/* ============================================================
   STORYBOARD DIRECTOR — "Director's Cut"
   A cinema-grade interface: warm-black grading suite, tungsten
   accents, editorial serif titling over production-equipment
   mono labels. Letterboxed previews, tally lights, slate cues.
   ============================================================ */

:root {
  color-scheme: dark;

  --rail-width: 276px;
  --topbar-h: 64px;
  --chat-max: 820px;
  --wall-width: clamp(420px, 34vw, 580px);

  /* Warm black grading-suite palette */
  --bg: #0b0908;
  --bg-2: #121009;
  --surface: #16130f;
  --surface-2: #1d1914;
  --surface-3: #242019;
  --surface-glass: rgba(22, 19, 15, 0.84);
  --line: rgba(228, 209, 182, 0.12);
  --line-strong: rgba(234, 218, 192, 0.26);

  --ink: #f0e9dc;
  --muted: #a89e8c;
  --dim: #6f675a;

  --gold: #e3a94f;
  --gold-bright: #f4cd7e;
  --gold-deep: #b97f2e;
  --gold-soft: rgba(227, 169, 79, 0.13);
  --rec: #ff4b3c;
  --rec-soft: rgba(255, 75, 60, 0.14);
  --ok: #a4cf72;
  --ok-soft: rgba(164, 207, 114, 0.13);
  --info: #92b8d8;
  --info-soft: rgba(146, 184, 216, 0.12);
  --danger: #ff7263;

  --font-display: "Instrument Serif", "Iowan Old Style", Georgia, serif;
  --font-body: "Instrument Sans", "Avenir Next", "Segoe UI", sans-serif;
  --mono: "IBM Plex Mono", "SF Mono", Menlo, Consolas, monospace;

  --radius: 10px;
  --radius-sm: 7px;
  --radius-lg: 16px;
  --shadow: 0 32px 90px rgba(0, 0, 0, 0.55);
  --shadow-soft: 0 14px 44px rgba(0, 0, 0, 0.38);
}

/* ---------- Reset & base ---------- */

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

html,
body {
  min-height: 100%;
}

body {
  margin: 0;
  overflow: hidden;
  background:
    radial-gradient(120% 90% at 50% -10%, rgba(227, 169, 79, 0.07), transparent 46%),
    radial-gradient(90% 120% at 100% 110%, rgba(146, 184, 216, 0.04), transparent 40%),
    linear-gradient(165deg, #0d0b09 0%, #0b0908 55%, #080705 100%);
  color: var(--ink);
  font-family: var(--font-body);
  font-size: 15px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}

/* Film grain over everything, very faint */
body::after {
  content: "";
  position: fixed;
  inset: 0;
  z-index: 2000;
  pointer-events: none;
  opacity: 0.05;
  mix-blend-mode: overlay;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='160' height='160'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='2' stitchTiles='stitch'/></filter><rect width='100%25' height='100%25' filter='url(%23n)'/></svg>");
}

::selection {
  background: rgba(227, 169, 79, 0.32);
  color: #fff8ec;
}

button,
input,
select,
textarea {
  font: inherit;
}

button,
select,
textarea {
  color: inherit;
}

button {
  cursor: pointer;
  background: none;
  border: none;
  padding: 0;
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.38;
}

svg {
  width: 18px;
  height: 18px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.8;
}

h1, h2, h3 {
  margin: 0;
  font-weight: 600;
}

p {
  margin: 0;
}

a {
  color: var(--gold-bright);
  text-decoration-color: rgba(227, 169, 79, 0.4);
  text-underline-offset: 3px;
}

a:hover {
  text-decoration-color: var(--gold-bright);
}

/* Thin warm scrollbars */
* {
  scrollbar-width: thin;
  scrollbar-color: rgba(168, 158, 140, 0.28) transparent;
}

*::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}

*::-webkit-scrollbar-thumb {
  background: rgba(168, 158, 140, 0.24);
  border-radius: 8px;
}

*::-webkit-scrollbar-track {
  background: transparent;
}

/* Mono label utility look (used by many chips) */
.output-pill,
.status-chip,
.mini-status,
.tally,
.panel-number,
.attachment-kind,
.hero-kicker,
.workflow-next-kicker,
.workflow-thread-kicker,
.stage-tc,
.stage-rec,
.latest-meta,
.production-action-index {
  font-family: var(--mono);
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

/* ---------- Drag overlay ---------- */

body.file-drag-active::after {
  content: "DROP TO ATTACH";
  position: fixed;
  inset: 14px;
  z-index: 2100;
  display: grid;
  place-items: center;
  border: 1px dashed rgba(227, 169, 79, 0.75);
  border-radius: var(--radius-lg);
  background: rgba(8, 6, 4, 0.72);
  backdrop-filter: blur(6px);
  color: var(--gold-bright);
  font-family: var(--mono);
  font-size: 15px;
  letter-spacing: 0.3em;
  opacity: 1;
  mix-blend-mode: normal;
  pointer-events: none;
}

/* ---------- App shell ---------- */

.app-shell {
  display: grid;
  grid-template-columns: var(--rail-width) minmax(0, 1fr);
  grid-template-rows: var(--topbar-h) minmax(0, 1fr);
  height: 100vh;
  height: 100dvh;
  transition: grid-template-columns 0.22s cubic-bezier(0.5, 0, 0.2, 1);
}

body.rail-collapsed .app-shell {
  grid-template-columns: 0 minmax(0, 1fr);
}

/* ---------- Left rail ---------- */

.left-rail {
  grid-row: 1 / 3;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  min-height: 0;
  min-width: 0;
  overflow: hidden;
  border-right: 1px solid var(--line);
  background: linear-gradient(180deg, rgba(20, 16, 12, 0.92), rgba(13, 11, 9, 0.96));
}

body.rail-collapsed .left-rail {
  border-right-color: transparent;
}

.brand-block {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 18px 18px 16px;
  border-bottom: 1px solid var(--line);
  min-width: var(--rail-width);
}

/* The rail brand block doubles as the home link back to the Previsto landing. */
a.brand-home { text-decoration: none; color: inherit; }
a.brand-home:hover .brand-mark { box-shadow: 0 0 0 1px var(--gold-deep); }

.brand-mark {
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-sm);
  background:
    repeating-linear-gradient(-45deg, rgba(227, 169, 79, 0.85) 0 7px, rgba(10, 8, 6, 0.9) 7px 14px) top / 100% 9px no-repeat,
    var(--surface-2);
  color: var(--gold-bright);
  font-family: var(--mono);
  font-weight: 600;
  font-size: 14px;
  letter-spacing: 0.04em;
  padding-top: 8px;
}

.brand-block h1 {
  font-family: var(--font-display);
  font-weight: 400;
  font-size: 19px;
  line-height: 1.02;
  letter-spacing: 0.01em;
}

.brand-block span {
  display: block;
  margin-top: 3px;
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--dim);
}

.rail-nav {
  display: flex;
  flex-direction: column;
  gap: 18px;
  padding: 16px 14px 18px;
  min-height: 0;
  min-width: var(--rail-width);
  overflow-y: auto;
}

.rail-section {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.rail-section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--dim);
  padding: 0 4px;
}

.rail-section.muted p {
  font-size: 12px;
  color: var(--dim);
  line-height: 1.6;
  padding: 0 4px;
}

#projectSelect {
  width: 100%;
  appearance: none;
  background:
    linear-gradient(45deg, transparent 50%, var(--muted) 50%) calc(100% - 19px) 55% / 5px 5px no-repeat,
    linear-gradient(-45deg, transparent 50%, var(--muted) 50%) calc(100% - 14px) 55% / 5px 5px no-repeat,
    var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  color: var(--ink);
  font-size: 13px;
  padding: 9px 34px 9px 12px;
  transition: border-color 0.15s ease;
}

#projectSelect:focus {
  outline: none;
  border-color: var(--gold);
}

.project-rail-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.rail-project {
  display: flex;
  flex-direction: column;
  gap: 3px;
  text-align: left;
  padding: 10px 12px;
  border: 1px solid transparent;
  border-left: 2px solid transparent;
  border-radius: var(--radius-sm);
  transition: background 0.15s ease, border-color 0.15s ease;
}

.rail-project span {
  font-size: 13.5px;
  font-weight: 600;
  color: var(--ink);
}

.rail-project small {
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--dim);
}

.rail-project:hover {
  background: rgba(227, 169, 79, 0.06);
}

.rail-project.selected {
  background: var(--gold-soft);
  border-left-color: var(--gold);
}

.rail-project.selected small {
  color: var(--gold-deep);
}

/* ---------- Topbar ---------- */

.topbar {
  grid-row: 1;
  grid-column: 2;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 0 18px 0 12px;
  border-bottom: 1px solid var(--line);
  background: var(--surface-glass);
  backdrop-filter: blur(18px);
  z-index: 30;
}

.topbar-left {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.topbar-title {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.topbar-title span {
  font-family: var(--mono);
  font-size: 9.5px;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--dim);
}

.topbar-title strong {
  font-family: var(--font-display);
  font-weight: 400;
  font-size: 19px;
  line-height: 1.15;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.topbar-status {
  display: flex;
  align-items: center;
  gap: 10px;
}

.status-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 10px;
  color: var(--dim);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 5px 12px;
}

.status-chip strong {
  color: var(--muted);
  font-weight: 500;
}

/* Engine tally light */
.tally {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  font-size: 10px;
  color: var(--muted);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 5px 12px;
  background: var(--surface);
}

.tally em {
  font-style: normal;
  color: var(--dim);
  letter-spacing: 0.14em;
}

.tally-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--dim);
  box-shadow: 0 0 0 0 transparent;
}

.tally-rec {
  display: none;
  color: var(--rec);
  font-weight: 600;
}

body.codex-running .tally {
  border-color: rgba(255, 75, 60, 0.5);
  background: var(--rec-soft);
}

body.codex-running .tally-standby {
  display: none;
}

body.codex-running .tally-rec {
  display: inline;
}

body.codex-running .tally-dot {
  background: var(--rec);
  animation: tallyPulse 1.1s ease-in-out infinite;
}

@keyframes tallyPulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(255, 75, 60, 0.55); }
  55% { box-shadow: 0 0 0 6px rgba(255, 75, 60, 0); }
}

/* ---------- Buttons ---------- */

.icon-button {
  display: inline-grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border-radius: var(--radius-sm);
  border: 1px solid transparent;
  color: var(--muted);
  transition: color 0.15s ease, background 0.15s ease, border-color 0.15s ease;
}

.icon-button:hover {
  color: var(--ink);
  background: rgba(227, 169, 79, 0.08);
}

.icon-button.is-active {
  color: var(--ink);
}

.text-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  font-family: var(--mono);
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  color: var(--muted);
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-sm);
  padding: 8px 14px;
  background: transparent;
  transition: color 0.15s ease, border-color 0.15s ease, background 0.15s ease, transform 0.12s ease;
}

.text-button:hover:not(:disabled) {
  color: var(--ink);
  border-color: var(--gold);
  background: var(--gold-soft);
}

.text-button:active:not(:disabled) {
  transform: translateY(1px);
}

.text-button.compact {
  padding: 6px 11px;
  font-size: 10px;
}

.text-button.primary {
  background: linear-gradient(180deg, var(--gold-bright), var(--gold));
  border-color: var(--gold);
  color: #221708;
  font-weight: 600;
  box-shadow: 0 2px 14px rgba(227, 169, 79, 0.25);
}

.text-button.primary:hover:not(:disabled) {
  background: linear-gradient(180deg, #ffe2a2, var(--gold-bright));
  color: #221708;
}

.text-button.danger {
  color: var(--danger);
  border-color: rgba(255, 114, 99, 0.4);
}

.text-button.danger:hover:not(:disabled) {
  background: rgba(255, 114, 99, 0.1);
  border-color: var(--danger);
  color: #ffd9d3;
}

.text-button.return-live {
  border-color: rgba(255, 75, 60, 0.55);
  color: var(--rec);
  gap: 6px;
}

.text-button.return-live i {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--rec);
  animation: recBlink 1s steps(2, jump-none) infinite;
}

.text-button.return-live:hover:not(:disabled) {
  background: rgba(255, 75, 60, 0.12);
  border-color: var(--rec);
  color: #ffd9d3;
}

.text-button.return-live.is-board {
  border-color: rgba(227, 169, 79, 0.5);
  color: var(--gold-bright);
}

.text-button.return-live.is-board i {
  background: var(--gold-bright);
  animation: none;
}

.text-button.return-live.is-board:hover:not(:disabled) {
  background: var(--gold-soft);
  border-color: var(--gold);
  color: var(--gold-bright);
}

.text-button.is-live {
  border-color: var(--gold);
  color: var(--gold-bright);
  animation: liveNudge 2.4s ease-in-out infinite;
}

@keyframes liveNudge {
  0%, 100% { box-shadow: 0 0 0 0 rgba(227, 169, 79, 0.35); }
  50% { box-shadow: 0 0 0 5px rgba(227, 169, 79, 0); }
}

/* ---------- Workspace ---------- */

.workspace {
  grid-row: 2;
  grid-column: 2;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 0;
  min-height: 0;
  transition: grid-template-columns 0.26s cubic-bezier(0.5, 0, 0.2, 1);
}

body.workbench-open .workspace {
  grid-template-columns: minmax(0, 1fr) var(--wall-width);
}

/* ---------- Chat stage ---------- */

.chat-stage {
  position: relative;
  display: flex;
  flex-direction: column;
  min-height: 0;
  min-width: 0;
  overflow: hidden;
}

.stage-watermark {
  position: absolute;
  right: -4%;
  bottom: -12%;
  z-index: 0;
  font-family: var(--font-display);
  font-size: clamp(220px, 36vw, 460px);
  line-height: 0.8;
  color: rgba(227, 169, 79, 0.025);
  pointer-events: none;
  user-select: none;
}

body.has-conversation .stage-watermark {
  display: none;
}

/* Hero (empty state) */
.chat-hero {
  position: relative;
  z-index: 1;
  margin: auto;
  max-width: 640px;
  padding: 24px 32px 0;
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
  animation: riseIn 0.7s cubic-bezier(0.2, 0.7, 0.2, 1) both;
}

body.has-conversation .chat-hero {
  display: none;
}

.hero-mark {
  display: grid;
  place-items: center;
  width: 54px;
  height: 54px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-sm);
  background:
    repeating-linear-gradient(-45deg, rgba(227, 169, 79, 0.85) 0 8px, rgba(10, 8, 6, 0.9) 8px 16px) top / 100% 11px no-repeat,
    var(--surface-2);
  padding-top: 10px;
  color: var(--gold-bright);
  font-family: var(--mono);
  font-weight: 600;
  font-size: 16px;
  animation: riseIn 0.7s 0.05s cubic-bezier(0.2, 0.7, 0.2, 1) both;
}

