/* ═══════════════════════════════════════════════════════════════════════════
   Render Labs — design system
   Public marketing surface = LIGHT ("Light Tech").
   Signed-in portal + admin = DARK by default, user-toggleable to LIGHT.
   Themes flip on  [data-theme="light|dark"]  set on <html>.
   Palettes distilled from the Google Stitch references (Synthetic Vision +
   Dev-Centric). Space Grotesk (display) · Inter (body) · JetBrains Mono (code).
   ═══════════════════════════════════════════════════════════════════════════ */

/* ── tokens: LIGHT (default / public) ─────────────────────────────────────── */
:root,
[data-theme='light'] {
  --bg: #f6f7fb;
  --bg-tint-a: rgba(79, 70, 229, 0.06);
  --bg-tint-b: rgba(14, 165, 233, 0.05);
  --surface: #ffffff;
  --surface-2: #f2f3f9;
  --surface-3: #e9ebf4;
  --surface-inset: #f7f8fc;
  --glass: rgba(255, 255, 255, 0.72);
  --border: #e4e6f0;
  --border-2: #d6d9e6;
  --border-strong: #c3c7d8;

  --text: #14141c;
  --text-2: #45475a;
  --muted: #6b6e82;
  --faint: #9297ab;

  --primary: #4f46e5;
  --primary-hi: #4338ca;
  --primary-ink: #ffffff;
  --primary-weak: rgba(79, 70, 229, 0.1);
  --primary-line: rgba(79, 70, 229, 0.28);
  --accent: #0ea5e9;
  --accent-weak: rgba(14, 165, 233, 0.12);
  --violet: #7c5cff;

  --good: #0f9d6f;
  --good-weak: rgba(15, 157, 111, 0.13);
  --warn: #c07a00;
  --warn-weak: rgba(217, 143, 0, 0.14);
  --bad: #dc2955;
  --bad-weak: rgba(220, 41, 85, 0.12);

  --grad: linear-gradient(120deg, #4f46e5 0%, #0ea5e9 100%);
  --grad-soft: linear-gradient(120deg, rgba(79, 70, 229, 0.14), rgba(14, 165, 233, 0.12));

  --shadow-sm: 0 1px 2px rgba(20, 22, 40, 0.06), 0 1px 3px rgba(20, 22, 40, 0.05);
  --shadow: 0 10px 30px -12px rgba(30, 33, 64, 0.22);
  --shadow-lg: 0 24px 60px -22px rgba(30, 33, 64, 0.32);
  --ring: 0 0 0 3px rgba(79, 70, 229, 0.22);

  --r-xs: 6px;
  --r-sm: 8px;
  --r: 12px;
  --r-lg: 16px;
  --r-xl: 22px;
  --r-full: 999px;

  --sidebar-w: 248px;
  --topbar-h: 62px;
  --maxw: 1200px;

  --code-bg: #0f1629;
  --code-text: #e2e8f5;
  /* editor / source viewer surface — light, matches the page in light theme */
  --editor-bg: var(--surface-inset);
  --editor-text: var(--text);
  --code-line: var(--border);
  --code-dim: var(--muted);
  --code-gutter: var(--faint);
  --code-gutter-bg: var(--surface-2);

  --font-mono: 'JetBrains Mono', ui-monospace, Menlo, monospace;
  --font-text: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --font-header: 'Space Grotesk', 'Inter', sans-serif;

  color-scheme: light;
}

/* ── tokens: DARK (portal / admin) — "Synthetic Vision" ───────────────────── */
[data-theme='dark'] {
  --bg: #0a1120;
  --bg-tint-a: rgba(124, 92, 255, 0.16);
  --bg-tint-b: rgba(66, 211, 255, 0.1);
  --surface: #131b2e;
  --surface-2: #172035;
  --surface-3: #222a3d;
  --surface-inset: #0e1626;
  --glass: rgba(19, 27, 46, 0.66);
  --border: #232c45;
  --border-2: #2c3654;
  --border-strong: #3a4568;

  --text: #e7ecfb;
  --text-2: #c3cae6;
  --muted: #939bc2;
  --faint: #6a7299;

  --primary: #8b8cff;
  --primary-hi: #a5a6ff;
  --primary-ink: #0a0730;
  --primary-weak: rgba(139, 140, 255, 0.14);
  --primary-line: rgba(139, 140, 255, 0.4);
  --accent: #56d4ff;
  --accent-weak: rgba(86, 212, 255, 0.14);
  --violet: #9d8cff;

  --good: #37d9a0;
  --good-weak: rgba(55, 217, 160, 0.14);
  --warn: #ffbf5b;
  --warn-weak: rgba(255, 191, 91, 0.15);
  --bad: #ff7b93;
  --bad-weak: rgba(255, 123, 147, 0.15);

  --grad: linear-gradient(120deg, #7c5cff 0%, #42d3ff 100%);
  --grad-soft: linear-gradient(120deg, rgba(124, 92, 255, 0.22), rgba(66, 211, 255, 0.14));

  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.4);
  --shadow: 0 18px 44px -20px rgba(0, 0, 0, 0.7);
  --shadow-lg: 0 30px 70px -26px rgba(0, 0, 0, 0.8);
  --ring: 0 0 0 3px rgba(139, 140, 255, 0.28);

  --code-bg: #0b1120;
  --code-text: #e2e8f5;
  /* editor / source viewer surface — dark code panel in dark theme */
  --editor-bg: var(--code-bg);
  --editor-text: var(--code-text);
  --code-line: rgba(255, 255, 255, 0.08);
  --code-dim: #7f8bb0;
  --code-gutter: #4a5578;
  --code-gutter-bg: rgba(0, 0, 0, 0.15);
  color-scheme: dark;
}

/* ── reset / base ─────────────────────────────────────────────────────────── */
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
html { -webkit-text-size-adjust: 100%; }
body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  transition: background 0.25s ease, color 0.25s ease;
}
h1, h2, h3, h4, h5 {
  font-family: var(--font-header);
  font-weight: 600;
  letter-spacing: -0.02em;
  margin: 0;
  line-height: 1.15;
}
p { margin: 0; }
a { color: inherit; text-decoration: none; }
button { font-family: inherit; cursor: pointer; }
input, textarea, select { font-family: inherit; }
img { max-width: 100%; display: block; }
svg { width: 18px; height: 18px; flex-shrink: 0; } /* sane default; specific rules override */
::selection { background: rgba(124, 92, 255, 0.3); }
.mono { font-family: var(--font-mono); }
.hidden { display: none !important; }
.spacer { flex: 1; }

/* scrollbars */
* { scrollbar-width: thin; scrollbar-color: var(--border-2) transparent; }
*::-webkit-scrollbar { width: 10px; height: 10px; }
*::-webkit-scrollbar-thumb { background: var(--border-2); border-radius: 999px; border: 3px solid transparent; background-clip: padding-box; }

/* ── utility layout ───────────────────────────────────────────────────────── */
.container { width: 100%; max-width: var(--maxw); margin: 0 auto; padding: 0 24px; }
.row { display: flex; align-items: center; gap: 12px; }
.col { display: flex; flex-direction: column; }
.wrap { flex-wrap: wrap; }
.between { justify-content: space-between; }
.center { justify-content: center; }
.grid { display: grid; gap: 18px; }
.muted { color: var(--muted); }
.faint { color: var(--faint); }
.small { font-size: 13px; }
.tiny { font-size: 12px; }
.strong { font-weight: 600; }
.nowrap { white-space: nowrap; }
.tabnum { font-variant-numeric: tabular-nums; }

