/* LuxuryAI — refined dark editorial design system */

/* Self-hosted fonts (rebuild via scripts/fonts/build-fonts.sh). General Sans is
   bbox-corrected to silence Firefox "Glyph bbox was incorrect" warnings; Geist
   Mono is the variable latin subset. Manual ?v= cache-bust — the deploy step
   rewrites only /assets/(js|css)/* refs in HTML, not url() inside CSS. */
@font-face{font-family:'General Sans';font-style:normal;font-weight:400;font-display:swap;src:url('/assets/fonts/general-sans/general-sans-400.woff2?v=1') format('woff2');}
@font-face{font-family:'General Sans';font-style:normal;font-weight:500;font-display:swap;src:url('/assets/fonts/general-sans/general-sans-500.woff2?v=1') format('woff2');}
@font-face{font-family:'General Sans';font-style:normal;font-weight:600;font-display:swap;src:url('/assets/fonts/general-sans/general-sans-600.woff2?v=1') format('woff2');}
@font-face{font-family:'General Sans';font-style:normal;font-weight:700;font-display:swap;src:url('/assets/fonts/general-sans/general-sans-700.woff2?v=1') format('woff2');}
@font-face{font-family:'Geist Mono';font-style:normal;font-weight:400 600;font-display:swap;src:url('/assets/fonts/geist-mono/geist-mono-latin.woff2?v=1') format('woff2');unicode-range:U+0000-00FF,U+0131,U+0152-0153,U+02BB-02BC,U+02C6,U+02DA,U+02DC,U+0304,U+0308,U+0329,U+2000-206F,U+20AC,U+2122,U+2191,U+2193,U+2212,U+2215,U+FEFF,U+FFFD;}

:root {
  /* Tonal ink — near-pure obsidian black */
  --ink-0: oklch(0.10 0.004 60);     /* deepest bg */
  --ink-1: oklch(0.13 0.005 60);     /* base bg */
  --ink-2: oklch(0.17 0.006 60);     /* surface */
  --ink-3: oklch(0.22 0.006 60);     /* raised surface */
  --ink-4: oklch(0.28 0.007 60);     /* border */
  --ink-5: oklch(0.38 0.008 60);     /* divider strong */

  /* Type */
  --fg-0: oklch(0.98 0.005 80);      /* primary text */
  --fg-1: oklch(0.78 0.008 70);      /* secondary */
  --fg-2: oklch(0.56 0.008 70);      /* tertiary */
  --fg-3: oklch(0.42 0.008 70);      /* quaternary */

  /* Warm gold — matched to the Luxury Ai banner */
  --brass-0: oklch(0.94 0.07 78);
  --brass-1: oklch(0.84 0.12 75);    /* primary gold */
  --brass-2: oklch(0.70 0.13 70);    /* deep gold */
  --brass-3: oklch(0.50 0.10 65);    /* dark gold */
  --brass-tint: oklch(0.84 0.12 75 / 0.10);
  --brass-glow: oklch(0.84 0.12 75 / 0.18);

  /* States */
  --success: oklch(0.78 0.10 150);
  --danger: oklch(0.70 0.15 25);

  /* Type families — Higgsfield-style geometric sans */
  --font-display: 'General Sans', system-ui, sans-serif;
  --font-body: 'General Sans', system-ui, sans-serif;
  --font-mono: 'Geist Mono', 'SF Mono', monospace;

  /* Radii */
  --r-xs: 4px;
  --r-sm: 6px;
  --r-md: 10px;
  --r-lg: 14px;
  --r-xl: 20px;

  /* Shadows — subtle, deep */
  --shadow-1: 0 1px 0 0 oklch(1 0 0 / 0.04) inset, 0 1px 2px oklch(0 0 0 / 0.4);
  --shadow-2: 0 1px 0 0 oklch(1 0 0 / 0.05) inset, 0 8px 24px -8px oklch(0 0 0 / 0.5);
  --shadow-brass: 0 0 0 1px oklch(0.82 0.10 82 / 0.25), 0 8px 24px -8px oklch(0.82 0.10 82 / 0.3);

  /* Legacy-token bridge — map the pre-Remix HEX-token names to the OKLCH brass/ink
     palette so lx-shell.css, lx-modules.css, lx-clipboard.css, credits.css and
     admin.css resolve to the new design system without per-file rewrites. */
  --bg:                var(--ink-0);
  --surface-1:         var(--ink-1);
  --surface-2:         var(--ink-2);
  --surface-3:         var(--ink-3);
  --surface-elevated:  var(--ink-4);
  --border:            var(--ink-3);
  --border-2:          var(--ink-4);
  --text:              var(--fg-0);
  --text-muted:        var(--fg-1);
  --text-dim:          var(--fg-3);
  --accent:            var(--brass-1);
  --accent-bright:     var(--brass-0);
  --accent-soft:       var(--brass-3);
  --accent-soft-fg:    var(--brass-0);

  /* Mobile / iPad layer — safe-area & touch sizing.
     Canonical breakpoints (mirrored in @media px values throughout the app):
       xs ≤ 480   (small phone)
       sm ≤ 640   (large phone)
       md ≤ 820   (iPad portrait — primary mobile tier)
       lg ≤ 1024  (iPad landscape — drawer cuts off here)
       xl ≤ 1280  */
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  --safe-top:    env(safe-area-inset-top, 0px);
  --safe-left:   env(safe-area-inset-left, 0px);
  --safe-right:  env(safe-area-inset-right, 0px);
  --touch-min:   44px;
  --touch-pref:  48px;
}

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

html, body {
  height: 100%;
  background: var(--ink-0);
  color: var(--fg-0);
  font-family: var(--font-body);
  font-size: 14px;
  line-height: 1.5;
  font-feature-settings: 'ss01', 'cv11';
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

/* Wavy gold contour-lines layer — fixed full-viewport */
body::before {
  content: '';
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  background-image: url('/assets/img/bg-waves.svg');
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
  mix-blend-mode: screen;
  opacity: 0.55;
}

/* Ambient warm glow + vignette — sits behind everything */
body::after {
  content: '';
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  background:
    /* Fine dot-grid texture */
    radial-gradient(oklch(1 0 0 / 0.018) 1px, transparent 1px) 0 0 / 22px 22px,
    /* Top-right warm gold blob */
    radial-gradient(700px 500px at 95% 10%, oklch(0.78 0.15 75 / 0.22), transparent 60%),
    /* Bottom-left warm gold blob */
    radial-gradient(800px 600px at 5% 95%, oklch(0.70 0.13 70 / 0.18), transparent 60%),
    /* Top-left rim halo */
    radial-gradient(700px 400px at 0% -5%, oklch(0.85 0.13 75 / 0.14), transparent 55%),
    /* Vignette to keep edges deep */
    radial-gradient(140% 90% at 50% 50%, transparent 35%, oklch(0.06 0.004 60 / 0.7) 100%);
}

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

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

/* === Layout shell === */
.app {
  display: grid;
  grid-template-columns: 248px 1fr;
  height: 100vh;
  overflow: hidden;
  position: relative;
  z-index: 1;
}

/* === Sidebar === */
.sidebar {
  background:
    linear-gradient(180deg, oklch(0.10 0.004 60), oklch(0.13 0.005 60));
  border-right: 1px solid var(--ink-3);
  display: flex;
  flex-direction: column;
  padding: 0 14px 14px;
  position: relative;
  isolation: isolate;
  overflow: hidden;
}

/* Gold rim-light along the top edge of the sidebar */
.sidebar::before {
  content: '';
  position: absolute;
  top: -1px;
  left: -1px;
  right: -1px;
  height: 1px;
  background: linear-gradient(to right,
    oklch(0.95 0.10 75 / 0.5) 0%,
    oklch(0.92 0.13 78 / 0.7) 30%,
    oklch(0.84 0.12 75 / 0.4) 60%,
    transparent 100%);
  z-index: 2;
  filter: blur(0.5px);
}

/* Warm gold halo rising from the bottom of the sidebar — clipped so it
   never bleeds past the Log Out item or out of the sidebar */
.sidebar::after {
  content: '';
  position: absolute;
  bottom: -200px;
  left: -80px;
  right: -80px;
  height: 460px;
  background: radial-gradient(ellipse 50% 60% at 30% 100%, oklch(0.85 0.13 75 / 0.22), transparent 75%);
  pointer-events: none;
  z-index: -1;
}

/* Brand banner — flush to top + sides, with only a bottom divider */
.brand-banner {
  margin: 0 -14px 14px;
  border: none;
  border-bottom: 1px solid var(--ink-3);
  border-radius: 0;
  overflow: hidden;
  cursor: pointer;
  position: relative;
  box-shadow: none;
}

.brand-banner::after {
  content: '';
  position: absolute;
  bottom: -1px;
  left: 10%; right: 10%; height: 1px;
  background: linear-gradient(to right, transparent, oklch(0.85 0.13 75 / 0.5), transparent);
  pointer-events: none;
}

.brand-banner img {
  width: 100%;
  height: auto;
  display: block;
  aspect-ratio: 16 / 8;
  object-fit: cover;
  object-position: center;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 4px 4px 22px;
}

.brand-mark {
  width: 38px;
  height: 38px;
  display: grid;
  place-items: center;
  position: relative;
  flex-shrink: 0;
}

.brand-mark img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  filter: drop-shadow(0 0 12px oklch(0.85 0.13 75 / 0.45));
}

.brand-name {
  font-family: var(--font-display);
  font-weight: 400;
  font-size: 22px;
  letter-spacing: -0.01em;
  color: oklch(0.78 0.12 75);
  background: none;
  -webkit-text-fill-color: oklch(0.78 0.12 75);
  text-shadow: 0 1px 6px oklch(0.85 0.13 75 / 0.25);
}

.brand-name em {
  font-style: normal;
  font-weight: 400;
}

/* Welcome block — between brand and nav */
.welcome-block {
  padding: 8px 4px 18px;
  margin-bottom: 6px;
  border-bottom: 1px solid var(--ink-3);
  position: relative;
}

.welcome-block::after {
  content: '';
  position: absolute;
  bottom: -1px;
  left: 10%; right: 10%; height: 1px;
  background: linear-gradient(to right, transparent, oklch(0.85 0.13 75 / 0.35), transparent);
  pointer-events: none;
}

.welcome-title {
  font-family: var(--font-display);
  font-weight: 500;
  font-size: 22px;
  line-height: 1.1;
  letter-spacing: -0.02em;
  color: var(--fg-0);
  margin-bottom: 8px;
}

.welcome-sub {
font-family: var(--font-mono);
  font-weight: 600;
  font-size: 10px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--fg-3);
}

.nav-label {
font-family: var(--font-mono);
  font-weight: 600;
  font-size: 10px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--fg-3);
  padding: 18px 10px 8px;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 10px 12px;
  border-radius: var(--r-md);
  color: var(--fg-1);
  cursor: pointer;
  font-size: 13.5px;
  font-weight: 500;
  position: relative;
  border: 1px solid transparent;
  transition: background 0.15s, color 0.15s, border-color 0.15s;
}

.nav-item:hover {
  background: oklch(1 0 0 / 0.025);
  color: var(--fg-0);
}

.nav-item.active {
  background:
    linear-gradient(180deg, oklch(1 0 0 / 0.05), oklch(1 0 0 / 0.015));
  color: var(--fg-0);
  border-color: oklch(1 0 0 / 0.08);
  box-shadow: 0 1px 0 oklch(1 0 0 / 0.04) inset, 0 8px 24px -16px oklch(0.84 0.12 75 / 0.4);
}

.nav-item.active::before { content: none; }

.nav-item .icon {
  width: 16px;
  height: 16px;
  flex-shrink: 0;
  opacity: 0.7;
}

.nav-item.active .icon {
  opacity: 1;
  color: var(--brass-1);
}

.nav-item .chev {
  margin-left: auto;
  opacity: 0.4;
  font-size: 10px;
}

.sidebar .footer {
  margin-top: auto;
  padding-top: 14px;
  border-top: 1px solid var(--ink-3);
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.credits-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 12px;
  background:
    linear-gradient(180deg, oklch(1 0 0 / 0.025), oklch(1 0 0 / 0.005)),
    var(--ink-1);
  border: 1px solid var(--ink-3);
  border-radius: var(--r-md);
  position: relative;
}

.credits-row::before {
  content: '';
  position: absolute;
  top: 0;
  left: 15%; right: 15%; height: 1px;
  background: linear-gradient(to right, transparent, oklch(0.85 0.13 75 / 0.4), transparent);
  border-radius: inherit;
  pointer-events: none;
}

.credits-row-l { display: flex; align-items: center; gap: 8px; }
.credits-coin {
  width: 20px;
  height: 20px;
  display: grid;
  place-items: center;
  background: var(--brass-tint);
  color: var(--brass-1);
  border-radius: 50%;
  font-size: 11px;
  font-weight: 600;
  border: 1px solid oklch(0.84 0.12 75 / 0.3);
}
.credits-label { font-size: 13px; color: var(--fg-0); font-weight: 500; }
.credits-value {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 14px;
  color: var(--brass-1);
}

.sidebar-cta {
  width: 100%;
  padding: 10px;
  border-radius: var(--r-md);
  background: var(--ink-1);
  border: 1px solid var(--ink-3);
  color: var(--fg-0);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  font-family: inherit;
  transition: border-color 0.15s, background 0.15s, color 0.15s;
  position: relative;
  display: block;
  text-align: center;
}

.sidebar-cta::before {
  content: '';
  position: absolute;
  top: 0;
  left: 18%; right: 18%; height: 1px;
  background: linear-gradient(to right, transparent, oklch(0.85 0.13 75 / 0.3), transparent);
  border-radius: inherit;
  pointer-events: none;
}