.hero-kicker {
  font-size: 10px;
  color: var(--gold-deep);
  letter-spacing: 0.3em;
  animation: riseIn 0.7s 0.12s cubic-bezier(0.2, 0.7, 0.2, 1) both;
}

.chat-hero h2 {
  font-family: var(--font-display);
  font-weight: 400;
  font-size: clamp(38px, 4.6vw, 54px);
  line-height: 1.04;
  letter-spacing: 0.005em;
  animation: riseIn 0.7s 0.18s cubic-bezier(0.2, 0.7, 0.2, 1) both;
}

.chat-hero h2 em {
  font-style: italic;
  color: var(--gold-bright);
}

.chat-hero > p:last-of-type {
  max-width: 470px;
  font-size: 14px;
  color: var(--muted);
  line-height: 1.7;
  animation: riseIn 0.7s 0.26s cubic-bezier(0.2, 0.7, 0.2, 1) both;
}

@keyframes riseIn {
  from { opacity: 0; transform: translateY(14px); }
  to { opacity: 1; transform: translateY(0); }
}

/* Motion dock (running departments) */
.motion-dock {
  position: relative;
  z-index: 2;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: center;
  padding: 10px 24px 0;
}

.motion-chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--gold-bright);
  border: 1px solid rgba(227, 169, 79, 0.32);
  background: var(--gold-soft);
  border-radius: 999px;
  padding: 6px 12px;
  animation: riseIn 0.4s ease both;
}

.motion-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--gold);
  animation: tallyPulse 1.4s ease-in-out infinite;
}

/* ---------- Command thread ---------- */

.command-thread {
  position: relative;
  z-index: 1;
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 18px;
  padding: 26px clamp(18px, 4vw, 48px) 18px;
  scroll-behavior: smooth;
}

body:not(.has-conversation) .command-thread {
  flex: 0 0 auto;
}

.command-message {
  position: relative;
  display: grid;
  grid-template-columns: 36px minmax(0, 1fr) auto;
  gap: 12px;
  width: 100%;
  max-width: var(--chat-max);
  margin: 0 auto;
  animation: msgIn 0.34s cubic-bezier(0.2, 0.7, 0.2, 1) both;
}

@keyframes msgIn {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

.command-message time {
  font-family: var(--mono);
  font-size: 10px;
  color: var(--dim);
  padding-top: 8px;
  white-space: nowrap;
}

.message-avatar {
  display: grid;
  place-items: center;
  width: 36px;
  height: 36px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--line);
  background: var(--surface-2);
  font-family: var(--mono);
  font-size: 11px;
  font-weight: 600;
  color: var(--muted);
}

.command-message.from-user .message-avatar {
  background: var(--gold-soft);
  border-color: rgba(227, 169, 79, 0.4);
  color: var(--gold-bright);
}

.message-copy {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 7px;
  padding: 4px 0;
}

.message-title {
  display: flex;
  align-items: center;
  gap: 8px;
  font-family: var(--mono);
  font-size: 10.5px;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--muted);
}

.message-body {
  font-size: 14.5px;
  line-height: 1.65;
  color: var(--ink);
  overflow-wrap: break-word;
}

.message-body p {
  margin: 0 0 9px;
}

.message-body p:last-child {
  margin-bottom: 0;
}

/* Collapsed Codex process narration — the director sees the payoff; the working notes are one click away. */
.working-notes {
  margin: 0 0 10px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--surface-2);
}

.working-notes summary {
  cursor: pointer;
  list-style: none;
  padding: 7px 12px;
  font-size: 11px;
  font-family: "IBM Plex Mono", monospace;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
  user-select: none;
}

.working-notes summary::-webkit-details-marker {
  display: none;
}

.working-notes summary::before {
  content: "▸";
  display: inline-block;
  margin-right: 7px;
  color: var(--gold);
  transition: transform 0.15s ease;
}

.working-notes[open] summary::before {
  transform: rotate(90deg);
}

.working-notes summary:hover {
  color: var(--ink);
}

.working-notes-body {
  padding: 4px 12px 12px;
  border-top: 1px solid var(--line);
  font-size: 13.5px;
  color: var(--muted);
}

.command-message.from-user .message-body {
  background: linear-gradient(180deg, rgba(227, 169, 79, 0.1), rgba(227, 169, 79, 0.05));
  border: 1px solid rgba(227, 169, 79, 0.2);
  border-radius: var(--radius);
  padding: 11px 15px;
}

.command-message.is-activity .message-body {
  font-size: 13px;
  color: var(--muted);
  font-style: italic;
}

/* status-coded left edge for failed/blocked */
.command-message.status-failed .message-body,
.command-message.status-blocked .message-body {
  border-left: 2px solid var(--danger);
  padding-left: 13px;
}

/* Mini status chips */
.mini-status {
  display: inline-flex;
  align-items: center;
  font-size: 9px;
  font-weight: 600;
  letter-spacing: 0.12em;
  border-radius: 4px;
  padding: 3px 7px;
  border: 1px solid var(--line-strong);
  color: var(--muted);
  background: var(--surface-2);
  white-space: nowrap;
}

.mini-status.working {
  color: var(--gold-bright);
  border-color: rgba(227, 169, 79, 0.45);
  background: var(--gold-soft);
  animation: workingGlow 1.8s ease-in-out infinite;
}

@keyframes workingGlow {
  0%, 100% { box-shadow: 0 0 0 0 rgba(227, 169, 79, 0.25); }
  50% { box-shadow: 0 0 10px 0 rgba(227, 169, 79, 0.18); }
}

.mini-status.ready {
  color: var(--gold-bright);
  border-color: rgba(227, 169, 79, 0.45);
  background: var(--gold-soft);
}

.mini-status.approved,
.mini-status.done,
.mini-status.completed {
  color: var(--ok);
  border-color: rgba(164, 207, 114, 0.4);
  background: var(--ok-soft);
}

.mini-status.needs_director,
.mini-status.needs_input,
.mini-status.needs_review,
.mini-status.review {
  color: #ffc46b;
  border-color: rgba(255, 196, 107, 0.45);
  background: rgba(255, 196, 107, 0.1);
}

.mini-status.failed,
.mini-status.danger,
.mini-status.rejected {
  color: var(--danger);
  border-color: rgba(255, 114, 99, 0.45);
  background: rgba(255, 114, 99, 0.1);
}

.mini-status.blocked {
  color: var(--dim);
  border-style: dashed;
}

.mini-status.open {
  color: var(--info);
  border-color: rgba(146, 184, 216, 0.4);
  background: var(--info-soft);
}

/* Thinking cue */
.thinking-cue {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.06em;
  color: var(--gold-bright);
}

.thinking-dots {
  display: inline-flex;
  gap: 4px;
}

.thinking-dots i {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--gold);
  animation: thinkBlink 1.2s ease-in-out infinite;
}

.thinking-dots i:nth-child(2) { animation-delay: 0.18s; }
.thinking-dots i:nth-child(3) { animation-delay: 0.36s; }

@keyframes thinkBlink {
  0%, 100% { opacity: 0.25; transform: translateY(0); }
  40% { opacity: 1; transform: translateY(-2px); }
}

/* Activity details */
.activity-details {
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: rgba(13, 11, 9, 0.6);
  overflow: hidden;
}

.activity-details summary {
  cursor: pointer;
  list-style: none;
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--dim);
  padding: 8px 12px;
  transition: color 0.15s ease;
}

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

.activity-details summary::before {
  content: "▸ ";
  color: var(--gold-deep);
}

.activity-details[open] summary::before {
  content: "▾ ";
}

.activity-details summary:hover {
  color: var(--muted);
}

.activity-details ul {
  list-style: none;
  margin: 0;
  padding: 2px 12px 10px;
  display: flex;
  flex-direction: column;
  gap: 7px;
  max-height: 230px;
  overflow-y: auto;
}

.activity-details li {
  display: flex;
  flex-direction: column;
  gap: 1px;
  font-size: 12px;
  border-left: 2px solid var(--line-strong);
  padding-left: 10px;
}

.activity-details li.completed { border-left-color: var(--ok); }
.activity-details li.failed { border-left-color: var(--danger); }
.activity-details li.working,
.activity-details li.running { border-left-color: var(--gold); }

.activity-details li strong {
  font-size: 11.5px;
  font-weight: 600;
  color: var(--muted);
}

.activity-details li span {
  color: var(--dim);
}

.activity-details li small {
  font-family: var(--mono);
  font-size: 10px;
  color: var(--dim);
  overflow-wrap: anywhere;
}

/* Message artifacts */
.message-artifacts {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
}

.message-artifact-card {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 12px;
  text-align: left;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  background: var(--surface-2);
  padding: 10px 14px;
  max-width: 460px;
  transition: border-color 0.15s ease, background 0.15s ease;
}

.message-artifact-card:hover {
  border-color: var(--gold);
  background: var(--surface-3);
}

.message-artifact-card span strong {
  display: block;
  font-size: 13px;
}

.message-artifact-card span small {
  display: block;
  font-family: var(--mono);
  font-size: 10px;
  color: var(--dim);
  overflow-wrap: anywhere;
}

.message-artifact-card b {
  font-family: var(--mono);
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--gold-bright);
  white-space: nowrap;
}

.message-artifact-newtab {
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--dim);
}

.message-artifact-newtab:hover {
  color: var(--gold-bright);
}

.attachment-kind {
  display: inline-grid;
  place-items: center;
  min-width: 38px;
  height: 38px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--line-strong);
  background: var(--bg-2);
  font-size: 10px;
  font-weight: 600;
  color: var(--gold-deep);
}

/* Message attachments */
.message-attachments {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.attachment-card {
  display: flex;
  align-items: center;
  gap: 10px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--surface-2);
  padding: 7px 12px 7px 7px;
  max-width: 300px;
}

.attachment-preview {
  width: 52px;
  height: 38px;
  border-radius: 5px;
  overflow: hidden;
  display: grid;
  place-items: center;
  background: var(--bg-2);
  flex: none;
}

.attachment-preview img,
.attachment-preview video {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.attachment-card strong {
  display: block;
  font-size: 12px;
  max-width: 190px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.attachment-card > div:last-child span {
  font-family: var(--mono);
  font-size: 9.5px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--dim);
}

/* ---------- Workflow next-step (thread + cards) ---------- */

.workflow-thread-cue {
  display: grid;
  grid-template-columns: 36px minmax(0, 1fr);
  gap: 12px;
  width: 100%;
  max-width: var(--chat-max);
  margin: 0 auto;
  animation: msgIn 0.34s cubic-bezier(0.2, 0.7, 0.2, 1) both;
}

.workflow-thread-copy {
  display: flex;
  flex-direction: column;
  gap: 7px;
  min-width: 0;
}

.workflow-thread-panel {
  display: flex;
  flex-direction: column;
  gap: 7px;
  border: 1px solid var(--line-strong);
  border-left: 2px solid var(--gold);
  border-radius: var(--radius);
  background: var(--surface-2);
  padding: 14px 16px;
}

.workflow-thread-kicker {
  font-size: 9.5px;
  color: var(--gold-deep);
}

.workflow-thread-panel strong {
  font-family: var(--font-display);
  font-weight: 400;
  font-size: 19px;
}

.workflow-thread-panel p {
  font-size: 13px;
  color: var(--muted);
  line-height: 1.6;
}

.workflow-thread-panel small {
  font-size: 12px;
  color: var(--dim);
  font-style: italic;
}

.workflow-thread-panel .text-button {
  align-self: flex-start;
  margin-top: 4px;
}

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

.workflow-next-chips span {
  font-family: var(--mono);
  font-size: 9.5px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 4px 10px;
}

.workflow-next-card {
  display: flex;
  flex-direction: column;
  gap: 8px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  background: var(--surface-2);
  padding: 16px;
}

.workflow-next-card strong {
  font-family: var(--font-display);
  font-weight: 400;
  font-size: 19px;
}

.workflow-next-card p {
  font-size: 13px;
  color: var(--muted);
}

.workflow-next-card em {
  font-size: 12px;
  color: var(--dim);
}

.workflow-next-kicker {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.workflow-next-strip {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  border: 1px solid var(--line-strong);
  border-left: 2px solid var(--gold);
  border-radius: var(--radius);
  background: var(--surface-2);
  padding: 12px 14px;
}

.workflow-next-strip strong {
  display: block;
  font-size: 14px;
  margin-top: 4px;
}

.workflow-next-strip p {
  font-size: 12px;
  color: var(--muted);
  margin-top: 2px;
}

/* ---------- Approval dock (director gates) ---------- */

.approval-dock {
  position: relative;
  z-index: 3;
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 4px clamp(18px, 4vw, 48px) 4px;
  max-height: 46vh;
  min-height: 0;
  flex: none;
  overflow-y: auto;
  overscroll-behavior: contain;
}

.approval-card {
  flex: none;
}

.approval-card {
  position: relative;
  width: 100%;
  max-width: var(--chat-max);
  margin: 0 auto;
  border: 1px solid rgba(255, 196, 107, 0.34);
  border-radius: var(--radius);
  background: linear-gradient(180deg, rgba(36, 28, 16, 0.94), rgba(24, 19, 12, 0.94));
  padding: 16px 16px 14px;
  overflow: hidden;
  animation: msgIn 0.34s ease both;
}

/* clapperboard stripe */
.approval-card::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 7px;
  background: repeating-linear-gradient(-45deg, rgba(255, 196, 107, 0.9) 0 9px, rgba(12, 9, 6, 0.95) 9px 18px);
}

.approval-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin: 6px 0 8px;
}

.approval-head strong {
  display: block;
  font-family: var(--font-display);
  font-weight: 400;
  font-size: 19px;
}

.approval-head span {
  display: block;
  font-family: var(--mono);
  font-size: 10px;
  color: var(--dim);
  margin-top: 3px;
  overflow-wrap: anywhere;
}

.approval-copy {
  font-size: 13.5px;
  color: var(--ink);
  line-height: 1.6;
}

.approval-copy pre {
  font-family: var(--mono);
  font-size: 11.5px;
  background: rgba(8, 6, 4, 0.7);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 10px 12px;
  overflow-x: auto;
  white-space: pre-wrap;
  margin: 9px 0 0;
}

.approval-inputs {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-top: 12px;
}

.approval-inputs label {
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.approval-inputs label span {
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--gold-deep);
}

.approval-inputs label small {
  font-size: 12.5px;
  color: var(--muted);
}

