/* studio-web shell — "creative studio" theme (2026-08 reskin): warm cream
   canvas, ink text, coral signature accent, self-hosted Bricolage Grotesque
   (display) + Schibsted Grotesk (body). Every pre-reskin variable name below
   still exists (values changed); new tokens are additive. M2 preview classes
   below; M3a studio-shell classes (composer/pcard/gallery/toast) at the end. */

@font-face {
  font-family: "Bricolage Grotesque";
  font-style: normal;
  font-weight: 200 800;
  font-display: swap;
  src: url("../fonts/bricolage-grotesque-latin-wght-normal.woff2")
    format("woff2");
}

@font-face {
  font-family: "Schibsted Grotesk";
  font-style: normal;
  font-weight: 400 900;
  font-display: swap;
  src: url("../fonts/schibsted-grotesk-latin-wght-normal.woff2")
    format("woff2");
}

:root {
  /* canvas + surfaces: warm cream / ink */
  --bg: #f7f2e9;
  --surface: #fffdf8;
  --panel: #f3ecdf;
  --line: #e6ddcb;
  --fg: #231d14;
  --fg-dim: #6e6557;
  --faint: #a49a89;

  /* signature hue: coral/vermilion */
  --accent: #d94f2b;
  --accent-soft: #fbe9e1;
  --accent-deep: #b83e1f; /* hover / pressed */
  --accent-ink: #a83518; /* accent-colored TEXT on cream (contrast-safe) */

  /* supporting hues */
  --accent-2: #6d55d9; /* violet */
  --accent-2-soft: #ece7fb;
  --pop: #e9a23b; /* amber */
  --pop-soft: #faf0d9;

  /* status */
  --ok: #2e7d55;
  --err: #c0331f;
  --err-soft: #f9e4de;
  --warn: #a4720e;

  /* aliases: older sections reference these via var(--x, fallback) with the
     variable historically undefined — defining them here retires the cool
     grey/blue fallback literals in one place. */
  --danger: var(--err);
  --muted: var(--fg-dim);
  --panel-hi: var(--accent-soft);

  /* elevation + shape */
  --shadow-s: 0 1px 2px rgba(63, 44, 22, 0.06);
  --shadow: 0 1px 2px rgba(63, 44, 22, 0.05), 0 4px 14px rgba(63, 44, 22, 0.08);
  --shadow-l:
    0 2px 4px rgba(63, 44, 22, 0.06), 0 12px 32px rgba(63, 44, 22, 0.12);
  --radius-s: 8px;
  --radius-m: 12px;
  --radius-l: 16px;
  --radius-pill: 999px;

  /* type */
  --font-display:
    "Bricolage Grotesque", "Avenir Next", -apple-system, sans-serif;
  --font-body:
    "Schibsted Grotesk", -apple-system, "Segoe UI", Roboto, sans-serif;
  --mono: ui-monospace, SFMono-Regular, Menlo, monospace;

  /* section identities */
  --tint-brand: #fbeee7;
  --tint-cast: #efeafa;
  --tint-library: #f8f0da;
  --tint-settings: #edf0e7;

  /* faint grain, layered into backgrounds (never a pointer-eating overlay) */
  --noise: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='140' height='140'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='2'/%3E%3C/filter%3E%3Crect width='140' height='140' filter='url(%23n)' opacity='0.028'/%3E%3C/svg%3E");
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background:
    var(--noise),
    radial-gradient(
      900px 500px at 15% -5%,
      rgba(217, 79, 43, 0.07),
      transparent 60%
    ),
    radial-gradient(
      800px 500px at 90% 0%,
      rgba(109, 85, 217, 0.06),
      transparent 55%
    ),
    var(--bg);
  background-attachment: fixed;
  color: var(--fg);
  font: 15px/1.5 var(--font-body);
}

.shell {
  max-width: 1040px;
  margin: 0 auto;
  padding: 24px 20px 64px;
}

.shell header h1 {
  font-size: 20px;
  margin: 0 0 4px;
}

.shell header p {
  margin: 0 0 20px;
  color: var(--fg-dim);
}

.fixtures {
  display: flex;
  gap: 8px;
  margin-bottom: 16px;
}

.fixtures button {
  padding: 8px 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  color: var(--fg);
  font: inherit;
  cursor: pointer;
}

.fixtures button[data-active="true"] {
  border-color: var(--accent);
  color: var(--accent);
  font-weight: 600;
}

.status {
  margin: 0 0 12px;
  color: var(--fg-dim);
  min-height: 1.5em;
}

.status[data-kind="error"] {
  color: var(--err);
}

.player {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 16px;
}

.viewport {
  position: relative;
  width: 100%;
  background: #17120d;
  border-radius: 8px;
  overflow: hidden;
}

.viewport iframe {
  position: absolute;
  top: 0;
  left: 0;
  border: 0;
  transform-origin: top left;
}

.controls {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-top: 12px;
}

.controls button {
  padding: 6px 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  font: inherit;
  cursor: pointer;
  min-width: 72px;
}

.controls button:disabled {
  opacity: 0.5;
  cursor: default;
}

.controls input[type="range"] {
  flex: 1;
  accent-color: var(--accent);
}

.controls .readout {
  font-variant-numeric: tabular-nums;
  color: var(--fg-dim);
  min-width: 130px;
  text-align: right;
}

/* ── studio shell: header + composer ─────────────────────────────────────── */

/* App header: brand + the "New video" action on the left, the view-switcher
   tab strip on the right, separated from the page body by a hairline. */
.apphead {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 20px;
  padding-bottom: 14px;
  border-bottom: 1px solid var(--line);
}

.apphead .brand {
  margin-bottom: 0;
}

/* "New video" header ACTION (by the brand) — deliberately NOT tab-shaped:
   a filled accent button so it reads as "do something", not "go somewhere". */
.newvideo-btn {
  padding: 8px 16px;
  border: 1px solid var(--accent);
  border-radius: var(--radius-pill);
  background: var(--accent);
  color: #fff;
  font: inherit;
  font-family: var(--font-display);
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.01em;
  cursor: pointer;
  box-shadow: 0 2px 8px rgba(217, 79, 43, 0.28);
  transition:
    background 0.12s ease,
    box-shadow 0.15s ease,
    transform 0.15s ease;
}

.newvideo-btn:hover,
.newvideo-btn:focus-visible {
  background: var(--accent-deep);
  border-color: var(--accent-deep);
  box-shadow: 0 4px 14px rgba(217, 79, 43, 0.35);
  outline: none;
}

.newvideo-btn:active {
  transform: scale(0.97);
}

/* View switcher (Studio | Library | Settings): a compact segmented control —
   one shared track, the active view a raised white pill. Pushed to the right
   edge of the header. */
.topnav {
  margin-left: auto;
  display: inline-flex;
  gap: 2px;
  padding: 4px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius-pill);
}

.topnav button {
  padding: 6px 15px;
  border: 0;
  border-radius: var(--radius-pill);
  background: transparent;
  color: var(--fg-dim);
  font: inherit;
  font-family: var(--font-display);
  font-size: 13px;
  font-weight: 600;
  line-height: 1.2;
  cursor: pointer;
  transition:
    background 0.12s ease,
    color 0.12s ease;
}

.topnav button:hover:not([data-active="true"]) {
  color: var(--fg);
}

.topnav button[data-active="true"] {
  background: var(--surface);
  color: var(--accent-ink);
  font-weight: 700;
  box-shadow: var(--shadow-s);
}

.topnav button:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 1px;
}

/* First-run hint now sits on its own line under the header (moved out of the
   nav row) — a small left-aligned notice, not nav clutter. */
.firstrun-hint {
  margin: 0 0 16px;
}

/* One-time first-visit hint pointing at the Settings TAB (settingsModal.js)
   — the handoff guide lives in that (inactive) tab; dismissed by its × or by
   activating Settings (localStorage vygent.firstRunHintSeen). */
.firstrun-hint {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 10px;
  border: 1px solid var(--accent);
  border-radius: var(--radius-pill);
  background: var(--accent-soft);
  color: var(--accent-ink);
  font-size: 12px;
  font-weight: 600;
  white-space: nowrap;
}

/* The hint text is itself the "go to Settings" button — pill look inherited. */
.firstrun-hint .firstrun-go {
  border: 0;
  background: none;
  color: inherit;
  font: inherit;
  padding: 0;
  cursor: pointer;
}
.firstrun-hint .firstrun-go:hover {
  text-decoration: underline;
  text-underline-offset: 2px;
}

.firstrun-hint .firstrun-dismiss {
  border: 0;
  background: none;
  color: inherit;
  font: inherit;
  font-size: 15px;
  line-height: 1;
  padding: 0 2px;
  cursor: pointer;
}

.brand {
  display: flex;
  align-items: baseline;
  gap: 8px;
  margin-bottom: 4px;
}

.brand b {
  font-family: var(--font-display);
  font-size: 23px;
  font-weight: 800;
  letter-spacing: -0.03em;
}

.brand span {
  font-family: var(--font-display);
  font-size: 20px;
  font-weight: 500;
  color: var(--fg-dim);
}

p.sub {
  color: var(--fg-dim);
  margin: 0 0 16px;
  font-size: 13.5px;
  max-width: none;
}

.composer {
  background: linear-gradient(
      180deg,
      rgba(217, 79, 43, 0.05),
      rgba(217, 79, 43, 0) 96px
    )
    var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-l);
  box-shadow: var(--shadow-l);
  padding: 16px 18px 14px;
}

.composer textarea {
  width: 100%;
  min-height: 84px;
  resize: vertical;
  border: none;
  outline: none;
  background: transparent;
  font: inherit;
  font-size: 15.5px;
  line-height: 1.55;
  padding: 2px;
  color: var(--fg);
}

.composer textarea::placeholder {
  color: var(--faint);
}

.composer .row {
  display: flex;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
  border-top: 1px solid var(--line);
  margin-top: 10px;
  padding-top: 11px;
}

/* R1 revision face: the collapsed "+ Add revision" row has no textarea above it. */
.composer .row.noline {
  border-top: none;
  margin-top: 0;
  padding-top: 0;
}

.composer .grow {
  flex: 1;
}

.composer .hint {
  color: var(--faint);
  font-size: 12.5px;
}

/* Draft-preview posture line (main.js livePreviewSurface): pre-compose jobs
   preview a mechanical scaffold — say so in chrome, never in the doc. */
.livepreview .live-draft-note {
  margin: 4px 0 6px;
  font-size: 12.5px;
  color: var(--warn);
}

/* Paused-job note on the brief face (composer.js briefView): with a job
   paused at a depth stop above, the brief box still starts a NEW video —
   this line disambiguates it from a "describe changes" field. */
.composer .pausedbrief-note {
  margin: 0 0 2px;
  font-size: 12.5px;
  color: var(--muted);
}

.composer .pausedbrief-note b {
  color: var(--fg);
}

/* Pre-spend $ estimate beside the Generate buttons (composer.js). The title
   attr carries the per-stage breakdown — cursor invites the hover. */
.composer .costhint {
  white-space: nowrap;
  cursor: help;
  font-variant-numeric: tabular-nums;
}

/* ── Brief-face control layout ─────────────────────────────────────────────
   A vertical stack instead of one ragged flex-wrap: a soft "options" panel of
   toggles, a uniform grid of setting selects (equal columns, stacked
   micro-labels), then a right-aligned action row. */
.composer .row.controls {
  flex-direction: column;
  align-items: stretch;
  gap: 13px;
}

/* R2 full-parity strip (revision face): every generation-time option shown
   READ-ONLY at the original brief's values — same chrome as .opts, dimmed,
   because the revision pipeline can't change these. */
.composer .row.parity {
  border-top: none;
  margin-top: 8px;
  padding: 9px 14px;
  gap: 7px 18px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius-m);
  opacity: 0.55;
}
.composer .row.parity label.toggle {
  cursor: default;
}
.composer .row.parity .speed {
  display: flex;
  align-items: center;
  gap: 8px;
}
.composer .row.parity .speed .slabel {
  font-size: 12px;
  font-weight: 600;
  white-space: nowrap;
}
.composer .row.parity .speed input[type="range"] {
  width: 108px;
  accent-color: var(--accent);
}
.composer .row.parity .speed .sticks {
  display: flex;
  gap: 8px;
  font-size: 11px;
  color: var(--fg-dim);
}
.composer .row.parity .speed .sticks .on {
  font-weight: 700;
  color: var(--accent);
}

/* A revision control with a staged change (op or video/voice draft pick):
   the label tints so current-vs-changed reads at a glance. */
.composer label.select.staged {
  color: var(--accent-ink);
}

/* Revision-face attached-docs row: one small icon per doc (filename in the
   tooltip), ×-remove, and the add input styled as a small button. */
.composer .row.jobdocs {
  gap: 8px;
  padding-top: 8px;
  border-top: none;
  margin-top: 4px;
  font-size: 12.5px;
}
.composer .jobdocs .jd-label {
  font-size: 11px;
  font-weight: 650;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: var(--faint);
}
.composer .jdoc {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  border: 1px solid var(--line);
  background: var(--panel);
  border-radius: 7px;
  padding: 3px 6px;
  cursor: default;
}
/* .jdoc-x is the REMOVE button only (the e2e keys on it); .jdoc-tpl is the
   save-as-template ⊞ — same chrome, non-destructive accent on hover. */
.composer .jdoc .jdoc-x,
.composer .jdoc .jdoc-tpl {
  border: none;
  background: transparent;
  color: var(--faint);
  cursor: pointer;
  font-size: 13px;
  line-height: 1;
  padding: 0 1px;
}
.composer .jdoc .jdoc-x:hover {
  color: var(--danger, #c0392b);
}
.composer .jdoc .jdoc-tpl:hover {
  color: var(--accent, #2563eb);
}
.composer .jdoc-add {
  display: inline-flex;
  align-items: center;
  border: 1px solid var(--line);
  background: var(--surface);
  border-radius: 7px;
  padding: 3px 8px;
  font-size: 12px;
  cursor: pointer;
  color: var(--fg-dim);
}
.composer .jdoc-add:hover {
  border-color: var(--accent);
  color: var(--accent);
}
.composer .jdoc-add input[type="file"] {
  display: none;
}
.composer .jdoc-err {
  color: var(--danger, #c0392b);
  font-size: 12px;
  max-width: 340px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* Four even columns — one tidy 4×1 row (Brand / Cast / Voice / Captions);
   extra advanced fields wrap onto further rows of four. Collapses to two
   columns on a narrow viewport. */
.composer .fields {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px 16px;
}

@media (max-width: 620px) {
  .composer .fields {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

/* Each field: an uppercase micro-label stacked over a full-width control, so
   every select lines up in a tidy column grid regardless of label length. */
.composer .fields label.select {
  flex-direction: column;
  align-items: stretch;
  gap: 5px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--faint);
}

.composer .fields label.select select {
  width: 100%;
  max-width: none;
  padding: 7px 9px;
  font-size: 13px;
  font-weight: 400;
  letter-spacing: normal;
  text-transform: none;
  color: var(--fg);
}

/* One shared chrome for ALL four field controls — the Brand/Cast picker
   BUTTONS ("ghost small" elsewhere) and the Voice/Captions SELECTS render as
   the same box: same height, border, radius, type. */
.composer .fields label.select select,
.composer .fields label.brandwrap #brandBtn,
.composer .fields label.castwrap > button {
  box-sizing: border-box;
  width: 100%;
  min-height: 34px;
  padding: 6px 10px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-s);
  font-size: 13px;
  font-weight: 400;
  letter-spacing: normal;
  text-transform: none;
  color: var(--fg);
  transition: border-color 0.12s ease;
}

.composer .fields label.brandwrap #brandBtn:hover,
.composer .fields label.castwrap > button:hover {
  border-color: var(--faint);
}

.composer .fields label.brandwrap #brandBtn:focus-visible,
.composer .fields label.castwrap > button:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 1px;
}

/* Draft-revision face: five setting selects (Brand / Captions / Image / Video /
   Voice) share the same stacked-microlabel grid as the brief face. */
.composer .fields.fields-rev {
  grid-template-columns: repeat(5, minmax(0, 1fr));
  margin-top: 10px;
}
@media (max-width: 620px) {
  .composer .fields.fields-rev {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

/* Draft-face action row: Record left; Discard / Regenerate / cost / the
   Full-render checkbox / Generate clustered right. */
.composer .row.revactions {
  align-items: center;
  gap: 10px;
}
.composer .revactions .fullrender-toggle {
  white-space: nowrap;
}

/* Style expectation hint: a full-width line under the fields grid telling the
   user what this style needs (cast count, screen recordings, brand…). */
.composer .fields .style-hintrow {
  grid-column: 1 / -1;
  display: flex;
  align-items: baseline;
  gap: 10px;
  font-size: 12px;
  color: var(--fg-dim);
  padding: 2px 2px 0;
}
.composer .fields .style-guide-link {
  color: var(--accent-ink);
  font-weight: 600;
  white-space: nowrap;
}

/* Brand picker button sits in the grid like the other field controls. */
.composer .fields label.brandwrap {
  position: relative;
}

.composer .fields label.brandwrap #brandBtn {
  width: 100%;
  justify-content: space-between;
  text-transform: none;
  letter-spacing: normal;
}

.composer .actions {
  display: flex;
  justify-content: flex-end;
  align-items: center;
  gap: 10px;
}

#addRevision,
#discardDraft {
  background: var(--accent);
  color: #fff;
  border: none;
  border-radius: var(--radius-m);
  padding: 10px 22px;
  font: 700 13.5px/1.2 var(--font-display);
  cursor: pointer;
  transition:
    background 0.12s ease,
    transform 0.15s ease;
}

#addRevision:hover:not(:disabled) {
  background: var(--accent-deep);
}

#addRevision:active:not(:disabled),
#discardDraft:active:not(:disabled) {
  transform: scale(0.97);
}

#addRevision:disabled,
#discardDraft:disabled {
  opacity: 0.4;
  cursor: default;
}

