:root {
  --bg: #f6f5f2; --panel: #ffffff; --ink: #1d1c1a; --muted: #6f6b64; --line: #e6e2db; --soft: #f1eee8;
  --accent: #e8664a; --accent-ink: #fff; --accent-soft: #fde9e3;
  --ok: #2f8f5b; --ok-soft: #e3f4ea; --warn: #b7791f; --warn-soft: #fbf1dc; --bad: #c2413a; --bad-soft: #fbe4e2;
  --info-soft: #e7eefb; --radius: 10px; --shadow: 0 1px 2px rgba(0,0,0,.05), 0 2px 8px rgba(0,0,0,.04);
  font: 14px/1.45 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root { --bg: #151514; --panel: #1f1e1c; --ink: #ecebe7; --muted: #9c978e; --line: #34322e; --soft: #2a2926;
    --accent-soft: #3d2620; --ok-soft: #1c3326; --warn-soft: #382c16; --bad-soft: #3b1f1d; --info-soft: #1d2638; color-scheme: dark; }
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); color: var(--ink); display: grid; grid-template-columns: 220px 1fr; min-height: 100vh; }
a { color: inherit; }
h1 { font-size: 22px; margin: 2px 0 4px; letter-spacing: -.01em; }
h2.group { font-size: 15px; margin: 24px 0 8px; }
h3 { font-size: 14px; margin: 0 0 10px; }
h4 { font-size: 13px; margin: 18px 0 6px; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); }
code { background: var(--soft); padding: 1px 5px; border-radius: 4px; font-size: 12px; word-break: break-all; }
kbd { border: 1px solid var(--line); border-bottom-width: 2px; border-radius: 4px; padding: 0 4px; font-size: 11px; background: var(--panel); }
pre { white-space: pre-wrap; font-size: 11px; max-height: 240px; overflow: auto; }
.muted, .unknown { color: var(--muted); }
.small { font-size: 12px; }
.hidden { display: none !important; }

/* nav */
.nav { position: sticky; top: 0; height: 100vh; padding: 18px 14px; border-right: 1px solid var(--line); background: var(--panel); display: flex; flex-direction: column; gap: 14px; }
.brand { font-weight: 700; font-size: 16px; display: flex; align-items: center; gap: 8px; }
.logo { background: var(--accent); color: #fff; border-radius: 7px; width: 26px; height: 26px; display: grid; place-items: center; font-size: 12px; }
.internal { font-size: 10px; font-weight: 600; color: var(--muted); border: 1px solid var(--line); border-radius: 99px; padding: 0 6px; }
.nav nav { display: flex; flex-direction: column; gap: 2px; }
.nav nav a { text-decoration: none; padding: 7px 10px; border-radius: 7px; display: flex; justify-content: space-between; color: var(--muted); }
.nav nav a:hover { background: var(--soft); color: var(--ink); }
.nav nav a.active { background: var(--accent-soft); color: var(--ink); font-weight: 600; }
.nav .count { background: var(--accent); color: #fff; border-radius: 99px; font-size: 11px; padding: 0 7px; }
.nav .count:empty { display: none; }
.nav-sep { height: 1px; background: var(--line); margin: 6px 0; }
.nav-foot { margin-top: auto; font-size: 12px; color: var(--muted); }

main { padding: 22px 28px 60px; min-width: 0; }
.page-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 16px; margin-bottom: 16px; flex-wrap: wrap; }
.page-head .sub { color: var(--muted); margin: 0; }
.page-head .actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.back { color: var(--muted); text-decoration: none; font-size: 13px; }
.loading, .empty { padding: 40px; text-align: center; color: var(--muted); }
.empty.error { color: var(--bad); }

/* controls */
.btn { font: inherit; border: 1px solid var(--line); background: var(--panel); color: var(--ink); padding: 7px 12px; border-radius: 8px; cursor: pointer; text-decoration: none; display: inline-flex; align-items: center; gap: 6px; white-space: nowrap; }
.btn:hover:not(:disabled) { border-color: var(--muted); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); font-weight: 600; }
.btn.primary:hover:not(:disabled) { filter: brightness(.95); }
.btn.danger { background: var(--bad); border-color: var(--bad); color: #fff; }
.btn.ghost { background: transparent; }
.btn.sm { padding: 4px 9px; font-size: 12.5px; }
.btn.block { width: 100%; justify-content: center; }
.btn:disabled, .btn.disabled { opacity: .45; cursor: not-allowed; pointer-events: none; }
.link { background: none; border: 0; color: var(--muted); cursor: pointer; font: inherit; padding: 0 2px; text-decoration: underline; }
.link.on { color: var(--ink); font-weight: 600; }
input, select, textarea { font: inherit; color: var(--ink); background: var(--panel); border: 1px solid var(--line); border-radius: 7px; padding: 6px 8px; min-width: 0; }
input:focus, select:focus, textarea:focus { outline: 2px solid var(--accent-soft); border-color: var(--accent); }
textarea { width: 100%; resize: vertical; }
.field { display: flex; flex-direction: column; gap: 3px; font-size: 12.5px; color: var(--muted); margin-bottom: 8px; }
.field > input, .field > select, .field > textarea { color: var(--ink); font-size: 14px; }
.hint { font-size: 12px; color: var(--muted); font-weight: 400; }
.hint.warn, .warn { color: var(--warn); }
.check { display: flex; gap: 6px; align-items: center; margin: 6px 0; cursor: pointer; }
.checks { display: flex; flex-wrap: wrap; gap: 6px 16px; margin: 8px 0; }
.checks.col { flex-direction: column; }
.checks label { display: flex; gap: 6px; align-items: center; }
.inline { display: inline-flex; gap: 5px; align-items: center; color: var(--muted); font-size: 12.5px; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 0 12px; }
.grid3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 0 10px; }
.row { display: flex; align-items: center; }
.row.between { justify-content: space-between; gap: 8px; }
.row.end { justify-content: flex-end; }
.row.gap { gap: 8px; }
.row.wrap { flex-wrap: wrap; }
.spacer { flex: 1; }
.slider { display: grid; grid-template-columns: 1fr 1.3fr 3em; align-items: center; gap: 8px; font-size: 12.5px; color: var(--muted); margin: 4px 0; }
.slider output { font-variant-numeric: tabular-nums; text-align: right; color: var(--ink); }
.slider input { accent-color: var(--accent); }