.approval-inputs textarea,
.approval-inputs select {
  background: rgba(8, 6, 4, 0.6);
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-sm);
  color: var(--ink);
  font-size: 13px;
  padding: 9px 11px;
  resize: vertical;
}

.approval-inputs textarea:focus,
.approval-inputs select:focus {
  outline: none;
  border-color: var(--gold);
}

.approval-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 13px;
}

/* ---------- Queued composer ---------- */

.queued-composer {
  padding: 4px clamp(18px, 4vw, 48px) 0;
}

.queued-command-card {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 12px;
  width: 100%;
  max-width: var(--chat-max);
  margin: 0 auto;
  border: 1px dashed rgba(227, 169, 79, 0.4);
  border-radius: var(--radius);
  background: rgba(227, 169, 79, 0.05);
  padding: 10px 14px;
}

.queued-command-icon {
  display: grid;
  place-items: center;
  width: 30px;
  height: 30px;
  border-radius: var(--radius-sm);
  background: var(--gold-soft);
  color: var(--gold-bright);
  font-family: var(--mono);
  font-size: 12px;
  font-weight: 600;
}

.queued-command-copy {
  min-width: 0;
}

.queued-command-title {
  display: flex;
  align-items: baseline;
  gap: 8px;
}

.queued-command-title strong {
  font-size: 12.5px;
}

.queued-command-title span {
  font-family: var(--mono);
  font-size: 9.5px;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--gold-deep);
}

.queued-command-copy p {
  font-size: 12.5px;
  color: var(--muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.queued-command-copy small {
  font-family: var(--mono);
  font-size: 10px;
  color: var(--dim);
}

.queued-command-actions {
  display: flex;
  gap: 6px;
}

/* ---------- Composer ---------- */

.director-composer {
  position: relative;
  z-index: 3;
  padding: 12px clamp(18px, 4vw, 48px) 18px;
}

.drop-zone {
  position: relative;
  width: 100%;
  max-width: var(--chat-max);
  margin: 0 auto;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-lg);
  background: var(--surface-glass);
  backdrop-filter: blur(14px);
  box-shadow: var(--shadow-soft);
  transition: border-color 0.18s ease, box-shadow 0.18s ease;
}

.drop-zone:focus-within {
  border-color: var(--gold);
  box-shadow: 0 0 0 1px rgba(227, 169, 79, 0.35), var(--shadow-soft);
}

.drop-zone.drag-over {
  border-color: var(--gold-bright);
  border-style: dashed;
}

body.composer-queue-mode .drop-zone {
  border-color: rgba(227, 169, 79, 0.5);
  background: linear-gradient(180deg, rgba(30, 24, 15, 0.9), rgba(22, 18, 12, 0.9));
}

.file-input {
  display: none;
}

.composer-body {
  display: flex;
  align-items: flex-end;
  gap: 10px;
  padding: 10px 10px 10px 12px;
}

.attach-button {
  display: grid;
  place-items: center;
  width: 36px;
  height: 36px;
  flex: none;
  border-radius: 50%;
  border: 1px solid var(--line-strong);
  color: var(--muted);
  transition: color 0.15s ease, border-color 0.15s ease, background 0.15s ease;
}

.attach-button:hover {
  color: var(--gold-bright);
  border-color: var(--gold);
  background: var(--gold-soft);
}

.composer-input {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.attachment-tray {
  display: none;
  flex-wrap: wrap;
  gap: 8px;
}

.attachment-tray.has-files {
  display: flex;
}

#directorCommand {
  width: 100%;
  min-height: 28px;
  max-height: 180px;
  background: transparent;
  border: none;
  resize: none;
  color: var(--ink);
  font-size: 14.5px;
  line-height: 1.5;
  padding: 4px 0;
}

#directorCommand:focus {
  outline: none;
}

#directorCommand::placeholder {
  color: var(--dim);
}

.send-button {
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  flex: none;
  border-radius: var(--radius-sm);
  background: linear-gradient(180deg, var(--gold-bright), var(--gold));
  color: #221708;
  box-shadow: 0 2px 14px rgba(227, 169, 79, 0.3);
  transition: transform 0.12s ease, box-shadow 0.15s ease;
}

.send-button:hover:not(:disabled) {
  transform: translateY(-1px);
  box-shadow: 0 4px 18px rgba(227, 169, 79, 0.4);
}

.send-button:active:not(:disabled) {
  transform: translateY(0);
}

body.composer-queue-mode .send-button {
  background: var(--surface-3);
  color: var(--gold-bright);
  border: 1px solid rgba(227, 169, 79, 0.5);
  box-shadow: none;
}

/* ---------- Output wall (right panel) ---------- */

.output-wall {
  display: flex;
  flex-direction: column;
  gap: 14px;
  min-height: 0;
  min-width: 0;
  overflow-y: auto;
  border-left: 1px solid var(--line);
  background: linear-gradient(180deg, rgba(16, 13, 10, 0.96), rgba(11, 9, 7, 0.98));
  padding: 16px 16px 18px;
}

.output-wall[hidden] {
  display: none;
}

.latest-output {
  display: flex;
  flex-direction: column;
  gap: 10px;
  flex: none;
}

.output-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.output-pill {
  font-size: 10px;
  font-weight: 600;
  color: var(--gold-bright);
  border: 1px solid rgba(227, 169, 79, 0.36);
  background: var(--gold-soft);
  border-radius: 4px;
  padding: 5px 10px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 50%;
}

.output-toolbar-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.icon-actions {
  display: flex;
  align-items: center;
  gap: 4px;
}

/* The letterboxed frame */
.latest-preview {
  position: relative;
  min-height: 200px;
  max-height: 52vh;
  overflow-y: auto;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  background: #060504;
}

/* viewfinder corner brackets */
.latest-preview::after {
  content: "";
  position: absolute;
  inset: 8px;
  pointer-events: none;
  z-index: 4;
  opacity: 0.65;
  background:
    linear-gradient(var(--line-strong), var(--line-strong)) left 0 top 0 / 16px 1px,
    linear-gradient(var(--line-strong), var(--line-strong)) left 0 top 0 / 1px 16px,
    linear-gradient(var(--line-strong), var(--line-strong)) right 0 top 0 / 16px 1px,
    linear-gradient(var(--line-strong), var(--line-strong)) right 0 top 0 / 1px 16px,
    linear-gradient(var(--line-strong), var(--line-strong)) left 0 bottom 0 / 16px 1px,
    linear-gradient(var(--line-strong), var(--line-strong)) left 0 bottom 0 / 1px 16px,
    linear-gradient(var(--line-strong), var(--line-strong)) right 0 bottom 0 / 16px 1px,
    linear-gradient(var(--line-strong), var(--line-strong)) right 0 bottom 0 / 1px 16px;
  background-repeat: no-repeat;
}

.latest-preview.is-document-preview::after {
  display: none;
}

.latest-preview.is-image-preview {
  display: grid;
  place-items: center;
  overflow: hidden;
  padding: 18px 0;
}

.latest-preview.is-image-preview img {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
  display: block;
}

.latest-preview.is-empty-preview {
  display: grid;
  place-items: center;
}

/* transfer-in flash on the primary frame */
.latest-output.is-receiving-workbench-item .latest-preview {
  animation: receiveFlash 1s cubic-bezier(0.2, 0.7, 0.2, 1) both;
}

@keyframes receiveFlash {
  0% { box-shadow: 0 0 0 2px rgba(227, 169, 79, 0.9), 0 0 40px rgba(227, 169, 79, 0.25); }
  100% { box-shadow: 0 0 0 1px transparent, 0 0 0 transparent; }
}

.preview-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  text-align: center;
  padding: 38px 24px;
  color: var(--muted);
}

.preview-empty strong {
  font-family: var(--font-display);
  font-weight: 400;
  font-size: 19px;
  color: var(--ink);
}

.preview-empty span {
  font-size: 12.5px;
  color: var(--dim);
  max-width: 260px;
}

.empty-mark {
  display: grid;
  place-items: center;
  width: 40px;
  height: 40px;
  border: 1px dashed var(--line-strong);
  border-radius: var(--radius-sm);
  color: var(--dim);
  font-family: var(--mono);
  font-size: 12px;
  font-weight: 600;
}

/* mono caption rail under the frame */
.latest-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  font-size: 10px;
  color: var(--dim);
  border-top: 1px solid var(--line);
  padding-top: 9px;
}

.latest-meta span {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.latest-workflow-next {
  flex: none;
}

/* ---------- Active workbench (Codex working stage) ---------- */

.active-workbench {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 14px;
  padding: 16px 16px 18px;
  min-height: 300px;
  overflow: hidden;
}

.workbench-glow {
  position: absolute;
  inset: -40%;
  background: radial-gradient(45% 38% at 50% 32%, rgba(227, 169, 79, 0.12), transparent 60%);
  pointer-events: none;
  animation: glowDrift 7s ease-in-out infinite alternate;
}

@keyframes glowDrift {
  from { transform: translateY(-2%) scale(1); opacity: 0.8; }
  to { transform: translateY(3%) scale(1.06); opacity: 1; }
}

.workbench-status-line {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  position: relative;
}

.workbench-status-line small {
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--dim);
}

/* Universal cinematic stage: aperture + scanline in a framed slate */
.workbench-stage.stage-slate {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.stage-frame {
  position: relative;
  height: 170px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-sm);
  background:
    linear-gradient(0deg, rgba(6, 5, 4, 0.92) 0 12%, transparent 12% 88%, rgba(6, 5, 4, 0.92) 88%),
    radial-gradient(60% 70% at 50% 50%, rgba(227, 169, 79, 0.06), transparent 70%),
    #0a0807;
  overflow: hidden;
}

.frame-corner {
  position: absolute;
  width: 14px;
  height: 14px;
  border-color: var(--gold);
  border-style: solid;
  border-width: 0;
  opacity: 0.85;
  z-index: 3;
}

.frame-corner.tl { top: 7px; left: 7px; border-top-width: 1.5px; border-left-width: 1.5px; }
.frame-corner.tr { top: 7px; right: 7px; border-top-width: 1.5px; border-right-width: 1.5px; }
.frame-corner.bl { bottom: 7px; left: 7px; border-bottom-width: 1.5px; border-left-width: 1.5px; }
.frame-corner.br { bottom: 7px; right: 7px; border-bottom-width: 1.5px; border-right-width: 1.5px; }

.stage-aperture {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 0;
  height: 0;
}

.aperture-ring {
  position: absolute;
  left: 0;
  top: 0;
  animation: apertureSpin 9s linear infinite;
}

.aperture-ring i {
  position: absolute;
  left: -1px;
  top: -6px;
  width: 2px;
  height: 11px;
  border-radius: 1px;
  background: var(--gold);
  opacity: calc(0.25 + (var(--i) / 40));
  transform: rotate(calc(var(--i) * 15deg)) translateY(-52px);
}

@keyframes apertureSpin {
  to { transform: rotate(360deg); }
}

.aperture-core {
  position: absolute;
  left: -23px;
  top: -23px;
  width: 46px;
  height: 46px;
  border-radius: 50%;
  border: 1px solid rgba(227, 169, 79, 0.55);
  background: radial-gradient(circle, rgba(227, 169, 79, 0.22), rgba(227, 169, 79, 0.04) 70%);
  animation: corePulse 1.8s ease-in-out infinite;
}

@keyframes corePulse {
  0%, 100% { transform: scale(0.94); opacity: 0.75; }
  50% { transform: scale(1.05); opacity: 1; }
}

/* Developing frame: newest generated panel resolves out of the dark */
.stage-develop-img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  z-index: 1;
  animation: developFrame 3.2s cubic-bezier(0.3, 0, 0.2, 1) both;
}

@keyframes developFrame {
  0% { opacity: 0; filter: blur(26px) brightness(0.4) contrast(0.8); transform: scale(1.06); }
  30% { opacity: 1; }
  100% { opacity: 1; filter: blur(0) brightness(1) contrast(1); transform: scale(1); }
}

/* Look re-render: the target frame develops in place with the signature blur-up while the worker
   regenerates it, then refreshes automatically on land. Reuses the developFrame keyframe verbatim so
   it sharpens in identically to the "develop latest frame" feature; a slower curve reads as "cooking". */
.stage-rerender-img {
  animation: developFrame 3.6s cubic-bezier(0.3, 0, 0.2, 1) both;
}

.stage-rerender-caption {
  border-color: rgba(244, 205, 126, 0.5);
  box-shadow: 0 0 0 1px rgba(227, 169, 79, 0.14), 0 6px 22px rgba(6, 5, 3, 0.5);
}

.stage-rerender-caption span {
  color: var(--gold-bright);
}

.stage-rerender-caption strong {
  color: var(--gold-bright);
}

.stage-take-video {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  z-index: 1;
  animation: developFrame 1.6s ease both;
}

.stage-develop-caption {
  position: absolute;
  left: 10px;
  bottom: 9px;
  z-index: 3;
  display: flex;
  flex-direction: column;
  gap: 1px;
  background: rgba(8, 6, 4, 0.74);
  border: 1px solid rgba(227, 169, 79, 0.32);
  border-radius: 5px;
  padding: 5px 10px;
  backdrop-filter: blur(5px);
  animation: riseIn 0.5s 0.9s ease both;
}

.stage-develop-caption span {
  font-family: var(--mono);
  font-size: 8.5px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--gold-deep);
}

.stage-develop-caption strong {
  font-size: 11.5px;
  color: var(--ink);
}

/* Assembling board: approved frames tiling together during bookkeeping */
.stage-assemble {
  position: absolute;
  inset: 10px;
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 5px;
  align-content: center;
}

.stage-assemble-count {
  position: absolute;
  left: 50%;
  bottom: 8px;
  transform: translateX(-50%);
  z-index: 2;
  font-family: var(--mono);
  font-size: 9px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--gold-bright);
  background: rgba(6, 5, 3, 0.7);
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  padding: 2px 9px;
  pointer-events: none;
}

.stage-assemble-tile {
  margin: 0;
  border: 1px solid var(--line);
  border-radius: 4px;
  overflow: hidden;
  background: #060504;
  animation: tileAssemble 5.2s ease-in-out infinite;
  animation-delay: calc(var(--i) * 0.45s);
  opacity: 0.35;
}

.stage-assemble-tile img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

@keyframes tileAssemble {
  0%, 100% { opacity: 0.3; transform: translateY(2px); border-color: var(--line); }
  18%, 55% { opacity: 1; transform: translateY(0); border-color: rgba(227, 169, 79, 0.55); }
  75% { opacity: 0.55; }
}

.project-file-video {
  width: 100%;
  border-radius: var(--radius-sm);
  border: 1px solid var(--line);
  display: block;
  background: #000;
}

