:root {
  --bg: #f3f5f9; --panel: #ffffff; --panel-2: #f6f8fc; --text: #14213d; --muted: #667085; --line: #e3e8ef;
  --brand: #0b5fff; --brand-ink: #ffffff; --brand-soft: #e8f0ff; --danger: #d92d20; --ok: #12843b; --warn: #b54708;
  --shadow: 0 1px 2px rgba(16,24,40,.06), 0 8px 24px rgba(16,24,40,.06);
  --radius: 12px;
}
:root[data-theme="dark"] {
  --bg: #0b1220; --panel: #131c2e; --panel-2: #182338; --text: #e8eefc; --muted: #93a1bd; --line: #25324d;
  --brand: #4d8dff; --brand-ink: #06122b; --brand-soft: #14274d; --shadow: 0 1px 2px rgba(0,0,0,.4), 0 8px 24px rgba(0,0,0,.35);
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0b1220; --panel: #131c2e; --panel-2: #182338; --text: #e8eefc; --muted: #93a1bd; --line: #25324d;
    --brand: #4d8dff; --brand-ink: #06122b; --brand-soft: #14274d; --shadow: 0 1px 2px rgba(0,0,0,.4), 0 8px 24px rgba(0,0,0,.35);
  }
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body { font: 14px/1.45 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; background: var(--bg); color: var(--text); }
button, input, select, textarea { font: inherit; color: inherit; }
h1 { font-size: 22px; margin: 0 0 4px; font-weight: 650; }
h2 { font-size: 16px; margin: 0 0 8px; font-weight: 650; }
.muted { color: var(--muted); }
.small { font-size: 12px; }

/* ---- layout do painel ---- */
.shell { display: grid; grid-template-columns: 232px 1fr; height: 100vh; }
.side { padding: 16px 12px; display: flex; flex-direction: column; gap: 4px; border-right: 1px solid var(--line); background: var(--panel); }
.logo { display: flex; align-items: center; gap: 10px; padding: 6px 10px 16px; font-weight: 700; font-size: 16px; }
.logo i { width: 28px; height: 28px; border-radius: 8px; background: var(--brand); display: grid; place-items: center; color: var(--brand-ink); font-style: normal; font-size: 14px; }
.nav a { display: flex; gap: 10px; align-items: center; padding: 9px 12px; border-radius: 9px; color: var(--text); text-decoration: none; }
.nav a:hover { background: var(--panel-2); }
.nav a.on { background: var(--brand-soft); color: var(--brand); font-weight: 600; }
.side .grow { flex: 1; }
.usage { padding: 12px; border-radius: 10px; background: var(--panel-2); }
.bar { height: 6px; border-radius: 4px; background: var(--line); margin: 6px 0; overflow: hidden; }
.bar > span { display: block; height: 100%; background: var(--brand); }
.main { overflow: auto; padding: 28px 36px 60px; }
.topline { display: flex; align-items: center; justify-content: space-between; margin-bottom: 22px; gap: 12px; }
.who { display: flex; align-items: center; gap: 10px; }

/* ---- componentes ---- */
.btn { border: 1px solid var(--line); background: var(--panel); border-radius: 9px; padding: 8px 14px; cursor: pointer; }
.btn:hover { background: var(--panel-2); }
.btn.primary { background: var(--brand); border-color: var(--brand); color: var(--brand-ink); font-weight: 600; }
.btn.primary:hover { filter: brightness(1.08); }
.btn.danger { color: var(--danger); }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn.sm { padding: 5px 10px; font-size: 12px; }
.field { display: grid; gap: 5px; margin-bottom: 14px; }
.field label { font-size: 12px; color: var(--muted); font-weight: 600; }
.input, select.input, textarea.input { width: 100%; border: 1px solid var(--line); background: var(--panel); border-radius: 9px; padding: 9px 11px; }
.input:focus { outline: 2px solid var(--brand); outline-offset: -1px; }
.input.secret { -webkit-text-security: disc; text-security: disc; }
.card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); }
.grid4 { display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); gap: 16px; max-width: 980px; margin: 0 auto 40px; }
.create { padding: 26px 18px; text-align: center; cursor: pointer; border: 1px solid var(--line); background: var(--panel); border-radius: var(--radius); transition: .15s; }
.create:hover { background: var(--brand); color: var(--brand-ink); transform: translateY(-2px); }
.create:hover .muted { color: inherit; opacity: .85; }
.create .ico { width: 44px; height: 44px; margin: 0 auto 12px; border-radius: 12px; background: var(--brand-soft); color: var(--brand); display: grid; place-items: center; font-size: 20px; }
.create b { display: block; margin-bottom: 4px; }
table.t { width: 100%; border-collapse: collapse; }
.t th { text-align: left; font-size: 12px; color: var(--muted); font-weight: 600; padding: 8px 12px; }
.t td { padding: 11px 12px; border-top: 1px solid var(--line); vertical-align: middle; }
.badge { display: inline-block; padding: 2px 9px; border-radius: 99px; font-size: 12px; background: var(--panel-2); border: 1px solid var(--line); }
.badge.live { background: #fee4e2; color: var(--danger); border-color: #fecdca; }
.dest-badge { width: 34px; height: 34px; border-radius: 9px; display: inline-grid; place-items: center; color: #fff; font-weight: 700; font-size: 12px; flex: none; }
.row { display: flex; align-items: center; gap: 12px; }
.row.sp { justify-content: space-between; }
.empty { text-align: center; padding: 60px 20px; color: var(--muted); }
.modal-bg { position: fixed; inset: 0; background: rgba(10,16,30,.55); display: grid; place-items: center; z-index: 50; padding: 16px; }
.modal { width: min(560px, 100%); max-height: 92vh; overflow: auto; background: var(--panel); border-radius: 16px; padding: 22px; box-shadow: var(--shadow); }
.modal h2 { font-size: 18px; }
.modal .actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 8px; }
.kinds { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin: 12px 0; }
.kind { border: 1px solid var(--line); border-radius: 10px; padding: 14px 6px; text-align: center; cursor: pointer; background: var(--panel); }
.kind:hover { border-color: var(--brand); background: var(--brand-soft); }
.kind .dest-badge { margin-bottom: 6px; }
.check { display: flex; gap: 10px; align-items: center; padding: 9px 11px; border: 1px solid var(--line); border-radius: 9px; margin-bottom: 8px; cursor: pointer; }
.toast { position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%); background: #101828; color: #fff; padding: 10px 16px; border-radius: 10px; z-index: 99; box-shadow: var(--shadow); }
.toast.err { background: var(--danger); }
.seg { display: inline-flex; border: 1px solid var(--line); border-radius: 9px; overflow: hidden; }
.seg button { border: 0; background: var(--panel); padding: 7px 12px; cursor: pointer; }
.seg button.on { background: var(--brand-soft); color: var(--brand); font-weight: 600; }
video.player { width: 100%; max-height: 62vh; background: #000; border-radius: 10px; }

/* ---- login ---- */
.login { min-height: 100vh; display: grid; place-items: center; padding: 20px; }
.login .card { width: min(400px, 100%); padding: 30px; }
.login .logo { padding-left: 0; }

@media (max-width: 800px) {
  .shell { grid-template-columns: 1fr; grid-template-rows: auto 1fr; }
  .side { flex-direction: row; overflow-x: auto; border-right: 0; border-bottom: 1px solid var(--line); padding: 8px; }
  .side .logo, .side .grow, .usage { display: none; }
  .nav { display: flex; }
  .main { padding: 18px 16px 50px; }
}
