:root {
  --bg: #eef1f5;
  --panel: #ffffff;
  --ink: #1d2530;
  --muted: #6b7785;
  --faint: #98a3b0;
  --line: #e3e7ec;
  --line-soft: #eef1f4;
  --accent: #2d5d7c;
  --accent-soft: #eaf1f6;
  --red: #e05656;
  --yellow: #e7b53c;
  --green: #4caf72;
  --radius: 10px;
  --shadow-sm: 0 1px 2px rgba(20, 30, 45, 0.06);
  --shadow: 0 2px 10px rgba(20, 30, 45, 0.08);
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  color: var(--ink);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
}

.hidden { display: none !important; }
.muted { color: var(--muted); }
.tiny { font-size: 0.72rem; }
.err { color: var(--red); min-height: 1.1em; font-size: 0.85rem; }

button {
  font: inherit;
  cursor: pointer;
  border: 1px solid var(--accent);
  background: var(--accent);
  color: #fff;
  padding: 0.42rem 0.8rem;
  border-radius: 8px;
}
button:hover { filter: brightness(1.04); }
button.ghost {
  background: #fff;
  color: var(--accent);
  border-color: var(--line);
}
button.ghost:hover { border-color: var(--accent); }
button.danger { border-color: var(--red); background: var(--red); }
button:disabled { opacity: 0.5; cursor: default; filter: none; }

/* soft neutral button (uploads, secondary) */
button.btn-soft {
  background: var(--line-soft);
  border-color: transparent;
  color: var(--muted);
}
button.btn-soft:hover { background: #e6eaee; color: var(--accent); filter: none; }

input, select, textarea {
  font: inherit;
  padding: 0.45rem 0.55rem;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--ink);
}

/* ---------- gate ---------- */
.gate {
  position: fixed; inset: 0;
  display: grid; place-items: center;
  background: var(--bg);
}
.gate-card {
  background: var(--panel);
  padding: 2rem;
  border-radius: 14px;
  box-shadow: var(--shadow);
  width: min(380px, 92vw);
}
.gate-card h1 { margin: 0 0 1rem; color: var(--accent); }
.gate-card input, .gate-card select { width: 100%; margin-bottom: 0.6rem; }
.gate-card button { width: 100%; }
.gate-card .row { display: flex; gap: 0.5rem; }
.gate-card .row input { flex: 1; }
.gate-card .row button { width: auto; white-space: nowrap; }

/* ---------- topbar ---------- */
.topbar {
  display: flex; align-items: center; gap: 1.1rem;
  padding: 0.6rem 1.1rem;
  background: var(--panel);
  border-bottom: 1px solid var(--line);
}
.brand { font-weight: 800; color: var(--accent); font-size: 1.02rem; letter-spacing: -0.01em; }
.topbar-right { display: flex; align-items: center; gap: 0.7rem; margin-left: auto; }
.topbar-right .muted b { color: var(--ink); }

