/* Design system "estúdio editorial escuro" (luz baixa) — decisão 2026-07-15, ver MEMORY.md.
   Paleta v2: grafite (nunca preto absoluto) + cobre dessaturado; accent SÓ para ação/atenção. */

/* Webfonts self-hosted (regra do projeto: sem CDN em runtime).
   Archivo Narrow = variável (um arquivo cobre 400–700). */
@font-face {
  font-family: "Archivo Narrow";
  src: url("fonts/ArchivoNarrow-var.woff2") format("woff2");
  font-weight: 400 700;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "IBM Plex Mono";
  src: url("fonts/IBMPlexMono-400.woff2") format("woff2");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "IBM Plex Mono";
  src: url("fonts/IBMPlexMono-500.woff2") format("woff2");
  font-weight: 500;
  font-style: normal;
  font-display: swap;
}

:root {
  --bg: #15171d;            /* fundo grafite */
  --panel: #1a1d24;         /* superfície */
  --panel-2: #21242d;       /* elevação / inset */
  --panel-3: #282c37;       /* hover */
  --border: rgba(168, 180, 206, 0.12);
  --text: #d5d9e2;          /* um tom abaixo do branco */
  --muted: #8b91a1;
  --accent: #d08a54;        /* cobre — links ativos e hover de botão */
  --accent-strong: #c17d47; /* fundo de botão primário / marcadores ativos */
  --accent-ink: #1c130b;    /* texto sobre accent */
  --green: #79b892;
  --red: #c97d74;
  --red-btn: #9c4f47;       /* fundo de botão danger — contraste ok com texto branco */
  --yellow: #c9a35f;
  --chart: #5f97d6;         /* cor de DADOS (gráficos) — nunca ação nem status; validada p/ o fundo escuro */
  /* três vozes tipográficas: display condensado / corpo / mono p/ timecode-id-log */
  --font-disp: "Archivo Narrow", "Bahnschrift", "Arial Narrow", "Segoe UI", sans-serif;
  --font-body: "Segoe UI Variable Text", "Segoe UI", system-ui, -apple-system, Roboto, sans-serif;
  --font-mono: "IBM Plex Mono", "Cascadia Mono", Consolas, ui-monospace, monospace;
}
* { box-sizing: border-box; }
body {
  margin: 0;
  font-family: var(--font-body);
  background: var(--bg);
  color: var(--text);
  font-size: 15px;
  font-variant-numeric: tabular-nums;
}
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 3px; }

/* Casca: sidebar fixa à esquerda + conteúdo (substituiu o nav horizontal na fase 2) */
.shell { display: grid; grid-template-columns: 216px minmax(0, 1fr); min-height: 100vh; }
.content { min-width: 0; }
.rail {
  background: var(--panel);
  border-right: 1px solid var(--border);
  padding: 18px 12px 14px;
  display: flex;
  flex-direction: column;
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
}
.rail .brand {
  font-family: var(--font-disp);
  font-weight: 700;
  font-size: 16.5px;
  line-height: 1.2;
  letter-spacing: 0.02em;
  color: var(--text);
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 4px 10px 16px;
}
.rail .brand:hover { text-decoration: none; }
.rail__nav { display: flex; flex-direction: column; gap: 4px; }
.rail .grp {
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--muted);
  opacity: 0.75;
  padding: 14px 10px 6px;
}
.rail__nav a {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 7px 10px;
  border-radius: 8px;
  color: var(--muted);
  font-size: 14px;
  font-weight: 500;
}
.rail__nav a:hover { color: var(--text); background: var(--panel-2); text-decoration: none; }
.rail__nav a.on { color: var(--text); background: var(--panel-2); box-shadow: inset 2px 0 0 var(--accent-strong); }
.rail__nav a .n {
  margin-left: auto;
  font-family: var(--font-disp);
  font-size: 12.5px;
  font-weight: 600;
  background: var(--panel-3);
  border-radius: 20px;
  padding: 1px 8px;
  color: var(--text);
}
.rail__nav a .n.hot { background: var(--accent-strong); color: var(--accent-ink); font-weight: 700; }
.rail__foot { margin-top: auto; padding: 12px 10px 4px; color: var(--muted); font-size: 13px; }
.rail__foot:hover { color: var(--text); text-decoration: none; }

