/* ════════════════════════════════════════════════════════════════════════════
   Story Forge — an editing-bay for AI video.
   Palette: deep indigo-charcoal + a warm amber "safelight" accent.
   Type: Bricolage Grotesque (display) · IBM Plex Sans (ui) · IBM Plex Mono (data)
   ════════════════════════════════════════════════════════════════════════════ */

:root {
  /* Render native controls (select popups, scrollbars, date pickers) dark to
     match the theme — without this the OS paints select option lists light. */
  color-scheme: dark;

  --bg:        #16181C;   /* neutral graphite */
  --text:      #ECEDF0;
  --muted:     #A2A6AE;
  --faint:     #7A7F89;   /* ≥4.5:1 on the bg — micro-labels stay legible */

  /* translucent fills so surfaces read as frosted glass over the aurora */
  --surface-1: rgba(255, 255, 255, 0.05);
  --surface-2: rgba(255, 255, 255, 0.08);
  --surface-3: rgba(255, 255, 255, 0.13);
  --fill:      rgba(255, 255, 255, 0.055);
  --hairline:  rgba(255, 255, 255, 0.10);
  --stroke:    rgba(255, 255, 255, 0.12);
  --glass-hi:  rgba(255, 255, 255, 0.08);  /* inset top highlight */
  --blur:      saturate(180%) blur(22px);

  --accent:      #CDD2DC;   /* soft neutral highlight — no hue */
  --accent-2:    #AEB4C0;
  --accent-hi:   #E4E7EE;
  --accent-soft: rgba(255, 255, 255, 0.10);
  --accent-line: rgba(255, 255, 255, 0.24);
  --accent-glow: rgba(0, 0, 0, 0.45);
  /* a whisper of prism, reserved for a single restrained glass edge */
  --iris: linear-gradient(110deg, rgba(120,200,210,.45), rgba(150,160,255,.45), rgba(210,150,230,.45), rgba(255,190,210,.45));
  --run:        #5BA3F5;   /* in progress — blue */
  --run-soft:   rgba(91, 163, 245, 0.16);
  --ok:         #E6B450;   /* success — gold */
  --ok-soft:    rgba(230, 180, 80, 0.16);
  --danger:     #E5685D;   /* fail — red */
  --err-soft:   rgba(229, 104, 93, 0.15);

  --radius:    18px;
  --radius-sm: 12px;
  --ease:      cubic-bezier(.4, 0, .2, 1);
  --spring:    cubic-bezier(.34, 1.56, .5, 1);   /* punchy overshoot */

  --shadow:    0 10px 40px rgba(0, 0, 0, .45);
  --shadow-lg: 0 24px 70px rgba(0, 0, 0, .55);

  /* The webfonts named in the header are loaded by index.html — these tokens
     finally USE them (system stack stays as the fallback while they arrive). */
  --font-display: "Bricolage Grotesque", -apple-system, "SF Pro Display", BlinkMacSystemFont, "Segoe UI", system-ui, sans-serif;
  --font-ui:      "IBM Plex Sans", -apple-system, "SF Pro Text", BlinkMacSystemFont, "Segoe UI", system-ui, sans-serif;
  --font-mono:    "IBM Plex Mono", "SF Mono", ui-monospace, Menlo, "Cascadia Mono", monospace;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html, body { height: 100%; }

body {
  color: var(--text);
  font-family: var(--font-ui);
  font-size: 14px;
  line-height: 1.5;
  letter-spacing: -0.006em;
  -webkit-font-smoothing: antialiased;
  /* dark base + soft aurora blobs the frosted-glass surfaces refract */
  background-color: var(--bg);
  background-image:
    radial-gradient(60% 50% at 50% -10%, rgba(255, 255, 255, 0.05), transparent 60%),
    radial-gradient(70% 60% at 100% 0%, rgba(255, 255, 255, 0.025), transparent 55%),
    radial-gradient(120% 95% at 50% -15%, #1E2128 0%, var(--bg) 60%);
  background-attachment: fixed;
  display: flex; flex-direction: column;
}

::selection { background: var(--accent-soft); }

button { font-family: inherit; font-size: inherit; cursor: pointer; border: none; background: none; color: inherit; }
input, textarea { font-family: inherit; color: inherit; }

:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
  border-radius: 4px;
}

/* ── App shell ──────────────────────────────────────────────────────────────*/
.app {
  --sb-w: 264px;                 /* live sidebar width; collapsed state shrinks it */
  display: grid;
  grid-template-columns: var(--sb-w) 1fr;
  flex: 1; min-height: 0;        /* fills the height under the full-width top menu */
  overflow: hidden;
  transition: grid-template-columns .22s var(--ease);
}
.app.sb-collapsed { --sb-w: 64px; }

/* ── Sidebar: projects ──────────────────────────────────────────────────────*/
.sidebar {
  background: var(--surface-1);
  border-right: 1px solid var(--hairline);
  display: flex;
  flex-direction: column;
  min-height: 0;
  overflow: hidden; /* slim rail must not show clipped labels mid-transition */
}

/* collapse/expand control */
.sb-head { display: flex; justify-content: flex-end; padding: 10px 12px 0; }
.app.sb-collapsed .sb-head { justify-content: center; padding: 10px 0 0; }
.sb-toggle {
  width: 30px; height: 30px; border-radius: 8px;
  display: grid; place-items: center; color: var(--muted);
  transition: background .15s var(--ease), color .15s var(--ease);
}
.sb-toggle:hover { background: var(--surface-3); color: var(--text); }
.sb-toggle svg { transition: transform .22s var(--ease); }
.app.sb-collapsed .sb-toggle svg { transform: rotate(180deg); }

/* ── Collapsed icon rail ─────────────────────────────────────────────────────*/
/* Hide every text label, centre the glyphs, swap project rows for initial chips. */
.app.sb-collapsed .nav { padding: 8px 8px 2px; }
.app.sb-collapsed .nav-item { justify-content: center; gap: 0; padding: 9px 0; }
.app.sb-collapsed .nav-item span { display: none; }
.app.sb-collapsed .proj-head { justify-content: center; padding: 14px 0 8px; }
.app.sb-collapsed .proj-head h2 { display: none; }
.app.sb-collapsed .proj-search-row { display: none; }
.app.sb-collapsed .proj-list { padding: 2px 8px 16px; }
.app.sb-collapsed .proj { justify-content: center; padding: 6px 0; }
.app.sb-collapsed .proj .name,
.app.sb-collapsed .proj .count { display: none; }
.app.sb-collapsed .proj.active::before { display: none; }
.app.sb-collapsed .proj-del { display: none; }
.app.sb-collapsed .sidebar-foot { padding: 8px 0 12px; }
.app.sb-collapsed .sidebar-foot .nav-item { justify-content: center; }
.app.sb-collapsed .trash-count { display: none; }
/* the rail hides folder rows entirely — the hover flyout is their only home
   (the flyout hangs off <body>, so this selector can't reach it) */
.app.sb-collapsed .proj-list .proj-folders { display: none; }

/* project initial avatar — only shown in the collapsed rail */
.proj-ava { display: none; flex: none; }
.app.sb-collapsed .proj-ava {
  display: grid; place-items: center; width: 32px; height: 32px; border-radius: 9px;
  background: var(--surface-3); color: var(--text);
  font-family: var(--font-mono); font-weight: 600; font-size: 13px;
}
.app.sb-collapsed .proj.active .proj-ava { background: var(--accent); color: #1A1206; }

.brand {
  padding: 22px 22px 18px;
  border-bottom: 1px solid var(--hairline);
}
.brand .mark {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 19px;
  letter-spacing: -0.02em;
  display: flex;
  align-items: center;
  gap: 9px;
}
.brand .dot {
  width: 9px; height: 9px; border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 12px var(--accent);
}
.brand .sub {
  margin-top: 4px;
  font-family: var(--font-mono);
  font-size: 10.5px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--faint);
}

.proj-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 18px 20px 10px;
}
.proj-head h2 {
  font-family: var(--font-mono);
  font-size: 11px; font-weight: 500;
  letter-spacing: 0.12em; text-transform: uppercase;
  color: var(--muted);
}
.icon-btn {
  width: 26px; height: 26px; border-radius: 7px;
  display: grid; place-items: center;
  color: var(--muted);
  transition: background .15s var(--ease), color .15s var(--ease);
}
.icon-btn:hover { color: var(--text); }

.proj-list { flex: 1; overflow-y: auto; padding: 2px 12px 16px; }

.proj {
  display: flex; align-items: center; gap: 10px;
  padding: 9px 11px; border-radius: var(--radius-sm);
  color: var(--muted);
  transition: background .14s var(--ease), color .14s var(--ease);
  position: relative;
  width: 100%; text-align: left;
}
.proj:hover { background: var(--surface-2); color: var(--text); }
.proj.active { background: var(--surface-3); color: var(--text); }
.proj.active::before {
  content: ''; position: absolute; left: -12px; top: 8px; bottom: 8px;
  width: 3px; border-radius: 0 3px 3px 0; background: var(--accent);
}
.proj .name { flex: 1; font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.proj .count {
  font-family: var(--font-mono); font-size: 11px;
  color: var(--faint); background: var(--bg);
  padding: 1px 7px; border-radius: 20px;
}

.proj-empty { padding: 14px 20px; color: var(--faint); font-size: 13px; }

/* sidebar project search */
.proj-search-row { padding: 2px 14px 8px; }
.proj-search {
  width: 100%; background: var(--fill); border: 1px solid var(--hairline);
  border-radius: var(--radius-sm); padding: 7px 11px; font-size: 13px; color: var(--text);
  transition: border-color .14s var(--ease);
}
.proj-search:focus { outline: none; border-color: var(--accent-line); }
.proj-search::placeholder { color: var(--faint); }

/* per-project reel filter bar */
.reel-filter { margin: 20px 0 16px; }

/* ── Main column ────────────────────────────────────────────────────────────*/
.main { min-width: 0; display: flex; flex-direction: column; overflow-y: auto; }

/* ── Top menu: full-width app header (brand + Projects / Costs) ──────────────*/
.topmenu {
  flex: none; z-index: 20;
  display: flex; align-items: center; gap: 22px;
  height: 54px; padding: 0 22px;
  background: rgba(18, 20, 24, 0.72);
  -webkit-backdrop-filter: var(--blur); backdrop-filter: var(--blur);
  border-bottom: 1px solid var(--hairline);
}
.tm-brand { display: flex; flex-direction: column; gap: 1px; padding-right: 22px; border-right: 1px solid var(--hairline); }
.tm-brand .mark {
  font-family: var(--font-display); font-weight: 700; font-size: 16.5px; letter-spacing: -0.02em;
  display: flex; align-items: center; gap: 9px;
}
.tm-brand .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--accent); box-shadow: 0 0 10px var(--accent); animation: breathe 5s var(--ease) infinite; }
.tm-brand .sub { font-family: var(--font-mono); font-size: 9.5px; letter-spacing: .08em; text-transform: uppercase; color: var(--faint); }
.tm-tabs { display: flex; gap: 4px; }
.tm-item {
  padding: 7px 14px; border-radius: 9px; font-size: 13.5px; font-weight: 500;
  color: var(--muted);
  transition: color .15s var(--ease), background-color .15s var(--ease), transform .2s var(--spring);
}
.tm-item:hover { color: var(--text); background-color: var(--fill); transform: translateY(-1px); }
.tm-item.active { color: var(--text); background-color: var(--surface-2); }

/* ── Sticky project header (title + compact cost + search) ──────────────────*/
.ws-header {
    position: sticky;
    top: 0; /* pins to the top of the scroll area — the account bar that used to
               occupy the first 48px now lives in the top menu */
    z-index: 6;
    background: rgb(16 18 22);
}
.ws-header-inner { max-width: 1180px; margin: 0; padding: 14px 32px 12px; }
.ws-header .topbar { position: static; top: auto; z-index: auto; padding: 0 0 10px; background: none; }
/* keep header text crisp over whatever scrolls behind it */
.ws-header .topbar h1, .ws-header .project-analysis.compact { text-shadow: 0 1px 3px rgba(0, 0, 0, 0.55); }
.ws-header .reel-filter { margin: 0; }
.ws-header .project-analysis.compact { margin: 0 0 12px; }
.canvas { padding-top: 16px; }

/* brighter shot-count pill (extra specificity to beat `.topbar .meta`) */
.topbar .meta.pill-meta {
  background: var(--surface-3); border: 1px solid var(--stroke);
  color: var(--text); padding: 3px 11px; border-radius: 20px;
  font-family: var(--font-mono); font-size: 12px; font-weight: 500; letter-spacing: .02em;
}

/* compact cost-analysis strip */
.project-analysis.compact {
  display: flex; align-items: center; flex-wrap: wrap; gap: 8px;
  background: none; border: none; padding: 0; box-shadow: none;
  font-family: var(--font-mono); font-size: 12px; color: var(--muted);
}
.project-analysis.compact .pa-lbl {
  font-size: 10px; letter-spacing: .12em; text-transform: uppercase; color: var(--faint);
}
.project-analysis.compact .pa-stat { color: var(--muted); }
.project-analysis.compact .pa-stat b { color: var(--text); font-weight: 600; }
.project-analysis.compact .pa-dot { color: var(--faint); }
.project-analysis.compact .pa-chips { display: inline-flex; gap: 6px; margin-left: 6px; }
.project-analysis.compact .pa-chip {
  font-size: 10.5px; color: var(--faint); background: var(--fill);
  border: 1px solid var(--hairline); padding: 1px 7px; border-radius: 6px;
}