.sidebar-cta:hover { border-color: var(--brass-3); color: var(--brass-1); background: var(--brass-tint); }

.user-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  border-radius: var(--r-md);
  cursor: pointer;
  transition: background 0.15s;
}

.user-row:hover { background: oklch(1 0 0 / 0.025); }

.user-avatar {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background: linear-gradient(140deg, oklch(0.32 0.04 60), oklch(0.22 0.03 50));
  border: 1px solid var(--brass-3);
  display: grid;
  place-items: center;
  font-family: var(--font-display);
  font-size: 13px;
  font-weight: 500;
  color: var(--brass-1);
  flex-shrink: 0;
}

.user-name { font-size: 13px; font-weight: 500; color: var(--fg-0); line-height: 1.2; }
.user-sub { font-size: 11px; color: var(--fg-3); margin-top: 2px; }

.logout-item { color: var(--fg-2) !important; transition: background 0.15s, color 0.15s, border-color 0.15s; }
.logout-item:hover {
  background: oklch(0.65 0.18 25 / 0.12) !important;
  color: oklch(0.78 0.15 25) !important;
  border-color: oklch(0.65 0.18 25 / 0.25) !important;
}
.logout-item:hover .icon { color: oklch(0.78 0.15 25); }

.sub-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 7px 10px 7px 30px;
  font-size: 12.5px;
  color: var(--fg-2);
  border-radius: var(--r-sm);
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
}

.sub-item:hover { color: var(--fg-0); background: oklch(1 0 0 / 0.025); }
.sub-item .dot { width: 4px; height: 4px; border-radius: 50%; background: var(--fg-3); flex-shrink: 0; }
.sub-item.active .dot { background: var(--brass-1); }
.sub-item .sub-name { flex: 1; }
.sub-item .sub-meta {
font-family: var(--font-mono);
  font-weight: 600;
  font-size: 10px;
  letter-spacing: 0.1em;
  color: var(--fg-3);
}

.nav-clipboard {
  margin-top: 10px;
  background:
    linear-gradient(180deg, oklch(1 0 0 / 0.025), oklch(1 0 0 / 0.005)),
    oklch(0.14 0.005 60);
  border: 1px solid var(--ink-3);
  position: relative;
}

.nav-clipboard::before {
  content: '';
  position: absolute;
  top: 0; left: 18%; right: 18%; height: 1px;
  background: linear-gradient(to right, transparent, oklch(0.85 0.13 75 / 0.4), transparent);
  border-radius: inherit;
  pointer-events: none;
}

.nav-clipboard:hover { border-color: var(--brass-3); }
.nav-clipboard .icon { color: var(--brass-1); opacity: 0.95; }
.nav-clipboard .clip-count {
font-family: var(--font-mono);
  font-weight: 600;
  font-size: 10px;
  letter-spacing: 0.08em;
  padding: 2px 8px;
  border-radius: 10px;
  background: var(--ink-0);
  border: 1px solid var(--ink-3);
  color: var(--fg-2);
  margin-left: auto;
}

/* Clipboard drawer */
.clip-drawer {
  margin-top: 6px;
  padding: 6px;
  background: oklch(0.10 0.004 60);
  border: 1px solid var(--ink-3);
  border-radius: var(--r-md);
  max-height: 220px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.clip-drawer::-webkit-scrollbar { width: 8px; }
.clip-drawer::-webkit-scrollbar-track { background: oklch(0.10 0.004 60); }
.clip-drawer::-webkit-scrollbar-thumb {
  background: oklch(0.22 0.006 60);
  border: 2px solid oklch(0.10 0.004 60);
  border-radius: 10px;
}
.clip-drawer::-webkit-scrollbar-thumb:hover { background: oklch(0.30 0.008 60); }
.clip-drawer { scrollbar-color: oklch(0.22 0.006 60) oklch(0.10 0.004 60); }

.clip-item {
  display: grid;
  grid-template-columns: 44px 1fr;
  gap: 10px;
  align-items: center;
  padding: 6px;
  border: 1px solid var(--ink-3);
  border-radius: var(--r-sm);
  background: var(--ink-1);
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s;
}

.clip-item:hover { border-color: var(--brass-3); }

.clip-thumb {
  width: 44px; height: 44px;
  border-radius: 6px;
  overflow: hidden;
  flex-shrink: 0;
}

.clip-ph {
  width: 100%; height: 100%;
  background:
    repeating-linear-gradient(135deg, transparent 0 10px, oklch(1 0 0 / 0.025) 10px 11px),
    linear-gradient(135deg, oklch(0.32 0.04 60), oklch(0.20 0.03 50));
  display: grid;
  place-items: center;
  color: var(--brass-1);
}
.clip-ph.prompt {
  background:
    linear-gradient(135deg, oklch(0.20 0.005 60), oklch(0.13 0.005 60));
}

.clip-label {
  font-size: 12px;
  color: var(--fg-1);
  line-height: 1.35;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.chev.expandable {
  cursor: pointer;
  transition: transform 0.18s, color 0.15s;
  padding: 2px;
  border-radius: 4px;
}
.chev.expandable:hover { color: var(--brass-1); background: oklch(1 0 0 / 0.04); }
.chev.expandable.open { transform: rotate(90deg); }

/* === Main === */
.main {
  display: flex;
  flex-direction: column;
  overflow: hidden;
  background: transparent;
  position: relative;
}

.topbar {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 16px 28px;
  border-bottom: 1px solid var(--ink-3);
  background:
    radial-gradient(800px 200px at 0% 0%, oklch(0.85 0.13 75 / 0.08), transparent 70%),
    var(--ink-0);
  position: relative;
  z-index: 2;
}

.topbar::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 1px;
  background: linear-gradient(to right,
    oklch(0.85 0.13 75 / 0.5) 0%,
    oklch(0.85 0.13 75 / 0.2) 25%,
    transparent 65%);
  pointer-events: none;
}

.search {
  flex: 1;
  max-width: 520px;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  background: oklch(1 0 0 / 0.03);
  border: 1px solid var(--ink-3);
  border-radius: 100px;
  color: var(--fg-2);
  transition: border-color 0.15s, background 0.15s;
}

.search:focus-within { border-color: var(--brass-3); background: oklch(1 0 0 / 0.04); }

.search input {
  flex: 1;
  background: none;
  border: none;
  outline: none;
  font-size: 13px;
  color: var(--fg-0);
}

.search input::placeholder { color: var(--fg-3); }

.kbd {
font-family: var(--font-mono);
  font-weight: 600;
  font-size: 10.5px;
  padding: 2px 6px;
  background: var(--ink-3);
  border: 1px solid var(--ink-4);
  border-radius: 4px;
  color: var(--fg-1);
}

.top-actions { margin-left: auto; display: flex; align-items: center; gap: 10px; }

.icon-btn {
  width: 36px;
  height: 36px;
  border-radius: var(--r-md);
  display: grid;
  place-items: center;
  color: var(--fg-1);
  border: 1px solid transparent;
  transition: background 0.15s, border-color 0.15s, color 0.15s;
}

.icon-btn:hover { background: var(--ink-2); color: var(--fg-0); border-color: var(--ink-3); }
.icon-btn.active { background: var(--ink-2); color: var(--brass-1); border-color: var(--ink-4); }

/* Header icon dropdown */
.header-icon-wrap { position: relative; }

.dot-badge {
  position: absolute;
  top: 4px;
  right: 4px;
  min-width: 16px;
  height: 16px;
  padding: 0 4px;
  border-radius: 100px;
  background: linear-gradient(140deg, var(--brass-0), var(--brass-2));
  color: oklch(0.16 0.01 60);
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 9.5px;
  display: grid;
  place-items: center;
  border: 1.5px solid var(--ink-0);
  pointer-events: none;
}

.header-popover {
  position: absolute;
  top: calc(100% + 10px);
  right: 0;
  width: 380px;
  background:
    linear-gradient(180deg, oklch(1 0 0 / 0.025), transparent),
    oklch(0.13 0.005 60);
  border: 1px solid var(--ink-4);
  border-radius: var(--r-md);
  box-shadow: 0 24px 60px -20px oklch(0 0 0 / 0.8), 0 1px 0 oklch(1 0 0 / 0.05) inset;
  z-index: 70;
  display: flex;
  flex-direction: column;
  max-height: 80vh;
  overflow: hidden;
}

.header-popover::before {
  content: '';
  position: absolute;
  top: 0; left: 18%; right: 18%; height: 1px;
  background: linear-gradient(to right, transparent, oklch(0.85 0.13 75 / 0.5), transparent);
  border-radius: inherit;
  pointer-events: none;
}

.hp-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  padding: 14px 16px;
  border-bottom: 1px solid var(--ink-3);
}

.hp-title { font-family: var(--font-display); font-weight: 500; font-size: 16px; color: var(--fg-0); }
.hp-sub {
font-family: var(--font-mono);
  font-weight: 600;
  font-size: 10px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--fg-3);
  margin-top: 2px;
}

.hp-mark {
  background: transparent;
  border: 1px solid var(--ink-3);
  padding: 6px 10px;
  border-radius: 100px;
  color: var(--fg-1);
  font-family: inherit;
  font-size: 11px;
  cursor: pointer;
  transition: border-color 0.15s, color 0.15s, background 0.15s;
}
.hp-mark:hover { border-color: var(--brass-3); color: var(--brass-1); background: var(--brass-tint); }

.hp-list {
  flex: 1;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
}

.hp-row {
  display: grid;
  grid-template-columns: 34px 1fr 8px;
  gap: 12px;
  padding: 12px 16px;
  border-top: 1px solid var(--ink-3);
  cursor: pointer;
  align-items: flex-start;
  transition: background 0.15s;
}

.hp-row:first-child { border-top: none; }
.hp-row:hover { background: oklch(1 0 0 / 0.02); }
.hp-row.unread { background: oklch(0.85 0.13 75 / 0.04); }

.hp-ico {
  width: 32px; height: 32px;
  border-radius: 8px;
  background: var(--brass-tint);
  border: 1px solid oklch(0.85 0.13 75 / 0.25);
  color: var(--brass-1);
  display: grid; place-items: center;
}

.hp-avatar {
  width: 32px; height: 32px;
  border-radius: 50%;
  background: linear-gradient(140deg, oklch(0.32 0.04 60), oklch(0.22 0.03 50));
  border: 1px solid var(--brass-3);
  display: grid; place-items: center;
  color: var(--brass-1);
  font-family: var(--font-display);
  font-weight: 500;
  font-size: 13px;
}

.hp-body { min-width: 0; }
.hp-row-title {
  font-size: 13px;
  font-weight: 500;
  color: var(--fg-0);
  margin-bottom: 2px;
}
.hp-row-desc {
  font-size: 12.5px;
  color: var(--fg-2);
  line-height: 1.45;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.hp-row-desc strong { color: var(--fg-1); font-weight: 500; }
.hp-row-when {
font-family: var(--font-mono);
  font-weight: 600;
  font-size: 10px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--fg-3);
  margin-top: 4px;
}

.hp-unread-dot {
  width: 8px; height: 8px;
  border-radius: 50%;
  background: var(--brass-1);
  margin-top: 12px;
  box-shadow: 0 0 8px var(--brass-1);
}

.hp-foot {
  padding: 12px 16px;
  border-top: 1px solid var(--ink-3);
  display: flex;
  justify-content: space-between;
  background: oklch(1 0 0 / 0.01);
}

.hp-foot a {
  font-size: 12.5px;
  color: var(--brass-1);
  cursor: pointer;
  text-decoration: none;
  transition: color 0.15s;
  font-weight: 500;
}
.hp-foot a:hover { color: var(--fg-0); }
.hp-foot a.muted { color: var(--fg-2); }

/* === Buy Credits modal === */
.bc-overlay {
  position: fixed;
  inset: 0;
  z-index: 200;
  display: grid;
  place-items: center;
  padding: 28px;
  background: oklch(0.05 0.005 60 / 0.78);
  backdrop-filter: blur(10px);
  animation: bc-fade 0.18s ease-out;
}

/* When any modal is open, suppress floating elements that might overlap */
body.modal-open .composer-dock,
body.modal-open .clipboard-pill { display: none; }

@keyframes bc-fade { from { opacity: 0; } to { opacity: 1; } }

.bc-stage {
  display: grid;
  grid-template-columns: minmax(0, 560px);
  gap: 16px;
  width: min(560px, 100%);
  max-height: 94vh;
  align-items: start;
  justify-content: center;
}

.bc-modal {
  position: relative;
  background:
    linear-gradient(180deg, oklch(1 0 0 / 0.025), transparent),
    oklch(0.13 0.005 60);
  border: 1px solid var(--ink-4);
  border-radius: var(--r-lg);
  padding: 22px 22px 18px;
  display: flex;
  flex-direction: column;
  gap: 14px;
  box-shadow: 0 32px 80px -24px oklch(0 0 0 / 0.8), 0 1px 0 oklch(1 0 0 / 0.05) inset;
  max-height: 94vh;
  overflow-y: auto;
}

.bc-modal::before {
  content: '';
  position: absolute;
  top: 0; left: 15%; right: 15%; height: 1px;
  background: linear-gradient(to right, transparent, oklch(0.95 0.10 75 / 0.6), transparent);
  border-radius: inherit;
  pointer-events: none;
}

.bc-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--ink-3);
}

.bc-eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 6px;
font-family: var(--font-mono);
  font-weight: 600;
  font-size: 10.5px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--brass-1);
  margin-bottom: 8px;
}