#discardDraft {
  background: var(--surface);
  color: var(--fg);
  border: 1px solid var(--line);
}

label.toggle {
  display: flex;
  align-items: center;
  gap: 7px;
  color: var(--fg-dim);
  font-size: 13px;
  cursor: pointer;
  user-select: none;
}

label.toggle input {
  accent-color: var(--accent);
  width: 14px;
  height: 14px;
}

/* dim a toggle whose input is disabled (e.g. a dependent axis / clips when
   images are off). */
label.toggle:has(input:disabled) {
  opacity: 0.45;
  cursor: default;
}

label.select {
  display: flex;
  align-items: center;
  gap: 7px;
  color: var(--fg-dim);
  font-size: 13px;
}

label.select select {
  background: var(--surface);
  color: var(--fg);
  border: 1px solid var(--line);
  border-radius: var(--radius-s);
  padding: 6px 9px;
  font: inherit;
  font-size: 12.5px;
  max-width: 220px;
  transition: border-color 0.12s ease;
}

label.select select:hover {
  border-color: var(--faint);
}

label.select select:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 1px;
}

/* The hero action: the one button that makes a video. The cost estimate sits
   directly beside it (.actions is justify-content: flex-end). */
#go {
  background: var(--accent);
  color: #fff;
  border: none;
  border-radius: var(--radius-m);
  padding: 11px 26px;
  font: 700 14.5px/1.2 var(--font-display);
  letter-spacing: 0.01em;
  cursor: pointer;
  box-shadow: 0 2px 10px rgba(217, 79, 43, 0.3);
  transition:
    background 0.12s ease,
    box-shadow 0.15s ease,
    transform 0.15s ease;
}

#go:hover:not(:disabled) {
  background: var(--accent-deep);
  box-shadow: 0 4px 16px rgba(217, 79, 43, 0.38);
}

#go:active:not(:disabled) {
  transform: scale(0.97);
}

#go:disabled {
  opacity: 0.4;
  cursor: default;
  box-shadow: none;
}

/* Stop face of the Generate button (danger styling while a run is watched). */
#go.stop {
  background: var(--err);
  box-shadow: 0 2px 10px rgba(192, 51, 31, 0.3);
}

/* ── progress + player cards ─────────────────────────────────────────────── */

#status,
#player {
  margin-top: 20px;
}

.pcard {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-l);
  box-shadow: var(--shadow);
  padding: 15px 17px 13px;
}

.progressrow {
  display: flex;
  align-items: center;
  gap: 12px;
}

.bar {
  flex: 1;
  height: 8px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius-pill);
  overflow: hidden;
}

.bar i {
  display: block;
  height: 100%;
  width: 0;
  background: linear-gradient(90deg, var(--accent), #e8703f);
  border-radius: var(--radius-pill);
  transition: width 0.4s;
}

.bar i.done {
  background: var(--ok);
}

#stage {
  font-size: 12.5px;
  color: var(--fg-dim);
  font-weight: 500;
  white-space: nowrap;
}

#stage.ok {
  color: var(--ok);
  font-weight: 600;
}

#stage.err {
  color: var(--err);
  font-weight: 600;
  white-space: normal;
}

/* R0 error surfacing: a failed run's stage-error detail rendered prominently
   on the progress card (progress.js), plus the fal key/billing hint line. */
.stage-error-detail {
  margin-top: 10px;
  padding: 8px 10px;
  border: 1px solid var(--err);
  border-radius: 8px;
  background: var(--err-soft);
  color: var(--err);
  font-size: 13px;
  white-space: pre-wrap;
  word-break: break-word;
}

/* Recovery hint (PipelineStageError.hint): what the USER can do about the
   failure — calmer than the red detail box, sits directly under it. */
.stage-error-hint {
  margin-top: 6px;
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  color: var(--fg);
  font-size: 13px;
  word-break: break-word;
}

.billing-hint {
  margin-top: 6px;
  font-size: 13px;
  color: var(--fg-dim);
}

.billing-hint a {
  color: var(--accent);
  font-weight: 600;
}

/* Fact-check report card (factCheckCard.js) — status-tinted left rail. */
.fc-card {
  margin-top: 10px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-left: 4px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  font-size: 13px;
}
.fc-card.fc-ok {
  border-left-color: var(--ok);
  background: #eef7f1;
}
.fc-card.fc-warn {
  border-left-color: var(--warn);
  background: #fbf5e9;
}
.fc-card.fc-err {
  border-left-color: var(--err);
  background: var(--err-soft);
}
.fc-card.fc-none {
  border-left-color: var(--fg-dim);
}
.fc-head {
  display: flex;
  align-items: baseline;
  gap: 8px;
}
.fc-icon {
  font-weight: 700;
}
.fc-ok .fc-icon {
  color: var(--ok);
}
.fc-warn .fc-icon {
  color: var(--warn);
}
.fc-err .fc-icon {
  color: var(--err);
}
.fc-title {
  font-weight: 600;
}
.fc-owner,
.fc-counts {
  color: var(--fg-dim);
}
.fc-counts {
  margin-top: 2px;
  font-size: 12px;
}
.fc-notes {
  margin: 8px 0 0;
  padding: 0;
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.fc-note {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 6px;
  padding: 6px 8px;
  border-radius: 6px;
  background: var(--panel);
}
.fc-badge {
  flex: none;
  padding: 1px 6px;
  border-radius: 10px;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.02em;
  background: var(--accent-soft);
  color: var(--accent);
}
.fc-note-corrected .fc-badge {
  background: #fbf5e9;
  color: var(--warn);
}
.fc-note-contradicted .fc-badge {
  background: var(--err-soft);
  color: var(--err);
}
.fc-claim {
  flex: 1 1 60%;
}
.fc-claim s {
  color: var(--fg-dim);
}
.fc-scene {
  margin-left: 6px;
  color: var(--fg-dim);
  font-size: 11px;
}
.fc-cite {
  flex-basis: 100%;
  color: var(--fg-dim);
  font-size: 12px;
  font-style: italic;
}

details.devfold {
  margin-top: 10px;
}

details.devfold > summary {
  list-style: none;
  cursor: pointer;
  font-size: 11px;
  font-weight: 650;
  color: var(--faint);
  text-transform: uppercase;
  letter-spacing: 0.07em;
  user-select: none;
  display: flex;
  align-items: center;
  gap: 6px;
}

details.devfold > summary::-webkit-details-marker {
  display: none;
}

.fchev {
  display: inline-block;
  transition: transform 0.15s;
  font-size: 9px;
}

details.devfold[open] .fchev {
  transform: rotate(90deg);
}

#log {
  margin-top: 8px;
  max-height: 170px;
  overflow-y: auto;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 10px 14px;
  font: 11.5px/1.75 var(--mono);
  color: var(--fg-dim);
}

#log .ok {
  color: var(--ok);
}

#log .err {
  color: var(--err);
}

#log .call {
  color: var(--accent);
}

#stats {
  margin-top: 8px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 12px 14px;
}

#stats h2 {
  margin: 0 0 6px;
  font-size: 10.5px;
  font-weight: 650;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: var(--faint);
}

#stats table {
  width: 100%;
  border-collapse: collapse;
  font: 11.5px/1.85 var(--mono);
}

#stats td {
  padding: 0 8px 0 0;
  color: var(--fg-dim);
}

#stats td.num {
  text-align: right;
  color: var(--fg);
  white-space: nowrap;
}

#stats tr.total td {
  border-top: 1px solid var(--line);
  padding-top: 4px;
  color: var(--fg);
  font-weight: 600;
}

#stats tr.running td:first-child::after {
  content: " ⏱";
}

/* Video-processing sub-rows under the render stage (setup / encode / mux). */
#stats tr.vsub td:first-child {
  padding-left: 14px;
  color: var(--faint);
}

/* Per-step diagnostic table: research / LLM / image / video (with model) + tokens. */
#stats table.steps {
  margin-top: 4px;
}
#stats table.steps th {
  text-align: left;
  color: var(--faint);
  font-weight: 600;
  border-bottom: 1px solid var(--line);
  padding: 0 8px 3px 0; /* match #stats td right-padding so headers align with columns */
  white-space: nowrap;
}
#stats table.steps th.num {
  text-align: right;
}
#stats table.steps td.model {
  color: var(--accent);
  max-width: 190px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
#stats tr.step.scached td {
  opacity: 0.55;
}
#stats tr.step.serr td {
  color: var(--err);
}
/* Per-step asset thumbnails: a tiny clickable tile once the step's media
   asset streams in (img/frame stills, clip poster, tts speaker icon) →
   preview popup (analytics.js stepPreviewOverlay reuses .preview-overlay). */
#stats table.steps th.sthumb,
#stats table.steps td.sthumb {
  width: 46px;
  padding: 2px 6px 2px 0;
}
/* Text-call (LLM) rows: no media thumb — a 💬 opens the reasoning popup. */
#stats .thumbbtn.text {
  display: grid;
  place-items: center;
  font-size: 12px;
  cursor: pointer;
}

#stats .thumbbtn {
  position: relative;
  display: block;
  width: 42px;
  height: 24px;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 4px;
  overflow: hidden;
  background: var(--panel);
  cursor: zoom-in;
}
#stats .thumbbtn img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
#stats .thumbbtn .tplay {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  font-size: 10px;
  color: #fff;
  text-shadow: 0 0 3px rgba(0, 0, 0, 0.7);
  pointer-events: none;
}
#stats .thumbbtn.audio .tplay {
  color: var(--faint);
  text-shadow: none;
}

#player video {
  width: 100%;
  border-radius: 10px;
  background: #000;
  display: block;
}

.vrow {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-top: 10px;
}

a.dl {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: var(--surface);
  color: var(--fg);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 6px 13px;
  font-size: 12.5px;
  font-weight: 600;
  text-decoration: none;
}

#renders {
  font-size: 12px;
  color: var(--fg-dim);
}

#renders a {
  color: var(--accent);
  text-decoration: none;
  margin-right: 6px;
}

/* ── job gallery (the Library nav tab) ───────────────────────────────────── */

#gallery {
  margin-top: 20px;
}

.galleryempty {
  color: var(--faint);
  font-size: 13px;
}

#gallery h2 {
  margin: 0 0 14px;
  font-family: var(--font-display);
  font-size: 11.5px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.09em;
  color: var(--fg-dim);
}

#galleryGrid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 14px;
}

.tile {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-l);
  overflow: hidden;
  cursor: pointer;
  box-shadow: var(--shadow);
  transition:
    border-color 0.15s,
    box-shadow 0.15s ease,
    transform 0.15s ease;
}

.tile:hover,
.tile:focus-visible {
  border-color: var(--accent);
  box-shadow: var(--shadow-l);
  outline: none;
}

.tile.active {
  border-color: var(--accent);
  box-shadow: 0 0 0 2px var(--accent-soft), 0 0 0 3px var(--accent);
}

.tile .shot {
  width: 100%;
  aspect-ratio: 16 / 9;
  object-fit: cover;
  display: block;
  background: #000;
}

/* Portrait (9:16) tiles: CSS hook only, not yet wired. JobSummary (the tile's
   data source) does not carry aspect, so gallery.js can't cheaply stamp
   data-aspect="9:16" without a summary-shape change — deferred per plan. When a
   future JobSummary exposes aspect, set data-aspect on the .shot <img> and this
   rule renders the thumbnail vertically. Harmless while unset. */
.tile .shot[data-aspect="9:16"] {
  aspect-ratio: 9 / 16;
  max-height: 300px;
  margin: 0 auto;
}

.tile .shot.empty {
  background: var(--tint-library);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--faint);
  font-size: 11.5px;
}

.tile .meta {
  padding: 10px 12px 12px;
}

.tile .tprompt {
  font-size: 12.5px;
  line-height: 1.45;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  min-height: 36px;
}

.tile .trow {
  display: flex;
  align-items: center;
  gap: 7px;
  margin-top: 8px;
  font-size: 11px;
  color: var(--fg-dim);
}

/* Generation-spend badges (event-log fold): project tiles, media tiles and
   the preview overlay. Tooltip carries the per-call breakdown. */
.tile .costhint,
.pv-sub .costhint {
  color: var(--faint);
  white-space: nowrap;
  cursor: help;
  font-variant-numeric: tabular-nums;
}

.tile .dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--faint);
  flex: none;
}

/* Paused at a depth stop — amber "waiting for you", not an error. */
.tile .dot.paused {
  background: #e0a10b;
}

.tile .dot.done {
  background: var(--ok);
}

.tile .dot.error {
  background: var(--err);
}

.tile .dot.running,
.tile .dot.queued {
  background: var(--warn);
}

/* ── document editor (M3b, adapted from static/index.html :85-156) ───────── */

@keyframes vypulse {
  0%,
  100% {
    opacity: 0.45;
  }
  50% {
    opacity: 0.9;
  }
}

#doc {
  margin-top: 28px;
}

#doc textarea,
#doc input[type="text"],
#doc input[type="number"] {
  background: var(--surface);
  color: var(--fg);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 7px 10px;
  font: inherit;
  font-size: 13px;
  width: 100%;
}

#doc textarea:focus,
#doc input:focus,
#doc select:focus {
  outline: none;
  border-color: var(--accent);
}

#doc select {
  background: var(--surface);
  color: var(--fg);
  border: 1px solid var(--line);
  border-radius: 7px;
  padding: 5px 8px;
  font: inherit;
  font-size: 12.5px;
}

/* The progress card's action buttons (depth-ladder Continue/finish-video,
   directions-chooser Continue, error-state Retry/Re-render, reload) use the
   same .small/.ghost classes as the #doc editor but live OUTSIDE #doc — they
   were falling through to native UA chrome. Mirror the #doc family, scoped to
   .pcard with CLASS-ONLY specificity so #cancelJob's red id rule still wins. */
.pcard button.small {
  appearance: none;
  background: var(--accent);
  color: #fff;
  border: none;
  border-radius: var(--radius-m);
  padding: 7px 14px;
  font: 700 12.5px/1.2 var(--font-display);
  cursor: pointer;
  transition: background 0.12s ease;
}

.pcard button.small:hover:not(:disabled):not(.ghost) {
  background: var(--accent-deep);
}

.pcard button.small:disabled {
  opacity: 0.4;
  cursor: default;
}

.pcard button.small.ghost {
  background: var(--surface);
  color: var(--fg);
  border: 1px solid var(--line);
  padding: 6px 13px; /* 1px border compensation — pixel-equal height with the primary */
}

.pcard button.small.ghost:hover:not(:disabled) {
  background: var(--panel);
}

#doc button {
  background: var(--accent);
  color: #fff;
  border: none;
  border-radius: var(--radius-m);
  padding: 9px 20px;
  font: 700 13.5px/1.2 var(--font-display);
  cursor: pointer;
  transition: background 0.12s ease;
}

#doc button:hover:not(:disabled):not(.ghost) {
  background: var(--accent-deep);
}

#doc button:disabled {
  opacity: 0.4;
  cursor: default;
}

#doc button.ghost {
  background: var(--surface);
  color: var(--fg);
  border: 1px solid var(--line);
}

#doc button.small {
  padding: 7px 14px;
  font-size: 12.5px;
}

/* Upload-your-own-image control (step 4/5) — a <label> wrapping a hidden file
   input, styled to match the ghost/small Regenerate button beside it. */
