/* Halive · painel — sistema HALPHAR: Bangers (display), JetBrains Mono (rótulos), Noto Sans JP (corpo), paleta onyx.
   Acento do Halive: vermelho "ao vivo" #FF4F5E (pressed #E03A49). Fontes servidas daqui — nunca do Google. */

@font-face { font-family: 'Bangers'; src: url('/fonts/bangers-latin-400-normal.woff2') format('woff2'); font-display: block; }
@font-face { font-family: 'JetBrains Mono'; src: url('/fonts/jetbrains-mono-latin-400-normal.woff2') format('woff2'); font-weight: 400; font-display: swap; }
@font-face { font-family: 'JetBrains Mono'; src: url('/fonts/jetbrains-mono-latin-700-normal.woff2') format('woff2'); font-weight: 700; font-display: swap; }
@font-face { font-family: 'Noto Sans JP'; src: url('/fonts/noto-sans-jp-latin-400-normal.woff2') format('woff2'); font-weight: 400; font-display: swap; }
@font-face { font-family: 'Noto Sans JP'; src: url('/fonts/noto-sans-jp-latin-700-normal.woff2') format('woff2'); font-weight: 700; font-display: swap; }

:root {
  --bg: #0a0a0a;
  --panel: #161412;
  --elevated: #1e1b18;
  --ink: #f2efe9;
  --muted: rgba(255, 255, 255, 0.55);
  --faint: rgba(255, 255, 255, 0.35);
  --border: rgba(255, 255, 255, 0.1);
  --accent: #ff4f5e;
  --accent-pressed: #e03a49;
  --accent-soft: rgba(255, 79, 94, 0.14);
  --ok: #53d86a;
  --warn: #f2b84b;
  --twitch: #9146ff;
  --kick: #53fc18;
  --display: 'Bangers', system-ui, sans-serif;
  --mono: 'JetBrains Mono', ui-monospace, monospace;
  --body: 'Noto Sans JP', system-ui, sans-serif;
  --radius: 12px;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { margin: 0; min-height: 100%; }
body { background: var(--bg); color: var(--ink); font: 15px/1.5 var(--body); -webkit-font-smoothing: antialiased; }
a { color: var(--accent); }
button, input, textarea, select { font: inherit; color: inherit; }
::selection { background: var(--accent); color: #0a0a0a; }

.kicker { font: 700 11px/1 var(--mono); letter-spacing: 0.18em; text-transform: uppercase; color: var(--muted); }
.kicker.dim { color: var(--faint); }
.wordmark { font: 400 clamp(56px, 12vw, 96px)/0.9 var(--display); letter-spacing: 2.5px; margin: 0; text-align: center; }
.katakana { font: 400 14px/1 var(--body); letter-spacing: 0.4em; color: var(--accent); }

/* ── Botões ─────────────────────────────────────────────── */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 40px; padding: 0 16px; border-radius: 10px; border: 1px solid var(--border);
  background: var(--elevated); color: var(--ink); cursor: pointer; text-decoration: none;
  font: 700 12px/1 var(--mono); letter-spacing: 0.12em; text-transform: uppercase;
}
.btn:hover { border-color: rgba(255, 255, 255, 0.25); }
.btn:disabled { opacity: 0.5; cursor: default; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: #0a0a0a; }
.btn.primary:hover { background: var(--accent-pressed); border-color: var(--accent-pressed); }
.btn.ghost { background: transparent; }
.btn.danger { color: var(--accent); border-color: rgba(255, 79, 94, 0.4); background: transparent; }
.btn.small { min-height: 32px; padding: 0 12px; font-size: 11px; }
.btn.brand.twitch { background: var(--twitch); border-color: var(--twitch); color: #fff; }
.btn.brand.kick { background: var(--kick); border-color: var(--kick); color: #0a0a0a; }

/* ── Entrada ────────────────────────────────────────────── */
.login { min-height: 100vh; display: grid; place-items: center; padding: 24px 16px; }
.login-frame { width: min(440px, 100%); display: flex; flex-direction: column; align-items: center; gap: 16px; text-align: center; }
.login-copy { color: var(--muted); margin: 8px 0; }
.login-actions { display: flex; flex-direction: column; gap: 10px; width: 100%; margin: 8px 0 16px; }
.login-actions .btn { min-height: 48px; }

/* ── Estrutura ──────────────────────────────────────────── */
.shell { display: grid; grid-template-columns: 232px 1fr; min-height: 100vh; }
.side { border-right: 1px solid var(--border); padding: 24px 16px; display: flex; flex-direction: column; gap: 24px; position: sticky; top: 0; height: 100vh; }
.side .wordmark { font-size: 40px; text-align: left; }
.brandline { display: flex; flex-direction: column; gap: 8px; }
.nav { display: flex; flex-direction: column; gap: 4px; }
.nav button {
  text-align: left; background: none; border: 0; border-radius: 8px; padding: 10px 12px; cursor: pointer;
  font: 700 12px/1 var(--mono); letter-spacing: 0.12em; text-transform: uppercase; color: var(--muted);
}
.nav button:hover { color: var(--ink); background: var(--panel); }
.nav button[aria-current='page'] { color: var(--ink); background: var(--accent-soft); box-shadow: inset 3px 0 0 var(--accent); }
.side-foot { margin-top: auto; display: flex; flex-direction: column; gap: 8px; }
.who { font-size: 13px; color: var(--muted); overflow-wrap: anywhere; }

.main { padding: 32px clamp(16px, 4vw, 48px) 96px; max-width: 1040px; width: 100%; }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; margin-bottom: 24px; flex-wrap: wrap; }
.page-head h2 { font: 400 40px/1 var(--display); letter-spacing: 2px; margin: 6px 0 0; }
.page-head p { margin: 6px 0 0; color: var(--muted); max-width: 60ch; }

.grid { display: grid; gap: 16px; }
.grid.two { grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); }
.card { background: var(--panel); border: 1px solid var(--border); border-radius: var(--radius); padding: 20px; display: flex; flex-direction: column; gap: 14px; min-width: 0; }
.card > .pill, .card > .btn { align-self: flex-start; }
.card h3 { margin: 0; font: 700 12px/1 var(--mono); letter-spacing: 0.14em; text-transform: uppercase; color: var(--muted); }
.card .row { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.card .between { justify-content: space-between; }
.muted { color: var(--muted); }
.small { font-size: 13px; }

/* ── Plataformas e status ──────────────────────────────── */
.pill { display: inline-flex; align-items: center; gap: 6px; padding: 4px 10px; border-radius: 999px; border: 1px solid var(--border); font: 700 11px/1 var(--mono); letter-spacing: 0.1em; text-transform: uppercase; color: var(--muted); }
.pill.live { color: var(--accent); border-color: rgba(255, 79, 94, 0.45); }
.pill.live::before { content: ''; width: 8px; height: 8px; border-radius: 50%; background: var(--accent); animation: pulse 1.6s infinite; }
.pill.ok { color: var(--ok); border-color: rgba(83, 216, 106, 0.4); }
.pill.warn { color: var(--warn); border-color: rgba(242, 184, 75, 0.4); }
.pill.twitch { color: #bf94ff; border-color: rgba(145, 70, 255, 0.5); }
.pill.kick { color: var(--kick); border-color: rgba(83, 252, 24, 0.4); }
@keyframes pulse { 50% { opacity: 0.35; } }
@media (prefers-reduced-motion: reduce) { .pill.live::before { animation: none; } }
.stat { font: 400 32px/1 var(--display); letter-spacing: 1.5px; }

/* ── Formulários ────────────────────────────────────────── */
.field { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.field > span { font: 700 11px/1 var(--mono); letter-spacing: 0.12em; text-transform: uppercase; color: var(--muted); }
.field small { color: var(--faint); font-size: 12px; }
.input, .textarea, .select {
  width: 100%; background: var(--bg); border: 1px solid var(--border); border-radius: 10px; padding: 10px 12px; outline: none;
}
.textarea { min-height: 84px; resize: vertical; }
.input:focus, .textarea:focus, .select:focus { border-color: var(--accent); }
.fields { display: grid; gap: 14px; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); }

.toggle { display: inline-flex; align-items: center; gap: 10px; cursor: pointer; user-select: none; }
.toggle input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.toggle .track { width: 38px; height: 22px; border-radius: 999px; background: var(--elevated); border: 1px solid var(--border); position: relative; flex: none; transition: background 0.15s; }
.toggle .track::after { content: ''; position: absolute; top: 2px; left: 2px; width: 16px; height: 16px; border-radius: 50%; background: var(--muted); transition: transform 0.15s, background 0.15s; }
.toggle input:checked + .track { background: var(--accent-soft); border-color: var(--accent); }
.toggle input:checked + .track::after { transform: translateX(16px); background: var(--accent); }
.toggle input:focus-visible + .track { outline: 2px solid var(--accent); outline-offset: 2px; }

.chips { display: flex; gap: 6px; flex-wrap: wrap; }
.chip { border: 1px solid var(--border); background: transparent; border-radius: 999px; padding: 6px 12px; cursor: pointer; font: 700 11px/1 var(--mono); letter-spacing: 0.1em; text-transform: uppercase; color: var(--muted); }
.chip[aria-pressed='true'] { color: var(--ink); border-color: var(--accent); background: var(--accent-soft); }

/* ── Listas ─────────────────────────────────────────────── */
.list { display: flex; flex-direction: column; border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; }
.item { display: grid; grid-template-columns: auto minmax(0, 160px) minmax(0, 1fr) auto; align-items: center; gap: 14px; padding: 12px 16px; background: var(--panel); border-top: 1px solid var(--border); }
.item:first-child { border-top: 0; }
.item.selected { background: var(--elevated); box-shadow: inset 3px 0 0 var(--accent); }
.item .name { font: 700 13px/1.2 var(--mono); overflow-wrap: anywhere; }
.item .preview { color: var(--muted); font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.empty { padding: 24px; text-align: center; color: var(--muted); background: var(--panel); }

.log { display: flex; flex-direction: column; gap: 2px; font-size: 13px; }
.log-row { display: grid; grid-template-columns: 64px 72px minmax(0, 1fr); gap: 10px; padding: 6px 0; border-top: 1px solid var(--border); }
.log-row:first-child { border-top: 0; }
.log-row .when { color: var(--faint); font: 400 12px/1.4 var(--mono); }
.log-row .what { color: var(--muted); font: 700 11px/1.4 var(--mono); text-transform: uppercase; letter-spacing: 0.08em; overflow: hidden; text-overflow: ellipsis; }
.log-row .text { overflow-wrap: anywhere; }
.log-row.bad .text { color: var(--accent); }

.vars { display: flex; flex-wrap: wrap; gap: 6px; }
.vars code { font: 400 12px/1 var(--mono); background: var(--bg); border: 1px solid var(--border); border-radius: 6px; padding: 4px 6px; color: var(--muted); }

.savebar { position: sticky; bottom: 16px; display: flex; align-items: center; justify-content: flex-end; gap: 12px; margin-top: 20px; padding: 12px 16px; background: rgba(22, 20, 18, 0.92); border: 1px solid var(--border); border-radius: var(--radius); backdrop-filter: blur(8px); }
.savebar .muted { margin-right: auto; font-size: 13px; }

.answer { background: var(--bg); border: 1px solid var(--border); border-radius: 10px; padding: 12px; overflow-wrap: anywhere; }

/* ── Avisos ─────────────────────────────────────────────── */
.toasts { position: fixed; right: 16px; bottom: 16px; display: flex; flex-direction: column; gap: 8px; z-index: 10; max-width: calc(100vw - 32px); }
.toast { background: var(--elevated); border: 1px solid var(--border); border-left: 3px solid var(--ok); border-radius: 10px; padding: 12px 16px; max-width: 380px; box-shadow: 0 8px 24px rgba(0, 0, 0, 0.4); }
.toast.bad { border-left-color: var(--accent); }

/* ── Celular ────────────────────────────────────────────── */
@media (max-width: 760px) {
  .shell { grid-template-columns: 1fr; }
  .side { position: static; height: auto; border-right: 0; border-bottom: 1px solid var(--border); padding: 16px; gap: 12px; }
  .side .wordmark { font-size: 32px; }
  .brandline { flex-direction: row; align-items: baseline; gap: 12px; }
  .nav { flex-direction: row; overflow-x: auto; scrollbar-width: none; }
  .nav button { white-space: nowrap; }
  .nav button[aria-current='page'] { box-shadow: inset 0 -2px 0 var(--accent); }
  .side-foot { flex-direction: row; align-items: center; justify-content: space-between; margin-top: 0; }
  .main { padding: 24px 16px 96px; }
  .item { grid-template-columns: auto minmax(0, 1fr) auto; }
  .item .preview { display: none; }
  .log-row { grid-template-columns: 52px minmax(0, 1fr); }
  .log-row .what { display: none; }
}
