:root {
  --bg: #f6f7f9; --panel: #ffffff; --ink: #1b1f27; --muted: #667085; --line: #dde1e8; --accent: #2457d6; --accent-ink: #ffffff;
  --warn: #b45309; --bad: #b91c1c; --good: #15803d; --code: #eef0f4;
  --vt-ai-image: #6d3fc4; --vt-diagram: #0b6e99; --vt-screenshot: #a24a00; --vt-animation: #1b7a3d; --vt-other: #566074; --vt-ink: #ffffff;
  --serif: Georgia, "Times New Roman", serif;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #12151b; --panel: #1b2029; --ink: #e8ebf1; --muted: #98a1b2; --line: #2d3442; --accent: #6b9bff; --accent-ink: #0b1220;
    --warn: #f59e0b; --bad: #f87171; --good: #4ade80; --code: #242a36;
    --vt-ai-image: #b79cff; --vt-diagram: #5cc4ee; --vt-screenshot: #f0a45e; --vt-animation: #6fd391; --vt-other: #a3adc0; --vt-ink: #10131a;
  }
}
* { box-sizing: border-box; }
html { background: var(--bg); }
body { margin: 0; background: var(--bg); color: var(--ink); font: 14px/1.45 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; overflow-x: hidden; }
[hidden] { display: none !important; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.muted { color: var(--muted); }
.grow { flex: 1 1 auto; }
a, .link { color: var(--accent); }
h1 { font-size: 20px; margin: 0 0 8px; }
h2 { font-size: 16px; margin: 20px 0 8px; }
h3 { font-size: 14px; margin: 0 0 6px; }
code, .mono { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 12px; }
code { background: var(--code); padding: 1px 4px; border-radius: 4px; word-break: break-all; }

.signin { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 16px; }
.card { background: var(--panel); border: 1px solid var(--line); border-radius: 10px; padding: 24px; max-width: 420px; width: 100%; }

.top { position: sticky; top: 0; z-index: 5; display: flex; align-items: center; gap: 0 14px; padding: 0 16px; min-height: 50px;
  background: var(--panel); border-bottom: 1px solid var(--line); }
.brand { display: inline-flex; align-items: center; gap: 8px; font-size: 15px; color: var(--ink); text-decoration: none; flex: 0 0 auto; }
.brand .logo { display: block; }
.switcher { flex: 0 0 auto; }
.switcher select { max-width: 40vw; }
.nav { display: flex; align-self: stretch; align-items: stretch; gap: 2px; flex: 1 1 auto; min-width: 0; overflow-x: auto; white-space: nowrap; -webkit-overflow-scrolling: touch; }
.nav button { border: 0; border-bottom: 2px solid transparent; border-radius: 0; background: transparent; padding: 0 12px; flex: 0 0 auto; }
.nav button.on { border-bottom-color: var(--accent); color: var(--accent); font-weight: 600; }
@media (max-width: 900px) {
  .top { flex-wrap: wrap; padding-top: 6px; gap: 6px 12px; }
  .nav { order: 9; flex: 1 1 100%; min-height: 40px; margin: 0 -16px; padding: 0 16px; border-top: 1px solid var(--line); }
}
.view { padding: 16px 16px 64px; max-width: 1100px; margin: 0 auto; min-width: 0; }

button, .btn { font: inherit; cursor: pointer; border: 1px solid var(--line); background: var(--panel); color: var(--ink); padding: 5px 12px; border-radius: 6px; }
button:hover:not(:disabled) { border-color: var(--accent); }
button.primary { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }
button.danger { color: var(--bad); }
button:disabled { opacity: .5; cursor: not-allowed; }
a.link { cursor: pointer; }
input, select, textarea { font: inherit; color: var(--ink); background: var(--bg); border: 1px solid var(--line); border-radius: 6px; padding: 6px 8px; max-width: 100%; }
input[type=checkbox] { padding: 0; }
textarea { width: 100%; min-height: 70px; }
input[type=text], input[type=number], input[type=url] { min-width: 0; }
label.f { display: flex; flex-direction: column; gap: 3px; margin: 8px 0; font-size: 13px; }
label.f input, label.f textarea, label.f select { width: 100%; }
label.inline { display: inline-flex; align-items: center; gap: 6px; margin-right: 12px; }

.row { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin: 8px 0; }
.row.end { justify-content: flex-end; }
.panel { background: var(--panel); border: 1px solid var(--line); border-radius: 8px; padding: 12px; margin: 10px 0; min-width: 0; }
.msg { padding: 8px 10px; border-radius: 6px; border: 1px solid var(--line); background: var(--panel); margin: 8px 0; white-space: pre-wrap; word-break: break-word; }
.msg.err { border-color: var(--bad); color: var(--bad); }
.msg.ok { border-color: var(--good); color: var(--good); }
.msg.warn { border-color: var(--warn); color: var(--warn); }

.tbl { overflow-x: auto; border: 1px solid var(--line); border-radius: 8px; background: var(--panel); margin: 8px 0; max-width: 100%; }
table { border-collapse: collapse; width: 100%; font-size: 13px; }
th, td { text-align: left; padding: 7px 10px; border-bottom: 1px solid var(--line); vertical-align: top; }
th { font-size: 12px; color: var(--muted); font-weight: 600; white-space: nowrap; }
tr:last-child td { border-bottom: 0; }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; }
td.wrap { white-space: normal; word-break: break-word; }
tr.sel td { background: color-mix(in srgb, var(--accent) 10%, transparent); }
.low { color: var(--bad); font-weight: 600; }
.st-succeeded { color: var(--good); } .st-failed, .st-cancelled, .st-missing { color: var(--bad); } .st-running, .st-queued { color: var(--warn); }
.pill { display: inline-block; font-size: 12px; padding: 0 8px; border: 1px solid var(--line); border-radius: 999px; }