.bc-title {
  font-family: var(--font-display);
  font-weight: 500;
  font-size: 26px;
  letter-spacing: -0.02em;
  color: var(--fg-0);
  line-height: 1.05;
}

.bc-sub {
  font-size: 12.5px;
  color: var(--fg-2);
  margin-top: 4px;
}

.bc-close {
  width: 30px; height: 30px;
  border-radius: 50%;
  background: oklch(1 0 0 / 0.04);
  border: 1px solid var(--ink-3);
  color: var(--fg-1);
  display: grid; place-items: center;
  cursor: pointer;
  font-family: inherit;
  font-size: 13px;
  transition: background 0.15s, color 0.15s;
}
.bc-close:hover { background: var(--ink-3); color: var(--fg-0); }

.bc-info-banner {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 14px;
  background: oklch(1 0 0 / 0.02);
  border: 1px solid var(--ink-3);
  border-radius: var(--r-md);
  font-size: 13px;
  color: var(--fg-1);
}
.bc-info-banner svg { color: var(--brass-1); flex-shrink: 0; }
.bc-info-banner strong { color: var(--fg-0); font-weight: 500; }

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

.bc-pack {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 14px 18px;
  background:
    linear-gradient(180deg, oklch(1 0 0 / 0.018), oklch(1 0 0 / 0.005)),
    oklch(0.14 0.005 60);
  border: 1px solid var(--ink-3);
  border-radius: var(--r-md);
  cursor: pointer;
  text-align: left;
  font-family: inherit;
  transition: border-color 0.15s, background 0.15s, transform 0.1s;
}

.bc-pack:hover { border-color: var(--ink-5); }

.bc-pack.on {
  border-color: var(--brass-1);
  background:
    linear-gradient(180deg, oklch(0.85 0.13 75 / 0.06), transparent),
    oklch(0.14 0.005 60);
  box-shadow: 0 0 0 1px var(--brass-1), 0 8px 24px -10px oklch(0.85 0.13 75 / 0.4);
}

.bc-pack-l { display: flex; flex-direction: column; gap: 3px; }

.bc-pack-clips {
  font-family: var(--font-display);
  font-weight: 500;
  font-size: 22px;
  letter-spacing: -0.015em;
  color: var(--fg-0);
  line-height: 1;
}

.bc-pack-sub {
  font-size: 12px;
  color: var(--fg-2);
}

.bc-pack-sub .bonus {
  color: oklch(0.78 0.16 152);
  font-weight: 500;
}

.bc-pack-r {
  display: flex;
  align-items: center;
  gap: 12px;
}

.bc-pack-badge {
font-family: var(--font-mono);
  font-weight: 600;
  font-size: 9.5px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  padding: 3px 8px;
  border-radius: 100px;
  background: var(--brass-tint);
  border: 1px solid oklch(0.85 0.13 75 / 0.4);
  color: var(--brass-1);
}

.bc-pack-price {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 22px;
  letter-spacing: -0.015em;
  color: var(--fg-0);
}
.bc-pack.on .bc-pack-price { color: var(--brass-1); }

.bc-stats {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px 18px;
  flex-wrap: wrap;
  padding: 12px 0;
  border-top: 1px dashed var(--ink-3);
  border-bottom: 1px dashed var(--ink-3);
  font-size: 12.5px;
  color: var(--fg-1);
}

.bc-stat { font-weight: 500; color: var(--fg-0); display: inline-flex; align-items: center; gap: 4px; }
.bc-stat.green { color: oklch(0.78 0.16 152); font-weight: 600; }
.bc-stars { color: oklch(0.78 0.16 152); font-size: 12px; }
.bc-stats .muted { color: var(--fg-2); font-weight: 400; }

.bc-cta {
  width: 100%;
  padding: 14px 18px;
  border-radius: 100px;
  background: linear-gradient(140deg, var(--brass-0), var(--brass-1) 50%, var(--brass-2));
  color: oklch(0.16 0.01 60);
  font-size: 14px;
  font-weight: 600;
  border: 1px solid oklch(0.92 0.07 85 / 0.5);
  cursor: pointer;
  font-family: inherit;
  box-shadow: 0 12px 32px -10px oklch(0.85 0.13 75 / 0.45);
  transition: filter 0.15s, transform 0.1s;
}
.bc-cta:hover { filter: brightness(1.08); }
.bc-cta:active { transform: translateY(1px); }

.bc-secure {
  text-align: center;
  font-size: 11.5px;
  color: var(--fg-3);
font-family: var(--font-mono);
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

/* Side panel */
.bc-side {
  display: flex;
  flex-direction: column;
  gap: 10px;
  max-height: 94vh;
  overflow-y: auto;
  padding-right: 4px;
}

.bc-side-title {
font-family: var(--font-mono);
  font-weight: 600;
  font-size: 10.5px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--fg-3);
  text-align: center;
  padding: 14px 14px 6px;
  background:
    linear-gradient(180deg, oklch(1 0 0 / 0.025), transparent),
    oklch(0.13 0.005 60);
  border: 1px solid var(--ink-4);
  border-bottom: none;
  border-top-left-radius: var(--r-md);
  border-top-right-radius: var(--r-md);
  margin-bottom: -10px;
}

.bc-card {
  position: relative;
  background:
    linear-gradient(180deg, oklch(1 0 0 / 0.025), oklch(1 0 0 / 0.005)),
    oklch(0.14 0.005 60);
  border: 1px solid var(--ink-3);
  border-radius: var(--r-md);
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.bc-who { display: flex; gap: 10px; align-items: center; }
.bc-avatar {
  width: 28px; height: 28px;
  border-radius: 6px;
  background: linear-gradient(140deg, oklch(0.32 0.04 60), oklch(0.22 0.03 50));
  border: 1px solid var(--brass-3);
  display: grid; place-items: center;
  color: var(--brass-1);
  font-family: var(--font-display);
  font-weight: 500;
  font-size: 12px;
}
.bc-name { font-size: 13px; font-weight: 500; color: var(--fg-0); line-height: 1.1; }
.bc-role { font-size: 11.5px; color: var(--fg-3); margin-top: 2px; }

.bc-highlight {
  font-family: var(--font-display);
  font-weight: 500;
  font-size: 17px;
  letter-spacing: -0.01em;
  color: oklch(0.78 0.16 152);
  margin-top: 2px;
}

.bc-quote {
  font-size: 12.5px;
  color: var(--fg-1);
  line-height: 1.5;
  margin: 0;
  font-style: normal;
}

@media (max-width: 920px) {
  .bc-stage { grid-template-columns: 1fr; max-width: 540px; }
  .bc-side { max-height: none; flex-direction: row; overflow-x: auto; padding-bottom: 8px; }
  .bc-side .bc-card { min-width: 240px; flex-shrink: 0; }
  .bc-side-title { display: none; }
}

.credits-pill {
  display: inline-flex;
  align-items: baseline;
  gap: 6px;
  padding: 9px 16px;
  border-radius: 12px;
  border: 1px solid var(--ink-4);
  background: transparent;
  font-size: 13px;
  color: var(--fg-0);
  transition: border-color 0.15s, background 0.15s;
}

.credits-pill:hover { border-color: var(--brass-3); background: oklch(1 0 0 / 0.02); }

.credits-pill .n {
  font-family: var(--font-display);
  font-size: 17px;
  font-weight: 700;
  color: var(--brass-1);
  letter-spacing: 0.01em;
}

.credits-pill .l {
font-family: var(--font-mono);
  font-weight: 600;
  font-size: 10px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--fg-2);
}

.btn-brass {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 18px;
  border-radius: 12px;
  background: linear-gradient(140deg, var(--brass-0), var(--brass-1) 50%, var(--brass-2));
  color: oklch(0.15 0.01 60);
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.01em;
  box-shadow: var(--shadow-brass);
  border: 1px solid oklch(0.92 0.07 85 / 0.5);
  transition: transform 0.1s, filter 0.15s;
}
.btn-brass:hover { filter: brightness(1.08); }
.btn-brass:active { transform: translateY(1px); }

/* Upgrade button — outlined rounded-rect */
.upgrade-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 18px;
  border-radius: 12px;
  background: transparent;
  border: 1px solid var(--ink-4);
  color: var(--fg-0);
  font-family: inherit;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s, color 0.15s;
}

.upgrade-btn:hover {
  background: oklch(1 0 0 / 0.02);
  border-color: var(--brass-3);
  color: var(--brass-1);
}

.upgrade-btn svg { color: var(--brass-1); flex-shrink: 0; }

.upgrade-tag {
  font-family: var(--font-mono);
  font-size: 9.5px;
  font-weight: 600;
  letter-spacing: 0.08em;
  padding: 4px 8px;
  border-radius: 100px;
  background: linear-gradient(140deg, oklch(0.65 0.20 25), oklch(0.55 0.22 22));
  color: oklch(0.98 0 0);
  border: 1px solid oklch(0.78 0.15 25 / 0.4);
  text-transform: uppercase;
  box-shadow: 0 2px 8px -2px oklch(0.65 0.20 25 / 0.5);
}

.avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: linear-gradient(140deg, var(--ink-3), var(--ink-4));
  border: 1px solid var(--brass-3);
  display: grid;
  place-items: center;
  font-family: var(--font-display);
  font-size: 15px;
  color: var(--brass-1);
  cursor: pointer;
}

/* === Page === */
.page {
  flex: 1;
  overflow: auto;
  padding: 32px 36px 120px;
  position: relative;
}

/* Clear the fixed composer dock (position:fixed; bottom:20px) so the last
   grid row can always scroll above it. --img-dock-h is kept in sync with the
   dock's live height in JS (syncImgDockHeight) — it grows with ref tiles /
   extra prompt rows, so a static value left the last row stuck behind it.
   +44px = the 20px bottom offset + a 24px breathing gap. The `.panel`
   compound is required: a bare `.page-imagegen` ties on specificity with the
   later `.panel { padding: 20px }` rule, which then wins and collapses the
   bottom padding to 20px (the long-standing bug that hid the last rows). */
.panel.page-imagegen { padding-bottom: calc(var(--img-dock-h, 220px) + 44px); }

.page-header { margin-bottom: 28px; max-width: 880px; }

.eyebrow {
font-family: var(--font-mono);
  font-weight: 600;
  font-size: 10.5px;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--brass-1);
  margin-bottom: 10px;
  display: flex;
  align-items: center;
  gap: 10px;
}

.eyebrow::after {
  content: '';
  flex: 1;
  max-width: 60px;
  height: 1px;
  background: linear-gradient(to right, var(--brass-3), transparent);
}

.page-title {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 40px;
  line-height: 1.05;
  letter-spacing: -0.025em;
  color: var(--fg-0);
  margin-bottom: 10px;
}

.page-title em {
  font-style: normal;
  font-weight: 500;
  color: var(--brass-1);
}

.page-sub {
  font-size: 14px;
  color: var(--fg-2);
  max-width: 640px;
  line-height: 1.55;
}

/* === Cards === */
.card {
  background:
    linear-gradient(180deg, oklch(1 0 0 / 0.025), oklch(1 0 0 / 0.005)),
    var(--ink-1);
  border: 1px solid var(--ink-3);
  border-radius: var(--r-lg);
  padding: 20px;
  transition: border-color 0.2s;
  box-shadow: 0 1px 0 oklch(1 0 0 / 0.03) inset;
  position: relative;
}

/* Top rim-light on every card */
.card::before,
.panel::before,
.gen-tile::before,
.action-card::before,
.run-card::before,
.project-tile::before,
.preset-hero::before,
.frame-card::before,
.prompt-card::before,
.setting-row::before,
.model-picker-btn::before,
.empty-state::before,
.output-block::before,
.preview-prompt-card::before,
.preview-info::before {
  content: '';
  position: absolute;
  top: 0;
  left: 12%;
  right: 12%;
  height: 1px;
  background: linear-gradient(to right,
    transparent,
    oklch(0.85 0.13 75 / 0.35) 30%,
    oklch(0.95 0.10 75 / 0.5) 50%,
    oklch(0.85 0.13 75 / 0.35) 70%,
    transparent);
  pointer-events: none;
  border-radius: inherit;
}

.card.elevated {
  background:
    linear-gradient(180deg, oklch(1 0 0 / 0.04), oklch(1 0 0 / 0.005)),
    var(--ink-1);
  box-shadow: 0 1px 0 oklch(1 0 0 / 0.04) inset, var(--shadow-2);
}

.card:hover { border-color: var(--ink-4); }

/* Ensure rim-light targets all have a positioning context */
.gen-tile, .run-card, .project-tile, .prompt-card,
.setting-row, .model-picker-btn, .empty-state, .output-block,
.preview-prompt-card, .preview-info, .action-card {
  position: relative;
}

/* === Image grid === */
.gen-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 18px;
}

.gen-tile {
  background: var(--ink-1);
  border: 1px solid var(--ink-3);
  border-radius: var(--r-md);
  overflow: hidden;
  position: relative;
  transition: transform 0.2s, border-color 0.2s, box-shadow 0.2s;
}

.gen-tile:hover {
  transform: translateY(-2px);
  border-color: var(--brass-3);
  box-shadow: 0 12px 32px -12px oklch(0 0 0 / 0.6);
}

.gen-thumb {
  aspect-ratio: 4/5;
  position: relative;
  overflow: hidden;
  background: linear-gradient(135deg, var(--ink-2), var(--ink-3));
}

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

.gen-thumb .ph {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  color: var(--fg-3);
font-family: var(--font-mono);
  font-weight: 600;
  font-size: 10px;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  background-image: repeating-linear-gradient(135deg, transparent 0 14px, oklch(1 0 0 / 0.015) 14px 15px);
}