main { padding: 24px 32px 40px; max-width: 1200px; margin: 0 auto; }
h1 {
  font-family: var(--font-disp);  font-weight: 600;
  font-size: 26px;
  letter-spacing: 0.01em;
  margin: 0 0 20px;
}
h2 {
  font-family: var(--font-disp);  font-weight: 600;
  font-size: 16px;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--muted);
  margin: 26px 0 12px;
}

.cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 16px; }
.card {
  background: linear-gradient(180deg, var(--panel-2), var(--panel));
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 18px;
}
.card .num {
  font-family: var(--font-disp);  font-weight: 700;
  font-size: 36px;
  line-height: 1.1;
  font-variant-numeric: tabular-nums;
}
.card .label { color: var(--muted); font-size: 13px; margin-top: 4px; }

/* A esteira (dashboard): o funil do pipeline em uma linha; estágios que
   dependem do operador ganham .act (cobre), automáticos mostram pulso. */
.belt {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  border: 1px solid var(--border);
  border-radius: 12px;
  background: linear-gradient(180deg, var(--panel-2), var(--panel));
  overflow: hidden;
}
.belt a {
  padding: 16px 18px 14px;
  text-decoration: none;
  color: inherit;
  position: relative;
  border-right: 1px solid var(--border);
  min-width: 0;
}
.belt a:last-child { border-right: none; }
.belt a:hover { background: var(--panel-3); text-decoration: none; }
.belt a::after {
  content: "›";
  position: absolute;
  right: -7px;
  top: 50%;
  transform: translateY(-58%);
  color: var(--muted);
  font-size: 18px;
  z-index: 1;
  opacity: 0.7;
}
.belt a:last-child::after { content: none; }
.belt .k {
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--muted);
  display: flex;
  align-items: center;
  gap: 7px;
}
.belt .v {
  display: block;
  font-family: var(--font-disp);
  font-weight: 700;
  font-size: 38px;
  line-height: 1.15;
  margin-top: 2px;
  font-variant-numeric: tabular-nums;
}
.belt .d { display: block; font-size: 12px; color: var(--muted); line-height: 1.35; }
.belt a.act .v { color: var(--accent); }
.belt a.act .d { color: var(--text); }
.dot { width: 7px; height: 7px; border-radius: 50%; display: inline-block; flex-shrink: 0; }
.dot.run { background: var(--yellow); animation: pulse 1.6s ease-in-out infinite; }
.dot.ok { background: var(--green); }
@keyframes pulse { 50% { opacity: 0.35; } }

/* Recursos de sistema (linha quieta sob a esteira): quota, disco */
.sysrow { display: flex; gap: 26px; margin-top: 14px; padding: 0 4px; flex-wrap: wrap; }
.sysrow .item { display: flex; align-items: center; gap: 10px; font-size: 12.5px; color: var(--muted); }
.sysrow .bar { width: 90px; height: 4px; border-radius: 2px; background: var(--panel-3); overflow: hidden; }
.sysrow .bar > i { display: block; height: 100%; background: var(--muted); }
.sysrow .bar > i.warn { background: var(--red); }
.sysrow b { color: var(--text); font-weight: 600; font-variant-numeric: tabular-nums; }

.panel {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 18px;
  margin-bottom: 20px;
  overflow-x: auto;
}

table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: 10px 12px; border-bottom: 1px solid var(--border); }
th {
  font-family: var(--font-mono);
  font-size: 10.5px;
  letter-spacing: 0.13em;
  text-transform: uppercase;
  font-weight: 500;
  color: var(--muted);
}
tr:last-child td { border-bottom: none; }
tbody tr:hover { background: var(--panel-2); }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; }
/* título como texto (accent é ação, não link) + linha de contexto embaixo */
.title-link { color: var(--text); font-weight: 500; }
.title-link:hover { color: var(--accent); text-decoration: none; }
td .sub { display: block; color: var(--muted); font-size: 12px; font-weight: 400; margin-top: 1px; }