.banner { display: flex; gap: 12px; align-items: flex-start; padding: 8px 16px; background: var(--warn); color: #fff; font-weight: 600; }
.banner button { flex: 0 0 auto; }
.badge { font-size: 12px; padding: 2px 10px; border-radius: 999px; }
.badge.warn { background: var(--warn); border-color: var(--warn); color: #fff; font-weight: 700; }
.menu { position: fixed; z-index: 15; min-width: 180px; display: flex; flex-direction: column; padding: 4px; background: var(--panel); border: 1px solid var(--line); border-radius: 8px; box-shadow: 0 6px 20px rgba(0, 0, 0, .2); }
.menu button { text-align: left; border: 0; background: transparent; padding: 8px 12px; border-radius: 6px; }
.menu button:hover, .menu button:focus-visible { background: color-mix(in srgb, var(--accent) 12%, transparent); outline: none; }
button:focus-visible, a:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
tr.overdue td { background: color-mix(in srgb, var(--warn) 18%, transparent); font-weight: 600; }
a.back { text-decoration: none; }

details { margin: 6px 0; }
summary { cursor: pointer; }
dl.kv { display: grid; grid-template-columns: 140px minmax(0, 1fr); gap: 4px 12px; margin: 0; }
dl.kv dt { color: var(--muted); }
dl.kv dd { margin: 0; word-break: break-word; }

.toast { position: fixed; left: 16px; right: 16px; bottom: 16px; max-width: 480px; margin: 0 auto; padding: 10px 14px; background: var(--ink); color: var(--bg); border-radius: 8px; z-index: 30; }
.overlay { position: fixed; inset: 0; background: rgba(0, 0, 0, .55); display: flex; align-items: center; justify-content: center; padding: 16px; z-index: 20; }
.dialog { background: var(--panel); border: 1px solid var(--line); border-radius: 10px; padding: 16px; width: 100%; max-width: 560px; max-height: 90vh; overflow: auto; }
.dialog h2 { margin-top: 0; }
.secret { display: block; padding: 8px; background: var(--code); border-radius: 6px; word-break: break-all; user-select: all; }

@media (max-width: 600px) {
  dl.kv { grid-template-columns: 1fr; }
  .banner { flex-direction: column; }
}

/* storyboard table view */
.view.wide { max-width: none; }
.sp { min-width: 0; }
.sp-head { display: grid; grid-template-columns: minmax(0, 1fr); gap: 8px 24px; margin: 4px 0 12px; }
.sp-eyebrow { margin: 0 0 4px; font-size: 12px; letter-spacing: .12em; text-transform: uppercase; color: var(--muted); font-weight: 600; word-break: break-word; }
.sp-title { font-family: var(--serif); font-size: clamp(1.4rem, 4vw, 2rem); line-height: 1.15; margin: 0; font-weight: 700; word-break: break-word; }
.sp-actions { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.sp-actions .btn, .tbar .btn { text-decoration: none; display: inline-block; }
.sp-lede { margin: 0; color: var(--muted); }
.sp-livenote { margin: 0 0 12px; }
@media (min-width: 860px) {
  .sp-head { grid-template-columns: minmax(0, 1fr) auto; align-items: end; }
  .sp-actions { justify-content: flex-end; }
  .sp-lede { grid-column: 1 / -1; }
}
.sp-video { margin: 0 auto 12px; max-width: 720px; }
.sp-stage { aspect-ratio: 16 / 9; background: #000; border-radius: 10px; overflow: hidden; display: flex; align-items: center; justify-content: center; color: #c8cdd8; }
.sp-stage video { width: 100%; height: 100%; max-width: none; margin: 0; display: block; background: #000; object-fit: contain; }
.sp-stage.empty { background: var(--code); color: var(--muted); border: 1px dashed var(--line); }
.sp-stage > p { margin: 0; padding: 0 12px; text-align: center; }
.sp-stage .msg { margin: 12px; }
.sp-figcap { margin-top: 6px; font-size: 13px; color: var(--muted); text-align: center; }
.sp-rev { margin-top: 12px; }
.sp-rev summary { font-weight: 600; }

.settings { background: var(--panel); border: 1px solid var(--line); border-radius: 8px; padding: 8px 12px; margin: 8px 0; }
.settings > summary { font-weight: 600; }
.ss { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 8px 20px; margin-top: 8px; min-width: 0; }
.ss > * { min-width: 0; }
.ss-voice { grid-column: 1 / -1; padding: 8px 10px; border-left: 4px solid var(--accent); background: color-mix(in srgb, var(--accent) 8%, transparent); border-radius: 4px; }
.ss-sec:has(.tbl) { grid-column: 1 / -1; }
.ss h3 { margin: 4px 0; }
.mini-tbl { font-size: 12px; }
.mini-tbl td, .mini-tbl th { min-width: 90px; }

.tbar { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin: 8px 0; }
.tbar input[type=search] { min-width: 180px; flex: 1 1 200px; max-width: 360px; }
.colmenu { position: relative; display: inline-block; margin: 0; }
.colmenu > summary { cursor: pointer; border: 1px solid var(--line); background: var(--panel); border-radius: 6px; padding: 5px 12px; list-style: none; }
.colbox { position: absolute; z-index: 8; top: 100%; left: 0; margin-top: 4px; min-width: 240px; max-width: 88vw; padding: 8px 12px; background: var(--panel); border: 1px solid var(--line); border-radius: 8px; box-shadow: 0 6px 20px rgba(0, 0, 0, .2); display: flex; flex-direction: column; gap: 4px; }
.colbox label.inline { margin: 0; }

.stwrap { max-height: 80vh; overflow: auto; -webkit-overflow-scrolling: touch; }
table.stbl { table-layout: fixed; width: auto; border-collapse: separate; border-spacing: 0; }
.stbl th, .stbl td { border-right: 1px solid var(--line); border-bottom: 1px solid var(--line); padding: 8px; overflow: hidden; }
.stbl thead th { position: sticky; top: 0; z-index: 3; background: var(--panel); padding: 0; }
.stbl thead th:last-child { padding: 8px; }
.sortb { display: flex; width: 100%; justify-content: space-between; border: 0; border-radius: 0; background: transparent; padding: 8px; font-weight: 600; color: var(--muted); text-align: left; }
.sortb:hover:not(:disabled) { color: var(--accent); }
.stbl td { background: var(--panel); }
@media (min-width: 900px) {
  .stbl th:first-child, .stbl td:first-child { position: sticky; left: 0; z-index: 2; }
  .stbl thead th:first-child { z-index: 4; }
}
.cell { max-height: 340px; overflow: auto; overflow-wrap: anywhere; word-break: break-word; }
.fld { margin: 0 0 8px; }
.fld:last-child { margin-bottom: 0; }
.fl { font-size: 11px; font-weight: 600; color: var(--muted); margin: 0 0 1px; }
.leaf { white-space: pre-wrap; }
.leaf.nul { color: var(--muted); font-style: italic; }
.leaf.long { display: block; }
.fv { min-width: 0; }
dl.tl { display: grid; grid-template-columns: minmax(0, 38%) minmax(0, 1fr); gap: 2px 8px; margin: 0; }
dl.tl dt { color: var(--muted); font-size: 12px; }
dl.tl dd { margin: 0; min-width: 0; }
dl.tl dd > dl.tl, dl.tl dd > ul.tl, dl.tl dd > ol.tl { padding-left: 6px; border-left: 2px solid var(--line); }
ul.tl, ol.tl { margin: 0; padding-left: 16px; }
ol.tl > li { margin: 0 0 4px; }
button.mini { padding: 0 8px; font-size: 12px; margin-left: 6px; }
.leafedit { display: inline; }
.editor { margin: 4px 0; }
.editor textarea, .editor input { width: 100%; }
.ed-count.over { color: var(--bad); font-weight: 600; }
.ed-msg .msg { margin: 4px 0; }
.asset { border: 1px solid var(--line); border-radius: 6px; padding: 6px; margin: 0 0 6px; }
.asset-id { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; margin-bottom: 4px; }
.pill.warn { color: var(--warn); border-color: var(--warn); }
.thumb { aspect-ratio: 16 / 9; width: 100%; border-radius: 6px; overflow: hidden; background: var(--code); display: flex; align-items: center; justify-content: center; color: var(--muted); font-size: 12px; }
.thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.json { white-space: pre-wrap; word-break: break-all; font-size: 11px; background: var(--code); padding: 6px; border-radius: 4px; margin: 4px 0; max-height: 260px; overflow: auto; }
.allf { margin: 0; }
.allpaths { grid-template-columns: 1fr; gap: 0; }
.allpaths dt { margin-top: 4px; color: var(--ink); }
.allpaths dd { padding-left: 8px; }
@media (max-width: 600px) {
  .ss { grid-template-columns: 1fr; }
  .tbar input[type=search] { max-width: none; }
}

/* scene summary table and drill-down drawer */
.sumwrap { position: relative; }
.sumtbl { border-collapse: collapse; width: 100%; background: var(--panel); border: 1px solid var(--line); border-radius: 8px; }
.sumtbl th { text-align: left; font-size: 12px; letter-spacing: .05em; text-transform: uppercase; color: var(--muted); padding: 8px 10px; border-bottom: 1px solid var(--line); white-space: nowrap; }
.sumtbl td { padding: 10px; border-bottom: 1px solid var(--line); vertical-align: top; }
.sumtbl tbody tr { cursor: pointer; }
.sumtbl tbody tr:hover, .sumtbl tbody tr.sel { background: var(--code); }
.sumtbl tbody tr:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; }
.sumtbl td.num { font-variant-numeric: tabular-nums; white-space: nowrap; color: var(--muted); }
.sumtbl .thumb { width: 132px; }
.sumtbl .vmeta { margin-top: 4px; }
.sumtbl .vt { display: inline-block; font-size: 11px; padding: 1px 7px; border-radius: 10px; background: var(--code); }
.shead { font-family: var(--serif); font-weight: 700; font-size: 15px; line-height: 1.3; }
.snar { color: var(--muted); margin-top: 3px; max-width: 64ch; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.sos { font-size: 13px; max-width: 28ch; }
.sos div { margin-bottom: 3px; }
.chip { display: inline-block; font-size: 11px; padding: 1px 8px; border-radius: 10px; background: var(--code); white-space: nowrap; }
.chip.warn { color: var(--warn); border: 1px solid var(--warn); }
.drawer { position: fixed; top: 0; right: 0; bottom: 0; width: min(640px, 100%); z-index: 30; background: var(--panel); border-left: 1px solid var(--line);
  box-shadow: -12px 0 30px rgba(0, 0, 0, .2); display: flex; flex-direction: column; }
.dhead { display: flex; gap: 8px; align-items: center; padding: 12px 16px; border-bottom: 1px solid var(--line); }
.dtitle { flex: 1 1 auto; margin: 0; font-family: var(--serif); font-size: 18px; line-height: 1.25; min-width: 0; }
.dtabs { display: flex; gap: 2px; padding: 4px 12px 0; border-bottom: 1px solid var(--line); overflow-x: auto; white-space: nowrap; }
.dtabs button { border: 0; border-bottom: 2px solid transparent; border-radius: 0; background: transparent; padding: 8px 10px; color: var(--muted); flex: 0 0 auto; }
.dtabs button[aria-selected=true] { color: var(--accent); border-bottom-color: var(--accent); font-weight: 600; }
.dbody { overflow: auto; padding: 8px 16px 24px; flex: 1 1 auto; min-height: 0; }
.dpanel .fld { margin-top: 14px; }
.dfoot { padding: 10px 16px; border-top: 1px solid var(--line); font-size: 12px; }
@media (max-width: 760px) { .hide-s { display: none; } .sumtbl .thumb { width: 96px; } .dtitle { font-size: 16px; } }
.vt.vt-ai-image { background: var(--vt-ai-image); color: var(--vt-ink); }
.vt.vt-diagram { background: var(--vt-diagram); color: var(--vt-ink); }
.vt.vt-screenshot { background: var(--vt-screenshot); color: var(--vt-ink); }
.vt.vt-animation { background: var(--vt-animation); color: var(--vt-ink); }
.vt.vt-other { background: var(--vt-other); color: var(--vt-ink); }
@media (max-width: 760px) { .sumtbl th, .sumtbl td { padding: 8px 5px; } .sumtbl .thumb { width: 72px; } .shead { font-size: 14px; } }

.sp-titles { display: flex; gap: 14px; align-items: center; min-width: 0; }
.sp-tt { min-width: 0; }
.sp-thumb { position: relative; flex: 0 0 auto; align-self: stretch; min-height: 62px; aspect-ratio: 16 / 9; padding: 0; border: 1px solid var(--line); border-radius: 6px; overflow: hidden;
  background: #000; cursor: pointer; display: flex; align-items: center; justify-content: center; color: #fff; }
.sp-thumb img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; opacity: .85; }
.sp-thumb .play { position: relative; font-size: 18px; text-shadow: 0 1px 4px rgba(0, 0, 0, .7); }
.sp-thumb:hover img { opacity: 1; }
.sp-thumb.none { background: var(--code); color: var(--muted); font-size: 11px; cursor: default; }
.dialog.wide { width: min(960px, 96vw); max-width: 96vw; }
.dialog.wide .sp-stage { width: 100%; }
.tbar #mode-toggle { margin-left: auto; }
.top .badge, #signout { white-space: nowrap; flex: 0 0 auto; }
#who { white-space: nowrap; flex: 0 0 auto; }
@media (max-width: 1150px) { #who { display: none; } }
.sumtbl td.lead { width: 230px; }
.sumtbl td.lead .thumb { width: 100%; max-width: 220px; }
.smeta { display: flex; flex-wrap: wrap; align-items: center; gap: 2px 8px; margin-top: 6px; font-size: 12px; color: var(--muted); font-variant-numeric: tabular-nums; }
.smeta b { color: var(--ink); }
.smeta .sid { opacity: .7; }
.sumtbl td.what { max-width: 46ch; }
.sumtbl .pic { margin: 0 0 6px; }
.sumtbl .mo { margin: 0 0 4px; font-size: 13px; }
.sumtbl .mo span { display: inline-block; margin-right: 8px; font-size: 11px; letter-spacing: .05em; text-transform: uppercase; color: var(--muted); }
.snar.none { font-style: italic; }
@media (max-width: 760px) { .sumtbl td.lead { width: 112px; } .smeta .sid { display: none; } }
.sp-titles { align-items: stretch; }
.sp-tt { display: flex; flex-direction: column; justify-content: center; gap: 4px; }
@media (min-width: 761px) { .sp-head { align-items: stretch; } .sp-actions { align-self: end; } }
.sp-top { display: grid; grid-template-columns: 280px minmax(0, 1fr); gap: 16px; align-items: stretch; margin: 4px 0 12px; }
.sp-top .sp-thumb { height: auto; min-height: 120px; aspect-ratio: auto; width: 100%; }
.sp-main { min-width: 0; display: flex; flex-direction: column; gap: 8px; }
.sp-main .sp-head { margin: 0; }
.sp-bar .tbar { margin: 0; }
@media (max-width: 760px) { .sp-top { grid-template-columns: minmax(0, 1fr); } .sp-top .sp-thumb { aspect-ratio: 16 / 9; min-height: 0; } }
@media (max-width: 760px) { .sp-top .sp-thumb { max-height: 190px; width: auto; max-width: 100%; justify-self: start; } }