.gen-tile-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 12px;
  border-top: 1px solid var(--ink-3);
}

.gen-tile-label {
font-family: var(--font-mono);
  font-weight: 600;
  font-size: 10px;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  color: var(--fg-2);
}

.gen-tile-actions {
  display: flex;
  gap: 4px;
}

.tile-icon-btn {
  width: 26px;
  height: 26px;
  border-radius: 6px;
  display: grid;
  place-items: center;
  color: var(--fg-2);
  transition: background 0.15s, color 0.15s;
}
.tile-icon-btn:hover { background: var(--ink-3); color: var(--brass-1); }

/* === Composer (image gen prompt) — fixed bottom dock === */
.composer-dock {
  position: fixed;
  bottom: 20px;
  left: 248px;
  right: 0;
  padding-right: 24px;
  z-index: 30;
  display: flex;
  justify-content: center;
  pointer-events: none;
}
.app.compact .composer-dock { left: 68px; }

.composer {
  pointer-events: auto;
  width: min(960px, 100%);
  background: linear-gradient(180deg, oklch(0.20 0.008 60 / 0.92), oklch(0.18 0.008 60 / 0.92));
  border: 1px solid var(--ink-4);
  border-radius: var(--r-lg);
  box-shadow: 0 24px 60px -20px oklch(0 0 0 / 0.7), 0 1px 0 oklch(1 0 0 / 0.04) inset;
  backdrop-filter: blur(18px) saturate(120%);
  -webkit-backdrop-filter: blur(18px) saturate(120%);
  padding: 14px 16px 12px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  position: relative;
}

.composer-attach-row {
  display: flex;
  gap: 8px;
  align-items: center;
}

.composer-input {
  width: 100%;
  background: none;
  border: none;
  outline: none;
  resize: none;
  font-family: var(--font-body);
  font-size: 14px;
  color: var(--fg-0);
  min-height: 44px;
  padding: 4px 2px;
  line-height: 1.45;
}

.composer-input::placeholder { color: var(--fg-3); }

.attach-thumb {
  width: 44px;
  height: 44px;
  border-radius: var(--r-sm);
  border: 1px solid var(--ink-4);
  background: linear-gradient(135deg, oklch(0.30 0.05 250), oklch(0.20 0.04 245));
  display: grid;
  place-items: center;
  overflow: hidden;
  position: relative;
  cursor: pointer;
  font-family: var(--font-display);
  font-size: 11px;
  color: var(--brass-1);
}

.attach-thumb .x {
  position: absolute;
  top: -4px;
  right: -4px;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: var(--ink-0);
  border: 1px solid var(--ink-4);
  display: grid;
  place-items: center;
  font-size: 9px;
  color: var(--fg-1);
  opacity: 0;
  transition: opacity 0.15s;
}

.attach-thumb:hover .x { opacity: 1; }

.attach-add {
  width: 44px;
  height: 44px;
  border-radius: var(--r-sm);
  border: 1px dashed var(--ink-4);
  background: transparent;
  display: grid;
  place-items: center;
  color: var(--fg-2);
  cursor: pointer;
  transition: border-color 0.15s, color 0.15s;
}

.attach-add:hover { border-color: var(--brass-2); color: var(--brass-1); }

.composer-text {
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: center;
  min-height: 44px;
}

.composer textarea {
  flex: 1;
  background: none;
  border: none;
  outline: none;
  resize: none;
  font-family: var(--font-body);
  font-size: 14px;
  color: var(--fg-0);
  min-height: 44px;
  padding: 4px 0;
  line-height: 1.45;
}

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

.composer-row {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

/* Tool pill row (model, aspect, quality…) */
.tool-pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 7px 12px;
  border-radius: 100px;
  background: oklch(0.16 0.008 60 / 0.7);
  border: 1px solid var(--ink-3);
  color: var(--fg-0);
  font-size: 12.5px;
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s;
  font-family: inherit;
  position: relative;
}

.tool-pill:hover { border-color: var(--ink-5); background: oklch(0.20 0.008 60); }
.tool-pill .ico { color: var(--brass-1); display: grid; place-items: center; }
.tool-pill .chev { opacity: 0.5; margin-left: 2px; }

.tool-pill.with-icon { padding-left: 6px; }
.tool-pill .lead {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: linear-gradient(140deg, var(--brass-0), var(--brass-2));
  display: grid;
  place-items: center;
  color: oklch(0.16 0.01 60);
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 12px;
}

.count-pill {
  display: inline-flex;
  align-items: center;
  border-radius: 100px;
  background: oklch(0.16 0.008 60 / 0.7);
  border: 1px solid var(--ink-3);
  font-size: 12.5px;
  color: var(--fg-0);
  overflow: hidden;
}

.count-pill button {
  width: 28px;
  height: 32px;
  display: grid;
  place-items: center;
  color: var(--fg-1);
  transition: background 0.15s, color 0.15s;
}

.count-pill button:hover { background: oklch(0.22 0.008 60); color: var(--brass-1); }
.count-pill .val { padding: 0 4px; min-width: 28px; text-align: center; font-variant-numeric: tabular-nums; }

/* Generate button */
.btn-generate {
  margin-left: auto;
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 12px 22px;
  border-radius: 100px;
  background: linear-gradient(140deg, var(--brass-0), var(--brass-1) 50%, var(--brass-2));
  color: oklch(0.16 0.01 60);
  font-size: 13.5px;
  font-weight: 600;
  letter-spacing: 0.005em;
  box-shadow: 0 8px 24px -8px oklch(0.82 0.10 82 / 0.45), 0 0 0 1px oklch(0.92 0.07 85 / 0.4) inset;
  border: none;
  transition: filter 0.15s, transform 0.1s;
}

.btn-generate:hover { filter: brightness(1.06); }
.btn-generate:active { transform: translateY(1px); }

.btn-generate .cost {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 8px;
  border-radius: 100px;
  background: oklch(0.16 0.01 60 / 0.18);
  font-size: 12px;
}

/* === Popovers (open upward from composer) === */
.popover {
  position: absolute;
  bottom: calc(100% + 10px);
  background: linear-gradient(180deg, var(--ink-1), var(--ink-0));
  border: 1px solid var(--ink-4);
  border-radius: var(--r-md);
  box-shadow: 0 24px 60px -20px oklch(0 0 0 / 0.8);
  padding: 8px;
  z-index: 40;
  min-width: 220px;
  max-height: 420px;
  overflow-y: auto;
}

.popover-search {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 10px;
  background: oklch(0.16 0.008 60);
  border: 1px solid var(--ink-3);
  border-radius: var(--r-sm);
  margin-bottom: 6px;
}

.popover-search input {
  flex: 1;
  background: none;
  border: none;
  outline: none;
  font-size: 12.5px;
  color: var(--fg-0);
}
.popover-search input::placeholder { color: var(--fg-3); }

.popover-section {
font-family: var(--font-mono);
  font-weight: 600;
  font-size: 10px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--fg-3);
  padding: 10px 10px 6px;
  display: flex;
  align-items: center;
  gap: 6px;
}

.popover-item {
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 10px;
  align-items: center;
  padding: 9px 10px;
  border-radius: var(--r-sm);
  cursor: pointer;
  transition: background 0.12s;
}

.popover-item:hover { background: var(--ink-2); }
.popover-item.active { background: oklch(0.82 0.10 82 / 0.10); }

.popover-item .ico {
  width: 28px;
  height: 28px;
  border-radius: 6px;
  background: var(--ink-2);
  border: 1px solid var(--ink-3);
  display: grid;
  place-items: center;
  color: var(--fg-1);
}

.popover-item.active .ico { color: var(--brass-1); border-color: var(--brass-3); background: var(--brass-tint); }

.popover-item .body { min-width: 0; }
.popover-item .title { font-size: 13px; color: var(--fg-0); display: flex; align-items: center; gap: 6px; font-weight: 500; }
.popover-item .sub { font-size: 11.5px; color: var(--fg-2); margin-top: 1px; line-height: 1.3; }
.popover-item .check { color: var(--brass-1); }

.badge {
font-family: var(--font-mono);
  font-weight: 600;
  font-size: 9px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  padding: 2px 7px;
  border-radius: 4px;
  background: var(--brass-tint);
  color: var(--brass-1);
  border: 1px solid oklch(0.82 0.10 82 / 0.3);
}

.badge.unlimited { background: oklch(0.78 0.10 150 / 0.10); color: var(--success); border-color: oklch(0.78 0.10 150 / 0.3); }

.popover-item-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 12px;
  border-radius: var(--r-sm);
  cursor: pointer;
  transition: background 0.12s;
  gap: 10px;
}
.popover-item-row:hover { background: var(--ink-2); }
.popover-item-row.active { background: oklch(0.82 0.10 82 / 0.10); color: var(--brass-1); }

.radio-dot {
  width: 16px;
  height: 16px;
  border-radius: 50%;
  border: 1.5px solid var(--ink-5);
  flex-shrink: 0;
  display: grid;
  place-items: center;
}
.popover-item-row.active .radio-dot { border-color: var(--brass-1); }
.popover-item-row.active .radio-dot::after { content: ''; width: 7px; height: 7px; border-radius: 50%; background: var(--brass-1); }

.popover-header {
  font-size: 13px;
  font-weight: 500;
  color: var(--fg-0);
  padding: 8px 10px;
  border-bottom: 1px solid var(--ink-3);
  margin-bottom: 6px;
}

/* === Gallery view === */
.gallery-tabs {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 22px;
}

.gallery-tab {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 9px 14px;
  border-radius: 100px;
  background: var(--ink-1);
  border: 1px solid var(--ink-3);
  color: var(--fg-1);
  font-size: 13px;
  cursor: pointer;
  font-family: inherit;
}

.gallery-tab.active { background: var(--ink-2); color: var(--fg-0); border-color: var(--ink-5); }
.gallery-tab .ico { opacity: 0.7; }
.gallery-tab.active .ico { opacity: 1; color: var(--brass-1); }

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

.gallery-card {
  position: relative;
  border-radius: var(--r-md);
  overflow: hidden;
  border: 1px solid var(--ink-3);
  background: var(--ink-1);
  aspect-ratio: 4/5;
  cursor: pointer;
  transition: transform 0.2s, border-color 0.2s;
}

.gallery-card:hover { transform: translateY(-2px); border-color: var(--brass-3); }

.gallery-card .ph {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  color: var(--fg-3);
font-family: var(--font-mono);
  font-weight: 600;
  font-size: 10px;
  letter-spacing: 0.15em;
  background-image: repeating-linear-gradient(135deg, transparent 0 14px, oklch(1 0 0 / 0.015) 14px 15px), linear-gradient(135deg, var(--ink-2), var(--ink-3));
}

.gallery-card .last-viewed {
  position: absolute;
  top: 10px;
  left: 10px;
  font-size: 11px;
  color: oklch(1 0 0 / 0.9);
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  background: oklch(0 0 0 / 0.5);
  backdrop-filter: blur(8px);
  border-radius: 100px;
font-family: var(--font-mono);
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  font-size: 9.5px;
}

.gallery-card-overlay {
  position: absolute;
  inset: auto 0 0 0;
  padding: 30px 12px 12px;
  background: linear-gradient(to top, oklch(0 0 0 / 0.7), transparent);
  display: flex;
  align-items: center;
  justify-content: space-between;
  opacity: 0;
  transition: opacity 0.2s;
}

.gallery-card:hover .gallery-card-overlay { opacity: 1; }
.gallery-card-overlay .title {font-family: var(--font-mono);
 font-weight: 600; font-size: 10px; letter-spacing: 0.12em; text-transform: uppercase; color: var(--fg-0); }
.gallery-card-overlay .actions { display: flex; gap: 4px; }
.gallery-card-overlay .actions .tile-icon-btn { background: oklch(0 0 0 / 0.4); color: var(--fg-0); }

/* === Preview lightbox === */
.lightbox {
  position: fixed;
  inset: 0;
  background: oklch(0 0 0 / 0.85);
  backdrop-filter: blur(8px);
  z-index: 80;
  display: grid;
  place-items: center;
  padding: 40px;
}

.lightbox-stage {
  width: min(1080px, 94vw);
  background: var(--ink-1);
  border: 1px solid var(--ink-4);
  border-radius: var(--r-lg);
  overflow: hidden;
  display: grid;
  grid-template-columns: 1fr 360px;
  max-height: 88vh;
}

.lightbox-image {
  aspect-ratio: 4/5;
  background: var(--ink-2);
  display: grid;
  place-items: center;
  color: var(--fg-3);
  position: relative;
  overflow: hidden;
}
.lightbox-image img { width: 100%; height: 100%; object-fit: cover; }
.lightbox-image .ph {
  background-image: repeating-linear-gradient(135deg, transparent 0 14px, oklch(1 0 0 / 0.015) 14px 15px), linear-gradient(135deg, var(--ink-2), var(--ink-3));
  position: absolute; inset: 0; display: grid; place-items: center;
font-family: var(--font-mono);
  font-weight: 600; font-size: 11px; letter-spacing: 0.15em;
}

.lightbox-side {
  padding: 20px;
  border-left: 1px solid var(--ink-3);
  display: flex;
  flex-direction: column;
  gap: 16px;
  overflow-y: auto;
}

.lightbox-side h4 {
  font-family: var(--font-display);
  font-weight: 500;
  font-size: 22px;
  margin-bottom: 6px;
}

