/* ==========================================================================
   Rest API Seedance 2.5 by Vidgen — Design System "Chrome Noir"
   --------------------------------------------------------------------------
   Dark, layered, chrome-cool surfaces with the VG brand gradient (blue →
   cyan → magenta) used deliberately as accent, not as a generic wash.
   Type: Bricolage Grotesque (display) · Manrope (body) · JetBrains Mono (code).
   All assets self-hosted to satisfy CSP: script-src 'self'; font-src 'self'.
   ========================================================================== */

/* --------------------------------------------------------------------------
   1. Fonts
   -------------------------------------------------------------------------- */
@font-face {
  font-family: 'Bricolage Grotesque';
  src: url('./fonts/bricolage.woff2') format('woff2');
  font-weight: 200 800;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: 'Manrope';
  src: url('./fonts/manrope.woff2') format('woff2');
  font-weight: 200 800;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: 'JetBrains Mono';
  src: url('./fonts/jetbrains-mono.woff2') format('woff2');
  font-weight: 100 800;
  font-style: normal;
  font-display: swap;
}

/* --------------------------------------------------------------------------
   2. Tokens
   -------------------------------------------------------------------------- */
:root {
  /* surfaces — near-black, blue-tinted, layered */
  --bg-0: #06080c;
  --bg-1: #0a0e14;
  --bg-2: #0e141d;
  --bg-3: #131b26;
  --bg-4: #1a2432;
  --bg-inset: #080b10;

  /* hairlines */
  --line-1: rgba(148, 180, 255, 0.08);
  --line-2: rgba(148, 180, 255, 0.14);
  --line-3: rgba(148, 180, 255, 0.22);

  /* text */
  --tx-1: #eaf0fa;
  --tx-2: #a7b6cc;
  --tx-3: #74849b;
  --tx-inv: #06080c;

  /* brand (from VG logo) */
  --blue: #2f7bff;
  --cyan: #22d3ee;
  --magenta: #d24bff;
  --brand-grad: linear-gradient(120deg, var(--blue) 0%, var(--cyan) 52%, var(--magenta) 100%);
  --brand-grad-soft: linear-gradient(120deg, rgba(47, 123, 255, .18), rgba(34, 211, 238, .14) 52%, rgba(210, 75, 255, .16));
  --accent: var(--cyan);
  --accent-ink: #04252b;

  /* semantic */
  --ok: #2dd4a7;
  --ok-bg: rgba(45, 212, 167, .12);
  --warn: #f5b544;
  --warn-bg: rgba(245, 181, 68, .12);
  --bad: #fb7185;
  --bad-bg: rgba(251, 113, 133, .12);
  --info: #58a6ff;
  --info-bg: rgba(88, 166, 255, .12);
  --idle: #7d8ca3;
  --idle-bg: rgba(125, 140, 163, .12);

  /* type */
  --font-display: 'Bricolage Grotesque', 'Manrope', system-ui, sans-serif;
  --font-body: 'Manrope', system-ui, -apple-system, sans-serif;
  --font-mono: 'JetBrains Mono', ui-monospace, 'SF Mono', monospace;

  /* spacing scale */
  --s-1: 4px;  --s-2: 8px;  --s-3: 12px; --s-4: 16px;
  --s-5: 24px; --s-6: 32px; --s-7: 48px; --s-8: 64px; --s-9: 96px;

  /* radii — varied on purpose */
  --r-xs: 6px; --r-sm: 10px; --r-md: 14px; --r-lg: 20px; --r-xl: 28px; --r-pill: 999px;

  /* elevation */
  --sh-1: 0 1px 2px rgba(0, 0, 0, .5);
  --sh-2: 0 8px 24px -8px rgba(0, 0, 0, .6);
  --sh-3: 0 24px 60px -20px rgba(0, 0, 0, .7);
  --glow-cyan: 0 0 0 1px rgba(34, 211, 238, .25), 0 8px 32px -8px rgba(34, 211, 238, .35);
  --glow-brand: 0 8px 40px -10px rgba(47, 123, 255, .45);

  /* motion */
  --ease: cubic-bezier(.22, .68, .32, 1);
  --t-fast: 120ms; --t-med: 220ms; --t-slow: 420ms;

  /* layout */
  --w-narrow: 860px;
  --w-main: 1180px;
  --w-wide: 1420px;
  --topbar-h: 64px;

  color-scheme: dark;
}

/* --------------------------------------------------------------------------
   3. Reset & base
   -------------------------------------------------------------------------- */
