/* Plus Jakarta Sans (SIL OFL 1.1, web/fonts/OFL-PlusJakartaSans.txt), self-hosted:
   the Google Fonts @import chained two extra origins (CSS + font files) into
   every page's critical path and sent each visitor's IP to Google. One
   variable woff2 per subset; the browser fetches only the subsets a page
   actually uses (Latin pages: 27 KB, cached for a year). */
@font-face {
  font-family: "Plus Jakarta Sans"; font-style: normal; font-weight: 200 800;
  font-display: swap;
  src: url("/assets/fonts/plus-jakarta-sans-v12-cyrillic-ext.woff2") format("woff2");
  unicode-range: U+0460-052F, U+1C80-1C8A, U+20B4, U+2DE0-2DFF, U+A640-A69F, U+FE2E-FE2F;
}
@font-face {
  font-family: "Plus Jakarta Sans"; font-style: normal; font-weight: 200 800;
  font-display: swap;
  src: url("/assets/fonts/plus-jakarta-sans-v12-vietnamese.woff2") format("woff2");
  unicode-range: U+0102-0103, U+0110-0111, U+0128-0129, U+0168-0169, U+01A0-01A1, U+01AF-01B0, U+0300-0301, U+0303-0304, U+0308-0309, U+0323, U+0329, U+1EA0-1EF9, U+20AB;
}
@font-face {
  font-family: "Plus Jakarta Sans"; font-style: normal; font-weight: 200 800;
  font-display: swap;
  src: url("/assets/fonts/plus-jakarta-sans-v12-latin-ext.woff2") format("woff2");
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C4, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
@font-face {
  font-family: "Plus Jakarta Sans"; font-style: normal; font-weight: 200 800;
  font-display: swap;
  src: url("/assets/fonts/plus-jakarta-sans-v12-latin.woff2") 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;
}

/* =============================================================================
 * ShortsAIEngine design system v3 — premium studio
 * One stylesheet serves the studio SPA, admin panel, landing and login pages,
 * so every class kept here is a contract — pages share tokens + components.
 *
 * v3 deltas:
 *   • new tokens: --grad-cta, --grad-soft, --glow-cta, --grad-success, --grad-warn,
 *     --ring-focus, --ease-out, --ease-spring
 *   • inline-SVG icon system (.ic, 24×24, currentColor, 1.5px stroke)
 *   • top bar with sticky blur, ⌘K trigger, streak chip, avatar menu
 *   • icon-rail sidebar (collapses to 64px on mobile, top tabs <540px)
 *   • 3-zone Create workbench: step rail (left) + form (mid) + live preview (right)
 *   • tabbed Fine-tune (4 tabs, replace 4 accordions)
 *   • live preview phone frame with gradients + template skin
 *   • command palette overlay (⌘K)
 *   • floating jobs dock (collapsible, bottom-right)
 *   • streak chip + confetti + milestone toast
 *   • winning-pattern cards on dashboard
 *   • videos toolbar + bulk select + list/grid view toggle
 *   • channels card grid + new-channel dashed card
 *   • sources 3-tile dropzone + library card grid
 * ========================================================================== */
:root {
  /* v4: neutral graphite dark (ChatGPT/Grok-style) — near-black surfaces,
     hairline borders, one restrained accent; brand gradient only on CTAs */
  --bg: #0e0e11;
  --bg2: #131316;
  --card: #18181c;
  --card2: #202026;
  --line: #2a2a32;
  --line-soft: #222228;
  --text: #ececf1;
  --muted: #9a9aa5;
  --accent: #7c5cff;
  --accent2: #5ea2ff;
  --accent-soft: rgba(124, 92, 255, 0.12);
  --ok: #34d399;
  --warn: #fbbf24;
  --err: #f87171;
  --shadow: 0 1px 2px rgba(0,0,0,.35), 0 10px 34px rgba(0,0,0,.35);
  --shadow-sm: 0 1px 2px rgba(0,0,0,.3), 0 4px 14px rgba(0,0,0,.2);
  --radius: 16px;
  --radius-sm: 10px;
  --nav-h: 62px;

  /* v3 additions */
  --grad-cta:     linear-gradient(135deg, #7c5cff 0%, #5ea2ff 100%);
  --grad-soft:    linear-gradient(135deg, rgba(124, 92, 255, 0.14), rgba(94, 162, 255, 0.10));
  --grad-success: linear-gradient(135deg, #38e07b 0%, #00e5ff 100%);
  --grad-warn:    linear-gradient(135deg, #ffb020 0%, #ff5d5d 100%);
  --glow-cta:     0 8px 30px rgba(124, 92, 255, 0.35);
  --glow-cta-soft: 0 4px 18px rgba(124, 92, 255, 0.22);
  --ring-focus:   0 0 0 3px rgba(0, 229, 255, 0.35);
  --ease-out:     cubic-bezier(.2, .9, .3, 1);
  --ease-spring:  cubic-bezier(.34, 1.56, .64, 1);

  /* layout */
  --sidebar-w: 216px;
  --sidebar-w-collapsed: 72px;
  --topbar-h: 60px;
  --rail-h: 64px;            /* measured/overridden by JS to match the sticky step rail */
  --mobnav-h: 0px;           /* set by JS when the mobile bottom nav is visible */
}
[data-theme="light"] {
  --bg: #f7f7f8;
  --bg2: #ffffff;
  --card: #ffffff;
  --card2: #f2f2f4;
  --line: #e4e4e9;
  --line-soft: #ededf0;
  --text: #18181b;
  --muted: #6f6f7a;
  --accent: #6366f1;
  --accent2: #3b82f6;
  --accent-soft: rgba(99, 102, 241, 0.08);
  --ok: #0fa958;
  --warn: #c98300;
  --err: #e04545;
  --shadow: 0 1px 2px rgba(25,30,60,.05), 0 10px 30px rgba(25,30,60,.09);
  --shadow-sm: 0 1px 2px rgba(25,30,60,.05), 0 4px 12px rgba(25,30,60,.06);
  --grad-soft:    linear-gradient(135deg, rgba(99, 102, 241, 0.10), rgba(2, 132, 199, 0.08));
  --glow-cta:     0 8px 30px rgba(99, 102, 241, 0.25);
  --glow-cta-soft: 0 4px 18px rgba(99, 102, 241, 0.18);
  --ring-focus:   0 0 0 3px rgba(2, 132, 199, 0.30);
}
* { box-sizing: border-box; margin: 0; padding: 0; }
html { color-scheme: dark; scroll-behavior: smooth; overflow-x: clip;
  -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
html.overlay-lock { overflow: hidden; overscroll-behavior: none;
  scrollbar-gutter: stable; }
body.overlay-lock { overflow: hidden; overscroll-behavior: none; }
[data-theme="light"] { color-scheme: light; }
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; }
}
body {
  background: radial-gradient(circle at 50% 0%, #0d1222 0%, var(--bg) 100%);
  color: var(--text);
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  font-size: 14px; line-height: 1.5;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}
[data-theme="light"] body {
  background: radial-gradient(circle at 50% 0%, #f1f5f9 0%, var(--bg) 100%);
}
h1, h2, h3, h4, h5, h6, .logo {
  font-family: inherit;
  font-weight: 700;
  letter-spacing: -0.02em;
}
a { color: var(--accent2); }

:focus-visible {
  outline: 2px solid var(--accent2);
  outline-offset: 2px;
  border-radius: 6px;
}
button, select, input, textarea, a { touch-action: manipulation; }

/* =============================================================================
 * ICON SYSTEM — inline SVG, 24×24, currentColor, 1.5px stroke
 * usage: <span class="ic"><svg viewBox="0 0 24 24">…</svg></span>
 * ========================================================================== */
.ic { display: inline-flex; width: 20px; height: 20px; flex-shrink: 0; vertical-align: -3px; }
.ic svg { width: 100%; height: 100%; stroke: currentColor; fill: none; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }
.ic.lg { width: 24px; height: 24px; }
.ic.xl { width: 32px; height: 32px; }
.ic.xxl { width: 44px; height: 44px; }

/* =============================================================================
 * TOP BAR (sticky, blur)
 * ========================================================================== */
.topbar-sticky {
  position: sticky; top: 0; z-index: 30;
  height: var(--topbar-h);
  background: color-mix(in srgb, var(--bg) 78%, transparent);
  backdrop-filter: blur(14px) saturate(180%);
  -webkit-backdrop-filter: blur(14px) saturate(180%);
  border-bottom: 1px solid var(--line);
  display: flex; align-items: center; gap: 14px; padding: 0 22px;
}
.topbar-sticky .logo {
  font-size: 18px; font-weight: 800; letter-spacing: -.01em; white-space: nowrap;
  display: flex; align-items: center; gap: 8px;
}
.topbar-sticky .logo span {
  background: var(--grad-cta);
  -webkit-background-clip: text; background-clip: text; color: transparent;
}
.topbar-sticky .logo .bolt { color: var(--warn); }
.cmdk-trigger {
  flex: 1; max-width: 460px; min-width: 0;
  display: flex; align-items: center; gap: 10px;
  background: var(--card2); border: 1px solid var(--line);
  border-radius: 10px; padding: 8px 12px; cursor: pointer;
  color: var(--muted); font-size: 13px; font-weight: 500;
  transition: border-color .18s var(--ease-out), color .18s var(--ease-out), box-shadow .18s var(--ease-out), transform .18s var(--ease-out);
}
.cmdk-trigger:hover {
  border-color: var(--accent);
  color: var(--text);
  box-shadow: 0 0 16px rgba(124,92,255,.15);
  transform: translateY(-0.5px);
}
.cmdk-trigger .kbd {
  margin-left: auto; display: inline-flex; align-items: center; gap: 3px;
  font-size: 10.5px; font-weight: 700; color: var(--muted);
  background: var(--bg); border: 1px solid var(--line); border-radius: 5px;
  padding: 2px 6px;
}
.topbar-right { margin-left: auto; display: flex; align-items: center; gap: 8px; }
.streak-chip {
  display: inline-flex; align-items: center; gap: 6px;
  background: linear-gradient(135deg, rgba(255,176,32,.18), rgba(255,93,93,.12));
  border: 1px solid color-mix(in srgb, var(--warn) 40%, var(--line));
  color: var(--warn); font-weight: 800; font-size: 12px;
  border-radius: 20px; padding: 5px 12px;
  animation: streakpop .4s var(--ease-spring);
}
@keyframes streakpop { from { transform: scale(.7); opacity: 0; } }
.avatar-btn {
  width: 36px; height: 36px; border-radius: 50%;
  background: var(--grad-cta); color: #fff; border: 0; cursor: pointer;
  display: inline-flex; align-items: center; justify-content: center;
  font-weight: 800; font-size: 13px; letter-spacing: .02em;
  box-shadow: var(--glow-cta-soft);
  transition: transform .22s var(--ease-spring), filter .15s;
}
.avatar-btn:hover { filter: brightness(1.08); transform: scale(1.06); }
.avatar-btn:active { transform: scale(0.95); }
.avatar-menu {
  position: absolute; right: 22px; top: calc(var(--topbar-h) + 6px);
  min-width: 240px;
  background: color-mix(in srgb, var(--card) 85%, transparent);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid color-mix(in srgb, var(--accent) 20%, var(--line));
  border-radius: 14px; box-shadow: var(--shadow);
  padding: 8px; z-index: 40; display: none; animation: fadein .15s var(--ease-out);
}
.avatar-menu.open { display: block; }
.avatar-menu .am-head { padding: 10px 12px 12px; border-bottom: 1px solid var(--line); margin-bottom: 6px; }
.avatar-menu .am-head b { display: block; font-size: 13.5px; }
.avatar-menu .am-head span { color: var(--muted); font-size: 11.5px; }
.avatar-menu .am-pill {
  display: flex; align-items: center; gap: 8px;
  padding: 9px 12px; border-radius: 9px; cursor: pointer; font-size: 13px;
  color: var(--text); font-weight: 600; width: 100%;
  border: 0; background: transparent; text-align: left; font-family: inherit;
}
.avatar-menu .am-pill:hover { background: var(--card2); }
.avatar-menu .am-pill .ic { color: var(--muted); }
.avatar-menu .am-sep { height: 1px; background: var(--line); margin: 6px 4px; }

/* =============================================================================
 * APP SHELL — sidebar (left, collapsible) + content
 * ========================================================================== */
.shell { display: flex; min-height: 100vh; padding-top: 0; }
.sidebar {
  width: var(--sidebar-w); flex-shrink: 0;
  background: var(--bg2);
  border-right: 1px solid var(--line);
  padding: 14px 10px; position: sticky; top: var(--topbar-h);
  height: calc(100vh - var(--topbar-h));
  overflow-y: auto;
  display: flex; flex-direction: column; gap: 4px;
  transition: width .2s var(--ease-out);
}
.sidebar .nav-group { display: flex; flex-direction: column; gap: 2px; }
.sidebar .nav-label {
  font-size: 10px; color: var(--muted); font-weight: 800;
  text-transform: uppercase; letter-spacing: .08em;
  padding: 14px 12px 6px;
}
.sidebar #nav button {
  display: flex; align-items: center; gap: 11px; width: 100%;
  background: none; border: 0; color: var(--muted); font-size: 13.5px;
  font-weight: 600; padding: 10px 12px; border-radius: var(--radius-sm);
  cursor: pointer; text-align: left;
  transition: color .18s var(--ease-out), background .18s var(--ease-out), transform .18s var(--ease-out);
  position: relative; min-height: 40px;
}
.sidebar #nav button .ic { color: var(--muted); transition: color .18s var(--ease-out), transform .18s var(--ease-out); }
.sidebar #nav button:hover { color: var(--text); background: var(--card2); transform: translateX(3px); }
.sidebar #nav button:hover .ic { color: var(--text); transform: scale(1.06); }
.sidebar #nav button.active { color: var(--text); background: var(--accent-soft); }
.sidebar #nav button.active .ic { color: var(--accent2); }
.sidebar #nav button.active::before {
  content: ""; position: absolute; left: -10px; top: 22%; bottom: 22%; width: 3px;
  border-radius: 3px; background: var(--grad-cta);
}
@media (max-width: 900px) {
  /* collapsed sidebar — keep icons clearly visible */
  .sidebar #nav button .ic { width: 22px; height: 22px; }
}
.sidebar #nav button .nav-badge {
  margin-left: auto; background: var(--grad-cta); color: #fff;
  font-size: 9.5px; font-weight: 800; padding: 1px 6px; border-radius: 8px;
  min-width: 18px; text-align: center;
}
/* two-line nav rows — label + what the user gets, so features are
   self-explanatory before the first click */
.sidebar #nav button .nav-txt {
  display: flex; flex-direction: column; gap: 1px; min-width: 0; flex: 1;
}
.sidebar #nav button .nav-txt b { font-size: 13.5px; font-weight: 700; }
.sidebar #nav button .nav-txt span {
  font-size: 10.5px; color: var(--muted); font-weight: 500; line-height: 1.3;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.sidebar #nav button.active .nav-txt span,
.sidebar #nav button:hover .nav-txt span { color: var(--text); opacity: .75; }
.sidebar #nav button .nav-badge { flex-shrink: 0; }
.sidebar .side-foot { display: flex; flex-direction: column; gap: 4px; padding-top: 12px; border-top: 1px solid var(--line); }
.sidebar .side-foot .am-pill { color: var(--muted); font-size: 12.5px; }
.sidebar .side-foot .am-pill:hover { color: var(--text); }
.sidebar .side-foot .am-pill .ic { color: var(--muted); }
/* persistent cost + daily-quota glance pinned to the bottom of the sidebar */
.sidebar .side-quota {
  margin-top: auto; padding: 12px;
  border: 1px solid color-mix(in srgb, var(--accent) 15%, var(--line));
  border-radius: 12px;
  background: linear-gradient(180deg, var(--card) 0%, var(--card2) 100%);
  display: flex; flex-direction: column; gap: 10px;
  box-shadow: var(--shadow-sm);
  transition: border-color .2s var(--ease-out);
}
.sidebar .side-quota:hover {
  border-color: color-mix(in srgb, var(--accent) 35%, var(--line));
}
.sidebar .side-quota .sq-title {
  font-size: 10px; font-weight: 800; letter-spacing: .08em; text-transform: uppercase;
  color: var(--muted);
}
.sidebar .side-quota .sq-cost {
  font-size: 12.5px; line-height: 1.5; color: var(--text); font-weight: 600;
}
.sidebar .side-quota .sq-cost b { color: var(--accent2); font-weight: 800; }
/* base .quota-bar carries min-width: 200px — the sidebar inner lane is
   196px wide (216px sidebar - padding), so the bar + day counters bled past
   the card edge. Sidebar copy must fit the lane. */
.sidebar .side-quota .quota-bar { padding: 0; min-width: 0; }
.theme-toggle {
  display: flex; align-items: center; gap: 8px; width: 100%;
  background: var(--card2); border: 1px solid var(--line);
  border-radius: var(--radius-sm); padding: 9px 12px; cursor: pointer;
  color: var(--muted); font-size: 12.5px; font-weight: 700; min-height: 38px;
  text-align: left;
  transition: color .18s var(--ease-out), border-color .18s var(--ease-out), background-color .18s var(--ease-out), transform .18s var(--ease-out);
}
.theme-toggle:hover { color: var(--text); border-color: var(--accent); background: var(--card); transform: translateY(-1px); }
.theme-toggle:active { transform: translateY(0) scale(0.98); }

.content {
  /* fully fluid: NO width cap — every viewport pixel outside the sidebar is
     usable (the old hard caps were the dead-band root cause). Hydration comes
     from the fluid gutter padding. Grids/galleries auto-fill, so density
     scales itself. Narrow paddings below 1180px are overridden by the mobile
     blocks at the bottom of this file. */
  flex: 1; min-width: 0; padding: 22px clamp(16px, 2.2vw, 44px) 120px;
  margin: 0; width: 100%;
  overflow-x: clip;
}
.view-head { display: flex; justify-content: space-between; align-items: flex-end; margin-bottom: 26px; gap: 16px; flex-wrap: wrap; }
.view-head > div:first-child { min-width: 0; flex: 1 1 220px; }
.view-head h1 {
  font-size: 28px; letter-spacing: -.02em; font-weight: 800; line-height: 1.2;
  overflow-wrap: anywhere; word-break: break-word;
}
.view-head .sub {
  color: var(--muted); font-size: 13.5px; margin-top: 6px; line-height: 1.5;
  max-width: 70ch; overflow-wrap: anywhere; word-break: break-word;
}
.view-head .actions { display: flex; gap: 10px; flex-wrap: wrap; flex-shrink: 0; }
.view { display: none; }
.view.active { display: block; animation: fadein .16s var(--ease-out); }
/* A transform on .view makes its fixed wizard footer temporarily position
   against the long form instead of the viewport, then snap into place. */
@keyframes fadein { from { opacity: .94; } to { opacity: 1; } }

/* =============================================================================
 * COMPONENTS — cards, buttons, inputs
 * ========================================================================== */
.card {
  background: var(--card); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 22px; box-shadow: var(--shadow-sm);
  transition: border-color .22s var(--ease-out), transform .22s var(--ease-out), box-shadow .22s var(--ease-out);
}
.card:hover {
  border-color: color-mix(in srgb, var(--accent) 45%, var(--line));
  transform: translateY(-2px);
  box-shadow: 0 12px 30px rgba(0,0,0,.4), 0 4px 12px rgba(124,92,255,.05);
}
.card + .card { margin-top: 16px; }
.card.hero { padding: 28px 28px 24px; }
.card.elev { box-shadow: var(--shadow); }
.card.flat { box-shadow: none; background: var(--bg2); }

h2 { font-size: 16px; margin-bottom: 16px; display: flex; align-items: center; gap: 10px; letter-spacing: -.01em; font-weight: 700; }
h2 .ic { color: var(--accent2); }
h3 { font-size: 15px; font-weight: 700; letter-spacing: -.005em; }
h4 { font-size: 13px; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: .08em; }

.step-num {
  display: inline-flex; align-items: center; justify-content: center;
  width: 26px; height: 26px; border-radius: 8px; font-size: 13px; flex-shrink: 0;
  background: var(--grad-cta); color: #fff; font-weight: 800;
}

/* Create step header — title/desc left, actions right; never overlap */
.step-head {
  display: flex; align-items: flex-start; justify-content: space-between;
  gap: 14px 18px; flex-wrap: wrap; margin-bottom: 14px;
}
.step-head-text { min-width: 0; flex: 1 1 240px; }
.step-head-text h2 {
  margin: 0 0 6px; display: flex; align-items: center; gap: 10px;
  flex-wrap: wrap; line-height: 1.3; overflow-wrap: anywhere;
}
.step-head-text .step-desc,
.step-head .step-desc {
  margin: 0; max-width: min(90ch, 100%); line-height: 1.55;
  overflow-wrap: anywhere; word-break: break-word;
  /* 62ch was ~390px at the desc's small size — help text wrapped to 2-3
     lines while the panel offered 800px+; 90ch lets it breathe to the
     column's true width on every device */
}
.step-head-actions {
  display: flex; flex-wrap: wrap; gap: 8px; align-items: center;
  flex: 0 1 auto; justify-content: flex-end; max-width: 100%;
}
.step-head-actions .mini,
.step-head-actions select.mini {
  flex: 0 1 auto; min-width: 0; max-width: 200px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
select.mini {
  min-height: 34px; padding: 6px 28px 6px 10px; width: auto;
  max-width: 200px;
}

.mini {
  background: var(--card2); color: var(--muted);
  border: 1px solid var(--line); border-radius: 9px; padding: 7px 13px;
  cursor: pointer; font-size: 12px; font-weight: 700; transition: .12s var(--ease-out);
  display: inline-flex; align-items: center; gap: 6px; min-height: 34px;
  white-space: nowrap;
}
.mini:hover { color: var(--text); border-color: var(--accent); }
.mini.active { color: var(--text); border-color: var(--accent); background: var(--accent-soft); }
.mini:disabled { opacity: .55; cursor: not-allowed; }

.pill {
  font-size: 11.5px; padding: 4px 11px; border-radius: 20px;
  border: 1px solid var(--line); color: var(--muted); background: var(--card);
  display: inline-flex; align-items: center; gap: 5px; font-weight: 600;
}
.pill.on { border-color: color-mix(in srgb, var(--ok) 50%, var(--line)); color: var(--ok); }
.pill.accent { border-color: var(--accent); color: var(--accent); background: var(--accent-soft); }
.pill.warn { border-color: color-mix(in srgb, var(--warn) 50%, var(--line)); color: var(--warn); }
.pill.err { border-color: color-mix(in srgb, var(--err) 50%, var(--line)); color: var(--err); }
.providers { display: flex; gap: 6px; flex-wrap: wrap; }

/* premium buttons */
.btn {
  border: 0; border-radius: 12px; padding: 11px 20px; font-weight: 800;
  font-size: 13.5px; cursor: pointer;
  transition: filter .15s, transform .22s var(--ease-out), box-shadow .22s var(--ease-out);
  background: var(--grad-cta); color: #fff;
  box-shadow: var(--glow-cta-soft);
  display: inline-flex; align-items: center; gap: 8px; min-height: 40px;
  text-decoration: none;
}
.btn:hover {
  filter: brightness(1.08);
  box-shadow: var(--glow-cta);
  transform: translateY(-1.5px);
}
.btn:active { transform: translateY(1px) scale(0.98); }
.btn:disabled { opacity: .55; cursor: wait; transform: none; box-shadow: none; }
.btn.ghost { background: var(--card2); color: var(--text); border: 1px solid var(--line); box-shadow: none; }
.btn.ghost:hover { border-color: var(--accent); background: var(--card); }
.btn.lg { padding: 14px 24px; font-size: 14.5px; border-radius: 14px; min-height: 48px; }
.btn.xl { padding: 16px 28px; font-size: 16px; border-radius: 16px; min-height: 56px; }

label { display: flex; flex-direction: column; gap: 7px; font-size: 12.5px; color: var(--muted); font-weight: 600; }
label b { color: var(--accent2); }
select, input[type=text], input[type=password], input[type=number], input[type=email], textarea {
  background: var(--card2); border: 1px solid var(--line); color: var(--text);
  border-radius: 9px; padding: 9px 11px; font-size: 13px; font-family: inherit;
  min-height: 38px; width: 100%; max-width: 100%;
}
select {
  padding-right: 30px; text-overflow: ellipsis;
  /* closed-select rendering: single line with ellipsis, never a wrapped
     two-line chip — the UA wraps text when white-space isn't pinned */
  white-space: nowrap; overflow: hidden;
  appearance: none; -webkit-appearance: none; -moz-appearance: none;
  cursor: pointer;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%23888' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'><path d='m6 9 6 6 6-6'/></svg>");
  background-repeat: no-repeat;
  background-position: right 10px center;
  background-size: 12px;
}
select:hover { background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%237c5cff' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'><path d='m6 9 6 6 6-6'/></svg>"); }
textarea { min-height: 64px; resize: vertical; line-height: 1.5; }
select:hover, input:hover, textarea:hover { border-color: color-mix(in srgb, var(--accent) 40%, var(--line)); }
select:focus, input:focus, textarea:focus {
  outline: none; box-shadow: var(--ring-focus); border-color: var(--accent);
}
input[type=range] { accent-color: var(--accent); min-height: 24px; cursor: pointer; }
.hint { font-weight: 400; font-size: 11.5px; color: var(--muted); }
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 220px), 1fr)); gap: 16px; align-items: start; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 15px; }
.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }

/* =============================================================================
 * STATS — KPI tiles
 * ========================================================================== */
.stat-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 12px; margin-bottom: 18px; }
.stat {
  background: var(--card); border: 1px solid var(--line); border-radius: 16px;
  padding: 18px 20px; box-shadow: var(--shadow-sm); min-height: 132px;
  position: relative; overflow: hidden;
  transition: transform .2s var(--ease-out), box-shadow .2s var(--ease-out);
}
.stat:hover { transform: translateY(-2px); box-shadow: var(--shadow); }
.stat::after {
  content: ""; position: absolute; inset: auto 0 0 0; height: 2px;
  background: var(--grad-cta); opacity: .55;
}
.stat .stat-icon {
  width: 38px; height: 38px; border-radius: 11px;
  background: var(--grad-soft); color: var(--accent2);
  display: inline-flex; align-items: center; justify-content: center;
  margin-bottom: 10px;
}
.stat b { font-size: 26px; display: block; letter-spacing: -.025em; font-weight: 800; line-height: 1.1; }
.stat span { color: var(--muted); font-size: 11.5px; font-weight: 600; }
.stat .trend { font-size: 11px; font-weight: 700; margin-top: 6px; display: inline-flex; align-items: center; gap: 3px; }
.stat .trend.up { color: var(--ok); }
.stat .trend.down { color: var(--err); }
@media (min-width: 541px) { .stat { min-height: 136px; } }
.stat-skeleton { pointer-events: none; }
.stat-skeleton .skeleton { display: block; min-height: 0; }
.stat-skel-icon { width: 38px; height: 38px; margin-bottom: 10px; }
.stat-skel-number { width: 48%; height: 29px; margin-bottom: 3px; }
.stat-skel-label { width: 68%; height: 14px; }

/* hero card on dashboard */
.dash-hero {
  background: var(--grad-soft);
  border: 1px solid var(--line);
  border-radius: 20px; padding: 28px 32px;
  display: grid; grid-template-columns: 1fr auto; gap: 24px; align-items: center;
  margin-bottom: 22px; min-height: 188px;
  position: relative; overflow: hidden;
}
.dash-hero::before {
  content: ""; position: absolute; inset: -50% -20% auto auto;
  width: 360px; height: 360px; border-radius: 50%;
  background: var(--grad-cta); filter: blur(80px); opacity: .12;
  pointer-events: none;
}
.dash-hero h1 { font-size: 26px; font-weight: 800; letter-spacing: -.02em; }
.dash-hero .hero-sub { color: var(--muted); font-size: 13.5px; margin-top: 6px; max-width: 480px; }
.dash-hero .hero-meta { display: flex; gap: 8px; margin-top: 16px; flex-wrap: wrap; }
.dash-hero .hero-meta .pill { max-width: 100%; white-space: normal;
  overflow-wrap: anywhere; line-height: 1.35; }
.dash-hero .hero-meta .hero-meta-skeleton { display:block; width:190px;
  height:28px; min-height:0; border-radius:999px; }
.dash-hero .hero-actions { display: flex; gap: 10px; flex-wrap: wrap; }
#newVideoBtn { min-height: 34px; padding: 6px 11px; font-size: 12px;
  border-color: var(--line); background: var(--card); }

/* daily quota bar (psychology: loss aversion / completion) */
.quota-bar { background: var(--card2); border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; min-width: 200px; }
.quota-bar .qrow { display: flex; justify-content: space-between; font-size: 11.5px; color: var(--muted); font-weight: 700; }
.quota-bar .qtrack { height: 6px; background: var(--line); border-radius: 4px; margin-top: 7px; overflow: hidden; }
.quota-bar .qfill { height: 100%; background: var(--grad-cta); border-radius: 4px; transition: width .4s var(--ease-out); }
.quota-bar .qfill.warn { background: var(--grad-warn); }
.quota-bar .qfill.ok { background: var(--grad-success); }

/* =============================================================================
 * DASHBOARD WINNING PATTERNS
 * ========================================================================== */
.pattern-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 280px), 1fr));
  gap: 14px; min-height: 150px; }
.pattern-card {
  background: var(--card2); border: 1px solid var(--line); border-radius: 14px;
  padding: 16px 18px; cursor: pointer; min-height: 150px;
  transition: all .15s var(--ease-out);
  position: relative; overflow: hidden;
}
.pattern-card:hover { border-color: var(--accent2); transform: translateY(-2px); box-shadow: var(--shadow); }
.pattern-card::before {
  content: "🏆"; position: absolute; right: -8px; top: -8px;
  font-size: 48px; opacity: .08;
}
.pattern-card .pct { font-size: 32px; font-weight: 800; letter-spacing: -.02em; color: var(--ok); }
.pattern-card .plbl { font-size: 11px; color: var(--muted); font-weight: 700; text-transform: uppercase; letter-spacing: .06em; }
.pattern-card .plev { font-size: 12.5px; color: var(--text); margin-top: 8px; line-height: 1.5; }
.pattern-card .papply { font-size: 11.5px; color: var(--accent2); margin-top: 10px; font-weight: 700; }
.pattern-skeleton { pointer-events: none; }
.pattern-skeleton .skeleton { display: block; min-height: 0; }
.pattern-skeleton .ps-label { width: 68%; height: 13px; margin-bottom: 14px; }
.pattern-skeleton .ps-score { width: 36%; height: 36px; margin-bottom: 14px; }
.pattern-skeleton .ps-line { width: 86%; height: 26px; }
#insightsBox { min-height: 130px; }
.insight-skeleton { display: grid; gap: 10px; min-height: 130px; align-content: center; }
.insight-skeleton .skeleton { display: block; min-height: 0; height: 28px; }
.insight-skeleton .skeleton:nth-child(2) { width: 84%; }
.insight-skeleton .skeleton:nth-child(3) { width: 66%; }

/* =============================================================================
 * STEPPER (old horizontal pill row, still used inside Create)
 * ========================================================================== */
.stepper { display: flex; gap: 8px; margin-bottom: 18px; flex-wrap: wrap; }
.stepper .st {
  display: flex; align-items: center; gap: 8px; padding: 8px 14px;
  border-radius: 24px; border: 1px solid var(--line); background: var(--card);
  color: var(--muted); font-size: 12.5px; font-weight: 700; cursor: pointer;
  transition: .12s var(--ease-out);
}
.stepper .st:hover { border-color: var(--accent); color: var(--text); }
.stepper .st em { font-style: normal; width: 20px; height: 20px; border-radius: 50%;
  background: var(--card2); display: inline-flex; align-items: center; justify-content: center; font-size: 11px; }
