/* ShadowScan — identidade do painel
   Paleta: #A3B18A sálvia · #DAD7CD pedra · #588157 folha · #3A5A40 musgo · #344E41 floresta
   Tipografia: Plus Jakarta Sans. Cartões grandes e arredondados, chips em pílula,
   navegação lateral em floresta. */

:root {
  --sage: #A3B18A;
  --stone: #DAD7CD;
  --leaf: #588157;
  --moss: #3A5A40;
  --forest: #344E41;

  --canvas: #ECEAE3;
  --surface: #F8F7F3;
  --surface-2: #E3E0D7;
  --ink: #1E2B24;
  --ink-2: #344E41;
  --muted: #5E6B60;
  --line: #D6D2C6;
  --accent: #588157;
  --accent-strong: #3A5A40;
  --on-accent: #F8F7F3;
  --side: #344E41;
  --side-ink: #DAD7CD;
  --side-muted: #A3B18A;

  --ok: #3A5A40;       --ok-bg: #D5E0C8;
  --warn: #8A5A12;     --warn-bg: #F1DDB4;
  --bad: #9C3B26;      --bad-bg: #F2D2C7;
  --busy: #2F5A4F;     --busy-bg: #CFE0DA;

  --radius: 20px;
  --radius-sm: 12px;
  --shadow: 0 1px 2px rgba(52, 78, 65, .06), 0 10px 28px -16px rgba(52, 78, 65, .35);
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root {
    --canvas: #121915;
    --surface: #1A241E;
    --surface-2: #233029;
    --ink: #E8E6DE;
    --ink-2: #DAD7CD;
    --muted: #9CA896;
    --line: #2C3A32;
    --accent: #A3B18A;
    --accent-strong: #B9C5A3;
    --on-accent: #16201A;
    --side: #0E1511;
    --side-ink: #DAD7CD;
    --side-muted: #8A9880;

    --ok: #BFD3A8;       --ok-bg: #2C4232;
    --warn: #F0CC86;     --warn-bg: #4A3A1C;
    --bad: #F3B3A1;      --bad-bg: #4D2A22;
    --busy: #B5D6CC;     --busy-bg: #22403A;
    --shadow: 0 1px 2px rgba(0, 0, 0, .25), 0 12px 30px -18px rgba(0, 0, 0, .7);
    color-scheme: dark;
  }
}

* { box-sizing: border-box; min-width: 0; }
html, body { margin: 0; }
body {
  background: var(--canvas);
  color: var(--ink);
  font: 15px/1.5 "Plus Jakarta Sans", system-ui, -apple-system, "Segoe UI", sans-serif;
  -webkit-font-smoothing: antialiased;
}
a { color: var(--accent-strong); }
img { max-width: 100%; }

/* ---------- estrutura ---------- */
.shell { display: grid; grid-template-columns: 248px minmax(0, 1fr); min-height: 100vh; }
.side {
  position: sticky; top: 0; height: 100vh;
  background: var(--side); color: var(--side-ink);
  display: flex; flex-direction: column; gap: 28px;
  padding: 24px 16px;
}
.brand { display: flex; align-items: center; gap: 12px; text-decoration: none; color: var(--side-ink); padding: 0 8px; }
.brand img { border-radius: 12px; flex: none; }
.brand-text { display: grid; line-height: 1.15; }
.brand-text b { font-size: 19px; font-weight: 800; letter-spacing: -.02em; }
.brand-text small { font-size: 12px; color: var(--side-muted); }
.nav { display: grid; gap: 4px; }
.nav a {
  display: flex; align-items: center; gap: 12px;
  color: var(--side-ink); text-decoration: none; font-weight: 600;
  padding: 11px 14px; border-radius: 14px; opacity: .82;
}
.nav a:hover { background: rgba(218, 215, 205, .08); opacity: 1; }
.nav a.on { background: var(--sage); color: #1E2B24; opacity: 1; }
.nav svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.9; stroke-linecap: round; stroke-linejoin: round; flex: none; }
.nav svg .fill { fill: currentColor; stroke: none; }
.side-foot { margin-top: auto; font-size: 12px; color: var(--side-muted); padding: 0 10px; letter-spacing: .04em; }

.main { padding: 28px clamp(16px, 3vw, 40px) 48px; max-width: 1320px; width: 100%; }

/* cabeçalho de página */
.page-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 16px; flex-wrap: wrap; margin-bottom: 20px; }
.page-head h1 { font-size: clamp(26px, 3vw, 34px); font-weight: 800; letter-spacing: -.025em; line-height: 1.1; margin: 0; color: var(--ink); }
.page-head p { margin: 6px 0 0; color: var(--muted); max-width: 64ch; }