*, *::before, *::after { box-sizing: border-box; }
* { margin: 0; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
html:focus-within { scroll-behavior: smooth; }

body {
  min-height: 100vh;
  background: var(--bg-0);
  color: var(--tx-1);
  font-family: var(--font-body);
  font-size: 16px;
  line-height: 1.6;
  font-weight: 400;
  letter-spacing: .005em;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  overflow-x: hidden;
}

/* ambient chrome glow + fine noise, fixed behind content */
body::before {
  content: '';
  position: fixed;
  inset: 0;
  z-index: -2;
  background:
    radial-gradient(900px 480px at 12% -8%, rgba(47, 123, 255, .16), transparent 60%),
    radial-gradient(760px 420px at 88% 4%, rgba(210, 75, 255, .10), transparent 62%),
    radial-gradient(1000px 600px at 50% 110%, rgba(34, 211, 238, .07), transparent 60%),
    var(--bg-0);
  pointer-events: none;
}
body::after {
  content: '';
  position: fixed;
  inset: 0;
  z-index: -1;
  opacity: .035;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='140' height='140'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.85' numOctaves='2'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
  pointer-events: none;
}

img, svg, video, canvas { display: block; max-width: 100%; }
img { height: auto; }
input, button, textarea, select { font: inherit; color: inherit; }
button { background: none; border: 0; cursor: pointer; }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; text-underline-offset: 3px; }
ul, ol { padding: 0; list-style: none; }
table { border-collapse: collapse; width: 100%; }
code, kbd, pre, samp { font-family: var(--font-mono); }
hr { border: 0; border-top: 1px solid var(--line-1); }

::selection { background: rgba(34, 211, 238, .28); color: var(--tx-1); }

/* scrollbar */
* { scrollbar-width: thin; scrollbar-color: var(--bg-4) transparent; }
*::-webkit-scrollbar { width: 10px; height: 10px; }
*::-webkit-scrollbar-thumb { background: var(--bg-4); border-radius: 8px; border: 2px solid var(--bg-0); }
*::-webkit-scrollbar-track { background: transparent; }

/* focus + a11y */
:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
  border-radius: var(--r-xs);
}
.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: var(--s-4); top: -60px; z-index: 200;
  background: var(--bg-3); color: var(--tx-1); padding: var(--s-3) var(--s-4);
  border-radius: var(--r-sm); border: 1px solid var(--line-2); transition: top var(--t-fast) var(--ease);
}
.skip-link:focus { top: var(--s-4); }

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

/* --------------------------------------------------------------------------
   4. Typography
   -------------------------------------------------------------------------- */
h1, h2, h3, h4, .display {
  font-family: var(--font-display);
  font-weight: 700;
  line-height: 1.12;
  letter-spacing: -.02em;
  color: var(--tx-1);
  text-wrap: balance;
}
h1 { font-size: clamp(2.1rem, 4.6vw, 3.4rem); font-weight: 800; }
h2 { font-size: clamp(1.5rem, 2.6vw, 2.1rem); }
h3 { font-size: 1.22rem; }
h4 { font-size: 1.02rem; }
.display-xl { font-size: clamp(2.6rem, 6vw, 4.4rem); font-weight: 800; letter-spacing: -.03em; }

p { color: var(--tx-2); }
.lead { font-size: 1.12rem; color: var(--tx-2); line-height: 1.65; }
.muted { color: var(--tx-3); }
.small { font-size: .85rem; }
.tiny { font-size: .75rem; }
.mono { font-family: var(--font-mono); font-size: .9em; letter-spacing: -.01em; }
.strong { font-weight: 700; color: var(--tx-1); }

.eyebrow {
  display: inline-flex; align-items: center; gap: var(--s-2);
  font-family: var(--font-mono); font-size: .72rem; font-weight: 600;
  letter-spacing: .18em; text-transform: uppercase; color: var(--accent);
}
.eyebrow::before { content: ''; width: 22px; height: 1px; background: var(--brand-grad); }

.gradient-text {
  background: var(--brand-grad);
  -webkit-background-clip: text; background-clip: text;
  -webkit-text-fill-color: transparent; color: transparent;
}

/* --------------------------------------------------------------------------
   5. Layout primitives
   -------------------------------------------------------------------------- */
.container { width: 100%; max-width: var(--w-main); margin-inline: auto; padding-inline: var(--s-5); }
.container-narrow { max-width: var(--w-narrow); }
.container-wide { max-width: var(--w-wide); }

.section { padding-block: var(--s-8); }
.section-tight { padding-block: var(--s-6); }
.section-head { display: flex; flex-direction: column; gap: var(--s-3); margin-bottom: var(--s-6); max-width: 62ch; }

.stack { display: flex; flex-direction: column; gap: var(--s-4); }
.stack-sm { gap: var(--s-2); }
.stack-lg { gap: var(--s-6); }
.cluster { display: flex; flex-wrap: wrap; align-items: center; gap: var(--s-3); }
.cluster-between { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: var(--s-3); }
.grid { display: grid; gap: var(--s-4); }
.grid-2 { grid-template-columns: repeat(2, 1fr); }
.grid-3 { grid-template-columns: repeat(3, 1fr); }
.grid-4 { grid-template-columns: repeat(4, 1fr); }
.grid-auto { grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); }
.split { display: grid; grid-template-columns: 1.15fr .85fr; gap: var(--s-6); align-items: center; }
.split-rev { grid-template-columns: .85fr 1.15fr; }