.lightbox-meta-row {
  display: flex;
  justify-content: space-between;
  padding: 8px 0;
  border-top: 1px dashed var(--ink-3);
  font-size: 12.5px;
}
.lightbox-meta-row:first-of-type { border-top: none; }
.lightbox-meta-row .k {
font-family: var(--font-mono);
  font-weight: 600;
  font-size: 10px;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  color: var(--fg-3);
}
.lightbox-meta-row .v { color: var(--fg-0); }

.close-x {
  position: absolute;
  top: 24px;
  right: 24px;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: oklch(0 0 0 / 0.5);
  border: 1px solid var(--ink-4);
  color: var(--fg-0);
  display: grid;
  place-items: center;
  cursor: pointer;
}

/* === Image preview sidebar (lightbox) === */
.preview-author-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding-bottom: 14px;
  border-bottom: 1px solid var(--ink-3);
}

.avatar-sm {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: linear-gradient(140deg, var(--brass-0), var(--brass-2));
  border: 1px solid var(--brass-3);
  flex-shrink: 0;
}

.author-meta { flex: 1; min-width: 0; }
.author-name {
  font-family: var(--font-display);
  font-size: 14.5px;
  font-weight: 500;
  color: var(--fg-0);
  line-height: 1.2;
}
.author-role {
font-family: var(--font-mono);
  font-weight: 600;
  font-size: 9.5px;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  color: var(--fg-3);
  margin-top: 1px;
}

.icon-btn-sm {
  width: 30px;
  height: 30px;
  border-radius: 8px;
  background: var(--ink-2);
  border: 1px solid var(--ink-3);
  color: var(--fg-1);
  display: grid;
  place-items: center;
  font-size: 13px;
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
  font-family: inherit;
}

.icon-btn-sm:hover { background: var(--ink-3); color: var(--brass-1); }

.preview-tabs {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
  padding: 4px;
  background: var(--ink-0);
  border: 1px solid var(--ink-3);
  border-radius: var(--r-md);
}

.preview-tab {
  padding: 8px 10px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  border-radius: var(--r-sm);
  color: var(--fg-2);
  font-size: 12.5px;
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
  font-family: inherit;
}

.preview-tab.active {
  background: var(--ink-2);
  color: var(--fg-0);
  box-shadow: 0 1px 2px oklch(0 0 0 / 0.3);
}

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

.preview-section-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
font-family: var(--font-mono);
  font-weight: 600;
  font-size: 10px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--fg-3);
}
.preview-section-head > span { display: inline-flex; align-items: center; gap: 6px; }

.preview-prompt-card {
  background: var(--ink-0);
  border: 1px solid var(--ink-3);
  border-radius: var(--r-md);
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.preview-refs { display: flex; gap: 8px; }
.ref-thumb {
  width: 44px;
  height: 44px;
  border-radius: var(--r-sm);
  background: linear-gradient(135deg, oklch(0.30 0.05 250), oklch(0.20 0.04 245));
  border: 1px solid var(--ink-3);
  display: grid;
  place-items: center;
  font-family: var(--font-display);
  font-size: 11px;
  color: var(--brass-1);
}

.preview-prompt-text {
  font-size: 13.5px;
  color: var(--fg-0);
  line-height: 1.5;
}

.preview-info {
  background: var(--ink-0);
  border: 1px solid var(--ink-3);
  border-radius: var(--r-md);
  overflow: hidden;
}

.info-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 11px 14px;
  font-size: 13px;
  border-top: 1px solid var(--ink-3);
}
.info-row:first-child { border-top: none; }
.info-row .k { color: var(--fg-2); }
.info-row .v { color: var(--fg-0); font-family: var(--font-display); font-weight: 500; font-size: 14px; }

.info-row.see-all {
  color: var(--fg-2);
  cursor: pointer;
  background: var(--ink-1);
}
.info-row.see-all:hover { color: var(--brass-1); }

.preview-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.action-primary, .action-secondary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  padding: 11px 12px;
  border-radius: var(--r-md);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  font-family: inherit;
  transition: filter 0.15s, background 0.15s, border-color 0.15s;
}

.action-primary {
  grid-column: 1 / -1;
  background: linear-gradient(140deg, var(--brass-0), var(--brass-1) 50%, var(--brass-2));
  color: oklch(0.16 0.01 60);
  border: 1px solid oklch(0.92 0.07 85 / 0.5);
  box-shadow: 0 4px 16px -8px oklch(0.82 0.10 82 / 0.5);
}
.action-primary:hover { filter: brightness(1.06); }

.action-secondary {
  background: var(--ink-0);
  color: var(--fg-0);
  border: 1px solid var(--ink-3);
}
.action-secondary:hover { background: var(--ink-2); border-color: var(--ink-5); }

.preview-icon-row {
  display: flex;
  gap: 6px;
  justify-content: flex-end;
  padding-top: 4px;
}

.heart {
  width: 30px;
  height: 30px;
  border-radius: 8px;
  background: var(--ink-2);
  border: 1px solid var(--ink-3);
  color: var(--fg-1);
  display: grid;
  place-items: center;
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
}
.heart:hover { background: var(--ink-3); }
.heart.on { color: var(--brass-1); }

/* === Ad Analysis — submitted-ad preview === */
.ad-preview-panel { padding: 16px; }
.ad-preview-media {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.ad-preview-thumb {
  position: relative;
  aspect-ratio: 9 / 16;
  width: 100%;
  max-height: 360px;
  margin: 0 auto;
  border-radius: var(--r-md);
  overflow: hidden;
  background:
    repeating-linear-gradient(135deg, transparent 0 14px, oklch(1 0 0 / 0.02) 14px 15px),
    linear-gradient(135deg, oklch(0.22 0.008 60), oklch(0.13 0.005 60));
  border: 1px solid var(--ink-3);
  display: grid;
  place-items: center;
  color: var(--fg-3);
font-family: var(--font-mono);
  font-weight: 600;
  font-size: 10.5px;
  letter-spacing: 0.15em;
  cursor: pointer;
}

.ad-preview-thumb .ph { color: var(--fg-3); }

.ad-preview-overlay {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  background: linear-gradient(180deg, transparent 50%, oklch(0 0 0 / 0.55));
  pointer-events: none;
}

.ad-preview-play {
  width: 52px;
  height: 52px;
  border-radius: 50%;
  background: oklch(1 0 0 / 0.95);
  color: oklch(0.15 0.005 60);
  display: grid;
  place-items: center;
  cursor: pointer;
  border: none;
  font-family: inherit;
  box-shadow: 0 12px 40px -10px oklch(0 0 0 / 0.7);
  transition: transform 0.15s, filter 0.15s;
  pointer-events: auto;
}

.ad-preview-thumb:hover .ad-preview-play { transform: scale(1.06); filter: brightness(1.05); }

.ad-preview-platform {
  position: absolute;
  top: 10px;
  left: 10px;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 4px 10px;
  border-radius: 100px;
  background: oklch(0 0 0 / 0.55);
  backdrop-filter: blur(8px);
  border: 1px solid oklch(1 0 0 / 0.12);
  color: var(--fg-0);
font-family: var(--font-mono);
  font-weight: 600;
  font-size: 9.5px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}
.ad-preview-platform svg { color: var(--brass-1); }

.ad-preview-meta {
  display: flex;
  flex-direction: column;
  gap: 0;
  padding: 0 4px;
}

.ad-preview-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 8px 0;
  border-top: 1px dashed var(--ink-3);
  font-size: 12.5px;
}
.ad-preview-row:first-child { border-top: none; }
.ad-preview-row .k {
font-family: var(--font-mono);
  font-weight: 600;
  font-size: 10px;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  color: var(--fg-3);
}
.ad-preview-row .v {
  color: var(--fg-0);
  font-weight: 500;
  font-size: 13px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 60%;
}

.ad-preview-actions {
  display: flex;
  gap: 6px;
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px dashed var(--ink-3);
}

.ad-preview-action {
  flex: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 8px 10px;
  border-radius: var(--r-sm);
  background: var(--ink-0);
  border: 1px solid var(--ink-3);
  color: var(--fg-1);
  font-family: inherit;
  font-size: 11.5px;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s, color 0.15s;
}
.ad-preview-action:hover {
  background: var(--brass-tint);
  border-color: var(--brass-3);
  color: var(--brass-1);
}
.ad-preview-action svg { color: var(--brass-1); }

/* === Video Generator form === */
.page-videogen { padding: 20px 28px 60px; }
.page-videogen .page-header { margin-bottom: 14px; }
.page-videogen .page-title { font-size: 30px; }
.page-videogen .page-sub { font-size: 13px; }
.page-videogen .split-wide { grid-template-columns: 340px 1fr; gap: 22px; }

.video-form {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.video-tab-row {
  display: flex;
  gap: 18px;
  border-bottom: 1px solid var(--ink-3);
  padding-bottom: 2px;
  margin-bottom: 2px;
}

.video-tab {
  padding: 6px 2px;
  font-size: 12.5px;
  color: var(--fg-2);
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
  cursor: pointer;
  font-family: inherit;
  font-weight: 500;
  transition: color 0.15s, border-color 0.15s;
}

.video-tab.active { color: var(--fg-0); border-color: var(--brass-1); }
.video-tab:hover { color: var(--fg-0); }

.preset-hero {
  aspect-ratio: 16/8;
  border-radius: var(--r-md);
  overflow: hidden;
  position: relative;
  border: 1px solid var(--ink-3);
}

.preset-hero-bg {
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, oklch(0.35 0.06 60), oklch(0.25 0.05 40));
}

.preset-hero-bg .ph {
  position: absolute;
  inset: 0;
  background-image: repeating-linear-gradient(135deg, transparent 0 16px, oklch(1 0 0 / 0.02) 16px 17px);
}

.preset-hero-overlay {
  position: absolute;
  inset: 0;
  padding: 12px 14px;
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  background: linear-gradient(to top, oklch(0 0 0 / 0.6) 0%, transparent 50%);
}

.preset-hero-tag {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 22px;
  color: var(--brass-1);
  letter-spacing: -0.02em;
  line-height: 1;
  text-shadow: 0 2px 8px oklch(0 0 0 / 0.4);
}

.preset-hero-name {
font-family: var(--font-mono);
  font-weight: 600;
  font-size: 11px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: oklch(1 0 0 / 0.85);
  margin-top: 4px;
}

.change-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  border-radius: 100px;
  background: oklch(0 0 0 / 0.55);
  backdrop-filter: blur(8px);
  border: 1px solid oklch(1 0 0 / 0.15);
  color: var(--fg-0);
  font-size: 11.5px;
  cursor: pointer;
  font-family: inherit;
}

.change-btn:hover { background: oklch(0 0 0 / 0.7); }

.subtab-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  background: var(--ink-1);
  border: 1px solid var(--ink-3);
  border-radius: var(--r-md);
  padding: 4px;
  gap: 4px;
}

.subtab {
  padding: 8px;
  border-radius: var(--r-sm);
  color: var(--fg-2);
  font-size: 12.5px;
  font-weight: 500;
  cursor: pointer;
  font-family: inherit;
  transition: background 0.15s, color 0.15s;
}

.subtab.active { background: var(--ink-2); color: var(--fg-0); box-shadow: 0 1px 2px oklch(0 0 0 / 0.3); }

.frame-card {
  position: relative;
  background: var(--ink-1);
  border: 1px solid var(--ink-3);
  border-radius: var(--r-md);
  min-height: 90px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
  color: var(--fg-3);
  font-size: 11.5px;
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s;
}
.frame-card:hover { border-color: var(--brass-3); color: var(--brass-1); }
.frame-card.disabled {
  opacity: 0.4;
  pointer-events: none;
  cursor: not-allowed;
  filter: saturate(0.6);
}
.frame-card.disabled:hover { border-color: var(--ink-3); color: var(--fg-3); }
.frame-card .frame-label { font-size: 12.5px; color: var(--fg-1); font-weight: 500; }

.opt-pill {
  position: absolute;
  top: 8px;
  left: 8px;
font-family: var(--font-mono);
  font-weight: 600;
  font-size: 9px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  padding: 3px 8px;
  border-radius: 100px;
  background: var(--ink-2);
  border: 1px solid var(--ink-3);
  color: var(--fg-3);
}

/* === New tall frame cards (Start / End frame) === */
.frame-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.frame-card-tall {
  position: relative;
  background:
    linear-gradient(180deg, oklch(1 0 0 / 0.025), oklch(1 0 0 / 0.005)),
    var(--ink-1);
  border: 1px solid var(--ink-3);
  border-radius: var(--r-md);
  padding: 12px 10px 10px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  cursor: pointer;
  transition: border-color 0.15s;
  box-shadow: 0 1px 0 oklch(1 0 0 / 0.03) inset;
}

.frame-card-tall:hover { border-color: var(--brass-3); }

.frame-card-tall.disabled {
  opacity: 0.4;
  pointer-events: none;
  cursor: not-allowed;
  filter: saturate(0.6);
}

.frame-head {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
}

.frame-icon {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background: var(--ink-2);
  border: 1px solid var(--ink-3);
  display: grid;
  place-items: center;
  color: var(--fg-2);
  margin-bottom: 2px;
}

.frame-title {
  font-size: 13px;
  font-weight: 500;
  color: var(--fg-0);
}

.frame-sub {
font-family: var(--font-mono);
  font-weight: 600;
  font-size: 9.5px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--fg-3);
}