/* panel show/hide pills — segmented control */
.panel-toggles {
  display: inline-flex; gap: 3px;
  background: var(--line-soft); border-radius: 999px; padding: 3px;
}
.pill {
  padding: 0.28rem 0.8rem;
  border-radius: 999px;
  border: 0;
  background: transparent;
  color: var(--muted);
  font-size: 0.8rem; font-weight: 600;
}
.pill.on { background: #fff; color: var(--accent); box-shadow: var(--shadow-sm); }

/* ---------- stats / progress bar ---------- */
.statsbar {
  display: flex; align-items: center; gap: 1.1rem;
  padding: 0.5rem 1.1rem;
  background: #fbfcfd;
  border-bottom: 1px solid var(--line);
}
.statbar-track {
  flex: 1; display: flex; height: 8px;
  border-radius: 999px; overflow: hidden; background: var(--line);
}
.statbar-seg { height: 100%; transition: width 0.2s; }
.statbar-seg.red { background: var(--red); }
.statbar-seg.yellow { background: var(--yellow); }
.statbar-seg.green { background: var(--green); }
.statbar-legend { display: flex; gap: 1.1rem; font-size: 0.78rem; color: var(--muted); white-space: nowrap; }
.statbar-legend b { color: var(--ink); font-variant-numeric: tabular-nums; }

/* ---------- layout (multi-panel, resizable) ---------- */
.app { display: flex; flex-direction: column; height: 100vh; }
.layout {
  flex: 1 1 auto;
  min-height: 0;
  display: flex;
  align-items: stretch;
  overflow-x: auto;
}
.layout.dragging { cursor: col-resize; }

.panel {
  display: flex;
  flex-direction: column;
  min-width: 240px; min-height: 0;
  background: var(--panel);
}
.panel-head {
  display: flex; align-items: center; gap: 0.45rem;
  flex: none;
  padding: 0.6rem 0.85rem;
  border-bottom: 1px solid var(--line);
}
.panel-title { font-weight: 700; color: var(--ink); font-size: 0.9rem; }
.panel-sub { color: var(--faint); font-size: 0.82rem; }
.panel-res {
  font-size: 0.72rem; font-variant-numeric: tabular-nums; white-space: nowrap;
  color: var(--faint); background: #fff;
  padding: 0.1rem 0.45rem; border-radius: 999px; border: 1px solid var(--line);
}
.panel-res.warn { color: #8a6100; background: #fdf6e3; border-color: var(--yellow); }
.panel-head .legend { flex: 1 1 auto; margin-left: 0.4rem; display: flex; gap: 0.35rem; overflow: hidden; flex-wrap: wrap; }
#add-volume { padding: 0.28rem 0.55rem; font-size: 0.8rem; }

/* subtle outline legend chips */
.chip {
  font-size: 0.7rem; padding: 0.12rem 0.5rem; border-radius: 999px;
  border: 1px solid var(--line); color: var(--muted); background: #fff;
  display: inline-flex; align-items: center; gap: 0.35rem;
}
.chip::before { content: ""; width: 8px; height: 8px; border-radius: 50%; }
.chip.red::before { background: var(--red); }
.chip.yellow::before { background: var(--yellow); }
.chip.green::before { background: var(--green); }

/* icon-style header buttons (minimise, add) */
.panel-min {
  margin-left: auto;
  width: 28px; height: 28px; padding: 0; line-height: 1;
  display: inline-flex; align-items: center; justify-content: center;
  background: transparent; color: var(--faint);
  border-color: transparent; border-radius: 7px; font-size: 1.1rem;
}
.panel-min:hover { color: var(--accent); background: var(--line-soft); filter: none; }

.panel-body { flex: 1 1 auto; overflow-y: auto; padding: 1rem; min-height: 0; }

/* ---------- bottom dock (note + status + approval) ---------- */
.panel-dock {
  flex: none;
  border-top: 1px solid var(--line);
  background: #fbfcfd;
  padding: 0.55rem 0.85rem;
  display: flex; flex-direction: column; gap: 0.5rem;
}

.note-line {
  display: flex; align-items: flex-start; gap: 0.5rem;
  background: #fffdf3; border: 1px solid #ecdfa4; border-radius: 8px;
  padding: 0.4rem 0.55rem;
}
.note-line:focus-within { border-color: var(--yellow); }
.note-ic { color: var(--yellow); font-size: 0.85rem; line-height: 1.6; flex: none; }
.note-line textarea.note-input {
  flex: 1; display: block;
  min-height: 1.5em; height: 1.5em; overflow: hidden; resize: none;
  border: 0; padding: 0; background: transparent;
  font-family: inherit; font-size: 0.85rem; line-height: 1.5; color: #5a5230;
}
.note-line textarea.note-input:focus { outline: none; }
.note-line textarea.note-input::placeholder { color: #b8ab78; }
.note-status { font-size: 0.72rem; color: var(--green); flex: none; min-width: 0; }

.meta-row { display: flex; align-items: center; gap: 0.6rem; flex-wrap: wrap; }
.approve-actions { margin-left: auto; display: flex; align-items: center; gap: 0.5rem; flex-wrap: wrap; }

/* status pill */
.status-pill {
  display: inline-flex; align-items: center; gap: 0.4rem;
  font-size: 0.76rem; font-weight: 600; padding: 0.22rem 0.6rem; border-radius: 999px;
}
.status-pill::before { content: ""; width: 8px; height: 8px; border-radius: 50%; }
.status-pill.red { background: #fcebeb; color: #b23b3b; } .status-pill.red::before { background: var(--red); }
.status-pill.yellow { background: #fbf2da; color: #946c10; } .status-pill.yellow::before { background: var(--yellow); }
.status-pill.green { background: #e6f4ec; color: #2f8a56; } .status-pill.green::before { background: var(--green); }

/* star / approval button */
.btn-star {
  font-size: 0.82rem; font-weight: 600;
  padding: 0.32rem 0.7rem; border-radius: 8px;
  background: #fff; border: 1px solid var(--accent); color: var(--accent);
}
.btn-star.on { background: #fbf2da; border-color: var(--yellow); color: #946c10; }

.splitter {
  flex: none;
  width: 6px;
  background: var(--line);
  cursor: col-resize;
}
.splitter:hover, .splitter.dragging { background: var(--accent); }

.detail-empty { margin-top: 2rem; text-align: center; }

/* ---------- tree ---------- */
.volume { margin-bottom: 0.85rem; border: 1px solid var(--line); border-radius: 10px; overflow: hidden; }
.node-head {
  display: flex; align-items: center; gap: 0.5rem;
  flex-wrap: wrap;
  cursor: pointer;
  user-select: none;
}
.caret { width: 0.9rem; font-size: 0.7rem; color: var(--faint); transition: transform 0.1s; }
.caret.collapsed { transform: rotate(-90deg); }
.dot { width: 10px; height: 10px; border-radius: 50%; flex: none; }
.dot.red { background: var(--red); }
.dot.yellow { background: var(--yellow); }
.dot.green { background: var(--green); }

.volume > .node-head {
  background: var(--accent); color: #fff;
  padding: 0.55rem 0.7rem;
  font-weight: 700; font-size: 0.95rem;
}
.volume > .node-head .dot { box-shadow: 0 0 0 2px rgba(255, 255, 255, 0.6); }

.episode { margin: 0.4rem 0.5rem; }
.episode > .node-head {
  color: var(--accent);
  padding: 0.35rem 0.45rem; border-radius: 8px; font-weight: 600; font-size: 0.85rem;
}
.episode > .node-head:hover { background: #f6f8fa; }

/* hover-revealed row actions */
.node-actions { margin-left: auto; display: flex; flex-wrap: wrap; gap: 0.25rem; opacity: 0; transition: opacity 0.12s; }
.node-head:hover .node-actions, .node-head:focus-within .node-actions { opacity: 1; }
.node-actions button {
  padding: 0.12rem 0.45rem; font-size: 0.72rem; border-radius: 6px;
  background: rgba(255, 255, 255, 0.16); color: inherit; border-color: transparent;
}
.episode .node-actions button { background: var(--line-soft); color: var(--muted); }
.episode .node-actions button:hover { background: var(--accent-soft); color: var(--accent); filter: none; }

.pages {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(40px, 1fr));
  gap: 7px 5px;
  padding: 0.4rem 0.5rem 0.5rem;
}
.page-cell { display: flex; flex-direction: column; align-items: stretch; gap: 2px; }
.page-num { font-size: 0.62rem; color: var(--faint); text-align: center; line-height: 1.1; }
.square {
  position: relative;
  width: 100%; height: 16px;
  cursor: pointer;
  display: flex; align-items: center; justify-content: center; gap: 2px;
  color: #fff; font-size: 0.56rem; font-weight: 700; line-height: 1;
}
.square.script { border-radius: 3px 3px 0 0; }
.square.art { border-radius: 0 0 3px 3px; }
.square.red { background: var(--red); }
.square.yellow { background: var(--yellow); color: #6a4e07; }
.square.green { background: var(--green); }
.square.selected { outline: 2px solid var(--accent); outline-offset: 1px; z-index: 1; }
.square .stars { font-size: 0.5rem; opacity: 0.95; letter-spacing: -1px; }
.square .alert {
  position: absolute; top: -5px; right: -5px;
  background: #fff; color: var(--red); border-radius: 50%;
  width: 13px; height: 13px; font-size: 9px; line-height: 13px;
  text-align: center; box-shadow: var(--shadow-sm); border: 1px solid var(--red);
}
.square .note-mark {
  position: absolute; top: -5px; left: -5px;
  background: #fff; color: var(--accent); border-radius: 50%;
  width: 13px; height: 13px; font-size: 8px; line-height: 13px;
  text-align: center; box-shadow: var(--shadow-sm); border: 1px solid var(--line);
}

/* ---------- detail content (art image / script editor) ---------- */
.detail h2 { margin: 0 0 0.25rem; }
.detail .sub { color: var(--muted); font-size: 0.85rem; margin-bottom: 0.75rem; }
.detail textarea {
  width: 100%; min-height: 38vh; resize: vertical;
  font-family: ui-monospace, Menlo, monospace; line-height: 1.55;
}
/* Script editor: maximise the textarea to fill the panel (no manual resize). */
#script-body { display: flex; flex-direction: column; }
#script-body textarea { flex: 1 1 auto; min-height: 0; resize: none; }
.detail .art-img { width: 100%; height: auto; border: 1px solid var(--line); border-radius: 8px; box-shadow: var(--shadow-sm); cursor: zoom-in; }

/* linked Google Doc */
.gdoc-meta {
  display: inline-flex; align-items: center; gap: 0.55rem; margin-bottom: 0.6rem; flex-wrap: wrap;
  background: var(--accent-soft); color: var(--accent);
  padding: 0.3rem 0.6rem; border-radius: 8px; font-size: 0.82rem;
}
.gdoc-link { color: var(--accent); font-size: 0.82rem; text-decoration: none; }
.gdoc-link:hover { text-decoration: underline; }
.gdoc-meta button { padding: 0.12rem 0.5rem; font-size: 0.74rem; }
.link-box { margin-top: 1rem; padding-top: 0.75rem; border-top: 1px dashed var(--line); font-size: 0.85rem; }
.link-box .muted { margin-bottom: 0.4rem; }
.link-input { width: 100%; flex: 1; }
.detail-actions { display: flex; gap: 0.5rem; align-items: center; margin: 0.75rem 0; flex-wrap: wrap; }
.alert-banner {
  background: #fff4f4; border: 1px solid var(--red); color: #a13030;
  padding: 0.5rem 0.7rem; border-radius: 8px; margin-bottom: 0.75rem;
  display: flex; justify-content: space-between; align-items: center; gap: 0.5rem;
}
.saved-note { color: var(--green); font-size: 0.85rem; }

/* episode "script Doc linked" tag + page flags */
.gdoc-tag { margin-left: 0.4rem; font-size: 0.7rem; color: var(--accent); background: var(--accent-soft);
  padding: 0.05rem 0.35rem; border-radius: 6px; white-space: nowrap; }
.page-flag { margin-left: 3px; font-size: 0.55rem; padding: 0 3px; border-radius: 4px; vertical-align: middle; }
.page-flag.splash { background: var(--accent-soft); color: var(--accent); }
.page-flag.orphan { background: #fdeaea; color: #b23b3b; }
.page-cell.orphaned { opacity: 0.6; }
.badge { font-size: 0.62rem; padding: 0.05rem 0.4rem; border-radius: 6px; margin-left: 0.4rem; }
.badge.splash { background: var(--accent-soft); color: var(--accent); }

/* script Doc link / validation modal */
.modal-overlay {
  position: fixed; inset: 0; background: rgba(20, 30, 45, 0.4);
  display: flex; align-items: center; justify-content: center; z-index: 100; padding: 1rem;
}
.modal-card {
  background: var(--panel); border-radius: var(--radius); box-shadow: var(--shadow);
  width: min(560px, 100%); max-height: 86vh; overflow: auto; padding: 1.1rem 1.25rem;
  display: flex; flex-direction: column; gap: 0.7rem;
}
.modal-head { display: flex; align-items: center; justify-content: space-between; }
.modal-head h2 { margin: 0; font-size: 1.05rem; }
.modal-linked { display: flex; align-items: center; gap: 0.6rem; font-size: 0.9rem;
  background: var(--line-soft); padding: 0.45rem 0.6rem; border-radius: 8px; }
.modal-doc-title { font-weight: 600; }
.modal-ok { color: var(--green); font-size: 0.9rem; }
.modal-warn { color: #b23b3b; font-size: 0.9rem; }
.modal-result { display: flex; flex-direction: column; gap: 0.4rem; }
.modal-errors { margin: 0.2rem 0 0; padding-left: 1.1rem; color: #a13030; font-size: 0.85rem; }
.modal-errors li { margin: 0.15rem 0; }
.modal-pages { margin: 0.2rem 0 0; padding: 0; list-style: none;
  display: flex; flex-wrap: wrap; gap: 0.3rem 0.6rem; max-height: 220px; overflow: auto; }
.modal-pages li { font-size: 0.82rem; background: var(--line-soft); padding: 0.1rem 0.45rem; border-radius: 6px; }
button.primary { background: var(--accent); color: #fff; border-color: var(--accent); }
button.primary.hidden { display: none; }

/* ---------- scripts pipeline board (full-window overlay) ---------- */
/* z-index sits below .modal-overlay (100) so the ingest dialog stacks on top,
   and below the reader (200). */
.scripts-overlay {
  position: fixed; inset: 0; z-index: 90;
  background: var(--bg);
  display: flex; flex-direction: column;
}
.scripts-head {
  display: flex; align-items: center; gap: 0.8rem;
  padding: 0.6rem 1.1rem;
  background: var(--panel);
  border-bottom: 1px solid var(--line);
}
.scripts-head-right { margin-left: auto; display: flex; gap: 0.5rem; align-items: center; }
.scripts-scan-warn {
  font-size: 0.76rem; color: #8a6100; background: #fdf6e3;
  border: 1px solid var(--yellow); border-radius: 8px; padding: 0.15rem 0.5rem;
  max-width: 40vw; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.scripts-body {
  flex: 1 1 auto; overflow-y: auto; min-height: 0;
  padding: 1rem 1.2rem 2rem;
  width: min(980px, 100%); margin: 0 auto;
}

/* per-person cheat sheet */
.scripts-guide {
  background: var(--panel); border: 1px solid var(--line); border-radius: 10px;
  padding: 0.55rem 0.8rem; margin-bottom: 0.8rem; box-shadow: var(--shadow-sm);
}
.scripts-guide-head { display: flex; align-items: center; gap: 0.5rem; }
.scripts-guide-head button { margin-left: auto; }
.scripts-guide-title { font-weight: 700; color: var(--accent); font-size: 0.85rem; }
.scripts-guide-list {
  margin: 0.45rem 0 0; padding: 0; list-style: none;
  display: flex; flex-direction: column; gap: 0.3rem;
}
.scripts-guide-list li { font-size: 0.82rem; padding: 0.15rem 0.45rem; border-radius: 6px; }
.scripts-guide-list li::before { content: '• '; color: var(--muted); }
.scripts-guide-list li.me { background: var(--accent-soft); }
.scripts-guide-list li.me::before { content: '➤ '; color: var(--accent); }

/* pipeline-at-a-glance bar */
.scripts-flow { display: flex; align-items: center; gap: 0.3rem; flex-wrap: wrap; margin-bottom: 1.1rem; }
button.flow-seg {
  display: inline-flex; align-items: center; gap: 0.35rem;
  background: var(--panel); color: var(--ink);
  border: 1px solid var(--line); border-radius: 999px;
  padding: 0.2rem 0.65rem; font-size: 0.78rem;
}
button.flow-seg:hover { border-color: var(--accent); filter: none; }
button.flow-seg:disabled { opacity: 0.45; }
.flow-n { font-weight: 800; color: var(--accent); }
.flow-sep { color: var(--muted); font-size: 0.8rem; }

/* stage sections — headers are deliberately big so the stages are unmissable */
.scripts-stage { margin-bottom: 2rem; }
.scripts-stage-head { display: flex; align-items: center; gap: 0.7rem; margin: 0 0 0.6rem; flex-wrap: wrap; }
.scripts-stage-head .stage-chip { font-size: 1.25rem; padding: 0.32rem 1.05rem; }
.scripts-stage-desc { font-size: 0.85rem; color: var(--muted); }
.scripts-stage-rows { display: flex; flex-direction: column; gap: 0.5rem; }
.scripts-stage-empty {
  border: 1px dashed var(--line); border-radius: 10px;
  padding: 0.55rem 0.75rem;
  color: var(--muted); font-size: 0.85rem;
}

.script-row {
  background: var(--panel); border: 1px solid var(--line); border-radius: 10px;
  padding: 0.55rem 0.75rem;
  display: flex; flex-direction: column; gap: 0.4rem;
  box-shadow: var(--shadow-sm);
}
.script-row.missing { opacity: 0.55; }
.script-row.attention { border-left: 3px solid var(--accent); }

.script-row-main { display: flex; align-items: center; gap: 0.5rem; flex-wrap: wrap; }
.script-actions-stack { display: flex; gap: 0.3rem; align-items: center; flex-wrap: wrap; justify-content: flex-end; }
.script-vs {
  font-size: 0.68rem; color: var(--muted); background: var(--line-soft);
  border-radius: 6px; padding: 0.08rem 0.35rem; white-space: nowrap;
}
.script-name { font-weight: 700; color: var(--ink); font-size: 0.95rem; }
.script-main-right { margin-left: auto; display: flex; gap: 0.4rem; align-items: center; flex-wrap: wrap; }
.tiny-btn-wide { padding: 0.12rem 0.55rem; font-size: 0.74rem; border-radius: 6px; }
.tiny-btn-wide.on { background: #fbf2da; border-color: var(--yellow); color: #946c10; }
button.script-action { background: var(--accent-soft); color: var(--accent); border: 1px solid var(--accent); }
button.script-action:hover:not(:disabled) { background: var(--accent); color: #fff; filter: none; }

/* one wrapping line: the note stretching to fill what's left, then the rarer
   actions — the note only gets its own line on narrow screens */
.script-row-details {
  display: flex; flex-wrap: wrap; align-items: center; gap: 0.4rem 0.75rem;
  border-top: 1px dashed var(--line); padding-top: 0.45rem; margin-top: 0.15rem;
}
.script-row-actions { display: flex; gap: 0.4rem; align-items: center; flex-wrap: wrap; }

/* stage color coding, shared by chips, section row tints and flow-bar dots:
   drafting (red) → in review (yellow) → finalizing (green), then panel prep
   (blue) and a deeper green for ready */
.stage-chip {
  font-size: 0.72rem; font-weight: 700; padding: 0.16rem 0.55rem; border-radius: 999px;
  border: 1px solid transparent; white-space: nowrap;
}
.stage-chip.drafting { background: #fcebeb; color: #b23b3b; }
.stage-chip.review { background: #fbf2da; color: #946c10; }
.stage-chip.finalizing { background: #e6f4ec; color: #2f8a56; }
.stage-chip.panel_prep { background: var(--accent-soft); color: var(--accent); }
.stage-chip.ready { background: #d3edde; color: #1f7a48; border-color: #2f8a56; }
.stage-chip.ingested { background: var(--line-soft); color: var(--muted); }

.scripts-stage[data-stage="drafting"] .script-row { background: #fdf5f5; border-color: #f0d9d9; }
.scripts-stage[data-stage="review"] .script-row { background: #fdf9ee; border-color: #eee3c2; }
.scripts-stage[data-stage="finalizing"] .script-row { background: #f2faf5; border-color: #d5ebde; }
.scripts-stage[data-stage="panel_prep"] .script-row { background: #f4f8fb; border-color: #d9e5ee; }
.scripts-stage[data-stage="ready"] .script-row { background: #ecf8f1; border-color: #c9e8d6; }
/* keep the "your turn" stripe visible on tinted rows (tints override border-color) */
.scripts-body .script-row.attention { border-left-color: var(--accent); }

.flow-dot { width: 9px; height: 9px; border-radius: 50%; background: var(--line); }
.flow-dot.drafting { background: #d98080; }
.flow-dot.review { background: #dcae4a; }
.flow-dot.finalizing { background: #6fbf92; }
.flow-dot.panel_prep { background: #7fa6c2; }
.flow-dot.ready { background: #2f8a56; }
.flow-dot.ingested { background: #b9c2cc; }

.badge.hint { background: var(--accent-soft); color: var(--accent); }
.badge.stale { background: #fdf6e3; color: #8a6100; border: 1px solid var(--yellow); }
.badge.gone { background: #fdeaea; color: #b23b3b; }
.badge.ingested { background: var(--line-soft); color: var(--muted); }

.script-row-links { display: flex; align-items: center; gap: 0.45rem; flex-wrap: wrap; }
/* full-width panel that wraps onto its own line under the details row */
.script-doc-picker {
  flex-basis: 100%; display: flex; flex-direction: column; gap: 0.25rem;
  border: 1px dashed var(--line); border-radius: 8px; padding: 0.4rem 0.55rem;
}
.script-doc-pick { display: flex; align-items: center; gap: 0.45rem; flex-wrap: wrap; }
.script-doc-pick > button { text-align: left; }
.doc-paste-input {
  flex: 1 1 14rem; min-width: 0;
  font-family: inherit; font-size: 0.78rem; color: var(--ink);
  border: 1px solid var(--line); border-radius: 6px;
  padding: 0.18rem 0.45rem; background: var(--panel);
}
.doc-paste-input:focus { outline: none; border-color: var(--accent); }
.script-doc-link {
  font-size: 0.78rem; color: var(--accent); text-decoration: none;
  background: var(--accent-soft); border-radius: 6px; padding: 0.1rem 0.45rem;
  white-space: nowrap;
}
.script-doc-link:hover { text-decoration: underline; }
.signoff-chip {
  font-size: 0.72rem; font-weight: 600; color: #946c10; background: #fbf2da;
  border-radius: 999px; padding: 0.12rem 0.5rem; white-space: nowrap;
}
.signoff-chip.mine { cursor: pointer; }
.signoff-chip.mine:hover { text-decoration: line-through; }

.script-row-msg {
  font-size: 0.82rem; color: #a13030; background: #fff4f4;
  border: 1px solid var(--red); border-radius: 8px; padding: 0.4rem 0.6rem;
}
.script-row-msg.ok { color: var(--green); background: #eef8f1; border-color: var(--green); }
.script-row-msg .modal-errors { margin-top: 0.25rem; }

.script-note { flex: 1 1 16rem; min-width: 0; }

/* ---------- reader mode (two-page spread lightbox) ---------- */
.reader-overlay {
  position: fixed; inset: 0; z-index: 200;
  background: rgba(10, 14, 20, 0.94);
  display: flex; align-items: center; justify-content: center;
  outline: none;
}
.reader-stage { display: flex; align-items: stretch; gap: 4px; /* book gutter */ }
.reader-page { height: 88vh; display: flex; align-items: center; }
.reader-page.left { justify-content: flex-end; cursor: w-resize; }
.reader-page.right { justify-content: flex-start; cursor: e-resize; }
.reader-page img {
  max-height: 100%; max-width: 46vw;
  background: #fff;
}
/* one landscape image spanning both pages of the spread */
.reader-page.wide { position: relative; justify-content: center; }
.reader-page.wide img { max-width: 93vw; }
.reader-zone { position: absolute; top: 0; bottom: 0; width: 50%; }
.reader-zone.left { left: 0; cursor: w-resize; }
.reader-zone.right { right: 0; cursor: e-resize; }
/* both sizeless slots keep a comic-page footprint so the spread geometry holds */
.reader-blank, .reader-empty { height: 100%; aspect-ratio: 2 / 3; max-width: 46vw; }
.reader-empty {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 0.35rem;
  background: #1c232d; color: #8fa0b3; font-size: 0.95rem;
  border: 1px dashed rgba(143, 160, 179, 0.45); border-radius: 4px;
}
.reader-close, .reader-nav {
  position: fixed;
  width: 40px; height: 40px; padding: 0;
  display: flex; align-items: center; justify-content: center;
  border-radius: 50%; font-size: 1.35rem; line-height: 1;
  background: rgba(255, 255, 255, 0.08); border: 1px solid rgba(255, 255, 255, 0.18);
  color: #dfe7ee;
}
.reader-close:hover, .reader-nav:hover:not(:disabled) { background: rgba(255, 255, 255, 0.18); filter: none; }
.reader-nav:disabled { opacity: 0.25; }
.reader-close { top: 0.8rem; right: 0.9rem; font-size: 1rem; }
.reader-nav { top: 50%; transform: translateY(-50%); }
.reader-nav.prev { left: 0.7rem; }
.reader-nav.next { right: 0.7rem; }
.reader-caption {
  position: fixed; left: 0; right: 0; bottom: 0.65rem;
  text-align: center; pointer-events: none;
  color: #b6c2cf; font-size: 0.84rem; text-shadow: 0 1px 3px rgba(0, 0, 0, 0.8);
}