.flex { display: flex; }
.items-center { align-items: center; }
.items-start { align-items: flex-start; }
.justify-between { justify-content: space-between; }
.justify-center { justify-content: center; }
.grow { flex: 1; }
.gap-1 { gap: var(--s-1); } .gap-2 { gap: var(--s-2); } .gap-3 { gap: var(--s-3); }
.gap-4 { gap: var(--s-4); } .gap-5 { gap: var(--s-5); }
.w-full { width: 100%; }
.text-center { text-align: center; }
.truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.hidden { display: none !important; }
.mt-2 { margin-top: var(--s-2); } .mt-4 { margin-top: var(--s-4); } .mt-6 { margin-top: var(--s-6); }
.mb-2 { margin-bottom: var(--s-2); } .mb-4 { margin-bottom: var(--s-4); } .mb-6 { margin-bottom: var(--s-6); }

/* --------------------------------------------------------------------------
   6. Topbar / nav
   -------------------------------------------------------------------------- */
.topbar {
  position: sticky; top: 0; z-index: 60;
  height: var(--topbar-h);
  display: flex; align-items: center;
  background: color-mix(in srgb, var(--bg-0) 78%, transparent);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--line-1);
}
.topbar-inner { display: flex; align-items: center; justify-content: space-between; gap: var(--s-4); width: 100%; }
.brand { display: inline-flex; align-items: center; gap: var(--s-3); color: var(--tx-1); }
.brand:hover { text-decoration: none; }
.brand-logo { width: 34px; height: 34px; border-radius: 9px; box-shadow: var(--glow-brand); }
.brand-name { font-family: var(--font-display); font-weight: 700; font-size: 1.02rem; letter-spacing: -.01em; line-height: 1.1; }
.brand-sub { display: block; font-family: var(--font-mono); font-size: .62rem; letter-spacing: .16em; text-transform: uppercase; color: var(--tx-3); }

.nav { display: flex; align-items: center; gap: var(--s-1); }
.nav-link {
  display: inline-flex; align-items: center; min-height: 44px; padding: 0 var(--s-3);
  border-radius: var(--r-sm); color: var(--tx-2); font-weight: 600; font-size: .92rem;
  transition: color var(--t-fast) var(--ease), background var(--t-fast) var(--ease);
}
.nav-link:hover { color: var(--tx-1); background: var(--bg-2); text-decoration: none; }
.nav-link[aria-current='page'] { color: var(--tx-1); background: var(--bg-3); box-shadow: inset 0 0 0 1px var(--line-2); }

.btn.nav-toggle { display: none; } /* outranks .btn's inline-flex (equal specificity, later source) */

/* --------------------------------------------------------------------------
   7. Buttons
   -------------------------------------------------------------------------- */
.btn {
  --btn-bg: var(--bg-3);
  --btn-ink: var(--tx-1);
  --btn-line: var(--line-2);
  position: relative;
  display: inline-flex; align-items: center; justify-content: center; gap: var(--s-2);
  min-height: 44px; padding: 0 var(--s-5);
  border-radius: var(--r-sm);
  background: var(--btn-bg); color: var(--btn-ink);
  border: 1px solid var(--btn-line);
  font-family: var(--font-body); font-weight: 700; font-size: .94rem; letter-spacing: .005em;
  cursor: pointer; user-select: none; white-space: nowrap;
  transition: transform var(--t-fast) var(--ease), box-shadow var(--t-med) var(--ease),
              background var(--t-fast) var(--ease), border-color var(--t-fast) var(--ease), opacity var(--t-fast);
}
.btn:hover { transform: translateY(-1px); }
.btn:active { transform: translateY(0); }
.btn:disabled, .btn[aria-disabled='true'] { opacity: .5; cursor: not-allowed; transform: none; }
.btn svg { width: 18px; height: 18px; flex: none; }

.btn-primary {
  --btn-bg: var(--brand-grad);
  --btn-ink: #041018;
  --btn-line: transparent;
  box-shadow: var(--glow-brand);
  font-weight: 800;
}
.btn-primary:hover { box-shadow: 0 10px 44px -8px rgba(34, 211, 238, .5); }

.btn-secondary { --btn-bg: var(--bg-3); --btn-line: var(--line-2); }
.btn-secondary:hover { --btn-bg: var(--bg-4); }

.btn-ghost { --btn-bg: transparent; --btn-line: transparent; --btn-ink: var(--tx-2); }
.btn-ghost:hover { --btn-bg: var(--bg-2); --btn-ink: var(--tx-1); }

.btn-outline { --btn-bg: transparent; --btn-line: var(--line-3); }
.btn-outline:hover { --btn-line: var(--accent); --btn-ink: var(--accent); }