#doc label.upload-btn.small {
  display: inline-flex;
  align-items: center;
  padding: 7px 14px;
  font-size: 12.5px;
  background: var(--surface);
  color: var(--fg);
  border: 1px solid var(--line);
  border-radius: inherit;
  cursor: pointer;
  white-space: nowrap;
}
#doc label.upload-btn.busy {
  opacity: 0.4;
  cursor: default;
}

/* The versions bar — ONE row: ‹ › nav + version chips (the picker) + the
   selected version's render thumb, meta, and read-only/branch affordances
   (ui/versionBar.js). Chip visuals are the standalone .verchip rules. */
.versionbar {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  padding: 2px 0 12px;
}

.versionbar .verchips {
  display: inline-flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px;
}

.versionbar .grow {
  flex: 1;
}

.versionbar .revnav {
  padding: 2px 9px;
  font-size: 14px;
  line-height: 1.4;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  color: var(--fg-dim);
  cursor: pointer;
}

.versionbar .revnav:disabled {
  opacity: 0.4;
  cursor: default;
}

.versionbar .revthumb {
  width: 64px;
  height: 36px;
  object-fit: cover;
  border-radius: 6px;
  border: 1px solid var(--line);
  background: #000;
  pointer-events: none;
}

.versionbar .revmeta {
  font-size: 12px;
  color: var(--fg-dim);
  max-width: 46ch;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.versionbar .robadge {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--warn);
  border: 1px solid var(--warn);
  border-radius: 999px;
  padding: 3px 10px;
}

/* Read-only wrapper around the scene cards (a disabled fieldset kills every
   input/textarea/select/button inside natively) — visually a no-op frame. */
/* ── whole-video palette pickers (documentEditor paletteRow) ────────────────
   Three color inputs staging setVideoAttr bg/text/accent — live in the Edit
   preview; ↺ resets a color to the theme. The harmony guard fixes MACHINE
   picks at generation; these are the USER's override, never corrected. */
.palette-row {
  display: flex;
  align-items: center;
  gap: 14px;
  flex-wrap: wrap;
  padding: 9px 12px;
  margin: 0 0 12px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius-m);
}

.palette-row .palette-label {
  font: 700 11px var(--font-display);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--fg-dim);
}

.palette-row .palette-pick {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  color: var(--fg-dim);
  cursor: pointer;
}

.palette-row .palette-pick input[type="color"] {
  width: 26px;
  height: 26px;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: none;
  cursor: pointer;
}

.palette-row .palette-pick.overridden span {
  color: var(--accent-ink);
  font-weight: 650;
}

.palette-row .palette-reset {
  border: none;
  background: transparent;
  color: var(--faint);
  cursor: pointer;
  font-size: 13px;
  padding: 0 2px;
}

.palette-row .palette-reset:hover {
  color: var(--accent-ink);
}

.palette-row .palette-hint {
  margin-left: auto;
  font-size: 11.5px;
  color: var(--faint);
}

.scenesfs {
  border: 0;
  padding: 0;
  margin: 0;
  min-inline-size: auto;
}

.scenesfs:disabled #scenes {
  opacity: 0.75;
}

/* Player caption when a picked revision's render is showing (R2). */
.renderlabel {
  font-size: 12.5px;
  color: var(--fg-dim);
  padding: 8px 12px 0;
}

#diag {
  margin: 12px 0 0;
  background: #fdf1f0;
  border: 1px solid #e5a9a4;
  border-radius: 12px;
  padding: 12px 16px;
  font-size: 12.5px;
  color: var(--err);
  white-space: pre-wrap;
  line-height: 1.6;
}

#docwarn {
  margin: 12px 0 0;
  color: var(--warn);
  font-size: 12.5px;
  background: #fcf6e8;
  border: 1px solid #ebd9ae;
  border-radius: 10px;
  padding: 10px 14px;
}

/* ── scene cards (collapsible) ────────────────────────────────────────────── */

details.scene {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-l);
  box-shadow: var(--shadow);
  margin-top: 12px;
  transition: border-color 0.15s ease;
}

details.scene:hover {
  border-color: var(--faint);
}

details.scene > summary {
  list-style: none;
}

details.scene > summary::-webkit-details-marker {
  display: none;
}

details.scene[open] .snip {
  display: none;
}

details.scene[open] .mthumb {
  display: none;
}

details.scene[open] .chev {
  transform: rotate(90deg);
}

.shead {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 16px;
  cursor: pointer;
  user-select: none;
}

.chev {
  display: inline-block;
  transition: transform 0.15s;
  font-size: 9px;
  color: var(--faint);
}

/* Step-number badge — scoped to <span> so it never hijacks the dev-analytics
   `<td class="num">` / `<th class="num">` numeric cells (which would collapse to
   a 21px inline-flex box and overlap). */
span.num {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  height: 22px;
  padding: 0 9px;
  border-radius: var(--radius-pill);
  background: var(--accent-soft);
  color: var(--accent-ink);
  font: 700 11px var(--font-display);
  letter-spacing: 0.02em;
  white-space: nowrap;
  flex: none;
}

/* Timeline window chip beside the scene number ("0:21–0:43", from the live
   preview's plan — the same clock the WYSIWYG player scrubs). */
.shead .stime {
  font: 11px var(--mono);
  font-variant-numeric: tabular-nums;
  color: var(--fg-dim);
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius-pill);
  padding: 2px 8px;
  flex: none;
}

.kind {
  background: var(--accent-soft);
  color: var(--accent-ink);
  border-radius: var(--radius-pill);
  padding: 2px 10px;
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.mthumb {
  width: 50px;
  height: 28px;
  object-fit: cover;
  border-radius: 5px;
  border: 1px solid var(--line);
}

/* S3 per-scene dirty + render-lifecycle badge (summary chip). */
.sbadge {
  border-radius: 999px;
  padding: 2px 10px;
  font-size: 10px;
  font-weight: 650;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  flex: none;
}

.sbadge[data-state="dirty"] {
  background: var(--pop-soft);
  color: var(--warn);
}

.sbadge[data-state="queued"] {
  background: var(--panel);
  color: var(--fg-dim);
  border: 1px solid var(--line);
}

.sbadge[data-state="committing"],
.sbadge[data-state="rendering"] {
  background: var(--accent-soft);
  color: var(--accent-ink);
}

/* M3d live-edit chip: an edit dispatched to the RUNNING pipeline, awaiting its
   re-recorded/redrawn asset (amber, gently pulsing). */
.sbadge.livechip[data-state="live"] {
  background: var(--pop-soft);
  color: var(--warn);
  margin-left: 8px;
  text-transform: none;
  animation: livechip-pulse 1.3s ease-in-out infinite;
}
@keyframes livechip-pulse {
  0%,
  100% {
    opacity: 1;
  }
  50% {
    opacity: 0.55;
  }
}

/* S3 [Regenerate scene] bar at the top of a dirty scene's body. */
.scenebar {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 8px 12px;
  margin: 8px 0 12px;
  border: 1px dashed var(--line);
  border-radius: 8px;
  background: var(--panel);
}

.scenebar .dirtynote {
  flex: 1;
  min-width: 0;
  font-size: 12px;
  color: var(--fg-dim);
}

.snip {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 12.5px;
  color: var(--fg-dim);
}

/* Raw internals (line-sync expression + scene id) stay in the DOM for
   tooling/e2e but out of the modern header — the timing chip carries the
   useful signal now. */
.shead .sync,
.shead .sid {
  display: none;
}

.sbody {
  padding: 2px 14px 14px;
}

/* ── media-state stepper: [Graphic › Image › Clip] background ladder ────────
   State chips show WHERE the scene's background is; the NEXT step renders as
   an action button (generate image / animate clip). Sits above the thumb. */
.mediastate {
  display: flex;
  align-items: center;
  gap: 5px;
  margin: 0 0 7px;
}

.mediastate .mstep {
  border: 1px solid var(--line);
  border-radius: var(--radius-pill);
  background: var(--panel);
  color: var(--faint);
  font: 600 10.5px var(--font-display);
  padding: 3px 10px;
  white-space: nowrap;
}

.mediastate .mstep.done {
  color: var(--fg-dim);
}

.mediastate .mstep.on {
  background: var(--accent-soft);
  border-color: transparent;
  color: var(--accent-ink);
}

/* #doc button (the doc editor's primary-button reset) outguns class-only
   selectors — mirror its specificity so the next-step action stays a quiet
   dashed affordance, not a loud primary button. */
#doc .mediastate button.mstep.next,
.mediastate button.mstep.next {
  cursor: pointer;
  background: var(--surface);
  border: 1px dashed var(--accent-ink);
  color: var(--accent-ink);
  font: 600 10.5px var(--font-display);
  padding: 3px 10px;
  border-radius: var(--radius-pill);
}

#doc .mediastate button.mstep.next:hover:not(:disabled),
.mediastate button.mstep.next:hover:not(:disabled) {
  background: var(--accent-soft);
}

#doc .mediastate button.mstep.next:disabled,
.mediastate button.mstep.next:disabled {
  opacity: 0.5;
  cursor: default;
}

.mediastate .marrow {
  color: var(--faint);
  font-size: 11px;
}

.srow {
  display: flex;
  gap: 16px;
  margin-bottom: 14px;
  flex-wrap: wrap;
}

.thumbcol {
  flex: 0 0 400px;
  max-width: 100%;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.thumb {
  width: 400px;
  max-width: 100%;
  height: 225px;
  object-fit: cover;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: #000;
  cursor: zoom-in;
  display: block;
}

.thumb.pattern {
  border: 1px dashed var(--line);
  background: var(--panel);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--faint);
  font: 11.5px var(--mono);
  cursor: default;
}

.imgpanel {
  flex: 1;
  min-width: 240px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

/* S1 layout: version chips + the image-prompt field share ONE row, inline
   beside the hero thumbnail (the imgpanel already sits next to .thumbcol). */
.imgrow {
  display: flex;
  gap: 12px;
  align-items: flex-start;
  flex-wrap: wrap;
}

.imgrow .chips {
  flex: 0 1 auto;
  max-width: 40%;
}

.imgrow .fld {
  flex: 1;
  min-width: 200px;
}

.imgpanel .motion textarea {
  min-height: 48px;
}

.inline {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.inline textarea {
  min-height: 84px;
  max-height: 150px;
  resize: vertical;
  background: var(--panel);
  color: var(--fg-dim);
  border-color: var(--line);
  font-size: 12px;
  line-height: 1.5;
}

.inline button {
  align-self: flex-start;
}

.chips {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

.chip {
  border: 1px solid var(--line);
  border-radius: 7px;
  padding: 2px;
  cursor: pointer;
  background: var(--surface);
}

.chip img {
  width: 54px;
  height: 30px;
  object-fit: cover;
  border-radius: 5px;
  display: block;
}

.chip.active {
  border-color: var(--accent);
  box-shadow: 0 0 0 1px var(--accent);
}

.chip .cv {
  display: block;
  text-align: center;
  font-size: 9.5px;
  color: var(--faint);
  padding: 1px 0;
}

.chip.active .cv {
  color: var(--accent-ink);
  font-weight: 600;
}

.chip .cv.warn {
  color: var(--warn);
}

.chip .clipbadge {
  color: var(--accent-ink);
  font-style: normal;
  margin-left: 3px;
}

.scol {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.fld label {
  display: block;
  font-size: 10px;
  font-weight: 650;
  color: var(--fg-dim);
  text-transform: uppercase;
  letter-spacing: 0.07em;
  margin-bottom: 4px;
}

.fld label em {
  font-style: normal;
  font-family: var(--mono);
  font-weight: 400;
  color: var(--faint);
  text-transform: none;
  letter-spacing: 0;
}

.fld.dirty label::after {
  content: " ●";
  color: var(--warn);
}

.fld.dirty textarea,
.fld.dirty input,
.fld.dirty select {
  background: #fffdf5;
  border-color: #e4ce96;
}

.fld textarea {
  min-height: 34px;
  resize: vertical;
  line-height: 1.4;
}

.narr {
  padding-left: 0;
}

.narr textarea {
  min-height: 44px;
  font-size: 14px;
  line-height: 1.5;
}

.selrow {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  align-items: flex-end;
}

.selrow .fld.f-sel {
  flex: 0 0 170px;
}

.selrow .fld.f-num {
  flex: 0 0 90px;
}

.selrow .fld.f-txt {
  flex: 1 1 200px;
  max-width: 340px;
}

.selrow .fld.f-ta {
  flex: 1 1 260px;
}

.selrow .fld.f-wide {
  flex: 1 1 100%;
}

.f-wide textarea {
  min-height: 56px;
  line-height: 1.5;
}

/* skeleton cards while generating */

.scene.skeleton {
  background: var(--surface);
  border: 1px dashed var(--line);
  border-radius: var(--radius-l);
  padding: 14px 16px;
  margin-top: 12px;
  animation: vypulse 2.2s ease-in-out infinite;
}

.scene.skeleton .skhead {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 10px;
}

.scene.skeleton .kind {
  background: var(--panel);
  color: var(--fg-dim);
}

.scene.skeleton .sid {
  margin-left: auto;
  color: var(--faint);
  font: 11px var(--mono);
}

.scene.skeleton .narr {
  margin-bottom: 8px;
}

.scene.skeleton .sktext {
  font-size: 13px;
  color: var(--fg-dim);
  line-height: 1.5;
}

.scene.skeleton .skvisual {
  font-size: 12.5px;
  color: var(--faint);
  line-height: 1.5;
}

/* gallery tile actions + sync chip + error card (U0) */

.tile .syncchip {
  font: 600 10px/1.4 inherit;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 1px 7px;
  color: var(--faint);
  white-space: nowrap;
}

.tile .syncchip .cloudicon {
  font-weight: 700;
}

/* U2: LIVE chip states — the icon + colour track the SyncEngine record and
   the transition animates as the background queue drains. */
.tile .syncchip[data-state="synced"] {
  color: var(--ok);
  border-color: color-mix(in srgb, var(--ok) 40%, var(--line));
}

.tile .syncchip[data-state="dirty"],
.tile .syncchip[data-state="queued"] {
  color: var(--warn, #a6791f);
  border-color: color-mix(in srgb, var(--warn, #a6791f) 35%, var(--line));
}

.tile .syncchip[data-state="syncing"] {
  color: var(--accent);
  border-color: color-mix(in srgb, var(--accent) 45%, var(--line));
  animation: syncpulse 1.1s ease-in-out infinite;
}

.tile .syncchip[data-state="error"] {
  color: var(--err);
  border-color: color-mix(in srgb, var(--err) 45%, var(--line));
}

.tile .syncchip[data-state="paused"] {
  color: var(--faint);
  border-style: dashed;
}

@keyframes syncpulse {
  0%,
  100% {
    opacity: 1;
  }
  50% {
    opacity: 0.5;
  }
}

.tile .tileactions {
  margin-left: auto;
  display: flex;
  gap: 4px;
}

.tile .tileactions button {
  background: var(--surface);
  color: var(--fg-dim);
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 2px 7px;
  font: 600 11px/1 inherit;
  cursor: pointer;
}

.tile .tileactions button:hover:not(:disabled) {
  border-color: var(--accent);
  color: var(--accent);
}

.tile .tileactions button.del:hover:not(:disabled) {
  border-color: var(--err);
  color: var(--err);
}

.tile .tileactions button:disabled {
  opacity: 0.35;
  cursor: default;
}

/* failed / interrupted tiles: unmistakable — NOT a healthy-looking placeholder */
.tile.broken {
  border-color: color-mix(in srgb, var(--err) 55%, var(--line));
}

.tile .errbadge {
  background: var(--err);
  color: #fff;
  font: 650 10.5px/1.3 inherit;
  padding: 4px 10px;
  text-align: center;
}

.tile .shot.empty.err {
  color: var(--err);
  background: color-mix(in srgb, var(--err) 8%, var(--panel));
  font-weight: 650;
}

.tile .errcard {
  margin-top: 10px;
  padding: 10px;
  border-radius: 8px;
  border: 1px solid color-mix(in srgb, var(--err) 40%, var(--line));
  background: color-mix(in srgb, var(--err) 6%, var(--surface));
  cursor: default;
}

.tile .errcard .errmsg {
  margin: 0 0 8px;
  font-size: 11.5px;
  line-height: 1.5;
  color: var(--fg);
}

/* Recovery hint (errorHint): what the user can DO about it — calmer than errmsg. */
.tile .errcard .errhint {
  margin: 0 0 8px;
  font-size: 11.5px;
  line-height: 1.5;
  color: var(--fg-dim);
}

.tile .errcard .erractions {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

.tile .errcard .erractions button {
  border: 1px solid var(--accent);
  background: var(--accent);
  color: #fff;
  border-radius: 6px;
  padding: 4px 10px;
  font: 600 11px/1.3 inherit;
  cursor: pointer;
}

.tile .errcard .erractions button.rerender {
  background: var(--surface);
  color: var(--accent);
}

.tile .errcard .erractions button:disabled {
  opacity: 0.45;
  cursor: default;
}

/* ── Library asset browser: toolbar + media tiles + tags + preview ─────────── */

.libloading,
.libwarn {
  font-size: 11px;
  color: var(--faint);
  text-transform: none;
  letter-spacing: 0;
  font-weight: 500;
  margin-left: 8px;
}
.libwarn {
  display: block;
  margin: -6px 0 12px;
  color: var(--warn, #b5761f);
}

.libtoolbar {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-bottom: 16px;
  padding: 12px 14px;
  background: var(--tint-library);
  border: 1px solid var(--line);
  border-radius: var(--radius-m);
}

.libchips,
.libtags {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  align-items: center;
}

.typechip {
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--fg-dim);
  border-radius: 999px;
  padding: 5px 12px;
  font-size: 12px;
  font-weight: 550;
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s, color 0.15s;
}
.typechip:hover {
  border-color: var(--accent);
}
.typechip[data-active="true"] {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}
.typechip .cnt {
  opacity: 0.6;
  font-variant-numeric: tabular-nums;
  margin-left: 3px;
}
.typechip[data-active="true"] .cnt {
  opacity: 0.85;
}

.libcontrols {
  display: flex;
  gap: 10px;
  align-items: center;
  flex-wrap: wrap;
}
.libsearch {
  flex: 1 1 220px;
  min-width: 180px;
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--fg);
  border-radius: 9px;
  padding: 7px 11px;
  font-size: 13px;
}
.libsearch:focus {
  outline: none;
  border-color: var(--accent);
}
.libsort {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 11px;
  color: var(--faint);
}
.libsort select {
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--fg);
  border-radius: 8px;
  padding: 6px 8px;
  font-size: 12.5px;
}
.librefresh {
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--fg-dim);
  border-radius: 8px;
  padding: 6px 12px;
  font-size: 12px;
  cursor: pointer;
}
.librefresh:hover:not(:disabled) {
  border-color: var(--accent);
}
.librefresh:disabled {
  opacity: 0.55;
  cursor: default;
}

/* tag chips — filter bar (toolbar) and per-tile editor share the pill look */
.tagchip {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  border: 1px solid var(--line);
  background: var(--panel);
  color: var(--fg-dim);
  border-radius: 999px;
  padding: 3px 9px;
  font-size: 11px;
  cursor: pointer;
  max-width: 100%;
}
.tagchip.filter.auto {
  font-family: var(--mono, ui-monospace, monospace);
  font-size: 10.5px;
}
.tagchip.filter.user {
  font-weight: 600;
}
.tagchip.filter:hover {
  border-color: var(--accent);
}
.tagchip.filter[data-active="true"] {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}
.tagclear {
  border: none;
  background: none;
  color: var(--faint);
  font-size: 11px;
  cursor: pointer;
  text-decoration: underline;
}

/* per-tile custom-tag row */
.tile .tagrow {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 5px;
  margin-top: 9px;
}
.tile .tagrow .tagchip.user {
  cursor: default;
  font-weight: 600;
}
.tagchip .tagx {
  border: none;
  background: none;
  color: inherit;
  opacity: 0.6;
  cursor: pointer;
  font-size: 12px;
  line-height: 1;
  padding: 0;
}
.tagchip .tagx:hover {
  opacity: 1;
}
.tagadd {
  border: 1px dashed var(--line);
  background: none;
  color: var(--faint);
  border-radius: 999px;
  width: 20px;
  height: 20px;
  font-size: 12px;
  line-height: 1;
  cursor: pointer;
  padding: 0;
}
.tagadd:hover {
  border-color: var(--accent);
  color: var(--accent);
}
.tagadd-input {
  border: 1px solid var(--accent);
  background: var(--surface);
  color: var(--fg);
  border-radius: 999px;
  padding: 2px 9px;
  font-size: 11px;
  width: 90px;
}
.tagadd-input:focus {
  outline: none;
}

/* media tiles — type badge + play affordance over the existing .tile look */
.tile .kindbadge {
  position: absolute;
  top: 7px;
  left: 7px;
  z-index: 2;
  font-size: 12px;
  background: rgba(0, 0, 0, 0.55);
  border-radius: 6px;
  padding: 1px 5px;
  line-height: 1.5;
}
.tile .playbadge {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  z-index: 2;
  color: #fff;
  font-size: 26px;
  text-shadow: 0 2px 8px rgba(0, 0, 0, 0.6);
  pointer-events: none;
}
.tile {
  position: relative;
}
.tile.media .shot.empty.voice {
  font-size: 26px;
}
.tile .asrc {
  font-variant-numeric: tabular-nums;
}

.libcount {
  margin-top: 14px;
  font-size: 11px;
  color: var(--faint);
  display: flex;
  align-items: center;
  gap: 12px;
}
.libmore {
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--fg-dim);
  border-radius: 8px;
  padding: 5px 14px;
  font-size: 12px;
  cursor: pointer;
}
.libmore:hover {
  border-color: var(--accent);
}

/* preview overlay (media lightbox) */
.preview-overlay {
  position: fixed;
  inset: 0;
  z-index: 50;
  background: rgba(20, 18, 14, 0.72);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 32px;
}
.preview-card {
  position: relative;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 14px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.4);
  max-width: min(880px, 92vw);
  max-height: 88vh;
  overflow: auto;
  display: flex;
  flex-direction: column;
}

/* LLM-reasoning popup (dev analytics 💬): recorded call input + output. */
.preview-card.pv-text {
  width: min(760px, 92vw);
}
.pv-io {
  padding: 16px 16px 8px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-height: 0;
}
.pv-io-label {
  font-size: 10.5px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: var(--faint);
}
.pv-io-fields {
  display: flex;
  flex-direction: column;
  gap: 3px;
  min-height: 0;
}
.pv-io-key {
  font: 700 10.5px var(--mono);
  color: var(--accent-ink);
}
.pv-io-pre {
  margin: 0 0 8px;
  padding: 10px 12px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius-s);
  font: 11.5px/1.6 var(--mono);
  color: var(--fg);
  white-space: pre-wrap;
  word-break: break-word;
  max-height: 30vh;
  overflow: auto;
}
.pv-close {
  position: absolute;
  top: 8px;
  right: 10px;
  z-index: 2;
  border: none;
  background: rgba(0, 0, 0, 0.5);
  color: #fff;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  font-size: 18px;
  line-height: 1;
  cursor: pointer;
}
.pv-media {
  display: block;
  width: 100%;
  max-height: 62vh;
  object-fit: contain;
  background: #000;
  border-radius: 14px 14px 0 0;
}
audio.pv-media {
  background: var(--panel);
  padding: 24px;
  height: auto;
}
.pv-loading {
  padding: 60px;
  text-align: center;
  color: var(--faint);
}
.pv-meta {
  padding: 14px 16px 16px;
}
.pv-title {
  font-size: 13.5px;
  line-height: 1.5;
}
.pv-sub {
  font-size: 11px;
  color: var(--faint);
  margin-top: 4px;
}
.pv-actions {
  margin-top: 12px;
}
.pv-open {
  border: 1px solid var(--accent);
  background: var(--accent);
  color: var(--bg);
  border-radius: 8px;
  padding: 7px 14px;
  font-size: 12.5px;
  font-weight: 550;
  cursor: pointer;
}

/* ── toasts ──────────────────────────────────────────────────────────────── */

.toast {
  position: fixed;
  bottom: 20px;
  left: 50%;
  transform: translateX(-50%);
  background: var(--fg);
  color: var(--bg);
  border-radius: var(--radius-pill);
  padding: 11px 22px;
  font-size: 13px;
  font-weight: 500;
  z-index: 20;
  box-shadow: 0 8px 24px rgba(35, 29, 20, 0.3);
}

/* ── settings tab panel (page section behind the Settings tab) ──────────── */

.settings-panel {
  max-width: 640px;
}

.settings-panel > h2 {
  margin: 8px 0 12px;
  font-family: var(--font-display);
  font-size: 15.5px;
  font-weight: 700;
}

/* ── engine bar + key gate + import bridge (M6) ─────────────────────────── */

.enginebar {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 0 0 10px;
  flex-wrap: wrap;
}

/* U0: the engine switcher is the Settings tab's "Rendering" section — a full
   width heading over the (wrapping) Browser/Server control row. */
#rendering h2 {
  flex-basis: 100%;
  font-size: 15px;
  margin: 0 0 4px;
}

.importjob {
  font-size: 12px;
  color: var(--faint);
  cursor: pointer;
}

.importjob input[type="file"] {
  font-size: 11px;
  max-width: 220px;
}

.keygate {
  border: 1px solid var(--line);
  border-radius: var(--radius-m);
  background: var(--tint-settings);
  padding: 10px 14px;
  margin: 0 0 12px;
  font-size: 12.5px;
}

.keygate p {
  margin: 0 0 8px;
  color: var(--faint);
  line-height: 1.5;
}

.keygate .row {
  display: flex;
  gap: 8px;
}

.keygate input[type="password"] {
  flex: 1;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 6px 10px;
  font: inherit;
}

.keygate .keyproblem {
  color: var(--err);
  margin: 6px 0 0;
}

.keychip {
  font: 600 12px/1.4 ui-monospace, monospace;
}

.keygate[data-state="stored"] {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 6px 14px;
}

.linkish {
  background: none;
  border: none;
  color: var(--accent);
  cursor: pointer;
  font: inherit;
  font-size: 12px;
  text-decoration: underline;
  padding: 0;
}

/* ── models section (task #4, L2) — the Settings tab's "Models" section ──── */

#models {
  margin-top: 18px;
  border-top: 1px solid var(--line);
  padding-top: 14px;
}

#models h2 {
  font-size: 15px;
  margin: 0 0 8px;
}