.frame-thumb {
  aspect-ratio: 3/4;
  border-radius: var(--r-sm);
  background:
    repeating-linear-gradient(135deg, transparent 0 14px, oklch(1 0 0 / 0.02) 14px 15px),
    linear-gradient(135deg, oklch(0.20 0.005 60), oklch(0.14 0.005 60));
  border: 1px solid var(--ink-3);
  display: grid;
  place-items: center;
  color: var(--fg-3);
font-family: var(--font-mono);
  font-weight: 600;
  font-size: 10px;
  letter-spacing: 0.15em;
  overflow: hidden;
}

/* Discover Presets banner */
.discover-card {
  position: relative;
  background:
    linear-gradient(180deg, oklch(1 0 0 / 0.03), oklch(1 0 0 / 0.005)),
    linear-gradient(135deg, oklch(0.18 0.02 70), oklch(0.13 0.005 60));
  border: 1px solid var(--ink-3);
  border-radius: var(--r-md);
  padding: 12px 14px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  box-shadow: 0 1px 0 oklch(1 0 0 / 0.04) inset;
}

.discover-info { display: flex; flex-direction: column; gap: 2px; }
.discover-title {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 16px;
  letter-spacing: -0.005em;
  color: var(--brass-1);
  text-transform: uppercase;
}
.discover-sub {
  font-size: 12px;
  color: var(--fg-1);
  font-weight: 500;
}

.explore-btn {
  padding: 7px 16px;
  border-radius: 100px;
  background: oklch(1 0 0 / 0.04);
  border: 1px solid var(--ink-4);
  color: var(--fg-0);
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  font-family: inherit;
  transition: background 0.15s, border-color 0.15s;
}
.change-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 9px 16px;
  border-radius: 12px;
  background: transparent;
  border: 1px solid var(--ink-4);
  color: var(--fg-0);
  font-family: inherit;
  font-size: 12.5px;
  font-weight: 500;
  cursor: pointer;
  white-space: nowrap;
  transition: background 0.15s, border-color 0.15s, color 0.15s;
}

.change-btn:hover {
  background: oklch(1 0 0 / 0.02);
  border-color: var(--brass-3);
  color: var(--brass-1);
}

.change-btn svg { color: var(--brass-1); flex-shrink: 0; }

/* === Model picker modal === */
.model-modal-bg {
  position: fixed;
  inset: 0;
  background: oklch(0.05 0.005 60 / 0.7);
  backdrop-filter: blur(8px);
  z-index: 90;
  display: grid;
  place-items: center;
  padding: 32px;
}

.model-modal {
  width: min(620px, 96vw);
  background:
    linear-gradient(180deg, oklch(1 0 0 / 0.03), transparent),
    oklch(0.13 0.005 60);
  border: 1px solid var(--ink-4);
  border-radius: var(--r-lg);
  padding: 18px 18px 20px;
  position: relative;
  box-shadow: 0 32px 80px -24px oklch(0 0 0 / 0.8), 0 1px 0 oklch(1 0 0 / 0.05) inset;
}

.model-modal::before {
  content: '';
  position: absolute;
  top: 0; left: 15%; right: 15%; height: 1px;
  background: linear-gradient(to right, transparent, oklch(0.85 0.13 75 / 0.5), transparent);
  border-radius: inherit;
  pointer-events: none;
}

.model-modal-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding-bottom: 14px;
}

.model-modal-head h3 {
  font-family: var(--font-display);
  font-weight: 500;
  font-size: 16px;
  color: var(--fg-0);
  letter-spacing: -0.005em;
}

.model-modal-close {
  width: 28px; height: 28px;
  border-radius: 6px;
  background: var(--ink-2);
  border: 1px solid var(--ink-3);
  color: var(--fg-1);
  display: grid;
  place-items: center;
  cursor: pointer;
  font-family: inherit;
  font-size: 13px;
  transition: background 0.15s, color 0.15s;
}
.model-modal-close:hover { background: var(--ink-3); color: var(--fg-0); }

.model-modal-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.model-modal-card {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px;
  background: oklch(1 0 0 / 0.018);
  border: 1px solid var(--ink-3);
  border-radius: var(--r-md);
  cursor: pointer;
  text-align: left;
  font-family: inherit;
  transition: border-color 0.15s, background 0.15s, transform 0.1s;
}

.model-modal-card:hover { border-color: var(--ink-5); background: oklch(1 0 0 / 0.028); }
.model-modal-card.active {
  border-color: var(--brass-1);
  box-shadow: 0 0 0 1px var(--brass-1), 0 8px 24px -10px oklch(0.85 0.13 75 / 0.4);
}

.mmc-icon {
  width: 44px;
  height: 44px;
  border-radius: 10px;
  display: grid;
  place-items: center;
  color: oklch(0.95 0.05 80);
  flex-shrink: 0;
  border: 1px solid oklch(1 0 0 / 0.08);
  box-shadow: 0 1px 0 oklch(1 0 0 / 0.08) inset;
}

.mmc-olive  { background: linear-gradient(140deg, oklch(0.42 0.06 100), oklch(0.30 0.05 95)); }
.mmc-brass  { background: linear-gradient(140deg, oklch(0.55 0.10 75), oklch(0.38 0.08 65)); }
.mmc-blue   { background: linear-gradient(140deg, oklch(0.42 0.10 240), oklch(0.28 0.08 235)); }
.mmc-violet { background: linear-gradient(140deg, oklch(0.45 0.13 305), oklch(0.30 0.10 300)); }
.mmc-emerald{ background: linear-gradient(140deg, oklch(0.45 0.12 160), oklch(0.30 0.10 155)); }
.mmc-teal   { background: linear-gradient(140deg, oklch(0.46 0.10 180), oklch(0.30 0.08 175)); }

.mmc-body { display: flex; flex-direction: column; gap: 3px; min-width: 0; }

.mmc-name {
  font-size: 14px;
  font-weight: 500;
  color: var(--fg-0);
  display: flex;
  align-items: baseline;
  gap: 6px;
}

.mmc-light { font-weight: 400; color: var(--fg-1); }

.mmc-tier {
font-family: var(--font-mono);
  font-weight: 600;
  font-size: 10px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--fg-3);
  display: flex;
  align-items: center;
  gap: 5px;
}
.mmc-tier svg { color: var(--fg-3); opacity: 0.7; }

/* === Side popover for Model button === */
.model-side-popover {
  position: absolute;
  left: calc(100% + 14px);
  bottom: 0;
  width: 330px;
  background:
    linear-gradient(180deg, oklch(1 0 0 / 0.025), transparent),
    oklch(0.13 0.005 60);
  border: 1px solid var(--ink-4);
  border-radius: var(--r-md);
  padding: 8px;
  box-shadow: 0 24px 60px -20px oklch(0 0 0 / 0.8);
  z-index: 50;
  max-height: 80vh;
  overflow-y: auto;
}

/* Small model icon next to selected model name in the Model button */
.mp-init {
  display: inline-grid;
  place-items: center;
  width: 18px;
  height: 18px;
  border-radius: 5px;
  color: oklch(0.95 0.05 80);
  border: 1px solid oklch(1 0 0 / 0.1);
  margin-left: 2px;
}

/* Frame slot — empty state hides the thumb */
.frame-card-tall.empty .frame-head { padding: 12px 0 14px; }
.frame-card-tall.filled .frame-thumb { position: relative; }

.frame-clear {
  position: absolute;
  top: 6px;
  right: 6px;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: oklch(0 0 0 / 0.6);
  border: 1px solid oklch(1 0 0 / 0.15);
  color: var(--fg-0);
  display: grid;
  place-items: center;
  cursor: pointer;
  font-size: 11px;
  backdrop-filter: blur(6px);
}
.frame-clear:hover { background: oklch(0 0 0 / 0.8); }

.prompt-card {
  background: var(--ink-1);
  border: 1px solid var(--ink-3);
  border-radius: var(--r-md);
  padding: 10px 12px;
  position: relative;
}

/* Sound toggle inside Prompt + Shot cards */
.sound-toggle {
  margin-top: 8px;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 6px 12px;
  border-radius: 100px;
  background: oklch(0.10 0.004 60);
  border: 1px solid var(--ink-3);
  color: var(--fg-1);
  font-family: inherit;
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  transition: color 0.15s, border-color 0.15s, background 0.15s;
}

.sound-toggle.on { color: var(--brass-1); border-color: var(--brass-3); }
.sound-toggle.on svg { color: var(--brass-1); }
.sound-toggle.off { color: var(--fg-2); }
.sound-toggle.off svg { color: var(--fg-3); }

.sound-toggle:hover {
  background: oklch(1 0 0 / 0.02);
  border-color: var(--brass-3);
  color: var(--brass-1);
}
.sound-toggle:hover svg { color: var(--brass-1); }

.sound-toggle.small { padding: 4px 10px; font-size: 11.5px; margin-top: 0; }

.prompt-label {
  font-size: 11.5px;
  color: var(--fg-2);
  margin-bottom: 4px;
  font-weight: 500;
}

.prompt-input {
  width: 100%;
  background: transparent;
  border: none;
  outline: none;
  resize: vertical;
  color: var(--fg-0);
  font-family: inherit;
  font-size: 13px;
  line-height: 1.45;
  padding: 0;
  min-height: 40px;
}
.prompt-input::placeholder { color: var(--fg-3); }

.prompt-row {
  display: flex;
  gap: 6px;
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1px solid var(--ink-3);
}

.mini-toggle {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  border-radius: 100px;
  background: var(--ink-0);
  border: 1px solid var(--ink-3);
  color: var(--fg-2);
  font-size: 11.5px;
  cursor: pointer;
  font-family: inherit;
}
.mini-toggle.on { color: var(--brass-1); border-color: var(--brass-3); background: var(--brass-tint); }

.setting-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 14px 14px;
  background: var(--ink-1);
  border: 1px solid var(--ink-3);
  border-radius: var(--r-md);
}

.setting-name { font-size: 13.5px; font-weight: 500; color: var(--fg-0); }
.setting-help {
font-family: var(--font-mono);
  font-weight: 600;
  font-size: 10px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--fg-3);
  margin-top: 3px;
}

.switch {
  width: 38px;
  height: 22px;
  background: var(--ink-3);
  border-radius: 100px;
  border: 1px solid var(--ink-4);
  position: relative;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s;
  padding: 0;
}

.switch .dot {
  position: absolute;
  top: 2px;
  left: 2px;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: var(--fg-1);
  transition: left 0.18s, background 0.18s;
}

.switch.on { background: var(--brass-2); border-color: var(--brass-2); }
.switch.on.success { background: oklch(0.72 0.16 152); border-color: oklch(0.72 0.16 152); }
.switch.on .dot { left: 18px; background: oklch(0.18 0.01 60); }

/* === Multi-shot panel === */
.multishot {
  background:
    linear-gradient(180deg, oklch(1 0 0 / 0.025), oklch(1 0 0 / 0.005)),
    var(--ink-1);
  border: 1px solid var(--ink-3);
  border-radius: var(--r-md);
  padding: 10px 12px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  position: relative;
}

.multishot-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.multishot-title {
  display: flex;
  align-items: center;
  gap: 6px;
}

.multishot-title svg { color: var(--fg-3); opacity: 0.6; }

.mode-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  background: var(--ink-0);
  border: 1px solid var(--ink-3);
  border-radius: var(--r-sm);
  padding: 3px;
  gap: 3px;
}

.mode-tab {
  padding: 7px;
  border-radius: 5px;
  color: var(--fg-2);
  font-size: 12.5px;
  font-weight: 500;
  cursor: pointer;
  font-family: inherit;
  transition: background 0.15s, color 0.15s;
}

.mode-tab.active {
  background: var(--ink-2);
  color: var(--fg-0);
  box-shadow: 0 1px 2px oklch(0 0 0 / 0.3);
}

.auto-note {
  font-size: 12px;
  color: var(--fg-2);
  padding: 10px 12px;
  background: var(--ink-0);
  border: 1px solid var(--ink-3);
  border-radius: var(--r-sm);
  line-height: 1.5;
}

.shot-stack {
  display: flex;
  flex-direction: column;
  gap: 10px;
  max-height: 360px;
  overflow-y: auto;
  margin: 0 -6px;
  padding: 0 6px;
}