/* ── buttons ──────────────────────────────────────────────────────────────── */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 10px 16px; border-radius: var(--r-sm); font-size: 14px; font-weight: 600;
  border: 1px solid var(--border-2); background: var(--surface); color: var(--text);
  cursor: pointer; white-space: nowrap; transition: 0.15s ease; user-select: none;
}
.btn:hover { border-color: var(--border-strong); background: var(--surface-2); }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }
.btn svg { width: 17px; height: 17px; }
.btn.primary { background: var(--grad); color: #fff; border: none; box-shadow: 0 8px 20px -10px rgba(79, 70, 229, 0.7); }
[data-theme='dark'] .btn.primary { color: #0a0730; box-shadow: 0 10px 26px -12px rgba(124, 92, 255, 0.8); }
.btn.primary:hover { filter: brightness(1.06); background: var(--grad); }
.btn.solid { background: var(--primary); color: var(--primary-ink); border: none; }
.btn.solid:hover { background: var(--primary-hi); }
.btn.ghost { background: transparent; border-color: transparent; }
.btn.ghost:hover { background: var(--surface-2); border-color: var(--border); }
.btn.outline { background: transparent; }
.btn.sm { padding: 7px 12px; font-size: 13px; border-radius: var(--r-xs); }
.btn.lg { padding: 13px 22px; font-size: 15px; }
.btn.block { width: 100%; }
.btn.danger { color: var(--bad); }
.btn.danger:hover { background: var(--bad-weak); border-color: var(--bad); }
.btn.icon { padding: 8px; width: 36px; height: 36px; }
.btn.icon.sm { width: 30px; height: 30px; padding: 6px; }

/* ── form fields ──────────────────────────────────────────────────────────── */
.field { display: block; margin-bottom: 15px; }
.field > .lbl { display: block; font-size: 12.5px; font-weight: 600; color: var(--text-2); margin-bottom: 6px; letter-spacing: 0.01em; }
.input, textarea.input, select.input {
  width: 100%; background: var(--surface-inset); border: 1px solid var(--border-2); color: var(--text);
  padding: 10px 12px; border-radius: var(--r-sm); font-size: 14px; transition: 0.15s;
}
.input::placeholder { color: var(--faint); }
.input:focus, textarea.input:focus, select.input:focus { outline: none; border-color: var(--primary); box-shadow: var(--ring); }
textarea.input { resize: vertical; }
select.input { appearance: none; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%236b6e82' stroke-width='2'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 10px center; padding-right: 34px; }
.hint { font-size: 12px; color: var(--muted); margin-top: 5px; }
/* input with a fixed, non-editable leading token (e.g. the `clone-` voice-id prefix) */
.input-affix { display: flex; align-items: stretch; background: var(--surface-inset); border: 1px solid var(--border-2); border-radius: var(--r-sm); transition: 0.15s; }
.input-affix:focus-within { border-color: var(--primary); box-shadow: var(--ring); }
.input-affix > .affix { display: flex; align-items: center; padding: 0 2px 0 12px; color: var(--muted); font-size: 14px; white-space: nowrap; }
.input-affix > .input { border: none; background: transparent; box-shadow: none; padding-left: 0; }
.input-affix > .input:focus { box-shadow: none; }

/* voice picker */
.voice-picker { display: flex; flex-direction: column; gap: 9px; margin-bottom: 2px; }
.voice-search-field, .voice-select-field { margin-bottom: 0; }
.voice-select-field .input { min-height: 38px; padding-top: 8px; padding-bottom: 8px; }
.voice-search-chip {
  display: flex;
  align-items: center;
  gap: 6px;
  width: 100%;
  padding: 6px 10px;
  border-radius: var(--r-full);
  background: var(--surface-2);
  border: 1px solid var(--border);
  color: var(--muted);
}
.voice-search-chip svg {
  width: 16px;
  height: 16px;
  flex: 0 0 auto;
}
.voice-search-input {
  width: 100%;
  border: none;
  background: transparent;
  outline: none;
  color: var(--text);
  font-size: 12.5px;
}
.voice-search-input::placeholder { color: var(--muted); }
.voice-trigger {
  width: 100%;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 12px;
  align-items: stretch;
  text-align: left;
  padding: 10px 12px;
  border-radius: var(--r-sm);
  border: 1px solid var(--border-2);
  background: linear-gradient(180deg, var(--surface-inset), var(--surface-2));
  color: var(--text);
  cursor: pointer;
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.02);
  transition: 0.15s ease;
}
.voice-trigger:hover, .voice-trigger:focus-visible {
  border-color: var(--border-strong);
  outline: none;
  box-shadow: var(--ring);
}
.voice-trigger > span:first-child { min-width: 0; }
.voice-trigger-action {
  display: flex;
  align-items: center;
  align-self: center;
  justify-self: end;
}
.voice-trigger-action svg {
  width: 18px;
  height: 18px;
  flex: 0 0 auto;
}
.voice-trigger.is-open .voice-trigger-action svg:last-child { transform: rotate(180deg); }
.voice-summary {
  display: flex; flex-direction: column; justify-content: center; gap: 6px;
  min-height: 54px;
}
.voice-summary.is-empty {
  min-height: 100%;
  color: var(--muted);
}
.voice-meta { display: flex; flex-wrap: wrap; gap: 6px; }
.voice-summary .rate { align-self: flex-start; }
.voice-summary .strong { font-size: 16px; }
.voice-summary .tiny { line-height: 1.4; }
.voice-picker-details { display: flex; flex-direction: column; gap: 9px; }
.voice-picker-details.collapsed { display: none; }
.voice-filter-grid {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  gap: 8px;
}
.voice-filter-control { position: relative; flex: 0 0 auto; min-width: 0; }
.voice-filter-trigger {
  width: max-content;
  display: inline-flex;
  align-items: center;
  justify-content: flex-start;
  gap: 7px;
  min-width: 0;
  max-width: calc(100vw - 40px);
  padding: 4px 10px;
  min-height: 30px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--surface-2);
  color: var(--text);
  font-size: 12.5px;
  font-weight: 600;
  text-align: left;
  cursor: pointer;
  transition: 0.15s ease;
}
.voice-filter-trigger:hover, .voice-filter-trigger:focus-visible {
  border-color: var(--border-strong);
  outline: none;
  box-shadow: var(--ring);
}
.voice-filter-trigger.active { border-color: var(--primary-line); color: var(--primary); background: var(--primary-weak); }
.voice-filter-trigger-text {
  min-width: 0;
  flex: 0 1 auto;
  display: flex;
  align-items: center;
  gap: 6px;
  overflow: hidden;
}
.voice-filter-trigger-label {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.voice-filter-trigger-label { color: var(--text-2); }
.voice-filter-trigger-count {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 18px;
  height: 16px;
  padding: 0 4px;
  border-radius: 999px;
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--text-2);
  font-size: 10.5px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  flex: 0 0 auto;
}
.voice-filter-trigger-icon { width: 15px; height: 15px; flex: 0 0 auto; color: var(--muted); transition: transform 0.15s ease; }
.voice-filter-control .voice-filter-trigger[aria-expanded='true'] .voice-filter-trigger-icon { transform: rotate(180deg); }
.voice-filter-menu {
  display: none;
  position: absolute;
  z-index: 35;
  left: 0;
  top: calc(100% + 5px);
  width: max-content;
  min-width: 100%;
  max-width: calc(100vw - 40px);
  background: var(--surface);
  border: 1px solid var(--border-2);
  border-radius: var(--r-sm);
  box-shadow: var(--shadow-lg);
  padding: 5px;
}
.voice-filter-menu.open { display: grid; gap: 3px; }
.voice-filter-option {
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 5px 8px;
  border-radius: var(--r-xs);
  cursor: pointer;
  color: var(--text);
  font-size: 12.5px;
  white-space: nowrap;
}
.voice-filter-option:hover { background: var(--surface-2); }
.voice-filter-option input {
  width: 13px;
  height: 13px;
  margin: 0;
  accent-color: var(--primary);
}
.voice-filter-empty { padding: 8px 10px; }
.cal-check {
  appearance: none;
  -webkit-appearance: none;
  width: 17px;
  height: 17px;
  margin: 0;
  border: 1.5px solid var(--border-strong);
  border-radius: 5px;
  background: var(--surface);
  cursor: pointer;
  display: inline-grid;
  place-content: center;
  vertical-align: middle;
  transition: background .12s ease, border-color .12s ease, box-shadow .12s ease;
}
.cal-check:hover { border-color: var(--primary); }
.cal-check:focus-visible { outline: none; box-shadow: 0 0 0 3px var(--primary-weak); border-color: var(--primary); }
.cal-check::before {
  content: "";
  width: 10px;
  height: 10px;
  transform: scale(0);
  transition: transform .12s cubic-bezier(.4, 0, .2, 1);
  background: var(--primary-ink);
  clip-path: polygon(14% 47%, 0 61%, 40% 100%, 100% 22%, 84% 8%, 39% 68%);
}
.cal-check:checked,
.cal-check:indeterminate {
  background: var(--primary);
  border-color: var(--primary);
}
.cal-check:checked::before { transform: scale(1); }
.cal-check:indeterminate::before {
  clip-path: none;
  transform: scale(1);
  width: 9px;
  height: 2px;
  border-radius: 1px;
}
.voice-library {
  display: grid;
  gap: 8px;
  max-height: 320px;
  overflow: auto;
  padding: 4px 4px 4px 2px;
}
.voice-item {
  width: 100%;
  display: flex;
  gap: 12px;
  align-items: center;
  text-align: left;
  padding: 10px;
  border-radius: var(--r-sm);
  border: 1px solid var(--border);
  background: linear-gradient(180deg, var(--surface), var(--surface-inset));
  box-shadow: var(--shadow-sm);
  transition: 0.16s ease;
  cursor: pointer;
}
.voice-item:hover, .voice-item:focus-visible { border-color: var(--border-strong); transform: translateY(-1px); outline: none; }
.voice-item.active { border-color: var(--primary-line); background: linear-gradient(180deg, var(--surface), var(--primary-weak)); box-shadow: 0 0 0 1px var(--primary-line), var(--shadow-sm); }
.voice-avatar {
  width: 38px; height: 38px; border-radius: 10px; flex: 0 0 auto; display: grid; place-items: center;
  color: #fff; font-weight: 700; letter-spacing: 0.03em; box-shadow: inset 0 1px 0 rgba(255,255,255,0.15);
  font-size: inherit; padding: 0;
}
.voice-avatar svg { width: 18px; height: 18px; display: block; }
.voice-table tr:not(:hover) .voice-avatar .play,
.voice-table tr:hover .voice-avatar .letters,
.voice-item:not(:hover) .voice-avatar .play,
.voice-item:hover .voice-avatar .letters { display: none; }
.voice-item-main { min-width: 0; flex: 1 1 auto; display: flex; flex-direction: column; gap: 8px; }
.voice-item-tags { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.voice-preview { margin-left: auto; }
.voice-desc { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.voice-empty {
  padding: 24px; border-radius: var(--r-lg); border: 1px dashed var(--border-2);
  background: var(--surface-inset); color: var(--muted); text-align: center;
}

/* toggle switch */
.switch { position: relative; width: 42px; height: 24px; flex: 0 0 auto; }
.switch input { opacity: 0; width: 0; height: 0; }
.switch .track { position: absolute; inset: 0; background: var(--surface-3); border: 1px solid var(--border-2); border-radius: 999px; transition: 0.2s; }
.switch .track::before { content: ''; position: absolute; width: 18px; height: 18px; left: 2px; top: 2px; background: #fff; border-radius: 50%; transition: 0.2s; box-shadow: 0 1px 3px rgba(0,0,0,0.3); }
.switch input:checked + .track { background: var(--primary); border-color: transparent; }
.switch input:checked + .track::before { transform: translateX(18px); }

/* ── cards / panels ───────────────────────────────────────────────────────── */
.card {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-lg);
  padding: 20px; box-shadow: var(--shadow-sm);
}
[data-theme='dark'] .card { box-shadow: none; }
.card.pad-lg { padding: 26px; }
.card.hover { transition: 0.18s; }
.card.hover:hover { border-color: var(--border-strong); transform: translateY(-2px); box-shadow: var(--shadow); }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 16px; }
.card-title { display: flex; align-items: center; gap: 9px; font-family: var(--font-header); font-weight: 600; font-size: 16px; }
.card-title svg { width: 18px; height: 18px; color: var(--primary); }
.glass { background: var(--glass); backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px); }

/* stat card */
.stat { background: var(--surface); border: 1px solid var(--border); border-radius: var(--r); padding: 16px 18px; box-shadow: var(--shadow-sm); }
[data-theme='dark'] .stat { box-shadow: none; }
.stat .k { font-size: 12.5px; color: var(--muted); font-weight: 600; letter-spacing: 0.02em; }
.stat .v { font-family: var(--font-header); font-size: 28px; font-weight: 700; margin-top: 4px; letter-spacing: -0.02em; }
.stat .d { font-size: 12.5px; margin-top: 3px; }
.stat .v .unit { font-size: 14px; color: var(--muted); font-weight: 500; margin-left: 4px; }

/* ── badges / chips ───────────────────────────────────────────────────────── */
.badge {
  display: inline-flex; align-items: center; gap: 5px; padding: 3px 9px; border-radius: var(--r-full);
  font-size: 11.5px; font-weight: 600; letter-spacing: 0.02em; border: 1px solid var(--border-2);
  background: var(--surface-2); color: var(--text-2); white-space: nowrap;
}
.badge .dot { width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.badge.primary { color: var(--primary); background: var(--primary-weak); border-color: var(--primary-line); }
.badge.accent { color: var(--accent); background: var(--accent-weak); border-color: transparent; }
.badge.good { color: var(--good); background: var(--good-weak); border-color: transparent; }
.badge.warn { color: var(--warn); background: var(--warn-weak); border-color: transparent; }
.badge.bad { color: var(--bad); background: var(--bad-weak); border-color: transparent; }
.badge.mono { font-family: var(--font-mono); }
.badge.ghost { background: transparent; border-color: transparent; padding: 0; border-radius: 0; }
.chip { display: inline-flex; align-items: center; gap: 6px; padding: 5px 10px; border-radius: var(--r-full); background: var(--surface-2); border: 1px solid var(--border); font-size: 12.5px; font-weight: 500; }
.chip.active { border-color: var(--primary); color: var(--primary); }

/* rate badge (credit c/s) */
.rate { font-family: var(--font-mono); font-size: 12px; padding: 4px 8px; border-radius: var(--r-xs); border: 1px solid var(--border-2); color: var(--muted); background: var(--surface-inset); white-space: nowrap; }
.rate.t-low { color: var(--text-2); }
.rate.t-hd { color: var(--accent); border-color: var(--accent); }
.rate.t-good { color: var(--violet); border-color: var(--primary-line); }
.rate.t-cloned { color: var(--bad); border-color: var(--bad); }

/* ── progress / meters ────────────────────────────────────────────────────── */
.meter { height: 8px; background: var(--surface-3); border-radius: 999px; overflow: hidden; }
.meter > i { display: block; height: 100%; background: var(--primary); border-radius: 999px; transition: width 0.5s ease; }
.meter.grad > i { background: var(--grad); }
.meter.warn > i { background: var(--warn); }
.meter.bad > i { background: var(--bad); }
.meter.good > i { background: var(--good); }
.meter.lg { height: 12px; }
.meter.thin { height: 5px; }

/* ── tables ───────────────────────────────────────────────────────────────── */
/* Let wide data tables scroll horizontally inside their card instead of forcing
   the whole page wider on narrow viewports. Negative margin lets the scroll area
   reach the card edges (cards holding tables use the default 20px padding). */
.table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
@media (max-width: 680px) {
  .table-wrap { margin: 0 -20px; padding: 0 20px; }
  .table-wrap .table { min-width: 680px; }
}
.table { width: 100%; border-collapse: collapse; }
.gift-cards-table { table-layout: fixed; }
.table th { text-align: left; font-size: 11px; font-weight: 700; letter-spacing: 0.06em; text-transform: uppercase; color: var(--faint); padding: 0 14px 12px; }
.table td { padding: 14px; border-top: 1px solid var(--border); font-size: 14px; vertical-align: middle; }
.table tbody tr:hover td, .table tbody tr:hover td { background: var(--surface-2); }
.table.tight td { padding: 10px 12px; }
.table .num { font-variant-numeric: tabular-nums; }

/* Clickable job rows */
.table tbody tr.row-link { cursor: pointer; outline: none; }
.table tbody tr.row-link:focus-visible td { background: var(--surface-2); box-shadow: inset 2px 0 0 var(--primary); }
.row-chevron { display: inline-flex; color: var(--faint); opacity: 0; transition: opacity 0.15s, transform 0.15s; }
.table tbody tr.row-link:hover .row-chevron, .table tbody tr.row-link:focus-visible .row-chevron { opacity: 1; transform: translateX(2px); }

/* First-scene still thumbnail in the job row */
.job-thumb { position: relative; width: 68px; height: 44px; border-radius: 6px; overflow: hidden; background: var(--surface-2); border: 1px solid var(--border-2); flex: 0 0 auto; display: grid; place-items: center; }
.thumb-col { flex: 0 0 auto; width: 68px; display: grid; place-items: center; }
.job-thumb.portrait { width: 44px; height: 68px; }
.job-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.job-thumb .thumb-icon { display: inline-flex; color: var(--faint); }
.job-thumb .thumb-icon svg { width: 15px; height: 15px; }

/* Tabs (job detail modal) */
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--border); margin-bottom: 16px; }
.tab { display: inline-flex; align-items: center; gap: 6px; padding: 8px 12px; font-size: 13px; font-weight: 600; color: var(--muted); background: none; border: none; border-bottom: 2px solid transparent; margin-bottom: -1px; cursor: pointer; }
.tab:hover { color: var(--text); }
.tab.active { color: var(--primary); border-bottom-color: var(--primary); }
.tab svg { width: 15px; height: 15px; }

