/* ============================================================================
   Video Studio mockups — SHARED SHELL  ·  "Premium refined" design system
   Light theme · teal brand accent · Lucide line icons (currentColor).
   Restrained, confident, soft. Strong-but-quiet hierarchy, real focus rings,
   soft layered shadows, crisp 1px hairlines, 140ms transitions.

   Contract with shell.js: chrome is injected into #rail / #pillar / #topbar.
   PRESERVED structural selectors + layout:
     .app .rail .logo .ritem(.active) .pillar .ptitle(.dot)
     .nav .nav .sep .nav .label .main .topbar .crumbs .spacer .avatar .content
   ========================================================================== */

@import url('https://fonts.googleapis.com/css2?family=Plus+Jakarta+Sans:wght@400;500;600;700;800&family=DM+Sans:wght@400;500;600;700&display=swap');

/* ============================== TOKENS ==================================== */
:root {
  /* GoUltra AI — Midnight Indigo × Hot Pink */
  --primary:#2b2d7c; --primary-hover:#3a3c99; --primary-deep:#1a1b52;
  --acc:#ff2d78; --acc-hover:#e61e66; --acc-soft:#ffe4ef; --acc-light:rgba(255,45,120,.10);
  --success:#16a34a; --success-deep:#15803d; --warning:#e08600; --danger:#e11d48; --coral:#f77062;
  --g50:#f7f6fc; --g100:#eeedf9; --g200:#e3e1f2; --g300:#d5d2ec;
  --g400:#9a9eb8; --g500:#5c6080; --g600:#46496b; --g700:#2e315a; --g800:#1f2248; --g900:#15173a;

  /* premium semantic names mapped onto the brand palette */
  --bg:var(--g50); --surface:#ffffff; --surface-2:#eeedf9;
  --ink:var(--g900); --ink-2:var(--g700); --muted:var(--g500); --muted-2:var(--g400);
  --line:var(--g200); --line-strong:var(--g300);
  --acc-600:var(--acc); --acc-700:#c01a5b;
  --acc-50:var(--acc-soft); --acc-100:#ffd3e4; --acc-ring:rgba(255,45,120,.34);

  /* status (green success · amber · red) */
  --emerald:var(--success); --emerald-50:rgba(22,163,74,.10);
  --amber:var(--warning);   --amber-50:rgba(224,134,0,.12);
  --rose:var(--danger);     --rose-50:rgba(225,29,72,.08);
  --purple:var(--primary);  --purple-hover:var(--primary-deep);

  /* radii */
  --r-sm:8px; --r:10px; --r-lg:14px; --r-xl:18px; --pill:999px;
  --radius:var(--r-lg); /* legacy alias */

  /* shadows */
  --sh-sm:0 1px 2px rgba(15,23,42,.05);
  --sh:0 1px 3px rgba(15,23,42,.07),0 1px 2px rgba(15,23,42,.04);
  --sh-md:0 6px 16px -4px rgba(15,23,42,.12),0 2px 6px -3px rgba(15,23,42,.07);
  --sh-acc:0 8px 20px -6px rgba(255,45,120,.40);
  --ring:0 0 0 3px var(--acc-ring);

  /* type */
  --display:'Plus Jakarta Sans', ui-sans-serif, system-ui, sans-serif;
  --body:'DM Sans', ui-sans-serif, system-ui, sans-serif;

  /* chrome metrics */
  --rail:78px; --topbar:58px; --pillar:230px;
}

/* ============================== RESET ==================================== */
* { box-sizing:border-box; }
html, body { margin:0; padding:0; }
body {
  font-family:var(--body);
  color:var(--ink);
  background:var(--bg);
  font-size:14px;
  line-height:1.5;
  -webkit-font-smoothing:antialiased;
  text-rendering:optimizeLegibility;
}
.font-display { font-family:var(--display); }
::selection { background:var(--acc-100); color:var(--acc-700); }
a { color:inherit; }

/* ============================== ICONS ==================================== */
/* Lucide line icons — inherit currentColor + text color. Size via parent
   font-size or the helpers. Works with inline <svg> or glyph content alike. */
.ic {
  display:inline-block; width:1em; height:1em; flex:none;
  vertical-align:-.125em; stroke-width:2; line-height:1;
}
.ic svg, svg.ic { width:1em; height:1em; display:block; stroke-width:2; }
.ic-sm { font-size:14px; } .ic-lg { font-size:20px; }

/* ============================== LAYOUT =================================== */
/* .app is the grid: rail | (pillar) | main. shell.js injects into the
   children; the row that contains topbar+content is .main. */
.app {
  display:grid;
  grid-template-columns:var(--rail) var(--pillar) 1fr;
  grid-template-rows:100vh;
  min-height:100vh;
}
/* graceful fallback if a page omits the pillar column */
.app.no-pillar { grid-template-columns:var(--rail) 1fr; }

/* --- Icon rail --- */
.rail {
  grid-row:1; flex-shrink:0;
  background:var(--surface); border-right:1px solid var(--line);
  display:flex; flex-direction:column; align-items:center;
  padding:14px 0; gap:4px;
  position:sticky; top:0; height:100vh; overflow-y:auto;
}
.rail .logo {
  width:42px; height:42px; border-radius:13px; margin-bottom:14px;
  background:linear-gradient(135deg,var(--primary),var(--primary-deep));
  display:grid; place-items:center; color:#fff; font-weight:800;
  font-family:var(--display); font-size:19px; letter-spacing:-.02em;
  box-shadow:var(--sh-acc);
}
.rail .ritem {
  width:58px; padding:9px 0; border-radius:13px; text-decoration:none;
  display:flex; flex-direction:column; align-items:center; gap:5px;
  color:var(--muted); font-size:10px; font-family:var(--display); font-weight:600;
  transition:background .14s, color .14s;
}
.rail .ritem .ic { font-size:18px; }
.rail .ritem:hover { background:rgba(15,23,42,.05); color:var(--ink); }
.rail .ritem.active { background:var(--acc-50); color:var(--acc-700); }

/* --- Pillar sidebar (module nav) --- */
.pillar {
  grid-row:1; flex-shrink:0; background:var(--surface);
  border-right:1px solid var(--line); padding:18px 12px;
  position:sticky; top:0; height:100vh; overflow-y:auto;
}
.pillar .ptitle {
  font-family:var(--display); font-weight:800; font-size:15px; color:var(--ink);
  padding:4px 10px 16px; display:flex; align-items:center; gap:9px;
}
.pillar .ptitle .dot {
  width:9px; height:9px; border-radius:50%;
  background:var(--acc); box-shadow:0 0 0 4px var(--acc-50);
}
.pillar .nav { display:flex; flex-direction:column; gap:2px; }
.pillar .nav a {
  display:flex; align-items:center; gap:10px; padding:9px 10px;
  border-radius:var(--r-sm); text-decoration:none; color:var(--ink-2);
  font-family:var(--display); font-weight:600; font-size:13px;
  transition:background .14s, color .14s;
}
.pillar .nav a .ic { font-size:16px; opacity:.85; }
.pillar .nav a:hover { background:rgba(15,23,42,.04); color:var(--ink); }
.pillar .nav a.active { background:var(--acc-50); color:var(--acc-700); }
.pillar .nav a.active .ic { opacity:1; }
.pillar .nav .sep { height:1px; background:var(--line); margin:11px 6px; }
.pillar .nav .label {
  font-size:10px; text-transform:uppercase; letter-spacing:.08em;
  color:var(--muted-2); padding:13px 10px 5px; font-weight:700;
}

/* --- Main column --- */
.main {
  grid-row:1; min-width:0; height:100vh; overflow-y:auto;
  display:flex; flex-direction:column; background:var(--bg);
}
.topbar {
  height:var(--topbar); flex-shrink:0;
  border-bottom:1px solid var(--line); background:rgba(255,255,255,.86);
  backdrop-filter:saturate(160%) blur(8px);
  display:flex; align-items:center; gap:14px; padding:0 22px;
  position:sticky; top:0; z-index:20;
}
.topbar .crumbs {
  font-family:var(--display); font-weight:500; color:var(--muted); font-size:13px;
}
.topbar .crumbs b { color:var(--ink); font-weight:700; }
.topbar .spacer { flex:1; }
.topbar .pill {
  display:inline-flex; align-items:center; gap:7px; padding:6px 12px;
  border-radius:var(--pill); background:var(--surface-2); border:1px solid var(--line);
  font-family:var(--display); font-weight:600; font-size:12px; color:var(--ink-2);
}
.topbar .avatar {
  width:32px; height:32px; border-radius:50%; flex:none;
  background:linear-gradient(135deg,var(--primary),var(--primary-deep));
  box-shadow:var(--sh-sm), inset 0 0 0 1px rgba(255,255,255,.25);
}

