/* AI Video Production Workflow — single stylesheet, no build step. */
:root {
  --bg: #f5f6f8; --surface: #ffffff; --surface-2: #f9fafb; --ink: #1b2130; --muted: #5f6878; --faint: #8a93a3;
  --line: #e2e5ea; --line-2: #eef0f3; --accent: #3557d4; --accent-ink: #ffffff; --accent-soft: #e9eefc;
  --good: #2b8a3e; --good-soft: #e6f4ea; --warn: #b35c00; --warn-soft: #fff3e0; --bad: #c92a2a; --bad-soft: #fdecec;
  --muted-soft: #eef0f3; --info-soft: #e8f1fb; --info: #1c64b4;
  --top: #141925; --top-ink: #e8ebf2; --radius: 8px; --shadow: 0 1px 2px rgba(16, 24, 40, .06);
  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, "Liberation Mono", monospace;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--ink); font: 14px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif; }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3, h4 { line-height: 1.25; margin: 0 0 .6em; }
h1 { font-size: 22px; } h2 { font-size: 17px; } h3 { font-size: 15px; } h4 { font-size: 13px; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); }
p { margin: 0 0 .8em; }
code, pre, kbd { font-family: var(--mono); font-size: 12.5px; }
pre { white-space: pre-wrap; word-break: break-word; background: var(--surface-2); border: 1px solid var(--line); border-radius: var(--radius); padding: 10px 12px; margin: 0 0 1em; max-height: 520px; overflow: auto; }
hr { border: 0; border-top: 1px solid var(--line); margin: 18px 0; }
small, .small { font-size: 12px; }
.muted { color: var(--muted); } .faint { color: var(--faint); }
.nowrap { white-space: nowrap; } .right { text-align: right; } .center { text-align: center; }
.mono { font-family: var(--mono); font-size: 12.5px; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }

/* top bar */
.topbar { background: var(--top); color: var(--top-ink); }
.topbar .in { max-width: 1320px; margin: 0 auto; padding: 0 20px; height: 52px; display: flex; align-items: center; gap: 22px; }
.brand { font-weight: 650; color: #fff; letter-spacing: .01em; display: flex; align-items: center; gap: 9px; }
.brand .dot { width: 10px; height: 10px; border-radius: 3px; background: linear-gradient(135deg, #6c8cff, #35c4b5); display: inline-block; }
.topbar nav { display: flex; gap: 4px; flex: 1; }
.topbar nav a { color: #c9cfdb; padding: 6px 10px; border-radius: 6px; }
.topbar nav a:hover, .topbar nav a.on { background: rgba(255,255,255,.08); color: #fff; text-decoration: none; }
.topbar .who { display: flex; align-items: center; gap: 12px; color: #aeb6c5; font-size: 13px; }
.topbar .who form { margin: 0; }
.linkbtn { background: none; border: 0; color: #c9cfdb; cursor: pointer; padding: 6px 8px; font: inherit; border-radius: 6px; }
.linkbtn:hover { background: rgba(255,255,255,.08); color: #fff; }

.wrap { max-width: 1320px; margin: 0 auto; padding: 22px 20px 60px; }
.narrow { max-width: 760px; }

/* project header */
.phead { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; margin-bottom: 4px; }
.phead h1 { margin-bottom: 4px; }
.phead .meta { color: var(--muted); font-size: 13px; }
.tabs { display: flex; gap: 2px; border-bottom: 1px solid var(--line); margin: 14px 0 20px; overflow-x: auto; }
.tabs a { padding: 9px 13px; color: var(--muted); border-bottom: 2px solid transparent; margin-bottom: -1px; white-space: nowrap; font-weight: 500; }
.tabs a:hover { color: var(--ink); text-decoration: none; }
.tabs a.on { color: var(--ink); border-bottom-color: var(--accent); }
.tabs .count { background: var(--muted-soft); color: var(--muted); border-radius: 9px; padding: 0 6px; font-size: 11px; margin-left: 4px; }

/* layout */
.grid { display: grid; gap: 16px; }
.g2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.g3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.side { grid-template-columns: minmax(0, 1fr) 340px; }
.side-l { grid-template-columns: 240px minmax(0, 1fr); }
@media (max-width: 980px) { .g2, .g3, .side, .side-l { grid-template-columns: 1fr; } }
.stack > * + * { margin-top: 16px; }
.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.row.between { justify-content: space-between; }
.spacer { flex: 1; }

.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); padding: 16px 18px; }
.card > h2:first-child, .card > h3:first-child { margin-top: 0; }
.card.flush { padding: 0; }
.card .card-h { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 12px 16px; border-bottom: 1px solid var(--line); }
.card .card-h h2, .card .card-h h3 { margin: 0; }
.card .card-b { padding: 14px 16px; }
.card.tint { background: var(--surface-2); }

/* tables */
table { border-collapse: collapse; width: 100%; }
.table th, .table td { text-align: left; padding: 8px 10px; border-bottom: 1px solid var(--line-2); vertical-align: top; }
.table th { font-size: 12px; font-weight: 600; color: var(--muted); background: var(--surface-2); border-bottom: 1px solid var(--line); }
.table tr:last-child td { border-bottom: 0; }
.table.compact td, .table.compact th { padding: 5px 8px; }
.table td.num, .table th.num { text-align: right; font-variant-numeric: tabular-nums; }
.scroll-x { overflow-x: auto; }

/* badges */
.badge { display: inline-block; padding: 1px 8px; border-radius: 10px; font-size: 11.5px; font-weight: 600; line-height: 18px; white-space: nowrap; text-transform: capitalize; }
.b-good { background: var(--good-soft); color: var(--good); }
.b-warn { background: var(--warn-soft); color: var(--warn); }
.b-bad { background: var(--bad-soft); color: var(--bad); }
.b-muted { background: var(--muted-soft); color: var(--muted); }
.b-info { background: var(--info-soft); color: var(--info); }
.status-pill { font-size: 12.5px; padding: 3px 12px; }

/* buttons & forms */
.btn { display: inline-flex; align-items: center; gap: 6px; padding: 7px 14px; border-radius: 7px; border: 1px solid var(--line); background: var(--surface); color: var(--ink); font: inherit; font-weight: 550; cursor: pointer; line-height: 1.3; }
.btn:hover { background: var(--surface-2); text-decoration: none; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.btn.primary:hover { filter: brightness(1.07); }
.btn.danger { color: var(--bad); border-color: #f1c4c4; }
.btn.good { background: var(--good); border-color: var(--good); color: #fff; }
.btn.sm { padding: 4px 10px; font-size: 12.5px; }
.btn[disabled], .btn.disabled { opacity: .5; cursor: not-allowed; }
.inline { display: inline; margin: 0; }
label { display: block; font-weight: 550; margin: 0 0 4px; font-size: 13px; }
label.check { display: flex; gap: 8px; align-items: center; font-weight: 400; }
.field { margin-bottom: 12px; }
.field .hint { color: var(--muted); font-size: 12px; margin-top: 3px; }
input[type=text], input[type=email], input[type=password], input[type=number], input[type=date], input[type=search], select, textarea {
  width: 100%; padding: 7px 10px; border: 1px solid #cfd4dc; border-radius: 7px; background: #fff; color: var(--ink); font: inherit; }
input:focus, select:focus, textarea:focus { outline: 2px solid var(--accent-soft); border-color: var(--accent); }
textarea { min-height: 90px; resize: vertical; }
textarea.code, .code { font-family: var(--mono); font-size: 12.5px; }
textarea.tall { min-height: 260px; }
input.short, select.short { width: auto; min-width: 80px; }
.form-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; }

/* callouts & flash */
.callout { border-radius: var(--radius); padding: 10px 14px; margin: 0 0 14px; border: 1px solid; }
.callout.info { background: var(--info-soft); border-color: #c9ddf5; color: #133d6e; }
.callout.success { background: var(--good-soft); border-color: #bfe3c8; color: #1d5e2b; }
.callout.error { background: var(--bad-soft); border-color: #f3c6c6; color: #8a1f1f; }
.callout.warn { background: var(--warn-soft); border-color: #f6d6a8; color: #7a3f00; }
.callout ul { margin: 6px 0 0; padding-left: 20px; }

/* key-value */
.kv { display: grid; grid-template-columns: max-content 1fr; gap: 6px 14px; margin: 0; }
.kv dt { color: var(--muted); font-size: 13px; }
.kv dd { margin: 0; }

/* gates & steps */
.gates { list-style: none; margin: 0; padding: 0; }
.gates li { display: flex; gap: 10px; padding: 7px 0; border-bottom: 1px solid var(--line-2); align-items: flex-start; }
.gates li:last-child { border-bottom: 0; }
.gates .ic { width: 20px; height: 20px; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center; font-size: 12px; font-weight: 700; flex: none; margin-top: 1px; }
.ic.ok { background: var(--good-soft); color: var(--good); } .ic.no { background: var(--bad-soft); color: var(--bad); }
.steps { list-style: none; padding: 0; margin: 0; counter-reset: s; }
.steps li { display: flex; gap: 10px; align-items: center; padding: 6px 0; border-bottom: 1px dashed var(--line-2); }
.steps li:last-child { border-bottom: 0; }
.next { border-left: 3px solid var(--accent); }
.next-item { display: flex; gap: 12px; align-items: center; padding: 10px 0; border-bottom: 1px solid var(--line-2); }
.next-item:last-child { border-bottom: 0; }

.prompt-box { font-family: var(--mono); font-size: 12.5px; min-height: 320px; background: var(--surface-2); }
.copy-row { display: flex; gap: 10px; align-items: center; margin: 8px 0 0; }
.err-list { margin: 0; padding-left: 18px; }
.err-list li { margin-bottom: 3px; }
.err-list code { background: rgba(0,0,0,.05); padding: 0 4px; border-radius: 4px; }

/* uploader */
.dropzone { border: 2px dashed #c6ccd6; border-radius: var(--radius); padding: 18px; text-align: center; background: var(--surface-2); color: var(--muted); }
.dropzone.over { border-color: var(--accent); background: var(--accent-soft); }
.progress { height: 8px; background: var(--line-2); border-radius: 4px; overflow: hidden; margin: 6px 0; }
.progress > div { height: 100%; background: var(--accent); width: 0; transition: width .2s; }
.upload-item { border: 1px solid var(--line); border-radius: var(--radius); padding: 10px 12px; margin-top: 10px; background: #fff; text-align: left; }

/* video review sequence */
.preview-banner { display: flex; gap: 10px; align-items: center; background: #1f2433; color: #e6e9f0; border-radius: var(--radius); padding: 9px 14px; margin-bottom: 14px; font-size: 13px; }
.preview-banner strong { color: #fff; }
.strip-wrap { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 12px 14px 10px; margin-bottom: 16px; }
.strip { display: flex; height: 46px; border-radius: 6px; overflow: hidden; border: 1px solid var(--line); }
.strip a { display: block; border-right: 1px solid rgba(255,255,255,.7); padding: 4px 6px; font-size: 11px; color: #1b2130; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; min-width: 3px; }
.strip a:hover { filter: brightness(.95); text-decoration: none; }
.strip .k-narrated { background: #dbe4ff; } .strip .k-gap { background: repeating-linear-gradient(45deg, #ffe3c2, #ffe3c2 5px, #fff4e5 5px, #fff4e5 10px); }
.strip .k-title { background: #e5dbff; } .strip .k-broll { background: #d3f9d8; } .strip .k-outro { background: #c5f6fa; } .strip .k-other { background: #e9ecef; }
.strip a.has-err { box-shadow: inset 0 -3px 0 var(--bad); } .strip a.has-warn { box-shadow: inset 0 -3px 0 var(--warn); }
.lane { display: flex; height: 14px; margin-top: 4px; }
.lane > span { display: block; height: 100%; }
.lane .vo-on { background: #4c6ef5; opacity: .75; border-radius: 2px; } .lane .vo-off { background: transparent; }
.lane .mu-on { background: #20c997; opacity: .7; border-radius: 2px; }
.lane-label { font-size: 11px; color: var(--muted); display: flex; gap: 14px; margin-top: 5px; }
.lane-label i { display: inline-block; width: 10px; height: 10px; border-radius: 2px; margin-right: 4px; vertical-align: -1px; }
.ticks { position: relative; height: 16px; font-size: 10.5px; color: var(--faint); margin-top: 2px; }
.ticks span { position: absolute; transform: translateX(-50%); }

.scene { display: grid; grid-template-columns: 340px minmax(0, 1fr); gap: 18px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px; margin-bottom: 14px; box-shadow: var(--shadow); }
.scene.err { border-left: 4px solid var(--bad); } .scene.warn { border-left: 4px solid var(--warn); }
@media (max-width: 900px) { .scene { grid-template-columns: 1fr; } }
.scene-h { display: flex; align-items: baseline; gap: 10px; flex-wrap: wrap; margin-bottom: 6px; }
.scene-h .no { font-weight: 700; font-size: 18px; color: var(--accent); }
.scene-h h3 { margin: 0; font-size: 16px; }
.frame { position: relative; width: 100%; background: #0e1118; border-radius: 6px; overflow: hidden; }
.frame .lyr { position: absolute; border: 1px dashed rgba(255,255,255,.45); color: #fff; font-size: 10.5px; overflow: hidden; display: flex; align-items: flex-start; justify-content: flex-start; }
.frame .lyr img { width: 100%; height: 100%; display: block; }
.frame .lyr .tag { position: absolute; left: 0; top: 0; background: rgba(0,0,0,.6); padding: 1px 5px; border-bottom-right-radius: 4px; white-space: nowrap; max-width: 100%; overflow: hidden; text-overflow: ellipsis; }
.frame .lyr.missing { background: repeating-linear-gradient(45deg, rgba(201,42,42,.35), rgba(201,42,42,.35) 6px, rgba(201,42,42,.18) 6px, rgba(201,42,42,.18) 12px); border-color: #ff8787; }
.frame .lyr.text { border-color: rgba(255,214,102,.8); }
.frame .lyr.text .txt { padding: 14px 6px 4px; font-weight: 600; line-height: 1.15; }
.frame .lyr.shape, .frame .lyr.overlay_effect { background: rgba(255,255,255,.07); }
.frame .bgnote { position: absolute; right: 6px; bottom: 4px; color: #aab; font-size: 10px; }
.frame .gapmark { position: absolute; inset: auto 0 0 0; text-align: center; background: rgba(230,119,0,.85); color: #fff; font-size: 11px; font-weight: 600; padding: 2px; }
.facts { display: grid; grid-template-columns: max-content minmax(0, 1fr); gap: 4px 14px; margin: 8px 0; font-size: 13px; }
.facts dt { color: var(--muted); } .facts dd { margin: 0; }
.lines { margin: 4px 0 8px; padding: 0; list-style: none; }
.lines li { padding: 3px 8px; border-left: 3px solid var(--accent-soft); margin-bottom: 3px; background: var(--surface-2); border-radius: 0 4px 4px 0; }
.lines li.cue_after { border-left-color: #ffc078; } .lines li.display_only { border-left-color: #b197fc; }
.lines .ln { font-weight: 700; color: var(--accent); margin-right: 6px; font-variant-numeric: tabular-nums; }
.layer-table td, .layer-table th { font-size: 12px; padding: 4px 6px; }
.findings { list-style: none; padding: 0; margin: 6px 0 0; }
.findings li { padding: 5px 8px; border-radius: 6px; margin-bottom: 4px; font-size: 12.5px; }
.findings li.error { background: var(--bad-soft); color: #8a1f1f; } .findings li.warning { background: var(--warn-soft); color: #7a3f00; }
.findings li.unverified, .findings li.info { background: var(--muted-soft); color: var(--muted); }
.drag-handle { cursor: grab; color: var(--faint); user-select: none; padding: 0 4px; }
.dragging { opacity: .5; }
.drop-target { outline: 2px dashed var(--accent); }

/* scene editor */
.ed-layer { border: 1px solid var(--line); border-radius: var(--radius); padding: 10px 12px; margin-bottom: 10px; background: var(--surface-2); }
.ed-layer .form-grid { grid-template-columns: repeat(auto-fill, minmax(110px, 1fr)); }
.ed-layer.del { opacity: .45; }
details > summary { cursor: pointer; font-weight: 600; margin: 4px 0; }
.sticky { position: sticky; top: 12px; }

/* misc */
.empty { padding: 26px; text-align: center; color: var(--muted); }
.stat { padding: 12px 14px; }
.stat .n { font-size: 22px; font-weight: 700; }
.stat .l { color: var(--muted); font-size: 12.5px; }
.pill-list { display: flex; flex-wrap: wrap; gap: 6px; }
.chip { display: inline-block; border: 1px solid var(--line); border-radius: 12px; padding: 1px 9px; font-size: 12px; background: var(--surface-2); }
.diff-old { background: var(--bad-soft); } .diff-new { background: var(--good-soft); }
.admin-nav a { display: block; padding: 6px 10px; border-radius: 6px; color: var(--ink); }
.admin-nav a.on { background: var(--accent-soft); color: var(--accent); font-weight: 600; }
.admin-nav a:hover { background: var(--surface-2); text-decoration: none; }
.admin-nav h4 { margin: 14px 10px 4px; }
.auth-box { max-width: 400px; margin: 70px auto; }
.footer { text-align: center; color: var(--faint); font-size: 12px; padding: 20px; }
audio, video { width: 100%; margin: 6px 0; }
.thumb { max-width: 100%; max-height: 260px; border-radius: 6px; border: 1px solid var(--line); background: #0e1118; }