/* Read-only source viewer — mirrors the editor (gutter + syntax highlight) but
   without an editable textarea. */
.source-view { border-radius: var(--r-lg); border: 1px solid var(--border-2); background: var(--editor-bg); overflow: hidden; }
.source-body { display: flex; max-height: 360px; overflow: auto; align-items: start; }
.source-body .gutter { position: sticky; left: 0; flex: 0 0 auto; white-space: pre; z-index: 1;
  /* opaque base + tint so scrolled code can't bleed through the sticky gutter */
  background-color: var(--editor-bg);
  background-image: linear-gradient(var(--code-gutter-bg), var(--code-gutter-bg));
  border-right: 1px solid var(--code-line); }
.source-code { flex: 1 1 auto; margin: 0; padding: 14px 16px; box-sizing: border-box; color: var(--editor-text);
  font-family: var(--font-mono); font-size: 12.5px; line-height: 1.7; tab-size: 2;
  white-space: pre; overflow-wrap: normal; }
.code-cell { display: flex; align-items: center; gap: 8px; min-width: 0; }
.code-cell .code-text { display: block; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; flex: 1 1 auto; }
.code-cell .btn { flex: 0 0 auto; }
.gift-cards-table td:first-child, .gift-cards-table th:first-child { width: clamp(220px, 28vw, 360px); }

/* ── avatar ───────────────────────────────────────────────────────────────── */
.avatar { width: 34px; height: 34px; border-radius: var(--r-sm); display: grid; place-items: center; font-weight: 700; font-size: 13px; color: #fff; flex: 0 0 auto; background: var(--grad); }
.avatar.round { border-radius: 50%; }
.avatar.sm { width: 28px; height: 28px; font-size: 11px; }
.avatar.lg { width: 44px; height: 44px; font-size: 15px; border-radius: var(--r); }

/* ═══════════════════════ PUBLIC (marketing) ═══════════════════════════════ */
.pub { min-height: 100%; display: flex; flex-direction: column; }
.pub-nav {
  position: sticky; top: 0; z-index: 40; height: var(--topbar-h);
  border-bottom: 1px solid var(--border); background: var(--glass);
  backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px);
}
.pub-nav .container { height: 100%; display: flex; align-items: center; gap: 22px; }
.pub-nav .links { display: flex; gap: 4px; }
.pub-nav .links a { padding: 8px 12px; border-radius: var(--r-sm); font-size: 14px; font-weight: 500; color: var(--text-2); }
.pub-nav .links a:hover { color: var(--text); background: var(--surface-2); }
.pub-nav .links a.active { color: var(--primary); }
.brand { display: flex; align-items: center; gap: 10px; font-family: var(--font-header); font-weight: 700; font-size: 18px; letter-spacing: -0.02em; white-space: nowrap; }
.brand .logo { width: 30px; height: 30px; border-radius: 9px; display: block; box-shadow: 0 6px 16px -6px rgba(79, 70, 229, 0.6); }

.hero { position: relative; overflow: hidden; padding: 76px 0 60px; }
.hero::before { content: ''; position: absolute; inset: 0; background: radial-gradient(900px 460px at 78% -10%, var(--bg-tint-a), transparent 60%), radial-gradient(720px 460px at 4% 108%, var(--bg-tint-b), transparent 55%); pointer-events: none; }
.hero .container { position: relative; display: grid; grid-template-columns: 1.05fr 0.95fr; gap: 48px; align-items: center; }
.hero h1 { font-size: 56px; line-height: 1.03; letter-spacing: -0.035em; }
.hero .lead { font-size: 18px; color: var(--text-2); margin-top: 20px; max-width: 34ch; }
.eyebrow { display: inline-flex; align-items: center; gap: 8px; padding: 6px 13px; border-radius: 999px; background: var(--primary-weak); border: 1px solid var(--primary-line); color: var(--primary); font-size: 12.5px; font-weight: 600; letter-spacing: 0.02em; white-space: nowrap; }
.hero-cta { display: flex; gap: 12px; margin-top: 30px; flex-wrap: wrap; }
.logos { margin-top: 44px; }
.logos .k { font-size: 11px; letter-spacing: 0.14em; text-transform: uppercase; color: var(--faint); font-weight: 700; }
.logos .set { display: flex; gap: 28px; flex-wrap: wrap; margin-top: 14px; font-family: var(--font-header); font-weight: 600; font-size: 18px; color: var(--faint); }