/* --- Content canvas --- */
.content {
  padding:22px; max-width:1040px; width:100%; margin:0 auto;
}

/* ============================== HEADINGS ================================= */
.h1 {
  font-family:var(--display); font-weight:800; font-size:24px;
  letter-spacing:-.02em; color:var(--ink); margin:0;
}
.h2 { font-family:var(--display); font-weight:800; font-size:18px; color:var(--ink); margin:0; }
.sub { color:var(--muted); margin:5px 0 0; font-size:14px; }
.muted { color:var(--muted); }
.muted-2 { color:var(--muted-2); }
.small { font-size:12px; }
.tiny  { font-size:11px; }
.mono  { font-family:ui-monospace, "SF Mono", Menlo, monospace; }

/* layout helpers */
.row { display:flex; gap:16px; }
.col { display:flex; flex-direction:column; gap:16px; }
.grid { display:grid; gap:16px; }
.wrap { flex-wrap:wrap; }
.between { justify-content:space-between; }
.center { align-items:center; }
hr.div { border:none; border-top:1px solid var(--line); margin:18px 0; }

/* ============================== BUTTONS ================================= */
.btn {
  display:inline-flex; align-items:center; gap:7px;
  height:36px; padding:0 14px; border-radius:var(--r);
  font:600 13px/1 var(--display); border:1px solid transparent;
  cursor:pointer; user-select:none; text-decoration:none; white-space:nowrap;
  transition:background .14s, border-color .14s, box-shadow .14s, color .14s, filter .14s, transform .06s;
  /* neutral default */
  background:var(--surface); border-color:var(--line-strong);
  color:var(--ink-2); box-shadow:var(--sh-sm);
}
.btn:hover { background:var(--surface-2); border-color:#d5d2ec; box-shadow:var(--sh); }
.btn:active { transform:translateY(1px); }
.btn:focus-visible { box-shadow:var(--ring); outline:none; }
.btn[disabled], .btn.is-disabled, .btn:disabled, .btn.disabled {
  opacity:.5; pointer-events:none; box-shadow:none;
}
.btn .ic { font-size:15px; }

/* sizes */
.btn.sm  { height:30px; padding:0 11px; font-size:12px; border-radius:var(--r-sm); gap:6px; }
.btn.lg  { height:42px; padding:0 20px; font-size:14px; }
.btn.icon{ width:36px; padding:0; justify-content:center; }
.btn.sm.icon { width:30px; }
.btn.lg.icon { width:42px; }
.btn.block { width:100%; justify-content:center; }

/* variants */
.btn.primary {
  background:var(--primary); border-color:var(--primary);
  color:#fff; box-shadow:var(--sh-sm);
}
.btn.primary:hover { background:var(--primary-hover); border-color:var(--primary-hover); box-shadow:var(--sh); }
.btn.primary:active { filter:brightness(.97); }
.btn.acc {
  background:var(--acc); border-color:var(--acc);
  color:#fff; box-shadow:var(--sh-sm);
}
.btn.acc:hover { background:var(--acc-hover); border-color:var(--acc-hover); box-shadow:var(--sh-acc); }
.btn.acc:active { filter:brightness(.97); }

.btn.outline {
  background:transparent; border-color:var(--line-strong); color:var(--ink-2); box-shadow:none;
}
.btn.outline:hover { border-color:var(--acc); color:var(--acc-700); background:var(--acc-50); }

.btn.ghost {
  background:transparent; border-color:transparent; color:var(--muted); box-shadow:none;
}
.btn.ghost:hover { background:rgba(15,23,42,.05); color:var(--ink); border-color:transparent; }

.btn.subtle {
  background:var(--acc-50); color:var(--acc-700); border-color:transparent; box-shadow:none;
}
.btn.subtle:hover { background:var(--acc-100); border-color:transparent; }

.btn.danger {
  background:transparent; color:var(--rose); border-color:transparent; box-shadow:none;
}
.btn.danger:hover { background:var(--rose-50); border-color:transparent; }

.btn.ai {
  position:relative;
  background:var(--surface); border-color:var(--line-strong);
  color:var(--ink-2); box-shadow:var(--sh-sm);
}
.btn.ai:hover { border-color:var(--primary); color:var(--primary); box-shadow:var(--sh); }
/* pink sparkle is the only pink on AI buttons (keeps pink to ~10%) */
.btn.ai > .ic, .btn.ai svg:first-child, .btn.ai .ic-sparkles, .btn.ai .sparkles, .btn.ai > span:first-child { color:var(--acc); }

/* ============================== FORM FIELDS ============================= */
.field { display:flex; flex-direction:column; gap:6px; }
.field > label {
  font:600 11px/1.2 var(--display); color:var(--muted); letter-spacing:.01em;
}
.input, .textarea, .select,
.field input, .field textarea, .field select {
  width:100%; background:var(--surface);
  border:1px solid var(--line-strong); border-radius:var(--r-sm);
  padding:9px 11px; font-size:13px; font-family:var(--body); color:var(--ink);
  transition:border-color .14s, box-shadow .14s;
}
.input::placeholder, .textarea::placeholder,
.field input::placeholder, .field textarea::placeholder { color:var(--muted-2); }
.input:hover, .textarea:hover, .select:hover,
.field input:hover, .field textarea:hover, .field select:hover { border-color:#d5d2ec; }
.input:focus, .textarea:focus, .select:focus,
.field input:focus, .field textarea:focus, .field select:focus {
  border-color:var(--acc); box-shadow:var(--ring); outline:none;
}
.textarea, .field textarea {
  min-height:74px; resize:vertical; line-height:1.5;
}

/* leading icon inside a field */
.field.has-icon { position:relative; }
.field.has-icon .lead { position:absolute; left:11px; top:33px; color:var(--muted-2); font-size:15px; }
.field.has-icon .input, .field.has-icon input { padding-left:34px; }

/* hint + validation */
.field .hint { font-size:11px; color:var(--muted); }
.field.invalid .input, .field.invalid input, .field.invalid .textarea, .field.invalid textarea { border-color:var(--rose); }
.field.invalid .hint { color:var(--rose); }

/* search box (legacy convenience) */
.search {
  display:flex; align-items:center; gap:8px; background:var(--surface);
  border:1px solid var(--line-strong); border-radius:var(--r-sm);
  padding:8px 12px; min-width:260px; color:var(--muted); font-size:13px;
  transition:border-color .14s, box-shadow .14s;
}
.search:focus-within { border-color:var(--acc); box-shadow:var(--ring); }
.search input { border:none; outline:none; flex:1; font-family:var(--body); font-size:13px; color:var(--ink); background:transparent; }

/* ============================== SELECT (styled) ======================== */
/* trigger */
.select {
  display:flex; align-items:center; gap:9px; justify-content:space-between;
  cursor:pointer; background:var(--surface);
  border:1px solid var(--line-strong); border-radius:var(--r-sm);
  padding:9px 11px; font-size:13px; color:var(--ink);
  transition:border-color .14s, box-shadow .14s;
}
.select:hover { border-color:#d5d2ec; }
.select:focus, .select.open { border-color:var(--acc); box-shadow:var(--ring); outline:none; }
.select .sic { color:var(--acc-700); font-size:16px; flex:none; }
.select .sval { flex:1; min-width:0; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; font-weight:500; }
.select .chev { color:var(--muted-2); font-size:16px; flex:none; transition:transform .14s; }
.select.open .chev { transform:rotate(180deg); }

/* open menu */
.selectmenu {
  margin-top:6px; background:var(--surface);
  border:1px solid var(--line); border-radius:var(--r);
  box-shadow:var(--sh-md); padding:5px;
  display:flex; flex-direction:column; gap:2px;
}
.opt {
  display:flex; align-items:center; gap:10px;
  padding:8px 10px; border-radius:var(--r-sm);
  cursor:pointer; transition:background .12s;
}
.opt:hover { background:var(--surface-2); }
.opt .oic {
  width:22px; height:22px; flex:none; display:grid; place-items:center;
  border-radius:6px; background:var(--acc-50); color:var(--acc-700); font-size:13px;
}
.opt .otxt { flex:1; min-width:0; font-size:13px; font-weight:500; color:var(--ink); }
.opt .otxt .odesc { display:block; font-size:11px; font-weight:400; color:var(--muted); margin-top:1px; }
.opt .odesc { font-size:11px; font-weight:400; color:var(--muted); }
.opt .ochk { color:var(--acc); opacity:0; font-size:15px; flex:none; }
.opt.sel { background:var(--acc-50); }
.opt.sel .ochk { opacity:1; }

/* segmented toggle */
.seg, .modetoggle {
  display:inline-flex; background:#eeedf9; border-radius:var(--pill);
  padding:3px; gap:2px;
}
.seg .opt, .modetoggle .opt {
  display:inline-flex; align-items:center; gap:6px;
  padding:6px 13px; border-radius:var(--pill);
  font:600 12px/1 var(--display); color:var(--muted);
  cursor:pointer; transition:background .14s, color .14s, box-shadow .14s;
}
.seg .opt:hover, .modetoggle .opt:hover { color:var(--ink-2); }
.seg .opt.on, .modetoggle .opt.on {
  background:var(--surface); color:var(--acc-700); box-shadow:var(--sh-sm);
}
.seg .opt .ic, .modetoggle .opt .ic { font-size:14px; }

/* ============================== TABS (pill strip) ====================== */
.tabs { display:inline-flex; gap:3px; background:#eeedf9; border-radius:var(--pill); padding:3px; }
.tabs a, .tabs .tab {
  padding:7px 15px; border-radius:var(--pill);
  font:600 12px/1 var(--display); color:var(--muted);
  text-decoration:none; cursor:pointer; display:inline-flex; align-items:center; gap:7px;
  transition:background .14s, color .14s, box-shadow .14s;
}
.tabs a:hover, .tabs .tab:hover { color:var(--ink-2); }
.tabs a.on, .tabs .tab.on { background:var(--surface); color:var(--acc-700); box-shadow:var(--sh-sm); }

/* ============================== BADGES / CHIPS ========================= */
.badge {
  display:inline-flex; align-items:center; gap:5px;
  padding:3px 9px; border-radius:var(--pill);
  font:600 11px/1 var(--display); border:1px solid transparent;
}
.badge .ic { font-size:12px; }
.badge.neutral { border-color:var(--line-strong); color:var(--muted); background:var(--surface); }
.badge.acc     { background:var(--acc-50);  color:var(--acc-700); }
.badge.video   { background:var(--acc-light); color:var(--acc-700); }
.badge.done, .badge.ready { background:var(--emerald-50); color:var(--emerald); }
.badge.warn    { background:var(--amber-50); color:var(--amber); }
.badge.type    { background:var(--g100);    color:var(--muted); }
.badge.lock    { background:var(--g100);    color:var(--muted); }
/* legacy badge variants → GoUltra palette (blue / teal / purple) */
.badge.idea       { background:var(--amber-50);            color:var(--amber); }
.badge.drafting   { background:rgba(43,45,124,.10);       color:var(--primary); }
.badge.scripted   { background:rgba(43,45,124,.10);       color:var(--purple); }
.badge.configuring{ background:var(--acc-50);              color:var(--acc-700); }
.badge.generating { background:rgba(43,45,124,.10);       color:var(--purple); }
.badge.selected   { background:var(--acc-50);              color:var(--acc-700); }
.badge.img        { background:rgba(43,45,124,.10);       color:var(--primary); }
.badge.audio      { background:rgba(43,45,124,.10);       color:var(--purple); }
.badge.danger     { background:var(--rose-50);             color:var(--rose); }

/* selectable chip */
.chip {
  display:inline-flex; align-items:center; gap:6px;
  padding:5px 11px; border:1px solid var(--line-strong); border-radius:var(--r-sm);
  font:600 12px/1 var(--display); color:var(--muted); cursor:pointer; background:var(--surface);
  transition:border-color .14s, background .14s, color .14s;
}
.chip:hover { border-color:#d5d2ec; }
.chip.sel { border-color:var(--acc); background:var(--acc-50); color:var(--acc-700); }
.chip.disabled { opacity:.45; pointer-events:none; }

/* ============================== STEPPER ================================ */
.stepper {
  display:flex; flex-wrap:wrap; align-items:center; gap:7px;
  position:sticky; top:0; z-index:5; padding:10px 0;
  background:linear-gradient(var(--bg), var(--bg) 70%, transparent);
}
.step {
  display:inline-flex; align-items:center; gap:8px;
  padding:6px 13px 6px 7px; border:1px solid var(--line-strong); border-radius:var(--pill);
  font:600 12px/1 var(--display); color:var(--muted); background:var(--surface);
  cursor:pointer; transition:all .14s;
}
.step .n {
  width:20px; height:20px; border-radius:50%;
  display:grid; place-items:center; font-size:11px;
  background:#eeedf9; color:var(--muted);
}
.step:hover { border-color:#d5d2ec; color:var(--ink-2); }
.step.on {
  border-color:var(--primary);
  background:linear-gradient(180deg,var(--primary),var(--primary-deep));
  color:#fff; box-shadow:var(--sh-md);
}
.step.on .n { background:rgba(255,255,255,.22); color:#fff; }
.step.done { border-color:rgba(22,163,74,.32); background:var(--emerald-50); color:var(--success-deep); }
.step.done .n { background:var(--success); color:#fff; }
.step .arr, .stepsep { color:var(--muted-2); font-size:15px; display:inline-flex; align-items:center; }

/* ============================== CARDS / SECTIONS ====================== */
.card {
  background:var(--surface); border:1px solid var(--line);
  border-radius:var(--r-lg); padding:16px; box-shadow:var(--sh-sm);
}
.card h3 { font-family:var(--display); font-weight:700; font-size:15px; color:var(--ink); margin:0 0 4px; }
.card .muted { color:var(--muted); font-size:13px; }

.section-h {
  display:flex; align-items:center; gap:8px;
  font:600 11px/1 var(--display); letter-spacing:.06em; text-transform:uppercase;
  color:var(--muted); margin:14px 0 10px;
}
.section-h::before {
  content:''; width:3px; height:12px; border-radius:2px; background:var(--acc); flex:none;
}

/* ============================== RADIO CARDS =========================== */
.radiocards {
  display:grid; grid-template-columns:repeat(auto-fit, minmax(150px,1fr)); gap:10px;
}
.radiocard {
  position:relative; border:1px solid var(--line-strong); border-radius:var(--r);
  padding:12px; cursor:pointer; background:var(--surface);
  transition:border-color .14s, background .14s, box-shadow .14s;
}
.radiocard:hover { border-color:#d5d2ec; box-shadow:var(--sh); }
.radiocard .rc-ic {
  width:32px; height:32px; border-radius:var(--r-sm);
  display:grid; place-items:center; font-size:16px;
  background:var(--acc-50); color:var(--acc-700);
}
.radiocard .rc-t { font:600 13px/1.2 var(--display); color:var(--ink); margin-top:8px; }
.radiocard .rc-d { font-size:11px; color:var(--muted); margin-top:3px; }
.radiocard.on { border-color:var(--acc); background:var(--acc-50); }
.radiocard .rc-check { position:absolute; top:10px; right:10px; color:var(--acc); font-size:16px; opacity:0; transition:opacity .14s; }
.radiocard.on .rc-check { opacity:1; }

/* ============================== STUDIO (two-col) ===================== */
.studio { display:grid; grid-template-columns:260px 1fr; gap:18px; align-items:start; }

.editor {
  background:var(--surface); border:1px solid var(--line);
  border-radius:var(--r-lg); padding:20px; box-shadow:var(--sh-sm);
}
.editor .eh { display:flex; align-items:center; justify-content:space-between; gap:10px; flex-wrap:wrap; margin-bottom:14px; }
.editor .eh .t { font-family:var(--display); font-weight:800; font-size:17px; color:var(--ink); }

/* ============================== SCENE LIST =========================== */
.scenelist {
  background:var(--surface); border:1px solid var(--line);
  border-radius:var(--r-lg); padding:12px; box-shadow:var(--sh-sm);
}
.scenelist .lh { display:flex; align-items:center; justify-content:space-between; padding:4px 6px 12px; }
.scenelist .lh .t { font-family:var(--display); font-weight:700; font-size:13px; color:var(--ink); }
.scene-item {
  display:flex; gap:10px; align-items:center; padding:9px 8px;
  border-radius:var(--r-sm); border:1px solid transparent; cursor:pointer; margin-bottom:4px;
  transition:background .14s, border-color .14s;
}
.scene-item:hover { background:var(--surface-2); }
.scene-item.active { background:var(--acc-50); border-color:var(--acc-100); }
.scene-item .num {
  width:26px; height:26px; border-radius:7px; flex:none;
  background:#eeedf9; display:grid; place-items:center;
  font:800 12px/1 var(--display); color:var(--muted);
}
.scene-item.active .num { background:var(--acc); color:#fff; }
.scene-item .meta { min-width:0; flex:1; }
.scene-item .meta .nm { font:700 13px/1.3 var(--display); color:var(--ink); white-space:nowrap; overflow:hidden; text-overflow:ellipsis; }
.scene-item .meta .st { font-size:11px; color:var(--muted); display:flex; align-items:center; gap:5px; margin-top:2px; }
.dot-st { width:7px; height:7px; border-radius:50%; display:inline-block; flex:none; }
.dot-st.ok    { background:var(--emerald); }
.dot-st.warn  { background:var(--amber); }
.dot-st.gen   { background:#2b2d7c; }
.dot-st.idle  { background:var(--line-strong); }
.rdot { width:8px; height:8px; border-radius:50%; display:inline-block; flex:none; }
.rdot.ready { background:var(--emerald); }
.rdot.part  { background:var(--amber); }
.rdot.no    { background:var(--line-strong); }

/* ============================== SHOTS ================================ */
.shots { display:flex; flex-direction:column; gap:8px; }
.shot {
  display:flex; gap:10px; padding:10px 12px;
  border:1px solid var(--line); border-radius:var(--r); background:var(--surface);
  box-shadow:var(--sh-sm);
}
.shot .sn {
  width:46px; flex:none; padding-top:6px;
  font:800 12px/1 var(--display); color:var(--acc-700);
}
.shot .sbody { flex:1; min-width:0; }
.shot .sbody textarea {
  width:100%; border:1px solid var(--line-strong); border-radius:var(--r-sm);
  padding:8px 10px; font-family:var(--body); font-size:13px; color:var(--ink);
  resize:vertical; min-height:44px; transition:border-color .14s, box-shadow .14s;
}
.shot .sbody textarea:focus { border-color:var(--acc); box-shadow:var(--ring); outline:none; }
.shot .sbody .smeta { display:flex; gap:8px; margin-top:6px; flex-wrap:wrap; }
.shot .sbody .smeta input {
  border:1px solid var(--line-strong); border-radius:var(--r-sm);
  padding:5px 9px; font-size:12px; font-family:var(--body); color:var(--ink);
  transition:border-color .14s, box-shadow .14s;
}
.shot .sbody .smeta input:focus { border-color:var(--acc); box-shadow:var(--ring); outline:none; }
.shot .sx { color:var(--muted-2); cursor:pointer; padding-top:6px; transition:color .14s; }
.shot .sx:hover { color:var(--rose); }
.shotsnote { font-size:11.5px; color:var(--muted); margin:4px 0 2px; }

/* ============================== INGREDIENT SLOTS ===================== */
.ingslots { display:grid; grid-template-columns:repeat(auto-fill, minmax(140px,1fr)); gap:12px; }
.ingslot {
  border:1px solid var(--line); border-radius:var(--r); overflow:hidden;
  background:var(--surface); box-shadow:var(--sh-sm);
}
.ingslot .ihead {
  padding:8px 10px; font:700 11px/1 var(--display);
  text-transform:uppercase; letter-spacing:.05em; color:var(--muted);
  border-bottom:1px solid var(--line);
  display:flex; align-items:center; justify-content:space-between; gap:6px;
}
.ingslot .ihead .req { color:var(--rose); }
.ingslot .ibody { aspect-ratio:1/1; display:grid; place-items:center; position:relative; font-size:30px; }
.ingslot .ibody.filled.image { background:linear-gradient(135deg,#eae9fb,#eeedf9); color:#2b2d7c; }
.ingslot .ibody.filled.video { background:linear-gradient(135deg,var(--acc-100),var(--acc-50)); color:var(--acc-700); }
.ingslot .ibody.filled.audio { background:linear-gradient(135deg,#eae9fb,#f3f1fb); color:#2b2d7c; }
.ingslot .ibody.empty {
  background:var(--surface-2); color:var(--muted-2);
  border:2px dashed var(--line-strong); margin:8px; border-radius:var(--r-sm);
  aspect-ratio:auto; min-height:96px; flex-direction:column; gap:6px;
  font:600 12px/1.2 var(--display); cursor:pointer; text-align:center;
  display:flex; align-items:center; justify-content:center;
  transition:border-color .14s, color .14s, background .14s;
}
.ingslot .ibody.empty:hover { border-color:var(--acc); color:var(--acc-700); background:var(--acc-50); }
.ingslot .ifoot {
  padding:8px 10px; font-size:11px; color:var(--muted);
  border-top:1px solid var(--line); white-space:nowrap; overflow:hidden; text-overflow:ellipsis;
}
.counter { font:600 11px/1 var(--display); color:var(--muted); }
.counter b { color:var(--acc-700); }

/* ============================== TAKES STRIP ========================== */
.takes { display:grid; grid-template-columns:repeat(auto-fill, minmax(200px,1fr)); gap:14px; }
.take {
  border:1px solid var(--line); border-radius:var(--r-lg); overflow:hidden;
  background:var(--surface); box-shadow:var(--sh-sm);
  transition:border-color .14s, box-shadow .14s;
}
.take:hover { border-color:#d5d2ec; box-shadow:var(--sh); }
.take.sel { border-color:var(--acc); box-shadow:0 0 0 3px var(--acc-ring), var(--sh-sm); }
.take .tpv {
  aspect-ratio:9/16; max-height:260px;
  background:linear-gradient(135deg,var(--acc-100),var(--acc-50),#eae9fb);
  display:grid; place-items:center; color:var(--acc-700); font-size:34px; position:relative;
}
.take .tpv .play {
  width:42px; height:42px; border-radius:50%;
  background:rgba(255,255,255,.92); box-shadow:var(--sh);
  display:grid; place-items:center; font-size:16px; color:var(--acc-700);
}
.take .tpv .dur {
  position:absolute; bottom:8px; right:8px; font-size:11px;
  padding:2px 7px; border-radius:5px; background:rgba(15,23,42,.72); color:#fff;
}
.take .tpv .gen { position:absolute; top:8px; left:8px; }
.take .tbody { padding:10px 12px; }
.take .tbody .tn { font:700 12.5px/1.3 var(--display); color:var(--ink); display:flex; align-items:center; justify-content:space-between; gap:6px; }
.take .tbody .tp { font-size:11px; color:var(--muted); margin-top:3px; }
.take .tbody .tact { margin-top:9px; }
.take.gen-loading .tpv { background:#eeedf9; color:var(--muted-2); }

/* ============================== DERIVATION CALLOUT =================== */
.deriv {
  display:flex; align-items:center; gap:10px;
  padding:12px 16px; border-radius:var(--r);
  background:var(--acc-50); border:1px solid var(--acc-100);
  border-left:3px solid var(--acc);
  font-size:13px; color:var(--ink-2);
}
.deriv b { color:var(--acc-700); font-size:15px; }
.deriv .calc { font-family:ui-monospace, monospace; color:var(--muted); font-size:12px; }
.deriv.calc { /* allow .deriv.calc as a single combined class too */ }

/* ============================== PLAN ROWS =========================== */
.planrow {
  display:flex; align-items:center; gap:12px;
  padding:12px 14px; border:1px solid var(--line); border-radius:var(--r);
  background:var(--surface); box-shadow:var(--sh-sm); margin-bottom:10px;
}
.planrow .pn {
  width:30px; height:30px; border-radius:var(--r-sm); flex:none;
  background:var(--acc-50); color:var(--acc-700);
  display:grid; place-items:center; font:800 13px/1 var(--display);
}
.planrow .pmeta { flex:1; min-width:0; }
.planrow .pmeta .pt { font:700 13.5px/1.3 var(--display); color:var(--ink); }
.planrow .pmeta .pb { font-size:12px; color:var(--muted); margin-top:2px; }
.planrow .pdur { display:flex; align-items:center; gap:6px; }

/* ============================== NUMERIC STEPPER ===================== */
.numstep {
  display:inline-flex; align-items:center;
  border:1px solid var(--line-strong); border-radius:var(--r-sm);
  overflow:hidden; background:var(--surface);
}
.numstep button {
  border:none; background:var(--surface); width:32px; height:34px;
  font-size:16px; color:var(--muted); cursor:pointer; transition:background .14s, color .14s;
}
.numstep button:hover { background:var(--surface-2); color:var(--ink); }
.numstep button:focus-visible { outline:none; box-shadow:var(--ring); }
.numstep .v {
  padding:0 12px; font:700 13px/1 var(--display); color:var(--ink);
  min-width:54px; text-align:center; border-left:1px solid var(--line); border-right:1px solid var(--line);
  height:34px; display:grid; place-items:center;
}
.rangenote { font-size:11px; color:var(--muted-2); margin-top:4px; }

/* ============================== STAGE FOOTER ======================== */
.stagefoot {
  position:sticky; bottom:0; z-index:5;
  display:flex; align-items:center; justify-content:space-between; gap:12px;
  margin-top:22px; padding:16px 0;
  background:linear-gradient(transparent, var(--bg) 30%, var(--bg));
  border-top:1px solid var(--line);
}
.stagefoot .hint { font-size:12px; color:var(--muted); }

/* ============================== INFO / AI NOTES ===================== */
.info-note {
  display:flex; gap:10px; align-items:flex-start;
  border:1px solid var(--acc-100); background:var(--acc-50);
  border-left:3px solid var(--acc); border-radius:var(--r);
  padding:12px 14px; font-size:13px; color:var(--ink-2);
}
.info-note .ic { color:var(--acc-700); font-size:16px; flex:none; margin-top:1px; }
.info-note b { color:var(--acc-700); }
.ai-note {
  border:1px dashed var(--acc); background:var(--acc-50); border-radius:var(--r);
  padding:12px 14px; font-size:13px; color:var(--ink-2);
}
.ai-note b { color:var(--acc-700); }

/* ============================== VOICE CHIP ========================== */
.voicechip {
  display:inline-flex; align-items:center; gap:7px;
  padding:6px 11px; border-radius:var(--pill);
  border:1px solid var(--line-strong); background:var(--surface-2);
  font:700 12px/1 var(--display); color:var(--ink-2);
}
.voicechip .av, .voicechip .dot {
  width:18px; height:18px; border-radius:50%; flex:none;
  background:linear-gradient(135deg,#2b2d7c,#ff2d78);
}

/* ============================== SAVE STATE ========================= */
.savestate {
  display:inline-flex; align-items:center; gap:6px;
  font:500 12px/1 var(--display); color:var(--muted);
}
.savestate .ic { font-size:14px; color:var(--emerald); }
.savestate.saving .ic { color:var(--muted-2); }
.savestate .spinner { width:13px; height:13px; }

/* ============================== PROGRESS =========================== */
.progress, .prog {
  height:6px; border-radius:var(--pill); background:#eeedf9; overflow:hidden;
}
.progress > .bar, .prog > span {
  display:block; height:100%; border-radius:var(--pill);
  background:linear-gradient(90deg,#ff2d78,#ff2d78); transition:width .3s ease;
}

/* ============================== EMPTY STATE ======================== */
.empty {
  display:flex; flex-direction:column; align-items:center; justify-content:center;
  gap:10px; text-align:center; padding:36px 24px;
  border:1.5px dashed var(--line-strong); border-radius:var(--r-lg);
  background:var(--surface-2); color:var(--muted);
}
.empty .eic {
  width:44px; height:44px; border-radius:var(--r); display:grid; place-items:center;
  background:var(--acc-50); color:var(--acc-700); font-size:20px;
}
.empty .et { font:600 14px/1.3 var(--display); color:var(--ink); }
.empty .ed { font-size:12.5px; color:var(--muted); max-width:340px; }

/* ============================== SKELETON / SPINNER ================= */
.skel {
  background:linear-gradient(90deg,#eeedf9,#f7f6fc,#eeedf9);
  background-size:200% 100%; animation:shimmer 1.3s infinite;
  border-radius:var(--r-sm);
}
.spinner, .spin {
  display:inline-block; width:14px; height:14px;
  border:2px solid var(--line-strong); border-top-color:var(--acc);
  border-radius:50%; animation:spin .8s linear infinite;
}
@keyframes shimmer { to { background-position:-200% 0; } }
@keyframes spin { to { transform:rotate(360deg); } }

/* ============================== MODAL / DIALOG ===================== */
.modal-backdrop {
  position:fixed; inset:0; background:rgba(15,23,42,.45);
  display:grid; place-items:center; z-index:50; padding:24px;
  backdrop-filter:blur(2px);
}
.modal {
  background:var(--surface); border:1px solid var(--line); border-radius:var(--r-xl);
  width:100%; max-width:860px; max-height:86vh;
  display:flex; flex-direction:column; overflow:hidden; box-shadow:var(--sh-md);
}
.modal .mh { display:flex; align-items:center; justify-content:space-between; padding:16px 20px; border-bottom:1px solid var(--line); }
.modal .mh .t { font:800 16px/1 var(--display); color:var(--ink); }
.modal .mb { padding:18px 20px; overflow-y:auto; }
.modal .mf {
  display:flex; align-items:center; justify-content:space-between; gap:10px;
  padding:14px 20px; border-top:1px solid var(--line); background:var(--surface-2);
}
.rolebar {
  display:flex; align-items:center; gap:8px; flex-wrap:wrap; margin-bottom:14px;
  padding:10px 12px; border-radius:var(--r);
  background:var(--acc-50); border:1px solid var(--acc-100);
  font-size:13px; color:var(--ink-2);
}
.rolebar b { color:var(--acc-700); }

/* ============================== SCRIPT PANE ======================== */
.scriptpane {
  border:1px solid var(--line); border-radius:var(--r-lg);
  background:var(--surface); box-shadow:var(--sh-sm); overflow:hidden; margin-bottom:16px;
}
.scriptpane .sph {
  display:flex; align-items:center; justify-content:space-between;
  padding:12px 16px; cursor:pointer; background:var(--surface-2);
}
.scriptpane .sph .t { font:800 14px/1 var(--display); color:var(--ink); display:flex; align-items:center; gap:8px; }
.scriptpane .spb { padding:14px 16px; border-top:1px solid var(--line); }
.scriptpane.collapsed .spb { display:none; }
.scriptline { display:flex; gap:10px; padding:8px 0; border-bottom:1px solid var(--line); }
.scriptline:last-child { border-bottom:none; }
.scriptline .lab {
  width:64px; flex:none; padding-top:2px;
  font:700 11px/1.3 var(--display); text-transform:uppercase; letter-spacing:.05em; color:var(--muted-2);
}
.scriptline .txt { flex:1; font-size:13px; color:var(--ink-2); }
.scriptline .txt .vo { color:var(--acc-700); font-weight:600; }
.scriptline .dur { font-size:11px; color:var(--muted); white-space:nowrap; }

/* ============================== GUIDELINES ========================= */
.guidelines { display:grid; grid-template-columns:repeat(auto-fill, minmax(160px,1fr)); gap:10px; }
.gline { border:1px solid var(--line); border-radius:var(--r); padding:9px 12px; background:var(--surface); box-shadow:var(--sh-sm); }
.gline .gk { font:700 10px/1 var(--display); text-transform:uppercase; letter-spacing:.06em; color:var(--muted-2); }
.gline .gv { font-size:13px; color:var(--ink); font-weight:600; margin-top:3px; }
.lockchip { display:inline-flex; align-items:center; gap:5px; font-size:10px; color:var(--muted-2); }

/* ============================== INVENTORY (HAVE / NEED) ============ */
.inv { display:grid; grid-template-columns:1fr 1fr; gap:16px; }
.invcol { border:1px solid var(--line); border-radius:var(--r-lg); background:var(--surface); box-shadow:var(--sh-sm); overflow:hidden; }
.invcol .ih { padding:12px 14px; border-bottom:1px solid var(--line); display:flex; align-items:center; justify-content:space-between; font:800 14px/1 var(--display); }
.invcol.have .ih { background:var(--acc-50); color:var(--acc-700); }
.invcol.need .ih { background:var(--amber-50); color:var(--amber); }
.invrow { display:flex; align-items:center; gap:11px; padding:11px 14px; border-bottom:1px solid var(--line); }
.invrow:last-child { border-bottom:none; }
.invrow .th { width:42px; height:42px; border-radius:var(--r-sm); flex:none; display:grid; place-items:center; font-size:18px; }
.invrow .th.image { background:linear-gradient(135deg,#eae9fb,#eeedf9); color:#2b2d7c; }
.invrow .th.video { background:linear-gradient(135deg,var(--acc-100),var(--acc-50)); color:var(--acc-700); }
.invrow .th.audio { background:linear-gradient(135deg,#eae9fb,#f3f1fb); color:#2b2d7c; }
.invrow .th.gap { background:var(--surface-2); color:var(--muted-2); border:1px dashed var(--line-strong); }
.invrow .im { flex:1; min-width:0; }
.invrow .im .nm { font:700 13px/1.3 var(--display); color:var(--ink); }
.invrow .im .rl { font-size:11px; color:var(--muted); }

/* ============================== MODEL PICKER ======================= */
.modelpick { display:flex; flex-direction:column; gap:8px; }
.model {
  display:flex; align-items:center; gap:12px; padding:11px 13px;
  border:1px solid var(--line-strong); border-radius:var(--r); background:var(--surface);
  cursor:pointer; transition:border-color .14s, background .14s, box-shadow .14s;
}
.model:hover { border-color:#d5d2ec; box-shadow:var(--sh); }
.model.on { border-color:var(--acc); background:var(--acc-50); }
.model.off { opacity:.5; pointer-events:none; background:var(--surface-2); }
.model .mlogo { width:36px; height:36px; border-radius:var(--r-sm); flex:none; display:grid; place-items:center; font-size:16px; background:#eeedf9; color:var(--ink-2); }
.model .minfo { flex:1; min-width:0; }
.model .minfo .mn { font:800 13.5px/1.2 var(--display); color:var(--ink); display:flex; align-items:center; gap:8px; }
.model .minfo .mp { font-size:11.5px; color:var(--muted); margin-top:2px; }
.model .mcheck { width:22px; height:22px; border-radius:50%; border:2px solid var(--line-strong); flex:none; display:grid; place-items:center; font-size:12px; color:transparent; }
.model.on .mcheck { background:var(--acc); border-color:var(--acc); color:#fff; }
.rolehints { display:flex; gap:5px; flex-wrap:wrap; margin-top:6px; }
.rolehint { font:600 10px/1 var(--display); padding:3px 7px; border-radius:6px; background:#eeedf9; color:var(--ink-2); }
.rolehint.audio { background:#eae9fb; color:#2b2d7c; }
.rolehint.video { background:var(--acc-50); color:var(--acc-700); }

/* ============================== AUDIO PANEL ======================== */
.audiorow { display:flex; align-items:center; gap:12px; padding:12px 14px; border:1px solid var(--line); border-radius:var(--r); background:var(--surface); box-shadow:var(--sh-sm); margin-bottom:10px; }
.audiorow .anum { width:26px; height:26px; border-radius:7px; flex:none; background:#eeedf9; display:grid; place-items:center; font:800 12px/1 var(--display); color:var(--muted); }
.audiorow .ainfo { flex:1; min-width:0; }
.audiorow .ainfo .at { font:700 13px/1.3 var(--display); color:var(--ink); }
.audiorow .ainfo .ad { font-size:11.5px; color:var(--muted); }
.audiolane { display:flex; align-items:center; gap:6px; padding:8px 10px; border:1px dashed var(--line-strong); border-radius:var(--r-sm); background:var(--surface-2); }
.audiolane .seg { flex:1; height:26px; border-radius:6px; display:grid; place-items:center; font:700 10px/1 var(--display); padding:0; background:transparent; }
.audiolane .seg.vo { background:var(--acc-50); color:var(--acc-700); }
.audiolane .seg.music { background:#eae9fb; color:#2b2d7c; }
.audiolane .seg.silent { background:#eeedf9; color:var(--muted-2); }

/* faux slider + waveform (voice settings) */
.slider { height:6px; border-radius:var(--pill); background:#eeedf9; position:relative; }
.slider > .fill { position:absolute; left:0; top:0; bottom:0; border-radius:var(--pill); background:var(--acc); }
.slider > .knob { position:absolute; top:50%; transform:translate(-50%,-50%); width:14px; height:14px; border-radius:50%; background:#fff; border:2px solid var(--acc); box-shadow:var(--sh-sm); }
.wave { display:flex; align-items:center; gap:2px; height:24px; }
.wave span { width:3px; border-radius:2px; background:var(--acc); opacity:.6; }

.embedbadge { display:inline-flex; align-items:center; gap:5px; padding:3px 9px; border-radius:var(--pill); font:700 11px/1 var(--display); }
.embedbadge.embed { background:var(--acc-50); color:var(--acc-700); }
.embedbadge.overlay { background:var(--amber-50); color:var(--amber); border:1px solid #fbd9a0; }

/* ============================== ASSET LIBRARY ===================== */
.filterbar { display:flex; align-items:center; gap:10px; flex-wrap:wrap; margin:18px 0; }
.catpills { display:inline-flex; gap:6px; flex-wrap:wrap; }
.kindtabs { display:inline-flex; background:#eeedf9; border-radius:var(--pill); padding:3px; gap:2px; }
.kindtabs .opt { padding:6px 13px; border-radius:var(--pill); font:600 12px/1 var(--display); color:var(--muted); cursor:pointer; display:inline-flex; align-items:center; gap:5px; transition:background .14s, color .14s, box-shadow .14s; }
.kindtabs .opt.on { background:var(--surface); color:var(--acc-700); box-shadow:var(--sh-sm); }

.libgrid { display:grid; grid-template-columns:repeat(auto-fill, minmax(176px,1fr)); gap:14px; }
.asset {
  border:1px solid var(--line); border-radius:var(--r-lg); overflow:hidden;
  background:var(--surface); box-shadow:var(--sh-sm); cursor:pointer;
  transition:box-shadow .14s, border-color .14s;
}
.asset:hover { border-color:#d5d2ec; box-shadow:var(--sh); }
.asset.sel { border-color:var(--acc); box-shadow:0 0 0 3px var(--acc-ring), var(--sh-sm); }
.asset .preview { aspect-ratio:1/1; display:grid; place-items:center; font-size:34px; position:relative; background:#eeedf9; color:var(--muted-2); }
.asset .preview.image { background:linear-gradient(135deg,#eae9fb,#eeedf9); color:#2b2d7c; }
.asset .preview.video { background:linear-gradient(135deg,var(--acc-100),var(--acc-50)); color:var(--acc-700); }
.asset .preview.audio { background:linear-gradient(135deg,#eae9fb,#f3f1fb); color:#2b2d7c; }
.asset .preview .kindtag { position:absolute; top:7px; left:7px; font:700 10px/1 var(--display); padding:3px 7px; border-radius:var(--pill); background:rgba(255,255,255,.88); color:var(--ink-2); }
.asset .preview .play { position:absolute; width:34px; height:34px; border-radius:50%; background:rgba(255,255,255,.92); box-shadow:var(--sh); display:grid; place-items:center; font-size:14px; color:var(--acc-700); }
.asset .preview .dur { position:absolute; bottom:7px; right:7px; font-size:10px; padding:1px 6px; border-radius:5px; background:rgba(15,23,42,.72); color:#fff; }
.asset .preview .pick { position:absolute; top:7px; right:7px; width:22px; height:22px; border-radius:50%; background:var(--acc); color:#fff; display:none; place-items:center; font-size:12px; }
.asset.sel .preview .pick { display:grid; }
.asset .ameta { padding:9px 11px; }
.asset .ameta .nm { font:700 12.5px/1.3 var(--display); color:var(--ink); white-space:nowrap; overflow:hidden; text-overflow:ellipsis; }
.asset .ameta .tags { display:flex; gap:4px; margin-top:5px; flex-wrap:wrap; }
.asset .ameta .t { font-size:10px; padding:2px 6px; border-radius:5px; background:#eeedf9; color:var(--muted); }
.asset.add { border-style:dashed; border-color:var(--line-strong); display:grid; place-items:center; min-height:220px; color:var(--muted-2); font:700 13px/1.3 var(--display); gap:6px; box-shadow:none; }
.asset.add:hover { border-color:var(--acc); color:var(--acc-700); background:var(--acc-50); }
.asset.add .big { font-size:30px; }

.detail { width:340px; flex:none; border-left:1px solid var(--line); background:var(--surface); padding:18px; }
.detail .dpv { aspect-ratio:1/1; border-radius:var(--r-lg); display:grid; place-items:center; font-size:46px; margin-bottom:14px; }

/* ============================== GENERATOR (refs + candidates) ===== */
.refchips { display:flex; gap:8px; flex-wrap:wrap; }
.refchip { display:inline-flex; align-items:center; gap:7px; padding:5px 7px 5px 5px; border-radius:var(--r-sm); border:1px solid var(--line-strong); background:var(--surface); font:600 12px/1 var(--display); color:var(--ink-2); }
.refchip .rt { width:26px; height:26px; border-radius:6px; display:grid; place-items:center; font-size:13px; }
.refchip .rt.image { background:linear-gradient(135deg,#eae9fb,#eeedf9); color:#2b2d7c; }
.refchip .x { color:var(--muted-2); cursor:pointer; padding:0 2px; }
.refchip .x:hover { color:var(--rose); }
.refchip.add { border-style:dashed; color:var(--acc-700); cursor:pointer; }
.refchip.add:hover { border-color:var(--acc); background:var(--acc-50); }

.gengrid { display:grid; grid-template-columns:repeat(auto-fill, minmax(150px,1fr)); gap:12px; }
.gencand { border:1px solid var(--line); border-radius:var(--r); overflow:hidden; background:var(--surface); box-shadow:var(--sh-sm); cursor:pointer; transition:border-color .14s, box-shadow .14s; }
.gencand:hover { border-color:#d5d2ec; box-shadow:var(--sh); }
.gencand.sel { border-color:var(--acc); box-shadow:0 0 0 3px var(--acc-ring), var(--sh-sm); }
.gencand .gpv { aspect-ratio:1/1; background:linear-gradient(135deg,#eae9fb,#eeedf9,#f1ecfb); display:grid; place-items:center; color:#2b2d7c; font-size:28px; position:relative; }
.gencand .gpv .pick { position:absolute; top:6px; right:6px; width:20px; height:20px; border-radius:50%; background:var(--acc); color:#fff; display:none; place-items:center; font-size:11px; }
.gencand.sel .gpv .pick { display:grid; }
.gencand .gf { padding:7px 9px; font-size:11px; color:var(--muted); }

.attempts { display:flex; gap:8px; align-items:center; flex-wrap:wrap; }
.attempt { display:inline-flex; align-items:center; gap:6px; padding:4px 9px; border-radius:var(--pill); border:1px solid var(--line-strong); font:600 11px/1 var(--display); color:var(--muted); cursor:pointer; transition:border-color .14s, background .14s, color .14s; }
.attempt:hover { border-color:#d5d2ec; }
.attempt.on { border-color:var(--acc); background:var(--acc-50); color:var(--acc-700); }

.genbar { display:flex; gap:10px; align-items:flex-end; }
.genbar .field { flex:1; }

/* ============================== EXPORT ============================ */
.exportcard { border:1px solid var(--line); border-radius:var(--r-lg); padding:18px; background:var(--surface); box-shadow:var(--sh-sm); }
.exportcard.lead { border-color:var(--acc-100); background:var(--acc-50); }
.exportcard h3 { font:800 15px/1.2 var(--display); color:var(--ink); margin:0 0 6px; }
.dlrow { display:flex; align-items:center; gap:10px; padding:9px 12px; border:1px solid var(--line-strong); border-radius:var(--r-sm); margin-bottom:8px; background:var(--surface); }
.dlrow .dth { width:40px; height:52px; border-radius:7px; background:linear-gradient(135deg,var(--acc-100),var(--acc-50)); display:grid; place-items:center; color:var(--acc-700); font-size:16px; flex:none; }

/* ============================== REDESIGN 2026-06-04 ===============
   New shared components for the script / configuration / deferred
   clip-planning / per-clip research redesign. Additive — all selectors
   below are new (verified no collision with existing rules). */

/* --- sync-to-planner pill (Brief & Script write-back indicator) --- */
.syncpill { display:inline-flex; align-items:center; gap:6px; padding:4px 10px; border-radius:var(--pill);
  background:var(--acc-50); border:1px solid var(--acc-100); color:var(--acc-700);
  font:600 11.5px/1 var(--display); white-space:nowrap; }
.syncpill .ic { width:13px; height:13px; }
.syncpill.muted2 { background:var(--g100); border-color:var(--line); color:var(--muted); }
.syncpill.warn { background:var(--amber-50); border-color:#f3d9a8; color:#9a6400; }

/* --- model gallery (Configuration default-model picker) ---------- */
.modelgrid { display:grid; grid-template-columns:repeat(auto-fill, minmax(232px,1fr)); gap:12px; }
.modelcard { position:relative; display:flex; flex-direction:column; gap:9px; padding:13px;
  border:1px solid var(--line); border-radius:var(--r-lg); background:var(--surface); box-shadow:var(--sh-sm);
  cursor:pointer; transition:border-color .14s, box-shadow .14s, transform .06s; }
.modelcard:hover { border-color:var(--line-strong); box-shadow:var(--sh-md); transform:translateY(-1px); }
.modelcard.sel { border-color:var(--acc); box-shadow:0 0 0 3px var(--acc-ring), var(--sh-sm); }
.modelcard .mc-head { display:flex; align-items:flex-start; gap:10px; }
.modelcard .mc-logo { width:38px; height:38px; flex:none; border-radius:var(--r-sm); display:grid; place-items:center;
  background:linear-gradient(135deg,#eae9fb,#eeedf9); color:var(--primary); font-size:18px; }
.modelcard.sel .mc-logo { background:linear-gradient(135deg,var(--acc-100),var(--acc-50)); color:var(--acc-700); }
.modelcard .mc-name { font:800 14px/1.15 var(--display); color:var(--ink); }
.modelcard .mc-sub { font-size:11px; color:var(--muted); margin-top:2px; }
.modelcard .mc-desc { font-size:11.5px; line-height:1.5; color:var(--ink-2); }
.modelcard .mc-roles { display:flex; flex-wrap:wrap; gap:4px; }
.modelcard .mc-foot { display:flex; flex-wrap:wrap; gap:5px 10px; padding-top:9px; margin-top:auto;
  border-top:1px solid var(--line); font:600 11px/1.3 var(--display); color:var(--muted); }
.modelcard .mc-foot b { color:var(--ink-2); font-weight:700; }
.modelcard .mc-check { position:absolute; top:11px; right:11px; width:20px; height:20px; border-radius:50%;
  background:var(--acc); color:#fff; display:none; place-items:center; }
.modelcard .mc-check .ic { width:12px; height:12px; }
.modelcard.sel .mc-check { display:grid; }
.modelcard.disabled { opacity:.55; cursor:not-allowed; }

/* --- required-ingredients checklist (Per-clip research) ---------- */
.checklist { display:flex; flex-direction:column; gap:8px; }
.cl-row { display:flex; align-items:center; gap:11px; padding:10px 12px; border:1px solid var(--line);
  border-radius:var(--r); background:var(--surface); box-shadow:var(--sh-sm); }
.cl-row.need { border-color:#f3d9a8; background:linear-gradient(0deg,var(--amber-50),var(--surface)); }
.cl-row.have { border-color:#bfe6cb; background:linear-gradient(0deg,var(--emerald-50),var(--surface)); }
.cl-ic { width:34px; height:34px; flex:none; border-radius:var(--r-sm); display:grid; place-items:center;
  background:var(--g100); color:var(--muted); font-size:15px; }
.cl-row.need .cl-ic { background:var(--amber-50); color:#9a6400; }
.cl-row.have .cl-ic { background:var(--emerald-50); color:var(--success-deep); }
.cl-info { flex:1; min-width:0; }
.cl-label { font:700 13px/1.25 var(--display); color:var(--ink); display:flex; align-items:center; gap:7px; }
.cl-note { font-size:11.5px; line-height:1.45; color:var(--muted); margin-top:2px; }
.cl-actions { display:flex; align-items:center; gap:6px; flex:none; }
.cl-status { display:inline-flex; align-items:center; gap:5px; font:600 11.5px/1 var(--display); color:var(--success-deep); }
.cl-status .ic { width:14px; height:14px; }

/* --- deferred clip-planning hero / empty state ------------------- */
.planempty { text-align:center; padding:34px 28px; border:1.5px dashed var(--line-strong);
  border-radius:var(--r-xl); background:linear-gradient(180deg,var(--surface),var(--g50)); }
.planempty .pe-ic { width:60px; height:60px; margin:0 auto 14px; border-radius:var(--r-lg); display:grid; place-items:center;
  background:linear-gradient(135deg,var(--primary),var(--primary-deep)); color:#fff; box-shadow:var(--sh-md); }
.planempty .pe-ic .ic { width:28px; height:28px; }
.planempty .pe-t { font:800 19px/1.2 var(--display); color:var(--ink); }
.planempty .pe-d { font-size:13px; line-height:1.55; color:var(--muted); max-width:460px; margin:7px auto 18px; }
.pe-steps { display:flex; justify-content:center; flex-wrap:wrap; gap:8px 14px; margin-top:18px; }
.pe-steps .pe-step { display:inline-flex; align-items:center; gap:6px; font:600 11.5px/1 var(--display); color:var(--muted); }
.pe-steps .pe-step .ic { width:14px; height:14px; color:var(--acc-700); }

/* --- per-clip research panel (AI suggestions) ------------------- */
.researchpanel { border:1px solid var(--acc-100); border-radius:var(--r-lg); background:var(--acc-50); overflow:hidden; }
.researchpanel .rp-head { display:flex; align-items:center; gap:9px; padding:11px 14px; border-bottom:1px solid var(--acc-100);
  font:700 12.5px/1 var(--display); color:var(--acc-700); }
.researchpanel .rp-head .ic { width:15px; height:15px; }
.researchpanel .rp-body { padding:13px 14px; display:flex; flex-direction:column; gap:11px; background:var(--surface); }
.rp-sug { border-left:2px solid var(--acc); padding-left:11px; }
.rp-sug .rp-k { font:700 10.5px/1 var(--display); letter-spacing:.05em; text-transform:uppercase; color:var(--muted-2); margin-bottom:4px; }
.rp-sug .rp-v { font-size:12.5px; line-height:1.5; color:var(--ink-2); }
.researchpanel .rp-foot { display:flex; align-items:center; justify-content:flex-end; gap:8px; padding:0 14px 13px; background:var(--surface); }

/* --- direct upload drop zone (ingredient upload) ---------------- */
.uploadzone { display:flex; flex-direction:column; align-items:center; justify-content:center; gap:6px;
  padding:18px; border:1.5px dashed var(--line-strong); border-radius:var(--r); background:var(--g50);
  color:var(--muted); text-align:center; cursor:pointer; transition:border-color .14s, background .14s, color .14s; }
.uploadzone:hover { border-color:var(--acc); background:var(--acc-50); color:var(--acc-700); }
.uploadzone .uz-ic { width:26px; height:26px; }
.uploadzone .uz-t { font:600 12px/1.2 var(--display); }
.uploadzone .uz-d { font-size:11px; color:var(--muted-2); }

/* --- tiny segmented "view state" switcher for mockup state demos -- */
.statetabs { display:inline-flex; gap:4px; padding:4px; border:1px solid var(--line); border-radius:var(--pill); background:var(--g100); }
.statetabs a { padding:5px 12px; border-radius:var(--pill); font:600 11.5px/1 var(--display); color:var(--muted); text-decoration:none; }
.statetabs a.on { background:var(--surface); color:var(--ink); box-shadow:var(--sh-sm); }

/* --- expandable model list-card (Configuration default-model picker) -- */
.modelselect { border:1px solid var(--line); border-radius:var(--r-lg); background:var(--surface); box-shadow:var(--sh-sm); overflow:hidden; }
.ms-current { display:flex; align-items:center; gap:12px; padding:12px 13px; }
.ms-current .mc-logo { width:42px; height:42px; flex:none; border-radius:var(--r-sm); display:grid; place-items:center;
  background:linear-gradient(135deg,var(--acc-100),var(--acc-50)); color:var(--acc-700); font-size:19px; }
.ms-cmeta { flex:1; min-width:0; }
.ms-cmeta .mc-name { font:800 15px/1.2 var(--display); color:var(--ink); display:flex; align-items:center; gap:8px; flex-wrap:wrap; }
.ms-specs { font-size:11.5px; line-height:1.4; color:var(--muted); margin-top:3px; }
.ms-toggle { flex:none; }
.ms-list { border-top:1px solid var(--line); background:var(--g50); padding:8px; display:none; flex-direction:column; gap:6px; }
.modelselect.open .ms-list { display:flex; }
.ms-list .mslh { font:700 10.5px/1 var(--display); letter-spacing:.05em; text-transform:uppercase; color:var(--muted-2); padding:3px 4px 5px; }
.ms-opt { position:relative; display:flex; align-items:flex-start; gap:11px; padding:11px 12px; border:1px solid var(--line);
  border-radius:var(--r); background:var(--surface); cursor:pointer; transition:border-color .14s, box-shadow .14s; }
.ms-opt:hover { border-color:var(--line-strong); box-shadow:var(--sh-sm); }
.ms-opt.sel { border-color:var(--acc); box-shadow:0 0 0 3px var(--acc-ring); }
.ms-opt .mc-logo { width:36px; height:36px; flex:none; border-radius:var(--r-sm); display:grid; place-items:center;
  background:linear-gradient(135deg,#eae9fb,#eeedf9); color:var(--primary); font-size:16px; }
.ms-opt.sel .mc-logo { background:linear-gradient(135deg,var(--acc-100),var(--acc-50)); color:var(--acc-700); }
.ms-ometa { flex:1; min-width:0; display:flex; flex-direction:column; gap:6px; }
.ms-ometa .mc-name { font:800 13.5px/1.15 var(--display); color:var(--ink); }
.ms-ometa .mc-sub { font-size:11px; color:var(--muted); margin-top:-4px; }
.ms-ometa .mc-desc { font-size:11.5px; line-height:1.45; color:var(--ink-2); }
.ms-ospec { flex:none; align-self:center; text-align:right; display:flex; flex-direction:column; gap:3px;
  font:600 11px/1.3 var(--display); color:var(--muted); padding-left:8px; border-left:1px solid var(--line); padding-right:18px; }
.ms-ospec b { color:var(--ink-2); }
.ms-check { position:absolute; top:10px; right:10px; width:18px; height:18px; border-radius:50%; background:var(--acc); color:#fff; display:none; place-items:center; }
.ms-check .ic { width:11px; height:11px; }
.ms-opt.sel .ms-check { display:grid; }

/* --- AI instruction bar (custom prompt on re-plan / research / redraft) -- */
.aiprompt { display:flex; align-items:center; gap:8px; padding:5px 5px 5px 12px; border:1px solid var(--acc-100);
  border-radius:var(--pill); background:var(--acc-50); }
.aiprompt.block { border-radius:var(--r); padding:9px; align-items:stretch; flex-direction:column; gap:8px; }
.aiprompt .ai-lead { flex:none; color:var(--acc-700); display:grid; place-items:center; }
.aiprompt .ai-lead .ic { width:15px; height:15px; }
.aiprompt .ai-in { flex:1; min-width:0; border:none; background:transparent; outline:none; resize:none;
  font:500 12.5px/1.5 var(--body); color:var(--ink); }
.aiprompt .ai-in::placeholder { color:var(--muted-2); }
.aiprompt.block .ai-in { padding:7px 9px; border:1px solid var(--acc-100); border-radius:var(--r-sm); background:var(--surface); }
.aiprompt .btn { flex:none; }
.aiprompt.block .btn { align-self:flex-end; }
.optgroup { display:flex; flex-direction:column; gap:7px; }
.optgroup > label { font:700 11px/1 var(--display); letter-spacing:.02em; color:var(--muted); text-transform:uppercase; }

/* ============================== RESPONSIVE ======================== */
@media (max-width:1080px) {
  .studio { grid-template-columns:1fr; }
  .inv { grid-template-columns:1fr; }
  .modelgrid { grid-template-columns:repeat(auto-fill, minmax(200px,1fr)); }
}
@media (max-width:720px) {
  .ms-ospec { display:none; }
}
@media (max-width:860px) {
  .app { grid-template-columns:var(--rail) 1fr; }
  .pillar { display:none; }
}