.btn-danger { --btn-bg: var(--bad-bg); --btn-ink: var(--bad); --btn-line: rgba(251, 113, 133, .35); }
.btn-danger:hover { --btn-bg: rgba(251, 113, 133, .2); }

.btn-sm { min-height: 36px; padding: 0 var(--s-3); font-size: .85rem; border-radius: var(--r-xs); }
.btn-lg { min-height: 52px; padding: 0 var(--s-6); font-size: 1.02rem; border-radius: var(--r-md); }
.btn-icon { min-height: 44px; width: 44px; padding: 0; }
.btn-icon.btn-sm { min-height: 36px; width: 36px; }
.btn-block { width: 100%; }

.btn.is-loading { color: transparent !important; pointer-events: none; }
.btn.is-loading::after {
  content: ''; position: absolute; width: 18px; height: 18px; border-radius: 50%;
  border: 2px solid rgba(255, 255, 255, .35); border-top-color: currentColor;
  color: var(--btn-ink); animation: vg-spin .7s linear infinite;
}
.btn-primary.is-loading::after { border-color: rgba(4, 16, 24, .3); border-top-color: #041018; }
@keyframes vg-spin { to { transform: rotate(360deg); } }

/* --------------------------------------------------------------------------
   8. Cards & surfaces
   -------------------------------------------------------------------------- */
.card {
  background: linear-gradient(180deg, var(--bg-2), var(--bg-1));
  border: 1px solid var(--line-1);
  border-radius: var(--r-lg);
  box-shadow: var(--sh-1);
  overflow: hidden;
}
.card-pad { padding: var(--s-5); }
.card-hover { transition: transform var(--t-med) var(--ease), border-color var(--t-med) var(--ease), box-shadow var(--t-med) var(--ease); }
.card-hover:hover { transform: translateY(-3px); border-color: var(--line-2); box-shadow: var(--sh-2); }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: var(--s-3); padding: var(--s-4) var(--s-5); border-bottom: 1px solid var(--line-1); }
.card-title { font-family: var(--font-display); font-weight: 700; font-size: 1.02rem; }
.card-body { padding: var(--s-5); }
.card-foot { padding: var(--s-4) var(--s-5); border-top: 1px solid var(--line-1); background: var(--bg-inset); }

.card-glow { position: relative; }
.card-glow::before {
  content: ''; position: absolute; inset: -1px; border-radius: inherit; padding: 1px;
  background: var(--brand-grad); opacity: .5;
  -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
  -webkit-mask-composite: xor; mask-composite: exclude;
  pointer-events: none;
}

.panel { background: var(--bg-1); border: 1px solid var(--line-1); border-radius: var(--r-md); }
.inset { background: var(--bg-inset); border: 1px solid var(--line-1); border-radius: var(--r-sm); }

/* --------------------------------------------------------------------------
   9. Stat cards
   -------------------------------------------------------------------------- */
.stat {
  display: flex; flex-direction: column; gap: var(--s-2);
  padding: var(--s-5);
  background: linear-gradient(180deg, var(--bg-2), var(--bg-1));
  border: 1px solid var(--line-1); border-radius: var(--r-md);
}
.stat-label { display: flex; align-items: center; gap: var(--s-2); font-size: .78rem; font-weight: 700; letter-spacing: .1em; text-transform: uppercase; color: var(--tx-3); }
.stat-value { font-family: var(--font-mono); font-size: clamp(1.7rem, 3vw, 2.3rem); font-weight: 700; letter-spacing: -.03em; color: var(--tx-1); line-height: 1; font-variant-numeric: tabular-nums; }
.stat-value.accent { color: var(--accent); }
.stat-sub { font-size: .8rem; color: var(--tx-3); }
.stat-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--ok); box-shadow: 0 0 0 3px var(--ok-bg); }
.stat-dot.live { animation: vg-pulse 2s var(--ease) infinite; }
@keyframes vg-pulse { 0%, 100% { opacity: 1; } 50% { opacity: .35; } }

/* --------------------------------------------------------------------------
   10. Badges / status / chips
   -------------------------------------------------------------------------- */