.shot-card {
  background: var(--ink-0);
  border: 1px solid var(--ink-3);
  border-radius: var(--r-sm);
  padding: 10px 12px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.shot-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.shot-title {
  font-size: 12.5px;
  font-weight: 500;
  color: var(--fg-1);
}

.shot-del {
  width: 22px;
  height: 22px;
  border-radius: 4px;
  display: grid;
  place-items: center;
  color: var(--fg-3);
  cursor: pointer;
  transition: color 0.15s, background 0.15s;
}
.shot-del:hover { color: var(--danger); background: oklch(0.70 0.15 25 / 0.1); }

.shot-input {
  width: 100%;
  background: transparent;
  border: none;
  outline: none;
  resize: vertical;
  color: var(--fg-0);
  font-family: inherit;
  font-size: 13px;
  line-height: 1.5;
  padding: 0;
  min-height: 44px;
  max-height: 120px;
}
.shot-input::placeholder { color: var(--fg-3); }

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

.shot-pill {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 4px 9px;
  border-radius: 100px;
  background: var(--ink-1);
  border: 1px solid var(--ink-3);
  font-size: 11.5px;
  color: var(--fg-1);
  cursor: pointer;
  font-family: inherit;
}

.shot-pill.ghost { color: var(--fg-2); }
.shot-pill:hover { border-color: var(--ink-5); color: var(--fg-0); }
.shot-pill svg { color: var(--brass-2); opacity: 0.8; }

.add-shot {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  width: 100%;
  padding: 9px;
  border-radius: var(--r-sm);
  border: 1px dashed var(--ink-4);
  background: transparent;
  color: var(--fg-1);
  font-size: 12.5px;
  cursor: pointer;
  font-family: inherit;
  transition: border-color 0.15s, color 0.15s, background 0.15s;
}

.add-shot:hover { border-color: var(--brass-3); color: var(--brass-1); background: var(--brass-tint); }
.add-shot .hint {
font-family: var(--font-mono);
  font-weight: 600;
  font-size: 10px;
  color: var(--fg-3);
  letter-spacing: 0.1em;
  margin-left: 4px;
}

.model-picker-btn {
  width: 100%;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 12px;
  background: var(--ink-1);
  border: 1px solid var(--ink-3);
  border-radius: var(--r-md);
  color: var(--fg-0);
  cursor: pointer;
  text-align: left;
  font-family: inherit;
  transition: border-color 0.15s;
}
.model-picker-btn:hover { border-color: var(--ink-5); }

.model-picker-name {
  font-size: 14px;
  font-weight: 500;
  margin-top: 3px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.brass-init {
  display: inline-grid;
  place-items: center;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: linear-gradient(140deg, var(--brass-0), var(--brass-2));
  color: oklch(0.16 0.01 60);
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 10px;
}

.setting-pills {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.setting-pills.wide-pills {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 8px;
}

.setting-pills.wide-pills > div { display: flex; }

.setting-pills.wide-pills .tool-pill {
  width: 100%;
  justify-content: flex-start;
  padding: 12px 14px;
  border-radius: var(--r-md);
  background: var(--ink-1);
  border-color: var(--ink-3);
  font-size: 13.5px;
  font-weight: 500;
}

.setting-pills.wide-pills .tool-pill:disabled {
  cursor: default;
  opacity: 0.85;
}
.setting-pills.wide-pills .tool-pill:disabled:hover {
  border-color: var(--ink-3);
  background: var(--ink-1);
}

/* Duration slider popover (Seedance) */
.dur-slider {
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  background: oklch(0.12 0.005 60);
  border-radius: var(--r-md);
}

.dur-slider-label {
  font-size: 13px;
  font-weight: 500;
  color: var(--fg-0);
}

.dur-slider-track {
  position: relative;
  padding: 12px 16px;
  border: 1px solid var(--ink-4);
  border-radius: 10px;
  background: oklch(0.08 0.004 60);
  display: flex;
  align-items: center;
  gap: 14px;
}

.dur-slider-value {
  font-size: 13.5px;
  font-weight: 500;
  color: var(--fg-0);
  min-width: 28px;
}

.dur-slider input[type="range"] {
  -webkit-appearance: none;
  appearance: none;
  flex: 1;
  height: 22px;
  background: transparent;
  outline: none;
  cursor: pointer;
  margin: 0;
  padding: 0;
}

.dur-slider input[type="range"]::-webkit-slider-runnable-track {
  height: 22px;
  background: transparent;
  border: none;
}
.dur-slider input[type="range"]::-moz-range-track {
  height: 22px;
  background: transparent;
  border: none;
}

.dur-slider input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 3px;
  height: 22px;
  border-radius: 2px;
  background: oklch(0.98 0 0);
  border: none;
  cursor: grab;
  margin-top: 0;
}
.dur-slider input[type="range"]::-moz-range-thumb {
  width: 3px;
  height: 22px;
  border-radius: 2px;
  background: oklch(0.98 0 0);
  border: none;
  cursor: grab;
}

/* === Video preview lightbox === */
.video-lightbox {
  position: fixed;
  inset: 0;
  background: oklch(0.05 0.005 60 / 0.96);
  backdrop-filter: blur(6px);
  z-index: 80;
  display: grid;
  place-items: center;
}

.video-close {
  position: absolute;
  top: 22px;
  right: 22px;
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: oklch(0.18 0.008 60);
  border: 1px solid var(--ink-4);
  color: var(--fg-0);
  display: grid;
  place-items: center;
  cursor: pointer;
  font-size: 14px;
  z-index: 2;
}
.video-close:hover { background: var(--ink-3); }

.video-lightbox-stage {
  display: grid;
  grid-template-columns: 1fr 300px;
  width: min(1080px, 94vw);
  height: 78vh;
  max-height: 720px;
  gap: 0;
}

.video-lightbox-player {
  position: relative;
  display: grid;
  place-items: center;
  height: 100%;
  overflow: hidden;
  background: transparent;
  padding: 20px;
}

.video-lightbox-player .ph {
  height: 100%;
  width: auto;
  aspect-ratio: 9/16;
  background-image: linear-gradient(135deg, oklch(0.22 0.008 60), oklch(0.16 0.008 60)),
                    repeating-linear-gradient(135deg, transparent 0 14px, oklch(1 0 0 / 0.02) 14px 15px);
  background-blend-mode: overlay;
  border-radius: var(--r-md);
  display: grid;
  place-items: center;
  color: var(--fg-3);
font-family: var(--font-mono);
  font-weight: 600;
  font-size: 11px;
  letter-spacing: 0.15em;
}

.video-play-big {
  position: absolute;
  width: 64px;
  height: 64px;
  border-radius: 50%;
  background: oklch(1 0 0 / 0.95);
  color: oklch(0.15 0.005 60);
  display: grid;
  place-items: center;
  box-shadow: 0 16px 48px -10px oklch(0 0 0 / 0.7);
  pointer-events: none;
}

.video-lightbox-side {
  padding: 22px 22px 18px;
  background:
    linear-gradient(180deg, oklch(1 0 0 / 0.025), oklch(1 0 0 / 0.005)),
    oklch(0.13 0.005 60);
  border: 1px solid var(--ink-4);
  border-radius: var(--r-lg);
  margin: 12px 12px 12px 0;
  display: flex;
  flex-direction: column;
  gap: 14px;
  overflow-y: auto;
  position: relative;
  box-shadow: 0 1px 0 oklch(1 0 0 / 0.03) inset;
}

.video-lightbox-side::before {
  content: '';
  position: absolute;
  top: 0;
  left: 15%;
  right: 15%;
  height: 1px;
  background: linear-gradient(to right,
    transparent,
    oklch(0.85 0.13 75 / 0.35) 30%,
    oklch(0.95 0.10 75 / 0.5) 50%,
    oklch(0.85 0.13 75 / 0.35) 70%,
    transparent);
  pointer-events: none;
  border-radius: inherit;
}

.video-model-pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 14px;
  border-radius: 100px;
  background: var(--ink-2);
  border: 1px solid var(--ink-3);
  color: var(--fg-0);
  font-size: 13px;
  align-self: flex-start;
}
.video-model-pill svg { color: var(--brass-1); }

.video-prompt-text {
  font-size: 12.5px;
  color: var(--fg-0);
  line-height: 1.5;
  max-height: 180px;
  overflow: hidden;
  text-overflow: ellipsis;
  position: relative;
}

.video-ref-row { display: flex; gap: 6px; }
.ref-circle {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: linear-gradient(135deg, oklch(0.32 0.04 60), oklch(0.22 0.03 50));
  border: 2px solid oklch(0.13 0.005 60);
  display: grid;
  place-items: center;
  color: var(--brass-1);
  font-family: var(--font-display);
  font-size: 11px;
  font-weight: 500;
  margin-left: -10px;
}
.ref-circle:first-child { margin-left: 0; }

.video-setting-row { display: flex; gap: 6px; flex-wrap: wrap; }

.vp-pill {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 6px 10px;
  border-radius: 100px;
  background: var(--ink-2);
  border: 1px solid var(--ink-3);
  font-size: 12px;
  color: var(--fg-0);
}
.vp-pill svg { color: var(--fg-2); }

.video-side-spacer { flex: 1; min-height: 12px; }
.video-date {
font-family: var(--font-mono);
  font-weight: 600;
  font-size: 10.5px;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  color: var(--fg-3);
  text-align: right;
}

/* === Video preview side sections === */
.vp-section { display: flex; flex-direction: column; gap: 8px; }

.vp-section-label {
font-family: var(--font-mono);
  font-weight: 600;
  font-size: 10px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--fg-3);
}

.vp-ref-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.vp-ref-thumb {
  aspect-ratio: 1;
  border-radius: var(--r-sm);
  background:
    repeating-linear-gradient(135deg, transparent 0 12px, oklch(1 0 0 / 0.025) 12px 13px),
    linear-gradient(135deg, oklch(0.30 0.04 60), oklch(0.18 0.03 50));
  display: grid;
  place-items: center;
  color: var(--brass-1);
  border: 1px solid var(--ink-3);
  cursor: pointer;
  transition: border-color 0.15s;
}
.vp-ref-thumb:hover { border-color: var(--brass-3); }

.vp-jobid {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 9px 11px;
  background: oklch(0.10 0.005 60);
  border: 1px solid var(--ink-3);
  border-radius: var(--r-sm);
}

.vp-jobid code {
  flex: 1;
font-family: var(--font-mono);
  font-weight: 600;
  font-size: 12px;
  color: var(--fg-0);
  letter-spacing: 0.02em;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.vp-jobid-copy {
  width: 24px; height: 24px;
  border-radius: 5px;
  background: oklch(1 0 0 / 0.04);
  border: 1px solid var(--ink-3);
  color: var(--fg-2);
  display: grid;
  place-items: center;
  cursor: pointer;
  transition: background 0.15s, color 0.15s, border-color 0.15s;
}
.vp-jobid-copy:hover { background: var(--brass-tint); border-color: var(--brass-3); color: var(--brass-1); }

.vp-actions {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 4px;
}

.vp-action {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 12px 14px;
  border-radius: var(--r-md);
  background: oklch(1 0 0 / 0.03);
  border: 1px solid var(--ink-3);
  color: var(--fg-0);
  font-family: inherit;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s, color 0.15s;
}
.vp-action svg { color: var(--brass-1); }
.vp-action:hover {
  background: oklch(1 0 0 / 0.05);
  border-color: var(--ink-5);
}

.vp-action.primary {
  background: linear-gradient(140deg, var(--brass-0), var(--brass-1) 50%, var(--brass-2));
  color: oklch(0.16 0.01 60);
  border-color: oklch(0.92 0.07 85 / 0.5);
  box-shadow: 0 6px 18px -6px oklch(0.85 0.13 75 / 0.5);
}
.vp-action.primary svg { color: oklch(0.16 0.01 60); }
.vp-action.primary:hover { filter: brightness(1.08); }

.chip {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 6px 11px;
  border-radius: 100px;
  background: var(--ink-2);
  border: 1px solid var(--ink-3);
  color: var(--fg-1);
  font-size: 12px;
  transition: border-color 0.15s, color 0.15s;
  cursor: pointer;
}

.chip:hover { border-color: var(--ink-5); color: var(--fg-0); }
.chip .ico { opacity: 0.7; }
.chip.active { background: var(--brass-tint); border-color: var(--brass-3); color: var(--brass-1); }

.chip.divider { background: none; border: none; padding: 0; color: var(--fg-3); cursor: default; pointer-events: none; }

.generate-btn {
  margin-left: auto;
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  padding: 10px 28px;
  border-radius: var(--r-md);
  background: linear-gradient(140deg, var(--brass-0), var(--brass-1) 50%, var(--brass-2));
  color: oklch(0.15 0.01 60);
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  font-size: 11px;
  box-shadow: var(--shadow-brass);
  border: 1px solid oklch(0.92 0.07 85 / 0.4);
}

.generate-btn .cost {
font-family: var(--font-mono);
  font-weight: 600;
  font-size: 9px;
  letter-spacing: 0.1em;
  opacity: 0.7;
  text-transform: none;
  margin-top: 2px;
}

.generate-btn:hover { filter: brightness(1.06); }

/* === Side panels (left rails on some pages) === */
.split { display: grid; grid-template-columns: 320px 1fr; gap: 28px; }
.split-wide { display: grid; grid-template-columns: 360px 1fr; gap: 32px; }

.panel {
  background:
    linear-gradient(180deg, oklch(1 0 0 / 0.025), oklch(1 0 0 / 0.005)),
    var(--ink-1);
  border: 1px solid var(--ink-3);
  border-radius: var(--r-lg);
  padding: 20px;
  box-shadow: 0 1px 0 oklch(1 0 0 / 0.03) inset;
  position: relative;
}

.panel + .panel { margin-top: 16px; }

.panel-label {
font-family: var(--font-mono);
  font-weight: 600;
  font-size: 10px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--fg-3);
  margin-bottom: 10px;
}

.field-label {
  font-size: 12px;
  color: var(--fg-1);
  margin-bottom: 8px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.field-label .hint {
font-family: var(--font-mono);
  font-weight: 600;
  font-size: 10px;
  color: var(--fg-3);
  letter-spacing: 0.05em;
}

.input, .textarea, .select {
  width: 100%;
  background: var(--ink-0);
  border: 1px solid var(--ink-3);
  border-radius: var(--r-sm);
  padding: 10px 12px;
  font-size: 13px;
  color: var(--fg-0);
  outline: none;
  transition: border-color 0.15s;
  font-family: inherit;
}

.input:focus, .textarea:focus, .select:focus { border-color: var(--brass-2); }

.input.mono, .textarea.mono { font-family: inherit; font-size: 13px; line-height: 1.55; }
.textarea { resize: vertical; min-height: 80px; line-height: 1.5; }

.muted-help {
  font-size: 11.5px;
  color: var(--fg-3);
  line-height: 1.5;
  margin-top: 6px;
}

/* Frame slots */
.frame-slot {
  aspect-ratio: 4/5;
  border: 1px dashed var(--ink-4);
  border-radius: var(--r-md);
  background: var(--ink-0);
  display: grid;
  place-items: center;
  color: var(--fg-3);
  font-size: 11px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
font-family: var(--font-mono);
  font-weight: 600;
}

/* Ad analysis */
.analysis-row {
  display: grid;
  grid-template-columns: 140px 1fr;
  gap: 24px;
  padding: 14px 0;
  border-top: 1px dashed var(--ink-3);
  align-items: baseline;
}
.analysis-row:first-child { border-top: none; }
.analysis-row .k {
font-family: var(--font-mono);
  font-weight: 600;
  font-size: 10.5px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--fg-3);
}
.analysis-row .v { font-size: 14px; color: var(--fg-0); line-height: 1.55; }