.stage-scanline {
  position: absolute;
  left: 0;
  right: 0;
  top: 0;
  height: 36px;
  background: linear-gradient(180deg, transparent, rgba(227, 169, 79, 0.07) 55%, rgba(227, 169, 79, 0.16));
  border-bottom: 1px solid rgba(227, 169, 79, 0.32);
  animation: scanSweep 3.4s cubic-bezier(0.4, 0, 0.4, 1) infinite;
  z-index: 2;
}

@keyframes scanSweep {
  0% { transform: translateY(-40px); opacity: 0; }
  12% { opacity: 1; }
  88% { opacity: 1; }
  100% { transform: translateY(176px); opacity: 0; }
}

.stage-readout {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

/* Live reel: frames landed in the active run */
.live-reel {
  display: flex;
  gap: 5px;
  overflow-x: auto;
  padding: 2px 1px 4px;
}

.live-reel-tick {
  position: relative;
  flex: none;
  width: 52px;
  aspect-ratio: 16 / 9;
  border: 1px solid var(--line);
  border-radius: 4px;
  overflow: hidden;
  background: #060504;
  opacity: 0.62;
  transition: opacity 0.14s ease, border-color 0.14s ease, transform 0.14s ease;
}

.live-reel-tick:hover {
  opacity: 1;
  transform: translateY(-2px);
}

.live-reel-tick img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.live-reel-tick.is-current {
  opacity: 1;
  border-color: var(--gold-bright);
  box-shadow: 0 0 0 1px rgba(227, 169, 79, 0.4);
}

.live-reel-tick.is-latest::after {
  content: "";
  position: absolute;
  top: 3px;
  right: 3px;
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--rec);
  animation: recBlink 1s steps(2, jump-none) infinite;
}

.stage-tc {
  font-size: 10px;
  color: var(--muted);
}

.stage-rec {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 10px;
  font-weight: 600;
  color: var(--rec);
}

.stage-rec i {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--rec);
  animation: recBlink 1s steps(2, jump-none) infinite;
}

@keyframes recBlink {
  50% { opacity: 0.2; }
}

.workbench-copy {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.workbench-copy strong {
  font-family: var(--font-display);
  font-weight: 400;
  font-size: 21px;
}

.workbench-copy p {
  font-size: 13px;
  color: var(--muted);
  line-height: 1.6;
}

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

.workbench-chips span {
  font-family: var(--mono);
  font-size: 9.5px;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  color: var(--gold-bright);
  border: 1px solid rgba(227, 169, 79, 0.3);
  border-radius: 999px;
  padding: 4px 10px;
  animation: riseIn 0.4s both;
  animation-delay: var(--delay, 0ms);
}

.workbench-log {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 5px;
  border-top: 1px solid var(--line);
  padding-top: 10px;
}

.workbench-log span {
  font-family: var(--mono);
  font-size: 10.5px;
  color: var(--dim);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.workbench-log span:first-child {
  color: var(--muted);
}

/* Orchestra rail */
.orchestra-rail {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 7px;
}

.orchestra-dept {
  display: grid;
  grid-template-columns: auto auto minmax(0, 1fr);
  align-items: baseline;
  gap: 9px;
  font-size: 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 8px 11px;
  background: rgba(13, 11, 9, 0.55);
}

.orchestra-dept span {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--dim);
  align-self: center;
}

.orchestra-dept.active span {
  background: var(--gold);
  animation: tallyPulse 1.3s ease-in-out infinite;
}

.orchestra-dept.queued span {
  background: var(--info);
}

.orchestra-dept.needs-director span {
  background: #ffc46b;
}

.orchestra-dept strong {
  font-size: 12px;
  font-weight: 600;
}

.orchestra-dept small {
  font-family: var(--mono);
  font-size: 10px;
  color: var(--dim);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* ---------- Document / file previews in the frame ---------- */

.file-back-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  text-align: left;
  margin: 12px 16px 0;
  width: calc(100% - 32px);
  padding: 8px 12px;
  border: 1px solid rgba(227, 169, 79, 0.5);
  border-radius: 9px;
  background: var(--gold-soft);
  color: var(--gold-bright);
  cursor: pointer;
  transition: border-color 140ms ease, background 140ms ease;
}

.file-back-bar:hover {
  border-color: var(--gold);
  background: rgba(227, 169, 79, 0.22);
}

.file-back-arrow {
  font-size: 13px;
  line-height: 1;
}

.file-back-bar strong {
  font-family: var(--mono);
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.file-back-bar kbd {
  margin-left: auto;
  font-family: var(--mono);
  font-size: 9px;
  color: var(--muted);
  border: 1px solid var(--line-strong);
  border-radius: 4px;
  padding: 1px 5px;
}

.review-document-preview {
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 16px;
}

.review-document-preview header {
  display: flex;
  align-items: flex-start;
  flex-wrap: wrap;
  gap: 10px;
}

.review-doc-actions {
  display: flex;
  align-items: center;
  gap: 7px;
  flex: none;
  width: 100%;
  justify-content: flex-end;
  order: 10;
}

.review-document-preview header > div {
  flex: 1 1 220px;
  min-width: 0;
}

.review-document-preview header strong {
  display: block;
  font-family: var(--font-display);
  font-weight: 400;
  font-size: 19px;
  line-height: 1.2;
}

.review-document-preview header small {
  display: block;
  font-family: var(--mono);
  font-size: 10px;
  color: var(--dim);
  margin-top: 3px;
  overflow-wrap: anywhere;
}

.review-document-note {
  font-size: 12.5px;
  color: var(--muted);
  border-left: 2px solid var(--gold);
  background: var(--gold-soft);
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  padding: 9px 12px;
  line-height: 1.55;
}

.preview-status-stack {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.workbench-transfer-cue {
  display: flex;
  align-items: baseline;
  gap: 10px;
  border: 1px solid rgba(227, 169, 79, 0.5);
  background: var(--gold-soft);
  border-radius: var(--radius-sm);
  padding: 8px 12px;
  animation: transferCue 1.1s ease both;
}

.workbench-transfer-cue span {
  font-family: var(--mono);
  font-size: 9.5px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--gold-deep);
  white-space: nowrap;
}

.workbench-transfer-cue strong {
  font-size: 12.5px;
  color: var(--gold-bright);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

@keyframes transferCue {
  0% { opacity: 0; transform: translateY(-6px) scale(0.98); }
  18% { opacity: 1; transform: translateY(0) scale(1); }
  100% { opacity: 1; }
}

.project-file-image {
  width: 100%;
  border-radius: var(--radius-sm);
  border: 1px solid var(--line);
  display: block;
}

.project-file-body {
  font-family: var(--mono);
  font-size: 11.5px;
  line-height: 1.6;
  color: var(--muted);
  background: rgba(8, 6, 4, 0.6);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 12px 14px;
  margin: 0;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.project-file-frame-wrap {
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-sm);
  overflow: hidden;
  background: #fff;
}

.project-file-frame {
  display: block;
  width: 100%;
  height: 46vh;
  border: none;
  background: #fff;
}

.project-file-actions {
  display: flex;
  justify-content: flex-end;
}

.project-file-actions a {
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
}

.project-file-actions a:hover {
  color: var(--gold-bright);
}

.markdown-preview-wrap {
  display: flex;
  flex-direction: column;
  gap: 0;
}

.preview-boundary {
  display: flex;
  justify-content: center;
  border-top: 1px dashed var(--line-strong);
  margin-top: 14px;
  padding-top: 10px;
}

.preview-boundary span {
  font-family: var(--mono);
  font-size: 9.5px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--dim);
}

.preview-boundary.is-truncated span {
  color: #ffc46b;
}

/* ---------- Markdown typography ---------- */

.markdown-preview {
  font-size: 13.5px;
  line-height: 1.7;
  color: var(--ink);
}

.markdown-preview h1,
.markdown-preview h2 {
  font-family: var(--font-display);
  font-weight: 400;
  line-height: 1.15;
  margin: 18px 0 8px;
}

.markdown-preview h1 { font-size: 24px; }
.markdown-preview h2 { font-size: 20px; }

.markdown-preview h3,
.markdown-preview h4 {
  font-size: 14px;
  font-weight: 600;
  letter-spacing: 0.02em;
  margin: 16px 0 6px;
  color: var(--gold-bright);
}

.markdown-preview h1:first-child,
.markdown-preview h2:first-child,
.markdown-preview h3:first-child {
  margin-top: 0;
}

.markdown-preview p {
  margin: 0 0 10px;
}

.markdown-preview ul,
.markdown-preview ol {
  margin: 0 0 10px;
  padding-left: 22px;
}

.markdown-preview li {
  margin-bottom: 4px;
}

.markdown-preview li::marker {
  color: var(--gold-deep);
}

.markdown-preview code {
  font-family: var(--mono);
  font-size: 0.88em;
  background: rgba(227, 169, 79, 0.1);
  border-radius: 4px;
  padding: 1px 5px;
  color: var(--gold-bright);
}

.markdown-code-block {
  font-family: var(--mono);
  font-size: 11.5px;
  line-height: 1.6;
  background: rgba(8, 6, 4, 0.7);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 12px 14px;
  overflow-x: auto;
  margin: 0 0 12px;
  white-space: pre;
}

.markdown-code-block code {
  background: none;
  padding: 0;
  color: var(--muted);
}

.markdown-table-wrap {
  overflow-x: auto;
  margin: 0 0 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
}

.markdown-table-wrap table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12.5px;
}

.markdown-table-wrap th {
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  text-align: left;
  color: var(--gold-deep);
  background: rgba(227, 169, 79, 0.06);
  padding: 8px 12px;
  border-bottom: 1px solid var(--line-strong);
}

.markdown-table-wrap td {
  padding: 8px 12px;
  border-bottom: 1px solid var(--line);
  color: var(--muted);
  vertical-align: top;
}

.markdown-table-wrap tr:last-child td {
  border-bottom: none;
}

.message-markdown {
  font-size: 14px;
}

/* ---------- Director choice comparison ---------- */

.director-choice-comparison {
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 16px;
}

.director-choice-head {
  display: flex;
  align-items: flex-start;
  gap: 10px;
}

.director-choice-head strong {
  display: block;
  font-family: var(--font-display);
  font-weight: 400;
  font-size: 19px;
}

.director-choice-head small {
  display: block;
  font-family: var(--mono);
  font-size: 10px;
  color: var(--dim);
  margin-top: 2px;
  overflow-wrap: anywhere;
}

.director-choice-note {
  font-size: 12.5px;
  color: var(--muted);
  border-left: 2px solid #ffc46b;
  padding-left: 11px;
}

.director-choice-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 12px;
}

.director-choice-card {
  display: flex;
  flex-direction: column;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  overflow: hidden;
  background: var(--surface-2);
  transition: border-color 0.15s ease, transform 0.15s ease;
}

.director-choice-card:hover {
  border-color: var(--gold);
  transform: translateY(-2px);
}

.director-choice-card.primary {
  border-color: rgba(227, 169, 79, 0.5);
}

.director-choice-image {
  display: block;
  aspect-ratio: 16 / 9;
  background: #060504;
}

.director-choice-image img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.director-choice-copy {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 10px 12px;
}

.director-choice-copy span {
  font-family: var(--mono);
  font-size: 9.5px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--gold-deep);
}

.director-choice-copy strong {
  font-size: 13px;
}

.director-choice-copy small {
  font-family: var(--mono);
  font-size: 9.5px;
  color: var(--dim);
  overflow-wrap: anywhere;
}

.director-choice-options {
  border: 1px dashed rgba(255, 196, 107, 0.4);
  border-radius: var(--radius-sm);
  background: rgba(255, 196, 107, 0.05);
  padding: 12px 14px;
  font-size: 13px;
}

.director-choice-options strong {
  font-size: 13px;
}

.director-choice-options ol {
  margin: 8px 0 0;
  padding-left: 20px;
  color: var(--muted);
}

.director-choice-options li {
  margin-bottom: 4px;
}

/* ---------- Primary workbench dock (connected items) ---------- */

.primary-workbench-dock {
  display: flex;
  flex-direction: column;
  gap: 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  padding: 13px 14px;
  margin-top: 12px;
}

.primary-workbench-action {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.primary-workbench-action strong {
  display: block;
  font-size: 14px;
  margin-top: 5px;
}

.primary-workbench-action p {
  font-size: 12px;
  color: var(--muted);
  margin-top: 2px;
}

.primary-workbench-related {
  display: flex;
  flex-direction: column;
  gap: 9px;
}

.primary-workbench-related-head,
.workbench-section-title {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
}

.primary-workbench-related-head span,
.workbench-section-title span {
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--dim);
}

.primary-workbench-related-head small,
.workbench-section-title small {
  font-family: var(--mono);
  font-size: 9.5px;
  color: var(--dim);
}

.primary-workbench-chip-grid,
.workbench-artifact-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 8px;
}

.workbench-artifact-chip {
  display: flex;
  flex-direction: column;
  gap: 2px;
  text-align: left;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--surface-2);
  padding: 9px 11px;
  min-width: 0;
  transition: border-color 0.15s ease, background 0.15s ease, transform 0.15s ease;
}

.workbench-artifact-chip:hover {
  border-color: var(--gold);
  background: var(--surface-3);
  transform: translateY(-1px);
}

.workbench-artifact-chip span {
  font-family: var(--mono);
  font-size: 8.5px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--gold-deep);
}

.workbench-artifact-chip strong {
  font-size: 12px;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* chip flying to the preview */
.workbench-artifact-chip.is-moving-to-preview,
.artifact-chip.is-moving-to-preview {
  border-color: var(--gold-bright);
  animation: chipDuck 0.9s cubic-bezier(0.3, 0, 0.2, 1) both;
}

@keyframes chipDuck {
  0% { transform: translateY(0) scale(1); box-shadow: 0 0 0 0 rgba(227, 169, 79, 0.5); }
  35% { transform: translateY(-7px) scale(1.03); box-shadow: 0 8px 22px rgba(227, 169, 79, 0.28); }
  100% { transform: translateY(0) scale(1); box-shadow: 0 0 0 0 transparent; }
}

.workbench-artifact-chip.loading {
  opacity: 0.6;
}

/* ---------- Dynamic workbench tray / related files ---------- */

.dynamic-workbench-tray {
  display: flex;
  flex-direction: column;
  gap: 13px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  padding: 14px;
  grid-column: 1 / -1;
}

.workbench-tray-head strong {
  display: block;
  font-family: var(--font-display);
  font-weight: 400;
  font-size: 18px;
  margin-top: 6px;
}

.workbench-tray-head p {
  font-size: 12px;
  color: var(--dim);
  margin-top: 2px;
}

.workbench-primary-card {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 11px;
  border: 1px solid rgba(227, 169, 79, 0.3);
  border-radius: var(--radius-sm);
  background: var(--gold-soft);
  padding: 10px 12px;
}

.workbench-primary-card strong {
  display: block;
  font-size: 13px;
}

.workbench-primary-card small {
  display: block;
  font-family: var(--mono);
  font-size: 9.5px;
  color: var(--dim);
  overflow-wrap: anywhere;
}

.workbench-primary-card em {
  font-style: normal;
  font-family: var(--mono);
  font-size: 9.5px;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--gold-deep);
  white-space: nowrap;
}