.badge {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 3px 10px; border-radius: var(--r-pill);
  font-family: var(--font-mono); font-size: .72rem; font-weight: 600; letter-spacing: .04em;
  background: var(--idle-bg); color: var(--idle); border: 1px solid transparent;
  white-space: nowrap;
}
.badge::before { content: ''; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.badge.ok { background: var(--ok-bg); color: var(--ok); }
.badge.warn { background: var(--warn-bg); color: var(--warn); }
.badge.bad { background: var(--bad-bg); color: var(--bad); }
.badge.info { background: var(--info-bg); color: var(--info); }
.badge.idle { background: var(--idle-bg); color: var(--idle); }
.badge.brand { background: var(--brand-grad-soft); color: var(--cyan); border-color: var(--line-2); }
.badge.no-dot::before { display: none; }

.chip {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 4px 12px; border-radius: var(--r-pill);
  background: var(--bg-3); border: 1px solid var(--line-2);
  font-size: .8rem; font-weight: 600; color: var(--tx-2);
}
.chip.mono { font-family: var(--font-mono); font-size: .76rem; }

.kbd {
  display: inline-block; padding: 2px 7px; border-radius: 6px;
  background: var(--bg-3); border: 1px solid var(--line-2); border-bottom-width: 2px;
  font-family: var(--font-mono); font-size: .74rem; color: var(--tx-2);
}

/* --------------------------------------------------------------------------
   11. Forms
   -------------------------------------------------------------------------- */
.field { display: flex; flex-direction: column; gap: var(--s-2); }
.label { font-size: .85rem; font-weight: 700; color: var(--tx-1); display: flex; align-items: center; gap: var(--s-2); }
.label .req { color: var(--bad); }
.hint { font-size: .78rem; color: var(--tx-3); }
.field-error { font-size: .78rem; color: var(--bad); display: flex; align-items: center; gap: 6px; }

.input, .select, .textarea {
  width: 100%; min-height: 46px; padding: 10px var(--s-4);
  background: var(--bg-inset); color: var(--tx-1);
  border: 1px solid var(--line-2); border-radius: var(--r-sm);
  font-size: .95rem; transition: border-color var(--t-fast) var(--ease), box-shadow var(--t-fast) var(--ease), background var(--t-fast);
}
.input::placeholder, .textarea::placeholder { color: var(--tx-3); }
.input:hover, .select:hover, .textarea:hover { border-color: var(--line-3); }
.input:focus, .select:focus, .textarea:focus {
  outline: none; border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(34, 211, 238, .16);
  background: var(--bg-1);
}
.input[aria-invalid='true'], .textarea[aria-invalid='true'] { border-color: var(--bad); box-shadow: 0 0 0 3px var(--bad-bg); }
.textarea { min-height: 120px; resize: vertical; line-height: 1.55; }
.select {
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 24 24' fill='none' stroke='%236d7d94' stroke-width='2.4' stroke-linecap='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 14px center;
  padding-right: 40px; cursor: pointer;
}
.select option { background: var(--bg-2); color: var(--tx-1); }
.input.mono { font-family: var(--font-mono); font-size: .88rem; }

.input-group { display: flex; gap: var(--s-2); }
.input-group .input { flex: 1; }

.form-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: var(--s-4); }
.form-grid .span-2 { grid-column: 1 / -1; }

/* --------------------------------------------------------------------------
   12. Tables
   -------------------------------------------------------------------------- */
.table-scroll { overflow-x: auto; border: 1px solid var(--line-1); border-radius: var(--r-md); background: var(--bg-1); }
.table { min-width: 640px; font-size: .9rem; }
.table th {
  text-align: left; padding: var(--s-3) var(--s-4);
  font-family: var(--font-mono); font-size: .7rem; font-weight: 600;
  letter-spacing: .12em; text-transform: uppercase; color: var(--tx-3);
  background: var(--bg-inset); border-bottom: 1px solid var(--line-2);
  white-space: nowrap;
}
.table td { padding: var(--s-3) var(--s-4); border-bottom: 1px solid var(--line-1); color: var(--tx-2); vertical-align: middle; }
.table tbody tr:last-child td { border-bottom: 0; }
.table tbody tr { transition: background var(--t-fast) var(--ease); }
.table tbody tr:hover { background: var(--bg-2); }
.table .num { font-family: var(--font-mono); font-variant-numeric: tabular-nums; color: var(--tx-1); }
.table .cell-main { color: var(--tx-1); font-weight: 600; }

/* --------------------------------------------------------------------------
   13. Code blocks
   -------------------------------------------------------------------------- */
