:root {
  color-scheme: light;
  --bg: #f6f7f9; --panel: #ffffff; --ink: #1d2330; --muted: #5d6677; --line: #dfe3ea;
  --accent: #2f5fd0; --accent-ink: #ffffff; --warn-bg: #fff4d6; --warn-ink: #5a4300;
  --err: #a52020; --ok: #1b6b3a; --sim: #7a3db8; --focus: #1a73e8;
}
@media (prefers-color-scheme: dark) {
  :root { color-scheme: dark; --bg: #14171d; --panel: #1c212b; --ink: #e8ebf2; --muted: #9aa4b6; --line: #2d3442;
    --accent: #6c93f5; --accent-ink: #0b1020; --warn-bg: #3a2f10; --warn-ink: #f3dca0; --err: #ff8a8a; --ok: #78d39a; --sim: #c9a2ff; --focus: #8ab4f8; }
}
* { box-sizing: border-box; }
html { font-size: 16px; }
body { margin: 0; background: var(--bg); color: var(--ink); font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; line-height: 1.5; }
a { color: var(--accent); }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; }
.banner { padding: .5rem 1rem; font-size: .9rem; }
.banner-sim { background: var(--warn-bg); color: var(--warn-ink); border-bottom: 2px solid var(--sim); }
.topbar { display: flex; align-items: center; gap: 1rem; padding: .6rem 1rem; background: var(--panel); border-bottom: 1px solid var(--line); flex-wrap: wrap; }
.brand { font-weight: 700; text-decoration: none; letter-spacing: .02em; }
.crumb a { text-decoration: none; }
.spacer { flex: 1; }
.who { color: var(--muted); font-size: .9rem; }
.projnav { display: flex; gap: .25rem; padding: 0 1rem; background: var(--panel); border-bottom: 1px solid var(--line); overflow-x: auto; }
.projnav a { padding: .6rem .9rem; text-decoration: none; color: var(--muted); border-bottom: 3px solid transparent; white-space: nowrap; }
.projnav a[aria-current="page"] { color: var(--ink); border-bottom-color: var(--accent); font-weight: 600; }
#page { min-height: 100vh; display: flex; flex-direction: column; }
main { max-width: 1200px; width: 100%; box-sizing: border-box; margin: 1.5rem auto; padding: 0 1rem; flex: 1 0 auto; }
.foot { position: sticky; bottom: 0; z-index: 20; display: flex; justify-content: space-between; align-items: center; gap: 1rem; color: var(--muted); font-size: .75rem; padding: .25rem 1rem; background: var(--panel); border-top: 1px solid var(--line); min-height: 1.6rem; }
.foot-status { text-align: right; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; } .foot-status.bad { color: var(--err); }
.formgrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(18rem, 1fr)); gap: .6rem 1rem; }
.card { background: var(--panel); border: 1px solid var(--line); border-radius: 10px; padding: 1.25rem 1.5rem; margin-bottom: 1.25rem; }
.card.narrow { max-width: 520px; margin-left: auto; margin-right: auto; }
h1 { font-size: 1.4rem; margin: 0 0 .75rem; } h2 { font-size: 1.1rem; margin: 0 0 .75rem; }
label { display: block; margin: .6rem 0; font-size: .92rem; }
input, select, textarea { display: block; width: 100%; padding: .5rem .6rem; margin-top: .25rem; font: inherit; color: var(--ink); background: var(--bg); border: 1px solid var(--line); border-radius: 6px; }
label.check { display: flex; gap: .5rem; align-items: center; } label.check input { width: auto; margin: 0; }
button { font: inherit; padding: .5rem 1rem; border: 0; border-radius: 6px; background: var(--accent); color: var(--accent-ink); cursor: pointer; }
button.secondary { background: transparent; color: var(--accent); border: 1px solid var(--accent); }
button[disabled], button.blocked { opacity: .55; cursor: not-allowed; }
button.link { background: none; color: var(--accent); padding: 0 .25rem; text-decoration: underline; }
form.inline { display: inline; } form.inline select { display: inline; width: auto; padding: .2rem; }
.table { width: 100%; border-collapse: collapse; } .table th, .table td { text-align: left; padding: .5rem .6rem; border-bottom: 1px solid var(--line); }
.table th { font-size: .8rem; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; }
.muted { color: var(--muted); font-size: .9rem; } .error { color: var(--err); } .flash { background: var(--warn-bg); color: var(--warn-ink); padding: .6rem .9rem; border-radius: 6px; }
.row { display: flex; align-items: center; gap: 1rem; } .list { list-style: none; padding: 0; margin: 0; } .list li { padding: .4rem 0; border-bottom: 1px solid var(--line); }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 0 1rem; } .span2 { grid-column: span 2; }
@media (max-width: 640px) { .grid2 { grid-template-columns: 1fr; } .span2 { grid-column: auto; } }
.tag { font-size: .75rem; padding: .1rem .45rem; border: 1px solid var(--line); border-radius: 999px; color: var(--muted); }
.tag.sim { border-color: var(--sim); color: var(--sim); }
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: .75rem; }
.stat { border: 1px solid var(--line); border-radius: 8px; padding: .75rem 1rem; } .stat .n { display: block; font-size: 1.5rem; font-weight: 700; }
.stat.sim { border-color: var(--sim); }
.dropzone { border: 2px dashed var(--line); border-radius: 10px; padding: 1.5rem; text-align: center; cursor: pointer; }
.dropzone.over, .dropzone:focus-visible { border-color: var(--accent); background: color-mix(in srgb, var(--accent) 8%, transparent); }
.upload-list { list-style: none; padding: 0; margin: .75rem 0 0; } .upload-list li { display: flex; gap: .75rem; align-items: center; padding: .25rem 0; flex-wrap: wrap; }
.upload-list progress { width: 160px; }
.filters { display: flex; flex-wrap: wrap; gap: .25rem 1rem; align-items: end; margin-bottom: 1rem; } .filters label { margin: 0; } .filters input, .filters select { width: auto; min-width: 8rem; }
.grid-media { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: .75rem; }
.tile { display: block; border: 1px solid var(--line); border-radius: 8px; padding: .5rem; text-decoration: none; color: var(--ink); }
.tile img, .tile .ph { width: 100%; height: 110px; object-fit: cover; border-radius: 4px; background: var(--bg); display: flex; align-items: center; justify-content: center; color: var(--muted); }
.tile .cap { display: block; font-size: .85rem; margin-top: .35rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.badges { display: flex; flex-wrap: wrap; gap: .2rem; margin-top: .25rem; }
.tag.ok { border-color: var(--ok); color: var(--ok); } .tag.bad { border-color: var(--err); color: var(--err); }
.props { display: grid; grid-template-columns: 9rem 1fr; gap: .25rem 1rem; } .props dt { color: var(--muted); } .props dd { margin: 0; word-break: break-all; }
.inline-form { margin-top: 1rem; display: flex; gap: 1rem; align-items: end; } .inline-form input { width: auto; }
.preview { margin: 1rem 0; }
.role { padding: .5rem 0; border-bottom: 1px solid var(--line); } fieldset { border: 1px solid var(--line); border-radius: 6px; margin: .6rem 0; } legend { color: var(--muted); font-size: .85rem; }
pre.prompt { white-space: pre-wrap; background: var(--bg); border: 1px solid var(--line); border-radius: 6px; padding: .75rem; max-height: 22rem; overflow: auto; }
details { margin: .6rem 0; } summary { cursor: pointer; } .inline { display: inline-flex; gap: .25rem; align-items: center; } .inline input { width: auto; }
h3 { font-size: 1rem; margin: 1rem 0 .4rem; }

.ai-actions { margin-top: 1rem; border-top: 1px dashed var(--line); padding-top: .5rem; }
.source-text { white-space: pre-wrap; font-family: Georgia, serif; line-height: 1.7; max-height: 36rem; overflow: auto; border: 1px solid var(--line); border-radius: 6px; padding: 1rem; }
.seg-heading { font-weight: 700; display: block; margin-top: .6rem; } .seg-stage_direction { color: var(--muted); font-style: italic; } .seg-dialogue[data-speaker]::first-line { font-weight: 600; }
ins { text-decoration: none; background: color-mix(in srgb, var(--ok) 18%, transparent); } del { color: var(--muted); }

/* Media player: waveform always fits its container; playhead and readout track playback */
.player { max-width: 100%; }
.player .wave { position: relative; width: 100%; height: 96px; background: rgba(0,0,0,.25); border-radius: 6px; overflow: hidden; cursor: pointer; }
.player .wave img { display: block; width: 100%; height: 100%; object-fit: fill; user-select: none; }
.player .wave .playhead { position: absolute; top: 0; bottom: 0; left: 0; width: 2px; background: #ffd166; box-shadow: 0 0 4px rgba(255,209,102,.8); pointer-events: none; }
.player .wave:focus-visible { outline: 2px solid var(--accent, #7aa2ff); }
.player .readout { font-variant-numeric: tabular-nums; font-family: ui-monospace, Menlo, Consolas, monospace; margin: .5rem 0; }
.player audio { width: 100%; max-width: 100%; }

.titlerow { display: flex; align-items: center; gap: .9rem; margin: .25rem 0 .75rem; }
.titlerow h1 { margin: 0; }
.playbtn { flex: none; width: 52px; height: 52px; border-radius: 50%; padding: 0; display: grid; place-items: center; background: #5b7cff; border: 0; cursor: pointer; box-shadow: 0 2px 10px rgba(91,124,255,.45); transition: transform .12s, background .12s; }
.playbtn:hover { background: #7390ff; transform: scale(1.06); }
.playbtn:focus-visible { outline: 2px solid #ffd166; outline-offset: 3px; }
.playbtn svg { width: 28px; height: 28px; fill: #fff; }
.playbtn .i-pause { display: none; }
.playbtn.playing .i-play { display: none; }
.playbtn.playing .i-pause { display: inline; }
.player .controls { display: flex; align-items: center; gap: .6rem; margin: .5rem 0; }
.player .controls .spacer { flex: 1; }
.player .controls .readout { margin: 0; }
.player .ctl { background: transparent; border: 1px solid var(--line); color: inherit; border-radius: 6px; padding: .2rem .55rem; cursor: pointer; font-variant-numeric: tabular-nums; }
.player .ctl:hover { border-color: #5b7cff; }
.player .vol { display: inline-flex; align-items: center; gap: .35rem; }
.player .vol svg { width: 18px; height: 18px; fill: currentColor; opacity: .7; }
.player .vol input { width: 90px; accent-color: #5b7cff; }

.bulkbar { display: flex; flex-wrap: wrap; align-items: center; gap: .75rem; margin: .5rem 0 1rem; }
.tilewrap { position: relative; }
.tilewrap .pick { position: absolute; z-index: 2; margin: 8px; width: 18px; height: 18px; accent-color: #5b7cff; }

.pdfview { width: 100%; height: 78vh; min-height: 480px; border: 1px solid var(--line); border-radius: 6px; background: #fff; }

/* Media: folder tree beside the upload/grid area */
.mediawrap { display: grid; grid-template-columns: 250px minmax(0, 1fr); gap: 1.25rem; align-items: start; max-width: 1500px; }
.foldertree { position: sticky; top: .75rem; padding: 1rem; }
.foldertree h2 { margin: 0 0 .5rem; font-size: 1rem; }
.tree { list-style: none; margin: 0 0 .75rem; padding: 0; }
.tree .node { display: flex; align-items: center; justify-content: space-between; gap: .4rem; padding: .35rem .55rem; border-radius: 6px; color: inherit; text-decoration: none; border: 1px solid transparent; }
.tree .node:hover { background: rgba(91,124,255,.12); }
.tree .node.sel { background: rgba(91,124,255,.28); border-color: #5b7cff; font-weight: 600; }
.tree .node.over { outline: 2px dashed #ffd166; background: rgba(255,209,102,.15); }
.tree .n { font-size: .75rem; opacity: .65; font-variant-numeric: tabular-nums; }
.newfolder { display: flex; gap: .35rem; margin: .4rem 0; }
.newfolder input { flex: 1; min-width: 0; }
.folderops summary { cursor: pointer; font-size: .85rem; opacity: .8; margin: .4rem 0; }
.small { font-size: .78rem; }
.ctx { font-weight: 400; font-size: 1rem; }
.tilewrap[draggable], .tilewrap { cursor: grab; }
@media (max-width: 800px) { .mediawrap { grid-template-columns: 1fr; } .foldertree { position: static; } }

/* Reference studio */
form textarea { width: 100%; resize: vertical; min-height: 3.2rem; font: inherit; }
.attempt { border: 1px solid var(--line); border-radius: 8px; padding: .75rem 1rem; margin: .75rem 0; }
.attempt .prompt-text { margin: .4rem 0; white-space: pre-wrap; }
.cands { display: flex; flex-wrap: wrap; gap: .75rem; margin: .5rem 0; }
.cand { margin: 0; width: 200px; }
.cand img { width: 100%; height: 170px; object-fit: cover; border-radius: 6px; background: var(--bg); display: block; }
.cand.rejected img { opacity: .4; }
.cand.approved img { outline: 2px solid #3ecf8e; }
.cand figcaption { font-size: .8rem; margin-top: .25rem; }

/* Sliders: compact, three-state (inherit / set / clear) */
.sliders { display: grid; grid-template-columns: repeat(auto-fill, minmax(330px, 1fr)); gap: .35rem 1.5rem; margin: .25rem 0 .75rem; }
.slider-row { padding: .25rem 0; }
.sl-head { display: flex; justify-content: space-between; align-items: baseline; font-size: .9rem; }
.sl-out { background: transparent; border: 0; color: var(--muted, #8a93a6); font: inherit; font-size: .8rem; cursor: pointer; padding: 0 .25rem; min-width: 3.5rem; text-align: right; font-variant-numeric: tabular-nums; }
.slider-row[data-state="set"] .sl-out { color: #7fa0ff; font-weight: 600; }
.slider-row[data-state="clear"] .sl-out { color: #ffb86b; }
.sl-track { display: flex; align-items: center; gap: .5rem; }
.sl-end { font-size: .72rem; color: var(--muted, #8a93a6); min-width: 4.2rem; }
.sl-end:nth-of-type(2) { text-align: left; }
.sl-track input[type="range"] { flex: 1; min-width: 90px; max-width: 200px; height: 4px; accent-color: #5b7cff; }
.slider-row[data-state="inherit"] input[type="range"], .slider-row[data-state="clear"] input[type="range"] { opacity: .4; }
.sl-btn { background: transparent; border: 1px solid var(--line); color: inherit; border-radius: 4px; padding: 0 .35rem; font-size: .8rem; cursor: pointer; line-height: 1.4; }
.sl-btn:hover { border-color: #5b7cff; }
.disp-summary { background: rgba(91,124,255,.1); border-left: 3px solid #5b7cff; padding: .5rem .75rem; margin: .75rem 0; border-radius: 4px; }
.sliderform h3 { margin: 1rem 0 .1rem; font-size: 1rem; }

/* Transcripts */
.txtabs { display: flex; flex-wrap: wrap; gap: .5rem; margin: .5rem 0; }
.txtab { border: 1px solid var(--line); border-radius: 6px; padding: .3rem .6rem; text-decoration: none; color: inherit; }
.txtab.sel { border-color: #5b7cff; background: rgba(91,124,255,.18); }
.txhead { display: flex; flex-wrap: wrap; gap: .75rem; align-items: center; margin: .75rem 0 .25rem; }
.segs { list-style: none; margin: .5rem 0; padding: 0; max-height: 420px; overflow-y: auto; border: 1px solid var(--line); border-radius: 8px; }
.segs.ro { max-height: 220px; }
.seg { display: flex; gap: .6rem; align-items: baseline; padding: .3rem .6rem; border-bottom: 1px solid var(--line); }
.seg:last-child { border-bottom: 0; }
.seg.now { background: rgba(255,209,102,.16); box-shadow: inset 3px 0 0 #ffd166; }
.seg .time { background: transparent; border: 0; color: #7fa0ff; cursor: pointer; font-family: ui-monospace, Menlo, Consolas, monospace; font-size: .8rem; padding: 0; white-space: nowrap; }
.seg .segtext { flex: 1; white-space: pre-wrap; }
.segedit summary { cursor: pointer; font-size: .75rem; opacity: .7; }
.segedit form { width: min(520px, 90vw); }
.linkform { display: flex; flex-wrap: wrap; gap: .6rem; align-items: center; margin: .5rem 0; }
.mono { font-family: ui-monospace, Menlo, Consolas, monospace; font-size: .85rem; }
.card.inner { background: transparent; border-style: dashed; margin-top: 1rem; }

/* Story adaptation */
.btnlink { display: inline-block; padding: .4rem .8rem; border: 1px solid #5b7cff; border-radius: 6px; text-decoration: none; color: #c9d6ff; background: rgba(91,124,255,.15); }
.btnlink:hover { background: rgba(91,124,255,.3); }
.dialopt { display: block; margin: .35rem 0; }
.concept { border: 1px solid var(--line); border-radius: 8px; padding: .6rem 1rem; margin: .6rem 0; }
.concept.chosen { border-color: #3ecf8e; }
.concept.rejected { opacity: .55; }
.concept h3 { margin: .1rem 0 .3rem; }

/* Checkboxes and radios are controls, not text fields: never stretched to the width of the row */
input[type="checkbox"], input[type="radio"] { display: inline-block; width: auto; margin: 0; padding: 0; flex: none; accent-color: #5b7cff; }
.seg { min-width: 0; }
.seg .segpick { margin-top: .25rem; }
.seg .segtext { flex: 1 1 auto; min-width: 0; overflow-wrap: anywhere; }
.seg .time { flex: none; }

.seg.excluded .segtext { text-decoration: line-through; opacity: .45; }
.remap { border: 1px solid #5b7cff; border-radius: 8px; padding: .5rem 1rem; margin: .75rem 0; background: rgba(91,124,255,.08); }
.retx { margin: .5rem 0; }
.retx form { display: grid; gap: .5rem; max-width: 520px; margin-top: .5rem; }

/* Persistent audio player (outside the swapped page) */
.dock { position: fixed; left: 0; right: 0; bottom: 0; z-index: 50; display: flex; align-items: center; gap: .75rem; padding: .5rem 1rem; background: #151a28; border-top: 1px solid #5b7cff; box-shadow: 0 -4px 16px rgba(0,0,0,.4); }
.dock[hidden] { display: none; }
body.has-dock { padding-bottom: 3.5rem; }
.dock-play { flex: none; width: 36px; height: 36px; border-radius: 50%; padding: 0; background: #5b7cff; border: 0; cursor: pointer; display: grid; place-items: center; }
.dock-play svg { width: 20px; height: 20px; fill: #fff; }
.dock-title { flex: 0 1 28ch; min-width: 6ch; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: #c9d6ff; text-decoration: none; font-weight: 600; }
.dock-time { flex: none; font-size: .8rem; opacity: .8; }
.dock-seek { flex: 1 1 auto; min-width: 80px; margin: 0; accent-color: #5b7cff; height: 4px; padding: 0; }
.dock-close { flex: none; background: transparent; border: 1px solid var(--line); color: inherit; border-radius: 6px; width: 30px; height: 30px; cursor: pointer; font-size: 1.1rem; line-height: 1; padding: 0; }
@media (max-width: 600px) { .dock-title { display: none; } }

/* Review */
.statuschips { gap: .5rem; margin: .5rem 0; flex-wrap: wrap; }
.chip { border: 1px solid var(--line); border-radius: 999px; padding: .15rem .7rem; text-decoration: none; color: inherit; font-size: .85rem; }
.chip.sel { border-color: #5b7cff; background: rgba(91,124,255,.2); }
.chip .n { opacity: .6; margin-left: .25rem; }
.takegrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: .9rem; }
.takecard { border: 1px solid var(--line); border-radius: 8px; overflow: hidden; background: rgba(255,255,255,.02); }
.takecard.approved { border-color: #3ecf8e; }
.takecard.rejected { opacity: .6; }
.takecard .thumb { display: block; }
.takecard img, .takecard .ph { width: 100%; height: 140px; object-fit: cover; display: flex; align-items: center; justify-content: center; background: var(--bg); color: var(--muted); }
.cardbody { padding: .5rem .7rem; display: grid; gap: .25rem; }
.reviewer video { width: 100%; max-height: 62vh; background: #000; border-radius: 6px; }
.reviewer:focus { outline: 1px dashed #5b7cff; outline-offset: 4px; }
.framebar { display: flex; flex-wrap: wrap; align-items: center; gap: .6rem; margin: .5rem 0; }
.framebar .ctl { background: transparent; border: 1px solid var(--line); color: inherit; border-radius: 6px; padding: .2rem .6rem; cursor: pointer; }
.framebar .ctl:hover { border-color: #5b7cff; }
.compare video { width: 100%; background: #000; border-radius: 6px; }

/* Timeline editor */
.tl-toolbar { display: flex; flex-wrap: wrap; align-items: center; gap: .35rem .6rem; margin-top: .4rem; }
.tl-toolbar .ctl { background: transparent; border: 1px solid var(--line); color: inherit; border-radius: 6px; padding: .15rem .55rem; font-size: .85rem; min-height: 0; cursor: pointer; }
.tl-toolbar select, .tl-toolbar input[type=range] { width: auto; display: inline-block; margin: 0; } .tl-toolbar input[type=range] { width: 7rem; } .tl-toolbar select { padding: .15rem .4rem; font-size: .85rem; }
.tl .pbtn { font-size: .75rem; padding: .15rem .5rem; min-height: 0; line-height: 1.2; border: 1px solid var(--line); background: transparent; color: var(--ink); border-radius: 5px; cursor: pointer; }
.tl .pbtn:hover { background: rgba(127,127,127,.18); } .tl-top.card { padding: .7rem 1rem; margin-bottom: .6rem; } .tl-top h1 { font-size: 1.15rem; margin: 0 .4rem; }
.tl-take { display: flex; justify-content: space-between; align-items: center; gap: .5rem; padding: .25rem .3rem; border-bottom: 1px solid var(--line); }
.tl-take.cur { background: rgba(91,124,255,.15); }
.issue { padding: .25rem .3rem; border-left: 3px solid transparent; font-size: .85rem; cursor: pointer; }
.issue.error { border-left-color: #d96a6a; }
.issue.warning { border-left-color: #ffd166; }
.tl-insp .grid2 { gap: .4rem .6rem; }

/* Background work: header indicator, panel, toasts */
.activity-slot { position: relative; margin-right: .75rem; }
.act-btn { background: transparent; border: 1px solid var(--line); color: inherit; border-radius: 999px; padding: .15rem .7rem; cursor: pointer; font-size: .85rem; display: inline-flex; gap: .4rem; align-items: center; }
.act-btn.busy .act-ico { animation: actspin 1.2s linear infinite; display: inline-block; }
.act-btn.has { border-color: #3ecf8e; color: #3ecf8e; }
@keyframes actspin { to { transform: rotate(360deg); } }
.act-panel { position: absolute; right: 0; top: 2.2rem; width: min(380px, 92vw); max-height: 70vh; overflow: auto; background: #151a28; border: 1px solid #5b7cff; border-radius: 8px; padding: .5rem; z-index: 60; box-shadow: 0 8px 24px rgba(0,0,0,.5); }
.act-item { display: flex; gap: .5rem; padding: .4rem; border-radius: 6px; text-decoration: none; color: inherit; }
.act-item:hover { background: rgba(91,124,255,.15); }
.act-item .mark { width: 1.2rem; text-align: center; }
.act-item.done .mark { color: #3ecf8e; } .act-item.failed .mark { color: #d96a6a; } .act-item.running .mark { color: #ffd166; }
.toasts { position: fixed; right: 1rem; bottom: 4rem; z-index: 70; display: grid; gap: .6rem; max-width: min(380px, 92vw); }
.toast { background: #151a28; border: 1px solid #5b7cff; border-left-width: 4px; border-radius: 8px; padding: .6rem .8rem; box-shadow: 0 8px 24px rgba(0,0,0,.5); display: grid; gap: .4rem; }
.toast.ok { border-left-color: #3ecf8e; } .toast.bad { border-left-color: #d96a6a; }

.radios { display: inline-flex; gap: .8rem; border: 0; margin: 0; padding: 0; } .sr { position: absolute; left: -9999px; }
.scenecard { border: 1px solid var(--line); border-radius: 8px; padding: .6rem 1rem; margin: .7rem 0; }
.scenecard.applied { border-color: #3ecf8e; } .scenecard.left_out { opacity: .6; } .scenecard.problem { border-color: #e5534b; }
.scenecard label { display: block; } .scenecard .row label { display: inline-block; } .scenecard textarea, .scenecard input:not([type=checkbox]) { width: 100%; box-sizing: border-box; }
.scenecard .row > .grow { flex: 1; min-width: 12rem; } .scenecard .row select { width: auto; }
.beats { padding-left: 1.4rem; } .beats li { margin: .5rem 0; } .beats li.left_out { opacity: .55; }
.castpick { border: 0; padding: 0; margin: .5rem 0; } .castpick label { display: inline-block; margin-right: 1rem; }
.breakdown { margin-left: .5rem; } .acceptbar { gap: .8rem; align-items: center; margin-top: .8rem; }
.breakform textarea { width: 100%; box-sizing: border-box; }

.navwrap { background: var(--panel); border-bottom: 1px solid var(--line); }
.navwrap .projnav { border-bottom: 0; }
.projnav .navgap { flex: 1; } .projnav a.tool { font-size: .9rem; }
.projnav a .mark { display: inline-block; margin-left: .4rem; font-size: .72rem; font-weight: 400; padding: .05rem .4rem; border-radius: 999px; background: rgba(127,127,127,.18); color: var(--muted); }
.projnav a .mark.done { background: rgba(62,207,142,.18); color: #3ecf8e; } .projnav a .mark.attention { background: rgba(255,209,102,.2); color: #ffd166; }
.projnav a.waiting { opacity: .55; }
.subnav { display: flex; flex-wrap: wrap; align-items: center; padding: 0 1rem; min-height: 2.6rem; border-top: 1px solid var(--line); }
.subtabs { display: flex; gap: .2rem; } .subtabs a { padding: .35rem .7rem; text-decoration: none; color: var(--muted); border-radius: 6px; }
.subtabs a[aria-current="page"] { color: var(--ink); background: rgba(127,127,127,.18); } .subtabs .mark { margin-left: .35rem; font-size: .72rem; opacity: .8; }
/* The notch: a small triangle hanging from the line above the tabs over the tab where the next useful work is. */
.projnav a { position: relative; }
.projnav a.next::before { content: ""; position: absolute; top: -1px; left: 50%; transform: translateX(-50%); border-left: 8px solid transparent; border-right: 8px solid transparent; border-top: 8px solid var(--line); }
.crumb + .crumb::before { content: "\00bb"; margin-right: .45rem; color: var(--muted); } .crumb + .crumb { margin-left: -.55rem; }
.trail { margin: 0 0 .6rem; } .trail ol { display: flex; flex-wrap: wrap; list-style: none; padding: 0; margin: 0; font-size: .88rem; color: var(--muted); }
.trail li + li::before { content: "\00bb"; margin: 0 .45rem; } .trail a { text-decoration: none; } .trail [aria-current="page"] { color: var(--ink); }
/* "+" add panels: a plus at the top right opens a wide compact form above the list */
/* Add buttons sit in the top-right corner of their card as part of its border: the top-right follows the card's curve, the bottom-left is curved, the other two corners are square where they meet the border */
.card { position: relative; }
.addpanel { margin: 0 0 .8rem; }
.addpanel > summary { list-style: none; cursor: pointer; display: inline-block; padding: .4rem 1rem; font-size: .8rem; font-weight: 600; letter-spacing: .06em; text-transform: uppercase;
  color: #fff; background: var(--accent); border: 1px solid var(--accent); border-radius: 6px; user-select: none; }
.card > .addpanel:first-of-type > summary, .card > h1 ~ .addpanel:first-of-type > summary { position: absolute; top: -1px; right: -1px; z-index: 2; border-radius: 0 10px 0 10px; margin: 0; }
.addpanel > summary::-webkit-details-marker { display: none; }
.addpanel > summary:hover { filter: brightness(1.12); }
.addpanel[open] > summary { filter: brightness(.85); }
.card > .addpanel ~ .addpanel > summary { position: static; display: inline-block; border-radius: 6px; margin-top: .4rem; }
.card:has(> .addpanel) > h1 { padding-right: 9rem; }
.backtri { display: inline-block; margin-right: .55rem; color: var(--accent); text-decoration: none; font-size: .8em; vertical-align: .08em; }
.backtri:hover { filter: brightness(1.3); }
.prow a.pedit { text-decoration: none; display: inline-block; }
.addbody { background: var(--panel); border: 1px solid var(--line); border-radius: 8px; padding: .8rem 1rem; margin-top: .6rem; }
.addform { display: grid; grid-template-columns: repeat(auto-fit, minmax(11rem, 1fr)); gap: .6rem .8rem; align-items: end; margin: 0; }
.addform label { display: flex; flex-direction: column; gap: .2rem; font-size: .85rem; margin: 0; } .addform label.check { flex-direction: row; align-items: center; }
.addform .wide, .addform .actions { grid-column: 1 / -1; } .addform textarea { min-height: 3.2rem; resize: vertical; } .addform .actions { display: flex; gap: .6rem; align-items: center; }
.addform input[type=number] { max-width: 9rem; }
.removal.dire { border-color: #e5534b; } .removal ul { margin: .3rem 0 1rem 1.2rem; } .removeform label { display: block; margin: .8rem 0; } .removeform input { max-width: 28rem; }
button.danger { background: #c0392b; border-color: #c0392b; color: #fff; } .btnlink.secondary { background: transparent; }
.danger-zone { border-color: #e5534b; } .removelink { color: var(--muted); }
.draftbox { border-bottom: 1px dashed var(--line); padding-bottom: .6rem; } .draftrow { display: flex; gap: .6rem; } .draftrow input { flex: 1; }
.stepnav { display: flex; justify-content: space-between; margin: 1.5rem 1rem 2rem; }
.beatwrap { margin: .5rem 0; } .beatstrip { width: 100%; height: 46px; background: rgba(127,127,127,.08); border-radius: 4px; }
.beatstrip .bar { stroke: #ffd166; stroke-width: 1.2; } .beatstrip .beat { stroke: var(--muted); stroke-width: .8; } .beatstrip .hit { fill: #7fa0ff; }
.tl-ruler .beatmark { position: absolute; bottom: 0; width: 1px; height: 7px; background: var(--muted); opacity: .7; pointer-events: none; } .tl-ruler .beatmark.bar { height: 14px; background: #ffd166; opacity: 1; }

/* story form and list */
.storyform { display: grid; gap: .6rem; }
.storyform label { display: grid; gap: .2rem; font-size: .9rem; }
.storyform input:not([type=radio]), .storyform textarea { font-size: .9rem; padding: .3rem .5rem; }
.storyform-head input { max-width: 28rem; }
.storyform-foot { display: flex; flex-wrap: wrap; gap: .6rem; align-items: center; }
.srcbtns { display: inline-flex; flex-wrap: wrap; gap: .4rem; }
.storyform .srcbtn { display: inline-block; cursor: pointer; }
.srcbtn input { position: absolute; opacity: 0; }
.srcbtn span { display: inline-block; padding: .3rem .8rem; border: 1px solid var(--border, #444); border-radius: 6px; }
.srcbtn input:checked + span { background: var(--accent, #3b6df0); color: #fff; border-color: transparent; }
.srcbtn input:focus-visible + span { outline: 2px solid var(--accent, #3b6df0); outline-offset: 2px; }
.srcpick { list-style: none; padding: 0; margin: 0; display: grid; gap: .35rem; }
.srcpick li { display: flex; flex-wrap: wrap; gap: .6rem; align-items: baseline; }
.storyform .srcpick .check { display: inline-flex; gap: .3rem; align-items: center; }
.storylist { list-style: none; padding: 0; display: grid; gap: .5rem; margin: 0 0 1rem; }
.storyitem { display: flex; flex-wrap: wrap; gap: .8rem; align-items: center; padding: .6rem .8rem; border: 1px solid var(--border, #444); border-radius: 8px; }
.storyitem.active { border-color: var(--accent, #3b6df0); box-shadow: inset 4px 0 0 var(--accent, #3b6df0); }
.storyitem .grow { flex: 1 1 18rem; }

/* story text editor */
.texteditor { display: grid; gap: .3rem; }
.tebar { display: flex; flex-wrap: wrap; gap: .3rem; }
.texteditor textarea { width: 100%; min-height: 12rem; font: inherit; line-height: 1.5; resize: vertical; }
[hidden] { display: none !important; }
.te-versions { display: grid; grid-template-columns: repeat(auto-fit, minmax(16rem, 1fr)); gap: .6rem; }
.te-col { display: grid; gap: .4rem; align-content: start; border: 1px solid var(--border, #444); border-radius: 8px; padding: .6rem; }
.te-text { white-space: pre-wrap; max-height: 22rem; overflow: auto; font-size: .9rem; }

.ctxform textarea { width: 100%; font: inherit; }
.counter { justify-self: end; font-size: .8rem; color: var(--muted, #888); }
.counter.over { color: #e5484d; font-weight: 600; }

/* story boxes with a footer bar inside the outline */
.fbox { border: 1px solid var(--border, #444); border-radius: 8px; overflow: hidden; display: grid; margin: .4rem 0 .8rem; }
.fbox > label { padding: .35rem .6rem 0; font-weight: 600; }
.fbox textarea { border: 0; border-radius: 0; width: 100%; font: inherit; line-height: 1.5; resize: vertical; background: transparent; }
.fbox textarea:focus { outline: 2px solid var(--accent, #3b6df0); outline-offset: -2px; }
.fbox.locked { background: rgba(127,127,127,.08); }
.fbar { display: flex; gap: .5rem; align-items: center; padding: .25rem .5rem; border-top: 1px solid var(--border, #444); font-size: .8rem; }
.fbar .fstatus { flex: 1; }
.iconbtn { background: transparent; border: 1px solid transparent; border-radius: 6px; padding: .1rem .45rem; cursor: pointer; font-size: .8rem; color: inherit; }
.iconbtn:hover:not(:disabled) { border-color: var(--border, #444); }
.iconbtn:disabled { opacity: .4; cursor: not-allowed; }
.srcbox { max-height: 22rem; overflow: auto; border: 1px solid var(--border, #444); border-radius: 8px; padding: .3rem .6rem; }
.srcline td { padding: .1rem .5rem; border: 0; }
.srctext { white-space: pre-wrap; font: inherit; margin: 0; }

/* approach chips */
.approach { display: grid; gap: .7rem; margin: .6rem 0; }
.agroup { border: 1px solid var(--border, #444); border-radius: 8px; padding: .4rem .7rem .6rem; margin: 0; }
.agroup legend { font-weight: 600; padding: 0 .3rem; }
.chips { display: flex; flex-wrap: wrap; gap: .35rem; align-items: center; }
.chip { display: inline-block; cursor: pointer; }
.chip input { position: absolute; opacity: 0; }
.chip span { display: inline-block; padding: .2rem .65rem; border: 1px solid var(--border, #444); border-radius: 999px; font-size: .85rem; }
.chip input:checked + span { background: var(--accent, #3b6df0); border-color: transparent; color: #fff; }
.chip input:focus-visible + span { outline: 2px solid var(--accent, #3b6df0); outline-offset: 2px; }
.chip.custom span { border-style: dashed; }
.addchip { display: inline-flex; gap: .2rem; align-items: center; }
.addchip input { font-size: .85rem; padding: .15rem .4rem; }
.atext { display: grid; gap: .5rem; }
.atext textarea { width: 100%; font: inherit; }

/* tool buttons under text fields: no outlines, so they do not look like part of the box above */
.texteditor .tebar { margin-top: .15rem; gap: .1rem; }
.texteditor .tebar button, .texteditor .tebar .secondary { background: transparent; border: 0; box-shadow: none; padding: .1rem .5rem; color: var(--muted, #8a8f98); font-size: .8rem; cursor: pointer; border-radius: 6px; }
.texteditor .tebar button:hover:not(:disabled) { color: inherit; background: rgba(127,127,127,.15); }
.texteditor.lite { position: relative; clear: both; margin: .15rem 0 .5rem; }
.texteditor textarea { margin-bottom: 0; }

.fbar .fstatus { min-height: 1.2em; }

/* Planning: context row, level lists */
.ctxbar { display: flex; flex-wrap: wrap; gap: .8rem; align-items: end; margin: 0 auto .6rem; max-width: 80rem; }
.ctxbar label { display: grid; gap: .1rem; font-size: .78rem; color: var(--muted, #8a8f98); }
.ctxbar select { min-width: 12rem; }
.subtabs a { display: inline-flex; flex-direction: column; align-items: center; text-align: center; line-height: 1.15; }
.subtabs a[aria-current="page"] { border-radius: 0; }
.ctxlabel { display: block; text-align: center; font-size: .66rem; color: var(--muted, #8a8f98); max-width: 11rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-height: .85rem; }
.plist { list-style: none; margin: .4rem 0; padding: 0; display: grid; gap: .2rem; }
.plist > li { list-style: none; }
.prow { padding: .2rem .6rem .25rem; border: 1px solid var(--border, #444); border-radius: 6px; background: transparent; }
.plist[data-sortable] .prow { cursor: grab; }
.plist[data-sortable] .prow a, .plist[data-sortable] .prow button, .plist[data-sortable] .prow select, .plist[data-sortable] .prow input, .plist[data-sortable] .prow summary { cursor: pointer; }
.plist[data-sortable] .prow:hover { border-color: rgba(127,127,127,.6); background: rgba(127,127,127,.06); }
.prow-main { display: flex; align-items: center; gap: .35rem; min-height: 1.6rem; }
.prow-meta { font-size: .72rem; line-height: 1.25; color: var(--muted, #8a8f98); margin-left: 1.15rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.prow .grip { color: var(--muted, #8a8f98); user-select: none; letter-spacing: -2px; font-size: .8rem; width: .8rem; }
.plist:not([data-sortable]) .grip { visibility: hidden; }
.prow.dragging { opacity: .4; }
.prow.dropbefore { box-shadow: 0 -3px 0 var(--accent, #3b6df0); }
.prow.dropafter { box-shadow: 0 3px 0 var(--accent, #3b6df0); }
.ptitle { font-weight: 600; text-decoration: none; }
.ptitle:hover { text-decoration: underline; }
.pprefix { font-size: .85rem; }
.prow input { font: inherit; padding: .05rem .3rem; min-width: 14rem; }
.prow .pen, .prow .trash, .prow .pbtn { background: none; border: 0; box-shadow: none; padding: 0 .25rem; margin: 0; min-height: 0; line-height: 1.2; font-size: .8rem; color: var(--muted, #8a8f98); text-decoration: none; cursor: pointer; border-radius: 4px; }
.prow .pen:hover, .prow .trash:hover, .prow .pbtn:hover { color: inherit; background: rgba(127,127,127,.18); }
.pspacer { flex: 1 1 1rem; }
.parrows { display: inline-flex; gap: 0; }
.plist:not([data-sortable]) .parrows { opacity: .3; pointer-events: none; }   /* a lone item has nothing to swap with; the arrows stay so every level looks the same */
.pin { font-size: .8rem; }
.prow .pnext { font-size: .75rem; line-height: 1.2; padding: .1rem .55rem; border: 1px solid var(--border, #444); border-radius: 5px; text-decoration: none; white-space: nowrap; color: var(--accent, #3b6df0); }
.prow .pnext:hover { background: rgba(127,127,127,.15); }
.prow .movefm { margin-left: .4rem; }
.prow .movefm select { font-size: .75rem; padding: 0 .2rem; min-width: 0; }
.prow .movefm button { font-size: .72rem; padding: 0 .4rem; min-height: 0; }
.beatedit { margin-left: 1.15rem; }
.beatedit summary { font-size: .72rem; }
.beatedit form { padding: .3rem 0; }

/* analysis panel: the state tag never wraps, and the beat picture only takes what is left */
.analysis .tag, .nowrap { white-space: nowrap; }
.analysis td { vertical-align: top; }
.analysis .beatwrap { max-width: 100%; overflow: hidden; }
.analysis .beatwrap svg { display: block; width: 100%; height: auto; max-height: 4rem; }

.prow .pedit { font-size: .75rem; line-height: 1.2; padding: .1rem .55rem; border: 1px solid var(--border, #444); border-radius: 5px; background: transparent; color: var(--accent, #3b6df0); cursor: pointer; min-height: 0; }
.prow .pedit:hover, .prow .pedit[aria-expanded="true"] { background: rgba(127,127,127,.18); }
.prow-edit { margin: .2rem 0 .1rem 1.15rem; }
.prow-edit form { padding: .3rem 0; }

/* the map */
.mapcard { max-width: none; }
.maptools { display: flex; flex-wrap: wrap; gap: .5rem; align-items: center; }
.maptools h2 { margin: 0; }
.mapstatus { min-height: 1.1rem; margin: .2rem 0; }
.mapview { position: relative; overflow: auto; height: min(78vh, 900px); border: 1px solid var(--border, #444); border-radius: 8px; background: rgba(127,127,127,.04); cursor: grab; }
.mapview.panning { cursor: grabbing; user-select: none; }
.mapscaler { position: relative; }
.mapcanvas { position: absolute; left: 0; top: 0; transform-origin: 0 0; }
.mapcanvas svg { position: absolute; left: 0; top: 0; pointer-events: none; }
.mlink { fill: none; stroke: rgba(130,140,160,.55); stroke-width: 1.4; }
.mlink.dashed { stroke-dasharray: 4 4; opacity: .7; }
.mlink.bc0 { stroke: rgba(224,108,117,.6); } .mlink.bc1 { stroke: rgba(229,192,123,.6); } .mlink.bc2 { stroke: rgba(152,195,121,.6); } .mlink.bc3 { stroke: rgba(86,182,194,.6); } .mlink.bc4 { stroke: rgba(97,175,239,.6); } .mlink.bc5 { stroke: rgba(198,120,221,.6); }
svg.lit .mlink { opacity: .15; } svg.lit .mlink.hl { opacity: 1; stroke-width: 2.4; } .mnode.hl { box-shadow: 0 0 0 2px rgba(255,209,102,.8); } .mnode[data-href] { cursor: pointer; } .mnode[draggable="true"] { cursor: pointer; }
.mapview.full { height: calc(100vh - 150px); min-height: 420px; }
.mnode { position: absolute; box-sizing: border-box; border: 1px solid var(--border, #444); border-radius: 6px; background: var(--panel); color: var(--ink); padding: .2rem .45rem; overflow: hidden; font-size: .78rem; line-height: 1.2; cursor: default; }
.mnode[draggable="true"] { cursor: grab; }
.mnode.k-story { border-color: #5b7be0; } .mnode.k-chapter { border-color: #4aa3a0; } .mnode.k-scene { border-color: #b08a3c; } .mnode.k-beat { border-color: #a05bb0; } .mnode.k-shot { border-color: #6ba35b; } .mnode.k-take { border-style: dashed; }
.mnode.selected { outline: 2px solid var(--accent, #3b6df0); background: rgba(59,109,240,.18); }
.mnode.candidate { box-shadow: 0 0 0 1px rgba(59,109,240,.5); }
.mnode.dropon { outline: 2px solid #3fb950; background: rgba(63,185,80,.16); }
.mhead { display: flex; align-items: center; gap: .25rem; min-width: 0; }
.mtitle { color: var(--ink); font-weight: 600; text-decoration: none; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; flex: 1 1 auto; min-width: 0; }
.mtitle:hover { text-decoration: underline; }
.mmeta { color: var(--muted, #8a8f98); font-size: .68rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mtoggle, .mtakes { background: none; border: 0; padding: 0 .2rem; min-height: 0; font-size: .7rem; color: var(--muted, #8a8f98); cursor: pointer; }
.mtakes { border: 1px solid var(--border, #444); border-radius: 4px; }
.mpin { font-size: .7rem; }
.mnode.hasthumb { padding-left: 94px; }
.mthumb { position: absolute; left: 0; top: 0; width: 88px; height: 100%; object-fit: cover; background: #0c0f16; }
.mappop { position: absolute; z-index: 20; width: 340px; background: #0c0f16; border: 1px solid var(--border, #444); border-radius: 8px; box-shadow: 0 8px 30px rgba(0,0,0,.5); overflow: hidden; pointer-events: none; }
.mappop video, .mappop img { display: block; width: 100%; height: auto; max-height: 200px; background: #000; object-fit: contain; }
.mpbar { height: 3px; background: rgba(255,255,255,.15); } .mpfill { height: 100%; width: 0; background: var(--accent, #3b6df0); }
.mpcap { padding: .25rem .5rem; font-size: .72rem; color: var(--muted, #8a8f98); }
.mapempty { position: absolute; left: 1rem; top: 1rem; }

.stat.spend.near .n { color: #d29922; } .stat.spend.over .n { color: #e5484d; }

.poolist .prow-main { gap: .6rem; } .pthumb { border-radius: 4px; background: #0c0f16; object-fit: cover; }
.poolact { display: flex; flex-wrap: wrap; gap: .8rem; align-items: center; white-space: normal; overflow: visible; margin-left: 0; padding-top: .2rem; }

.pthumbwrap { display: inline-block; line-height: 0; margin-left: .3rem; } .prow .pthumb { border-radius: 4px; background: #0c0f16; object-fit: cover; }

/* scrollbars match the theme everywhere; the page keeps room for its scrollbar so nothing shifts when one appears */
html { scrollbar-gutter: stable; }
* { scrollbar-width: thin; scrollbar-color: color-mix(in srgb, var(--muted) 45%, var(--panel)) transparent; }
*::-webkit-scrollbar { width: 10px; height: 10px; }
*::-webkit-scrollbar-track { background: transparent; }
*::-webkit-scrollbar-thumb { background: color-mix(in srgb, var(--muted) 40%, var(--panel)); border-radius: 6px; border: 2px solid transparent; background-clip: content-box; }
*::-webkit-scrollbar-thumb:hover { background: color-mix(in srgb, var(--muted) 65%, var(--panel)); background-clip: content-box; }
*::-webkit-scrollbar-corner { background: transparent; }

/* pages that use the whole screen (the map, timelines, card lists, the storyboard) */
main.wide { max-width: none; }

/* planning lists are cards side by side, all the same height; long text is trimmed */
.plist { grid-template-columns: repeat(auto-fill, minmax(17.5rem, 1fr)); gap: .6rem; grid-auto-rows: 1fr; }
.plist > .prow { display: flex; flex-direction: column; gap: .15rem; min-height: 8rem; padding: .45rem .6rem .4rem; overflow: hidden; }
.plist > .prow.open { grid-column: 1 / -1; overflow: visible; }
.prow-main { min-width: 0; }
.prow-main .ptitle { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.plist .prow-meta { margin-left: 0; flex: 0 0 auto; line-height: 1.25; max-height: 3.75em; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; white-space: normal; text-overflow: clip; }
.pcard-foot { display: flex; align-items: center; gap: .3rem; margin-top: auto; padding-top: .2rem; }
.pcard-foot .pspacer { flex: 1 1 .5rem; }
.plist > .prow .prow-edit { margin: .3rem 0 0; }
.plist > .prow .movefm { margin-left: 0; }
.poolist { grid-template-columns: 1fr; grid-auto-rows: auto; }
.poolist > .prow { min-height: 0; }
.poolist .prow-meta { display: block; -webkit-line-clamp: unset; }

.maptoolbtns { display: inline-flex; flex-wrap: nowrap; gap: .35rem; align-items: center; }
.maptools .maphint { flex: 1 1 24rem; }

/* the map's column colours, carried into the matching pages: a coloured top edge on the main card and a coloured underline on the current sub-menu item */
:root { --lv-story: #5b7be0; --lv-chapter: #4aa3a0; --lv-scene: #b08a3c; --lv-beat: #a05bb0; --lv-shot: #6ba35b; }
main[data-level="story"] { --lv: var(--lv-story); } main[data-level="chapter"] { --lv: var(--lv-chapter); } main[data-level="scene"] { --lv: var(--lv-scene); }
main[data-level="beat"] { --lv: var(--lv-beat); } main[data-level="shot"] { --lv: var(--lv-shot); }
main[data-level] > .card:first-of-type { box-shadow: inset 0 3px 0 var(--lv); }
main[data-level] .backtri { color: var(--lv); }
.subtabs a[data-sub="story"][aria-current="page"] { box-shadow: inset 0 -3px 0 var(--lv-story); } .subtabs a[data-sub="chapters"][aria-current="page"] { box-shadow: inset 0 -3px 0 var(--lv-chapter); }
.subtabs a[data-sub="scenes"][aria-current="page"] { box-shadow: inset 0 -3px 0 var(--lv-scene); } .subtabs a[data-sub="beats"][aria-current="page"] { box-shadow: inset 0 -3px 0 var(--lv-beat); }
.subtabs a[data-sub="storyboard"][aria-current="page"] { box-shadow: inset 0 -3px 0 var(--lv-shot); }
.plist[data-kind="story"] > .prow { box-shadow: inset 0 3px 0 var(--lv-story); }
.plist[data-kind="chapter"] > .prow { box-shadow: inset 0 3px 0 var(--lv-chapter); }
.plist[data-kind="scene"] > .prow { box-shadow: inset 0 3px 0 var(--lv-scene); }
.plist[data-kind="beat"] > .prow { box-shadow: inset 0 3px 0 var(--lv-beat); }
.plist[data-kind="shot"] > .prow { box-shadow: inset 0 3px 0 var(--lv-shot); }

/* ---- timeline editor ---- */
.tl:focus { outline: none; }
.tl-toolbar .ctl.on { background: var(--accent); border-color: var(--accent); color: #fff; }
.tl-toolbar .ctl[disabled] { opacity: .4; }
.tl-sep { width: 1px; align-self: stretch; background: var(--line); margin: 0 .1rem; }
.tl-upper { display: grid; grid-template-columns: 340px minmax(0, 1fr) 300px; gap: .75rem; height: var(--upper-h, clamp(220px, 34vh, 360px)); min-height: 200px; }
.tl-upper.nobrowser { grid-template-columns: 0 minmax(0, 1fr) 300px; } .tl-upper.nobrowser .tl-browser { display: none; }
.tl-browser, .tl-right { overflow: hidden; padding: .6rem; margin: 0; display: flex; flex-direction: column; min-height: 0; }
.tl-right { overflow: auto; display: block; }
.tlb-head { display: flex; align-items: center; gap: .4rem; margin-bottom: .4rem; } .tlb-head input { margin: 0; padding: .2rem .4rem; flex: 1; } .tlb-head .pbtn { flex: none; }
.tlb-tree { flex: 0 1 38%; overflow: auto; border-bottom: 1px solid var(--line); padding-bottom: .3rem; font-size: .85rem; min-height: 3rem; }
.tlb-node { display: flex; align-items: center; gap: .25rem; padding: .12rem .3rem; border-radius: 4px; cursor: pointer; white-space: nowrap; user-select: none; } .tlb-node:hover { background: rgba(127,127,127,.15); }
.tlb-node.sel { background: color-mix(in srgb, var(--accent) 30%, transparent); } .tlb-caret { width: .9rem; text-align: center; color: var(--muted); flex: none; font-size: .7rem; }
.tlb-kids { margin-left: .9rem; }
.tlb-items { flex: 1 1 auto; overflow: auto; display: grid; grid-template-columns: repeat(auto-fill, minmax(96px, 1fr)); gap: .4rem; align-content: start; padding-top: .4rem; min-height: 0; }
.tlb-item { border: 1px solid var(--line); border-radius: 5px; overflow: hidden; background: var(--bg); cursor: grab; position: relative; } .tlb-item:hover { border-color: var(--accent); }
.tlb-item img { display: block; width: 100%; aspect-ratio: 16 / 9; object-fit: cover; background: #000; } .tlb-item .ph { aspect-ratio: 16 / 9; display: grid; place-items: center; color: var(--muted); font-size: .7rem; background: #0b0e14; }
.tlb-item .nm { font-size: .7rem; padding: .1rem .3rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; } .tlb-item .sb { font-size: .62rem; color: var(--muted); padding: 0 .3rem .15rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tlb-item .bd { position: absolute; top: 2px; right: 2px; font-size: .6rem; background: #000a; border-radius: 3px; padding: 0 3px; color: #fff; }
.tlb-open { position: absolute; z-index: 5; margin: .5rem 0 0 -.4rem; border: 1px solid var(--line); background: var(--panel); color: var(--ink); border-radius: 0 6px 6px 0; cursor: pointer; padding: .4rem .25rem; }
.tl-centre { min-width: 0; min-height: 0; display: flex; flex-direction: column; align-items: center; }
.tl-preview { position: relative; background: #000; border-radius: 6px; flex: 1 1 auto; min-height: 0; aspect-ratio: 16 / 9; max-width: 100%; max-height: calc(100% - 1.6rem); }
.tl-preview video { width: 100%; height: 100%; object-fit: contain; } .tl-note { margin: .3rem 0 0; text-align: center; }
.tl-gap { position: absolute; inset: 0; display: grid; place-items: center; color: #8a93a6; font-size: .85rem; }
.tl-vsplit, .tl-hsplit { height: 8px; cursor: row-resize; background: transparent; position: relative; flex: none; margin: 0; }
.tl-vsplit::after, .tl-hsplit::after { content: ""; position: absolute; left: 50%; top: 3px; width: 56px; height: 3px; margin-left: -28px; border-radius: 2px; background: var(--line); } .tl-vsplit:hover::after, .tl-hsplit:hover::after { background: var(--accent); }
.tl-panel { --label-w: 168px; --sx: 0px; --vh: 100; position: relative; border: 1px solid var(--line); border-radius: 8px; background: color-mix(in srgb, var(--panel) 88%, #000); display: flex; flex-direction: column; height: var(--panel-h, 52vh); min-height: 240px; overflow: hidden; margin-bottom: 1rem; }
.tl-rulerrow, .tl-hbarrow { display: flex; flex: none; } .tl-corner { width: var(--label-w); flex: none; display: flex; gap: .3rem; align-items: center; padding: 0 .4rem; border-right: 1px solid var(--line); box-sizing: border-box; } .tl-corner.small { justify-content: flex-end; }
.tl-rulerview { flex: 1; overflow: hidden; position: relative; height: 26px; border-bottom: 1px solid var(--line); cursor: pointer; }
.tl-ruler { position: absolute; left: 0; top: 0; height: 100%; transform: translateX(calc(-1 * var(--sx))); }
.tl-ruler .tick { position: absolute; top: 0; bottom: 0; border-left: 1px solid var(--line); font-size: .62rem; padding-left: 3px; opacity: .85; white-space: nowrap; pointer-events: none; }
.tl-region { overflow-y: auto; overflow-x: hidden; flex: 1 1 0; min-height: 40px; position: relative; scrollbar-gutter: stable; }
.tl-hsplit { height: 7px; background: rgba(127,127,127,.08); border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.trow { display: flex; height: calc(var(--vh) * .56px); min-height: 34px; border-bottom: 1px solid color-mix(in srgb, var(--line) 70%, transparent); }
.trow.audio { height: calc(var(--vh) * .42px); min-height: 30px; }
.thead { position: relative; width: var(--label-w); flex: none; box-sizing: border-box; border-right: 1px solid var(--line); background: var(--panel); padding: .15rem .3rem; display: flex; flex-direction: column; justify-content: center; gap: .15rem; z-index: 3; font-size: .72rem; }
.thead .tn { font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; cursor: text; } .thead .tb { display: flex; gap: .2rem; align-items: center; }
.thead button { font-size: .62rem; line-height: 1; padding: .12rem .28rem; min-height: 0; border: 1px solid var(--line); background: transparent; color: var(--muted); border-radius: 4px; cursor: pointer; }
.thead button.on { color: #fff; background: #a05b2f; border-color: #a05b2f; } .thead button.on.s { background: #b8960c; border-color: #b8960c; } .thead button.on.l { background: #6a4aa0; border-color: #6a4aa0; }
.thead input.gdb { width: 2.9rem; padding: .05rem .2rem; font-size: .62rem; margin: 0; display: inline-block; } .thead .rm { margin-left: auto; opacity: .5; }
.trow.muted .lanevp { opacity: .45; } .trow.locked .lanevp { background-image: repeating-linear-gradient(135deg, transparent 0 8px, rgba(127,127,127,.12) 8px 16px); }
.trow.droptarget .lanevp { outline: 2px solid var(--accent); outline-offset: -2px; }
.tresize { position: absolute; left: 0; right: 0; bottom: 0; height: 7px; cursor: ns-resize; touch-action: none; } .tresize:hover { background: rgba(122,162,255,.45); }
.lanevp { flex: 1; position: relative; overflow: hidden; min-width: 0; }
.lane { position: absolute; left: 0; top: 0; bottom: 0; transform: translateX(calc(-1 * var(--sx))); }
.clip { position: absolute; top: 3px; bottom: 3px; border-radius: 5px; overflow: hidden; white-space: nowrap; font-size: .72rem; cursor: grab; user-select: none; touch-action: none; box-sizing: border-box; }
.clip.video { background: #2c4a9a; border: 1px solid #5b7cff; } .clip.audio { background: #1a2332; border: 1px solid #4a6fa5; }
.clip .thumb { position: absolute; left: 0; top: 0; bottom: 0; width: auto; aspect-ratio: 16 / 9; object-fit: cover; opacity: .85; pointer-events: none; max-width: 40%; }
.clip .wave { position: absolute; top: 0; bottom: 0; background-repeat: no-repeat; background-size: 100% 100%; opacity: .95; pointer-events: none; }
.clip .cliplabel { position: relative; padding: 1px 6px; text-shadow: 0 1px 2px #000a; pointer-events: none; display: inline-block; max-width: 100%; overflow: hidden; text-overflow: ellipsis; }
.clip.approved { box-shadow: inset 0 -3px 0 #3ecf8e; }
.clip.nocard { background: repeating-linear-gradient(45deg, #5a2a2a, #5a2a2a 8px, #6a3232 8px, #6a3232 16px); border-color: #d96a6a; }
.clip.sim { border-style: dashed; } .clip.held { background-image: linear-gradient(90deg, transparent 85%, rgba(255,255,255,.18) 85%); }
.clip.sel { outline: 2px solid #ffd166; outline-offset: -1px; z-index: 2; } .clip.grp { box-shadow: 0 0 0 1px #ffd16688; }
.clip .alt { position: absolute; right: 12px; top: 2px; font-size: .62rem; background: #0007; border-radius: 8px; padding: 0 5px; color: #fff; }
.clip .lnk { position: absolute; right: 12px; bottom: 2px; font-size: .62rem; opacity: .85; }
.clip .edge { position: absolute; top: 0; bottom: 0; width: 7px; cursor: ew-resize; background: rgba(255,255,255,.18); opacity: 0; } .clip:hover .edge, .clip.sel .edge { opacity: 1; } .clip .edge.l { left: 0; } .clip .edge.r { right: 0; }
.tl-panel.blade .clip { cursor: crosshair; }
.trmark { position: absolute; top: 0; height: 6px; background: #ffd166; border-radius: 3px; }
.tl-hscroll { flex: 1; overflow-x: auto; overflow-y: hidden; height: 16px; } #tl-hsize { height: 1px; }
.tl-playhead { position: absolute; top: 0; bottom: 0; left: 0; width: 0; border-left: 2px solid #ffd166; pointer-events: none; z-index: 6; box-shadow: 0 0 4px rgba(255,209,102,.8); } .tl-phtab { position: absolute; top: 0; left: -6px; border: 6px solid transparent; border-top-color: #ffd166; }
.tl-dropline { position: absolute; top: 26px; bottom: 16px; width: 0; border-left: 2px dashed var(--accent); z-index: 5; pointer-events: none; }
@media (max-width: 1100px) { .tl-upper { grid-template-columns: 1fr; height: auto; } .tl-browser { max-height: 320px; } .tl-preview { max-height: 40vh; } }

/* the later stages continue the map's colours: Assets, then Generate (takes), Review, Timeline (cuts) and Export */
:root { --lv-asset: #6f8fb5; --lv-take: #d9694e; --lv-review: #3fa7d6; --lv-cut: #d65a8c; --lv-export: #8d9bb0; }
main[data-level="asset"] { --lv: var(--lv-asset); } main[data-level="take"] { --lv: var(--lv-take); } main[data-level="review"] { --lv: var(--lv-review); }
main[data-level="cut"] { --lv: var(--lv-cut); } main[data-level="export"] { --lv: var(--lv-export); }
.projnav a[data-tab="assets"][aria-current="page"] { border-bottom-color: var(--lv-asset); } .projnav a[data-tab="planning"][aria-current="page"] { border-bottom-color: var(--lv-scene); }
.projnav a[data-tab="generation"][aria-current="page"] { border-bottom-color: var(--lv-take); } .projnav a[data-tab="review"][aria-current="page"] { border-bottom-color: var(--lv-review); }
.projnav a[data-tab="timelines"][aria-current="page"] { border-bottom-color: var(--lv-cut); } .projnav a[data-tab="exports"][aria-current="page"] { border-bottom-color: var(--lv-export); }
.tl-top.card { box-shadow: inset 0 3px 0 var(--lv, transparent); }

/* ---- Pictures: guide images in slots, side by side, large view ---- */
:root { --lv-picture: #c98a6b; } main[data-level="picture"] { --lv: var(--lv-picture); }
.levelswitch { display: flex; gap: .3rem; margin: .4rem 0 .6rem; } .levelswitch a { padding: .25rem .8rem; border: 1px solid var(--line); border-radius: 999px; text-decoration: none; color: var(--muted); }
.levelswitch a[aria-current="page"] { color: #fff; background: var(--lv-picture); border-color: var(--lv-picture); }
.pbar { gap: 1rem; flex-wrap: wrap; margin: .3rem 0; } .pbar label { display: flex; align-items: center; gap: .35rem; margin: 0; } .pbar select { width: auto; margin: 0; }
.pbulk { margin-top: .5rem; } .pbulk summary { cursor: pointer; } .pbulk form { margin-top: .5rem; gap: .8rem; flex-wrap: wrap; align-items: end; } .pbulk select { width: auto; }
.pcardx { box-shadow: inset 0 3px 0 var(--lv-picture); } .pcardx[data-level="story"] { box-shadow: inset 0 3px 0 var(--lv-story); } .pcardx[data-level="scene"] { box-shadow: inset 0 3px 0 var(--lv-scene); }
.pcardx[data-level="beat"] { box-shadow: inset 0 3px 0 var(--lv-beat); } .pcardx[data-level="shot"] { box-shadow: inset 0 3px 0 var(--lv-shot); }
.ptitlebar { display: flex; align-items: baseline; gap: .8rem; } .ptitlebar h2 { margin: 0; } .ptext { margin: .2rem 0 .6rem; max-width: 70rem; }
.pic-slots { display: grid; grid-template-columns: 1fr; gap: .8rem; align-items: start; }
.pslot { border: 1px solid var(--line); border-radius: 8px; padding: .6rem; background: color-mix(in srgb, var(--panel) 92%, #000); min-width: 0; display: grid; grid-template-columns: minmax(17rem, 24rem) minmax(0, 1fr); gap: 1rem; align-items: start; } .pleft, .pright { min-width: 0; } .phead { margin-bottom: .4rem; }
@media (max-width: 900px) { .pslot { grid-template-columns: 1fr; } }
.pstrip { display: flex; flex-wrap: wrap; gap: .5rem; align-items: flex-start; } .pstrip.small { gap: .3rem; }
.pthumbx { margin: 0; width: 32rem; max-width: 100%; border: 2px solid transparent; border-radius: 8px; overflow: hidden; background: var(--bg); position: relative; } .pthumbx.sel { border-color: #3fb950; box-shadow: 0 0 0 1px #3fb95066; }
.pthumbx img { display: block; width: 100%; aspect-ratio: 16 / 10; object-fit: cover; cursor: zoom-in; background: #000; } .pthumbx figcaption { padding: .25rem .35rem; display: flex; flex-wrap: wrap; gap: .25rem; align-items: center; font-size: .78rem; }
.pthumbx .pact { display: flex; gap: .25rem; margin-left: auto; } .pthumbx .ph { aspect-ratio: 16 / 10; display: grid; place-items: center; color: var(--muted); background: repeating-linear-gradient(45deg, rgba(127,127,127,.12) 0 10px, transparent 10px 20px); }
.pthumbx.drawing, .pthumbx.waiting { border: 2px dashed var(--line); } .pthumbx.failed { border: 2px solid #d96a6a66; } .pthumbx.failed .ph { color: #d96a6a; } .pthumbx .perr { display: block; max-height: 4.2em; overflow: auto; } .pthumbx.gone { width: 7rem; opacity: .75; } .pthumbx.gone img { cursor: default; }
.pnone { margin: .2rem 0; } .pdel { margin-top: .4rem; } .pgen { margin-top: .6rem; } .pgen textarea { margin-bottom: .2rem; width: 100%; min-height: 11rem; line-height: 1.4; } .pcount { margin: 0 0 .4rem; } .pgen .row { gap: .6rem; flex-wrap: wrap; align-items: center; } .pgen select { width: auto; display: inline-block; margin: 0; }
.pbtn { font-size: .72rem; padding: .1rem .45rem; border: 1px solid var(--line); background: transparent; color: var(--ink); border-radius: 5px; cursor: pointer; min-height: 0; line-height: 1.3; } .pbtn:hover { background: rgba(127,127,127,.18); }
.piclb { position: fixed; inset: 0; z-index: 60; background: rgba(0,0,0,.86); display: grid; grid-template-columns: 4rem 1fr 4rem; align-items: center; padding: 1.5rem; }
.piclb figure { margin: 0; text-align: center; min-width: 0; } .piclb img { max-width: 100%; max-height: 80vh; border-radius: 6px; } .piclb figcaption { color: #fff; margin-top: .6rem; display: flex; gap: .6rem; justify-content: center; flex-wrap: wrap; align-items: center; }
.piclb-nav, .piclb-x { background: transparent; border: 0; color: #fff; font-size: 2rem; cursor: pointer; } .piclb-x { position: absolute; top: .6rem; right: 1rem; font-size: 1.4rem; } .piclb .pbtn { color: #fff; border-color: #fff8; }
.brand { display: inline-flex; align-items: center; } .brand img { height: 24px; width: auto; display: block; }

/* pictures inside the stage cards */
.picthumbs { display: flex; gap: .25rem; margin: .15rem 0; } .picthumbs img { border-radius: 4px; border: 2px solid transparent; opacity: .7; cursor: pointer; object-fit: cover; } .picthumbs img.sel { border-color: #3fb950; opacity: 1; }
.prow-pics { margin: .4rem 0 0; } .plist > .prow .prow-pics { grid-column: 1 / -1; } .picpanel .pbar { margin: 0 0 .6rem; gap: 1rem; flex-wrap: wrap; } .picpanel .pbar label { display: flex; align-items: center; gap: .35rem; margin: 0; } .picpanel .pbar select { width: auto; margin: 0; }
.prow.open .prow-pics:not([hidden]) { width: 100%; }

.ppick { grid-column: 1 / -1; border-top: 1px solid var(--line); padding-top: .5rem; } .psrc h4 { margin: .8rem 0 .3rem; } .psrc-head { display: flex; gap: .8rem; align-items: center; flex-wrap: wrap; }
.psrc-search { display: flex; gap: .3rem; margin: 0 0 0 auto; } .psrc-row { display: flex; flex-wrap: wrap; gap: .6rem; margin: .3rem 0; }
.psrc-card { margin: 0; width: 15rem; border: 1px solid var(--line); border-radius: 8px; overflow: hidden; background: var(--bg); } .psrc-card.small { width: 10rem; }
.psrc-card img { display: block; width: 100%; height: auto; aspect-ratio: 16 / 9; object-fit: cover; background: #000; } .psrc-card figcaption { padding: .3rem .4rem; display: flex; flex-direction: column; gap: .2rem; font-size: .8rem; }
.psrc-videos { display: grid; grid-template-columns: repeat(auto-fill, minmax(22rem, 1fr)); gap: .5rem; } .psrc-video { border: 1px solid var(--line); border-radius: 8px; padding: .3rem; background: var(--bg); }
.psrc-vhead { display: flex; gap: .6rem; align-items: center; width: 100%; text-align: left; background: none; border: 0; color: inherit; cursor: pointer; padding: .2rem; } .psrc-vhead img { border-radius: 4px; object-fit: cover; background: #000; }
.psrc-big { display: block; width: 100%; max-width: 480px; height: auto; aspect-ratio: 16 / 9; background: #000; border-radius: 6px; margin: .4rem 0; } .psrc-ctl { display: flex; flex-wrap: wrap; gap: .4rem; align-items: center; } .psrc-ctl input[type=range] { flex: 1 1 14rem; }
.psrc-group { margin: .3rem 0; } .psrc-group summary { cursor: pointer; }

.formactions { display: flex; flex-wrap: wrap; gap: .6rem; align-items: center; }

.provlinks { margin: .2rem 0 .6rem; } .trouble { margin-top: .6rem; } .trouble dl { margin: .4rem 0 0; max-width: 60rem; } td form.inline input[name=usd] { width: 6rem; }

#jobs-body { overflow-x: auto; } #jobs-body .table { width: 100%; } #jobs-body .table td { vertical-align: top; } #jobs-body .table td.jreason { overflow-wrap: anywhere; max-width: 34rem; min-width: 14rem; } #jobs-body .table td.jacts { white-space: nowrap; width: 1%; }
.iconbtn { background: transparent; border: 1px solid var(--line); border-radius: 6px; color: var(--ink); cursor: pointer; font-size: 1rem; line-height: 1; padding: .25rem .5rem; } .iconbtn:hover { border-color: var(--accent); color: var(--accent); }

/* an open card works alone: the others step aside (they can be reached with the buttons at the top of the open one) */
.plist:has(> .prow.open) { grid-auto-rows: auto; } .plist:has(> .prow.open) > .prow:not(.open) { display: none; }
.rownav { grid-column: 1 / -1; display: flex; flex-wrap: wrap; gap: .5rem; align-items: center; margin: 0 0 .4rem; padding-bottom: .4rem; border-bottom: 1px solid var(--line); }
.rownav .link { margin-left: auto; }
.detailnav { margin: 0 0 .8rem; } .detailnav a { padding: .25rem .6rem; border: 1px solid var(--line); border-radius: 6px; text-decoration: none; color: var(--accent); font-size: .85rem; } .detailnav a:hover { background: rgba(127,127,127,.15); }