.models-section .hint {
  margin: 0 0 12px;
  font-size: 12px;
  color: var(--faint);
  line-height: 1.5;
}

.modelrow {
  display: grid;
  grid-template-columns: 140px minmax(0, 1fr);
  align-items: center;
  gap: 6px 12px;
  margin: 0 0 12px;
}

.modelrow .modellabel {
  font-size: 12.5px;
  font-weight: 600;
}

.modelrow .modelselect {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 6px 10px;
  font: inherit;
  font-size: 12.5px;
  background: var(--surface);
  color: var(--fg);
}

.modelrow .modelnote {
  grid-column: 2;
  font-size: 11.5px;
  color: var(--faint);
  line-height: 1.4;
}

/* ── storage panel (M8) — the Settings tab's "Storage" section ──────────── */

#storage {
  margin-top: 18px;
  border-top: 1px solid var(--line);
  padding-top: 14px;
}

#storage h2 {
  font-size: 15px;
  margin: 0 0 8px;
}

/* U0: Storage splits into a Local (browser/disk) card and a Remote (fal.ai)
   card. The M8 sync toggle, restore row and per-project rows live under
   Remote; OPFS usage + the (U3) linked-folder placeholder live under Local. */
.storagecard {
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 12px 14px;
  margin: 0 0 12px;
  background: var(--surface);
}

.storagecard h3 {
  font-size: 12px;
  font-weight: 650;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--faint);
  margin: 0 0 10px;
}

/* U3: per-project FSA linked-folder mirror rows (Local card, Chromium only). */
.linkedfolders {
  font-size: 12px;
  color: var(--fg-dim);
}

.linkedfolders .lf-head {
  display: flex;
  align-items: baseline;
  gap: 10px;
  margin: 4px 0 6px;
}

.linkedfolders .lf-label {
  font-weight: 650;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  font-size: 11px;
  color: var(--faint);
}

.linkedfolders .lf-hint {
  color: var(--faint);
}

.linkedfolders .lf-empty {
  color: var(--faint);
  margin: 2px 0;
}

.lf-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 5px 0;
  border-top: 1px solid var(--line);
}

.lf-row .lf-jid {
  flex: 1;
  min-width: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.lf-row .lf-state {
  white-space: nowrap;
  color: var(--fg-dim);
}

.lf-row .lf-state[data-state="unlinked"] {
  color: var(--faint);
  font-style: italic;
}

.lf-row .lf-state[data-state="linked"] {
  color: var(--ok);
}

.lf-row .lf-state[data-state="lapsed"] {
  color: var(--err);
  font-weight: 650;
}

.lf-row .lf-media {
  display: flex;
  align-items: center;
  gap: 4px;
  color: var(--faint);
  white-space: nowrap;
}

.lf-row button {
  font-size: 11px;
  padding: 3px 8px;
}

.lf-row button.lf-grant {
  border-color: var(--err);
  color: var(--err);
}

.storagemeter {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 12px;
  color: var(--faint);
  margin: 4px 0 10px;
}

.storagemeter .bar {
  max-width: 220px;
}

.storagemeter .persist[data-persisted="false"] {
  color: var(--err);
}

.syncrow {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  font-size: 12px;
  margin: 0 0 8px;
}

.syncrow .syncnote {
  color: var(--faint);
}

.restorerow {
  display: flex;
  align-items: center;
  gap: 14px;
  flex-wrap: wrap;
  font-size: 12px;
  margin: 0 0 10px;
}

.restorerow .pull {
  display: flex;
  gap: 6px;
  align-items: center;
}

.restorerow .pull input[type="text"] {
  width: 260px;
  font-size: 12px;
  padding: 4px 8px;
}

.jobrow {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 6px 0;
  border-top: 1px solid var(--line);
  font-size: 12px;
}

.jobrow .jid {
  flex: 1;
  min-width: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.jobrow .syncstate {
  color: var(--faint);
  white-space: nowrap;
}

.jobrow .syncstate[data-state="synced"] {
  color: var(--ok);
}

.jobrow .syncstate[data-state="error"] {
  color: var(--err);
}

.jobrow .actions {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

.jobrow .actions button {
  font-size: 11px;
  padding: 3px 8px;
}

.storageempty {
  color: var(--faint);
  font-size: 12px;
}

/* ── M9 hardening: quota banner, cancel, feature gate, help panel ─────────── */

.quotabanner {
  margin: 0 0 8px;
  padding: 8px 12px;
  border: 1px solid #e8d9b0;
  border-radius: 8px;
  background: #fdf6e3;
  color: var(--warn);
  font-size: 12.5px;
}

#cancelJob {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  color: var(--err);
  font: 600 12px/1.4 inherit;
  padding: 4px 12px;
  cursor: pointer;
  margin-left: 10px;
}

#cancelJob:hover {
  border-color: var(--err);
}

.gatefail {
  max-width: 640px;
  margin: 12vh auto 0;
  padding: 24px 28px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--surface);
  box-shadow: var(--shadow);
}

.gatefail h1 {
  font-size: 18px;
  margin: 0 0 10px;
}

.gatefail ul {
  color: var(--err);
  font-size: 13.5px;
}

.gatefail-note {
  color: var(--faint);
  font-size: 12.5px;
}

.gatefail-cta {
  display: inline-block;
  margin: 4px 0 6px;
  padding: 8px 14px;
  border-radius: 8px;
  background: var(--accent, #2563eb);
  color: #fff;
  font-size: 13.5px;
  font-weight: 600;
  text-decoration: none;
}

.helpcard {
  margin: 0 0 12px;
}

.helpcard details {
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--surface);
  padding: 8px 14px;
}

.helpcard summary {
  cursor: pointer;
  font-size: 12.5px;
  color: var(--fg-dim);
}

.helpcard summary .linkish {
  margin-left: 8px;
}

.helpbody {
  font: 12px/1.55 var(--mono);
  white-space: pre-wrap;
  color: var(--fg);
  max-height: 340px;
  overflow: auto;
  margin: 10px 0 4px;
}

.helpbody.err {
  color: var(--err);
}