.codeblock { border: 1px solid var(--line-2); border-radius: var(--r-md); overflow: hidden; background: var(--bg-inset); }
.codeblock-head {
  display: flex; align-items: center; justify-content: space-between; gap: var(--s-3);
  padding: var(--s-2) var(--s-3) var(--s-2) var(--s-4);
  background: var(--bg-2); border-bottom: 1px solid var(--line-1);
}
.codeblock-lang { font-family: var(--font-mono); font-size: .7rem; letter-spacing: .12em; text-transform: uppercase; color: var(--tx-3); }
.codeblock pre { padding: var(--s-4); overflow-x: auto; font-size: .84rem; line-height: 1.65; color: #cfe0f4; }
.codeblock code { font-family: var(--font-mono); }
code.inline {
  padding: 2px 7px; border-radius: 6px; background: var(--bg-3);
  border: 1px solid var(--line-1); font-size: .84em; color: var(--cyan);
}

/* --------------------------------------------------------------------------
   14. Progress
   -------------------------------------------------------------------------- */
.progress { height: 8px; border-radius: var(--r-pill); background: var(--bg-4); overflow: hidden; }
.progress-bar { height: 100%; border-radius: inherit; background: var(--brand-grad); transition: width var(--t-med) var(--ease); }
.progress-row { display: flex; align-items: center; gap: var(--s-3); }
.progress-row .progress { flex: 1; }
.progress-label { font-family: var(--font-mono); font-size: .78rem; color: var(--tx-2); min-width: 42px; text-align: right; font-variant-numeric: tabular-nums; }

/* --------------------------------------------------------------------------
   15. Alerts / callouts
   -------------------------------------------------------------------------- */
.callout {
  display: flex; gap: var(--s-3); padding: var(--s-4);
  border-radius: var(--r-md); border: 1px solid var(--line-2);
  background: var(--bg-2); font-size: .9rem; color: var(--tx-2);
}
.callout svg { width: 20px; height: 20px; flex: none; margin-top: 2px; }
.callout.info { background: var(--info-bg); border-color: rgba(88, 166, 255, .3); }
.callout.info svg { color: var(--info); }
.callout.warn { background: var(--warn-bg); border-color: rgba(245, 181, 68, .3); }
.callout.warn svg { color: var(--warn); }
.callout.bad { background: var(--bad-bg); border-color: rgba(251, 113, 133, .3); }
.callout.bad svg { color: var(--bad); }
.callout.ok { background: var(--ok-bg); border-color: rgba(45, 212, 167, .3); }
.callout.ok svg { color: var(--ok); }
.callout strong { color: var(--tx-1); }

/* --------------------------------------------------------------------------
   16. Toasts
   -------------------------------------------------------------------------- */
.toast-region {
  position: fixed; right: var(--s-4); bottom: var(--s-4); z-index: 120;
  display: flex; flex-direction: column; gap: var(--s-2);
  max-width: min(380px, calc(100vw - 32px));
}
.toast {
  display: flex; align-items: flex-start; gap: var(--s-3);
  padding: var(--s-3) var(--s-4);
  background: var(--bg-3); border: 1px solid var(--line-2); border-left: 3px solid var(--info);
  border-radius: var(--r-sm); box-shadow: var(--sh-2);
  font-size: .88rem; color: var(--tx-1);
  animation: vg-toast-in var(--t-med) var(--ease);
}
.toast.ok { border-left-color: var(--ok); }
.toast.bad { border-left-color: var(--bad); }
.toast.warn { border-left-color: var(--warn); }
.toast svg { width: 18px; height: 18px; flex: none; margin-top: 2px; }
.toast.ok svg { color: var(--ok); } .toast.bad svg { color: var(--bad); }
.toast.warn svg { color: var(--warn); } .toast.info svg { color: var(--info); }
.toast.leaving { animation: vg-toast-out var(--t-med) var(--ease) forwards; }
@keyframes vg-toast-in { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }
@keyframes vg-toast-out { to { opacity: 0; transform: translateX(16px); } }

/* --------------------------------------------------------------------------
   17. Modal / dialog
   -------------------------------------------------------------------------- */
.modal-overlay {
  position: fixed; inset: 0; z-index: 100;
  display: flex; align-items: center; justify-content: center; padding: var(--s-4);
  background: rgba(4, 6, 10, .7); backdrop-filter: blur(6px);
  animation: vg-fade var(--t-med) var(--ease);
}
.modal {
  width: 100%; max-width: 480px; max-height: calc(100vh - 48px); overflow-y: auto;
  background: var(--bg-2); border: 1px solid var(--line-2); border-radius: var(--r-lg);
  box-shadow: var(--sh-3); animation: vg-pop var(--t-med) var(--ease);
}
.modal-head { display: flex; align-items: center; justify-content: space-between; gap: var(--s-3); padding: var(--s-4) var(--s-5); border-bottom: 1px solid var(--line-1); }
.modal-title { font-family: var(--font-display); font-weight: 700; font-size: 1.08rem; }
.modal-body { padding: var(--s-5); }
.modal-foot { display: flex; justify-content: flex-end; gap: var(--s-2); padding: var(--s-4) var(--s-5); border-top: 1px solid var(--line-1); background: var(--bg-inset); }
@keyframes vg-fade { from { opacity: 0; } to { opacity: 1; } }
@keyframes vg-pop { from { opacity: 0; transform: translateY(12px) scale(.98); } to { opacity: 1; transform: none; } }

/* --------------------------------------------------------------------------
   18. Skeleton / empty / divider
   -------------------------------------------------------------------------- */
.skeleton {
  border-radius: var(--r-sm);
  background: linear-gradient(90deg, var(--bg-2) 25%, var(--bg-3) 50%, var(--bg-2) 75%);
  background-size: 200% 100%; animation: vg-shimmer 1.4s linear infinite;
}
@keyframes vg-shimmer { to { background-position: -200% 0; } }
.skeleton-line { height: 14px; margin-bottom: var(--s-2); }
.skeleton-block { height: 96px; }

.empty {
  display: flex; flex-direction: column; align-items: center; gap: var(--s-3);
  padding: var(--s-7) var(--s-5); text-align: center; color: var(--tx-3);
}
.empty svg { width: 40px; height: 40px; opacity: .5; }
.empty-title { font-family: var(--font-display); font-weight: 700; color: var(--tx-2); }

.divider { height: 1px; background: var(--line-1); border: 0; margin-block: var(--s-5); }

/* --------------------------------------------------------------------------
   19. Segmented control (range toggle)
   -------------------------------------------------------------------------- */
.segmented { display: inline-flex; padding: 3px; gap: 2px; background: var(--bg-inset); border: 1px solid var(--line-2); border-radius: var(--r-sm); }
.segmented button {
  min-height: 36px; padding: 0 var(--s-4); border-radius: var(--r-xs);
  font-family: var(--font-mono); font-size: .8rem; font-weight: 600; color: var(--tx-3);
  transition: color var(--t-fast), background var(--t-fast);
}
.segmented button:hover { color: var(--tx-1); }
.segmented button[aria-pressed='true'] { background: var(--bg-4); color: var(--accent); box-shadow: inset 0 0 0 1px var(--line-2); }

/* --------------------------------------------------------------------------
   20. Hero / landing
   -------------------------------------------------------------------------- */
.hero { position: relative; padding-block: var(--s-9) var(--s-8); }
.hero-grid { display: grid; grid-template-columns: 1.1fr .9fr; gap: var(--s-7); align-items: center; }
.hero-copy { display: flex; flex-direction: column; gap: var(--s-5); }
.hero-title { font-size: clamp(2.4rem, 5.4vw, 4rem); font-weight: 800; letter-spacing: -.03em; line-height: 1.05; }
.hero-actions { display: flex; flex-wrap: wrap; gap: var(--s-3); }
.hero-visual { position: relative; }
.hero-banner { display: block; width: 100%; height: auto; border-radius: var(--r-xl); border: 1px solid var(--line-1); box-shadow: var(--sh-3), var(--glow-brand); }
.hero-ring {
  position: absolute; inset: -8%; border-radius: 50%;
  background: conic-gradient(from 0deg, transparent 0 40%, rgba(34, 211, 238, .25) 50%, transparent 60% 100%);
  filter: blur(30px); z-index: -1; animation: vg-rotate 14s linear infinite;
}
@keyframes vg-rotate { to { transform: rotate(360deg); } }

.feature-icon {
  display: inline-flex; align-items: center; justify-content: center;
  width: 42px; height: 42px; border-radius: var(--r-sm);
  background: var(--brand-grad-soft); border: 1px solid var(--line-2); color: var(--cyan);
}
.feature-icon svg { width: 20px; height: 20px; }

.logo-mark { width: 40px; height: 40px; border-radius: 10px; }

/* --------------------------------------------------------------------------
   21. Docs layout
   -------------------------------------------------------------------------- */
.docs-shell { display: grid; grid-template-columns: 250px 1fr; gap: var(--s-6); align-items: start; }
.docs-nav { position: sticky; top: calc(var(--topbar-h) + var(--s-4)); display: flex; flex-direction: column; gap: 2px; max-height: calc(100vh - var(--topbar-h) - 48px); overflow-y: auto; padding-right: var(--s-2); }
.docs-nav-title { font-family: var(--font-mono); font-size: .68rem; letter-spacing: .16em; text-transform: uppercase; color: var(--tx-3); margin: var(--s-4) 0 var(--s-2); }
.docs-nav a {
  display: block; padding: 7px var(--s-3); border-radius: var(--r-xs);
  color: var(--tx-2); font-size: .88rem; font-weight: 600; border-left: 2px solid transparent;
}
.docs-nav a:hover { color: var(--tx-1); background: var(--bg-2); text-decoration: none; }
.docs-nav a[aria-current='true'] { color: var(--accent); border-left-color: var(--accent); background: var(--bg-2); }
.docs-content { display: flex; flex-direction: column; gap: var(--s-7); min-width: 0; }
.docs-section { scroll-margin-top: calc(var(--topbar-h) + var(--s-4)); display: flex; flex-direction: column; gap: var(--s-4); }
.docs-section > h2 { display: flex; align-items: center; gap: var(--s-3); }
.anchor-link { opacity: 0; color: var(--tx-3); font-size: .9em; transition: opacity var(--t-fast); }
.docs-section:hover .anchor-link { opacity: 1; }
.endpoint-tag {
  display: inline-flex; align-items: center; gap: var(--s-2);
  font-family: var(--font-mono); font-size: .8rem; font-weight: 700;
  padding: 5px 12px; border-radius: var(--r-xs); border: 1px solid var(--line-2); background: var(--bg-inset);
}
.endpoint-tag .method { font-weight: 800; }
.method.get { color: var(--ok); } .method.post { color: var(--info); }
.method.patch { color: var(--warn); } .method.delete { color: var(--bad); }

.param-table { font-size: .86rem; }
.param-table td:first-child { font-family: var(--font-mono); color: var(--cyan); white-space: nowrap; }

/* --------------------------------------------------------------------------
   22. Dashboard / admin specifics
   -------------------------------------------------------------------------- */
.page-head { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: var(--s-4); padding-block: var(--s-6) var(--s-5); }
.page-title { font-size: clamp(1.6rem, 3vw, 2.2rem); }

.slot-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: var(--s-4); }
.slot-card { display: flex; flex-direction: column; gap: var(--s-3); padding: var(--s-4); }
.slot-head { display: flex; align-items: center; justify-content: space-between; gap: var(--s-2); }
.slot-id { font-family: var(--font-mono); font-weight: 700; font-size: 1rem; color: var(--tx-1); }
.slot-meta { display: grid; grid-template-columns: auto 1fr; gap: 4px var(--s-3); font-size: .8rem; }
.slot-meta dt { color: var(--tx-3); }
.slot-meta dd { color: var(--tx-2); font-family: var(--font-mono); font-size: .78rem; overflow: hidden; text-overflow: ellipsis; }