/* ---------- superfícies ---------- */
.panel {
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 20px 22px; margin-bottom: 18px;
  box-shadow: var(--shadow);
}
.panel h2, .panel h3 { letter-spacing: -.015em; }
.panel > h3:first-child, .panel h3[style*="margin-top:0"] { font-size: 18px; font-weight: 700; }
details.panel > summary { cursor: pointer; list-style: none; font-size: 16px; }
details.panel > summary::-webkit-details-marker { display: none; }
details.panel > summary::before { content: "▸"; color: var(--accent); margin-right: 8px; display: inline-block; transition: transform .15s; }
details.panel[open] > summary::before { transform: rotate(90deg); }

.grid { display: grid; gap: 18px; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); }
.card { transition: transform .15s, box-shadow .15s; }
.card:hover { transform: translateY(-2px); }
.card h3 { margin: 0; font-size: 17px; font-weight: 700; }
.card a { color: var(--ink); text-decoration: none; }
.stats { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; margin-top: 16px; }
.stats > div { background: var(--surface-2); border-radius: 14px; padding: 10px 10px 8px; }
.stats b { display: block; font-size: 18px; font-weight: 800; white-space: nowrap; color: var(--ink-2); }
.stats .muted { font-size: 11.5px; line-height: 1.25; display: block; }

/* números em destaque */
.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 14px; margin-bottom: 18px; }
.kpi { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px 18px; box-shadow: var(--shadow); }
.kpi b { display: block; font-size: 28px; font-weight: 800; letter-spacing: -.02em; color: var(--ink-2); line-height: 1.1; }
.kpi span { color: var(--muted); font-size: 13px; }
.kpi.dark { background: var(--forest); border-color: var(--forest); color: var(--stone); }
.kpi.dark b { color: var(--stone); }
.kpi.dark span { color: var(--sage); }
.meter { height: 8px; border-radius: 99px; background: var(--surface-2); overflow: hidden; margin-top: 10px; }
.meter > span { display: block; height: 100%; border-radius: 99px; background: var(--accent); }
.kpi.dark .meter { background: rgba(218, 215, 205, .18); }
.kpi.dark .meter > span { background: var(--sage); }

/* ---------- formulários ---------- */
select, input, textarea, button {
  font: inherit; color: var(--ink);
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--radius-sm); padding: 9px 12px;
}
input:focus, select:focus, textarea:focus { outline: 2px solid var(--sage); outline-offset: 1px; border-color: var(--accent); }
textarea { width: 100%; resize: vertical; line-height: 1.5; }
button {
  cursor: pointer; font-weight: 600; background: var(--surface-2); border-color: transparent;
  border-radius: 999px; padding: 9px 16px; transition: background .15s, transform .05s;
}
button:hover { background: var(--line); }
button:active { transform: translateY(1px); }
button:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
button.primary { background: var(--accent-strong); color: var(--on-accent); }
button.primary:hover { background: var(--forest); }
button:disabled { opacity: .55; cursor: default; }
@media (prefers-color-scheme: dark) {
  button.primary:hover { background: var(--sage); }
}
form.inline { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
label.field { display: grid; gap: 6px; font-size: 12.5px; font-weight: 600; color: var(--muted); }
label.field input, label.field select, label.field textarea { font-size: 15px; font-weight: 400; color: var(--ink); }
.row { display: flex; gap: 12px; flex-wrap: wrap; }
.row > * { flex: 1 1 200px; }
input[type="checkbox"] { accent-color: var(--accent-strong); width: 16px; height: 16px; vertical-align: -3px; padding: 0; }

/* ---------- tabelas ---------- */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: separate; border-spacing: 0; }
th, td { text-align: left; padding: 12px 10px; border-bottom: 1px solid var(--line); vertical-align: top; }
th { color: var(--muted); font-weight: 600; font-size: 12.5px; }
tbody tr:hover td { background: color-mix(in srgb, var(--surface-2) 55%, transparent); }
tbody tr:last-child td { border-bottom: 0; }
td a { color: var(--ink); font-weight: 600; text-decoration: none; }
td a:hover { color: var(--accent-strong); text-decoration: underline; }
.score { font-variant-numeric: tabular-nums; font-weight: 800; white-space: nowrap; color: var(--ink-2); font-size: 16px; }
.bar { height: 6px; background: var(--surface-2); border-radius: 99px; margin-top: 6px; width: 64px; overflow: hidden; }
.bar > span { display: block; height: 100%; border-radius: 99px; background: var(--accent); }