/* ── D4 document/image drop zone + chips + brand confirm card ─────────────── */
.dropzone-wrap {
  margin: 8px 0 4px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

/* "Add things to your video" row: the attach dropzone + the Record button sit
   together under the prompt — both are inputs INTO the video, so the Record
   button borrows the dropzone's dashed add-affordance chrome here. */
.composer .addrow {
  display: flex;
  align-items: stretch;
  gap: 8px;
  flex-wrap: wrap;
  margin: 8px 0 4px;
}
.composer .addrow .dropzone-wrap {
  flex: 1;
  min-width: 260px;
  margin: 0;
}
.composer .addrow .rec-open-btn {
  border: 1px dashed var(--line);
  background: var(--panel);
  color: var(--muted, #5b6472);
  border-radius: var(--radius-s);
  padding: 10px 14px;
  transition:
    border-color 0.15s,
    background 0.15s,
    color 0.15s;
}
.composer .addrow .rec-open-btn:hover:not(:disabled) {
  border-color: var(--accent);
  background: var(--panel-hi, #eef3ff);
  color: var(--accent-ink);
}
.composer .addrow .recchip {
  align-self: center;
}
.dropzone {
  border: 1px dashed var(--line, #cbd2dc);
  border-radius: 8px;
  padding: 10px 12px;
  text-align: center;
  cursor: pointer;
  color: var(--muted, #5b6472);
  font-size: 13px;
  background: var(--panel, #f7f9fc);
  transition: border-color 0.15s, background 0.15s;
}
.dropzone.over,
.dropzone:hover {
  border-color: var(--accent, #3b6cff);
  background: var(--panel-hi, #eef3ff);
}
.dropzone-error {
  color: var(--err, #c0392b);
  font-size: 12px;
  margin: 0;
}
.docchips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.docchip {
  border: 1px solid var(--line, #cbd2dc);
  border-radius: 8px;
  padding: 6px 8px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-width: 200px;
  max-width: 280px;
  background: var(--surface);
}
.docchip-head {
  display: flex;
  align-items: center;
  gap: 6px;
}
.docchip-thumb {
  width: 28px;
  height: 28px;
  object-fit: cover;
  border-radius: 4px;
  flex: 0 0 auto;
}
.docchip-badge {
  font-size: 10px;
  font-weight: 700;
  padding: 3px 5px;
  border-radius: 4px;
  background: var(--panel-hi, #eef3ff);
  color: var(--accent-ink);
  flex: 0 0 auto;
}
.docchip-name {
  font-size: 13px;
  font-weight: 600;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  flex: 1 1 auto;
}
.docchip-meta {
  font-size: 11px;
  color: var(--muted, #5b6472);
  flex: 0 0 auto;
}
.docchip-x {
  border: none;
  background: none;
  cursor: pointer;
  font-size: 16px;
  line-height: 1;
  color: var(--muted, #5b6472);
  padding: 0 2px;
}
.docchip-x:hover {
  color: var(--err, #c0392b);
}
.docchip-instr {
  font-size: 12px;
  padding: 4px 6px;
  border: 1px solid var(--line, #cbd2dc);
  border-radius: 5px;
  width: 100%;
  box-sizing: border-box;
}
.docchip-more {
  border: 1px dashed var(--line, #cbd2dc);
  border-radius: 8px;
  background: none;
  cursor: pointer;
  font-size: 12px;
  color: var(--muted, #5b6472);
  padding: 0 10px;
}
.brandsuggest-row {
  display: flex;
  align-items: center;
  gap: 8px;
}
.brandcard {
  border: 1px solid var(--line, #cbd2dc);
  border-radius: 8px;
  padding: 10px 12px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  background: var(--card, #fff);
  max-width: 380px;
}
.brandcard-title {
  font-weight: 600;
  font-size: 13px;
}
.brandcard-swatches {
  display: flex;
  gap: 4px;
}
.brand-swatch {
  width: 22px;
  height: 22px;
  border-radius: 4px;
  border: 1px solid rgba(0, 0, 0, 0.1);
}
.brand-logo {
  max-width: 160px;
  max-height: 60px;
  object-fit: contain;
  border: 1px solid var(--line, #cbd2dc);
  border-radius: 4px;
  background: #fff;
}
.brand-nologo {
  font-size: 12px;
  color: var(--muted, #5b6472);
}
.brandcard-attrs {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 16px;
  margin: 0;
  font-size: 12px;
}
.brandcard-attrs > div {
  display: flex;
  gap: 6px;
}
.brandcard-attrs dt {
  color: var(--muted, #5b6472);
  margin: 0;
}
.brandcard-attrs dd {
  margin: 0;
  font-weight: 600;
}
.brandcard-actions {
  display: flex;
  gap: 6px;
}

/* ── brand kit picker (popover) + New-brand dialog (D6) ──────────────────────
 * Ported from static/index.html with the legacy tokens remapped to studio-web's
 * light theme (--card→--surface, --text→--fg, --dim→--fg-dim, --dim2→--faint). */
.brandwrap {
  position: relative;
}
#brandBtn {
  display: flex;
  align-items: center;
  gap: 8px;
}
#brandBtn .ramp {
  display: flex;
  gap: 2px;
}
.ramp i {
  width: 10px;
  height: 14px;
  border-radius: 2px;
  display: block;
  border: 1px solid rgba(0, 0, 0, 0.08);
}
#brandPop {
  position: absolute;
  z-index: 30;
  top: calc(100% + 6px);
  left: 0;
  width: 340px;
  max-height: 420px;
  overflow-y: auto;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 12px;
  box-shadow: 0 8px 28px rgba(30, 28, 22, 0.14);
  padding: 8px;
  /* Same wrapper as #castPop: inside the field's <label class="select">, so
     reset the inherited uppercase micro-label typography. */
  font-size: 13px;
  font-weight: 400;
  letter-spacing: normal;
  text-transform: none;
  color: var(--fg);
}
.bcard {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  text-align: left;
  background: transparent;
  border: 1px solid transparent;
  border-radius: 9px;
  padding: 8px 10px;
  cursor: pointer;
  color: var(--fg);
  font: inherit;
  font-size: 13px;
}
.bcard:hover {
  background: var(--panel);
}
.bcard.active {
  border-color: var(--accent);
  background: var(--accent-soft);
}
.bcard .ramp i {
  width: 14px;
  height: 20px;
}
.bcard .meta {
  flex: 1;
  min-width: 0;
}
.bcard .meta b {
  display: block;
  font-size: 13px;
}
.bcard .meta span {
  display: block;
  font-size: 11px;
  color: var(--faint);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.bcard .bcap {
  display: flex;
  gap: 2px;
}
.bcard .bcap i {
  width: 18px;
  height: 18px;
  border-radius: 3px;
  border: 1px solid rgba(0, 0, 0, 0.12);
  font-size: 9px;
  font-style: normal;
  line-height: 18px;
  text-align: center;
  color: #fff;
  text-shadow: 0 0 2px rgba(0, 0, 0, 0.6);
}
.bcard img.blogo {
  width: 28px;
  height: 28px;
  object-fit: contain;
}
.bcard .del {
  color: var(--err);
  font-size: 11px;
  background: none;
  border: none;
  cursor: pointer;
  padding: 2px 6px;
}
.bcard .edit {
  color: var(--accent);
  font-size: 11px;
  background: none;
  border: none;
  cursor: pointer;
  padding: 2px 6px;
}
#brandDialog {
  border: 1px solid var(--line);
  border-radius: var(--radius-l);
  padding: 20px 22px;
  width: 420px;
  max-width: 92vw;
  background: var(--surface);
  color: var(--fg);
  font: inherit;
  box-shadow: 0 2px 4px rgba(63, 44, 22, 0.06), 0 12px 32px rgba(63, 44, 22, 0.12);
}
/* literal rgba: custom props don't reach ::backdrop until Chrome 122 */
#brandDialog::backdrop {
  background: rgba(35, 29, 20, 0.4);
}
#brandDialog h3 {
  margin: 0 0 12px;
  font-family: "Bricolage Grotesque", "Avenir Next", -apple-system, sans-serif;
  font-size: 16px;
  font-weight: 700;
}
#brandDialog .fld {
  margin-top: 10px;
}
#brandDialog .fld label {
  display: block;
  font-size: 11px;
  color: var(--fg-dim);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 3px;
}
#brandDialog .fld input[type="text"],
#brandDialog .fld select {
  width: 100%;
  background: var(--surface);
  color: var(--fg);
  border: 1px solid var(--line);
  border-radius: 7px;
  padding: 6px 8px;
  font: inherit;
  font-size: 13px;
}
#brandDialog .hueRow {
  display: flex;
  gap: 10px;
  align-items: center;
}
#brandDialog .hueRow .bcaplabel {
  display: flex;
  align-items: center;
  gap: 4px;
  font-size: 11px;
  color: var(--fg-dim);
  text-transform: none;
  letter-spacing: 0;
}
#hueSlider {
  flex: 1;
  appearance: none;
  height: 10px;
  border-radius: 5px;
  background: linear-gradient(
    to right,
    hsl(0, 80%, 55%),
    hsl(60, 80%, 55%),
    hsl(120, 80%, 55%),
    hsl(180, 80%, 55%),
    hsl(240, 80%, 55%),
    hsl(300, 80%, 55%),
    hsl(360, 80%, 55%)
  );
}
#hueSlider::-webkit-slider-thumb {
  appearance: none;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: #fff;
  border: 2px solid var(--fg);
}
#brandPreview {
  display: flex;
  gap: 3px;
  margin-top: 12px;
}
#brandPreview i {
  flex: 1;
  height: 26px;
  border-radius: 4px;
  border: 1px solid rgba(0, 0, 0, 0.08);
}
#brandDialog .actions {
  display: flex;
  gap: 10px;
  justify-content: flex-end;
  margin-top: 16px;
}

/* ── Cast tab (reusable dialogue characters) ─────────────────────────────── */
.castpanel {
  max-width: 900px;
}
.castpanel h2 {
  margin: 0 0 4px;
  font-family: var(--font-display);
  font-weight: 700;
}
.cast-form {
  display: grid;
  gap: 10px;
  max-width: 520px;
  margin: 16px 0 26px;
}
.cast-form label {
  display: grid;
  gap: 4px;
  font-size: 13px;
  color: var(--fg-dim);
}
.cast-form input,
.cast-form textarea,
.cast-form select {
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  color: var(--fg);
  font: inherit;
}
.cast-form textarea {
  resize: vertical;
}
/* Placeholders must read as faint HINTS, not filled-in values — the fields are
   empty until you type, so a dark/heavy placeholder makes the form look
   pre-populated (and Create then "does nothing" on an empty required field). */
.cast-form input::placeholder,
.cast-form textarea::placeholder,
.cast-editor .fld input::placeholder,
.cast-editor .fld textarea::placeholder {
  color: var(--faint);
  font-weight: 400;
  font-style: normal;
  opacity: 1; /* Firefox dims placeholders by default; pin it to --faint */
}
.cast-form > button {
  justify-self: start;
  padding: 8px 16px;
  border: 1px solid var(--accent);
  background: var(--accent);
  color: #fff;
  border-radius: 8px;
  cursor: pointer;
}
.cast-form > button[disabled] {
  opacity: 0.6;
  cursor: default;
}
.cast-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 14px;
}
.cast-card {
  border: 1px solid var(--line);
  border-radius: var(--radius-m);
  overflow: hidden;
  background: var(--surface);
  box-shadow: var(--shadow-s);
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}
.cast-card:hover {
  border-color: var(--faint);
  box-shadow: var(--shadow);
}
.cast-thumb {
  aspect-ratio: 1 / 1;
  display: grid;
  place-items: center;
  background: var(--tint-cast);
}
.cast-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.cast-noimg {
  color: var(--fg-dim);
  font-size: 12px;
}
.cast-meta {
  padding: 8px 10px;
  display: grid;
  gap: 2px;
}
.cast-meta .sub {
  font-size: 12px;
}
.cast-actions {
  display: flex;
  gap: 6px;
  margin-top: 6px;
}
.cast-actions button {
  flex: 0 0 auto;
  padding: 4px 8px;
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--fg);
  border-radius: 6px;
  cursor: pointer;
  font-size: 12px;
}
.cast-actions button.danger {
  color: var(--err);
}
.cast-actions button[disabled] {
  opacity: 0.6;
  cursor: default;
}

/* Hover-info affordance beside section/panel headings (see ui/infoDot.js).
   A real <button> (keyboard-focusable, screen-reader-named) styled down to a
   bare glyph; the visible bubble is the native `title` on mouse-hover. */
.info {
  cursor: help;
  margin-left: 0.35em;
  color: var(--faint);
  font-size: 0.85em;
  font-style: normal;
  font-weight: 400;
  line-height: 1;
  background: none;
  border: 0;
  padding: 0;
  user-select: none;
  vertical-align: middle;
}
.info:hover {
  color: var(--accent);
}
.info:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
  border-radius: 3px;
  color: var(--accent);
}

/* ── cast picker (composer) — mirrors the brand picker popover ─────────────── */
.composer .fields label.castwrap {
  position: relative;
}
.composer .fields label.castwrap > button {
  width: 100%;
  justify-content: space-between;
  text-transform: none;
  letter-spacing: normal;
}
#castPop {
  position: absolute;
  z-index: 30;
  top: calc(100% + 6px);
  left: 0;
  width: 320px;
  max-height: 420px;
  overflow-y: auto;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 12px;
  box-shadow: 0 8px 28px rgba(30, 28, 22, 0.14);
  padding: 8px;
  /* The popover renders INSIDE the field's <label class="select"> and would
     otherwise inherit its uppercase micro-label typography. */
  font-size: 13px;
  font-weight: 400;
  letter-spacing: normal;
  text-transform: none;
  color: var(--fg);
}
.ccard {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  border: 1px solid transparent;
  border-radius: 9px;
  padding: 6px 8px;
  cursor: pointer;
  color: var(--fg);
  font-size: 13px;
}
.ccard:hover {
  background: var(--panel);
}
.ccard.active {
  border-color: var(--accent);
  background: var(--accent-soft);
}
.ccard.empty {
  /* Prose, not a picker row: .ccard's flex would split the text around the
     inline <b> into side-by-side items (the "two column" empty-state bug). */
  display: block;
  cursor: default;
  color: var(--fg-dim);
  font-size: 12.5px;
  line-height: 1.5;
  padding: 8px 10px;
}
.ccard .cthumb {
  width: 34px;
  height: 34px;
  flex: 0 0 34px;
  border-radius: 7px;
  overflow: hidden;
  background: var(--panel);
  display: grid;
  place-items: center;
}
.ccard .cthumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.ccard .cnoimg {
  font-weight: 700;
  color: var(--fg-dim);
}
.ccard .meta {
  flex: 1;
  min-width: 0;
}
.ccard .meta b {
  display: block;
  font-size: 13px;
}
.ccard .meta span {
  display: block;
  font-size: 11px;
  color: var(--fg-dim);
}
.ccard .ccheck {
  color: var(--accent);
  font-weight: 700;
  width: 14px;
  text-align: center;
}

/* ── knowledge-base panel (character + brand editors) ─────────────────────── */
.kb {
  margin-top: 12px;
  border-top: 1px solid var(--line);
  padding-top: 12px;
}
.kb-head {
  display: flex;
  flex-direction: column;
  gap: 2px;
  margin-bottom: 8px;
}
.kb-title {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--fg-dim);
}
.kb-sub {
  font-size: 12px;
  color: var(--fg-dim);
}
.kb-count {
  font-size: 11px;
  color: var(--fg-dim);
}
.kb-count.full {
  color: var(--warn, #b8860b);
  font-weight: 600;
}
.kb-drop.disabled {
  opacity: 0.5;
  cursor: not-allowed;
}
a.kb-name {
  color: var(--accent);
  text-decoration: none;
}
a.kb-name:hover {
  text-decoration: underline;
}
.kb-drop {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  position: relative;
  border: 1px dashed var(--line);
  border-radius: 9px;
  padding: 14px;
  font-size: 12px;
  color: var(--fg-dim);
  cursor: pointer;
  text-align: center;
}
.kb-drop.over {
  border-color: var(--accent);
  background: var(--accent-soft);
}
.kb-drop.busy {
  opacity: 0.6;
}
.kb-drop input[type="file"] {
  position: absolute;
  inset: 0;
  opacity: 0;
  cursor: pointer;
}
.kb-list {
  list-style: none;
  margin: 8px 0 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.kb-doc {
  display: flex;
  align-items: center;
  gap: 8px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 6px 8px;
  font-size: 12px;
}
.kb-fmt {
  font-size: 10px;
  font-weight: 700;
  color: var(--fg-dim);
  background: var(--panel);
  border-radius: 4px;
  padding: 2px 5px;
}
.kb-name {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.kb-size {
  color: var(--fg-dim);
}
.kb-x {
  background: transparent;
  border: none;
  color: var(--fg-dim);
  cursor: pointer;
  font-size: 13px;
}
.kb-x:hover {
  color: var(--err);
}
.kb-empty {
  font-size: 12px;
  color: var(--fg-dim);
  margin: 8px 0 0;
}

/* ── character detail editor ───────────────────────────────────────────────── */
/* ── Virtual Expert: "+ Create" CTA + unified create/edit editor ─────────────── */
.expert-new {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  max-width: 620px;
  text-align: left;
  padding: 13px 16px;
  margin: 0 0 20px;
  border: 1px dashed var(--line);
  border-radius: 12px;
  background: var(--surface);
  color: var(--fg);
  font: inherit;
  cursor: pointer;
  transition:
    border-color 0.12s ease,
    background 0.12s ease;
}
.expert-new:hover,
.expert-new:focus-visible {
  border-color: var(--accent);
  background: var(--accent-soft);
  outline: none;
}
.expert-new-plus {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  flex: 0 0 34px;
  border-radius: 9px;
  background: var(--accent);
  color: #fff;
  font-size: 22px;
  line-height: 1;
}
.expert-new > span:last-child {
  display: grid;
  gap: 1px;
}
.expert-new b {
  font-size: 14px;
}
.expert-new > span:last-child > span {
  font-size: 12px;
  color: var(--fg-dim);
}

.expert-editor {
  max-width: 620px;
  border: 1px solid var(--line);
  border-radius: var(--radius-l);
  padding: 18px 20px 16px;
  margin: 0 0 22px;
  background: var(--surface);
  box-shadow: var(--shadow-l);
}
.expert-editor-head {
  display: flex;
  align-items: flex-start;
  flex-wrap: wrap;
  gap: 13px;
  margin-bottom: 15px;
}
.expert-portrait {
  width: 52px;
  height: 52px;
  flex: 0 0 52px;
  border-radius: 10px;
  overflow: hidden;
  background: var(--panel);
  display: grid;
  place-items: center;
  color: var(--fg-dim);
  font-size: 20px;
  font-weight: 600;
}
.expert-portrait img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

/* Portrait control (portraitStudio.js): webcam · upload · generate · edit. */
.portrait-studio {
  flex: 0 0 auto;
  display: flex;
  flex-direction: column;
  gap: 8px;
  width: 168px;
}
.portrait-studio .expert-portrait {
  width: 168px;
  height: 168px;
  flex: 0 0 168px;
}
.portrait-studio .expert-portrait video {
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.portrait-busy {
  opacity: 0.6;
}
.portrait-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.portrait-actions button,
.portrait-upload {
  flex: 0 0 auto;
  padding: 4px 8px;
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--fg);
  border-radius: 6px;
  cursor: pointer;
  font-size: 12px;
  line-height: 1.4;
}
.portrait-actions button:disabled {
  opacity: 0.5;
  cursor: default;
}
.portrait-upload {
  position: relative;
  overflow: hidden;
  display: inline-flex;
  align-items: center;
}
.portrait-upload input[type="file"] {
  position: absolute;
  inset: 0;
  opacity: 0;
  cursor: pointer;
}
.portrait-edit {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.portrait-edit textarea {
  width: 100%;
  resize: vertical;
  font: inherit;
  padding: 6px 8px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--surface);
  color: var(--fg);
}
.portrait-ref {
  position: relative;
  overflow: hidden;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 8px;
  border: 1px dashed var(--line);
  border-radius: 6px;
  font-size: 12px;
  color: var(--fg-dim);
  cursor: pointer;
}
.portrait-ref input[type="file"] {
  position: absolute;
  inset: 0;
  opacity: 0;
  cursor: pointer;
}
.portrait-err {
  font-size: 12px;
  margin: 0;
}

/* Voice-clone control (voiceClone.js): record mic → f5-tts cloned dialogue. */
.voiceclone {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-top: 6px;
}
.vc-panel {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
}
.vc-hint {
  margin: 0;
  font-size: 12px;
  color: var(--fg-dim);
}
.vc-sentence {
  margin: 0;
  font-size: 13px;
  font-style: italic;
  color: var(--fg);
  line-height: 1.4;
}
.vc-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}
.vc-timer {
  font-size: 13px;
  color: var(--err);
  font-variant-numeric: tabular-nums;
}
.vc-audio {
  width: 100%;
  height: 34px;
}
.vc-chip {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}
.vc-badge {
  padding: 2px 8px;
  border-radius: 10px;
  font-size: 12px;
  font-weight: 600;
  background: var(--accent-soft);
  color: var(--accent);
}
.vc-err {
  font-size: 12px;
  margin: 0;
}
.expert-editor-title {
  flex: 1;
  min-width: 0;
}
.expert-editor-title h3 {
  margin: 0 0 2px;
  font-size: 16px;
}
.expert-editor-title p {
  margin: 0;
  font-size: 12.5px;
  color: var(--fg-dim);
}
.expert-close {
  align-self: flex-start;
}
/* Voice-mode segmented control (cast editor): three mutually exclusive modes. */
.voice-mode-seg {
  display: inline-flex;
  border: 1px solid var(--line);
  border-radius: 8px;
  overflow: hidden;
  width: fit-content;
}
.voice-mode-seg .seg {
  border: none;
  background: var(--surface);
  color: var(--fg-dim);
  padding: 7px 14px;
  font: 600 12.5px/1.2 inherit;
  cursor: pointer;
  border-right: 1px solid var(--line);
}
.voice-mode-seg .seg:last-child {
  border-right: none;
}
.voice-mode-seg .seg.active {
  background: var(--accent);
  color: #fff;
}

.expert-fields {
  display: grid;
  gap: 13px;
}
.expert-field {
  display: grid;
  gap: 5px;
}
.expert-field > span {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--fg-dim);
}
.expert-field input,
.expert-field textarea,
.expert-field select {
  width: 100%;
  padding: 8px 11px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  color: var(--fg);
  font-family: inherit; /* UI font — NOT the monospace the old editor inherited */
  font-size: 14px;
  line-height: 1.45;
}
.expert-field textarea {
  resize: vertical;
}
.expert-field input:focus,
.expert-field textarea:focus,
.expert-field select:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}
.expert-field input::placeholder,
.expert-field textarea::placeholder {
  color: var(--faint);
  font-weight: 400;
  opacity: 1;
}
.expert-field small {
  font-size: 11.5px;
  color: var(--fg-dim);
}
.expert-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  justify-content: flex-end;
  margin-top: 16px;
}
.expert-progress {
  margin-right: auto;
  font-size: 12px;
  color: var(--fg-dim);
}
.expert-actions button {
  font: inherit;
  font-size: 13px;
  border-radius: 8px;
  cursor: pointer;
  padding: 8px 14px;
}
.expert-actions button.ghost {
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--fg-dim);
}
.expert-actions button:last-child {
  border: 1px solid var(--accent);
  background: var(--accent);
  color: #fff;
  font-weight: 600;
}
.expert-actions button:last-child[disabled] {
  opacity: 0.6;
  cursor: default;
}