.badge {
  display: inline-block;
  padding: 2px 10px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 600;
  background: var(--panel-2);
  color: var(--muted);
  white-space: nowrap;
}
/* origem: chip discreto de contorno (a cor fica reservada p/ status) */
.badge.manual, .badge.channel, .badge.topic {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--muted);
  font-weight: 500;
}
.badge.ok { background: rgba(121, 184, 146, 0.10); color: var(--green); }
.badge.fail { background: rgba(201, 125, 116, 0.11); color: var(--red); }
.badge.run { background: rgba(201, 163, 95, 0.10); color: var(--yellow); }
.badge.wait { color: var(--text); }  /* esperando o operador */
/* success com falha em passo best-effort: verde + ponto dourado (sutil) */
.badge.ok.warn::after { content: "●"; color: var(--yellow); font-size: 9px; margin-left: 5px; vertical-align: 1px; }

/* Tabs (aba Jobs: Histórico / Agendados) — sublinhado sutil, como o nav do topo */
.tabs { display: flex; gap: 22px; border-bottom: 1px solid var(--border); margin-bottom: 16px; }
.tabs .tab {
  background: none;
  border: none;
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
  color: var(--muted);
  padding: 6px 2px 10px;
  cursor: pointer;
  font-family: var(--font-disp);  font-size: 14.5px;
  font-weight: 600;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}
.tabs .tab:hover { color: var(--text); }
.tabs .tab.active { color: var(--text); border-bottom-color: var(--accent-strong); }

/* Chips de filtro rápido (Jobs, Vídeos) — servem p/ <button> e <a> */
.chips { display: flex; gap: 6px; }
.chips .chip {
  display: inline-block;
  background: transparent;
  border: 1px solid var(--border);
  color: var(--muted);
  padding: 3px 12px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  text-decoration: none;
}
.chips a.chip:hover { text-decoration: none; }
.chips .chip:hover { background: transparent; color: var(--text); }
.chips .chip.active { border-color: var(--accent-strong); color: var(--accent); }

/* Cards-acordeão (Canais / Tópicos): linha compacta, expande p/ configurar */
details.acc > summary {
  display: flex;
  align-items: center;
  gap: 14px;
  cursor: pointer;
  list-style: none;
  user-select: none;
}
details.acc > summary::-webkit-details-marker { display: none; }
details.acc > summary::before {
  content: "▸";
  color: var(--muted);
  font-size: 13px;
  transition: transform 0.15s;
  flex-shrink: 0;
}
details.acc[open] > summary::before { transform: rotate(90deg); }
.acc__head { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; flex: 1; min-width: 0; }
.acc__actions { margin-left: auto; flex-shrink: 0; }
.acc__body { margin-top: 14px; padding-top: 14px; border-top: 1px solid var(--border); }

input, textarea, select {
  width: 100%;
  padding: 9px 11px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text);
  font-family: inherit;
  font-size: 14px;
}
textarea { resize: vertical; min-height: 60px; }
label { display: block; color: var(--muted); font-size: 13px; margin: 12px 0 5px; }