/* ── Costs dashboard ────────────────────────────────────────────────────────*/
.costs-body { display: flex; flex-direction: column; gap: 24px; }
.cost-cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 14px; }
.cost-card {
  background: var(--surface-1); border: 1px solid var(--hairline);
  border-radius: var(--radius); padding: 16px 18px;
  box-shadow: var(--shadow), inset 0 1px 0 var(--glass-hi);
  display: flex; flex-direction: column; gap: 4px;
}
.cc-lbl { font-family: var(--font-mono); font-size: 10px; letter-spacing: .12em; text-transform: uppercase; color: var(--faint); }
.cost-card b { font-family: var(--font-mono); font-size: 24px; font-weight: 500; color: var(--text); }
.cc-sub { font-family: var(--font-mono); font-size: 12px; color: var(--muted); }
.cost-section {
  background: var(--surface-1); border: 1px solid var(--hairline);
  border-radius: var(--radius); padding: 18px 20px;
  box-shadow: var(--shadow), inset 0 1px 0 var(--glass-hi);
}
.cost-h {
  font-family: var(--font-mono); font-size: 10.5px; letter-spacing: .12em;
  text-transform: uppercase; color: var(--muted); margin-bottom: 14px;
}
.cost-row {
  display: flex; align-items: center; gap: 14px; width: 100%; text-align: left;
  padding: 8px 0; border: none; background: none; color: inherit;
}
.cost-row + .cost-row { border-top: 1px solid var(--hairline); }
.proj-row { cursor: pointer; border-radius: 8px; transition: background-color .14s var(--ease); }
.proj-row:hover { background-color: var(--fill); }
.cr-name { flex: 0 0 160px; font-size: 13.5px; font-weight: 500; color: var(--text); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cr-bar { flex: 1; height: 7px; background: var(--surface-3); border-radius: 6px; overflow: hidden; }
.cr-bar i { display: block; height: 100%; border-radius: 6px; background: linear-gradient(90deg, rgba(255,255,255,.4), rgba(255,255,255,.8)); }
.cr-val { flex: 0 0 auto; font-family: var(--font-mono); font-size: 11.5px; color: var(--muted); white-space: nowrap; }
.cr-val b { color: var(--text); }

/* ── Account bar: purchased token pack balance ──────────────────────────────*/
.account-bar {
  position: sticky; top: 0; z-index: 12;
  padding: 0 32px; min-height: 48px;
  background: var(--surface-1); border-bottom: 1px solid var(--hairline);
  display: flex; align-items: center;
}
.account-bar:empty { display: none; }
.ab-summary { display: flex; align-items: center; gap: 16px; width: 100%; }
.ab-label {
  display: flex; align-items: center; gap: 8px; white-space: nowrap;
  font-family: var(--font-mono); font-size: 10.5px; font-weight: 500;
  letter-spacing: .12em; text-transform: uppercase; color: var(--muted);
}
.ab-label .dot { width: 7px; height: 7px; border-radius: 50%; background: var(--accent); box-shadow: 0 0 10px var(--accent); }
.ab-meter {
  flex: 0 1 260px; height: 6px; border-radius: 6px;
  background: var(--surface-3); overflow: hidden;
}
.ab-meter > span { display: block; height: 100%; background: var(--accent); border-radius: 6px; transition: width .4s var(--ease); }
.ab-meter.over > span { background: var(--danger); }
.ab-stat { font-family: var(--font-mono); font-size: 13px; color: var(--text); white-space: nowrap; }
.ab-stat .u { color: var(--faint); }
.ab-stat.money { color: var(--accent); }
.ab-pending {
  font-family: var(--font-mono); font-size: 11.5px; white-space: nowrap;
  color: var(--run); background: var(--run-soft);
  padding: 2px 9px; border-radius: 20px;
}
.ab-conc {
  display: inline-flex; align-items: center; gap: 6px;
  font-family: var(--font-mono); font-size: 11.5px; white-space: nowrap;
  color: var(--run); background: var(--run-soft);
  padding: 2px 9px; border-radius: 20px;
}
.ab-conc .conc-dot {
  width: 6px; height: 6px; border-radius: 50%; background: currentColor;
  animation: concpulse 1.4s ease-in-out infinite;
}
.ab-conc.at-limit { color: var(--ok); background: var(--ok-soft); } /* at the BytePlus cap */
@keyframes concpulse { 0%, 100% { opacity: 1; } 50% { opacity: 0.35; } }
.ab-edit {
  margin-left: auto; width: 30px; height: 30px; border-radius: 8px;
  display: grid; place-items: center; color: var(--muted); border: 1px solid var(--hairline);
  transition: color .14s var(--ease), border-color .14s var(--ease);
}
.ab-edit:hover { color: var(--accent); border-color: var(--accent-line); }

/* resource-pack manager popover */
.packs-pop {
  position: absolute; top: calc(100% + 8px); right: 28px; width: 322px;
  background: var(--surface-1); border: 1px solid var(--hairline);
  border-radius: var(--radius); padding: 16px;
  box-shadow: 0 18px 54px rgba(0,0,0,.55);
  opacity: 0; transform: translateY(-8px); pointer-events: none;
  transition: opacity .16s var(--ease), transform .16s var(--ease); z-index: 40;
}
.packs-pop.open { opacity: 1; transform: none; pointer-events: auto; }
.pp-head {
  display: flex; align-items: center; gap: 8px; margin-bottom: 13px;
  font-family: var(--font-mono); font-size: 10.5px; font-weight: 500;
  letter-spacing: .12em; text-transform: uppercase; color: var(--muted);
}
.pp-head .hint { color: var(--faint); letter-spacing: 0; text-transform: none; font-size: 11px; }
.pp-list { display: flex; flex-direction: column; gap: 8px; }
.pp-row { display: flex; align-items: center; gap: 9px; }
.pp-idx { width: 14px; font-family: var(--font-mono); font-size: 11px; color: var(--faint); }
.pp-size {
  width: 78px; background: var(--bg); border: 1px solid var(--hairline);
  border-radius: 8px; padding: 6px 9px; font-family: var(--font-mono); font-size: 12.5px;
}
.pp-size:focus { outline: none; border-color: var(--accent-line); }
.pp-rem { flex: 1; font-family: var(--font-mono); font-size: 11.5px; color: var(--muted); }
.pp-del {
  width: 24px; height: 24px; border-radius: 6px; color: var(--faint);
  display: grid; place-items: center; font-size: 12px;
}
.pp-del:hover { color: var(--danger); background: rgba(229,104,93,.12); }
.pp-empty { font-size: 12.5px; color: var(--faint); }
.pp-add {
  width: 100%; margin-top: 12px; padding: 8px; border-radius: 8px;
  border: 1px dashed var(--hairline); color: var(--muted); font-size: 12.5px;
  transition: color .14s var(--ease), border-color .14s var(--ease);
}
.pp-add:hover { color: var(--accent); border-color: var(--accent-line); }
.pp-total {
  margin-top: 13px; padding-top: 12px; border-top: 1px solid var(--hairline);
  font-family: var(--font-mono); font-size: 12px; color: var(--muted);
}
.pp-total b { color: var(--text); }

.topbar {
  position: sticky; top: 0; z-index: 5; /* top of the scroll area — see .ws-header note */
  display: flex; align-items: baseline; gap: 14px;
  padding: 22px 32px 18px;
  background: linear-gradient(var(--bg) 70%, transparent);
}
.topbar h1 {
  font-family: var(--font-display);
  font-weight: 600; font-size: 24px; letter-spacing: -0.02em;
}
.topbar .meta { font-family: var(--font-mono); font-size: 12px; color: var(--faint); }

/* Bottom clearance tracks the dock's MEASURED height (--dock-clear, set by a
   ResizeObserver in app.js): the dock is fixed and grows when its rows wrap at
   narrow widths or the prompt expands — a hardcoded 180px let it swallow the
   last feed card. Fallback matches the old value. */
.canvas { padding: 0 32px calc(var(--dock-clear, 134px) + 46px); max-width: 1180px; width: 100%; margin: 0; }

/* ── Composer ───────────────────────────────────────────────────────────────*/
.composer {
  display: grid;
  grid-template-columns: 1fr 300px;
  gap: 0;
  background: var(--surface-1);
  border: 1px solid var(--hairline);
  border-radius: var(--radius);
  overflow: hidden;
}
.compose-left { padding: 20px; border-right: 1px solid var(--hairline); }
.compose-right { padding: 20px; background: var(--surface-2); }

/* segmented control */
.seg {
  display: inline-flex; background: var(--bg);
  border: 1px solid var(--hairline); border-radius: 9px; padding: 3px;
}
.seg button {
  padding: 6px 14px; border-radius: 6px; font-size: 13px; font-weight: 500;
  color: var(--muted); transition: all .15s var(--ease); white-space: nowrap;
}
.seg button:hover:not(.on) { color: var(--text); background: var(--surface-1); }
.seg button.on { background: var(--surface-3); color: var(--text); box-shadow: 0 1px 0 rgba(0,0,0,.3); }

.field-label {
  font-family: var(--font-mono); font-size: 10.5px; font-weight: 500;
  letter-spacing: 0.12em; text-transform: uppercase; color: var(--muted);
  display: flex; align-items: center; justify-content: space-between;
  margin: 18px 0 9px;
}
.compose-left > .field-label:first-child { margin-top: 14px; }
.field-label .hint { color: var(--faint); letter-spacing: 0; text-transform: none; font-size: 11px; }

/* reference slots */
.refs { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
.refs.firstlast { grid-template-columns: repeat(2, 1fr); }
.ref-slot {
  position: relative; aspect-ratio: 1; border-radius: var(--radius-sm);
  border: 1.5px dashed var(--hairline); background: var(--bg);
  display: grid; place-items: center; overflow: hidden;
  transition: border-color .15s var(--ease), background .15s var(--ease);
}
.ref-slot:hover { border-color: var(--accent-line); }
.ref-slot.filled { border-style: solid; border-color: var(--hairline); }
.ref-slot.dragover { border-color: var(--accent); background: var(--accent-soft); }
/* Dragging a file over a FILLED slot = replace-in-place: dim the media + label it. */
.ref-slot.filled.dragover { position: relative; }
.ref-slot.filled.dragover > img, .ref-slot.filled.dragover > video, .ref-slot.filled.dragover > .audio-tile { opacity: .3; }
.ref-slot.filled.dragover::after {
  content: 'Replace'; position: absolute; inset: 0; display: grid; place-items: center;
  font-size: 11px; font-weight: 600; letter-spacing: .08em; text-transform: uppercase;
  color: var(--accent); pointer-events: none;
}
.ref-slot img { width: 100%; height: 100%; object-fit: cover; }
.ref-slot .plus { color: var(--faint); font-size: 22px; font-weight: 300; }
.ref-slot .slot-tag {
  position: absolute; left: 6px; bottom: 6px;
  font-family: var(--font-mono); font-size: 9px; letter-spacing: .04em;
  background: rgba(0,0,0,.6); color: var(--text); padding: 2px 6px; border-radius: 5px;
}
/* Tag-as-button: click drops the @tag into the prompt (matches Forge's refbar) */
button.slot-tag-insert { border: 1px solid transparent; cursor: pointer; }
button.slot-tag-insert:hover { color: var(--accent-hi); border-color: var(--accent-line); background: rgba(0,0,0,.8); }
.ref-slot .remove {
  position: absolute; top: 5px; right: 5px; width: 20px; height: 20px;
  border-radius: 6px; background: rgba(0,0,0,.66); color: #fff;
  display: grid; place-items: center; font-size: 13px; opacity: 0;
  transition: opacity .15s var(--ease);
}
.ref-slot.filled:hover .remove { opacity: 1; }
.ref-slot video { width: 100%; height: 100%; object-fit: cover; }
.audio-tile { color: var(--muted); display: grid; place-items: center; }

.refs-wrap { display: flex; flex-direction: column; }
.uploader { margin-bottom: 4px; }
.uploader .field-label { margin: 14px 0 8px; }
.uploader-rule {
  font-family: var(--font-mono); font-size: 10px; color: var(--faint);
  letter-spacing: 0.02em; margin: -4px 0 8px;
}
.ref-hint {
  margin-top: 10px; font-size: 12px; color: var(--accent);
  background: var(--accent-soft); border: 1px solid var(--accent-line);
  padding: 7px 11px; border-radius: var(--radius-sm);
}

textarea.prompt {
  width: 100%; min-height: 96px; resize: vertical;
  background: var(--bg); border: 1px solid var(--hairline);
  border-radius: var(--radius-sm); padding: 13px 14px;
  font-size: 14.5px; line-height: 1.55; color: var(--text);
  transition: border-color .15s var(--ease);
}
textarea.prompt:focus { outline: none; border-color: var(--accent-line); }
textarea.prompt::placeholder { color: var(--faint); }

/* settings rail */
.rail-group { margin-bottom: 16px; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip {
  display: inline-flex; align-items: center; gap: 7px;
  padding: 6px 11px; border-radius: 7px; font-size: 13px; font-weight: 500;
  background: var(--bg); border: 1px solid var(--hairline); color: var(--muted);
  transition: all .14s var(--ease);
}
.chip:hover { border-color: var(--faint); color: var(--text); }
.chip.on { background: var(--accent-soft); border-color: var(--accent-line); color: var(--accent); }
.chip .frame {
  display: block; width: 18px; border: 1.4px solid currentColor; border-radius: 2px;
  opacity: .8;
}

/* slider */
.slider-row { display: flex; align-items: center; gap: 12px; }
input[type=range] {
  -webkit-appearance: none; appearance: none; flex: 1; height: 3px;
  background: var(--hairline); border-radius: 3px; outline-offset: 6px;
}
input[type=range]::-webkit-slider-thumb {
  -webkit-appearance: none; width: 16px; height: 16px; border-radius: 50%;
  background: var(--accent); cursor: pointer; box-shadow: 0 0 0 4px var(--accent-soft);
  transition: box-shadow .15s var(--ease);
}
input[type=range]::-webkit-slider-thumb:hover { box-shadow: 0 0 0 6px var(--accent-soft); }
input[type=range]::-moz-range-thumb {
  width: 16px; height: 16px; border: none; border-radius: 50%;
  background: var(--accent); cursor: pointer;
}
input[type=range]:disabled { opacity: .4; }
input[type=range]:disabled::-webkit-slider-thumb { background: var(--faint); box-shadow: none; }
.readout {
  font-family: var(--font-mono); font-size: 13px; color: var(--text);
  min-width: 64px; text-align: right;
}
.readout .u { color: var(--faint); }

/* toggle */
.toggle-row { display: flex; align-items: center; justify-content: space-between; padding: 3px 0; }
.toggle-row span { font-size: 13.5px; }
.toggle {
  width: 38px; height: 22px; border-radius: 20px; background: var(--surface-3);
  position: relative; transition: background .18s var(--ease); flex-shrink: 0;
}
.toggle::after {
  content: ''; position: absolute; top: 3px; left: 3px; width: 16px; height: 16px;
  border-radius: 50%; background: var(--muted); transition: transform .18s var(--ease), background .18s var(--ease);
}
.toggle:hover:not(.on)::after { background: var(--text); }
.toggle.on { background: var(--accent); }
.toggle.on::after { transform: translateX(16px); background: #fff; }

/* seed */
.seed-row { display: flex; gap: 8px; }
.seed-row input {
  flex: 1; background: var(--bg); border: 1px solid var(--hairline);
  border-radius: var(--radius-sm); padding: 8px 11px;
  font-family: var(--font-mono); font-size: 13px;
}
.seed-row input:focus { outline: none; border-color: var(--accent-line); }
.dice {
  width: 36px; border-radius: var(--radius-sm); border: 1px solid var(--hairline);
  background: var(--bg); color: var(--muted); display: grid; place-items: center;
  transition: all .14s var(--ease);
}
.dice:hover { color: var(--accent); border-color: var(--accent-line); }

/* generate bar */
.generate-bar {
  grid-column: 1 / -1; border-top: 1px solid var(--hairline);
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 20px; background: var(--surface-1);
}
.config-summary { font-family: var(--font-mono); font-size: 12px; color: var(--muted); }
.config-summary b { color: var(--text); font-weight: 500; }
.btn-generate {
  display: inline-flex; align-items: center; gap: 9px;
  background: var(--accent); color: #1A1206; font-weight: 600; font-size: 14.5px;
  padding: 11px 22px; border-radius: 10px;
  transition: transform .12s var(--ease), box-shadow .15s var(--ease), opacity .15s;
  box-shadow: 0 4px 20px rgba(240,169,59,.22);
}
.btn-generate:hover { transform: translateY(-1px); box-shadow: 0 6px 26px rgba(240,169,59,.32); }
.btn-generate:active { transform: translateY(0); }
.btn-generate:disabled { opacity: .45; cursor: not-allowed; transform: none; box-shadow: none; }

/* Subtle keyboard-shortcut pill inside the Generate button (⌘↵ / Ctrl↵). */
.gen-kbd {
  margin-left: 2px; display: inline-flex; align-items: center;
  font-family: var(--font-mono); font-size: 10.5px; line-height: 1; letter-spacing: .02em;
  padding: 3px 5px 2px; border-radius: 5px;
  background: rgba(255, 255, 255, .12); border: 1px solid rgba(255, 255, 255, .16);
  color: inherit; opacity: .7;
}
.btn-generate:disabled .gen-kbd { opacity: .35; }

/* ── Composer dock (floating command bar) ───────────────────────────────────*/
.composer-dock {
  position: fixed; left: var(--sb-w, 264px); right: 0; bottom: 0; z-index: 30;
  container-type: inline-size; container-name: dock; /* responsive to its own width */
  transition: left .22s var(--ease);
  /* bottom padding 0: the shared bottom:26px offset IS the bottom margin —
     identical to Forge's .fg-dock so both docks sit at the same height. */
  padding: 40px 32px 0;
  pointer-events: none; /* the transparent gutter lets the reel scroll under */
  /* light fade only — let reel content show through so the dock refracts it */
  background: linear-gradient(to top, rgba(11, 11, 15, 0.5) 0%, transparent 60%);
}
.dock-row {
  pointer-events: auto;
  width: 100%; margin: 0;        /* always span the full bar (no centred cap) */
  display: flex; flex-wrap: wrap; align-items: center; gap: 9px;
  background: var(--surface-2); border: 1px solid var(--hairline);
  border-radius: 16px; padding: 12px;
  box-shadow: 0 14px 44px rgba(0,0,0,.5), 0 1px 0 rgba(255,255,255,.02) inset;
}

/* Files dragged over the project view: the dock advertises itself as the target.
   (A real element, not ::after — the liquid-glass sheen owns .dock-row::after.) */
.composer-dock.drop-target .dock-row {
  border-color: var(--accent-line);
  box-shadow: 0 0 0 2px var(--accent-soft), 0 14px 44px rgba(0,0,0,.5);
  position: relative;
}
.dock-row > .dock-drop-hint {
  display: none; position: absolute; inset: 0; z-index: 6;
  place-items: center;
  font-size: 13px; font-weight: 600; color: var(--accent);
  background: rgba(11, 12, 17, 0.82); border-radius: 16px;
  pointer-events: none;
}
.composer-dock.drop-target .dock-row > .dock-drop-hint { display: grid; }

/* Stitch modal — Track-style transport + filmstrip with seam markers */
.stitch-tp { display: flex; align-items: center; gap: 8px; padding: 8px 10px; margin-top: 10px; background: var(--surface-1); border: 1px solid var(--hairline); border-radius: 11px; }
.stitch-film { margin-top: 8px; height: 46px; }
.stitch-seam { position: absolute; top: 0; bottom: 0; width: 2px; background: rgba(255,255,255,.55); z-index: 4; }
.stitch-seam.final { width: 4px; margin-left: -1px; background: var(--accent); box-shadow: 0 0 8px var(--accent); cursor: ew-resize; }
.stitch-seam.final::before { content: ''; position: absolute; top: -1px; left: -4px; width: 12px; height: 8px; background: var(--accent); border-radius: 2px; }
.stitch-video { width: 100%; border-radius: 10px; background: #000; }

/* Hover-preview scrub bar (reel cells + library cards) */
.hover-scrub { position: absolute; left: 0; right: 0; bottom: 0; height: 3px; background: rgba(255,255,255,.10); opacity: 0; transition: opacity .18s; pointer-events: none; z-index: 3; }
.hover-scrub i { display: block; height: 100%; width: 0%; background: var(--accent); box-shadow: 0 0 8px var(--accent); }
.playable:hover .hover-scrub { opacity: 1; }

/* The prompt always sits on its own full-width line above the controls. */
.prompt-wrap { order: -1; flex: 1 1 100%; min-width: 0; position: relative; display: flex; }
.prompt-wrap .dock-prompt { width: 100%; }

/* @mention autocomplete menu (rises above the prompt) */
.mention-menu {
  position: absolute; left: 0; bottom: calc(100% + 10px);
  width: 300px; max-width: 80vw; max-height: 264px; overflow-y: auto;
  background: rgba(20, 21, 29, 0.96);
  -webkit-backdrop-filter: saturate(160%) blur(30px); backdrop-filter: saturate(160%) blur(30px);
  border: 1px solid var(--stroke); border-radius: var(--radius); padding: 6px;
  box-shadow: var(--shadow-lg), inset 0 1px 0 var(--glass-hi);
  display: none; z-index: 50;
}
.mention-menu.open { display: block; }
.mention-item {
  display: flex; align-items: center; gap: 10px; width: 100%; text-align: left;
  padding: 7px 9px; border-radius: 10px; color: var(--text);
  transition: background-color .12s var(--ease);
}
.mention-item:hover, .mention-item.sel { background-color: var(--fill); }
.mention-thumb {
  width: 34px; height: 34px; flex-shrink: 0; border-radius: 7px; overflow: hidden;
  display: grid; place-items: center; background: var(--bg); color: var(--muted);
}
.mention-thumb img { width: 100%; height: 100%; object-fit: cover; }
.mention-tok { font-family: var(--font-mono); font-size: 13px; font-weight: 500; }
.mention-name { font-size: 11px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 160px; }
.mention-kind { margin-left: auto; font-size: 10px; color: var(--faint); text-transform: uppercase; letter-spacing: .08em; }

/* ── In-composer Asset Library modal ─────────────────────────────────────────*/
.lib-modal {
  position: fixed; inset: 0; z-index: 88; display: grid; place-items: center; padding: 40px;
  background: rgba(0, 0, 0, 0.62); -webkit-backdrop-filter: blur(10px); backdrop-filter: blur(10px);
  animation: fade-in .18s var(--ease) both;
}
.lib-modal-panel {
  display: flex; flex-direction: column; width: min(960px, 94vw); max-height: 86vh;
  background: rgba(13, 14, 18, 0.985); border: 1px solid var(--stroke); border-radius: var(--radius);
  box-shadow: var(--shadow-lg), inset 0 1px 0 var(--glass-hi); overflow: hidden;
  animation: card-rise .3s var(--spring) both;
}
.lib-modal-top { display: flex; align-items: center; gap: 12px; padding: 16px 20px; border-bottom: 1px solid var(--hairline); flex-shrink: 0; }
.lib-modal-title { display: inline-flex; align-items: center; gap: 9px; font-size: 16px; font-weight: 600; }
.lib-modal-title svg { color: var(--accent); }
.lib-modal-scope { font-family: var(--font-mono); font-size: 11px; color: var(--muted); font-weight: 400; }
.lib-modal-link {
  margin-left: auto; font-size: 12px; color: var(--muted); padding: 5px 10px; border-radius: 8px;
  border: 1px solid var(--hairline); background: var(--fill);
}
.lib-modal-link:hover { color: var(--text); border-color: var(--accent-line); }
.lib-modal-x { width: 32px; height: 32px; border-radius: 8px; color: var(--muted); font-size: 15px; display: grid; place-items: center; border: 1px solid var(--hairline); background: var(--fill); }
.lib-modal-x:hover { color: var(--text); border-color: var(--accent-line); }
.lib-modal-bar { display: flex; align-items: center; gap: 10px; padding: 16px 20px 0; flex-shrink: 0; }
.lib-modal-search {
  flex: 1; min-width: 0; font-size: 13.5px; color: var(--text);
  padding: 9px 13px; border-radius: 10px; border: 1px solid var(--stroke); background: var(--bg);
}
.lib-modal-add {
  flex-shrink: 0; display: inline-flex; align-items: center; gap: 7px;
  font-size: 13px; font-weight: 500; color: var(--bg); background: var(--accent);
  padding: 9px 14px; border-radius: 10px; transition: filter .15s var(--ease), transform .2s var(--spring);
}
.lib-modal-add:hover { filter: brightness(1.08); transform: translateY(-1px); }
.lib-modal-add.ghost { color: var(--text); background: var(--fill); border: 1px solid var(--stroke); }
.lib-modal-add.ghost:hover { border-color: var(--accent-line); filter: none; }
.lib-modal-cats { display: flex; flex-wrap: wrap; gap: 7px; padding: 14px 20px 4px; flex-shrink: 0; }
.lib-modal-grid {
  flex: 1; min-height: 0; overflow-y: auto; padding: 16px 20px;
  display: grid; grid-template-columns: repeat(auto-fill, minmax(196px, 1fr)); gap: 16px;
  /* Size each row to the card's full content and don't stretch cards to the row —
     otherwise the media's aspect-ratio collapses the track and overflow:hidden clips
     the card body (token, category, "Use in composer" button). */
  align-content: start; align-items: start; grid-auto-rows: max-content;
}
.lib-modal-drop {
  flex-shrink: 0; padding: 12px 20px; border-top: 1px dashed var(--hairline);
  font-size: 12px; color: var(--faint); text-align: center;
}
.lib-modal-panel.lib-dragover { outline: 2px dashed var(--accent); outline-offset: -8px; }
.lib-modal-panel.lib-dragover .lib-modal-drop { color: var(--accent); border-top-color: var(--accent-line); }

/* ── Stitch (combine extension + original) modal ───────────────────────────── */
.stitch-modal {
  position: fixed; inset: 0; z-index: 2000; display: grid; place-items: center; padding: 40px;
  background: rgba(0, 0, 0, 0.66); -webkit-backdrop-filter: blur(10px); backdrop-filter: blur(10px);
  animation: fade-in .18s var(--ease) both;
}
.stitch-panel {
  display: flex; flex-direction: column; width: min(760px, 94vw); max-height: 88vh;
  background: rgba(13, 14, 18, 0.985); border: 1px solid var(--stroke); border-radius: var(--radius);
  box-shadow: var(--shadow-lg), inset 0 1px 0 var(--glass-hi); overflow: hidden;
  animation: card-rise .3s var(--spring) both;
}
.stitch-top { display: flex; align-items: center; gap: 12px; padding: 14px 18px; border-bottom: 1px solid var(--hairline); flex-shrink: 0; }
.stitch-title { display: inline-flex; align-items: center; gap: 9px; font-size: 15px; font-weight: 600; }
.stitch-title svg { color: var(--accent); }
.stitch-x { margin-left: auto; width: 30px; height: 30px; border-radius: 8px; color: var(--muted); font-size: 14px; display: grid; place-items: center; border: 1px solid var(--hairline); background: var(--fill); }
.stitch-x:hover { color: var(--text); border-color: var(--accent-line); }
.stitch-body { padding: 16px 18px; overflow-y: auto; min-height: 0; }
.stitch-status { display: flex; align-items: center; gap: 9px; font-size: 13px; color: var(--muted); padding: 28px 0; justify-content: center; }
.stitch-status .spin { width: 15px; height: 15px; border: 2px solid var(--hairline); border-top-color: var(--accent); border-radius: 50%; animation: spin .7s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.stitch-stage { width: 100%; border-radius: 10px; overflow: hidden; background: #000; }
.stitch-video { display: block; width: 100%; max-height: 52vh; background: #000; }
.stitch-info { margin-top: 13px; }
.stitch-line { font-size: 13px; color: var(--text); }
.stitch-ctl { margin-top: 14px; }
.stitch-ctl label { display: flex; align-items: baseline; gap: 8px; font-size: 12px; color: var(--muted); margin-bottom: 6px; }
.stitch-read { color: var(--accent); font-family: var(--font-mono); font-size: 11.5px; }
.stitch-ctl input[type=range] { width: 100%; accent-color: var(--accent); }
.stitch-hint { font-size: 11.5px; color: var(--faint); margin-top: 7px; }
.stitch-foot { display: flex; gap: 10px; justify-content: flex-end; padding: 14px 18px; border-top: 1px solid var(--hairline); flex-shrink: 0; }
.stitch-btn {
  display: inline-flex; align-items: center; gap: 7px; font-size: 13px; font-weight: 500;
  padding: 9px 15px; border-radius: 10px; color: var(--text); background: var(--fill); border: 1px solid var(--stroke); cursor: pointer;
}
.stitch-btn:hover { border-color: var(--accent-line); }
.stitch-btn.primary { color: var(--bg); background: var(--accent); border-color: var(--accent); }
.stitch-btn.primary:hover { filter: brightness(1.08); }
.asset-btn.done { color: var(--ok); background: var(--ok-soft); border-color: var(--ok-soft); cursor: default; opacity: 1; }

/* ── Digital character roster: composer chips + library modal ──────────────── */
.char-chips { display: flex; flex-wrap: wrap; gap: 7px; }
.char-chip { display: inline-flex; align-items: center; gap: 7px; padding: 4px 8px 4px 4px; border-radius: 20px; background: var(--fill); border: 1px solid var(--hairline); }
.char-chip-name { font-size: 12px; color: var(--text); max-width: 120px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.char-chip-x { width: 16px; height: 16px; border-radius: 50%; color: var(--muted); font-size: 10px; display: grid; place-items: center; }
/* The character's @Image_N tag — inline on the chip (the slot-tag base styles
   assume absolute positioning inside a media tile). */
.char-chip-tag { position: static; font-family: var(--font-mono); font-size: 10px; padding: 2px 6px; border-radius: 6px; background: var(--surface-3); color: var(--muted); cursor: pointer; }
.char-chip-tag:hover { color: var(--accent); }
.char-chip-x:hover { color: var(--text); }
.char-add { display: inline-flex; align-items: center; gap: 6px; padding: 5px 11px; border-radius: 20px; font-size: 12px; color: var(--muted); border: 1px dashed var(--stroke); background: transparent; cursor: pointer; }
.char-add:hover:not(:disabled) { color: var(--accent); border-color: var(--accent-line); }
.char-add:disabled { opacity: .4; cursor: default; }
.char-ava { width: 26px; height: 26px; border-radius: 50%; flex-shrink: 0; background: var(--surface-3) center/cover no-repeat; display: grid; place-items: center; font-size: 10px; font-weight: 600; color: var(--muted); overflow: hidden; }
.char-ava.initials { background: linear-gradient(150deg, var(--surface-3), var(--surface-2)); color: var(--text); }

.char-modal { position: fixed; inset: 0; z-index: 2000; display: grid; place-items: center; padding: 40px; background: rgba(0,0,0,0.66); -webkit-backdrop-filter: blur(10px); backdrop-filter: blur(10px); animation: fade-in .18s var(--ease) both; }
.char-panel { display: flex; flex-direction: column; width: min(860px, 95vw); max-height: 88vh; background: rgba(13,14,18,0.985); border: 1px solid var(--stroke); border-radius: var(--radius); box-shadow: var(--shadow-lg), inset 0 1px 0 var(--glass-hi); overflow: hidden; animation: card-rise .3s var(--spring) both; }
.char-top { display: flex; align-items: center; gap: 12px; padding: 14px 18px; border-bottom: 1px solid var(--hairline); flex-shrink: 0; }
.char-title { display: inline-flex; align-items: center; gap: 9px; font-size: 15px; font-weight: 600; }
.char-title svg { color: var(--accent); }
.char-x { margin-left: auto; width: 30px; height: 30px; border-radius: 8px; color: var(--muted); font-size: 14px; display: grid; place-items: center; border: 1px solid var(--hairline); background: var(--fill); }
.char-x:hover { color: var(--text); border-color: var(--accent-line); }
.char-add-wrap { padding: 14px 18px; border-bottom: 1px solid var(--hairline); flex-shrink: 0; }
.char-howto { font-size: 12px; color: var(--faint); line-height: 1.5; margin-bottom: 10px; }

/* Private portrait library (ModelArk trusted assets) — the live section that
   sits above the manual roster inside the characters modal. */
.pf-lib { padding: 12px 18px 4px; border-bottom: 1px solid var(--hairline); }
.pf-head { display: flex; align-items: baseline; gap: 9px; margin-bottom: 9px; }
.pf-title { font-size: 13px; font-weight: 600; color: var(--text); }
.pf-sub { flex: 1; font-size: 11.5px; color: var(--faint); }
.pf-row { display: flex; align-items: center; gap: 8px; margin-bottom: 8px; }
.pf-row .char-in { flex: 1; min-width: 0; }
.pf-select { min-width: 180px; }
.pf-err {
  display: flex; flex-direction: column; gap: 9px; align-items: flex-start;
  font-size: 12px; line-height: 1.55; color: var(--muted);
  background: var(--surface-1); border: 1px solid var(--hairline);
  border-radius: 10px; padding: 11px 13px; margin-bottom: 10px;
}
.pf-grid { flex: none; max-height: 300px; padding: 2px 0 12px; }
.pf-thumb { border-radius: 8px; width: 100%; height: 84px; font-size: 22px; }
.pf-name { padding: 2px 0; border: none; }
.pf-status { text-transform: capitalize; }
.pf-status.active { color: var(--ok, #3db46a); }
.pf-status.processing { color: var(--accent); }
.pf-status.failed { color: var(--danger, #e5534b); }
.char-form { display: flex; gap: 8px; }
.char-in { flex: 1; min-width: 0; font-size: 13px; color: var(--text); padding: 8px 11px; border-radius: 9px; border: 1px solid var(--stroke); background: var(--bg); }
.char-in.mono { font-family: var(--font-mono); font-size: 12px; flex: 1.4; }
.char-bulk-toggle { margin-top: 10px; font-size: 11.5px; color: var(--muted); background: none; border: none; cursor: pointer; padding: 0; }
.char-bulk-toggle:hover { color: var(--accent); }
.char-bulk { margin-top: 8px; display: flex; flex-direction: column; gap: 8px; }
.char-bulk.hidden { display: none; }
.char-bulk-ta { width: 100%; min-height: 80px; resize: vertical; font-family: var(--font-mono); font-size: 12px; color: var(--text); padding: 9px 11px; border-radius: 9px; border: 1px solid var(--stroke); background: var(--bg); }
.char-bar { padding: 12px 18px 0; flex-shrink: 0; }
.char-search { width: 100%; font-size: 13px; color: var(--text); padding: 8px 12px; border-radius: 9px; border: 1px solid var(--stroke); background: var(--bg); }
.char-grid { flex: 1; min-height: 0; overflow-y: auto; padding: 14px 18px; display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 12px; align-content: start; align-items: start; grid-auto-rows: max-content; }
.char-empty { grid-column: 1 / -1; color: var(--muted); font-size: 13px; text-align: center; padding: 30px 0; }
.char-card { display: flex; flex-direction: column; gap: 9px; padding: 12px; border: 1px solid var(--hairline); border-radius: 12px; background: var(--surface-1); }
.char-card.on { border-color: var(--accent-line); background: var(--accent-soft); }
.char-card .char-ava { width: 40px; height: 40px; font-size: 14px; }
.char-card-body { min-width: 0; }
.char-card-name { width: 100%; font-size: 13.5px; font-weight: 500; color: var(--text); background: transparent; border: 1px solid transparent; border-radius: 6px; padding: 2px 5px; }
.char-card-name:hover { border-color: var(--hairline); }
.char-card-name:focus { border-color: var(--accent-line); background: var(--bg); outline: none; }
.char-card-id { font-family: var(--font-mono); font-size: 10.5px; color: var(--faint); padding: 0 5px; margin-top: 2px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.char-card-row { display: flex; gap: 8px; }
.char-btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; font-size: 12.5px; font-weight: 500; padding: 7px 12px; border-radius: 9px; color: var(--text); background: var(--fill); border: 1px solid var(--stroke); cursor: pointer; }
.char-btn:hover:not(:disabled) { background: rgba(255,255,255,0.08); border-color: var(--accent-line); }
.char-btn:disabled { opacity: .5; cursor: default; }
.char-btn.grow { flex: 1; }
.char-btn.primary { color: var(--bg); background: var(--accent); border-color: var(--accent); }
.char-btn.primary:hover { filter: brightness(1.08); }
.char-btn.done { color: var(--ok); background: var(--ok-soft); border-color: var(--ok-soft); }
.char-btn.danger:hover { color: var(--danger, #ff6b6b); border-color: var(--danger, #ff6b6b); background: transparent; }

.dock-prompt {
  flex: 1; min-width: 0; resize: none; overflow-y: auto;
  background: transparent; border: none; outline: none;
  font-size: 15px; line-height: 1.5; color: var(--text);
  padding: 8px 6px; min-height: 24px; max-height: 140px;
}
.dock-prompt::placeholder { color: var(--faint); }

.dock-btn {
  display: inline-flex; align-items: center; gap: 7px; flex-shrink: 0;
  padding: 9px 13px; border-radius: 10px; max-width: 220px;
  font-family: var(--font-mono); font-size: 12.5px; letter-spacing: .01em;
  background: var(--bg); border: 1px solid var(--hairline); color: var(--muted);
  transition: color .14s var(--ease), border-color .14s var(--ease), background .14s var(--ease);
}
.dock-btn:hover { color: var(--text); border-color: var(--accent-line); }
.dock-btn.has { color: var(--text); }
.dock-btn.active { color: var(--accent); border-color: var(--accent-line); background: var(--accent-soft); }
.dock-btn span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dock-btn svg { flex-shrink: 0; }

/* Attach button is icon-only — match the square icon buttons; accent when media attached. */
.dock-btn.attach { width: 38px; height: 38px; padding: 0; gap: 0; justify-content: center; }
.dock-btn.attach.has { color: var(--accent); border-color: var(--accent-line); background: var(--accent-soft); }

.dock-icon {
  flex-shrink: 0; width: 38px; height: 38px; border-radius: 10px;
  display: grid; place-items: center; color: var(--muted);
  background: var(--bg); border: 1px solid var(--hairline);
  transition: color .14s var(--ease), border-color .14s var(--ease);
}
.dock-icon:hover { color: var(--accent); border-color: var(--accent-line); }
.dock-icon.optimize:hover { color: var(--accent); }
.dock-icon.busy { color: var(--accent); border-color: var(--accent-line); animation: pp-pulse 1s var(--ease) infinite; }
.dock-icon.has-scene { color: var(--accent); border-color: var(--accent-line); background: var(--accent-soft); }
@keyframes pp-pulse { 50% { opacity: .45; } }

.rail-note { margin-top: 8px; font-size: 11.5px; line-height: 1.45; color: var(--faint); }

.dock-cost {
  flex-shrink: 0; font-family: var(--font-mono); font-size: 14px;
  color: var(--text); white-space: nowrap; padding: 0 6px 0 2px; cursor: help;
  margin-left: auto; /* push the cost + Generate group to the right edge */
}
.dock-cost .cap {
  color: var(--faint); font-size: 9.5px; text-transform: uppercase;
  letter-spacing: .12em; margin-right: 6px;
}
.dock-cost .usd { color: var(--faint); margin-left: 8px; font-size: 12.5px; }

/* popovers that rise above the bar */
.pop-wrap { position: relative; flex-shrink: 0; }
.popover {
  position: absolute; bottom: calc(100% + 12px);
  background: var(--surface-1); border: 1px solid var(--hairline);
  border-radius: var(--radius); padding: 16px;
  box-shadow: 0 18px 54px rgba(0,0,0,.55);
  opacity: 0; transform: translateY(8px) scale(.98); pointer-events: none;
  transition: opacity .16s var(--ease), transform .16s var(--ease);
  z-index: 40;
}
.popover.open { opacity: 1; transform: none; pointer-events: auto; }
.refs-pop { left: 0; width: 384px; max-width: calc(100vw - 64px); }
.settings-pop { right: 0; width: 344px; max-width: calc(100vw - 64px); }
/* never taller than the space above the dock — scroll inside instead */
.popover { max-height: calc(100vh - 220px); overflow-y: auto; overscroll-behavior: contain; }
.pop-head {
  font-family: var(--font-mono); font-size: 10.5px; font-weight: 500;
  letter-spacing: .12em; text-transform: uppercase; color: var(--muted);
  margin-bottom: 12px;
}
.refs-pop .seg { display: flex; width: 100%; margin-bottom: 4px; }
.refs-pop .seg button { flex: 1; }
.refs-pop .refs-wrap { max-height: 52vh; overflow-y: auto; padding-right: 2px; }
.settings-body > .field-label:first-child { margin-top: 2px; }

/* ── Per-project cost analysis ──────────────────────────────────────────────*/
.project-analysis {
  background: var(--surface-1); border: 1px solid var(--hairline);
  border-radius: var(--radius); padding: 15px 18px; margin-top: 4px;
}
.project-analysis:empty { display: none; }
.pa-head {
  display: flex; align-items: center; gap: 9px; margin-bottom: 13px;
  font-family: var(--font-mono); font-size: 10.5px; font-weight: 500;
  letter-spacing: .12em; text-transform: uppercase; color: var(--muted);
}
.pa-head .hint { color: var(--faint); letter-spacing: 0; text-transform: none; font-size: 11px; }
.pa-top { display: flex; gap: 30px; margin-bottom: 4px; }
.pa-fig { display: flex; flex-direction: column; gap: 1px; }
.pa-fig b { font-family: var(--font-mono); font-size: 19px; font-weight: 500; color: var(--text); }
.pa-fig span { font-size: 11px; color: var(--faint); }
.pa-bars { display: flex; flex-direction: column; gap: 6px; margin-top: 14px; }
.pa-bar { display: flex; align-items: center; gap: 10px; font-family: var(--font-mono); font-size: 11.5px; }
.pa-bar .r { width: 48px; color: var(--muted); }
.pa-bar .track { flex: 1; height: 7px; background: var(--surface-3); border-radius: 6px; overflow: hidden; }
.pa-bar .track i { display: block; height: 100%; background: var(--accent-line); border-radius: 6px; }
.pa-bar .v { width: 66px; text-align: right; color: var(--text); }
.pa-none { font-size: 12.5px; color: var(--faint); }

/* ── The reel ───────────────────────────────────────────────────────────────*/
.reel-head {
  display: flex; align-items: center; gap: 12px; margin: 34px 0 16px;
}
.reel-head h3 {
  font-family: var(--font-mono); font-size: 11px; font-weight: 500;
  letter-spacing: 0.14em; text-transform: uppercase; color: var(--muted);
}
.reel-head .rule { flex: 1; height: 1px; background: var(--hairline); }

.reel { display: flex; flex-direction: column; gap: 14px; }
/* Incremental-load tail: sits after the last materialized cell/card while more
   matches remain; scrolling it near the viewport appends the next batch. */
.reel-more { display: grid; place-items: center; padding: 22px 0; min-height: 64px; grid-column: 1 / -1; }

/* Decode-free scrub preview: the nearest sprite tile floats above the playhead
   while dragging a film strip — instant feedback while the video seek lands. */
.scrub-tile {
  display: none; position: absolute; bottom: calc(100% + 10px); z-index: 6;
  width: 148px; height: 84px; transform: translateX(-50%);
  border: 1px solid var(--stroke); border-radius: 8px;
  background-color: #000; background-repeat: no-repeat;
  box-shadow: 0 10px 30px rgba(0,0,0,.55);
  pointer-events: none;
}
.scrub-tile.on { display: block; }

.cell {
  display: grid; grid-template-columns: 380px 1fr;
  background: var(--surface-1); border: 1px solid var(--hairline);
  border-radius: var(--radius); overflow: hidden;
  transition: border-color .2s var(--ease), box-shadow .3s var(--ease);
}
.cell.running { border-color: var(--run); box-shadow: 0 0 0 1px rgba(91,163,245,.5), 0 0 32px var(--run-soft); }

.cell-frame {
  aspect-ratio: 16 / 9; background: #0E0E13; position: relative;
  display: grid; place-items: center; overflow: hidden;
}
.cell-frame video { width: 100%; height: 100%; object-fit: contain; background: #000; }
/* Poster-first cells: static JPEG at rest; the hover <video> facade covers it. */
.cell-frame img.cell-poster, .lib-frame img.cell-poster { width: 100%; height: 100%; object-fit: contain; background: #000; }
.lib-frame { position: relative; }
video.cell-hovervid { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: contain; background: #000; }
.cell-frame.playable { cursor: pointer; }
/* click-to-expand cue, top-right of the thumbnail */
.frame-hint {
  position: absolute; top: 8px; right: 8px; width: 28px; height: 28px;
  display: grid; place-items: center; border-radius: 8px; color: #fff;
  background: rgba(0,0,0,.5); opacity: 0; transition: opacity .15s var(--ease);
  pointer-events: none;
}
.cell-frame.playable:hover .frame-hint { opacity: 1; }

/* ── Fullscreen video modal ─────────────────────────────────────────────────*/
.vmodal {
  position: fixed; inset: 0; z-index: 80;
  background: rgba(8,8,12,.82); backdrop-filter: blur(6px);
  display: flex; align-items: flex-start; justify-content: center;
  padding: 28px; overflow-y: auto;
  animation: vmodal-in .18s var(--ease);
}
@keyframes vmodal-in { from { opacity: 0; } to { opacity: 1; } }
.vmodal-panel {
  width: 100%; max-width: 1040px; margin: auto;
  background: var(--surface-1); border: 1px solid var(--hairline);
  border-radius: var(--radius); overflow: hidden;
  box-shadow: 0 30px 80px rgba(0,0,0,.6);
}
.vmodal-top { padding: 12px 16px; border-bottom: 1px solid var(--hairline); }
.vmodal-back {
  display: inline-flex; align-items: center; gap: 7px;
  font-size: 13.5px; font-weight: 500; color: var(--muted);
  padding: 7px 12px; border-radius: 8px; border: 1px solid var(--hairline);
  transition: color .14s var(--ease), border-color .14s var(--ease);
}
.vmodal-back:hover { color: var(--text); border-color: var(--faint); }
.vmodal-stage { background: #000; display: grid; place-items: center; }
.vmodal-stage video { width: 100%; max-height: 64vh; display: block; background: #000; }
.vmodal-meta { padding: 20px 22px 24px; }
.vmodal-label {
  font-family: var(--font-mono); font-size: 10.5px; font-weight: 500;
  letter-spacing: .12em; text-transform: uppercase; color: var(--muted);
  margin: 18px 0 9px;
}
.vmodal-label:first-child { margin-top: 0; }
.vmodal-prompt { font-size: 15px; line-height: 1.55; color: var(--text); white-space: pre-wrap; }
.vmodal-prompt.empty { color: var(--faint); font-style: italic; }
/* collapsed: clamp to 3 lines. expanded: cap at ~9 lines, then scroll. */
.vmodal-prompt.collapsed {
  display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden;
}
.vmodal-prompt:not(.collapsed) {
  max-height: calc(1.55em * 9); overflow-y: auto; padding-right: 8px;
}
.vmodal-plabel { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.vmodal-ptoggle {
  font-family: var(--font-ui); font-size: 12px; font-weight: 500; text-transform: none; letter-spacing: 0;
  color: var(--accent); background: none; border: none; cursor: pointer; padding: 2px 4px;
}
.vmodal-ptoggle:hover { color: var(--accent-hi); }
.vmodal-refs { display: flex; flex-wrap: wrap; gap: 10px; }
.vmodal-refs .ref-slot { width: 92px; height: 92px; flex: none; }
.vmodal-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.vmodal-actions .act { font-size: 13px; padding: 8px 13px; }

/* Multi-shot detection: the shot list in the detail modal + cut markers on the
   filmstrip. Rows are clickable (play that shot) with a per-row save button. */
.shot-list { display: flex; flex-direction: column; gap: 6px; }
.shot-head, .shot-note {
  font-size: 12.5px; color: var(--muted); line-height: 1.5;
}
.shot-note { color: var(--faint); }
.shot-link {
  font: inherit; color: var(--accent); background: none; border: none;
  padding: 0; cursor: pointer; text-decoration: underline; text-underline-offset: 2px;
}
.shot-link:hover { color: var(--accent-hi); }
.shot-row {
  display: flex; align-items: center; gap: 11px;
  padding: 7px 9px; border-radius: 9px; cursor: pointer;
  border: 1px solid var(--hairline); background: var(--surface-2, rgba(255, 255, 255, .02));
  transition: border-color .14s var(--ease), background .14s var(--ease);
}
.shot-row:hover { border-color: var(--faint); background: rgba(255, 255, 255, .045); }
.shot-row:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.shot-row.on { border-color: var(--accent); background: rgba(255, 255, 255, .05); }
.shot-thumb {
  width: 62px; height: 35px; flex: none; border-radius: 5px;
  background: #000 center/cover no-repeat; box-shadow: inset 0 0 0 1px var(--hairline);
}
.shot-info { flex: 1; min-width: 0; }
.shot-name { font-size: 13.5px; font-weight: 500; color: var(--text); }
.shot-time { font-family: var(--font-mono); font-size: 11px; color: var(--muted); margin-top: 2px; }
.shot-dur {
  font-family: var(--font-mono); font-size: 11px; color: var(--muted);
  padding: 3px 6px; border-radius: 5px; border: 1px solid var(--hairline); flex: none;
}
.shot-dl {
  flex: none; display: grid; place-items: center; width: 30px; height: 30px;
  border-radius: 7px; border: 1px solid var(--hairline); color: var(--muted); cursor: pointer;
  transition: color .14s var(--ease), border-color .14s var(--ease);
}
.shot-dl:hover { color: var(--text); border-color: var(--faint); }
.shot-dl.busy, .shot-dl:disabled { opacity: .5; cursor: progress; }
.shot-cuts { position: absolute; inset: 0; pointer-events: none; z-index: 2; }
.shot-cut {
  position: absolute; top: 0; bottom: 0; width: 2px; margin-left: -1px;
  background: #fff; opacity: .85; box-shadow: 0 0 0 1px rgba(0, 0, 0, .55);
}

.placeholder { text-align: center; color: var(--faint); padding: 20px; width: 100%; }
.placeholder .status-word {
  font-family: var(--font-mono); font-size: 11px; letter-spacing: .12em;
  text-transform: uppercase; margin-top: 12px;
}
.placeholder.queued .status-word { color: var(--muted); }
.placeholder.running .status-word { color: var(--run); }
.placeholder.failed .status-word { color: var(--danger); }
.placeholder.cancelled .status-word { color: var(--faint); }
.placeholder .err-msg { font-size: 11.5px; margin-top: 6px; color: var(--faint); max-width: 230px; }

/* live progress + ETA on a running render */
.progress { margin: 14px auto 0; width: 72%; max-width: 240px; }
.progress-track { height: 5px; border-radius: 6px; background: var(--surface-3); overflow: hidden; }
.progress-track i { display: block; height: 100%; border-radius: 6px; background: var(--run); transition: width .9s var(--ease); }
.progress-meta { margin-top: 7px; text-align: center; font-family: var(--font-mono); font-size: 11px; letter-spacing: .04em; color: var(--run); }

/* scanning shimmer for an active render */
.scan {
  position: absolute; inset: 0; overflow: hidden;
}
.scan::after {
  content: ''; position: absolute; top: 0; bottom: 0; width: 40%;
  background: linear-gradient(90deg, transparent, var(--run-soft), transparent);
  animation: sweep 1.8s var(--ease) infinite;
}
@keyframes sweep { from { left: -40%; } to { left: 100%; } }

.spinner {
  width: 30px; height: 30px; border-radius: 50%; margin: 0 auto;
  border: 2px solid var(--surface-3); border-top-color: var(--run);
  animation: spin .9s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

.cell-body { padding: 16px 18px; display: flex; flex-direction: column; min-width: 0; }
.cell-prompt {
  font-size: 14px; line-height: 1.5; color: var(--text);
  display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden;
}
.cell-prompt.empty { color: var(--faint); font-style: italic; }

.tags { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 12px; }
.tag {
  font-family: var(--font-mono); font-size: 11px; color: var(--muted);
  background: var(--bg); border: 1px solid var(--hairline);
  padding: 2px 8px; border-radius: 6px;
}
.tag.seed { color: var(--text); border-color: var(--accent-line); background: var(--accent-soft); }
.tag.pp { color: var(--muted); border-color: var(--hairline); background: var(--fill); }

/* PromptPilot review block — neutral glass card */
.review {
  margin-top: 12px; padding: 12px 14px; border-radius: var(--radius-sm);
  background: rgba(255, 255, 255, 0.045); border: 1px solid var(--hairline);
}
.review-head {
  display: flex; align-items: center; gap: 6px; color: var(--muted);
  font-family: var(--font-mono); font-size: 10.5px; letter-spacing: .1em;
  text-transform: uppercase; margin-bottom: 8px;
}
.review-body { font-size: 13px; line-height: 1.55; color: var(--text); }
.review-use {
  margin-top: 11px; display: inline-flex; align-items: center; gap: 6px;
  font-size: 12.5px; font-weight: 500; color: var(--text);
  padding: 6px 12px; border-radius: 8px; border: 1px solid var(--stroke); background: var(--fill);
  transition: background .15s var(--ease), border-color .15s var(--ease), transform .25s var(--spring);
}
.review-use:hover { border-color: var(--accent-line); transform: translateY(-1px); }

.act.busy { opacity: .6; pointer-events: none; }

.tag.director {
  color: var(--accent); border-color: var(--accent-line); background: var(--accent-soft);
  display: inline-flex; align-items: center; gap: 4px;
}
.tag.director svg { width: 11px; height: 11px; }

/* ── Director Mode run panel (above the reel) ─────────────────────────────────*/
.director-panel:empty { display: none; }
.director-card {
  margin: 0 0 16px; padding: 14px 16px; border-radius: var(--radius);
  background: var(--surface-1); border: 1px solid var(--hairline);
  box-shadow: var(--shadow-lg), inset 0 1px 0 var(--glass-hi);
}
.director-card.completed { border-color: var(--ok-soft); }
.director-card.failed { border-color: rgba(229, 92, 92, 0.4); }
.dir-head { display: flex; align-items: center; gap: 10px; }
.dir-title {
  display: inline-flex; align-items: center; gap: 7px; font-weight: 600; color: var(--text);
}
.dir-title svg { color: var(--accent); }
.dir-status {
  font-family: var(--font-mono); font-size: 10.5px; letter-spacing: .1em; text-transform: uppercase;
  color: var(--muted); padding: 2px 9px; border-radius: 20px; background: var(--fill);
}
.dir-status.live { color: var(--run); background: var(--run-soft); animation: concpulse 1.4s ease-in-out infinite; }
.dir-head-actions { margin-left: auto; }
.dir-btn {
  font-size: 12.5px; font-weight: 500; color: var(--text); padding: 6px 12px; border-radius: 8px;
  border: 1px solid var(--stroke); background: var(--fill);
  transition: background .15s var(--ease), border-color .15s var(--ease), transform .25s var(--spring);
}
.dir-btn:hover { border-color: var(--accent-line); transform: translateY(-1px); }
.dir-btn.primary { color: var(--bg); background: var(--accent); border-color: transparent; display: inline-flex; align-items: center; gap: 6px; }
.dir-line { margin-top: 8px; font-size: 13px; color: var(--muted); }
.dir-rounds { margin-top: 12px; display: flex; flex-direction: column; gap: 8px; }
.dir-round { display: flex; gap: 11px; align-items: flex-start; }
.dir-rscore {
  flex-shrink: 0; width: 34px; height: 34px; border-radius: 8px; display: grid; place-items: center;
  font-family: var(--font-mono); font-size: 13px; font-weight: 600;
  color: var(--muted); background: var(--fill); border: 1px solid var(--hairline);
}
.dir-rscore.good { color: var(--ok); background: var(--ok-soft); border-color: var(--ok-soft); }
.dir-rscore.ok { color: var(--run); background: var(--run-soft); border-color: var(--run-soft); }
.dir-rscore.low { color: #E5928A; background: rgba(229, 92, 92, 0.14); border-color: rgba(229, 92, 92, 0.2); }
.dir-rbody { min-width: 0; }
.dir-rhead {
  font-family: var(--font-mono); font-size: 10.5px; letter-spacing: .08em; text-transform: uppercase;
  color: var(--faint); margin-bottom: 2px;
}
.dir-rcrit { font-size: 12.5px; line-height: 1.5; color: var(--text); }
.dir-final {
  margin-top: 13px; padding-top: 13px; border-top: 1px solid var(--hairline);
}
.dir-prompt-row { margin-bottom: 10px; }
.dir-final-label {
  font-family: var(--font-mono); font-size: 10.5px; letter-spacing: .1em; text-transform: uppercase;
  color: var(--muted); margin-bottom: 6px;
}
.dir-final-prompt {
  font-size: 13px; line-height: 1.55; color: var(--text);
  padding: 9px 12px; border-radius: var(--radius-sm); background: var(--fill); border: 1px solid var(--hairline);
}
.dir-final-prompt.subtle { color: var(--muted); background: transparent; border-color: var(--hairline); }
.dir-final-actions { margin-top: 11px; display: flex; align-items: center; gap: 9px; }
.dir-final-cta { font-size: 13px; color: var(--muted); }
.dir-res {
  font-family: var(--font-mono); font-size: 12.5px; color: var(--text);
  padding: 6px 10px; border-radius: 8px; border: 1px solid var(--stroke); background: var(--bg);
}

/* ── "More" dropdown on each reel cell ───────────────────────────────────────*/
.cell-menu-wrap { position: relative; display: inline-flex; }
.cell-menu {
  position: absolute; right: 0; bottom: calc(100% + 6px); z-index: 30;
  min-width: 158px; display: none; flex-direction: column; gap: 2px; padding: 5px;
  background: rgba(20, 21, 29, 0.97);
  -webkit-backdrop-filter: saturate(160%) blur(24px); backdrop-filter: saturate(160%) blur(24px);
  border: 1px solid var(--stroke); border-radius: 12px;
  box-shadow: var(--shadow-lg), inset 0 1px 0 var(--glass-hi);
}
.cell-menu.open { display: flex; animation: pop-in .14s var(--ease) both; }
@keyframes pop-in { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: none; } }
.cell-menu-item {
  display: flex; align-items: center; gap: 9px; width: 100%; text-align: left;
  padding: 8px 10px; border-radius: 8px; color: var(--text); font-size: 12.5px; white-space: nowrap;
  transition: background-color .12s var(--ease);
}
.cell-menu-item:hover { background: var(--fill); }
.cell-menu-item svg { color: var(--muted); flex-shrink: 0; }

/* ── Director Mode right-side drawer + edge tab ──────────────────────────────*/
.director-tab {
  position: fixed; right: 0; top: 50%; transform: translateY(-50%) translateX(100%);
  z-index: 60; display: none; flex-direction: column; align-items: center; gap: 7px;
  padding: 14px 9px; border-radius: 12px 0 0 12px; cursor: pointer;
  background: var(--surface-1); border: 1px solid var(--hairline); border-right: none;
  color: var(--text); box-shadow: var(--shadow-lg);
  transition: transform .35s var(--spring), background-color .15s var(--ease);
}
.director-tab.show { display: flex; transform: translateY(-50%) translateX(0); }
.director-tab:hover { background: var(--surface-2); }
.director-tab span {
  writing-mode: vertical-rl; rotate: 180deg; font-size: 11px; font-weight: 600;
  letter-spacing: .08em; text-transform: uppercase;
}
.director-tab svg { color: var(--accent); }
.director-tab.live svg { animation: concpulse 1.4s ease-in-out infinite; }

.director-drawer {
  position: fixed; top: 0; right: 0; height: 100vh; width: 390px; max-width: 92vw; z-index: 61;
  background: rgba(11, 12, 15, 0.985);
  -webkit-backdrop-filter: saturate(140%) blur(20px); backdrop-filter: saturate(140%) blur(20px);
  border-left: 1px solid var(--stroke); box-shadow: -24px 0 60px rgba(0, 0, 0, 0.55);
  transform: translateX(100%); transition: transform .4s var(--spring);
  display: flex; flex-direction: column;
}
.director-drawer.open { transform: translateX(0); }
.dd-inner { display: flex; flex-direction: column; height: 100%; min-height: 0; }
.dd-head {
  display: flex; align-items: center; gap: 10px; padding: 16px 18px;
  border-bottom: 1px solid var(--hairline); flex-shrink: 0;
}
.dd-title { display: inline-flex; align-items: center; gap: 8px; font-weight: 600; }
.dd-title svg { color: var(--accent); }
.dd-x {
  margin-left: auto; width: 30px; height: 30px; border-radius: 8px; color: var(--muted);
  display: grid; place-items: center; font-size: 15px;
  border: 1px solid var(--hairline); background: var(--fill);
}
.dd-x:hover { color: var(--text); border-color: var(--accent-line); }
.dd-scroll { flex: 1; min-height: 0; overflow-y: auto; padding: 16px 18px; }
.dd-section-label {
  font-family: var(--font-mono); font-size: 10px; letter-spacing: .12em; text-transform: uppercase;
  color: var(--faint); margin: 16px 0 9px;
}
.dd-rounds { display: flex; flex-direction: column; gap: 11px; }
.dd-round {
  display: flex; gap: 11px; padding: 10px; border-radius: var(--radius-sm);
  background: rgba(255, 255, 255, 0.035); border: 1px solid var(--hairline);
}
.dd-thumb {
  width: 84px; height: 56px; flex-shrink: 0; border-radius: 7px; object-fit: cover;
  background: var(--bg); cursor: pointer;
}
.dd-thumb.empty { display: grid; place-items: center; color: var(--faint); font-size: 16px; cursor: default; }
.dd-rmeta { min-width: 0; flex: 1; }
.dd-rhead {
  display: flex; align-items: center; gap: 8px; font-family: var(--font-mono);
  font-size: 11px; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); margin-bottom: 5px;
}
.dd-round.is-best { border-color: var(--ok-soft); background: var(--ok-soft); }
.dd-verdict {
  font-family: var(--font-mono); font-size: 9.5px; letter-spacing: .06em; text-transform: uppercase;
  padding: 2px 7px; border-radius: 20px; color: var(--muted); background: var(--fill);
}
.dd-verdict.best { color: var(--ok); background: var(--ok-soft); }
.dd-verdict.better { color: var(--run); background: var(--run-soft); }
.dd-verdict.kept { color: var(--faint); background: var(--surface-3); }
.dd-verdict.base { color: var(--muted); background: var(--fill); }
.dd-verdict.err { color: var(--danger); background: var(--err-soft); }
.dd-rprompt { font-size: 12.5px; line-height: 1.5; color: var(--text); }
.dd-rcrit { font-size: 12px; line-height: 1.5; color: var(--muted); margin-top: 5px; }
.dd-rcrit.err { color: #E5928A; }
.dd-use {
  margin-top: 9px; display: inline-flex; align-items: center; gap: 6px;
  font-size: 11.5px; font-weight: 500; color: var(--text);
  padding: 5px 10px; border-radius: 8px; border: 1px solid var(--stroke); background: var(--fill);
  transition: background-color .15s var(--ease), border-color .15s var(--ease), transform .2s var(--spring);
}
.dd-use:hover { border-color: var(--accent-line); transform: translateY(-1px); }
.dd-use svg { width: 12px; height: 12px; color: var(--muted); }
.dd-empty { color: var(--faint); font-size: 13px; padding: 8px 0; }
.dd-final { margin-top: 18px; padding-top: 16px; border-top: 1px solid var(--hairline); }
.dd-final-actions { margin-top: 12px; display: flex; align-items: center; gap: 9px; flex-wrap: wrap; }
.dd-foot {
  flex-shrink: 0; padding: 14px 18px; border-top: 1px solid var(--hairline);
  display: flex; justify-content: flex-end;
}

/* ── Asset library view ──────────────────────────────────────────────────────*/
.assets-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; padding: 28px 32px 0; }
.assets-head h1 { font-size: 26px; font-weight: 600; }
.assets-sub { margin-top: 5px; color: var(--muted); font-size: 13.5px; }
.assets-sub code { font-family: var(--font-mono); font-size: 12px; color: var(--accent); background: var(--accent-soft); padding: 1px 6px; border-radius: 6px; }
.assets-actions { display: flex; gap: 8px; flex-shrink: 0; }
.assets-add {
  display: inline-flex; align-items: center; gap: 7px;
  font-size: 13px; font-weight: 500; color: var(--bg); background: var(--accent);
  padding: 9px 15px; border-radius: 10px;
  transition: transform .2s var(--spring), filter .15s var(--ease), background-color .15s var(--ease);
}
.assets-add:hover { transform: translateY(-1px); filter: brightness(1.08); }
.assets-add.ghost { color: var(--text); background: var(--fill); border: 1px solid var(--stroke); }
.assets-add.ghost:hover { border-color: var(--accent-line); filter: none; }
/* drag-and-drop affordance on the whole view */
#workspace.assets-dragover { outline: 2px dashed var(--accent-line); outline-offset: -10px; border-radius: var(--radius); }
#workspace.assets-dragover::after {
  content: 'Drop files to add to the library'; position: fixed; inset: auto 0 28px 0; margin: 0 auto;
  width: max-content; padding: 9px 16px; border-radius: 20px; z-index: 70;
  font-size: 13px; color: var(--bg); background: var(--accent); box-shadow: var(--shadow-lg); pointer-events: none;
}
.assets-bar { padding: 18px 32px 0; margin: 0; border: none; background: none; }
.assets-filter { display: flex; gap: 8px; flex-wrap: wrap; padding: 14px 32px 0; }
.assets-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(212px, 1fr)); gap: 16px;
  padding: 20px 32px 60px;
}
.assets-empty { grid-column: 1 / -1; color: var(--muted); font-size: 14px; padding: 40px 0; text-align: center; }
.asset-card {
  border: 1px solid var(--hairline); border-radius: var(--radius); overflow: hidden;
  background: var(--surface-1); transition: border-color .2s var(--ease), transform .3s var(--spring), box-shadow .3s var(--ease);
  animation: card-rise .4s var(--spring) both;
}
.asset-card:hover { transform: translateY(-3px); border-color: var(--accent-line); box-shadow: var(--shadow-lg), inset 0 1px 0 var(--glass-hi); }
.asset-media { position: relative; aspect-ratio: 4 / 3; background: var(--bg); overflow: hidden; cursor: pointer; }
.asset-play {
  position: absolute; inset: 0; margin: auto; width: 46px; height: 46px; border-radius: 50%;
  display: grid; place-items: center; color: #fff; background: rgba(0, 0, 0, 0.5);
  -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px);
  pointer-events: none; opacity: .9; transition: transform .2s var(--spring), opacity .15s var(--ease);
}
.asset-media:hover .asset-play { opacity: 0; } /* hover plays inline; the badge is the "click to preview" hint at rest */
.asset-media img, .asset-media video { width: 100%; height: 100%; object-fit: cover; display: block; }
.asset-audio { width: 100%; height: 100%; display: grid; place-items: center; color: var(--muted); }
.asset-kind {
  position: absolute; top: 8px; right: 8px; font-family: var(--font-mono); font-size: 9.5px;
  letter-spacing: .06em; text-transform: uppercase; color: var(--text);
  background: rgba(0, 0, 0, 0.55); padding: 2px 7px; border-radius: 20px;
  -webkit-backdrop-filter: blur(8px); backdrop-filter: blur(8px);
}
.asset-body { padding: 11px 12px 12px; }
.asset-token { font-family: var(--font-mono); font-size: 12px; color: var(--accent); }
.asset-token-wrap { display: flex; align-items: center; gap: 1px; margin-bottom: 3px; }
.asset-at { font-family: var(--font-mono); font-size: 12px; color: var(--accent); }
.asset-token-input {
  flex: 1; min-width: 0; font-family: var(--font-mono); font-size: 12px; color: var(--accent);
  background: transparent; border: 1px solid transparent; border-radius: 6px; padding: 2px 5px;
  transition: border-color .15s var(--ease), background-color .15s var(--ease);
}
.asset-token-input:hover { border-color: var(--hairline); }
.asset-token-input:focus { border-color: var(--accent-line); background: var(--bg); outline: none; }
.asset-label {
  display: block; width: 100%; margin: 6px 0 9px; font-size: 14px; font-weight: 500; color: var(--text);
  background: transparent; border: 1px solid transparent; border-radius: 7px; padding: 4px 6px;
  transition: border-color .15s var(--ease), background-color .15s var(--ease);
}
.asset-label:hover { border-color: var(--hairline); }
.asset-label:focus { border-color: var(--accent-line); background: var(--bg); outline: none; }
.asset-row { display: flex; align-items: center; gap: 7px; }
.asset-cat {
  flex: 1; min-width: 0; font-size: 12px; color: var(--text);
  padding: 6px 8px; border-radius: 8px; border: 1px solid var(--stroke); background: var(--bg);
}
.asset-btn {
  flex-shrink: 0; font-size: 12px; font-weight: 500; color: var(--text);
  padding: 6px 11px; border-radius: 8px; border: 1px solid var(--stroke); background: var(--fill);
  display: inline-flex; align-items: center; gap: 5px;
  transition: background-color .15s var(--ease), border-color .15s var(--ease);
}
.asset-btn.grow { flex: 1; justify-content: center; }
.asset-btn:hover { border-color: var(--accent-line); }
.asset-btn.danger { color: var(--muted); }
.asset-btn.danger:hover { color: var(--danger); border-color: rgba(229, 92, 92, 0.4); background: var(--err-soft); }
.asset-btn.danger svg { width: 13px; height: 13px; }

/* Asset preview modal */
.asset-modal {
  position: fixed; inset: 0; z-index: 90; display: grid; place-items: center; padding: 40px;
  background: rgba(0, 0, 0, 0.66); -webkit-backdrop-filter: blur(10px); backdrop-filter: blur(10px);
  animation: fade-in .18s var(--ease) both;
}
@keyframes fade-in { from { opacity: 0; } to { opacity: 1; } }
.asset-modal-panel {
  display: flex; flex-direction: column; max-width: min(1200px, 95vw); max-height: 92vh;
  background: rgba(11, 12, 15, 0.985); border: 1px solid var(--stroke); border-radius: var(--radius);
  box-shadow: var(--shadow-lg); overflow: hidden;
}
.asset-modal-top { display: flex; align-items: center; gap: 12px; padding: 12px 14px; border-bottom: 1px solid var(--hairline); }
.asset-modal-title { font-family: var(--font-mono); font-size: 13px; color: var(--text); }
.asset-modal-close {
  margin-left: auto; width: 30px; height: 30px; border-radius: 8px; color: var(--muted); font-size: 15px;
  display: grid; place-items: center; border: 1px solid var(--hairline); background: var(--fill);
}
.asset-modal-close:hover { color: var(--text); border-color: var(--accent-line); }
.asset-modal-stage { display: grid; place-items: center; padding: 16px; min-height: 120px; overflow: auto; }
.asset-modal-stage.audio { padding: 40px 24px; }
.asset-modal-stage img, .asset-modal-stage video { max-width: 100%; max-height: 82vh; border-radius: var(--radius-sm); display: block; }

/* Any reference tile that can be clicked to enlarge into the lightbox. */
.ref-slot.zoomable { cursor: zoom-in; }
.ref-slot.zoomable:hover { outline: 2px solid var(--accent-line); outline-offset: -2px; }

.cell-foot {
  margin-top: auto; padding-top: 14px; display: flex; align-items: center; gap: 6px;
}
.pill {
  font-family: var(--font-mono); font-size: 10.5px; letter-spacing: .06em;
  text-transform: uppercase; padding: 3px 9px; border-radius: 20px; margin-right: auto;
}
.pill.queued  { color: var(--muted); background: var(--surface-3); }
.pill.running { color: var(--run); background: var(--run-soft); }
.pill.succeeded { color: var(--ok); background: var(--ok-soft); }
.pill.failed  { color: var(--danger); background: var(--err-soft); }
.pill.cancelled { color: var(--faint); background: var(--surface-3); }
.pill.directed {
  cursor: pointer; color: var(--accent); background: var(--accent-soft);
  border: 1px solid var(--accent-line); display: inline-flex; align-items: center;
  transition: background-color .15s var(--ease), transform .2s var(--spring);
}
.pill.directed:hover { border-color: var(--accent-line); transform: translateY(-1px); }
/* keep the status + DIRECTED pills grouped on the left; auto-margin moves to DIRECTED */
.cell-foot:has(.pill.directed) .pill:not(.directed) { margin-right: 7px; }
.pill.directed { margin-right: auto; }

.act {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: 12.5px; font-weight: 500; color: var(--muted);
  padding: 6px 11px; border-radius: 8px; border: 1px solid var(--hairline);
  transition: all .14s var(--ease);
}
.act:hover { color: var(--text); border-color: var(--accent-line); }
.act.danger:hover { color: var(--danger); border-color: var(--danger); }

/* empty reel */
.reel-empty {
  border: 1.5px dashed var(--hairline); border-radius: var(--radius);
  padding: 56px 24px; text-align: center; color: var(--faint);
}
.reel-empty .big { font-family: var(--font-display); font-size: 17px; color: var(--muted); margin-bottom: 6px; }

/* ── No project chosen ──────────────────────────────────────────────────────*/
.blank-state { display: grid; place-items: center; height: 100%; text-align: center; padding: 40px; }
.blank-state .big { font-family: var(--font-display); font-size: 22px; margin-bottom: 8px; }
.blank-state p { color: var(--muted); margin-bottom: 22px; max-width: 360px; }

/* ── Toast / banner ─────────────────────────────────────────────────────────*/
.banner {
  margin: 0 32px; padding: 11px 16px; border-radius: var(--radius-sm);
  font-size: 13px; display: none; align-items: center; gap: 10px;
}
.banner.show { display: flex; }
.banner.warn { background: rgba(240,169,59,.10); border: 1px solid var(--accent-line); color: var(--accent); }
.banner.err  { background: rgba(229,104,93,.10); border: 1px solid var(--danger); color: var(--danger); }

.toast {
  position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%) translateY(20px);
  background: var(--surface-3); border: 1px solid var(--hairline);
  color: var(--text); padding: 11px 18px; border-radius: 10px; font-size: 13.5px;
  opacity: 0; pointer-events: none; transition: all .25s var(--ease); z-index: 2200;
  box-shadow: 0 10px 30px rgba(0,0,0,.4);
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

/* ── Primary button (used in blank states/dialogs) ──────────────────────────*/
.btn {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 10px 18px; border-radius: 9px; font-weight: 600; font-size: 14px;
  background: var(--accent); color: #1A1206; transition: transform .12s var(--ease);
}
.btn:hover { transform: translateY(-1px); }
.btn.ghost { background: var(--surface-2); color: var(--text); border: 1px solid var(--hairline); }

/* ── Sidebar nav (Overview) ─────────────────────────────────────────────────*/
.nav { padding: 12px 12px 2px; }
.nav-item {
  display: flex; align-items: center; gap: 10px; width: 100%; text-align: left;
  padding: 9px 11px; border-radius: var(--radius-sm); color: var(--muted);
  font-weight: 500; transition: background .14s var(--ease), color .14s var(--ease);
}
.nav-item:hover { background: var(--surface-2); color: var(--text); }
.nav-item.active { background: var(--surface-3); color: var(--text); }
.nav-item svg { flex-shrink: 0; }

/* ── Sticky sidebar footer (Trash) ──────────────────────────────────────────*/
.sidebar-foot {
  margin-top: auto;            /* pin to the bottom; proj-list scrolls above it */
  padding: 8px 12px 12px;
  border-top: 1px solid var(--hairline);
  background: var(--surface-1);
}
.sidebar-foot .nav-item { width: 100%; }
.trash-count {
  margin-left: auto;
  font-family: var(--font-mono); font-size: 11px; color: var(--faint);
  background: var(--bg); padding: 1px 7px; border-radius: 20px;
}

/* ── Trash view ─────────────────────────────────────────────────────────────*/
.trash-head { display: flex; align-items: center; gap: 16px; margin-bottom: 20px; }
.trash-note { flex: 1; font-size: 13px; color: var(--muted); line-height: 1.5; }
.trash-list { display: flex; flex-direction: column; gap: 12px; }
.trash-card {
  display: flex; align-items: center; gap: 16px; padding: 16px 18px;
  background: var(--surface-1); border: 1px solid var(--hairline);
  border-radius: var(--radius); box-shadow: var(--shadow), inset 0 1px 0 var(--glass-hi);
  transition: border-color .2s var(--ease), transform .3s var(--spring);
}
.trash-card:hover { transform: translateY(-1px); border-color: var(--stroke); }
.t-info { flex: 1; min-width: 0; }
.t-name { font-weight: 500; font-size: 14.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.t-meta { margin-top: 3px; font-family: var(--font-mono); font-size: 11.5px; color: var(--faint); }
.t-acts { display: flex; gap: 8px; flex-shrink: 0; }
.t-thumb { width: 72px; height: 44px; flex-shrink: 0; object-fit: cover; border-radius: 8px; background: #000; border: 1px solid var(--hairline); }

/* ── Overview tab ───────────────────────────────────────────────────────────*/
.ov-canvas { padding-bottom: 60px; }

.filter-bar { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 12px; margin-bottom: 24px; }
.filter-search {
  flex: 1; min-width: 220px; height: 38px;
  background: var(--surface-1); border: 1px solid var(--hairline);
  border-radius: var(--radius-sm); padding: 0 13px; font-size: 14px; color: var(--text);
}
.filter-search:focus { outline: none; border-color: var(--accent-line); }
.filter-field { display: flex; flex-direction: column; gap: 5px; }
.filter-field label {
  font-family: var(--font-mono); font-size: 10px; letter-spacing: .1em;
  text-transform: uppercase; color: var(--faint);
}
.filter-select {
  height: 38px;
  background: var(--surface-1); border: 1px solid var(--hairline);
  border-radius: var(--radius-sm); padding: 0 11px; font-size: 13px; color: var(--text); cursor: pointer;
}
.filter-select:focus { outline: none; border-color: var(--accent-line); }

.library-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 16px; }
.lib-card {
  background: var(--surface-1); border: 1px solid var(--hairline);
  border-radius: var(--radius); overflow: hidden; transition: border-color .2s var(--ease);
}
.lib-card:hover { border-color: var(--faint); }
.lib-frame { position: relative; background: #0E0E13; overflow: hidden; }
.lib-frame video { width: 100%; height: 100%; object-fit: cover; background: #000; display: block; }
.lib-info { padding: 11px 13px 13px; }
.lib-prompt {
  font-size: 13px; line-height: 1.45; color: var(--text);
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; min-height: 2.6em;
}
.lib-prompt.empty { color: var(--faint); font-style: italic; }
.lib-meta {
  display: flex; justify-content: space-between; gap: 8px; margin-top: 9px;
  font-family: var(--font-mono); font-size: 11px; color: var(--faint);
}
.lib-proj { color: var(--accent); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ════════════════════════════════════════════════════════════════════════════
   Apple-style glass polish — frosted surfaces, depth & spring micro-interactions
   ════════════════════════════════════════════════════════════════════════════ */

/* Frost the chrome — translucent surfaces refract the aurora behind them.
   (.dock-row deliberately absent: the composer is a solid panel now.) */
.sidebar, .account-bar, .topbar, .popover, .packs-pop, .users-pop,
.vmodal, .vmodal-panel, .cell, .lib-card, .project-analysis, .toast,
.filter-search, .filter-select, .reel-empty, .banner {
  -webkit-backdrop-filter: var(--blur);
  backdrop-filter: var(--blur);
}

/* Depth + inset top highlight on the floating glass panels */
.cell, .lib-card, .project-analysis {
  box-shadow: var(--shadow), inset 0 1px 0 var(--glass-hi);
  border-color: var(--stroke);
}
.dock-row { box-shadow: var(--shadow-lg), inset 0 1px 0 var(--glass-hi); border-color: var(--stroke); }
.popover, .packs-pop, .users-pop, .vmodal-panel { box-shadow: var(--shadow-lg), inset 0 1px 0 var(--glass-hi); border-color: var(--stroke); }

/* Floating menus sit over busy content, so they need a dense, dark frosted
   panel — heavy blur abstracts the background, high opacity keeps text crisp. */
.popover, .packs-pop, .users-pop, .vmodal-panel, .toast {
  background: rgba(20, 21, 29, 0.9);
  -webkit-backdrop-filter: saturate(160%) blur(34px);
  backdrop-filter: saturate(160%) blur(34px);
}
/* Fully opaque: nothing from the feed bleeds through the composer. */
.dock-row { background: #1B1C23; }
/* Composer popovers (Source panel, settings, Forge refs) ride the solid dock —
   same opaque treatment, no frost. */
.composer-dock .popover, .fg-dock .popover {
  background: #191A21;
  -webkit-backdrop-filter: none; backdrop-filter: none;
}

/* ── Glass dock — Apple-glass material (RETIRED, kept for reference) ─────────
   Semi-opaque smoked glass over a heavy frost. The SVG backdrop filter (built
   in applyLiquidGlass) bends the blurred backdrop at the rim (refraction) and
   splits it into a faint spectral fringe (dispersion). No motion: the material
   itself is the interest — a still bezel, a breathing-room frost, no sweeps.
   Currently DORMANT: buildComposer no longer adds .liquid — the see-through
   dock let feed content distract from composing. Re-enable there if wanted. */
.dock-row.liquid {
  position: relative;
  background: linear-gradient(165deg,
    rgba(255, 255, 255, 0.085) 0%,
    rgba(28, 31, 40, 0.38) 34%,
    rgba(14, 15, 21, 0.44) 100%);
  border-color: rgba(255, 255, 255, 0.22);
  /* CSS frost fallback; Chromium swaps in the refraction+dispersion chain inline */
  -webkit-backdrop-filter: blur(18px) saturate(180%);
  backdrop-filter: blur(18px) saturate(180%);
  box-shadow:
    0 24px 70px rgba(0, 0, 0, 0.55),
    0 2px 10px rgba(0, 0, 0, 0.35),
    inset 0 1px 0 rgba(255, 255, 255, 0.32),   /* crisp top catch-light */
    inset 1px 0 0 rgba(255, 255, 255, 0.10),   /* faint left edge */
    inset -1px 0 0 rgba(255, 255, 255, 0.07),
    inset 0 -1px 1px rgba(255, 255, 255, 0.10); /* soft underside bounce */
}
/* a still, top-weighted inner sheen — ambience, not animation. The same layer
   carries a smoked tint that deepens while you type (iOS-Siri-style focus):
   gradients can't transition, but a background-color can. */
.dock-row.liquid::before {
  content: ''; position: absolute; inset: 0; border-radius: inherit; pointer-events: none; z-index: 0;
  background:
    radial-gradient(130% 90% at 18% -20%, rgba(255, 255, 255, 0.10), transparent 55%),
    radial-gradient(90% 100% at 85% 120%, rgba(255, 255, 255, 0.045), transparent 60%);
  background-color: rgba(6, 8, 12, 0);
  transition: background-color .38s var(--ease);
}
/* focused = the glass smokes over — the backdrop recedes, your words lead */
.dock-row.liquid:focus-within::before { background-color: rgba(6, 8, 12, 0.45); }
.dock-row.liquid > * { position: relative; z-index: 3; }

/* Legibility on glass: brighter text + translucent controls inside the dock */
.dock-row.liquid .dock-prompt { color: #fff; }
.dock-row.liquid .dock-prompt::placeholder { color: rgba(255, 255, 255, 0.55); }
.dock-row.liquid .dock-btn { color: rgba(255, 255, 255, 0.85); }
.dock-row.liquid .dock-btn.has, .dock-row.liquid .dock-btn.active { color: #fff; }
.dock-row.liquid .dock-icon { color: rgba(255, 255, 255, 0.8); }
.dock-row.liquid .dock-cost { color: #fff; }
.dock-row.liquid .dock-cost .cap, .dock-row.liquid .dock-cost .usd { color: rgba(255, 255, 255, 0.6); }
/* the controls read better with a touch more fill on glass */
.dock-row.liquid .dock-btn, .dock-row.liquid .dock-icon { background-color: rgba(255, 255, 255, 0.10); border-color: rgba(255, 255, 255, 0.16); }

/* translucent inner controls instead of flat-dark fills */
.chip, .dock-btn, .dock-icon, .seg, textarea.prompt, .seed-row input,
.pp-size, .tag, .proj .count, .ref-slot, .ab-edit, .act, .vmodal-back, .icon-btn:hover {
  background-color: var(--fill);
}
.ref-slot { border-color: var(--stroke); }

/* sticky headers as translucent blurred bars */
.account-bar { background: rgba(14, 14, 20, 0.55); border-bottom: 1px solid var(--stroke); }
.topbar { background: linear-gradient(180deg, rgba(11, 11, 15, 0.72) 0%, rgba(11, 11, 15, 0.10) 100%); }

/* ── Spring micro-interactions ──────────────────────────────────────────────*/
.proj, .nav-item, .act, .chip, .dock-btn, .dock-icon, .review-use, .vmodal-back,
.pp-add, .seg button, .ab-edit, .btn, .dice {
  transition: background-color .2s var(--ease), color .2s var(--ease),
              border-color .2s var(--ease), transform .25s var(--spring),
              box-shadow .25s var(--ease);
}
.proj:hover, .nav-item:hover { transform: translateX(3px); }
.act:hover, .chip:hover, .dock-btn:hover, .vmodal-back:hover,
.review-use:hover, .ab-edit:hover, .pp-add:hover { transform: translateY(-1px); }

.cell { transition: border-color .25s var(--ease), transform .3s var(--spring), box-shadow .3s var(--ease); }
.cell:hover { transform: translateY(-3px); box-shadow: var(--shadow-lg), 0 0 0 1px var(--accent-line), inset 0 1px 0 var(--glass-hi); }

.lib-card { transition: border-color .2s var(--ease), transform .35s var(--spring), box-shadow .35s var(--ease); animation: card-rise .4s var(--spring) both; }
.lib-card:hover { transform: translateY(-6px) scale(1.025); box-shadow: var(--shadow-lg), 0 0 0 1px var(--accent-line), inset 0 1px 0 var(--glass-hi); }
@keyframes card-rise { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: translateY(0); } }

/* selected project / nav get a blue glow edge */
.proj.active, .nav-item.active { box-shadow: inset 0 0 0 1px var(--accent-line); }
.proj.active::before { box-shadow: 0 0 10px var(--accent); }
/* focus rings feel intentional, not harsh */
:focus-visible { outline-color: var(--accent); }

/* ── Icon animations ────────────────────────────────────────────────────────*/
button svg { transition: transform .3s var(--spring); }
.icon-btn:hover svg { transform: rotate(90deg); }            /* + becomes a turn */
.dice:hover svg { transform: rotate(180deg); }               /* randomize spin */
.nav-item:hover svg, .dock-icon:hover svg,
.act:hover svg, .btn-generate:hover svg { transform: scale(1.14); }
.vmodal-back:hover svg { transform: translateX(-3px); }      /* arrow nudges back */
.frame-hint { transition: opacity .2s var(--ease), transform .3s var(--spring); }
.cell-frame.playable:hover .frame-hint,
.lib-frame.playable:hover .frame-hint { transform: scale(1.1); }

@keyframes twinkle { 0%, 100% { transform: scale(1) rotate(0); } 50% { transform: scale(1.2) rotate(10deg); } }
.dock-icon.optimize:hover svg { animation: twinkle 1.1s var(--ease) infinite; }

/* ── Refined accent buttons (Generate / primary) ────────────────────────────*/
.btn-generate, .btn:not(.ghost) {
  color: #fff;
  background: linear-gradient(180deg, #2C2F37 0%, #181A20 100%);
  border: 1px solid rgba(255, 255, 255, 0.14);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.5), inset 0 1px 0 rgba(255, 255, 255, 0.12);
  transition: transform .22s var(--spring), box-shadow .22s var(--ease), background .2s var(--ease), opacity .2s var(--ease);
}
.btn-generate:hover, .btn:not(.ghost):hover {
  transform: translateY(-1px);
  filter: brightness(1.08);
}
.btn-generate:active, .btn:not(.ghost):active { transform: translateY(0) scale(.98); filter: none; }

/* neutral meters & monochrome toggle */
.ab-meter > span { background: linear-gradient(90deg, rgba(255, 255, 255, 0.5), rgba(255, 255, 255, 0.85)); }
.progress-track i { background: var(--run); }
.toggle.on { background: rgba(255, 255, 255, 0.9); }
.toggle.on::after { background: #16181C; }
.toggle::after { box-shadow: 0 1px 3px rgba(0, 0, 0, .4); }
.brand .dot { background: var(--text); box-shadow: 0 0 10px rgba(255, 255, 255, .35); animation: breathe 5s var(--ease) infinite; }
@keyframes breathe { 50% { opacity: .6; } }

/* smoother fades for popovers/modal already handled; add easing refinements */
.popover, .packs-pop, .users-pop { transition: opacity .22s var(--ease), transform .28s var(--spring); }

/* ── Project delete (hover) + confirm dialog ────────────────────────────────*/
.proj-wrap { position: relative; }
.proj { padding-right: 32px; }
.proj .count { transition: opacity .14s var(--ease); }
/* ⋯ actions menu — appears on row hover (replaces the old hover trash) */
.proj-menu-btn {
  position: absolute; right: 7px; top: 50%; transform: translateY(-50%);
  width: 24px; height: 24px; border-radius: 7px; display: grid; place-items: center;
  color: var(--faint); opacity: 0;
  transition: opacity .14s var(--ease), color .14s var(--ease), background-color .14s var(--ease);
}
.proj-wrap:hover .proj-menu-btn { opacity: 1; }
.proj-wrap:hover .proj .count { opacity: 0; }
.proj-menu-btn:hover { color: var(--text); background-color: var(--surface-2); }
.cell-menu-item.danger { color: var(--danger); }
.cell-menu-item.danger:hover { background: var(--err-soft); }

/* expander chevron — only rendered when the project has folders */
.proj-chev {
  flex-shrink: 0; width: 14px; display: grid; place-items: center;
  margin-left: -4px; color: var(--faint); font-size: 10px;
  transition: transform .16s var(--ease), color .14s var(--ease);
}
.proj-chev.open { transform: rotate(90deg); }
.proj-chev:hover { color: var(--text); }
/* folderless projects keep the gutter so every name starts at the same x */
.proj-chev.ghost { visibility: hidden; pointer-events: none; }
.app.sb-collapsed .proj-chev { display: none; } /* the rail centers its tiles */

/* folder rows nested under an expanded project */
.proj-folders { display: flex; flex-direction: column; gap: 1px; padding: 1px 0 5px 26px; }
/* Folder rows match project rows exactly (height, type, count pill) — the
   indent + folder icon are the only cues, Frame.io-style. */
.proj-folder {
  position: relative; display: flex; align-items: center; gap: 10px;
  padding: 9px 28px 9px 11px; border-radius: var(--radius-sm);
  color: var(--muted); width: 100%; text-align: left;
  transition: background .14s var(--ease), color .14s var(--ease);
}
.proj-folder:hover { background: var(--surface-2); color: var(--text); }
.proj-folder.on { background: var(--surface-2); color: var(--accent); }
.proj-folder svg { flex-shrink: 0; }
.pf-name { flex: 1; min-width: 0; font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pf-count {
  font-family: var(--font-mono); font-size: 11px;
  color: var(--faint); background: var(--bg);
  padding: 1px 7px; border-radius: 20px;
}
.pf-x {
  position: absolute; right: 7px; top: 50%; transform: translateY(-50%);
  width: 18px; height: 18px; border-radius: 6px; display: grid; place-items: center;
  color: var(--faint); font-size: 10px; opacity: 0; cursor: pointer;
  transition: opacity .14s var(--ease), color .14s var(--ease);
}
.proj-folder:hover .pf-x { opacity: 1; }
.proj-folder:hover .pf-count { opacity: 0; }
.pf-x:hover { color: var(--danger); background: var(--err-soft); }
.pf-loading { padding: 6px 9px; font-size: 11.5px; color: var(--faint); }

/* Enhance-a-video button matches the filter controls' height exactly */
.reel-filter .enh-open { height: 38px; padding: 0 13px; font-size: 13px; }

.confirm-overlay {
  position: fixed; inset: 0; z-index: 2000; /* above the Camera Mode modal (1000) */
  background: rgba(8, 9, 12, 0.6);
  -webkit-backdrop-filter: blur(8px); backdrop-filter: blur(8px);
  display: grid; place-items: center; padding: 24px;
  animation: vmodal-in .16s var(--ease);
}
.confirm-box {
  width: 100%; max-width: 384px;
  background: rgba(24, 26, 32, 0.92);
  -webkit-backdrop-filter: saturate(160%) blur(34px); backdrop-filter: saturate(160%) blur(34px);
  border: 1px solid var(--stroke); border-radius: var(--radius);
  padding: 22px 22px 18px;
  box-shadow: var(--shadow-lg), inset 0 1px 0 var(--glass-hi);
  animation: confirm-pop .22s var(--spring);
}
@keyframes confirm-pop { from { transform: scale(.94); opacity: 0; } to { transform: none; opacity: 1; } }
.confirm-title { font-family: var(--font-display); font-size: 17px; font-weight: 600; letter-spacing: -.01em; margin-bottom: 8px; }
.confirm-msg { font-size: 13.5px; line-height: 1.55; color: var(--muted); margin-bottom: 20px; }
.confirm-actions { display: flex; gap: 10px; justify-content: flex-end; }
.confirm-btn {
  padding: 9px 16px; border-radius: 10px; font-size: 13.5px; font-weight: 500;
  color: var(--text); background: var(--fill); border: 1px solid var(--stroke);
  transition: background-color .15s var(--ease), border-color .15s var(--ease), transform .25s var(--spring);
}
.confirm-btn:hover { border-color: var(--accent-line); transform: translateY(-1px); }
.confirm-btn.primary { background: linear-gradient(180deg, #2C2F37, #181A20); border-color: rgba(255, 255, 255, 0.14); }
.confirm-btn.danger { color: #fff; background: linear-gradient(180deg, #E5685D, #C7544B); border-color: rgba(255, 255, 255, 0.14); }
.confirm-btn.danger:hover { background: linear-gradient(180deg, #EB7268, #CE5A51); }

/* ── Responsive ─────────────────────────────────────────────────────────────*/
/* The sidebar never disappears now — it lives as a slim icon rail (see .sb-collapsed).
   Below ~960px the reel cell stacks its thumbnail above the text so neither gets
   squeezed; the composer dock tightens its side padding to match. */
@media (max-width: 960px) {
  .cell { grid-template-columns: 1fr; }
  .composer-dock { padding-left: 18px; padding-right: 18px; }
  .ws-header-inner, .canvas { padding-left: 20px; padding-right: 20px; }
}

@media (prefers-reduced-motion: reduce) {
  .scan::after, .spinner, .brand .dot, .dock-icon.optimize:hover svg, .lib-card { animation: none !important; }
  * { transition: none !important; }
}

/* ── Camera Mode — 3D camera-move studio ─────────────────────────────────── */
.cam-modal {
  position: fixed; inset: 0; z-index: 1000;
  background: #0b0c0f;
  display: flex; padding: 0;
}
/* Camera Mode owns the whole screen — an app within the app, not a dialog. */
.cam-panel {
  margin: 0; width: 100%; height: 100%;
  background: #0e1014; border: none; border-radius: 0;
  display: flex; flex-direction: column; overflow: hidden;
  color: var(--text); font-family: var(--font-ui);
}
.cam-top { display: flex; align-items: center; justify-content: space-between; padding: 0 14px; height: 52px; border-bottom: 1px solid var(--hairline); flex: none; }
.cam-title { display: flex; align-items: center; gap: 9px; font-size: 14px; }
.cam-title b { font-weight: 600; letter-spacing: .2px; }
.cam-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--run); box-shadow: 0 0 10px var(--run); }
.cam-sub { color: var(--muted); font-size: 12px; font-family: var(--font-mono); }
.cam-top-actions { display: flex; align-items: center; gap: 8px; }
.cam-x { width: 30px; height: 30px; border-radius: 8px; border: 1px solid var(--hairline); background: var(--fill); color: var(--muted); cursor: pointer; font-size: 14px; }
.cam-x:hover { color: var(--text); border-color: var(--accent-line); }

.cam-btn { border: 1px solid var(--hairline); background: var(--fill); color: var(--text); border-radius: 9px; padding: 8px 13px; font-size: 13px; cursor: pointer; font-family: var(--font-ui); transition: background .15s var(--ease), border-color .15s var(--ease); }
.cam-btn:hover { border-color: var(--accent-line); }
.cam-btn:disabled { opacity: .55; cursor: default; }
.cam-btn.primary { background: var(--accent); color: #14161a; border-color: transparent; font-weight: 600; }
.cam-btn.primary:hover { background: var(--accent-hi); }
.cam-btn.ghost { background: transparent; }
.cam-btn.small { padding: 6px 10px; font-size: 12px; }
.cam-btn.tiny { padding: 4px 9px; font-size: 11px; border-radius: 7px; }
.cam-btn.danger { color: var(--danger); border-color: var(--err-soft); }
.cam-btn.danger:hover { background: var(--err-soft); }
.cam-btn.on { background: var(--surface-3); border-color: var(--accent-line); color: var(--text); }

.cam-body { flex: 1; display: flex; min-height: 0; }
.cam-viewport { flex: 1; position: relative; background: #0b0c0f; min-width: 0; overflow: hidden; }
.cam-canvas { display: block; position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%); touch-action: none; box-shadow: 0 0 0 1px rgba(255, 255, 255, .06), 0 8px 40px rgba(0, 0, 0, .5); }
.cam-hud { position: absolute; left: 12px; bottom: 10px; font-size: 11px; font-family: var(--font-mono); color: var(--faint); background: rgba(0,0,0,.4); padding: 4px 9px; border-radius: 7px; pointer-events: none; }
.cam-rec { position: absolute; right: 12px; top: 10px; font-size: 11px; font-family: var(--font-mono); color: var(--danger); opacity: 0; transition: opacity .2s; pointer-events: none; }
.cam-rec.on { opacity: 1; animation: cam-blink 1s steps(2, start) infinite; }
@keyframes cam-blink { 50% { opacity: .25; } }
/* aspect-ratio selector overlay (top-centre of the viewport) */
.cam-ratiobar {
  position: absolute; top: 10px; left: 50%; transform: translateX(-50%); z-index: 3;
  display: flex; align-items: center; gap: 3px; padding: 4px 6px;
  background: rgba(0, 0, 0, .5); border: 1px solid rgba(255, 255, 255, .08);
  border-radius: 10px; -webkit-backdrop-filter: blur(5px); backdrop-filter: blur(5px);
}
.cam-ratiobar-lbl { font-family: var(--font-mono); font-size: 9px; letter-spacing: .12em; color: var(--faint); padding: 0 4px; }
.cam-ratio-chip {
  font-family: var(--font-mono); font-size: 11px; color: var(--muted);
  padding: 3px 8px; border-radius: 6px; transition: background .14s var(--ease), color .14s var(--ease);
}
.cam-ratio-chip:hover { background: rgba(255, 255, 255, .08); color: var(--text); }
.cam-ratio-chip.on { background: var(--accent); color: #1A1206; font-weight: 600; }
.cam-viewport.dragover { outline: 2px dashed var(--accent-line); outline-offset: -8px; }
.cam-empty { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; pointer-events: none; }
.cam-empty-card {
  pointer-events: auto; display: flex; flex-direction: column; align-items: center; gap: 10px; text-align: center;
  max-width: 320px; padding: 22px 24px; border-radius: 14px;
  background: rgba(16, 18, 22, 0.82); border: 1px solid var(--hairline); -webkit-backdrop-filter: blur(8px); backdrop-filter: blur(8px);
}
.cam-empty-card b { font-size: 14px; }
.cam-empty-card span { font-size: 12px; color: var(--muted); line-height: 1.5; }
.cam-empty-actions { display: flex; gap: 8px; flex-wrap: wrap; justify-content: center; }
.cam-ai { display: flex; flex-direction: column; gap: 6px; padding: 10px; border: 1px solid var(--hairline); border-radius: 9px; background: rgba(106, 163, 255, 0.05); }
.cam-obj-list { display: flex; flex-direction: column; gap: 5px; margin-top: 2px; }
.cam-obj { display: flex; align-items: center; gap: 8px; padding: 5px 7px; border: 1px solid var(--hairline); border-radius: 7px; background: var(--fill); }
.cam-obj input { accent-color: var(--accent); flex: none; }
.cam-obj-sw { width: 12px; height: 12px; border-radius: 3px; flex: none; }
.cam-obj-name { flex: 1; font-size: 12px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; cursor: pointer; }
.cam-obj.sel { border-color: var(--accent-line); background: var(--surface-2); }

.cam-inspector { width: 304px; flex: none; border-left: 1px solid var(--hairline); display: flex; flex-direction: column; background: #101216; }
.cam-tabs { display: flex; flex-wrap: wrap; border-bottom: 1px solid var(--hairline); flex: none; }
.cam-tab { flex: 1 1 25%; padding: 9px 4px; background: none; border: none; color: var(--muted); font-size: 11.5px; cursor: pointer; border-bottom: 2px solid transparent; font-family: var(--font-ui); }
.cam-tab:hover { color: var(--text); }
.cam-tab.on { color: var(--text); border-bottom-color: var(--accent); }
.cam-insp-body { flex: 1; overflow-y: auto; padding: 13px; display: flex; flex-direction: column; gap: 11px; }

.cam-note { font-size: 12px; color: var(--muted); line-height: 1.5; }
.cam-hint-sm { font-size: 11px; color: var(--faint); line-height: 1.45; }
.cam-divider { font-size: 11px; text-transform: uppercase; letter-spacing: .6px; color: var(--faint); border-top: 1px solid var(--hairline); padding-top: 10px; margin-top: 2px; }
.cam-field { display: flex; flex-direction: column; gap: 6px; }
.cam-field.inline { flex-direction: row; align-items: center; gap: 8px; }
.cam-field label { font-size: 12px; color: var(--muted); display: flex; justify-content: space-between; align-items: center; }
.cam-field.inline label { flex: none; }
.cam-field input[type=range] { width: 100%; accent-color: var(--accent); }
.cam-field input[type=number], .cam-field select, .cam-inspector select, .cam-transport select { background: var(--fill); border: 1px solid var(--hairline); color: var(--text); border-radius: 7px; padding: 5px 8px; font-size: 12px; font-family: var(--font-ui); }
.cam-field input[type=color] { width: 100%; height: 30px; background: var(--fill); border: 1px solid var(--hairline); border-radius: 7px; padding: 2px; cursor: pointer; }
.cam-read { font-family: var(--font-mono); font-size: 11px; color: var(--text); }
.cam-check { display: flex; align-items: center; gap: 8px; font-size: 12px; color: var(--muted); cursor: pointer; }
.cam-check input { accent-color: var(--accent); }
.cam-btn-row { display: flex; gap: 8px; flex-wrap: wrap; }

.cam-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.cam-chip { border: 1px solid var(--hairline); background: var(--fill); color: var(--muted); border-radius: 20px; padding: 4px 11px; font-size: 11px; cursor: pointer; }
.cam-chip:hover { color: var(--text); border-color: var(--accent-line); }
.cam-chip.on { background: var(--accent-soft); border-color: var(--accent-line); color: var(--accent); font-weight: 600; }
.cam-graphdock-head .cam-graph-chans { padding-right: 12px; border-right: 1px solid var(--hairline); }

.cam-graph { width: 100%; height: auto; border: 1px solid var(--hairline); border-radius: 8px; background: #0e1014; touch-action: none; cursor: crosshair; }

/* Bottom graph editor dock — slides up full-width, above the timeline (Blender-style). */
.cam-graphdock {
  flex: none; width: 100%; height: 0; overflow: hidden;
  background: #0c0d11; border-top: 1px solid var(--hairline);
  transition: height .26s var(--ease);
}
.cam-graphdock.open { height: 300px; }
.cam-graphdock-head { display: flex; align-items: center; gap: 12px; padding: 8px 14px; border-bottom: 1px solid var(--hairline); }
.cam-graphdock-head b { font-size: 12px; color: var(--text); }
.cam-graphdock-head .cam-chips { margin: 0; flex-wrap: wrap; }
.cam-graphdock-hint { margin-left: auto; font-family: var(--font-mono); font-size: 10.5px; color: var(--faint); white-space: nowrap; }
.cam-graphdock .cam-x-sm { width: 24px; height: 24px; border-radius: 6px; display: grid; place-items: center; color: var(--muted); font-size: 13px; }
.cam-graphdock .cam-x-sm:hover { background: var(--surface-3); color: var(--text); }
.cam-graphdock-canvaswrap { padding: 8px 14px 12px; }
.cam-graph-dock { border: none; border-radius: 0; background: transparent; cursor: default; display: block; width: 100%; height: auto; }

.cam-move-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.cam-move { border: 1px solid var(--hairline); background: var(--fill); color: var(--text); border-radius: 9px; padding: 12px 8px; font-size: 12px; cursor: pointer; text-align: center; }
.cam-move:hover { border-color: var(--accent-line); transform: translateY(-1px); }

.cam-search { width: 100%; background: var(--fill); border: 1px solid var(--hairline); color: var(--text); border-radius: 8px; padding: 7px 10px; font-size: 12px; font-family: var(--font-ui); }
.cam-preset-list { display: flex; flex-direction: column; gap: 8px; }
.cam-preset { display: flex; gap: 9px; align-items: center; border: 1px solid var(--hairline); background: var(--fill); border-radius: 9px; padding: 8px; }
.cam-preset-thumb { width: 54px; height: 36px; flex: none; border-radius: 5px; background: #0b0c0f center/cover no-repeat; border: 1px solid var(--hairline); }
.cam-preset-meta { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.cam-preset-meta b { font-size: 12px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cam-preset-meta span { font-size: 11px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cam-preset-acts { display: flex; gap: 5px; flex: none; }

.cam-timeline { border-top: 1px solid var(--hairline); padding: 10px 14px 13px; background: #101216; flex: none; }
.cam-transport { display: flex; align-items: center; gap: 9px; flex-wrap: wrap; }
.cam-icon-btn { width: 32px; height: 32px; border-radius: 8px; border: 1px solid var(--hairline); background: var(--fill); color: var(--text); cursor: pointer; display: inline-flex; align-items: center; justify-content: center; }
.cam-icon-btn:hover { border-color: var(--accent-line); }
.cam-icon-btn.on { color: var(--accent); border-color: var(--accent-line); background: var(--surface-3); }
.cam-icon-btn:disabled { opacity: .32; cursor: default; }
.cam-icon-btn:disabled:hover { background: var(--fill); }
.cam-time { font-family: var(--font-mono); font-size: 12px; color: var(--text); margin: 0 4px; min-width: 96px; }
.cam-transport .cam-field.inline { margin: 0; }
.cam-transport .cam-field.inline label { font-size: 11px; }
.cam-transport input[type=range] { width: 92px; }

.cam-track { position: relative; height: 58px; margin-top: 9px; background: #0b0c0f; border: 1px solid var(--hairline); border-radius: 8px; overflow: hidden; cursor: pointer; }
.cam-ruler { position: absolute; inset: 0; pointer-events: none; }
.cam-tick { position: absolute; top: 0; height: 100%; transform: translateX(-50%); display: flex; flex-direction: column; align-items: center; }
.cam-tick i { width: 1px; height: 10px; background: var(--hairline); }
.cam-tick em { font-style: normal; font-size: 9px; color: var(--faint); font-family: var(--font-mono); margin-top: 2px; }
.cam-key { position: absolute; top: 50%; width: 13px; height: 13px; margin-top: -6px; transform: translateX(-50%) rotate(45deg); background: var(--ok); border: 1px solid #1a1c20; border-radius: 2px; cursor: grab; padding: 0; transition: box-shadow .12s; }
.cam-key:hover { box-shadow: 0 0 0 3px var(--ok-soft); }
.cam-key.sel { background: var(--accent-hi); box-shadow: 0 0 0 3px var(--accent-soft); z-index: 3; }
.cam-key.primary { box-shadow: 0 0 0 2px #1a1c20, 0 0 0 4px var(--accent); z-index: 4; }
.cam-playhead { position: absolute; top: 0; bottom: 0; width: 2px; background: var(--run); box-shadow: 0 0 8px var(--run); pointer-events: none; z-index: 2; }
/* rubber-band box-select over the timeline (Shift-drag) */
.cam-marquee { position: absolute; top: 0; bottom: 0; background: rgba(255, 209, 102, .14); border: 1px dashed rgba(255, 209, 102, .8); pointer-events: none; z-index: 5; }

/* ══ Camera Track tool ═══════════════════════════════════════════════════════ */
.trk { display: flex; flex-direction: column; height: calc(100vh - 92px); padding: 18px 24px 0; gap: 14px; }
.trk-head { display: flex; align-items: center; gap: 14px; flex-shrink: 0; }
.trk-title { font-size: 18px; font-weight: 600; }
.trk-title .trk-sub { font-size: 12px; color: var(--muted); font-weight: 400; margin-left: 8px; }
.trk-new { margin-left: auto; font-size: 13px; font-weight: 500; color: var(--bg); background: var(--accent); border-radius: 10px; padding: 9px 15px; cursor: pointer; }
.trk-new:hover { filter: brightness(1.08); }
.trk-body { display: flex; gap: 16px; flex: 1; min-height: 0; padding-bottom: 18px; }
.trk-list { width: 230px; flex-shrink: 0; overflow-y: auto; display: flex; flex-direction: column; gap: 8px; }
.trk-empty { color: var(--muted); font-size: 13px; padding: 20px; text-align: center; }
.trk-card { padding: 11px 12px; border-radius: 10px; border: 1px solid var(--hairline); background: var(--surface-1); cursor: pointer; }
.trk-card:hover { border-color: var(--accent-line); }
.trk-card.on { border-color: var(--accent-line); background: var(--accent-soft); }
.trk-card-name { font-size: 13px; font-weight: 500; color: var(--text); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.trk-card-meta { font-size: 11px; color: var(--muted); margin-top: 4px; display: flex; align-items: center; gap: 6px; }
.trk-detail { flex: 1; min-width: 0; overflow-y: auto; display: flex; flex-direction: column; gap: 14px; }
.trk-detbar { display: flex; align-items: center; gap: 10px; }
.trk-name { flex: 1; min-width: 0; font-size: 15px; font-weight: 600; color: var(--text); background: transparent; border: 1px solid transparent; border-radius: 8px; padding: 6px 9px; }
.trk-name:hover { border-color: var(--hairline); } .trk-name:focus { border-color: var(--accent-line); background: var(--bg); outline: none; }
.trk-badge { font-family: var(--font-mono); font-size: 10.5px; text-transform: uppercase; letter-spacing: .05em; padding: 2px 8px; border-radius: 20px; background: var(--fill); color: var(--muted); }
.trk-badge.solved { background: var(--ok-soft); color: var(--ok); }
.trk-badge.solving, .trk-badge.extracting { background: var(--accent-soft); color: var(--accent); }
.trk-badge.failed { background: rgba(255,107,107,.15); color: #ff8080; }
.trk-btn { font-size: 13px; color: var(--text); background: var(--fill); border: 1px solid var(--stroke); border-radius: 9px; padding: 8px 13px; cursor: pointer; }
.trk-btn:hover { border-color: var(--accent-line); }
.trk-btn.on { background: var(--accent-soft); border-color: var(--accent-line); color: var(--accent); }
.trk-btn.primary { color: var(--bg); background: var(--accent); border-color: var(--accent); }
.trk-btn.primary:hover { filter: brightness(1.08); }
.trk-btn.big { align-self: flex-start; padding: 11px 20px; font-weight: 600; }
.trk-btn.danger:hover { color: #ff8080; border-color: #ff8080; background: transparent; }
.trk-hint, .trk-toolhint { font-size: 12px; color: var(--faint); line-height: 1.5; }
.trk-err { font-size: 12px; color: #ff8080; }
.trk-rawvid { width: 100%; max-width: 640px; border-radius: 10px; border: 1px solid var(--hairline); }
.trk-solverow { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.trk-solveopts { display: inline-flex; align-items: center; gap: 6px; padding: 4px; border: 1px solid var(--hairline); border-radius: 11px; background: var(--surface-1); }
.trk-solveopts.inline { align-self: flex-start; }
.trk-solvebox { display: flex; flex-direction: column; align-items: flex-start; gap: 12px; padding: 18px 0; max-width: 560px; }
.trk-solving { display: flex; align-items: center; gap: 10px; font-size: 14px; color: var(--muted); padding: 24px 0; }
.trk-solvebox .trk-solving { padding: 0; }
.trk-solving .spin { width: 16px; height: 16px; border: 2px solid var(--hairline); border-top-color: var(--accent); border-radius: 50%; animation: spin .7s linear infinite; flex-shrink: 0; }
.trk-progouter { width: 100%; height: 8px; border-radius: 6px; background: var(--fill); border: 1px solid var(--hairline); overflow: hidden; }
.trk-proginner { height: 100%; width: 2%; background: var(--accent); border-radius: 6px; transition: width .6s ease; }
/* no percentage yet (e.g. probing) — slide a pulse instead of sitting empty */
.trk-progouter.indet .trk-proginner { width: 30%; animation: trk-indet 1.2s ease-in-out infinite alternate; }
@keyframes trk-indet { from { margin-left: 0; } to { margin-left: 70%; } }
.trk-prog { font-family: var(--font-mono); font-size: 11px; color: var(--faint); }
.trk-stagewrap { display: flex; flex-direction: column; gap: 10px; max-width: 1100px; }
.trk-toolbar { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.trk-tgroup { display: inline-flex; align-items: center; gap: 6px; padding: 4px; border: 1px solid var(--hairline); border-radius: 11px; background: var(--surface-1); }
.trk-spacer { flex: 1; }
.trk-btn.ghost { background: transparent; }
.trk-kind { font-size: 13px; color: var(--text); background: var(--bg); border: 1px solid var(--stroke); border-radius: 8px; padding: 7px 9px; }
.trk-slider { display: inline-flex; align-items: center; gap: 7px; font-size: 11.5px; color: var(--muted); padding: 0 6px; }
.trk-slider input[type=range] { width: 84px; accent-color: var(--accent); }
.trk-toolhint { font-family: var(--font-mono); font-size: 11px; color: var(--faint); white-space: nowrap; }
.trk-stage { position: relative; width: 100%; background: #05060a; border-radius: 12px; overflow: hidden; border: 1px solid var(--hairline); }
/* mask-inspection overlay: the solver's exact tracking mask tinted over playback */
.trk-maskoverlay { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; z-index: 3; }
.trk-video { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: fill; }
/* Scrub proxy — the pre-extracted frame JPEG shown instantly while the video seeks */
.trk-proxy { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: fill; z-index: 1; opacity: 0; pointer-events: none; }
.trk-proxy.on { opacity: 1; }
.trk-canvas { position: absolute; inset: 0; width: 100%; height: 100%; z-index: 2; pointer-events: none; }
.trk-canvas.placing { pointer-events: auto; cursor: crosshair; }
/* 3D (orbit) view — the canvas takes over: footage hidden, pointer drives the orbit */
.trk-stage.orbitmode .trk-video, .trk-stage.orbitmode .trk-proxy { visibility: hidden; }
.trk-stage.orbitmode .trk-canvas { pointer-events: auto; cursor: grab; }
.trk-stage.orbitmode .trk-canvas:active { cursor: grabbing; }
.trk-viewseg button { display: inline-flex; align-items: center; gap: 5px; }

/* Transport bar — custom play controls, kept off the video */
.trk-transport { display: flex; align-items: center; gap: 8px; padding: 7px 10px; background: var(--surface-1); border: 1px solid var(--hairline); border-radius: 11px; }
.trk-tp-btn { width: 32px; height: 32px; border-radius: 8px; display: grid; place-items: center; color: var(--text); background: var(--fill); border: 1px solid var(--stroke); cursor: pointer; }
.trk-tp-btn:hover { border-color: var(--accent-line); }
.trk-tp-btn.play { color: var(--accent); }
.trk-frame { font-family: var(--font-mono); font-size: 12px; color: var(--text); margin-left: 6px; }
.trk-time { font-family: var(--font-mono); font-size: 12px; color: var(--muted); }

/* Timeline ruler above the filmstrip — seconds/frames ticks + labels */
.trk-ruler { position: relative; height: 18px; margin: 0 1px -2px; user-select: none; pointer-events: none; }
.trk-rtick { position: absolute; bottom: 0; width: 1px; height: 5px; background: var(--stroke); }
.trk-rtick.major { height: 9px; background: var(--muted); }
.trk-rlabel { position: absolute; bottom: 8px; transform: translateX(-50%); font-family: var(--font-mono); font-size: 9px; line-height: 1; color: var(--faint); white-space: nowrap; }
.trk-rlabel:first-of-type { transform: translateX(0); }

/* Scrub bubble — current time/frame readout while dragging the playhead */
.trk-scrubbubble { position: absolute; top: 3px; z-index: 5; padding: 3px 7px; border-radius: 6px; background: rgba(10, 12, 14, .92); border: 1px solid var(--accent-line); color: var(--text); font-family: var(--font-mono); font-size: 10px; line-height: 1; white-space: nowrap; pointer-events: none; opacity: 0; transition: opacity .1s; }
.trk-scrubbubble.show { opacity: 1; }

/* Seconds/frames unit switch */
.trk-unitsw { display: inline-flex; border: 1px solid var(--stroke); border-radius: 7px; overflow: hidden; }
.trk-unit-btn { padding: 4px 8px; font-family: var(--font-mono); font-size: 10px; color: var(--muted); background: transparent; border: 0; cursor: pointer; line-height: 1; }
.trk-unit-btn + .trk-unit-btn { border-left: 1px solid var(--stroke); }
.trk-unit-btn.on { color: var(--text); background: var(--fill); }
.trk-unit-btn:hover { color: var(--text); }

/* Filmstrip timeline — frame thumbnails + draggable playhead */
.trk-film { position: relative; height: 52px; border-radius: 10px; overflow: hidden; border: 1px solid var(--hairline); cursor: pointer; user-select: none; background: #000; }
.trk-strip { position: absolute; inset: 0; display: flex; }
.trk-thumb { flex: 1; min-width: 0; background-size: cover; background-position: center; border-right: 1px solid rgba(0,0,0,0.35); }
.trk-playhead { position: absolute; top: 0; bottom: 0; width: 2px; background: var(--accent); box-shadow: 0 0 6px var(--accent); pointer-events: none; z-index: 3; }
.trk-playhead::before { content: ''; position: absolute; top: -1px; left: -4px; width: 10px; height: 6px; background: var(--accent); border-radius: 2px; }

/* ══ Polish pass — micro-interactions & finish (kept together, overrides above) ══ */
::selection { background: rgba(230, 180, 80, .28); }

/* refined scrollbars */
::-webkit-scrollbar { width: 9px; height: 9px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: rgba(255,255,255,.12); border-radius: 8px; border: 2px solid transparent; background-clip: content-box; }
::-webkit-scrollbar-thumb:hover { background: rgba(255,255,255,.22); border: 2px solid transparent; background-clip: content-box; }

/* buttons: uniform ease + press feedback */
button { transition: background .15s var(--ease), border-color .15s var(--ease), color .15s var(--ease), transform .12s var(--ease), box-shadow .18s var(--ease); }
button:active:not(:disabled) { transform: scale(.97); }
button:focus-visible, input:focus-visible, textarea:focus-visible, select:focus-visible { outline: 1.5px solid var(--accent-line); outline-offset: 1.5px; }

/* cards lift gently on hover */
.cell, .lib-card, .asset-card, .trk-card, .char-card {
  transition: transform .18s var(--ease), border-color .18s var(--ease), box-shadow .22s var(--ease), background .18s var(--ease);
}
.lib-card:hover, .asset-card:hover, .trk-card:hover, .char-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 14px 34px rgba(0,0,0,.45);
  border-color: var(--accent-line);
}
.cell-frame { transition: box-shadow .2s var(--ease); }
.cell-frame.playable:hover { box-shadow: 0 0 0 1px var(--accent-line), 0 18px 44px rgba(0,0,0,.5); }

/* modals & popovers breathe in */
@keyframes pop-in { from { opacity: 0; transform: translateY(8px) scale(.985); } to { opacity: 1; transform: none; } }
.stitch-panel, .confirm-box, .lib-modal-panel, .char-modal-panel { animation: pop-in .22s var(--ease) both; }
.cam-modal { animation: cam-fade .2s var(--ease) both; } /* fullscreen: fade, don't pop */
@keyframes cam-fade { from { opacity: 0; } to { opacity: 1; } }
.popover.open, .mention-menu.open { animation: pop-in .16s var(--ease) both; }

/* toolbar groups get a faint inner top light */
.trk-tgroup, .trk-transport, .stitch-tp, .trk-solveopts { box-shadow: inset 0 1px 0 rgba(255,255,255,.04); }

/* film strips get a soft vignette so thumbs read as one ribbon */
.trk-film::after { content: ''; position: absolute; inset: 0; pointer-events: none; box-shadow: inset 0 0 18px rgba(0,0,0,.55); border-radius: inherit; }

/* status badges: soft glow dots */
.trk-badge.solved::before, .trk-badge.solving::before, .trk-badge.extracting::before {
  content: ''; display: inline-block; width: 5px; height: 5px; border-radius: 50%; margin-right: 5px; vertical-align: 1px; background: currentColor; box-shadow: 0 0 6px currentColor;
}

/* frame-hint (expand cue) fades/scales rather than snapping */
.frame-hint { transition: opacity .18s var(--ease), transform .18s var(--ease); transform: scale(.92); }
.playable:hover .frame-hint { transform: scale(1); }

/* smoother sliders */
input[type=range] { accent-color: var(--accent); }

@media (prefers-reduced-motion: reduce) {
  .stitch-panel, .confirm-box, .lib-modal-panel, .char-modal-panel, .cam-panel, .popover.open, .mention-menu.open { animation: none; }
}

/* ══ Flow — VFX toolkit view ══════════════════════════════════════════════════ */
.flow-hero {
  margin: 8vh auto 0; max-width: 520px; padding: 56px 40px; text-align: center;
  border: 1.5px dashed var(--stroke); border-radius: 20px; color: var(--muted);
  cursor: pointer; transition: border-color .2s var(--ease), background .2s var(--ease), transform .2s var(--ease);
}
.flow-hero:hover { border-color: var(--accent-line); background: var(--surface-1); transform: translateY(-2px); }
.flow-hero svg { color: var(--faint); }
.flow-hero-t { font-size: 19px; font-weight: 650; color: var(--text); margin-top: 14px; letter-spacing: -0.01em; }
.flow-hero-s { font-size: 12.5px; color: var(--faint); margin-top: 8px; line-height: 1.7; }
.flow.flow-dragover .trk-detail, .flow.flow-dragover .flow-hero { outline: 2px dashed var(--accent-line); outline-offset: -8px; border-radius: 20px; }
.flow-meta { font-family: var(--font-mono); font-size: 11px; color: var(--faint); white-space: nowrap; }

/* tool rack — three node-style cards */
.flow-tools { display: grid; grid-template-columns: repeat(3, minmax(240px, 1fr)); gap: 12px; }
@media (max-width: 1100px) { .flow-tools { grid-template-columns: 1fr; } }
.flow-card {
  position: relative; display: flex; flex-direction: column; gap: 10px;
  padding: 13px 14px; border-radius: 14px;
  background: linear-gradient(180deg, rgba(255,255,255,.055), rgba(255,255,255,.025));
  border: 1px solid var(--hairline);
  box-shadow: inset 0 1px 0 rgba(255,255,255,.05);
}
.flow-card::before { content: ''; position: absolute; top: 0; left: 14px; right: 14px; height: 1px;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,.16), transparent); }
.flow-card-head { display: flex; align-items: center; gap: 8px; }
.flow-card-ic { display: grid; place-items: center; width: 26px; height: 26px; border-radius: 8px; background: var(--fill); border: 1px solid var(--hairline); color: var(--accent); }
.flow-card-t { font-size: 12px; font-weight: 650; text-transform: uppercase; letter-spacing: .08em; color: var(--text); flex: 1; }
.flow-card-info { font-size: 12px; color: var(--muted); line-height: 1.55; min-height: 34px; }
.flow-card-actions { display: flex; align-items: center; gap: 7px; flex-wrap: wrap; margin-top: auto; }
.flow-card-actions .trk-btn { padding: 7px 11px; font-size: 12.5px; text-decoration: none; display: inline-flex; align-items: center; gap: 5px; }
.flow-card-vid { width: 100%; border-radius: 9px; border: 1px solid var(--hairline); background: #000; }
.flow-card .trk-solveopts { padding: 3px; border-radius: 9px; }
.flow-card .trk-solveopts .trk-btn, .flow-card .trk-kind { padding: 6px 9px; font-size: 12px; }
.flow-progress { display: flex; flex-direction: column; gap: 9px; }
.flow-progress .trk-solving { padding: 0; font-size: 12.5px; }
.trk-btn.sm { padding: 5px 10px; font-size: 12px; align-self: flex-start; }

/* ══ Review v2 — score, axis bars, frame-tied issue chips ═════════════════════ */
.review-score { margin-left: auto; font-family: var(--font-mono); font-size: 12px; font-weight: 700; padding: 1px 8px; border-radius: 12px; }
.review-score.good { color: var(--ok); background: var(--ok-soft); }
.review-score.mid { color: #d8b45a; background: rgba(216,180,90,.13); }
.review-score.bad { color: var(--danger); background: var(--err-soft); }
.review-axes { display: grid; grid-template-columns: 1fr 1fr; gap: 4px 14px; margin: 7px 0 2px; }
.review-axis { display: flex; align-items: center; gap: 7px; font-size: 10.5px; color: var(--faint); }
.review-axis .ax-l { width: 58px; text-transform: uppercase; letter-spacing: .05em; }
.review-axis .ax-bar { flex: 1; height: 4px; border-radius: 3px; background: rgba(255,255,255,.08); overflow: hidden; }
.review-axis .ax-bar i { display: block; height: 100%; border-radius: 3px; }
.review-axis .ax-bar i.good { background: var(--ok); }
.review-axis .ax-bar i.mid { background: #d8b45a; }
.review-axis .ax-bar i.bad { background: var(--danger); }
.review-axis .ax-v { font-family: var(--font-mono); font-size: 10.5px; color: var(--muted); width: 24px; text-align: right; }
.review-issues { display: flex; flex-wrap: wrap; gap: 5px; margin-top: 7px; }
.review-issue { font-size: 11px; color: var(--muted); background: var(--fill); border: 1px solid var(--hairline); border-radius: 14px; padding: 3px 9px; cursor: pointer; text-align: left; }
.review-issue:hover { color: var(--text); border-color: var(--accent-line); }

/* ══ VFX THEME — "the grade suite" ════════════════════════════════════════════
   A finishing-suite feel: deeper blacks, amber safelight accent, blueprint
   grid, tighter radii, mono readouts. Layered last so it re-skins everything. */
:root {
  --bg: #101114;
  --accent: #E8B44C;            /* amber safelight */
  --accent-2: #C99A3E;
  --accent-hi: #F5CD7A;
  --accent-soft: rgba(232, 180, 76, 0.12);
  --accent-line: rgba(232, 180, 76, 0.38);
  --radius: 14px;
  --radius-sm: 10px;
  --hairline: rgba(255, 255, 255, 0.09);
  --stroke: rgba(255, 255, 255, 0.13);
}
/* blueprint grid + corner vignette behind everything */
body::before {
  content: ''; position: fixed; inset: 0; z-index: 0; pointer-events: none;
  background-image:
    radial-gradient(ellipse 120% 90% at 50% -10%, rgba(120, 140, 190, 0.05), transparent 60%),
    linear-gradient(rgba(255,255,255,.013) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255,255,255,.013) 1px, transparent 1px);
  background-size: auto, 44px 44px, 44px 44px;
}
body::after {
  content: ''; position: fixed; inset: 0; z-index: 0; pointer-events: none;
  box-shadow: inset 0 0 220px rgba(0, 0, 0, 0.55);
}

/* top bar → utility rail: mono tag, amber underline on the live tab */
.tm-tabs .tm-item { text-transform: uppercase; letter-spacing: .09em; font-size: 11.5px; font-weight: 650; position: relative; }
.tm-tabs .tm-item.active::after {
  content: ''; position: absolute; left: 14px; right: 14px; bottom: 2px; height: 2px;
  background: var(--accent); border-radius: 2px; box-shadow: 0 0 10px var(--accent);
}
#modelTag { color: var(--faint); }

/* primary actions read as safelight keys */
.btn-generate, .trk-btn.primary, .stitch-btn.primary, .trk-new, .assets-add {
  background: linear-gradient(180deg, var(--accent-hi), var(--accent));
  border-color: transparent; color: #17130a; font-weight: 650;
  box-shadow: 0 2px 14px rgba(232, 180, 76, 0.22), inset 0 1px 0 rgba(255,255,255,.35);
}
.btn-generate:hover:not(:disabled), .trk-btn.primary:hover, .stitch-btn.primary:hover, .trk-new:hover, .assets-add:hover {
  filter: brightness(1.06);
}

/* frames get a hairline "monitor bezel" */
.cell-frame, .trk-stage, .stitch-video, .lib-frame { box-shadow: inset 0 0 0 1px rgba(255,255,255,.05), 0 10px 30px rgba(0,0,0,.4); }

/* mono micro-labels across panel heads */
.pop-head span, .vmodal-label, .field-label > span:first-child, .assets-head h1 {
  text-transform: uppercase; letter-spacing: .09em; font-size: 11px; font-weight: 650; color: var(--muted);
}
.assets-head h1 { font-size: 15px; color: var(--text); }

/* extend chip in the composer dock */
.dock-extend {
  display: inline-flex; align-items: center; gap: 7px; padding: 7px 6px 7px 11px;
  border-radius: 10px; border: 1px solid var(--accent-line); background: var(--accent-soft);
  color: var(--accent-hi); font-size: 12px; max-width: 300px;
}
.dock-extend-l { font-family: var(--font-mono); font-size: 10px; font-weight: 700; letter-spacing: .08em; }
.dock-extend-t { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--muted); font-size: 11.5px; }
.dock-extend-x { border: 0; background: transparent; color: var(--muted); cursor: pointer; padding: 2px 5px; border-radius: 6px; }
.dock-extend-x:hover { color: var(--danger); background: rgba(229,104,93,.12); }

/* extension lineage tag on reel cells */
.tag.ext { color: var(--accent-hi); border-color: var(--accent-line); background: var(--accent-soft); display: inline-flex; align-items: center; gap: 4px; }

/* ══ Pipeline modules — Spark · Forge · Frame · Flow ══════════════════════════ */
.tm-tabs .tm-item.costs { opacity: .75; margin-left: 10px; }
.module-hero { max-width: 640px; margin: 10vh auto 0; padding: 0 28px; position: relative; z-index: 1; }
.module-tag { font-family: var(--font-mono); font-size: 11px; letter-spacing: .22em; color: var(--accent); }
.module-name { font-size: 44px; font-weight: 750; letter-spacing: -0.02em; margin: 8px 0 10px; }
.module-blurb { font-size: 15px; color: var(--muted); line-height: 1.65; max-width: 480px; }
.module-points { margin: 22px 0 0; padding: 0; list-style: none; display: flex; flex-direction: column; gap: 9px; }
.module-points li { font-size: 13px; color: var(--muted); padding-left: 22px; position: relative; }
.module-points li::before { content: '▸'; position: absolute; left: 4px; color: var(--accent); }
.module-proj { margin-top: 26px; font-size: 12.5px; color: var(--faint); }
.module-proj b { color: var(--accent-hi); font-weight: 600; }
.module-soon {
  display: inline-block; margin-top: 30px; font-family: var(--font-mono); font-size: 10.5px;
  letter-spacing: .18em; color: var(--faint); border: 1px dashed var(--stroke);
  border-radius: 8px; padding: 7px 14px;
}
.flow-projchip {
  font-family: var(--font-mono); font-size: 11px; color: var(--accent-hi);
  border: 1px solid var(--accent-line); background: var(--accent-soft);
  border-radius: 14px; padding: 3px 11px; margin-left: 12px;
}

/* ══ VFX LAYOUT PASS — docked panels, status rail, Flow inspector ═════════════ */

/* bottom status rail */
.statusbar {
  position: fixed; left: 0; right: 0; bottom: 0; height: 26px; z-index: 60;
  display: flex; align-items: center; gap: 2px; padding: 0 10px;
  background: #0b0c0f; border-top: 1px solid var(--hairline);
  font-family: var(--font-mono); font-size: 10px; letter-spacing: .08em; color: var(--muted);
  user-select: none;
}
.statusbar .sb-cell { padding: 0 10px; display: inline-flex; align-items: center; gap: 7px; border-right: 1px solid rgba(255,255,255,.06); white-space: nowrap; }
.statusbar .sb-cell:last-child { border-right: 0; }
.statusbar .sb-cell.proj { color: var(--accent-hi); }
.statusbar .sb-cell.run { color: var(--run); }
.statusbar .sb-cell.dim { color: var(--faint); }
.statusbar .sb-spring { flex: 1; }
.statusbar .led { width: 6px; height: 6px; border-radius: 50%; background: rgba(255,255,255,.18); }
.statusbar .led.on { background: var(--run); box-shadow: 0 0 8px var(--run); animation: led-pulse 1.6s ease-in-out infinite; }
@keyframes led-pulse { 50% { opacity: .45; } }

/* everything sits above the rail */
.app { padding-bottom: 26px; }
.composer-dock { bottom: 26px; }
.toast { bottom: 40px; }

/* chrome: slimmer header that reads as an app title bar */
.topmenu { height: 44px; padding: 0 14px; background: #0b0c0f; border-bottom: 1px solid var(--hairline); }
.tm-brand .mark { font-size: 13px; }
.tm-brand .sub { display: none; } /* model id lives in the status rail now */

/* sidebar: denser bin-style rows */
.sidebar { background: rgba(10, 11, 14, 0.6); }
.proj-list .proj-item, .proj-list > div { border-radius: 8px; }
.nav-item { border-radius: 8px; }

/* main panels: docked, not floating */
.account-bar { border-radius: 0 0 12px 12px; }

/* viewport letterbox flavour on all video stages */
.trk-stage::after, .cell-frame::after, .lib-frame::after {
  content: ''; position: absolute; inset: 0; pointer-events: none; z-index: 4; border-radius: inherit;
  background: linear-gradient(180deg, rgba(0,0,0,.18), transparent 8%, transparent 92%, rgba(0,0,0,.22));
}

/* ── Flow: viewport + right inspector column (the tool rack docks like panels) */
/* flow list = shots bin */
.trk-list { width: 210px; }
.trk-card { border-radius: 9px; }
.trk-card.on { box-shadow: inset 2px 0 0 var(--accent); }

/* mono numerals for every readout */
.dock-cost, .cost-figures, .ab-summary { font-variant-numeric: tabular-nums; }

/* ══ Flow v2 — one viewer, segmented outputs (Apple-style) ════════════════════ */
.trk-detail { display: flex !important; flex-direction: column; gap: 14px; }

/* header */
.flowv-head { display: flex; align-items: flex-start; gap: 14px; }
.flowv-id { flex: 1; min-width: 0; }
.flowv-title {
  width: 100%; font-family: var(--font-display); font-size: 22px; font-weight: 700; letter-spacing: -0.015em;
  color: var(--text); background: transparent; border: 1px solid transparent; border-radius: 9px; padding: 3px 8px; margin-left: -8px;
}
.flowv-title:hover { border-color: var(--hairline); }
.flowv-title:focus { border-color: var(--accent-line); background: var(--bg); outline: none; }
.flowv-sub { font-family: var(--font-mono); font-size: 11px; color: var(--faint); margin-top: 2px; padding-left: 1px; }
.flowv-actions { display: flex; align-items: center; gap: 8px; padding-top: 4px; }
.flowv-export { white-space: nowrap; }
.flowv-export:disabled { opacity: .4; cursor: not-allowed; filter: grayscale(.6); }
.flowv-more { font-size: 16px; padding: 7px 12px; }
.flowv-menuwrap, .flowv-expwrap { position: relative; }
.flowv-menu {
  position: absolute; right: 0; top: calc(100% + 8px); z-index: 40; min-width: 200px;
  display: none; flex-direction: column; gap: 3px; padding: 6px;
  background: rgba(18, 19, 24, 0.98); border: 1px solid var(--stroke); border-radius: 12px;
  box-shadow: var(--shadow-lg);
}
.flowv-menu.open { display: flex; animation: pop-in .14s var(--ease) both; }
.flowv-menu > button { display: flex; align-items: center; gap: 8px; text-align: left; font-size: 13px; color: var(--text); background: transparent; border: 0; border-radius: 8px; padding: 8px 10px; cursor: pointer; }
.flowv-menu > button:hover { background: var(--fill); }
.flowv-menu > button.danger:hover { color: #ff8080; }
.flowv-menu.sheet { min-width: 250px; padding: 10px; gap: 10px; max-height: calc(100vh - 200px); overflow-y: auto; }
.flowv-optrow { display: flex; align-items: center; justify-content: space-between; gap: 12px; font-size: 12.5px; color: var(--muted); }
.flowv-miniseg { display: inline-flex; background: var(--fill); border: 1px solid var(--hairline); border-radius: 8px; padding: 2px; }
.flowv-miniseg button { border: 0; background: transparent; color: var(--muted); font-size: 12px; padding: 4px 12px; border-radius: 6px; cursor: pointer; transition: color .15s var(--ease), background-color .15s var(--ease); }
.flowv-miniseg button:hover:not(.on) { color: var(--text); background: var(--surface-1); }
.flowv-miniseg button.on { background: var(--surface-3); color: var(--text); }
.flowv-switch { width: 36px; height: 21px; border-radius: 12px; border: 1px solid var(--hairline); background: var(--fill); position: relative; cursor: pointer; transition: background .18s var(--ease), border-color .18s var(--ease); }
.flowv-switch:hover:not(.on) { border-color: var(--stroke); }
.flowv-switch:hover:not(.on)::after { background: var(--text); }
.flowv-switch::after { content: ''; position: absolute; top: 2px; left: 2px; width: 15px; height: 15px; border-radius: 50%; background: var(--muted); transition: left .18s var(--ease), background .18s; }
.flowv-switch.on { background: var(--accent); border-color: var(--accent); }
.flowv-switch.on::after { left: 17px; background: #17130a; }

/* viewer */
.flowv-viewer { position: relative; width: 100%; }
.flowv-player { position: relative; width: 100%; background: #000; border-radius: 14px; overflow: hidden; border: 1px solid var(--hairline); cursor: pointer; }
.flowv-player video { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: contain; }
.flowv-play {
  position: absolute; inset: 0; margin: auto; width: 64px; height: 64px; z-index: 3;
  display: grid; place-items: center; border: 0; border-radius: 50%; cursor: pointer;
  color: #fff; background: rgba(16, 17, 22, 0.66); backdrop-filter: blur(8px);
  transition: opacity .18s var(--ease), transform .18s var(--ease);
}
.flowv-player.playing .flowv-play { opacity: 0; transform: scale(.9); pointer-events: none; }
.flowv-player:hover.playing .flowv-play { opacity: .85; transform: none; pointer-events: auto; }
.flowv-player .hover-scrub { opacity: 1; }

/* guided empty state */
.flowv-empty {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px;
  min-height: 380px; padding: 48px 32px; text-align: center;
  background: linear-gradient(180deg, rgba(255,255,255,.028), rgba(255,255,255,.012));
  border: 1px solid var(--hairline); border-radius: 14px;
}
.flowv-empty-ic { display: grid; place-items: center; width: 52px; height: 52px; border-radius: 15px; background: var(--accent-soft); border: 1px solid var(--accent-line); color: var(--accent-hi); margin-bottom: 8px; }
.flowv-empty-ic svg { width: 22px; height: 22px; }
.flowv-empty h3 { font-size: 19px; font-weight: 700; letter-spacing: -0.01em; }
.flowv-empty p { font-size: 13px; color: var(--muted); max-width: 400px; line-height: 1.6; margin-bottom: 12px; }
.flowv-empty .trk-btn.big { padding: 11px 26px; border-radius: 11px; }
.flowv-empty .trk-solveopts.quiet { margin-top: 14px; border: 0; background: transparent; }
.flowv-empty-note { font-size: 11px; color: var(--faint); margin-top: 16px; }
.flowv-run-label { font-family: var(--font-mono); font-size: 11.5px !important; }
.flowv-empty .trk-progouter { max-width: 340px; margin: 4px 0 14px; }

/* segmented output switcher */
.flowv-seg {
  display: flex; gap: 4px; align-self: center; padding: 4px;
  background: var(--surface-1); border: 1px solid var(--hairline); border-radius: 13px;
}
.flowv-segbtn {
  display: inline-flex; align-items: center; gap: 8px; padding: 8px 16px;
  border: 0; border-radius: 9px; background: transparent; color: var(--muted);
  font-size: 13px; font-weight: 550; cursor: pointer;
}
.flowv-segbtn:hover { color: var(--text); background: rgba(255,255,255,.04); }
.flowv-segbtn.on { background: var(--surface-3); color: var(--text); box-shadow: 0 1px 6px rgba(0,0,0,.3), inset 0 1px 0 rgba(255,255,255,.06); }
.flowv-segbtn .segdot { width: 6px; height: 6px; border-radius: 50%; }
.segdot.ready { background: var(--ok); box-shadow: 0 0 6px var(--ok); }
.segdot.running { background: var(--run); box-shadow: 0 0 6px var(--run); animation: led-pulse 1.4s ease-in-out infinite; }
.segdot.failed { background: var(--danger); }
.segdot.none { background: transparent; border: 1px solid var(--stroke); }

/* clips bin with posters */
.trk-list { width: 236px; }
.trk-card { display: flex; gap: 10px; padding: 8px; align-items: center; }
.trk-card-thumb { position: relative; width: 74px; aspect-ratio: 16/9; border-radius: 6px; overflow: hidden; background: #000 center/cover no-repeat; flex-shrink: 0; border: 1px solid rgba(255,255,255,.06); }
.trk-card-thumb video { width: 100%; height: 100%; object-fit: cover; }
.trk-card-info { min-width: 0; flex: 1; }
.trk-card-meta { font-family: var(--font-mono); font-size: 10px; }

/* hero CTA */
.flow-hero-cta { margin-top: 20px; }

/* ══ ITERATION 1 — chrome & navigation cohesion ═══════════════════════════════ */

/* tabs: one sliding indicator pill, no per-tab underline */
.tm-tabs { position: relative; }
.tm-tabs .tm-item.active::after { display: none; }
.tm-ind {
  position: absolute; bottom: 4px; height: 2px; border-radius: 2px;
  background: var(--accent); box-shadow: 0 0 10px var(--accent);
  transition: left .32s var(--spring), width .32s var(--spring);
  opacity: 0;
}
.tm-ind.ready { opacity: 1; }

/* resource meter lives in the title bar now — compact, quiet, expandable */
.topmenu { display: flex; align-items: center; gap: 18px; }
.topmenu .account-bar {
  margin-left: auto; background: transparent; border: 0; padding: 0;
  display: flex; align-items: center; position: relative;
}
.topmenu .ab-summary { gap: 10px; width: auto; font-size: 11px; }
.topmenu .ab-label { display: none; }                    /* self-evident from the meter */
.topmenu .ab-stat .u { display: none; }                  /* units live in the tooltip */
.topmenu .ab-stat { font-family: var(--font-mono); font-size: 11px; color: var(--muted); }
.topmenu .ab-stat b { color: var(--text); font-weight: 600; }
.topmenu .ab-stat.money { color: var(--accent-hi); }
.topmenu .ab-meter { width: 90px; height: 4px; border-radius: 3px; background: rgba(255,255,255,.09); overflow: hidden; }
.topmenu .ab-meter span { display: block; height: 100%; background: var(--accent); border-radius: 3px; }
.topmenu .ab-meter.over span { background: var(--danger); }
.topmenu .ab-pending { font-family: var(--font-mono); font-size: 10px; color: var(--run); }
.topmenu .ab-conc { font-size: 10px; }
.topmenu .ab-edit { width: 26px; height: 26px; border-radius: 7px; display: grid; place-items: center; background: transparent; border: 1px solid transparent; color: var(--faint); cursor: pointer; }
.topmenu .ab-edit:hover { color: var(--text); border-color: var(--hairline); background: var(--fill); }
.topmenu .packs-pop { position: absolute; right: 0; top: calc(100% + 10px); left: auto; z-index: 80; }

/* sidebar: calmer rows, hover nudge, quieter counts */
.proj-list > * { transition: background .15s var(--ease), transform .15s var(--ease); }
.proj-list > *:hover { transform: translateX(2px); }
.nav-item { transition: background .15s var(--ease), color .15s var(--ease); }

/* toast: rises with a spring instead of appearing */
.toast { transition: opacity .2s var(--ease), transform .34s var(--spring); transform: translateX(-50%) translateY(14px); }
.toast.show { transform: translateX(-50%) translateY(0); }

/* ══ ITERATION 2 — the Frame workspace ════════════════════════════════════════ */

/* composer: the dock announces focus like a first-class input */
.dock-row { transition: border-color .2s var(--ease), box-shadow .25s var(--ease); }
.dock-row:focus-within {
  border-color: var(--accent-line);
  box-shadow: 0 0 0 3px rgba(232,180,76,.08), 0 14px 44px rgba(0,0,0,.5);
}
/* generate: no light sweep — hover is a calm brighten + soft pulse (see HOVER DISCIPLINE) */

/* reel cells: enter with a soft rise, first paint only */
@keyframes cell-in { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }
.reel .cell { animation: cell-in .4s var(--ease) both; }
.reel .cell:nth-child(1) { animation-delay: .02s; } .reel .cell:nth-child(2) { animation-delay: .07s; }
.reel .cell:nth-child(3) { animation-delay: .12s; } .reel .cell:nth-child(4) { animation-delay: .17s; }
.reel .cell:nth-child(n+5) { animation-delay: .22s; }

/* prompt text: click to read it all */
.cell-prompt { cursor: pointer; transition: -webkit-line-clamp .01s; }
.cell-prompt.expanded { -webkit-line-clamp: unset; }
.cell-prompt.empty { cursor: default; }

/* footer actions: quiet until the row is engaged */
.cell-foot .act { background: transparent; border-color: transparent; color: var(--muted); transition: all .15s var(--ease); }
.cell:hover .cell-foot .act { border-color: var(--hairline); background: var(--fill); }
.cell-foot .act:hover { color: var(--text); border-color: var(--accent-line); }

/* empty reel: an invitation, not a void */
.reel-empty, .empty-reel { border: 1.5px dashed var(--stroke); border-radius: 16px; }

@media (prefers-reduced-motion: reduce) { .reel .cell { animation: none; } }

/* ══ ITERATION 3 — Flow motion & viewer chrome ════════════════════════════════ */

/* segmented control: gliding thumb, dots ride above it */
.flowv-seg { position: relative; }
.flowv-thumb {
  position: absolute; top: 4px; bottom: 4px; border-radius: 9px; opacity: 0;
  background: var(--surface-3);
  box-shadow: 0 1px 6px rgba(0,0,0,.35), inset 0 1px 0 rgba(255,255,255,.07);
  transition: left .34s var(--spring), width .34s var(--spring), opacity .2s;
}
.flowv-thumb.ready { opacity: 1; }
.flowv-segbtn { position: relative; z-index: 1; }
.flowv-segbtn.on { background: transparent; box-shadow: none; } /* the thumb is the highlight now */

/* viewer content crossfades between outputs */
@keyframes viewer-in { from { opacity: 0; transform: scale(.995); } to { opacity: 1; transform: none; } }
.flowv-viewer > * { animation: viewer-in .28s var(--ease) both; }

/* clips bin: entries rise in like the reel */
.trk-list .trk-card { animation: cell-in .35s var(--ease) both; }
.trk-list .trk-card:nth-child(1) { animation-delay: .02s; } .trk-list .trk-card:nth-child(2) { animation-delay: .06s; }
.trk-list .trk-card:nth-child(3) { animation-delay: .1s; } .trk-list .trk-card:nth-child(n+4) { animation-delay: .14s; }

@media (prefers-reduced-motion: reduce) {
  .flowv-thumb { transition: none; }
  .flowv-viewer > *, .trk-list .trk-card { animation: none; }
}

/* ══ Detail-view player: transport + volume + filmstrip in the video modal ════ */
.vmodal-tp { margin: 10px 0 0; }
.vmodal-film { margin-top: 8px; height: 44px; }
.vmodal-vol { width: 86px; accent-color: var(--accent); }
.trk-tp-btn.wide { width: auto; padding: 0 12px; display: inline-flex; align-items: center; gap: 6px; font-size: 11.5px; font-family: var(--font-mono); }
.vmodal-stage video { cursor: pointer; }
/* the stage is a centering grid — the player chrome must span it */
.vmodal-stage { grid-template-columns: 100%; padding-bottom: 10px; }
.vmodal-tp, .vmodal-film { width: calc(100% - 20px); justify-self: center; }

/* ══ Feed day separators + detail timestamp ═══════════════════════════════════ */
.reel-day {
  display: flex; align-items: baseline; gap: 12px; margin: 6px 2px -2px;
  animation: cell-in .4s var(--ease) both;
}
.reel-day:first-child { margin-top: 0; }
.reel-day-main { font-family: var(--font-display); font-size: 15px; font-weight: 650; color: var(--text); letter-spacing: -0.01em; }
.reel-day-sub { font-family: var(--font-mono); font-size: 11px; color: var(--faint); text-transform: uppercase; letter-spacing: .05em; white-space: nowrap; }
.reel-day-rule { flex: 1; height: 1px; background: linear-gradient(90deg, var(--hairline), transparent); }

.vmodal-created { font-family: var(--font-mono); font-size: 13px; color: var(--muted); }

/* ══ Flow v3 — video-editor layout (fills the frame, docks the timeline) ══════ */
.trk { height: calc(100dvh - 70px); padding: 14px 22px 12px; overflow: hidden; gap: 12px; }
.trk-body { flex: 1; min-height: 0; padding-bottom: 0; gap: 14px; }
.trk-head { flex: none; }

/* detail = fixed column: header (auto) · viewer (fills) · outputs (auto) */
.trk-detail { display: flex !important; flex-direction: column; gap: 12px; min-height: 0; overflow: hidden; }
.flowv-head { flex: none; }
.flowv-seg { flex: none; }

/* the dark viewer that holds whatever output is active */
.flowv-viewer {
  flex: 1 1 auto; min-height: 0; display: flex; flex-direction: column;
  background: #060708; border: 1px solid var(--hairline); border-radius: 14px; overflow: hidden;
  box-shadow: inset 0 1px 0 rgba(255,255,255,.03), 0 12px 40px rgba(0,0,0,.35);
}
.flowv-viewer > * { flex: 1; min-height: 0; }

/* camera view fills the viewer: toolbar / stage box / dock */
.trk-stagewrap { display: flex; flex-direction: column; gap: 0; max-width: none; min-height: 0; }
.trk-toolbar { flex: none; padding: 9px 11px; margin: 0; border-bottom: 1px solid var(--hairline); background: rgba(0,0,0,.28); flex-wrap: wrap; row-gap: 8px; }
/* position:relative — the pin/mask toolbars anchor to the BOX (letterbox band), not the picture */
.trk-stagebox { position: relative; flex: 1; min-height: 0; display: flex; align-items: center; justify-content: center; overflow: hidden; background: #030405; padding: 10px; }
.trk-stage { position: relative; width: auto; height: auto; background: #000; border-radius: 6px; overflow: hidden; box-shadow: 0 0 0 1px rgba(255,255,255,.06), 0 8px 30px rgba(0,0,0,.5); }
.trk-video, .trk-proxy { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: fill; }
.trk-canvas { position: absolute; inset: 0; width: 100%; height: 100%; z-index: 2; }

/* interactive SAM masking: click canvas + on-stage tools */
.trk-maskpaint { position: absolute; inset: 0; width: 100%; height: 100%; z-index: 4; cursor: crosshair; }
.trk-masktools { position: absolute; top: 8px; left: 8px; z-index: 5; display: flex; gap: 6px; background: rgba(0,0,0,.55); padding: 5px; border-radius: 9px; backdrop-filter: blur(6px); }

/* guided repair — heat-lane click menu */
.trk-errheat.clickable { cursor: pointer; }
.trk-repairpop { position: fixed; z-index: 300; width: 340px; background: rgba(16,17,22,.97); border: 1px solid var(--stroke); border-radius: 12px; box-shadow: var(--shadow-lg); padding: 12px; display: flex; flex-direction: column; gap: 8px; animation: card-rise .18s var(--spring) both; }
.trk-repairpop-h { font-family: var(--font-mono); font-size: 11.5px; font-weight: 650; letter-spacing: .04em; color: var(--text); }
.trk-repairpop-note { font-size: 11.5px; color: var(--muted); line-height: 1.45; }
.trk-repairpop-act { display: flex; flex-direction: column; align-items: flex-start; gap: 3px; text-align: left; padding: 9px 11px; }
.trk-repairpop-act b { font-size: 12.5px; }
.trk-repairpop-act span { font-size: 11px; color: var(--muted); line-height: 1.4; white-space: normal; }
.trk-repairpop-close { align-self: flex-end; }
.trk-masktools .trk-btn.sm { padding: 4px 9px; font-size: 11px; }
.trk-maskhint { position: absolute; bottom: 10px; left: 50%; transform: translateX(-50%); z-index: 5; font-size: 11px; color: #fff; background: rgba(0,0,0,.55); padding: 4px 10px; border-radius: 6px; font-family: var(--font-mono); white-space: nowrap; backdrop-filter: blur(6px); }

/* bottom dock — always visible under the picture */
.trk-dock { flex: none; padding: 9px 11px 10px; display: flex; flex-direction: column; gap: 8px; border-top: 1px solid var(--hairline); background: rgba(0,0,0,.28); }
.trk-dock .trk-transport { width: 100%; margin: 0; background: transparent; border: 0; padding: 0; }
.trk-dock .trk-film { height: 44px; margin: 0; }

/* simple player (original / depth / matte) letterboxes in the same dark viewer */
.flowv-player { position: relative; width: 100%; height: 100%; background: #030405; border-radius: 0; border: 0; aspect-ratio: auto; }
.flowv-player video { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: contain; }

/* empty / running states fill the viewer and stay centered */
.flowv-viewer > .flowv-empty { border: 0; border-radius: 0; background: transparent; min-height: 0; }

/* resolve sheet (model · quality · masking) */
.flowv-reswrap .sheet { left: 0; right: auto; min-width: 260px; }
.flowv-sheet-h { font-family: var(--font-mono); font-size: 10px; letter-spacing: .1em; text-transform: uppercase; color: var(--faint); margin: 2px 0 -2px; }
.flowv-sheet-note { font-size: 11px; color: var(--faint); border-top: 1px solid var(--hairline); padding-top: 8px; line-height: 1.5; }
.flowv-reswrap .sheet select.trk-kind { width: 100%; }

/* two-column body: viewer (left) + docked settings panel (right) */
.flowv-body { flex: 1 1 auto; min-height: 0; display: flex; gap: 12px; }
.flowv-body > .flowv-viewer { flex: 1 1 auto; }
.flowv-panel {
  flex: 0 0 320px; width: 320px; min-height: 0; overflow-y: auto;
  display: flex; flex-direction: column; gap: 10px;
  padding: 14px; border: 1px solid var(--hairline); border-radius: 14px;
  background: rgba(255,255,255,.02);
  box-shadow: inset 0 1px 0 rgba(255,255,255,.03);
}
.flowv-panel select.trk-kind, .flowv-panel .flowv-switch { flex: none; }
.flowv-panel select.trk-kind { width: 100%; max-width: 170px; }
.flowv-panel-h { font-family: var(--font-mono); font-size: 10px; letter-spacing: .1em; text-transform: uppercase; color: var(--faint); margin: 6px 0 -2px; }
.flowv-panel-h:first-child { margin-top: 0; }
.flowv-panel-note { font-size: 11px; color: var(--faint); border-top: 1px solid var(--hairline); padding-top: 8px; line-height: 1.5; }
.flowv-panel-foot {
  position: sticky; bottom: -14px; margin: auto -14px -14px; padding: 12px 14px 14px;
  display: flex; flex-direction: column; gap: 8px;
  border-top: 1px solid var(--hairline); background: rgba(14,16,18,.97); backdrop-filter: blur(6px);
}
.flowv-panel-foot .big { width: 100%; justify-content: center; }
.flowv-maskadd { width: 100%; justify-content: center; }
.flowv-maskadd.on { background: var(--accent-soft); border-color: var(--accent-line); color: var(--text); }

/* Advanced Tracking — witness pins + certificate */
.trk-witpaint { position: absolute; inset: 0; width: 100%; height: 100%; z-index: 4; cursor: crosshair; }
.flowv-witadd { width: 100%; justify-content: center; }
.flowv-witadd.on { background: var(--accent-soft); border-color: var(--accent-line); color: var(--text); }
.flowv-witlist { display: flex; flex-direction: column; gap: 4px; }
.flowv-witrow { display: flex; align-items: center; gap: 8px; font-size: 12px; color: var(--muted); font-family: var(--font-mono); }
.flowv-witrow .flowv-witname { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.flowv-witrow .wit-plane-lbl { font-size: 10px; letter-spacing: .08em; text-transform: uppercase; color: var(--faint); }
.flowv-panel-note.flowv-cert-ok { color: #39d98a; }
.flowv-panel-note.flowv-cert-weak { color: #f5af00; }
.flowv-witjump { width: 100%; justify-content: center; }
.flowv-witprev { width: 100%; justify-content: center; }
.flowv-num { width: 110px; background: var(--panel-2, rgba(255,255,255,.04)); border: 1px solid var(--line, rgba(255,255,255,.12)); border-radius: 7px; color: var(--text); padding: 5px 8px; font: inherit; font-size: 12px; }
.flowv-witrow .flowv-witname.wit-ok { color: #39d98a; }
.flowv-witrow .flowv-witname.wit-weak { color: #f5af00; }
.flowv-witrow .flowv-witname.wit-lost { color: #ff5a46; }

/* narrow screens: stack the panel under the viewer */
@media (max-width: 1080px) {
  .flowv-body { flex-direction: column; }
  .flowv-panel { flex: none; width: auto; max-height: 46vh; }
  .flowv-panel select.trk-kind { max-width: 220px; }
}

/* toolbar zoom slider a touch wider */
.trk-tgroup .trk-slider input[type=range] { width: 74px; }

/* ══ Flow v4 — output menu (replaces the bottom segmented control) ════════════ */
.flowv-seg { display: none; } /* retired: output switching is a menu now */

.flowv-vmenu { position: relative; }
.flowv-vmenu-btn {
  display: inline-flex; align-items: center; gap: 8px; padding: 7px 11px;
  background: var(--surface-2); border: 1px solid var(--stroke); border-radius: 9px;
  color: var(--text); font-size: 13px; font-weight: 550; cursor: pointer;
}
.flowv-vmenu-btn:hover { border-color: var(--accent-line); }
.flowv-vmenu-btn .segdot { width: 6px; height: 6px; border-radius: 50%; }
.flowv-vmenu-btn .vmenu-caret { font-style: normal; color: var(--muted); font-size: 10px; margin-left: 1px; }
.flowv-vmenu-list {
  position: absolute; left: 0; top: calc(100% + 6px); z-index: 30; min-width: 236px;
  display: none; flex-direction: column; gap: 2px; padding: 6px;
  background: rgba(18, 19, 24, 0.98); border: 1px solid var(--stroke); border-radius: 12px;
  box-shadow: var(--shadow-lg);
}
.flowv-vmenu-list.open { display: flex; animation: pop-in .14s var(--ease) both; }
.flowv-vmenu-item {
  display: flex; align-items: center; gap: 9px; padding: 8px 10px; border: 0; border-radius: 8px;
  background: transparent; color: var(--text); font-size: 13px; cursor: pointer; text-align: left;
}
.flowv-vmenu-item span { flex: 1; }
.flowv-vmenu-item .segdot { width: 6px; height: 6px; border-radius: 50%; }
.flowv-vmenu-item em { font-style: normal; font-family: var(--font-mono); font-size: 10px; color: var(--faint); }
.flowv-vmenu-item:hover { background: var(--fill); }
.flowv-vmenu-item.on { background: var(--accent-soft); color: var(--accent-hi); }
.flowv-vmenu-item svg { color: var(--muted); }
.flowv-vmenu-item.on svg { color: var(--accent-hi); }

/* the empty / running body centers in the stage box */
.trk-stagebox > .flowv-empty { border: 0; background: transparent; width: 100%; }

/* ══ Flow v5 — toolbar dropdowns + zoom menu under the video ══════════════════ */
.trk-dd { position: relative; }
.trk-dd-btn { display: inline-flex; align-items: center; gap: 6px; }
.trk-dd-panel {
  position: absolute; left: 0; top: calc(100% + 6px); z-index: 40; min-width: 210px;
  display: none; flex-direction: column; gap: 9px; padding: 11px;
  background: rgba(20, 21, 29, 0.97); border: 1px solid var(--stroke); border-radius: 12px;
  -webkit-backdrop-filter: saturate(160%) blur(24px); backdrop-filter: saturate(160%) blur(24px);
  box-shadow: var(--shadow-lg), inset 0 1px 0 var(--glass-hi);
}
.trk-dd-panel.open { display: flex; animation: pop-in .14s var(--ease) both; }
.trk-dd-panel.up { top: auto; bottom: calc(100% + 8px); }
.trk-dd-row { display: flex; align-items: center; justify-content: space-between; gap: 14px; font-size: 12.5px; color: var(--muted); }
.trk-dd-row span { white-space: nowrap; }
.trk-dd-row input[type=range] { width: 108px; accent-color: var(--accent); }
.trk-dd-panel .trk-btn.ghost { justify-content: center; font-size: 12px; }
.trk-dd-panel .flowv-miniseg button { padding: 4px 10px; }

/* the zoom menu sits at the right end of the transport, opening upward */
.trk-zoommenu { margin-left: 4px; }
.trk-zoommenu .trk-dd-btn { font-family: var(--font-mono); font-size: 11.5px; padding: 6px 10px; }
.trk-zoommenu .trk-dd-panel { left: auto; right: 0; min-width: 190px; }
/* the stage must keep its JS-computed size inside the flex-centered box (so zoom
   actually enlarges it and the box clips the overflow) */
.trk-stagebox > .trk-stage { flex: 0 0 auto; }

/* ══ Preview modal — two-column editor (video left · details right) ═══════════ */
.vmodal-panel { max-width: 1200px; max-height: 90vh; display: flex; flex-direction: column; }
.vmodal-body { display: flex; align-items: stretch; min-height: 0; flex: 1; }

/* left: the player fills the column, letterboxed, with its transport docked */
.vmodal-body > .vmodal-stage {
  flex: 1 1 auto; min-width: 0; display: flex; flex-direction: column; gap: 8px;
  background: #030405; padding: 12px; place-items: stretch;
}
.vmodal-body .vmodal-stage video { flex: 1; min-height: 0; width: 100%; height: auto; max-height: none; object-fit: contain; }
.vmodal-body .vmodal-tp, .vmodal-body .vmodal-film { flex: none; width: 100%; }

/* right: details scroll independently */
.vmodal-meta {
  width: 348px; flex: none; overflow-y: auto; padding: 18px 20px 22px;
  border-left: 1px solid var(--hairline); background: var(--surface-1);
}
.vmodal-label:first-child { margin-top: 0; }

/* stack on narrow viewports */
@media (max-width: 860px) {
  .vmodal-body { flex-direction: column; }
  .vmodal-meta { width: auto; border-left: 0; border-top: 1px solid var(--hairline); max-height: 40vh; }
  .vmodal-body > .vmodal-stage { min-height: 46vh; }
}

/* ══ Combine modal — two-column editor (player left · join controls right) ════ */
.stitch-panel { width: min(1080px, 95vw); }
.stitch-body { display: flex; align-items: stretch; padding: 0; overflow: hidden; }
.stitch-body > .stitch-stage {
  flex: 1 1 auto; min-width: 0; border-radius: 0; display: flex; flex-direction: column; gap: 8px;
  background: #030405; padding: 12px; position: relative;
}
.stitch-body .stitch-video { flex: 1; min-height: 0; width: 100%; height: auto; max-height: none; object-fit: contain; border-radius: 6px; }
.stitch-body .stitch-tp, .stitch-body .stitch-film { flex: none; }
.stitch-body .stitch-status { position: absolute; inset: 0; margin: auto; }
.stitch-side {
  width: 320px; flex: none; display: flex; flex-direction: column;
  border-left: 1px solid var(--hairline); background: var(--surface-1);
}
.stitch-side .stitch-info { margin: 0; padding: 18px 20px; overflow-y: auto; flex: 1; }
.stitch-side .stitch-foot { border-top: 1px solid var(--hairline); }
.stitch-line.dim { color: var(--muted); font-size: 12px; margin-top: 2px; }
.stitch-side .stitch-hint { margin-top: 6px; }

@media (max-width: 860px) {
  .stitch-body { flex-direction: column; }
  .stitch-side { width: auto; border-left: 0; border-top: 1px solid var(--hairline); }
  .stitch-body > .stitch-stage { min-height: 44vh; }
}

/* ══ Modals: strict viewport-height cap + combine source-clip tiles ═══════════ */
/* never taller than the viewport (centered, inner columns scroll) */
.vmodal { align-items: center; padding: 16px; overflow: hidden; }
.vmodal-panel { max-height: calc(100vh - 32px); margin: 0; }
.stitch-modal { padding: 16px; }
.stitch-panel { max-height: calc(100vh - 32px); }

/* combine: source-clip preview/download tiles under the filmstrip (left column) */
.stitch-clips { display: flex; gap: 8px; flex-wrap: wrap; flex: none; padding-top: 2px; }
.stitch-clip {
  position: relative; width: 116px; aspect-ratio: 16/9; border-radius: 7px; overflow: hidden;
  border: 1px solid var(--hairline); background: #000; cursor: pointer; flex: none;
}
.stitch-clip:hover { border-color: var(--accent-line); }
.stitch-clip video { width: 100%; height: 100%; object-fit: cover; display: block; }
.stitch-clip-lbl {
  position: absolute; left: 5px; bottom: 4px; z-index: 2;
  font-family: var(--font-mono); font-size: 9.5px; letter-spacing: .04em; color: #fff;
  background: rgba(0,0,0,.55); padding: 1px 6px; border-radius: 5px;
}
.stitch-clip-dl {
  position: absolute; top: 4px; right: 4px; z-index: 2; width: 22px; height: 22px;
  display: grid; place-items: center; border-radius: 6px; color: #fff;
  background: rgba(0,0,0,.5); opacity: 0; transition: opacity .15s var(--ease);
}
.stitch-clip:hover .stitch-clip-dl { opacity: 1; }
.stitch-clip-dl:hover { background: var(--accent); color: #17130a; }

/* ══ Flow clips bin — dark panel, like the video area ═════════════════════════ */
.trk-list {
  background: #060708; border: 1px solid var(--hairline); border-radius: 14px;
  padding: 8px; gap: 8px;
  box-shadow: inset 0 1px 0 rgba(255,255,255,.03), 0 12px 40px rgba(0,0,0,.35);
}
.trk-list .trk-card { background: rgba(255,255,255,.045); }
.trk-list .trk-card:hover { background: rgba(255,255,255,.075); }
.trk-list .trk-card.on { background: var(--accent-soft); }

/* ══ Flow — ingest empty state (upload prompt) ═══════════════════════════════ */
.flow-nf-empty {
  flex: 1 1 auto; min-height: 340px; display: flex; flex-direction: column;
  align-items: center; justify-content: center; gap: 12px; text-align: center;
  border: 1.5px dashed var(--stroke); border-radius: 16px; background: #060708;
  padding: 40px 24px; transition: border-color .18s var(--ease), background .18s var(--ease);
}
.flow-nf-empty.over { border-color: var(--accent-line); background: var(--accent-soft); }
.flow-nf-empty .flow-nf-ic { display: block; opacity: .5; margin-bottom: 4px; }
.flow-nf-empty .flow-nf-ic svg { width: 40px; height: 40px; }
.flow-nf-empty .trk-btn.big { margin-top: 6px; }

/* ══ Flow — combined new-flow setup (upload · settings · track) ═══════════════ */
.flow-newflow {
  max-width: 560px; margin: 4vh auto 0; display: flex; flex-direction: column; gap: 12px;
}
.trk-detail > .flow-newflow { flex: 1 1 auto; min-height: 0; max-width: 720px; }
.flow-nf-t { font-family: var(--font-display); font-size: 22px; font-weight: 700; letter-spacing: -0.015em; }
.flow-nf-s { font-size: 13px; color: var(--muted); line-height: 1.6; margin-bottom: 4px; }
.flow-nf-lbl { font-family: var(--font-mono); font-size: 10px; letter-spacing: .1em; text-transform: uppercase; color: var(--faint); margin-top: 6px; }

/* dropzone / preview */
.flow-nf-drop {
  border: 1.5px dashed var(--stroke); border-radius: 14px; background: #060708;
  min-height: 220px; display: flex; align-items: center; justify-content: center; overflow: hidden;
  transition: border-color .18s var(--ease), background .18s var(--ease);
}
.flow-nf-drop.over { border-color: var(--accent-line); background: var(--accent-soft); }
.flow-nf-drop.has { border-style: solid; border-color: var(--hairline); flex-direction: column; align-items: stretch; }
.flow-nf-drop-in { display: flex; flex-direction: column; align-items: center; gap: 8px; padding: 40px 24px; text-align: center; }
.flow-nf-ic { color: var(--faint); }
.flow-nf-drop-h { font-size: 16px; font-weight: 600; color: var(--text); }
.flow-nf-drop-sub { font-family: var(--font-mono); font-size: 10.5px; color: var(--faint); text-transform: uppercase; letter-spacing: .05em; margin-bottom: 6px; }
.flow-nf-vid { width: 100%; max-height: 42vh; object-fit: contain; background: #000; display: block; }
.flow-nf-vidbar { display: flex; align-items: center; gap: 10px; padding: 9px 11px; border-top: 1px solid var(--hairline); }
.flow-nf-name { flex: 1; min-width: 0; font-size: 12.5px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.flow-nf-vidbar .trk-btn { padding: 6px 11px; font-size: 12px; }

.flow-newflow .trk-solveopts { align-self: stretch; }
.flow-newflow .flow-nf-track {
  align-self: stretch; justify-content: center; margin-top: 6px;
  padding: 12px 16px; font-size: 14px;
}
.flow-nf-track:disabled { opacity: .45; cursor: not-allowed; filter: grayscale(.5); }
.flow-nf-track:disabled:hover { animation: none; }
/* the panel sits centered in the pane and scrolls if the pane is short */
.flow-newflow { margin-top: max(2vh, 12px); min-height: 0; overflow-y: auto; padding: 2px 6px 18px; }
.flow-newflow > * { flex-shrink: 0; } /* the scroller does the giving, not the dropzone */
.flow-newflow .flowv-empty-note { text-align: center; }
/* update tick: give the two intro lines a touch more air over the card */
.flow-nf-t { margin-top: 2px; }

/* New-flow button now lives at the top of the clips bin (full width) */
.trk-list .trk-new {
  margin: 0 0 4px; width: 100%; display: flex; align-items: center; justify-content: center; gap: 6px;
  background: linear-gradient(180deg, var(--accent-hi), var(--accent)); color: #17130a;
  font-weight: 650; padding: 10px 12px; border-radius: 10px; flex-shrink: 0;
  box-shadow: 0 2px 12px rgba(232,180,76,.2), inset 0 1px 0 rgba(255,255,255,.3);
}
.trk-list .trk-new:hover { filter: brightness(1.06); }

/* ══ HOVER DISCIPLINE — one graceful hover for every button ═══════════════════
   No grey wash, no light sweep. Hover = brightened text, amber hairline, a tiny
   lift, and a soft safelight "breathe" on the glow. Backgrounds never change. */
@keyframes hover-breathe {
  0%, 100% { box-shadow: 0 0 0 1px var(--accent-line), 0 0 10px rgba(232, 180, 76, 0.06); }
  50%      { box-shadow: 0 0 0 1px var(--accent-line), 0 0 20px rgba(232, 180, 76, 0.16); }
}
/* the composer's controls + the app's bordered buttons share the breathe */
.dock-btn:hover, .dock-icon:hover, .dock-btn.attach:hover, .dice:hover,
.act:hover, .trk-btn:hover, .trk-tp-btn:hover, .cam-btn:hover, .cam-move:hover,
.stitch-btn:hover, .asset-btn:hover, .dir-btn:hover, .dd-use:hover, .review-use:hover,
.confirm-btn:hover, .flowv-vmenu-btn:hover, .btn:hover {
  animation: hover-breathe 2s var(--ease) infinite;
}
/* primary "safelight keys" breathe amber a touch stronger */
@keyframes key-breathe {
  0%, 100% { box-shadow: 0 2px 14px rgba(232, 180, 76, 0.22), inset 0 1px 0 rgba(255, 255, 255, 0.35); }
  50%      { box-shadow: 0 2px 22px rgba(232, 180, 76, 0.42), inset 0 1px 0 rgba(255, 255, 255, 0.35); }
}
.btn-generate:hover:not(:disabled), .trk-btn.primary:hover, .stitch-btn.primary:hover,
.trk-new:hover, .assets-add:not(.ghost):hover, .flow-nf-track:hover:not(:disabled) {
  animation: key-breathe 2s var(--ease) infinite;
}
@media (prefers-reduced-motion: reduce) {
  .dock-btn:hover, .dock-icon:hover, .act:hover, .btn:hover, .btn-generate:hover { animation: none !important; }
}

/* ══ DIRECTOR — inline right panel that pushes the workspace left ═════════════ */
/* No edge tab, no floating popover: when a run is open the drawer docks to the
   right and the app + composer shift over, like a inspector in an NLE. */
.director-tab { display: none !important; }
.director-drawer {
  top: 44px; bottom: 26px; height: auto;  /* between the top menu and status rail */
  box-shadow: none;
  transition: transform .32s var(--ease);
}
.app, .composer-dock { transition: margin-right .32s var(--ease), left .22s var(--ease), right .32s var(--ease); }
body.director-open .app { margin-right: min(390px, 92vw); }
body.director-open .composer-dock { right: min(390px, 92vw); }
/* the run's source clip reads as the reference, not a pass */
.dd-round.dd-source { border-style: dashed; background: rgba(255, 255, 255, 0.02); }

/* ══ RESPONSIVE PASS — the dock degrades gracefully, chrome never wraps ═══════ */
.tm-brand .mark { white-space: nowrap; }
.topmenu { flex-wrap: nowrap; min-width: 0; }
/* Clip the meter strip, not the whole bar — the packs/users popovers hang
   below the bar and must escape it. */
.topmenu .account-bar { min-width: 0; }
.topmenu .ab-summary { min-width: 0; overflow: hidden; }

/* the dock is a container (container-name: dock) — tighten by its own width,
   not the viewport, so it also adapts when the Director panel pushes it */
@container dock (max-width: 760px) {
  .dock-cost { margin-left: auto; }        /* cost + Generate hug the right edge */
  .dock-cost .usd { display: none; }       /* one currency is plenty when tight */
  .gen-kbd { display: none; }
}
@container dock (max-width: 620px) {
  .dock-btn.options span { display: none; }  /* settings collapses to its icon */
  .dock-btn.options { width: 38px; height: 38px; padding: 0; justify-content: center; gap: 0; }
  .dock-cost .cap { display: none; }
}
@container dock (max-width: 470px) {
  .dock-cost { display: none; }            /* the estimate lives in the settings pop */
}

/* Flow at narrow widths: the bin slims down, the setup panel never overflows */
.flow-newflow { width: 100%; }
.flow-newflow .trk-solveopts { flex-wrap: wrap; row-gap: 6px; }
@media (max-width: 940px) {
  .trk-list { width: 178px; }
  .trk-card-thumb { width: 52px; }
}
@media (max-width: 720px) {
  .trk { padding: 10px 12px 8px; }
  .trk-list { width: 138px; }
}

/* ══ PERF — long feeds skip offscreen rendering entirely ══════════════════════ */
.reel .cell { content-visibility: auto; contain-intrinsic-size: auto 420px; }
.library-grid .lib-card { content-visibility: auto; contain-intrinsic-size: auto 300px; }

/* ══ FOLDERS — per-project bins shared across modules ═════════════════════════ */
.folder-bar { display: flex; align-items: center; gap: 7px; flex-wrap: wrap; padding: 2px 0 10px; }
.folder-chip {
  display: inline-flex; align-items: center; gap: 6px; padding: 5px 11px;
  border: 1px solid var(--hairline); border-radius: 20px; background: var(--fill);
  font-size: 12px; color: var(--muted); cursor: pointer;
  transition: color .15s var(--ease), border-color .15s var(--ease), background-color .15s var(--ease);
}
.folder-chip:hover { color: var(--text); border-color: var(--accent-line); }
.folder-chip.on { color: var(--accent-hi); border-color: var(--accent-line); background: var(--accent-soft); }
.folder-chip svg { color: currentColor; opacity: .8; }
.fc-count { font-family: var(--font-mono); font-size: 10px; color: var(--faint); }
.folder-chip.on .fc-count { color: var(--accent-hi); opacity: .75; }
.fc-x { display: none; margin-left: 2px; font-size: 10px; color: var(--faint); }
.fc-x:hover { color: var(--danger); }
.folder-chip:hover .fc-x { display: inline; }
.folder-chip.new { border-style: dashed; }
.fc-edit {
  width: 120px; padding: 3px 8px; font-size: 12px; color: var(--text);
  background: var(--bg); border: 1px solid var(--accent-line); border-radius: 8px; outline: none;
  font-family: var(--font-ui);
}
.tag.folder { color: var(--accent-2); display: inline-flex; align-items: center; gap: 4px; }

/* Move dialog — project select + folder list */
.move-box { width: min(420px, 92vw); text-align: left; }
.move-row { display: flex; align-items: center; gap: 10px; margin: 12px 0 10px; }
.move-lbl { font-family: var(--font-mono); font-size: 10px; letter-spacing: .1em; text-transform: uppercase; color: var(--faint); width: 56px; }
.move-row .filter-select { flex: 1; }
.move-folders { display: flex; flex-direction: column; gap: 4px; max-height: 260px; overflow-y: auto; padding: 2px; }
.move-folder {
  display: flex; align-items: center; gap: 9px; padding: 8px 11px; text-align: left;
  border: 1px solid var(--hairline); border-radius: 10px; background: var(--fill);
  color: var(--muted); font-size: 13px; cursor: pointer;
  transition: color .15s var(--ease), border-color .15s var(--ease), background-color .15s var(--ease);
}
.move-folder:hover { color: var(--text); border-color: var(--accent-line); }
.move-folder.on { color: var(--accent-hi); border-color: var(--accent-line); background: var(--accent-soft); }
.move-folder svg { flex: none; }
.move-newfolder { display: flex; gap: 6px; margin-top: 4px; }
.move-newfolder .fc-edit { flex: 1; width: auto; padding: 7px 10px; }
.move-empty { color: var(--faint); font-size: 12px; padding: 8px 2px; }

/* Flow bin: folder filter + per-card move affordance */
.trk-folder-filter { width: 100%; margin: 0 0 2px; }
.trk-card { position: relative; }
.trk-card-move {
  position: absolute; top: 6px; right: 6px; z-index: 2; width: 22px; height: 22px;
  display: none; place-items: center; border-radius: 6px; color: var(--muted);
  background: rgba(0, 0, 0, .55); border: 1px solid var(--hairline); cursor: pointer;
}
.trk-card:hover .trk-card-move { display: grid; }
.trk-card-move:hover { color: var(--accent-hi); border-color: var(--accent-line); }

/* Lens controls in the solve options + Resolve sheet */
.trk-lens { display: inline-flex; align-items: center; gap: 6px; }
.trk-fov {
  width: 74px; padding: 7px 9px; font-size: 12.5px; color: var(--text);
  background: var(--bg); border: 1px solid var(--hairline); border-radius: 9px;
  font-family: var(--font-mono); outline: none;
}
.trk-fov:focus { border-color: var(--accent-line); }
/* timeline markers where the solve audit found its worst frames */
.trk-errtick {
  position: absolute; top: -2px; bottom: -2px; width: 2px; z-index: 3;
  background: var(--accent); opacity: .8; pointer-events: auto; cursor: help;
  box-shadow: 0 0 6px rgba(232, 180, 76, .5);
}
/* per-frame solve-quality heat strip — a scanline INSIDE the filmstrip box.
   (It used to hang below the film, but .trk-film clips overflow: in the dock
   layout the lane was invisible and unhittable. Inside the box it always
   shows, and it's a real click target for the guided-repair menu.) */
.trk-errheat {
  position: absolute; left: 0; right: 0; bottom: 0; height: 7px; width: 100%;
  z-index: 3; opacity: .85; pointer-events: auto; cursor: help;
  image-rendering: pixelated; transition: opacity .15s ease, transform .15s ease;
  transform-origin: bottom;
}
.trk-errheat.clickable:hover { opacity: 1; transform: scaleY(1.6); }
.trk-film { margin-bottom: 6px; }

/* ══ ENHANCE — upscale/restore modal (BytePlus; backend pending) ══════════════ */
.enh-panel { width: min(980px, 95vw); }
.enh-info { display: flex; flex-direction: column; gap: 14px; }
.enh-src { font-family: var(--font-mono); font-size: 11px; color: var(--faint); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.enh-field { display: flex; flex-direction: column; gap: 7px; }
.enh-field.enh-inline { flex-direction: row; align-items: center; justify-content: space-between; }
.enh-lbl { font-family: var(--font-mono); font-size: 10px; letter-spacing: .1em; text-transform: uppercase; color: var(--faint); }
.enh-chips { display: flex; gap: 6px; flex-wrap: wrap; }
.enh-chip {
  padding: 6px 12px; border-radius: 9px; font-size: 12.5px; font-family: var(--font-mono);
  border: 1px solid var(--hairline); background: var(--fill); color: var(--muted); cursor: pointer;
  transition: color .15s var(--ease), border-color .15s var(--ease), background-color .15s var(--ease);
}
.enh-chip:hover { color: var(--text); border-color: var(--accent-line); }
.enh-chip.on { color: var(--accent-hi); border-color: var(--accent-line); background: var(--accent-soft); }
.enh-chip.disabled { opacity: .4; cursor: not-allowed; }
.enh-seg { display: flex; width: 100%; }
.enh-seg button { flex: 1; }
.enh-est {
  display: flex; align-items: baseline; gap: 9px; padding: 12px 14px; border-radius: 11px;
  background: var(--surface-1); border: 1px solid var(--hairline);
}
.enh-est b { font-size: 20px; font-family: var(--font-mono); letter-spacing: -0.01em; }
.enh-est-lbl { font-family: var(--font-mono); font-size: 9.5px; letter-spacing: .12em; color: var(--faint); }
.enh-est-usd { font-family: var(--font-mono); font-size: 12px; color: var(--muted); }
.enh-est-rate { margin-left: auto; font-family: var(--font-mono); font-size: 11px; color: var(--faint); }
.enh-warn {
  font-size: 12px; line-height: 1.5; color: var(--accent-hi);
  background: var(--accent-soft); border: 1px solid var(--accent-line); border-radius: 9px; padding: 8px 11px;
}
.enh-note { font-size: 11px; color: var(--faint); line-height: 1.5; flex: 1; }
.stitch-foot { display: flex; align-items: center; gap: 12px; }
/* the reel filter bar's "Enhance a video…" entry sits with the filters */
.reel-filter .enh-open { align-self: end; white-space: nowrap; }

/* Enhance modal v2 — fullscreen suite with compare wipe + zoom/pan */
.stitch-modal.enh-modal { padding: 0; }
.enh-panel { width: 100vw; height: 100vh; max-height: 100vh; border-radius: 0; border: 0; }
.enh-panel .stitch-body { flex: 1; min-height: 0; }
.enh-stagecol { display: flex; flex-direction: column; gap: 8px; min-width: 0; }
.enh-tools { display: flex; align-items: center; gap: 10px; flex: none; }
.enh-modeseg { width: auto; }
.enh-modeseg button { padding: 6px 16px; }
.enh-zoomrow .enh-chip { padding: 5px 10px; font-size: 11.5px; }

.enh-viewport {
  flex: 1; min-height: 0; position: relative; overflow: hidden;
  background: #000; border-radius: 8px; border: 1px solid rgba(255,255,255,.06);
}
.enh-viewport.zoomed { cursor: grab; }
.enh-viewport.zoomed:active { cursor: grabbing; }
.enh-zoomwrap { position: absolute; inset: 0; transform-origin: 50% 50%; will-change: transform; }
.enh-video { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: contain; }
.enh-video-b { z-index: 2; }
.enh-pending {
  position: absolute; inset: 0; z-index: 2; display: flex; flex-direction: column;
  align-items: center; justify-content: center; gap: 6px; text-align: center;
  background: rgba(8, 9, 12, .82); -webkit-backdrop-filter: blur(2px); backdrop-filter: blur(2px);
}
.enh-pending b { font-family: var(--font-mono); font-size: 11px; letter-spacing: .14em; color: var(--accent); }
.enh-pending span { font-size: 12px; color: var(--muted); max-width: 220px; line-height: 1.5; }
.enh-side-lbl {
  position: absolute; top: 10px; z-index: 4; font-family: var(--font-mono); font-size: 9.5px;
  letter-spacing: .12em; color: #fff; background: rgba(0,0,0,.55); padding: 3px 8px; border-radius: 6px;
  pointer-events: none;
}
.enh-side-lbl.a { left: 10px; }
.enh-side-lbl.b { right: 10px; }
.enh-divider {
  position: absolute; top: 0; bottom: 0; z-index: 5; width: 2px; margin-left: -1px;
  background: var(--accent); cursor: ew-resize;
  box-shadow: 0 0 10px rgba(232,180,76,.6);
}
.enh-divider::after {
  content: '◂ ▸'; position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%);
  font-size: 9px; letter-spacing: 1px; color: #17130a; background: var(--accent);
  padding: 3px 6px; border-radius: 10px; white-space: nowrap;
}
/* the side column scrolls if short screens squeeze it */
.enh-panel .stitch-side { width: 340px; }
.enh-panel .enh-info { overflow-y: auto; }

/* Enhance queue rail — left of the viewer, like a render queue */
.enh-queue {
  width: 218px; flex: none; display: flex; flex-direction: column; gap: 8px;
  padding: 14px 12px; border-right: 1px solid var(--hairline); background: var(--surface-1);
  overflow-y: auto;
}
.enh-q-h { font-family: var(--font-mono); font-size: 10px; letter-spacing: .12em; color: var(--faint); }
.enh-q-empty { font-size: 11.5px; color: var(--faint); line-height: 1.5; }
.enh-q-item {
  position: relative; display: flex; flex-direction: column; gap: 3px;
  padding: 9px 10px; border-radius: 10px; border: 1px solid var(--hairline); background: var(--fill);
}
.enh-q-item.live { border-color: var(--accent-line); box-shadow: 0 0 12px rgba(232,180,76,.12); }
.enh-q-name { font-size: 12px; color: var(--text); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; padding-right: 18px; }
.enh-q-meta { font-family: var(--font-mono); font-size: 10px; color: var(--faint); }
.enh-q-status { font-family: var(--font-mono); font-size: 10px; letter-spacing: .04em; }
.enh-q-status.queued { color: var(--muted); }
.enh-q-status.processing { color: var(--run); }
.enh-q-status.done { color: var(--ok); }
.enh-q-status.failed, .enh-q-status.cancelled { color: var(--danger); }
.enh-q-x {
  position: absolute; top: 7px; right: 7px; width: 18px; height: 18px; border-radius: 6px;
  display: grid; place-items: center; font-size: 10px; color: var(--faint);
  background: transparent; border: 0; cursor: pointer;
}
.enh-q-x:hover { color: var(--danger); }
@media (max-width: 1100px) { .enh-queue { display: none; } } /* viewer first on small screens */

/* ══ LOGIN — full-page gate ═══════════════════════════════════════════════════ */
.login-screen {
  position: fixed; inset: 0; z-index: 2000; display: flex; align-items: center; justify-content: center;
  background: radial-gradient(120% 95% at 50% -15%, #1E2128 0%, #101114 60%);
}
.login-card {
  width: min(360px, 90vw); padding: 34px 32px 30px; border-radius: 18px;
  background: var(--surface-1); border: 1px solid var(--hairline);
  box-shadow: var(--shadow-lg); display: flex; flex-direction: column; gap: 6px;
}
.login-brand { display: flex; align-items: center; gap: 10px; font-family: var(--font-display); font-size: 20px; font-weight: 700; letter-spacing: -0.02em; }
.login-brand .dot { width: 9px; height: 9px; border-radius: 50%; background: var(--accent); box-shadow: 0 0 12px var(--accent); }
.login-sub { font-size: 12.5px; color: var(--muted); margin-bottom: 14px; }
.login-form { display: flex; flex-direction: column; gap: 7px; }
.login-lbl { font-family: var(--font-mono); font-size: 10px; letter-spacing: .12em; text-transform: uppercase; color: var(--faint); margin-top: 6px; }
.login-input {
  padding: 10px 12px; border-radius: 10px; font-size: 14px; color: var(--text);
  background: var(--bg); border: 1px solid var(--hairline); outline: none; font-family: var(--font-ui);
}
.login-input:focus { border-color: var(--accent-line); }
.login-err { min-height: 16px; font-size: 12px; color: var(--danger); }
.login-btn { margin-top: 4px; padding: 11px 16px; border-radius: 11px; font-size: 14px; justify-content: center; display: inline-flex; }
.login-btn:disabled { opacity: .6; }
.login-code { font-family: var(--font-mono); font-size: 22px; letter-spacing: .18em; text-align: center; }
.login-trust { display: flex; align-items: center; gap: 8px; font-size: 12px; color: var(--muted); margin-top: 2px; cursor: pointer; }
.login-links { display: flex; justify-content: space-between; margin-top: 8px; font-size: 12px; }
.login-links a { color: var(--muted); text-decoration: none; }
.login-links a:hover { color: var(--text); }

/* People: 2FA status banner + token dialog */
.ppl-banner { margin: 0 0 12px; padding: 9px 12px; border-radius: 10px; font-size: 12.5px; line-height: 1.45; border: 1px solid var(--hairline); background: var(--surface-1); color: var(--muted); }
.ppl-banner.ok { border-color: color-mix(in srgb, var(--accent) 45%, transparent); }
.ppl-banner.warn { border-color: color-mix(in srgb, #F5AF00 55%, transparent); background: color-mix(in srgb, #F5AF00 8%, var(--surface-1)); }
.ppl-banner b { color: var(--text); }
.ppl-banner code { font-family: var(--font-mono); font-size: 11.5px; }
.ppl-banner-warn { color: #F5AF00; }
.tok-box { width: min(560px, 92vw); }
.tok-fresh { margin: 10px 0; padding: 10px 12px; border-radius: 10px; border: 1px solid color-mix(in srgb, var(--accent) 50%, transparent); background: color-mix(in srgb, var(--accent) 8%, var(--surface-1)); }
.tok-fresh-h { font-size: 11px; letter-spacing: .08em; text-transform: uppercase; color: var(--accent); margin-bottom: 6px; }
.tok-fresh-row { display: flex; gap: 8px; align-items: center; }
.tok-value { flex: 1; font-family: var(--font-mono); font-size: 12px; word-break: break-all; user-select: all; }
.tok-list { display: flex; flex-direction: column; gap: 6px; margin: 10px 0 4px; max-height: 260px; overflow: auto; }
.tok-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 8px 10px; border-radius: 9px; background: var(--bg); border: 1px solid var(--hairline); font-size: 12.5px; }
.tok-prefix { font-family: var(--font-mono); color: var(--faint); font-size: 11px; margin-left: 6px; }
.tok-meta { font-size: 11px; color: var(--faint); margin-top: 2px; }
.tok-box .confirm-actions { align-items: center; gap: 8px; }
.tok-box .confirm-actions .char-in { flex: 1; }

/* signed-in chip + sign out in the account bar */
.ab-user { display: inline-flex; align-items: center; gap: 7px; margin-left: 12px; }
.ab-user-name { font-size: 12px; color: var(--muted); white-space: nowrap; }
.ab-signout {
  width: 24px; height: 24px; border-radius: 7px; display: grid; place-items: center;
  color: var(--faint); background: transparent; border: 1px solid transparent; cursor: pointer;
}
.ab-signout:hover { color: var(--danger); border-color: var(--err-soft); }
.ab-users {
  width: 24px; height: 24px; border-radius: 7px; display: grid; place-items: center;
  color: var(--faint); background: transparent; border: 1px solid transparent; cursor: pointer;
}
.ab-users:hover { color: var(--accent); border-color: var(--accent-line); }

/* users manager popover — same shell as the packs manager */
.users-pop {
  position: absolute; top: calc(100% + 8px); right: 28px; width: 322px;
  background: var(--surface-1); border: 1px solid var(--hairline);
  border-radius: var(--radius); padding: 16px;
  box-shadow: 0 18px 54px rgba(0,0,0,.55);
  opacity: 0; transform: translateY(-8px); pointer-events: none;
  transition: opacity .16s var(--ease), transform .16s var(--ease); z-index: 40;
}
.users-pop.open { opacity: 1; transform: none; pointer-events: auto; }
.topmenu .users-pop { position: absolute; right: 0; top: calc(100% + 10px); left: auto; z-index: 80; }
.up-list { display: flex; flex-direction: column; gap: 8px; max-height: 260px; overflow: auto; }
.up-row { display: flex; align-items: center; gap: 10px; }
.up-avatar {
  width: 26px; height: 26px; border-radius: 50%; flex: none;
  display: grid; place-items: center; font-size: 12px; font-weight: 600;
  background: var(--bg); border: 1px solid var(--hairline); color: var(--muted);
}
.up-id { flex: 1; min-width: 0; display: flex; flex-direction: column; line-height: 1.25; }
.up-id b { font-size: 12.5px; font-weight: 600; color: var(--text); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.up-uname { font-family: var(--font-mono); font-size: 10.5px; color: var(--faint); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.up-role {
  font-family: var(--font-mono); font-size: 9.5px; letter-spacing: .1em;
  color: var(--accent); border: 1px solid var(--accent-line);
  border-radius: 5px; padding: 2px 5px; flex: none;
}
.up-del {
  width: 24px; height: 24px; border-radius: 6px; color: var(--faint); flex: none;
  display: grid; place-items: center; font-size: 12px;
}
.up-del:hover { color: var(--danger); background: rgba(229,104,93,.12); }
.up-add { margin-top: 14px; padding-top: 13px; border-top: 1px solid var(--hairline); display: flex; flex-direction: column; gap: 8px; }
.up-add .pp-head { margin-bottom: 3px; }
.up-in {
  width: 100%; background: var(--bg); border: 1px solid var(--hairline);
  border-radius: 8px; padding: 7px 10px; font-size: 12.5px; color: var(--text);
}
.up-in:focus { outline: none; border-color: var(--accent-line); }
.up-pass-row { display: flex; gap: 7px; }
.up-pass-row .up-in { flex: 1; font-family: var(--font-mono); }
.up-genpass {
  width: 32px; border-radius: 8px; border: 1px solid var(--hairline);
  color: var(--muted); font-size: 13px; flex: none;
}
.up-genpass:hover { color: var(--accent); border-color: var(--accent-line); }
.up-err { min-height: 14px; font-size: 11.5px; color: var(--danger); }
.up-create {
  width: 100%; padding: 8px; border-radius: 8px;
  border: 1px dashed var(--hairline); color: var(--muted); font-size: 12.5px;
  transition: color .14s var(--ease), border-color .14s var(--ease);
}
.up-create:hover:not(:disabled) { color: var(--accent); border-color: var(--accent-line); }
.up-create:disabled { opacity: .55; }

/* ══ GRACEFUL LOAD — layout first, outlined skeletons until data lands ════════ */
.skel-item { pointer-events: none; animation: skel-pulse 1.6s var(--ease) infinite; }
@keyframes skel-pulse { 0%, 100% { opacity: .85; } 50% { opacity: .4; } }
.skel-line {
  height: 12px; border-radius: 7px; margin: 7px 0;
  border: 1px solid var(--stroke); background: rgba(255, 255, 255, 0.025);
}
.skel-frame { background: rgba(255, 255, 255, 0.02) !important; border: 1px dashed var(--stroke); }
.skel-cell .cell-body { padding: 18px; }
.skel-chips { display: flex; gap: 6px; margin-top: 12px; }
.skel-chip { height: 20px; border-radius: 12px; border: 1px solid var(--stroke); background: rgba(255,255,255,0.02); display: inline-block; }
.skel-projrow { display: flex; align-items: center; min-height: 34px; padding: 0 12px; }
.skel-projrow .skel-line { margin: 0; }
.skel-card .lib-info { padding: 12px; }
.trk-card.skel-item { display: flex; align-items: center; gap: 9px; }
.trk-card.skel-item .skel-line { flex: 1; }
@media (prefers-reduced-motion: reduce) { .skel-item { animation: none; } }

/* section hand-off: workspace children rise in softly (first paint only) */
#workspace.section-enter > * { animation: ws-in .3s var(--ease) both; }
#workspace.section-enter > *:nth-child(2) { animation-delay: .05s; }
@keyframes ws-in { from { opacity: 0; transform: translateY(7px); } to { opacity: 1; transform: none; } }
@media (prefers-reduced-motion: reduce) { #workspace.section-enter > * { animation: none; } }

/* ══ CUSTOM SELECT — themed dropdown replacing native <select> (see select.js) ══
   The trigger carries the original select's classes for layout; these rules load
   last so the custom look wins. The native <select> stays as a hidden a11y/value
   source. Applies site-wide — every select is upgraded automatically. */
.cs { display: contents; }
.cs__native {  /* visually hidden, non-interactive; still holds value + fires events */
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); border: 0; pointer-events: none;
}
.cs__trigger {
  display: inline-flex; align-items: center; justify-content: space-between; gap: 8px;
  font: inherit; text-align: left; line-height: 1.3; cursor: pointer;
  padding: 8px 11px; border-radius: var(--radius-sm);
  color: var(--text); background: var(--surface-1); border: 1px solid var(--hairline);
  -webkit-backdrop-filter: var(--blur); backdrop-filter: var(--blur);
  transition: border-color .15s var(--ease), background-color .15s var(--ease);
}
.cs__trigger:hover { border-color: var(--accent-line); }
.cs__trigger:focus-visible { outline: none; border-color: var(--accent-line); box-shadow: 0 0 0 3px var(--accent-soft); }
.cs__trigger:active:not(:disabled) { transform: none; }  /* no button press-scale */
.cs__trigger:disabled { opacity: .5; cursor: not-allowed; }
.cs__trigger.cs--open { border-color: var(--accent-line); background: var(--surface-2); }
.cs__label { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.cs__label--empty { color: var(--faint); }
.cs__caret { flex: none; color: var(--muted); transition: transform .18s var(--ease); }
.cs--open .cs__caret { transform: rotate(180deg); }

.cs__panel {
  position: fixed; z-index: 100000; box-sizing: border-box;
  max-height: min(320px, 60vh); overflow-y: auto; padding: 5px;
  border-radius: var(--radius-sm); border: 1px solid var(--stroke);
  background: color-mix(in srgb, var(--bg) 78%, transparent);
  -webkit-backdrop-filter: var(--blur); backdrop-filter: var(--blur);
  box-shadow: var(--shadow-lg);
  animation: cs-pop .13s var(--ease) both;
}
@keyframes cs-pop { from { opacity: 0; transform: translateY(-4px); } to { opacity: 1; transform: none; } }
@media (prefers-reduced-motion: reduce) { .cs__panel { animation: none; } .cs__caret { transition: none; } }
.cs__opt {
  display: flex; align-items: center; gap: 8px; padding: 8px 10px; border-radius: 8px;
  font-size: 13px; color: var(--muted); cursor: pointer; white-space: nowrap;
}
.cs__opt.is-active { color: var(--text); background: var(--surface-2); }
.cs__opt.is-sel { color: var(--accent-hi); }
.cs__opt.is-sel::after { content: '✓'; margin-left: auto; padding-left: 12px; font-size: 12px; color: var(--accent-hi); }
.cs__opt.is-dis { opacity: .38; cursor: not-allowed; }
/* scrollbar in the panel matches the frost */
.cs__panel::-webkit-scrollbar { width: 9px; }
.cs__panel::-webkit-scrollbar-thumb { background: var(--stroke); border-radius: 9px; border: 3px solid transparent; background-clip: content-box; }
/* ══ PROMPT ENHANCER — tabbed cinematic-language popup with visual presets ════ */
.pe-panel { width: min(860px, 94vw); max-height: 90vh; display: flex; flex-direction: column; padding: 0; overflow: hidden; }
.pe-head { padding: 18px 22px 12px; border-bottom: 1px solid var(--hairline); }
.pe-title { display: flex; align-items: center; gap: 9px; font-size: 16px; font-weight: 600; color: var(--text); }
.pe-title svg { color: var(--accent); width: 17px; height: 17px; }
.pe-hint { margin-top: 5px; font-size: 12px; color: var(--muted); line-height: 1.45; }
.pe-body { padding: 4px 22px 16px; overflow-y: auto; flex: 1; }
.pe-sec-label { margin: 15px 0 7px; font-size: 10.5px; font-weight: 600; letter-spacing: .08em; text-transform: uppercase; color: var(--faint); }
.pe-brief { width: 100%; min-height: 66px; resize: vertical; padding: 10px 12px; border-radius: 10px; border: 1px solid var(--stroke); background: var(--surface-1); color: var(--text); font: inherit; font-size: 13px; line-height: 1.5; }
.pe-brief:focus { outline: none; border-color: var(--accent-line); }

/* live selection summary */
.pe-summary { display: flex; flex-wrap: wrap; gap: 6px; min-height: 26px; }
.pe-sum-chip { display: inline-flex; align-items: center; gap: 6px; padding: 5px 10px; border-radius: 999px; border: 1px solid var(--accent-line); background: rgba(230, 180, 80, .12); color: var(--text); font-size: 12px; line-height: 1.2; cursor: pointer; }
.pe-sum-chip b { color: var(--accent); font-weight: 600; font-size: 10px; letter-spacing: .06em; text-transform: uppercase; }
.pe-sum-chip i { font-style: normal; color: var(--muted); font-size: 10px; }
.pe-sum-chip:hover i { color: var(--text); }

/* tabs */
.pe-tabs { display: flex; gap: 2px; margin-top: 14px; border-bottom: 1px solid var(--hairline); }
.pe-tab { padding: 8px 14px 9px; background: transparent; border: 0; border-bottom: 2px solid transparent; color: var(--muted); font-size: 12.5px; font-weight: 500; cursor: pointer; }
.pe-tab:hover { color: var(--text); }
.pe-tab.on { color: var(--accent); border-bottom-color: var(--accent); }
.pe-panes { padding-top: 12px; }

/* visual preset cards (style / camera / stock — generated thumbnails) */
.pe-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(148px, 1fr)); gap: 9px; }
.pe-card { position: relative; aspect-ratio: 16/9; border-radius: 10px; border: 2px solid transparent; outline: 1px solid var(--hairline); background-size: cover; background-position: center; cursor: pointer; overflow: hidden; padding: 0; transition: transform .12s, border-color .12s; }
.pe-card::after { content: ''; position: absolute; inset: 0; background: linear-gradient(to top, rgba(0,0,0,.72) 0%, rgba(0,0,0,.05) 45%); }
.pe-card:hover { transform: translateY(-1px); outline-color: var(--accent-line); }
.pe-card.on { border-color: var(--accent); outline-color: transparent; box-shadow: 0 0 0 1px var(--accent), 0 4px 14px rgba(230, 180, 80, .18); }
.pe-card.on::before { content: '✓'; position: absolute; top: 6px; right: 7px; z-index: 2; width: 18px; height: 18px; border-radius: 50%; background: var(--accent); color: #16130a; font-size: 11px; font-weight: 700; display: grid; place-items: center; }
.pe-card-lbl { position: absolute; left: 9px; right: 9px; bottom: 7px; z-index: 1; color: #fff; font-size: 11.5px; font-weight: 600; text-align: left; text-shadow: 0 1px 4px rgba(0,0,0,.8); }

/* text chips (framing / lighting / mood) */
.pe-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.pe-chips.pane { padding: 2px 0 6px; }
.pe-chip { padding: 6px 12px; border-radius: 999px; border: 1px solid var(--stroke); background: var(--fill); color: var(--muted); font-size: 12px; line-height: 1.2; cursor: pointer; transition: color .12s, border-color .12s, background .12s; }
.pe-chip:hover { color: var(--text); border-color: var(--accent-line); }
.pe-chip.on { color: var(--accent); border-color: var(--accent-line); background: rgba(230, 180, 80, .12); }
.pe-none { font-size: 12px; color: var(--faint); line-height: 1.5; }

/* reference thumbnails with their Seedance tags */
.pe-refs { display: flex; flex-wrap: wrap; gap: 9px; }
.pe-ref { position: relative; width: 118px; aspect-ratio: 16/9; border-radius: 9px; overflow: hidden; border: 1px solid var(--hairline); background: #000; }
.pe-ref img, .pe-ref video { width: 100%; height: 100%; object-fit: cover; display: block; }
.pe-ref-audio { display: grid; place-items: center; width: 100%; height: 100%; font-size: 22px; background: var(--surface-1); }
.pe-ref-tag { position: absolute; left: 5px; bottom: 5px; padding: 2px 7px; border-radius: 5px; background: rgba(10, 12, 14, .88); border: 1px solid var(--accent-line); color: var(--accent); font-family: var(--font-mono); font-size: 9.5px; line-height: 1.3; }
.pe-ref.swappable { cursor: pointer; transition: border-color .15s ease, box-shadow .15s ease; }
.pe-ref.swappable:hover { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent); }
.pe-ref.swappable:hover::after { content: '⇄ swap'; position: absolute; right: 5px; top: 5px; padding: 2px 7px; border-radius: 5px; background: rgba(10, 12, 14, .88); border: 1px solid var(--accent-line); color: var(--accent); font-family: var(--font-mono); font-size: 9.5px; line-height: 1.3; }

.pe-foot { display: flex; justify-content: flex-end; gap: 9px; padding: 13px 22px; border-top: 1px solid var(--hairline); }
.pe-btn { padding: 8px 16px; border-radius: 9px; border: 1px solid var(--stroke); background: var(--fill); color: var(--text); font-size: 13px; cursor: pointer; display: inline-flex; align-items: center; gap: 7px; }
.pe-btn:hover { border-color: var(--accent-line); }
.pe-btn.primary { background: var(--accent); border-color: var(--accent); color: #16130a; font-weight: 600; }
.pe-btn.primary:hover { filter: brightness(1.06); }
.pe-btn.primary.busy { opacity: .75; cursor: progress; }
.pe-btn:disabled { opacity: .6; cursor: default; }

/* PE expansion: scroll inside beyond 3 card rows; preset cards + drop zone */
.pe-cards { max-height: 296px; overflow-y: auto; padding: 2px; }
.pe-cards::-webkit-scrollbar { width: 8px; }
.pe-cards::-webkit-scrollbar-thumb { background: var(--stroke); border-radius: 8px; }
.pe-chips.pane { max-height: 200px; overflow-y: auto; }
.pe-tab.presets { color: var(--accent); opacity: .85; }
.pe-tab.presets.on { opacity: 1; }

.pe-card.preset .pe-card-del { position: absolute; top: 5px; left: 6px; z-index: 3; width: 17px; height: 17px; border-radius: 50%; display: grid; place-items: center; background: rgba(10,12,14,.85); color: var(--muted); font-size: 10px; opacity: 0; transition: opacity .12s; }
.pe-card.preset:hover .pe-card-del { opacity: 1; }
.pe-card.preset .pe-card-del:hover { color: #ff7a7a; }

.pe-card.combo { background: linear-gradient(145deg, var(--surface-1), var(--fill)); display: flex; flex-direction: column; justify-content: flex-end; gap: 3px; padding: 9px 10px; text-align: left; }
.pe-card.combo::after { display: none; }
.pe-combo-name { position: relative; z-index: 1; color: var(--text); font-size: 12px; font-weight: 600; }
.pe-combo-parts { position: relative; z-index: 1; color: var(--muted); font-size: 10px; line-height: 1.35; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }

.pe-drop { aspect-ratio: 16/9; border-radius: 10px; border: 1.5px dashed var(--stroke); display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 5px; padding: 10px; text-align: center; cursor: pointer; color: var(--muted); transition: border-color .12s, background .12s; }
.pe-drop b { color: var(--text); font-size: 12.5px; font-weight: 600; }
.pe-drop span { font-size: 10px; line-height: 1.4; color: var(--faint); }
.pe-drop:hover, .pe-drop.over { border-color: var(--accent-line); background: rgba(230, 180, 80, .06); }
.pe-drop.busy { opacity: .7; cursor: progress; }

.pe-sum-chip.save { border-style: dashed; background: transparent; color: var(--muted); }
.pe-sum-chip.save:hover { color: var(--accent); border-color: var(--accent-line); }
.pe-none.pad { padding: 8px 2px; grid-column: 1 / -1; }

/* PE presets menu — recall saved selection combos in any generation */
.pe-head-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.pe-menu-wrap { position: relative; }
.pe-btn.small { padding: 6px 12px; font-size: 12px; }
.pe-menu { position: absolute; right: 0; top: calc(100% + 6px); z-index: 30; min-width: 280px; max-width: 360px; max-height: 320px; overflow-y: auto; background: var(--surface-1); border: 1px solid var(--stroke); border-radius: 11px; box-shadow: 0 12px 34px rgba(0,0,0,.5); display: none; padding: 5px; }
.pe-menu.open { display: block; }
.pe-menu-empty { padding: 12px 12px; font-size: 12px; color: var(--faint); line-height: 1.5; }
.pe-menu-item { display: flex; align-items: stretch; gap: 2px; }
.pe-menu-apply { flex: 1; display: flex; flex-direction: column; gap: 2px; padding: 8px 10px; border: 0; border-radius: 8px; background: transparent; text-align: left; cursor: pointer; }
.pe-menu-apply:hover { background: var(--fill); }
.pe-menu-apply b { color: var(--text); font-size: 12.5px; font-weight: 600; }
.pe-menu-apply span { color: var(--muted); font-size: 10.5px; line-height: 1.4; }
.pe-menu-del { border: 0; background: transparent; color: var(--faint); font-size: 11px; padding: 0 9px; cursor: pointer; border-radius: 8px; }
.pe-menu-del:hover { color: #ff7a7a; background: var(--fill); }

/* ══ FORGE — Seedream image generation ══════════════════════════════════════ */

/* Feed / grid canvas */
.fg-canvas { padding-bottom: 240px; }
.fg-feed { display: flex; flex-direction: column; gap: 14px; }
.fg-empty { padding: 60px 0; text-align: center; color: var(--faint); font-size: 14px; }
.fg-skel { height: 180px; border-radius: 14px; background: var(--surface-1); border: 1px solid var(--hairline); animation: fgpulse 1.4s ease-in-out infinite; }
@keyframes fgpulse { 0%,100% { opacity: .55; } 50% { opacity: .9; } }

/* Grid view — three tile sizes */
.fg-feed.fg-grid { display: grid; gap: 12px; align-items: start; }
.fg-grid.size-s { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); }
.fg-grid.size-m { grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); }
.fg-grid.size-l { grid-template-columns: repeat(auto-fill, minmax(340px, 1fr)); }
.fg-tile {
  position: relative; overflow: hidden; border-radius: 13px; background: #0a0b0e;
  border: 1px solid var(--hairline); cursor: pointer; min-height: 90px;
  transition: border-color .16s var(--ease), transform .16s var(--ease);
}
.fg-tile:hover { border-color: var(--accent-line); }
.fg-tile img { width: 100%; height: 100%; object-fit: cover; display: block; }
.fg-score {
  /* bottom-left: top-left belongs to the multi-select checkbox, top-right to the hover actions */
  position: absolute; left: 8px; bottom: 8px; z-index: 3;
  padding: 2px 8px; border-radius: 6px; font-family: var(--font-mono); font-size: 10.5px;
  background: rgba(10,12,14,.85); border: 1px solid var(--accent-line); color: var(--accent);
}

/* Hover actions — clean surface, controls appear only on hover */
.fg-actions {
  position: absolute; right: 8px; top: 8px; z-index: 4;
  display: flex; gap: 5px; opacity: 0; transform: translateY(-4px);
  transition: opacity .16s var(--ease), transform .16s var(--ease);
}
.fg-tile:hover .fg-actions, .fg-card-stage:hover .fg-actions { opacity: 1; transform: none; }
.fg-act {
  width: 30px; height: 30px; display: grid; place-items: center;
  border-radius: 8px; background: rgba(12,13,17,.88); border: 1px solid var(--hairline);
  color: var(--muted); cursor: pointer;
}
.fg-act:hover { color: var(--accent); border-color: var(--accent-line); }

/* Status overlays (queued / running / failed) */
.fg-status {
  position: absolute; inset: 0; display: flex; flex-direction: column; gap: 10px;
  align-items: center; justify-content: center; font-size: 12.5px; color: var(--muted);
  background: var(--surface-1); text-align: center; padding: 12px;
}
.fg-status.fail { color: #ff8a8a; }
.fg-spin {
  width: 18px; height: 18px; border-radius: 50%;
  border: 2px solid var(--hairline); border-top-color: var(--accent);
  animation: fgspin 1s linear infinite;
}
@keyframes fgspin { to { transform: rotate(360deg); } }
.fg-cancel { padding: 4px 12px; border-radius: 8px; border: 1px solid var(--stroke); background: var(--fill); color: var(--text); font-size: 11.5px; cursor: pointer; }

/* Feed (photo browser) view */
/* Left-aligned like Frame's feed (and the day headers above the cards) —
   the whole app rags left; a centered column was the odd one out. */
.fg-list .fg-card { max-width: 860px; width: 100%; margin: 0; }
.fg-card { border-radius: 15px; overflow: hidden; border: 1px solid var(--hairline); background: var(--surface-1); }
.fg-card-stage { position: relative; background: #0a0b0e; cursor: pointer; min-height: 120px; }
.fg-card-stage img { width: 100%; max-height: 560px; object-fit: contain; display: block; }
.fg-card-meta { display: flex; align-items: center; gap: 7px; padding: 9px 13px; flex-wrap: wrap; }
.fg-chip {
  padding: 2.5px 9px; border-radius: 6px; font-family: var(--font-mono); font-size: 10.5px;
  background: var(--fill); border: 1px solid var(--hairline); color: var(--text); white-space: nowrap;
}
.fg-chip.dim { color: var(--muted); }
.fg-chip.score { color: var(--accent); border-color: var(--accent-line); }
.fg-prompt-snip { flex: 1; min-width: 160px; color: var(--faint); font-size: 12px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* View switcher */
.fg-viewsw { display: flex; gap: 4px; margin-left: auto; }
.fg-vbtn {
  width: 32px; height: 30px; display: grid; place-items: center; font-size: 14px;
  border-radius: 8px; border: 1px solid var(--hairline); background: var(--fill); color: var(--muted); cursor: pointer;
  transition: color .15s var(--ease), border-color .15s var(--ease), background-color .15s var(--ease);
}
.fg-vbtn:hover:not(.on) { color: var(--text); border-color: var(--stroke); }
.fg-vbtn.on { color: var(--accent); border-color: var(--accent-line); }

/* ── Composer dock ── */
.fg-dock {
  position: fixed; left: var(--sb-w, 264px); right: 0; bottom: 26px; z-index: 30;
  padding: 0 32px; pointer-events: none;
  display: flex; flex-direction: column; gap: 8px;
  transition: left .22s var(--ease);
}
.fg-dock-row, .fg-dock-opts {
  pointer-events: auto;
  /* fully opaque — feed tiles must not bleed through the composer */
  background: #1B1C23; border: 1px solid var(--hairline);
  border-radius: 16px; padding: 10px 12px;
  box-shadow: 0 14px 44px rgba(0,0,0,.5), 0 1px 0 rgba(255,255,255,.02) inset;
}
.fg-dock.drop-target .fg-dock-row { border-color: var(--accent-line); box-shadow: 0 0 0 2px var(--accent-soft), 0 14px 44px rgba(0,0,0,.5); }
.fg-dock-row { display: flex; align-items: flex-end; gap: 9px; position: relative; }
.fg-prompt { flex: 1; }
/* Full-width line under the prompt: icons left, .dock-cost pushes cost +
   Generate to the right edge — Frame's exact arrangement. */
.fg-dock-btns { display: flex; gap: 7px; align-items: center; flex: 1 1 100%; }
.fg-generate.busy { opacity: .6; pointer-events: none; }
.fg-dock-opts { display: flex; align-items: center; gap: 8px; padding: 8px 12px; flex-wrap: wrap; }
.fg-opt { min-width: 0; }
.fg-dims { margin-left: auto; font-family: var(--font-mono); font-size: 11px; color: var(--faint); white-space: nowrap; }

/* Reference strip with clickable @tags */
/* Shared attached-asset strip, ENCLOSED inside the composer box (Frame's
   .dock-row and Forge's .fg-dock-row both wrap; the strip is the first
   full-width line, separated from the prompt by a hairline). */
.dock-refbar {
  width: 100%; display: flex; gap: 9px; align-items: center;
  overflow-x: auto; padding: 2px 2px 10px; margin-bottom: 9px;
  border-bottom: 1px solid var(--hairline);
  order: -2; /* above Frame's prompt (.prompt-wrap is order:-1) — Forge parity */
}
.fg-dock-row { flex-wrap: wrap; }
.fg-ref { position: relative; flex-shrink: 0; width: 92px; aspect-ratio: 16/10; border-radius: 9px; overflow: hidden; border: 1px solid var(--hairline); cursor: pointer; background: #000; }
.fg-ref:hover { border-color: var(--accent-line); }
.fg-ref img { width: 100%; height: 100%; object-fit: cover; display: block; }
.fg-ref video { width: 100%; height: 100%; object-fit: cover; display: block; }
.fg-ref .audio-tile { width: 100%; height: 100%; }
/* Character chips in the strip: avatar + name, no @tag (roster-bound) */
.fg-ref.dref-char {
  width: auto; aspect-ratio: auto; display: flex; align-items: center; gap: 7px;
  padding: 5px 26px 5px 6px; background: var(--fill); cursor: default;
}
.fg-ref.dref-char .char-ava { width: 26px; height: 26px; flex: none; }
.dref-char-name { font-size: 11px; color: var(--text); white-space: nowrap; }
.fg-ref-tag {
  position: absolute; left: 4px; bottom: 4px; padding: 1.5px 7px; border-radius: 5px;
  background: rgba(10,12,14,.9); border: 1px solid var(--accent-line); color: var(--accent);
  font-family: var(--font-mono); font-size: 9.5px; cursor: pointer;
}
.fg-ref-count { flex-shrink: 0; font-family: var(--font-mono); font-size: 10.5px; color: var(--faint); padding: 0 4px; }
.cell-menu-item.disabled { opacity: .38; cursor: not-allowed; }

/* @mention dropdown */
/* Collapsed-rail flyout: a project's folders + actions beside its icon tile */
.sb-flyout {
  position: fixed; z-index: 90; min-width: 224px; max-width: 300px;
  background: rgba(20, 21, 29, 0.97); border: 1px solid var(--stroke); border-radius: 12px;
  -webkit-backdrop-filter: saturate(160%) blur(24px); backdrop-filter: saturate(160%) blur(24px);
  padding: 8px; box-shadow: var(--shadow-lg), inset 0 1px 0 var(--glass-hi);
  animation: pop-in .14s var(--ease) both;
}
.sb-flyout-h {
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
  padding: 4px 8px 8px; border-bottom: 1px solid var(--hairline); margin-bottom: 6px;
  font-weight: 600; font-size: 13px;
}
.sb-flyout-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sb-flyout .proj-folders { display: block; } /* visible even though the rail hides them */
.sb-flyout-act {
  display: flex; align-items: center; gap: 8px; width: 100%;
  margin-top: 6px; padding: 7px 8px; border-radius: 8px;
  font-size: 12.5px; color: var(--muted); border-top: 1px solid var(--hairline);
}
.sb-flyout-act:hover { background: var(--fill); color: var(--text); }

/* Frame's quick-settings strip (reuses Forge's .fg-dock-opts box chrome) */
.composer-dock .dock-opts { margin-top: 8px; }
.dock-opts .dock-sound { flex-shrink: 0; }
.dock-opts .dock-opts-more { margin-left: auto; }

/* Anchored inside .fg-prompt-wrap — rises above the prompt's live top edge
   (the old dock-anchored 88px offset drifted whenever the prompt grew). */
.fg-mention {
  position: absolute; left: 0; bottom: calc(100% + 10px);
  width: 320px; max-height: 240px; overflow-y: auto; display: none; z-index: 50;
  background: rgba(20,21,29,.96); border: 1px solid var(--stroke); border-radius: 12px; padding: 6px;
  box-shadow: var(--shadow-lg);
}
.fg-mention.open { display: block; }
.fg-mention-item {
  display: flex; align-items: center; gap: 9px; width: 100%; padding: 6px 8px;
  border: 0; background: transparent; border-radius: 8px; cursor: pointer; text-align: left;
}
.fg-mention-item.sel, .fg-mention-item:hover { background: var(--fill); }
.fg-mention-item img { width: 40px; height: 26px; object-fit: cover; border-radius: 5px; }
.fg-mention-item span { color: var(--accent); font-family: var(--font-mono); font-size: 12px; }
.fg-mention-item i { color: var(--faint); font-size: 11px; font-style: normal; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ── Image modal (FLOW-style viewer + side panel) ── */
.fg-modal { display: flex; align-items: center; justify-content: center; }
.fg-modal-panel {
  display: flex; width: min(1480px, 96vw); height: min(880px, 92vh);
  background: var(--surface-1); border: 1px solid var(--stroke); border-radius: var(--radius); overflow: hidden;
  box-shadow: var(--shadow-lg);
}
.fg-modal-stage { position: relative; flex: 1; min-width: 0; display: grid; place-items: center; background: #08090b; overflow: hidden; }
.fg-modal-stage img { max-width: 100%; max-height: 100%; transition: transform .06s linear; user-select: none; -webkit-user-drag: none; }
.fg-nav {
  position: absolute; top: 50%; transform: translateY(-50%); z-index: 5;
  width: 40px; height: 64px; border-radius: 11px; border: 1px solid var(--hairline);
  background: rgba(12,13,17,.8); color: var(--text); font-size: 24px; cursor: pointer; opacity: 0;
  transition: opacity .16s var(--ease);
}
.fg-modal-stage:hover .fg-nav { opacity: 1; }
.fg-nav.prev { left: 14px; } .fg-nav.next { right: 14px; }
.fg-modal-side { width: 336px; flex-shrink: 0; overflow-y: auto; padding: 18px; display: flex; flex-direction: column; gap: 13px; border-left: 1px solid var(--hairline); }
.fg-side-title { font-size: 15px; font-weight: 600; color: var(--text); }
.fg-side-chips, .fg-rv-scores { display: flex; flex-wrap: wrap; gap: 5px; }
.fg-side-lbl { font-family: var(--font-mono); font-size: 10.5px; letter-spacing: .06em; text-transform: uppercase; color: var(--faint); }
.fg-side-prompt { display: flex; flex-direction: column; gap: 7px; align-items: flex-start; }
.fg-side-text { font-size: 12.5px; line-height: 1.55; color: var(--muted); white-space: pre-wrap; }
.fg-side-refs { display: flex; flex-wrap: wrap; gap: 7px; }
.fg-side-ref { position: relative; width: 84px; aspect-ratio: 16/10; border-radius: 8px; overflow: hidden; border: 1px solid var(--hairline); }
.fg-side-ref img { width: 100%; height: 100%; object-fit: cover; }
.fg-side-review { display: flex; flex-direction: column; gap: 8px; }
.fg-rv-issues { display: flex; flex-wrap: wrap; gap: 5px; }
.fg-side-actions { margin-top: auto; display: flex; flex-wrap: wrap; gap: 6px; padding-top: 10px; border-top: 1px solid var(--hairline); }

/* ── Annotator ── */
.fg-anno { display: flex; align-items: center; justify-content: center; }
/* ── Layer editor (Seedream 5.0 Pro layer decomposition) ─────────────────── */
/* Fullscreen, Photoshop-shaped: fixed LEFT rail (scrolling layer list, actions
   pinned at the rail's bottom) + the stage filling the rest. */
.fg-layer-ed { padding: 0; }
.fg-led-panel {
  display: flex; flex-direction: column; width: 100vw; height: 100vh;
  background: var(--surface-1); border: none; border-radius: 0; overflow: hidden;
}
.fg-led-head {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 10px 18px; border-bottom: 1px solid var(--hairline); flex: none;
}
.fg-led-body { display: flex; flex: 1; min-height: 0; gap: 0; }
.fg-led-stage {
  flex: 1; min-width: 0; display: grid; place-items: center; padding: 18px; overflow: hidden;
  /* checkerboard so alpha reads as alpha */
  background:
    linear-gradient(45deg, rgba(255,255,255,.05) 25%, transparent 25%, transparent 75%, rgba(255,255,255,.05) 75%) 0 0 / 22px 22px,
    linear-gradient(45deg, rgba(255,255,255,.05) 25%, transparent 25%, transparent 75%, rgba(255,255,255,.05) 75%) 11px 11px / 22px 22px,
    #0a0b0e;
}
.fg-led-stage canvas { max-width: 100%; max-height: 100%; touch-action: none; cursor: crosshair; }
.fg-led-side {
  width: 300px; flex: none; display: flex; flex-direction: column; gap: 10px;
  border-right: 1px solid var(--hairline); padding: 14px 12px 12px; background: var(--surface-2);
  overflow: hidden; /* the LIST scrolls, not the rail — actions stay pinned */
}
.fg-led-list { flex: 1; min-height: 0; overflow-y: auto; display: flex; flex-direction: column; gap: 4px; padding-right: 2px; }
.fg-led-foot { flex: none; display: flex; flex-direction: column; gap: 8px; border-top: 1px solid var(--hairline); padding-top: 12px; }
.fg-led-row {
  display: flex; align-items: center; gap: 8px; padding: 6px 8px; border-radius: 10px;
  border: 1px solid transparent; cursor: pointer; user-select: none;
}
.fg-led-row:hover { background: var(--surface-3); }
.fg-led-row.sel { border-color: var(--accent-line); background: var(--accent-soft); }
.fg-led-row.hidden .fg-led-thumb, .fg-led-row.hidden .fg-led-name { opacity: .35; }
.fg-led-row.base { border-top: 1px dashed var(--hairline); border-radius: 0 0 10px 10px; margin-top: 4px; cursor: default; }
.fg-led-thumb {
  width: 40px; height: 40px; flex: none; object-fit: contain; border-radius: 6px;
  background:
    linear-gradient(45deg, rgba(255,255,255,.08) 25%, transparent 25%, transparent 75%, rgba(255,255,255,.08) 75%) 0 0 / 10px 10px,
    linear-gradient(45deg, rgba(255,255,255,.08) 25%, transparent 25%, transparent 75%, rgba(255,255,255,.08) 75%) 5px 5px / 10px 10px,
    #101216;
}
.fg-led-name { flex: 1; min-width: 0; font-size: 12.5px; color: var(--text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.fg-led-eye, .fg-led-dl {
  flex: none; width: 26px; height: 26px; display: grid; place-items: center; border-radius: 7px;
  background: none; border: none; color: var(--muted); font-size: 13px; cursor: pointer; text-decoration: none;
}
.fg-led-eye:hover, .fg-led-dl:hover { background: var(--surface-3); color: var(--text); }
.fg-led-basecb { width: 13px; flex: none; }
.fg-led-actions { display: flex; flex-direction: column; gap: 6px; }
.fg-led-actions .act { justify-content: flex-start; }
.fg-led-hint { font-size: 11px; color: var(--faint); line-height: 1.5; }
.fg-layers-badge {
  position: absolute; left: 8px; top: 8px; z-index: 2;
  font-family: var(--font-mono); font-size: 11px; padding: 3px 8px; border-radius: 12px;
  background: rgba(11, 12, 15, .78); border: 1px solid var(--stroke); color: var(--accent);
  pointer-events: none;
}
.fg-chip.layers { color: var(--accent); border-color: var(--accent-line); }
.fg-layer-toggle.on { color: var(--accent); border-color: var(--accent-line); background: var(--accent-soft); }
.fg-side-actions .act.primary { color: var(--accent); border-color: var(--accent-line); }

/* Frame picker (video → single-frame reference) + object picker share the
   annotator chrome; these are their specifics. */
.fg-frame-stage { display: grid; place-items: center; background: #08090b; min-height: 0; }
.fg-frame-stage video { max-width: min(1200px, 88vw); max-height: 62vh; }
.fg-frame-bar { display: flex; align-items: center; gap: 10px; }
.fg-frame-bar input[type="range"] { flex: 1; min-width: 200px; }
.fg-frame-time { font-family: var(--font-mono); font-size: 12px; color: var(--muted); min-width: 52px; text-align: right; }
.fg-pick-stage { display: grid; place-items: center; background: #08090b; min-height: 0; }
.fg-pick-stage canvas { max-width: 100%; max-height: 68vh; cursor: crosshair; touch-action: none; }
.fg-pick-bar { display: flex; align-items: center; gap: 8px; }
.fg-pick-count { font-family: var(--font-mono); font-size: 12px; color: var(--muted); margin-right: auto; }
.fg-anno-bar .act.primary, .fg-led-actions .act.primary, .fg-led-foot .act.primary { color: var(--accent); border-color: var(--accent-line); }
/* Placement editor: in-rail library chooser (characters / props / attached refs) */
.fg-place-lib {
  display: flex; flex-direction: column; gap: 8px; padding: 10px;
  border: 1px solid var(--stroke); border-radius: 12px; background: var(--surface-1);
}
.fg-place-lib-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; max-height: 300px; overflow-y: auto; }
.fg-place-lib-tile {
  position: relative; display: block; padding: 0; border: 1px solid var(--hairline); border-radius: 8px;
  overflow: hidden; background: var(--surface-3); cursor: pointer; aspect-ratio: 1;
}
.fg-place-lib-tile:hover { border-color: var(--accent-line); }
.fg-place-lib-tile img { width: 100%; height: 100%; object-fit: cover; display: block; }
.fg-place-lib-name {
  position: absolute; left: 0; right: 0; bottom: 0; padding: 2px 4px;
  font-size: 10px; color: var(--text); background: rgba(10,11,14,.72);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}

.fg-anno-panel {
  display: flex; flex-direction: column; width: min(1180px, 94vw); max-height: 92vh;
  background: var(--surface-1); border: 1px solid var(--stroke); border-radius: 18px; overflow: hidden;
  box-shadow: var(--shadow-lg);
}
.fg-anno-head { padding: 14px 20px 6px; }
.fg-anno-title { font-size: 14px; font-weight: 600; color: var(--text); }
.fg-anno-bar { display: flex; align-items: center; gap: 7px; padding: 9px 20px; flex-wrap: wrap; border-bottom: 1px solid var(--hairline); }
.fg-anno-tool {
  padding: 6px 12px; border-radius: 9px; border: 1px solid var(--hairline);
  background: var(--fill); color: var(--muted); font-size: 12px; cursor: pointer;
}
.fg-anno-tool.on { color: var(--accent); border-color: var(--accent-line); }
.fg-anno-colors { display: flex; gap: 5px; margin-left: 6px; }
.fg-anno-color { width: 22px; height: 22px; border-radius: 50%; border: 2px solid transparent; cursor: pointer; }
.fg-anno-color.on { border-color: #fff; box-shadow: 0 0 0 2px rgba(255,255,255,.25); }
.fg-anno-width { width: 90px; accent-color: var(--accent); }
.fg-anno-stage { flex: 1; min-height: 0; display: grid; place-items: center; background: #08090b; padding: 14px; overflow: auto; }
.fg-anno-canvas { max-width: 100%; max-height: calc(92vh - 220px); border-radius: 8px; cursor: crosshair; touch-action: none; }

/* ── Forge attach popover — Frame's Source panel is the blueprint ── */
.fg-refs-pop { left: auto; right: 0; width: 384px; max-width: calc(100vw - 64px); }
.fg-refs-pop .slot-tag {
  position: absolute; left: 5px; bottom: 5px; padding: 1.5px 7px; border-radius: 5px;
  background: rgba(10,12,14,.9); border: 1px solid var(--accent-line); color: var(--accent);
  font-family: var(--font-mono); font-size: 9px; max-width: calc(100% - 10px);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.fg-pop-search {
  width: 100%; margin-bottom: 8px; padding: 7px 11px;
  background: var(--bg); border: 1px solid var(--hairline); border-radius: 9px;
  color: var(--text); font-size: 12px; outline: none;
}
.fg-pop-search:focus { border-color: var(--accent-line); }
.fg-pop-lib {
  display: grid; grid-template-columns: repeat(3, 1fr);
  /* fixed row height — aspect-ratio cards make grid rows undersize and overlap */
  grid-auto-rows: 76px;
  gap: 8px; max-height: 252px; overflow-y: auto; padding-right: 2px;
}
.fg-pop-lib .fg-lib-card { aspect-ratio: auto; height: 100%; width: 100%; }
.fg-lib-card {
  position: relative; padding: 0; border: 1px solid var(--hairline); border-radius: 10px;
  overflow: hidden; background: #0a0b0e; cursor: pointer; aspect-ratio: 16/11;
  transition: border-color .15s var(--ease);
}
.fg-lib-card:hover { border-color: var(--accent-line); }
.fg-lib-card.attached { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent); }
.fg-lib-card img { width: 100%; height: 100%; object-fit: cover; display: block; }
.fg-lib-name {
  position: absolute; left: 0; right: 0; bottom: 0; padding: 10px 7px 5px;
  font-size: 10.5px; color: #fff; text-align: left; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  background: linear-gradient(transparent, rgba(8,9,11,.9));
}

/* ✕ on ref tiles (dock strip + attach box) — hover-revealed */
.fg-ref-del {
  position: absolute; right: 3px; top: 3px; z-index: 3;
  width: 18px; height: 18px; display: grid; place-items: center;
  border-radius: 6px; border: 1px solid var(--hairline);
  background: rgba(10,12,14,.9); color: var(--muted);
  font-size: 10px; line-height: 1; cursor: pointer;
  opacity: 0; transition: opacity .14s var(--ease);
}
.fg-ref:hover .fg-ref-del { opacity: 1; }
.fg-ref-del:hover { color: #ff7a7a; border-color: rgba(255,122,122,.5); }

/* ── Clickable @tags inside the prompt (mirror overlay over the textarea) ── */
.ptag-wrap { position: relative; }
/* Frame's reading order mirrored: asset strip (order:-2), prompt on its own
   full-width line (order:-1), icon buttons + cost + Generate beneath. */
.fg-prompt-wrap { position: relative; flex: 1 1 100%; order: -1; min-width: 0; display: flex; }
.fg-prompt-wrap .fg-prompt { width: 100%; }
.ptag-overlay {
  position: absolute; inset: 0; z-index: 2; pointer-events: none;
  color: transparent; background: transparent;
  white-space: pre-wrap; overflow-wrap: break-word; word-break: break-word;
  overflow: hidden;
}
.ptag {
  pointer-events: auto; cursor: pointer;
  color: var(--accent); background: var(--accent-soft);
  border-radius: 4px;
  -webkit-box-decoration-break: clone; box-decoration-break: clone;
  transition: background-color .12s var(--ease);
}
.ptag:hover { background: var(--accent-line); color: var(--accent-hi, var(--accent)); }
.ptag.bad {
  color: #ff8a8a; background: var(--err-soft);
  text-decoration: underline dotted; text-underline-offset: 2px;
}

/* ── New-project modal + project colour pills ── */
.np-box { width: min(440px, 92vw); }
.np-name {
  width: 100%; margin-top: 10px; padding: 9px 12px;
  background: var(--bg); border: 1px solid var(--hairline); border-radius: 9px;
  color: var(--text); font-size: 13.5px; outline: none;
}
.np-name:focus { border-color: var(--accent-line); }
.np-label {
  font-family: var(--font-mono); font-size: 10.5px; letter-spacing: .1em;
  text-transform: uppercase; color: var(--faint); margin: 15px 0 7px; text-align: left;
}
.np-swatches { display: flex; gap: 7px; flex-wrap: wrap; }
.np-swatch {
  width: 26px; height: 26px; border-radius: 8px; cursor: pointer;
  border: 2px solid transparent; transition: transform .12s var(--ease), border-color .12s var(--ease);
}
.np-swatch:hover { transform: scale(1.12); }
.np-swatch.on { border-color: #fff; box-shadow: 0 0 0 2px rgba(255,255,255,.22); }
.np-swatch.none { background: var(--surface-2); position: relative; }
.np-swatch.none::after {
  content: ''; position: absolute; left: 3px; right: 3px; top: 50%;
  height: 2px; background: var(--faint); transform: rotate(-45deg); border-radius: 2px;
}
.np-folder-row { display: flex; gap: 7px; align-items: center; }
.np-folder-row .np-name { flex: 1; margin-top: 0; }
.np-folders { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; min-height: 0; }
.np-folder-chip {
  display: inline-flex; align-items: center; gap: 6px; padding: 4px 8px;
  border-radius: 8px; background: var(--fill); border: 1px solid var(--hairline);
  color: var(--text); font-size: 12px;
}
.np-folder-chip svg { color: var(--muted); }
.np-folder-chip i { font-style: normal; color: var(--faint); cursor: pointer; padding: 0 2px; }
.np-folder-chip i:hover { color: var(--danger); }

/* colour pill to the left of the project name in the sidebar */
.proj-pill { flex: none; width: 11px; height: 11px; border-radius: 4px; }
.app.sb-collapsed .proj-pill { display: none; } /* the tinted avatar carries the colour */

/* ── GPU worker chip + panel (Flow header) ── */
.pod-chip {
  margin-left: auto; display: inline-flex; align-items: center; gap: 8px;
  padding: 7px 13px; border-radius: 10px; font-size: 12.5px; color: var(--muted);
  background: var(--fill); border: 1px solid var(--stroke);
  transition: border-color .15s var(--ease), color .15s var(--ease);
}
.pod-chip:hover { border-color: var(--accent-line); color: var(--text); }
.pod-dot { width: 8px; height: 8px; border-radius: 50%; background: #6a6f7a; flex: none; }
.pod-dot.on { background: #3db46a; box-shadow: 0 0 0 3px rgba(61, 180, 106, .18); }
.pod-dot.off { background: #6a6f7a; }
.pod-dot.busy { background: #f5af00; box-shadow: 0 0 0 3px rgba(245, 175, 0, .16); animation: pod-pulse 1.2s ease-in-out infinite; }
@keyframes pod-pulse { 50% { opacity: .45; } }
.pod-box { max-width: 460px; }
.pod-box.pod-busy { opacity: .6; pointer-events: none; }
.pod-name { font-family: var(--font-mono); font-size: 11px; color: var(--muted); font-weight: 400; letter-spacing: 0; }
.pod-stats { display: flex; flex-direction: column; gap: 8px; margin-top: 4px; }
.pod-stat { display: grid; grid-template-columns: 52px 1fr auto; align-items: center; gap: 10px; font-size: 12px; }
.pod-stat-l { font-family: var(--font-mono); font-size: 10.5px; letter-spacing: .08em; color: var(--muted); }
.pod-stat-v { color: var(--muted); font-variant-numeric: tabular-nums; }
.pod-bar { height: 6px; border-radius: 4px; background: var(--fill); border: 1px solid var(--hairline); overflow: hidden; }
.pod-bar i { display: block; height: 100%; border-radius: 4px; background: linear-gradient(90deg, #3db46a, #8fd66f); transition: width .5s var(--ease); }
.pod-jobs { margin-top: 12px; border-top: 1px solid var(--hairline); padding-top: 9px; display: flex; flex-direction: column; gap: 4px; }
.pod-job { display: flex; justify-content: space-between; font-size: 11.5px; color: var(--muted); font-family: var(--font-mono); }
.pod-job-idle { justify-content: flex-start; font-style: italic; }

/* ── Flow footage-mode dropdown + panel note ── */
.trk-mode { width: 100%; margin-bottom: 8px; }
.flowv-mode-note { margin: 2px 0 10px; font-size: 11.5px; line-height: 1.5; color: var(--muted); }

/* ── New-flow empty state polish: centered CTA, inline icon, roomier type ── */
.flow-nf-empty { gap: 10px; min-height: 460px; }
.flow-nf-empty .flow-nf-ic svg { width: 46px; height: 46px; }
.flow-nf-empty .flow-nf-drop-h { font-family: var(--font-display); font-size: 20px; font-weight: 650; letter-spacing: -.012em; }
.flow-nf-empty .flow-nf-drop-sub { margin-bottom: 2px; }
.flow-nf-empty .trk-btn.big {
  align-self: center; display: inline-flex; align-items: center; justify-content: center; gap: 9px;
  margin-top: 14px; padding: 12px 26px; border-radius: 12px; font-size: 14px;
}
.flow-nf-empty .trk-btn.big svg { width: 17px; height: 17px; flex: none; }
.flow-nf-empty .flowv-empty-note { margin-top: 8px; }

/* ── Global jobs chip (status bar) + tray ── */
.sb-jobs { cursor: pointer; background: transparent; border: 0; font: inherit; color: inherit; display: inline-flex; align-items: center; gap: 6px; }
.sb-jobs:hover { color: var(--text); }
.sb-jobs.bad { color: #ff8080; }
.jobs-tray {
  position: fixed; right: 10px; bottom: 34px; z-index: 2200;
  width: min(400px, calc(100vw - 20px)); max-height: 55vh; overflow-y: auto;
  background: rgba(24, 26, 32, 0.94);
  -webkit-backdrop-filter: saturate(160%) blur(30px); backdrop-filter: saturate(160%) blur(30px);
  border: 1px solid var(--stroke); border-radius: 13px;
  box-shadow: var(--shadow-lg), inset 0 1px 0 var(--glass-hi);
  padding: 6px 6px 8px; animation: confirm-pop .2s var(--spring);
}
.jobs-h { display: flex; align-items: center; gap: 10px; padding: 8px 10px 7px; border-bottom: 1px solid var(--hairline); position: sticky; top: 0; }
.jobs-h > span { font-family: var(--font-display); font-size: 14px; font-weight: 650; margin-right: auto; }
.jobs-clear { font-size: 11.5px; color: var(--muted); background: var(--fill); border: 1px solid var(--stroke); border-radius: 8px; padding: 4px 10px; }
.jobs-clear:hover { color: var(--text); border-color: var(--accent-line); }
.jobs-x { color: var(--muted); background: transparent; border: 0; font-size: 12px; padding: 4px 6px; }
.jobs-x:hover { color: var(--text); }
.jobs-empty { padding: 18px 12px; font-size: 12.5px; color: var(--muted); text-align: center; line-height: 1.5; }
.jobs-row { display: flex; align-items: flex-start; gap: 9px; padding: 9px 8px; border-bottom: 1px solid var(--hairline); }
.jobs-row:last-child { border-bottom: 0; }
/* Rows jump to their generation on click */
.jobs-row.jumpable { cursor: pointer; border-radius: 8px; }
.jobs-row.jumpable:hover { background: var(--fill); }

/* Landing flash on the jumped-to item (Frame cell / Forge tile or card) */
.jump-flash { animation: jump-flash 2.4s var(--ease) both; }
@keyframes jump-flash {
  0%, 55% { box-shadow: 0 0 0 2px var(--accent), 0 0 34px rgba(240,169,59,.35); border-color: var(--accent); }
  100% { box-shadow: none; }
}
.jobs-dot { width: 8px; height: 8px; border-radius: 50%; margin-top: 4px; flex: none; background: #6a6f7a; }
.jobs-dot.running, .jobs-dot.queued { background: #f5af00; animation: pod-pulse 1.2s ease-in-out infinite; }
.jobs-dot.done { background: #3db46a; }
.jobs-dot.failed { background: #e5484d; }
.jobs-main { flex: 1; min-width: 0; }
.jobs-l1 { font-size: 12.5px; color: var(--text); display: flex; align-items: baseline; gap: 7px; overflow: hidden; }
.jobs-l1 > span + * { min-width: 0; }
.jobs-mod { font-family: var(--font-mono); font-size: 9.5px; letter-spacing: .08em; color: var(--faint); flex: none; }
.jobs-l2 { font-size: 11px; color: var(--muted); margin-top: 3px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.jobs-bar { height: 4px; border-radius: 3px; background: var(--fill); border: 1px solid var(--hairline); overflow: hidden; margin-top: 6px; }
.jobs-bar i { display: block; height: 100%; background: linear-gradient(90deg, #f5af00, #ffd166); border-radius: 3px; transition: width .8s var(--ease); }
.jobs-acts { display: flex; gap: 4px; flex: none; }
.jobs-retry, .jobs-dismiss { background: var(--fill); border: 1px solid var(--stroke); border-radius: 7px; color: var(--muted); font-size: 12px; padding: 3px 8px; }
.jobs-retry:hover { color: var(--text); border-color: var(--accent-line); }
.jobs-dismiss:hover { color: #ff8080; border-color: #ff8080; }

/* ── Advanced masking workspace (Flow panel) ── */
.flowv-masklist { display: flex; flex-direction: column; gap: 5px; margin-bottom: 8px; }
.flowv-maskobj {
  display: flex; align-items: center; gap: 8px; padding: 6px 9px;
  background: var(--fill); border: 1px solid var(--hairline); border-radius: 9px; font-size: 12px;
}
.flowv-maskobj-l { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.flowv-maskobj-x { color: var(--muted); background: transparent; border: 0; font-size: 11px; padding: 2px 4px; }
.flowv-maskobj-x:hover { color: #ff8080; }
.flowv-masktextrow { display: flex; gap: 7px; margin-bottom: 10px; }
.flowv-masktext {
  flex: 1; min-width: 0; padding: 8px 10px; font-size: 12px;
  background: var(--bg); border: 1px solid var(--hairline); border-radius: 9px; color: var(--text); outline: none;
}
.flowv-masktext:focus { border-color: var(--accent-line); }
.flowv-dilaterow { display: flex; align-items: center; gap: 8px; }
.flowv-dilaterow .trk-btn.sm { min-width: 26px; padding: 3px 8px; font-size: 14px; line-height: 1; }
.flowv-dilate-val { min-width: 62px; text-align: center; font-size: 12px; color: var(--muted); font-variant-numeric: tabular-nums; }

/* ── Multi-select: hover checkbox + floating bulk-action bar ── */
/* The chip appears on item hover, and stays visible everywhere while a
   selection is in progress (.selecting on the container). */
.sel-box {
  position: absolute; top: 8px; left: 8px; z-index: 6;
  width: 21px; height: 21px; border-radius: 7px; padding: 0;
  border: 1.5px solid rgba(255,255,255,.6); background: rgba(10,11,14,.6);
  color: transparent; cursor: pointer;
  display: grid; place-items: center;
  opacity: 0; transition: opacity .15s var(--ease), background .15s var(--ease), border-color .15s var(--ease);
}
.sel-box::after { content: '✓'; font-size: 12px; font-weight: 700; line-height: 1; color: inherit; }
/* invisible halo: a 21px chip is a mean click target — pad it to ~31px */
.sel-box::before { content: ''; position: absolute; inset: -5px; }
.cell-frame:hover .sel-box, .fg-tile:hover .sel-box, .fg-card-stage:hover .sel-box,
.selecting .sel-box, .sel-box.on { opacity: 1; }
.sel-box:hover { border-color: var(--accent); }
.sel-box.on { background: var(--accent); border-color: var(--accent); color: #1A1206; }
.sel-box:focus-visible { opacity: 1; outline: 2px solid var(--accent); outline-offset: 2px; }
.bulk-btn:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }

.cell.selected .cell-frame,
.fg-tile.selected,
.fg-card.selected .fg-card-stage { outline: 2px solid var(--accent); outline-offset: -2px; }
.fg-tile.selected { border-color: transparent; }

.bulk-bar {
  position: fixed; top: 56px; left: 50%; transform: translateX(-50%);
  z-index: 95; display: flex; align-items: center; gap: 6px;
  max-width: min(92vw, 720px); flex-wrap: wrap; justify-content: center;
  padding: 7px 9px; border-radius: 13px;
  background: rgba(20,21,29,.96); border: 1px solid var(--hairline);
  box-shadow: 0 14px 36px rgba(0,0,0,.5);
  animation: bulkIn .18s var(--ease);
}
@keyframes bulkIn { from { opacity: 0; transform: translate(-50%, -6px); } }
.bulk-count { font-family: var(--font-mono); font-size: 12px; font-weight: 600; color: var(--accent); padding: 0 7px; white-space: nowrap; }
.bulk-btn {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 6px 11px; border-radius: 9px;
  background: var(--fill); border: 1px solid transparent;
  color: var(--text); font-size: 12.5px; cursor: pointer; white-space: nowrap;
}
.bulk-btn:hover { border-color: var(--accent-line); }
.bulk-btn svg { width: 13px; height: 13px; }
.bulk-btn.danger { color: var(--danger); }
.bulk-btn.danger:hover { background: rgba(229,104,93,.12); border-color: rgba(229,104,93,.4); }
.bulk-btn.bulk-x { padding: 6px 8px; background: transparent; color: var(--faint); }
.bulk-btn.bulk-x:hover { color: var(--text); border-color: transparent; }

/* ── Storyboard scrub ghost: sprite frame shown while dragging across a cell ── */
.scrub-ghost {
  position: absolute; inset: 0; z-index: 2; /* above video/poster, below the scrub bar (3) and checkbox (6) */
  background-repeat: no-repeat; background-position: 0% 50%;
  opacity: 0; pointer-events: none;
  transition: opacity .12s var(--ease); /* soft hand-off back to the real frame */
}
.scrub-ghost.on { opacity: 1; transition: none; } /* instant on — the drag must never lag */

/* timecode bubble that rides the pointer while hover-scrubbing */
.scrub-time {
  position: absolute; bottom: 10px; transform: translateX(-50%);
  z-index: 4; padding: 2px 7px; border-radius: 6px;
  font-family: var(--font-mono); font-size: 10.5px; font-weight: 600;
  color: var(--text); background: rgba(10, 11, 14, 0.85);
  border: 1px solid var(--hairline);
  opacity: 0; pointer-events: none; white-space: nowrap;
  transition: opacity .12s var(--ease);
}
.scrub-time.on { opacity: 1; transition: none; }

/* ── Live review-progress card (PromptPilot running on a feed clip) ── */
.review-progress .rp-stage { font-size: 11.5px; color: var(--muted); margin: 2px 0 9px; }
.rp-live {
  margin-left: auto; font-family: var(--font-mono); font-size: 9px;
  letter-spacing: .12em; text-transform: uppercase; color: var(--accent);
  animation: breathe 2.2s var(--ease) infinite;
}
.review-progress .progress-track { height: 4px; }
.review-progress .progress-track i { transition: width .6s var(--ease); }

/* ── Improved-prompt preview dialog ── */
.ppv-box { max-width: 560px; }
.ppv-label {
  font-family: var(--font-mono); font-size: 10px; font-weight: 500;
  letter-spacing: .12em; text-transform: uppercase; color: var(--faint);
  margin: 12px 0 6px;
}
.ppv-original {
  font-size: 12.5px; color: var(--muted); line-height: 1.55;
  background: var(--bg); border: 1px solid var(--hairline); border-radius: var(--radius-sm);
  padding: 9px 11px; max-height: 110px; overflow-y: auto; white-space: pre-wrap;
}
.ppv-edit {
  width: 100%; min-height: 130px; max-height: 260px; resize: vertical;
  font-family: inherit; font-size: 13px; line-height: 1.55; color: var(--text);
  background: var(--bg); border: 1px solid var(--hairline); border-radius: var(--radius-sm);
  padding: 10px 12px; outline: none;
}
.ppv-edit:focus { border-color: var(--accent-line); }
/* Seedream 5.0 Pro fast mode (optimize_prompt_options.mode=fast) */
.fg-chip.fast { color: var(--yellow, #f5af00); border-color: rgba(245, 175, 0, .35); }
/* Portrait library: bigger asset tiles + batch-upload progress */
.pf-grid { max-height: 460px; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); }
/* .char-card .char-ava pins avatars to 40px — outrank it for portrait tiles */
.char-card .char-ava.pf-thumb { width: 100%; height: 150px; font-size: 34px; background-size: cover; background-position: center top; }
.pf-upload { display: flex; flex-direction: column; gap: 6px; padding: 8px 0 2px; }
.pf-upload-row { display: flex; align-items: center; gap: 10px; }
.pf-upload-bar { flex: 1; height: 8px; border-radius: 5px; background: var(--surface-3); overflow: hidden; }
.pf-upload-fill { height: 100%; width: 0; border-radius: 5px; background: var(--accent); transition: width .25s ease; }
.pf-upload-count { font-family: var(--font-mono); font-size: 11.5px; color: var(--muted); white-space: nowrap; }
.pf-upload-fails { display: flex; flex-direction: column; gap: 2px; max-height: 110px; overflow-y: auto; }
.pf-upload-fail { font-size: 11.5px; color: var(--red, #e5484d); }
/* Portrait library drop target */
#pfLib { border-radius: 12px; transition: box-shadow .12s ease; }
#pfLib.pf-dropping { box-shadow: 0 0 0 2px var(--accent-line) inset; background: var(--accent-soft); }

/* ── People (user admin page) ─────────────────────────────────────────── */
.ppl-body { display: flex; flex-direction: column; gap: 14px; }
.ppl-toolbar { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.ppl-toolbar .filter-search { min-width: 220px; }
.ppl-spacer { flex: 1; }
.ppl-table { border: 1px solid var(--hairline); border-radius: 14px; background: var(--surface-1); overflow: hidden; }
.ppl-row { display: grid; grid-template-columns: 2.4fr 0.9fr 2.2fr 1fr 44px; gap: 14px; align-items: center; padding: 14px 18px; border-top: 1px solid var(--hairline); }
.ppl-table.compact .ppl-row { grid-template-columns: 3fr 1fr; }
.ppl-row:first-child { border-top: none; }
.ppl-row.head { padding: 10px 18px; font-family: var(--font-mono); font-size: 11px; letter-spacing: .06em; text-transform: uppercase; color: var(--faint); background: var(--surface-2); }
.ppl-row.off .ppl-who, .ppl-row.off .ppl-usage, .ppl-row.off .ppl-seen { opacity: .45; }
.ppl-who { display: flex; align-items: center; gap: 12px; min-width: 0; }
.ppl-ava { flex: none; width: 40px; height: 40px; border-radius: 50%; display: grid; place-items: center; font-weight: 600; font-size: 13px; background: var(--accent-soft); color: var(--accent); border: 1px solid var(--accent-line); }
.ppl-id { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.ppl-id b { font-size: 14px; color: var(--text); }
.ppl-sub { font-size: 12px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ppl-sub b { color: var(--text); font-weight: 500; }
.ppl-you { margin-left: 8px; font-family: var(--font-mono); font-size: 10px; color: var(--faint); text-transform: uppercase; letter-spacing: .06em; }
.ppl-chip { display: inline-block; margin-left: 8px; font-family: var(--font-mono); font-size: 10px; letter-spacing: .06em; padding: 2px 7px; border-radius: 10px; border: 1px solid var(--stroke); color: var(--muted); vertical-align: middle; }
.ppl-chip.admin { color: var(--accent); border-color: var(--accent-line); }
.ppl-chip.off { color: var(--red, #e5484d); border-color: rgba(229,72,77,.4); }
.ppl-role .filter-select { min-width: 110px; }
.ppl-usage { display: flex; flex-direction: column; gap: 5px; min-width: 0; }
.ppl-usage-line { display: flex; justify-content: space-between; gap: 10px; font-size: 12.5px; color: var(--muted); }
.ppl-usage-line b { color: var(--text); font-weight: 600; }
.ppl-usage-line i { font-style: normal; color: var(--faint); }
.ppl-usage .cr-bar i { background: linear-gradient(90deg, var(--accent-line), var(--accent)); }
.ppl-usage .cr-bar.over i { background: var(--red, #e5484d); }
.ppl-seen { display: flex; flex-direction: column; gap: 2px; font-size: 13px; color: var(--text); }
.ppl-act { display: flex; justify-content: flex-end; }
.act.icon { width: 32px; padding: 0; justify-content: center; }
.act.primary { color: var(--accent); border-color: var(--accent-line); }
.ppl-add { border: 1px solid var(--accent-line); background: var(--accent-soft); border-radius: 14px; padding: 14px 18px; display: flex; flex-direction: column; gap: 10px; }
.ppl-add-h { font-family: var(--font-display); font-weight: 600; font-size: 14px; }
.ppl-add-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.ppl-add-grid .char-in, .ppl-add-grid .filter-select { width: 100%; box-sizing: border-box; }
.ppl-pass { display: flex; gap: 6px; }
.ppl-add-foot { display: flex; align-items: center; justify-content: flex-end; gap: 8px; }
.ppl-err { flex: 1; font-size: 12px; color: var(--red, #e5484d); }
.ppl-foot { font-size: 12px; color: var(--faint); line-height: 1.5; }
@media (max-width: 980px) {
  .ppl-row, .ppl-table.compact .ppl-row { grid-template-columns: 1fr 1fr; }
  .ppl-row.head { display: none; }
  .ppl-who { grid-column: 1 / -1; }
  .ppl-usage { grid-column: 1 / -1; }
  .ppl-add-grid { grid-template-columns: 1fr; }
}

/* ══ HOST APP — host.cascadeai.cloud (host.html / host.js) ═══════════════════ */
.hs-body { display: flex; flex-direction: column; min-height: 100vh; }
.hs-top { position: sticky; top: 0; justify-content: space-between; }
.hs-top .tm-brand .sub { display: block; }
.hs-top .account-bar { display: flex; align-items: center; gap: 8px; background: none; border: 0; padding: 0; margin: 0; }
.hs-top .account-bar:empty { display: none; }
.hs-who { font-size: 12px; color: var(--muted); margin-right: 4px; }
.hs-prog[hidden] { display: none; }
.hs-lbl .hs-opt { text-transform: none; letter-spacing: 0; }
.hs-main { display: grid; grid-template-columns: minmax(360px, 480px) 1fr; gap: 22px; padding: 22px 32px 40px; flex: 1; max-width: 1400px; width: 100%; margin: 0 auto; box-sizing: border-box; }
@media (max-width: 900px) { .hs-main { grid-template-columns: 1fr; } }
.hs-card { background: var(--surface-1); border: 1px solid var(--hairline); border-radius: 16px; padding: 18px 18px 16px; display: flex; flex-direction: column; gap: 12px; }
.hs-card-h { font-family: var(--font-display); font-size: 18px; font-weight: 600; letter-spacing: -0.01em; }
.hs-card-top { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.hs-title-row { display: flex; align-items: center; gap: 8px; }
.hs-title { margin: 0; font-family: var(--font-display); font-size: 20px; font-weight: 600; letter-spacing: -0.01em; overflow-wrap: anywhere; }
.hs-sub { font-family: var(--font-mono); font-size: 10.5px; letter-spacing: .12em; text-transform: uppercase; color: var(--faint); margin-top: 6px; }
.hs-opt { font-size: 11.5px; color: var(--faint); font-weight: 400; }
.hs-lbl { font-family: var(--font-mono); font-size: 10px; letter-spacing: .12em; text-transform: uppercase; color: var(--faint); display: flex; justify-content: space-between; gap: 8px; }
.hs-form { display: flex; flex-direction: column; gap: 7px; }
.hs-form .char-in { width: 100%; box-sizing: border-box; }
.hs-actions { display: flex; justify-content: flex-end; margin-top: 4px; }
.hs-actions .act.primary, .hs-upd-acts .act.primary, .hs-linkbox .act.primary { color: var(--accent); border-color: var(--accent-line); }
.hs-note { font-size: 11.5px; color: var(--faint); line-height: 1.45; }
.hs-drop { border: 1.5px dashed var(--stroke); border-radius: 14px; padding: 26px 16px; text-align: center; cursor: pointer; transition: border-color .15s, background .15s; background: var(--bg); }
.hs-drop:hover, .hs-drop.over { border-color: var(--accent-line); background: color-mix(in srgb, var(--accent) 6%, var(--bg)); }
.hs-drop-ico { font-size: 26px; color: var(--muted); margin-bottom: 4px; }
.hs-drop-h { font-size: 14px; }
.hs-drop-s { font-size: 11.5px; color: var(--faint); margin-top: 3px; }
.hs-link { color: var(--accent); text-decoration: underline; }
.hs-staged { display: flex; align-items: center; justify-content: space-between; gap: 8px; flex-wrap: wrap; }
.hs-staged:empty { display: none; }
.hs-file { font-size: 12.5px; }
.hs-upd-acts { display: flex; gap: 6px; align-items: center; }
.hs-prog { display: flex; align-items: center; gap: 10px; font-size: 11.5px; color: var(--muted); }
.hs-prog-track { height: 6px; flex: 1; background: var(--stroke); border-radius: 3px; overflow: hidden; }
.hs-prog-bar { height: 100%; width: 0; background: var(--accent); border-radius: 3px; transition: width .15s; }
.hs-linkbox { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; padding: 10px 12px; border-radius: 10px; background: var(--bg); border: 1px solid var(--hairline); }
.hs-url { flex: 1; min-width: 0; font-family: var(--font-mono); font-size: 12px; color: var(--text); text-decoration: none; overflow-wrap: anywhere; }
.hs-row { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.hs-badge { font-size: 12px; color: var(--muted); padding: 4px 9px; border-radius: 999px; background: var(--bg); border: 1px solid var(--hairline); }
.hs-badge.on { color: var(--accent); border-color: var(--accent-line); }
.hs-warn { font-size: 12px; color: #F5AF00; padding: 8px 10px; border-radius: 9px; background: color-mix(in srgb, #F5AF00 9%, var(--bg)); border: 1px solid color-mix(in srgb, #F5AF00 40%, transparent); }
.hs-versions { display: flex; flex-direction: column; gap: 6px; }
.hs-ver { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 8px 10px; border-radius: 10px; background: var(--bg); border: 1px solid var(--hairline); font-size: 12.5px; }
.hs-ver.live { border-color: var(--accent-line); }
.hs-live { font-family: var(--font-mono); font-size: 9.5px; letter-spacing: .12em; color: var(--accent); margin-left: 6px; }
.hs-ver-acts { display: flex; gap: 6px; flex-shrink: 0; }
.hs-foot { display: flex; justify-content: flex-end; padding-top: 6px; border-top: 1px solid var(--hairline); }
.hs-toolbar { display: flex; gap: 8px; align-items: center; margin-bottom: 8px; }
.hs-toolbar .filter-search { flex: 1; }
.hs-count { font-size: 11.5px; color: var(--faint); margin: 0 0 8px 2px; }
.hs-list { display: flex; flex-direction: column; gap: 6px; }
.hs-item { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 11px 13px; border-radius: 12px; background: var(--surface-1); border: 1px solid var(--hairline); cursor: pointer; transition: border-color .12s, transform .12s; }
.hs-item:hover { border-color: var(--stroke); transform: translateY(-1px); }
.hs-item.sel { border-color: var(--accent-line); }
.hs-item-main { min-width: 0; }
.hs-item-name { font-size: 14px; font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.hs-item-sub { font-size: 11.5px; color: var(--faint); margin-top: 2px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