/* staged-but-not-yet-uploaded KB rows (create flow) */
.kb-doc.pending {
  border-style: dashed;
}
.kb-pending {
  font-size: 11px;
  font-style: italic;
  color: var(--fg-dim);
}

/* ── Brand tab (page) — reuses .castpanel/.cast-grid/.cast-card + .expert-editor ─
   The brand card thumbnail is a logo (or first reference image), so `contain`
   with padding reads better than the cast portrait's `cover` crop; a kit-less
   thumbnail falls back to a colour ramp. */
.brandpanel .cast-thumb {
  background: var(--tint-brand);
}
.brandpanel .cast-thumb img {
  object-fit: contain;
  padding: 14px;
}
/* Logo preview in the editor header — scale to fit, never crop a wide/tall logo. */
.brandpanel-editor .expert-portrait img {
  object-fit: contain;
  padding: 6px;
}
/* "Guide generated visuals" opt-out toggle under the image panel. */
.brandpanel-editor .brand-toggle {
  margin-top: 10px;
  font-size: 12px;
  color: var(--fg-dim);
}
.brandcard-ramp {
  display: flex;
  gap: 0;
  width: 70%;
  height: 22px;
  border-radius: 6px;
  overflow: hidden;
}
.brandcard-ramp i {
  flex: 1;
}

/* Compound editor rows (brand color / watermark / captions) inside .expert-field */
.brandpanel-editor .brow {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
}
.brandpanel-editor .brow input[type="range"] {
  flex: 1;
  min-width: 120px;
}
.brandpanel-editor .brow .bcaplabel {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 12px;
  color: var(--fg-dim);
}

/* ── reference-image panel (imagePanel.js) — thumbnail-grid twin of .kb ──────── */
.imgset {
  margin-top: 12px;
  border-top: 1px solid var(--line);
  padding-top: 12px;
}
.imgset-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(96px, 1fr));
  gap: 8px;
  margin-top: 8px;
}
.imgset-tile {
  position: relative;
  margin: 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  overflow: hidden;
  background: var(--panel);
}
.imgset-tile.pending {
  border-style: dashed;
}
.imgset-tile > img {
  display: block;
  width: 100%;
  aspect-ratio: 1 / 1;
  object-fit: contain; /* preserve aspect — a wide/tall reference is scaled, not cropped */
  padding: 4px;
  background: var(--panel);
}
.imgset-noimg {
  display: grid;
  place-items: center;
  aspect-ratio: 1 / 1;
  font-size: 11px;
  font-weight: 700;
  color: var(--fg-dim);
}
.imgset-tile figcaption {
  display: grid;
  gap: 1px;
  padding: 4px 6px;
  font-size: 10px;
}
.imgset-name {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.imgset-size {
  color: var(--fg-dim);
}
.imgset-x {
  position: absolute;
  top: 3px;
  right: 3px;
  width: 20px;
  height: 20px;
  border: none;
  border-radius: 50%;
  background: color-mix(in srgb, var(--surface) 80%, transparent);
  color: var(--fg-dim);
  cursor: pointer;
  font-size: 12px;
  line-height: 1;
}
.imgset-x:hover {
  color: var(--err);
  background: var(--surface);
}

/* ── live scene media: unified image/clip thumbnail + overlay + playback ────
   The hero thumbnail wraps its media so the Generate/Regenerate-clip button can
   sit OVER it — telling you at a glance whether a scene has no image (dashed
   placeholder), a still (click to enlarge), or a playable clip. */
.thumbwrap {
  position: relative;
  width: 400px;
  max-width: 100%;
}

/* Live still that fades in only once it has actually loaded — a not-yet-ready
   or failed image leaves the "generating…"/"loading…" placeholder showing
   behind it instead of a broken-image glyph (skeleton, waiting for assets). */
.thumb.overlay-img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  opacity: 0;
  transition: opacity 0.2s ease;
}

.thumb.clip {
  cursor: default;
}

.thumb.placeholder {
  border: 1px dashed var(--line);
  background: var(--panel);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--faint);
  font: 11.5px var(--mono);
  cursor: default;
}

/* Generate/Regenerate-clip control overlaid on the thumbnail — top-right so it
   clears a playing video's control bar. */
/* #doc-scoped to beat the generic `#doc button` accent-pill rule (specificity). */
#doc .clip-overlay {
  position: absolute;
  top: 8px;
  right: 8px;
  padding: 5px 10px;
  border: 0;
  border-radius: 7px;
  background: rgba(17, 18, 22, 0.72);
  color: #fff;
  font: 600 12px/1.2 inherit;
  cursor: pointer;
  backdrop-filter: blur(2px);
  transition: background 0.12s ease;
}
#doc .clip-overlay:hover:not(:disabled) {
  background: rgba(17, 18, 22, 0.9);
}
#doc .clip-overlay:disabled {
  opacity: 0.7;
  cursor: default;
}
#doc .clip-overlay.has-clip {
  background: rgba(17, 18, 22, 0.55);
  font-size: 11.5px;
}
#doc .clip-overlay:focus-visible {
  outline: 2px solid #fff;
  outline-offset: 1px;
}

/* ▶ play button on a narration line (appears once its TTS audio has landed). */
/* #doc-scoped to beat the generic `#doc button` accent-pill rule (specificity). */
#doc .playline {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  margin-left: 6px;
  padding: 0 0 0 1px; /* optical: the ▶ triangle sits slightly left of centre */
  width: 20px;
  height: 20px;
  border: 1px solid var(--line);
  border-radius: 50%;
  background: var(--surface);
  color: var(--accent);
  font: 8px/1 inherit;
  cursor: pointer;
  vertical-align: middle;
}
#doc .playline:hover {
  border-color: var(--accent);
  background: var(--accent-soft);
}
#doc .playline:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 1px;
}

/* Skeleton (during generation): live thumbnail beside the narration. */
.skrow {
  display: flex;
  gap: 14px;
  flex-wrap: wrap;
  align-items: flex-start;
}
.skcol {
  flex: 1;
  min-width: 240px;
}
.scene.skeleton.haslive {
  border-style: solid;
  animation: none; /* asset landed — stop the waiting pulse so it reads as "ready", not dimmed */
}

/* Image lightbox (ui/lightbox.js) — click a still to see it full size. */
.lightbox {
  border: 0;
  padding: 0;
  background: transparent;
  max-width: 100vw;
  max-height: 100vh;
}
.lightbox::backdrop {
  background: rgba(10, 11, 14, 0.85);
}
.lightbox img {
  display: block;
  max-width: 92vw;
  max-height: 92vh;
  border-radius: 8px;
  box-shadow: 0 12px 48px rgba(0, 0, 0, 0.5);
}
.lightbox-close {
  position: fixed;
  top: 18px;
  right: 22px;
  width: 34px;
  height: 34px;
  border: 0;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.15);
  color: #fff;
  font-size: 16px;
  cursor: pointer;
}
.lightbox-close:hover {
  background: rgba(255, 255, 255, 0.28);
}

/* ── per-scene WYSIWYG mini-player (ui/scenePreviewPlayer.js + scenePreviewMount.js) ──
   Opt-in per scene: the ▶ Preview toggle swaps the still/clip thumbnail for a
   live, scrubbable render of the actual composition (captions/headings/effects).
   The compiled doc is 1280×720; the player scales it (inline transform) into the
   400px thumb column and clips it here. */
/* #doc-scoped to beat the generic `#doc button` accent-pill rule (specificity). */
#doc .preview-toggle {
  align-self: flex-start;
  padding: 5px 12px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: var(--surface);
  color: var(--fg-dim);
  font: 600 12px/1.2 inherit;
  cursor: pointer;
}
#doc .preview-toggle:hover {
  border-color: var(--accent);
  color: var(--accent);
}
#doc .preview-toggle.on {
  background: var(--accent-soft);
  color: var(--accent);
  border-color: var(--accent);
}

.scenepreview {
  width: 400px;
  max-width: 100%;
  border-radius: 10px;
  border: 1px solid var(--line);
  overflow: hidden;
  background: #000;
}
.spv-view {
  position: relative;
  overflow: hidden;
  background: #000;
  height: 214px;
}
.spv-frame {
  border: 0;
  display: block;
}
.spv-controls {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 5px 8px;
  background: var(--panel);
  border-top: 1px solid var(--line);
}
#doc .spv-play {
  border: 0;
  background: none;
  color: var(--accent);
  font-size: 12px;
  line-height: 1;
  cursor: pointer;
  padding: 0 4px;
}
.spv-scrub {
  flex: 1;
  accent-color: var(--accent);
}
.spv-readout {
  font-variant-numeric: tabular-nums;
  font-size: 11px;
  color: var(--fg-dim);
  min-width: 68px;
  text-align: right;
}
.spv-loading,
.spv-empty {
  height: 214px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--faint);
  font: 12px var(--mono);
  background: var(--panel);
}

/* ── full-timeline live preview surface (ui/livePreviewMount.js) ─────────────
   A WYSIWYG canvas for the current job, above the scene list. The PreviewPlayer
   iframe is scaled to .live-viewport's width (which MUST be a real, sized block
   or PreviewPlayer.mountIframe computes scale=1 and the 1280/1920px iframe
   overflows). The controls are wired imperatively, not via lit-html. */
.livepreview {
  position: relative; /* anchors the directions choose-overlay */
  margin: 16px 0;
  border: 1px solid var(--line);
  border-radius: 12px;
  overflow: hidden;
  background: var(--panel);
}

/* Directions pause: the pick lives ON the player — three buttons over the
   preview's lower edge (left / centre / right — one per direction page). */
.livepreview .dir-overlay {
  position: absolute;
  left: 12px;
  right: 12px;
  bottom: 58px; /* above the scrub/controls row */
  display: flex;
  justify-content: space-between;
  gap: 10px;
  z-index: 6;
  pointer-events: none; /* the gaps stay scrubbable/clickable */
}

/* Playhead-synced: one button, centred, for the direction on screen now. */
.livepreview .dir-overlay.solo {
  justify-content: center;
}