/* ---------- chips e status ---------- */
.tag, .status {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: 12px; font-weight: 600; line-height: 1;
  padding: 6px 10px; border-radius: 999px; white-space: nowrap;
  background: var(--surface-2); color: var(--ink-2); border: 0;
}
.tag.arbitrage { background: var(--ok-bg); color: var(--ok); }
.tag.trend { background: var(--warn-bg); color: var(--warn); }
.tag.outlier { background: var(--busy-bg); color: var(--busy); }
.tag.risk { background: var(--bad-bg); color: var(--bad); }
.status::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: currentColor; opacity: .8; }
.status.script_review, .status.video_review { background: var(--warn-bg); color: var(--warn); }
.status.approved, .status.script_approved { background: var(--ok-bg); color: var(--ok); }
.status.failed { background: var(--bad-bg); color: var(--bad); }
.status.writing, .status.rendering, .status.queued { background: var(--busy-bg); color: var(--busy); }
.status.writing::before, .status.rendering::before, .status.queued::before { animation: pulse 1.2s infinite; }
.status.rejected { opacity: .65; }
@keyframes pulse { 50% { opacity: .2; } }
@media (prefers-reduced-motion: reduce) { .status::before { animation: none !important; } .card:hover { transform: none; } }

/* ---------- texto auxiliar ---------- */
.muted { color: var(--muted); font-size: 13px; }
.topic a { color: var(--ink); font-weight: 600; }
.warn { color: var(--warn); }
.err { color: var(--bad); }
.check { padding: 6px 0; border-bottom: 1px dashed var(--line); }
.check:last-child { border-bottom: 0; }
.check.error { color: var(--bad); } .check.warning { color: var(--warn); } .check.info { color: var(--ok); }
.error-box { background: var(--bad-bg); color: var(--bad); padding: 12px 16px; border-radius: 14px; margin-bottom: 16px; font-weight: 600; }
pre.meta { white-space: pre-wrap; background: var(--surface-2); padding: 14px; border-radius: 14px; font: 12.5px/1.55 ui-monospace, "SF Mono", Consolas, monospace; max-height: 360px; overflow: auto; }
code { background: var(--surface-2); padding: 2px 6px; border-radius: 6px; font-size: 13px; }