.video-frame { border-radius: var(--r-md); overflow: hidden; border: 1px solid var(--line-2); background: #000; aspect-ratio: 16 / 9; }
.video-frame video { width: 100%; height: 100%; object-fit: contain; }

.key-secret {
  display: flex; align-items: center; gap: var(--s-2);
  padding: var(--s-3) var(--s-4); border-radius: var(--r-sm);
  background: var(--bg-inset); border: 1px dashed var(--line-3);
  font-family: var(--font-mono); font-size: .84rem; color: var(--cyan); word-break: break-all;
}

.auth-shell { min-height: calc(100vh - var(--topbar-h)); display: grid; place-items: center; padding: var(--s-6) var(--s-4); }
.auth-card { width: 100%; max-width: 420px; }

.pagination { display: flex; align-items: center; justify-content: space-between; gap: var(--s-3); padding-top: var(--s-4); }

/* --------------------------------------------------------------------------
   23. Footer
   -------------------------------------------------------------------------- */
.footer { border-top: 1px solid var(--line-1); background: var(--bg-inset); padding-block: var(--s-6); margin-top: var(--s-8); }
.footer-inner { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: var(--s-4); }
.footer-links { display: flex; flex-wrap: wrap; gap: var(--s-4); }
.footer-links a { color: var(--tx-3); font-size: .86rem; font-weight: 600; }
.footer-links a:hover { color: var(--tx-1); }

/* --------------------------------------------------------------------------
   24. Responsive
   -------------------------------------------------------------------------- */
@media (max-width: 1024px) {
  .grid-4 { grid-template-columns: repeat(2, 1fr); }
  .hero-grid { grid-template-columns: 1fr; gap: var(--s-6); }
  .hero-visual { order: -1; }
  .hero-banner { width: 100%; }
  .docs-shell { grid-template-columns: 1fr; }
  .docs-nav { position: static; max-height: none; flex-direction: row; flex-wrap: wrap; gap: var(--s-1); border-bottom: 1px solid var(--line-1); padding-bottom: var(--s-3); }
  .docs-nav-title { width: 100%; margin: var(--s-2) 0; }
  .docs-nav a { border-left: 0; border: 1px solid var(--line-1); }
}
@media (max-width: 820px) {
  .grid-3 { grid-template-columns: repeat(2, 1fr); }
  .split, .split-rev { grid-template-columns: 1fr; }
  .form-grid { grid-template-columns: 1fr; }
  .section { padding-block: var(--s-7); }
  .nav {
    position: fixed; inset: var(--topbar-h) 0 auto 0; z-index: 59;
    flex-direction: column; align-items: stretch; gap: 2px;
    background: var(--bg-1); border-bottom: 1px solid var(--line-2);
    padding: var(--s-3); display: none;
  }
  .nav.open { display: flex; }
  .nav-link { justify-content: flex-start; }
  .btn.nav-toggle { display: inline-flex; }
}
@media (max-width: 480px) {
  .container { padding-inline: var(--s-4); }
  .grid-2, .grid-3, .grid-4 { grid-template-columns: 1fr; }
  .hero { padding-block: var(--s-7) var(--s-6); }
  .hero-actions .btn { width: 100%; }
  .cluster-between { flex-direction: column; align-items: stretch; }
  .toast-region { left: var(--s-4); right: var(--s-4); max-width: none; }
  .page-head { flex-direction: column; align-items: stretch; }
}

/* --------------------------------------------------------------------------
   25. Print (docs friendly)
   -------------------------------------------------------------------------- */
@media print {
  body::before, body::after, .topbar, .footer, .toast-region { display: none; }
  body { background: #fff; color: #000; }
  .card, .codeblock { border-color: #ccc; background: #fff; }
}