.workbench-action-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  border: 1px solid var(--line-strong);
  border-left: 2px solid var(--gold);
  border-radius: var(--radius-sm);
  background: var(--surface-2);
  padding: 11px 13px;
}

.workbench-action-card strong {
  display: block;
  font-size: 13.5px;
  margin-top: 4px;
}

.workbench-action-card p {
  font-size: 12px;
  color: var(--muted);
  margin-top: 2px;
}

.workbench-related-files {
  display: flex;
  flex-direction: column;
  gap: 9px;
}

.workbench-fold {
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: rgba(13, 11, 9, 0.5);
  overflow: hidden;
}

.workbench-fold summary {
  cursor: pointer;
  list-style: none;
  display: flex;
  align-items: baseline;
  gap: 8px;
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--dim);
  padding: 9px 12px;
  transition: color 0.15s ease;
}

.workbench-fold summary::-webkit-details-marker {
  display: none;
}

.workbench-fold summary::before {
  content: "▸";
  color: var(--gold-deep);
}

.workbench-fold[open] summary::before {
  content: "▾";
}

.workbench-fold summary:hover {
  color: var(--muted);
}

.workbench-fold summary small {
  font-size: 9px;
  color: var(--gold-deep);
}

.workbench-fold > :not(summary) {
  padding: 0 12px 12px;
}

.workbench-fold .workbench-progress-strip {
  border-top: none;
  padding-top: 0;
}

.workbench-progress-strip {
  display: flex;
  flex-direction: column;
  gap: 8px;
  border-top: 1px solid var(--line);
  padding-top: 11px;
}

.workbench-progress-strip > div:first-child {
  display: flex;
  align-items: center;
  gap: 10px;
}

.workbench-progress-strip strong {
  font-family: var(--mono);
  font-size: 10.5px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted);
}

.workbench-progress-steps {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.workbench-progress-steps span {
  font-family: var(--mono);
  font-size: 10px;
  color: var(--dim);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.workbench-progress-steps span.done { color: var(--ok); }
.workbench-progress-steps span.is-next { color: var(--gold-bright); }
.workbench-progress-steps span.needs_director { color: #ffc46b; }

/* ---------- Board strip (living filmstrip) ---------- */

.board-strip {
  display: flex;
  flex-direction: column;
  gap: 8px;
  flex: none;
  border-top: 1px solid var(--line);
  padding-top: 12px;
}

.board-strip-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
}

.board-strip-head span {
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--dim);
}

.board-strip-head small {
  font-family: var(--mono);
  font-size: 9.5px;
  color: var(--dim);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.board-strip-rail {
  display: flex;
  gap: 5px;
  overflow-x: auto;
  padding: 2px 1px 5px;
}

.board-tick {
  position: relative;
  flex: none;
  width: 56px;
  aspect-ratio: 16 / 9;
  border: 1px solid var(--line);
  border-bottom-width: 2px;
  border-radius: 4px;
  overflow: hidden;
  background: #060504;
  display: grid;
  place-items: center;
  opacity: 0.72;
  transition: opacity 0.14s ease, border-color 0.14s ease, transform 0.14s ease;
}

.board-tick:hover {
  opacity: 1;
  transform: translateY(-2px);
}

.board-tick img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.board-tick span {
  font-family: var(--mono);
  font-size: 9px;
  color: var(--dim);
}

.board-tick.approved,
.board-tick.accepted_with_notes {
  border-bottom-color: var(--ok);
}

.board-tick.candidate {
  border-bottom-color: var(--gold);
  border-style: solid solid dashed;
}

.board-tick.rejected {
  border-bottom-color: var(--danger);
}

.board-tick.is-open {
  border-style: dashed;
  opacity: 0.45;
}

.board-tick.is-current {
  opacity: 1;
  border-color: var(--gold-bright);
  box-shadow: 0 0 0 1px rgba(227, 169, 79, 0.45);
}

.board-tick.has-look {
  opacity: 0.92;
}

.board-tick.has-look::after,
.range-tick.has-look span::after {
  content: "";
  position: absolute;
  top: 3px;
  right: 3px;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--gold-bright);
  box-shadow: 0 0 6px rgba(227, 169, 79, 0.7);
}

.range-tick.has-look span::after {
  position: static;
  display: inline-block;
  margin-left: 4px;
  box-shadow: none;
}

.panel-slot.has-look {
  border-color: rgba(227, 169, 79, 0.5);
}

.panel-slot.has-look .slot-footer small {
  color: var(--gold-bright);
}

/* ---------- Sequence panel ---------- */

.sequence-panel {
  display: flex;
  flex-direction: column;
  gap: 12px;
  flex: none;
}

.sequence-panel[hidden] {
  display: none;
}

.sequence-head {
  position: sticky;
  top: -17px;
  z-index: 6;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  border-top: 1px solid var(--line);
  padding: 14px 0 10px;
  background: linear-gradient(180deg, rgba(14, 11, 9, 0.97) 78%, rgba(14, 11, 9, 0));
}

.sequence-head h2 {
  font-family: var(--font-display);
  font-weight: 400;
  font-size: 21px;
}

.sequence-head p {
  font-size: 12px;
  color: var(--dim);
  margin-top: 3px;
  line-height: 1.55;
}

.panel-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(170px, 1fr));
  grid-auto-rows: max-content;
  gap: 12px;
  align-content: start;
  padding-bottom: 6px;
}

/* Shot cards */
.panel-slot {
  position: relative;
  display: flex;
  flex-direction: column;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--surface);
  overflow: hidden;
  text-align: left;
  transition: border-color 0.16s ease, transform 0.16s ease, box-shadow 0.16s ease;
}

.panel-slot:hover {
  border-color: var(--gold);
  transform: translateY(-2px);
  box-shadow: 0 10px 26px rgba(0, 0, 0, 0.4);
}

.panel-slot img {
  width: 100%;
  aspect-ratio: 16 / 9;
  flex: none;
  object-fit: cover;
  display: block;
}

.panel-slot.empty-slot {
  border-style: dashed;
  background: rgba(16, 13, 10, 0.5);
}

.panel-number {
  position: absolute;
  top: 7px;
  left: 7px;
  z-index: 2;
  font-size: 9.5px;
  font-weight: 600;
  color: var(--gold-bright);
  background: rgba(8, 6, 4, 0.78);
  border: 1px solid rgba(227, 169, 79, 0.35);
  border-radius: 4px;
  padding: 2px 6px;
  backdrop-filter: blur(4px);
}

.slot-placeholder {
  width: 100%;
  aspect-ratio: 16 / 9;
  min-height: 84px;
  flex: none;
  display: grid;
  place-items: center;
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--dim);
}

.slot-footer {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px;
  padding: 7px 10px;
  border-top: 1px solid var(--line);
  background: rgba(10, 8, 6, 0.85);
}

.slot-footer strong {
  font-size: 11.5px;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.slot-footer small {
  font-family: var(--mono);
  font-size: 8.5px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--dim);
  white-space: nowrap;
}

/* status edges */
.panel-slot.approved {
  border-color: rgba(164, 207, 114, 0.45);
}

.panel-slot.approved .slot-footer small {
  color: var(--ok);
}

.panel-slot.accepted_with_notes {
  border-color: rgba(164, 207, 114, 0.3);
}

.panel-slot.accepted_with_notes .slot-footer small {
  color: var(--ok);
}

.panel-slot.candidate {
  border-color: rgba(227, 169, 79, 0.5);
  border-style: dashed;
}

.panel-slot.candidate .slot-footer small {
  color: var(--gold-bright);
}

.panel-slot.rejected {
  border-color: rgba(255, 114, 99, 0.4);
}

.panel-slot.rejected .slot-footer small {
  color: var(--danger);
}

.panel-slot.selected {
  border-color: var(--gold-bright);
  box-shadow: 0 0 0 1px rgba(227, 169, 79, 0.5), 0 10px 26px rgba(0, 0, 0, 0.4);
}

/* Sequence empty state */
.storyboard-empty {
  grid-column: 1 / -1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 9px;
  text-align: center;
  border: 1px dashed var(--line-strong);
  border-radius: var(--radius);
  padding: 26px 18px;
  color: var(--muted);
}

.storyboard-empty strong {
  font-family: var(--font-display);
  font-weight: 400;
  font-size: 18px;
  color: var(--ink);
}

.storyboard-empty span {
  font-size: 12.5px;
  color: var(--dim);
  max-width: 300px;
}

.storyboard-empty.full {
  padding: 60px 24px;
}

/* ---------- Workflow map ---------- */

.workflow-map {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
  gap: 8px;
  width: 100%;
}

.workflow-map.rail {
  grid-template-columns: 1fr;
  max-width: 320px;
  margin-top: 8px;
}

.workflow-step {
  display: flex;
  flex-direction: column;
  gap: 3px;
  text-align: left;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--surface-2);
  padding: 9px 11px;
  position: relative;
}

.workflow-map.rail .workflow-step {
  flex-direction: row;
  align-items: baseline;
  gap: 9px;
  padding: 7px 11px;
}

.workflow-step span {
  font-family: var(--mono);
  font-size: 9px;
  letter-spacing: 0.1em;
  color: var(--dim);
}

.workflow-step strong {
  font-size: 11.5px;
  font-weight: 600;
  color: var(--muted);
}

.workflow-step small {
  font-size: 10.5px;
  color: var(--dim);
  line-height: 1.45;
}

.workflow-step.done {
  border-color: rgba(164, 207, 114, 0.3);
}

.workflow-step.done span,
.workflow-step.done strong {
  color: var(--ok);
}

.workflow-step.current {
  border-color: rgba(227, 169, 79, 0.55);
  background: var(--gold-soft);
}

.workflow-step.current span,
.workflow-step.current strong {
  color: var(--gold-bright);
}

.workflow-step.working {
  border-color: rgba(227, 169, 79, 0.55);
  background: var(--gold-soft);
  animation: workingGlow 1.8s ease-in-out infinite;
}

.workflow-step.working strong {
  color: var(--gold-bright);
}

/* ---------- Production action registry ---------- */

.production-action-registry {
  display: flex;
  flex-direction: column;
  gap: 13px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  padding: 15px;
  grid-column: 1 / -1;
}

.production-action-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.production-action-head strong {
  display: block;
  font-family: var(--font-display);
  font-weight: 400;
  font-size: 19px;
  margin-top: 6px;
}

.production-action-head p {
  font-size: 12px;
  color: var(--dim);
  margin-top: 3px;
  max-width: 420px;
  line-height: 1.55;
}

.production-action-counts {
  display: flex;
  gap: 6px;
  flex: none;
}

.production-action-counts span {
  font-family: var(--mono);
  font-size: 9.5px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 4px 9px;
  white-space: nowrap;
}

.production-action-list {
  display: flex;
  flex-direction: column;
  gap: 9px;
}

.production-action-row {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  gap: 13px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--surface-2);
  padding: 12px 13px;
  transition: border-color 0.15s ease;
}

.production-action-row.is-next {
  border-color: rgba(227, 169, 79, 0.55);
  background: linear-gradient(180deg, rgba(227, 169, 79, 0.08), rgba(227, 169, 79, 0.03));
}

.production-action-row.done {
  opacity: 0.66;
}

.production-action-row.blocked {
  opacity: 0.5;
}

.production-action-index {
  font-size: 11px;
  color: var(--dim);
  padding-top: 2px;
}

.production-action-row.is-next .production-action-index {
  color: var(--gold-bright);
}

.production-action-copy {
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-width: 0;
}

.production-action-titleline {
  display: flex;
  align-items: center;
  gap: 9px;
  flex-wrap: wrap;
}

.production-action-titleline strong {
  font-size: 13.5px;
}

.production-action-copy > p {
  font-size: 12px;
  color: var(--muted);
  line-height: 1.55;
}

.production-action-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
}

.production-action-chips span {
  font-family: var(--mono);
  font-size: 8.5px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--dim);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 3px 8px;
}

.production-action-artifacts {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 2px;
}

.artifact-chip {
  font-family: var(--mono);
  font-size: 9.5px;
  letter-spacing: 0.04em;
  color: var(--muted);
  border: 1px solid var(--line-strong);
  border-radius: 4px;
  background: var(--bg-2);
  padding: 4px 8px;
  transition: color 0.15s ease, border-color 0.15s ease;
  max-width: 100%;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.artifact-chip:hover {
  color: var(--gold-bright);
  border-color: var(--gold);
}

.production-action-controls {
  display: flex;
  align-items: flex-start;
}

/* ---------- Workflow surface / file inspection cards ---------- */

.workflow-surface-card,
.review-artifact-card {
  display: flex;
  flex-direction: column;
  gap: 10px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  padding: 14px;
}

.review-artifact-head {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.review-artifact-head strong {
  font-family: var(--font-display);
  font-weight: 400;
  font-size: 18px;
}

.review-artifact-head small {
  font-family: var(--mono);
  font-size: 10px;
  color: var(--dim);
  overflow-wrap: anywhere;
}

.file-inspection-card p {
  font-size: 12.5px;
  color: var(--muted);
}

.file-inspection-next {
  display: flex;
  flex-direction: column;
  gap: 2px;
  border-left: 2px solid var(--gold);
  padding-left: 11px;
}

.file-inspection-next span {
  font-family: var(--mono);
  font-size: 9px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--gold-deep);
}

.file-inspection-next strong {
  font-size: 13px;
}

.file-inspection-next small {
  font-size: 11.5px;
  color: var(--muted);
}

.file-inspection-actions {
  display: flex;
  align-items: center;
  gap: 9px;
}

.project-file-link {
  font-family: var(--mono);
  font-size: 11px;
  color: var(--gold-bright);
}

/* ---------- Full storyboard dialog ---------- */

dialog {
  border: none;
  padding: 0;
  background: transparent;
  color: inherit;
  max-width: none;
  max-height: none;
}

dialog::backdrop {
  background: rgba(5, 4, 3, 0.78);
  backdrop-filter: blur(10px);
}

.storyboard-dialog {
  width: min(1240px, calc(100vw - 48px));
  height: min(86vh, 980px);
  margin: auto;
  flex-direction: column;
  gap: 16px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-lg);
  background: linear-gradient(180deg, #14110d, #0c0a08);
  box-shadow: var(--shadow);
  padding: 22px 24px;
  overflow: hidden;
}

.storyboard-dialog[open] {
  display: flex;
}

.storyboard-dialog[open],
.project-dialog[open] {
  animation: dialogIn 0.3s cubic-bezier(0.2, 0.7, 0.2, 1) both;
}

@keyframes dialogIn {
  from { opacity: 0; transform: translateY(14px) scale(0.985); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

.dialog-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
}

.dialog-top h2 {
  font-family: var(--font-display);
  font-weight: 400;
  font-size: 26px;
}

.dialog-top p {
  font-family: var(--mono);
  font-size: 10.5px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--dim);
  margin-top: 4px;
}

.dialog-actions {
  display: flex;
  align-items: center;
  gap: 9px;
}

.full-storyboard-grid {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(230px, 1fr));
  grid-auto-rows: max-content;
  gap: 14px;
  align-content: start;
  padding-right: 4px;
}