/* code window mock */
.win { border-radius: var(--r-lg); border: 1px solid var(--border-2); background: var(--code-bg); box-shadow: var(--shadow-lg); overflow: hidden; }
.win-bar { display: flex; align-items: center; gap: 7px; padding: 8px 10px 8px 14px; border-bottom: 1px solid rgba(255,255,255,0.08); }
.win-bar .dot { width: 11px; height: 11px; border-radius: 50%; }
.win-bar .t { flex: 1; min-width: 0; font-family: var(--font-mono); font-size: 12px; color: #7f8bb0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* Copy button on code viewers */
.copy-btn {
  display: inline-flex; align-items: center; justify-content: center;
  width: 30px; height: 30px; flex-shrink: 0; cursor: pointer;
  border-radius: 7px; color: #9aa4c4;
  background: rgba(255,255,255,0.05); border: 1px solid rgba(255,255,255,0.1);
  transition: color .15s, background .15s, border-color .15s;
}
.copy-btn:hover { color: #fff; background: rgba(255,255,255,0.1); }
.copy-btn svg { width: 15px; height: 15px; }
.copy-btn .copy-btn-done { display: none; align-items: center; color: #34d399; }
.copy-btn.copied > svg { display: none; }
.copy-btn.copied .copy-btn-done { display: inline-flex; }
.win-copy { margin-left: 8px; }

.code-plain-wrap { position: relative; }
.code-plain-wrap .plain-copy {
  position: absolute; top: 8px; right: 8px; z-index: 2;
  width: 28px; height: 28px; opacity: 0; transition: opacity .15s, color .15s, background .15s, border-color .15s;
}
.code-plain-wrap:hover .plain-copy, .code-plain-wrap .plain-copy:focus-visible, .plain-copy.copied { opacity: 1; }
.code-plain-wrap .code-plain { margin: 0; }
.win pre { margin: 0; padding: 16px 18px; font-family: var(--font-mono); font-size: 12.5px; line-height: 1.7; color: var(--code-text); overflow-x: auto; }

/* rendered-frame preview gallery (docs) */
.frame-gallery { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 18px; }
.frame { border-radius: var(--r-lg); overflow: hidden; border: 1px solid var(--border-2); box-shadow: var(--shadow-lg); background: #0d1117; }
.frame svg { display: block; width: 100%; height: auto; }
.frame .cap { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 10px 12px; border-top: 1px solid rgba(255,255,255,0.07); font-size: 12.5px; color: #aeb6cf; background: #10151e; }
.frame .cap code { font-family: var(--font-mono); font-size: 11px; color: #9db4ff; }
.slot-table td .mono { color: var(--primary); }

/* editor scene-preview strip (one still per scene) */
.scene-preview .badge.busy .dot { animation: pulse 0.9s ease-in-out infinite; }
@keyframes pulse { 50% { opacity: 0.25; } }
.scene-strip { display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px; max-height: 460px; overflow-y: auto; margin-top: 4px; }
.scene-thumb { margin: 0; border-radius: var(--r-md); overflow: hidden; border: 1px solid var(--border-2); background: #0d1117; }
.scene-thumb img { display: block; width: 100%; height: auto; aspect-ratio: 16 / 9; object-fit: cover; }
.scene-strip.portrait { grid-template-columns: repeat(3, 1fr); }
.scene-strip.portrait .scene-thumb img { aspect-ratio: 9 / 16; }
.scene-thumb figcaption { display: flex; align-items: center; gap: 7px; padding: 7px 9px; font-size: 12px; border-top: 1px solid var(--border); }
.scene-thumb figcaption .n { display: inline-flex; align-items: center; justify-content: center; min-width: 18px; height: 18px; border-radius: 5px; background: var(--primary-weak); color: var(--primary); font-size: 11px; font-weight: 700; }
.scene-thumb figcaption .mono { color: var(--muted); }
.scene-ph { grid-column: 1 / -1; display: flex; flex-direction: column; align-items: center; gap: 10px; text-align: center; padding: 30px 16px; color: var(--muted); font-size: 13px; }
.scene-ph svg { width: 26px; height: 26px; color: var(--faint); }

.section { padding: 64px 0; }
.section-head { text-align: center; max-width: 640px; margin: 0 auto 40px; }
.section-head h2 { font-size: 36px; letter-spacing: -0.03em; }
.section-head p { color: var(--text-2); margin-top: 12px; font-size: 17px; }
.feature-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 18px; }
.feature .ic { width: 40px; height: 40px; border-radius: var(--r); display: grid; place-items: center; background: var(--grad-soft); color: var(--primary); margin-bottom: 16px; }
.feature h3 { font-size: 18px; margin-bottom: 8px; }
.feature p { color: var(--text-2); font-size: 14.5px; }
.feature ul { list-style: none; padding: 0; margin: 14px 0 0; display: grid; gap: 7px; }
.feature li { display: flex; gap: 8px; align-items: center; font-size: 13.5px; color: var(--text-2); }
.feature li svg { width: 15px; height: 15px; color: var(--good); flex: 0 0 auto; }

.cta-band { text-align: center; padding: 72px 24px; margin: 40px auto; max-width: 900px; border-radius: var(--r-xl); background: var(--grad-soft); border: 1px solid var(--primary-line); }
.cta-band h2 { font-size: 40px; letter-spacing: -0.03em; }
.cta-band p { color: var(--text-2); margin: 14px auto 26px; max-width: 46ch; }
.cta-band .dev-hint { font-size: 13.5px; margin-top: 22px; margin-bottom: 0; color: var(--muted); }
.cta-band .dev-hint a { color: var(--primary); font-weight: 600; display: inline-flex; align-items: center; gap: 4px; }
.cta-band .dev-hint a svg { width: 15px; height: 15px; }

/* ── consumer home: AI chat demo + how-it-works ───────────────────────────── */
.hero-note { margin-top: 18px; font-size: 13px; }
.chat-demo { border-radius: var(--r-lg); border: 1px solid var(--border-2); background: var(--surface); box-shadow: var(--shadow-lg); overflow: hidden; }
.chat-demo .win-bar { border-bottom: 1px solid var(--border); }
.chat-demo .win-bar .t { display: inline-flex; align-items: center; gap: 6px; color: var(--text-2); }
.chat-demo .win-bar .t svg { width: 14px; height: 14px; }
.chat-body { padding: 18px; display: flex; flex-direction: column; gap: 14px; }
.bubble { max-width: 84%; padding: 11px 14px; border-radius: 16px; font-size: 14px; line-height: 1.55; }
.bubble.user { align-self: flex-end; background: var(--grad); color: #fff; border-bottom-right-radius: 5px; }
.bubble.ai { align-self: flex-start; background: var(--surface-2); color: var(--text); border: 1px solid var(--border); border-bottom-left-radius: 5px; max-width: 92%; }
.bubble .who { display: block; font-size: 10.5px; font-weight: 700; letter-spacing: 0.05em; text-transform: uppercase; opacity: 0.72; margin-bottom: 4px; }
.vid-card { margin-top: 11px; border-radius: 12px; overflow: hidden; border: 1px solid var(--border); }
.vid-thumb { position: relative; aspect-ratio: 16 / 9; background: linear-gradient(135deg, #4f46e5, #0ea5e9); display: grid; place-items: center; }
.vid-thumb .play { width: 46px; height: 46px; border-radius: 50%; background: rgba(255, 255, 255, 0.92); color: #4f46e5; display: grid; place-items: center; box-shadow: 0 6px 16px -6px rgba(0, 0, 0, 0.5); }
.vid-thumb .play svg { width: 20px; height: 20px; margin-left: 2px; }
.vid-thumb .dur { position: absolute; right: 8px; bottom: 8px; background: rgba(0, 0, 0, 0.62); color: #fff; font-size: 11px; padding: 2px 6px; border-radius: 5px; font-family: var(--font-mono); }
.vid-meta { display: flex; align-items: center; gap: 7px; padding: 9px 12px; background: var(--surface); font-size: 12.5px; color: var(--text-2); }
.vid-meta svg { width: 15px; height: 15px; flex: 0 0 auto; }
.how { display: grid; grid-template-columns: repeat(3, 1fr); gap: 18px; }
.how-step { padding: 26px 22px; border-radius: var(--r-lg); border: 1px solid var(--border); background: var(--surface); }
.how-num { width: 34px; height: 34px; border-radius: 50%; background: var(--grad-soft); color: var(--primary); font-weight: 800; font-size: 15px; display: grid; place-items: center; margin-bottom: 15px; }
.how-step h3 { font-size: 17px; margin-bottom: 6px; letter-spacing: -0.01em; }
.how-step p { color: var(--text-2); font-size: 14px; line-height: 1.6; }
@media (max-width: 860px) { .how { grid-template-columns: 1fr; } }

/* ── friendly connect page (#/connect) ─────────────────────────────────────── */
.connect-hero .section-head { margin-bottom: 30px; }
.connect-url { max-width: 620px; margin: 0 auto 34px; }
.connect-url-label { font-size: 13px; color: var(--text-2); text-align: center; margin-bottom: 10px; }
.connect-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
.connect-card-head { display: flex; align-items: center; gap: 10px; margin-bottom: 18px; }
.connect-name { font-family: var(--font-header); font-weight: 600; font-size: 18px; letter-spacing: -0.01em; }
.connect-note { text-align: center; font-size: 13.5px; margin-top: 20px; }
.connect-fallback { margin-top: 28px; max-width: 720px; margin-left: auto; margin-right: auto; }
.connect-fallback-head { display: flex; align-items: flex-start; gap: 14px; margin-bottom: 18px; }
.connect-fallback-head .ic { flex: none; width: 40px; height: 40px; border-radius: var(--r); display: grid; place-items: center; background: var(--grad-soft); color: var(--primary); }
.connect-fallback-head h3 { font-family: var(--font-header); font-weight: 600; font-size: 17px; letter-spacing: -0.01em; margin-bottom: 4px; }
.connect-fallback-head p { font-size: 13.5px; line-height: 1.5; }
.connect-fallback-cta { display: flex; justify-content: center; }
.connect-fallback > .tiny { text-align: center; }
.ask-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 18px; }
.ask-card { display: flex; flex-direction: column; gap: 14px; }
.ask-card .ic { width: 40px; height: 40px; border-radius: var(--r); display: grid; place-items: center; background: var(--grad-soft); color: var(--primary); }
.ask-prompt { font-size: 15px; line-height: 1.5; color: var(--text); font-style: italic; }
@media (max-width: 860px) { .connect-grid, .ask-grid { grid-template-columns: 1fr; } }

.pub-foot { border-top: 1px solid var(--border); padding: 30px 0; margin-top: auto; color: var(--muted); font-size: 13.5px; }
.pub-foot .container { display: flex; justify-content: space-between; gap: 20px; flex-wrap: wrap; }
.pub-foot .flinks { display: flex; gap: 20px; flex-wrap: wrap; }
.pub-foot a:hover { color: var(--text); }

/* pricing */
.price-grid { display: grid; /* grid-template-columns: repeat(3, 1fr); */ grid-template-columns: repeat(2, 1fr); gap: 18px; align-items: start; }
.price-card { position: relative; }
.price-card.featured { border-color: var(--primary); box-shadow: 0 20px 50px -24px rgba(79,70,229,0.4); }
.price-card .plan { font-size: 14px; font-weight: 700; letter-spacing: 0.02em; color: var(--primary); }
.price-card .amt { font-family: var(--font-header); font-size: 44px; font-weight: 700; margin: 8px 0 2px; letter-spacing: -0.03em; }
.price-card .amt small { font-size: 15px; color: var(--muted); font-weight: 500; }
.price-card ul { list-style: none; padding: 0; margin: 18px 0; display: grid; gap: 10px; }
.price-card li { display: flex; gap: 9px; font-size: 14px; color: var(--text-2); align-items: flex-start; }
.price-card li svg { width: 16px; height: 16px; color: var(--good); flex: 0 0 auto; margin-top: 2px; }
.ribbon { position: absolute; top: -11px; right: 18px; background: var(--grad); color: #fff; font-size: 11px; font-weight: 700; padding: 4px 11px; border-radius: 999px; letter-spacing: 0.04em; }
.rate-table { width: 100%; border-collapse: collapse; }
.rate-table td, .rate-table th { padding: 12px 14px; border-bottom: 1px solid var(--border); text-align: left; font-size: 14px; }
.rate-table th { font-size: 11px; text-transform: uppercase; letter-spacing: 0.06em; color: var(--faint); }

/* ═══════════════════════ AUTH ═════════════════════════════════════════════ */
.auth { min-height: 100vh; display: grid; grid-template-columns: 1fr 1fr; }
.auth-aside { position: relative; overflow: hidden; padding: 48px; display: flex; flex-direction: column; justify-content: space-between; background: #0a1120; color: #e7ecfb; }
.auth-aside::before { content: ''; position: absolute; inset: 0; background: radial-gradient(700px 500px at 30% 10%, rgba(124,92,255,0.28), transparent 60%), radial-gradient(600px 500px at 90% 100%, rgba(66,211,255,0.16), transparent 55%); }
.auth-aside > * { position: relative; }
.auth-aside .quote { font-family: var(--font-header); font-size: 26px; line-height: 1.3; letter-spacing: -0.02em; max-width: 22ch; }
.auth-main { display: grid; place-items: center; padding: 40px 24px; background: var(--bg); }
.auth-box { width: 100%; max-width: 380px; }
.auth-box h1 { font-size: 28px; margin-bottom: 6px; }
.auth-intro { margin-bottom: 22px; }
.seg { display: flex; gap: 4px; background: var(--surface-2); border: 1px solid var(--border); padding: 4px; border-radius: var(--r-sm); margin: 20px 0; }
.seg a { flex: 1; text-align: center; padding: 8px; border-radius: var(--r-xs); font-size: 13.5px; font-weight: 600; color: var(--muted); }
.seg a.active { background: var(--surface); color: var(--text); box-shadow: var(--shadow-sm); }

/* ═══════════════════════ APP SHELL (portal / admin) ═══════════════════════ */
.app { min-height: 100vh; display: grid; grid-template-columns: var(--sidebar-w) 1fr; background: var(--bg); position: relative; }
.app::before { content: ''; position: fixed; inset: 0; pointer-events: none; z-index: 0; background: radial-gradient(900px 500px at 85% -8%, var(--bg-tint-a), transparent 60%), radial-gradient(700px 500px at -5% 105%, var(--bg-tint-b), transparent 55%); }
.sidebar {
  position: sticky; top: 0; height: 100vh; z-index: 20;
  border-right: 1px solid var(--border); background: var(--surface);
  display: flex; flex-direction: column; padding: 16px 14px; gap: 6px;
  overflow-y: auto; overflow-x: hidden; overscroll-behavior: contain;
  scrollbar-gutter: stable;
}
.sidebar .org {
  display: flex; align-items: center; gap: 11px; padding: 10px; border-radius: var(--r);
  background: var(--surface-2); border: 1px solid var(--border); margin-bottom: 8px; cursor: pointer;
}
.sidebar .org .meta { min-width: 0; }
.sidebar .org .n { font-weight: 700; font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sidebar .org .p { font-size: 11.5px; color: var(--muted); }
.org-choice { width: 100%; display: flex; align-items: center; gap: 12px; padding: 12px; border: 1px solid var(--border); border-radius: var(--r); background: var(--surface-2); color: var(--text); text-align: left; cursor: pointer; }
.org-choice + .org-choice { margin-top: 10px; }
.org-choice:hover, .org-choice.active { border-color: var(--primary); background: var(--surface-3); }
.org-choice svg { width: 18px; height: 18px; flex: 0 0 auto; }
.org-choice .meta { min-width: 0; }
.nav { display: flex; flex-direction: column; gap: 2px; margin-top: 6px; }
.nav .lbl { font-size: 10.5px; letter-spacing: 0.1em; text-transform: uppercase; color: var(--faint); font-weight: 700; padding: 12px 10px 5px; }
.nav a { display: flex; align-items: center; gap: 11px; padding: 9px 11px; border-radius: var(--r-sm); font-size: 14px; font-weight: 500; color: var(--text-2); position: relative; }
.nav a svg { width: 18px; height: 18px; opacity: 0.85; flex: 0 0 auto; }
.nav a:hover { background: var(--surface-2); color: var(--text); }
.nav a.active { background: var(--primary-weak); color: var(--primary); font-weight: 600; }
[data-theme='dark'] .nav a.active { box-shadow: inset 0 0 0 1px var(--primary-line), 0 0 18px -8px rgba(139,140,255,0.6); }
.nav a.active svg { opacity: 1; }
.sidebar-foot { margin-top: auto; display: flex; flex-direction: column; gap: 2px; padding-top: 10px; border-top: 1px solid var(--border); }

.main { min-width: 0; position: relative; z-index: 1; display: flex; flex-direction: column; }
.topbar {
  position: sticky; top: 0; z-index: 15; height: var(--topbar-h);
  display: flex; align-items: center; gap: 14px; padding: 0 28px;
  border-bottom: 1px solid var(--border); background: var(--glass);
  backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px);
}
.topbar .credits {
  display: flex; align-items: center; gap: 8px; padding: 7px 13px; border-radius: var(--r-full);
  background: var(--primary-weak); border: 1px solid var(--primary-line); color: var(--primary);
  font-weight: 700; font-size: 14px; font-variant-numeric: tabular-nums;
}
.topbar .credits svg { width: 16px; height: 16px; }
.content { padding: 28px; max-width: 1240px; width: 100%; }
.page-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 20px; margin-bottom: 24px; flex-wrap: wrap; }
.page-head h1 { font-size: 30px; letter-spacing: -0.03em; }
.page-head .sub { color: var(--muted); margin-top: 6px; font-size: 15px; }
.crumb { font-size: 12px; font-weight: 700; letter-spacing: 0.06em; text-transform: uppercase; color: var(--faint); margin-bottom: 8px; }
.crumb b { color: var(--primary); }

/* grids used across pages */
.g-2 { display: grid; grid-template-columns: repeat(2, 1fr); gap: 18px; }
.g-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 18px; }
.g-4 { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; }
.split-2 { display: grid; grid-template-columns: 2fr 1fr; gap: 18px; align-items: start; }
.split-editor { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; align-items: start; }
.admin-gift-grid { display: grid; grid-template-columns: 2fr 1fr 1fr; gap: 18px; align-items: start; }
/* min-width:0 lets these grid items shrink below the table's min-content so the
   table scrolls inside .table-wrap instead of forcing the whole page to overflow. */
.gift-cards-panel { grid-column: span 2; min-width: 0; }
.gift-card-generator { grid-column: span 1; min-width: 0; }

/* member/user rows */
.urow { display: grid; grid-template-columns: 1.4fr 0.7fr 2fr auto; gap: 16px; align-items: center; padding: 14px 4px; border-top: 1px solid var(--border); }
.urow:first-child { border-top: none; }
.uinfo { display: flex; align-items: center; gap: 11px; min-width: 0; }
.uinfo .n { font-weight: 600; font-size: 14px; }
.uinfo .e { font-size: 12.5px; color: var(--muted); }
.quota-cell .top { display: flex; justify-content: space-between; font-size: 12.5px; margin-bottom: 6px; }

/* per-member action menu */
.row-menu { position: relative; display: inline-block; }
.row-menu > summary { list-style: none; cursor: pointer; }
.row-menu > summary::-webkit-details-marker { display: none; }
.row-menu[open] > summary { background: var(--surface-2); border-color: var(--border-2); }
.row-menu-list {
  position: absolute; z-index: 35; right: 0; top: calc(100% + 5px);
  width: max-content; min-width: 180px;
  background: var(--surface); border: 1px solid var(--border-2);
  border-radius: var(--r-sm); box-shadow: var(--shadow-lg); padding: 5px;
  display: grid; gap: 2px;
}
.row-menu-item {
  display: flex; align-items: center; gap: 9px; width: 100%;
  padding: 7px 9px; border: none; background: none; cursor: pointer;
  border-radius: var(--r-xs); color: var(--text); font-size: 13px; text-align: left;
  font: inherit; font-size: 13px;
}
.row-menu-item:hover { background: var(--surface-2); }
.row-menu-item svg { width: 15px; height: 15px; flex: 0 0 auto; color: var(--muted); }
.row-menu-item.danger { color: var(--bad); }
.row-menu-item.danger svg { color: var(--bad); }

/* ── Org SSO setup ───────────────────────────────────────────────────────── */
.sso-connection { padding: 12px 0; border-bottom: 1px solid var(--border); min-width: 0; }
.sso-connection-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; min-width: 0; }
.sso-connection-main { display: flex; align-items: center; gap: 10px; min-width: 0; flex: 1 1 280px; }
.sso-connection-text { min-width: 0; }
.sso-actions { display: flex; align-items: center; justify-content: flex-end; gap: 8px; flex-wrap: wrap; }
.sso-actions .badge svg { width: 13px; height: 13px; }
.sso-redirect-uri { margin-bottom: 14px; max-width: 720px; }
.sso-copy-field { min-width: 0; }
.sso-pending-panel {
  margin-top: 12px; padding: 14px; border: 1px solid var(--border-2); border-left: 4px solid var(--warn);
  border-radius: var(--r-sm); background: var(--surface-inset);
}
.sso-pending-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 14px; margin-bottom: 12px; }
.sso-pending-copy { display: flex; align-items: flex-start; gap: 9px; min-width: 0; color: var(--warn); }
.sso-pending-copy .muted { color: var(--text-2); }
.sso-dns-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 14px; }
.sso-dns-row { min-width: 0; }
.sso-dns-label { font-size: 12px; font-weight: 700; color: var(--text-2); margin-bottom: 6px; }
.sso-dns-value-row { display: grid; grid-template-columns: minmax(0, 1fr) 36px; align-items: stretch; }
.sso-dns-value {
  min-width: 0; background: var(--surface); border: 1px solid var(--border);
  border-right: 0; border-radius: var(--r-sm) 0 0 var(--r-sm); padding: 9px 10px;
  overflow-wrap: anywhere; line-height: 1.55; word-break: break-all;
}
.sso-copy-btn {
  display: inline-flex; align-items: center; justify-content: center; width: 36px;
  border: 1px solid var(--border); border-radius: 0 var(--r-sm) var(--r-sm) 0;
  background: var(--surface); color: var(--text-2); cursor: pointer; transition: 0.15s ease;
}
.sso-copy-btn:hover { background: var(--surface-2); color: var(--text); border-color: var(--border-strong); }
.sso-copy-btn svg { width: 16px; height: 16px; }

/* wallet card */
.wallet { background: linear-gradient(135deg, var(--surface-2), var(--surface)); border: 1px solid var(--primary-line); border-radius: var(--r-lg); padding: 20px; position: relative; overflow: hidden; }
.wallet::after { content: ''; position: absolute; top: -40px; right: -30px; width: 160px; height: 160px; border-radius: 50%; background: var(--grad-soft); filter: blur(10px); }
.wallet .bal { font-family: var(--font-header); font-size: 38px; font-weight: 700; letter-spacing: -0.03em; position: relative; }
.wallet .bal .unit { font-size: 15px; color: var(--muted); font-weight: 500; margin-left: 6px; }

/* bank extract / ledger list */
.ledger { display: flex; flex-direction: column; }
.ledger .li { display: flex; align-items: flex-start; gap: 12px; padding: 13px 0; border-top: 1px solid var(--border); }
.ledger .li:first-child { border-top: none; }
.ledger .li .ic { width: 32px; height: 32px; border-radius: var(--r-sm); display: grid; place-items: center; flex: 0 0 auto; background: var(--surface-2); color: var(--muted); }
.ledger .li .ic.in { color: var(--good); background: var(--good-weak); }
.ledger .li .ic.out { color: var(--muted); }
.ledger .li .amt { margin-left: auto; font-family: var(--font-mono); font-weight: 600; font-size: 14px; white-space: nowrap; }
.ledger .li .amt.pos { color: var(--good); }
.ledger .li .amt.neg { color: var(--text); }
.ledger .li .t { font-weight: 600; font-size: 13.5px; }
.ledger .li .s { font-size: 12px; color: var(--muted); font-family: var(--font-mono); margin-top: 2px; }

/* YAML syntax tokens — default (dark surface: LP code window + dark theme). */
.hl-key { color: #9db4ff; }
.hl-str { color: #9ff0c8; }
.hl-num { color: #ffcf8a; }
.hl-com { color: #4a5578; }
.hl-punc { color: #7f8bb0; }
/* On the light editor/source surface, use saturated tokens for readable contrast. */
[data-theme='light'] .editor-pane .hl-key, [data-theme='light'] .source-view .hl-key { color: #3538cd; }
[data-theme='light'] .editor-pane .hl-str, [data-theme='light'] .source-view .hl-str { color: #0f8a5f; }
[data-theme='light'] .editor-pane .hl-num, [data-theme='light'] .source-view .hl-num { color: #b3560a; }
[data-theme='light'] .editor-pane .hl-com, [data-theme='light'] .source-view .hl-com { color: #8a8fa3; }
[data-theme='light'] .editor-pane .hl-punc, [data-theme='light'] .source-view .hl-punc { color: #6b6e82; }

/* editor */
.editor-pane { border-radius: var(--r-lg); border: 1px solid var(--border-2); background: var(--editor-bg); overflow: hidden; display: flex; flex-direction: column; }
.editor-head { display: flex; align-items: center; justify-content: space-between; padding: 10px 14px; border-bottom: 1px solid var(--code-line); }
.editor-head .lang { font-family: var(--font-mono); font-size: 11px; letter-spacing: 0.08em; color: var(--code-dim); text-transform: uppercase; }
.editor-body { display: flex; min-height: 440px; max-height: min(640px, 70vh); }
.gutter { padding: 14px 10px; text-align: right; font-family: var(--font-mono); font-size: 12.5px; line-height: 1.7; color: var(--code-gutter); user-select: none; background: var(--code-gutter-bg); overflow: hidden; }
/* Highlight overlay: the <pre> and <textarea> must share identical box metrics
   so the colored layer sits exactly under the (transparent-text) caret layer. */
.code-wrap { position: relative; flex: 1; min-width: 0; }
.code-hl, .code-input {
  margin: 0; border: 0; padding: 14px 16px; box-sizing: border-box;
  font-family: var(--font-mono); font-size: 12.5px; line-height: 1.7; tab-size: 2;
  white-space: pre; overflow-wrap: normal; letter-spacing: normal;
}
.code-hl { position: absolute; inset: 0; overflow: hidden; color: var(--editor-text); pointer-events: none; }
.code-input {
  position: absolute; inset: 0; width: 100%; height: 100%;
  background: transparent; color: transparent; caret-color: var(--editor-text);
  resize: none; outline: none; overflow: auto;
}
.code-input::selection { background: rgba(124,140,255,0.35); }
/* assets:// suggestions, positioned at the caret over the code layers. */
.ac {
  position: absolute; z-index: 20; min-width: 220px; max-width: min(520px, 90%); max-height: 216px; overflow: auto;
  background: var(--surface); border: 1px solid var(--line); border-radius: 10px;
  box-shadow: 0 12px 28px rgba(0,0,0,0.28); padding: 4px;
}
.ac-item {
  display: flex; align-items: baseline; justify-content: space-between; gap: 10px;
  padding: 5px 8px; border-radius: 6px; cursor: pointer; font-size: 12px; white-space: nowrap;
}
/* Middle ellipsis: the head shrinks and clips, the tail never does — so a long
   name keeps both its recognisable start and its distinguishing end. */
.ac-item .mono { display: flex; min-width: 0; flex: 1 1 auto; }
.ac-item .head { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.ac-item .tail { flex: 0 0 auto; }
.ac-item:hover, .ac-item.active { background: var(--primary-weak); color: var(--primary); }
.console { font-family: var(--font-mono); font-size: 12.5px; display: flex; flex-direction: column; gap: 8px; }
.console .ln { display: flex; gap: 9px; align-items: flex-start; }
.console .tag { padding: 1px 6px; border-radius: 4px; font-size: 10px; font-weight: 700; letter-spacing: 0.06em; flex: 0 0 auto; margin-top: 1px; }
.console .tag.info { background: var(--primary-weak); color: var(--primary); }
.console .tag.ok { background: var(--good-weak); color: var(--good); }
.console .tag.warn { background: var(--warn-weak); color: var(--warn); }
.console .tag.err { background: var(--bad-weak); color: var(--bad); }

/* video preview / player */
.player { aspect-ratio: 16 / 9; border-radius: var(--r); overflow: hidden; background: #06080f; position: relative; display: grid; place-items: center; border: 1px solid var(--border-2); }
.player video { width: 100%; height: 100%; object-fit: contain; }
.player .ph { display: flex; flex-direction: column; align-items: center; gap: 12px; color: var(--faint); }
.player .ph .play { width: 58px; height: 58px; border-radius: 50%; background: var(--glass); display: grid; place-items: center; color: var(--text); }

/* audio waveform player (TTS) — overrides the 16:9 video frame */
.player.portrait { aspect-ratio: 9 / 16; max-width: 340px; margin-left: auto; margin-right: auto; }
/* `display: block` (not the inherited grid + place-items: center) so the wave
   fills the host: centred grid items are sized from content, and the canvas's
   `width` attribute would then hold the row wider than a narrow container. */
.player.audio { aspect-ratio: auto; background: var(--surface-inset); display: block; }
.wave { display: flex; align-items: center; gap: 14px; width: 100%; padding: 16px 18px; box-sizing: border-box; }
.wave .pp { flex: 0 0 auto; width: 44px; height: 44px; border-radius: 50%; border: 1px solid var(--border-2); background: var(--surface); color: var(--text); display: grid; place-items: center; cursor: pointer; transition: background .15s, transform .1s; }
.wave .pp:hover { background: var(--surface-2); }
.wave .pp:active { transform: scale(0.96); }
.wave .pp:disabled { opacity: 0.5; cursor: default; }
.wave canvas { flex: 1; height: 56px; min-width: 0; cursor: pointer; }
.wave .tm { flex: 0 0 auto; font-family: var(--font-header); font-size: 12px; font-variant-numeric: tabular-nums; color: var(--muted); min-width: 76px; text-align: right; }
/* Narrow screens: claw back chrome so the waveform itself keeps a usable width. */
@media (max-width: 560px) {
  .wave { gap: 10px; padding: 12px; }
  .wave .pp { width: 38px; height: 38px; }
  .wave canvas { height: 48px; }
  .wave .tm { min-width: 0; }
}

/* estimate box */
.estimate .big { font-family: var(--font-header); font-size: 34px; font-weight: 700; color: var(--primary); letter-spacing: -0.02em; }
.seg-toggle { display: inline-flex; background: var(--surface-inset); border: 1px solid var(--border-2); border-radius: var(--r-sm); padding: 3px; gap: 3px; }
.seg-toggle button { display: inline-flex; align-items: center; justify-content: center; gap: 6px; border: none; background: transparent; padding: 8px 12px; border-radius: var(--r-xs); font-size: 13px; font-weight: 600; color: var(--muted); }
.seg-toggle button.active { background: var(--primary); color: var(--primary-ink); }
/* Two-line segments (label + qualifier). The sub-label inherits the segment's
   color so it stays legible on the active fill — never a fixed muted tone. */
/* Format picker: two cards that *show* the aspect they produce, plus where the
   shape is normally posted — friendlier than reading "9:16" and picturing it. */
.fmt-cards { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.fmt-cards button { display: flex; align-items: center; gap: 10px; text-align: left; padding: 10px 11px;
  background: var(--surface-inset); border: 1px solid var(--border-2); border-radius: var(--r-sm); color: var(--text); }
.fmt-cards button:hover { border-color: var(--border-1); }
.fmt-cards button.active { border-color: var(--primary); background: color-mix(in srgb, var(--primary) 12%, transparent); }
.fmt-cards .shape { flex: 0 0 auto; border: 2px solid var(--muted); border-radius: 3px; }
.fmt-cards .shape.wide { width: 26px; height: 15px; }
.fmt-cards .shape.tall { width: 15px; height: 26px; }
.fmt-cards button.active .shape { border-color: var(--primary); background: color-mix(in srgb, var(--primary) 25%, transparent); }
.fmt-cards .txt { display: flex; flex-direction: column; gap: 1px; min-width: 0; }
.fmt-cards .txt b { font-size: 13px; font-weight: 600; }
.fmt-cards .txt .sub { font-size: 11px; color: var(--muted); }

/* Tick slider: a discrete range styled as a track of dots with a filled lead-in.
   The dots are a sibling layer under a transparent-track native input, so
   keyboard, drag and click behaviour all stay the browser's. */
.slider-ends { display: flex; justify-content: space-between; font-size: 12px; color: var(--muted); margin-bottom: 6px; }
.tick-slider { position: relative; height: 30px; }
.tick-slider .ticks { position: absolute; inset: 0; display: flex; align-items: center; justify-content: space-between;
  background: var(--surface-inset); border: 1px solid var(--border-2); border-radius: var(--r-sm); padding: 0 8px; overflow: hidden; }
.tick-slider .ticks::before { content: ''; position: absolute; left: 0; top: 0; bottom: 0; width: var(--pct, 0%); background: color-mix(in srgb, var(--primary) 45%, transparent);
  transition: width .18s cubic-bezier(.2, .8, .3, 1); }
.tick-slider .ticks i { position: relative; width: 4px; height: 4px; border-radius: 50%; background: var(--muted); opacity: .55; }
.tick-slider input[type="range"] { position: absolute; inset: 0; width: 100%; height: 100%; margin: 0; appearance: none; background: transparent; }
/* Native thumb is the (invisible) hit target; `.thumb` is what you see, so it
   can ease between steps — a native thumb jumps, it cannot be transitioned. */
.tick-slider input[type="range"]::-webkit-slider-thumb { appearance: none; width: 24px; height: 24px; opacity: 0; cursor: pointer; }
.tick-slider input[type="range"]::-moz-range-thumb { width: 24px; height: 24px; opacity: 0; border: none; cursor: pointer; }
.tick-slider .thumb { position: absolute; top: 0; bottom: 0; width: 20px; border-radius: var(--r-sm); background: var(--primary);
  left: var(--thumb-x, 0px); pointer-events: none;
  transition: left .18s cubic-bezier(.2, .8, .3, 1); }
.tick-slider input[type="range"]:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; border-radius: var(--r-sm); }
.seg-toggle button:has(.sub) { flex-direction: column; gap: 1px; line-height: 1.25; }
.seg-toggle button .sub { font-size: 11px; font-weight: 500; color: inherit; opacity: .7; }

/* TTS studio */
.tts-panel .field:last-of-type { margin-bottom: 0; }
.tts-text { min-height: 200px; resize: vertical; line-height: 1.6; }
.tts-metrics { align-items: stretch; }
.tts-result { display: flex; flex-direction: column; gap: 14px; }
.tts-player { aspect-ratio: auto; min-height: 180px; background: var(--surface-3); }
.tts-player audio { width: 100%; max-width: 100%; }
/* In waveform mode drop the tall placeholder height + dark frame so the player
   is as compact as the one in the jobs list. */
.tts-player.audio { min-height: 0; background: var(--surface-inset); }
.tts-actions { display: flex; gap: 8px; margin-top: 12px; flex-wrap: wrap; }
.tts-meta { display: flex; flex-direction: column; gap: 8px; padding-top: 2px; }

/* ── modal ────────────────────────────────────────────────────────────────── */
.modal-scrim { position: fixed; inset: 0; z-index: 90; background: rgba(6, 9, 20, 0.6); backdrop-filter: blur(4px); display: grid; place-items: center; padding: 24px; animation: fade 0.15s ease; }
.modal { width: 100%; max-width: 480px; background: var(--surface); border: 1px solid var(--border-2); border-radius: var(--r-lg); box-shadow: var(--shadow-lg); animation: pop 0.16s ease; max-height: 90vh; overflow: auto; }
.modal-head { display: flex; align-items: center; justify-content: space-between; padding: 18px 20px; border-bottom: 1px solid var(--border); }
.modal-head h3 { font-size: 18px; }
.modal-body { padding: 20px; }
.modal-foot { padding: 16px 20px; border-top: 1px solid var(--border); display: flex; justify-content: flex-end; gap: 10px; }
/* Headerless modals (e.g. the signup welcome): drop the empty divider, keep the close button floating. */
.modal-head:has(h3:empty) { border-bottom: none; padding: 12px 12px 0; }
/* ── Drawer (right-side slide-over, e.g. admin org drill-down) ──────────────── */
.drawer-scrim { position: fixed; inset: 0; z-index: 90; background: rgba(6, 9, 20, 0.6); backdrop-filter: blur(4px); display: flex; justify-content: flex-end; animation: fade 0.15s ease; }
.drawer { width: 100%; max-width: 560px; height: 100%; background: var(--surface); border-left: 1px solid var(--border-2); box-shadow: var(--shadow-lg); display: flex; flex-direction: column; animation: drawerin 0.2s cubic-bezier(0.22, 1, 0.36, 1); }
@keyframes drawerin { from { transform: translateX(24px); opacity: 0; } }
.drawer-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; padding: 18px 20px; border-bottom: 1px solid var(--border); }
.drawer-body { padding: 20px; overflow: auto; flex: 1; }
.drawer-section { margin-top: 22px; }
.drawer-section:first-child { margin-top: 0; }
.drawer-section-title { font-size: 12px; text-transform: uppercase; letter-spacing: 0.04em; color: var(--muted); margin-bottom: 10px; }
/* ── Admin home overview ───────────────────────────────────────────────────── */
.admin-overview-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; align-items: start; }
@media (max-width: 900px) { .admin-overview-grid { grid-template-columns: 1fr; } }
.ov-segbar { display: flex; height: 12px; border-radius: 999px; overflow: hidden; background: var(--surface-3); gap: 2px; }
.ov-seg { height: 100%; }
.ov-seg.good, .ov-dot.good { background: var(--good); }
.ov-seg.primary, .ov-dot.primary { background: var(--primary); }
.ov-seg.warn, .ov-dot.warn { background: var(--warn); }
.ov-seg.bad, .ov-dot.bad { background: var(--bad); }
.ov-dot { width: 9px; height: 9px; border-radius: 999px; flex: none; }
.ov-rank { display: flex; align-items: center; gap: 12px; padding: 10px 8px; border-radius: var(--r); text-decoration: none; color: inherit; transition: background 0.15s; }
.ov-rank:hover { background: var(--surface-2); }
.ov-rank + .ov-rank { border-top: 1px solid var(--border); }
.ov-rank-n { width: 16px; text-align: center; font-size: 12px; }
.ov-mix-row + .ov-mix-row { margin-top: 10px; }
.ov-dist { display: flex; align-items: flex-end; gap: 8px; }
.ov-dist-col { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 5px; }
.ov-dist-bar-wrap { width: 100%; height: 90px; display: flex; align-items: flex-end; }
.ov-dist-bar { width: 100%; border-radius: 5px 5px 2px 2px; transition: height 0.4s ease; }
.ov-dist-bar.good { background: var(--good); }
.ov-dist-bar.warn { background: var(--warn); }
.ov-dist-bar.bad { background: var(--bad); }
.ov-dist-lbl { text-align: center; }
/* ── Welcome (post-signup) ─────────────────────────────────────────────────── */
.welcome-hero {
  width: 64px; height: 64px; margin: 0 auto; border-radius: 18px;
  display: flex; align-items: center; justify-content: center;
  background: var(--grad); color: #fff; box-shadow: var(--shadow-lg);
}
.welcome-hero svg { width: 30px; height: 30px; }
.welcome-steps { display: flex; flex-direction: column; gap: 10px; margin-top: 20px; }
.welcome-step { display: flex; align-items: center; gap: 12px; padding: 12px 14px; border: 1px solid var(--border); border-radius: var(--r); background: var(--surface-2); }
.welcome-step-ic {
  flex: none; width: 34px; height: 34px; border-radius: 10px;
  display: flex; align-items: center; justify-content: center;
  background: var(--grad-soft); color: var(--accent);
}
.welcome-step-ic svg { width: 18px; height: 18px; }
@keyframes fade { from { opacity: 0; } }
@keyframes pop { from { opacity: 0; transform: translateY(8px) scale(0.98); } }

/* reveal secret box */
.secret { font-family: var(--font-mono); font-size: 13px; background: var(--code-bg); color: #9ff0c8; border: 1px solid var(--border-2); border-radius: var(--r-sm); padding: 12px 14px; word-break: break-all; display: flex; align-items: center; gap: 10px; }
.secret button { margin-left: auto; }

/* ── toast ────────────────────────────────────────────────────────────────── */
.toasts { position: fixed; bottom: 22px; right: 22px; z-index: 120; display: flex; flex-direction: column; gap: 10px; }
.toast { display: flex; align-items: center; gap: 10px; padding: 12px 16px; border-radius: var(--r); background: var(--surface); border: 1px solid var(--border-2); box-shadow: var(--shadow-lg); font-size: 14px; font-weight: 500; min-width: 240px; animation: slidein 0.2s ease; }
.toast svg { width: 18px; height: 18px; flex: 0 0 auto; }
.toast.good svg { color: var(--good); }
.toast.bad svg { color: var(--bad); }
.toast.info svg { color: var(--primary); }
@keyframes slidein { from { opacity: 0; transform: translateX(20px); } }

/* empty state */
.empty { text-align: center; padding: 40px 20px; color: var(--muted); }
.empty .ic { width: 48px; height: 48px; border-radius: var(--r); background: var(--surface-2); display: grid; place-items: center; margin: 0 auto 14px; color: var(--faint); }

/* skeleton */
.skel { background: linear-gradient(90deg, var(--surface-2) 25%, var(--surface-3) 37%, var(--surface-2) 63%); background-size: 400% 100%; animation: shimmer 1.3s ease infinite; border-radius: var(--r-sm); }
@keyframes shimmer { from { background-position: 100% 0; } to { background-position: -100% 0; } }

/* divider */
.hr { height: 1px; background: var(--border); border: none; margin: 18px 0; }

/* dropdown menu */
.menu { position: absolute; z-index: 60; min-width: 180px; background: var(--surface); border: 1px solid var(--border-2); border-radius: var(--r); box-shadow: var(--shadow-lg); padding: 6px; }
.menu button { display: flex; align-items: center; gap: 9px; width: 100%; text-align: left; padding: 8px 10px; border: none; background: transparent; border-radius: var(--r-xs); font-size: 13.5px; color: var(--text); }
.menu button:hover { background: var(--surface-2); }
.menu button.danger { color: var(--bad); }
.menu button svg { width: 15px; height: 15px; }

/* ── responsive ───────────────────────────────────────────────────────────── */
@media (max-width: 1080px) {
  .hero .container { grid-template-columns: 1fr; }
  .hero h1 { font-size: 44px; }
  .feature-grid, .price-grid, .g-3, .g-4 { grid-template-columns: repeat(2, 1fr); }
  .split-2, .split-editor, .admin-gift-grid { grid-template-columns: 1fr; }
  .gift-cards-panel, .gift-card-generator { grid-column: auto; }
}
@media (max-width: 860px) {
  .app { grid-template-columns: 1fr; }
  .sidebar { position: fixed; left: 0; top: 0; transform: translateX(-100%); transition: transform 0.2s ease; width: 264px; box-shadow: var(--shadow-lg); }
  .app.nav-open .sidebar { transform: translateX(0); }
  .nav-scrim { display: none; }
  .app.nav-open .nav-scrim { display: block; position: fixed; inset: 0; z-index: 19; background: rgba(0,0,0,0.5); }
  .nav-close { display: inline-flex !important; position: absolute; top: 12px; right: 12px; z-index: 1; }
  .menu-btn { display: inline-flex !important; }
  .auth { grid-template-columns: 1fr; }
  .auth-aside { display: none; }
}
@media (max-width: 680px) {
  .feature-grid, .price-grid, .g-2, .g-3, .g-4, .admin-gift-grid { grid-template-columns: 1fr; }
  .admins-grid { grid-template-columns: minmax(0, 1fr) !important; }
  .hero h1 { font-size: 36px; }
  .section-head h2, .cta-band h2 { font-size: 28px; }
  .content { padding: 18px; }
  .urow { grid-template-columns: 1fr auto; }
  .quota-cell { grid-column: 1 / -1; }
  .pub-nav .links { display: none; }
  .voice-library { max-height: 280px; }
  /* page-head actions wrap and stretch full width instead of overflowing */
  .page-head { gap: 14px; }
  .page-head > .row { flex-wrap: wrap; width: 100%; }
  /* resolution segmented control: fill the width with equal buttons */
  .seg-toggle { display: flex; width: 100%; }
  .seg-toggle button { flex: 1 1 0; text-align: center; padding: 8px 6px; }
  .sso-connection { padding: 14px 0; }
  .sso-connection-head { display: grid; grid-template-columns: minmax(0, 1fr); align-items: stretch; gap: 10px; }
  .sso-connection-main { flex-basis: auto; width: 100%; }
  .sso-actions .btn { margin-top: 2px; }
  .sso-pending-panel { padding: 12px; }
  .sso-pending-head { flex-direction: column; align-items: stretch; }
  .sso-pending-head .btn { width: 100%; }
  .sso-dns-grid { grid-template-columns: 1fr; gap: 12px; }
}
.menu-btn { display: none; }
.nav-close { display: none; }
.nav-scrim { display: none; }

/* ── legal pages (privacy / terms / cookies) ──────────────────────────────── */
.legal-wrap { max-width: 820px; }
.legal-head { margin-bottom: 28px; }
.legal-head h1 { font-size: 40px; letter-spacing: -0.02em; margin: 10px 0 12px; }
.legal-meta { font-size: 13px; color: var(--muted); margin-top: 10px; }
.legal-note {
  border: 1px solid var(--primary-line); background: var(--primary-weak);
  border-radius: var(--r-sm); padding: 12px 16px; font-size: 13.5px;
  color: var(--text-2); margin-bottom: 30px;
}
.legal-note code { background: transparent; }
.legal-body { color: var(--text-2); font-size: 15px; line-height: 1.72; }
.legal-sec { margin-bottom: 34px; scroll-margin-top: 90px; }
.legal-sec h2 {
  font-family: var(--font-header); font-size: 21px;
  font-weight: 600; color: var(--text); letter-spacing: -0.01em;
  margin: 0 0 12px; padding-bottom: 8px; border-bottom: 1px solid var(--border);
}
.legal-sec h3 {
  font-family: var(--font-header); font-size: 16px;
  font-weight: 600; color: var(--text); margin: 20px 0 8px;
}
.legal-sec p { margin: 0 0 12px; }
.legal-sec ul { margin: 0 0 12px; padding-left: 22px; }
.legal-sec li { margin-bottom: 7px; }
.legal-sec a { color: var(--primary); text-decoration: underline; text-underline-offset: 2px; }
.legal-sec code {
  font-family: var(--font-mono); font-size: 12.5px;
  background: var(--surface-inset); border: 1px solid var(--border);
  border-radius: var(--r-xs); padding: 1px 5px; color: var(--text);
}
.legal-table {
  width: 100%; border-collapse: collapse; margin: 4px 0 16px;
  font-size: 13.5px; display: block; overflow-x: auto;
}
.legal-table th, .legal-table td {
  text-align: left; padding: 9px 12px; border: 1px solid var(--border);
  vertical-align: top;
}
.legal-table thead th {
  background: var(--surface-inset); font-weight: 600; color: var(--text);
  white-space: nowrap;
}
.legal-table td { color: var(--text-2); }

/* ── docs page ────────────────────────────────────────────────────────────── */
.docs-page-hero { padding: 44px 0 34px; border-bottom: 1px solid var(--border); background: linear-gradient(180deg, var(--bg-tint-a) 0%, transparent 100%); }
.docs-page-hero h1 { font-size: 42px; letter-spacing: -0.035em; margin-top: 16px; }
.docs-page-hero .lead { font-size: 16px; color: var(--text-2); margin-top: 12px; line-height: 1.65; max-width: 54ch; }

.docs-shell { display: grid; grid-template-columns: 214px 1fr; gap: 52px; max-width: 1180px; margin: 0 auto; padding: 38px 24px 100px; align-items: start; }
.docs-aside { position: sticky; top: calc(var(--topbar-h) + 22px); align-self: start; max-height: calc(100vh - var(--topbar-h) - 48px); overflow-y: auto; overflow-x: hidden; scrollbar-width: none; }
.docs-aside::-webkit-scrollbar { display: none; }
.docs-content { min-width: 0; }

.docs-nav-group { margin-bottom: 22px; }
.docs-nav-label { font-size: 10.5px; font-weight: 700; letter-spacing: 0.1em; text-transform: uppercase; color: var(--faint); margin-bottom: 5px; padding: 0 10px; display: block; }
.docs-nav-link { display: block; padding: 5px 10px; border-radius: var(--r-xs); font-size: 13px; color: var(--text-2); transition: 0.14s; cursor: pointer; }
.docs-nav-link:hover { color: var(--text); background: var(--surface-2); }
.docs-nav-link.active { color: var(--primary); font-weight: 600; background: var(--primary-weak); }
.docs-tpl-pills { display: grid; grid-template-columns: 1fr 1fr; gap: 3px; padding: 2px 0; }
.docs-tpl-pill { display: block; padding: 4px 10px; border-radius: var(--r-xs); font-size: 11.5px; font-family: var(--font-mono); color: var(--muted); cursor: pointer; transition: 0.14s; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.docs-tpl-pill:hover { color: var(--primary); background: var(--primary-weak); }
.docs-tpl-pill.active { color: var(--primary); background: var(--primary-weak); font-weight: 600; }

.docs-section { scroll-margin-top: 84px; min-width: 0; }
.docs-section + .docs-section { margin-top: 4px; }
.docs-h2 { font-size: 26px; letter-spacing: -0.025em; margin: 52px 0 13px; padding-top: 26px; border-top: 1px solid var(--border); }
.docs-section:first-child .docs-h2 { margin-top: 0; padding-top: 0; border-top: none; }
.docs-h3 { font-size: 18px; letter-spacing: -0.015em; margin: 32px 0 10px; }
.docs-p { color: var(--text-2); font-size: 15px; margin-bottom: 13px; line-height: 1.65; }
.docs-p code { overflow-wrap: anywhere; }
.docs-steps { margin: 4px 0 14px; padding-left: 0; list-style: none; counter-reset: step; display: grid; gap: 10px; }
.docs-steps li { position: relative; padding-left: 40px; color: var(--text-2); font-size: 14.5px; line-height: 1.55; counter-increment: step; }
.docs-steps li::before { content: counter(step); position: absolute; left: 0; top: 0; width: 26px; height: 26px; border-radius: 50%; display: grid; place-items: center; font-size: 13px; font-weight: 700; color: var(--primary); background: var(--primary-weak); border: 1px solid var(--primary-line); }
.docs-steps code { overflow-wrap: anywhere; }

/* template cards — header row, then preview + code aligned to top */
.format-preview { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 24px; margin: 18px 0; }
.format-fig { margin: 0; display: flex; flex-direction: column; align-items: center; gap: 10px; }
.format-fig svg { display: block; height: 135px; width: auto; filter: drop-shadow(var(--shadow)); }
.format-fig figcaption { font-size: 12.5px; color: var(--muted); text-align: center; }
.format-fig figcaption code { color: var(--text); }

.theme-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 16px; margin-top: 18px; }
.theme-card { border: 1px solid var(--border); border-radius: var(--r-lg); background: var(--surface); overflow: hidden; transition: border-color 0.18s, box-shadow 0.18s; }
.theme-card:hover { border-color: var(--border-strong); box-shadow: var(--shadow); }
.theme-swatch { display: block; width: 100%; height: auto; }
.theme-card-foot { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 10px 12px; border-top: 1px solid var(--border); }
.theme-name { font-size: 12.5px; font-weight: 700; color: var(--text); }
.theme-chips { display: flex; gap: 5px; }
.theme-chip { width: 14px; height: 14px; border-radius: var(--r-full); border: 1px solid var(--border-strong); flex: 0 0 auto; }

.docs-tpl-grid { display: grid; grid-template-columns: minmax(0, 1fr); gap: 16px; margin-top: 18px; }
.tpl-card { border: 1px solid var(--border); border-radius: var(--r-lg); background: var(--surface); padding: 16px 18px 18px; transition: border-color 0.18s, box-shadow 0.18s; }
.tpl-card:hover { border-color: var(--border-strong); box-shadow: var(--shadow); }
.tpl-card-head { display: flex; align-items: baseline; gap: 12px; margin-bottom: 14px; flex-wrap: wrap; }
.tpl-name-badge { font-family: var(--font-mono); font-size: 12px; font-weight: 700; color: var(--primary); background: var(--primary-weak); border: 1px solid var(--primary-line); padding: 2px 9px; border-radius: var(--r-full); flex: 0 0 auto; }
.tpl-desc-text { font-size: 13.5px; color: var(--text-2); line-height: 1.5; flex: 1; min-width: 200px; }
.tpl-card-body { display: grid; grid-template-columns: 260px 1fr; gap: 16px; align-items: start; }
.tpl-preview { display: flex; flex-direction: column; gap: 11px; }
.tpl-preview svg { display: block; width: 100%; height: auto; border-radius: var(--r-sm); border: 1px solid var(--border-2); }
.tpl-slots { display: flex; flex-direction: column; gap: 5px; }
.tpl-slot-row { display: flex; gap: 8px; font-size: 12px; }
.tpl-slot-k { color: var(--faint); font-weight: 600; min-width: 56px; flex: 0 0 auto; }
.tpl-slot-v { font-family: var(--font-mono); color: var(--text-2); font-size: 11.5px; }
.tpl-code { min-width: 0; }

/* plain code block — dark panel without the mac-window chrome */
.code-plain { margin: 0; max-width: 100%; padding: 13px 15px; background: var(--code-bg); color: var(--code-text); border-radius: var(--r-sm); border: 1px solid var(--border-2); font-family: var(--font-mono); font-size: 11.5px; line-height: 1.66; white-space: pre; overflow-x: auto; }

/* reveal animation */
.reveal { opacity: 0; transform: translateY(13px); transition: opacity 0.42s ease, transform 0.42s ease; }
.reveal.visible { opacity: 1; transform: none; }

/* API example pairs */
.api-pair { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; margin: 14px 0; }
.api-pair > div { min-width: 0; }
.api-pair-label { font-size: 11px; font-weight: 700; letter-spacing: 0.06em; text-transform: uppercase; color: var(--faint); margin-bottom: 6px; }

/* docs tables — scroll horizontally on narrow viewports instead of clipping */
.docs-table-card { padding: 0; overflow-x: auto; }
.docs-table-card .table { margin: 0; min-width: 460px; }
.docs-table-card .table th, .docs-table-card .table td { padding-top: 11px; padding-bottom: 11px; }
.docs-table-card .table th:first-child, .docs-table-card .table td:first-child { padding-left: 16px; }
.docs-table-card .table th:last-child, .docs-table-card .table td:last-child { padding-right: 16px; }
.docs-table-card .table thead th { position: sticky; top: 0; background: var(--surface); padding-top: 14px; }

/* MCP section */
.mcp-tools-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin: 14px 0; }
.mcp-tool-card { border: 1px solid var(--border); border-radius: var(--r); padding: 13px 15px; background: var(--surface-inset); }
.mcp-tool-name { font-family: var(--font-mono); font-size: 12.5px; color: var(--primary); font-weight: 700; margin-bottom: 5px; }
.mcp-tool-desc { font-size: 12.5px; color: var(--text-2); line-height: 1.45; }
.mcp-tool-params { font-size: 11.5px; color: var(--muted); margin-top: 6px; font-family: var(--font-mono); }
.prompt-block { background: var(--surface-inset); border: 1px solid var(--border-2); border-radius: var(--r); padding: 16px 18px; font-size: 13px; line-height: 1.72; white-space: pre-wrap; font-family: var(--font-text); color: var(--text-2); margin: 12px 0; }
.prompt-block .ph { color: var(--accent); font-style: italic; }
.prompt-block .kw { color: var(--primary); font-weight: 600; }

/* MCP URL copy */
.mcp-url-copy {
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
  margin: 10px 0 18px; padding: 10px 12px 10px 16px;
  background: var(--surface-inset); border: 1px solid var(--border); border-radius: var(--r);
}
.mcp-url-copy > code { flex: 1; min-width: 0; font-size: 13.5px; color: var(--text); overflow-wrap: anywhere; }
.mcp-url-btn {
  display: inline-flex; align-items: center; gap: 6px; flex-shrink: 0;
  padding: 7px 12px; border-radius: 8px; cursor: pointer;
  font-size: 12.5px; font-weight: 600; color: var(--primary);
  background: var(--primary-weak); border: 1px solid var(--primary-line);
  transition: color .15s, background .15s, border-color .15s;
}
.mcp-url-btn:hover { background: var(--primary); color: #fff; border-color: var(--primary); }
.mcp-url-btn svg { width: 15px; height: 15px; }
.mcp-url-btn.copied { color: var(--ok, #16a34a); background: transparent; border-color: var(--border-2); }

/* MCP client tabs */
.mcp-clients { margin: 14px 0 4px; }
.mcp-client-tabs { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 16px; }
.mcp-client-tab {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 8px 14px; border-radius: 999px; cursor: pointer;
  font-size: 13.5px; font-weight: 600; color: var(--text-2);
  background: var(--surface-inset); border: 1px solid var(--border);
  transition: color .15s, border-color .15s, background .15s;
}
.mcp-client-tab:hover { color: var(--text); border-color: var(--border-2); }
.mcp-client-tab.active { color: var(--primary); background: var(--primary-weak); border-color: var(--primary-line); }
.mcp-client-tag { font-size: 10.5px; font-weight: 600; letter-spacing: .02em; text-transform: uppercase; color: var(--muted); }
.mcp-client-tab.active .mcp-client-tag { color: var(--primary); opacity: .8; }
.mcp-client-panel { display: none; }
.mcp-client-panel.active { display: block; animation: fade-in .18s ease; }
.mcp-client-lead { font-size: 13.5px; color: var(--text-2); margin-bottom: 10px; padding-left: 12px; border-left: 3px solid var(--primary-line); }
@keyframes fade-in { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: none; } }

@media (max-width: 960px) {
  .docs-shell { grid-template-columns: 1fr; gap: 0; padding-top: 24px; }
  .docs-aside { position: static; max-height: none; display: none; }
  .tpl-card-body { grid-template-columns: 1fr; }
  .tpl-preview { max-width: 420px; }
  .api-pair, .mcp-tools-grid { grid-template-columns: 1fr; }
}

/* ── cookie consent banner ────────────────────────────────────────────────── */
.cookie-banner {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 60;
  padding: 14px; display: flex; justify-content: center;
  animation: cookie-rise 0.25s ease;
}
@keyframes cookie-rise { from { transform: translateY(12px); opacity: 0; } to { transform: none; opacity: 1; } }
.cookie-inner {
  width: min(960px, 100%); display: flex; align-items: center; gap: 20px;
  background: var(--surface); border: 1px solid var(--border-2);
  border-radius: var(--r-md); box-shadow: var(--shadow-lg); padding: 16px 20px;
}
.cookie-text { font-size: 13px; line-height: 1.6; color: var(--text-2); flex: 1; }
.cookie-text b { color: var(--text); }
.cookie-text a { color: var(--primary); text-decoration: underline; text-underline-offset: 2px; }
.cookie-actions { display: flex; gap: 10px; flex-shrink: 0; }
@media (max-width: 680px) {
  .legal-head h1 { font-size: 30px; }
  .cookie-inner { flex-direction: column; align-items: stretch; gap: 12px; }
  .cookie-actions { justify-content: flex-end; }
}

/* ── Org asset library ──────────────────────────────────────────────────── */
.ellip { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 100%; }
.asset-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 14px; }
.asset-card { padding: 0; overflow: hidden; display: flex; flex-direction: column; position: relative; }
.asset-thumb { aspect-ratio: 16 / 10; background: var(--surface-2, rgba(127,139,176,.08)); display: grid; place-items: center; overflow: hidden; }
.asset-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.asset-thumb.ph { color: var(--text-3, #7f8bb0); }
.asset-thumb.ph svg { width: 34px; height: 34px; opacity: .5; }
.asset-meta { padding: 10px 12px; display: flex; flex-direction: column; gap: 6px; }
.asset-actions { gap: 4px; margin-top: 2px; justify-content: flex-end; }
.asset-thumb[role="button"] { cursor: pointer; }
.asset-thumb[role="button"]:hover { filter: brightness(1.08); }
.asset-preview { display: grid; place-items: center; }
/* Images/videos centre at their intrinsic size, but the waveform player has no
   intrinsic width (the canvas would fall back to 300px), so stretch it. */
.asset-preview > .player.audio { width: 100%; }

/* List view: dense rows sharing the card container. */
.asset-list { padding: 0; overflow: hidden; }
.asset-row { display: flex; align-items: center; gap: 12px; padding: 8px 12px; border-bottom: 1px solid var(--border); cursor: pointer; }
.asset-row:last-child { border-bottom: none; }
.asset-row:hover { background: var(--surface-2, rgba(127,139,176,.06)); }
.asset-row:focus-visible { outline: 2px solid var(--primary); outline-offset: -2px; }
.asset-row .asset-thumb { cursor: pointer; }
.asset-row .asset-thumb.sm { flex: none; width: 44px; height: 44px; aspect-ratio: 1; border-radius: var(--r-xs); }
.asset-row .asset-thumb.sm.ph svg { width: 20px; height: 20px; }
.asset-row-name { flex: 1 1 auto; min-width: 0; }
.asset-row-kind { flex: none; width: 52px; }
.asset-row-size { flex: none; width: 72px; text-align: right; }
.asset-row-hash { flex: none; width: 84px; }
.asset-row-actions { flex: none; gap: 4px; }
@media (max-width: 640px) {
  .asset-row-kind, .asset-row-hash, .asset-row-size { display: none; }
}

/* ── Multi-select ── */
/* Styled checkbox (a role="checkbox" div, not a native input — see assetCheckHtml). */
.asset-check { flex: none; box-sizing: border-box; width: 18px; height: 18px; border: 2px solid var(--border-2); border-radius: 5px; background: var(--surface); cursor: pointer; display: grid; place-items: center; transition: background .12s, border-color .12s; }
.asset-check[aria-checked="true"] { background: var(--primary); border-color: var(--primary); }
.asset-check[aria-checked="true"]::after { content: ""; width: 5px; height: 9px; margin-top: -2px; border: solid var(--primary-ink); border-width: 0 2px 2px 0; transform: rotate(45deg); }
.asset-check:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; }
/* Card: the tick floats over the thumbnail's top-left, revealed on hover, when
   the item is selected, or whenever any selection is active. */
.asset-card .asset-check { position: absolute; top: 8px; left: 8px; z-index: 2; box-shadow: var(--shadow-sm); opacity: 0; transition: opacity .12s, background .12s, border-color .12s; }
.asset-card:hover .asset-check,
.asset-card.selected .asset-check,
.selecting .asset-card .asset-check { opacity: 1; }
/* Selected emphasis, both layouts. */
.asset-row.selected { background: var(--primary-weak); }
.asset-card.selected { outline: 2px solid var(--primary); outline-offset: -2px; }

/* Bulk-action bar, shown only while ≥1 asset is ticked. */
.asset-selbar { display: flex; align-items: center; flex-wrap: wrap; gap: 8px 12px; margin-bottom: 14px; padding: 10px 14px; border-radius: var(--r-sm); border: 1px solid var(--primary); background: var(--primary-weak); }
.asset-selbar.hidden { display: none; }
.asset-selbar .row { flex-wrap: wrap; }
@media (max-width: 640px) {
  .asset-selbar .row { margin-left: 0 !important; width: 100%; }
}

.asset-dropzone { position: relative; border-radius: 14px; min-height: 140px; transition: outline-color .15s; }
.asset-dropzone.dragging { outline: 2px dashed var(--primary); outline-offset: 4px; }
.asset-dropzone.dragging::after { content: "Drop files to upload"; position: absolute; inset: 0; z-index: 3; display: grid; place-items: center; border-radius: 14px; background: var(--primary-weak); color: var(--primary); font-weight: 600; pointer-events: none; }