button, .btn {
  display: inline-block;
  padding: 8px 16px;
  border: none;
  border-radius: 8px;
  background: var(--accent-strong);
  color: var(--accent-ink);
  font-family: var(--font-body);
  font-weight: 600;
  font-size: 14px;
  cursor: pointer;
  transition: background-color 0.2s ease, opacity 0.2s ease;
}
button:hover, .btn:hover { background: var(--accent); text-decoration: none; }
button.secondary, .btn.secondary { background: var(--panel-2); color: var(--text); border: 1px solid var(--border); }
button.secondary:hover, .btn.secondary:hover { background: var(--panel-3); }
button.danger, .btn.danger { background: var(--red-btn); color: #fff; }
button.danger:hover, .btn.danger:hover { background: #8a423b; }
button.danger.secondary { background: transparent; color: var(--red); border: 1px solid rgba(201, 125, 116, 0.4); }
button.danger.secondary:hover { background: rgba(201, 125, 116, 0.10); }
button.ok { background: var(--green); color: var(--accent-ink); }
button.ok:hover { background: #8ac6a2; }
button:disabled { opacity: 0.55; cursor: wait; }
button.loading::after {
  content: "";
  display: inline-block;
  width: 11px;
  height: 11px;
  margin-left: 8px;
  vertical-align: -1px;
  border: 2px solid currentColor;
  border-right-color: transparent;
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
.btn-row { display: flex; gap: 8px; flex-wrap: wrap; }
.btn-row.nowrap { flex-wrap: nowrap; }
/* Botões compactos p/ células de tabela (ações por linha) */
button.btn-sm, .btn.btn-sm { padding: 4px 10px; font-size: 12.5px; border-radius: 6px; white-space: nowrap; }

.inline-form { display: inline; }
/* Selects compactos: em célula de tabela e em formulário de uma linha o
   width:100% padrão dos campos quebraria o layout. */
select.sel-sm { width: auto; padding: 4px 9px; font-size: 12.5px; border-radius: 6px; }

/* Revisão de clips: um card por clip, decisão em primeiro plano */
.review { display: flex; flex-direction: column; gap: 14px; }
.rev-card {
  display: grid;
  grid-template-columns: 250px minmax(0, 1fr);
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 12px;
  overflow: hidden;
}
.rev-card .player {
  position: relative;
  background: #000;
  border-right: 1px solid var(--border);
  display: flex;
  align-items: center;
}
.rev-card .player video { display: block; width: 100%; max-height: 445px; }
.rev-card .player .fmt {
  position: absolute;
  top: 10px;
  left: 10px;
  z-index: 2;
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--text);
  background: rgba(10, 11, 15, 0.78);
  border-radius: 5px;
  padding: 3px 8px;
  pointer-events: none;
}
.rev-body { padding: 18px 22px; display: flex; flex-direction: column; gap: 13px; }
.rev-top { display: flex; gap: 18px; align-items: flex-start; }
/* Aviso do render no card de revisão (ex.: legenda não queimada). Dourado, não
   vermelho: o clip está pronto, só saiu com uma etapa best-effort a menos. */
.rev-warn {
  background: rgba(201, 163, 95, 0.10);
  border-left: 3px solid var(--yellow);
  border-radius: 6px;
  padding: 9px 12px;
  font-size: 13px;
  color: var(--text);
}
.rev-warn p { margin: 0; }
.rev-warn p + p { margin-top: 5px; }
.score-blk { text-align: center; flex-shrink: 0; }
.score-blk .s {
  font-family: var(--font-disp);
  font-weight: 700;
  font-size: 44px;
  line-height: 1;
  color: var(--green);
}
.score-blk .s.mid { color: var(--yellow); }
.score-blk .s.low { color: var(--red); }
.score-blk .k {
  font-family: var(--font-mono);
  font-size: 9.5px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--muted);
}
.hook { margin: 0; padding-left: 14px; border-left: 3px solid var(--accent-strong); }
.hook p { margin: 0; font-size: 16.5px; font-weight: 600; line-height: 1.35; text-wrap: balance; }
.hook cite { font-style: normal; font-size: 12.5px; color: var(--muted); display: block; margin-top: 5px; }
.rev-grid { display: grid; grid-template-columns: 2fr 1fr; gap: 12px; }
.rev-grid label, .rev-body label { margin-top: 0; }
.rev-actions {
  display: flex;
  gap: 8px;
  align-items: flex-end;
  flex-wrap: wrap;
  border-top: 1px solid var(--border);
  padding-top: 14px;
}
.rev-actions .trim { display: flex; gap: 8px; align-items: flex-end; }
.rev-actions .trim .field { width: 104px; }
.rev-actions .trim input { font-family: var(--font-mono); font-size: 13px; }
.rev-actions .spacer { flex: 1; }

/* legado (vídeo dentro de painel genérico) */
.clip-card video { width: 100%; border-radius: 8px 8px 0 0; background: #000; display: block; }
.clip-card { background: var(--panel); border: 1px solid var(--border); border-radius: 12px; overflow: hidden; }
.clip-card .body { padding: 14px; }
.score {
  font-family: var(--font-disp);  font-weight: 700;
  color: var(--green);
}
.muted { color: var(--muted); }
.small { font-size: 13px; }
.mono { font-family: var(--font-mono); font-size: 12.5px; }
/* Toasts (substituem flash/alert/confirm — regra: nunca window.alert/confirm) */
.toasts { position: fixed; top: 16px; right: 16px; z-index: 1000; display: flex; flex-direction: column; gap: 10px; max-width: min(92vw, 380px); pointer-events: none; }
.toast { pointer-events: auto; background: var(--panel-2); border: 1px solid var(--border); border-left: 3px solid var(--accent); border-radius: 8px; padding: 12px 14px; box-shadow: 0 8px 24px rgba(0,0,0,.3); animation: toast-in .18s ease-out; }
.toast--ok { border-left-color: var(--green); }
.toast--erro { border-left-color: var(--red); }
.toast--confirm { border-left-color: var(--accent-strong); }
.toast--out { opacity: 0; transform: translateX(8px); transition: opacity .2s, transform .2s; }
.toast__msg { display: block; font-size: 14px; color: var(--text); }
.toast__actions { display: flex; gap: 8px; justify-content: flex-end; margin-top: 10px; }
.toast__actions button { padding: 6px 12px; font-size: 13px; }
@keyframes toast-in { from { opacity: 0; transform: translateX(12px); } to { opacity: 1; transform: none; } }

/* Diálogos (caixa de configuração — ex.: reagendar publicação) */
dialog.dialog { background: var(--panel); color: var(--text); border: 1px solid var(--border); border-radius: 12px; padding: 20px; max-width: min(92vw, 400px); box-shadow: 0 16px 48px rgba(0,0,0,.45); }
dialog.dialog::backdrop { background: rgba(10, 11, 15, 0.6); }
dialog.dialog h3 { font-family: var(--font-disp); font-weight: 600; margin: 0 0 14px; }
dialog.dialog label { display: block; font-size: 13px; color: var(--muted); margin-bottom: 14px; }
dialog.dialog input[type="datetime-local"] { display: block; margin-top: 6px; width: 100%; }

/* Reagendar (modal "Schedule Event"): calendário + SET TIME (spinners/sliders/leitura) */
.dialog--wide { max-width: min(94vw, 560px); }
.dialog--xwide { max-width: min(94vw, 820px); }
.sched { display: flex; gap: 20px; align-items: flex-start; margin-bottom: 16px; flex-wrap: wrap; }
.cal { flex: 1; min-width: 200px; }
.cal-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 8px; }
.cal-title { font-family: var(--font-disp); font-weight: 600; font-size: 14.5px; }
.cal-nav { padding: 2px 10px; font-size: 16px; line-height: 1; }
.cal-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 2px; }
.cal-wd { text-align: center; font-family: var(--font-mono); font-size: 10px; text-transform: uppercase; color: var(--muted); padding: 4px 0; }
.cal-day { background: transparent; color: var(--text); border: 1px solid transparent; border-radius: 6px; padding: 6px 0; font-size: 13px; }
.cal-day:hover { background: var(--panel-2); }
.cal-day.sel { background: var(--accent-strong); color: var(--accent-ink); font-weight: 700; }
.settime { flex: 1; min-width: 200px; background: var(--panel-2); border: 1px solid var(--border); border-radius: 10px; padding: 14px 16px; }
.settime-label { font-family: var(--font-mono); font-size: 10.5px; letter-spacing: .13em; text-transform: uppercase; color: var(--muted); margin-bottom: 10px; }
.spinner-row { display: flex; align-items: center; justify-content: center; gap: 10px; margin-bottom: 14px; }
.spinner { display: flex; flex-direction: column; align-items: center; gap: 4px; }
.spin { padding: 2px 12px; font-size: 12px; line-height: 1; }
.spin-num { font-family: var(--font-disp); font-size: 36px; font-weight: 700; font-variant-numeric: tabular-nums; }
.spin-colon { font-family: var(--font-disp); font-size: 32px; font-weight: 700; }
.slider-label { display: flex; justify-content: space-between; font-size: 12px; color: var(--muted); margin: 8px 0 4px; }
.settime input[type="range"] { width: 100%; accent-color: var(--accent-strong); }
.active-sel { margin-top: 14px; text-align: center; background: var(--panel); border: 1px solid var(--border); border-radius: 8px; padding: 8px; }
.active-sel-val { font-weight: 600; font-size: 14px; margin-top: 2px; }

/* Botões-ícone (ações compactas na fila) */
.icon-btn { display: inline-flex; align-items: center; justify-content: center; width: 32px; height: 32px; padding: 0; background: var(--panel-2); color: var(--text); border: 1px solid var(--border); border-radius: 6px; }
.icon-btn:hover { background: var(--panel-3); }
.icon-btn.danger { background: var(--panel-2); color: var(--red); border-color: rgba(201, 125, 116, 0.4); }
.icon-btn.danger:hover { background: rgba(201, 125, 116, 0.10); }
.icon-btn.ok { background: var(--panel-2); color: var(--green); border-color: rgba(121, 184, 146, 0.4); }
.icon-btn.ok:hover { background: rgba(121, 184, 146, 0.10); }

/* Cards clicáveis (dashboard) */
a.card { color: inherit; text-decoration: none; display: block; }
a.card:hover { border-color: var(--accent); }

/* Linhas de job clicáveis + detalhe no modal */
tr.clickable-row { cursor: pointer; }
tr.clickable-row:hover { background: var(--panel-2); }
.job-meta { display: grid; grid-template-columns: 1fr 1fr; gap: 6px 16px; margin: 12px 0 16px; font-size: 13px; }
.job-meta .k { display: block; font-family: var(--font-mono); font-size: 10px; text-transform: uppercase; letter-spacing: .1em; color: var(--muted); }

.meter { display: block; height: 5px; border-radius: 3px; background: var(--panel-2); overflow: hidden; margin-top: 8px; }
.meter > span { display: block; height: 100%; border-radius: 3px; background: var(--accent-strong); }
.meter.warn > span { background: var(--red); }
.scorebar { display: inline-block; width: 64px; height: 5px; border-radius: 3px; background: var(--panel-2); overflow: hidden; vertical-align: middle; margin-left: 8px; }
.scorebar > span { display: block; height: 100%; border-radius: 3px; background: var(--chart); }

/* Barra de magnitude inline (tabelas de insights) — comprimento = valor/máximo da tabela */
.vbar { display: inline-block; width: 84px; height: 5px; border-radius: 3px; background: var(--panel-2); overflow: hidden; vertical-align: middle; margin-left: 8px; }
.vbar > span { display: block; height: 100%; border-radius: 3px; background: var(--chart); }

/* Sparkline da curva de retenção (SVG server-side; linha tracejada = 100%) */
.spark { display: block; }
.spark__line { fill: none; stroke: var(--chart); stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; }
.spark__fill { fill: var(--chart); opacity: 0.12; }
.spark__ref { stroke: var(--border); stroke-dasharray: 3 3; }
.spark__dot { fill: var(--chart); }

/* Aviso inline (retenção indisponível, erro de vídeo) */
.flash {
  background: rgba(201, 163, 95, 0.08);
  border: 1px solid rgba(201, 163, 95, 0.35);
  border-radius: 10px;
  padding: 12px 14px;
  margin-bottom: 16px;
  font-size: 14px;
}
pre.log { background: var(--bg); border: 1px solid var(--border); border-radius: 8px; padding: 12px; overflow-x: auto; font-family: var(--font-mono); font-size: 12px; white-space: pre-wrap; overflow-wrap: anywhere; }

/* Config em seções: índice lateral fixo + linhas label/controle + salvar por seção */
.cfg { display: grid; grid-template-columns: 180px minmax(0, 1fr); gap: 24px; align-items: start; }
.cfg-toc { position: sticky; top: 20px; display: flex; flex-direction: column; gap: 2px; }
.cfg-toc a {
  color: var(--muted);
  font-size: 13.5px;
  padding: 6px 12px;
  border-left: 2px solid var(--border);
}
.cfg-toc a:hover { color: var(--text); text-decoration: none; }
.cfg-toc a.on { color: var(--text); border-left-color: var(--accent-strong); }
.cfg-sec h3 { font-family: var(--font-disp); font-weight: 600; font-size: 17px; margin: 0 0 4px; }
.cfg-sec .desc { color: var(--muted); font-size: 13px; margin: 0 0 6px; }
.cfg-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 300px;
  gap: 24px;
  align-items: center;
  padding: 13px 0;
  border-top: 1px solid var(--border);
}
.cfg-row:first-of-type { border-top: none; }
.cfg-row--stack { display: block; }
.cfg-row--stack .ctl { margin-top: 8px; }
.cfg-row--wide { grid-template-columns: minmax(0, 1fr) 440px; }
.cfg-row--wide .ctl { flex-wrap: wrap; }
.cfg-row .lbl b { display: block; font-size: 14px; font-weight: 600; }
.cfg-row .lbl span { font-size: 12.5px; color: var(--muted); }
.cfg-row .ctl { display: flex; gap: 8px; justify-content: flex-end; align-items: center; }
.cfg-row .ctl .w-s { width: 90px; flex: none; }
.cfg-save { display: flex; justify-content: flex-end; border-top: 1px solid var(--border); padding-top: 14px; }