.full-panel {
  display: flex;
  flex-direction: column;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  overflow: hidden;
  background: var(--surface);
}

.full-panel.is-candidate {
  border-style: dashed;
  border-color: rgba(227, 169, 79, 0.45);
}

.full-panel-image {
  position: relative;
  aspect-ratio: 16 / 9;
  display: grid;
  place-items: center;
  background: #060504;
}

.full-panel-image img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.full-panel-image > span {
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--dim);
}

.full-panel-flag {
  position: absolute;
  top: 7px;
  right: 7px;
  font-family: var(--mono);
  font-size: 8.5px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--gold-bright);
  background: rgba(8, 6, 4, 0.8);
  border: 1px solid rgba(227, 169, 79, 0.45);
  border-radius: 4px;
  padding: 3px 7px;
  backdrop-filter: blur(4px);
}

.full-panel-copy {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 9px 12px;
  border-top: 1px solid var(--line);
}

.full-panel-copy strong {
  font-size: 12.5px;
}

.full-panel-copy span {
  font-size: 11px;
  color: var(--dim);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* ---------- Range Builder ---------- */

.range-builder-dialog {
  width: min(880px, calc(100vw - 40px));
  max-height: 90vh;
  margin: auto;
  flex-direction: column;
  gap: 14px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-lg);
  background: linear-gradient(180deg, #14110d, #0b0907);
  box-shadow: var(--shadow);
  padding: 20px 22px;
  overflow: hidden;
}

.range-builder-dialog[open] {
  display: flex;
  animation: dialogIn 0.3s cubic-bezier(0.2, 0.7, 0.2, 1) both;
}

.range-builder-body {
  display: flex;
  flex-direction: column;
  gap: 14px;
  min-height: 0;
  overflow-y: auto;
  padding-right: 4px;
}

.range-builder-hint {
  font-size: 12.5px;
  color: var(--muted);
  line-height: 1.6;
  border-left: 2px solid var(--gold);
  background: var(--gold-soft);
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  padding: 9px 12px;
}

.range-strip {
  display: flex;
  gap: 6px;
  overflow-x: auto;
  padding: 3px 1px 6px;
}

.range-tick {
  position: relative;
  flex: none;
  width: 118px;
  aspect-ratio: 16 / 9;
  border: 1px solid var(--line);
  border-radius: 5px;
  overflow: hidden;
  background: #060504;
  opacity: 0.6;
  transition: opacity 0.14s ease, border-color 0.14s ease, transform 0.14s ease;
}

.range-tick:hover {
  opacity: 1;
  transform: translateY(-2px);
}

.range-tick img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.range-tick span {
  position: absolute;
  top: 4px;
  left: 4px;
  z-index: 2;
  font-family: var(--mono);
  font-size: 8.5px;
  color: var(--gold-bright);
  background: rgba(8, 6, 4, 0.78);
  border-radius: 3px;
  padding: 1px 5px;
}

.range-tick.in-span {
  opacity: 1;
  border-color: rgba(227, 169, 79, 0.55);
}

.range-tick.is-start,
.range-tick.is-end {
  border-color: var(--gold-bright);
  box-shadow: 0 0 0 1px rgba(227, 169, 79, 0.5);
}

.range-span-label {
  font-family: var(--mono);
  font-size: 10.5px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--gold-bright);
}

.range-warnings {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.range-warnings span {
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.04em;
  color: var(--rec);
  border-left: 2px solid var(--rec);
  background: rgba(255, 75, 60, 0.07);
  border-radius: 0 4px 4px 0;
  padding: 5px 9px;
}

.range-billing {
  margin-left: auto;
  color: var(--gold-deep) !important;
}

.range-form {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
  gap: 11px;
}

.range-form label {
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.range-form-wide {
  grid-column: 1 / -1;
}

.range-form span {
  font-family: var(--mono);
  font-size: 9.5px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--dim);
}

.range-form input,
.range-form select,
.range-form textarea {
  background: rgba(8, 6, 4, 0.6);
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-sm);
  color: var(--ink);
  font-size: 13px;
  padding: 8px 11px;
  resize: vertical;
}

.range-form textarea {
  font-family: var(--mono);
  font-size: 11.5px;
  line-height: 1.6;
}

.range-form input:focus,
.range-form select:focus,
.range-form textarea:focus {
  outline: none;
  border-color: var(--gold);
}

.range-builder-actions {
  display: flex;
  align-items: center;
  gap: 12px;
}

.range-builder-actions small {
  font-family: var(--mono);
  font-size: 10px;
  color: var(--dim);
}

.range-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  border-top: 1px solid var(--line);
  padding-top: 12px;
}

.range-row {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto auto;
  align-items: center;
  gap: 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--surface-2);
  padding: 10px 12px;
}

.range-row-strip {
  display: flex;
  gap: 3px;
  flex: none;
}

.range-row-strip img {
  width: 44px;
  aspect-ratio: 16 / 9;
  object-fit: cover;
  border-radius: 3px;
  border: 1px solid var(--line);
  display: block;
}

.range-row-copy strong {
  display: block;
  font-family: var(--mono);
  font-size: 12px;
}

.range-row-copy small {
  display: block;
  font-family: var(--mono);
  font-size: 10px;
  color: var(--dim);
  margin-top: 2px;
  overflow-wrap: anywhere;
}

.range-guardrails {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.range-guardrails label {
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.range-guardrails span {
  font-family: var(--mono);
  font-size: 9.5px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--dim);
}

.range-guardrails textarea {
  background: rgba(8, 6, 4, 0.6);
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-sm);
  color: var(--ink);
  font-family: var(--mono);
  font-size: 11.5px;
  line-height: 1.6;
  padding: 8px 11px;
  resize: vertical;
}

.range-guardrails textarea:focus {
  outline: none;
  border-color: var(--gold);
}

.sequence-head-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex: none;
}

/* ---------- Project dialog ---------- */

.project-dialog {
  width: min(440px, calc(100vw - 48px));
  margin: auto;
}

.project-dialog-card {
  display: flex;
  flex-direction: column;
  gap: 16px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-lg);
  background: linear-gradient(180deg, #14110d, #0c0a08);
  box-shadow: var(--shadow);
  padding: 22px;
}

.field-label {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.field-label span {
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--dim);
}

.field-label input {
  background: rgba(8, 6, 4, 0.6);
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-sm);
  color: var(--ink);
  font-size: 14px;
  padding: 10px 12px;
}

.field-label input:focus {
  outline: none;
  border-color: var(--gold);
}

.project-dialog-actions {
  display: flex;
  justify-content: space-between;
  gap: 10px;
}

.engine-option {
  display: flex;
  flex-direction: column;
  gap: 4px;
  text-align: left;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  background: var(--surface-2);
  padding: 14px 16px;
  transition: border-color 0.15s ease, background 0.15s ease, transform 0.12s ease;
}

.engine-option:hover {
  border-color: var(--gold);
  background: var(--surface-3);
  transform: translateY(-1px);
}

.engine-option strong {
  font-size: 14px;
  color: var(--gold-bright);
}

.engine-option span {
  font-size: 12px;
  color: var(--muted);
  line-height: 1.55;
}

.look-engine-body {
  display: flex;
  flex-direction: column;
  gap: 10px;
  max-height: min(58vh, 520px);
  overflow-y: auto;
}

.engine-option.compact {
  padding: 10px 14px;
  gap: 2px;
}

.engine-model-row {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 12px;
}

.engine-model-row em {
  font-style: normal;
  font-family: "IBM Plex Mono", monospace;
  font-size: 11px;
  color: var(--gold);
  white-space: nowrap;
}

.engine-back {
  align-self: flex-start;
}

.lane-toggle {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 10px 14px;
  border: 1px dashed var(--line-strong);
  border-radius: var(--radius);
  cursor: pointer;
  font-size: 12px;
  color: var(--muted);
  line-height: 1.5;
}

.lane-toggle:hover {
  border-color: var(--gold);
}

.lane-toggle input {
  margin-top: 2px;
  accent-color: var(--gold);
}

.lane-toggle strong {
  color: var(--gold-bright);
}

/* ---------- Project rail (thread-style) ---------- */

#projectSelect {
  display: none;
}

.rail-project-row {
  position: relative;
  display: flex;
  align-items: stretch;
}

.rail-project-row .rail-project {
  flex: 1;
  min-width: 0;
}

.rail-project-row .rail-project small em {
  font-style: normal;
  color: var(--line-strong);
}

.rail-project-row .rail-project-name {
  display: block;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.rail-project-menu {
  flex: none;
  width: 28px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--muted);
  opacity: 0;
  cursor: pointer;
  transition: opacity 0.15s ease, color 0.15s ease;
}

.rail-project-menu svg {
  width: 14px;
  height: 14px;
  stroke: currentColor;
  stroke-width: 2.4;
  fill: none;
  stroke-linecap: round;
}

.rail-project-row:hover .rail-project-menu,
.rail-project-row.selected .rail-project-menu {
  opacity: 1;
}

.rail-project-menu:hover {
  color: var(--gold-bright);
}

.rail-expand-toggle {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  width: 100%;
  margin-top: 6px;
  padding: 7px 10px;
  border: 1px dashed var(--line-strong);
  border-radius: 8px;
  background: transparent;
  color: var(--muted);
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  cursor: pointer;
  transition: border-color 0.15s ease, color 0.15s ease;
}

.rail-expand-toggle:hover {
  border-color: var(--gold);
  color: var(--gold-bright);
}

.rail-expand-toggle i {
  font-style: normal;
}

/* ---------- Reference intake stage ---------- */

.stage-ref-tray {
  position: absolute;
  inset: 14px;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(110px, 1fr));
  gap: 10px;
  align-content: start;
  overflow: hidden;
}

.stage-ref-card {
  position: relative;
  margin: 0;
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  overflow: hidden;
  background: var(--surface-2);
  opacity: 0;
  animation: riseIn 0.5s ease forwards;
  animation-delay: calc(var(--i) * 90ms);
}

.stage-ref-card img {
  display: block;
  width: 100%;
  aspect-ratio: 4 / 3;
  object-fit: cover;
}

.stage-ref-card figcaption {
  display: flex;
  flex-direction: column;
  gap: 1px;
  padding: 5px 8px;
}

.stage-ref-card figcaption strong {
  font-family: var(--mono);
  font-size: 9px;
  letter-spacing: 0.06em;
  color: var(--gold-bright);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.stage-ref-card figcaption span {
  font-size: 10px;
  color: var(--muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.stage-ref-card.is-candidate {
  border-color: rgba(227, 169, 79, 0.55);
}

.stage-ref-card .ref-card-pip {
  position: absolute;
  top: 6px;
  right: 6px;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--gold-bright);
  animation: tallyPulse 1.8s ease-in-out infinite;
}

.stage-ref-card.is-locked {
  border-color: rgba(164, 207, 114, 0.5);
}

.stage-ref-card .ref-card-lock {
  position: absolute;
  top: 2px;
  right: 6px;
  font-style: normal;
  font-size: 10px;
  color: var(--ok);
}

/* ---------- Workbench stage tabs + galleries ---------- */

.stage-tabs {
  display: inline-flex;
  gap: 2px;
  padding: 3px;
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  background: var(--surface-2);
}

.stage-tabs-toolbar {
  display: flex;
  width: 100%;
  margin: 0 0 10px;
}

.stage-tabs-toolbar .stage-tab {
  flex: 1;
}

.stage-tab {
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--muted);
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  padding: 5px 10px;
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease;
}

.stage-tab:hover {
  color: var(--ink);
}

.stage-tab.is-active {
  background: var(--gold-soft);
  color: var(--gold-bright);
}

.stage-gallery {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(132px, 1fr));
  gap: 12px;
}

.stage-card {
  margin: 0;
  border: 1px solid var(--line-strong);
  border-radius: 10px;
  overflow: hidden;
  background: var(--surface-2);
}

.stage-card.is-current {
  border-color: var(--gold);
}

.stage-card-main {
  display: block;
  width: 100%;
  padding: 0;
  border: 0;
  background: var(--surface-3);
  cursor: pointer;
  aspect-ratio: 16 / 9;
  overflow: hidden;
}

.stage-card-main img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  transition: transform 0.2s ease;
}

.stage-card-main:hover img {
  transform: scale(1.04);
}

.stage-card-hole,
.stage-card-play {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 100%;
  font-family: var(--mono);
  font-size: 11px;
  color: var(--muted);
}

.stage-card-play {
  font-size: 22px;
  color: var(--gold-bright);
}

.stage-card figcaption {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
  padding: 6px 9px;
}