.panel { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 16px; margin-bottom: 14px; box-shadow: var(--shadow); }
.banner { padding: 9px 12px; border-radius: 8px; margin-bottom: 12px; }
.banner.warn { background: var(--warn-soft); }
.banner.info { background: var(--info-soft); }
.banner.error { background: var(--bad-soft); }
.banner.sample { background: repeating-linear-gradient(45deg, var(--warn-soft), var(--warn-soft) 10px, transparent 10px, transparent 20px); border: 1px dashed var(--warn); font-weight: 600; }

/* badges & pills */
.badge { display: inline-block; font-size: 11px; font-weight: 600; padding: 1px 8px; border-radius: 99px; background: var(--soft); color: var(--muted); white-space: nowrap; }
.badge.sample { background: var(--warn); color: #fff; }
.badge.ok, .vs-done, .ps-approved, .hs-supported, .hs-active { background: var(--ok-soft); color: var(--ok); }
.st-new { background: var(--info-soft); color: #3a64b0; }
.st-shortlisted, .st-editing { background: var(--accent-soft); color: var(--accent); }
.st-ready, .st-published, .st-measured, .ps-published, .ps-measured { background: var(--ok-soft); color: var(--ok); }
.st-rejected, .vs-failed, .hs-not_supported { background: var(--bad-soft); color: var(--bad); }
.st-blocked, .vs-rendering, .vs-queued, .ps-queued, .hs-testing, .hs-mixed { background: var(--warn-soft); color: var(--warn); }
.pills { display: flex; flex-wrap: wrap; gap: 4px; margin: 6px 0; }
.pill { font-size: 11.5px; padding: 1px 8px; border-radius: 99px; border: 1px solid var(--line); white-space: nowrap; font-variant-numeric: tabular-nums; }
.pill.hi { background: var(--ok-soft); border-color: transparent; color: var(--ok); }
.pill.mid { background: var(--warn-soft); border-color: transparent; color: var(--warn); }
.pill.lo, .pill.muted { color: var(--muted); }
.att-strong { background: var(--accent-soft); color: var(--accent); border-color: transparent; }
.att-moderate { background: var(--warn-soft); color: var(--warn); border-color: transparent; }
.att-unknown { color: var(--muted); border-style: dashed; }
.tag { display: inline-block; background: var(--soft); border-radius: 6px; padding: 1px 7px; font-size: 12px; margin: 1px 2px; }
.ev { font-size: 11px; padding: 0 6px; border-radius: 99px; }
.ev-anecdotal { background: var(--soft); color: var(--muted); }
.ev-early { background: var(--warn-soft); color: var(--warn); }
.ev-pattern { background: var(--ok-soft); color: var(--ok); }
.blocker { font-size: 12.5px; color: var(--bad); margin-top: 4px; }
.blocker.soft { color: var(--warn); }
.blocker.muted { color: var(--muted); }
.blocker.inline { margin-left: 8px; }

/* filters + inbox cards */
.filters { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 14px; align-items: center; }
.filters input[type=search] { flex: 1 1 260px; }
.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(330px, 1fr)); gap: 12px; }
.card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); display: grid; grid-template-columns: 112px 1fr; overflow: hidden; box-shadow: var(--shadow); }
.card.sel { outline: 2px solid var(--accent); }
.thumb { position: relative; background: #000; display: block; }
.thumb img { width: 100%; height: 100%; object-fit: cover; display: block; min-height: 150px; }
.thumb .dur { position: absolute; right: 4px; bottom: 4px; background: rgba(0,0,0,.7); color: #fff; font-size: 11px; padding: 0 5px; border-radius: 4px; }
.nofootage { color: #bbb; font-size: 12px; text-align: center; padding: 50px 6px; background: repeating-linear-gradient(45deg, #222, #222 6px, #2a2a2a 6px, #2a2a2a 12px); height: 100%; }
.nofootage.big { padding: 60px 20px; color: #ddd; border-radius: 8px; }
.card-body { padding: 10px 12px; min-width: 0; }
.card .title { font-weight: 600; text-decoration: none; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.card .meta, .card .metrics { font-size: 12px; color: var(--muted); }
.card .hook { font-size: 13px; margin-top: 2px; }
.card-actions { margin-top: 6px; }
.stars { display: inline-flex; }
.stars button { background: none; border: 0; padding: 0 1px; font-size: 16px; color: var(--line); cursor: default; }
.stars.interactive button { cursor: pointer; }
.stars button.on { color: #f0a92e; }
.stars.interactive:hover button { color: #f0a92e; }
.stars.interactive button:hover ~ button { color: var(--line); }

/* candidate detail */
.detail { display: grid; grid-template-columns: minmax(0, 1.25fr) minmax(320px, 1fr); gap: 16px; align-items: start; }
.video-panel video { width: 100%; max-height: 62vh; background: #000; border-radius: 8px; display: block; }
.vid-tools { margin-top: 8px; font-size: 13px; }
.scorecard { width: 100%; border-collapse: collapse; margin: 8px 0; }
.scorecard td { padding: 3px 0; border-bottom: 1px solid var(--soft); }
.scorecard td.sc { text-align: right; white-space: nowrap; }
.scorecard tr.note td { font-size: 12px; color: var(--muted); border-bottom: 1px solid var(--line); padding-bottom: 6px; }
.scorecard.edit tr.note td { border-bottom: 0; }
.scorecard.edit input { width: 100%; font-size: 12px; padding: 3px 6px; }
.dots { color: var(--accent); letter-spacing: 1px; }
.reasons { margin: 6px 0; padding-left: 18px; font-size: 13px; }
.checklist { list-style: none; padding: 0; margin: 0; font-size: 13px; }
.checklist li { padding: 3px 0; display: flex; gap: 6px; }
.checklist .ic { width: 18px; height: 18px; border-radius: 50%; display: inline-grid; place-items: center; font-size: 11px; flex: none; }
.checklist .pass .ic { background: var(--ok-soft); color: var(--ok); }
.checklist .fail .ic { background: var(--bad-soft); color: var(--bad); }
.checklist .warn .ic { background: var(--warn-soft); color: var(--warn); }
.tabs { display: flex; gap: 4px; margin-bottom: 12px; border-bottom: 1px solid var(--line); }
.tabs button { font: inherit; background: none; border: 0; padding: 6px 10px; cursor: pointer; color: var(--muted); border-bottom: 2px solid transparent; margin-bottom: -1px; }
.tabs button.active { color: var(--ink); border-color: var(--accent); font-weight: 600; }
.tabs.small button { font-size: 12.5px; padding: 4px 8px; }
.tbl { width: 100%; border-collapse: collapse; font-size: 13px; }
.tbl th { text-align: left; font-weight: 600; color: var(--muted); font-size: 12px; border-bottom: 1px solid var(--line); padding: 5px 6px; }
.tbl td { border-bottom: 1px solid var(--soft); padding: 6px; vertical-align: top; }
.tbl.compact td, .tbl.compact th { padding: 3px 5px; }
.tbl.rank tr.disagree td { background: var(--warn-soft); }
.mini { width: 54px; height: 54px; object-fit: cover; border-radius: 6px; }
.grid-metrics { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; margin-top: 8px; }
.grid-metrics input[type=datetime-local] { grid-column: span 3; }
.events { list-style: none; padding: 0; margin: 0; font-size: 12.5px; max-height: 260px; overflow: auto; }
.events li { padding: 2px 0; }
.cap-idea { padding: 4px 0; border-bottom: 1px solid var(--soft); }
.sub-box { background: var(--soft); border-radius: 8px; padding: 10px; margin-bottom: 10px; }

/* editor */
.editor { display: grid; grid-template-columns: 200px minmax(340px, 1fr) minmax(300px, 400px); gap: 14px; align-items: start; }
.versions { display: flex; flex-direction: column; gap: 6px; position: sticky; top: 12px; }
.ver { background: var(--panel); border: 1px solid var(--line); border-radius: 8px; padding: 8px 10px; cursor: pointer; font-size: 12.5px; }
.ver.sel { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent); }
.ed-form { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 12px 16px; }
.ed-form fieldset { border: 0; padding: 0; margin: 0; }
.ed-form fieldset:disabled { opacity: .6; }
.src-wrap video { width: 100%; max-height: 220px; background: #000; border-radius: 6px; }
.chips { display: flex; flex-wrap: wrap; gap: 5px; margin: -2px 0 8px; }
.chip { font: inherit; font-size: 12px; border: 1px solid var(--line); background: var(--soft); border-radius: 99px; padding: 2px 9px; cursor: pointer; color: var(--ink); }
.chip:hover { border-color: var(--accent); }
.sticky-actions { position: sticky; bottom: 0; background: var(--panel); padding: 10px 0 2px; border-top: 1px solid var(--line); margin-top: 12px; }
#sf .sticky-actions { background: var(--bg); }
.ed-preview { position: sticky; top: 12px; }
.phone { position: relative; aspect-ratio: 9 / 16; width: 100%; background: #000; border-radius: 14px; overflow: hidden; }
.phone img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.phone .safe { position: absolute; border: 1.5px dashed rgba(255,255,255,.75); box-shadow: 0 0 0 9999px rgba(0,0,0,.18); pointer-events: none; }
.phone .capbox { position: absolute; border: 1.5px solid #ffd54a; pointer-events: none; }
.phone .split-line { position: absolute; top: 0; bottom: 0; width: 2px; background: #fff; box-shadow: 0 0 4px rgba(0,0,0,.6); pointer-events: none; }
.phone .lbl { position: absolute; top: 6px; font-size: 10px; color: #fff; background: rgba(0,0,0,.55); padding: 0 6px; border-radius: 4px; }
.phone .lbl.l { left: 6px; } .phone .lbl.r { right: 6px; }
.pv-busy { position: absolute; bottom: 8px; left: 50%; transform: translateX(-50%); background: rgba(0,0,0,.7); color: #fff; font-size: 11px; padding: 2px 8px; border-radius: 99px; }
#split { width: 100%; accent-color: var(--accent); }
video.rendered { width: 100%; max-height: 70vh; background: #000; border-radius: 10px; }
.compare { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; margin-top: 12px; }
.cmp-col video { width: 100%; max-height: 70vh; background: #000; border-radius: 10px; margin: 6px 0; }
.cmp-col ul { padding-left: 16px; }

/* queue */
.pub-grid { display: grid; grid-template-columns: 200px 1fr; gap: 16px; }
.pub-grid video { width: 100%; aspect-ratio: 9/16; background: #000; border-radius: 10px; }

/* results / playbook */
.groups { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 12px; }
.group-card { border: 1px solid var(--line); border-radius: 8px; padding: 8px 10px; }
.caveats { font-size: 12.5px; color: var(--muted); margin: 4px 0 10px; padding-left: 18px; }
.hyp { padding: 5px 0; border-bottom: 1px solid var(--soft); }
.pb-item { padding: 8px 0; border-bottom: 1px solid var(--soft); }
.pb-item.inactive { opacity: .55; }
.list-row { display: grid; grid-template-columns: 64px 1fr auto; align-items: center; gap: 12px; text-decoration: none; padding: 6px; border-radius: 8px; }
.list-row:hover { background: var(--soft); }
.list-row img, .nothumb { width: 64px; height: 64px; object-fit: cover; border-radius: 6px; background: var(--soft); }
.settings-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(380px, 1fr)); gap: 14px; }

/* modal + toasts */
.modal-wrap { position: fixed; inset: 0; background: rgba(0,0,0,.35); display: grid; place-items: center; z-index: 50; padding: 16px; }
.modal { background: var(--panel); border-radius: 12px; width: min(520px, 100%); max-height: 90vh; display: flex; flex-direction: column; box-shadow: 0 10px 40px rgba(0,0,0,.25); }
.modal.wide { width: min(760px, 100%); }
.modal header, .modal footer { padding: 12px 16px; display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.modal header { border-bottom: 1px solid var(--line); }
.modal header h3 { margin: 0; }
.modal footer { border-top: 1px solid var(--line); justify-content: flex-end; }
.modal .x { background: none; border: 0; font-size: 20px; cursor: pointer; color: var(--muted); }
.modal-body { padding: 14px 16px; overflow: auto; }
#toasts { position: fixed; right: 16px; bottom: 16px; display: flex; flex-direction: column; gap: 6px; z-index: 60; max-width: 420px; }
.toast { background: var(--ink); color: var(--bg); padding: 8px 12px; border-radius: 8px; font-size: 13px; box-shadow: var(--shadow); transition: opacity .4s; }
.toast.ok { background: var(--ok); color: #fff; }
.toast.error { background: var(--bad); color: #fff; }
.toast.out { opacity: 0; }

@media (max-width: 1200px) {
  .editor { grid-template-columns: 170px 1fr; }
  .ed-preview { grid-column: 1 / -1; position: static; max-width: 420px; }
}
@media (max-width: 900px) {
  body { grid-template-columns: 1fr; }
  .nav { position: static; height: auto; }
  main { padding: 16px; }
  .detail, .editor, .compare, .pub-grid { grid-template-columns: 1fr; }
  .grid2, .grid3 { grid-template-columns: 1fr; }
}

/* v2: autopilot, creators, login, submission */
.btn.big { padding: 10px 18px; font-size: 15px; font-weight: 700; }
.btn.danger:hover:not(:disabled) { filter: brightness(.95); }
.ops-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 14px; }
.seg { display: inline-flex; border: 1px solid var(--line); border-radius: 9px; overflow: hidden; margin-bottom: 6px; }
.seg button { font: inherit; border: 0; background: var(--panel); color: var(--muted); padding: 7px 14px; cursor: pointer; border-right: 1px solid var(--line); }
.seg button:last-child { border-right: 0; }
.seg button.on { background: var(--accent); color: #fff; font-weight: 600; }
.seg button.danger-on.on { background: var(--bad); }
.dot { width: 9px; height: 9px; border-radius: 50%; display: inline-block; align-self: center; background: var(--line); }
.dot.live { background: var(--ok); box-shadow: 0 0 0 3px var(--ok-soft); }
.dot.dry { background: var(--warn); }
.dot.paused { background: var(--bad); }
.badge.lvl-error, .badge.qa-fail { background: var(--bad-soft); color: var(--bad); }
.badge.lvl-warn, .badge.qa-warn { background: var(--warn-soft); color: var(--warn); }
.badge.lvl-info, .badge.qa-pass, .badge.ag-active { background: var(--ok-soft); color: var(--ok); }
.badge.ag-requested { background: var(--info-soft); color: #3a64b0; }
.badge.ag-declined, .badge.ag-revoked { background: var(--bad-soft); color: var(--bad); }
.ps-dry_run { background: var(--info-soft); color: #3a64b0; }
.ps-failed { background: var(--bad-soft); color: var(--bad); }
details.qa summary { cursor: pointer; }
.tbl tr.fail td { color: var(--bad); }
.tbl tr.warn td { color: var(--warn); }
.center-page { display: grid; place-items: center; min-height: 100vh; grid-template-columns: 1fr; padding: 16px; }
.panel.login { width: min(360px, 100%); }
.panel.login .brand { margin-bottom: 14px; }
.panel.submit { width: min(560px, 100%); }
.terms { white-space: pre-wrap; background: var(--soft); border-radius: 8px; padding: 10px 12px; font: inherit; font-size: 13px; }
progress { width: 100%; }

.hp { position: absolute; left: -9999px; width: 1px; height: 1px; overflow: hidden; }

pre.mail { white-space: pre-wrap; font-family: inherit; background: rgba(127,127,127,.08); padding: 12px; border-radius: 8px; }