.stepper .st.done { color: var(--ok); border-color: color-mix(in srgb, var(--ok) 45%, var(--line)); }
.stepper .st.done em { background: var(--ok); color: #fff; }
.stepper .st.current { color: var(--text); border-color: var(--accent); background: var(--accent-soft); }
.stepper .st.current em { background: var(--accent); color: #fff; }

/* =============================================================================
 * CREATE — 3-zone workbench
 * ========================================================================== */
.workbench {
  display: grid; grid-template-columns: minmax(0, 1fr) minmax(260px, 320px);
  gap: 16px; align-items: start; min-width: 0; width: 100%;
}
.wb-form { min-width: 0; max-width: 100%; }
/* Eight real steps stay in one horizontally scrollable row at every width. */
.step-rail {
  display: flex; gap: 5px; align-items: stretch;
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 8px; margin-bottom: 14px; box-shadow: var(--shadow-sm);
  position: sticky; top: calc(var(--topbar-h) + 8px); z-index: 5;
  overflow-x: auto; overflow-y: hidden; overscroll-behavior-x: contain;
  scrollbar-width: thin; scroll-snap-type: x proximity;
}
.step-rail .rail-item {
  display: flex; align-items: center; gap: 10px;
  flex: 1 0 118px; padding: 9px 11px; border-radius: 10px; cursor: pointer;
  background: transparent; border: 1px solid transparent;
  transition: all .15s var(--ease-out);
  position: relative; text-align: left; min-width: 0; scroll-snap-align: center;
  font: inherit; color: inherit;
}
.step-rail .rail-item:hover { background: var(--card2); }
.step-rail .rail-item.active { background: var(--accent-soft); border-color: var(--accent); }
.step-rail .rail-item .rail-num {
  width: 26px; height: 26px; border-radius: 7px; flex-shrink: 0;
  background: var(--card2); color: var(--muted);
  display: inline-flex; align-items: center; justify-content: center;
  font-weight: 800; font-size: 12.5px;
  transition: all .15s var(--ease-out);
}
.step-rail .rail-item.active .rail-num { background: var(--grad-cta); color: #fff; }
.step-rail .rail-item.done .rail-num { background: var(--grad-success); color: #fff; }
.step-rail .rail-item .rail-lbl { min-width: 0; }
.step-rail .rail-item .rail-lbl b { display: block; font-size: 12px; color: var(--text);
  font-weight: 700; white-space: normal; line-height: 1.2; overflow-wrap: normal; }
.step-rail .rail-item .rail-lbl span { display: none; }
.step-rail .rail-item.active .rail-lbl span { color: var(--accent2); }
.step-rail .rail-prog { padding: 8px 14px; min-width: 180px; display: flex; flex-direction: column; justify-content: center; gap: 5px; }
.step-rail .rail-prog .prog-text { font-size: 10.5px; color: var(--muted); font-weight: 700; }
.step-rail .rail-prog .prog-text b { color: var(--ok); }
.step-rail .rail-prog .prog-bar { display: block; height: 4px; background: var(--card2); border-radius: 4px; overflow: hidden; }
.step-rail .rail-prog .prog-bar i { display: block; height: 100%; background: var(--grad-success); transition: width .3s var(--ease-out); }

.wb-form { display: flex; flex-direction: column; gap: 12px; }
.wb-form .form-section {
  background: var(--card); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 18px 20px;
  box-shadow: var(--shadow-sm);
  scroll-margin-top: calc(var(--topbar-h) + var(--rail-h) + 16px);
  display: none;
  min-width: 0; overflow: visible;
}
.wb-form .form-section.active { display: block; animation: fadein .22s var(--ease-out); }
.wb-form .form-section h2 {
  margin-bottom: 4px; font-size: 15px;
  overflow-wrap: anywhere; word-break: break-word; line-height: 1.35;
}
.wb-form .form-section .step-desc {
  margin-bottom: 0; font-size: 12.5px; line-height: 1.55;
  overflow-wrap: anywhere; word-break: break-word; color: var(--muted);
}
/* legacy step-desc when not inside step-head */
.wb-form .form-section > .step-desc { margin-bottom: 14px; }
.wb-form .form-section .opt-help {
  font-size: 11.5px; line-height: 1.45;
  overflow-wrap: anywhere; word-break: break-word;
}
/* form fields: never spill out of grid cells */
.wb-form .grid > label,
.wb-form .grid2 > label {
  min-width: 0; max-width: 100%;
}
.wb-form .grid select,
.wb-form .grid input[type=text],
.wb-form .grid input[type=number],
.wb-form .grid2 select {
  min-width: 0; max-width: 100%;
}

/* live preview pane */
.wb-preview {
  position: sticky; top: calc(var(--topbar-h) + 20px);
  display: flex; flex-direction: column; gap: 14px;
}
.phone-card {
  background: var(--card); border: 1px solid var(--line);
  border-radius: 16px; padding: 16px; box-shadow: var(--shadow-sm);
  display: flex; flex-direction: column; gap: 14px; align-items: stretch;
}
.phone-frame {
  width: 100%; max-width: 240px; margin: 0 auto;
  background: #000; border-radius: 28px; padding: 10px;
  border: 2px solid var(--line);
  box-shadow: var(--shadow);
  aspect-ratio: 9/19;
  position: relative; overflow: hidden;
}
.phone-frame .phone-screen {
  width: 100%; height: 100%; border-radius: 20px;
  display: flex; flex-direction: column; justify-content: flex-end;
  padding: 22px 18px 36px; color: #fff; text-align: center;
  position: relative; overflow: hidden;
  transition: background .3s var(--ease-out);
}
.phone-frame .phone-screen .pf-title { font-size: 18px; font-weight: 800; line-height: 1.2; letter-spacing: -.01em; }
.phone-frame .phone-screen .pf-sub { font-size: 11px; opacity: .85; margin-top: 6px; }
.phone-frame .phone-screen .pf-chip {
  display: inline-block; font-size: 9px; font-weight: 700; letter-spacing: .04em;
  padding: 2px 8px; border-radius: 8px; background: rgba(0,0,0,.45); margin-top: 8px;
}
.phone-frame .phone-screen .pf-corner {
  position: absolute; top: 12px; right: 12px; font-size: 10px; font-weight: 800;
  background: rgba(255,255,255,.18); backdrop-filter: blur(8px);
  padding: 3px 8px; border-radius: 6px;
}
.phone-frame .phone-screen .pf-niche {
  position: absolute; top: 14px; left: 14px; font-size: 18px;
}
.phone-frame .phone-screen .pf-progress {
  position: absolute; bottom: 12px; left: 12px; right: 12px;
  height: 3px; background: rgba(255,255,255,.2); border-radius: 2px; overflow: hidden;
}
.phone-frame .phone-screen .pf-progress i {
  display: block; height: 100%; background: var(--grad-cta); border-radius: 2px;
  width: 0%; transition: width .5s var(--ease-out);
}
/* live caption demo — mirrors the chosen caption style so users SEE the
   karaoke look they'll get, not a static placeholder */
.phone-frame .phone-screen .pf-cap {
  align-self: center; margin-bottom: 12px; max-width: 92%;
  font-weight: 900; font-size: 12.5px; letter-spacing: .02em;
  padding: 4px 10px; border-radius: 8px; color: #fff;
  animation: pfCapPop 1.4s var(--ease-out) infinite;
}
@keyframes pfCapPop {
  0% { transform: scale(.86); opacity: 0; }
  14% { transform: scale(1.05); opacity: 1; }
  24% { transform: scale(1); }
  86% { opacity: 1; }
  100% { opacity: 0; }
}
.pf-cap-hype  { color: #f2c94c; text-shadow: 0 2px 10px rgba(0,0,0,.65); }
.pf-cap-clean { background: rgba(255,255,255,.94); color: #15181d; }
.pf-cap-impact { text-transform: uppercase; color: #fff;
  -webkit-text-stroke: 1px rgba(0,0,0,.5); paint-order: stroke fill;
  text-shadow: 0 2px 8px rgba(0,0,0,.55); }
.pf-cap-money { color: #7cf29c; text-shadow: 0 2px 10px rgba(0,0,0,.65); }
.pf-cap-fire  { color: #ff9a3d; text-shadow: 0 0 14px rgba(255,90,0,.55), 0 2px 8px rgba(0,0,0,.6); }
.pf-skin-light .pf-cap-hype, .pf-skin-light .pf-cap-money, .pf-skin-light .pf-cap-fire,
.pf-skin-board .pf-cap-hype, .pf-skin-board .pf-cap-money, .pf-skin-board .pf-cap-fire {
  text-shadow: 0 2px 6px rgba(0,0,0,.28);
}
/* voice/music level bars — visible only while music is on */
.phone-frame .phone-screen .pf-eq {
  display: flex; gap: 3px; justify-content: center; align-items: flex-end;
  height: 14px; margin-top: 8px;
}
.phone-frame .phone-screen .pf-eq i {
  width: 3px; border-radius: 2px; background: rgba(255,255,255,.85);
  animation: pfEq 1.1s ease-in-out infinite;
  height: 30%;
}
.phone-frame .phone-screen .pf-eq i:nth-child(2) { animation-delay: .15s; }
.phone-frame .phone-screen .pf-eq i:nth-child(3) { animation-delay: .3s; }
.phone-frame .phone-screen .pf-eq i:nth-child(4) { animation-delay: .45s; }
.phone-frame .phone-screen .pf-eq i:nth-child(5) { animation-delay: .6s; }
@keyframes pfEq { 0%,100% { height: 22%; } 50% { height: 100%; } }
.pf-skin-light .pf-eq i, .pf-skin-board .pf-eq i { background: rgba(0,0,0,.55); }
.preview-card {
  background: var(--card2); border: 1px solid var(--line);
  border-radius: 12px; padding: 14px 16px;
}
.preview-card h4 { margin-bottom: 8px; font-size: 11px; font-weight: 800; color: var(--muted); text-transform: uppercase; letter-spacing: .5px; }
.preview-row { display: flex; justify-content: space-between; font-size: 12.5px; padding: 4px 0; }
.preview-row span:first-child { color: var(--muted); font-weight: 600; }
.preview-row span:last-child { color: var(--text); font-weight: 700; }

.preview-cta { display: flex; flex-direction: column; gap: 8px; }
.preview-cta .btn.full { width: 100%; justify-content: center; }

/* cost + daily quota + preview-script button stacked under the phone emulator */
.pv-meta {
  display: flex; flex-direction: column; gap: 12px;
  background: var(--card); border: 1px solid var(--line);
  border-radius: 14px; padding: 14px; box-shadow: var(--shadow-sm);
}
.pv-meta .gen-cost { font-size: 13px; color: var(--muted); font-weight: 600; line-height: 1.45; }
.pv-meta .gen-cost b { color: var(--accent2); font-weight: 800; }
.pv-meta .btn.full { width: 100%; justify-content: center; }

/* Generate & download section (step 5, lives at bottom of form column) */
.gen-bar { border: 1px solid color-mix(in srgb, var(--accent) 30%, var(--line));
  background: linear-gradient(180deg, var(--card), color-mix(in srgb, var(--accent-soft) 40%, var(--card))); }
.gen-chips { display: flex; flex-wrap: wrap; gap: 6px; margin: 4px 0 14px; min-height: 24px; }
.gen-chips .chip {
  font-size: 12px; color: var(--text); font-weight: 700;
  border: 1px solid var(--line); background: var(--card2);
  border-radius: 12px; padding: 5px 11px;
  display: inline-flex; align-items: center; gap: 5px;
}
.gen-chips:empty::before { content: "Pick a niche to build your summary"; color: var(--muted); font-size: 12.5px; font-weight: 500; }
.gen-foot { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; }
.gen-cost { flex: 1; min-width: 180px; font-size: 13px; color: var(--muted); font-weight: 600; }
.gen-cost b { color: var(--accent2); }
.gen-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.gen-actions .btn { justify-content: center; }

/* wizard footer (Back / Next) — fixed to the bottom of the content column,
 * always reachable like the sidebar's theme-toggle row. Becomes "Generate"
 * on the last step. (Lives inside #view-create, so display:none on the
 * section hides the fixed bar too — only the Create view shows it.) */
.wb-nav {
  position: fixed; left: var(--sidebar-w); right: 0; bottom: 0; z-index: 30;
  display: grid; grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center; gap: 12px;
  margin: 0; padding: 12px 28px;
  background: color-mix(in srgb, var(--bg) 92%, transparent);
  backdrop-filter: saturate(1.5) blur(14px);
  -webkit-backdrop-filter: saturate(1.5) blur(14px);
  border-top: 1px solid var(--line);
  box-shadow: 0 -10px 30px rgba(0,0,0,.14);
}
.wb-nav .wb-nav-label {
  min-width: 0; text-align: center;
  font-size: 12.5px; font-weight: 700; color: var(--muted); letter-spacing: .01em;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.wb-nav .btn { min-width: 0; justify-content: center; white-space: nowrap; }
.wb-nav .btn.ghost .ic { order: -1; }
/* keep the workbench's last step clear of the fixed bar */
#view-create { padding-bottom: calc(76px + env(safe-area-inset-bottom)); }

/* realtime settings recap in the preview pane */
.pv-settings { display: flex; flex-direction: column; gap: 9px; }
.pv-row { display: flex; flex-direction: column; gap: 2px;
  padding: 7px 0; border-bottom: 1px solid var(--line-soft); }
.pv-row:last-child { border-bottom: 0; }
.pv-row b { font-size: 12.5px; font-weight: 700; color: var(--text);
  display: flex; align-items: baseline; gap: 6px; }
/* premium spec-sheet: fixed uppercase label column; the explanation is
   indented to the value's left edge — reads like a bill of settings */
.pv-row b .pv-k { flex: 0 0 104px; color: var(--muted); font-weight: 700;
  font-size: 10px; text-transform: uppercase; letter-spacing: .09em;
  padding-top: 1px; }
.pv-row > span { margin-left: 110px; }
.pv-row span { font-size: 11.5px; color: var(--muted); line-height: 1.45; }
.pv-row span b { color: var(--accent2); font-weight: 700; display: inline; font-size: 11.5px; }
.pv-row b b { color: var(--accent2); font-weight: 800; }

/* summary chips above the phone (form column) */
.preview-chips { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.preview-chips .chip {
  font-size: 11.5px; color: var(--text); font-weight: 700;
  border: 1px solid var(--line); background: var(--card);
  border-radius: 12px; padding: 4px 10px;
  white-space: nowrap; max-width: 220px; overflow: hidden; text-overflow: ellipsis;
  display: inline-flex; align-items: center; gap: 4px;
}
.preview-cost { font-size: 12.5px; color: var(--muted); font-weight: 600; }
.preview-cost b { color: var(--accent2); }
.preview-actions { display: flex; gap: 8px; flex-wrap: wrap; }

/* sticky generate CTA */
.sticky-cta {
  position: sticky; bottom: 16px; z-index: 12;
  display: flex; align-items: center; gap: 12px; flex-wrap: wrap;
  background: color-mix(in srgb, var(--card) 94%, transparent);
  backdrop-filter: blur(14px) saturate(180%);
  -webkit-backdrop-filter: blur(14px) saturate(180%);
  border: 1px solid var(--line); border-radius: 16px;
  padding: 12px 16px; box-shadow: var(--shadow);
  margin-top: 8px;
}
.sticky-cta .summary-chips { display: flex; gap: 6px; flex-wrap: wrap; flex: 1; min-width: 0; align-items: center; }
.sticky-cta .summary-chips .chip {
  font-size: 11.5px; color: var(--text); font-weight: 700;
  border: 1px solid var(--line); background: var(--card2);
  border-radius: 14px; padding: 4px 11px;
  white-space: nowrap; max-width: 200px; overflow: hidden; text-overflow: ellipsis;
  display: inline-flex; align-items: center; gap: 4px;
}
.sticky-cta .cost-inline { font-size: 12.5px; color: var(--muted); font-weight: 600; white-space: nowrap; }
.sticky-cta .cost-inline b { color: var(--accent2); }

/* =============================================================================
 * TABS — Fine-tune (replaces 4 accordions)
 * ========================================================================== */
.ft-tabs {
  display: none;  /* rail-driven since the 3 core rooms became wizard steps */
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 8px; margin-bottom: 18px;
  padding: 6px; background: var(--card2); border: 1px solid var(--line);
  border-radius: 14px; min-width: 0; max-width: 100%;
}
/* step 7 (Brand & finish) is the only slot that still owns inner tabs —
   captions + brand live there; the 3 core rooms were promoted to the rail */
.ft-tabs.solo {
  display: grid; grid-template-columns: repeat(2, minmax(0, 1fr));
  max-width: 620px;
}
@media (max-width: 1220px) {
  .ft-tabs { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
.ft-tab {
  display: flex; align-items: center; gap: 10px;
  background: transparent; border: 1px solid transparent;
  color: var(--muted);
  padding: 10px 12px; cursor: pointer;
  border-radius: 10px;
  /* nowrap used to overflow the 168px grid column at higher zoom —
     titles wrap like every other text now */
  white-space: normal; text-align: left;
  min-width: 0; overflow: hidden;
  transition: .14s var(--ease-out);
}
.ft-tab .ft-ico {
  font-size: 17px; width: 34px; height: 34px; flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
  background: var(--card); border: 1px solid var(--line); border-radius: 9px;
  transition: .14s var(--ease-out);
}
.ft-tab .ft-txt { display: flex; flex-direction: column; gap: 1px; min-width: 0; }
.ft-tab .ft-txt b { font-size: 12.5px; font-weight: 800; }
.ft-tab .ft-txt span {
  font-size: 10px; color: var(--muted); font-weight: 600; line-height: 1.35;
  white-space: normal;
}
.ft-tab:hover { color: var(--text); background: var(--card); transform: translateY(-1px); }
.ft-tab.active {
  color: var(--text); background: var(--card);
  border-color: color-mix(in srgb, var(--accent) 45%, var(--line));
  box-shadow: var(--shadow-sm);
}
.ft-tab.active .ft-ico {
  background: var(--grad-cta); border-color: transparent;
  box-shadow: 0 4px 14px color-mix(in srgb, var(--accent) 35%, transparent);
}
.ft-tab.active .ft-txt b { color: var(--text); }
.ft-tab.active .ft-txt span { color: var(--muted); }
@media (max-width: 640px) {
  .ft-tabs { grid-template-columns: 1fr 1fr; gap: 6px; }
  .ft-tab .ft-txt b { font-size: 11.5px; }
  .ft-tab .ft-txt span { font-size: 9.5px; }
}
.ft-tab .ft-badge {
  font-size: 9.5px; font-weight: 800;
  background: var(--grad-cta); color: #fff;
  padding: 1px 6px; border-radius: 8px;
  min-width: 16px; text-align: center;
}
.ft-hint {
  margin: -8px 0 16px; font-size: 12px; line-height: 1.55;
  color: var(--muted); max-width: 70ch;
}
.ft-hint:empty { display: none; }
.ft-pane { display: none; }
.ft-pane.active { display: block; animation: fadein .2s var(--ease-out); }

/* --- Fine-tune grouped control rooms (Brand & beyond) --- */
.fgrp {
  background: var(--card); border: 1px solid var(--line);
  border-radius: 16px; padding: 16px 18px; margin-bottom: 14px;
  box-shadow: var(--shadow-sm);
}
.fgrp-head {
  display: flex; align-items: flex-start; gap: 12px;
  margin-bottom: 14px;
}
.fgrp-head .fgrp-ico {
  width: 38px; height: 38px; flex-shrink: 0; font-size: 19px;
  display: flex; align-items: center; justify-content: center;
  background: var(--card2); border: 1px solid var(--line);
  border-radius: 11px;
}
.fgrp-head b { display: block; font-size: 14px; font-weight: 800; margin-bottom: 2px; }
.fgrp-head span { display: block; font-size: 11.5px; color: var(--muted); line-height: 1.5; max-width: 62ch; }

/* Control rows: a grid item cannot shrink below its content's min-content
   width by default — long select options / input placeholders blew past the
   card edge (the "clipped 4th column" bug). Force the row into its lane. */
.fgrp .grid > * { min-width: 0; }
.fgrp .grid label {
  display: flex; flex-direction: column; gap: 5px;
  font-size: 12px; font-weight: 700; color: var(--muted);
}
.fgrp .grid label > .hint { font-size: 11px; font-weight: 500; color: var(--muted); display: block; }
.fgrp .grid select, .fgrp .grid input,
.fgrp .grid select:focus, .fgrp .grid input:focus {
  width: 100%; max-width: 100%; min-width: 0;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.fgrp .grid .opt-help { margin-top: 2px; }
.fgrp-lock {
  display: flex; align-items: center; gap: 12px;
  background: color-mix(in srgb, var(--warn, #f5a623) 12%, var(--card2));
  border: 1px solid color-mix(in srgb, var(--warn, #f5a623) 40%, var(--line));
  border-radius: 12px; padding: 10px 14px; margin-bottom: 14px;
}
.fgrp-lock b { display: block; font-size: 12.5px; }
.fgrp-lock span { display: block; font-size: 11px; color: var(--muted); margin-top: 1px; }
.fgrp-lock .mini { margin-left: auto; white-space: nowrap; }
.wpos-label { font-size: 12px; font-weight: 700; color: var(--muted); margin: 14px 0 8px; }
.wpos-grid {
  display: grid; grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
}
.wpos {
  display: flex; flex-direction: column; align-items: flex-start; gap: 4px;
  padding: 10px 12px; border-radius: 11px;
  background: var(--card2); border: 1px solid var(--line);
  color: var(--text); cursor: pointer; text-align: left;
  transition: .14s var(--ease-out);
}
.wpos i {
  font-style: normal; font-size: 15px; line-height: 1;
}
.wpos span { font-size: 11px; font-weight: 700; line-height: 1.3; }
.wpos em { display: block; font-style: normal; font-weight: 500; font-size: 9.5px; color: var(--muted); margin-top: 1px; }
.wpos:hover { transform: translateY(-1px); border-color: color-mix(in srgb, var(--accent) 35%, var(--line)); }
.wpos.active {
  background: color-mix(in srgb, var(--accent) 14%, var(--card));
  border-color: color-mix(in srgb, var(--accent) 55%, var(--line));
  box-shadow: 0 4px 14px color-mix(in srgb, var(--accent) 18%, transparent);
}
.wpos.active i { color: var(--accent); }
@media (max-width: 860px) { .wpos-grid { grid-template-columns: 1fr 1fr; } }

/* legacy details/acc (admin etc.) — keep working */
details.acc { background: var(--card); border: 1px solid var(--line); border-radius: 14px; margin-bottom: 12px; box-shadow: var(--shadow-sm); }
details.acc > summary { cursor: pointer; padding: 15px 20px; font-weight: 700; font-size: 13.5px; list-style: none; display: flex; align-items: center; gap: 10px; user-select: none; }
details.acc > summary::-webkit-details-marker { display: none; }
details.acc > summary::after { content: "▾"; margin-left: auto; color: var(--muted); transition: transform .15s; }
details.acc[open] > summary::after { transform: rotate(180deg); }
details.acc .acc-body { padding: 4px 20px 20px; }

/* =============================================================================
 * NICHES
 * ========================================================================== */
.niche-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 200px), 1fr));
  gap: 10px; max-height: 480px; overflow-y: auto; padding-right: 4px;
}
.niche {
  background: var(--card2); border: 1px solid var(--line);
  border-radius: 14px; padding: 14px 14px 12px;
  cursor: pointer; transition: all .15s var(--ease-out);
  position: relative; overflow: hidden; min-width: 0;
  display: flex; flex-direction: column; gap: 4px;
  font: inherit; color: var(--text); text-align: left;
}
.niche:hover { border-color: var(--accent); transform: translateY(-1px); box-shadow: var(--shadow-sm); }
.niche.active {
  border-color: var(--accent2); box-shadow: 0 0 0 1px var(--accent2);
  background: var(--accent-soft); padding-right: 38px;
}
.niche.active::after {
  content: "✓"; position: absolute; right: 10px; top: 10px;
  width: 22px; height: 22px; border-radius: 50%;
  background: var(--grad-success); color: #fff;
  display: inline-flex; align-items: center; justify-content: center;
  font-size: 12px; font-weight: 800; z-index: 1;
}
.niche .t {
  font-weight: 700; font-size: 13px; line-height: 1.35;
  overflow-wrap: anywhere; word-break: break-word;
  padding-right: 2px; min-width: 0;
}
.niche .t .n-emoji { flex-shrink: 0; }
.niche .cpm { color: var(--muted); font-size: 11px; font-weight: 600; }
.niche .d {
  color: var(--muted); font-size: 11px; line-height: 1.45;
  display: block; overflow: visible; overflow-wrap: anywhere; word-break: normal;
  min-width: 0;
}

/* =============================================================================
 * TOPICS / TRENDS
 * ========================================================================== */
.topic-row { display: flex; gap: 8px; }
.topic-row input { flex: 1; padding: 12px 14px; border-radius: 10px; font-size: 14px; }
.tabs { display: flex; gap: 8px; margin: 14px 0 10px; flex-wrap: wrap; }
.tab { background: var(--card2); border: 1px solid var(--line); color: var(--muted); padding: 7px 13px; border-radius: 20px; cursor: pointer; font-size: 12px; font-weight: 700; transition: .12s var(--ease-out); }
.tab:hover { color: var(--text); }
.tab.active { color: var(--text); border-color: var(--accent); background: var(--accent-soft); }
.topics { display: flex; flex-direction: column; gap: 6px; max-height: 320px; overflow-y: auto; padding-right: 4px; }
.topic { display: flex; justify-content: space-between; gap: 10px; align-items: center; background: var(--card2); border: 1px solid var(--line); border-radius: 10px; padding: 10px 14px; cursor: pointer; font-size: 13px; transition: .12s var(--ease-out); }
.topic:hover { border-color: var(--accent2); background: var(--card); }
.topic .heat { color: var(--warn); font-size: 11px; white-space: nowrap; font-weight: 700; }
.topic .src { color: var(--muted); font-size: 10px; }

/* =============================================================================
 * EMPTY / SKELETON
 * ========================================================================== */
.empty { color: var(--muted); font-size: 13px; padding: 24px 16px; text-align: center; }
.empty b { color: var(--text); }
.empty .btn, .empty .mini { margin-top: 10px; }
.empty.big { padding: 48px 20px; }
.empty.big .ic { color: var(--muted); opacity: .6; margin-bottom: 12px; }
.skeleton {
  border-radius: 10px; background: var(--card2); position: relative; overflow: hidden;
  min-height: 44px;
}
.skeleton::after {
  content: ""; position: absolute; inset: 0;
  background: linear-gradient(90deg, transparent, color-mix(in srgb, var(--text) 6%, transparent), transparent);
  animation: shimmer 1.4s infinite;
}
@keyframes shimmer { from { transform: translateX(-100%); } to { transform: translateX(100%); } }

/* =============================================================================
 * PRESETS — visual chips with icon + name + description
 * ========================================================================== */
.presets {
  display: grid;
  /* 160px could not fit a preset name, so every title ellipsised and the
     description clamped to two lines — the user could not tell the presets
     apart. Wider tracks + wrapping type below fix that. */
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 215px), 1fr));
  gap: 12px; margin-bottom: 12px;
}
.preset {
  background: var(--card2); border: 1px solid var(--line); color: var(--text);
  padding: 13px 15px; border-radius: 12px; cursor: pointer;
  font-size: 12.5px; font-weight: 700; text-align: left;
  transition: all .15s var(--ease-out);
  display: flex; flex-direction: column; gap: 5px;
  min-height: 92px; min-width: 0; overflow: hidden;
}
.preset:hover { border-color: var(--accent); transform: translateY(-1px); box-shadow: var(--shadow-sm); }
.preset.active { border-color: var(--accent2); background: var(--accent-soft); box-shadow: 0 0 0 1px var(--accent2); }
.preset b {
  /* Wrap to a second line rather than ellipsising the name away. */
  font-size: 13px; line-height: 1.3; white-space: normal;
  overflow-wrap: break-word;
}
.preset small {
  font-size: 11px; color: var(--muted); font-weight: 500; line-height: 1.45;
  display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical;
  overflow: hidden; overflow-wrap: break-word;
}

/* my templates — the user's own saved setups (Style step) */
.mytpl-block {
  margin-top: 18px; padding-top: 14px;
  border-top: 1px dashed color-mix(in srgb, var(--muted) 35%, var(--line));
}
.mytpl-block .mytpl-head { display: flex; flex-direction: column; gap: 3px; margin-bottom: 4px; }
.mytpl-block .mytpl-head b { font-size: 13.5px; }
.mytpls { display: flex; flex-direction: column; gap: 8px; margin: 10px 0 12px; }
.mytpl {
  display: flex; align-items: center; gap: 10px;
  background: var(--card2); border: 1px solid var(--line);
  border-radius: 10px; padding: 9px 12px;
  transition: border-color .15s var(--ease-out), transform .15s var(--ease-out);
}
.mytpl:hover { border-color: var(--accent); transform: translateY(-1px); }
.mytpl-name { font-weight: 800; font-size: 12.5px; white-space: nowrap; }
.mytpl-sub {
  color: var(--muted); font-size: 11px; flex: 1; min-width: 0;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.mytpl .mini { flex-shrink: 0; }
@media (max-width: 560px) {
  .mytpl { flex-wrap: wrap; }
  .mytpl-sub { flex-basis: 100%; }
}

/* =============================================================================
 * JOBS — floating dock + cards
 * ========================================================================== */
.job {
  background: var(--card2); border: 1px solid var(--line); border-radius: 12px;
  padding: 14px; margin-bottom: 10px;
}
.job .head { display: flex; justify-content: space-between; font-size: 13px; margin-bottom: 8px; gap: 8px; flex-wrap: wrap; }
.bar { height: 8px; background: var(--line); border-radius: 6px; overflow: hidden; }
.bar i { display: block; height: 100%; background: var(--grad-cta); transition: width .4s var(--ease-out); }
.job .logs { margin-top: 8px; font-family: ui-monospace, monospace; font-size: 10.5px; color: var(--muted); max-height: 90px; overflow-y: auto; white-space: pre-wrap; }
.job.error .bar i { background: var(--err); }
.job.done .bar i { background: var(--grad-success); }

/* floating jobs dock (anchored to bottom-right of viewport) */
.jobs-dock {
  position: fixed; right: 22px; bottom: 22px; z-index: 36;
  display: flex; flex-direction: column; gap: 8px;
  max-width: 340px; pointer-events: none;
  animation: dockin .3s var(--ease-spring);
}
/* on the Create view the fixed wizard footer owns the bottom — lift the
 * dock above it so the "Rendering" toggle stays visible + clickable */
body.on-create .jobs-dock { bottom: calc(86px + env(safe-area-inset-bottom)); }
@keyframes dockin { from { transform: translateY(20px); opacity: 0; } }
.jobs-dock .dock-toggle {
  pointer-events: auto; align-self: flex-end;
  background: var(--grad-cta); color: #fff;
  border: 0; border-radius: 22px;
  padding: 10px 16px; font-size: 12.5px; font-weight: 800; cursor: pointer;
  display: inline-flex; align-items: center; gap: 8px;
  box-shadow: var(--glow-cta);
}
.jobs-dock .dock-toggle .count {
  background: rgba(255,255,255,.25); color: #fff; font-size: 10.5px;
  padding: 1px 7px; border-radius: 8px; font-weight: 800;
}
.jobs-dock .dock-panel {
  pointer-events: auto;
  background: var(--card); border: 1px solid var(--line);
  border-radius: 14px; box-shadow: var(--shadow);
  padding: 12px; max-height: 360px; overflow-y: auto;
  display: none;
}
.jobs-dock.open .dock-panel { display: block; animation: fadein .15s var(--ease-out); }
.jobs-dock.open .dock-toggle { background: var(--card2); color: var(--text); border: 1px solid var(--line); }
.jobs-dock .mini-job {
  background: var(--card2); border: 1px solid var(--line);
  border-radius: 10px; padding: 10px 12px; margin-bottom: 6px; font-size: 12px;
}
.jobs-dock .mini-job b { display: block; font-size: 12.5px; margin-bottom: 4px; }

/* =============================================================================
 * MOBILE BOTTOM NAV — phones only (≤540px), replaces the icon sidebar
 * ========================================================================== */
.mobnav {
  display: none; position: fixed; left: 0; right: 0; bottom: 0; z-index: 35;
  height: calc(60px + env(safe-area-inset-bottom));
  padding-bottom: env(safe-area-inset-bottom);
  background: color-mix(in srgb, var(--bg2) 92%, transparent);
  backdrop-filter: blur(14px) saturate(180%);
  -webkit-backdrop-filter: blur(14px) saturate(180%);
  border-top: 1px solid var(--line);
  justify-content: space-around; align-items: center;
}
.mobnav button {
  display: flex; flex-direction: column; align-items: center; gap: 3px;
  background: none; border: 0; color: var(--muted); cursor: pointer;
  font-size: 10px; font-weight: 700; padding: 6px 2px;
  flex: 1 1 0; min-width: 0;
}
.mobnav button .ic { width: 22px; height: 22px; }
.mobnav button.active { color: var(--accent2); }
.mobnav button.active .ic { color: var(--accent2); }

/* =============================================================================
 * VIDEOS GALLERY
 * ========================================================================== */
.vid-section { margin-bottom: 26px; }
.vid-section > h2 { margin-bottom: 14px; }
/* My Videos tabs — Library / In progress */
.vid-tabs {
  display: flex; gap: 4px; flex-wrap: wrap; margin-bottom: 18px;
  padding: 4px; background: var(--card2); border: 1px solid var(--line);
  border-radius: 12px;
}
.vid-tabs .vt {
  display: inline-flex; align-items: center; gap: 8px;
  background: transparent; border: 0; cursor: pointer;
  color: var(--muted); font-size: 13px; font-weight: 700;
  padding: 9px 15px; border-radius: 9px;
  transition: .12s var(--ease-out);
}
.vid-tabs .vt:hover { color: var(--text); background: var(--card); }
.vid-tabs .vt.active { color: var(--text); background: var(--card); box-shadow: var(--shadow-sm); }
.vid-tabs .vt .ic { color: inherit; }
.vid-tabs .vt.active .ic { color: var(--accent2); }
.vt-count {
  font-size: 11px; font-weight: 800; color: var(--muted);
  background: var(--card2); border: 1px solid var(--line);
  padding: 1px 8px; border-radius: 20px; min-width: 22px; text-align: center;
}
.vid-tabs .vt.active .vt-count { color: var(--accent2); border-color: color-mix(in srgb, var(--accent) 40%, var(--line)); }
.vid-tabs .vt .vt-count.has-live {
  color: var(--accent2);
  border-color: color-mix(in srgb, var(--accent) 40%, var(--line));
}
.vt-pane { display: none; }
.vt-pane.active { display: block; animation: fadein .2s var(--ease-out); }
#progressEmpty[hidden] { display: none; }
.sec-count {
  margin-left: auto; font-size: 11px; font-weight: 800; color: var(--muted);
  background: var(--card2); border: 1px solid var(--line);
  padding: 2px 10px; border-radius: 20px; min-width: 28px; text-align: center;
}
/* live render-queue cards */
.render-list {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 12px;
}
.render-card {
  background: var(--card); border: 1px solid var(--line);
  border-radius: 14px; padding: 14px; box-shadow: var(--shadow-sm);
  transition: border-color .15s var(--ease-out);
  cursor: pointer;
}
.render-card:hover { border-color: var(--accent); }
.render-card.is-live {
  border-color: color-mix(in srgb, var(--accent) 45%, var(--line));
  box-shadow: var(--glow-cta-soft);
}
.render-card.is-wait { opacity: .96; }
.render-card .rc-head { display: flex; align-items: center; gap: 9px; margin-bottom: 10px; flex-wrap: wrap; }
.render-card .rc-head b { font-size: 13px; font-weight: 700; flex: 1; min-width: 0;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.render-card .rc-pill {
  display: inline-flex; align-items: center; gap: 5px;
  font-size: 10.5px; font-weight: 800; letter-spacing: .04em;
  text-transform: uppercase; border-radius: 999px;
  padding: 3px 9px; border: 1px solid var(--line); flex: 0 0 auto;
}
.render-card .rc-pill .ic { width: 12px; height: 12px; }
.render-card .rc-pill.live {
  color: var(--accent2);
  background: color-mix(in srgb, var(--accent) 14%, var(--card));
  border-color: color-mix(in srgb, var(--accent) 40%, var(--line));
}
.render-card .rc-pill.live .ic { animation: spin 1.4s linear infinite; }
.render-card .rc-pill.wait {
  color: var(--warn);
  background: color-mix(in srgb, var(--warn) 12%, var(--card));
  border-color: color-mix(in srgb, var(--warn) 38%, var(--line));
}
.render-card .rc-pct { font-size: 12px; font-weight: 800; color: var(--accent2); }
@keyframes spin { to { transform: rotate(360deg); } }
.render-card .rc-bar { height: 6px; background: var(--card2); border-radius: 6px; overflow: hidden; }
.render-card .rc-bar i { display: block; height: 100%; background: var(--grad-cta); border-radius: 6px;
  transition: width .4s var(--ease-out); }
.render-card .rc-stage { margin-top: 8px; font-size: 11.5px; color: var(--muted); font-weight: 600; }
.render-card .rc-cancel { margin-top: 10px; color: var(--err); border-color: color-mix(in srgb, var(--err) 40%, var(--line)); }
.render-card .rc-cancel:hover { color: var(--card); background: var(--err); border-color: var(--err); }
.jobs-dock .dock-cancel { margin-top: 8px; color: var(--err); border-color: color-mix(in srgb, var(--err) 40%, var(--line)); }
.jobs-dock .dock-cancel:hover { color: var(--card); background: var(--err); border-color: var(--err); }

.videos-toolbar {
  display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 16px; align-items: center;
  background: var(--card); border: 1px solid var(--line);
  border-radius: 14px; padding: 8px 10px;
  max-width: 100%; box-sizing: border-box;
}
.videos-toolbar .search-wrap { flex: 1 1 240px; min-width: 160px; display: flex; align-items: center; gap: 6px; background: var(--bg); border: 1px solid var(--line); border-radius: 9px; padding: 0 10px; height: 34px; }
.videos-toolbar .search-wrap input { flex: 1 1 auto; min-width: 0; border: 0; background: transparent; height: 100%; padding: 0; }
.videos-toolbar .search-wrap .ic { color: var(--muted); flex: 0 0 auto; }
.videos-toolbar select { padding: 7px 26px 7px 10px; font-size: 12px; height: 34px; flex: 1 1 130px; min-width: 0; max-width: 220px; }
.videos-toolbar .seg {
  display: inline-flex; background: var(--card2); border: 1px solid var(--line);
  border-radius: 9px; padding: 2px; gap: 1px; flex: 0 0 auto;
}
.videos-toolbar .seg button {
  background: transparent; border: 0; color: var(--muted);
  padding: 5px 10px; border-radius: 7px; cursor: pointer;
  font-size: 12px; font-weight: 700;
}
.videos-toolbar .seg button.active { background: var(--card); color: var(--text); box-shadow: var(--shadow-sm); }
.videos-toolbar .count { color: var(--muted); font-size: 12.5px; font-weight: 600; flex: 0 0 auto; margin-left: auto; }
@media (max-width: 720px) {
  .videos-toolbar .search-wrap { flex: 1 1 100%; }
  .videos-toolbar .count { margin-left: 0; flex: 1 1 100%; }
}

.gallery { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 14px; align-items: stretch; }
#gallery { min-height: 330px; }
@media (max-width: 980px) { #gallery { min-height: 260px; } }
.gallery.list { grid-template-columns: 1fr; gap: 8px; }
.vid {
  background: var(--card); border: 1px solid var(--line); border-radius: 16px;
  overflow: hidden; cursor: pointer;
  transition: all .18s var(--ease-out);
  box-shadow: var(--shadow-sm);
  position: relative; display: flex; flex-direction: column; min-width: 0;
}
.vid:hover { border-color: var(--accent); transform: translateY(-3px); box-shadow: var(--shadow); }
.vid .thumb { position: relative; height: clamp(178px, 22vw, 248px);
  flex: none; overflow: hidden; background: var(--bg2); }
.thumb-fallback {position:absolute;inset:0;display:none;place-content:center;justify-items:center;gap:9px;background:linear-gradient(145deg,var(--card2),var(--bg));color:var(--muted);z-index:1;text-align:center}
.thumb-fallback.show,.thumb:not(:has(img)) .thumb-fallback {display:grid}
.thumb-fallback .ic {width:28px;height:28px}
.media-error {opacity:0;pointer-events:none}
.schedule-live {display:grid;gap:4px;line-height:1.35}
.schedule-live b {font-size:15px;color:var(--text)}
.schedule-live span {font-size:12px;color:var(--muted);font-weight:500}
.schedule-live[data-state="quota"] b {color:var(--warn)}
.cost-breakdown {display:flex;flex-wrap:wrap;gap:6px;margin:7px 0}
.cost-breakdown > span {display:inline-flex!important;gap:5px;padding:5px 8px;border:1px solid var(--line);border-radius:999px;background:var(--bg);font-size:11px!important;color:var(--muted)}
.cg-breakdown {margin-top:12px;padding:14px;border:1px solid var(--line);border-radius:14px;background:var(--bg)}
.cg-breakdown > b {display:block;margin-bottom:8px;font-size:12px}
.channel-connect-state {display:flex;gap:12px;align-items:center;margin-bottom:10px}
.channel-connect-state div {display:grid;gap:3px}
.channel-connect-state span {color:var(--muted);font-size:12px}
#csConnection label {display:grid;gap:6px;margin:12px 0}
#csConnection input {width:100%;box-sizing:border-box}
.media-error {visibility:hidden}
.schedule-live {display:grid;gap:5px;line-height:1.35}
.schedule-live b {font-size:15px}
.schedule-live span {font-size:12px;color:var(--muted)}
/* The frame, not the image response, owns card height. Contain preserves
   captions and titles in portrait, square and landscape posters. */
.vid .thumb img { width: 100%; height: 100%; max-height: none;
  object-fit: contain; display: block; background: transparent; }
.vid .thumb::after {
  content: ""; position: absolute; inset: 0;
  background: linear-gradient(180deg, transparent 55%, rgba(0,0,0,.55));
  opacity: .35; transition: opacity .18s var(--ease-out);
}
.vid:hover .thumb::after { opacity: .75; }
.vid .play-pill {
  position: absolute; left: 50%; top: 50%; transform: translate(-50%,-50%) scale(.8);
  width: 42px; height: 42px; border-radius: 50%;
  background: rgba(255,255,255,.16); backdrop-filter: blur(6px);
  border: 1px solid rgba(255,255,255,.4);
  display: flex; align-items: center; justify-content: center;
  color: #fff; opacity: 0; transition: all .18s var(--ease-out); pointer-events: none;
}
.vid:hover .play-pill { opacity: 1; transform: translate(-50%,-50%) scale(1); }
.vid .info { padding: 12px 13px 14px; font-size: 12.5px; line-height: 1.4;
  min-height: 78px; display: flex; flex-direction: column; justify-content: space-between; }
.vid-skeleton { pointer-events: none; transform: none !important; }
.vid-skeleton .thumb { background: var(--card2); }
.vid-skeleton .thumb::after { opacity: 1; background: linear-gradient(90deg,
    transparent, color-mix(in srgb, var(--text) 7%, transparent), transparent);
  animation: shimmer 1.4s infinite; }
.vid-skeleton .info .skeleton { display: block; min-height: 0; height: 13px; }
.vid-skeleton .info .sk-title { width: 88%; }
.vid-skeleton .info .sk-meta { width: 63%; height: 10px; }
#homeRecent { min-height: 330px; }
@media (max-width: 980px) {
  #homeRecent { min-height: 260px; }
  #homeRecent .vid-skeleton:nth-child(n+4) { display: none; }
}
@media (max-width: 540px) {
  #homeRecent .vid-skeleton:nth-child(n+3) { display: none; }
}
@media (prefers-reduced-motion: reduce) {
  .vid-skeleton .thumb::after { animation: none; }
}
.vid .info b { display: -webkit-box; font-weight: 700; font-size: 13px;
  -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.vid .meta { color: var(--muted); font-size: 10.5px; margin-top: 5px; display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.vid .badges { position: absolute; top: 8px; left: 8px; display: flex; gap: 4px; z-index: 2; }
.vid .badges .b { font-size: 9.5px; font-weight: 800; padding: 3px 7px; border-radius: 6px; background: rgba(0,0,0,.6); color: #fff; backdrop-filter: blur(6px); letter-spacing: .02em; }
.vid .menu-btn { position: absolute; top: 8px; right: 8px; background: rgba(0,0,0,.5); color: #fff; border: 0; border-radius: 7px; width: 26px; height: 26px; cursor: pointer; display: inline-flex; align-items: center; justify-content: center; opacity: 0; transition: .15s; z-index: 2; }
.vid:hover .menu-btn { opacity: 1; }
.gallery .empty, .topics .empty { grid-column: 1 / -1; width: 100%; }

/* list view rows */
.gallery.list .vid { display: grid; grid-template-columns: 92px minmax(0,1fr); align-items: center; padding: 10px; gap: 14px; }
.gallery.list .vid .thumb { position: relative; width: 92px; height: 68px; border-radius: 8px; overflow: hidden; }
.gallery.list .vid .thumb img { width: 100%; height: 100%; border-radius: 8px; }
.gallery.list .vid .thumb::after { display: none; }
.gallery.list .vid .play-pill { display: none; }
.gallery.list .vid .menu-btn { opacity: 1; top: 4px; right: 4px; width: 22px; height: 22px; }
.gallery.list .vid .info { padding: 0 4px 0 0; min-height: 0; }
.gallery.list .vid .badges { top: 4px; left: 4px; }
.gallery.list .vid .badges .b { font-size: 8.5px; padding: 2px 5px; }

/* =============================================================================
 * CHANNELS — card grid
 * ========================================================================== */
.chan-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 280px), 1fr));
  gap: 14px; }
#sourceList { min-height: 154px; }
#sourceList .empty.big { padding: 20px 16px; min-height: 150px;
  grid-column: 1 / -1; }
.chan-card {
  background: var(--card); border: 1px solid var(--line); border-radius: 18px;
  padding: 20px; transition: all .18s var(--ease-out);
  box-shadow: var(--shadow-sm);
  display: flex; flex-direction: column; gap: 14px;
  position: relative; overflow: hidden;
}
.chan-card::after {
  content: ""; position: absolute; inset: auto 0 0 0; height: 2px;
  background: var(--grad-cta); opacity: 0; transition: opacity .18s var(--ease-out);
}
.chan-card:hover { box-shadow: var(--shadow); border-color: var(--accent); transform: translateY(-2px); }
.chan-card:hover::after { opacity: .6; }
.chan-card .ch-head { display: flex; align-items: center; gap: 12px; min-width: 0; }
.chan-card .ch-head .ch-ico {
  width: 44px; height: 44px; border-radius: 12px; flex-shrink: 0;
  background: var(--grad-soft); color: var(--accent2);
  display: inline-flex; align-items: center; justify-content: center;
}
.chan-card .ch-head .ch-ico .ic { width: 22px; height: 22px; }
.chan-card .ch-head .ch-head-text,
.chan-card .ch-head > div:not(.ch-ico) { min-width: 0; flex: 1; }
.chan-card .ch-head b {
  font-size: 15.5px; font-weight: 800; letter-spacing: -.01em;
  display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.chan-card .ch-head .meta {
  color: var(--muted); font-size: 11.5px; font-weight: 600; margin-top: 3px;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.chan-card .ch-stats { display: flex; gap: 10px; font-size: 11px; color: var(--muted); font-weight: 700;
  text-transform: uppercase; letter-spacing: .04em; padding: 12px 0; border-top: 1px solid var(--line-soft); border-bottom: 1px solid var(--line-soft); }
.chan-card .ch-stats > div { flex: 1; }
.chan-card .ch-stats b { color: var(--text); display: block; font-size: 19px; font-weight: 800; letter-spacing: -.02em; text-transform: none; margin-bottom: 2px; }
.chan-card .ch-actions { display: flex; gap: 6px; flex-wrap: wrap; margin-top: auto; }
.chan-card .ch-actions .mini { flex: 1 1 auto; justify-content: center; min-width: 70px; }
.chan-card.add {
  background: transparent; border: 2px dashed var(--line);
  display: flex; align-items: center; justify-content: center;
  flex-direction: column; gap: 8px; min-height: 200px;
  color: var(--muted); cursor: pointer; text-align: center;
}
.chan-card.add:hover { border-color: var(--accent); color: var(--text); }
.chan-card.add .ic.xl { color: var(--accent); }

/* channel rows — one channel per horizontal row, premium + responsive */
.chan-list { display: flex; flex-direction: column; gap: 10px; min-height: 192px; }
#channelList .empty.big { padding: 14px 16px; min-height: 170px; }
#channelList .empty.big .btn { display: flex; width: fit-content;
  justify-content: center; margin: 10px auto 0; }
.chan-row {
  display: flex; align-items: center; gap: 16px;
  background: var(--card); border: 1px solid var(--line);
  border-radius: 14px; padding: 14px 16px; box-shadow: var(--shadow-sm);
  transition: border-color .15s var(--ease-out), box-shadow .15s var(--ease-out);
  max-width: 100%; box-sizing: border-box;
}
.chan-row:hover { border-color: var(--accent); box-shadow: var(--shadow); }
.chan-row .ch-ico {
  flex: 0 0 auto; width: 42px; height: 42px; border-radius: 11px;
  display: grid; place-items: center; color: var(--accent2);
  background: color-mix(in srgb, var(--accent) 12%, var(--card2));
}
.chan-row .ch-ico .ic { width: 22px; height: 22px; }
.chan-row .ch-main { flex: 1 1 180px; min-width: 0; }
.chan-row .ch-main b { font-size: 15px; font-weight: 800; letter-spacing: -.01em;
  display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.chan-row .ch-main .meta { color: var(--muted); font-size: 11.5px; font-weight: 600; margin-top: 3px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.chan-row .ch-stats { display: flex; gap: 18px; flex: 0 1 auto; flex-wrap: wrap;
  font-size: 11.5px; color: var(--muted); font-weight: 700; }
.chan-row .ch-stats b { color: var(--text); font-weight: 800; }
.chan-row .ch-actions { display: flex; gap: 6px; flex: 0 0 auto; flex-wrap: wrap; justify-content: flex-end; margin-left: auto; }
.chan-row .ch-actions .mini { justify-content: center; }
.chan-row .ch-actions .del { color: var(--err); }
.chan-skeleton, .source-skeleton { pointer-events: none; }
.chan-skeleton { min-height: 192px; }
.chan-skeleton .skeleton, .source-skeleton .skeleton { display: block; min-height: 0; }
.chan-skeleton .ch-ico.skeleton, .source-skeleton .ch-ico.skeleton {
  background: var(--card2); }
.chan-skeleton .sk-name, .source-skeleton .sk-name { width: 64%; height: 18px; margin-bottom: 8px; }
.chan-skeleton .sk-detail, .source-skeleton .sk-detail { width: 88%; height: 13px; }
.chan-skeleton .sk-stat { width: 62px; height: 20px; }
.chan-skeleton .sk-action, .source-skeleton .sk-action {
  width: 76px; height: 32px; border-radius: 8px; }
.source-skeleton { min-height: 154px; }
@media (max-width: 860px) {
  .chan-row { flex-wrap: wrap; }
  .chan-row .ch-actions { margin-left: 0; flex: 1 1 100%; justify-content: flex-start; }
}
@media (max-width: 540px) {
  .chan-row { gap: 12px; padding: 12px; }
  .chan-row .ch-stats { gap: 12px; flex: 1 1 100%; margin-top: 2px; }
  .chan-row .ch-actions .mini { flex: 1 1 auto; }
}

/* compact new-channel row (single-line form) */
.newchan-card { margin-top: 18px; }
.newchan-card h2 { margin-bottom: 12px; }
.newchan-row {
  display: grid; grid-template-columns: minmax(180px, 1.4fr) repeat(3, minmax(140px, 1fr)) auto;
  gap: 10px; align-items: end;
}
.newchan-field { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.newchan-field > span { font-size: 11px; color: var(--muted); font-weight: 700; text-transform: uppercase; letter-spacing: .3px; }
.newchan-field input, .newchan-field select { width: 100%; }
.newchan-btn { white-space: nowrap; height: 38px; }
@media (max-width: 900px) {
  .newchan-row { grid-template-columns: 1fr 1fr; }
  .newchan-btn { grid-column: 1 / -1; }
}
@media (max-width: 540px) {
  .newchan-row { grid-template-columns: 1fr; }
}
.chan { display: flex; justify-content: space-between; align-items: center; gap: 12px; background: var(--card2); border: 1px solid var(--line); border-radius: 12px; padding: 14px 16px; flex-wrap: wrap; }
.chan b { font-size: 14px; }
.chan .meta { display: block; color: var(--muted); font-size: 11.5px; margin-top: 4px; }
.chbtns { display: flex; gap: 8px; }
.newchan summary { cursor: pointer; color: var(--muted); font-size: 13px; }
.newchan summary:hover { color: var(--text); }

/* =============================================================================
 * SOURCES — 3-tile dropzone
 * ========================================================================== */
.src-tiles { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; align-items: stretch; }
.src-tile {
  background: var(--card2); border: 1px solid var(--line);
  border-radius: 16px; padding: 20px; text-align: left;
  display: flex; flex-direction: column; gap: 10px;
  transition: all .15s var(--ease-out); min-width: 0;
  position: relative;
}
.src-tile:hover { border-color: var(--accent); background: var(--card); transform: translateY(-2px); box-shadow: var(--shadow-sm); }
.src-tile .ic.xl { color: var(--accent2); width: 36px; height: 36px; }
.src-tile b { display: block; font-size: 15px; margin: 2px 0 0; }
.src-tile > span.sub { font-size: 12px; color: var(--muted); line-height: 1.45; }
.src-tile input[type=file] { display: none; }
/* centered upload tile — icon + title + subtitle + button stacked in the middle */
.src-tile.src-tile--center {
  text-align: center; align-items: center; justify-content: center;
  gap: 12px;
}
.src-tile.src-tile--center .ic.xl { width: 52px; height: 52px; }
.src-tile.src-tile--center .tile-btn {
  margin-top: 4px; align-self: center; width: 100%; max-width: 220px;
}
.src-tile.src-tile--center input[type=text] { max-width: 220px; text-align: center; }
/* Files are parsed in the browser and never uploaded — say so where the user
   is deciding whether to hand over a document. */
.src-privacy {
  font-size: 11px; color: var(--muted); line-height: 1.4;
  display: inline-flex; align-items: center; gap: 5px;
  background: color-mix(in srgb, var(--ok, #23c483) 12%, transparent);
  border: 1px solid color-mix(in srgb, var(--ok, #23c483) 26%, transparent);
  border-radius: 999px; padding: 4px 10px; cursor: help;
}
.src-tile .tile-btn {
  margin-top: auto; align-self: stretch;
  padding: 10px 16px !important; font-size: 12.5px !important; justify-content: center;
}
.src-tile textarea, .src-tile input[type=text] {
  width: 100%; font-size: 13px;
  padding: 9px 11px; border-radius: 9px;
  background: var(--bg); border: 1px solid var(--line); color: var(--text);
  min-height: 38px;
}
.src-tile textarea { min-height: 72px; resize: vertical; }
.src-tile .src-msg { font-size: 11.5px; color: var(--muted); min-height: 15px; }
.src-tile .src-msg.ok { color: var(--ok); }
.src-tile .src-msg.err { color: var(--err); }

/* =============================================================================
 * MODAL — preserved + refined
 * ========================================================================== */
.modal { display: none; position: fixed; inset: 0; background: rgba(4,6,10,.74);
  z-index: 50; overflow-y: auto; overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch; padding: 30px 14px;
  backdrop-filter: blur(4px); }
.modal-body {
  width: 100%; max-width: 920px; min-width: 0; margin: 0 auto;
  background: var(--card); border: 1px solid var(--line);
  border-radius: 20px; padding: 26px; display: grid;
  grid-template-columns: minmax(0, 320px) minmax(0, 1fr);
  gap: 24px; position: relative; animation: modalin .18s var(--ease-out);
  box-shadow: 0 30px 80px rgba(0,0,0,.4);
}
@keyframes modalin { from { opacity: 0; transform: translateY(10px) scale(.99); } }
@keyframes modalFade { from { opacity: 0; } to { opacity: 1; } }
.modal-body.single { grid-template-columns: minmax(0, 1fr); }
.modal-body > * { min-width: 0; max-width: 100%; }
.modal-body video { width: 100%; border-radius: 14px; background: #000; }
.modal-body h3 { font-size: 17px; margin-bottom: 8px; padding-right: 34px; font-weight: 800; letter-spacing: -.01em; }
.modal-x {
  position: absolute; top: 14px; right: 14px; width: 32px; height: 32px;
  border-radius: 50%; border: 1px solid var(--line); background: var(--card2);
  color: var(--muted); cursor: pointer; font-size: 14px; line-height: 1;
  display: flex; align-items: center; justify-content: center; z-index: 2;
  transition: .12s var(--ease-out);
}
.modal-x:hover { color: var(--text); border-color: var(--accent); transform: rotate(90deg); }
.copybox { background: var(--card2); border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; font-size: 12px; margin-bottom: 10px; position: relative; white-space: pre-wrap; word-break: break-word; }
.copybox .lbl { color: var(--muted); font-size: 10px; text-transform: uppercase; letter-spacing: .06em; margin-bottom: 4px; display: block; padding-right: 46px; }
.copybtn { position: absolute; top: 8px; right: 8px; font-size: 10px; background: var(--accent); color: #fff; border: 0; border-radius: 6px; padding: 3px 8px; cursor: pointer; }
.rowbtns { display: flex; gap: 8px; margin-top: 6px; flex-wrap: wrap; }
.rowbtns a, .rowbtns button { flex: 1; text-align: center; padding: 9px; border-radius: 9px; text-decoration: none; font-size: 12.5px; font-weight: 700; cursor: pointer; border: 1px solid var(--line); background: var(--card2); color: var(--text); min-width: 110px; }
.rowbtns a:hover, .rowbtns button:hover { border-color: var(--accent); }
.rowbtns .del { color: var(--err); }
.platgroup { font-size: 13px; font-weight: 800; margin: 14px 0 8px; padding-top: 10px; border-top: 1px dashed var(--line); }
.platgroup .hint { display: block; font-weight: 400; font-size: 10.5px; margin-top: 2px; }

/* =============================================================================
 * SCRIPT DOCTOR + EDITOR
 * ========================================================================== */
.doc-scores { display: flex; gap: 10px; margin-bottom: 10px; flex-wrap: wrap; }
.score-badge {
  display: flex; align-items: center; gap: 10px; padding: 10px 14px;
  border: 1px solid var(--line); border-radius: 12px; background: var(--card2);
}
.score-badge b { font-size: 24px; letter-spacing: -.02em; }
.score-badge span { font-size: 10.5px; color: var(--muted); line-height: 1.35; }
.score-badge.ok b { color: var(--ok); }
.score-badge.warn b { color: var(--warn); }
.score-badge.err b { color: var(--err); }
.tl-wrap { margin: 8px 0 10px; }
.tl-bar { display: flex; height: 14px; border-radius: 8px; overflow: hidden; gap: 2px; }
.tl-bar i, .tl-legend i { display: block; height: 100%; border-radius: 3px; }
.tl-strong { background: var(--ok); }
.tl-good { background: color-mix(in srgb, var(--accent2) 70%, var(--card2)); }
.tl-risk { background: var(--warn); }
.tl-legend { display: flex; gap: 12px; font-size: 10.5px; color: var(--muted); margin-top: 5px; align-items: center; }
.tl-legend i { width: 10px; height: 10px; display: inline-block; margin-right: 4px; vertical-align: -1px; }
.doc-issues { display: flex; flex-direction: column; gap: 6px; margin: 8px 0; }
.issue { border: 1px solid var(--line); border-left: 3px solid var(--accent2);
  border-radius: 9px; padding: 8px 12px; font-size: 12px; background: var(--card2); }
.issue.warn { border-left-color: var(--warn); }
.issue.err { border-left-color: var(--err); }
.issue b { display: block; font-size: 12px; }
.issue span { color: var(--muted); font-size: 11.5px; }
.hookpick { margin: 10px 0 12px; }
.hookpick .lbl { display: block; font-size: 11px; color: var(--muted);
  text-transform: uppercase; letter-spacing: .06em; margin-bottom: 7px; font-weight: 700; }
.hook-opt { display: block; width: 100%; text-align: left; background: var(--card2);
  border: 1px solid var(--line); border-radius: 9px; padding: 8px 11px; margin-bottom: 6px;
  color: var(--text); font-size: 12.5px; cursor: pointer; transition: .12s var(--ease-out); }
.hook-opt:hover { border-color: var(--accent); }
.hook-opt em { display: block; font-style: normal; font-size: 10px; color: var(--accent2);
  text-transform: uppercase; letter-spacing: .05em; margin-bottom: 2px; }
.makebetter { margin: 12px 0 2px; padding: 12px 14px; border: 1px solid var(--line);
  border-radius: 12px; background: var(--card2); }
.makebetter .lbl { display: block; font-size: 11px; color: var(--muted);
  text-transform: uppercase; letter-spacing: .06em; font-weight: 700; margin-bottom: 8px; }
.mb-btns { display: flex; gap: 6px; flex-wrap: wrap; }
.makebetter #mb-note { display: block; margin-top: 8px; color: var(--ok); }
.scene-edit { background: var(--card2); border: 1px solid var(--line); border-radius: 12px; padding: 14px; margin-bottom: 10px; }
.scene-edit .tag { font-size: 10px; font-weight: 800; letter-spacing: .08em; color: var(--accent2); text-transform: uppercase; }
.scene-edit .chip-src { color: var(--ok); text-transform: none; letter-spacing: 0; cursor: help; }
.scene-edit .chip-warn { color: var(--warn); text-transform: none; letter-spacing: 0; cursor: help; }
.scene-edit textarea { width: 100%; margin-top: 8px; min-height: 54px; resize: vertical; }
.scene-edit input { width: 100%; margin-top: 8px; }

.guide li { display: flex; gap: 10px; align-items: flex-start; padding: 9px 0; border-bottom: 1px dashed var(--line); font-size: 13px; list-style: none; }
.guide li:last-child { border: 0; }
.guide li em { font-style: normal; }
.guide li .g-txt b { display: block; font-size: 13px; }
.guide li .g-txt span { color: var(--muted); font-size: 12px; }

/* =============================================================================
 * SCRIPT EDITOR MODAL — tabbed director's view
 * ========================================================================== */
.script-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 4px; padding-right: 34px; }
.script-head h3 { margin: 0; }
.script-head .script-topic { color: var(--muted); font-size: 12.5px; margin-top: 3px; font-weight: 600; }
.script-tabs { display: flex; gap: 0; border-bottom: 1px solid var(--line); margin: 14px 0 18px; position: sticky; top: 0; background: var(--card); z-index: 1; }
.script-tab {
  background: transparent; border: 0; color: var(--muted);
  padding: 10px 16px; cursor: pointer; font-size: 13px; font-weight: 700;
  position: relative; transition: color .12s;
  display: inline-flex; align-items: center; gap: 7px;
}
.script-tab:hover { color: var(--text); }
.script-tab .ic { color: var(--muted); }
.script-tab:hover .ic { color: var(--text); }
.script-tab.active { color: var(--text); }
.script-tab.active::after {
  content: ""; position: absolute; left: 14px; right: 14px; bottom: -1px; height: 2px;
  background: var(--grad-cta); border-radius: 2px 2px 0 0;
}
.script-tab .pill {
  font-size: 9.5px; font-weight: 800; background: var(--card2);
  border: 1px solid var(--line); color: var(--muted);
  padding: 1px 6px; border-radius: 6px; min-width: 16px; text-align: center;
}
.script-tab.active .pill { background: var(--accent-soft); color: var(--accent2); border-color: var(--accent); }
.script-pane { display: none; }
.script-pane.active { display: block; animation: fadein .15s var(--ease-out); }
.script-pane .pane-intro { color: var(--muted); font-size: 12.5px; margin-bottom: 14px; line-height: 1.5; }
.script-foot {
  position: sticky; bottom: 0; background: var(--card);
  border-top: 1px solid var(--line); margin-top: 18px; padding: 12px 0 0;
  display: flex; gap: 8px; align-items: center;
}
.script-foot .meta-line { color: var(--muted); font-size: 11.5px; font-weight: 600; margin-right: auto; }
.script-foot .spacer { flex: 1; }

/* =============================================================================
 * COMMAND PALETTE (⌘K)
 * ========================================================================== */
.cmdk-overlay {
  display: none; position: fixed; inset: 0; z-index: 100;
  background: rgba(4,6,10,.6); backdrop-filter: blur(8px);
  align-items: flex-start; justify-content: center; padding-top: 12vh;
  animation: fadein .15s var(--ease-out);
}
.cmdk-overlay.open { display: flex; }
.cmdk-box {
  width: 100%; max-width: 580px; max-height: 70vh;
  background: var(--card); border: 1px solid var(--line); border-radius: 16px;
  box-shadow: 0 30px 80px rgba(0,0,0,.5);
  display: flex; flex-direction: column; overflow: hidden;
  animation: modalin .2s var(--ease-out);
}
.cmdk-box .cmdk-input-row {
  display: flex; align-items: center; gap: 12px;
  padding: 16px 20px; border-bottom: 1px solid var(--line);
}
.cmdk-box .cmdk-input-row .ic { color: var(--muted); }
.cmdk-box .cmdk-input-row input {
  flex: 1; background: transparent; border: 0; padding: 0;
  font-size: 16px; color: var(--text); min-height: 24px;
}
.cmdk-box .cmdk-input-row input:focus { box-shadow: none; }
.cmdk-box .cmdk-input-row .esc-kbd {
  font-size: 10.5px; color: var(--muted); font-weight: 700;
  background: var(--card2); border: 1px solid var(--line); border-radius: 5px;
  padding: 2px 7px;
}
.cmdk-results { overflow-y: auto; padding: 8px; max-height: 50vh; }
.cmdk-section {
  font-size: 10px; color: var(--muted); font-weight: 800;
  text-transform: uppercase; letter-spacing: .08em;
  padding: 8px 12px 4px;
}
.cmdk-item {
  display: flex; align-items: center; gap: 12px;
  padding: 10px 12px; border-radius: 9px; cursor: pointer;
  font-size: 13.5px; color: var(--text); font-weight: 600;
  transition: .1s var(--ease-out);
}
.cmdk-item:hover, .cmdk-item.sel { background: var(--card2); }
.cmdk-item .ic { color: var(--muted); }
.cmdk-item.sel .ic { color: var(--accent2); }
.cmdk-item .cmd-sub { color: var(--muted); font-size: 11.5px; font-weight: 500; margin-left: auto; }
.cmdk-item .cmd-kbd { font-size: 10.5px; color: var(--muted); font-weight: 700; background: var(--bg2); border: 1px solid var(--line); border-radius: 5px; padding: 2px 6px; }

/* =============================================================================
 * CONFETTI
 * ========================================================================== */
.confetti {
  position: fixed; top: 0; left: 0; width: 100%; height: 100%;
  pointer-events: none; z-index: 200; overflow: hidden;
}
.confetti i {
  position: absolute; top: -10px; width: 8px; height: 14px;
  border-radius: 2px;
  animation: confettifall 1.6s cubic-bezier(.3, .1, .4, 1) forwards;
}
@keyframes confettifall {
  to { transform: translateY(110vh) rotate(720deg); opacity: 0; }
}

/* =============================================================================
 * TOASTS — refined
 * ========================================================================== */
.toasts {
  position: fixed; top: calc(var(--topbar-h, 60px) + 12px); right: 22px;
  display: flex; flex-direction: column; gap: 8px; z-index: 80; align-items: flex-end;
  pointer-events: none; width: min(420px, calc(100vw - 24px));
}
.toast {
  pointer-events: auto; display: flex; gap: 10px; align-items: flex-start;
  background: var(--card); color: var(--text); border: 1px solid var(--line);
  border-left: 3px solid var(--accent2); border-radius: 12px; padding: 12px 16px;
  font-size: 13px; box-shadow: var(--shadow); animation: toastin .22s var(--ease-spring);
  max-width: 100%; font-weight: 600;
}
.toast b { font-weight: 800; }
.toast .ic { color: var(--accent2); margin-top: 1px; }
.toast.err { border-left-color: var(--err); }
.toast.err .ic { color: var(--err); }
.toast.ok { border-left-color: var(--ok); }
.toast.ok .ic { color: var(--ok); }
.toast.warn { border-left-color: var(--warn); }
.toast.warn .ic { color: var(--warn); }
.toast.milestone {
  border-left: 0; background: var(--grad-cta); color: #fff;
  border-radius: 14px; padding: 14px 18px; font-weight: 700;
  box-shadow: var(--glow-cta);
}
.toast.milestone .ic { color: #fff; }
@keyframes toastin { from { opacity: 0; transform: translateY(8px) scale(.95); } }

/* =============================================================================
 * TEMPLATE PICKER (visual)
 * ========================================================================== */
.tpl-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(110px, 1fr)); gap: 10px; }
.tpl-card { cursor: pointer; border: 1px solid var(--line); border-radius: 12px; padding: 8px 8px 10px; background: var(--card2); text-align: center; transition: .15s var(--ease-out); }
.tpl-card:hover { border-color: var(--accent); transform: translateY(-2px); }
.tpl-card.active { border-color: var(--accent2); box-shadow: 0 0 0 1px var(--accent2); background: var(--accent-soft); }
.tpl-thumb { aspect-ratio: 9/13; border-radius: 8px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 7px; overflow: hidden; position: relative; }
.tpl-thumb i { display: block; width: 58%; height: 6px; border-radius: 3px; font-style: normal; }
.tpl-thumb i + i { width: 40%; opacity: .8; }
.tpl-thumb i + i + i { width: 26%; opacity: .55; }
.tpl-card b { display: block; font-size: 10.5px; margin-top: 8px; color: var(--text); font-weight: 700; line-height: 1.25; }
.tpl-dark  { background: linear-gradient(160deg, #0f2027, #2c5364); }  .tpl-dark i  { background: #f2c94c; }
.tpl-light { background: linear-gradient(160deg, #ffffff, #e9edf6); box-shadow: inset 0 0 0 1px #dfe3ee; } .tpl-light i { background: #5b4ce0; }
.tpl-glass { background: linear-gradient(160deg, #151a2e, #43317a); }  .tpl-glass i { background: rgba(255,255,255,.8); }
.tpl-bold  { background: linear-gradient(160deg, #ff4757, #c9202f); } .tpl-bold i  { background: #ffffff; }
.tpl-news  { background: #101114; box-shadow: inset 0 -7px 0 #e5322d; } .tpl-news i { background: #e5322d; }
.tpl-board { background: #f7f4ea;
  background-image: linear-gradient(#20242e14 1px, transparent 1px), linear-gradient(90deg, #20242e14 1px, transparent 1px);
  background-size: 11px 11px; box-shadow: inset 0 0 0 1px #e4dfc0; } .tpl-board i { background: #20242e; }
.tpl-editorial { background: linear-gradient(160deg, #f4efe4, #eae3d1);
  box-shadow: inset 0 0 0 1px #ddd3ba, inset 0 -1px 0 #19182333; }
  .tpl-editorial i { background: #191823; }
.tpl-broadcast { background: linear-gradient(160deg, #0c1f44, #133467);
  box-shadow: inset 0 -7px 0 #e63946; } .tpl-broadcast i { background: #ffffff; }
  .tpl-broadcast i + i { background: #e63946; opacity: .9; }
.tpl-record { background: radial-gradient(90% 100% at 50% 0%, #101018, #07070b); }
  .tpl-record i { background: #e8e8ee; }
  .tpl-record::after { content: "●"; position: absolute; top: 8px; left: 10px;
  color: #ff4444; font-size: 11px; }

/* phone-frame skins (one per template, applied via .pf-skin-X) */
.pf-skin-dark  { background: linear-gradient(160deg, #0f2027, #2c5364); }
.pf-skin-light { background: linear-gradient(160deg, #ffffff, #e9edf6); color: #1a1a1a; }
.pf-skin-light .pf-progress { background: rgba(0,0,0,.15) !important; }
.pf-skin-glass { background: linear-gradient(160deg, #151a2e, #43317a); }
.pf-skin-bold  { background: linear-gradient(160deg, #ff4757, #c9202f); }
.pf-skin-news  { background: #101114; box-shadow: inset 0 -7px 0 #e5322d; }
.pf-skin-board {
  background-color: #f7f4ea;
  background-image: linear-gradient(#20242e14 1px, transparent 1px), linear-gradient(90deg, #20242e14 1px, transparent 1px);
  background-size: 11px 11px; color: #1a1a1a;
}
.pf-skin-board .pf-progress { background: rgba(0,0,0,.15) !important; }
.pf-skin-board .pf-corner, .pf-skin-board .pf-chip { background: rgba(0,0,0,.55) !important; color: #fff !important; }
.pf-skin-editorial { background: linear-gradient(160deg, #f4efe4, #eae3d1); color: #191823; }
.pf-skin-editorial .pf-progress { background: rgba(0,0,0,.15) !important; }
.pf-skin-editorial .pf-corner, .pf-skin-editorial .pf-chip { background: rgba(25,24,35,.82) !important; color: #f4efe4 !important; }
.pf-skin-broadcast { background: linear-gradient(155deg, #071124, #0c1f44 55%, #133467); }
.pf-skin-broadcast .pf-chip { background: #e63946 !important; color: #fff !important; }
.pf-skin-record { background: radial-gradient(130% 100% at 50% 0%, #101018, #07070b 60%, #030305); }
.pf-skin-record .pf-chip { background: rgba(255,68,68,.9) !important; color: #fff !important; }

/* =============================================================================
 * ADMIN bits (unchanged, kept working)
 * ========================================================================== */
.tabsbar { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 18px; }
.tabsbar button { background: var(--card2); border: 1px solid var(--line); color: var(--muted); padding: 9px 16px; border-radius: 10px; cursor: pointer; font-size: 13px; font-weight: 700; transition: .12s var(--ease-out); }
.tabsbar button:hover { color: var(--text); }
.tabsbar button.active { color: var(--text); border-color: var(--accent); background: var(--accent-soft); }
.tablewrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 12.5px; }
th, td { text-align: left; padding: 9px 10px; border-bottom: 1px solid var(--line); }
th { color: var(--muted); font-weight: 600; font-size: 11px; text-transform: uppercase; letter-spacing: .05em; }
.on { color: var(--ok); } .off { color: var(--muted); }
.danger { color: var(--err); }

.opt-help { font-weight: 400; font-size: 11px; color: var(--muted); line-height: 1.5; }
/* never negative margin — it pulled step-desc under step-head actions */
.step-desc {
  color: var(--muted); font-size: 13px; margin: 0 0 14px;
  line-height: 1.55; max-width: 62ch;
  overflow-wrap: anywhere; word-break: break-word;
}
.step-head .step-desc { margin: 0; }

.modal-body { overflow-wrap: anywhere; }
.modal-body p, .modal-body li { line-height: 1.55; }

/* =============================================================================
 * WIDE-SCREEN DENSITY — grow-up tiers (the shrink-down half lives below).
 * The old layout stopped at 1320px: above ~1600px the centered column left
 * dead bands on both sides while every inner cap stayed pinned at phone-era
 * values. These tiers reclaim the gutters: bigger cards/columns, a wider
 * workbench preview, and a 2-column live summary that reads top-down.
 * ========================================================================== */
@media (min-width: 1600px) {
  .dash-hero { padding: 32px 40px; }
  .card { padding: 26px; }
  .card.hero { padding: 30px 32px 28px; }
  .wb-form .form-section { padding: 22px 26px; }
  .workbench { grid-template-columns: minmax(0, 1fr) minmax(300px, 360px); gap: 20px; }
  .phone-frame { max-width: 268px; }
  #genSummaryCard .pv-settings { column-count: 2; column-gap: 30px; }
  #genSummaryCard .pv-row { break-inside: avoid; }
  .modal-body { max-width: 1060px; }
}
@media (min-width: 2400px) {
  .workbench { grid-template-columns: minmax(0, 1fr) minmax(320px, 400px); }
  .phone-frame { max-width: 300px; }
}

/* =============================================================================
 * RESPONSIVE
 * ========================================================================== */
@media (max-width: 1180px) {
  .workbench { grid-template-columns: minmax(0,1fr) 300px; gap: 14px; }
}
@media (max-width: 1320px) {
  /* keep the phone emulator readable but secondary — it must never own
     half the wizard on landscape tablets */
  .workbench { grid-template-columns: minmax(0, 1fr) minmax(240px, 300px); }
}
@media (max-width: 980px) {
  .workbench { display: flex; flex-direction: column; }
  .wb-preview { order: -1; position: static; width: 100%; max-width: 340px; margin: 0 auto 14px; }
  .step-rail { gap: 4px; padding: 6px; }
  .step-rail .rail-item { flex: 0 0 116px; padding: 8px; gap: 8px; }
  .step-rail .rail-item .rail-lbl b { font-size: 12px; }
  .step-rail .rail-item .rail-lbl span { display: none; }
  .step-rail .rail-prog { display: none; }
  .src-tiles { grid-template-columns: 1fr; }
}
@media (max-width: 720px) {
  /* A single scrollable row keeps all eight steps reachable without a
     two-line sticky block covering the workbench. */
  .step-rail { gap: 4px; padding: 5px; }
  .step-rail .rail-item { flex: 0 0 112px; padding: 7px; justify-content: flex-start; gap: 6px; }
  .step-rail .rail-item .rail-lbl { display: block; }
  .step-rail .rail-item .rail-lbl b { font-size: 11px; }
  .step-rail .rail-item .rail-num { width: 28px; height: 28px; font-size: 12px; }
  .step-head { flex-direction: column; align-items: stretch; gap: 10px; }
  /* flex-basis 240px was authored for the ROW layout — stacked, it
     became a 240px empty HEIGHT under every step description (the
     "dead void" in mobile screenshots) */
  .step-head-text { flex: 0 1 auto; }
  .step-head-actions { justify-content: flex-start; }
  .step-head-actions .mini,
  .step-head-actions select.mini { max-width: 100%; flex: 1 1 auto; }
  .niche-grid { grid-template-columns: 1fr; max-height: none; overflow: visible; padding-right: 0; }
  .niche .d { display: block; overflow: visible; -webkit-line-clamp: unset; }
}
/* low-screen adaptive: below ~tablet landscape the LEFT RAIL GOES AWAY
   and the app moves to the mobile pattern (bottom tab nav). The old icon
   rail looked broken at these widths — labels clipped at the rail edge. */
@media (max-width: 1180px) {
  .sidebar { display: none !important; }
  .mobnav { display: flex; }
  /* phone emulator is a large-screen luxury — on low screens it stole
     the whole wizard viewport (owner directive: hide it, no substitute) */
  .wb-preview { display: none !important; }
  .workbench { grid-template-columns: minmax(0, 1fr) !important; }
  /* wizard footer + bottom nav read as ONE deck: same bg token, same blur,
     flush edges, no seam — matches .mobnav above it */
  .wb-nav {
    left: 0; bottom: calc(60px + env(safe-area-inset-bottom));
    padding: 10px 12px; gap: 8px;
    background: color-mix(in srgb, var(--bg2) 92%, transparent);
    border-top: 1px solid var(--line);
    box-shadow: none;
  }
  .content { padding: 16px 16px calc(96px + env(safe-area-inset-bottom)); }
  #view-create { padding-bottom: calc(80px + 60px + env(safe-area-inset-bottom)); }
  .jobs-dock { right: 12px; bottom: calc(76px + env(safe-area-inset-bottom)); }
  body.on-create .jobs-dock { bottom: calc(132px + env(safe-area-inset-bottom)); }
  .toasts { bottom: calc(80px + env(safe-area-inset-bottom)); top: auto; right: 12px; }
  .topbar-sticky { left: 0; }
  .shell { display: block; }
}
@media (max-width: 900px) {
  body { font-size: 13.5px; }
  /* sidebar collapses to icon-rail */
  .sidebar {
    width: var(--sidebar-w-collapsed) !important;
    padding: 14px 6px;
  }
  /* sidebar is display:none !important at <=1180, so the old collapsed-rail
     offset here (left: 72px) was dead styling that outranks the 1180 block —
     it made the wizard footer start 72px in while the bottom nav spans the
     full width. Footer is always full-width on mobile layouts. */
  .wb-nav { left: 0; padding: 10px 16px; }
  /* BUG FIX: this 900px block used to drop the +60px mobnav allowance that
     the 1180px and 540px blocks keep — on 540<w<=900 the stacked wizard
     footer + bottom tab bar (124px+) hid the wizard's last fields behind
     the fixed bars. Keep all three tiers identical. */
  #view-create { padding-bottom: calc(80px + 60px + env(safe-area-inset-bottom)); }
  .sidebar .nav-label, .sidebar #nav button span, .sidebar .side-foot .am-pill span, .sidebar .theme-toggle span { display: none; }
  .sidebar .side-quota { display: none; }
  .sidebar #nav button { justify-content: center; padding: 10px; }
  .sidebar #nav button.active::before { left: -6px; }
  .content { padding: 16px 16px calc(100px + env(safe-area-inset-bottom)); }
  .topbar-sticky { padding: 0 14px; gap: 10px; }
  .cmdk-trigger { max-width: 200px; padding: 7px 10px; }
  .cmdk-trigger .label { display: none; }
  .dash-hero { grid-template-columns: 1fr; }
  .view-head h1 { font-size: 22px; }
  .card { padding: 18px; border-radius: 14px; }
  .jobs-dock {
    right: 12px; bottom: calc(76px + env(safe-area-inset-bottom));
    max-width: calc(100vw - 24px);
  }
  body.on-create .jobs-dock { bottom: calc(132px + env(safe-area-inset-bottom)); }
  .niche-grid { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); max-height: 380px; }
  .gallery { grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 10px; }
  .toasts { bottom: calc(var(--nav-h) + 14px); }
  .stat b { font-size: 22px; }
  .grid { grid-template-columns: 1fr 1fr; gap: 11px; }
  .grid2 { grid-template-columns: 1fr; }
  /* Fixed overlay scrolling is contained; a stable mobile height avoids
     browser-toolbar resize jumps during a long billing-sheet scroll. */
  .modal { padding: min(7svh, 48px) 0 0; background: rgba(4,6,10,.86);
    backdrop-filter: none; -webkit-backdrop-filter: none; }
  .cmdk-overlay { background: rgba(4,6,10,.86);
    backdrop-filter: none; -webkit-backdrop-filter: none; }
  .modal-body {
    grid-template-columns: minmax(0, 1fr);
    padding: 22px 18px calc(30px + env(safe-area-inset-bottom));
    border-radius: 22px 22px 0 0; border-bottom: 0;
    animation: modalFade .16s var(--ease-out);
  }
  .modal-body::before {
    content: ""; display: block; width: 44px; height: 4px; border-radius: 3px;
    background: var(--line); margin: -6px auto 12px;
  }
}
@media (max-width: 540px) {
  .grid { grid-template-columns: 1fr; }
  .stat-row { grid-template-columns: 1fr 1fr; }
  .view-head { flex-direction: column; align-items: stretch; gap: 14px; margin-bottom: 20px; }
  /* A desktop width basis becomes height after switching to a column. */
  .view-head > div:first-child { flex: 0 1 auto; width: 100%; }
  .videos-toolbar input, .videos-toolbar select { max-width: none; }
  .cmdk-overlay { padding-top: 6vh; }
  .cmdk-box { max-height: 88vh; border-radius: 14px 14px 0 0; align-self: flex-end; margin-top: auto; }
  .topbar-sticky .logo span { display: none; }
  .streak-chip { padding: 4px 9px; font-size: 11px; }
  .view-head h1 { font-size: 20px; }
  .dash-hero { padding: 22px 18px; }
  .dash-hero h1 { font-size: 22px; }
  .sticky-cta { flex-direction: column; align-items: stretch; }
  .sticky-cta .btn { width: 100%; justify-content: center; }
  .chan-grid { grid-template-columns: 1fr; }
  .pattern-grid { grid-template-columns: 1fr; }
  .ft-tabs { overflow-x: auto; flex-wrap: nowrap; }
  .ft-tab { white-space: nowrap; }
  /* phone: sidebar/bottom-nav state is handled by the 1180px block above */
  .wb-nav { left: 0; bottom: calc(60px + env(safe-area-inset-bottom)); padding: 10px 12px; gap: 8px; }
  .wb-nav .btn { min-width: 0; padding-left: 12px; padding-right: 12px; font-size: 13px; }
  .wb-nav .wb-nav-label { font-size: 11.5px; }
  .src-tiles { grid-template-columns: 1fr; }
  .sidebar #nav button, .mobnav button { min-height: 44px; }
  #view-create { padding-bottom: calc(80px + 60px + env(safe-area-inset-bottom)); }
  .content { padding: 14px 14px calc(80px + env(safe-area-inset-bottom)); }
  .jobs-dock { right: 12px; bottom: calc(76px + env(safe-area-inset-bottom)); }
  body.on-create .jobs-dock { bottom: calc(132px + env(safe-area-inset-bottom)); }
  .toasts { bottom: calc(80px + env(safe-area-inset-bottom)); top: auto; right: 12px; }
  .view-head .actions { width: 100%; }
  .view-head .actions .btn { flex: 1; justify-content: center; }
  .gen-foot { flex-direction: column; align-items: stretch; }
  .gen-actions .btn { flex: 1; }
  .videos-toolbar .seg, .videos-toolbar .count { flex: 1 1 auto; }
}

/* =============================================================================
 * PREMIUM CHECKOUT & REFERRAL UX
 * ========================================================================== */
.modal-body.billing-modal, .modal-body.referrals-modal {
  width: min(1120px, 100%);
  max-width: 100%; min-width: 0;
  background: color-mix(in srgb, var(--card) 92%, #fff);
}
.modal-body.referrals-modal.referrals-active { min-height: 476px; }
.billing-container, .referrals-container {
  display: flex;
  flex-direction: column;
  gap: 20px;
  min-width: 0; max-width: 100%;
}
.billing-header, .referrals-header {
  border-bottom: 1px solid var(--line);
  padding-bottom: 14px;
}
.billing-header h3, .referrals-header h3 {
  font-size: 20px;
  font-weight: 800;
  color: var(--text);
  margin-bottom: 6px;
}
.billing-hint, .referrals-subtitle {
  font-size: 13px;
  color: var(--muted);
  line-height: 1.5;
}
.highlight {
  color: var(--accent2);
  font-weight: 700;
}
.billing-sec-title {
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
  color: var(--muted);
  letter-spacing: .08em;
  margin-bottom: 12px;
}
.pricing-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 16px;
  align-items: stretch;
}
.pricing-card {
  background: var(--card2);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 20px;
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 12px;
  cursor: pointer;
  transition: all .24s var(--ease-out);
  min-width: 0; max-width: 100%; overflow-wrap: anywhere;
}
.pricing-card:hover {
  border-color: var(--accent);
  box-shadow: 0 8px 24px rgba(124, 92, 255, .15);
  transform: translateY(-3px);
}
.card-badge {
  position: absolute;
  top: 14px;
  right: 14px;
  font-size: 9px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: .05em;
  background: var(--accent-soft);
  color: var(--accent);
  padding: 3px 8px;
  border-radius: 20px;
}
.topup-badge {
  background: rgba(0, 229, 255, 0.1);
  color: var(--accent2);
}
.plan-name {
  font-size: 15px;
  font-weight: 800;
  color: var(--text);
}
.plan-price {
  font-size: 26px;
  font-weight: 800;
  color: var(--text);
  line-height: 1.1;
}
.plan-price span {
  font-size: 13px;
  font-weight: 500;
  color: var(--muted);
}
.plan-credits {
  font-size: 12px;
  color: var(--muted);
  font-weight: 600;
}
.credit-badge {
  background: rgba(255, 255, 255, 0.05);
  padding: 4px 8px;
  border-radius: 6px;
  border: 1px solid var(--line-soft);
  display: inline-block;
  color: var(--text);
}
.plan-features {
  list-style: none;
  font-size: 12.5px;
  color: var(--muted);
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-top: 4px;
  margin-bottom: auto;
}
.plan-features li::before {
  content: "✓";
  color: var(--ok);
  margin-right: 8px;
  font-weight: bold;
}
.pricing-btn {
  width: 100%;
  border: 0;
  border-radius: 10px;
  padding: 10px;
  font-size: 13px;
  font-weight: 800;
  cursor: pointer;
  background: var(--line);
  color: var(--text);
  transition: all .2s;
}
.pricing-card:hover .pricing-btn {
  background: var(--grad-cta);
  color: #fff;
  box-shadow: var(--glow-cta-soft);
}
.topup-card {
  align-items: center;
  text-align: center;
  padding: 24px 20px;
}
.topup-card .plan-price {
  font-size: 28px;
}
.topup-btn {
  margin-top: 8px;
}
.pricing-card.topup-card:hover .topup-btn {
  background: linear-gradient(135deg, var(--accent2) 0%, #00b0ff 100%);
  box-shadow: 0 4px 14px rgba(0, 229, 255, 0.25);
}

/* Referrals UI */
.referral-link-section {
  background: var(--card2);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 20px;
  min-width: 0; max-width: 100%;
}
.ref-link-card {
  display: flex;
  flex-direction: column;
  gap: 8px;
  min-width: 0;
}
.ref-link-label {
  font-size: 11px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: var(--muted);
}
.ref-link-input-group {
  display: flex;
  align-items: center;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 6px 6px 6px 14px;
  gap: 12px;
  min-height: 48px;
  min-width: 0; max-width: 100%;
}
.ref-link-url {
  font-size: 13px;
  color: var(--text);
  font-family: ui-monospace, monospace;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  flex: 1 1 auto; min-width: 0;
}
.ref-copy-btn {
  padding: 8px 16px;
  font-size: 12.5px;
  border-radius: 8px;
  min-height: auto;
  box-shadow: none;
  flex: none;
}
.ref-copy-btn:hover {
  transform: scale(1.02);
}
.referral-stats-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
  min-width: 0;
}
.ref-stat-card {
  background: var(--card2);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 20px;
  text-align: center;
  display: flex;
  flex-direction: column;
  gap: 6px;
  transition: all .2s;
  min-width: 0;
}
.ref-stat-card:hover {
  border-color: color-mix(in srgb, var(--accent) 30%, var(--line));
}
.ref-stat-value {
  font-size: 32px;
  font-weight: 800;
  line-height: 1;
}
.ref-stat-primary .ref-stat-value {
  color: var(--accent2);
}
.ref-stat-success .ref-stat-value {
  color: var(--ok);
}
.ref-stat-label {
  font-size: 12px;
  font-weight: 700;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: .05em;
}
.ref-payout-info {
  font-size: 11px;
  color: var(--muted);
  text-align: center;
}
.referrals-loading .skeleton { display: block; min-height: 0; }
.ref-loading-title { width: min(72%, 280px); height: 28px; margin-bottom: 9px; }
.ref-loading-copy { width: 100%; height: 56px; }
.ref-loading-label { width: 44%; height: 12px; }
.ref-loading-link { height: 18px; }
.ref-loading-button { width: 112px; height: 34px; }
.ref-loading-value { width: 60px; height: 36px; margin: 0 auto; }
.ref-loading-stat-label { width: 72%; height: 12px; margin: 0 auto; }
.ref-loading-footer { width: 84%; height: 15px; margin: 0 auto; }
@media (max-width: 900px) {
  .modal-body.billing-modal, .modal-body.referrals-modal {
    width: calc(100% - 32px);
  }
}
@media (max-width: 540px) {
  .modal-body.referrals-modal.referrals-active { min-height: 593px; }
  .referral-link-section { padding: 14px; }
  .ref-link-input-group { display: grid; grid-template-columns: minmax(0, 1fr);
    padding: 10px; gap: 10px; }
  .ref-link-url { display: block; white-space: normal; overflow: visible;
    text-overflow: clip; overflow-wrap: anywhere; line-height: 1.45;
    user-select: all; }
  .ref-copy-btn { width: 100%; min-height: 42px; justify-content: center; }
  .referral-stats-grid { gap: 10px; }
  .ref-stat-card { padding: 14px 8px; }
  .ref-stat-label { font-size: 10.5px; overflow-wrap: anywhere; }
  .ref-loading-copy { height: 76px; }
  .ref-loading-link { height: 54px; }
  .ref-loading-button { width: 100%; height: 42px; }
  .ref-loading-footer { height: 28px; }
}
@media (max-width: 340px) {
  .modal-body.referrals-modal.referrals-active { min-height: 664px; }
}

/* =============================================================================
 * v4 components — guide banners, video detail page, stickman studio
 * ========================================================================== */
.guide-banner {
  display: flex; align-items: flex-start; gap: 10px;
  background: var(--accent-soft); border: 1px solid var(--line);
  border-left: 3px solid var(--accent);
  border-radius: var(--radius-sm); padding: 12px 14px; margin-bottom: 16px;
  font-size: 13px; color: var(--text); line-height: 1.5;
  min-width: 0; overflow-wrap: anywhere; word-break: break-word;
}
.guide-banner > span:not(.gb-ic) { min-width: 0; flex: 1; }
.guide-banner .gb-ic { flex: none; }
.guide-banner .gb-x {
  margin-left: auto; flex: none; background: none; border: 0;
  color: var(--muted); cursor: pointer; font-size: 12px; padding: 2px 6px;
  border-radius: 6px;
}
.guide-banner .gb-x:hover { background: var(--card2); color: var(--text); }

/* ---------- video detail page ---------- */
.video-page, #view-video { min-width: 0; max-width: 100%; }
.video-page { animation: fadeUp .25s var(--ease-out); }
.vp-back { margin-bottom: 12px; }
.vp-grid { display: grid; grid-template-columns: minmax(0, 340px) minmax(0, 1fr);
  gap: 22px; align-items: start; min-width: 0; max-width: 100%; }
.vp-grid > * { min-width: 0; max-width: 100%; }
.vp-left { position: sticky; top: calc(var(--topbar-h) + 16px); }
.vp-player { border-radius: var(--radius); overflow: hidden; background: #000;
  border: 1px solid var(--line); box-shadow: var(--shadow); min-width: 0;
  max-width: 100%; }
.vp-player video { width: 100%; max-width: 100%; display: block; max-height: 62vh;
  object-fit: contain; background: #000; }
.vp-header { margin-bottom: 18px; }
.vp-header .vp-title { margin-bottom: 4px; overflow-wrap: anywhere; }
.vp-header p { color: var(--muted); font-size: 12.5px; margin: 0;
  overflow-wrap: anywhere; }
.vp-actionbar { display: flex; gap: 8px; margin-top: 10px; align-items: flex-start; }
.vp-actionbar > .vp-download { flex: 1; text-align: center; padding: 11px 12px;
  border-radius: 10px; background: var(--grad-cta); color: #fff;
  text-decoration: none; font-size: 12.5px; font-weight: 750; }
.vp-more { flex: 1; min-width: 0; }
.vp-more summary, .vp-facts summary { cursor: pointer; list-style: none;
  border: 1px solid var(--line); border-radius: 10px; background: var(--card);
  padding: 10px 12px; font-size: 12.5px; font-weight: 700; color: var(--text); }
.vp-more summary::-webkit-details-marker, .vp-facts summary::-webkit-details-marker { display: none; }
.vp-more .rowbtns { margin-top: 8px; }
.vp-facts { margin-top: 12px; }
.vp-facts .vp-chips { margin-top: 8px; }
.vp-title { font-size: 22px; font-weight: 800; margin: 0 0 12px; line-height: 1.3; }
.vp-chips { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-top: 14px; }
.vp-chip { background: var(--card); border: 1px solid var(--line);
  border-radius: var(--radius-sm); padding: 8px 10px; display: flex;
  flex-direction: column; gap: 2px; min-width: 0; }
.vp-chip span { font-size: 10px; text-transform: uppercase; letter-spacing: .07em;
  color: var(--muted); }
.vp-chip b { font-size: 13px; white-space: normal; overflow-wrap: anywhere; }
.vp-tabs { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 14px;
  background: var(--card); border: 1px solid var(--line);
  border-radius: 12px; padding: 5px; max-width: 100%; }
.vp-tab { flex: 1; min-width: 110px; background: none; border: 0; cursor: pointer;
  color: var(--muted); font: inherit; font-size: 13px; font-weight: 600;
  padding: 9px 10px; border-radius: 8px; transition: all .15s var(--ease-out); }
.vp-tab:hover { color: var(--text); }
.vp-tab.active { background: var(--card2); color: var(--text);
  box-shadow: var(--shadow-sm); }
.vp-pane { display: none; min-width: 0; max-width: 100%; }
.vp-pane.active { display: block; animation: fadeUp .2s var(--ease-out); }
.vp-pane .copybox, .vp-scene > span:last-child, .vp-src {
  min-width: 0; max-width: 100%; overflow-wrap: anywhere; }
.vp-audit { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 130px), 1fr));
  gap: 10px; margin-bottom: 12px; }
.vp-audit-tile { background: var(--card); border: 1px solid var(--line);
  border-radius: var(--radius-sm); padding: 12px; text-align: center; }
.vp-audit-tile b { display: block; font-size: 22px; }
.vp-audit-tile span { font-size: 11px; color: var(--muted); }
.vp-audit-tile.ok b { color: var(--ok); }
.vp-audit-tile.warn b { color: var(--warn); }
/* ---- gallery paging + bulk selection ---- */
.pager { display: flex; flex-wrap: wrap; align-items: center; gap: 6px;
  justify-content: center; padding: 20px 0 8px; }
.pg-btn { min-width: 36px; height: 36px; padding: 0 10px; cursor: pointer;
  background: var(--card); border: 1px solid var(--line); color: var(--text);
  border-radius: 9px; font-size: 13px; font-weight: 600;
  transition: .12s var(--ease-out); }
.pg-btn:hover:not(:disabled):not(.active) { border-color: var(--accent);
  color: var(--accent); }
.pg-btn.active { background: var(--accent); border-color: var(--accent);
  color: #fff; cursor: default; }
.pg-btn:disabled { opacity: .38; cursor: not-allowed; }
.pg-gap { color: var(--muted); padding: 0 2px; }
.pg-info { margin-left: 10px; font-size: 12px; color: var(--muted); }
@media (max-width: 540px) {
  .pg-info { flex-basis: 100%; text-align: center; margin: 6px 0 0; }
}
.vid-pick { position: absolute; bottom: 8px; left: 8px; z-index: 3;
  display: flex; padding: 5px; border-radius: 7px;
  background: rgba(8, 10, 16, .62); backdrop-filter: blur(4px);
  opacity: 0; transition: opacity .14s ease; }
.vid:hover .vid-pick, .vid-pick:has(input:checked) { opacity: 1; }
.vid-pick input { width: 16px; height: 16px; cursor: pointer; margin: 0; }
.vid:has(.vid-pick input:checked) { outline: 2px solid var(--accent);
  outline-offset: 2px; border-radius: var(--radius-sm); }
.bulk-bar { position: fixed; left: 50%; transform: translateX(-50%);
  bottom: calc(22px + env(safe-area-inset-bottom)); z-index: 60;
  display: flex; align-items: center; gap: 12px; padding: 10px 14px;
  border: 1px solid var(--line); border-radius: 999px; background: var(--card);
  box-shadow: 0 10px 30px rgba(0, 0, 0, .35); font-size: 13px; }
.bulk-bar[hidden] { display: none; }
.btn.danger { background: var(--bad); border-color: var(--bad); color: #fff; }
/* Delete in flight: selected cards grey instantly (never a dead wait), then
   collapse out. .del-dot = busy pulse in the bar. */
.vid.deleting { opacity: .45; filter: grayscale(.5); pointer-events: none;
  transition: opacity .18s ease, filter .18s ease; }
.vid.gone { opacity: 0; transform: scale(.92); pointer-events: none;
  transition: opacity .26s ease, transform .26s ease; }
.del-dot { display: inline-block; width: 9px; height: 9px; border-radius: 50%;
  background: var(--bad); margin-right: 6px; vertical-align: 1px;
  animation: delPulse .8s ease-in-out infinite; }
@keyframes delPulse { 50% { opacity: .25; transform: scale(.75); } }
@media (max-width: 540px) {
  .bulk-bar { bottom: calc(72px + env(safe-area-inset-bottom)); width: min(92vw, 420px);
    justify-content: space-between; }
  .vid-pick { opacity: 1; }
}

/* ---- payment method picker ---- */
.pay-methods { display: flex; flex-wrap: wrap; align-items: center; gap: 10px;
  margin-top: 18px; padding: 12px 14px; border: 1px solid var(--line);
  border-radius: var(--radius-sm); background: var(--card2); }
.pay-methods[hidden] { display: none; }
.pay-label { font-size: 12px; color: var(--muted); font-weight: 600; }
.pay-opt { display: inline-flex; align-items: center; gap: 7px; padding: 7px 12px;
  border: 1px solid var(--line); border-radius: 999px; cursor: pointer;
  font-size: 12.5px; background: var(--card); }
.pay-opt:has(input:checked) { border-color: var(--accent); color: var(--accent); }

/* ---- armed-look banner (Create) ---- */
.armed-bar { display: flex; align-items: center; gap: 12px; margin-bottom: 14px;
  padding: 11px 14px; border: 1px solid var(--accent);
  border-radius: var(--radius-sm); background: var(--card2); }
.armed-bar[hidden] { display: none; }
.armed-ico { font-size: 22px; line-height: 1; flex: none; }
.armed-txt { display: flex; flex-direction: column; gap: 1px; min-width: 0;
  flex: 1; }
.armed-txt b { font-size: 13px; }
.armed-txt span { font-size: 11.5px; color: var(--muted);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.armed-x { flex: none; background: none; border: 0; color: var(--muted);
  cursor: pointer; font-size: 15px; padding: 4px 6px; border-radius: 6px; }
.armed-x:hover { color: var(--text); background: var(--card); }
@media (max-width: 560px) {
  .armed-bar { flex-wrap: wrap; }
  .armed-txt { flex-basis: 100%; order: -1; }
}

.ref-note { margin: 12px 0 8px; padding: 10px 12px; font-size: 11.5px;
  line-height: 1.55; color: var(--muted); background: var(--card2);
  border: 1px solid var(--line); border-left: 3px solid var(--accent);
  border-radius: 7px; }

/* ---- channel video template ---- */
.ch-template { margin-top: 18px; padding: 14px; border: 1px solid var(--line);
  border-radius: var(--radius-sm); background: var(--card2); }
.ch-template-head { display: flex; flex-direction: column; gap: 3px;
  margin-bottom: 10px; }
.ch-template-head b { display: flex; align-items: center; gap: 7px;
  font-size: 13px; }
.ch-template-head span { font-size: 11.5px; color: var(--muted); }
.ch-template-grid { display: grid; gap: 6px;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 180px), 1fr)); }
.ch-tpl-row { display: flex; align-items: baseline; justify-content: space-between;
  gap: 10px; padding: 6px 9px; background: var(--card);
  border: 1px solid var(--line); border-radius: 7px; font-size: 11.5px; }
.ch-tpl-row span { color: var(--muted); white-space: nowrap; }
.ch-tpl-row b { font-size: 12px; text-align: right; overflow: hidden;
  text-overflow: ellipsis; white-space: nowrap; }
.ch-recapture { display: flex; gap: 9px; align-items: flex-start;
  margin-top: 12px; font-size: 12px; cursor: pointer; }
.ch-recapture input { margin-top: 2px; flex: none; }
.ch-recapture em { display: block; color: var(--muted); font-size: 11px;
  font-style: normal; }
.ch-next { white-space: nowrap; }

/* ---- video detail: thumbnail pack ---- */
/* Columns are capped, not `1fr`: with only two or three posters an auto-fit
   track stretched to the full pane, and a portrait poster at that width was
   taller than the screen. */
.tp-grid { display: grid; gap: 12px; margin-bottom: 14px; justify-content: start;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 180px), 240px)); }
.tp-card { margin: 0; background: var(--card); border: 1px solid var(--line);
  border-radius: var(--radius-sm); overflow: hidden; }
.tp-card.primary { border-color: var(--accent); }
/* `contain` + a viewport cap: portrait, landscape and square posters sit in
   the same row without any of them dictating the height of the page. */
.tp-card img { display: block; width: 100%; height: auto; max-height: 42vh;
  object-fit: contain; background: var(--card2); }
.tp-card figcaption { display: flex; flex-direction: column; gap: 2px;
  padding: 9px 10px; font-size: 11px; color: var(--muted); }
.tp-card figcaption b { font-size: 12px; color: var(--text);
  text-transform: capitalize; }
.tp-card figcaption a { color: var(--accent); text-decoration: none;
  margin-top: 4px; font-weight: 600; }
.tp-form { display: grid; gap: 8px; margin-top: 8px;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 170px), 1fr)); }
.tp-form label { display: flex; flex-direction: column; gap: 4px;
  font-size: 11px; color: var(--muted); }
.vp-srcs { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 6px; }
.vp-src { background: var(--card2); border: 1px solid var(--line);
  border-radius: 999px; padding: 3px 10px; font-size: 12px;
  color: var(--text); text-decoration: none; }
a.vp-src:hover { border-color: var(--accent); color: var(--accent); }
.vp-scenes { display: flex; flex-direction: column; gap: 8px; margin-top: 10px; }
.vp-scene { display: flex; gap: 10px; align-items: flex-start;
  background: var(--card); border: 1px solid var(--line);
  border-radius: var(--radius-sm); padding: 10px 12px; font-size: 13px;
  line-height: 1.5; }
.vp-scene-n { flex: none; width: 22px; height: 22px; border-radius: 50%;
  background: var(--accent-soft); color: var(--accent); font-size: 11px;
  font-weight: 700; display: grid; place-items: center; }
.vp-scene-type { flex: none; font-size: 10px; text-transform: uppercase;
  letter-spacing: .06em; color: var(--muted); padding-top: 4px; }
@media (min-width: 1600px) {
  .vp-grid { grid-template-columns: minmax(0, 460px) minmax(0, 1fr); }
}
@media (max-width: 900px) {
  .vp-grid { grid-template-columns: minmax(0, 1fr); }
  .vp-left { position: static; }
  .vp-player video { max-height: 48vh; }
}

/* ---------- stickman studio ---------- */
.stick-hero { display: flex; align-items: center; justify-content: space-between;
  gap: 18px; flex-wrap: wrap; background:
  linear-gradient(135deg, var(--accent-soft), transparent 65%), var(--card);
  min-width: 0; }
.stick-hero > div { min-width: 0; flex: 1 1 240px; }
.stick-hero h2, .stick-hero p, .stick-hero .hint {
  overflow-wrap: anywhere; word-break: break-word; max-width: 100%;
}
.stick-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
  gap: 10px; }
.stick-grid.eps, .stick-grid.styles {
  grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); }
.stick-card { background: var(--card2); border: 1px solid var(--line);
  border-radius: var(--radius-sm); padding: 14px 10px; cursor: pointer;
  font: inherit; color: var(--text); text-align: center; display: flex;
  flex-direction: column; gap: 6px; align-items: center;
  transition: all .15s var(--ease-out); }
.stick-card:hover { transform: translateY(-2px); border-color: var(--accent);
  box-shadow: var(--shadow-sm); }
.stick-card.sel { border-color: var(--accent);
  box-shadow: 0 0 0 1px var(--accent), var(--glow-cta-soft);
  background: var(--accent-soft); }
.stick-card .face { font-size: 30px; line-height: 1; }
.stick-card b { font-size: 13px; }
.stick-card .sub { font-size: 11px; color: var(--muted); line-height: 1.4; }


/* =============================================================================
 * GENERATE CONFIRM — premium, high-visibility CTAs
 * ========================================================================== */
.modal-body.cg-modal {
  max-width: 440px;
  padding: 0;
  overflow: hidden;
  border: 1px solid color-mix(in srgb, var(--accent) 28%, var(--line));
  box-shadow:
    0 0 0 1px color-mix(in srgb, var(--accent) 12%, transparent),
    0 28px 80px rgba(0, 0, 0, .55),
    0 0 60px color-mix(in srgb, var(--accent) 14%, transparent);
}
.cg { padding: 28px 24px 22px; text-align: center; }
.cg-hero { margin-bottom: 18px; }
.cg-orb {
  width: 64px; height: 64px; margin: 0 auto 14px;
  border-radius: 20px;
  display: flex; align-items: center; justify-content: center;
  font-size: 28px; line-height: 1;
  background: linear-gradient(145deg,
    color-mix(in srgb, var(--accent) 85%, #fff),
    var(--accent));
  color: #0a0c10;
  box-shadow:
    0 10px 28px color-mix(in srgb, var(--accent) 45%, transparent),
    inset 0 1px 0 rgba(255,255,255,.35);
}
.cg-orb .ic, .cg-orb svg { width: 28px; height: 28px; }
.cg-title {
  margin: 0 0 6px !important;
  padding: 0 !important;
  font-size: 22px !important;
  font-weight: 850 !important;
  letter-spacing: -.02em;
  line-height: 1.2;
}
.cg-sub {
  margin: 0 auto;
  max-width: 32ch;
  font-size: 13px;
  color: var(--muted);
  line-height: 1.45;
}
.cg-summary {
  text-align: left;
  background: var(--card2);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 4px 0;
  margin-bottom: 14px;
}
.cg-row {
  display: flex; align-items: baseline; gap: 12px;
  padding: 10px 14px;
  border-bottom: 1px solid color-mix(in srgb, var(--line) 70%, transparent);
}
.cg-row:last-child { border-bottom: 0; }
.cg-k {
  flex: 0 0 64px;
  font-size: 10.5px;
  font-weight: 800;
  letter-spacing: .07em;
  text-transform: uppercase;
  color: var(--muted);
}
.cg-v {
  flex: 1;
  font-size: 13.5px;
  font-weight: 700;
  color: var(--text);
  line-height: 1.35;
  word-break: break-word;
}
.cg-cost {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 14px 16px;
  margin-bottom: 10px;
  border-radius: 14px;
  background: var(--card2);
  border: 1px solid var(--line);
  text-align: left;
}
.cg-cost.saas {
  background: linear-gradient(135deg,
    color-mix(in srgb, var(--accent) 16%, var(--card2)),
    var(--card2));
  border-color: color-mix(in srgb, var(--accent) 40%, var(--line));
}
.cg-cost-main { display: flex; align-items: baseline; gap: 6px; }
.cg-cost-num {
  font-size: 28px;
  font-weight: 900;
  letter-spacing: -.03em;
  color: var(--text);
  line-height: 1;
}
.cg-cost.saas .cg-cost-num { color: var(--accent); }
.cg-cost-unit {
  font-size: 13px;
  font-weight: 700;
  color: var(--muted);
  text-transform: lowercase;
}
.cg-cost-meta {
  display: flex; flex-direction: column; align-items: flex-end; gap: 2px;
  font-size: 11.5px;
  color: var(--muted);
  line-height: 1.35;
}
.cg-bal b { color: var(--text); font-weight: 800; }
.cg-safe {
  margin: 0 0 18px;
  font-size: 11.5px;
  color: var(--muted);
  line-height: 1.45;
}
.cg-actions {
  display: grid;
  grid-template-columns: 1fr 1.55fr;
  gap: 10px;
  align-items: stretch;
}
.cg-actions .btn {
  width: 100%;
  min-height: 52px;
  font-size: 15px;
  font-weight: 800;
  border-radius: 14px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}
.cg-actions .cg-cancel {
  background: var(--card2);
  border: 1.5px solid var(--line);
  color: var(--text);
  box-shadow: none;
}
.cg-actions .cg-cancel:hover {
  border-color: var(--text);
  background: var(--card);
}
.cg-actions .cg-go {
  min-height: 54px;
  font-size: 15.5px;
  letter-spacing: -.01em;
  box-shadow:
    0 8px 24px color-mix(in srgb, var(--accent) 40%, transparent),
    inset 0 1px 0 rgba(255,255,255,.22);
}
.cg-actions .cg-go:hover {
  filter: brightness(1.06);
  transform: translateY(-1px);
}
.cg-actions .cg-go:focus-visible,
.cg-actions .cg-cancel:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}
@media (max-width: 480px) {
  .modal-body.cg-modal { max-width: 100%; margin: 0 8px; }
  .cg { padding: 24px 18px 18px; }
  .cg-actions {
    grid-template-columns: 1fr;
  }
  .cg-actions .cg-go { order: -1; } /* primary on top on mobile */
  .cg-cost { flex-direction: column; align-items: flex-start; }
  .cg-cost-meta { align-items: flex-start; }
}

/* ---------- Thumbnails tab v2: hero + rail + compact tools ---------- */
.tp2 { display: grid; gap: 14px; }
.tp2-main { display: grid; grid-template-columns: minmax(0, 2.2fr) minmax(0, 1fr);
  gap: 12px; align-items: start; }
.tp2-main:has(.tp2-card.hero:last-child), .tp2-main:has(.tp2-rail:empty) {
  grid-template-columns: minmax(0, 1.4fr); }
.tp2-card { position: relative; border-radius: 14px; overflow: hidden; min-width: 0;
  border: 1px solid var(--line, #2a2a36); background: var(--panel2, #15151c);
  box-shadow: 0 18px 46px rgba(0,0,0,.42); transition: transform .18s ease; }
.tp2-card:hover { transform: translateY(-2px); }
.tp2-card .dl, .tp2-card img { display: block; width: 100%; height: auto;
  object-fit: contain; background: #0b0b11; }
.tp2-card.hero img { max-height: min(62vh, 776px); object-fit: contain; }
.tp2-rail { display: grid; gap: 12px; }
.tp2-card.rail img { max-height: 340px; object-fit: contain; }
.tp2-card figcaption { position: absolute; left: 0; right: 0; bottom: 0;
  display: flex; align-items: center; flex-wrap: wrap; gap: 8px; padding: 10px 12px;
  background: linear-gradient(0deg, rgba(5,5,10,.88), rgba(5,5,10,.35) 70%, transparent);
  backdrop-filter: blur(6px); }
.tp2-badge { padding: 3px 10px; border-radius: 999px; font-size: 11px;
  font-weight: 700; letter-spacing: .4px; text-transform: capitalize;
  background: rgba(255,255,255,.14); color: #fff; border: 1px solid rgba(255,255,255,.18); }
.tp2-badge.hot { background: linear-gradient(120deg, #ffd21f, #ff9b1f);
  color: #191305; border-color: transparent; }
.tp2-score { margin-left: auto; padding: 3px 10px; border-radius: 999px;
  font-size: 11.5px; font-weight: 800; color: #0d0d0d;
  background: linear-gradient(120deg, #8dff3f, #23d6ff); }
.tp2-dims { font-size: 10.5px; color: rgba(255,255,255,.62);
  font-variant-numeric: tabular-nums; }
.tp2-dl { width: 30px; height: 30px; display: grid; place-items: center;
  border-radius: 10px; background: rgba(255,255,255,.15);
  border: 1px solid rgba(255,255,255,.22); color: #fff; text-decoration: none;
  font-size: 13px; }
.tp2-dl:hover { background: rgba(255,255,255,.26); }
.tp2-tools { background: var(--panel2, #15151c); border: 1px solid var(--line, #2a2a36);
  border-radius: 14px; padding: 12px 14px; }
.tp2-tools-row { display: flex; gap: 12px; flex-wrap: wrap; align-items: flex-end; }
.tp2-tools-row label { display: grid; gap: 4px; font-size: 11.5px;
  min-width: 0; max-width: 100%;
  color: var(--text3, #8b8b99); }
.tp2-tools-row label.grow { flex: 1 1 220px; }
.tp2-tools-row select, .tp2-tools-row input { background: var(--bg2, #0e0e13);
  border: 1px solid var(--line, #2a2a36); border-radius: 9px; color: var(--text, #eee);
  padding: 8px 10px; font-size: 13px; min-width: 0; max-width: 100%; width: 100%; }
.tp2-tools-row select { width: auto; }
@media (max-width: 860px) {
  .tp2-main { grid-template-columns: minmax(0, 1fr); }
  .tp2-rail { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

/* =============================================================================
 * DASHBOARD FAST LANE — trending topic → render in two clicks
 * ========================================================================== */
.fastlane .fl-bar {
  display: flex; gap: 12px; align-items: center;
  margin: -2px 0 12px; flex-wrap: wrap;
}
.fastlane .fl-bar select { max-width: 280px; }
.fastlane .fl-note { color: var(--muted); font-size: 11.5px; }
.fl-list { display: flex; flex-direction: column; gap: 8px; min-height: 154px; }
.fl-item {
  display: flex; align-items: center; gap: 12px;
  background: var(--card2); border: 1px solid var(--line);
  border-radius: 12px; padding: 11px 14px; cursor: pointer;
  color: var(--text); text-align: left; font: inherit; width: 100%;
  transition: border-color .15s var(--ease-out), transform .15s var(--ease-out),
              background .15s var(--ease-out);
}
.fl-item:hover {
  border-color: var(--accent); transform: translateX(4px);
}
.fl-item:hover .fl-go { color: var(--accent2); }
.fl-topic {
  flex: 1; min-width: 0; font-weight: 700; font-size: 13px;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.fl-heat {
  font-size: 10px; font-weight: 800; letter-spacing: .03em;
  color: var(--warn); background: color-mix(in srgb, var(--warn) 12%, transparent);
  padding: 2px 8px; border-radius: 8px; flex-shrink: 0;
}
.fl-go {
  color: var(--muted); font-weight: 800; font-size: 11.5px;
  white-space: nowrap; flex-shrink: 0;
  display: inline-flex; align-items: center; gap: 4px;
  transition: color .15s var(--ease-out);
}
.fl-go .ic { width: 14px; height: 14px; }
@media (max-width: 560px) {
  .fl-heat { display: none; }
}

/* billing v2 — current plan + per-credit value */
.pricing-card.plan-current {
  border-color: color-mix(in srgb, var(--ok) 65%, var(--line));
  border-width: 2px;
}
.pricing-card.plan-current .card-badge {
  background: color-mix(in srgb, var(--ok) 16%, transparent);
  color: var(--ok);
}
.pricing-card .per-credit {
  display: block; margin-top: 3px; font-size: 10.5px;
  color: var(--muted); font-weight: 600;
}
.pricing-btn[disabled] { opacity: .55; cursor: default; }

.upgrade-cta {
  display: inline-flex; align-items: center; gap: 7px; min-height: 36px;
  border: 1px solid color-mix(in srgb, var(--accent) 55%, var(--line));
  border-radius: 999px; padding: 7px 13px; color: #fff; font-size: 12px;
  font-weight: 850; cursor: pointer; background: var(--grad-cta);
  box-shadow: var(--glow-cta-soft); transition: transform .16s var(--ease-out), box-shadow .16s;
}
.upgrade-cta:hover { transform: translateY(-1px); box-shadow: var(--glow-cta); }
.upgrade-cta:active { transform: scale(.97); }

.app-activity {
  pointer-events: none; position: fixed; inset: 0 0 auto; z-index: 9999;
  opacity: 0; visibility: hidden; transition: opacity .12s ease;
}
.app-activity[data-active="true"] { opacity: 1; visibility: visible; }
.app-activity-rail {
  display: block; height: 3px; transform-origin: left;
  background: linear-gradient(90deg, var(--accent), var(--accent2), #ffbe3d);
  box-shadow: 0 0 18px color-mix(in srgb, var(--accent) 60%, transparent);
  animation: app-progress 1.1s cubic-bezier(.2,.75,.3,1) infinite;
}
.app-activity-pill {
  position: fixed; top: 66px; left: 50%; transform: translateX(-50%);
  display: inline-flex; align-items: center; gap: 8px; max-width: calc(100vw - 32px);
  border: 1px solid var(--line); border-radius: 999px; padding: 8px 12px;
  background: color-mix(in srgb, var(--card) 94%, transparent);
  box-shadow: 0 14px 38px rgba(0,0,0,.26); backdrop-filter: blur(14px);
  color: var(--text); font-size: 11.5px; white-space: nowrap;
}
.app-activity-pill i {
  width: 11px; height: 11px; border: 2px solid color-mix(in srgb, var(--accent) 30%, transparent);
  border-top-color: var(--accent); border-radius: 50%; animation: app-spin .65s linear infinite;
}
.billing-container.billing-loading { text-align: left; padding: 0; }
.billing-container .billing-header { min-height: 85px; }
.billing-loading .skeleton { display: block; min-height: 0; }
.billing-skel-title { width: 56%; height: 25px; margin-bottom: 9px; }
.billing-skel-hint { display: grid; gap: 8px; height: 36px; }
.billing-skel-hint i { width: 90%; height: 14px; }
.billing-skel-hint i:nth-child(2n) { width: 72%; }
.billing-skel-hint i:nth-child(n+3) { display: none; }
.billing-skel-section { display: grid; gap: 8px; height: 14px;
  width: 58%; margin-bottom: 12px; }
.billing-skel-section i { height: 14px; }
.billing-skel-section i:last-child { display: none; width: 76%; }
.billing-loading-grid { grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 16px; margin-top: 0; }
.billing-section:first-child .pricing-card { min-height: 348px; }
.pricing-skeleton { pointer-events: none; }
.pricing-skeleton .billing-skel-name { width: 58%; height: 20px; }
.pricing-skeleton .billing-skel-price { width: 68%; height: 32px; }
.pricing-skeleton .billing-skel-credit { width: 74%; height: 16px; }
.pricing-skeleton .billing-skel-feature { width: 96%; height: 13px; }
.pricing-skeleton .billing-skel-feature.short { width: 76%; }
.pricing-skeleton .billing-skel-button { width: 100%; height: 42px; margin-top: auto; }
.credit-lock-note {
  display: flex; align-items: center; gap: 10px; margin: -2px 0 12px;
  border: 1px solid color-mix(in srgb, var(--accent) 35%, var(--line));
  border-radius: 12px; padding: 10px 12px; background: var(--accent-soft);
  color: var(--text); font-size: 12px;
}
.credit-lock-note span { font-size: 18px; }
.credit-lock-note b, .credit-lock-note small { display: block; }
.credit-lock-note small { margin-top: 2px; color: var(--muted); }
.pricing-card.topup-locked { cursor: pointer; opacity: .72; filter: saturate(.7); }
.pricing-card.topup-locked:hover { border-color: color-mix(in srgb, var(--accent) 45%, var(--line)); }
.pricing-card.topup-locked .pricing-btn { background: var(--line); color: var(--muted); }
.plan-grid-nudge { animation: plan-nudge .42s ease; }
.billing-manage-panel {
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
  margin-top: 14px; border: 1px solid color-mix(in srgb, var(--accent) 32%, var(--line));
  border-radius: 14px; padding: 14px 16px; background: var(--accent-soft);
}
.billing-manage-panel b, .billing-manage-panel small { display: block; }
.billing-manage-panel b { color: var(--text); font-size: 13px; }
.billing-manage-panel small { color: var(--muted); font-size: 11.5px; line-height: 1.45; margin-top: 3px; }
.billing-manage-link { flex: 0 0 auto; white-space: nowrap; text-decoration: none; }

@keyframes app-progress { 0%{transform:scaleX(.08)} 55%{transform:scaleX(.68)} 100%{transform:scaleX(.92)} }
@keyframes app-spin { to{transform:rotate(360deg)} }
@keyframes plan-nudge { 0%,100%{transform:translateX(0)} 30%{transform:translateX(5px)} 65%{transform:translateX(-4px)} }

@media (max-width: 700px) {
  .upgrade-cta { padding: 7px 10px; }
  .upgrade-cta span:first-child { display: none; }
  .billing-loading-grid { grid-template-columns: minmax(0, 1fr); }
  .pricing-grid { grid-template-columns: minmax(0, 1fr); }
  .billing-manage-panel { align-items: stretch; flex-direction: column; }
  .billing-manage-link { width: 100%; justify-content: center; }
}
@media (max-width: 540px) {
  .billing-container .billing-header { min-height: 132px; }
  .billing-skel-hint { height: 80px; }
  .billing-skel-hint i:nth-child(n+3) { display: block; }
  .billing-skel-section { height: 36px; width: 82%; }
  .billing-skel-section i:last-child { display: block; }
}
@media (min-width: 701px) and (max-width: 980px) {
  .pricing-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 430px) { .upgrade-cta { display: none !important; } }
@media (prefers-reduced-motion: reduce) {
  .app-activity-rail, .app-activity-pill i,
  .plan-grid-nudge, .modal-body, .cmdk-box { animation: none; }
  .upgrade-cta, .pricing-card { transition: none; }
}

/* generate-time cap upsell */
.upsell { text-align: center; padding: 10px 6px; }
.upsell-ico { font-size: 34px; }

/* ==========================================================================
 * CREATE PAGE — premium polish pass (2026-08-01)
 * ========================================================================== */

/* step rail: connector spine + elevated active/done states.
   NEVER `position: relative` here: .step-rail is sticky with a top offset —
   relative + top shifts the bar 57px down over the step content (2026-08-01
   Create-page overlap bug). */
.step-rail { position: sticky; overflow-x: auto; overflow-y: hidden; }
.step-rail .rail-item { position: relative; overflow: hidden; }
.step-rail .rail-item.active {
  box-shadow: 0 8px 22px color-mix(in srgb, var(--accent) 18%, transparent),
    inset 0 1px 0 rgba(255, 255, 255, .06);
}
.step-rail .rail-item.done .rail-num { position: relative; }
.step-rail .rail-item.done .rail-num::after {
  content: "✓"; position: absolute; inset: 0; display: grid; place-items: center;
  font-size: 11px; font-weight: 900; color: #fff;
}
.step-rail .rail-item.done .rail-num { font-size: 0; }

/* wizard footer: last-step Generate becomes the hero CTA */
#wbNav .btn.lg {
  position: relative;
  font-weight: 900; letter-spacing: .01em;
  background: var(--grad-cta); color: #fff; border: none;
  box-shadow: 0 10px 30px color-mix(in srgb, var(--accent) 45%, transparent);
  transition: transform .16s var(--ease-out), box-shadow .16s var(--ease-out);
}
#wbNav .btn.lg::before {
  content: ""; position: absolute; inset: -4px; border-radius: inherit;
  background: var(--grad-cta); opacity: .35; filter: blur(14px); z-index: -1;
  animation: genPulse 2.6s ease-in-out infinite;
}
#wbNav .btn.lg:hover { transform: translateY(-1px) scale(1.02); }
#wbNav .btn.lg:active { transform: translateY(0) scale(.99); }
@keyframes genPulse {
  0%, 100% { opacity: .22; transform: scale(.98); }
  50% { opacity: .5; transform: scale(1.02); }
}

/* phone preview: soft ambient lift so the emulator owns the right column */
.phone-card {
  position: relative;
}
.phone-card::before {
  content: ""; position: absolute; inset: 8% -4% -2% -4%;
  background: radial-gradient(60% 55% at 50% 45%,
    color-mix(in srgb, var(--accent) 16%, transparent), transparent 75%);
  filter: blur(26px); z-index: -1; pointer-events: none;
}

/* genbar summary: the live-recap card reads like a receipt, not a form */
#genSummaryCard {
  border: 1px solid color-mix(in srgb, var(--accent) 24%, var(--line));
  box-shadow: 0 12px 34px color-mix(in srgb, var(--accent) 10%, transparent);
}
#genSummaryCard h4 {
  letter-spacing: .02em; text-transform: none;
  color: color-mix(in srgb, var(--accent) 75%, var(--text));
}

/* grouped rooms inside fine-tune get a hair of scroll-into-view air */
.ft-pane .fgrp:first-child { box-shadow: inset 0 1px 0 rgba(255,255,255,.05), var(--shadow-sm); }

/* Character direction: purposeful presets above the detailed controls. */
.performance-presets { padding:20px; border:1px solid var(--line); border-radius:16px; background:var(--bg2); }
.production-eyebrow { font-size:10px; letter-spacing:.16em; font-weight:700; opacity:.65; }
.performance-presets h4 { margin:8px 0; font-size:17px; }
.performance-presets p { font-size:12px; line-height:1.5; opacity:.72; margin:8px 0; }
.performance-options { display:grid; grid-template-columns:repeat(3,minmax(0,1fr)); gap:10px; margin-top:16px; }
.performance-options button { text-align:left; white-space:normal; color:inherit; background:var(--bg); border:1px solid var(--line); border-radius:12px; padding:14px; cursor:pointer; }
.performance-options strong,.performance-options span { display:block; }
.performance-options span { font-size:11px; line-height:1.6; opacity:.7; margin-top:6px; }
.performance-options button:hover { border-color:currentColor; }
.performance-options button:focus-visible { outline:2px solid currentColor; outline-offset:3px; }
@media(max-width:640px) { .performance-options { grid-template-columns:1fr; } }

.thumbnail-loading { display:grid; grid-template-columns:repeat(3,minmax(0,1fr)); gap:10px; margin:14px 0; }
.thumbnail-loading .skeleton { display:block; min-width:0; width:100%; min-height:60px; aspect-ratio:16/9; border-radius:10px; }
.tp2-card img { background:var(--bg2); }
@media(prefers-reduced-motion:reduce) { .skeleton, .skeleton::after { animation:none !important; } }

.media-loading { background:linear-gradient(100deg,var(--bg2) 20%,var(--card2) 45%,var(--bg2) 70%); background-size:250% 100%; animation:media-shimmer 1.4s ease-in-out infinite; }
@keyframes media-shimmer { from { background-position:100% 0; } to { background-position:-100% 0; } }
@media(prefers-reduced-motion:reduce) { .media-loading { animation:none; } }

[hidden] { display:none !important; }
.stats-fields { display:grid; grid-template-columns:repeat(2,minmax(0,1fr)); gap:14px; margin:16px 0; }
.stats-fields label { display:grid; gap:5px; }
.stats-fields small { color:var(--muted); font-size:11px; }
@media(max-width:540px) { .stats-fields { grid-template-columns:1fr; } }

/* Channel workspace: readable grouping and wrapping at every screen size. */
#channelDetail > .card { border-radius:18px; }
#channelDetail .hint { line-height:1.6; }
#channelDetail .card b { overflow-wrap:anywhere; }
.chan-row { flex-wrap:wrap; gap:16px; padding:20px; }
.chan-row .ch-main { flex:1 1 220px; }
.chan-row .ch-actions { display:flex; gap:8px; flex-wrap:wrap; }
@media(max-width:720px) { .chan-row .ch-actions { width:100%; } .chan-row .ch-actions button { flex:1 1 90px; } #channelDetail .card { padding:16px !important; } }
.publish-hero {padding:28px;border:1px solid var(--border);border-radius:22px;background:linear-gradient(120deg,rgba(119,92,255,.13),transparent);margin-bottom:22px}
.publish-hero h2 {font-size:clamp(24px,3vw,34px);margin:8px 0 12px;letter-spacing:-.03em}
.publish-hero p {max-width:760px;line-height:1.65;color:var(--muted)}
.publish-eyebrow {font-size:11px;font-weight:700;letter-spacing:.14em;text-transform:uppercase;color:var(--accent)}
.publish-grid {display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:20px;align-items:start}
.publish-card {padding:26px;border:1px solid var(--border);border-radius:22px;background:var(--card);min-width:0}
.publish-card header {display:flex;align-items:center;gap:14px;margin-bottom:22px}
.publish-logo {display:grid;place-items:center;width:48px;height:48px;border-radius:15px;background:rgba(119,92,255,.12);font-size:24px}
.publish-card h3 {margin:0 0 4px;font-size:20px}
.publish-card p,.publish-card li {line-height:1.65}
.publish-card ol {padding-left:22px;margin:18px 0 24px}
.publish-card li {padding-left:5px;margin-bottom:10px}
.publish-card label {display:grid;gap:8px;margin:16px 0;font-size:13px;font-weight:600}
.publish-card input {width:100%;min-height:46px;box-sizing:border-box;padding:12px;border-radius:12px;border:1px solid var(--border);background:var(--bg);color:var(--text)}
.publish-card .btn {min-height:46px;margin:6px 0 16px}
.publish-note {font-size:12px;color:var(--muted);padding-top:16px;border-top:1px solid var(--border)}
.publish-steps {display:flex;flex-wrap:wrap;gap:12px;margin-top:20px;font-size:12px}
.publish-steps span {padding:8px 12px;border:1px solid var(--border);border-radius:999px}
@media(max-width:700px){.publish-grid{grid-template-columns:1fr}.publish-card,.publish-hero{padding:20px}.publish-card .btn{width:100%}}

/* Mobile account clarity: reserve the space before data arrives so credits
   and daily usage never pop the rest of the page downward after sign-in. */
.usage-panel { display: none; margin: 0 0 16px; padding: 12px 14px;
  border: 1px solid var(--line); border-radius: 14px; background: var(--card);
  box-shadow: var(--shadow-sm); }
.usage-head { display: flex; align-items: center; justify-content: space-between;
  gap: 10px; margin-bottom: 9px; }
.usage-head b { font-size: 12px; color: var(--text); }
.usage-head button { border: 0; background: none; color: var(--accent2);
  font: inherit; font-size: 11.5px; font-weight: 700; cursor: pointer;
  padding: 5px; }
.usage-metrics { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 6px; }
.usage-metrics > div { min-width: 0; padding: 8px; border-radius: 9px;
  background: var(--card2); }
.usage-metrics small { display: block; color: var(--muted); font-size: 10px;
  line-height: 1.25; }
.usage-metrics strong { display: block; margin-top: 3px; color: var(--text);
  font-size: 14px; font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
.usage-note { margin: 8px 0 0; color: var(--muted); font-size: 10.5px; }
/* Detail playback should lead the screen. The video title is its page heading;
   plan usage remains available elsewhere in the studio. */
body.on-video .view-head, body.on-video .usage-panel { display: none; }
.preview-chips .chip, .sticky-cta .summary-chips .chip, .gen-chips .chip {
  white-space: normal; max-width: 100%; overflow: visible;
  text-overflow: clip; overflow-wrap: anywhere; }

@media (max-width: 1180px) {
  .usage-panel { display: block; }
  .mobnav { height: calc(54px + env(safe-area-inset-bottom)); }
  .wb-nav { bottom: calc(54px + env(safe-area-inset-bottom));
    padding: 6px 12px; min-height: 52px; }
  .wb-nav .btn { min-height: 40px; }
  #view-create { padding-bottom: calc(120px + env(safe-area-inset-bottom)); }
  body.on-create .jobs-dock { bottom: calc(116px + env(safe-area-inset-bottom)); }
}
@media (max-width: 900px) {
  .vp-tabs { flex-wrap: nowrap; overflow-x: auto; overscroll-behavior-x: contain;
    scrollbar-width: thin; scroll-snap-type: x proximity; }
  .vp-tab { flex: 0 0 auto; min-width: max-content; scroll-snap-align: start; }
  .vp-header { margin-bottom: 12px; }
  .vp-player video { max-height: 46svh; }
  .vp-more .rowbtns > * { min-width: 0; }
}
@media (max-width: 720px) {
  .niche-grid { grid-template-columns: 1fr; max-height: none; overflow: visible; }
  .niche { padding: 12px; }
  .niche .d { display: block; overflow: visible; -webkit-line-clamp: unset; }
  #view-create > .guide-banner, #view-home > .guide-banner { display: none; }
}
@media (max-width: 540px) {
  .tp2-rail { grid-template-columns: minmax(0, 1fr); }
  .topbar-sticky { gap: 8px; padding: 0 12px; }
  .topbar-sticky .logo { font-size: 15px; gap: 4px; }
  .topbar-sticky .logo span { display: inline; }
  .cmdk-trigger { flex: 0 0 42px; max-width: 42px; width: 42px;
    height: 42px; padding: 0; justify-content: center; }
  .cmdk-trigger .label, .cmdk-trigger .kbd { display: none; }
  .content { padding: 12px 12px calc(70px + env(safe-area-inset-bottom)); }
  .view-head { gap: 10px; margin-bottom: 14px; }
  .view-head .sub { font-size: 12.5px; }
  .view-head .actions { gap: 8px; }
  .view-head .actions { justify-content: flex-end; }
  .view-head .actions #newVideoBtn { flex: 0 0 auto; width: auto; min-height: 34px; }
  .dash-hero { padding: 18px; gap: 14px; margin-bottom: 14px;
    min-height: 300px; }
  .dash-hero h1 { font-size: 20px; }
  .dash-hero #heroName { min-height: 2.4em; }
  .dash-hero .hero-sub { font-size: 12.5px; line-height: 1.5; }
  .dash-hero #heroSub { min-height: 4.5em; }
  .dash-hero .hero-meta { margin-top: 12px; }
  .dash-hero .hero-actions { display: grid; grid-template-columns: 1fr;
    justify-items: center; gap: 4px; }
  .dash-hero .hero-actions #heroCreate { width: 100%; min-height: 42px; }
  .dash-hero .hero-actions #heroSurprise { min-height: 32px; padding: 4px 10px;
    background: transparent; border-color: transparent; box-shadow: none; }
  .wb-form .form-section { padding: 15px; }
  .step-rail { margin-bottom: 10px; }
  .wb-nav .wb-nav-label { font-size: 10.5px; white-space: normal;
    overflow: visible; text-overflow: clip; line-height: 1.2; }
  .mobnav button { font-size: 9px; gap: 2px; padding: 4px 1px; }
  .mobnav button .ic { width: 20px; height: 20px; }
  .gallery { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 9px; }
  .vid .thumb { height: 182px; }
  .vid .info { padding: 10px; min-height: 74px; }
  .vp-actionbar { align-items: stretch; }
  .vp-actionbar > .vp-download, .vp-more summary { min-height: 42px;
    display: grid; place-items: center; box-sizing: border-box; }
  .vp-chip { padding: 8px; }
}
@media (max-width: 340px) {
  .gallery:not(.list) { grid-template-columns: 1fr; }
  .vid .thumb { height: 230px; }
  /* Keep the compact dashboard preview to one card at this width. Its
     loaded and empty states now occupy the same footprint. */
  #homeRecent .vid-skeleton:nth-child(n+2) { display: none; }
  #homeRecent .vid .thumb { height: 182px; }
  #homeStats .stat { min-height: 150px; }
  .usage-metrics { gap: 4px; }
  .usage-metrics > div { padding: 6px; }
}
@media (max-width: 1180px) and (max-height: 560px) {
  /* In landscape a sticky top rail plus two fixed bottom bars left almost no
     space for the form. Keep Back/Next reachable, but let the rail scroll away. */
  .step-rail { position: relative; top: auto; }
  .view-head { margin-bottom: 8px; }
  .view-head .sub { display: none; }
}
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .view.active, .wb-form .form-section.active, .video-page,
  .vp-pane.active, #wbNav .btn.lg::before { animation: none !important; }
  .step-rail, .vp-tabs { scroll-behavior: auto; }
}
/* Loading images have a stable frame; animated shimmer was perceived as
   flicker when a private thumbnail needed one network retry. */
.media-loading { animation: none; background: var(--card2); }