/* Toggle (hidden 'false' + checkbox 'true' com o mesmo name — ver update_settings) */
.switch { position: relative; display: inline-block; width: 40px; height: 22px; flex-shrink: 0; }
.switch input[type="checkbox"] { position: absolute; inset: 0; width: 100%; height: 100%; opacity: 0; margin: 0; cursor: pointer; }
.switch .knob {
  position: absolute; inset: 0; border-radius: 20px;
  background: var(--panel-3); border: 1px solid var(--border);
  transition: background-color 0.15s ease;
  pointer-events: none;
}
.switch .knob::after {
  content: ""; position: absolute; top: 2px; left: 2px;
  width: 16px; height: 16px; border-radius: 50%; background: #d9dce3;
  transition: left 0.15s ease;
}
.switch input:checked + .knob { background: var(--accent-strong); border-color: var(--accent-strong); }
.switch input:checked + .knob::after { left: 20px; background: var(--accent-ink); }
.switch input:focus-visible + .knob { outline: 2px solid var(--accent); outline-offset: 2px; }

@media (max-width: 820px) {
  /* sidebar vira barra horizontal rolável no mobile */
  .shell { grid-template-columns: 1fr; }
  .rail {
    position: static;
    height: auto;
    flex-direction: row;
    align-items: center;
    gap: 4px;
    padding: 8px 12px;
    border-right: none;
    border-bottom: 1px solid var(--border);
    overflow-x: auto;
  }
  .rail .brand { padding: 4px 8px; white-space: nowrap; }
  .rail .brand img { height: 20px; }
  .rail__nav { flex-direction: row; align-items: center; }
  .rail__nav a { white-space: nowrap; padding: 6px 9px; }
  .rail .grp { display: none; }
  .rail__foot { margin-top: 0; margin-left: auto; padding: 6px 8px; }
  main { padding: 16px; }
  .belt { grid-template-columns: repeat(2, 1fr); }
  .belt a::after { content: none; }
  .cfg { grid-template-columns: 1fr; }
  .cfg-toc { position: static; flex-direction: row; flex-wrap: wrap; gap: 6px; }
  .cfg-toc a { border-left: none; border: 1px solid var(--border); border-radius: 20px; padding: 4px 12px; font-size: 12.5px; }
  .cfg-toc a.on { border-color: var(--accent-strong); color: var(--accent); }
  .cfg-row { grid-template-columns: 1fr; gap: 8px; }
  .cfg-row .ctl { justify-content: flex-start; }
  .rev-card { grid-template-columns: 1fr; }
  .rev-card .player { border-right: none; border-bottom: 1px solid var(--border); justify-content: center; }
  .rev-card .player video { max-height: 340px; }
  .rev-grid { grid-template-columns: 1fr; }
}

/* Envio de vídeo autoral: alvo de arrastar + barra do progresso real */
.upload-drop {
  border: 1px dashed var(--border);
  border-radius: 8px;
  background: var(--panel-2);
  padding: 26px 18px;
  text-align: center;
  transition: border-color .15s, background .15s;
}
.upload-drop.over {
  border-color: var(--accent-strong);
  background: var(--panel-3);
}
.upload-progress { margin-top: 14px; }
.upload-bar {
  height: 8px;
  border-radius: 999px;
  background: var(--panel-3);
  overflow: hidden;
}
.upload-bar span {
  display: block;
  height: 100%;
  width: 0;
  background: var(--accent-strong);
  transition: width .2s linear;
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; animation: none !important; }
}