.stage-card figcaption strong {
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.05em;
  color: var(--ink);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.stage-card figcaption span {
  font-size: 10px;
  color: var(--muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.stage-card-action {
  flex: none;
  border: 1px solid var(--line-strong);
  border-radius: 6px;
  background: transparent;
  color: var(--gold-bright);
  font-size: 11px;
  padding: 2px 7px;
  cursor: pointer;
}

.stage-card-action:hover {
  border-color: var(--gold);
  background: var(--gold-soft);
}

.stage-card-action-wide {
  width: auto;
  padding: 2px 9px;
  border-radius: 999px;
  font-family: var(--mono);
  font-size: 9px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.stage-doclist {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.stage-doc-row {
  display: flex;
  flex-direction: column;
  gap: 1px;
  text-align: left;
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  background: var(--surface-2);
  padding: 8px 12px;
  cursor: pointer;
}

.stage-doc-row:hover {
  border-color: var(--gold);
}

.stage-doc-row strong {
  font-size: 12px;
  color: var(--ink);
}

.stage-doc-row span {
  font-family: var(--mono);
  font-size: 9px;
  color: var(--muted);
}

.stage-gallery-empty {
  padding: 22px;
  text-align: center;
  font-size: 12px;
  color: var(--muted);
  border: 1px dashed var(--line-strong);
  border-radius: 10px;
}

/* MM7: text-lock continuity nudge on the reference bench */
.refs-continuity-hint {
  display: flex;
  align-items: baseline;
  gap: 8px;
  margin: 0 0 10px;
  padding: 9px 12px;
  font-size: 11.5px;
  line-height: 1.5;
  color: var(--muted);
  background: var(--gold-soft);
  border: 1px solid rgba(227, 169, 79, 0.28);
  border-radius: var(--radius-sm);
}

.refs-continuity-hint strong {
  color: var(--gold-bright);
  font-weight: 600;
}

.refs-hint-mark {
  color: var(--gold);
  font-size: 9px;
  transform: translateY(-1px);
}

/* ---------- Stage groups (binder dividers) ---------- */

.stage-group {
  margin-bottom: 10px;
}

.stage-group-header {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  text-align: left;
  padding: 9px 12px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: linear-gradient(180deg, rgba(240, 233, 220, 0.035), rgba(240, 233, 220, 0.01));
  cursor: pointer;
  transition: border-color 140ms ease, background 140ms ease;
}

.stage-group-header:hover {
  border-color: var(--gold);
}

.stage-group.is-open .stage-group-header {
  border-color: var(--line-strong);
  background: var(--gold-soft);
  border-radius: 10px 10px 0 0;
  border-bottom-color: transparent;
}

.stage-group-tick {
  flex: none;
  width: 3px;
  height: 16px;
  border-radius: 2px;
  background: var(--gold-deep);
}

.stage-group.is-open .stage-group-tick {
  background: var(--gold-bright);
}

.stage-group-header strong {
  font-family: var(--mono);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--ink);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.stage-group-count {
  flex: none;
  font-family: var(--mono);
  font-size: 9px;
  color: var(--gold-bright);
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  padding: 1px 7px;
  line-height: 1.5;
}

.stage-group-strip {
  display: flex;
  margin-left: auto;
  flex: none;
}

.stage-group-strip img {
  width: 26px;
  height: 26px;
  object-fit: cover;
  border-radius: 6px;
  border: 1px solid var(--line-strong);
  margin-left: -8px;
  background: var(--surface-2);
}

.stage-group-strip img:first-child {
  margin-left: 0;
}

.stage-group-chevron {
  flex: none;
  margin-left: auto;
  font-family: var(--mono);
  font-size: 11px;
  color: var(--muted);
  line-height: 1;
}

.stage-group-strip + .stage-group-chevron {
  margin-left: 10px;
}

.stage-group .stage-gallery,
.stage-group .stage-doclist {
  border: 1px solid var(--line-strong);
  border-top: none;
  border-radius: 0 0 10px 10px;
  padding: 12px;
  background: rgba(0, 0, 0, 0.14);
}

/* ---------- Director's Cue (the one next action) ---------- */

.director-cue {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 14px;
  margin: 0 0 10px;
  border: 1px solid rgba(227, 169, 79, 0.35);
  border-radius: var(--radius);
  background: linear-gradient(180deg, rgba(227, 169, 79, 0.07), rgba(227, 169, 79, 0.02));
}

.director-cue .cue-dot {
  flex: none;
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: var(--gold-bright);
  box-shadow: 0 0 8px rgba(227, 169, 79, 0.6);
}

.director-cue .cue-dot.working {
  background: var(--danger);
  box-shadow: 0 0 8px rgba(255, 114, 99, 0.6);
  animation: tallyPulse 1.6s ease-in-out infinite;
}

.director-cue .cue-text {
  display: flex;
  flex-direction: column;
  gap: 1px;
  min-width: 0;
  flex: 1;
}

.director-cue .cue-text strong {
  font-size: 13px;
  color: var(--ink);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.director-cue .cue-text span {
  font-size: 11px;
  color: var(--muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* ---------- Review Room ---------- */

.review-room {
  width: min(1480px, calc(100vw - 32px));
  height: min(94vh, 1060px);
  margin: auto;
  flex-direction: column;
  gap: 14px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-lg);
  background:
    radial-gradient(70% 50% at 50% 0%, rgba(227, 169, 79, 0.05), transparent 60%),
    linear-gradient(180deg, #110e0b, #090807);
  box-shadow: var(--shadow);
  padding: 18px 22px 20px;
  overflow: hidden;
}

.review-room[open] {
  display: flex;
  animation: dialogIn 0.3s cubic-bezier(0.2, 0.7, 0.2, 1) both;
}

.review-room-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex: none;
}

.review-room-kicker {
  font-family: var(--mono);
  font-size: 9.5px;
  letter-spacing: 0.26em;
  text-transform: uppercase;
  color: var(--gold-deep);
}

.review-room-top h2,
.review-summary h3 {
  font-family: var(--font-display);
  font-weight: 400;
  font-size: 26px;
  margin-top: 2px;
}

.review-room-progress {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-left: auto;
}

.review-count {
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
}

.review-tag {
  display: inline-flex;
  align-items: center;
  font-family: var(--mono);
  font-size: 9px;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  border-radius: 4px;
  padding: 3px 8px;
  border: 1px solid var(--line-strong);
  color: var(--muted);
  white-space: nowrap;
}

.review-tag.approved {
  color: var(--ok);
  border-color: rgba(164, 207, 114, 0.4);
  background: var(--ok-soft);
}

.review-tag.noted,
.review-tag.accepted_with_notes {
  color: var(--gold-bright);
  border-color: rgba(227, 169, 79, 0.45);
  background: var(--gold-soft);
}

.review-tag.revise,
.review-tag.rejected {
  color: var(--danger);
  border-color: rgba(255, 114, 99, 0.45);
  background: rgba(255, 114, 99, 0.1);
}

.review-tag.rendering {
  color: var(--gold-bright);
  border-color: rgba(227, 169, 79, 0.45);
  background: var(--gold-soft);
  animation: tallyPulse 2.4s ease-in-out infinite;
}

.review-tag.skipped {
  color: var(--dim);
  border-style: dashed;
}

.review-room-body {
  flex: 1;
  min-height: 0;
  display: grid;
  grid-template-columns: minmax(0, 1fr) clamp(300px, 26vw, 380px);
  grid-template-rows: minmax(0, 1fr) auto;
  gap: 14px;
}

/* The screen */
.review-stage {
  grid-row: 1;
  grid-column: 1;
  position: relative;
  display: grid;
  place-items: center;
  min-height: 0;
  overflow: hidden;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  background:
    linear-gradient(0deg, rgba(4, 3, 2, 0.96) 0 6%, transparent 6% 94%, rgba(4, 3, 2, 0.96) 94%),
    #060504;
}

.review-stage img {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
  cursor: zoom-in;
  display: block;
}

.review-stage.zoomed {
  display: block;
  overflow: auto;
  place-items: unset;
}

.review-stage.zoomed img {
  max-width: none;
  max-height: none;
  width: 170%;
  cursor: zoom-out;
}

.review-stage-empty {
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--dim);
}

/* The director's side card */
.review-side {
  grid-row: 1;
  grid-column: 2;
  min-height: 0;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 13px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  padding: 16px;
}

.review-shot-head {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.review-shot-index {
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.2em;
  color: var(--gold-deep);
}

.review-shot-head h3 {
  font-family: var(--font-display);
  font-weight: 400;
  font-size: 27px;
  line-height: 1.05;
}

.review-shot-head small {
  font-family: var(--mono);
  font-size: 10px;
  color: var(--dim);
}

.review-camera-line {
  font-family: var(--mono);
  font-size: 10.5px;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  color: var(--muted);
  border: 1px solid var(--line);
  border-radius: 4px;
  padding: 6px 10px;
  background: var(--bg-2);
}

.review-action-line {
  font-size: 13.5px;
  line-height: 1.6;
  color: var(--ink);
}

.review-qa {
  display: flex;
  flex-direction: column;
  gap: 4px;
  border-left: 2px solid var(--ok);
  background: var(--ok-soft);
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  padding: 9px 12px;
}

.review-qa.is-notes {
  border-left-color: var(--gold);
  background: var(--gold-soft);
}

.review-qa.is-fail {
  border-left-color: var(--danger);
  background: rgba(255, 114, 99, 0.08);
}

.review-qa span {
  font-family: var(--mono);
  font-size: 9.5px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--muted);
}

.review-qa p {
  font-size: 12.5px;
  line-height: 1.55;
  color: var(--ink);
}

.review-decided {
  display: flex;
  flex-direction: column;
  gap: 6px;
  border: 1px dashed var(--line-strong);
  border-radius: var(--radius-sm);
  padding: 10px 12px;
}

.review-decided p {
  font-size: 12.5px;
  color: var(--muted);
}

.review-controls {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: auto;
}

.review-controls .text-button {
  justify-content: flex-start;
  gap: 10px;
  padding: 10px 14px;
}

/* Re-tiered look/panel review: the three decisions are primary; Compare/Skip/Re-render are quieter tools. */
.review-guide {
  margin-top: auto;
  font-size: 12px;
  line-height: 1.5;
  color: var(--muted);
}

.review-guide strong {
  color: var(--ink);
  font-weight: 600;
}

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

.review-decisions .text-button {
  justify-content: flex-start;
  gap: 10px;
  padding: 10px 14px;
}

/* Tools = a full-size amber button (peer of the decisions) that drops down Compare/Skip/Re-render. */
.review-tools-menu {
  position: relative;
}

.tools-toggle {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 10px 14px;
  border-radius: var(--radius-sm);
  font-family: var(--mono);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  color: var(--gold-bright);
  background: var(--gold-soft);
  border: 1px solid var(--gold);
  cursor: pointer;
  transition: background 0.12s, border-color 0.12s;
}

.tools-toggle:hover,
.review-tools-menu.is-open .tools-toggle {
  background: rgba(227, 169, 79, 0.2);
  border-color: var(--gold-bright);
}

.tools-caret {
  font-size: 11px;
  color: var(--gold);
}

/* Each tool is a clean bordered box, spaced + styled like the decision buttons above (no tight panel). */
.review-tools-list {
  margin-top: 8px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.review-tool-item {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  text-align: left;
  padding: 10px 14px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--line-strong);
  background: transparent;
  color: var(--muted);
  font-family: var(--mono);
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  cursor: pointer;
  transition: color 0.15s ease, border-color 0.15s ease, background 0.15s ease;
}

.review-tool-item:hover {
  color: var(--ink);
  border-color: var(--gold);
  background: var(--gold-soft);
}

.review-tool-item.is-live {
  color: var(--gold-bright);
  border-color: var(--gold-deep);
  background: var(--gold-soft);
}

/* Rich tool item (Manual re-render): an uppercase title + a sentence-case descriptor line. */
.review-tool-item.rich {
  flex-direction: column;
  align-items: flex-start;
  gap: 5px;
  text-transform: none;
  letter-spacing: normal;
}

.review-tool-head {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  color: var(--ink);
}

.review-tool-cost {
  font-size: 10px;
  font-weight: 400;
  letter-spacing: normal;
  text-transform: none;
  color: var(--muted);
}

.review-tool-desc {
  font-size: 10px;
  line-height: 1.5;
  color: var(--muted);
}

/* Manual re-render is a caution action (spends credits + overwrites the frame) — red like Request revision. */
.review-tool-item.danger {
  border-color: rgba(255, 114, 99, 0.4);
}

.review-tool-item.danger .review-tool-head {
  color: var(--danger);
}

.review-tool-item.danger:hover {
  border-color: var(--danger);
  background: rgba(255, 114, 99, 0.1);
}

/* Persistent re-render error (replaces the vanishing toast) + the in-progress busy panel. */
.review-error {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 10px 12px;
  margin-bottom: 6px;
  border: 1px solid rgba(255, 114, 99, 0.5);
  border-radius: var(--radius-sm);
  background: rgba(255, 114, 99, 0.1);
  color: var(--danger);
  font-size: 12px;
  line-height: 1.4;
}

.review-error span {
  flex: 1;
}

.review-busy {
  margin-top: auto;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 9px;
  text-align: center;
  padding: 26px 16px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
}

.review-busy-dot {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: var(--gold);
  animation: reviewBusyPulse 1.1s ease-in-out infinite;
}

@keyframes reviewBusyPulse {
  0%, 100% { opacity: 0.35; transform: scale(0.85); }
  50% { opacity: 1; transform: scale(1.1); }
}

.review-busy-title {
  font-family: var(--mono);
  font-size: 12px;
  color: var(--gold-bright);
  margin: 0;
}

.review-busy small {
  font-size: 10.5px;
  color: var(--muted);
  line-height: 1.5;
  max-width: 260px;
}

/* VP — Versions strip (model shootout): variant thumbnails, primary marked, Set-as-primary. */
.review-versions {
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px solid var(--line);
}

.review-versions-label {
  display: block;
  font-family: var(--mono);
  font-size: 9px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--gold-deep);
  margin-bottom: 8px;
}

.review-versions-strip {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding-bottom: 4px;
}

.review-version {
  flex: 0 0 auto;
  width: 118px;
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.review-version-thumb {
  position: relative;
  display: block;
  width: 100%;
  padding: 0;
  aspect-ratio: 16 / 9;
  border-radius: 7px;
  overflow: hidden;
  border: 1px solid var(--line-strong);
  background: var(--surface-2);
  cursor: zoom-in;
  transition: border-color 0.18s ease, box-shadow 0.18s ease, transform 0.18s ease;
}

.review-version-thumb:hover {
  border-color: var(--gold);
  box-shadow: 0 0 0 1px var(--gold-deep);
  transform: translateY(-1px);
}

.review-version-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.review-version.is-primary .review-version-thumb {
  border-color: var(--gold);
  box-shadow: 0 0 0 1px var(--gold);
}

.review-version.is-previewing .review-version-thumb {
  border-color: var(--gold);
  box-shadow: 0 0 0 2px var(--gold), 0 6px 18px rgba(0, 0, 0, 0.45);
}

.review-version-tag {
  position: absolute;
  top: 4px;
  left: 4px;
  font-family: var(--mono);
  font-size: 8px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: #1a1206;
  background: var(--gold);
  border-radius: 3px;
  padding: 1px 5px;
}

.review-version-label {
  display: block;
  width: 100%;
  font-family: var(--mono);
  font-size: 9.5px;
  line-height: 1.35;
  color: var(--muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.review-version .text-button {
  padding: 4px 8px;
  font-size: 9px;
}

/* Enlarged variant preview — overlay banner on the review stage */
.review-stage.is-preview {
  position: relative;
}

.review-preview-banner {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 14px;
  background: linear-gradient(to top, rgba(8, 6, 3, 0.92), rgba(8, 6, 3, 0));
  pointer-events: none;
}

.review-preview-label {
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--gold);
}

.review-preview-actions {
  display: flex;
  gap: 8px;
  pointer-events: auto;
}

kbd {
  display: inline-grid;
  place-items: center;
  min-width: 20px;
  height: 20px;
  padding: 0 5px;
  font-family: var(--mono);
  font-size: 10px;
  font-weight: 600;
  color: var(--muted);
  border: 1px solid var(--line-strong);
  border-bottom-width: 2px;
  border-radius: 4px;
  background: var(--bg-2);
}

.text-button.primary kbd {
  color: #221708;
  border-color: rgba(34, 23, 8, 0.4);
  background: rgba(255, 255, 255, 0.22);
}

.text-button.danger kbd {
  color: var(--danger);
  border-color: rgba(255, 114, 99, 0.45);
}

.review-kbd-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  justify-content: center;
  padding-top: 4px;
}

.review-kbd-legend span {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-family: var(--mono);
  font-size: 9.5px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--dim);
}

.review-note-editor {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: auto;
}

.review-note-editor label {
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--gold-deep);
}

.review-note-editor textarea {
  background: rgba(8, 6, 4, 0.6);
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-sm);
  color: var(--ink);
  font-size: 13px;
  line-height: 1.5;
  padding: 10px 12px;
  resize: vertical;
}

.review-note-editor textarea:focus {
  outline: none;
  border-color: var(--gold);
}

.review-note-actions {
  display: flex;
  gap: 8px;
}

/* ---- MM5: inline image-model re-render picker ---- */
.rerender-picker {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-top: auto;
}

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

.rerender-engine {
  display: flex;
  flex-direction: column;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  background: var(--surface-2);
  overflow: hidden;
  transition: border-color 0.15s ease, background 0.15s ease;
}

.rerender-engine.is-selected {
  border-color: var(--gold);
  background: var(--surface-3);
  box-shadow: 0 0 0 1px var(--gold-soft);
}

.rerender-engine-head {
  display: flex;
  flex-direction: column;
  gap: 3px;
  text-align: left;
  background: transparent;
  border: 0;
  padding: 11px 14px;
  cursor: pointer;
  transition: background 0.15s ease;
}

.rerender-engine-head:hover {
  background: var(--gold-soft);
}

.rerender-engine-top {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
}

.rerender-engine-top strong {
  font-size: 13px;
  color: var(--gold-bright);
}

.rerender-badge {
  font-style: normal;
  font-family: var(--mono);
  font-size: 9px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--dim);
  border: 1px solid var(--line-strong);
  border-radius: 4px;
  padding: 2px 6px;
  white-space: nowrap;
}

.rerender-badge.is-default {
  color: var(--gold);
  border-color: rgba(227, 169, 79, 0.4);
  background: var(--gold-soft);
}

.rerender-engine-meta {
  font-family: var(--mono);
  font-size: 10.5px;
  letter-spacing: 0.04em;
  color: var(--muted);
}

.rerender-engine-note {
  font-size: 11.5px;
  line-height: 1.5;
  color: var(--dim);
}

.rerender-more {
  align-self: flex-start;
  margin: 0 14px 10px;
  background: transparent;
  border: 0;
  cursor: pointer;
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--gold);
  padding: 0;
}

.rerender-more:hover {
  color: var(--gold-bright);
}

.rerender-details {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 0 14px 12px;
  border-top: 1px solid var(--line);
  padding-top: 10px;
}

.rerender-field-label {
  font-family: var(--mono);
  font-size: 9.5px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--gold-deep);
}

