/* ==========================================================================
   SARDAV DESIGN SYSTEM
   Cinematic · premium · minimal. Dark "screening room" surfaces, warm tungsten
   accent, bone-white type. No purple gradients, no neon.
   ========================================================================== */

@font-face {
  font-family: "Sardav Serif";
  src: url("/assets/fonts/lora-italic-500.woff") format("woff");
  font-style: italic;
  font-weight: 500;
  font-display: swap;
}

:root {
  --ink-0: #070708;
  --ink-1: #0c0c0e;
  --ink-2: #131316;
  --ink-3: #1b1b1f;
  --ink-4: #26262b;
  --line: rgba(244, 239, 230, 0.09);
  --line-strong: rgba(244, 239, 230, 0.16);
  --bone: #f4efe6;
  --bone-2: #d9d3c8;
  --muted: #9a958c;
  --muted-2: #6f6b64;
  --tungsten: #f0a34b;
  --tungsten-2: #ffc47e;
  --tungsten-ink: #1a1107;
  --steel: #8fb3b8;
  --ok: #7cc79a;
  --warn: #f0c24b;
  --err: #f07a6b;

  --font-sans: ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI Variable Text", "Segoe UI", Roboto, "Helvetica Neue", Arial, "Noto Sans", sans-serif;
  --font-serif: "Sardav Serif", "Iowan Old Style", "Palatino Linotype", Palatino, Georgia, serif;
  --font-mono: ui-monospace, "SF Mono", "Cascadia Mono", Menlo, Consolas, monospace;

  --r-sm: 8px;
  --r: 12px;
  --r-lg: 18px;
  --r-xl: 26px;
  --shadow: 0 1px 0 rgba(255,255,255,.04) inset, 0 20px 50px -20px rgba(0,0,0,.6);
  --ring: 0 0 0 3px rgba(240, 163, 75, .45);
  --max: 1200px;
  --gutter: clamp(16px, 4vw, 40px);
  color-scheme: dark;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
body {
  margin: 0; background: var(--ink-1); color: var(--bone); font-family: var(--font-sans);
  font-size: 16px; line-height: 1.55; -webkit-font-smoothing: antialiased; text-rendering: optimizeLegibility;
}
img, video, svg { display: block; max-width: 100%; }
a { color: inherit; text-decoration-color: rgba(240,163,75,.5); text-underline-offset: 3px; }
a:hover { color: var(--tungsten-2); }
h1, h2, h3, h4 { line-height: 1.08; margin: 0 0 .5em; letter-spacing: -0.025em; font-weight: 700; }
h1 { font-size: clamp(2.4rem, 6.2vw, 5.2rem); letter-spacing: -0.04em; }
h2 { font-size: clamp(1.8rem, 3.8vw, 3rem); letter-spacing: -0.035em; }
h3 { font-size: 1.2rem; letter-spacing: -0.015em; }
p { margin: 0 0 1em; }
em.serif, .serif { font-family: var(--font-serif); font-style: italic; font-weight: 500; letter-spacing: -0.01em; }
.accent { color: var(--tungsten); }
.muted { color: var(--muted); }
.small { font-size: .875rem; }
.xs { font-size: .78rem; }
.mono { font-family: var(--font-mono); font-size: .85em; }
.eyebrow { font-size: .76rem; letter-spacing: .22em; text-transform: uppercase; color: var(--muted); font-weight: 600; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0; }
.skip-link { position: absolute; left: 12px; top: -60px; z-index: 100; background: var(--bone); color: var(--ink-0); padding: 10px 14px; border-radius: var(--r-sm); font-weight: 600; }
.skip-link:focus { top: 12px; }
:focus-visible { outline: none; box-shadow: var(--ring); border-radius: 6px; }
::selection { background: rgba(240,163,75,.35); color: var(--bone); }

.container { width: 100%; max-width: var(--max); margin: 0 auto; padding: 0 var(--gutter); }
.stack > * + * { margin-top: var(--stack, 1rem); }
.row { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; }
.row.between { justify-content: space-between; }
.grid { display: grid; gap: 20px; }
.grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
@media (max-width: 900px) { .grid-3, .grid-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 640px) { .grid-2, .grid-3, .grid-4 { grid-template-columns: 1fr; } }
.hide-sm { } @media (max-width: 720px) { .hide-sm { display: none !important; } }
.hide-lg { display: none; } @media (max-width: 720px) { .hide-lg { display: initial; } }

/* ───────── Brand ───────── */
.brand { display: inline-flex; align-items: center; gap: 10px; text-decoration: none; color: var(--bone); }
.brand .mark { width: 28px; height: 28px; flex: none; }
.brand .wordmark { height: 13px; width: auto; color: var(--bone); }
.brand:hover { color: var(--bone); }

/* ───────── Buttons ───────── */
.btn {
  --bg: var(--ink-3); --fg: var(--bone); --bd: var(--line-strong);
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 44px; padding: 0 18px;
  border-radius: 999px; border: 1px solid var(--bd); background: var(--bg); color: var(--fg); font: inherit; font-weight: 600;
  font-size: .95rem; letter-spacing: -0.005em; cursor: pointer; text-decoration: none; white-space: nowrap;
  transition: background .15s ease, border-color .15s ease, color .15s ease, transform .15s ease;
}
.btn:hover { --bg: var(--ink-4); color: var(--fg); }
.btn:active { transform: translateY(1px); }
.btn[disabled], .btn[aria-disabled="true"] { opacity: .5; cursor: not-allowed; pointer-events: none; }
.btn-primary { --bg: var(--bone); --fg: var(--ink-0); --bd: var(--bone); }
.btn-primary:hover { --bg: #fffaf1; --fg: var(--ink-0); }
.btn-accent { --bg: var(--tungsten); --fg: var(--tungsten-ink); --bd: var(--tungsten); }
.btn-accent:hover { --bg: var(--tungsten-2); --fg: var(--tungsten-ink); }
.btn-ghost { --bg: transparent; --bd: transparent; }
.btn-ghost:hover { --bg: rgba(244,239,230,.06); }
.btn-outline { --bg: transparent; }
.btn-danger { --bg: transparent; --fg: var(--err); --bd: rgba(240,122,107,.35); }
.btn-danger:hover { --bg: rgba(240,122,107,.08); --fg: var(--err); }
.btn-sm { min-height: 36px; padding: 0 14px; font-size: .86rem; }
.btn-lg { min-height: 54px; padding: 0 26px; font-size: 1.02rem; }
.btn-block { width: 100%; }
.btn .spinner { width: 16px; height: 16px; }

/* ───────── Forms ───────── */
.field { display: grid; gap: 6px; }
.field + .field { margin-top: 14px; }
.grid > .field + .field, .row > .field + .field, .inline-form .field + .field { margin-top: 0; }
.label { font-size: .86rem; font-weight: 600; color: var(--bone-2); }
.hint { font-size: .8rem; color: var(--muted); }
.error-text { font-size: .8rem; color: var(--err); }
.input, .textarea, .select {
  width: 100%; min-height: 46px; padding: 11px 14px; border-radius: var(--r); border: 1px solid var(--line-strong);
  background: var(--ink-2); color: var(--bone); font: inherit; font-size: 1rem; transition: border-color .15s, box-shadow .15s;
}
.textarea { min-height: 120px; resize: vertical; line-height: 1.5; }
.select { appearance: none; background-image: linear-gradient(45deg, transparent 50%, var(--muted) 50%), linear-gradient(135deg, var(--muted) 50%, transparent 50%); background-position: calc(100% - 20px) 50%, calc(100% - 15px) 50%; background-size: 5px 5px; background-repeat: no-repeat; padding-right: 40px; }
.input:hover, .textarea:hover, .select:hover { border-color: rgba(244,239,230,.26); }
.input:focus, .textarea:focus, .select:focus { outline: none; border-color: var(--tungsten); box-shadow: var(--ring); }
.input[aria-invalid="true"], .textarea[aria-invalid="true"] { border-color: var(--err); }
.input::placeholder, .textarea::placeholder { color: var(--muted-2); }
.check { display: inline-flex; gap: 10px; align-items: center; cursor: pointer; font-size: .92rem; }
.check input { width: 18px; height: 18px; accent-color: var(--tungsten); }

/* Segmented control (radio group) */
.seg { display: inline-flex; flex-wrap: wrap; gap: 6px; padding: 5px; border-radius: 14px; background: var(--ink-2); border: 1px solid var(--line); }
.seg label { position: relative; }
.seg input { position: absolute; opacity: 0; inset: 0; cursor: pointer; }
.seg span { display: inline-flex; align-items: center; gap: 6px; min-height: 36px; padding: 0 14px; border-radius: 10px; font-size: .88rem; font-weight: 600; color: var(--bone-2); transition: background .15s, color .15s; }
.seg input:checked + span { background: var(--bone); color: var(--ink-0); }
.seg input:focus-visible + span { box-shadow: var(--ring); }
.seg input:disabled + span { opacity: .4; }

/* ───────── Cards & surfaces ───────── */
.card { background: var(--ink-2); border: 1px solid var(--line); border-radius: var(--r-lg); padding: 22px; }
.card-tight { padding: 16px; }
.card h3 { margin-bottom: .35em; }
.card.hover { transition: border-color .15s, transform .2s; }
.card.hover:hover { border-color: var(--line-strong); }
.surface { background: linear-gradient(180deg, var(--ink-2), var(--ink-1)); border: 1px solid var(--line); border-radius: var(--r-xl); }
.divider { height: 1px; background: var(--line); border: 0; margin: 24px 0; }

.badge { display: inline-flex; align-items: center; gap: 6px; padding: 3px 10px; border-radius: 999px; font-size: .74rem; font-weight: 700; letter-spacing: .02em; border: 1px solid var(--line-strong); color: var(--bone-2); background: rgba(244,239,230,.04); white-space: nowrap; }
.badge-ok { color: var(--ok); border-color: rgba(124,199,154,.35); background: rgba(124,199,154,.07); }
.badge-warn { color: var(--warn); border-color: rgba(240,194,75,.35); background: rgba(240,194,75,.07); }
.badge-err { color: var(--err); border-color: rgba(240,122,107,.35); background: rgba(240,122,107,.07); }
.badge-accent { color: var(--tungsten-2); border-color: rgba(240,163,75,.4); background: rgba(240,163,75,.08); }
.badge-dot::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.credit-badge { display: inline-flex; align-items: center; gap: 8px; padding: 6px 12px; border-radius: 999px; border: 1px solid rgba(240,163,75,.35); background: rgba(240,163,75,.08); font-weight: 700; font-size: .88rem; color: var(--tungsten-2); text-decoration: none; }
.credit-badge svg { width: 14px; height: 14px; }

.notice { display: flex; gap: 12px; align-items: flex-start; padding: 14px 16px; border-radius: var(--r); border: 1px solid var(--line-strong); background: var(--ink-2); font-size: .92rem; }
.notice-warn { border-color: rgba(240,194,75,.35); background: rgba(240,194,75,.06); }
.notice-err { border-color: rgba(240,122,107,.4); background: rgba(240,122,107,.06); }
.notice-ok { border-color: rgba(124,199,154,.35); background: rgba(124,199,154,.06); }
.notice-info { border-color: rgba(143,179,184,.35); background: rgba(143,179,184,.06); }
.notice strong { display: block; margin-bottom: 2px; }

/* ───────── Marketing header / footer ───────── */
.site-header { position: sticky; top: 0; z-index: 40; backdrop-filter: saturate(140%) blur(14px); -webkit-backdrop-filter: saturate(140%) blur(14px); background: rgba(12,12,14,.72); border-bottom: 1px solid var(--line); }
.site-header .inner { display: flex; align-items: center; justify-content: space-between; height: 68px; gap: 16px; }
.site-nav { display: flex; align-items: center; gap: 4px; }
.site-nav a { padding: 8px 12px; border-radius: 999px; text-decoration: none; color: var(--bone-2); font-size: .92rem; font-weight: 500; }
.site-nav a:hover, .site-nav a[aria-current="page"] { color: var(--bone); background: rgba(244,239,230,.06); }
.header-cta { display: flex; gap: 8px; align-items: center; }
.menu-toggle { display: none; }
@media (max-width: 900px) {
  .site-nav { display: none; position: absolute; top: 68px; left: 0; right: 0; flex-direction: column; align-items: stretch; padding: 12px var(--gutter) 20px; background: var(--ink-1); border-bottom: 1px solid var(--line); }
  .site-nav.open { display: flex; }
  .site-nav a { padding: 12px; font-size: 1rem; }
  .menu-toggle { display: inline-flex; }
  .header-cta .btn-ghost:not(.menu-toggle) { display: none; }
}
.site-footer { border-top: 1px solid var(--line); margin-top: 96px; padding: 56px 0 40px; color: var(--muted); font-size: .9rem; }
.footer-grid { display: grid; grid-template-columns: 1.4fr repeat(4, 1fr); gap: 28px; }
.footer-grid h4 { font-size: .78rem; letter-spacing: .18em; text-transform: uppercase; color: var(--bone-2); margin-bottom: 14px; }
.footer-grid ul { list-style: none; padding: 0; margin: 0; display: grid; gap: 8px; }
.footer-grid a { text-decoration: none; color: var(--muted); }
.footer-grid a:hover { color: var(--bone); }
@media (max-width: 900px) { .footer-grid { grid-template-columns: 1fr 1fr; } .footer-grid > :first-child { grid-column: 1 / -1; } }

/* ───────── Hero ───────── */
.hero { position: relative; padding: clamp(40px, 6vw, 72px) 0 clamp(40px, 7vw, 80px); overflow: hidden; }
.hero::before { content: ""; position: absolute; inset: -20% -10% auto -10%; height: 90%; background:
  radial-gradient(60% 55% at 70% 20%, rgba(240,163,75,.16), transparent 60%),
  radial-gradient(40% 50% at 15% 30%, rgba(143,179,184,.08), transparent 60%); pointer-events: none; }
.hero .container { position: relative; }
.hero h1 { max-width: 16ch; font-size: clamp(2.4rem, 5.6vw, 4.6rem); }
.hero .lede { font-size: clamp(1.02rem, 1.5vw, 1.22rem); color: var(--bone-2); max-width: 60ch; margin: 18px 0 0; }
.hero-actions { display: flex; gap: 12px; flex-wrap: wrap; }
.hero-meta { display: flex; gap: 22px; flex-wrap: wrap; align-items: center; margin-top: 22px; color: var(--muted); font-size: .88rem; }
.hero-meta span { display: inline-flex; gap: 8px; align-items: center; }
.hero-meta svg { width: 16px; height: 16px; color: var(--tungsten); }

/* Choice cards — "What do you want to create?" */
.choice-wrap { margin-top: clamp(28px, 4vw, 44px); }
.choice-title { font-size: .8rem; letter-spacing: .22em; text-transform: uppercase; color: var(--muted); margin-bottom: 16px; font-weight: 600; }
.choice-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }
@media (max-width: 760px) { .choice-grid { grid-template-columns: 1fr; } }
.choice { position: relative; display: grid; grid-template-rows: auto 1fr auto; min-height: 300px; padding: 26px; border-radius: var(--r-xl); border: 1px solid var(--line-strong); text-decoration: none; overflow: hidden; background: var(--ink-2); isolation: isolate; transition: border-color .2s, transform .25s; }
.choice:hover { border-color: rgba(240,163,75,.55); color: var(--bone); transform: translateY(-2px); }
.choice .scene { position: absolute; inset: 0; z-index: -1; }
.choice .scene::after { content: ""; position: absolute; inset: 0; background: linear-gradient(180deg, rgba(12,12,14,.1) 0%, rgba(12,12,14,.55) 55%, rgba(12,12,14,.94) 100%); }
.choice h2 { font-size: clamp(1.7rem, 3vw, 2.4rem); margin: 0; }
.choice p { color: var(--bone-2); max-width: 36ch; margin: 10px 0 0; }
.choice .go { display: inline-flex; align-items: center; gap: 10px; margin-top: 22px; font-weight: 700; }
.choice .go svg { width: 18px; height: 18px; transition: transform .2s; }
.choice:hover .go svg { transform: translateX(4px); }
.choice .tag { justify-self: start; }

/* Film-frame art (pure CSS/SVG, no stock imagery) */
.frame-art { position: absolute; inset: 0; overflow: hidden; }
.frame-art .sky { position: absolute; inset: 0; }
.art-video .sky { background: radial-gradient(120% 80% at 80% 0%, #3a2a1a 0%, #17130f 45%, #0d0d10 80%); }
.art-ad .sky { background: radial-gradient(100% 80% at 20% 10%, #1d2a2c 0%, #121719 45%, #0d0d10 80%); }
.frame-art .sun { position: absolute; width: 34%; aspect-ratio: 1; right: 7%; top: 12%; border-radius: 50%; background: radial-gradient(circle at 40% 40%, #ffd79e, #f0a34b 45%, rgba(240,163,75,0) 70%); filter: blur(2px); opacity: .9; }
.frame-art .horizon { position: absolute; left: 48%; right: 0; bottom: 34%; height: 1px; background: linear-gradient(90deg, transparent, rgba(255,215,158,.5), transparent); }
.frame-art .dunes { position: absolute; left: -10%; right: -10%; bottom: 0; height: 40%; background: radial-gradient(60% 100% at 30% 100%, #1e1812, transparent 70%), radial-gradient(70% 100% at 80% 100%, #15120e, transparent 70%); }
.frame-art .product { position: absolute; left: 76%; bottom: 34%; width: 18%; aspect-ratio: 1 / 1.45; transform: translateX(-50%); border-radius: 14px 14px 10px 10px; background: linear-gradient(160deg, rgba(255,255,255,.26), rgba(255,255,255,.04) 40%, rgba(143,179,184,.18) 70%, rgba(255,255,255,.08)); border: 1px solid rgba(255,255,255,.2); box-shadow: 0 30px 60px -20px rgba(0,0,0,.8), inset 0 0 30px rgba(143,179,184,.2); }
.frame-art .product::before { content: ""; position: absolute; left: 32%; right: 32%; top: -18%; height: 18%; border-radius: 6px 6px 2px 2px; background: linear-gradient(180deg, #d9b27a, #8a6a3e); }
.frame-art .product::after { content: ""; position: absolute; left: 18%; right: 18%; top: 42%; height: 16%; border-radius: 3px; background: rgba(12,12,14,.55); }
.frame-art .glow { position: absolute; left: 76%; bottom: 30%; width: 46%; height: 8%; transform: translateX(-50%); background: radial-gradient(closest-side, rgba(143,179,184,.35), transparent); filter: blur(6px); }
.frame-art .bars::before, .frame-art .bars::after { content: ""; position: absolute; left: 0; right: 0; height: 5%; background: rgba(0,0,0,.85); z-index: 2; }
.frame-art .bars::before { top: 0; } .frame-art .bars::after { bottom: 0; }
.frame-art .grain { position: absolute; inset: 0; opacity: .12; background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='120' height='120'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='.9' numOctaves='2' stitchTiles='stitch'/></filter><rect width='100%' height='100%' filter='url(%23n)' opacity='.6'/></svg>"); mix-blend-mode: overlay; }

/* ───────── Sections ───────── */
.section { padding: clamp(56px, 9vw, 110px) 0; }
.section-head { max-width: 760px; margin-bottom: 44px; }
.section-head p { color: var(--bone-2); font-size: 1.08rem; }
.section-head .eyebrow { font-size: .76rem; color: var(--muted); margin-bottom: 14px; }
.feature { padding: 26px; border-radius: var(--r-lg); border: 1px solid var(--line); background: var(--ink-2); }
.feature .ico { width: 40px; height: 40px; border-radius: 12px; display: grid; place-items: center; background: rgba(240,163,75,.1); color: var(--tungsten); margin-bottom: 16px; }
.feature .ico svg { width: 20px; height: 20px; }
.feature p { color: var(--muted); margin: 0; font-size: .95rem; }
.steps { counter-reset: step; display: grid; gap: 16px; }
.step { position: relative; padding: 22px 22px 22px 70px; border-radius: var(--r-lg); border: 1px solid var(--line); background: var(--ink-2); }
.step::before { counter-increment: step; content: counter(step, decimal-leading-zero); position: absolute; left: 22px; top: 22px; font-family: var(--font-mono); color: var(--tungsten); font-size: .9rem; }
.step h3 { margin: 0 0 4px; font-size: 1.05rem; }
.step p { margin: 0; color: var(--muted); font-size: .95rem; }
.pipeline { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.pipeline span { padding: 8px 14px; border-radius: 999px; border: 1px solid var(--line-strong); font-size: .86rem; color: var(--bone-2); background: var(--ink-2); }
.pipeline i { color: var(--muted-2); font-style: normal; }
.quote-block { font-family: var(--font-serif); font-style: italic; font-size: clamp(1.4rem, 2.6vw, 2rem); line-height: 1.3; color: var(--bone); }
.cta-band { padding: clamp(40px, 6vw, 72px); border-radius: var(--r-xl); border: 1px solid var(--line-strong); background: radial-gradient(80% 120% at 100% 0%, rgba(240,163,75,.18), transparent 60%), var(--ink-2); }
.faq details { border-bottom: 1px solid var(--line); padding: 18px 0; }
.faq summary { cursor: pointer; font-weight: 600; font-size: 1.05rem; list-style: none; display: flex; justify-content: space-between; gap: 16px; }
.faq summary::-webkit-details-marker { display: none; }
.faq summary::after { content: "+"; color: var(--tungsten); font-weight: 400; font-size: 1.3rem; line-height: 1; }
.faq details[open] summary::after { content: "–"; }
.faq details p { color: var(--bone-2); margin: 12px 0 0; }
.breadcrumbs { font-size: .84rem; color: var(--muted); margin-bottom: 18px; }
.breadcrumbs ol { list-style: none; display: flex; flex-wrap: wrap; gap: 8px; padding: 0; margin: 0; }
.breadcrumbs li + li::before { content: "/"; margin-right: 8px; color: var(--muted-2); }
.breadcrumbs a { text-decoration: none; color: var(--muted); }
.breadcrumbs a:hover { color: var(--bone); }
.prose { max-width: 72ch; }
.prose h2 { font-size: 1.6rem; margin-top: 2em; }
.prose h3 { margin-top: 1.6em; }
.prose p, .prose li { color: var(--bone-2); }
.prose ul { padding-left: 1.2em; }
.kbd-list { display: flex; flex-wrap: wrap; gap: 8px; }
.kbd-list span { padding: 6px 12px; border-radius: 999px; border: 1px solid var(--line); font-size: .84rem; color: var(--bone-2); }
.compare { width: 100%; border-collapse: collapse; font-size: .95rem; }
.compare th, .compare td { text-align: left; padding: 14px 12px; border-bottom: 1px solid var(--line); vertical-align: top; }
.compare th { color: var(--muted); font-weight: 600; font-size: .8rem; letter-spacing: .08em; text-transform: uppercase; }

/* Prompt demo (interactive on SEO pages) */
.demo { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }
@media (max-width: 860px) { .demo { grid-template-columns: 1fr; } }
.demo pre { white-space: pre-wrap; word-break: break-word; margin: 0; font-family: var(--font-mono); font-size: .84rem; line-height: 1.6; color: var(--bone-2); background: var(--ink-0); border: 1px solid var(--line); border-radius: var(--r); padding: 16px; min-height: 180px; }

/* ───────── App shell ───────── */
.app { display: grid; grid-template-columns: 248px 1fr; min-height: 100vh; }
.sidebar { position: sticky; top: 0; height: 100vh; display: flex; flex-direction: column; gap: 6px; padding: 18px 14px; border-right: 1px solid var(--line); background: var(--ink-0); }
.sidebar .brand { padding: 6px 10px 18px; }
.side-nav { display: grid; gap: 2px; }
.side-nav a { display: flex; align-items: center; gap: 12px; padding: 10px 12px; border-radius: 10px; text-decoration: none; color: var(--bone-2); font-size: .93rem; font-weight: 500; }
.side-nav a svg { width: 18px; height: 18px; color: var(--muted); flex: none; }
.side-nav a:hover { background: rgba(244,239,230,.05); color: var(--bone); }
.side-nav a[aria-current="page"] { background: rgba(244,239,230,.08); color: var(--bone); }
.side-nav a[aria-current="page"] svg { color: var(--tungsten); }
.side-nav .sep { height: 1px; background: var(--line); margin: 10px 8px; }
.side-foot { margin-top: auto; display: grid; gap: 10px; padding: 12px 8px 0; border-top: 1px solid var(--line); }
.user-chip { display: flex; align-items: center; gap: 10px; font-size: .85rem; color: var(--bone-2); min-width: 0; }
.user-chip .avatar { width: 30px; height: 30px; border-radius: 50%; display: grid; place-items: center; background: var(--ink-4); font-weight: 700; font-size: .8rem; flex: none; }
.user-chip span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.main { min-width: 0; }
.topbar { position: sticky; top: 0; z-index: 30; display: flex; align-items: center; justify-content: space-between; gap: 12px; height: 64px; padding: 0 28px; border-bottom: 1px solid var(--line); background: rgba(12,12,14,.82); backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px); }
.topbar h1 { font-size: 1.15rem; margin: 0; letter-spacing: -0.02em; }
.page { padding: 28px; max-width: 1280px; }
.page-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 16px; flex-wrap: wrap; margin-bottom: 24px; }
.page-head h2 { font-size: 1.7rem; margin: 0; }
.page-head p { margin: 6px 0 0; color: var(--muted); }
.mobile-nav-toggle { display: none; }
@media (max-width: 900px) {
  .app { grid-template-columns: 1fr; }
  .sidebar { position: fixed; inset: 0 auto 0 0; width: 280px; z-index: 60; transform: translateX(-100%); transition: transform .2s ease; }
  .sidebar.open { transform: translateX(0); box-shadow: 0 0 0 100vmax rgba(0,0,0,.55); }
  .mobile-nav-toggle { display: inline-flex; }
  .topbar { padding: 0 16px; }
  .page { padding: 20px 16px; }
}

.stat { padding: 20px; border-radius: var(--r-lg); border: 1px solid var(--line); background: var(--ink-2); }
.stat .k { font-size: .78rem; color: var(--muted); letter-spacing: .1em; text-transform: uppercase; font-weight: 600; }
.stat .v { font-size: 2rem; font-weight: 700; letter-spacing: -0.03em; margin-top: 6px; font-variant-numeric: tabular-nums; }
.stat .d { font-size: .82rem; color: var(--muted); }

.table-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: var(--r-lg); }
.table { width: 100%; border-collapse: collapse; font-size: .9rem; }
.table th, .table td { padding: 12px 14px; text-align: left; border-bottom: 1px solid var(--line); white-space: nowrap; }
.table th { font-size: .74rem; letter-spacing: .1em; text-transform: uppercase; color: var(--muted); font-weight: 600; background: var(--ink-2); }
.table tr:last-child td { border-bottom: 0; }
.table td.num, .table th.num { text-align: right; font-variant-numeric: tabular-nums; }
.table a { text-decoration: none; }
.table a:hover { text-decoration: underline; }

/* Quick actions */
.quick { display: grid; grid-template-columns: repeat(2, 1fr); gap: 16px; }
@media (max-width: 700px) { .quick { grid-template-columns: 1fr; } }
.quick a { display: flex; gap: 16px; align-items: center; padding: 22px; border-radius: var(--r-lg); border: 1px solid var(--line-strong); background: var(--ink-2); text-decoration: none; transition: border-color .2s; }
.quick a:hover { border-color: rgba(240,163,75,.5); color: var(--bone); }
.quick .qi { width: 48px; height: 48px; border-radius: 14px; display: grid; place-items: center; background: rgba(240,163,75,.1); color: var(--tungsten); flex: none; }
.quick .qi svg { width: 22px; height: 22px; }
.quick strong { display: block; font-size: 1.05rem; }
.quick span { color: var(--muted); font-size: .9rem; }

/* Generation / media cards */
.gen-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 16px; }
.gen-card { border-radius: var(--r-lg); border: 1px solid var(--line); background: var(--ink-2); overflow: hidden; display: flex; flex-direction: column; }
.gen-card .thumb { position: relative; aspect-ratio: 16 / 10; background: var(--ink-0); display: grid; place-items: center; overflow: hidden; }
.gen-card .thumb video, .gen-card .thumb img { width: 100%; height: 100%; object-fit: cover; }
.gen-card .thumb .ph { color: var(--muted-2); font-size: .8rem; text-align: center; padding: 12px; }
.gen-card .body { padding: 14px; display: grid; gap: 8px; }
.gen-card .prompt { font-size: .88rem; color: var(--bone-2); display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.gen-card .meta { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; }
.gen-card .actions { display: flex; gap: 6px; flex-wrap: wrap; padding: 0 14px 14px; }
.test-ribbon { position: absolute; top: 10px; left: 10px; z-index: 2; }

/* Video player */
.player { position: relative; border-radius: var(--r-lg); overflow: hidden; background: #000; border: 1px solid var(--line); }
.player video { width: 100%; height: auto; max-height: 70vh; background: #000; }
.player.r916 video { max-height: 72vh; width: auto; margin: 0 auto; }

/* Upload zone */
.upload-zone { position: relative; display: grid; place-items: center; gap: 8px; text-align: center; padding: 28px 18px; border-radius: var(--r-lg); border: 1.5px dashed var(--line-strong); background: var(--ink-2); color: var(--muted); transition: border-color .15s, background .15s; cursor: pointer; }
.upload-zone:hover, .upload-zone.drag { border-color: var(--tungsten); background: rgba(240,163,75,.05); color: var(--bone-2); }
.upload-zone input[type=file] { position: absolute; inset: 0; opacity: 0; cursor: pointer; }
.upload-zone svg { width: 28px; height: 28px; color: var(--tungsten); }
.thumbs { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 12px; }
.thumbs .t { position: relative; width: 84px; height: 84px; border-radius: 12px; overflow: hidden; border: 1px solid var(--line-strong); background: var(--ink-0); }
.thumbs .t img { width: 100%; height: 100%; object-fit: cover; }
.thumbs .t button { position: absolute; top: 4px; right: 4px; width: 24px; height: 24px; border-radius: 50%; border: 0; background: rgba(0,0,0,.7); color: #fff; cursor: pointer; display: grid; place-items: center; font-size: 14px; line-height: 1; }
.thumbs .t.pending { opacity: .5; }

/* Studio layout */
.studio { display: grid; grid-template-columns: minmax(0, 1.25fr) minmax(320px, .75fr); gap: 22px; align-items: start; }
@media (max-width: 1080px) { .studio { grid-template-columns: 1fr; } }
.studio .panel { position: sticky; top: 84px; }
.prompt-editor { position: relative; }
.prompt-editor .textarea { min-height: 150px; font-size: 1.05rem; padding: 16px; }
.prompt-editor .count { position: absolute; right: 12px; bottom: 10px; font-size: .75rem; color: var(--muted-2); }
.enhanced { border: 1px solid rgba(240,163,75,.35); border-radius: var(--r-lg); background: rgba(240,163,75,.04); padding: 16px; }
.spec-grid { display: grid; grid-template-columns: repeat(2, minmax(0,1fr)); gap: 8px 16px; font-size: .84rem; margin-top: 12px; }
.spec-grid div { color: var(--muted); } .spec-grid b { display: block; color: var(--bone-2); font-weight: 600; font-size: .72rem; letter-spacing: .1em; text-transform: uppercase; }
@media (max-width: 600px) { .spec-grid { grid-template-columns: 1fr; } }
.opt-row { display: grid; gap: 8px; }
.opt-row + .opt-row { margin-top: 18px; }
.estimate { display: flex; justify-content: space-between; align-items: center; padding: 14px 16px; border-radius: var(--r); background: var(--ink-0); border: 1px solid var(--line); font-size: .92rem; }
.estimate strong { font-size: 1.2rem; color: var(--tungsten-2); font-variant-numeric: tabular-nums; }

/* Progress */
.progress { height: 6px; border-radius: 999px; background: var(--ink-4); overflow: hidden; }
.progress > span { display: block; height: 100%; width: var(--p, 30%); background: linear-gradient(90deg, var(--tungsten), var(--tungsten-2)); border-radius: 999px; transition: width .5s ease; }
.progress.indeterminate > span { width: 35%; animation: indet 1.4s ease-in-out infinite; }
@keyframes indet { 0% { transform: translateX(-100%); } 100% { transform: translateX(300%); } }
.status-line { display: flex; align-items: center; gap: 10px; font-size: .9rem; color: var(--bone-2); }
.spinner { width: 18px; height: 18px; border-radius: 50%; border: 2px solid rgba(244,239,230,.2); border-top-color: var(--tungsten); animation: spin .8s linear infinite; flex: none; }
@keyframes spin { to { transform: rotate(360deg); } }

/* Skeleton */
.skeleton { background: linear-gradient(90deg, var(--ink-3) 0%, var(--ink-4) 50%, var(--ink-3) 100%); background-size: 200% 100%; animation: shimmer 1.4s linear infinite; border-radius: var(--r-sm); min-height: 14px; }
@keyframes shimmer { 0% { background-position: 200% 0; } 100% { background-position: -200% 0; } }

/* Empty / error states */
.empty { text-align: center; padding: 56px 20px; border: 1px dashed var(--line-strong); border-radius: var(--r-lg); color: var(--muted); }
.empty svg { width: 36px; height: 36px; margin: 0 auto 14px; color: var(--muted-2); }
.empty h3 { color: var(--bone); margin-bottom: 6px; }
.empty p { max-width: 44ch; margin: 0 auto 18px; }

/* Ad creator wizard */
.wizard-steps { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 22px; }
.wizard-steps li { list-style: none; display: inline-flex; align-items: center; gap: 8px; padding: 8px 14px; border-radius: 999px; border: 1px solid var(--line); font-size: .84rem; color: var(--muted); }
.wizard-steps li[aria-current="step"] { color: var(--ink-0); background: var(--bone); border-color: var(--bone); font-weight: 700; }
.wizard-steps li.done { color: var(--bone-2); border-color: var(--line-strong); }
.wizard-steps li.done::before { content: "✓"; color: var(--ok); }
.wizard-steps { padding: 0; margin-top: 0; }
.tabs { display: flex; gap: 6px; border-bottom: 1px solid var(--line); margin-bottom: 18px; overflow-x: auto; }
.tabs button { background: none; border: 0; color: var(--muted); font: inherit; font-weight: 600; padding: 12px 14px; cursor: pointer; border-bottom: 2px solid transparent; white-space: nowrap; }
.tabs button[aria-selected="true"] { color: var(--bone); border-bottom-color: var(--tungsten); }
.hook-list { display: grid; gap: 8px; }
.hook-list label { display: flex; gap: 12px; align-items: flex-start; padding: 12px 14px; border-radius: var(--r); border: 1px solid var(--line); cursor: pointer; background: var(--ink-2); }
.hook-list input { margin-top: 4px; accent-color: var(--tungsten); }
.hook-list label:has(input:checked) { border-color: rgba(240,163,75,.55); background: rgba(240,163,75,.05); }
.hook-list .input { min-height: 38px; padding: 8px 10px; }

.scene-list { display: grid; gap: 14px; }
.scene { display: grid; grid-template-columns: 220px 1fr; gap: 18px; padding: 16px; border-radius: var(--r-lg); border: 1px solid var(--line); background: var(--ink-2); }
@media (max-width: 800px) { .scene { grid-template-columns: 1fr; } }
.scene .preview { aspect-ratio: 9 / 16; max-height: 320px; width: 100%; border-radius: 12px; background: var(--ink-0); display: grid; place-items: center; overflow: hidden; border: 1px solid var(--line); position: relative; }
.scene .preview.r169 { aspect-ratio: 16 / 9; }
.scene .preview.r11 { aspect-ratio: 1; }
.scene .preview video { width: 100%; height: 100%; object-fit: cover; }
.scene .preview .ph { color: var(--muted-2); font-size: .8rem; padding: 12px; text-align: center; }
.scene .num { font-family: var(--font-mono); color: var(--tungsten); font-size: .85rem; }
.scene .fields { display: grid; gap: 10px; min-width: 0; }
.scene .fields .grid { gap: 10px; }
.scene .tools { display: flex; flex-wrap: wrap; gap: 6px; }
.scene textarea.textarea { min-height: 72px; font-size: .92rem; }
.scene details summary { cursor: pointer; font-size: .84rem; color: var(--muted); }
.scene details pre { white-space: pre-wrap; font-family: var(--font-mono); font-size: .78rem; color: var(--bone-2); background: var(--ink-0); border-radius: 10px; padding: 12px; border: 1px solid var(--line); }

/* Modal (native <dialog>) */
dialog.modal { border: 1px solid var(--line-strong); border-radius: var(--r-xl); background: var(--ink-2); color: var(--bone); padding: 0; width: min(560px, calc(100vw - 32px)); box-shadow: 0 40px 100px -20px rgba(0,0,0,.8); }
dialog.modal::backdrop { background: rgba(0,0,0,.6); backdrop-filter: blur(4px); }
dialog.modal .mh { display: flex; justify-content: space-between; align-items: center; padding: 18px 22px; border-bottom: 1px solid var(--line); }
dialog.modal .mh h2 { font-size: 1.15rem; margin: 0; }
dialog.modal .mb { padding: 22px; }
dialog.modal .mf { display: flex; justify-content: flex-end; gap: 8px; padding: 16px 22px; border-top: 1px solid var(--line); }

/* Toasts */
.toasts { position: fixed; right: 16px; bottom: 16px; z-index: 90; display: grid; gap: 8px; width: min(380px, calc(100vw - 32px)); }
.toast { padding: 12px 16px; border-radius: var(--r); background: var(--ink-3); border: 1px solid var(--line-strong); box-shadow: var(--shadow); font-size: .92rem; animation: toast-in .2s ease; }
.toast.err { border-color: rgba(240,122,107,.5); }
.toast.ok { border-color: rgba(124,199,154,.45); }
@keyframes toast-in { from { opacity: 0; transform: translateY(8px); } }

/* Auth pages */
.auth-wrap { min-height: 100vh; display: grid; grid-template-columns: 1fr 1fr; }
.auth-art { position: relative; overflow: hidden; border-right: 1px solid var(--line); }
.auth-art .copy { position: absolute; left: 40px; right: 40px; bottom: 44px; z-index: 3; }
.auth-form { display: grid; place-items: center; padding: 40px var(--gutter); }
.auth-form .box { width: 100%; max-width: 400px; }
.auth-form h1 { font-size: 2rem; margin-bottom: 8px; }
.or { display: flex; align-items: center; gap: 12px; color: var(--muted); font-size: .8rem; margin: 18px 0; }
.or::before, .or::after { content: ""; flex: 1; height: 1px; background: var(--line); }
@media (max-width: 860px) { .auth-wrap { grid-template-columns: 1fr; } .auth-art { display: none; } }

/* Admin */
.kv { display: grid; grid-template-columns: 180px 1fr; gap: 8px 16px; font-size: .9rem; }
.kv dt { color: var(--muted); } .kv dd { margin: 0; word-break: break-word; }
.inline-form { display: flex; gap: 8px; align-items: end; flex-wrap: wrap; }
.inline-form .input, .inline-form .select { min-height: 38px; padding: 7px 10px; width: auto; }
.inline-form .field + .field { margin-top: 0; }

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