/* ---------- conteúdo / mídia ---------- */
.actions form { display: inline; }
.actions button { font-size: 12.5px; padding: 6px 10px; }
.scene { border-top: 1px solid var(--line); padding: 14px 0; display: grid; gap: 8px; }
.scene-head { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.scene-head b { background: var(--forest); color: var(--stone); font-size: 12px; padding: 4px 10px; border-radius: 999px; }
.thumbs { display: flex; gap: 14px; flex-wrap: wrap; }
.thumbs img { width: 320px; max-width: 100%; border-radius: 14px; box-shadow: var(--shadow); }
video { width: 100%; max-width: 960px; border-radius: 18px; background: #0E1511; display: block; }

/* ---------- celular / tela estreita ---------- */
@media (max-width: 900px) {
  .shell { grid-template-columns: 1fr; }
  .side { position: sticky; height: auto; flex-direction: row; align-items: center; gap: 12px; padding: 10px 12px; z-index: 10; overflow-x: auto; }
  .brand-text small, .side-foot { display: none; }
  .brand { padding: 0; }
  .brand img { width: 34px; height: 34px; }
  .nav { display: flex; gap: 4px; }
  .nav a { padding: 9px 12px; white-space: nowrap; }
  .main { padding-top: 20px; }
  .stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 560px) {
  .nav a span { display: none; }
  .brand-text { display: none; }
  .panel { padding: 16px; border-radius: 16px; }
}

/* chips de seleção (coleta) */
label.chip { display: inline-flex; align-items: center; gap: 7px; background: var(--surface-2); padding: 7px 12px; border-radius: 999px; font-weight: 600; font-size: 13px; cursor: pointer; }
label.chip:has(input:checked) { background: var(--ok-bg); color: var(--ok); }
.sep { width: 1px; height: 22px; background: var(--line); margin: 0 4px; }

/* player + lateral (conteúdo) */
.media-short { display: grid; grid-template-columns: minmax(0, 340px) minmax(0, 1fr); gap: 28px; align-items: start; }
.media-short video { max-width: 340px; }
.media-side h4 { margin: 0 0 10px; font-size: 14px; color: var(--muted); }
.media-side h4 ~ h4 { margin-top: 18px; }
.media:not(.media-short) .media-side h4 { margin-top: 18px; }
@media (max-width: 760px) { .media-short { grid-template-columns: 1fr; } .media-short video { margin: 0 auto; } }

/* cards de canal: números cabem em qualquer largura */
.stats { grid-template-columns: repeat(auto-fit, minmax(76px, 1fr)); }
.stats b { font-size: 16px; }

/* logo destacado na barra lateral */
.brand img { box-shadow: 0 0 0 1px rgba(218, 215, 205, .22), 0 6px 16px -6px rgba(0, 0, 0, .5); }
.card .stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.media-side pre.meta { font: 14px/1.55 "Plus Jakarta Sans", system-ui, sans-serif; }

/* contas e marcos */
.section-head h2 { font-size: 22px; font-weight: 800; letter-spacing: -.02em; margin: 6px 0 4px; }
.section-head p { margin: 0 0 14px; max-width: 80ch; }
.acc-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(380px, 1fr)); gap: 18px; margin-bottom: 18px; }
.acc { margin-bottom: 0; display: grid; gap: 14px; align-content: start; }
.acc-head { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.acc-head h3 { margin: 0; font-size: 19px; font-weight: 800; }
.acc.youtube .acc-head h3::before { content: ""; display: inline-block; width: 12px; height: 12px; border-radius: 3px; background: #C4302B; margin-right: 8px; }
.acc.tiktok .acc-head h3::before { content: ""; display: inline-block; width: 12px; height: 12px; border-radius: 3px; background: var(--ink); margin-right: 8px; }
.metric-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(118px, 1fr)); gap: 8px; }
.metric { background: var(--surface-2); border-radius: 14px; padding: 10px 12px; display: grid; gap: 1px; }
.metric b { font-size: 18px; font-weight: 800; color: var(--ink-2); font-variant-numeric: tabular-nums; }
.metric span { font-size: 12px; color: var(--muted); line-height: 1.25; }
.metric small { font-size: 11px; color: var(--muted); opacity: .8; }
.acc-actions { display: flex; gap: 10px; align-items: flex-start; flex-wrap: wrap; }
.acc-actions details { flex: 1 1 220px; }
.acc-actions summary { cursor: pointer; font-weight: 600; font-size: 14px; color: var(--accent-strong); padding: 9px 0; }
form.manual { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 10px; margin-top: 6px; align-items: end; }
.milestones { display: grid; gap: 10px; }
.ms { border: 1px solid var(--line); border-radius: 16px; padding: 12px 14px; }
.ms.done { background: var(--ok-bg); border-color: transparent; }
.ms.na { opacity: .6; }
.ms-top { display: flex; justify-content: space-between; gap: 10px; align-items: baseline; }
.ms-top b { font-size: 14.5px; }
.ms-pct { font-weight: 800; color: var(--ink-2); white-space: nowrap; }
.ms .meter { margin: 8px 0; }
.reqs { list-style: none; margin: 0; padding: 0; display: grid; gap: 2px; font-size: 13px; color: var(--muted); }
.reqs li::before { content: "○ "; }
.reqs li.ok { color: var(--ok); }
.reqs li.ok::before { content: "● "; }
.reqs li.route { padding-left: 14px; }
.reqs li.route.best { color: var(--ink-2); }
.reqs li.route-label { margin-top: 4px; }
.reqs li.route-label::before { content: ""; }
.eta { margin-top: 8px; font-size: 13.5px; }
.card-ms { margin-top: 14px; }
.card-ms .ms-top b { font-size: 15px; color: var(--ink-2); }
.card-ms .meter { margin-top: 6px; }
@media (max-width: 560px) { .acc-grid { grid-template-columns: 1fr; } }

/* login */
.login-page { min-height: 100vh; background: var(--side); display: grid; place-items: center; padding: 24px 16px; }
.login-wrap { width: 100%; max-width: 380px; display: grid; gap: 22px; }
.login-brand { display: flex; gap: 14px; align-items: center; color: var(--side-ink); justify-content: center; }
.login-brand img { border-radius: 16px; box-shadow: 0 0 0 1px rgba(218, 215, 205, .22); }
.login-brand b { display: block; font-size: 28px; font-weight: 800; letter-spacing: -.02em; line-height: 1; }
.login-brand span { color: var(--side-muted); font-size: 14px; }
.login-card { display: grid; gap: 14px; margin: 0; }
.login-card h1 { margin: 0; font-size: 22px; font-weight: 800; }
.logout { margin-top: 12px; }
.logout button { background: transparent; color: var(--side-muted); padding: 8px 10px; font-size: 13px; }
.logout button:hover { background: rgba(218, 215, 205, .08); color: var(--side-ink); }
.google-btn { display: flex; align-items: center; justify-content: center; gap: 10px; background: #fff; color: #1f1f1f; border: 1px solid #c8c8c8; border-radius: 999px; padding: 11px 16px; font-weight: 600; text-decoration: none; }
.google-btn:hover { background: #f5f5f5; }
.google-btn svg { width: 20px; height: 20px; }
.or { display: flex; align-items: center; gap: 10px; color: var(--muted); font-size: 13px; }
.or::before, .or::after { content: ""; flex: 1; height: 1px; background: var(--line); }
.user-chip { display: flex; align-items: center; gap: 8px; color: var(--side-ink); font-size: 13px; margin-top: 10px; }
.user-chip img { width: 26px; height: 26px; border-radius: 50%; }