.livepreview .dir-choose {
  pointer-events: auto;
  max-width: 32%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  border: 1px solid rgba(255, 255, 255, 0.35);
  border-radius: var(--radius-pill);
  background: rgba(20, 14, 10, 0.72);
  color: #fff;
  font: 650 12px var(--font-display);
  padding: 7px 14px;
  cursor: pointer;
  backdrop-filter: blur(3px);
  transition: background 0.12s ease, border-color 0.12s ease;
}

.livepreview .dir-choose:hover:not(:disabled) {
  background: var(--accent);
  border-color: var(--accent);
}

.livepreview .dir-choose:disabled {
  opacity: 0.5;
  cursor: default;
}
.live-head {
  display: flex;
  align-items: baseline;
  gap: 10px;
  padding: 9px 12px;
  border-bottom: 1px solid var(--line);
  flex-wrap: wrap;
}
.live-head b {
  font-size: 13px;
}
.live-hint {
  font-size: 11px;
  color: var(--fg-dim);
}
.live-preview-mount {
  width: 100%;
}
.live-wrap {
  width: 100%;
  background: #000;
  /* Anchor the click-to-edit inspector (ui/editableCanvas.js), which is an
     absolutely-positioned child so it can extend past the viewport edge (the
     viewport itself clips with overflow:hidden). */
  position: relative;
}

/* ── click-to-edit overlay (ui/editableCanvas.js) ─────────────────────────────
   PREVIEW-only WYSIWYG editing surfaces layered over the live preview iframe:
   a highlight box on the clicked component + a floating attr inspector. */
.vy-edit-highlight {
  position: absolute;
  pointer-events: none;
  box-sizing: border-box;
  border: 2px solid var(--accent);
  border-radius: 3px;
  box-shadow: 0 0 0 2px rgba(0, 0, 0, 0.25);
  z-index: 5;
}
.vy-inspector {
  position: absolute;
  top: 8px;
  right: 8px;
  z-index: 6;
  width: min(340px, calc(100% - 16px));
  max-height: calc(100% - 16px);
  overflow-y: auto;
  padding: 10px 12px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 10px;
  box-shadow: 0 8px 28px rgba(0, 0, 0, 0.35);
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.vy-inspector-title {
  font: 11px var(--mono);
  color: var(--fg-dim);
  padding-bottom: 4px;
  border-bottom: 1px solid var(--line);
  word-break: break-all;
}
.vy-inspector-row {
  display: flex;
  flex-direction: column;
  gap: 3px;
}
.vy-inspector-label {
  font-size: 11px;
  color: var(--fg-dim);
}
.vy-inspector-control {
  width: 100%;
  box-sizing: border-box;
  font: 12px var(--sans, inherit);
}
/* Text fields are textareas: wrap long copy, grow with content, and stay
   user-resizable (vertical) like any other text editor. */
textarea.vy-inspector-control {
  resize: vertical;
  min-height: 30px;
  line-height: 1.45;
  font-size: 12.5px;
  padding: 5px 7px;
  border: 1px solid var(--line);
  border-radius: var(--radius-s);
  background: var(--surface);
  color: var(--fg);
}
textarea.vy-inspector-control:focus {
  outline: none;
  border-color: var(--accent);
}
.vy-inspector-close {
  align-self: flex-end;
  margin-top: 2px;
  padding: 4px 12px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--accent);
  color: #fff;
  cursor: pointer;
  font-size: 12px;
}
/* Image edit panel (step 4/5) — version strip + regenerate + upload. */
.vy-inspector-imgpanel {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding-bottom: 6px;
  border-bottom: 1px solid var(--line);
}
.vy-inspector-versions {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
}
.vy-inspector-vchip {
  padding: 2px 7px;
  border: 1px solid var(--line);
  border-radius: 5px;
  background: var(--panel);
  color: var(--fg-dim);
  font: 11px var(--mono);
  cursor: pointer;
}
.vy-inspector-vchip.active {
  border-color: var(--accent);
  color: var(--fg);
  background: color-mix(in srgb, var(--accent) 18%, transparent);
}
.vy-inspector-imgactions {
  display: flex;
  gap: 6px;
}
.vy-inspector-btn {
  flex: 1;
  text-align: center;
  padding: 4px 8px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--panel);
  color: var(--fg);
  cursor: pointer;
  font-size: 12px;
}
.vy-inspector-btn:disabled {
  opacity: 0.5;
  cursor: default;
}
.vy-inspector-upload {
  position: relative;
}
.live-viewport {
  position: relative;
  width: 100%;
  overflow: hidden;
  background: #000;
  transform-origin: top left;
}
.live-viewport iframe {
  border: 0;
  display: block;
  transform-origin: top left;
}
.live-controls {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 7px 12px;
  background: var(--panel);
  border-top: 1px solid var(--line);
}
.live-play {
  border: 0;
  background: none;
  color: var(--accent);
  font-size: 14px;
  line-height: 1;
  cursor: pointer;
  padding: 0 4px;
}
.live-scrub {
  flex: 1;
  accent-color: var(--accent);
}
.live-readout {
  font-variant-numeric: tabular-nums;
  font-size: 11px;
  color: var(--fg-dim);
  min-width: 84px;
  text-align: right;
}
.live-warn {
  font-size: 11px;
  color: var(--warn, #c9822a);
  min-width: 0;
}
.live-placeholder {
  min-height: 180px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--faint);
  font: 12px var(--mono);
  background: var(--panel);
}

/* ── original-brief panel (ui/briefPanel.js) — read-only, collapsible ──────
   Shows the prompt + options a job was generated from, at the top of the
   studio view when a job is open. */
.briefpanel {
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--panel);
  margin-bottom: 12px;
  overflow: hidden;
}
.briefpanel > summary {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 14px;
  cursor: pointer;
  list-style: none;
  user-select: none;
}
.briefpanel > summary::-webkit-details-marker {
  display: none;
}
.briefpanel .bp-chev {
  font-size: 9px;
  color: var(--faint);
  transition: transform 0.15s ease;
  flex: 0 0 auto;
}
.briefpanel[open] .bp-chev {
  transform: rotate(90deg);
}
.briefpanel .bp-label {
  font-size: 11px;
  font-weight: 650;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: var(--fg-dim);
  flex: 0 0 auto;
}
.briefpanel .bp-preview {
  color: var(--faint);
  font-size: 13px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  min-width: 0;
  flex: 1;
}
.briefpanel[open] .bp-preview {
  display: none;
}
.briefpanel .bp-body {
  padding: 4px 16px 14px;
  border-top: 1px solid var(--line);
}
.briefpanel .bp-field {
  margin: 10px 0;
}
.briefpanel .bp-field label {
  display: block;
  font-size: 10px;
  font-weight: 650;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: var(--fg-dim);
  margin-bottom: 4px;
}
.briefpanel .bp-prompt {
  font-size: 14.5px;
  line-height: 1.5;
  color: var(--fg);
  white-space: pre-wrap;
}
.briefpanel .bp-opts {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 8px 18px;
  margin: 12px 0 0;
}
.briefpanel .bp-opts > div {
  display: flex;
  flex-direction: column;
  gap: 1px;
}
.briefpanel .bp-opts dt {
  font-size: 10px;
  font-weight: 650;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--faint);
}
.briefpanel .bp-opts dd {
  margin: 0;
  font-size: 13.5px;
  color: var(--fg);
}
.briefpanel .bp-loading {
  color: var(--faint);
  font: 12px var(--mono);
  margin-top: 10px;
}
.briefpanel .bp-note {
  margin: 14px 0 0;
  font-size: 12px;
  color: var(--faint);
}

/* ── revision-history panel (ui/revisionsPanel.js) — briefPanel's sibling ──
   Nested per-revision <details>. The nested chevron is .rp-chev, NOT .bp-chev:
   `.briefpanel[open] .bp-chev` matches all descendants, so reusing it would
   pre-rotate every item's chevron the moment the outer panel opens. */
.revpanel .bp-body {
  padding: 8px 12px 12px;
}
.rp-item {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  margin: 6px 0;
  overflow: hidden;
}
.rp-item > summary {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 7px 10px;
  cursor: pointer;
  list-style: none;
  user-select: none;
}
.rp-item > summary::-webkit-details-marker {
  display: none;
}
.rp-chev {
  font-size: 9px;
  color: var(--faint);
  transition: transform 0.15s ease;
  flex: 0 0 auto;
}
.rp-item[open] > summary .rp-chev {
  transform: rotate(90deg);
}
.rp-rev {
  font-size: 12px;
  font-weight: 650;
  color: var(--fg-dim);
  flex: 0 0 auto;
  white-space: nowrap;
}
.rp-note {
  color: var(--faint);
  font-size: 13px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  min-width: 0;
  flex: 1;
}
.rp-when {
  color: var(--faint);
  font-size: 11.5px;
  flex: 0 0 auto;
  white-space: nowrap;
}
.rp-body {
  padding: 2px 12px 12px;
  border-top: 1px solid var(--line);
}
.rp-rerun {
  margin-top: 8px;
}

/* ── screen/webcam recorder modal (recorderPanel.js + ui/recorder.js) ──
   The "● Record" open button sits on the composer faces (brief face shows it
   disabled — importClip needs an open job). */
