/* ============================================================================
   LaunchFrame Studio — ValleyFold v5 product design system
   Canonical VF palette and locally bundled Geist UI / Geist Mono numerics. Every class hook the JS toggles/emits is
   preserved; this file only restyles them. UI fonts load locally; canvas/content font loading remains independent.
   ========================================================================= */

/* UI-only aliases deliberately do not replace fonts used by canvas exports. */
@font-face { font-family: 'VF UI'; src: url('assets/brand/geist-variable.woff2') format('woff2'); font-style: normal; font-weight: 100 900; font-display: swap; }
@font-face { font-family: 'VF Mono'; src: url('assets/brand/geist-mono-variable.woff2') format('woff2'); font-style: normal; font-weight: 100 900; font-display: swap; }

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

:root {
  color-scheme: dark;
  /* Layout */
  --leftpanel-w: 248px;
  --inspector-w: 288px;
  --header-h: 48px;
  --carousel-h: 120px;

  /* VF navy ramp; canvas/sunken/surface are canonical, remaining rungs are editor elevations. */
  --ink-950: #101b2e;
  --ink-900: #14233b;
  --ink-850: #1d304b;
  --ink-800: #233953;
  --ink-750: #29415e;
  --ink-700: #304a69;
  --ink-650: #375375;

  --bg: var(--ink-950);
  --surface: #1d304b;
  --surface2: #233953;

  /* Hairlines */
  --line: #40536f;
  --line-2: #536986;
  --line-3: #899bb6;

  /* Text */
  --text1: #edf2fc;
  --text2: #b1bfd6;
  --text3: #b1bfd6;   /* >= 4.5:1 on panels (WCAG AA) */
  --text4: #899bb6;

  /* VF accessible link accent; primary filled actions keep the canonical brand blue. */
  --accent: #a9beff;
  --accent-bright: #d5e0ff;
  --accent-deep: #294dcc;
  --blue: var(--accent);
  --blue-dim: var(--accent-14);
  --accent-ring: var(--accent);
  --accent-glow: var(--accent-14);

  /* Status */
  --green: #4ade80;
  --amber: #ffd17b;
  --red: #ffb4ab;

  /* Radii */
  --r-xs: 4px;
  --r-sm: 4px;
  --r-md: 8px;
  --r-lg: 8px;
  --r-pill: 999px;

  /* Semantic fills (tinted surfaces that flip per theme) */
  --fill-1: rgba(255,255,255,0.05);
  --fill-2: rgba(255,255,255,0.09);
  --fill-faint: rgba(255,255,255,0.03);
  --card-bg: var(--surface);
  --field-bg: var(--ink-900);
  --field-bg-focus: var(--ink-850);
  --stage: var(--ink-950);
  --stage-glow: transparent;
  --stage-dot: rgba(177,191,214,0.08);
  --grain-opacity: 0;
  --grain-blend: overlay;

  /* Elevation */
  --e1: 0 1px 2px rgba(0,0,0,0.35);
  --e2: 0 6px 20px rgba(0,0,0,0.40);
  --e3: 0 18px 50px rgba(0,0,0,0.55);

  /* Type */
  --font-display: 'VF UI', system-ui, sans-serif;
  --font-ui: 'VF UI', -apple-system, system-ui, 'Segoe UI', sans-serif;
  --font-mono: 'VF Mono', ui-monospace, 'SF Mono', Menlo, monospace;

  --ease: cubic-bezier(0.2, 0, 0.2, 1);

  /* Design-system Phase 1: semantic tokens (docs/design-system-plan.md) */
  --label-size: 11px;
  --label-color: var(--text2);
  /* Accent tint scale — derived from one theme-aware triplet, so every
     tint adapts in light mode instead of staying dark-theme blue. */
  --accent-rgb: 169, 190, 255;
  --accent-06: rgba(var(--accent-rgb), 0.06);
  --accent-08: rgba(var(--accent-rgb), 0.08);
  --accent-14: rgba(var(--accent-rgb), 0.14);
  --accent-20: rgba(var(--accent-rgb), 0.20);
  --accent-35: rgba(var(--accent-rgb), 0.35);
  --accent-55: rgba(var(--accent-rgb), 0.55);
  --focus-ring: 0 0 0 2px var(--ink-900), 0 0 0 4px var(--accent-ring);
  /* Target sizes. 24px is the WCAG 2.2 AA minimum (SC 2.5.8) and keeps a
     dense pro-tool inspector usable; coarse pointers get the 44px guidance. */
  /* Text on a selection tint follows the theme, independently of filled actions. */
  --on-tint-text: var(--text1);
  /* Canonical VF filled action / hover roles, with white text in both themes. */
  --btn-p-from: #294dcc;
  --btn-p-to: #193ba8;
  --hit-min: 24px;
  --hit-touch: 44px;
  --spring: cubic-bezier(0.34, 1.56, 0.64, 1);

  /* ── Layer ladder ──────────────────────────────────────────────────────
     One ordered list of every surface that can cover another. Before this,
     layering was 24 ad-hoc numbers ending 9000 / 9998 / 9999 / 10000 — the
     signature of an escalation war, where each new surface outbids the last
     and nobody can say what sits above what.

     Steps of 100 leave room to slot a surface in without renumbering, which
     is what starts the war. Relative order here is identical to the order
     those raw numbers produced, so this is a renaming, not a reshuffle.

     Values <= 6 are deliberately NOT on this ladder: they order children
     inside one component (a drop indicator over its row) and never compete
     with another surface. Adding them would imply a relationship that isn't
     there. Anything that can cover a *different* surface belongs here. */
  --z-panel: 100;            /* left panel, inspector — docked rails       */
  --z-panel-float: 200;      /* first-run card floating over a rail        */
  --z-canvas-ui: 300;        /* zoom bar, stage pills, device switcher     */
  --z-resizer: 400;          /* rail drag handle — above what it resizes   */
  --z-header: 500;           /* app header — above the rails it spans      */
  --z-popover: 600;          /* menus anchored to header controls          */
  --z-sheet-backdrop: 700;
  --z-sheet: 800;            /* responsive rails promoted to sheets        */
  --z-drawer-backdrop: 900;
  --z-modal-backdrop: 1000;
  --z-modal: 1100;           /* command palette, device + project modals   */
  --z-modal-nested: 1200;    /* a modal opened from a modal                */
  --z-modal-top: 1300;       /* colour editor, asset import                */
  --z-banner: 1400;          /* save-failure banner — outranks any modal   */
  --z-inline-edit: 1500;     /* on-canvas text editing                     */
  --z-grain: 1600;           /* film-grain overlay, pointer-events: none   */
  --z-toast: 1700;
  --z-dropzone: 1800;        /* whole-window drag target — always on top   */

  /* ── Spacing ───────────────────────────────────────────────────────────
     A dense pro-tool scale: every step is EVEN — 2px steps while the gaps are
     small enough that 1px reads, 4px steps once they aren't. "No odd spacing"
     is the whole rule, which is why the scale keeps 10px rather than forcing a
     4px grid the app has never actually used.

     Adoption is partial on purpose. Roughly half these declarations predate
     the scale, and rewriting tuned pixel values in one pass with no visual
     regression coverage would risk more than it fixes, so check-tokens.js
     reports the percentage instead of failing on it. See design-system.md §5. */
  --sp-1: 2px;
  --sp-2: 4px;
  --sp-3: 6px;
  --sp-4: 8px;
  --sp-5: 10px;
  --sp-6: 12px;
  --sp-7: 16px;
  --sp-8: 20px;
  --sp-9: 24px;
  --sp-10: 32px;
}

/* ── Light theme — a soft "studio daylight" palette. Chrome only; the canvas
   render + exports are unaffected (they draw from slide data, not CSS). ──── */
:root[data-theme="light"] {
  --label-color: var(--text2);
  --on-tint-text: var(--text1);
  --accent-rgb: 41, 77, 204;
  color-scheme: light;
  /* Canonical sunken/canvas/white roles with distinct editor elevation steps. */
  --ink-950: #edf0f6;
  --ink-900: #f3f5fa;
  --ink-850: #f8f9fc;
  --ink-800: #f9fafc;
  --ink-750: #fbfcfd;
  --ink-700: #fdfdfe;
  --ink-650: #ffffff;
  /* Fields lift from canvas to white on focus, reinforced by the focus ring. */
  --field-bg: var(--ink-800);
  --field-bg-focus: var(--ink-650);

  --bg: #f8f9fc;
  --surface: #ffffff;
  --surface2: #f8f9fc;

  --line: #d6deea;
  --line-2: #b8c4d6;
  --line-3: #78839a;

  --text1: #15233d;
  --text2: #526078;
  --text3: #526078;   /* >= 4.5:1 on light panels (WCAG AA) */
  --text4: #78839a;

  --accent: #294dcc;
  --accent-bright: #193ba8;
  --accent-deep: #193ba8;
  --blue-dim: var(--accent-14);
  --accent-ring: var(--accent);
  --accent-glow: var(--accent-14);

  --green: #15803d;   /* 4.6:1 on light panels (was #16a34a, 3.02 — failed AA) */
  --amber: #78500b;   /* 4.6:1 on light panels (was #d97706, 2.92 — failed AA) */
  --red: #b91c1c;     /* 5.9:1 on light panels (was #e5484d, 3.59 — failed AA) */

  --fill-1: rgba(15, 23, 42, 0.045);
  --fill-2: rgba(15, 23, 42, 0.085);
  --fill-faint: rgba(15, 23, 42, 0.03);
  --card-bg: var(--surface);
  /* Fields are mapped once, next to the ink ramp above — a second literal
     definition here is exactly how rest and focus silently became the same
     white. If you need to retune fields, retune the ramp mapping, not this. */

  --stage: #f3f5fa;
  --stage-glow: transparent;
  --stage-dot: rgba(15, 23, 42, 0.06);
  --grain-opacity: 0;
  --grain-blend: multiply;

  --e1: 0 1px 2px rgba(15,23,42,0.10);
  --e2: 0 8px 24px rgba(15,23,42,0.12);
  --e3: 0 20px 50px rgba(15,23,42,0.18);
}

html { -webkit-text-size-adjust: 100%; }

/* Keep native number steppers available everywhere. Keyboard nudging remains
   supported, while pointer users can use the platform's up/down controls. */
input[type="number"] { appearance: auto; -moz-appearance: auto; }
input[type="number"]::-webkit-outer-spin-button,
input[type="number"]::-webkit-inner-spin-button { -webkit-appearance: auto; opacity: 1; margin: 0; }

body {
  background: var(--bg);
  color: var(--text1);
  font-family: var(--font-ui);
  font-feature-settings: 'cv01', 'ss01';
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  overflow: hidden;
  height: 100vh;
  height: 100dvh;
}

/* Legacy texture hook remains inert (--grain-opacity: 0) for quiet VF surfaces. */
body::after {
  content: '';
  position: fixed;
  inset: 0;
  z-index: var(--z-grain);
  pointer-events: none;
  opacity: var(--grain-opacity);
  mix-blend-mode: var(--grain-blend);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='140' height='140'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='2' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}

::selection { background: var(--accent-35); color: var(--text1); }

/* Consistent, calm focus ring (keyboard only). */
:focus { outline: none; }
:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
  border-radius: var(--r-xs);
}

/* Scrollbars */
* { scrollbar-width: thin; scrollbar-color: var(--line-3) transparent; }
::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--line-3); border-radius: var(--r-pill); border: 2px solid transparent; background-clip: padding-box; }
::-webkit-scrollbar-thumb:hover { background: var(--text4); background-clip: padding-box; }

/* ── Layout ─────────────────────────────────────────────────────────────── */
/* Permanent editor shell: Layers · Stage · Properties. Workflow surfaces are
   overlays and never replace a rail or change the stage geometry. */
.app {
  display: grid;
  grid-template-columns: var(--leftpanel-w) 1fr var(--inspector-w);
  grid-template-rows: var(--header-h) 1fr;
  height: 100vh;
  height: 100dvh;
  position: relative;
}
.header, .stage-shell, .main, .carousel { min-width: 0; }   /* grid items may shrink below content */