.rerender-model-picker {
  position: relative;
}

.rerender-model-trigger {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  background: rgba(8, 6, 4, 0.6);
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-sm);
  color: var(--ink);
  font-family: var(--font-body);
  font-size: 12.5px;
  padding: 9px 11px;
  cursor: pointer;
  transition: border-color 0.12s;
}

.rerender-model-trigger:hover,
.rerender-model-picker.is-open .rerender-model-trigger {
  border-color: var(--gold);
}

.rerender-model-current {
  font-weight: 500;
}

.rerender-model-caret {
  color: var(--gold);
  font-size: 11px;
}

.rerender-model-menu {
  margin-top: 6px;
  display: flex;
  flex-direction: column;
  gap: 2px;
  max-height: 268px;
  overflow-y: auto;
  background: var(--surface-2);
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-sm);
  padding: 5px;
  box-shadow: 0 14px 40px rgba(0, 0, 0, 0.5);
}

.rerender-model-option {
  display: flex;
  flex-direction: column;
  gap: 3px;
  text-align: left;
  background: transparent;
  border: 1px solid transparent;
  border-radius: 7px;
  padding: 8px 10px;
  cursor: pointer;
  transition: background 0.1s, border-color 0.1s;
}

.rerender-model-option:hover {
  background: var(--surface-3);
}

.rerender-model-option.is-selected {
  background: var(--gold-soft);
  border-color: var(--gold-deep);
}

.rerender-model-option-head {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  color: var(--ink);
}

.rerender-model-option-head strong {
  font-weight: 600;
}

.rerender-model-cost {
  font-family: var(--mono);
  font-size: 10px;
  color: var(--muted);
}

.rerender-model-check {
  margin-left: auto;
  color: var(--gold-bright);
}

.rerender-model-tag {
  font-family: var(--mono);
  font-size: 8.5px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--gold);
  border: 1px solid var(--gold-deep);
  background: var(--gold-soft);
  border-radius: 4px;
  padding: 1px 5px;
}

.rerender-model-tag.alt {
  color: #9db98a;
  border-color: #45532f;
  background: rgba(120, 150, 90, 0.12);
}

.rerender-model-blurb {
  font-family: var(--mono);
  font-size: 10px;
  line-height: 1.4;
  color: var(--muted);
}

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

.rerender-chip {
  font-family: var(--mono);
  font-size: 10.5px;
  letter-spacing: 0.04em;
  color: var(--muted);
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-sm);
  background: transparent;
  padding: 5px 11px;
  cursor: pointer;
  transition: color 0.15s ease, border-color 0.15s ease, background 0.15s ease;
}

.rerender-chip:hover {
  color: var(--ink);
  border-color: var(--gold);
}

.rerender-chip.is-selected {
  color: #221708;
  background: linear-gradient(180deg, var(--gold-bright), var(--gold));
  border-color: var(--gold);
  font-weight: 600;
}

.rerender-quality {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  align-self: flex-start;
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--dim);
  border: 1px dashed var(--line-strong);
  border-radius: var(--radius-sm);
  padding: 5px 10px;
}

.rerender-quality-lock {
  font-size: 11px;
  filter: grayscale(1) opacity(0.7);
}

.rerender-actions {
  display: flex;
  gap: 8px;
}

.rerender-empty {
  font-size: 12px;
  line-height: 1.5;
  color: var(--muted);
}

/* Filmstrip */
.review-strip {
  grid-row: 2;
  grid-column: 1 / -1;
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding: 4px 2px 2px;
  flex: none;
}

.review-thumb {
  position: relative;
  flex: none;
  width: 104px;
  aspect-ratio: 16 / 9;
  border: 1px solid var(--line);
  border-radius: 6px;
  overflow: hidden;
  background: #060504;
  display: grid;
  place-items: center;
  opacity: 0.62;
  transition: opacity 0.15s ease, border-color 0.15s ease, transform 0.15s ease;
}

.review-thumb:hover {
  opacity: 1;
}

.review-thumb.is-current {
  opacity: 1;
  border-color: var(--gold-bright);
  box-shadow: 0 0 0 1px rgba(227, 169, 79, 0.5);
  transform: translateY(-2px);
}

.review-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.review-thumb span {
  font-family: var(--mono);
  font-size: 10px;
  color: var(--dim);
}

.review-thumb-mark {
  position: absolute;
  top: 5px;
  right: 5px;
  width: 9px;
  height: 9px;
  border-radius: 50%;
  border: 1px solid rgba(8, 6, 4, 0.8);
}

.review-thumb-mark.approved { background: var(--ok); }
.review-thumb-mark.accepted_with_notes { background: var(--gold); }
.review-thumb-mark.rejected { background: var(--danger); }

.review-thumb.decided-approved { border-color: rgba(164, 207, 114, 0.5); }
.review-thumb.decided-accepted_with_notes { border-color: rgba(227, 169, 79, 0.55); }
.review-thumb.decided-rejected { border-color: rgba(255, 114, 99, 0.5); }

/* Continuity compare */
.review-stage.is-compare {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  padding: 12px;
  place-items: stretch;
}

.review-compare-frame {
  position: relative;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 7px;
  min-height: 0;
}

.review-compare-frame img,
.review-compare-frame video {
  flex: 1;
  min-height: 0;
  width: 100%;
  object-fit: contain;
  cursor: default;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #040302;
}

.review-stage-video {
  max-width: 100%;
  max-height: 100%;
  width: 100%;
  background: #000;
}

.review-compare-frame.is-candidate img {
  border-color: rgba(227, 169, 79, 0.5);
}

.review-compare-frame figcaption {
  font-family: var(--mono);
  font-size: 9.5px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--dim);
  text-align: center;
  flex: none;
}

.review-compare-frame.is-candidate figcaption {
  color: var(--gold-bright);
}

/* Revision markup canvas */
.review-stage.is-marking {
  display: flex;
  flex-direction: column;
  gap: 0;
  place-items: unset;
}

.review-annotate-wrap {
  position: relative;
  flex: 1;
  min-height: 0;
  display: grid;
  place-items: center;
  overflow: hidden;
}

.review-annotate-wrap img {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
  cursor: default;
}

.review-annotate-canvas {
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  cursor: crosshair;
  touch-action: none;
}

.review-annotate-hint {
  flex: none;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  border-top: 1px solid rgba(255, 75, 60, 0.35);
  background: rgba(255, 75, 60, 0.07);
  padding: 8px 12px;
}

.review-annotate-hint span {
  font-family: var(--mono);
  font-size: 9.5px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--rec);
}

/* Summary */
.review-summary {
  grid-column: 1 / -1;
  grid-row: 1 / 3;
  min-height: 0;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
  text-align: center;
  padding: 28px 20px;
}

.review-summary-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  width: min(560px, 100%);
  text-align: left;
}

.review-summary-row {
  display: grid;
  grid-template-columns: auto auto;
  justify-content: space-between;
  align-items: center;
  gap: 6px 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--surface);
  padding: 10px 14px;
}

.review-summary-row strong {
  font-size: 13.5px;
}

.review-summary-row p {
  grid-column: 1 / -1;
  font-size: 12px;
  color: var(--muted);
}

.review-summary-note {
  max-width: 540px;
  font-size: 13px;
  color: var(--muted);
  line-height: 1.65;
}

.review-summary-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 10px;
}

@media (max-width: 900px) {
  .review-room-body {
    grid-template-columns: minmax(0, 1fr);
    grid-template-rows: minmax(0, 1.2fr) auto auto;
  }

  .review-stage {
    grid-column: 1;
  }

  .review-side {
    grid-row: 2;
    grid-column: 1;
    max-height: 38vh;
  }

  .review-strip {
    grid-row: 3;
  }
}

/* ---------- Toast ---------- */

.toast {
  position: fixed;
  left: 50%;
  bottom: 26px;
  transform: translateX(-50%);
  z-index: 2200;
  font-family: var(--mono);
  font-size: 11.5px;
  letter-spacing: 0.03em;
  color: var(--ink);
  background: rgba(24, 20, 15, 0.95);
  border: 1px solid var(--line-strong);
  border-left: 2px solid var(--gold);
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow-soft);
  padding: 11px 16px;
  max-width: min(520px, calc(100vw - 40px));
  animation: toastIn 0.3s cubic-bezier(0.2, 0.7, 0.2, 1) both;
}

@keyframes toastIn {
  from { opacity: 0; transform: translate(-50%, 10px); }
  to { opacity: 1; transform: translate(-50%, 0); }
}

.toast[hidden] {
  display: none;
}

/* ---------- Responsive ---------- */

/* Medium tier: keep chat + wall side by side, slim everything */
@media (max-width: 1380px) {
  :root {
    --wall-width: clamp(330px, 31vw, 440px);
    --chat-max: 700px;
    --rail-width: 248px;
  }

  .panel-grid {
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  }
}

/* Compact tier: wall and rail become drawers over a dimmed stage */
@media (max-width: 1100px) {
  body.workbench-open .workspace {
    grid-template-columns: minmax(0, 1fr) 0;
  }

  .output-wall {
    position: fixed;
    top: var(--topbar-h);
    right: 0;
    bottom: 0;
    width: min(520px, 92vw);
    z-index: 60;
    box-shadow: var(--shadow);
    border-left: 1px solid var(--line-strong);
    transform: translateX(102%);
    transition: transform 0.26s cubic-bezier(0.5, 0, 0.2, 1);
  }

  body.workbench-open .output-wall {
    transform: translateX(0);
  }

  /* scrim so the chat clearly reads as "behind the drawer" */
  body.workbench-open .workspace::after {
    content: "";
    position: fixed;
    top: var(--topbar-h);
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 55;
    background: rgba(6, 5, 3, 0.55);
    backdrop-filter: blur(1.5px);
    pointer-events: none;
  }

  .left-rail {
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    width: var(--rail-width);
    z-index: 70;
    box-shadow: var(--shadow);
    transform: translateX(0);
    transition: transform 0.24s ease;
  }

  body.rail-collapsed .left-rail {
    transform: translateX(-103%);
  }

  body:not(.rail-collapsed) .topbar::after {
    content: "";
    position: fixed;
    inset: 0;
    z-index: 65;
    background: rgba(6, 5, 3, 0.45);
    pointer-events: none;
  }

  .app-shell {
    grid-template-columns: 0 minmax(0, 1fr);
  }
}

@media (max-width: 760px) {
  .status-chip {
    display: none;
  }

  .chat-hero h2 {
    font-size: 34px;
  }
}

/* ---------- Reduced motion ---------- */

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}

.stage-card.is-cut {
  opacity: 0.45;
}

.stage-card-cut {
  font-family: var(--mono);
  font-size: 9px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted);
}

/* Stage-browsing mode: the primary slot becomes a scrollable gallery */
.latest-preview.is-stage {
  aspect-ratio: auto;
  height: auto;
  max-height: 62vh;
  overflow-y: auto;
  padding: 12px;
  background: var(--surface-1, transparent);
  align-items: start;
  justify-items: normal;
  display: block;
}

.latest-preview.is-stage .stage-gallery {
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
}