.rec-open-btn {
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--fg, #1a1a1a);
  border-radius: 8px;
  padding: 6px 12px;
  font-size: 13px;
  cursor: pointer;
  white-space: nowrap;
}
.rec-open-btn:hover:not(:disabled) { border-color: var(--accent, #2f6df6); color: var(--accent, #2f6df6); }
.rec-open-btn:disabled {
  opacity: 0.4;
  cursor: default;
}
/* Staged-recording chip (brief face) — the attached-document affordance for a
   clip recorded before the project exists. */
.recchip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  border: 1px solid var(--line);
  background: var(--panel);
  border-radius: 8px;
  padding: 5px 8px;
  font-size: 12.5px;
  color: var(--fg-dim);
  white-space: nowrap;
}
.recchip.err {
  border-color: var(--danger, #c0392b);
  color: var(--danger, #c0392b);
}
.recchip .recchip-x {
  border: none;
  background: transparent;
  color: inherit;
  cursor: pointer;
  font-size: 14px;
  line-height: 1;
  padding: 0 2px;
}
/* Feature-showcase popup (featurePopup.js): one-time welcome embedding
   /features.html?embed=1 — the standalone page is the single content source. */
.features-overlay {
  position: fixed;
  inset: 0;
  z-index: 70;
  background: rgba(20, 18, 14, 0.72);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 32px;
}
.features-modal {
  position: relative;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 14px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.4);
  width: min(880px, 94vw);
  height: min(84vh, 720px);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.features-head {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 48px 12px 18px;
  border-bottom: 1px solid var(--line);
}
.features-head b {
  font-size: 14.5px;
}
.features-head a {
  font-size: 12.5px;
  color: var(--accent-ink);
  text-decoration: none;
}
.features-head a:hover {
  text-decoration: underline;
}
.features-modal iframe {
  flex: 1;
  border: 0;
  width: 100%;
  background: var(--bg);
}
.features-foot {
  padding: 10px 18px;
  border-top: 1px solid var(--line);
  text-align: right;
}
.features-cta {
  background: var(--accent);
  color: #fff;
  border: none;
  border-radius: 999px;
  padding: 8px 20px;
  font-weight: 700;
  font-size: 13.5px;
  cursor: pointer;
}
.features-cta:hover {
  background: var(--accent-deep);
}
/* Header reopen affordance, next to the brand mark. */
.features-link {
  font-size: 12px;
  color: var(--faint);
  margin-right: 4px;
}
.features-link:hover {
  color: var(--accent-ink);
}

/* Startup "Enter Key" popup (keyGate.js modal): Local engine, no stored fal
   key, dry-run off. Same overlay treatment as the recorder. */
.keygate-overlay {
  position: fixed;
  inset: 0;
  z-index: 70;
  background: rgba(20, 18, 14, 0.72);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 32px;
}
.keygate-modal {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 14px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.4);
  width: min(520px, 94vw);
  padding: 20px;
}
.keygate-modal h2 {
  margin: 0 0 8px;
  font-size: 16px;
}
.keygate-modal p {
  margin: 0 0 12px;
  color: var(--faint);
  font-size: 13px;
  line-height: 1.5;
}
.keygate-modal .row {
  display: flex;
  gap: 8px;
}
.keygate-modal .row input {
  flex: 1;
}
.keygate-modal-actions {
  margin-top: 12px;
  text-align: right;
}

.rec-overlay {
  position: fixed;
  inset: 0;
  z-index: 60;
  background: rgba(20, 18, 14, 0.72);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 32px;
}
.recorder {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 14px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.4);
  width: min(720px, 94vw);
  padding: 20px;
}
.rec-panel { display: flex; flex-direction: column; gap: 14px; }
.rec-toggle { display: flex; gap: 8px; }
.rec-hint { color: var(--faint); font-size: 13px; margin: 0; }
.rec-stage {
  position: relative;
  aspect-ratio: 16 / 9;
  background: #111;
  border-radius: 10px;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
}
.rec-video { width: 100%; height: 100%; object-fit: contain; background: #111; }
.rec-actions { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.rec-timer { font-variant-numeric: tabular-nums; font-weight: 600; color: var(--fg, #1a1a1a); margin-right: auto; }
.rec-dot {
  position: absolute; top: 12px; left: 12px;
  width: 12px; height: 12px; border-radius: 50%;
  background: #e5484d; box-shadow: 0 0 10px #e5484d;
  animation: recPulse 1.1s ease-in-out infinite;
}
.rec-dot-paused { animation: none; opacity: 0.5; }
@keyframes recPulse { 0%, 100% { opacity: 1; } 50% { opacity: 0.35; } }
.rec-rec { color: #e5484d; }
.rec-err { margin: 0; }

/* Brand layouts (layoutPanel): dual-pane accuracy preview rows. */
.layset .lay-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-top: 8px;
}
.layset .lay-row {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 8px;
  background: var(--surface);
}
.layset .lay-row.pending {
  opacity: 0.7;
  border-style: dashed;
}
.layset .lay-panes {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  flex-wrap: wrap;
}
.layset .lay-underlay {
  height: auto;
  border-radius: 4px;
  border: 1px solid var(--line);
}
.layset .lay-skeleton {
  position: relative;
  overflow: hidden;
  border-radius: 4px;
  border: 1px solid var(--line);
}
.layset .lay-skeleton .lay-box {
  position: absolute;
  margin: 0;
  line-height: 1.1;
  white-space: pre-line;
  overflow: hidden;
}
.layset .lay-meta {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 6px;
}
.layset .lay-meta .lay-x {
  position: static;
  margin-left: auto;
}
.layset .lay-pending-note {
  font-size: 12px;
  color: var(--faint);
  align-self: center;
}


/* ── stage rail (the ONE pipeline display: progress map + checkpoints) ────── */

/* Persistent strip above the studio view. Each stage is a mini progress track
   (background-image fill so the label always sits above it) — done = full,
   current = filling + glowing, pending = empty. The connectors between stages
   are the gate pills: quiet "auto ›" vs accent "✋ STOP" (where the agents
   pause for review). */
.stagerail {
  margin: 0 0 14px;
}
.stagerail .srow {
  display: flex;
  align-items: center;
  gap: 6px;
  list-style: none;
  margin: 0;
  padding: 0;
  font-size: 12px;
}
.stagerail .sstage {
  position: relative;
  flex: 1;
  text-align: center;
  padding: 7px 4px;
  border-radius: var(--radius-s);
  border: 1px solid var(--line);
  background-color: var(--panel);
  background-image: linear-gradient(
    90deg,
    color-mix(in srgb, var(--accent) 26%, transparent),
    color-mix(in srgb, var(--accent) 42%, transparent)
  );
  background-repeat: no-repeat;
  /* The fill level is REAL data (inline background-size from stopFractions) —
     each track fills ONCE as its assets land; no decorative refill loop. */
  background-size: 0% 100%;
  color: var(--faint);
  font-weight: 600;
  white-space: nowrap;
  /* Fill-level changes glide instead of jumping. */
  transition: background-size 0.5s ease;
}
.stagerail .sstage .spct {
  font-style: normal;
  font-size: 10px;
  margin-left: 5px;
  color: var(--accent-ink);
  opacity: 0.85;
}
.stagerail .sstage[data-state="done"] {
  border-color: color-mix(in srgb, var(--accent) 45%, var(--line));
  color: var(--accent-ink);
}
.stagerail .sstage[data-state="current"] {
  border-color: var(--accent);
  color: var(--accent-ink);
  box-shadow:
    0 0 0 3px var(--accent-soft),
    0 2px 12px rgba(217, 79, 43, 0.35);
}
.stagerail .sstage[data-state="unordered"] {
  opacity: 0.45;
}

/* Gate pills — the auto/STOP toggles living in the connector slots. */
.stagerail .sgate {
  flex: 0 0 auto;
  display: flex;
}
.stagerail .gatepill {
  border: 1px solid transparent;
  background: transparent;
  color: var(--faint);
  font: 700 10px/1 var(--font-display);
  letter-spacing: 0.02em;
  padding: 5px 7px;
  border-radius: var(--radius-pill);
  cursor: pointer;
  white-space: nowrap;
}
.stagerail .gatepill.auto:hover:not(:disabled) {
  border-color: var(--line);
  color: var(--accent-ink);
}
.stagerail .gatepill.stop {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}
/* The pause we're sitting at: the loud "you are here" ✋. */
.stagerail .gatepill[data-state="waiting"] {
  box-shadow: 0 0 0 3px var(--accent-soft);
  opacity: 1;
}
/* Already behind the run — inert and faint. */
.stagerail .gatepill[data-state="passed"] {
  opacity: 0.35;
  cursor: default;
}
.stagerail .gatepill:disabled:not([data-state="waiting"]) {
  cursor: default;
  opacity: 0.45;
}
.stagerail .railhint {
  margin: 6px 2px 0;
  font-size: 10.5px;
  color: var(--faint);
}
@media (prefers-reduced-motion: no-preference) {
  /* The active agent visibly WORKS: the glow breathes (box-shadow only —
     non-interactive node; the fill itself is data, not animation). */
  .stagerail .sstage[data-state="current"],
  .stagerail .gatepill[data-state="waiting"] {
    animation: vy-stageglow 1.8s ease-in-out infinite;
  }
  /* A playful wobble invites the click. */
  .stagerail .gatepill:hover:not(:disabled) {
    animation: vy-gatewobble 0.4s ease-in-out;
  }
  @keyframes vy-gatewobble {
    0%,
    100% {
      transform: rotate(0);
    }
    25% {
      transform: rotate(-4deg);
    }
    75% {
      transform: rotate(4deg);
    }
  }
  @keyframes vy-stageglow {
    0%,
    100% {
      box-shadow:
        0 0 0 3px var(--accent-soft),
        0 2px 10px rgba(217, 79, 43, 0.25);
    }
    50% {
      box-shadow:
        0 0 0 4px var(--accent-soft),
        0 2px 18px rgba(217, 79, 43, 0.5);
    }
  }
}
/* Narrow viewports: stack into two rows of boxes; pills stay in flow. */
@media (max-width: 720px) {
  .stagerail .srow {
    flex-wrap: wrap;
    gap: 4px;
  }
  .stagerail .sstage {
    flex: 1 1 28%;
  }
}

/* Full-width stage label + action buttons row under the (full-width) bar. */
.stagerow {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 7px;
}
.stagerow #stage {
  flex: 1;
  min-width: 0;
  white-space: normal;
}

/* Paused row: "Pictures ready — edit below" + the Continue buttons. */
.pausedrow {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 8px;
  flex-wrap: wrap;
}
.pausedrow .pausednote {
  color: var(--fg-dim);
  font-size: 12.5px;
}

/* Continue row: the Continue / finish-video buttons (targets come from the
   stage rail's checkpoints — no picker here). */
.pausedrow .controw {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

/* Directions chooser (directions depth stop): three creative-direction cards
   (hero + title + hook); the picked one highlights, then one Continue. */
.pausedrow.directions {
  flex-direction: column;
  align-items: stretch;
}
.dir-cards {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}
@media (max-width: 640px) {
  .dir-cards {
    grid-template-columns: 1fr;
  }
}
.dir-card {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 6px;
  padding: 8px;
  border: 1.5px solid var(--line, #ddd);
  border-radius: 10px;
  background: var(--panel, #fff);
  text-align: left;
  cursor: pointer;
  transition: border-color 0.12s ease, box-shadow 0.12s ease;
}
.dir-card:hover:not(:disabled) {
  border-color: color-mix(in srgb, var(--accent) 45%, transparent);
}
.dir-card.sel {
  border-color: var(--accent);
  box-shadow: 0 0 0 2px color-mix(in srgb, var(--accent) 30%, transparent);
}
.dir-card:disabled {
  opacity: 0.6;
  cursor: default;
}
.dir-hero {
  width: 100%;
  aspect-ratio: 16 / 9;
  object-fit: cover;
  border-radius: 6px;
  background: color-mix(in srgb, var(--fg-dim) 12%, transparent);
}
.dir-hero.placeholder {
  display: block;
}
.dir-title {
  font-weight: 600;
  font-size: 13px;
}
.dir-hook {
  color: var(--fg-dim);
  font-size: 12px;
}

/* Brief-gap guidance panel at the directions stop: probing questions +
   missing-input bullets when the brief was too vague for a non-generic video. */
.dir-gaps {
  background: var(--pop-soft);
  border: 1px solid color-mix(in srgb, var(--pop) 45%, var(--line));
  border-radius: var(--radius-m);
  padding: 12px 16px;
  margin-bottom: 12px;
  font-size: 12.5px;
  line-height: 1.5;
  text-align: left;
}
.dir-gaps > b { color: var(--warn); font-size: 12.5px; }
.dir-gaps ul { margin: 6px 0 0; padding-left: 18px; color: var(--fg-dim); }
.dir-gaps li { margin: 2px 0; }
.dir-gaps-missing li::marker { color: var(--warn); }
.dir-gaps-q li { font-style: italic; }
.dir-gaps-q li::marker { color: var(--accent); }
.dir-gaps-hint { display: block; margin-top: 8px; font-size: 11.5px; color: var(--faint); }

/* Enriched direction copy: concept line, numbered beat spine, style fine print. */
.dir-concept {
  display: block;
  font-size: 12px;
  color: var(--fg-dim);
  line-height: 1.4;
  margin-top: 4px;
}
.dir-beats {
  margin: 8px 0 0;
  padding: 0 0 0 18px;
  font-size: 11.5px;
  color: var(--fg-dim);
  line-height: 1.45;
  text-align: left;
}
.dir-beats li { margin: 2px 0; }
.dir-beats li::marker { color: var(--accent); font-weight: 700; }
.dir-style {
  display: block;
  margin-top: 8px;
  font-size: 11px;
  color: var(--faint);
  font-style: italic;
  line-height: 1.4;
}

/* Editable outline cards (M2): plain document text boxes on the skeleton. */
.scene.skeleton.outline textarea {
  width: 100%;
  min-height: 40px;
  resize: vertical;
  font: inherit;
}
.scene.skeleton.outline .fld.dirty textarea {
  outline: 2px solid color-mix(in srgb, var(--accent) 55%, transparent);
}
.pendingbanner {
  margin: 6px 0 10px;
  padding: 7px 12px;
  border-radius: 8px;
  background: color-mix(in srgb, var(--accent) 10%, transparent);
  color: var(--fg-dim);
  font-size: 12.5px;
}

/* Advanced fold (M2b): the brief face's extra controls — the Speed preset,
   generation toggles, model picks, layout templates — folded away for the
   word-processor user. Open, it reads as one inset panel: Speed is the
   full-width header row (its presets pin exactly these toggles), a hairline
   under it, then the toggle grid. */
.composer details.advanced {
  width: 100%;
  margin-top: 6px;
}
.composer details.advanced > summary {
  cursor: pointer;
  color: var(--faint);
  font-size: 12.5px;
  user-select: none;
  width: max-content;
}
.composer details.advanced > summary:hover {
  color: var(--fg-dim);
}
.composer details.advanced .advbody {
  display: flex;
  flex-wrap: wrap;
  gap: 10px 14px;
  align-items: center;
  margin-top: 8px;
  padding: 12px 14px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius-m);
}
.composer details.advanced .advbody > .speed {
  flex-basis: 100%;
  display: flex;
  align-items: center;
  gap: 8px;
  border-bottom: 1px solid var(--line);
  padding-bottom: 10px;
}
.composer details.advanced .advbody .speed .slabel {
  font-size: 12px;
  font-weight: 600;
  white-space: nowrap;
}
.composer details.advanced .advbody .speed input[type="range"] {
  width: 140px;
  flex: none;
  accent-color: var(--accent);
}
.composer details.advanced .advbody .speed .sticks {
  display: flex;
  gap: 8px;
  font-size: 11px;
  color: var(--fg-dim);
}
.composer details.advanced .advbody .speed .sticks .on {
  font-weight: 700;
  color: var(--accent);
}
.composer details.advanced .advbody .speed.custom {
  opacity: 0.5;
}

/* ── delight & motion (2026-08 reskin) ────────────────────────────────────────
   Every animation here is opt-in via prefers-reduced-motion. Entrances are
   finite (≤400ms); the only infinite loops animate background-position or
   opacity on NON-interactive nodes (.bar i, status chips) — never a moving
   click target, so Playwright's actionability "stable" check stays happy. */

/* Composer focus glow (a transition, so it's fine outside the motion gate). */
.composer:focus-within {
  border-color: var(--accent);
  box-shadow:
    0 0 0 3px var(--accent-soft),
    var(--shadow-l);
}

@media (prefers-reduced-motion: no-preference) {
  /* Staggered entrance: gallery tiles + scene cards rise in, capped at the
     first 8 children (later ones appear instantly — no long tail). */
  @keyframes vy-rise {
    from {
      opacity: 0;
      transform: translateY(6px);
    }
    to {
      opacity: 1;
      transform: none;
    }
  }
  #galleryGrid .tile,
  #scenes details.scene {
    animation: vy-rise 0.32s ease-out backwards;
  }
  #galleryGrid .tile:nth-child(2),
  #scenes details.scene:nth-child(2) {
    animation-delay: 0.05s;
  }
  #galleryGrid .tile:nth-child(3),
  #scenes details.scene:nth-child(3) {
    animation-delay: 0.1s;
  }
  #galleryGrid .tile:nth-child(4),
  #scenes details.scene:nth-child(4) {
    animation-delay: 0.15s;
  }
  #galleryGrid .tile:nth-child(5),
  #scenes details.scene:nth-child(5) {
    animation-delay: 0.2s;
  }
  #galleryGrid .tile:nth-child(6),
  #scenes details.scene:nth-child(6) {
    animation-delay: 0.25s;
  }
  #galleryGrid .tile:nth-child(7),
  #scenes details.scene:nth-child(7) {
    animation-delay: 0.3s;
  }
  #galleryGrid .tile:nth-child(8),
  #scenes details.scene:nth-child(8) {
    animation-delay: 0.35s;
  }

  /* Gallery tiles get a gentle hover lift (finite transition, small travel). */
  #galleryGrid .tile:hover {
    transform: translateY(-2px);
  }

  /* The generate run becomes a little show: a light sheen sweeps the
     progress fill while it's in flight (background-position only). */
  @keyframes vy-sheen {
    to {
      background-position:
        166% 0,
        0 0;
    }
  }
  .bar i:not(.done) {
    background-image:
      linear-gradient(
        100deg,
        rgba(255, 255, 255, 0) 30%,
        rgba(255, 255, 255, 0.35),
        rgba(255, 255, 255, 0) 70%
      ),
      linear-gradient(90deg, var(--accent), #e8703f);
    background-size:
      40% 100%,
      100% 100%;
    background-repeat: no-repeat;
    background-position:
      -66% 0,
      0 0;
    animation: vy-sheen 1.5s ease-in-out infinite;
  }

  /* Celebratory done-state: the stage label pops once when a run lands. */
  @keyframes vy-pop {
    0% {
      transform: scale(0.9);
    }
    60% {
      transform: scale(1.08);
    }
    100% {
      transform: none;
    }
  }
  #stage.ok {
    display: inline-block;
    animation: vy-pop 0.35s ease-out;
  }

  /* Toast slides up into place (keyframes carry the centering transform). */
  @keyframes vy-toast-in {
    from {
      opacity: 0;
      transform: translate(-50%, 10px);
    }
    to {
      opacity: 1;
      transform: translate(-50%, 0);
    }
  }
  .toast {
    animation: vy-toast-in 0.28s cubic-bezier(0.2, 0.9, 0.3, 1.15);
  }
}

/* Retro-guard the pre-reskin status pulses for reduced-motion users. */
@media (prefers-reduced-motion: reduce) {
  .sbadge.livechip[data-state="live"],
  .scene.skeleton,
  .tile .syncchip[data-state="syncing"],
  .rec-dot {
    animation: none !important;
  }
}

/* ── job-view IA (2026-08-07): media tabs, versions rail, section headers ──── */

/* Section eyebrow headers ("New version" / "Versions" / "Edit"). */
.secthead {
  margin: 26px 0 10px;
  font-family: var(--font-display);
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.09em;
  color: var(--fg-dim);
  display: flex;
  align-items: baseline;
  gap: 10px;
}
.secthead .secthint {
  font-family: var(--font-body);
  font-size: 12px;
  font-weight: 400;
  text-transform: none;
  letter-spacing: normal;
  color: var(--faint);
}

/* Media tabs card: [Final video | Edit preview] over one slot. Panels stay
   mounted ([hidden] toggles) — the live preview iframe and <video> survive. */
.mediacard {
  margin-bottom: 14px;
}
.mediatabs {
  display: inline-flex;
  gap: 2px;
  padding: 4px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius-pill);
  margin-bottom: 10px;
}
.mediatabs button {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 15px;
  border: 0;
  border-radius: var(--radius-pill);
  background: transparent;
  color: var(--fg-dim);
  font: inherit;
  font-family: var(--font-display);
  font-size: 13px;
  font-weight: 600;
  line-height: 1.2;
  cursor: pointer;
  transition:
    background 0.12s ease,
    color 0.12s ease;
}
.mediatabs button:hover:not([data-active="true"]):not(:disabled) {
  color: var(--fg);
}
.mediatabs button[data-active="true"] {
  background: var(--surface);
  color: var(--accent-ink);
  font-weight: 700;
  box-shadow: var(--shadow-s);
}
.mediatabs button:disabled {
  opacity: 0.45;
  cursor: default;
}
.mediatabs button:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 1px;
}
/* Amber "needs re-render" dot on the Final-video tab. */
.staledot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--pop);
  box-shadow: 0 0 0 2px var(--pop-soft);
  flex: none;
}
.mediapanel[hidden] {
  display: none;
}
/* The panels' own cards already carry chrome; kill their outer margins so the
   tab strip and panel read as one unit. */
.mediapanel #player {
  margin-top: 0;
}
.mediapanel .livepreview {
  margin-top: 0;
}

/* Stale banner on the Final-video player. */
.stale-banner {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 10px;
  padding: 8px 12px;
  background: var(--pop-soft);
  border: 1px solid color-mix(in srgb, var(--warn) 40%, var(--line));
  border-radius: var(--radius-s);
  font-size: 12.5px;
  color: var(--warn);
  font-weight: 600;
}
.stale-banner button {
  margin-left: auto;
  background: var(--accent);
  color: #fff;
  border: none;
  border-radius: var(--radius-s);
  padding: 6px 14px;
  font: 700 12.5px/1.2 var(--font-display);
  cursor: pointer;
}
.stale-banner button:hover:not(:disabled) {
  background: var(--accent-deep);
}
.stale-banner button:disabled {
  opacity: 0.4;
  cursor: default;
}
/* Quieter twin inside the Edit-preview panel. */
.live-stale-note {
  margin: 6px 0 8px;
  padding: 6px 10px;
  background: var(--pop-soft);
  border: 1px solid color-mix(in srgb, var(--warn) 30%, var(--line));
  border-radius: var(--radius-s);
  font-size: 12px;
  color: var(--warn);
}

/* Versions section: the ONE versions bar + the collapsed/draft composer +
   history folds. */
.verssection {
  margin-top: 6px;
}
.verssection .briefpanel {
  margin-top: 8px;
}
.verchip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius-pill);
  background: var(--surface);
  color: var(--fg-dim);
  font: 600 12.5px/1.2 var(--font-display);
  cursor: pointer;
  transition:
    border-color 0.12s ease,
    background 0.12s ease,
    color 0.12s ease;
}
.verchip:hover {
  border-color: var(--faint);
  color: var(--fg);
}
.verchip.cur {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}
.verchip.sel:not(.cur) {
  border-color: var(--accent);
  color: var(--accent-ink);
  box-shadow: 0 0 0 2px var(--accent-soft);
}
.verchip .vercur {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  opacity: 0.85;
}
.verchip .verdot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--ok);
  flex: none;
}
.verchip.cur .verdot {
  background: #fff;
}