/* ── Header ─────────────────────────────────────────────────────────────── */
.header {
  grid-column: 1 / -1;
  background: var(--surface);
  border-bottom: 1px solid var(--line);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--sp-5);
  padding: 0 var(--sp-6);
  z-index: var(--z-header);
}
.header-left { display: flex; align-items: center; gap: var(--sp-5); min-width: 0; flex: 1 1 0; }
.header-left h1 {
  font-family: var(--font-display);
  font-size: 14px;
  font-weight: 650;
  letter-spacing: -0.045em;
  color: var(--text1);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.header-right { display: flex; align-items: center; gap: var(--sp-4); flex-wrap: wrap; justify-content: flex-end; flex: 1 1 0; }

/* v2 top bar — project crumb */
.tb-slash { color: var(--text4); font-size: 13px; }
.tb-project {
  appearance: none; background: none; border: none; cursor: pointer;
  display: inline-flex; align-items: center; gap: var(--sp-2);
  font-family: var(--font-ui); font-size: 13px; color: color-mix(in srgb, var(--text1) 85%, transparent);
  padding: var(--sp-2) var(--sp-3); border-radius: var(--r-xs);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 220px;
  transition: background 0.12s, color 0.12s;
}
.tb-project:hover { background: var(--fill-1); color: var(--text1); }
.tb-chev { font-size: 9px; color: var(--text3); }

/* v2 top bar — center tool strip (recessed pill) */
.tb-tools {
  display: flex; align-items: center; gap: var(--sp-1); flex: 0 0 auto;
  background: var(--fill-faint); border: 1px solid var(--line); border-radius: var(--r-md);
  padding: var(--sp-1);
}
.tb-tool {
  appearance: none; display: flex; align-items: center; justify-content: center;
  width: 34px; height: 30px; border-radius: 6px;
  border: 1px solid transparent; background: none; cursor: pointer;
  color: var(--text2); font-family: var(--font-ui); font-size: 13px;
  transition: background 0.12s, color 0.12s, border-color 0.12s;
}
.tb-tool:hover { background: var(--fill-2); color: var(--text1); }
.tb-tool.active {
  background: var(--accent-14);
  border-color: var(--accent);
  color: var(--text1);
}
.tb-tool-mono { font-family: var(--font-mono); font-weight: 600; }
.tb-tool.tb-insert { width: 43px; gap: var(--sp-1); }
.tb-tool.tb-insert span { color: var(--text3); font-size: 8px; }
.tb-sep { width: 1px; height: 18px; background: var(--line-2); margin: 0 var(--sp-2); }
.tb-tool-label {
  appearance: none; display: flex; align-items: center; height: 30px; padding: 0 var(--sp-5);
  border: none; border-radius: 6px; background: none; cursor: pointer;
  color: var(--text2); font-family: var(--font-ui); font-size: 12px; font-weight: 550;
  transition: background 0.12s, color 0.12s;
}
.tb-tool-label:hover { background: var(--fill-2); color: var(--text1); }

/* v2 top bar — store-coverage pill */
.coverage-pill {
  appearance: none; display: inline-flex; align-items: center; gap: var(--sp-3); cursor: pointer;
  font-family: var(--font-ui); font-size: 11.5px; font-weight: 550;
  border-radius: var(--r-pill); padding: var(--sp-2) var(--sp-5); white-space: nowrap;
  transition: filter 0.12s;
}
.coverage-pill:hover { filter: brightness(1.2); }
.coverage-pill.cov-neutral { color: var(--text2); background: var(--fill-faint); border: 1px solid var(--line-2); }
.coverage-pill.cov-amber { color: var(--amber); background: rgba(251,191,36,0.09); border: 1px solid rgba(251,191,36,0.35); }
.coverage-pill.cov-green { color: var(--green); background: rgba(74,222,128,0.08); border: 1px solid rgba(74,222,128,0.35); }

/* Decorative aperture brand mark (pure CSS, no image). */
.brand-mark {
  width: 22px; height: 22px; border-radius: 7px; flex-shrink: 0;
  background:
    radial-gradient(circle at 50% 50%, #fff 0 2px, transparent 3px),
    conic-gradient(from 0deg, var(--accent-deep), var(--accent-bright), var(--accent-deep));
  box-shadow: inset 0 0 0 1px rgba(255,255,255,0.25), 0 2px 10px var(--accent-glow);
  position: relative;
}
.brand-mark::before {
  content: ''; position: absolute; inset: 4px; border-radius: 4px;
  border: 1.5px solid rgba(255,255,255,0.5);
  clip-path: polygon(50% 0, 100% 25%, 100% 75%, 50% 100%, 0 75%, 0 25%);
}
#saveIndicator { font-family: var(--font-mono); font-size: 10px; letter-spacing: 0.02em; color: var(--text3); opacity: 0.5; margin-right: var(--sp-1); transition: opacity 0.3s; }
.save-failure-banner {
  position: fixed; z-index: var(--z-banner); top: calc(var(--header-h) + 8px); left: 50%; transform: translateX(-50%);
  width: min(620px, calc(100vw - 24px)); display: flex; align-items: center; gap: var(--sp-4);
  padding: var(--sp-4) var(--sp-5) var(--sp-4) var(--sp-6); border: 1px solid rgba(255,90,82,0.45); border-radius: var(--r-md);
  background: color-mix(in srgb, var(--ink-850) 96%, #7f1d1d); box-shadow: var(--e3);
  color: var(--text1); font-size: 11.5px;
}
.save-failure-banner[hidden] { display: none; }
.save-failure-banner > span { flex: 1; min-width: 0; }

/* ── Sidebar ────────────────────────────────────────────────────────────── */
.sidebar {
  /* On-demand overlay drawer at every width (v2 canvas-first shell). */
  position: fixed; top: var(--header-h); left: 0; bottom: 0;
  width: min(380px, 88vw); z-index: var(--z-modal);
  transform: translateX(-102%);
  transition: transform 0.28s var(--ease);
  box-shadow: 0 0 60px rgba(0,0,0,0.6);
  background: var(--surface);
  border-right: 1px solid var(--line);
  overflow-y: auto;
  overflow-x: hidden;
  padding: 0 var(--sp-7) 40px;
  display: flex;
  flex-direction: column;
}
.sidebar[hidden] { display: none !important; }
.app.controls-open .sidebar { transform: translateX(0); }
.drawer-backdrop { position: fixed; inset: var(--header-h) 0 0 0; background: rgba(0,0,0,0.55); backdrop-filter: blur(3px); z-index: var(--z-drawer-backdrop); }
.app.controls-open .drawer-backdrop { display: block; animation: fadeIn 0.2s var(--ease); }
#drawerClose { display: inline-flex; margin: var(--sp-5) 0 var(--sp-3); align-self: flex-end; }

/* Transitional project workflows stay available as an explicit overlay while
   their controls move into focused modals. Opening it never changes the grid. */
@media (min-width: 1024px) {
  #controlsToggle[aria-expanded="true"] {
    color: var(--on-tint-text); border-color: var(--accent-ring); background: var(--blue-dim);
  }
}

/* ── v2 left panel: slides + layers ─────────────────────────────────────── */
.leftpanel {
  grid-row: 2; grid-column: 1;
  background: var(--surface);
  border-right: 1px solid var(--line);
  display: flex; flex-direction: column; min-height: 0; min-width: 0;
  z-index: var(--z-panel);
}
.sheet-close { display: none; }
.lp-label {
  padding: var(--sp-6) var(--sp-6) var(--sp-3); flex-shrink: 0;
  font-family: var(--font-mono); font-size: var(--label-size); letter-spacing: 0.055em;
  text-transform: uppercase; color: var(--label-color);
}
.lp-slides-label { padding-top: var(--sp-2); }
.lp-tabs { display: flex; gap: var(--sp-1); padding: var(--sp-5) var(--sp-5) var(--sp-3); flex-shrink: 0; }
.lp-tab {
  appearance: none; background: none; border: none; border-radius: var(--r-xs); cursor: pointer;
  font-family: var(--font-mono); font-size: var(--label-size); letter-spacing: 0.055em; text-transform: uppercase;
  color: var(--label-color); padding: var(--sp-1) var(--sp-4);
  transition: background 0.12s, color 0.12s;
}
.lp-tab:hover { color: var(--text1); }
.lp-tab.active { background: var(--accent-14); color: var(--accent); box-shadow: inset 0 -2px var(--accent); }
.lp-asset-thumb { width: 30px; height: 30px; object-fit: cover; border-radius: 4px; flex-shrink: 0; background: #000; }
.lp-slides {
  display: flex; flex-direction: column; gap: var(--sp-1);
  padding: 0 var(--sp-5) var(--sp-5); border-bottom: 1px solid var(--line);
  overflow-y: auto; flex: 0 1 auto; max-height: 44%;
}
.lp-slide {
  appearance: none; display: flex; align-items: center; gap: var(--sp-4);
  padding: var(--sp-2) var(--sp-3); border-radius: var(--r-sm); border: 1px solid transparent;
  background: none; cursor: pointer; text-align: left; width: 100%;
  font-family: var(--font-ui);
  transition: background 0.12s, border-color 0.12s;
}
.lp-slide:hover { background: var(--fill-1); }
.lp-slide.active { background: var(--accent-14); border-color: var(--accent-ring); }
.lp-slide canvas { height: 39px; width: auto; border-radius: 2.5px; flex-shrink: 0; background: #000; display: block; }
.lp-slide-name { font-size: 12px; color: var(--text2); flex: 1; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.lp-slide.active .lp-slide-name { color: var(--text1); font-weight: 600; }
.lp-del {
  display: none; flex-shrink: 0; cursor: pointer;
  font-size: 10px; color: var(--text3); padding: var(--sp-1) var(--sp-2); border-radius: 4px;
  transition: color 0.12s, background 0.12s;
}
.lp-slide:hover .lp-del { display: inline-flex; }
.lp-del:hover { color: var(--red); background: rgba(255,90,82,0.12); }
.lp-rename {
  flex: 1; min-width: 0; font-family: var(--font-ui); font-size: 12px;
  background: var(--field-bg); color: var(--text1);
  border: 1px solid var(--accent-ring); border-radius: var(--r-xs); padding: var(--sp-1) var(--sp-3); outline: none;
}
.lp-add {
  appearance: none; display: flex; align-items: center; gap: var(--sp-4);
  padding: var(--sp-3); border-radius: var(--r-sm); border: none; background: none;
  color: var(--text3); font-family: var(--font-ui); font-size: 12px; cursor: pointer; text-align: left; width: 100%;
  transition: background 0.12s, color 0.12s;
}
.lp-add:hover { background: var(--fill-1); color: var(--text1); }
.lp-add em { font-style: normal; margin-left: auto; font-family: var(--font-mono); font-size: 9.5px; opacity: 0.6; }
.lp-layers { display: flex; flex-direction: column; padding: 0 var(--sp-5); overflow-y: auto; flex: 1 1 auto; min-height: 0; }
.lp-layer {
  display: flex; align-items: center; gap: var(--sp-4);
  padding: var(--sp-2) var(--sp-3); border-radius: 6px; border-left: 2px solid transparent;
  color: var(--text2); font-size: 12px; cursor: pointer;
  position: relative;
  transition: background 0.12s, color 0.12s, opacity 0.12s;
}
.lp-layer:hover { background: var(--fill-1); }
.lp-layer.sel { border-left-color: var(--accent); background: var(--accent-14); color: var(--text1); }
.lp-layer.inactive { opacity: 0.45; }
.lp-layer[draggable="true"] { cursor: grab; }
.lp-layer.dragging { opacity: 0.35; cursor: grabbing; }
.lp-layer.drop-above::before, .lp-layer.drop-below::after {
  content: ''; position: absolute; z-index: 2; left: 5px; right: 5px; height: 2px;
  border-radius: 2px; background: var(--accent); box-shadow: 0 0 0 1px var(--ink-900);
}
.lp-layer.drop-above::before { top: -2px; }
.lp-layer.drop-below::after { bottom: -2px; }
.lp-glyph { font-family: var(--font-mono); font-size: 10px; color: var(--text3); width: 14px; text-align: center; flex-shrink: 0; }
.lp-name { flex: 1; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.lp-acts { margin-left: auto; display: none; gap: var(--sp-1); flex-shrink: 0; }
.lp-layer:hover .lp-acts, .lp-acts.on { display: inline-flex; }
.lp-act { appearance: none; background: none; border: none; cursor: pointer; font-size: 10px; padding: 0 var(--sp-1); opacity: 0.75; }
.lp-act:hover { opacity: 1; }
.lp-drag-hint { padding: var(--sp-2) var(--sp-3) var(--sp-4); color: var(--text3); font-size: 10px; line-height: 1.45; }
.lp-section-intro { padding: var(--sp-1) var(--sp-3) var(--sp-4); color: var(--text3); font-size: 10.5px; line-height: 1.45; }
.lp-section-intro strong { display: block; margin-bottom: var(--sp-1); color: var(--text2); font-size: 11px; }
.lp-kit-apply { margin: var(--sp-4) 0; padding: var(--sp-5); border: 1px solid var(--line-2); border-radius: var(--r-sm); background: var(--fill-faint); }
.lp-kit-apply > strong { display: block; margin-bottom: var(--sp-1); color: var(--text1); font-size: 12px; }
.lp-kit-summary { margin-bottom: var(--sp-4); color: var(--text3); font-size: 10px; line-height: 1.45; }
.lp-kit-option { display: flex; align-items: flex-start; gap: var(--sp-4); padding: var(--sp-2) 0; color: var(--text2); font-size: 10.5px; cursor: pointer; }
.lp-kit-option input { margin: 1px 0 0; accent-color: var(--accent); }
.lp-kit-option span { min-width: 0; line-height: 1.35; }
.lp-kit-option small { display: block; margin-top: 1px; color: var(--text3); font-size: 9.5px; }
.lp-kit-actions { display: grid; grid-template-columns: 1fr 1fr; gap: var(--sp-2); margin-top: var(--sp-4); }
/* First-run checklist rows (replace the layers list on fresh projects) */
.lp-step {
  appearance: none; display: flex; align-items: center; gap: var(--sp-4);
  padding: var(--sp-3) var(--sp-3); border-radius: 6px; border: none; background: none;
  color: var(--text2); font-family: var(--font-ui); font-size: 11.5px; cursor: pointer;
  text-align: left; width: 100%;
  transition: background 0.12s, color 0.12s;
}
.lp-step:hover { background: var(--fill-1); color: var(--text1); }
.lp-step-chip {
  width: 20px; height: 20px; border-radius: 50%; flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
  font-family: var(--font-mono); font-size: 10px;
  border: 1px solid var(--line-3); color: var(--text3);
}
.lp-step.active .lp-step-chip { background: var(--btn-p-from); border-color: var(--btn-p-from); color: #fff; }
.lp-step.done { color: var(--text3); }
.lp-step.done .lp-step-chip { color: var(--green); border-color: rgba(74,222,128,0.4); }
.lp-step-label { flex: 1; line-height: 1.35; }

.lp-foot {
  margin-top: auto; padding: var(--sp-5) var(--sp-6); border-top: 1px solid var(--line); flex-shrink: 0;
  font-size: 10.5px; line-height: 1.55; color: var(--text3);
}

/* The old Callouts panel retains its action hooks until all callers migrate,
   but its second rendered tree is retired. The permanent #lpLayers tree owns
   object visibility, lock, order and selection. */
.legacy-layer-controls .layer-list,
.legacy-layer-controls .drop-lbl { display: none !important; }

/* ── v2 right inspector: contextual properties ──────────────────────────── */
.inspector {
  grid-row: 2; grid-column: 3;
  background: var(--surface);
  border-left: 1px solid var(--line);
  display: flex; flex-direction: column; min-height: 0; min-width: 0;
  overflow-y: auto;
  z-index: var(--z-panel);
}
.insp-head {
  padding: var(--sp-6) var(--sp-7); border-bottom: 1px solid var(--line);
  display: flex; align-items: center; gap: var(--sp-4); flex-shrink: 0;
}
.insp-chip {
  font-family: var(--font-mono); font-size: 10px; color: var(--text2);
  background: var(--fill-1); border: 1px solid var(--line-2); border-radius: var(--r-xs);
  padding: 1px var(--sp-3); flex-shrink: 0;
}
.insp-title { font-size: 13px; font-weight: 650; color: var(--text1); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.insp-lock {
  appearance: none; margin-left: auto; background: none; border: none; cursor: pointer;
  font-size: 12px; opacity: 0.75; flex-shrink: 0;
}
.insp-lock:hover { opacity: 1; }
.insp-sec { padding: var(--sp-6) var(--sp-7); border-bottom: 1px solid var(--line); display: flex; flex-direction: column; gap: var(--sp-4); }
.insp-label {
  font-family: var(--font-mono); font-size: var(--label-size); letter-spacing: 0.055em;
  text-transform: uppercase; color: var(--label-color);
}
.insp-sec textarea, .insp-sec input[type="text"] {
  width: 100%; box-sizing: border-box;
  background: var(--field-bg); border: 1px solid var(--line-2); border-radius: var(--r-sm);
  padding: var(--sp-4) var(--sp-5); font-size: 12.5px; line-height: 1.5; color: var(--text1);
  font-family: var(--font-ui); resize: vertical; outline: none;
}
.insp-sec textarea:focus, .insp-sec input[type="text"]:focus { border-color: var(--accent-ring); }
.insp-help { font-size: 10.5px; line-height: 1.5; color: var(--text3); }
.insp-scope-warning {
  padding: var(--sp-4) var(--sp-4); border: 1px solid color-mix(in srgb, var(--amber) 38%, var(--line-2));
  border-radius: var(--r-xs); background: color-mix(in srgb, var(--amber) 8%, transparent);
  color: var(--text2); font-size: 10.5px; line-height: 1.45;
}
.insp-scope-warning strong { display: block; margin-bottom: var(--sp-1); color: var(--amber); font-weight: 650; }
.insp-scope-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--sp-3); }
.insp-scope-grid > label { display: flex; min-width: 0; flex-direction: column; gap: var(--sp-2); color: var(--text3); font: 9px var(--font-ui); }
.insp-scope-grid .insp-scope { min-width: 0; }
/* Informational, not actionable — so it stays quiet. The filled accent tint
   (--accent-14 + --accent-55) is reserved for SELECTED and actionable things;
   a status box wearing it competes with the primary Export button for the
   eye. A left accent rule keeps its identity without the weight. Matches the
   .insp-override-policy treatment so both info blocks read alike. */
.insp-scope-summary {
  display: flex; flex-direction: column; gap: var(--sp-1); padding: var(--sp-4) var(--sp-4) var(--sp-4) var(--sp-5);
  border: 1px solid var(--line-2); border-left: 2px solid var(--accent-55);
  border-radius: var(--r-xs); background: var(--fill-faint);
}
.insp-scope-summary strong { color: var(--text1); font-size: 10.5px; font-weight: 650; }
.insp-scope-summary span { color: var(--text3); font: 9.5px/1.35 var(--font-ui); }
.insp-override-policy {
  display: flex; flex-direction: column; gap: var(--sp-3); padding: var(--sp-4);
  border: 1px solid var(--line-2); border-radius: var(--r-xs); background: var(--fill-faint);
}
.insp-override-policy > strong { color: var(--text1); font-size: 10.5px; font-weight: 650; }
.insp-override-policy > span { color: var(--text3); font-size: 10px; line-height: 1.45; }
.insp-override-policy .insp-chipbtn { flex: 1 1 112px; min-height: 28px; }
.insp-row { display: flex; align-items: center; justify-content: space-between; gap: var(--sp-4); font-size: 11.5px; color: var(--text2); }
.insp-val { font-family: var(--font-mono); font-size: 11px; color: var(--text1); }
.insp-sec input[type="range"] { width: 100%; accent-color: var(--accent); height: 4px; cursor: pointer; }
.insp-geom-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--sp-3); }
.insp-num-field {
  display: grid; grid-template-columns: 22px minmax(0, 1fr); align-items: center;
  min-width: 0; height: 30px; border: 1px solid var(--line-2); border-radius: var(--r-xs);
  background: var(--field-bg); overflow: hidden;
}
.insp-num-label {
  display: grid; place-items: center; align-self: stretch; cursor: ew-resize;
  color: var(--text3); font: 600 9.5px var(--font-mono); background: var(--fill-faint);
  border-right: 1px solid var(--line);
}
.insp-num-field input[type="number"] {
  width: 100%; min-width: 0; height: 100%; padding: 0 var(--sp-3); border: 0; outline: 0;
  background: transparent; color: var(--text1); font: 11px var(--font-mono);
  font-variant-numeric: tabular-nums; appearance: auto; -moz-appearance: auto;
}
.insp-num-field input[type="number"]::-webkit-outer-spin-button,
.insp-num-field input[type="number"]::-webkit-inner-spin-button { -webkit-appearance: auto; opacity: 1; margin: 0; }
.insp-num-field:focus-within { border-color: var(--accent-ring); box-shadow: 0 0 0 2px var(--blue-dim); }
.insp-guide-meta { display: grid; grid-template-columns: 1fr auto; gap: var(--sp-3); align-items: center; }
.insp-chips { display: flex; flex-wrap: wrap; gap: var(--sp-2); }
/* ── COMPONENT: chip ────────────────────────────────────────────────────────
   One selectable option inside a group (background modes, alignment, fill,
   frame styles, quick actions). States: default · :hover · .on (selected) ·
   :disabled · .insp-danger (destructive hover). Focus ring is global.
   `.insp-chipbtn` and `.bg-mode-btn` are legacy aliases kept so ~57 existing
   call sites need no DOM churn — all three share ONE set of declarations. */
.chip, .insp-chipbtn, .bg-mode-btn {
  appearance: none; font-family: var(--font-ui);
  font-size: 10.5px; font-weight: 550;
  padding: var(--sp-2) var(--sp-5); border-radius: var(--r-xs); cursor: pointer;
  /* The AA floor is a structural guarantee, not padding arithmetic: when the
     spacing migration tightened vertical padding 5px -> 4px, chips landed at
     23px and failed SC 2.5.8. min-height means padding can move on-scale
     without the component ever dipping below its floor again. */
  min-height: var(--hit-min);
  display: inline-flex; align-items: center; justify-content: center;
  background: var(--fill-1); border: 1px solid transparent; color: var(--text2);
  transition: background 0.12s, color 0.12s, border-color 0.12s, transform 0.06s;
}
.chip:hover, .insp-chipbtn:hover, .bg-mode-btn:hover { background: var(--fill-2); color: var(--text1); }
.chip:active, .insp-chipbtn:active, .bg-mode-btn:active { transform: translateY(1px); }
.chip.on, .insp-chipbtn.on, .bg-mode-btn.on { background: var(--accent-20); border-color: var(--accent-55); color: var(--on-tint-text); }
.chip:disabled, .insp-chipbtn:disabled, .bg-mode-btn:disabled { opacity: 0.4; cursor: default; transform: none; }
.chip.insp-danger:hover, .insp-chipbtn.insp-danger:hover { background: rgba(255,90,82,0.15); color: var(--red); }
.insp-preset-grid {
  display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--sp-3);
}
.insp-preset-btn {
  appearance: none; display: grid; grid-template-columns: 28px minmax(0, 1fr); align-items: center; gap: var(--sp-3);
  min-width: 0; padding: var(--sp-2); border: 1px solid var(--line-2); border-radius: var(--r-sm);
  background: var(--fill-faint); color: var(--text2); cursor: pointer; text-align: left;
}
.insp-preset-btn:hover { border-color: var(--line-3); color: var(--text1); }
.insp-preset-btn.on { border-color: var(--accent-ring); background: var(--blue-dim); color: var(--on-tint-text); }
.insp-preset-btn > span { display: block; width: 28px; height: 22px; border-radius: 5px; box-shadow: inset 0 0 0 1px rgba(255,255,255,.16); }
.insp-preset-btn > em { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font: 10.5px var(--font-ui); font-style: normal; }
.insp-field-label { display: flex; flex-direction: column; gap: var(--sp-2); color: var(--text3); font: 10px var(--font-ui); }
.insp-link {
  appearance: none; background: none; border: none; cursor: pointer; padding: 0;
  font-family: var(--font-ui); font-size: 11px; font-weight: 550; color: var(--accent-bright); text-align: left;
}
.insp-link:hover { color: var(--text1); }
.insp-link.insp-scope-shortcut {
  min-height: 32px; padding: var(--sp-3) var(--sp-4); border: 1px solid var(--accent-ring); border-radius: var(--r-xs);
  background: var(--blue-dim); color: var(--on-tint-text); text-align: center;
}
.insp-link.insp-scope-shortcut:hover, .insp-link.is-active { border-color: var(--accent); background: var(--accent-20); color: var(--on-tint-text); }
.insp-sw {
  appearance: none; width: 18px; height: 18px; border-radius: 50%; cursor: pointer;
  border: 1px solid rgba(255,255,255,0.2); padding: 0;
  transition: box-shadow 0.12s;
}
.insp-sw.on { box-shadow: 0 0 0 2px var(--ink-900), 0 0 0 4px var(--accent); }
.insp-hex {
  width: 84px !important; font-family: var(--font-mono) !important; font-size: 11px !important;
  padding: var(--sp-2) var(--sp-3) !important; text-transform: lowercase;
}
.insp-dot { width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0; }
.insp-dot.green { background: var(--green); }
.insp-dot.amber { background: var(--amber); }
.insp-scope {
  width: 100%; font-family: var(--font-ui); font-size: 11.5px; color: var(--text1);
  background: var(--field-bg); border: 1px solid var(--line-2); border-radius: var(--r-xs); padding: var(--sp-2) var(--sp-3);
}
.insp-weight-select { width: 92px; flex: 0 0 92px; font-family: var(--font-mono); font-variant-numeric: tabular-nums; }
.insp-details { border-bottom: 1px solid var(--line); }
.insp-details summary {
  padding: var(--sp-6) var(--sp-7); cursor: pointer; list-style: none;
  font-family: var(--font-mono); font-size: var(--label-size); letter-spacing: 0.055em;
  text-transform: uppercase; color: var(--label-color);
}
.insp-details summary::before { content: '▸ '; }
.insp-details[open] summary::before { content: '▾ '; }
.insp-details summary:hover { color: var(--text1); }
.insp-dsec { padding: 0 14px var(--sp-6); display: flex; flex-direction: column; gap: var(--sp-4); }

.insp-foot {
  margin-top: auto; padding: var(--sp-5) 14px; border-top: 1px solid var(--line); flex-shrink: 0;
  font-size: 10.5px; color: var(--text3);
}
.insp-foot kbd {
  font-family: var(--font-mono); font-size: 9.5px; background: var(--fill-2);
  border: 1px solid var(--line-3); border-radius: 4px; padding: 1px var(--sp-2);
}
.mobile-insp-close { display: none; }
/* Shared selection actions continue the contextual inspector as normal sections. */
#selInspector { padding: 0; }

.lp-assets-actions { padding: var(--sp-3); border-top: 1px solid var(--line); }
.lp-assets-actions .insp-label { margin-bottom: var(--sp-3); }
.lp-assets-actions .insp-chips { gap: var(--sp-2); }
.lp-asset-organizer { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: var(--sp-3); align-items: end; padding: 0 var(--sp-3) var(--sp-4); }
.lp-asset-organizer label { display: flex; flex-direction: column; gap: var(--sp-2); color: var(--text3); font: 9px var(--font-mono); letter-spacing: .07em; text-transform: uppercase; }
.lp-asset-organizer select { width: 100%; min-width: 0; height: 30px; padding: 0 var(--sp-9) 0 var(--sp-3); border: 1px solid var(--line-2); border-radius: var(--r-xs); background: var(--field-bg); color: var(--text1); font: 11px var(--font-ui); }
.lp-asset-organizer .insp-chipbtn { height: 30px; white-space: nowrap; }
.lp-folder-create { padding: 0 var(--sp-3) var(--sp-4); }
.lp-folder-create .lp-rename { width: 100%; height: 30px; }
.lp-asset-folders { display: flex; flex-direction: column; gap: var(--sp-1); padding: 0 0 var(--sp-3); }
.lp-asset-folder { border: 1px solid transparent; border-radius: var(--r-sm); }
.lp-asset-folder-head { display: flex; align-items: center; gap: var(--sp-2); min-height: 28px; padding: var(--sp-1) var(--sp-2); border: 1px solid transparent; border-radius: 6px; color: var(--text2); }
.lp-asset-folder-head:hover { background: var(--fill-faint); color: var(--text1); }
.lp-asset-folder-head.drop-folder { border-color: var(--accent); background: var(--blue-dim); box-shadow: inset 0 0 0 1px var(--accent-ring); }
.lp-asset-folder-toggle, .lp-asset-folder-menu { appearance: none; flex: 0 0 auto; border: 0; border-radius: 4px; background: transparent; color: var(--text3); cursor: pointer; font: 11px var(--font-ui); }
.lp-asset-folder-toggle { width: 20px; height: 22px; padding: 0; }
.lp-asset-folder-menu { min-width: 25px; height: 22px; padding: 0 var(--sp-2); opacity: 0; }
.lp-asset-folder-head:hover .lp-asset-folder-menu, .lp-asset-folder-menu:focus-visible { opacity: 1; }
.lp-asset-folder-name { min-width: 0; flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; cursor: pointer; font-size: 11px; font-weight: 600; }
.lp-asset-folder-count { flex: 0 0 auto; color: var(--text4); font: 9px var(--font-mono); }
.lp-asset-folder-body { display: flex; flex-direction: column; gap: var(--sp-1); padding: 1px 0 var(--sp-2) var(--sp-6); }
.lp-asset-folder-body[hidden] { display: none; }
.lp-asset-folder-empty { margin: var(--sp-1) var(--sp-2) var(--sp-1); padding: var(--sp-4); border: 1px dashed var(--line-2); border-radius: 6px; color: var(--text4); text-align: center; font-size: 9.5px; }
.lp-asset-row { position: relative; }
.lp-asset-copy { display: flex; flex: 1; min-width: 0; flex-direction: column; gap: var(--sp-1); }
.lp-asset-copy .lp-slide-name { display: block; width: 100%; flex: 0 0 auto; font-size: 11.5px; }
.lp-asset-meta { display: flex; align-items: center; min-width: 0; gap: var(--sp-2); line-height: 1; }
.lp-asset-row .lp-asset-type { flex: 0 1 auto; max-width: 64px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--text4); font: 8.5px var(--font-mono); }
.lp-asset-usage-status { flex: 0 1 auto; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font: 8.5px var(--font-ui); }
.lp-asset-usage-status.used { color: var(--accent-bright); }
.lp-asset-usage-status.referenced { color: var(--amber); }
.lp-asset-usage-status.unused { color: var(--text4); }
.lp-asset-usage-status::before { content: ''; display: inline-block; width: 5px; height: 5px; margin-right: var(--sp-2); border-radius: 50%; background: currentColor; vertical-align: 1px; }
.lp-asset-preview-btn { appearance: none; display: none; flex: 0 0 auto; width: 24px; height: 24px; padding: 0; border: 1px solid var(--line-2); border-radius: 5px; background: var(--surface2); color: var(--text2); cursor: pointer; font: 11px var(--font-mono); }
.lp-asset-row:hover .lp-asset-preview-btn, .lp-asset-preview-btn:focus-visible { display: inline-flex; align-items: center; justify-content: center; }
.lp-asset-row.drop-before::before, .lp-asset-row.drop-after::after { content: ''; position: absolute; z-index: 3; left: 4px; right: 4px; height: 2px; border-radius: 2px; background: var(--accent); box-shadow: 0 0 0 1px var(--ink-900); }
.lp-asset-row.drop-before::before { top: -2px; }
.lp-asset-row.drop-after::after { bottom: -2px; }
.lp-kit-list { display: flex; flex-direction: column; gap: var(--sp-1); padding: var(--sp-2) var(--sp-3); }
.lp-kit {
  appearance: none; width: 100%; display: flex; align-items: center; gap: var(--sp-4);
  border: 1px solid transparent; border-radius: var(--r-sm); background: transparent;
  padding: var(--sp-3); color: var(--text2); text-align: left; cursor: pointer;
}
.lp-kit:hover { background: var(--fill-faint); color: var(--text1); }
.lp-kit.active { border-color: var(--accent-ring); background: var(--blue-dim); color: var(--text1); }
.lp-kit > span:last-child { min-width: 0; display: flex; flex-direction: column; gap: var(--sp-1); }
.lp-kit strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font: 600 11.5px var(--font-ui); }
.lp-kit small { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font: 9.5px var(--font-ui); color: var(--text3); }
.lp-kit-swatches { display: flex; flex: 0 0 auto; overflow: hidden; width: 36px; height: 25px; border: 1px solid var(--line-2); border-radius: 6px; }
.lp-kit-swatches i { display: block; flex: 1; }

/* ── v2 popovers: coverage, export menu, preflight ──────────────────────── */
.popover {
  position: fixed; z-index: var(--z-popover);
  width: 300px; max-height: min(70vh, 520px); overflow-y: auto;
  background: var(--surface);
  border: 1px solid var(--line-2); border-radius: var(--r-md);
  box-shadow: var(--e3);
  padding: var(--sp-6); display: flex; flex-direction: column; gap: var(--sp-4);
  backdrop-filter: blur(16px);
}
.popover[hidden] { display: none; }
.pop-coverage { top: calc(var(--header-h) - 4px); right: 108px; }
.pop-export { top: calc(var(--header-h) - 4px); right: 12px; width: 280px; padding: var(--sp-4); gap: var(--sp-1); }
.pop-insert { top: calc(var(--header-h) - 4px); left: 50%; width: 220px; padding: var(--sp-4); gap: var(--sp-1); transform: translateX(-50%); }
.pop-preflight { bottom: 58px; right: calc(var(--inspector-w) + 16px); }
.pop-head { display: flex; align-items: center; justify-content: space-between; gap: var(--sp-4); font-size: 13px; font-weight: 650; color: var(--text1); }
.pop-head select {
  font-family: var(--font-ui); font-size: 11px; color: var(--text2);
  background: var(--field-bg); border: 1px solid var(--line-2); border-radius: var(--r-xs); padding: var(--sp-1) var(--sp-2); max-width: 160px;
}
.pop-rows { display: flex; flex-direction: column; gap: var(--sp-3); }
.pop-row { display: flex; align-items: center; gap: var(--sp-4); font-size: 12px; color: var(--text1); }
.pop-row.missing { color: var(--text2); }
.pop-glyph { width: 13px; text-align: center; flex-shrink: 0; }
.pop-glyph.ok { color: var(--green); }
.pop-glyph.warn { color: var(--amber); }
.pop-glyph.dim { color: var(--text3); }
.pop-label { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pop-req {
  font-style: normal; font-family: var(--font-mono); font-size: 8.5px; letter-spacing: 0.06em; text-transform: uppercase;
  color: var(--text3); border: 1px solid var(--line-2); border-radius: 4px; padding: 1px var(--sp-2); flex-shrink: 0;
}
.pop-row:not(.missing) .pop-req { color: var(--green); border-color: rgba(74,222,128,0.35); }
.pop-dims { margin-left: auto; font-family: var(--font-mono); font-size: 9.5px; color: var(--text3); flex-shrink: 0; }
.pop-note { font-size: 11px; line-height: 1.5; color: var(--text3); }
.pop-cta {
  appearance: none; font-family: var(--font-ui); font-size: 11.5px; font-weight: 600; color: var(--on-tint-text);
  background: var(--accent-20); border: 1px solid var(--accent-55); border-radius: var(--r-sm);
  padding: var(--sp-4) 0; cursor: pointer; transition: background 0.12s;
}
.pop-cta:hover { background: var(--accent-35); }
.pop-covered {
  font-size: 11.5px; font-weight: 550; color: var(--green); text-align: center;
  background: rgba(74,222,128,0.08); border: 1px solid rgba(74,222,128,0.35); border-radius: var(--r-sm); padding: var(--sp-4) 0;
}
.menu-item {
  appearance: none; display: flex; align-items: center; gap: var(--sp-4);
  padding: var(--sp-4) var(--sp-5); border-radius: var(--r-sm); border: none; background: none; cursor: pointer;
  font-family: var(--font-ui); font-size: 12.5px; color: var(--text2); text-align: left; width: 100%;
  transition: background 0.12s, color 0.12s;
}
.menu-item:hover { background: var(--fill-1); color: var(--text1); }
.menu-item.primary { color: var(--text1); font-weight: 550; }
.menu-item.primary:hover { background: var(--accent-14); }
.menu-item em { font-style: normal; margin-left: auto; font-family: var(--font-mono); font-size: 9.5px; color: var(--text3); }
.menu-sep { border-top: 1px solid var(--line); margin: var(--sp-2) var(--sp-1); }
.menu-label { padding: var(--sp-2) var(--sp-4) var(--sp-1); color: var(--text4); font: 8.5px var(--font-mono); letter-spacing: .1em; text-transform: uppercase; }
.menu-note { padding: var(--sp-3) var(--sp-5); font-size: 10.5px; line-height: 1.5; color: var(--text3); }
.insert-group-label { padding: var(--sp-3) var(--sp-5) var(--sp-2); color: var(--text3); font: 9px var(--font-mono); letter-spacing: .1em; text-transform: uppercase; }
.insert-shape-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: var(--sp-2); padding: var(--sp-1) var(--sp-3) var(--sp-3); }
.insert-shape-option { appearance: none; min-height: 34px; padding: var(--sp-2) var(--sp-3); border: 1px solid var(--line-2); border-radius: 6px; background: var(--fill-faint); color: var(--text2); font: 10.5px var(--font-ui); cursor: pointer; }
.insert-shape-option:hover { border-color: var(--accent-ring); background: var(--blue-dim); color: var(--text1); }
.menu-readiness { margin: 1px var(--sp-2) var(--sp-3); padding: var(--sp-3) var(--sp-4); border-radius: var(--r-sm); border: 1px solid rgba(251,191,36,0.35); background: rgba(251,191,36,0.07); color: var(--amber); font-size: 10.5px; font-weight: 600; }
.menu-readiness.ready { border-color: rgba(74,222,128,0.35); background: rgba(74,222,128,0.07); color: var(--green); }

/* ── v2 stage pills: safe areas + preflight ─────────────────────────────── */
.stage-pills {
  position: absolute; z-index: var(--z-canvas-ui);
  bottom: 16px; right: 16px;
  display: flex; align-items: center; gap: var(--sp-4);
}
.stage-pill {
  appearance: none; display: inline-flex; align-items: center; gap: var(--sp-3); cursor: pointer;
  background: color-mix(in srgb, var(--surface2) 92%, transparent);
  border: 1px solid var(--line-2); border-radius: var(--r-pill); padding: var(--sp-3) var(--sp-6);
  font-family: var(--font-ui); font-size: 11.5px; font-weight: 550; color: var(--text2);
  backdrop-filter: blur(10px); box-shadow: var(--e1);
  transition: color 0.12s, border-color 0.12s;
}
.stage-pill:hover { color: var(--text1); }
.stage-pill.on { color: var(--green); border-color: rgba(74,222,128,0.4); }
.pf-dot { width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0; }
.stage-pill.pf-ok .pf-dot { background: var(--green); box-shadow: 0 0 8px rgba(74,222,128,0.5); }
.stage-pill.pf-warn { border-color: rgba(251,191,36,0.35); }
.stage-pill.pf-warn .pf-dot { background: var(--amber); box-shadow: 0 0 8px rgba(251,191,36,0.5); }
.stage-pill.pf-error { border-color: rgba(255,90,82,0.4); }
.stage-pill.pf-error .pf-dot { background: var(--red); box-shadow: 0 0 8px rgba(255,90,82,0.5); }

/* ── v2 command palette (⌘K) ────────────────────────────────────────────── */
.tb-kbd {
  font-style: normal; font-family: var(--font-mono); font-size: 9.5px;
  background: var(--fill-2); border: 1px solid var(--line-3); border-radius: 4px; padding: 1px var(--sp-2); margin-left: var(--sp-2);
}
.cmdk-backdrop { position: fixed; inset: 0; z-index: var(--z-modal-backdrop); background: rgba(0,0,0,0.5); backdrop-filter: blur(3px); }
.cmdk-backdrop[hidden] { display: none; }
.cmdk {
  position: fixed; z-index: var(--z-modal);
  top: 16vh; left: 50%; transform: translateX(-50%);
  width: min(560px, 92vw); max-height: 60vh;
  background: var(--surface);
  border: 1px solid var(--line-2); border-radius: var(--r-lg);
  box-shadow: var(--e3);
  display: flex; flex-direction: column; overflow: hidden;
  backdrop-filter: blur(16px);
}
.cmdk[hidden] { display: none; }
.cmdk input {
  width: 100%; box-sizing: border-box; background: none; border: none; outline: none;
  border-bottom: 1px solid var(--line);
  padding: 14px var(--sp-7); font-family: var(--font-ui); font-size: 14px; color: var(--text1);
}
.cmdk-list { overflow-y: auto; padding: var(--sp-3); display: flex; flex-direction: column; gap: 1px; }
.cmdk-row {
  display: flex; align-items: center; gap: var(--sp-5);
  padding: var(--sp-4) var(--sp-5); border-radius: var(--r-sm); cursor: pointer;
  font-size: 13px; color: var(--text2);
}
.cmdk-row:hover { background: var(--fill-1); color: var(--text1); }
.cmdk-row.sel { background: var(--accent-14); color: var(--text1); }
.cmdk-icon { width: 18px; text-align: center; flex-shrink: 0; font-size: 12px; color: var(--text3); }
.cmdk-label { flex: 1; min-width: 0; }
.cmdk-row kbd {
  font-family: var(--font-mono); font-size: 9.5px; color: var(--text3);
  background: var(--fill-2); border: 1px solid var(--line-3); border-radius: 4px; padding: 1px var(--sp-3);
}
.cmdk-empty { padding: 18px; text-align: center; font-size: 12px; color: var(--text3); }

/* ── v2.2 devices & artboards modal + project menu ──────────────────────── */
.dmodal {
  position: fixed; z-index: var(--z-modal);
  top: 8vh; left: 50%; transform: translateX(-50%);
  width: min(640px, 94vw); max-height: 82vh;
  background: var(--surface);
  border: 1px solid var(--line-2); border-radius: var(--r-lg);
  box-shadow: var(--e3);
  display: flex; flex-direction: column; overflow: hidden;
  backdrop-filter: blur(16px);
}
.dmodal[hidden] { display: none; }
.dmodal-head {
  display: flex; align-items: center; justify-content: space-between; gap: var(--sp-5);
  padding: var(--sp-6) var(--sp-7); border-bottom: 1px solid var(--line); flex-shrink: 0;
  font-family: var(--font-display); font-size: 15px; font-weight: 700; color: var(--text1);
}
.dmodal-head h2 { margin: 0; color: inherit; font: inherit; }
.dmodal-body { overflow-y: auto; padding: var(--sp-2) var(--sp-7) var(--sp-8); }
.dmodal-body .panel.in-modal.active { display: flex; }
.guides-modal { width: min(680px, 94vw); }
.guide-manager { display: flex; flex-direction: column; gap: 14px; padding-top: var(--sp-6); }
.guide-snap-panel { padding: var(--sp-6); border: 1px solid var(--accent-ring); border-radius: var(--r-md); background: var(--blue-dim); }
.guide-snap-head { display: flex; align-items: center; justify-content: space-between; gap: var(--sp-6); margin-bottom: var(--sp-4); }
.guide-snap-head strong { display: block; color: var(--text1); font-size: 12.5px; }
.guide-snap-head span { display: block; margin-top: var(--sp-1); color: var(--text2); font-size: 10.5px; }
.guide-snap-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 18px; }
.guide-snap-grid .settings-pref-row { min-height: 38px; padding: var(--sp-3) 0; }
.guide-snap-grid .settings-pref-copy strong { font-size: 11.5px; }
.guide-snap-grid .settings-pref-copy span { font-size: 9.5px; }
.grid-axis-settings { display: flex; flex-direction: column; gap: 0; margin-top: var(--sp-3); border: 1px solid var(--line); border-radius: var(--r-sm); overflow: hidden; background: var(--fill-faint); }
.grid-axis-row { display: grid; grid-template-columns: minmax(140px, 1fr) 102px 102px; gap: var(--sp-4); align-items: end; padding: var(--sp-5); border-bottom: 1px solid var(--line); }
.grid-axis-copy strong { display: block; color: var(--text1); font-size: 11.5px; }
.grid-axis-copy span { display: block; margin-top: var(--sp-1); color: var(--text3); font-size: 9.5px; line-height: 1.35; }
.grid-pixel-field { display: grid; grid-template-columns: 1fr auto; gap: var(--sp-1) var(--sp-2); align-items: center; color: var(--text3); font: 9px var(--font-mono); }
.grid-pixel-field > span { grid-column: 1 / -1; text-transform: uppercase; letter-spacing: .06em; }
.grid-pixel-field input { width: 100%; min-width: 0; box-sizing: border-box; padding: var(--sp-3) var(--sp-3); border: 1px solid var(--line-2); border-radius: 6px; background: var(--field-bg); color: var(--text1); font: 11.5px var(--font-mono); text-align: right; }
.grid-pixel-field b { color: var(--text3); font-size: 9px; font-weight: 500; }
.grid-axis-settings > p { margin: 0; padding: var(--sp-4) var(--sp-5); color: var(--text3); font-size: 9.5px; line-height: 1.4; }
.grid-axis-settings.compact { margin-top: var(--sp-4); }
.grid-axis-settings.compact .grid-axis-row { grid-template-columns: minmax(150px, 1fr) 92px 92px; padding: var(--sp-4); }
.guide-grid-size { display: flex; align-items: center; gap: var(--sp-3); padding-top: var(--sp-4); border-top: 1px solid var(--line); color: var(--text2); font-size: 10.5px; }
.guide-grid-size input { width: 72px; margin-left: auto; padding: var(--sp-3) var(--sp-4); border: 1px solid var(--line-2); border-radius: 6px; background: var(--field-bg); color: var(--text1); font: 11.5px var(--font-mono); text-align: right; }
.guide-grid-size b { color: var(--text2); font-size: 10px; font-weight: 500; }
.guide-manager-head { display: grid; grid-template-columns: minmax(0, 1fr) minmax(160px, 0.7fr) minmax(180px, 0.8fr); gap: var(--sp-5); align-items: end; }
.guide-manager-title strong { display: block; font-size: 13px; color: var(--text1); }
.guide-manager-title span { display: block; margin-top: var(--sp-1); font-size: 10.5px; line-height: 1.45; color: var(--text3); }
.guide-scope { display: flex; flex-direction: column; gap: var(--sp-2); font-size: 10px; color: var(--text3); }
.guide-scope select { width: 100%; padding: var(--sp-4) var(--sp-4); border: 1px solid var(--line-2); border-radius: var(--r-sm); background: var(--field-bg); color: var(--text1); }
.guide-add { display: flex; gap: var(--sp-3); flex-wrap: wrap; }
.guide-bulk { display: flex; align-items: center; gap: var(--sp-3); flex-wrap: wrap; }
.guide-bulk > span { margin-right: auto; color: var(--text3); font: 9.5px var(--font-mono); text-transform: uppercase; letter-spacing: .08em; }
.guide-list { display: flex; flex-direction: column; gap: var(--sp-3); }
.guide-row { display: grid; grid-template-columns: 28px minmax(0, 1fr) 108px 38px 38px; gap: var(--sp-3); align-items: center; padding: var(--sp-4); border: 1px solid var(--line); border-radius: var(--r-sm); background: var(--fill-faint); }
.guide-axis { appearance:none; width: 28px; height: 28px; display: grid; place-items: center; border-radius: 6px; border:1px solid transparent; background: var(--blue-dim); color: var(--accent-bright); font: 700 14px var(--font-mono); cursor:pointer; }
.guide-axis:hover { border-color:var(--accent-ring); }
.guide-row input[type="text"], .guide-row input[type="number"] { width: 100%; min-width: 0; padding: var(--sp-3) var(--sp-4); border: 1px solid var(--line-2); border-radius: 6px; background: var(--field-bg); color: var(--text1); font: 11.5px var(--font-ui); }
.guide-row input[type="number"] { font-family: var(--font-mono); }
.guide-pos-field { position: relative; display: block; min-width: 0; }
.guide-pos-field input[type="number"] { padding-right: 42px; }
.guide-pos-field span { position: absolute; right: 24px; top: 50%; transform: translateY(-50%); pointer-events: none; color: var(--text3); font: 9.5px var(--font-mono); }
.guide-empty { padding: 18px; border: 1px dashed var(--line-2); border-radius: var(--r-sm); text-align: center; color: var(--text3); font-size: 11px; }
.guide-legend { padding: var(--sp-5) var(--sp-5); border-radius: var(--r-sm); background: var(--fill-faint); color: var(--text3); font-size: 10.5px; line-height: 1.5; }
.guide-legend strong { color: var(--text2); }
.color-editor {
  position: fixed; z-index: var(--z-modal-top); top: 80px; right: calc(var(--inspector-w) + 12px);
  width: min(296px, calc(100vw - 20px)); max-height: min(620px, calc(100dvh - 20px)); overflow: hidden;
  display: flex; flex-direction: column; border: 1px solid var(--line-2); border-radius: var(--r-lg);
  background: var(--surface); box-shadow: var(--e3); backdrop-filter: blur(18px);
}
.color-editor[hidden] { display: none; }
.color-pop-head { display:flex; align-items:center; gap:var(--sp-4); padding:var(--sp-5) var(--sp-5); border-bottom:1px solid var(--line); color:var(--text1); font:650 12px var(--font-ui); }
.color-pop-head > span { flex:1; min-width:0; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
.color-eyedropper { appearance:none; width:28px; height:28px; border:1px solid var(--line-2); border-radius:6px; background:var(--fill-1); color:var(--text2); cursor:pointer; font:700 15px var(--font-mono); }
.color-eyedropper:hover { color:var(--text1); border-color:var(--accent-ring); }
.color-eyedropper[hidden] { display:none; }
.color-editor-body { padding: var(--sp-5); overflow-y: auto; display: flex; flex-direction: column; gap: var(--sp-5); }
.color-sv { position:relative; height:150px; border-radius:8px; overflow:hidden; cursor:crosshair; touch-action:none; box-shadow:inset 0 0 0 1px rgba(255,255,255,.16); }
.color-sv::before { content:''; position:absolute; inset:0; background:linear-gradient(to top,#000,transparent),linear-gradient(to right,#fff,transparent); }
.color-sv-thumb { position:absolute; width:14px; height:14px; margin:-7px 0 0 -7px; border:2px solid #fff; border-radius:50%; box-shadow:0 0 0 1px rgba(0,0,0,.8),0 2px 5px rgba(0,0,0,.5); pointer-events:none; }
.color-slider { display:grid; grid-template-columns:1fr auto; align-items:center; gap:var(--sp-2); font:10px var(--font-ui); color:var(--text3); }
.color-slider input { grid-column:1 / -1; width:100%; accent-color:var(--accent); }
.color-hue input { appearance:none; height:12px; border-radius:999px; background:linear-gradient(90deg,#f00,#ff0,#0f0,#0ff,#00f,#f0f,#f00); }
.color-hue input::-webkit-slider-thumb { appearance:none; width:14px; height:14px; border-radius:50%; border:2px solid #fff; box-shadow:0 0 0 1px rgba(0,0,0,.7); background:transparent; }
.color-preview-checker, .color-trigger-preview {
  background-color: #fff; background-image: linear-gradient(45deg,#c8ccd4 25%,transparent 25%),linear-gradient(-45deg,#c8ccd4 25%,transparent 25%),linear-gradient(45deg,transparent 75%,#c8ccd4 75%),linear-gradient(-45deg,transparent 75%,#c8ccd4 75%);
  background-size: 14px 14px; background-position: 0 0,0 7px,7px -7px,-7px 0;
}
.color-preview-checker { width:30px; height:30px; flex:0 0 auto; border: 1px solid var(--line-2); border-radius: 6px; overflow: hidden; }
.color-preview-checker span { display: block; width: 100%; height: 100%; }
.color-mode { display: grid; grid-template-columns: 1fr 1fr; padding: var(--sp-1); border: 1px solid var(--line); border-radius: var(--r-sm); background: var(--fill-faint); }
.color-mode button { border: 0; border-radius: 5px; padding: var(--sp-3); background: transparent; color: var(--text3); font: 600 11px var(--font-ui); cursor: pointer; }
.color-mode button.on { background: var(--blue-dim); color: var(--text1); box-shadow: inset 0 0 0 1px var(--accent-ring); }
.color-fields { display: grid; grid-template-columns: 1fr; gap: var(--sp-3); }
.color-fields[hidden], #colorDefaultBtn[hidden] { display: none; }
.color-fields.color-rgba { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.color-fields label, .color-alpha { display: flex; flex-direction: column; gap: var(--sp-2); font-size: 10px; color: var(--text3); }
.color-fields input { width: 100%; min-width: 0; padding: var(--sp-4); border: 1px solid var(--line-2); border-radius: 6px; background: var(--field-bg); color: var(--text1); font: 12px var(--font-mono); }
.color-library > span { display:block; margin-bottom:var(--sp-3); color:var(--text3); font:9.5px var(--font-ui); }
.color-presets { display: grid; grid-template-columns: repeat(8, 1fr); gap: var(--sp-3); }
.color-preset { aspect-ratio: 1; min-width: 0; border: 2px solid rgba(255,255,255,.12); border-radius: 7px; cursor: pointer; box-shadow: inset 0 0 0 1px rgba(0,0,0,.25); }
.color-preset:hover { transform: translateY(-1px); border-color: var(--text2); }
.color-editor-foot { display:flex; gap:var(--sp-3); align-items:center; padding-top:var(--sp-2); border-top:1px solid var(--line); }
.color-pop-hint { margin-left:auto; color:var(--text4); font:9px var(--font-mono); white-space:nowrap; }
.color-trigger { display: flex; align-items: center; gap: var(--sp-4); width: 100%; padding: var(--sp-3) var(--sp-4); border: 1px solid var(--line-2); border-radius: var(--r-sm); background: var(--fill-faint); color: var(--text2); font: 11px var(--font-ui); cursor: pointer; text-align: left; }
.color-trigger:hover { border-color: var(--accent-ring); color: var(--text1); }
.color-trigger-preview { width: 28px; height: 24px; flex: 0 0 auto; border-radius: 5px; overflow: hidden; border: 1px solid var(--line-2); }
.color-trigger-preview span { display: block; width: 100%; height: 100%; }
.color-trigger code { margin-left: auto; font: 10px var(--font-mono); color: var(--text3); }
.workflow-modal {
  position: fixed; z-index: var(--z-modal-nested); top: 5dvh; left: 50%; transform: translateX(-50%);
  width: min(780px, 95vw); max-height: 90dvh;
  background: var(--surface);
  border: 1px solid var(--line-2); border-radius: var(--r-lg); box-shadow: var(--e3);
  display: flex; flex-direction: column; overflow: hidden; backdrop-filter: blur(18px);
}
.workflow-modal[hidden] { display: none; }
.workflow-modal-body { overflow-y: auto; padding: var(--sp-7); }
.surface-modal {
  position: fixed; z-index: var(--z-modal-nested); top: 5dvh; left: 50%; transform: translateX(-50%);
  width: min(860px, 95vw); max-height: 90dvh;
  background: var(--surface);
  border: 1px solid var(--line-2); border-radius: var(--r-lg); box-shadow: var(--e3);
  display: flex; flex-direction: column; overflow: hidden; backdrop-filter: blur(18px);
}
.surface-modal[hidden] { display: none; }
.surface-modal-body { overflow-y: auto; padding: 18px; }
.asset-import-dialog {
  position: fixed; z-index: var(--z-modal-top); top: 50%; left: 50%; transform: translate(-50%, -50%);
  width: min(520px, calc(100vw - 28px)); display: grid; grid-template-columns: auto minmax(0, 1fr) auto; gap: var(--sp-6); align-items: start;
  padding: 18px; border: 1px solid var(--line-2); border-radius: var(--r-lg); background: var(--surface); box-shadow: var(--e3); backdrop-filter: blur(18px);
}
.asset-import-dialog[hidden] { display: none; }
.asset-import-icon { display: flex; align-items: center; justify-content: center; width: 38px; height: 38px; border-radius: 10px; background: var(--blue-dim); color: var(--accent-bright); font: 700 20px var(--font-mono); }
.asset-import-copy { min-width: 0; }
.asset-import-copy h2 { margin: 0; color: var(--text1); font: 700 15px var(--font-display); }
.asset-import-copy p { margin: var(--sp-2) 0 var(--sp-5); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--text2); font-size: 11px; }
.asset-import-copy progress { appearance: none; display: block; width: 100%; height: 8px; overflow: hidden; border: 0; border-radius: 999px; background: var(--fill-2); }
.asset-import-copy progress::-webkit-progress-bar { background: var(--fill-2); border-radius: 999px; }
.asset-import-copy progress::-webkit-progress-value { border-radius: 999px; background: linear-gradient(90deg, var(--accent), var(--accent-bright)); transition: width .18s ease; }
.asset-import-copy progress::-moz-progress-bar { border-radius: 999px; background: linear-gradient(90deg, var(--accent), var(--accent-bright)); }
.asset-import-meta { display: flex; justify-content: space-between; margin-top: var(--sp-3); color: var(--text3); font: 9.5px var(--font-mono); }
.asset-import-copy small { display: block; margin-top: var(--sp-4); color: var(--text4); font-size: 9.5px; line-height: 1.4; }
.asset-import-dialog > .btn { white-space: nowrap; }
.surface-modal[data-surface="settings"] { width: min(820px, 95vw); }
.surface-modal[data-surface="brand-kit-save"] { width: min(720px, 95vw); }
.surface-modal[data-surface="asset-preview"] { width: min(980px, 96vw); height: min(780px, 92dvh); max-height: 92dvh; }
.surface-modal-body.surface-mode-asset-preview { flex: 1; min-height: 0; overflow: hidden; padding: 0; }
.surface-modal-body.surface-mode-settings { flex: 1; min-height: 0; padding: 0; overflow: hidden; }
.surface-modal[data-surface="motion"] { width: min(1180px, 97vw); height: min(900px, 94dvh); max-height: 94dvh; }
.surface-modal-body.surface-mode-motion { flex: 1; min-height: 0; padding: 0; overflow: hidden; }
.surface-modal-body > .sec { margin: 0; padding: 0; border: 0; }
.surface-modal-body > .panel { display: flex !important; flex-direction: column; gap: 18px; }
.surface-modal .tmpl-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.brand-save { display: flex; flex-direction: column; gap: var(--sp-7); }
.brand-save-intro h3 { margin: 0; color: var(--text1); font: 700 19px/1.25 var(--font-display); }
.brand-save-intro p { margin: var(--sp-3) 0 0; color: var(--text2); font-size: 12px; line-height: 1.5; max-width: 580px; }
.brand-save-name { margin: 0; color: var(--text2); font-size: 11px; }
.brand-save-name input { margin-top: var(--sp-3); }
.brand-save-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--sp-5); }
.brand-save-card { min-width: 0; padding: 14px; border: 1px solid var(--line-2); border-radius: var(--r-md); background: var(--fill-faint); }
.brand-save-card-head { display: flex; align-items: flex-start; gap: var(--sp-4); margin-bottom: var(--sp-6); }
.brand-save-card-head > div { min-width: 0; }
.brand-save-card-head strong { display: block; color: var(--text1); font-size: 12.5px; }
.brand-save-card-head small { display: block; margin-top: var(--sp-1); color: var(--text3); font-size: 9.5px; line-height: 1.35; }
.brand-save-check { display: inline-flex; align-items: center; justify-content: center; width: 20px; height: 20px; flex: 0 0 auto; border-radius: 50%; background: rgba(74,222,128,.12); color: var(--green); font-size: 11px; }
.brand-save-card dl { margin: 0; }
.brand-save-card dl > div { display: grid; grid-template-columns: 86px minmax(0, 1fr); gap: var(--sp-4); padding: var(--sp-3) 0; border-top: 1px solid var(--line); }
.brand-save-card dt { color: var(--text3); font-size: 10px; }
.brand-save-card dd { min-width: 0; margin: 0; color: var(--text2); font: 10.5px/1.4 var(--font-ui); overflow-wrap: anywhere; }
.brand-color { display: inline-block; width: 12px; height: 12px; margin-right: var(--sp-2); border: 1px solid var(--line-3); border-radius: 3px; vertical-align: -2px; }
.brand-save-excludes { display: flex; align-items: flex-start; gap: var(--sp-5); padding: var(--sp-5) var(--sp-6); border: 1px solid var(--line); border-radius: var(--r-sm); background: color-mix(in srgb, var(--fill-faint) 65%, transparent); }
.brand-save-excludes strong { flex: 0 0 auto; color: var(--text2); font-size: 10.5px; }
.brand-save-excludes span { color: var(--text3); font-size: 10.5px; line-height: 1.45; }
.brand-save-foot { display: flex; justify-content: flex-end; gap: var(--sp-4); padding-top: var(--sp-1); }
.asset-preview { display: grid; grid-template-columns: minmax(0, 1fr) 250px; grid-template-rows: minmax(0, 1fr) auto; width: 100%; height: 100%; min-height: 0; }
.asset-preview-stage {
  min-width: 0; min-height: 0; display: flex; align-items: center; justify-content: center; padding: var(--sp-9);
  background-color: #121419; background-image: linear-gradient(45deg,rgba(255,255,255,.045) 25%,transparent 25%),linear-gradient(-45deg,rgba(255,255,255,.045) 25%,transparent 25%),linear-gradient(45deg,transparent 75%,rgba(255,255,255,.045) 75%),linear-gradient(-45deg,transparent 75%,rgba(255,255,255,.045) 75%); background-size: 24px 24px; background-position: 0 0,0 12px,12px -12px,-12px 0;
  outline: none;
}
.asset-preview-stage:focus-visible { box-shadow: inset 0 0 0 2px var(--accent); }
.asset-preview-stage img { display: block; max-width: 100%; max-height: 100%; width: auto; height: auto; object-fit: contain; border-radius: 5px; box-shadow: 0 18px 55px rgba(0,0,0,.45); }
.asset-preview-info { min-width: 0; overflow-y: auto; padding: 18px; border-left: 1px solid var(--line); background: var(--fill-faint); }
.asset-preview-heading h3 { margin: var(--sp-3) 0 var(--sp-1); overflow-wrap: anywhere; color: var(--text1); font: 700 16px/1.3 var(--font-display); }
.asset-preview-heading p { margin: 0; color: var(--text3); font-size: 10px; }
.asset-preview-type { display: inline-flex; padding: var(--sp-1) var(--sp-3); border: 1px solid var(--accent-ring); border-radius: 999px; background: var(--blue-dim); color: var(--accent-bright); font: 8.5px var(--font-mono); letter-spacing: .08em; text-transform: uppercase; }
.asset-preview-info dl { margin: var(--sp-7) 0; }
.asset-preview-info dl > div { display: grid; grid-template-columns: 74px minmax(0, 1fr); gap: var(--sp-4); padding: var(--sp-4) 0; border-top: 1px solid var(--line); }
.asset-preview-info dt { color: var(--text3); font-size: 9.5px; }
.asset-preview-info dd { min-width: 0; margin: 0; overflow-wrap: anywhere; color: var(--text2); font-size: 10.5px; }
.asset-preview-actions { display: flex; flex-direction: column; gap: var(--sp-3); }
.asset-preview-actions .btn { width: 100%; }
.asset-usage-panel { min-width: 0; }
.asset-usage-panel.preview { margin: 0 0 var(--sp-7); }
.asset-usage-panel.rail { padding: var(--sp-4) var(--sp-3) var(--sp-5); border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.asset-usage-panel.legacy { margin: var(--sp-4) 0; padding: var(--sp-4); border: 1px solid var(--line); border-radius: var(--r-sm); background: var(--fill-faint); }
.asset-usage-head { display: flex; align-items: center; justify-content: space-between; gap: var(--sp-4); margin-bottom: var(--sp-3); color: var(--text3); font: 8.5px var(--font-mono); letter-spacing: .08em; text-transform: uppercase; }
.asset-usage-head strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; letter-spacing: 0; text-transform: none; font: 600 9px var(--font-ui); }
.asset-usage-head strong.used { color: var(--accent-bright); }
.asset-usage-head strong.referenced { color: var(--amber); }
.asset-usage-head strong.unused { color: var(--text4); }
.asset-usage-list { display: flex; flex-direction: column; gap: var(--sp-1); }
.asset-usage-slide { appearance: none; display: grid; grid-template-columns: 22px minmax(0, 1fr) auto; align-items: center; gap: var(--sp-3); width: 100%; min-width: 0; min-height: 36px; padding: var(--sp-2) var(--sp-3); border: 1px solid transparent; border-radius: 7px; background: var(--fill-faint); color: var(--text2); cursor: pointer; text-align: left; font-family: var(--font-ui); }
.asset-usage-slide:hover { border-color: var(--line-2); background: var(--fill-1); color: var(--text1); }
.asset-usage-slide.current { border-color: var(--accent-ring); background: var(--blue-dim); }
.asset-usage-index { display: inline-flex; align-items: center; justify-content: center; width: 22px; height: 22px; border-radius: 6px; background: var(--fill-2); color: var(--text3); font: 9px var(--font-mono); }
.asset-usage-slide.current .asset-usage-index { background: var(--accent-deep); color: #fff; }
.asset-usage-copy { display: flex; flex-direction: column; min-width: 0; gap: var(--sp-1); }
.asset-usage-copy strong, .asset-usage-copy small { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.asset-usage-copy strong { color: inherit; font-size: 10.5px; font-weight: 600; }
.asset-usage-copy small { color: var(--text3); font-size: 8.5px; }
.asset-usage-arrow { color: var(--text4); font: 10px var(--font-mono); }
.asset-usage-slide:hover .asset-usage-arrow { color: var(--accent-bright); }
.asset-usage-project { display: flex; align-items: flex-start; gap: var(--sp-4); margin-bottom: var(--sp-2); padding: var(--sp-3); border: 1px solid var(--line); border-radius: 7px; color: var(--text2); }
.asset-usage-project-icon { display: inline-flex; align-items: center; justify-content: center; width: 22px; height: 22px; flex: 0 0 auto; border-radius: 6px; background: var(--blue-dim); color: var(--accent-bright); }
.asset-usage-project > span:last-child { min-width: 0; }
.asset-usage-project strong, .asset-usage-project small { display: block; }
.asset-usage-project strong { font-size: 10px; }
.asset-usage-project small { margin-top: var(--sp-1); color: var(--text3); font-size: 8.5px; line-height: 1.35; }
.asset-usage-empty { padding: var(--sp-4); border: 1px dashed var(--line-2); border-radius: 7px; color: var(--text4); font-size: 9.5px; line-height: 1.4; text-align: center; }
.asset-preview-nav { grid-column: 1 / -1; display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: var(--sp-6); padding: var(--sp-5) 14px; border-top: 1px solid var(--line); background: var(--surface); }
.asset-preview-nav span { text-align: center; color: var(--text3); font: 10px var(--font-mono); }
.settings-shell {
  display: grid; grid-template-columns: 176px minmax(0, 1fr); width: 100%;
  height: min(740px, calc(90dvh - 58px)); min-height: min(520px, calc(90dvh - 58px));
}
.settings-nav {
  display: flex; flex-direction: column; gap: var(--sp-2); min-width: 0; padding: 14px var(--sp-5);
  border-right: 1px solid var(--line); background: color-mix(in srgb, var(--fill-faint) 72%, transparent);
}
.settings-nav button {
  appearance: none; width: 100%; min-width: 0; padding: var(--sp-5) var(--sp-5); border: 1px solid transparent;
  border-radius: var(--r-sm); background: transparent; color: var(--text2); cursor: pointer; text-align: left;
  font-family: var(--font-ui); transition: background .12s, border-color .12s, color .12s;
}
.settings-nav button:hover { background: var(--fill-1); color: var(--text1); }
.settings-nav button.on { background: var(--blue-dim); border-color: var(--accent-ring); color: var(--text1); }
.settings-nav button:focus-visible { outline: 2px solid var(--accent-bright); outline-offset: 1px; }
.settings-nav span { display: block; font-size: 12px; font-weight: 650; line-height: 1.25; }
.settings-nav small { display: block; margin-top: var(--sp-1); color: var(--text3); font-size: 9.5px; line-height: 1.3; }
.settings-content { min-width: 0; min-height: 0; overflow-y: auto; padding: 22px var(--sp-9) 28px; }
.settings-panel { display: flex; flex-direction: column; gap: 14px; max-width: 590px; margin: 0 auto; }
.settings-panel[hidden] { display: none; }
.settings-pane-head { padding: 0 1px var(--sp-2); }
.settings-pane-head h3 { margin: 0; color: var(--text1); font: 700 19px/1.25 var(--font-display); }
.settings-pane-head p { margin: var(--sp-3) 0 0; color: var(--text2); font-size: 12px; line-height: 1.5; }
.settings-section { padding: 14px var(--sp-7); border: 1px solid var(--line-2); border-radius: var(--r-md); background: var(--fill-faint); }
.settings-section h4 { margin: 0 0 var(--sp-5); color: var(--text1); font: 650 12.5px var(--font-ui); }
.settings-section-heading { display: flex; align-items: flex-start; justify-content: space-between; gap: 14px; margin-bottom: var(--sp-5); }
.settings-section-heading h4 { margin: 0 0 var(--sp-2); }
.settings-section-heading p { margin: 0; color: var(--text2); font-size: 10.5px; line-height: 1.45; }
.settings-section .surface-field { margin-top: var(--sp-5); color: var(--text2); font-size: 11px; }
.settings-section .surface-field:first-child { margin-top: 0; }
.settings-field-action { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: var(--sp-4); align-items: end; }
.settings-field-action .surface-field { margin: 0; }
.settings-two-fields { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--sp-6); }
.settings-help { margin: var(--sp-4) 0 0; color: var(--text2); font-size: 11px; line-height: 1.55; }
.settings-example { margin: var(--sp-5) 0; padding: var(--sp-4) var(--sp-5); border: 1px solid var(--line); border-radius: var(--r-sm); background: var(--field-bg); color: var(--text2); font: 10.5px var(--font-mono); }
.settings-pref-row { display: flex; align-items: center; gap: 18px; min-height: 42px; padding: var(--sp-4) 0; border-bottom: 1px solid var(--line); }
.settings-pref-row:last-child { border-bottom: 0; }
.settings-pref-copy { flex: 1; min-width: 0; }
.settings-pref-copy strong { display: block; color: var(--text1); font: 600 12px/1.3 var(--font-ui); }
.settings-pref-copy span { display: block; margin-top: var(--sp-1); color: var(--text2); font: 10.5px/1.4 var(--font-ui); }
.settings-switch {
  appearance: none; position: relative; width: 38px; height: 22px; flex: 0 0 38px; padding: 0;
  border: 1px solid var(--line-3); border-radius: var(--r-pill); background: var(--fill-2); cursor: pointer;
  transition: background .15s, border-color .15s, box-shadow .15s;
}
.settings-switch::after { content: ''; position: absolute; top: 2px; left: 2px; width: 16px; height: 16px; border-radius: 50%; background: #fff; box-shadow: 0 1px 3px rgba(0,0,0,.4); transition: transform .15s; }
.settings-switch.on { border-color: var(--accent-ring); background: linear-gradient(180deg, var(--accent-bright), var(--accent-deep)); box-shadow: 0 0 10px var(--accent-glow); }
.settings-switch.on::after { transform: translateX(16px); }
.settings-switch:focus-visible { outline: 2px solid var(--accent-bright); outline-offset: 2px; }
.settings-compact-select { min-width: 112px; padding: var(--sp-4) var(--sp-4); border: 1px solid var(--line-2); border-radius: var(--r-sm); background: var(--field-bg); color: var(--text1); font: 11.5px var(--font-ui); }
.settings-number { display: grid; grid-template-columns: 72px auto; align-items: center; gap: var(--sp-3); color: var(--text2); font-size: 11px; }
.settings-number input { width: 72px; box-sizing: border-box; padding: var(--sp-4); border: 1px solid var(--line-2); border-radius: var(--r-sm); background: var(--field-bg); color: var(--text1); font: 11.5px var(--font-mono); text-align: right; }
.settings-inline-actions { display: flex; flex-wrap: wrap; gap: var(--sp-3); padding-top: var(--sp-5); }
.storage-diagnostics { padding: var(--sp-5); border: 1px solid var(--line); border-radius: var(--r-sm); background: var(--field-bg); }
.storage-summary { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--sp-5); }
.storage-summary > div { min-width: 0; }
.storage-summary strong { display: block; color: var(--text1); font: 650 14px/1.2 var(--font-mono); }
.storage-summary span { display: block; margin-top: var(--sp-1); color: var(--text3); font-size: 9.5px; line-height: 1.35; }
.storage-meter { height: 5px; margin-top: var(--sp-5); overflow: hidden; border-radius: var(--r-pill); background: var(--fill-2); }
.storage-meter i { display: block; height: 100%; border-radius: inherit; background: linear-gradient(90deg, var(--accent), var(--accent-bright)); }
.storage-diagnostics .settings-help { margin-top: var(--sp-4); }
.storage-error { margin: var(--sp-4) 0 0; color: var(--red); font-size: 10.5px; line-height: 1.45; }
.settings-file-actions { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--sp-4); }
.settings-file-action { position: relative; overflow: hidden; cursor: pointer; }
.settings-file-action input { position: absolute; width: 1px; height: 1px; opacity: 0; pointer-events: none; }
.settings-file-action:focus-within { outline: 2px solid var(--accent-bright); outline-offset: 2px; }
.settings-danger { border-color: rgba(255,69,58,.32); background: rgba(255,69,58,.04); }
.settings-danger-row { display: flex; align-items: center; justify-content: space-between; gap: 18px; padding: var(--sp-6) 0; border-bottom: 1px solid rgba(255,69,58,.16); }
.settings-danger-row:first-child { padding-top: 0; }
.settings-danger-row:last-child { padding-bottom: 0; border-bottom: 0; }
.settings-danger-row h4 { margin-bottom: var(--sp-2); }
.settings-danger-row p { margin: 0; max-width: 360px; color: var(--text2); font-size: 11px; line-height: 1.5; }
.settings-danger-button { color: #ff746b; border-color: rgba(255,69,58,.4); }
.surface-field { display: flex; flex-direction: column; gap: var(--sp-2); margin-top: var(--sp-4); color: var(--text3); font-size: 10.5px; }
.surface-field input, .surface-field select { width: 100%; padding: var(--sp-4) var(--sp-4); border: 1px solid var(--line-2); border-radius: var(--r-sm); background: var(--field-bg); color: var(--text1); font: 12px var(--font-ui); }
.workflow-intro { display: flex; align-items: flex-start; justify-content: space-between; gap: 18px; margin-bottom: 14px; }
.workflow-intro h2 { margin: 0; font: 700 20px/1.2 var(--font-display); color: var(--text1); }
.workflow-intro p { margin: var(--sp-2) 0 0; max-width: 580px; font-size: 12px; line-height: 1.55; color: var(--text2); }
.workflow-steps { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: var(--sp-5); }
.workflow-step { padding: var(--sp-6); border: 1px solid var(--line-2); border-radius: var(--r-md); background: var(--fill-faint); }
.workflow-step h3 { margin: 0 0 var(--sp-4); font: 650 12.5px var(--font-ui); color: var(--text1); }
.workflow-step h3 span { display: inline-grid; place-items: center; width: 19px; height: 19px; margin-right: var(--sp-3); border-radius: 50%; background: var(--blue-dim); color: var(--accent-bright); font: 650 10px var(--font-mono); }
.workflow-field { display: flex; flex-direction: column; gap: var(--sp-2); margin-top: var(--sp-4); font-size: 10.5px; color: var(--text3); }
.workflow-field input, .workflow-field select {
  width: 100%; box-sizing: border-box; padding: var(--sp-4) var(--sp-4); border: 1px solid var(--line-2); border-radius: var(--r-sm);
  background: var(--field-bg); color: var(--text1); font: 12px var(--font-ui); outline: none;
}
.workflow-field input:focus, .workflow-field select:focus { border-color: var(--accent-ring); box-shadow: 0 0 0 2px var(--blue-dim); }
.smart-choice-grid { display: grid; grid-template-columns: 1fr 1fr; gap: var(--sp-3); }
.smart-choice {
  appearance: none; display: flex; flex-direction: column; gap: var(--sp-1); padding: var(--sp-4); text-align: left; cursor: pointer;
  border: 1px solid var(--line-2); border-radius: var(--r-sm); background: var(--fill-1); color: var(--text2); font: 11px var(--font-ui);
}
.smart-choice strong { font-size: 11.5px; color: var(--text1); }
.smart-choice span { color: var(--text3); font-size: 9.5px; line-height: 1.35; }
.smart-choice.on { border-color: var(--accent-ring); background: var(--accent-14); }
.smart-counts { display: flex; gap: var(--sp-2); }
.smart-counts .smart-choice { flex: 1; align-items: center; text-align: center; }
.smart-options { display: flex; flex-direction: column; gap: var(--sp-3); margin-top: var(--sp-5); }
.smart-check { display: flex; align-items: flex-start; gap: var(--sp-3); font-size: 10.5px; line-height: 1.4; color: var(--text2); }
.smart-check input { margin: 1px 0 0; accent-color: var(--accent); }
.store-support { margin: var(--sp-4) 0; padding: var(--sp-3) var(--sp-4); border-radius: var(--r-sm); background: var(--fill-faint); border: 1px solid var(--line); }
.store-support > span { margin-left: auto; color: var(--text3); font-size: 9px; }
.smart-upload { display: flex; align-items: center; justify-content: space-between; gap: 14px; margin-top: var(--sp-6); padding: var(--sp-5) var(--sp-6); border: 1px dashed var(--line-3); border-radius: var(--r-md); background: var(--fill-faint); }
.smart-upload strong { display: block; font-size: 11.5px; color: var(--text1); }
.smart-upload strong span { font-weight: 500; color: var(--text3); }
.smart-upload p { margin: var(--sp-1) 0 0; font-size: 9.5px; line-height: 1.4; color: var(--text3); }
.smart-file-list { display: flex; flex-direction: column; gap: var(--sp-2); margin-top: var(--sp-3); }
.smart-file-empty { padding: var(--sp-4) var(--sp-5); border-radius: var(--r-sm); background: var(--fill-faint); color: var(--text3); font-size: 9.5px; }
.smart-file-row { display: flex; align-items: center; gap: var(--sp-3); padding: var(--sp-2) var(--sp-3); border: 1px solid var(--line); border-radius: var(--r-sm); background: var(--fill-faint); }
.smart-file-num { display: inline-grid; place-items: center; width: 20px; height: 20px; border-radius: 50%; background: var(--blue-dim); color: var(--accent-bright); font: 650 9px var(--font-mono); }
.smart-file-name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 10.5px; color: var(--text2); }
.smart-file-name small { display: block; font: 8.5px var(--font-mono); color: var(--text3); }
.story-preview { margin-top: var(--sp-6); padding: var(--sp-5) var(--sp-6); border: 1px solid var(--line-2); border-radius: var(--r-md); background: var(--fill-faint); }
.story-preview-head { display: flex; align-items: center; justify-content: space-between; gap: var(--sp-5); font-size: 11px; color: var(--text2); }
.story-preview-head strong { color: var(--text1); }
.story-sequence { display: flex; gap: var(--sp-2); margin-top: var(--sp-4); overflow-x: auto; padding-bottom: var(--sp-1); }
.story-beat { flex: 1 0 82px; padding: var(--sp-3) var(--sp-4); border-radius: var(--r-xs); background: var(--fill-1); border: 1px solid var(--line); }
.story-beat b { display: block; font-size: 10px; color: var(--text1); }
.story-beat span { display: block; margin-top: var(--sp-1); font-size: 8.5px; line-height: 1.3; color: var(--text3); }
.workflow-foot { position: sticky; bottom: -16px; display: flex; justify-content: space-between; align-items: center; gap: var(--sp-6); margin: 14px -16px -16px; padding: var(--sp-6) var(--sp-7) max(var(--sp-6), env(safe-area-inset-bottom)); border-top: 1px solid var(--line); background: var(--surface); }
.workflow-summary { font-size: 10.5px; line-height: 1.45; color: var(--text3); }
.batch-options { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--sp-4); margin: var(--sp-6) 0; }
.batch-option { display: flex; align-items: flex-start; gap: var(--sp-4); padding: var(--sp-5); border: 1px solid var(--line-2); border-radius: var(--r-sm); background: var(--fill-faint); color: var(--text2); font-size: 11px; line-height: 1.4; }
.batch-option input { margin-top: 1px; accent-color: var(--accent); }
.batch-option strong { display: block; color: var(--text1); font-size: 11.5px; }
.batch-option span { display: block; color: var(--text3); font-size: 9.5px; margin-top: var(--sp-1); }
.set-editor-rows { display: flex; flex-direction: column; gap: var(--sp-3); }
.set-row { display: grid; grid-template-columns: 74px minmax(190px, 1fr) 112px auto; gap: var(--sp-4); align-items: center; padding: var(--sp-3); border: 1px solid var(--line); border-radius: var(--r-md); background: var(--fill-faint); }
.set-row.current { border-color: var(--accent-ring); box-shadow: inset 0 0 0 1px var(--accent-14); }
.set-thumb { appearance: none; height: 78px; padding: 0; overflow: hidden; cursor: pointer; border: 1px solid var(--line-2); border-radius: var(--r-sm); background: var(--ink-900); color: var(--text3); font: 9px var(--font-ui); }
.set-thumb img { display: block; width: 100%; height: 100%; object-fit: contain; }
.set-fields { display: grid; grid-template-columns: 0.7fr 1.15fr 1fr; gap: var(--sp-2); min-width: 0; }
.set-fields input, .set-fields textarea { width: 100%; min-width: 0; box-sizing: border-box; padding: var(--sp-3) var(--sp-4); resize: none; border: 1px solid var(--line-2); border-radius: var(--r-sm); background: var(--field-bg); color: var(--text1); font: 10.5px/1.35 var(--font-ui); outline: none; }
.set-fields input:focus, .set-fields textarea:focus { border-color: var(--accent-ring); box-shadow: 0 0 0 2px var(--blue-dim); }
.set-status { display: flex; flex-direction: column; gap: var(--sp-2); align-items: stretch; font-size: 9.5px; color: var(--text3); }
.set-status .has { color: var(--green); }
.set-status .missing { color: var(--amber); }
.set-actions { display: grid; grid-template-columns: repeat(2, 32px); gap: var(--sp-2); }
.set-actions .btn { min-width: 32px; padding-left: 0; padding-right: 0; }
.batch-panel { position: relative; margin-top: 14px; padding: var(--sp-6); border: 1px solid var(--line-2); border-radius: var(--r-md); background: var(--fill-faint); }
.batch-scope { max-width: 300px; }
.pop-project { top: calc(var(--header-h) - 4px); left: 130px; width: 280px; padding: var(--sp-4); gap: var(--sp-1); }
.pop-ctx { width: 190px; padding: var(--sp-3); gap: 1px; }   /* positioned at the cursor by JS */
.pop-ctx .menu-item:disabled { opacity: 0.4; cursor: default; }

/* Drag-to-reorder markers on left-panel slide rows */
.lp-slide.dragging { opacity: 0.45; }
.lp-slide.drop-above { box-shadow: 0 -2px 0 0 var(--accent); }
.lp-slide.drop-below { box-shadow: 0 2px 0 0 var(--accent); }

/* ── v2 guided first run ────────────────────────────────────────────────── */
.firstrun-card {
  position: absolute; z-index: var(--z-panel-float);
  top: 50%; left: 50%; transform: translate(-50%, -50%);
  width: min(560px, 80%);
  background: var(--surface);
  border: 1px solid var(--line-2); border-radius: var(--r-lg);
  box-shadow: 0 30px 80px rgba(0,0,0,0.6);
  padding: 22px; display: flex; flex-direction: column; gap: var(--sp-6);
  backdrop-filter: blur(16px);
}
.fr-title { font-family: var(--font-display); font-size: 19px; font-weight: 700; color: var(--text1); }
.fr-sub { font-size: 12px; line-height: 1.55; color: var(--text2); }
.fr-project-name { display: flex; flex-direction: column; gap: var(--sp-2); color: var(--text2); font-size: 10.5px; }
.fr-project-name input {
  width: 100%; padding: var(--sp-4) var(--sp-5); border-radius: var(--r-sm); border: 1px solid var(--line-2);
  background: var(--field-bg); color: var(--text1); font: 12.5px var(--font-ui); outline: none;
}
.fr-project-name input:focus { border-color: var(--accent-ring); box-shadow: 0 0 0 2px var(--blue-dim); }
.fr-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: var(--sp-4); }
.fr-tmpl {
  appearance: none; display: flex; flex-direction: column; gap: var(--sp-2); text-align: left;
  background: var(--fill-faint); border: 1px solid var(--line); border-radius: var(--r-sm);
  padding: var(--sp-5) var(--sp-5) var(--sp-4); cursor: pointer; font-family: var(--font-ui);
  transition: border-color 0.15s, background 0.15s;
}
.fr-tmpl:hover { border-color: var(--accent-ring); background: var(--accent-08); }
.fr-tmpl-name { font-size: 11.5px; font-weight: 600; color: var(--text1); line-height: 1.3; }
.fr-tmpl-n { font-family: var(--font-mono); font-size: 9px; color: var(--text3); }
.fr-actions { display: flex; gap: var(--sp-4); justify-content: flex-end; }

.smart-entry { display: flex; align-items: center; justify-content: space-between; gap: var(--sp-5); padding: var(--sp-4); margin-bottom: var(--sp-4); border: 1px solid var(--accent-ring); border-radius: var(--r-sm); background: var(--accent-08); }
.smart-entry > div { min-width: 0; }
.smart-entry strong { display: block; font-size: 11px; color: var(--text1); }
.smart-entry span { display: block; margin-top: var(--sp-1); font-size: 9.5px; line-height: 1.35; color: var(--text3); }
.template-levels { display: grid; grid-template-columns: repeat(3, 1fr); gap: var(--sp-2); margin-bottom: var(--sp-4); }
.template-levels span { padding: var(--sp-3) var(--sp-3); border-radius: var(--r-xs); border: 1px solid var(--line); background: var(--fill-faint); font-size: 9px; line-height: 1.35; color: var(--text3); }
.template-levels strong { display: block; color: var(--text2); font-size: 9.5px; }
.template-search { width: 100%; box-sizing: border-box; margin-bottom: var(--sp-3); padding: var(--sp-4) var(--sp-4); border-radius: var(--r-sm); border: 1px solid var(--line-2); background: var(--field-bg); color: var(--text1); font: 11.5px var(--font-ui); outline: none; }
.template-search:focus { border-color: var(--accent-ring); box-shadow: 0 0 0 2px var(--blue-dim); }
.tmpl-kinds { padding-bottom: var(--sp-3); margin-bottom: var(--sp-3); border-bottom: 1px solid var(--line); }

.readiness-list { display: flex; flex-direction: column; gap: var(--sp-2); margin-bottom: var(--sp-5); }
.ready-row { display: flex; align-items: center; gap: var(--sp-4); padding: var(--sp-3) var(--sp-4); border-radius: var(--r-sm); border: 1px solid var(--line); background: var(--fill-faint); font-size: 10.5px; color: var(--text2); }
.ready-row .ready-mark { width: 16px; height: 16px; display: inline-grid; place-items: center; flex-shrink: 0; border-radius: 50%; font-size: 9px; background: var(--fill-2); color: var(--text3); }
.ready-row.done .ready-mark { color: var(--green); background: rgba(74,222,128,0.1); }
.ready-row > span:nth-child(2) { flex: 1; min-width: 0; }
.ready-row strong { display: block; color: var(--text1); font-size: 10.5px; }
.ready-row small { display: block; margin-top: 1px; color: var(--text3); font-size: 9px; }
.ready-row button { margin-left: auto; }

/* ── Workflow panel nav — a recessed segmented control ──────────────────── */
.panel-nav {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: var(--sp-2);
  position: sticky; top: 0; z-index: 6;
  margin: 0 -16px var(--sp-7);
  padding: var(--sp-6) var(--sp-6);
  background: linear-gradient(180deg, var(--ink-850) 72%, rgba(14,16,23,0));
  border-bottom: 1px solid var(--line);
}
.panel-nav-btn {
  appearance: none;
  background: var(--fill-faint);
  border: 1px solid var(--fill-1);
  color: var(--text3);
  font-family: var(--font-ui);
  font-size: 11px;
  font-weight: 550;
  letter-spacing: 0.01em;
  padding: var(--sp-3) var(--sp-2);
  border-radius: var(--r-sm);
  cursor: pointer;
  transition: background 0.16s var(--ease), color 0.16s var(--ease), border-color 0.16s, box-shadow 0.16s, transform 0.08s;
}
.panel-nav-btn:hover { background: var(--fill-2); color: var(--text1); }
.panel-nav-btn:active { transform: translateY(1px); }
.panel-nav-btn.on {
  background: var(--accent-14);
  border-color: var(--accent-ring);
  color: var(--on-tint-text);
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.15), 0 2px 12px var(--accent-glow);
}

/* ── Panels + staggered reveal ──────────────────────────────────────────── */
.panel { display: none; }
.panel.active { display: flex; flex-direction: column; gap: 18px; }
.panel.active > * { animation: panelIn 0.34s var(--ease) both; }
.panel.active > *:nth-child(1) { animation-delay: 0.00s; }
.panel.active > *:nth-child(2) { animation-delay: 0.03s; }
.panel.active > *:nth-child(3) { animation-delay: 0.06s; }
.panel.active > *:nth-child(4) { animation-delay: 0.09s; }
.panel.active > *:nth-child(5) { animation-delay: 0.12s; }
.panel.active > *:nth-child(6) { animation-delay: 0.15s; }
.panel.active > *:nth-child(7) { animation-delay: 0.18s; }
.panel.active > *:nth-child(n+8) { animation-delay: 0.20s; }
@keyframes panelIn { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }

/* ── Sections ───────────────────────────────────────────────────────────── */
.sec { border-bottom: 1px solid var(--line); padding-bottom: 18px; }
.sec:last-child { border-bottom: none; padding-bottom: 0; }
.sec h3 {
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  color: var(--text3);
  margin-bottom: var(--sp-6);
  display: flex; align-items: center; gap: var(--sp-3);
}
.sec h3::before {
  content: ''; width: 5px; height: 5px; border-radius: 1.5px;
  background: var(--accent); box-shadow: 0 0 8px var(--accent-glow); flex-shrink: 0;
}

/* ── Cards / notes / links ──────────────────────────────────────────────── */
.card {
  background: var(--card-bg);
  border: 1px solid var(--line-2);
  border-radius: var(--r-md);
  padding: var(--sp-6) var(--sp-6);
  box-shadow: var(--e1);
}
.next-steps { background: linear-gradient(150deg, var(--blue-dim), var(--fill-faint)); border-color: var(--accent-ring); }
.next-steps .ns-title { font-family: var(--font-display); font-size: 14px; font-weight: 700; color: var(--text1); margin-bottom: var(--sp-4); letter-spacing: -0.01em; }
.next-steps ol { margin: 0; padding-left: var(--sp-7); font-size: 11.5px; line-height: 1.95; color: var(--text2); }
.next-steps ol::marker { color: var(--accent); }
.section-note { font-size: 10.5px; line-height: 1.55; color: var(--text3); margin-top: var(--sp-4); text-align: left; }
.ctl-sub {
  font-family: var(--font-mono); font-size: 9px; font-weight: 500;
  text-transform: uppercase; letter-spacing: 0.09em; color: var(--text3);
  margin: var(--sp-2) 0 var(--sp-2);
}
.section-note code, .drop-lbl code {
  font-family: var(--font-mono); font-size: 9.5px;
  background: var(--fill-1); border: 1px solid var(--line); border-radius: 4px;
  padding: 0 var(--sp-2); color: var(--text2); white-space: nowrap;
}
.lnk {
  background: none; border: none; padding: 0; cursor: pointer;
  color: var(--accent-bright); font-family: inherit; font-size: inherit; font-weight: 550;
  text-decoration: none; border-bottom: 1px solid var(--accent-ring); transition: color 0.15s;
}
.lnk:hover { color: var(--text1); }

/* ── Progressive-disclosure details ─────────────────────────────────────── */
.details-lite { margin-top: var(--sp-5); border-top: 1px dashed var(--line); padding-top: var(--sp-3); }
.details-lite summary {
  font-family: var(--font-mono);
  font-size: 10px; font-weight: 500; letter-spacing: 0.06em; text-transform: uppercase;
  color: var(--text3); cursor: pointer; padding: var(--sp-2) 0; user-select: none;
  list-style: none; display: flex; align-items: center; gap: var(--sp-3);
}
.details-lite summary::-webkit-details-marker { display: none; }
.details-lite summary::before {
  content: '＋'; font-family: var(--font-ui); font-size: 12px; color: var(--accent); transition: transform 0.2s var(--ease); line-height: 1;
}
.details-lite[open] summary::before { content: '−'; }
.details-lite summary:hover { color: var(--text1); }
.details-lite[open] summary { color: var(--text2); margin-bottom: var(--sp-3); }

/* ── Selection inspector card ───────────────────────────────────────────── */
.sel-card {
  display: flex; flex-direction: column; gap: var(--sp-4); padding: var(--sp-4) var(--sp-5); margin-bottom: var(--sp-2);
  border-color: var(--accent-ring);
  background: linear-gradient(180deg, var(--accent-14), var(--accent-06));
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.08), 0 4px 16px var(--accent-glow);
}
.sel-card.sel-locked { border-color: var(--line-3); background: linear-gradient(180deg, rgba(255,255,255,0.05), rgba(255,255,255,0.02)); }
.sel-head { display: flex; align-items: center; gap: var(--sp-4); }
.sel-card-name { font-size: 11.5px; color: var(--text2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sel-card-name strong { color: var(--text1); font-weight: 600; }
.sel-type { font-size: 9.5px; font-weight: 600; letter-spacing: .04em; text-transform: uppercase; color: var(--text3); padding: 1px var(--sp-2); border: 1px solid var(--line-2); border-radius: 5px; margin-left: var(--sp-2); }
.sel-tools { display: flex; align-items: center; gap: var(--sp-6); }
.sel-tools.is-locked { opacity: .5; pointer-events: none; }
.sel-tool-col { display: flex; flex-direction: column; gap: var(--sp-3); min-width: 0; }
.sel-tool-grow { flex: 1 1 auto; }
.anchor-grid { display: grid; grid-template-columns: repeat(3, 1fr); grid-template-rows: repeat(3, 1fr); gap: var(--sp-1); width: 54px; height: 54px; padding: var(--sp-1); background: var(--fill-faint); border: 1px solid var(--line-2); border-radius: 7px; }
.anchor-cell { border: 0; border-radius: 3px; background: var(--fill-2); cursor: pointer; padding: 0; transition: background .1s; position: relative; }
.anchor-cell::after { content: ''; position: absolute; inset: 0; margin: auto; width: 4px; height: 4px; border-radius: 50%; background: var(--text3); opacity: .5; }
.anchor-cell:hover { background: var(--accent); }
.anchor-cell:hover::after { background: #fff; opacity: 1; }
.align-row { display: flex; align-items: center; gap: var(--sp-1); flex-wrap: wrap; }
.align-sep { width: 1px; height: 16px; background: var(--line-2); margin: 0 var(--sp-1); }
.align-action-grid {
  display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: var(--sp-2);
}
.align-action {
  appearance: none; min-width: 0; min-height: 38px; padding: var(--sp-2) var(--sp-2);
  display: flex; align-items: center; justify-content: center; gap: var(--sp-2);
  border: 1px solid var(--line-2); border-radius: var(--r-xs);
  background: var(--fill-1); color: var(--text2); cursor: pointer;
  font: 550 9.5px var(--font-ui); transition: background .12s, border-color .12s, color .12s, transform .06s;
}
.align-action:hover { background: var(--fill-2); border-color: var(--line-3); color: var(--text1); }
.align-action:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
.align-action:active { transform: translateY(1px); }
.align-action:disabled { opacity: .38; cursor: default; pointer-events: none; transform: none; }
.align-action-icon { width: 17px; height: 17px; flex: 0 0 17px; display: grid; place-items: center; }
.align-action-icon svg { display: block; width: 17px; height: 17px; fill: none; stroke: currentColor; stroke-width: 1.45; stroke-linecap: round; stroke-linejoin: round; }
.align-action-label { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.align-subsection { display: flex; flex-direction: column; gap: var(--sp-4); margin-top: var(--sp-1); padding-top: var(--sp-5); border-top: 1px solid var(--line); }
.insp-sec.is-locked .align-action-grid { opacity: .72; }
.sel-hint { font-size: 10px; color: var(--text3); margin: var(--sp-2) 0 0; line-height: 1.35; }
.sel-glabel { display: block; font-size: 9px; font-weight: 600; letter-spacing: .05em; text-transform: uppercase; color: var(--text3); margin-bottom: var(--sp-1); }
.sel-metrics { font-size: 11px; color: var(--text1); font-variant-numeric: tabular-nums; font-family: var(--mono, ui-monospace, monospace); }
.sel-metrics .sel-glabel { display: inline; margin-right: var(--sp-2); text-transform: uppercase; }
.sel-lockchip { font-size: 9px; font-weight: 600; text-transform: uppercase; letter-spacing: .04em; color: var(--text3); border: 1px solid var(--line-2); border-radius: 5px; padding: 0 var(--sp-2); margin-left: var(--sp-2); }
.sel-match { font-size: 10px; font-weight: 700; min-width: 22px; }
.btn-g.on { background: var(--btn-p-from); color: #fff; border-color: var(--btn-p-from); }
/* Emphasize the Design section matching the current selection. */
.sec.sec-emphasis { box-shadow: inset 0 0 0 1.5px var(--accent-ring), 0 2px 14px var(--accent-glow); border-radius: 10px; }
/* On-canvas direct text editor (DOM overlay — never part of export). */
.inline-text-edit {
  position: fixed; z-index: var(--z-inline-edit); margin: 0; resize: none; overflow: hidden;
  color: #fff; background: rgba(15,20,32,0.58); backdrop-filter: blur(2px);
  border: 1.5px solid var(--accent); border-radius: 6px; padding: var(--sp-1) var(--sp-2);
  box-shadow: 0 6px 26px rgba(0,0,0,.5); outline: none;
  caret-color: #fff;
}

/* ── Rows / labels / fields ─────────────────────────────────────────────── */
.row { margin-bottom: var(--sp-5); }
.row:last-child { margin-bottom: 0; }
.row label { display: block; font-size: 11px; font-weight: 500; color: var(--text2); margin-bottom: var(--sp-2); }

.row select,
.row input[type="text"],
.row textarea,
#bgFitMode {
  width: 100%;
  background: var(--ink-750);
  border: 1px solid var(--line-2);
  color: var(--text1);
  padding: var(--sp-4) var(--sp-5);
  border-radius: var(--r-sm);
  font-size: 12.5px;
  font-family: inherit;
  transition: border-color 0.15s, box-shadow 0.15s, background 0.15s;
}
.row select:hover, .row input[type="text"]:hover, .row textarea:hover { border-color: var(--line-3); }
.row select:focus, .row input:focus, .row textarea:focus, #bgFitMode:focus {
  outline: none;
  border-color: var(--accent-ring);
  background: var(--ink-700);
  box-shadow: 0 0 0 3px var(--blue-dim);
}
.row textarea { resize: vertical; min-height: 56px; line-height: 1.55; }
.row select, #bgFitMode {
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' fill='none' stroke='%23889'%3E%3Cpath d='M3 5l3 3 3-3' stroke-width='1.4' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 10px center;
  padding-right: 28px;
}
.row-pair { display: grid; grid-template-columns: 1fr 1fr; gap: var(--sp-4); }
.row-pair > .row { min-width: 0; }   /* let paired controls shrink instead of clipping */
.row select, .row input[type="text"] { max-width: 100%; }

/* ── Sliders + editable numeric readouts (mono) ─────────────────────────── */
.sli { display: flex; align-items: center; gap: var(--sp-4); min-width: 0; }
.sli input[type="range"] {
  flex: 1 1 0;
  min-width: 0;                       /* range may shrink so the number box never clips */
  accent-color: var(--accent);
  height: 4px;
  cursor: pointer;
}
.sli .sv, input.sv {
  font-family: var(--font-mono);
  font-size: 11px;
  font-variant-numeric: tabular-nums;
  color: var(--text2);
}
input.sv {
  width: 62px; min-width: 62px;
  color: var(--text1);
  background: var(--ink-750);
  border: 1px solid var(--line-2);
  border-radius: var(--r-xs);
  padding: var(--sp-1) var(--sp-2);
  text-align: right;
  appearance: auto;
  -moz-appearance: auto;
  transition: border-color 0.15s, box-shadow 0.15s;
}
input.sv::-webkit-outer-spin-button, input.sv::-webkit-inner-spin-button { -webkit-appearance: auto; opacity: 1; margin: 0; }
input.sv:focus { outline: none; border-color: var(--accent-ring); box-shadow: 0 0 0 3px var(--blue-dim); color: var(--text1); }

/* VF control boundaries are distinct from decorative dividers. */
input:not([type="range"]):not([type="checkbox"]):not([type="radio"]):not([type="file"]),
select, textarea, .insp-num-field { border-color: var(--line-3); }
input[aria-invalid="true"], textarea[aria-invalid="true"] { border-color: var(--red); border-inline-start-width: 3px; }
input:focus-visible, select:focus-visible, textarea:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

/* ── Buttons ────────────────────────────────────────────────────────────── */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: var(--sp-2);
  padding: var(--sp-4) var(--sp-6);
  border-radius: var(--r-sm);
  border: 1px solid transparent;
  font-size: 12px; font-weight: 600; font-family: inherit;
  cursor: pointer; white-space: nowrap;
  transition: background 0.15s var(--ease), color 0.15s, border-color 0.15s, box-shadow 0.15s, transform 0.06s;
}
.btn:active { transform: translateY(1px); }
.btn-p {
  background: var(--btn-p-from);
  color: #fff;
  box-shadow: none;
}
.btn-p:hover { background: var(--btn-p-to); box-shadow: none; }
.btn-s {
  background: linear-gradient(180deg, #63e79a, #34c46f); color: #052;
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.4), 0 2px 10px rgba(52,196,111,0.3);
}
.btn-s:hover { filter: brightness(1.06); }
.btn-g {
  background: var(--fill-1);
  color: var(--text2);
  border: 1px solid var(--line-2);
}
.btn-g:hover { background: var(--fill-2); color: var(--text1); border-color: var(--line-3); }
.btn-sm { padding: var(--sp-3) var(--sp-5); font-size: 11px; }
.btn-block { width: 100%; }
.btn:disabled { opacity: 0.34; cursor: default; pointer-events: none; box-shadow: none; filter: none; }
.btn-row { display: flex; gap: var(--sp-3); flex-wrap: wrap; }
.btn-row .btn { flex: 1; }
.zip-btn { }

/* ── Info cards (templates / brand kits / assets / store / QA / scope) ──── */
.tmpl-info {
  margin-top: var(--sp-5); padding: var(--sp-5) var(--sp-6);
  background: linear-gradient(180deg, var(--fill-1), var(--fill-faint));
  border: 1px solid var(--line-2); border-radius: var(--r-md);
}
.tmpl-name { font-size: 12.5px; font-weight: 600; color: var(--text1); display: flex; align-items: center; gap: var(--sp-3); }
.tmpl-tag {
  font-family: var(--font-mono);
  font-size: 8.5px; font-weight: 500; text-transform: uppercase; letter-spacing: 0.08em;
  color: var(--accent-bright); background: var(--blue-dim); padding: var(--sp-1) var(--sp-3); border-radius: var(--r-xs);
  border: 1px solid var(--accent-ring);
}
.tmpl-desc { font-size: 11px; color: var(--text2); margin-top: var(--sp-2); line-height: 1.4; }
.tmpl-meta { font-family: var(--font-mono); font-size: 10px; color: var(--text3); margin-top: var(--sp-3); letter-spacing: 0.01em; }
.tmpl-prev { font-size: 11px; color: var(--text2); margin-top: var(--sp-3); font-style: italic; opacity: 0.85; }

/* ── Store coverage chips ───────────────────────────────────────────────── */
.store-target-list { display: flex; flex-wrap: wrap; gap: var(--sp-2); margin-top: var(--sp-5); }
.store-target-chip {
  font-family: var(--font-mono); font-size: 10px; padding: var(--sp-1) var(--sp-3); border-radius: var(--r-xs);
  border: 1px solid var(--line-2); color: var(--text2); background: var(--fill-faint);
  white-space: nowrap; max-width: 100%; overflow: hidden; text-overflow: ellipsis;
}
.store-target-chip.covered { color: var(--green); border-color: rgba(74,222,128,0.32); background: rgba(74,222,128,0.06); }
.store-target-chip.alternative-covered { color: var(--green); border-color: rgba(74,222,128,0.24); background: rgba(74,222,128,0.04); }
.store-target-chip.missing { color: var(--text3); }
.store-target-chip.required-missing { color: var(--amber); border-color: rgba(251,191,36,0.42); background: rgba(251,191,36,0.09); }
.store-warn { font-size: 11px; color: var(--amber); margin-top: var(--sp-3); }
.store-ok { font-size: 11px; color: var(--green); margin-top: var(--sp-3); }

/* ── Layers ─────────────────────────────────────────────────────────────── */
.layer-list {
  display: flex; flex-direction: column; gap: 1px;
  background: var(--ink-850); border: 1px solid var(--line); border-radius: var(--r-md); padding: var(--sp-2);
}
.layer-row {
  display: flex; align-items: center; gap: var(--sp-2); padding: var(--sp-2) var(--sp-3); border-radius: var(--r-xs);
  border-left: 2px solid transparent; transition: background 0.12s;
}
.layer-row:hover { background: var(--fill-1); }
.layer-row.sel { background: var(--blue-dim); border-left-color: var(--accent); }
.layer-row.inactive { opacity: 0.42; }
.layer-annotation .layer-label { color: var(--accent-bright); }
.layer-icon { background: none; border: none; cursor: pointer; font-size: 13px; line-height: 1; padding: var(--sp-1) var(--sp-1); border-radius: var(--r-xs); flex-shrink: 0; opacity: 0.85; transition: opacity 0.12s, background 0.12s; }
.layer-icon:hover { background: var(--fill-2); opacity: 1; }
.layer-type { flex-shrink: 0; width: 16px; text-align: center; font-size: 10px; font-weight: 700; color: var(--text3); font-family: var(--font-mono); }
.layer-group { background: var(--accent-06); border-left: 2px solid var(--accent-ring); }
.layer-group .layer-label { font-weight: 600; }
/* ── Assets library (thumbnail grid) ─────────────────────────────────────── */
.asset-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: var(--sp-3); margin-top: var(--sp-4); }
.asset-cell { position: relative; display: flex; flex-direction: column; gap: var(--sp-1); padding: var(--sp-2); background: var(--fill-faint); border: 1px solid var(--line-2); border-radius: 8px; cursor: pointer; text-align: left; min-width: 0; transition: border-color .12s, background .12s; }
.asset-cell:hover { background: var(--fill-1); border-color: var(--line-3); }
.asset-cell.sel { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent-ring); }
.asset-thumb { display: block; width: 100%; aspect-ratio: 1 / 1; border-radius: 5px; overflow: hidden; background: repeating-conic-gradient(rgba(255,255,255,0.06) 0% 25%, transparent 0% 50%) 0 / 12px 12px; }
.asset-thumb img { width: 100%; height: 100%; object-fit: contain; display: block; }
.asset-cap { font-size: 10.5px; color: var(--text1); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.asset-tag { font-size: 9px; color: var(--text3); font-family: var(--font-mono); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.asset-use-status { font-size: 8.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.asset-use-status.used { color: var(--accent-bright); }
.asset-use-status.referenced { color: var(--amber); }
.asset-use-status.unused { color: var(--text4); }
.asset-empty { grid-column: 1 / -1; padding: var(--sp-7) var(--sp-5); text-align: center; font-size: 11px; color: var(--text3); border: 1px dashed var(--line-2); border-radius: 8px; }
.asset-detail { margin-top: var(--sp-4); padding: var(--sp-4) var(--sp-5); background: var(--fill-faint); border: 1px solid var(--line-2); border-radius: 8px; }
.asset-detail .row { margin-bottom: var(--sp-3); }
.asset-detail .tmpl-meta { font-size: 10px; }
/* ── Templates (category chips + thumbnail grid) ─────────────────────────── */
.tmpl-cats { display: flex; flex-wrap: wrap; gap: var(--sp-2); margin-bottom: var(--sp-4); }
.tmpl-chip { font-size: 10.5px; padding: var(--sp-1) var(--sp-4); border-radius: 999px; border: 1px solid var(--line-2); background: var(--fill-faint); color: var(--text2); cursor: pointer; transition: all .12s; }
.tmpl-chip:hover { border-color: var(--line-3); color: var(--text1); }
.tmpl-chip.on { background: var(--btn-p-from); border-color: var(--btn-p-from); color: #fff; }
.tmpl-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: var(--sp-3); }
.tmpl-cell { display: flex; flex-direction: column; gap: var(--sp-1); padding: var(--sp-2); background: var(--fill-faint); border: 1px solid var(--line-2); border-radius: 8px; cursor: pointer; text-align: left; min-width: 0; transition: border-color .12s, background .12s; }
.tmpl-cell:hover { background: var(--fill-1); border-color: var(--line-3); }
.tmpl-cell.sel { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent-ring); }
.tmpl-thumb { display: block; width: 100%; aspect-ratio: 9 / 19.5; border-radius: 5px; overflow: hidden; background: #0a0a0c; }
.tmpl-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.tmpl-cap { font-size: 10px; color: var(--text1); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tmpl-badge { font-size: 8.5px; color: var(--text3); font-family: var(--font-mono); text-transform: uppercase; letter-spacing: .03em; }
.tmpl-badge.custom { color: var(--accent-bright); }
.tmpl-empty { grid-column: 1 / -1; padding: var(--sp-7) var(--sp-5); text-align: center; font-size: 11px; color: var(--text3); border: 1px dashed var(--line-2); border-radius: 8px; }
/* ── Artboards (custom export targets) ───────────────────────────────────── */
.artboard-warn { font-size: 11px; color: #ffb454; background: rgba(255,150,60,0.1); border: 1px solid rgba(255,150,60,0.28); border-radius: 7px; padding: var(--sp-3) var(--sp-4); margin: var(--sp-2) 0; }
.artboard-row { display: flex; align-items: center; gap: var(--sp-3); padding: var(--sp-2) var(--sp-2); border-radius: 6px; border-left: 2px solid transparent; }
.artboard-row.on { background: var(--blue-dim); border-left-color: var(--accent); }
.artboard-row .ab-name { flex: 1; min-width: 0; font-size: 12px; color: var(--text1); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.artboard-row .ab-meta { font-size: 9.5px; color: var(--text3); font-family: var(--font-mono); white-space: nowrap; }
.artboard-row .ab-acts { display: flex; gap: 1px; flex-shrink: 0; }
.artboard-empty { font-size: 10.5px; color: var(--text3); padding: var(--sp-4) var(--sp-2); }
.artboard-add { margin-top: var(--sp-4); padding: var(--sp-4); background: var(--fill-faint); border: 1px solid var(--line-2); border-radius: 8px; }
.artboard-add .row { margin-bottom: var(--sp-3); }
/* ── Animation preset row (selection inspector) ──────────────────────────── */
.anim-row { margin-top: var(--sp-4); }
.anim-preset {
  flex: 1 1 auto; min-width: 0; box-sizing: border-box;
  height: 28px; padding: 0 var(--sp-4);
  background: var(--field-bg); color: var(--text1);
  border: 1px solid var(--line-2); border-radius: var(--r-xs);
  font: 11.5px var(--font-ui); cursor: pointer; outline: none;
}
.anim-preset:focus { border-color: var(--accent-ring); }
.motion-compact-head, .motion-compact-actions { display:flex; align-items:center; justify-content:space-between; gap:var(--sp-4); }
.motion-summary { color:var(--text3); font:9.5px var(--font-mono); white-space:nowrap; }
.motion-compact-add { display:flex; gap:var(--sp-3); margin-top:var(--sp-3); }
.motion-compact-add select { min-width:0; flex:1; }
.motion-compact-actions { margin-top:var(--sp-1); }
.motion-clear { color:var(--red); }
.motion-clear:disabled { opacity:.35; cursor:default; }

/* ── Focused story + object Motion surface ─────────────────────────────── */
.motion-surface { height:100%; min-height:0; display:grid; grid-template-rows:minmax(250px,1fr) auto minmax(260px,.95fr); background:var(--ink-900); }
.motion-preview-panel { min-height:0; display:grid; grid-template-rows:auto minmax(0,1fr) auto; border-bottom:1px solid var(--line); }
.motion-preview-head { display:flex; align-items:center; justify-content:space-between; gap:var(--sp-6); padding:var(--sp-5) 14px; color:var(--text3); font-size:10px; }
.motion-preview-head > div { display:flex; flex-direction:column; gap:var(--sp-1); }
.motion-preview-head strong { color:var(--text1); font-size:12px; }
.motion-preview-wrap { min-height:0; display:grid; place-items:center; overflow:hidden; padding:var(--sp-4) var(--sp-7); background:radial-gradient(circle at 50% 45%,var(--accent-08),transparent 54%),#080a0f; }
.motion-preview-wrap canvas { display:block; max-width:100%; max-height:100%; width:auto; height:auto; border-radius:5px; box-shadow:0 18px 55px rgba(0,0,0,.6); }
.motion-transport { display:grid; grid-template-columns:auto auto minmax(120px,1fr) auto; align-items:center; gap:var(--sp-3); padding:var(--sp-4) var(--sp-6); border-top:1px solid var(--line); background:var(--ink-850); }
.motion-transport input[type="range"] { width:100%; accent-color:var(--accent); }
.motion-transport output { min-width:92px; color:var(--text2); font:10px var(--font-mono); text-align:right; }
.motion-story-panel { padding:var(--sp-4) var(--sp-6) var(--sp-5); border-bottom:1px solid var(--line); background:var(--ink-850); }
.motion-panel-title { display:flex; align-items:baseline; gap:var(--sp-4); margin-bottom:var(--sp-3); }
.motion-panel-title strong { color:var(--text1); font-size:11.5px; }
.motion-panel-title span { color:var(--text3); font-size:9.5px; }
.motion-story-row { display:flex; gap:var(--sp-2); min-width:0; }
.motion-story-slide { appearance:none; flex:1 1 0; min-width:72px; height:46px; display:grid; grid-template-columns:auto minmax(0,1fr) auto; align-items:center; gap:var(--sp-3); padding:var(--sp-2) var(--sp-4); border:1px solid var(--line-2); border-radius:7px; background:var(--fill-faint); color:var(--text2); cursor:pointer; text-align:left; }
.motion-story-slide:hover { border-color:var(--accent-ring); color:var(--text1); }
.motion-story-slide.active { border-color:var(--accent); background:var(--blue-dim); color:var(--text1); }
.motion-story-slide > strong { display:grid; place-items:center; width:22px; height:22px; border-radius:5px; background:var(--fill-2); font:10px var(--font-mono); }
.motion-story-slide > span { overflow:hidden; text-overflow:ellipsis; white-space:nowrap; font-size:10.5px; }
.motion-story-slide > small { color:var(--text3); font:9px var(--font-mono); }
.motion-timeline-panel { min-height:0; display:grid; grid-template-columns:minmax(0,1fr) 250px; }
.motion-track-list { min-width:0; min-height:0; display:flex; flex-direction:column; padding:var(--sp-5) var(--sp-6); border-right:1px solid var(--line); }
.motion-addbar { display:flex; align-items:center; gap:var(--sp-3); margin-bottom:var(--sp-4); }
.motion-addbar > select:first-child { min-width:140px; max-width:210px; }
.motion-addbar > label { display:flex; align-items:center; gap:var(--sp-2); margin-left:auto; color:var(--text3); font-size:9.5px; }
.motion-addbar select, .motion-addbar input { height:30px; border:1px solid var(--line-2); border-radius:6px; background:var(--field-bg); color:var(--text1); font:10.5px var(--font-ui); padding:0 var(--sp-3); }
.motion-duration { width:58px; text-align:right; font-family:var(--font-mono) !important; }
.motion-tracks { min-height:0; overflow:auto; display:flex; flex-direction:column; gap:var(--sp-1); }
.motion-track-row { min-height:38px; display:grid; grid-template-columns:150px minmax(180px,1fr); align-items:stretch; border:1px solid transparent; border-radius:6px; overflow:hidden; }
.motion-track-row.active { border-color:var(--accent-ring); background:var(--accent-06); }
.motion-track-name { appearance:none; min-width:0; display:grid; grid-template-columns:20px minmax(0,1fr) auto; align-items:center; gap:var(--sp-3); padding:var(--sp-2) var(--sp-4); border:0; border-right:1px solid var(--line); background:var(--fill-faint); color:var(--text2); cursor:pointer; text-align:left; }
.motion-track-name strong { overflow:hidden; text-overflow:ellipsis; white-space:nowrap; font-size:10.5px; }
.motion-track-name small { color:var(--text4); font:9px var(--font-mono); }
.motion-track-lane { position:relative; min-width:0; background:repeating-linear-gradient(90deg,transparent 0 calc(10% - 1px),var(--line) calc(10% - 1px) 10%); cursor:pointer; }
.motion-step-block { appearance:none; position:absolute; top:5px; height:26px; min-width:18px; padding:0 var(--sp-3); overflow:hidden; border:1px solid rgba(255,255,255,.14); border-radius:5px; cursor:pointer; color:#fff; font:9px var(--font-ui); text-align:left; white-space:nowrap; }
.motion-step-block span { pointer-events:none; }
.motion-step-block.phase-in { background:#2469c8; }
.motion-step-block.phase-emphasis { background:#7c4ac7; }
.motion-step-block.phase-out { background:#a34d5d; }
.motion-step-block.selected { outline:2px solid #fff; outline-offset:1px; z-index:2; }
.motion-step-block.disabled { opacity:.42; }
.motion-local-playhead { position:absolute; z-index:4; top:0; bottom:0; width:1px; background:#ff5a52; pointer-events:none; }
.motion-local-playhead::before { content:''; position:absolute; top:0; left:-3px; border-left:4px solid transparent; border-right:4px solid transparent; border-top:5px solid #ff5a52; }
.motion-step-side { min-width:0; overflow:auto; padding:var(--sp-6); background:var(--ink-850); }
.motion-step-empty { height:100%; display:flex; flex-direction:column; align-items:center; justify-content:center; gap:var(--sp-2); color:var(--text3); text-align:center; font-size:10px; }
.motion-step-empty strong { color:var(--text2); font-size:12px; }
.motion-step-editor { display:flex; flex-direction:column; gap:var(--sp-4); }
.motion-step-editor-head { display:flex; flex-direction:column; gap:var(--sp-2); padding-bottom:var(--sp-4); border-bottom:1px solid var(--line); }
.motion-step-editor-head strong { color:var(--text1); font-size:13px; }
.motion-phase { align-self:flex-start; padding:var(--sp-1) var(--sp-3); border-radius:4px; color:#fff; font:8.5px var(--font-mono); text-transform:uppercase; letter-spacing:.06em; }
.motion-phase.phase-in { background:#2469c8; }.motion-phase.phase-emphasis{background:#7c4ac7}.motion-phase.phase-out{background:#a34d5d}
.motion-step-editor > label { display:flex; align-items:center; justify-content:space-between; gap:var(--sp-4); color:var(--text3); font-size:10.5px; }
.motion-step-editor label > span { display:flex; align-items:center; gap:var(--sp-2); }
.motion-step-editor input[type="number"], .motion-step-editor select { width:104px; min-width:0; height:32px; padding:0 var(--sp-3); border:1px solid var(--line-2); border-radius:6px; background:var(--field-bg); color:var(--text1); font:10.5px var(--font-mono); }
.motion-step-editor .motion-enable { justify-content:flex-start; }
.motion-step-actions { display:grid; grid-template-columns:1fr 1fr; gap:var(--sp-2); padding-top:var(--sp-3); border-top:1px solid var(--line); }
.motion-step-actions .motion-delete { grid-column:1/-1; color:var(--red); }
.motion-empty { padding:22px; border:1px dashed var(--line-2); border-radius:7px; color:var(--text3); text-align:center; font-size:11px; }
/* ── Keyboard shortcuts reference ────────────────────────────────────────── */
.kbd-list { margin: var(--sp-2) 0 0; display: flex; flex-direction: column; gap: var(--sp-2); }
.kbd-row { display: flex; align-items: baseline; gap: var(--sp-4); }
.kbd-row dt { flex: 0 0 40%; font-size: 11px; color: var(--text2); }
.kbd-row dd { flex: 1 1 auto; margin: 0; font-size: 10.5px; color: var(--text1); min-width: 0; }
.kbd-row kbd { display: inline-block; font-family: var(--font-mono); font-size: 9.5px; line-height: 1.4; padding: 1px var(--sp-2); border: 1px solid var(--line-3); border-bottom-width: 2px; border-radius: 5px; background: var(--fill-2); color: var(--text1); }
.kbd-note { color: var(--text3); font-size: 9.5px; }
/* Custom-layer inspector props block */
/* ── COMPONENT: field (baseline) ────────────────────────────────────────────
   Controls inside the layer-properties panel inherit the field treatment by
   default. Without this, a bare <input type="number"> renders as raw browser
   chrome — Arial on a grey box — next to themed mono fields, which is exactly
   how Stroke width and Radius shipped. Styling the container rather than each
   call site means a future control cannot reintroduce the drift. */
.custom-props input[type="number"],
.custom-props input[type="text"],
.custom-props select,
.custom-props textarea {
  width: 100%; min-width: 0; box-sizing: border-box;
  height: 28px; padding: 0 var(--sp-4);
  background: var(--field-bg); color: var(--text1);
  border: 1px solid var(--line-2); border-radius: var(--r-xs);
  font: 11px var(--font-mono); font-variant-numeric: tabular-nums;
  outline: none;
}
.custom-props textarea { height: auto; padding: var(--sp-3) var(--sp-4); font-family: var(--font-ui); font-size: 11.5px; line-height: 1.45; resize: vertical; }
/* Focus lifts the field fill one rung (--field-bg -> --field-bg-focus), on
   top of the ring/border each family already shows. The pair existed with
   ZERO consumers once -- values defined, remapped, self-tested, applied by
   nothing; the style guide's usage counter is what caught it. One grouped
   rule so the next field family gets it by adding a selector, not a copy. */
.custom-props input[type="number"]:focus, .custom-props input[type="text"]:focus,
.custom-props select:focus, .custom-props textarea:focus,
.insp-sec textarea:focus, .insp-sec input[type="text"]:focus,
.row select:focus, .row input:focus, .row textarea:focus,
.workflow-field input:focus, .workflow-field select:focus,
.set-fields input:focus, .set-fields textarea:focus,
.fr-project-name input:focus, .template-search:focus,
.surface-field input:focus, .surface-field select:focus,
.color-fields input:focus, .dsw-select:focus,
.lp-asset-organizer select:focus,
.settings-compact-select:focus, .settings-number input:focus {
  background: var(--field-bg-focus);
}
.custom-props select { font-family: var(--font-ui); font-size: 11.5px; cursor: pointer; }
.custom-props input:focus, .custom-props select:focus, .custom-props textarea:focus { border-color: var(--accent-ring); }

.custom-props { display: flex; flex-direction: column; gap: var(--sp-3); width: 100%; }
.custom-props .row { margin-bottom: 0; }
.custom-props .row-pair { display: flex; gap: var(--sp-4); }
.custom-props .row-pair > .row { flex: 1 1 0; min-width: 0; }
.custom-props textarea { min-height: 40px; resize: vertical; }
.layer-label { flex: 1; min-width: 0; font-size: 12px; color: var(--text1); cursor: pointer; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.layer-empty { font-family: var(--font-mono); font-size: 9.5px; color: var(--text3); }
.layer-order { display: flex; gap: 1px; flex-shrink: 0; }
.layer-ord { background: none; border: none; cursor: pointer; font-size: 12px; line-height: 1; padding: var(--sp-1) var(--sp-2); border-radius: var(--r-xs); color: var(--text3); flex-shrink: 0; transition: background 0.12s, color 0.12s; }
.layer-ord:hover:not(:disabled) { background: var(--fill-2); color: var(--text1); }
.layer-ord:disabled { opacity: 0.25; cursor: default; }

/* ── Preflight QA ───────────────────────────────────────────────────────── */
.qa-dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; margin-right: var(--sp-3); vertical-align: middle; }
.qa-dot.qa-ok { background: var(--green); box-shadow: 0 0 8px rgba(74,222,128,0.5); }
.qa-dot.qa-warn { background: var(--amber); box-shadow: 0 0 8px rgba(251,191,36,0.5); }
.qa-dot.qa-err { background: var(--red); box-shadow: 0 0 8px rgba(255,90,82,0.5); }
.qa-row { font-size: 11px; line-height: 1.5; padding: var(--sp-2) 0; border-bottom: 1px solid var(--line); }
.qa-row:last-child { border-bottom: none; }
.qa-row.qa-error { color: #ff9a93; }
.qa-row.qa-warn { color: #fcd34d; }
.qa-row.qa-info { color: var(--text3); }

/* ── Brand-kit apply options ────────────────────────────────────────────── */
.bk-opt { display: flex; align-items: center; gap: var(--sp-3); font-size: 11px; color: var(--text2); padding: var(--sp-2) 0; cursor: pointer; }
.bk-opt input { flex-shrink: 0; accent-color: var(--accent); }

/* ── Slide tabs ─────────────────────────────────────────────────────────── */
.tabs { display: flex; gap: var(--sp-2); flex-wrap: wrap; }
.tab {
  min-width: 30px;
  padding: var(--sp-3) var(--sp-5); border-radius: var(--r-xs);
  background: var(--fill-1); border: 1px solid transparent;
  color: var(--text2); font-family: var(--font-mono); font-size: 11px; font-weight: 500; cursor: pointer;
  transition: background 0.12s, color 0.12s, border-color 0.12s;
}
.tab:hover { background: var(--fill-2); color: var(--text1); }
.tab.on { background: var(--blue-dim); border-color: var(--accent-ring); color: var(--on-tint-text); }

/* ── Toggles ────────────────────────────────────────────────────────────── */
.tog-row { display: flex; align-items: center; justify-content: space-between; margin-bottom: var(--sp-5); gap: var(--sp-5); }
.tog-row span { font-size: 11.5px; color: var(--text2); }
.tog {
  width: 36px; height: 20px; flex-shrink: 0;
  background: rgba(255,255,255,0.14); border-radius: var(--r-pill);
  position: relative; cursor: pointer; border: none;
  transition: background 0.25s var(--ease);
}
.tog.on { background: linear-gradient(180deg, var(--accent-bright), var(--accent-deep)); box-shadow: 0 0 12px var(--accent-glow); }
.tog::after {
  content: ''; position: absolute; width: 16px; height: 16px;
  background: #fff; border-radius: 50%; top: 2px; left: 2px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.4);
  transition: transform 0.25s var(--spring);
}
.tog.on::after { transform: translateX(16px); }

/* ── Drop zones + media previews ────────────────────────────────────────── */
.drop {
  border: 1.5px dashed var(--line-3);
  border-radius: var(--r-md);
  padding: var(--sp-7) var(--sp-6);
  text-align: center; cursor: pointer; position: relative;
  background: var(--fill-faint);
  transition: border-color 0.2s, background 0.2s;
}
.drop:hover, .drop.over { border-color: var(--accent-ring); background: var(--accent-06); }
.drop input[type="file"] { position: absolute; inset: 0; opacity: 0; cursor: pointer; }
.drop-lbl { font-size: 11px; color: var(--text3); line-height: 1.5; }
.drop-ico { font-size: 22px; opacity: 0.3; margin-bottom: var(--sp-2); }

.mp { margin-top: var(--sp-4); border-radius: var(--r-sm); background: var(--fill-1); border: 1px solid var(--line); padding: var(--sp-3) var(--sp-4); display: flex; align-items: center; gap: var(--sp-4); }
.mp img { width: 34px; height: auto; border-radius: var(--r-xs); box-shadow: var(--e1); }
.mp .mn { font-family: var(--font-mono); font-size: 10px; color: var(--text3); flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mp .mc { background: none; border: none; color: var(--text4); cursor: pointer; font-size: 15px; padding: var(--sp-1); line-height: 1; transition: color 0.12s; }
.mp .mc:hover { color: var(--red); }

/* ── Colour swatches ────────────────────────────────────────────────────── */
.colors { display: flex; gap: var(--sp-3); flex-wrap: wrap; }
.csw {
  width: 26px; height: 26px; border-radius: var(--r-sm);
  border: 2px solid transparent; cursor: pointer; position: relative;
  box-shadow: inset 0 0 0 1px rgba(0,0,0,0.25), var(--e1);
  transition: transform 0.15s var(--spring), box-shadow 0.15s;
}
.csw:hover { transform: scale(1.14) translateY(-1px); }
.csw.on { box-shadow: 0 0 0 2px var(--ink-850), 0 0 0 4px var(--accent), 0 2px 10px var(--accent-glow); }
.csw.on::after {
  content: '✓'; position: absolute; inset: 0; display: flex; align-items: center; justify-content: center;
  font-size: 12px; color: #fff; text-shadow: 0 1px 2px rgba(0,0,0,0.6);
}

/* Ring background: native color input */
#ringColorPick {
  width: 100%; height: 32px; padding: var(--sp-1); background: var(--ink-750);
  border: 1px solid var(--line-2); border-radius: var(--r-sm); cursor: pointer;
}

/* ── Background-mode buttons ────────────────────────────────────────────── */
.bg-mode-row { display: flex; gap: var(--sp-2); margin-bottom: var(--sp-5); flex-wrap: wrap; }
/* .bg-mode-btn is an alias of the canonical chip (see COMPONENT: chip). */

/* ── Device + orientation matrix ────────────────────────────────────────── */
.dev-checks { display: flex; flex-direction: column; gap: var(--sp-6); margin-top: var(--sp-5); }
.dev-platform-group {
  overflow: hidden; border: 1px solid var(--line); border-radius: var(--r-md);
  background: var(--fill-faint);
}
.dev-platform-head {
  min-height: 40px; padding: var(--sp-4) var(--sp-5); display: flex; align-items: center; justify-content: space-between; gap: var(--sp-6);
  border-bottom: 1px solid var(--line); background: var(--fill-1); color: var(--text3); font-size: 9.5px;
}
.dev-platform-head > div { display: flex; align-items: baseline; gap: var(--sp-3); min-width: 0; }
.dev-platform-head strong { color: var(--text1); font-size: 12px; }
.dev-platform-head span { color: var(--text3); }
.dev-size-list { display: flex; flex-direction: column; }
.dev-size-row {
  display: grid; grid-template-columns: minmax(150px, .8fr) minmax(250px, 1.4fr); gap: var(--sp-5); align-items: center;
  min-height: 58px; padding: var(--sp-4) var(--sp-5); border-bottom: 1px solid var(--line);
}
.dev-size-row:last-child { border-bottom: 0; }
.dev-size-copy { min-width: 0; }
.dev-size-copy strong { display: block; color: var(--text1); font-size: 11px; line-height: 1.25; }
.dev-size-copy span { display: block; margin-top: var(--sp-1); color: var(--text3); font-size: 9px; line-height: 1.3; }
.dev-orientation-options { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--sp-3); }
.dev-size-row.single-orientation .dev-orientation-options { grid-template-columns: minmax(0, 1fr); }
.dev-orientation-choice {
  min-width: 0; min-height: 42px; padding: var(--sp-3) var(--sp-3); display: flex; align-items: center; gap: var(--sp-3);
  border: 1px solid var(--line-2); border-radius: var(--r-sm); background: var(--field-bg);
  color: var(--text2); cursor: pointer; transition: border-color .12s, background .12s, color .12s;
}
.dev-orientation-choice:hover { border-color: var(--line-3); background: var(--fill-2); color: var(--text1); }
.dev-orientation-choice.is-on { border-color: var(--accent-ring); background: var(--blue-dim); color: var(--text1); }
.dev-orientation-choice input { width: 14px; height: 14px; margin: 0; flex: 0 0 auto; accent-color: var(--accent); }
.dev-orientation-icon {
  display: inline-block; width: 9px; height: 14px; flex: 0 0 auto; box-sizing: border-box;
  border: 1.5px solid currentColor; border-radius: 2px; color: var(--text3);
}
.dev-orientation-choice.is-on .dev-orientation-icon { color: var(--accent-bright); }
.dev-orientation-icon.landscape { width: 14px; height: 9px; }
.dev-orientation-copy { min-width: 0; display: flex; flex-direction: column; gap: var(--sp-1); }
.dev-orientation-copy strong { overflow: hidden; text-overflow: ellipsis; color: inherit; font-size: 10px; line-height: 1.1; }
.dev-orientation-copy span { color: var(--text3); font: 9px var(--font-mono); font-variant-numeric: tabular-nums; white-space: nowrap; }
.dev-preset-groups { display: flex; flex-direction: column; gap: var(--sp-2); margin-top: var(--sp-4); }
.dev-preset-row { display: flex; align-items: center; gap: var(--sp-2); flex-wrap: wrap; }
.dev-preset-row > span { width: 66px; flex: 0 0 66px; color: var(--text3); font: 9px var(--font-mono); text-transform: uppercase; letter-spacing: .05em; }

@media (max-width: 620px) {
  .dev-size-row { grid-template-columns: 1fr; gap: var(--sp-3); padding: var(--sp-5); }
  .dev-size-copy span { max-width: 32rem; }
  .dev-orientation-choice { min-height: 44px; }
  .dev-preset-row > span { width: 100%; flex-basis: 100%; margin-top: var(--sp-2); }
}

/* ── Font preview ───────────────────────────────────────────────────────── */
.font-preview {
  font-size: 15px; color: var(--text2); margin-top: var(--sp-3); padding: var(--sp-5);
  background: var(--ink-850); border: 1px solid var(--line); border-radius: var(--r-sm);
  text-align: center; line-height: 1.4; min-height: 32px;
}

/* ── Override dot ───────────────────────────────────────────────────────── */
.override-dot { display: inline-block; width: 5px; height: 5px; border-radius: 50%; background: var(--accent); margin-left: var(--sp-2); vertical-align: middle; box-shadow: 0 0 6px var(--accent-glow); }

/* ── The stage ──────────────────────────────────────────────────────────── */
.stage-shell {
  grid-row: 2; grid-column: 2;
  position: relative; min-width: 0; min-height: 0; overflow: hidden;
  isolation: isolate;
}
.main {
  width: 100%; height: 100%;
  overflow: auto;
  position: relative;
  /* "safe" keeps the zoomed canvas scroll-reachable instead of clipping it when
     it overflows a centered flex container. */
  display: flex; align-items: safe center; justify-content: safe center;
  padding: 28px;
  background:
    radial-gradient(120% 90% at 50% -10%, var(--stage-glow), transparent 60%),
    radial-gradient(90% 80% at 50% 120%, var(--stage-glow), transparent 55%),
    var(--stage);
}
/* Faint dot-grid over the stage floor for depth (behind the devices). */
.main::before {
  content: ''; position: absolute; inset: 0; pointer-events: none;
  background-image: radial-gradient(var(--stage-dot) 1px, transparent 1px);
  background-size: 26px 26px;
  mask-image: radial-gradient(70% 70% at 50% 50%, #000, transparent 100%);
  -webkit-mask-image: radial-gradient(70% 70% at 50% 50%, #000, transparent 100%);
  opacity: 0.6;
}
.preview-hint {
  position: absolute; top: 54px; left: 18px; z-index: 5; pointer-events: none;
  max-width: calc(100% - 230px); overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  font-family: var(--font-mono); font-size: 9.5px; letter-spacing: 0.03em; color: var(--text4);
}
.scope-badge {
  position: absolute; top: 48px; right: 18px; z-index: 5; pointer-events: none;
  font-family: var(--font-mono); font-size: 9.5px; font-weight: 500; letter-spacing: 0.03em;
  color: var(--text3);
  background: color-mix(in srgb, var(--surface) 85%, transparent);
  border: 1px solid var(--line-2); padding: var(--sp-2) var(--sp-4); border-radius: var(--r-sm);
  backdrop-filter: blur(8px);
}
.scope-badge.scoped { color: var(--accent-bright); border-color: var(--accent-ring); }
.scope-badge.has-overrides { color: var(--amber); border-color: color-mix(in srgb, var(--amber) 42%, var(--line-2)); }
.measure-state {
  position: absolute; top: 80px; right: 18px; z-index: 6; pointer-events: none;
  font-family: var(--font-mono); font-size: 9.5px; font-weight: 650; letter-spacing: 0.035em;
  color: #cfe1ff; background: rgba(12,24,48,0.9); border: 1px solid rgba(90,150,255,0.72);
  padding: var(--sp-2) var(--sp-4); border-radius: var(--r-sm); box-shadow: 0 5px 20px rgba(20,70,160,0.22);
  backdrop-filter: blur(8px);
}
.measure-state[hidden] { display: none; }
/* No-devices empty message on the stage. */
.stage-empty {
  display: flex; flex-direction: column; align-items: center; gap: var(--sp-2);
  color: var(--text3); font-size: 13px; text-align: center;
}

/* ── v2 stage: device rows × slide frames ───────────────────────────────── */
.main.panning { cursor: grabbing; }
.main.panning * { pointer-events: none; }
.stage-rows { display: flex; flex-direction: column; gap: 60px; padding: 92px 60px 40px; z-index: 1; }
.stage-row { display: flex; flex-direction: column; gap: var(--sp-6); }
.row-head { display: flex; align-items: center; gap: var(--sp-4); }
.row-title { font-size: 13px; font-weight: 650; color: var(--text1); }
.row-dims { font-family: var(--font-mono); font-size: 10px; color: var(--text3); }
.row-badge {
  font-family: var(--font-mono); font-size: 8.5px; letter-spacing: 0.08em; text-transform: uppercase;
  border-radius: 4px; padding: 1px var(--sp-3); border: 1px solid;
}
.row-badge.required { color: var(--green); border-color: rgba(74,222,128,0.35); background: rgba(74,222,128,0.08); }
.row-badge.optional { color: var(--text3); border-color: var(--line-2); background: var(--fill-faint); }
.frame-strip { display: flex; gap: 48px; align-items: flex-start; }
.frame { display: flex; flex-direction: column; gap: var(--sp-4); flex-shrink: 0; }
.frame-label {
  appearance: none; background: none; border: none; padding: 0; cursor: pointer; text-align: left;
  font-family: var(--font-ui); font-size: 12px; color: var(--text3);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 100%;
  transition: color 0.12s;
}
.frame-label:hover { color: var(--text1); }
.frame.current-slide .frame-label { color: var(--text2); font-weight: 600; }
.frame.active-artboard .frame-label { color: var(--accent-bright); }
.frame-override-badge {
  display: inline-flex; align-items: center; margin-left: var(--sp-2); padding: 1px var(--sp-2);
  border: 1px solid color-mix(in srgb, var(--amber) 38%, var(--line-2)); border-radius: 4px;
  background: color-mix(in srgb, var(--amber) 9%, transparent); color: var(--amber);
  font: 600 8px var(--font-mono); letter-spacing: 0.04em; text-transform: uppercase;
  vertical-align: 1px;
}
.frame-override-badge.group { color: var(--accent-bright); border-color: var(--accent-ring); background: var(--blue-dim); }
.frame canvas {
  display: block; border-radius: 5px;
  outline: none;
  box-shadow: 0 24px 60px -14px rgba(0,0,0,0.7);
  transition: box-shadow 0.2s;
}
.frame.active-artboard .frame-label::after { content: ''; display: inline-block; width: 5px; height: 5px; margin-left: var(--sp-3); border-radius: 50%; background: var(--accent); vertical-align: 1px; }
.canvas-ruler-shell {
  --ruler-size: 18px;
  display: inline-grid;
  grid-template-columns: var(--ruler-size) auto;
  grid-template-rows: var(--ruler-size) auto;
  align-self: flex-start;
  flex: 0 0 auto;
  user-select: none;
}
.canvas-ruler-corner {
  grid-column: 1; grid-row: 1;
  border: 1px solid var(--line-2); border-right: 0; border-bottom: 0;
  border-radius: 5px 0 0 0;
  background: color-mix(in srgb, var(--surface2) 94%, transparent);
}
.canvas-ruler {
  position: relative; overflow: hidden; touch-action: none; cursor: crosshair;
  color: var(--text3);
  background-color: color-mix(in srgb, var(--surface2) 94%, transparent);
  border-color: var(--line-2); border-style: solid;
}
.canvas-ruler::after { content: ''; position: absolute; pointer-events: none; opacity: 0.72; }
.canvas-ruler-top {
  grid-column: 2; grid-row: 1; border-width: 1px 1px 0 0; border-radius: 0 5px 0 0;
  background-image: repeating-linear-gradient(90deg, transparent 0 9px, var(--text4) 9px 10px, transparent 10px 49px, var(--text3) 49px 50px);
}
.canvas-ruler-top::after { inset: auto 0 0; height: 1px; background: var(--line-3); }
.canvas-ruler-left {
  grid-column: 1; grid-row: 2; border-width: 0 0 1px 1px; border-radius: 0 0 0 5px;
  background-image: repeating-linear-gradient(0deg, transparent 0 9px, var(--text4) 9px 10px, transparent 10px 49px, var(--text3) 49px 50px);
}
.canvas-ruler-left::after { inset: 0 0 0 auto; width: 1px; background: var(--line-3); }
.canvas-ruler-surface { grid-column: 2; grid-row: 2; position: relative; min-width: 0; min-height: 0; }
.canvas-ruler.dragging { background-color: var(--blue-dim); }
.ghost-frame {
  appearance: none; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: var(--sp-4);
  border-radius: var(--r-sm); border: 1.5px dashed var(--line-3); background: none; cursor: pointer;
  color: var(--text3); font-family: var(--font-ui); font-size: 13px;
  transition: border-color 0.15s, color 0.15s, background 0.15s;
}
.ghost-frame:hover { border-color: var(--accent-ring); color: var(--text1); background: var(--accent-06); }
.gf-plus { font-size: 24px; line-height: 1; }
.device-switcher {
  position: absolute; z-index: var(--z-canvas-ui);
  top: 12px; left: 50%;
  transform: translateX(-50%);
  display: flex; align-items: center; gap: var(--sp-4);
  background: color-mix(in srgb, var(--surface2) 92%, transparent);
  border: 1px solid var(--line-2); border-radius: var(--r-md); padding: var(--sp-2) var(--sp-3) var(--sp-2) var(--sp-4);
  box-shadow: var(--e2); backdrop-filter: blur(10px);
  width: min(590px, calc(100% - 32px)); max-width: min(78vw, 590px);
}
.dsw-label { color: var(--text3); font: 9px var(--font-mono); letter-spacing: .09em; text-transform: uppercase; flex-shrink: 0; }
.dsw-select { flex: 1; min-width: 0; height: 28px; padding: 0 28px 0 var(--sp-4); border: 1px solid var(--line-2); border-radius: 6px; background: var(--field-bg); color: var(--text1); font: 11.5px var(--font-ui); cursor: pointer; }
.dsw-manage { appearance: none; height: 28px; padding: 0 var(--sp-4); border: 0; border-radius: 6px; background: none; color: var(--text3); font: 10.5px var(--font-ui); cursor: pointer; white-space: nowrap; }
.dsw-manage:hover { background: var(--fill-2); color: var(--text1); }
.dsw-edit-target { color: var(--accent-bright); border: 1px solid var(--accent-ring); background: var(--blue-dim); }
.dsw-edit-target:hover, .dsw-edit-target.on { color: var(--on-tint-text); border-color: var(--accent); background: var(--accent-20); }
.dsw-chip {
  appearance: none; height: 26px; padding: 0 var(--sp-5); border-radius: 6px; cursor: pointer;
  border: 1px solid transparent; background: none;
  font-family: var(--font-ui); font-size: 11.5px; font-weight: 550; color: var(--text2); white-space: nowrap;
  transition: background 0.12s, color 0.12s, border-color 0.12s;
}
.dsw-chip:hover { color: var(--text1); background: var(--fill-2); }
.dsw-chip.on { background: var(--accent-20); border-color: var(--accent-55); color: var(--on-tint-text); }

.device-grid { display: flex; gap: 26px; align-items: flex-end; flex-wrap: nowrap; max-width: 100%; z-index: 1; }
.device-card { display: flex; flex-direction: column; align-items: center; gap: var(--sp-5); flex-shrink: 0; }
.device-card canvas {
  display: block; border-radius: 5px; cursor: pointer;
  box-shadow: 0 20px 50px -12px rgba(0,0,0,0.7), 0 4px 14px rgba(0,0,0,0.5);
  outline: none;
  transition: box-shadow 0.25s var(--ease), transform 0.25s var(--ease);
}
.device-card canvas:hover { box-shadow: 0 28px 64px -12px rgba(0,0,0,0.8), 0 6px 18px rgba(0,0,0,0.55); transform: translateY(-3px); }
.device-card .canvas-ruler-shell canvas:hover { transform: none; }
.device-card.selected canvas { box-shadow: 0 24px 60px -12px rgba(0,0,0,0.75), 0 0 24px -6px var(--accent-glow); }
.device-card.selected .device-label { color: var(--accent-bright); }
.device-label { font-size: 10.5px; font-weight: 550; color: var(--text2); text-align: center; letter-spacing: 0.01em; }
.device-label .device-dims { display: block; font-family: var(--font-mono); font-size: 9px; color: var(--text4); font-variant-numeric: tabular-nums; margin-top: var(--sp-1); }
.canvas-asset-drop { filter: saturate(1.08) brightness(1.04); box-shadow: 0 0 0 2px var(--accent), 0 18px 50px rgba(0,0,0,.68) !important; }
.asset-drop-hint { position: fixed; z-index: var(--z-dropzone); pointer-events: none; transform: translate(12px, 12px); padding: var(--sp-3) var(--sp-4); border: 1px solid var(--accent-ring); border-radius: 6px; background: color-mix(in srgb, var(--ink-850) 94%, transparent); color: var(--text1); box-shadow: var(--e2); font: 10.5px var(--font-ui); }

/* ── Carousel ───────────────────────────────────────────────────────────── */
.carousel {
  /* Desktop uses the left panel's slides list; the carousel is the mobile slide nav. */
  display: none;
  background: linear-gradient(180deg, var(--ink-900), var(--ink-850));
  border-top: 1px solid var(--line);
  align-items: center; gap: var(--sp-6); padding: var(--sp-6) var(--sp-7); overflow-x: auto;
}
.carousel-item {
  flex-shrink: 0; cursor: pointer; border-radius: var(--r-sm); overflow: hidden;
  border: 2px solid transparent; transition: border-color 0.15s, transform 0.15s var(--ease), box-shadow 0.15s;
  display: flex; flex-direction: column; align-items: center;
}
.carousel-item:hover { transform: translateY(-3px); box-shadow: var(--e2); }
.carousel-item.active { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent-ring), 0 4px 20px var(--accent-glow); }
.carousel-item canvas { display: block; width: auto; height: 82px; border-radius: 3px; }
.carousel-item .ci-label { font-family: var(--font-mono); font-size: 9px; color: var(--text3); padding: var(--sp-2) var(--sp-3); text-align: center; background: rgba(0,0,0,0.35); width: 100%; letter-spacing: 0.02em; }

/* ── Toast ──────────────────────────────────────────────────────────────── */
.toast {
  position: fixed; bottom: 22px; left: 50%;   /* bottom-center per the v2 spec */
  background: var(--surface);
  border: 1px solid var(--line-2);
  padding: var(--sp-5) 18px; border-radius: var(--r-md);
  font-size: 12.5px; color: var(--text1);
  box-shadow: var(--e3);
  backdrop-filter: blur(18px);
  transform: translateX(-50%) translateY(90px) scale(0.96); opacity: 0;
  transition: transform 0.32s var(--spring), opacity 0.24s var(--ease);
  z-index: var(--z-toast); max-width: min(360px, 80vw);
}
.toast.show { transform: translateX(-50%); opacity: 1; }

/* ── Subheading "theme default" swatch + native colour input ────────────── */
.csw-default {
  background: repeating-linear-gradient(45deg, var(--fill-2) 0 4px, transparent 4px 8px), var(--ink-750);
  position: relative; padding: 0;
}
.csw-default::after { content: 'A'; position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; font-family: var(--font-ui); font-size: 11px; font-weight: 700; color: var(--text2); }
.colors input[type="color"] {
  width: 26px; height: 26px; padding: 0; border: none; border-radius: var(--r-sm);
  background: none; cursor: pointer; flex-shrink: 0;
  box-shadow: inset 0 0 0 1px var(--line-3), var(--e1);
}
.colors input[type="color"]::-webkit-color-swatch-wrapper { padding: var(--sp-1); }
.colors input[type="color"]::-webkit-color-swatch { border: none; border-radius: 5px; }

/* ── Canvas zoom bar (desktop overlay, bottom-right of the stage) ────────── */
.zoombar {
  position: absolute; z-index: var(--z-canvas-ui);
  bottom: 16px; left: 16px;
  display: flex; align-items: center; gap: var(--sp-1);
  padding: var(--sp-2); border-radius: var(--r-md);
  background: color-mix(in srgb, var(--surface2) 92%, transparent);
  border: 1px solid var(--line-2); box-shadow: var(--e2); backdrop-filter: blur(10px);
}
.zb-btn, .zb-pct {
  appearance: none; background: none; border: none; cursor: pointer;
  color: var(--text2); font-family: var(--font-ui); font-size: 12px; font-weight: 600;
  height: 26px; min-width: 26px; padding: 0 var(--sp-3); border-radius: var(--r-xs);
  transition: background 0.12s, color 0.12s;
}
.zb-pct { font-family: var(--font-mono); font-size: 11px; min-width: 46px; }
.zb-btn.zb-wide { padding: 0 var(--sp-4); }
.zb-btn:hover, .zb-pct:hover { background: var(--fill-2); color: var(--text1); }
.zb-sep { width: 1px; height: 18px; background: var(--line-2); margin: 0 var(--sp-1); }

/* Retired pre-three-pane collapse control; both desktop rails stay present. */
.sidebar-collapse-btn { display: none; }

/* Pointer + keyboard affordances for persisted rail widths. JavaScript owns
   the drag transaction; CSS keeps the hit target and stage boundary stable. */
.rail-resizer {
  position: fixed; z-index: var(--z-resizer); top: var(--header-h); bottom: 0; width: 7px;
  cursor: col-resize; touch-action: none;
}
.rail-resizer::after {
  content: ''; position: absolute; top: 0; bottom: 0; left: 3px; width: 1px;
  background: var(--accent); opacity: 0; transition: opacity 0.12s;
}
.rail-resizer:hover::after, .rail-resizer:focus-visible::after,
.rail-resizer.dragging::after { opacity: 0.8; }
.rail-resizer-left { left: calc(var(--leftpanel-w) - 3px); }
.rail-resizer-right { right: calc(var(--inspector-w) - 3px); }

.responsive-sheet-toggle {
  appearance: none; min-height: 32px; padding: 0 var(--sp-4); border-radius: var(--r-xs);
  border: 1px solid var(--line-2); background: var(--fill-faint); color: var(--text2);
  font: 600 11px var(--font-ui); cursor: pointer;
}
.responsive-sheet-toggle[aria-expanded="true"] {
  color: var(--on-tint-text); border-color: var(--accent-ring); background: var(--blue-dim);
}
.responsive-sheet-backdrop {
  position: fixed; z-index: var(--z-sheet-backdrop); inset: var(--header-h) 0 0;
  background: rgba(0,0,0,0.42); backdrop-filter: blur(2px);
}
.responsive-sheet-backdrop[hidden] { display: none; }

/* ── Responsive shell ───────────────────────────────────────────────────── */
.hdr-mobile-only { display: none; }
#mobileDevSelect { max-width: 150px; }
.drawer-backdrop { display: none; }   /* .app.controls-open reveals it */

/* Tablet: the stage remains stable while Layers and Properties become mutually
   exclusive side sheets. The backing selection is never coupled to visibility. */
@media (max-width: 1023px) {
  .app { grid-template-columns: 1fr; grid-template-rows: var(--header-h) 1fr var(--carousel-h); }
  .stage-shell { grid-column: 1; grid-row: 2; }
  .leftpanel { display: none; }
  .inspector { display: none; }
  .main { padding: 14px; align-items: flex-start; justify-content: flex-start; }
  .carousel { display: flex; grid-column: 1; grid-row: 3; }
  .rail-resizer { display: none; }
  .hdr-mobile-only { display: inline-flex; }
  .hdr-desktop-only { display: none !important; }
  .header { padding: 0 var(--sp-5); gap: var(--sp-4); }
  .header-left { gap: var(--sp-4); flex: 1 1 auto; min-width: 0; overflow: hidden; }
  .header-left h1 { flex-shrink: 1; min-width: 0; }
  .header-right { gap: var(--sp-2); flex: 0 0 auto; flex-wrap: nowrap; }
  .header #themeToggle, .header #saveIndicator { display: none; }
  #mobileDevSelect { max-width: 104px; flex-shrink: 1; min-width: 0; }
  .device-grid { flex-direction: column; align-items: center; gap: 18px; }
  .btn-sm { padding: var(--sp-4) var(--sp-5); font-size: 12px; }
  .header .btn-sm { padding: var(--sp-3) var(--sp-4); font-size: 11.5px; }
  .preview-hint { display: none; }

  .leftpanel.sheet-open {
    display: flex; position: fixed; z-index: var(--z-sheet);
    top: calc(var(--header-h) + 8px); bottom: calc(var(--carousel-h) + 8px); left: 8px;
    width: min(330px, 44vw); min-width: 260px; max-height: none;
    border: 1px solid var(--line-2); border-radius: var(--r-lg);
    box-shadow: var(--e3); overflow: hidden;
  }
  .inspector.mobile-open, .inspector.sheet-open {
    display: flex; position: fixed; z-index: var(--z-sheet); grid-column: auto; grid-row: auto;
    top: calc(var(--header-h) + 8px); right: 8px; bottom: calc(var(--carousel-h) + 8px); left: auto;
    width: min(360px, 46vw); max-height: none; min-height: 0;
    border: 1px solid var(--line-2); border-radius: var(--r-lg);
    box-shadow: var(--e3); overflow-y: auto;
  }
  .leftpanel.sheet-open .left-sheet-close,
  .inspector.mobile-open .mobile-insp-close,
  .inspector.sheet-open .mobile-insp-close {
    display: inline-flex; align-items: center; justify-content: center;
    position: sticky; top: 8px; align-self: flex-end; z-index: 3;
    min-width: 68px; min-height: 44px; margin: var(--sp-4) var(--sp-5); padding: var(--sp-3) 14px; border-radius: var(--r-pill);
    border: 1px solid var(--accent-ring); background: var(--accent-deep); color: #fff;
    font: 600 12px var(--font-ui); cursor: pointer; box-shadow: var(--e2);
  }
  .leftpanel.sheet-open .left-sheet-close { flex: 0 0 auto; }
  .inspector.mobile-open .insp-chipbtn, .inspector.sheet-open .insp-chipbtn { min-height: 38px; padding: var(--sp-3) var(--sp-5); }
  .inspector.mobile-open .align-action, .inspector.sheet-open .align-action { min-height: 44px; font-size: 10.5px; }
  .inspector.mobile-open .insp-sw, .inspector.sheet-open .insp-sw { width: 32px; height: 32px; }
  .inspector.mobile-open .insp-lock, .inspector.sheet-open .insp-lock { min-width: 44px; min-height: 44px; }
  .inspector.mobile-open .sel-tools, .inspector.sheet-open .sel-tools { flex-wrap: wrap; }
  .inspector.mobile-open .anchor-grid, .inspector.sheet-open .anchor-grid { width: 96px; height: 96px; }
  .inspector.mobile-open .insp-foot, .inspector.sheet-open .insp-foot { display: none; }
  .firstrun-card {
    top: 12px; transform: translateX(-50%); width: calc(100% - 16px);
    max-height: calc(100dvh - var(--header-h) - 24px); overflow-y: auto; padding: var(--sp-7);
  }
  .fr-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }

@media (max-width: 699px) {
  .header-left h1 { font-size: 13.5px; }
  .header .btn-sm, .header select { min-height: 44px; padding: var(--sp-3) var(--sp-4); }
  .header #undoBtn, .header #redoBtn { display: none; }
  .legacy-workflow-toggle { width: 44px; min-width: 44px; padding-left: 0 !important; padding-right: 0 !important; font-size: 0 !important; }
  .legacy-workflow-toggle::before { content: '•••'; font: 700 10px var(--font-ui); letter-spacing: 1px; }
  .responsive-sheet-toggle { min-width: 44px; min-height: 44px; padding: 0 var(--sp-3); font-size: 10px; }
  .carousel { padding: var(--sp-5); }
  :root { --carousel-h: 104px; --header-h: 50px; }
  /* Keep scope visible without laying it over the first selected object. */
  .scope-badge { top: 6px; right: 8px; font-size: 8.5px; padding: var(--sp-1) var(--sp-3); }
  .leftpanel.sheet-open,
  .inspector.mobile-open, .inspector.sheet-open {
    top: auto; left: 6px; right: 6px;
    bottom: calc(var(--carousel-h) + max(6px, env(safe-area-inset-bottom)));
    width: auto; min-width: 0; max-height: min(68dvh, 640px);
    border-radius: var(--r-lg);
  }
  .leftpanel.sheet-open .lp-foot { display: none; }
  .leftpanel.sheet-open .lp-slides { max-height: 38%; }
  .workflow-modal, .surface-modal, .dmodal, .cmdk {
    top: 6px; width: calc(100vw - 12px); height: calc(100dvh - 12px);
    max-height: calc(100dvh - 12px); border-radius: var(--r-lg);
  }
  .color-editor {
    left: 6px !important; right: 6px !important; top: auto !important; bottom: 6px;
    width: calc(100vw - 12px); max-height: calc(100dvh - 12px); border-radius: var(--r-lg);
  }
  .surface-modal-body.surface-mode-settings { padding: 0; }
  .surface-modal-body.surface-mode-motion { padding: 0; }
  .brand-save-grid { grid-template-columns: 1fr; }
  .brand-save-foot .btn { min-height: 44px; }
  .surface-modal-body.surface-mode-asset-preview { padding: 0; }
  .asset-preview { grid-template-columns: 1fr; grid-template-rows: minmax(260px, 1fr) auto auto; overflow-y: auto; }
  .asset-preview-info { overflow: visible; border-left: 0; border-top: 1px solid var(--line); }
  .asset-preview-nav { grid-column: 1; position: sticky; bottom: 0; }
  .asset-preview-nav .btn { min-height: 44px; }
  .asset-usage-slide { min-height: 44px; }
  .asset-import-dialog { grid-template-columns: auto minmax(0, 1fr); align-items: center; }
  .asset-import-dialog > .btn { grid-column: 1 / -1; min-height: 44px; }
  .motion-surface { grid-template-rows:minmax(220px,.8fr) auto minmax(0,1.2fr); }
  .motion-preview-head > span { display:none; }
  .motion-preview-wrap { padding:var(--sp-3); }
  .motion-transport { grid-template-columns:1fr 1fr; }
  .motion-transport input[type="range"] { grid-column:1 / -1; grid-row:2; }
  .motion-transport output { grid-column:1 / -1; text-align:center; }
  .motion-story-row { overflow-x:auto; padding-bottom:var(--sp-1); }
  .motion-story-slide { flex:0 0 120px; min-height:44px; }
  .motion-timeline-panel { grid-template-columns:1fr; overflow:auto; }
  .motion-track-list { min-height:230px; border-right:0; border-bottom:1px solid var(--line); }
  .motion-addbar { align-items:stretch; flex-wrap:wrap; }
  .motion-addbar > select:first-child { flex:1; max-width:none; }
  .motion-addbar > label { width:100%; margin-left:0; justify-content:flex-end; }
  .motion-track-row { grid-template-columns:112px minmax(180px,1fr); }
  .motion-step-side { min-height:260px; }
  .settings-shell { grid-template-columns: 1fr; grid-template-rows: auto minmax(0, 1fr); width: 100%; height: 100%; min-height: 0; }
  .settings-nav { flex-direction: row; gap: var(--sp-3); padding: var(--sp-4); overflow-x: auto; border-right: 0; border-bottom: 1px solid var(--line); }
  .settings-nav button { flex: 0 0 auto; width: auto; min-width: 118px; min-height: 44px; padding: var(--sp-4) var(--sp-5); }
  .settings-nav small { display: none; }
  .settings-content { padding: var(--sp-7) 14px 22px; }
  .settings-panel { max-width: none; }
  .settings-two-fields, .settings-file-actions { grid-template-columns: 1fr; }
  .settings-field-action { grid-template-columns: 1fr; align-items: stretch; }
  .settings-pref-row { min-height: 48px; }
  .settings-switch { width: 44px; height: 26px; flex-basis: 44px; }
  .settings-switch::after { width: 20px; height: 20px; }
  .settings-switch.on::after { transform: translateX(18px); }
  .settings-danger-row { align-items: stretch; flex-direction: column; }
  .guide-snap-grid { grid-template-columns: 1fr; }
  .guide-snap-head { align-items: flex-start; }
  .grid-axis-row, .grid-axis-settings.compact .grid-axis-row { grid-template-columns: 1fr 1fr; }
  .grid-axis-copy { grid-column: 1 / -1; }
  .surface-modal .tmpl-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .workflow-steps { grid-template-columns: 1fr; }
  .batch-options { grid-template-columns: 1fr; }
  .set-row { grid-template-columns: 60px minmax(0, 1fr); align-items: start; }
  .set-thumb { height: 70px; }
  .set-fields { grid-template-columns: 1fr; }
  .set-status { grid-column: 2; flex-direction: row; align-items: center; }
  .set-actions { grid-column: 2; grid-template-columns: repeat(4, minmax(40px, 1fr)); }
  .workflow-foot { align-items: stretch; flex-direction: column; }
  .workflow-foot .btn { width: 100%; }
  .leftpanel.sheet-open button, .leftpanel.sheet-open input, .leftpanel.sheet-open select,
  .inspector.mobile-open button, .inspector.mobile-open input, .inspector.mobile-open select,
  .inspector.sheet-open button, .inspector.sheet-open input, .inspector.sheet-open select,
  .workflow-modal button, .workflow-modal input, .workflow-modal select,
  .workflow-modal textarea, .workflow-modal label.btn,
  .surface-modal button, .surface-modal input, .surface-modal select,
  .surface-modal textarea, .surface-modal label.btn,
  .dmodal button, .dmodal input, .dmodal select,
  .cmdk input, .cmdk-row,
  .color-editor button, .color-editor input, .color-editor select { min-height: 44px; }
  .leftpanel.sheet-open button, .inspector.mobile-open button, .inspector.sheet-open button,
  .workflow-modal button, .surface-modal button, .dmodal button, .color-editor button { min-width: 44px; }
  .inspector.mobile-open .insp-chipbtn, .inspector.sheet-open .insp-chipbtn { min-height: 44px; }
  .inspector.mobile-open .insp-num-field, .inspector.sheet-open .insp-num-field {
    height: 44px; grid-template-columns: 44px minmax(0, 1fr);
  }
  .leftpanel.sheet-open .lp-layer { min-height: 44px; box-sizing: border-box; }
  .leftpanel.sheet-open .lp-acts { display: inline-flex; }
  .leftpanel.sheet-open .lp-layer button.lp-act { min-width: 44px; min-height: 44px; display: inline-grid; place-items: center; }
  .leftpanel.sheet-open .lp-del {
    display: inline-flex; align-items: center; justify-content: center;
    min-width: 44px; min-height: 44px; padding: 0;
  }
  .guide-row { grid-template-columns: 44px minmax(0, 1fr) 78px 44px 44px; }
  .guide-axis, .guide-row .guide-delete { width: 44px; min-width: 44px; height: 44px; }
  .color-eyedropper { width: 44px; height: 44px; }
  .color-mode button { min-height: 44px; }
  .color-presets { grid-template-columns: repeat(auto-fill, minmax(44px, 1fr)); }
  .color-preset { min-width: 44px; min-height: 44px; }
  .color-slider { min-height: 44px; }
  .color-slider input { min-height: 44px; }
  .color-hue input {
    height: 44px; background-size: 100% 12px; background-repeat: no-repeat; background-position: center;
  }
  .guide-manager-head { grid-template-columns: 1fr; }
  .guide-row .guide-delete { grid-column: 5; }
  .surface-modal .settings-switch, .dmodal .settings-switch {
    width: 44px; height: 44px; min-width: 44px; min-height: 44px; border: 0; background: transparent; box-shadow: none;
  }
  .surface-modal .settings-switch::before, .dmodal .settings-switch::before {
    content: ''; position: absolute; top: 9px; left: 0; width: 44px; height: 26px;
    border: 1px solid var(--line-3); border-radius: var(--r-pill); background: var(--fill-2); box-sizing: border-box;
  }
  .surface-modal .settings-switch::after, .dmodal .settings-switch::after { top: 12px; left: 3px; }
  .surface-modal .settings-switch.on::before, .dmodal .settings-switch.on::before { border-color: var(--accent-ring); background: linear-gradient(180deg, var(--accent-bright), var(--accent-deep)); }
  .smart-entry { align-items: stretch; flex-direction: column; }
  .smart-upload { align-items: stretch; flex-direction: column; }
  .smart-upload .btn { width: 100%; }
}
/* Phones: the wordmark yields to the brand mark + device select + actions. */
@media (max-width: 560px) {
  .header-left h1 { display: none; }
}

/* ── Reduced motion ─────────────────────────────────────────────────────── */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.001ms !important; animation-iteration-count: 1 !important; transition-duration: 0.001ms !important; scroll-behavior: auto !important; }
}

/* ── Design-system Phase 1: keyboard focus parity (plan §5, pulled forward) ──
   Every interactive control gets a visible focus ring, and hover-revealed
   actions also appear when reached by keyboard. */
button:focus-visible, select:focus-visible, input:focus-visible,
textarea:focus-visible, [role="button"]:focus-visible {
  outline: none;
  box-shadow: var(--focus-ring);
}
.lp-slide:focus-within .lp-del { display: inline-flex; }
.lp-layer:focus-within .lp-acts { display: inline-flex; }

/* ── COMPONENT: scope disclosure (design-system Phase 3) ──────────────────
   Collapsed, the edit-target reads as one summary line so controls come
   first; open, it reveals the full targeting model. Matches the section
   rhythm used elsewhere: label on top, state beneath, caret at the right. */
.insp-scope-sec { display: block; }
.insp-scope-toggle {
  position: relative;
  display: flex; flex-direction: column; gap: var(--sp-2);
  padding-right: var(--sp-7);
  cursor: pointer; list-style: none;
}
.insp-scope-toggle::-webkit-details-marker { display: none; }
.insp-scope-toggle::after {
  content: '\25B8'; position: absolute; right: 0; top: 0;
  color: var(--label-color); font-size: 10px; line-height: 1.4;
  transition: transform 0.15s var(--ease);
}
.insp-scope-sec[open] > .insp-scope-toggle::after { transform: rotate(90deg); }
.insp-scope-toggle-state { display: flex; align-items: center; gap: var(--sp-3); min-width: 0; }
.insp-scope-toggle-text {
  min-width: 0; font-size: 11.5px; line-height: 1.4; color: var(--text2);
  transition: color 0.12s;
}
.insp-scope-toggle:hover .insp-scope-toggle-text { color: var(--text1); }
.insp-scope-sec[open] > .insp-scope-toggle { margin-bottom: var(--sp-4); }
.stage-pill.pf-setup { border-color: var(--accent-35); }
.stage-pill.pf-setup .pf-dot { background: var(--accent); box-shadow: 0 0 8px var(--accent-35); }

/* VF supporting copy stays readable in compact panels; geometry and icon glyphs
   keep their existing sizes. These are UI-only selectors, never canvas text. */
.insp-help, .lp-foot, .lp-section-intro, .lp-kit-summary, .lp-kit-option,
.insp-field-label, .insp-scope-summary span, .insp-override-policy > span,
.stage-hint, .device-label .device-dims { font-size: 11px; }

/* ── A11y (design-system Phase 5): target sizes ─────────────────────────────
   Undersized controls found by audit are padded up to the WCAG 2.2 AA
   minimum without changing their visual weight; coarse pointers get the
   larger touch guidance across every interactive control. */
.insp-lock, .lp-act {
  min-width: var(--hit-min); min-height: var(--hit-min);
  display: inline-flex; align-items: center; justify-content: center;
}
.lp-tab { min-height: var(--hit-min); }
.insp-link { min-height: var(--hit-min); display: inline-flex; align-items: center; }
.frame-label { min-height: var(--hit-min); }

@media (pointer: coarse) {
  .chip, .insp-chipbtn, .bg-mode-btn, .stage-pill, .zb-btn, .zb-pct,
  .dsw-manage, .tb-tool, .lp-tab, .lp-act, .insp-lock, .insp-link, .insp-sw,
  .coverage-pill, .tb-project, .menu-item {
    min-height: var(--hit-touch);
  }
  .insp-sw { min-width: var(--hit-touch); }
}

/* VF composition pass. The editor keeps its canvas and command hooks, while
   hierarchy follows the live System's identity, section, field and action roles. */
:root { --header-h: 128px; --leftpanel-w: 264px; --inspector-w: 320px; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0; }
body { font-size: 14px; }
.header { display: grid; grid-template-columns: minmax(0,1fr) auto; grid-template-rows: 72px 56px; padding: 0 24px; gap: 0 24px; background: var(--bg); }
.header-left { gap: 24px; overflow: hidden; }
.studio-identity { display: inline-flex; align-items: center; gap: 12px; flex: 0 0 auto; color: var(--text1); }
.studio-identity > span { font: 650 23px/1.1 var(--font-ui); letter-spacing: -.055em; }
.studio-identity img { width: 32px; height: 32px; }
.studio-identity small { display: block; margin-top: 4px; color: var(--text3); font: 500 10px/1.4 var(--font-mono); letter-spacing: .08em; }
.studio-project { border-left: 1px solid var(--line); padding-left: 24px; min-width: 0; }
.studio-eyebrow { display: block; font: 500 11px/1.5 var(--font-mono); letter-spacing: .055em; text-transform: uppercase; color: var(--text3); }
.header-left h1 { font: 550 20px/1.25 var(--font-ui); letter-spacing: -.04em; margin-top: 4px; }
.tb-project { flex: 0 0 auto; min-height: 40px; padding: 8px 12px; border: 1px solid var(--line); font-size: 13px; }
.header-right { grid-column: 2; grid-row: 1; gap: 8px; flex-wrap: nowrap; }
.header .btn { min-height: 40px; padding: 8px 12px; font-size: 13px; }
.header #goExportBtn { min-height: 44px; padding: 12px 20px; font-size: 15px; }
.header #saveIndicator { font-size: 11px !important; opacity: 1 !important; }
.coverage-pill { min-height: 36px; border-radius: 4px; font-size: 12px; box-shadow: none; }
.tb-tools { grid-column: 1 / -1; grid-row: 2; align-self: stretch; border: 0; border-top: 1px solid var(--line); border-radius: 0; padding: 6px 0; background: transparent; gap: 8px; min-width: 0; }
.tool-caption { margin-right: 16px; }
.tb-tool, .tb-tool.tb-insert { width: auto; min-width: 60px; height: 40px; padding: 8px 12px; border-radius: 4px; font: 550 14px var(--font-ui); gap: 8px; flex: 0 0 auto; }
.tb-tool.active { background: var(--btn-p-from); color: #fff; border-color: var(--btn-p-from); }
.tb-tool-label { min-height: 40px; font-size: 14px; padding-inline: 16px; border-radius: 4px; flex: 0 0 auto; }
.tb-sep { margin-left: auto; margin-right: 8px; height: 24px; }
.tb-kbd { margin-left: 8px; }
.studio-mobile-nav { display: none; }

/* Rule-separated rails: one panel heading, then meaningful content groups. */
.studio-panel-heading { padding: 24px 24px 16px; flex: 0 0 auto; }
.studio-panel-heading h2 { font: 550 25px/1.15 var(--font-ui); letter-spacing: -.045em; margin-top: 8px; color: var(--text1); }
.lp-tabs { gap: 24px; margin: 0 24px 16px; padding: 0; border-bottom: 1px solid var(--line); }
.lp-tab { border-radius: 0; min-height: 40px; padding: 8px 0; font: 550 14px var(--font-ui); text-transform: none; letter-spacing: 0; }
.lp-tab.active { background: transparent; box-shadow: inset 0 -2px var(--accent); }
.lp-label { padding: 16px 24px 12px; font: 550 16px/1.3 var(--font-ui); letter-spacing: -.02em; text-transform: none; color: var(--text1); }
.lp-slides-label { padding-top: 0; }
.lp-slides { padding: 0 16px 16px; gap: 8px; max-height: 43%; }
.lp-slide { padding: 8px; gap: 12px; min-height: 64px; border-radius: 4px; border-color: var(--line); }
.lp-slide canvas { height: 48px; border-radius: 2px; }
.lp-slide-name { font-size: 14px; }
.lp-slide.active { border-color: var(--accent); background: var(--accent-08); box-shadow: inset 3px 0 var(--accent); }
.lp-add { min-height: 40px; padding: 8px; color: var(--accent); font-size: 14px; }
.lp-layers { padding: 0 16px 16px; gap: 4px; }
.lp-layer { padding: 8px; min-height: 40px; font-size: 14px; border-radius: 4px; }
.lp-glyph { width: 20px; font-size: 12px; }
.lp-foot { padding: 16px 24px; font-size: 12px; background: var(--bg); }
.lp-foot strong, .lp-foot span { display: block; }
.lp-foot strong { color: var(--text1); font-weight: 550; }
.lp-foot .insp-link { margin-top: 8px; font-size: 12px; }
.lp-step { font-size: 14px; padding: 12px 8px; gap: 12px; }
.lp-step-chip { width: 28px; height: 28px; border-radius: 4px; font-size: 12px; }
.insp-head { margin: 0 24px; padding: 12px 0 16px; gap: 12px; border-bottom: 1px solid var(--line); }
.insp-title { font: 550 18px/1.3 var(--font-ui); letter-spacing: -.025em; }
.insp-chip { padding: 4px 8px; font-size: 13px; }
.insp-sec { margin: 0 24px; padding: 24px 0; gap: 12px; }
.insp-label { font: 550 16px/1.35 var(--font-ui); color: var(--text1); letter-spacing: -.02em; text-transform: none; }
.insp-sec .insp-label:not(:first-child) { margin-top: 8px; font-size: 13px; }
.insp-scope-sec { background: var(--bg); margin: 16px 24px 0; padding: 12px; border: 1px solid var(--line); border-radius: 4px; }
.insp-scope-toggle .insp-label { font-size: 13px; }
.insp-row, .insp-val, .insp-scope, .insp-field-label, .studio-field { font-size: 13px; line-height: 1.5; }
.studio-field { display: flex; flex-direction: column; gap: 8px; color: var(--text2); font-weight: 500; }
.insp-sec textarea, .insp-sec input[type="text"], .insp-scope { min-height: 40px; padding: 10px 12px; font-size: 14px; border-radius: 4px; }
.insp-sec textarea { min-height: 84px; }
.insp-num-field { min-height: 40px; grid-template-columns: 28px minmax(0,1fr); border-radius: 4px; }
.insp-num-label { font-size: 11px; }
.insp-num-field input[type="number"] { font-size: 13px; }
.insp-geom-grid, .insp-scope-grid { gap: 8px; }
.insp-help, .section-note, .insp-scope-summary span, .insp-override-policy > span, .insp-scope-grid > label { font-size: 12px; line-height: 1.55; }
.insp-scope-summary strong, .insp-override-policy > strong { font-size: 13px; }
.chip, .insp-chipbtn, .bg-mode-btn { min-height: 36px; padding: 8px 10px; border-radius: 4px; font-size: 13px; }
.insp-link { font-size: 13px; text-align: left; line-height: 1.5; text-underline-offset: 4px; }
.color-trigger { min-height: 44px; }
.insp-sec input[type="range"] { min-height: 20px; }
.insp-foot { font-size: 11px; padding: 16px 24px; }

/* Dock controls to the workspace edges; artwork remains unchanged. */
@media (min-width: 1024px) {
  .main { position: absolute; top: 96px; bottom: 96px; height: auto; padding: 24px 32px; }
  .device-switcher { top: 0; left: 0; right: 0; transform: none; width: 100%; max-width: none; min-height: 64px; padding: 12px 24px; gap: 12px; background: var(--bg); border: 0; border-bottom: 1px solid var(--line); border-radius: 0; box-shadow: none; backdrop-filter: none; }
  .dsw-select { height: 40px; font-size: 13px; border-radius: 4px; }
  .dsw-label { font-size: 11px; }
  .dsw-manage { height: 40px; font-size: 13px; border-radius: 4px; }
  .preview-hint { top: auto; bottom: 72px; left: 24px; max-width: calc(100% - 48px); font: 11px/1.5 var(--font-ui); }
  .scope-badge { top: 72px; left: 24px; right: auto; max-width: calc(100% - 48px); padding: 0; font: 11px/1.5 var(--font-mono); background: transparent; border: 0; backdrop-filter: none; }
  .studio-stage-footer { display: flex; justify-content: space-between; flex-wrap: wrap; align-content: center; align-items: center; gap: 8px 16px; position: absolute; bottom: 0; left: 0; right: 0; min-height: 64px; padding: 8px 16px; background: var(--bg); border-top: 1px solid var(--line); z-index: var(--z-canvas-ui); }
  .zoombar, .stage-pills { position: static; padding: 0; background: transparent; border: 0; border-radius: 0; box-shadow: none; backdrop-filter: none; gap: 4px; }
  .stage-pills { flex-wrap: wrap; }
  .stage-pill { min-height: 36px; font-size: 12px; padding: 8px; background: transparent; border-color: transparent; border-radius: 4px; box-shadow: none; backdrop-filter: none; }
  .stage-pill:hover { background: var(--fill-1); }
  .zb-btn, .zb-pct { min-height: 36px; min-width: 32px; font-size: 12px; }
  .stage-rows { padding: 0; gap: 32px; }
  .frame-strip { gap: 32px; }
  .row-head { padding-bottom: 12px; border-bottom: 1px solid var(--line); }
  .row-title { font-size: 15px; font-weight: 550; }
  .frame-label { font-size: 13px; }
}
.main::before { display: none; }
.frame canvas, .device-card canvas, .device-card.selected canvas, .device-card canvas:hover { box-shadow: 0 2px 8px rgba(0,0,0,.16); border-radius: 2px; transform: none; }

/* Dialogs use the same reading hierarchy and field/action composition. */
.btn { min-height: 40px; font-size: 14px; padding: 10px 16px; border-radius: 4px; }
.btn-sm { min-height: 36px; font-size: 13px; padding: 8px 12px; }
.btn:disabled { opacity: .55; }
.dmodal-head { min-height: 80px; padding: 20px 24px; font: 550 26px/1.2 var(--font-ui); letter-spacing: -.04em; background: var(--bg); }
.dmodal-head .btn { letter-spacing: 0; }
.dmodal-body, .surface-modal-body, .workflow-modal-body { padding: 24px; }
.surface-modal, .dmodal, .workflow-modal { border-radius: 8px; backdrop-filter: none; }
.surface-modal[data-surface="settings"] { width: min(980px,95vw); }
.settings-shell { grid-template-columns: 220px minmax(0,1fr); }
.settings-nav { padding: 24px 16px; gap: 8px; background: var(--bg); }
.settings-nav button { padding: 12px; border-radius: 4px; }
.settings-nav span { font-size: 15px; font-weight: 550; }
.settings-nav small { font-size: 12px; line-height: 1.5; margin-top: 4px; }
.settings-content { padding: 32px; }
.settings-panel { gap: 24px; }
.settings-pane-head h3 { font: 550 28px/1.15 var(--font-ui); letter-spacing: -.04em; }
.settings-pane-head p, .settings-help, .settings-pref-copy span, .settings-section-heading p { font-size: 14px; line-height: 1.6; }
.settings-section { padding: 24px 0; border: 0; border-top: 1px solid var(--line); border-radius: 0; background: transparent; }
.settings-section h4 { font-size: 18px; font-weight: 550; margin-bottom: 16px; }
.settings-section .surface-field, .surface-field { font-size: 14px; gap: 8px; }
.surface-field input, .surface-field select { min-height: 44px; padding: 12px; font-size: 15px; }
.settings-pref-copy strong { font-size: 15px; }
.settings-pref-row { padding: 16px 0; }
.settings-example { padding: 12px 16px; font-size: 12px; line-height: 1.6; }
.menu-item { min-height: 44px; padding: 12px 16px; font-size: 14px; }
.popover { border-radius: 4px; }
.tmpl-chip { min-height: 36px; font-size: 13px; border-radius: 4px; padding: 8px 12px; }
.tmpl-empty { font-size: 15px; padding: 32px; }
@media (min-width: 1024px) and (max-width: 1279px) {
  .header { padding-inline: 16px; gap: 0 16px; }
  .header-left { gap: 16px; }
  .studio-project { padding-left: 16px; }
  .studio-identity > span { font-size: 20px; }
  .header #saveIndicator, .coverage-pill { display: none; }
  .tool-caption { display: none; }
  .studio-stage-footer { min-height: 104px; }
  .main { bottom: 136px; }
  .preview-hint { bottom: 112px; }
  .device-switcher { padding-inline: 16px; gap: 8px; }
  .dsw-label { display: none; }
}
@media (max-width: 1023px) {
  :root { --header-h: 176px; }
  .header { grid-template-rows: 64px 56px 56px; padding: 0 16px; gap: 0 12px; }
  .studio-identity > span { font-size: 20px; }
  .studio-identity small { font-size: 9px; }
  .studio-identity img { width: 28px; height: 28px; }
  .studio-project { display: none; }
  .header .legacy-workflow-toggle { width: auto; min-width: 44px; padding: 8px !important; font-size: 12px !important; }
  .legacy-workflow-toggle::before { display: none; }
  .header #goExportBtn { min-height: 44px; padding: 10px 16px; font-size: 14px; }
  .header #undoBtn, .header #redoBtn { display: none; }
  .tb-tools { display: flex; overflow-x: auto; scrollbar-width: thin; gap: 4px; }
  .tool-caption { display: none; }
  .tb-tool, .tb-tool.tb-insert { min-height: 44px; min-width: 56px; padding-inline: 10px; font-size: 13px; }
  .tb-sep { margin-left: 8px; flex: 0 0 1px; }
  .tb-tool-label { font-size: 13px; min-height: 44px; padding-inline: 12px; }
  .studio-mobile-nav { grid-column: 1 / -1; grid-row: 3; display: flex; align-items: center; gap: 8px; border-top: 1px solid var(--line); }
  .studio-mobile-nav .responsive-sheet-toggle { min-height: 44px; padding: 8px 12px; font-size: 13px; border-radius: 4px; }
  #mobileDevSelect { flex: 1; min-width: 0; max-width: none; height: 40px; font-size: 13px; padding: 8px; border-radius: 4px; }
  .main { padding: 40px 16px 16px; }
  .scope-badge { top: 8px; left: 16px; right: auto; max-width: calc(100% - 32px); font-size: 11px; }
  .studio-panel-heading { padding: 16px 24px; }
  .leftpanel.sheet-open, .inspector.sheet-open, .inspector.mobile-open { border-radius: 4px; }
  .sheet-close { border-radius: 4px !important; box-shadow: none !important; }
  .inspector.sheet-open .insp-sec, .inspector.mobile-open .insp-sec { padding-block: 20px; }
  .leftpanel.sheet-open .lp-slides { max-height: 42%; }
  .settings-shell { grid-template-columns: minmax(0,1fr); }
  .settings-nav { flex-direction: row; overflow-x: auto; border-right: 0; border-bottom: 1px solid var(--line); padding: 12px; }
  .settings-nav button { width: auto; flex: 0 0 auto; }
  .settings-nav small { display: none; }
  .settings-content { padding: 24px; }
  .settings-shell { grid-template-rows: auto minmax(0,1fr); }
  .dmodal-head { min-height: 72px; font-size: 24px; padding: 16px; }
  .dmodal-body, .surface-modal-body, .workflow-modal-body { padding: 16px; }
}
@media (max-width: 479px) {
  .header { padding-inline: 12px; gap: 0 8px; }
  .studio-identity { gap: 8px; }
  .studio-identity > span { font-size: 19px; }
  .header .legacy-workflow-toggle { font-size: 11px !important; }
  .header #goExportBtn { padding-inline: 12px; }
  .header-right { gap: 4px; }
  .studio-mobile-nav .responsive-sheet-toggle { padding-inline: 8px; }
  .studio-panel-heading h2 { font-size: 24px; }
  .settings-content { padding: 20px; }
  .settings-pane-head h3 { font-size: 24px; }
  .settings-field-action { grid-template-columns: minmax(0,1fr); }
}
@media (max-width: 1023px) {
  .tb-tools { padding-block: 0; overflow-y: hidden; }
  .device-grid { width: 100%; }
  .studio-identity small { font-size: 10px; }
}
@media (min-width: 1024px) and (max-width: 1399px) {
  .studio-stage-footer { display: grid; grid-template-columns: minmax(0,1fr); gap: 4px; height: 96px; min-height: 96px; }
  .stage-pills { width: 100%; flex-wrap: nowrap; overflow-x: auto; overflow-y: hidden; }
  .stage-pill { flex: 0 0 auto; }
  .main { bottom: 128px; }
  .preview-hint { bottom: 104px; }
}
.pop-export, .pop-coverage { top: 64px; }
.pop-project { top: 64px; }
.menu-label, .insert-group-label { font-size: 11px; padding: 8px 16px; }
.menu-note, .menu-readiness, .pop-note { font-size: 12px; line-height: 1.55; }
.pop-head { font-size: 16px; }
.pop-row, .pop-cta { font-size: 13px; }
.pop-cta { min-height: 40px; }
.workflow-intro { margin-bottom: 24px; }
.workflow-intro h2 { font: 550 28px/1.2 var(--font-ui); letter-spacing: -.04em; }
.workflow-intro p, .workflow-field { font-size: 14px; }
.workflow-step { padding: 20px; background: var(--bg); border-color: var(--line); border-radius: 4px; }
.workflow-step h3 { font-size: 16px; margin-bottom: 16px; }
.workflow-step h3 span { width: 28px; height: 28px; border-radius: 4px; font-size: 12px; margin-right: 8px; }
.workflow-field { gap: 8px; margin-top: 16px; }
.workflow-field input, .workflow-field select { min-height: 44px; padding: 10px 12px; font-size: 15px; }
.smart-choice { padding: 12px; gap: 8px; }
.smart-choice strong, .smart-upload strong { font-size: 14px; }
.smart-choice span, .smart-check, .smart-upload p, .smart-file-empty, .workflow-summary { font-size: 12px; line-height: 1.5; }
.workflow-foot { bottom: -24px; margin: 24px -24px -24px; padding: 16px 24px; }
.surface-modal .sec h3 { font-size: 18px; text-transform: none; letter-spacing: -.025em; }
@media (max-width: 1023px) {
  .pop-export, .pop-project, .pop-coverage { top: 58px; }
  .workflow-foot { bottom: -16px; margin: 16px -16px -16px; padding: 16px; }
}
@media (max-width: 359px) { .studio-identity img { display: none; } }

/* Supporting workflow copy follows the same field and metadata roles. */
.template-levels { gap: 8px; margin-bottom: 16px; }
.template-levels span { padding: 12px; font-size: 12px; line-height: 1.5; }
.template-levels strong { font-size: 13px; }
.template-search { min-height: 44px; padding: 10px 12px; font-size: 14px; }
.tmpl-info { padding: 16px; border-radius: 4px; background: var(--bg); }
.tmpl-name { font-size: 15px; }
.tmpl-tag { font-size: 10px; }
.tmpl-desc, .tmpl-prev { font-size: 13px; line-height: 1.5; }
.tmpl-meta { font-size: 11px; line-height: 1.5; }

/* Density correction: preserve VF hierarchy without reserving website-sized
   chrome around an editing workspace. Add slide is outside the scroll region. */
#lpAddSlide { flex: 0 0 44px; min-height: 44px; width: auto; margin: 0 16px; padding: 8px; border-bottom: 1px solid var(--line); border-radius: 0; }
#lpAddSlide[hidden] { display: none; }
.lp-slides { border-bottom: 0; padding-bottom: 8px; min-height: 0; }
.lp-slide { flex-shrink: 0; }
.studio-panel-heading { padding: 16px 16px 8px; }
.studio-panel-heading h2 { font-size: 22px; margin-top: 4px; }
.lp-tabs { margin: 0 16px 8px; }
.lp-label { padding: 12px 16px 8px; }
.lp-slides-label { padding-top: 0; }
.lp-foot { padding: 12px 16px; }
.insp-head { margin: 0 16px; padding: 8px 0; }
.insp-title { font-size: 16px; }
.insp-sec { margin: 0 16px; padding: 16px 0; gap: 8px; }
.insp-scope-sec { margin: 8px 16px 0; padding: 8px; }
.studio-field { gap: 4px; }
.insp-sec textarea { min-height: 60px; padding: 8px 10px; }
.insp-sec .insp-label:not(:first-child) { margin-top: 4px; }
.insp-foot { padding: 12px 16px; }
@media (min-width: 1024px) {
  :root { --header-h: 96px; }
  .header { grid-template-rows: 52px 44px; }
  .studio-identity > span { font-size: 21px; }
  .studio-identity small { font-size: 9px; margin-top: 2px; }
  .studio-project .studio-eyebrow { font-size: 10px; }
  .header-left h1 { font-size: 18px; margin-top: 2px; }
  .header #goExportBtn { min-height: 40px; padding-block: 8px; }
  .tb-tools { padding: 0; gap: 8px; }
  .tb-tool, .tb-tool.tb-insert, .tb-tool-label { height: 36px; min-height: 36px; padding-block: 6px; }
  .device-switcher { min-height: 48px; padding: 6px 16px; }
  .dsw-select, .dsw-manage { height: 36px; }
  .scope-badge { top: 52px; left: 16px; }
  .main { top: 72px; bottom: 64px; padding: 16px 24px; }
  .studio-stage-footer { min-height: 48px; padding-block: 4px; }
  .preview-hint { bottom: 52px; left: 16px; }
  .pop-export, .pop-coverage, .pop-project { top: 48px; }
}
@media (min-width: 1024px) and (max-width: 1399px) {
  .studio-stage-footer { min-height: 80px; height: 80px; }
  .main { bottom: 96px; }
  .preview-hint { bottom: 84px; }
}
@media (max-width: 1023px) {
  :root { --header-h: 160px; }
  .header { grid-template-rows: 56px 56px 48px; }
  .studio-panel-heading { padding: 12px 16px 8px; }
  .inspector.sheet-open .insp-sec, .inspector.mobile-open .insp-sec { padding-block: 16px; }
  .inspector.sheet-open .insp-scope-sec, .inspector.mobile-open .insp-scope-sec { padding: 8px; }
  .pop-export, .pop-project, .pop-coverage { top: 52px; }
}