.section-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  padding-bottom: 14px;
  border-bottom: 1px solid var(--ink-3);
  margin-bottom: 8px;
}

.section-head h3 {
  font-family: var(--font-display);
  font-weight: 500;
  font-size: 24px;
  letter-spacing: -0.005em;
}

.toc-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 0;
  font-size: 13px;
  color: var(--fg-2);
  cursor: pointer;
  border-bottom: 1px dashed var(--ink-3);
}

.toc-item:last-child { border-bottom: none; }
.toc-item:hover { color: var(--fg-0); }
.toc-item.active { color: var(--brass-1); }
.toc-item .num {
font-family: var(--font-mono);
  font-weight: 600;
  font-size: 10px;
  color: var(--fg-3);
  width: 22px;
}
.toc-item.active .num { color: var(--brass-2); }

/* Status pills */
.status-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  border-radius: 100px;
  border: 1px solid var(--ink-3);
  background: var(--ink-2);
font-family: var(--font-mono);
  font-weight: 600;
  font-size: 10px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--fg-1);
}

.status-pill.success { color: var(--success); border-color: oklch(0.78 0.10 150 / 0.4); }
.status-pill.success::before {
  content: '';
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--success);
  box-shadow: 0 0 8px var(--success);
}

/* Run cards */
.run-card {
  padding: 14px;
  border: 1px solid var(--ink-3);
  border-radius: var(--r-md);
  background: var(--ink-1);
  transition: border-color 0.15s;
}
.run-card:hover { border-color: var(--brass-3); cursor: pointer; }

.run-card h4 {
  font-size: 13.5px;
  font-weight: 500;
  margin-bottom: 8px;
  color: var(--fg-0);
}

.run-meta {
  display: flex;
  align-items: center;
  gap: 10px;
font-family: var(--font-mono);
  font-weight: 600;
  font-size: 10px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--fg-3);
}

.run-meta .sep { width: 3px; height: 3px; border-radius: 50%; background: var(--fg-3); }

/* Video gen tile (portrait) */
.video-tile .gen-thumb { aspect-ratio: 9/16; }

.video-tile .play-overlay {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  background: linear-gradient(180deg, transparent 60%, oklch(0 0 0 / 0.5));
}

.play-circle {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: oklch(0 0 0 / 0.5);
  backdrop-filter: blur(10px);
  border: 1px solid oklch(1 0 0 / 0.2);
  display: grid;
  place-items: center;
  color: var(--fg-0);
}

/* Voice / large action card */
.action-card {
  border: 1px solid var(--ink-3);
  border-radius: var(--r-lg);
  padding: 28px;
  background: radial-gradient(ellipse at center top, oklch(0.82 0.10 82 / 0.06), transparent 60%), var(--ink-1);
  display: flex;
  flex-direction: column;
  gap: 14px;
  min-height: 240px;
  position: relative;
  overflow: hidden;
  transition: border-color 0.2s;
}

.action-card:hover { border-color: var(--brass-3); }

.action-card .iconbox {
  width: 48px;
  height: 48px;
  border-radius: var(--r-md);
  background: linear-gradient(140deg, var(--brass-tint), transparent);
  border: 1px solid oklch(0.82 0.10 82 / 0.3);
  display: grid;
  place-items: center;
  color: var(--brass-1);
}

.action-card h4 {
  font-family: var(--font-display);
  font-weight: 500;
  font-size: 22px;
  letter-spacing: -0.005em;
  color: var(--fg-0);
}

.action-card p { font-size: 13px; color: var(--fg-2); line-height: 1.55; }

.action-card .step {
  position: absolute;
  top: 20px;
  right: 22px;
font-family: var(--font-mono);
  font-weight: 600;
  font-size: 10.5px;
  letter-spacing: 0.15em;
  color: var(--fg-3);
}

/* Project tiles */
.project-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 20px;
}

.project-tile {
  border: 1px solid var(--ink-3);
  border-radius: var(--r-lg);
  background: var(--ink-1);
  overflow: hidden;
  transition: transform 0.2s, border-color 0.2s, box-shadow 0.2s;
}

.project-tile:hover {
  transform: translateY(-2px);
  border-color: var(--brass-3);
  box-shadow: 0 12px 28px -12px oklch(0 0 0 / 0.6);
  cursor: pointer;
}

.project-thumb {
  aspect-ratio: 16/9;
  background: linear-gradient(135deg, var(--ink-2), var(--ink-3));
  display: grid;
  place-items: center;
  color: var(--fg-3);
  position: relative;
  overflow: hidden;
}

.project-thumb img { width: 100%; height: 100%; object-fit: cover; }

.project-meta {
  padding: 14px 16px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.project-name {
  font-family: var(--font-display);
  font-size: 18px;
  font-weight: 500;
  color: var(--fg-0);
}

.project-info {
font-family: var(--font-mono);
  font-weight: 600;
  font-size: 10px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--fg-3);
}

/* Improver */
.io-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }

.output-block {
  background: var(--ink-1);
  border: 1px solid var(--ink-3);
  border-radius: var(--r-md);
  padding: 18px 20px;
  min-height: 120px;
}

.output-block .head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 10px;
}

.output-block .head .l {
font-family: var(--font-mono);
  font-weight: 600;
  font-size: 10px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--fg-3);
}

.copy-link {
font-family: var(--font-mono);
  font-weight: 600;
  font-size: 10px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--brass-1);
  cursor: pointer;
  padding: 4px 8px;
  border-radius: 4px;
}

.copy-link:hover { background: var(--brass-tint); }

/* Outlined rounded-rectangle button — thin border, no glow */
.glow-btn {
  padding: 10px 20px;
  border-radius: 12px;
  background: transparent;
  border: 1px solid var(--ink-4);
  color: var(--fg-0);
  font-family: inherit;
  font-size: 12.5px;
  font-weight: 500;
  letter-spacing: 0.01em;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s, color 0.15s;
}

.glow-btn:hover {
  border-color: var(--brass-3);
  color: var(--brass-1);
  background: oklch(1 0 0 / 0.02);
}

.glow-btn:active { transform: translateY(1px); }

.output-block .body {
  font-size: 13.5px;
  color: var(--fg-1);
  line-height: 1.6;
  min-height: 60px;
}

.output-block .body.empty {
  color: var(--fg-3);
font-family: var(--font-mono);
  font-weight: 600;
  font-size: 11px;
  letter-spacing: 0.1em;
}

/* Prompt library */
.tab-row {
  display: flex;
  gap: 6px;
  border-bottom: 1px solid var(--ink-3);
  padding-bottom: 0;
  margin-bottom: 24px;
}

.tab {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 14px;
  border-bottom: 2px solid transparent;
  color: var(--fg-2);
  font-size: 13px;
  cursor: pointer;
  margin-bottom: -1px;
}

.tab .count {
font-family: var(--font-mono);
  font-weight: 600;
  font-size: 10px;
  padding: 2px 6px;
  border-radius: 10px;
  background: var(--ink-2);
  color: var(--fg-3);
}

.tab.active {
  color: var(--brass-1);
  border-color: var(--brass-1);
}
.tab.active .count { background: var(--brass-tint); color: var(--brass-1); }

.empty-state {
  border: 1px dashed var(--ink-3);
  border-radius: var(--r-lg);
  padding: 48px;
  text-align: center;
  background: var(--ink-1);
}

.empty-state h4 {
  font-family: var(--font-display);
  font-size: 22px;
  font-weight: 500;
  margin-bottom: 8px;
}

.empty-state p { color: var(--fg-2); font-size: 13px; margin-bottom: 16px; }

/* Clipboard pill — draggable */
.clipboard-pill {
  position: fixed;
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 9px 16px 9px 11px;
  background: linear-gradient(180deg, oklch(0.24 0.008 60), oklch(0.20 0.008 60));
  border: 1px solid var(--ink-4);
  border-radius: 100px;
  font-size: 12.5px;
  color: var(--fg-0);
  box-shadow: 0 12px 28px -10px oklch(0 0 0 / 0.7), 0 1px 0 oklch(1 0 0 / 0.05) inset;
  z-index: 60;
  user-select: none;
  cursor: grab;
  transition: box-shadow 0.15s;
}

.clipboard-pill:hover { box-shadow: 0 16px 36px -12px oklch(0 0 0 / 0.8), 0 1px 0 oklch(1 0 0 / 0.05) inset; }
.clipboard-pill.dragging { cursor: grabbing; }

.clipboard-pill .grip {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: var(--brass-tint);
  color: var(--brass-1);
  border: 1px solid oklch(0.82 0.10 82 / 0.3);
}

.clipboard-pill .count {
font-family: var(--font-mono);
  font-weight: 600;
  font-size: 10px;
  padding: 2px 7px;
  background: var(--ink-0);
  border-radius: 10px;
  color: var(--fg-3);
}

/* Sidebar collapsed (variant) */
.app.compact { grid-template-columns: 68px 1fr; }
.app.compact .nav-item .label,
.app.compact .nav-label,
.app.compact .brand-name,
.app.compact .nav-item .chev,
.app.compact .sub-item { display: none; }
.app.compact .nav-item { justify-content: center; padding: 11px; }
.app.compact .nav-item.active::before { left: -8px; }
.app.compact .brand { justify-content: center; padding-left: 0; padding-right: 0; }

/* Accent variants (driven by tweaks) */
.app[data-accent="ivory"] {
  --brass-0: oklch(0.96 0.005 80);
  --brass-1: oklch(0.92 0.008 80);
  --brass-2: oklch(0.80 0.010 75);
  --brass-3: oklch(0.55 0.010 70);
  --brass-tint: oklch(0.92 0.008 80 / 0.10);
}
.app[data-accent="copper"] {
  --brass-0: oklch(0.85 0.10 50);
  --brass-1: oklch(0.72 0.13 45);
  --brass-2: oklch(0.58 0.12 40);
  --brass-3: oklch(0.42 0.09 35);
  --brass-tint: oklch(0.72 0.13 45 / 0.10);
}
.app[data-accent="oxblood"] {
  --brass-0: oklch(0.70 0.13 20);
  --brass-1: oklch(0.55 0.15 22);
  --brass-2: oklch(0.42 0.13 22);
  --brass-3: oklch(0.30 0.10 22);
  --brass-tint: oklch(0.55 0.15 22 / 0.12);
}
.app[data-accent="emerald"] {
  --brass-0: oklch(0.82 0.10 165);
  --brass-1: oklch(0.68 0.12 165);
  --brass-2: oklch(0.50 0.11 165);
  --brass-3: oklch(0.36 0.08 165);
  --brass-tint: oklch(0.68 0.12 165 / 0.10);
}

/* Background tone variants */
.app[data-tone="cool"] {
  --ink-0: oklch(0.16 0.008 240);
  --ink-1: oklch(0.19 0.008 240);
  --ink-2: oklch(0.22 0.008 240);
  --ink-3: oklch(0.26 0.008 240);
  --ink-4: oklch(0.32 0.008 240);
}
.app[data-tone="neutral"] {
  --ink-0: oklch(0.16 0.002 0);
  --ink-1: oklch(0.19 0.002 0);
  --ink-2: oklch(0.22 0.002 0);
  --ink-3: oklch(0.26 0.002 0);
  --ink-4: oklch(0.32 0.002 0);
}

/* Density */
.app[data-density="comfortable"] .page { padding-top: 44px; padding-left: 48px; padding-right: 48px; }
.app[data-density="dense"] .page { padding-top: 22px; padding-left: 26px; padding-right: 26px; }
.app[data-density="dense"] .gen-grid { gap: 12px; }
.app[data-density="dense"] .page-title { font-size: 32px; }

/* Display font variant */
.app[data-display="grotesk"] {
  --font-display: 'General Sans', system-ui, sans-serif;
}
.app[data-display="grotesk"] .page-title,
.app[data-display="grotesk"] .brand-name,
.app[data-display="grotesk"] .action-card h4,
.app[data-display="grotesk"] .project-name,
.app[data-display="grotesk"] .section-head h3,
.app[data-display="grotesk"] .empty-state h4 {
  font-weight: 600;
  letter-spacing: -0.02em;
}
.app[data-display="grotesk"] .page-title em,
.app[data-display="grotesk"] .brand-name em { font-style: normal; }

.app[data-display="grotesk"] .credits-pill .n { font-family: var(--font-body); font-weight: 700; font-size: 13px; }

/* Scrollbar */
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--ink-3); border-radius: 10px; border: 2px solid var(--ink-0); }
::-webkit-scrollbar-thumb:hover { background: var(--ink-4); }

/* Live HTML uses h1+em inside .page-header (no .page-title class).
   Mirror the brass-on-em look so existing markup still gets the gold accent. */
.lx-content .page-header h1 {
  font-family: var(--font-display);
  font-size: clamp(28px, 4vw, 40px);
  font-weight: 600;
  letter-spacing: -0.025em;
  line-height: 1.05;
  color: var(--fg-0);
}
.lx-content .page-header h1 em {
  font-style: normal;
  font-weight: 500;
  color: var(--brass-1);
}
