/* Kroniq design system (brand: ADR-0015).
   The brand: the subtitle yellow ("sous-titre") on a cool night. Yellow is a fill for
   actions and timecodes, always with ink text on it; it is never text on a light
   background (--accent-text is the readable variant).
   Tokens first (light, then dark), then base, app shell, components, pages, public site.
   Everything is hand-made: no CSS framework. */

:root {
  --font-sans: "Archivo", ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --font-display: "Archivo", "Arial Black", ui-sans-serif, system-ui, sans-serif;
  --font-mono: "JetBrains Mono", ui-monospace, "Cascadia Code", Consolas, monospace;
  /* Archivo is variable in width: titles run wide, like broadcast captions. */
  --display-stretch: 112%;
  --display-stretch-xl: 125%;

  --brand-yellow: #ffd43b;
  --brand-ink: #0b0b10;
  --brand-night: #0b0b10;
  --brand-live: #ff4d5e;

  --bg: #f3f3f6;
  --bg-elevated: #ffffff;
  --bg-sunken: #eaeaf0;
  --bg-hover: #ededf2;
  --border: #e2e2e8;
  --border-strong: #cfcfd8;
  --text: #0b0b10;
  --text-muted: #5b5a68;
  /* Text tokens hold WCAG AA (4.5:1) on every surface, --bg-sunken included (ADR-0023). */
  --text-faint: #63626f;
  --highlight: inset 0 1px 0 rgba(255, 255, 255, 0.9);

  /* The yellow is a flat fill, like a broadcast caption (docs/marque.md). */
  --accent: var(--brand-yellow);
  --accent-2: var(--brand-live);
  --accent-hover: #ffdd5e;
  --accent-soft: #fff5cc;
  --accent-text: #7a5b00;
  --accent-line: rgba(196, 150, 0, 0.45);
  --on-accent: var(--brand-ink);
  --twitch: #9146ff;
  --gold: #e19a12;
  --gold-soft: #fff4dc;
  --gold-text: #8a5800;
  /* A faint yellow tint that marks highlighted surfaces (featured cards, the current job). */
  --gradient-soft: linear-gradient(135deg, rgba(255, 212, 59, 0.2), rgba(255, 212, 59, 0.04));

  --success: #087a4b;
  --success-soft: #e1f5ea;
  --warning: #925500;
  --warning-soft: #fff2d9;
  --danger: #b8263d;
  --danger-soft: #fde7eb;
  --info: #2462cc;
  --info-soft: #e5eefc;

  --radius-sm: 8px;
  --radius: 12px;
  --radius-lg: 16px;
  --radius-xl: 22px;
  --shadow-sm: 0 1px 2px rgba(11, 11, 16, 0.05);
  --shadow: 0 1px 2px rgba(11, 11, 16, 0.04), 0 12px 32px -16px rgba(11, 11, 16, 0.18);
  --shadow-lg: 0 24px 64px -24px rgba(11, 11, 16, 0.35), 0 2px 6px rgba(11, 11, 16, 0.05);
  --ring: 0 0 0 3px rgba(11, 11, 16, 0.22);
  --ease: cubic-bezier(0.2, 0, 0, 1);
  --spring: cubic-bezier(0.34, 1.56, 0.64, 1);
  --transition: 160ms var(--ease);
  --sidebar-w: 256px;
  --topbar-h: 60px;
  --tabbar-h: 62px;
  /* Height of the fixed UI at the bottom of the screen (the phone tab bar). */
  --bottom-ui: 0px;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0b0b10;
    --bg-elevated: #14141b;
    --bg-sunken: #18181f;
    --bg-hover: #1e1e27;
    --border: #26262f;
    --border-strong: #363642;
    --text: #f2f1ec;
    --text-muted: #a3a2ae;
    --text-faint: #8a8996;
    --highlight: inset 0 1px 0 rgba(255, 255, 255, 0.04);
    --accent-hover: #ffe070;
    --accent-soft: #29230d;
    --accent-text: #ffd43b;
    --accent-line: rgba(255, 212, 59, 0.38);
    --gold: #ffc548;
    --gold-soft: #2a2110;
    --gold-text: #ffc548;
    --gradient-soft: linear-gradient(135deg, rgba(255, 212, 59, 0.11), rgba(255, 212, 59, 0.02));
    --ring: 0 0 0 3px rgba(255, 212, 59, 0.42);
    --success: #3ed08f;
    --success-soft: #0e271d;
    --warning: #f3b04d;
    --warning-soft: #2a1f0e;
    --danger: #ff6b7b;
    --danger-soft: #331520;
    --info: #78a7ff;
    --info-soft: #131f37;
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.5);
    --shadow: 0 1px 2px rgba(0, 0, 0, 0.4), 0 14px 36px -18px rgba(0, 0, 0, 0.85);
    --shadow-lg: 0 30px 70px -24px rgba(0, 0, 0, 0.9), 0 0 0 1px rgba(255, 255, 255, 0.03);
    color-scheme: dark;
  }
}

:root[data-theme="dark"] {
  --bg: #0b0b10;
  --bg-elevated: #14141b;
  --bg-sunken: #18181f;
  --bg-hover: #1e1e27;
  --border: #26262f;
  --border-strong: #363642;
  --text: #f2f1ec;
  --text-muted: #a3a2ae;
  --text-faint: #8a8996;
  --highlight: inset 0 1px 0 rgba(255, 255, 255, 0.04);
  --accent-hover: #ffe070;
  --accent-soft: #29230d;
  --accent-text: #ffd43b;
  --accent-line: rgba(255, 212, 59, 0.38);
  --gold: #ffc548;
  --gold-soft: #2a2110;
  --gold-text: #ffc548;
  --gradient-soft: linear-gradient(135deg, rgba(255, 212, 59, 0.11), rgba(255, 212, 59, 0.02));
  --ring: 0 0 0 3px rgba(255, 212, 59, 0.42);
  --success: #3ed08f;
  --success-soft: #0e271d;
  --warning: #f3b04d;
  --warning-soft: #2a1f0e;
  --danger: #ff6b7b;
  --danger-soft: #331520;
  --info: #78a7ff;
  --info-soft: #131f37;
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.5);
  --shadow: 0 1px 2px rgba(0, 0, 0, 0.4), 0 14px 36px -18px rgba(0, 0, 0, 0.85);
  --shadow-lg: 0 30px 70px -24px rgba(0, 0, 0, 0.9), 0 0 0 1px rgba(255, 255, 255, 0.03);
  color-scheme: dark;
}

/* Base */

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; scroll-padding-top: calc(var(--topbar-h) + 16px); }

body {
  margin: 0;
  min-height: 100vh;
  min-height: 100dvh;
  background: var(--bg);
  color: var(--text);
  font: 14.5px/1.55 var(--font-sans);
  font-feature-settings: "cv11", "ss01";
  -webkit-font-smoothing: antialiased;
}

a { color: var(--accent-text); text-decoration: none; }
a:hover { text-decoration: underline; text-underline-offset: 3px; }

h1, h2, h3 { line-height: 1.2; margin: 0; letter-spacing: -0.02em; font-family: var(--font-display); font-stretch: var(--display-stretch); }
h1 { font-size: clamp(24px, 2.6vw, 30px); font-weight: 700; letter-spacing: -0.03em; }
h2 { font-size: 16.5px; font-weight: 650; }
h3 { font-size: 14.5px; font-weight: 650; }
p { margin: 0 0 0.75em; }
code, kbd, pre, .mono { font-family: var(--font-mono); font-size: 0.9em; }
img { max-width: 100%; display: block; }
kbd {
  display: inline-grid; place-items: center; min-width: 20px; height: 20px; padding: 0 5px;
  border-radius: 6px; border: 1px solid var(--border); border-bottom-width: 2px;
  background: var(--bg-elevated); color: var(--text-faint); font: 600 10.5px/1 var(--font-sans);
}

::selection { background: color-mix(in srgb, var(--accent) 28%, transparent); }
:focus-visible { outline: none; box-shadow: var(--ring); border-radius: var(--radius-sm); }

.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;
}

.muted { color: var(--text-muted); }
.faint { color: var(--text-faint); }
.small { font-size: 13px; }
.nowrap { white-space: nowrap; }
.spacer { flex: 1; }
.row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.row-between { justify-content: space-between; }
.stack { display: flex; flex-direction: column; gap: 20px; min-width: 0; }
.stack-sm { display: flex; flex-direction: column; gap: 10px; }
.clamp { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.ellipsis { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.gradient-text { color: var(--accent-text); }
.num { font-variant-numeric: tabular-nums; }

/* App shell */

.app { display: grid; grid-template-columns: var(--sidebar-w) minmax(0, 1fr); min-height: 100vh; min-height: 100dvh; }

.sidebar {
  position: sticky; top: 0; height: 100vh; height: 100dvh; z-index: 40;
  display: flex; flex-direction: column; gap: 4px;
  padding: 14px 12px 12px;
  background: var(--bg-elevated);
  border-right: 1px solid var(--border);
  overflow-y: auto; scrollbar-width: none;
}
/* The menu scrolls when it is taller than the screen: its items keep their height. */
.sidebar > * { flex-shrink: 0; }

/* The lockup: the [•] mark and the lowercase wordmark, set wide and heavy. */
.brand {
  display: flex; align-items: center; gap: 10px; padding: 6px 8px 14px;
  color: var(--text); font: 850 20px/1 var(--font-display); font-stretch: var(--display-stretch-xl); letter-spacing: -0.03em;
}
.brand:hover { text-decoration: none; }
.brand-mark { width: 30px; height: 30px; display: block; flex: none; }
.brand-mark svg { display: block; width: 100%; height: 100%; }
.brand-tag {
  margin-left: auto; font: 650 10px/1 var(--font-sans); letter-spacing: 0.06em; text-transform: uppercase;
  color: var(--accent-text); background: var(--accent-soft); padding: 5px 7px; border-radius: 999px;
}

.search-trigger {
  display: flex; align-items: center; gap: 10px; width: 100%; height: 38px; padding: 0 8px 0 11px; margin-bottom: 10px;
  border: 1px solid var(--border); border-radius: 11px; background: var(--bg-elevated); color: var(--text-faint);
  font: 500 13.5px var(--font-sans); cursor: pointer; box-shadow: var(--shadow-sm);
  transition: border-color var(--transition), color var(--transition);
}
.search-trigger:hover { border-color: var(--border-strong); color: var(--text-muted); }
.search-trigger kbd { margin-left: auto; }

.nav { display: flex; flex-direction: column; gap: 1px; }
.nav-section {
  margin: 16px 10px 6px; font-size: 11px; font-weight: 650; letter-spacing: 0.07em;
  text-transform: uppercase; color: var(--text-faint);
}
.nav a {
  position: relative; display: flex; align-items: center; gap: 11px;
  height: 38px; padding: 0 10px; border-radius: 10px;
  color: var(--text-muted); font-weight: 550; font-size: 14px;
  transition: background var(--transition), color var(--transition);
}
.nav a svg { flex: none; opacity: 0.9; }
.nav a:hover { background: var(--bg-hover); color: var(--text); text-decoration: none; }
.nav a[aria-current="page"] { background: var(--accent-soft); color: var(--accent-text); font-weight: 650; }
.nav a[aria-current="page"]::before {
  content: ""; position: absolute; left: -12px; top: 9px; bottom: 9px; width: 3px;
  border-radius: 0 3px 3px 0; background: var(--accent);
}
.nav-badge-slot { margin-left: auto; display: inline-flex; }
.nav-badge {
  margin-left: auto; min-width: 20px; height: 20px; padding: 0 6px; border-radius: 999px;
  display: inline-grid; place-items: center; font-size: 11.5px; font-weight: 700;
  background: var(--accent); color: var(--on-accent); animation: pop 400ms var(--spring);
}
.nav-badge-warn { background: var(--warning); }
.nav-badge-muted { background: var(--bg-sunken); color: var(--text-muted); box-shadow: inset 0 0 0 1px var(--border); animation: none; }

.sidebar-foot { margin-top: auto; padding-top: 12px; display: flex; flex-direction: column; gap: 8px; }

/* Token wallet, above the user card (ADR-0013): one simple line. */
.wallet {
  display: flex; align-items: center; gap: 10px; padding: 9px 10px; border-radius: 12px;
  color: var(--text); background: var(--bg-elevated); border: 1px solid var(--border);
  transition: border-color var(--transition), background var(--transition);
}
.wallet:hover { text-decoration: none; border-color: color-mix(in srgb, var(--gold) 45%, var(--border)); }
.wallet[aria-current="page"] { border-color: color-mix(in srgb, var(--gold) 60%, var(--border)); }
.wallet-icon {
  flex: none; width: 24px; height: 24px; border-radius: 50%; display: grid; place-items: center;
  background: var(--gold); color: #5a3200;
}
.wallet-amount { flex: 1; min-width: 0; font-size: 13.5px; font-weight: 600; color: var(--text-muted); white-space: nowrap; }
.wallet-amount strong { font: 700 16px/1 var(--font-display); font-stretch: var(--display-stretch); color: var(--text); font-variant-numeric: tabular-nums; }
.wallet-cta { flex: none; font-size: 12.5px; font-weight: 650; color: var(--accent-text, var(--accent)); }
.wallet:hover .wallet-cta { text-decoration: underline; }
.wallet.is-low .wallet-amount strong { color: var(--warning); }
.wallet.is-free .wallet-amount { color: var(--text); }

.user-menu { position: relative; }
.user-card {
  display: flex; align-items: center; gap: 10px; padding: 8px 10px 8px 8px; cursor: pointer; list-style: none;
  border: 1px solid transparent; border-radius: 12px; transition: background var(--transition), border-color var(--transition);
}
.user-card::-webkit-details-marker { display: none; }
.user-card:hover, .user-menu[open] .user-card { background: var(--bg-hover); }
.user-card[aria-current="page"] { border-color: var(--border); background: var(--bg-elevated); }
.user-card .who { min-width: 0; flex: 1; }
.user-card .name { font-weight: 650; font-size: 13.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; line-height: 1.25; }
.user-card .role { font-size: 12px; color: var(--text-muted); line-height: 1.25; }
.user-card .chev { color: var(--text-faint); transition: transform var(--transition); }
.user-menu[open] .chev { transform: rotate(180deg); }

.scrim { display: none; }

.main { min-width: 0; display: flex; flex-direction: column; }

.topbar {
  position: sticky; top: 0; z-index: 30; height: var(--topbar-h);
  display: flex; align-items: center; gap: 10px; padding: 0 36px;
  background: var(--bg);
  border-bottom: 1px solid color-mix(in srgb, var(--border) 70%, transparent);
}
.topbar .brand { display: none; padding: 0; font-size: 16.5px; }
.topbar .brand-mark { width: 28px; height: 28px; border-radius: 9px; }
.topbar .topbar-menu { display: none; }
.crumbs { display: flex; align-items: center; gap: 4px; min-width: 0; font-size: 13.5px; color: var(--text-muted); }
.crumbs a { color: var(--text-muted); padding: 4px 6px; border-radius: 7px; white-space: nowrap; }
.crumbs a:hover { color: var(--text); background: var(--bg-hover); text-decoration: none; }
.crumbs .sep { color: var(--text-faint); display: inline-flex; }
.crumbs .current { color: var(--text); font-weight: 600; padding: 4px 6px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.topbar-live {
  display: inline-flex; align-items: center; gap: 8px; height: 32px; padding: 0 12px 0 10px; border-radius: 999px;
  border: 1px solid var(--border); background: var(--bg-elevated); color: var(--text); font-size: 13px; font-weight: 600;
}
.topbar-live:hover { text-decoration: none; border-color: var(--border-strong); }
.topbar-live .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--accent); position: relative; }
.theme-icon-dark { display: none; }
:root[data-theme="dark"] .theme-icon-dark { display: block; }
:root[data-theme="dark"] .theme-icon-light { display: none; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .theme-icon-dark { display: block; }
  :root:not([data-theme="light"]) .theme-icon-light { display: none; }
}

.content {
  width: 100%; max-width: 1280px; margin: 0 auto; padding: 28px 36px 72px;
  animation: page-in 320ms var(--ease) both;
}
.footer { margin-top: auto; padding: 20px 36px 28px; color: var(--text-faint); font-size: 12.5px; text-align: center; }

/* Loading bar shown during htmx navigations. */
.loading-bar {
  position: fixed; top: 0; left: 0; right: 0; height: 2px; z-index: 100; pointer-events: none;
  background: var(--accent); transform-origin: left; transform: scaleX(0); opacity: 0;
}
html.is-loading .loading-bar { opacity: 1; animation: loading 1.4s var(--ease) infinite; }

@media (max-width: 960px) {
  .app { grid-template-columns: 1fr; }
  .sidebar {
    position: fixed; left: 0; top: 0; bottom: 0; width: min(86vw, 300px);
    transform: translateX(-102%); transition: transform 260ms var(--ease);
    background: var(--bg-elevated); box-shadow: var(--shadow-lg);
  }
  body.nav-open .sidebar { transform: none; }
  body.nav-open .scrim {
    display: block; position: fixed; inset: 0; z-index: 35; background: rgba(8, 6, 14, 0.5);
    animation: fade-in 200ms both;
  }
  .topbar { padding: 0 12px; gap: 8px; }
  .topbar .topbar-menu { display: inline-grid; }
  .topbar .brand { display: flex; }
  .crumbs { display: none; }
  .content { padding: 20px 16px 56px; }
  .footer { padding: 18px 16px 24px; }
}

/* Page header */

.page-head {
  display: flex; align-items: flex-end; justify-content: space-between; gap: 16px 24px; flex-wrap: wrap;
  margin-bottom: 24px;
}
.page-head > div:first-child { min-width: 0; }
.page-head .actions { display: flex; gap: 8px; flex-wrap: wrap; }
.eyebrow {
  display: inline-flex; align-items: center; gap: 6px; margin-bottom: 8px;
  font-size: 11.5px; font-weight: 650; letter-spacing: 0.08em; text-transform: uppercase;
  color: var(--accent-text);
}
.lead { color: var(--text-muted); font-size: 15px; max-width: 68ch; margin: 8px 0 0; }
.meta-line { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 14px; margin-top: 10px; font-size: 13.5px; color: var(--text-muted); }
.meta-line > span { display: inline-flex; align-items: center; gap: 6px; }
.section-title { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin: 32px 0 12px; }
.section-title h2 { font-size: 17px; }
.section-title a { font-size: 13.5px; font-weight: 600; display: inline-flex; align-items: center; gap: 4px; }

/* Grid */

.grid { display: grid; gap: 20px; }
.grid-main { grid-template-columns: minmax(0, 1fr) 340px; align-items: start; }
.grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid-cards { grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 16px; }
@media (max-width: 1080px) { .grid-main { grid-template-columns: minmax(0, 1fr); } }
@media (max-width: 640px) { .grid-2 { grid-template-columns: minmax(0, 1fr); } }
.sticky-side { position: sticky; top: calc(var(--topbar-h) + 20px); }
@media (max-width: 1080px) { .sticky-side { position: static; } }

/* Cards */

.card {
  background: var(--bg-elevated); border: 1px solid var(--border); border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm), var(--highlight); min-width: 0;
}
.card-head {
  display: flex; align-items: flex-start; justify-content: space-between; gap: 14px; flex-wrap: wrap;
  padding: 18px 20px 0;
}
.card-head p { margin: 4px 0 0; color: var(--text-muted); font-size: 13.5px; }
.card-body { padding: 16px 20px 20px; }
.card-foot { padding: 14px 20px; border-top: 1px solid var(--border); background: var(--bg-sunken); border-radius: 0 0 var(--radius-lg) var(--radius-lg); }
.card-glow { position: relative; overflow: hidden; }
.card-glow::before { content: ""; position: absolute; inset: 0; pointer-events: none; background: var(--gradient-soft); }
a.card { color: inherit; transition: transform var(--transition), box-shadow var(--transition), border-color var(--transition); }
a.card:hover { text-decoration: none; transform: translateY(-2px); box-shadow: var(--shadow); border-color: var(--border-strong); }

/* Stat tiles */

.stats { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; margin-bottom: 24px; }
@media (max-width: 900px) { .stats { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.stat {
  position: relative; overflow: hidden; display: flex; align-items: center; gap: 14px; padding: 16px;
  background: var(--bg-elevated); border: 1px solid var(--border); border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm), var(--highlight); color: var(--text);
}
a.stat { transition: border-color var(--transition), transform var(--transition); }
a.stat:hover { text-decoration: none; border-color: var(--border-strong); transform: translateY(-1px); }
.stat-icon {
  width: 40px; height: 40px; border-radius: 12px; display: grid; place-items: center; flex: none;
  background: var(--accent-soft); color: var(--accent-text);
}
.stat:nth-child(2) .stat-icon { background: color-mix(in srgb, var(--accent-2) 13%, transparent); color: var(--accent-2); }
.stat:nth-child(3) .stat-icon { background: color-mix(in srgb, var(--info) 15%, transparent); color: var(--info); }
.stat:nth-child(4) .stat-icon { background: var(--warning-soft); color: var(--warning); }
.stat .stat-icon-gold { background: var(--gold-soft); color: var(--gold); }
.stat-num { font: 700 24px/1.05 var(--font-display); font-stretch: var(--display-stretch); letter-spacing: -0.03em; font-variant-numeric: tabular-nums; }
.stat-label { margin-top: 3px; color: var(--text-muted); font-size: 12.5px; line-height: 1.3; }

/* Buttons */

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  height: 38px; padding: 0 15px; border-radius: 11px;
  border: 1px solid var(--border-strong); background: var(--bg-elevated); color: var(--text);
  font: 600 13.5px/1 var(--font-sans); cursor: pointer; white-space: nowrap; box-shadow: var(--shadow-sm);
  transition: background var(--transition), border-color var(--transition), transform 120ms var(--ease), box-shadow var(--transition), opacity var(--transition), filter var(--transition);
}
.btn:hover { background: var(--bg-hover); text-decoration: none; }
.btn:active { transform: scale(0.97); }
.btn[disabled] { opacity: 0.45; pointer-events: none; box-shadow: none; }
.btn-primary { border-color: transparent; background: var(--accent); color: var(--on-accent); box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.22); }
.btn-primary:hover { background: var(--accent); filter: brightness(1.08); }
.btn-twitch { border-color: transparent; background: var(--twitch); color: #fff; box-shadow: 0 10px 26px -12px rgba(145, 70, 255, 0.8); }
.btn-twitch:hover { background: #a06bff; }
.btn-ghost { border-color: transparent; background: transparent; box-shadow: none; }
.btn-danger { color: var(--danger); }
.btn-danger:hover { background: var(--danger-soft); }
.btn-danger-solid { border-color: transparent; background: var(--danger); color: #fff; }
.btn-danger-solid:hover { background: var(--danger); filter: brightness(1.08); }
.btn-sm { height: 32px; padding: 0 11px; font-size: 13px; border-radius: 9px; gap: 6px; }
.btn-lg { height: 48px; padding: 0 22px; font-size: 15px; border-radius: 13px; }
.btn-block { width: 100%; }
.btn .pill {
  margin-left: 2px; padding: 3px 7px; border-radius: 999px; font-size: 11.5px; font-weight: 700;
  background: rgba(255, 255, 255, 0.2); display: inline-flex; align-items: center; gap: 4px;
}
.icon-btn {
  display: inline-grid; place-items: center; width: 36px; height: 36px; border-radius: 10px; flex: none;
  border: 1px solid var(--border); background: var(--bg-elevated); color: var(--text-muted); cursor: pointer;
  transition: background var(--transition), color var(--transition), border-color var(--transition);
}
.icon-btn:hover { background: var(--bg-hover); color: var(--text); border-color: var(--border-strong); }
.icon-btn-ghost { border-color: transparent; background: transparent; }

/* Forms */

.field { display: flex; flex-direction: column; gap: 6px; margin-bottom: 14px; }
.field label, .label { font-size: 12.5px; font-weight: 650; color: var(--text-muted); letter-spacing: 0.01em; }
.input {
  width: 100%; height: 40px; padding: 0 12px; border-radius: 11px;
  border: 1px solid var(--border-strong); background: var(--bg); color: var(--text);
  font: 14.5px var(--font-sans); transition: border-color var(--transition), box-shadow var(--transition), background var(--transition);
}
.input:hover { border-color: var(--text-faint); }
.input:focus { outline: none; border-color: var(--accent); box-shadow: var(--ring); background: var(--bg-elevated); }
.input::placeholder { color: var(--text-faint); }
select.input { appearance: none; padding-right: 34px; cursor: pointer;
  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='%23908aa3' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 12px center; }
.input-sm { height: 32px; font-size: 13.5px; border-radius: 9px; }
.input-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
textarea.input { height: auto; padding: 12px 13px; line-height: 1.5; resize: vertical; }
.code-editor { min-height: 520px; font: 13px/1.6 var(--font-mono); tab-size: 2; }
.check { display: flex; align-items: center; gap: 10px; margin: 4px 0 16px; font-size: 14px; cursor: pointer; }
.check input, .switch input { accent-color: var(--accent); width: 17px; height: 17px; }
.hint { margin: -4px 0 14px; }
.file-input { font-size: 13px; color: var(--text-muted); }
.file-input::file-selector-button {
  margin-right: 10px; height: 32px; padding: 0 12px; border-radius: 9px; cursor: pointer;
  border: 1px solid var(--border-strong); background: var(--bg-elevated); color: var(--text); font: 600 13px var(--font-sans);
}
.or { display: flex; align-items: center; gap: 12px; margin: 6px 0 14px; color: var(--text-faint); font-size: 12px; text-transform: uppercase; letter-spacing: 0.08em; }
.or::before, .or::after { content: ""; flex: 1; height: 1px; background: var(--border); }

/* Chips, statuses, avatars */

.chip {
  display: inline-flex; align-items: center; gap: 6px; height: 26px; padding: 0 9px;
  border-radius: 999px; border: 1px solid var(--border); background: var(--bg-elevated);
  color: var(--text-muted); font-size: 12.5px; font-weight: 550; white-space: nowrap;
}
a.chip:hover { color: var(--text); border-color: var(--border-strong); text-decoration: none; }
.chip-accent { color: var(--accent-text); background: var(--accent-soft); border-color: transparent; }
.chip-gold { color: var(--gold); background: var(--gold-soft); border-color: transparent; }
.chip-glass { background: rgba(255, 255, 255, 0.14); border-color: rgba(255, 255, 255, 0.22); color: #fff; backdrop-filter: blur(8px); }
a.chip-glass:hover { color: #fff; background: rgba(255, 255, 255, 0.24); }

.status {
  display: inline-flex; align-items: center; gap: 6px; height: 24px; padding: 0 9px; border-radius: 999px;
  font-size: 12px; font-weight: 650; white-space: nowrap;
}
.status::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.status-pending, .status-queued, .status-cancelled { background: var(--bg-sunken); color: var(--text-muted); }
.status-downloaded, .status-transcribed, .status-diarized, .status-running { background: var(--info-soft); color: var(--info); }
.status-summarized, .status-done, .status-approved { background: var(--success-soft); color: var(--success); }
.status-error, .status-blocked { background: var(--danger-soft); color: var(--danger); }
.status-admin { background: var(--accent-soft); color: var(--accent-text); }
.status-waiting { background: var(--warning-soft); color: var(--warning); }

.avatar {
  --h: 265; flex: none; width: 40px; height: 40px; border-radius: 12px; display: grid; place-items: center;
  font: 700 14.5px/1 var(--font-display); font-stretch: var(--display-stretch); color: #fff;
  background: linear-gradient(135deg, hsl(var(--h) 80% 62%), hsl(calc(var(--h) + 50) 78% 52%));
  box-shadow: 0 8px 20px -10px hsl(var(--h) 80% 50% / 0.8), inset 0 1px 0 rgba(255, 255, 255, 0.25);
}
.avatar-sm { width: 30px; height: 30px; border-radius: 9px; font-size: 12px; }
.avatar-lg { width: 80px; height: 80px; border-radius: 22px; font-size: 28px; }
.avatar-img { object-fit: cover; background: var(--bg-sunken); }
.avatar-round { border-radius: 50%; }

/* Alerts & toasts */

.alert {
  display: flex; gap: 12px; padding: 13px 15px; margin-bottom: 20px; border-radius: var(--radius);
  border: 1px solid transparent; font-size: 14px;
}
.alert svg { flex: none; margin-top: 2px; }
.alert-text { min-width: 0; }
.alert-text p:last-child, .alert-text ul:last-child { margin-bottom: 0; }
.alert-text ul { margin: 6px 0; padding-left: 18px; }
.alert-title { font-weight: 700; margin-bottom: 4px; }
.alert-success { background: var(--success-soft); color: var(--success); }
.alert-error { background: var(--danger-soft); color: var(--danger); }
.alert-warning { background: var(--warning-soft); color: var(--warning); border-color: color-mix(in srgb, var(--warning) 22%, transparent); }
.alert-info { background: var(--info-soft); color: var(--info); border-color: color-mix(in srgb, var(--info) 18%, transparent); }
.alert-warning .alert-text, .alert-info .alert-text { color: var(--text); }
.alert a { color: inherit; text-decoration: underline; }
.alert[hidden] { display: none; }

.toasts {
  position: fixed; right: 20px; bottom: calc(var(--bottom-ui) + 20px); z-index: 90; display: flex; flex-direction: column; gap: 10px;
  max-width: min(420px, calc(100vw - 32px));
}
.toast {
  display: flex; align-items: flex-start; gap: 12px; padding: 13px 13px 13px 15px;
  border-radius: var(--radius); background: var(--bg-elevated); border: 1px solid var(--border);
  box-shadow: var(--shadow-lg); font-size: 14px; font-weight: 550;
  animation: toast-in 420ms var(--spring) both, toast-out 400ms var(--ease) 6s forwards;
}
.toast-icon { flex: none; width: 26px; height: 26px; border-radius: 8px; display: grid; place-items: center; }
.toast-success .toast-icon { background: var(--success-soft); color: var(--success); }
.toast-error .toast-icon { background: var(--danger-soft); color: var(--danger); }
.toast-error { animation: toast-in 420ms var(--spring) both; }
.toast .alert-text { flex: 1; padding-top: 3px; }
.toast-close { flex: none; border: 0; background: none; color: var(--text-faint); cursor: pointer; padding: 3px; border-radius: 6px; }
.toast-close:hover { color: var(--text); background: var(--bg-hover); }

/* Empty state */

.empty { text-align: center; padding: 44px 24px; color: var(--text-muted); }
.empty h3 { color: var(--text); margin-bottom: 6px; font-size: 16.5px; }
.empty p { max-width: 44ch; margin: 0 auto 16px; }
.empty-icon {
  width: 52px; height: 52px; margin: 0 auto 16px; border-radius: 16px; display: grid; place-items: center;
  background: var(--gradient-soft); color: var(--accent-text); box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--accent) 18%, transparent);
}

/* Progress */

.progress { min-width: 160px; }
.progress-meta { display: flex; justify-content: space-between; gap: 10px; font-size: 12.5px; margin-bottom: 6px; color: var(--text-muted); }
.progress-meta strong { color: var(--text); font-weight: 650; }
.bar { height: 8px; border-radius: 999px; background: var(--bg-sunken); overflow: hidden; box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--border) 60%, transparent); }
.bar span {
  display: block; height: 100%; border-radius: inherit; background: var(--accent);
  background-size: 200% 100%; transition: width 500ms var(--ease);
  position: relative; overflow: hidden;
}
.bar-live span::after, .progress .bar span::after {
  content: ""; position: absolute; inset: 0;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.45), transparent);
  animation: shimmer 1.6s linear infinite;
}
.bar-lg { height: 10px; }

.stepper { display: flex; gap: 6px; margin-top: 12px; }
.step { flex: 1; min-width: 0; }
.step-bar { height: 4px; border-radius: 999px; background: var(--bg-sunken); }
.step-label { margin-top: 6px; font-size: 11.5px; color: var(--text-faint); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.step.done .step-bar { background: var(--accent); }
.step.done .step-label { color: var(--text-muted); }
.step.current .step-bar { background: var(--accent); }
.step.current .step-label { color: var(--text); font-weight: 650; }

/* Menu (details) */

.menu { position: relative; }
.menu > summary { list-style: none; }
.menu > summary::-webkit-details-marker { display: none; }
.menu-panel {
  position: absolute; right: 0; top: calc(100% + 6px); z-index: 50; min-width: 240px; padding: 6px;
  background: var(--bg-elevated); border: 1px solid var(--border); border-radius: var(--radius);
  box-shadow: var(--shadow-lg); animation: menu-in 160ms var(--ease) both; transform-origin: top right;
}
.menu-up .menu-panel { top: auto; bottom: calc(100% + 6px); left: 0; right: 0; min-width: 0; transform-origin: bottom center; }
.menu-panel form { margin: 0; }
.menu-panel button, .menu-panel a {
  display: flex; align-items: center; gap: 10px; width: 100%; padding: 8px 10px; border: 0; border-radius: 8px;
  background: none; color: var(--text); font: 550 13.5px var(--font-sans); text-align: left; cursor: pointer;
}
.menu-panel button svg, .menu-panel a svg { color: var(--text-muted); flex: none; }
.menu-panel button:hover, .menu-panel a:hover { background: var(--bg-hover); text-decoration: none; }
.menu-panel .danger, .menu-panel .danger svg { color: var(--danger); }
.menu-sep { height: 1px; margin: 6px 4px; background: var(--border); }
.menu-label { padding: 6px 10px 4px; font-size: 11px; font-weight: 650; letter-spacing: 0.06em; text-transform: uppercase; color: var(--text-faint); }

/* Dialog */

dialog.modal {
  width: min(500px, calc(100vw - 32px)); padding: 0; border: 1px solid var(--border); border-radius: var(--radius-xl);
  background: var(--bg-elevated); color: var(--text); box-shadow: var(--shadow-lg);
}
dialog.modal[open] { animation: modal-in 300ms var(--spring) both; }
dialog.modal::backdrop { background: rgba(8, 6, 14, 0.55); animation: fade-in 200ms both; }
.modal-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; padding: 22px 22px 4px; }
.modal-head p { margin: 6px 0 0; color: var(--text-muted); font-size: 14px; }
.modal-body { padding: 16px 22px 22px; }
.modal-actions { display: flex; gap: 8px; justify-content: flex-end; flex-wrap: wrap; padding: 14px 22px; border-top: 1px solid var(--border); background: var(--bg-sunken); border-radius: 0 0 var(--radius-xl) var(--radius-xl); }

/* Plain confirmation (replaces window.confirm). */
.confirm-body { display: flex; gap: 16px; padding: 24px 22px 20px; }
.confirm-icon { flex: none; width: 44px; height: 44px; border-radius: 14px; display: grid; place-items: center; background: var(--accent-soft); color: var(--accent-text); }
.modal.is-danger .confirm-icon { background: var(--danger-soft); color: var(--danger); }
.confirm-body h2 { font-size: 17px; margin-bottom: 6px; }
.confirm-body p { margin: 0; color: var(--text-muted); font-size: 14px; }

/* Launch confirmation: the tokens a summary will use. */
.launch-body { padding: 26px 24px 20px; text-align: center; }
.launch-coin {
  width: 60px; height: 60px; margin: 0 auto 16px; border-radius: 20px; display: grid; place-items: center;
  background: var(--gold); color: #5a3200;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.55);
  animation: coin-in 600ms var(--spring) both;
}
.launch-body h2 { font-size: 20px; }
.launch-what { margin: 8px auto 0; max-width: 40ch; color: var(--text-muted); font-size: 14px; }
.launch-what strong { color: var(--text); }
.launch-cost { margin: 20px 0 4px; display: flex; align-items: baseline; justify-content: center; gap: 8px; }
.launch-cost strong { font: 750 52px/1 var(--font-display); font-stretch: var(--display-stretch); letter-spacing: -0.04em; font-variant-numeric: tabular-nums; }
.launch-cost span { font-size: 16px; color: var(--text-muted); font-weight: 600; }
.launch-ledger {
  display: grid; grid-template-columns: 1fr auto; gap: 8px 16px; margin: 18px 0 0; padding: 14px 16px; text-align: left;
  border-radius: var(--radius); background: var(--bg-sunken); font-size: 14px;
}
.launch-ledger dt { color: var(--text-muted); }
.launch-ledger dd { margin: 0; text-align: right; font-weight: 650; font-variant-numeric: tabular-nums; }
.launch-ledger .after { padding-top: 8px; border-top: 1px dashed var(--border-strong); }
.launch-ledger dd.after { color: var(--text); }
.launch-free { margin: 16px 0 0; }
.launch-body .alert { margin: 16px 0 0; text-align: left; }
.launch-note { margin: 14px 0 0; font-size: 12.5px; color: var(--text-faint); }
.launch-whole button.link { padding: 0; border: 0; background: none; color: inherit; font: inherit; text-decoration: underline; cursor: pointer; }
.launch-whole [hidden] { display: none; }
[data-launch-free][hidden], [data-launch-paid][hidden], [data-launch-billing][hidden] { display: none; }

/* Command palette. */
dialog.palette {
  width: min(620px, calc(100vw - 24px)); max-height: min(560px, calc(100vh - 120px)); margin-top: 12vh; padding: 0;
  border: 1px solid var(--border); border-radius: var(--radius-xl); background: var(--bg-elevated); color: var(--text);
  box-shadow: var(--shadow-lg); overflow: hidden;
}
dialog.palette[open] { display: flex; flex-direction: column; animation: modal-in 240ms var(--spring) both; }
dialog.palette::backdrop { background: rgba(8, 6, 14, 0.45); animation: fade-in 160ms both; }
.palette-search { display: flex; align-items: center; gap: 12px; padding: 0 16px; border-bottom: 1px solid var(--border); color: var(--text-faint); }
.palette-search input { flex: 1; height: 56px; border: 0; background: none; color: var(--text); font: 500 16px var(--font-sans); outline: none; box-shadow: none; }
.palette-close { display: none; margin-right: -8px; }
.palette-list { overflow-y: auto; padding: 8px; }
.palette-group { padding: 10px 10px 6px; font-size: 11px; font-weight: 650; letter-spacing: 0.06em; text-transform: uppercase; color: var(--text-faint); }
.palette-item {
  display: flex; align-items: center; gap: 12px; padding: 9px 10px; border-radius: 10px; color: var(--text); font-weight: 550;
}
.palette-item:hover { text-decoration: none; }
.palette-item .ico { width: 30px; height: 30px; border-radius: 9px; display: grid; place-items: center; background: var(--bg-sunken); color: var(--text-muted); flex: none; }
.palette-item .sub { margin-left: auto; font-size: 12.5px; color: var(--text-faint); font-weight: 500; white-space: nowrap; }
.palette-item.is-active { background: var(--accent-soft); color: var(--accent-text); }
.palette-item.is-active .ico { background: var(--bg-elevated); color: var(--accent-text); }
.palette-item[hidden], .palette-group[hidden] { display: none; }
.palette-empty { padding: 28px; text-align: center; color: var(--text-muted); font-size: 14px; }
.palette-foot { display: flex; gap: 16px; padding: 10px 16px; border-top: 1px solid var(--border); background: var(--bg-sunken); color: var(--text-faint); font-size: 12px; }
.palette-foot span { display: inline-flex; align-items: center; gap: 6px; }

/* Tabs */

.tabs {
  display: flex; gap: 2px; margin-bottom: 20px; max-width: 100%; overflow-x: auto; scrollbar-width: none;
  border-bottom: 1px solid var(--border);
}
.tab {
  position: relative; display: inline-flex; align-items: center; gap: 8px; height: 42px; padding: 0 12px; border: 0;
  background: none; color: var(--text-muted); font: 600 14px var(--font-sans); cursor: pointer; white-space: nowrap;
  transition: color var(--transition);
}
.tab:hover { color: var(--text); text-decoration: none; }
.tab::after {
  content: ""; position: absolute; left: 8px; right: 8px; bottom: -1px; height: 2px; border-radius: 2px;
  background: var(--accent); transform: scaleX(0); transition: transform 220ms var(--ease);
}
.tab[aria-selected="true"] { color: var(--text); }
.tab[aria-selected="true"]::after { transform: scaleX(1); }
.tab[aria-selected="true"] svg { color: var(--accent-text); }
.tab-count { font-size: 11.5px; padding: 1px 7px; border-radius: 999px; background: var(--bg-sunken); color: var(--text-muted); font-weight: 650; }
.tab-panel[hidden] { display: none; }
.tab-panel { animation: fade-up 240ms var(--ease) both; }

/* Tables */

.table { width: 100%; border-collapse: collapse; font-size: 14px; }
.table th {
  text-align: left; padding: 11px 16px; font-size: 11.5px; font-weight: 650; letter-spacing: 0.05em;
  text-transform: uppercase; color: var(--text-faint); border-bottom: 1px solid var(--border); background: var(--bg-sunken);
}
.table thead tr:first-child th:first-child { border-top-left-radius: var(--radius-lg); }
.table thead tr:first-child th:last-child { border-top-right-radius: var(--radius-lg); }
.table td { padding: 13px 16px; border-bottom: 1px solid var(--border); vertical-align: middle; }
.table tr:last-child td { border-bottom: 0; }
.table tbody tr { transition: background var(--transition); }
.table tbody tr:hover { background: var(--bg-hover); }
.cell-actions { text-align: right; white-space: nowrap; }
.cell-title { min-width: 220px; }
@media (max-width: 760px) {
  .table-cards thead { display: none; }
  .table-cards tr { display: block; padding: 12px 14px; border-bottom: 1px solid var(--border); }
  .table-cards td { display: flex; justify-content: space-between; gap: 12px; padding: 5px 0; border: 0; }
  .table-cards td[data-label]::before { content: attr(data-label); color: var(--text-faint); font-size: 12px; }
  .table-cards .cell-title { display: block; min-width: 0; }
  .table-cards .cell-actions { justify-content: flex-end; }
}

/* Dashboard */

.welcome { display: flex; align-items: center; gap: 16px; }
.todo-list { display: flex; flex-direction: column; }
.todo {
  display: grid; grid-template-columns: 112px minmax(0, 1fr) auto; gap: 14px; align-items: center;
  padding: 12px 16px; border-top: 1px solid var(--border); transition: background var(--transition);
}
.todo:first-child { border-top: 0; }
.todo:hover { background: var(--bg-hover); }
.todo .vod-thumb { border-radius: 8px; }
@media (max-width: 640px) { .todo { grid-template-columns: 80px minmax(0, 1fr); } .todo .btn { grid-column: 1 / -1; } }

/* Character cards. */
.char-card { overflow: hidden; display: flex; flex-direction: column; }
.char-banner {
  --h: 265; position: relative; height: 84px;
  background:
    radial-gradient(110% 160% at 0% 0%, hsl(var(--h) 80% 58% / 0.75), transparent 62%),
    radial-gradient(90% 140% at 100% 100%, hsl(calc(var(--h) + 60) 80% 55% / 0.4), transparent 60%),
    var(--brand-night);
}
/* The character's colour, seen through the brand's night and its caption grid. */
.char-banner::after {
  content: ""; position: absolute; inset: 0;
  background-image: linear-gradient(rgba(255, 255, 255, 0.06) 1px, transparent 1px), linear-gradient(90deg, rgba(255, 255, 255, 0.06) 1px, transparent 1px);
  background-size: 14px 14px; mask-image: linear-gradient(to bottom, black, transparent);
}
.char-card .avatar { position: relative; z-index: 1; margin: -28px 0 0 16px; width: 54px; height: 54px; border-radius: 16px; font-size: 19px; border: 3px solid var(--bg-elevated); }
.char-card-body { padding: 10px 16px 16px; display: flex; flex-direction: column; gap: 10px; flex: 1; }
.char-name { font: 650 16.5px/1.25 var(--font-display); font-stretch: var(--display-stretch); letter-spacing: -0.02em; }
.char-channel { color: var(--text-muted); font-size: 13px; }
.char-stats { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: auto; padding-top: 12px; border-top: 1px solid var(--border); }
.char-stats strong { display: block; font: 700 19px/1.1 var(--font-display); font-stretch: var(--display-stretch); font-variant-numeric: tabular-nums; }
.char-stats span { font-size: 12px; color: var(--text-muted); }
.char-stats .is-waiting strong { color: var(--warning); }
.char-card-new {
  display: grid; place-items: center; text-align: center; min-height: 250px; gap: 10px; padding: 24px;
  border: 1.5px dashed var(--border-strong); background: transparent; box-shadow: none; cursor: pointer;
  font: inherit; color: var(--text-muted); border-radius: var(--radius-lg);
  transition: border-color var(--transition), color var(--transition), background var(--transition);
}
.char-card-new:hover { border-color: var(--accent); color: var(--accent-text); background: var(--accent-soft); }
.char-card-new .empty-icon { margin: 0 auto; }

/* Hero (character, session) */

.hero {
  --h: 265; position: relative; overflow: hidden; margin-bottom: 22px; padding: 28px; border-radius: var(--radius-xl);
  color: #fff;
  background:
    radial-gradient(80% 140% at 0% 0%, hsl(var(--h) 80% 55% / 0.55), transparent 60%),
    radial-gradient(70% 120% at 100% 100%, hsl(calc(var(--h) + 60) 80% 55% / 0.25), transparent 60%),
    radial-gradient(50% 90% at 92% 0%, rgba(255, 212, 59, 0.12), transparent 70%),
    var(--brand-night);
  box-shadow: var(--shadow), inset 0 1px 0 rgba(255, 255, 255, 0.12);
}
.hero::after {
  content: ""; position: absolute; inset: 0; pointer-events: none;
  background-image: linear-gradient(rgba(255, 255, 255, 0.05) 1px, transparent 1px), linear-gradient(90deg, rgba(255, 255, 255, 0.05) 1px, transparent 1px);
  background-size: 32px 32px; mask-image: linear-gradient(105deg, black 10%, transparent 75%);
}
.hero-inner { position: relative; z-index: 1; display: flex; align-items: flex-end; gap: 20px; flex-wrap: wrap; }
.hero .avatar-lg { border: 3px solid rgba(255, 255, 255, 0.4); box-shadow: 0 20px 40px -18px rgba(0, 0, 0, 0.6); }
.hero .eyebrow { color: rgba(255, 255, 255, 0.78); }
.hero h1 { color: #fff; }
.hero-meta { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 12px; }
.hero-actions { margin-left: auto; display: flex; gap: 8px; flex-wrap: wrap; }
.hero .btn { background: rgba(255, 255, 255, 0.14); border-color: rgba(255, 255, 255, 0.24); color: #fff; backdrop-filter: blur(8px); box-shadow: none; }
.hero .btn:hover { background: rgba(255, 255, 255, 0.24); }
.hero .btn-primary { background: var(--brand-yellow); color: var(--brand-ink); border-color: var(--brand-yellow); box-shadow: 0 12px 30px -12px rgba(0, 0, 0, 0.5); }
.hero .btn-primary:hover { background: #ffe070; filter: none; }
.hero-stats { position: relative; z-index: 1; display: grid; grid-template-columns: repeat(4, minmax(0, max-content)); gap: 12px 36px; margin-top: 22px; padding-top: 18px; border-top: 1px solid rgba(255, 255, 255, 0.16); }
.hero-stats strong { display: block; font: 700 22px/1.05 var(--font-display); font-stretch: var(--display-stretch); letter-spacing: -0.02em; }
.hero-stats span { font-size: 12.5px; color: rgba(255, 255, 255, 0.72); }
@media (max-width: 640px) {
  .hero { padding: 20px; border-radius: var(--radius-lg); }
  .hero .avatar-lg { width: 60px; height: 60px; font-size: 21px; border-radius: 17px; }
  .hero-actions { margin-left: 0; }
  .hero-stats { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px 20px; }
}

/* VOD list (character page) */

.vod-list { display: flex; flex-direction: column; }
.vod-row {
  display: grid; grid-template-columns: 140px minmax(0, 1fr) auto; gap: 16px; align-items: center;
  padding: 14px 20px; border-top: 1px solid var(--border); transition: background var(--transition);
}
.vod-row:first-child { border-top: 0; }
.vod-row:hover { background: var(--bg-hover); }
.vod-thumb {
  position: relative; aspect-ratio: 16 / 9; border-radius: 10px; overflow: hidden;
  background: var(--gradient-soft), var(--bg-sunken); display: grid; place-items: center; color: var(--text-faint);
}
.vod-thumb img { width: 100%; height: 100%; object-fit: cover; }
.vod-duration {
  position: absolute; right: 6px; bottom: 6px; padding: 2px 6px; border-radius: 6px;
  background: rgba(0, 0, 0, 0.72); color: #fff; font: 600 11px/1.4 var(--font-mono);
}
.vod-title { font-weight: 650; color: var(--text); }
a.vod-title:hover { color: var(--accent-text); }
.vod-meta { display: flex; gap: 8px 10px; flex-wrap: wrap; align-items: center; margin-top: 6px; font-size: 13px; color: var(--text-muted); }
.vod-error { margin-top: 8px; font-size: 13px; color: var(--danger); display: flex; gap: 6px; align-items: flex-start; }
.vod-error svg { flex: none; margin-top: 2px; }
.vod-actions { display: flex; gap: 6px; align-items: center; }
@media (max-width: 700px) {
  .vod-row { grid-template-columns: 96px minmax(0, 1fr); padding: 14px 16px; }
  .vod-actions { grid-column: 1 / -1; justify-content: flex-end; }
}

/* Twitch VOD picker */

.picker { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 16px; }
.pick { position: relative; display: block; cursor: pointer; }
.pick input { position: absolute; opacity: 0; pointer-events: none; }
.pick-card {
  height: 100%; border-radius: var(--radius-lg); overflow: hidden; background: var(--bg-elevated);
  border: 1.5px solid var(--border); transition: border-color var(--transition), transform var(--transition), box-shadow var(--transition);
}
.pick:hover .pick-card { transform: translateY(-2px); box-shadow: var(--shadow); }
.pick input:focus-visible + .pick-card { box-shadow: var(--ring); }
.pick input:checked + .pick-card { border-color: var(--accent); box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 22%, transparent), var(--shadow); }
.pick .vod-thumb { border-radius: 0; }
.pick-check {
  position: absolute; top: 10px; left: 10px; z-index: 2; width: 26px; height: 26px; border-radius: 9px;
  display: grid; place-items: center; color: transparent;
  background: rgba(0, 0, 0, 0.35); border: 2px solid rgba(255, 255, 255, 0.85); backdrop-filter: blur(4px);
  transition: background var(--transition), transform 200ms var(--spring);
}
.pick input:checked + .pick-card .pick-check { background: var(--accent); border-color: var(--accent); color: var(--on-accent); transform: scale(1.08); }
.pick-body { padding: 12px 14px 14px; }
.pick-title { font-weight: 650; font-size: 14px; line-height: 1.35; }
.pick-meta { margin-top: 6px; font-size: 12.5px; color: var(--text-muted); display: flex; gap: 8px; flex-wrap: wrap; }
.pick.known { cursor: default; }
.pick.known .pick-card { opacity: 0.6; }
.pick.known:hover .pick-card { transform: none; box-shadow: none; }
.pick.known .pick-check { display: none; }
.pick-badge { position: absolute; top: 10px; right: 10px; z-index: 2; }
.pick-badge .chip { background: rgba(0, 0, 0, 0.62); color: #fff; border-color: transparent; backdrop-filter: blur(6px); }

.actionbar {
  position: sticky; bottom: calc(var(--bottom-ui) + 18px); z-index: 25; margin-top: 22px;
  display: flex; align-items: center; gap: 12px; flex-wrap: wrap; padding: 10px 12px 10px 18px;
  border-radius: 16px; border: 1px solid var(--border); background: var(--bg-elevated);
  box-shadow: var(--shadow-lg);
  transition: transform 320ms var(--spring), opacity 200ms var(--ease);
}
.actionbar[data-empty] { transform: translateY(16px); opacity: 0; pointer-events: none; }
.actionbar .count { font: 700 15px var(--font-display); font-stretch: var(--display-stretch); }
.actionbar .check { margin: 0; }
.actionbar select { width: auto; min-width: 200px; }

.skeleton {
  border-radius: var(--radius-lg); background: var(--bg-sunken); position: relative; overflow: hidden; min-height: 230px;
}
.skeleton::after {
  content: ""; position: absolute; inset: 0;
  background: linear-gradient(90deg, transparent, color-mix(in srgb, var(--bg-elevated) 70%, transparent), transparent);
  animation: shimmer 1.4s linear infinite;
}
.load-more { display: flex; justify-content: center; grid-column: 1 / -1; padding: 8px 0; }
.htmx-indicator { display: none; }
.htmx-request .htmx-indicator, .htmx-request.htmx-indicator { display: inline-flex; }
.spin { animation: spin 0.9s linear infinite; }

/* Now playing (live job) */

.now {
  display: flex; gap: 18px; align-items: center; padding: 16px 20px; margin-bottom: 24px;
  border-radius: var(--radius-lg); border: 1px solid color-mix(in srgb, var(--accent) 28%, var(--border));
  background: var(--bg-elevated); position: relative; overflow: hidden; box-shadow: var(--shadow-sm);
}
.now::before { content: ""; position: absolute; inset: 0; background: var(--gradient-soft); pointer-events: none; }
.now > * { position: relative; }
.now-icon { width: 44px; height: 44px; border-radius: 13px; display: grid; place-items: center; background: var(--accent); color: var(--on-accent); flex: none; }
.now-body { flex: 1; min-width: 0; }
.now-title { font-weight: 650; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.now-side { min-width: 190px; }
@media (max-width: 700px) { .now { flex-wrap: wrap; } .now-side { flex: 1 1 100%; } }

/* Jobs */

.job-list { display: flex; flex-direction: column; }
.job {
  display: grid; grid-template-columns: 40px minmax(0, 1fr) auto; gap: 14px; align-items: center;
  padding: 15px 20px; border-top: 1px solid var(--border);
}
.job:first-child { border-top: 0; }
.job-icon { width: 40px; height: 40px; border-radius: 12px; display: grid; place-items: center; background: var(--bg-sunken); color: var(--text-muted); }
.job-running .job-icon { background: var(--accent); color: var(--on-accent); }
.job-done .job-icon { background: var(--success-soft); color: var(--success); }
.job-error .job-icon { background: var(--danger-soft); color: var(--danger); }
.job-title { font-weight: 600; }
.job-msg { margin-top: 4px; font-size: 13px; color: var(--text-muted); }
.job-error .job-msg { color: var(--danger); }
.job-side { display: flex; flex-direction: column; align-items: flex-end; gap: 6px; }
.job-section { padding: 12px 20px 6px; font-size: 11.5px; font-weight: 650; letter-spacing: 0.06em; text-transform: uppercase; color: var(--text-faint); border-top: 1px solid var(--border); background: var(--bg-sunken); }
.job-section:first-child { border-top: 0; border-radius: var(--radius-lg) var(--radius-lg) 0 0; }
@media (max-width: 640px) { .job { grid-template-columns: 40px minmax(0, 1fr); } .job-side { grid-column: 1 / -1; flex-direction: row; justify-content: space-between; align-items: center; } }

/* Session recap */

.prose { font-size: 15.5px; line-height: 1.75; }
.prose h2 { margin: 30px 0 12px; padding-top: 22px; border-top: 1px solid var(--border); font-size: 19px; }
.prose h2:first-child { margin-top: 0; padding-top: 0; border-top: 0; }
.prose h3 { margin: 20px 0 8px; }
.prose ul, .prose ol { padding-left: 22px; margin: 0 0 14px; }
.prose li { margin: 7px 0; }
.prose li::marker { color: var(--accent); }
.prose strong { font-weight: 650; }
.prose blockquote { margin: 0 0 14px; padding: 4px 16px; border-left: 3px solid var(--accent); color: var(--text-muted); }
.prose pre { white-space: pre-wrap; margin: 0; font-size: 13px; line-height: 1.6; }
.prose-lead > p:first-of-type { font-size: 17px; }
.reading { max-width: 74ch; }

/* Timecodes in recaps: the brand's [h:mm:ss] chip, a link into the VOD. */
a.ts, .ts {
  display: inline-flex; align-items: center; height: 20px; padding: 0 6px; margin: 0 2px; border-radius: 5px;
  background: var(--accent); color: var(--on-accent); font: 700 11.5px/1 var(--font-mono);
  vertical-align: 1px; transition: background var(--transition), box-shadow var(--transition), transform 120ms var(--ease);
}
a.ts::before { content: "["; }
a.ts::after { content: "]"; }
a.ts:hover { background: var(--accent-hover); color: var(--on-accent); text-decoration: none; transform: translateY(-1px); }

.chunk { border-top: 1px solid var(--border); }
.chunk > summary {
  display: flex; align-items: center; gap: 10px; padding: 12px 20px; cursor: pointer; list-style: none; font-size: 14px;
  transition: background var(--transition);
}
.chunk > summary:hover { background: var(--bg-hover); }
.chunk > summary::-webkit-details-marker { display: none; }
.chunk > summary::after { content: ""; width: 8px; height: 8px; border-right: 2px solid var(--text-faint); border-bottom: 2px solid var(--text-faint); transform: rotate(-45deg); transition: transform var(--transition); }
.chunk[open] > summary::after { transform: rotate(45deg); }
.chunk .prose { padding: 4px 20px 18px; }

/* Facts of a recap reported as wrong (ADR-0026) */
.report-list { list-style: none; margin: 0; padding: 0; }
.report-item { display: flex; gap: 12px; align-items: flex-start; justify-content: space-between; padding: 14px 20px; border-top: 1px solid var(--border); }
.report-meta { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin-bottom: 6px; }
.report-quote { padding: 2px 12px; border-left: 3px solid var(--border-strong); color: var(--text-muted); margin-bottom: 6px; overflow-wrap: anywhere; }
.report-correction { margin: 0; overflow-wrap: anywhere; }
.chunk-hrp-title { margin: 14px 0 6px; font-size: 12px; font-weight: 650; text-transform: uppercase; letter-spacing: 0.06em; color: var(--text-faint); }
.chunk-hrp { color: var(--text-muted); }

.session-nav { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; margin-top: 20px; }
.session-nav a { display: flex; flex-direction: column; gap: 4px; padding: 16px 18px; }
.session-nav a.next { text-align: right; align-items: flex-end; }
.session-nav small { color: var(--text-muted); font-size: 12px; display: inline-flex; gap: 6px; align-items: center; }

.kv { display: grid; grid-template-columns: 1fr auto; gap: 10px 16px; margin: 0; font-size: 14px; }
.kv dt { color: var(--text-muted); }
.kv dd { margin: 0; text-align: right; font-weight: 600; font-variant-numeric: tabular-nums; }

/* Voice */

.voice-state { display: flex; align-items: center; gap: 16px; margin-bottom: 16px; padding: 16px; border-radius: var(--radius); background: var(--bg-sunken); }
.voice-wave { display: flex; align-items: center; gap: 3px; height: 30px; }
.voice-wave i { display: block; width: 4px; border-radius: 3px; background: var(--accent); }
.voice-wave.live i { animation: wave 1s ease-in-out infinite; }
.voice-wave.live i:nth-child(2n) { animation-delay: -0.3s; }
.voice-wave.live i:nth-child(3n) { animation-delay: -0.6s; }

/* Servers, system, admin */

.server-card { display: flex; align-items: center; gap: 16px; padding: 16px 18px; }
.server-icon { width: 44px; height: 44px; border-radius: 13px; display: grid; place-items: center; background: var(--gradient-soft); color: var(--accent-text); flex: none; }
.server-card .chev { margin-left: auto; color: var(--text-faint); transition: transform var(--transition); }
.server-card:hover .chev { transform: translateX(3px); color: var(--accent-text); }

.checks { list-style: none; margin: 0; padding: 8px 0; }
.check-item { display: flex; gap: 14px; padding: 14px 20px; }
.check-icon { width: 28px; height: 28px; border-radius: 9px; display: grid; place-items: center; flex: none; }
.check-ok .check-icon { background: var(--success-soft); color: var(--success); }
.check-warning .check-icon { background: var(--warning-soft); color: var(--warning); }
.check-blocking .check-icon { background: var(--danger-soft); color: var(--danger); }
.check-info .check-icon { background: var(--info-soft); color: var(--info); }
.check-title { font-weight: 650; }
.check-detail { color: var(--text-muted); font-size: 14px; }
.check-fix { margin-top: 8px; padding: 10px 12px; border-radius: 10px; background: var(--bg-sunken); font-size: 13.5px; }
.check-fix code { background: var(--bg-elevated); padding: 1px 5px; border-radius: 5px; }

.config { list-style: none; margin: 0; padding: 8px 0 12px; }
.config li { display: flex; justify-content: space-between; gap: 14px; padding: 8px 20px; font-size: 13px; }
.config-key { font-family: var(--font-mono); color: var(--text-muted); }
.config-value { font-family: var(--font-mono); text-align: right; word-break: break-all; }

.context-preview { white-space: pre-wrap; margin: 0; padding: 12px; border-radius: 10px; background: var(--bg-sunken); font-size: 12.5px; max-height: 320px; overflow: auto; }

.user-row { display: flex; align-items: center; gap: 12px; }
.user-row .name { font-weight: 650; }
.user-actions { display: flex; gap: 6px; justify-content: flex-end; flex-wrap: wrap; }
.user-actions form { margin: 0; }

/* Auth pages */

.auth {
  min-height: 100vh; min-height: 100dvh; display: grid; grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr);
  background: var(--bg);
}
.auth-art {
  position: relative; overflow: hidden; padding: 48px; color: #f2f1ec; display: flex; flex-direction: column; justify-content: space-between;
  background:
    radial-gradient(520px 420px at 100% 0%, rgba(255, 212, 59, 0.16), transparent 70%),
    radial-gradient(480px 380px at 0% 100%, rgba(80, 140, 255, 0.1), transparent 70%),
    var(--brand-night);
}
.auth-art::after {
  content: ""; position: absolute; inset: 0; pointer-events: none;
  background-image: linear-gradient(rgba(255, 255, 255, 0.035) 1px, transparent 1px), linear-gradient(90deg, rgba(255, 255, 255, 0.035) 1px, transparent 1px);
  background-size: 40px 40px;
}
.auth-art > * { position: relative; z-index: 1; }
.auth-art .brand { color: #f2f1ec; padding: 0; }
.auth-quote { max-width: 18ch; font: 850 clamp(32px, 3.6vw, 52px)/1.02 var(--font-display); font-stretch: var(--display-stretch-xl); letter-spacing: -0.035em; text-wrap: balance; }
.auth-quote em { font-style: normal; color: var(--brand-yellow); }
.auth-features { display: grid; gap: 12px; max-width: 420px; }
.auth-feature { display: flex; gap: 12px; align-items: center; padding: 12px 14px; border-radius: 14px; background: rgba(255, 255, 255, 0.05); border: 1px solid rgba(255, 255, 255, 0.1); font-size: 14px; animation: fade-up 600ms var(--ease) both; }
.auth-feature:nth-child(2) { animation-delay: 120ms; }
.auth-feature:nth-child(3) { animation-delay: 240ms; }
.auth-feature .ico { width: 32px; height: 32px; border-radius: 10px; display: grid; place-items: center; background: var(--brand-yellow); color: var(--brand-ink); flex: none; }
.auth-panel { display: grid; place-items: center; padding: 40px 24px; }
.auth-box { width: min(400px, 100%); animation: fade-up 500ms var(--ease) both; }
.auth-box h1 { font-size: 30px; }
.auth-box .lead { font-size: 15px; margin-bottom: 28px; }
.auth-note { margin-top: 18px; font-size: 13px; color: var(--text-muted); text-align: center; }
.auth-setup { margin-top: 18px; padding: 14px 16px; border-radius: var(--radius); background: var(--bg-sunken); font-size: 13.5px; }
.auth-setup code { word-break: break-all; }
.auth-theme { position: fixed; top: 18px; right: 18px; z-index: 5; }
@media (max-width: 900px) {
  .auth { grid-template-columns: 1fr; }
  .auth-art { min-height: 300px; padding: 28px 24px; gap: 28px; }
  .auth-features { display: none; }
}

.error-page { display: grid; place-items: center; min-height: 60vh; text-align: center; }
.error-code { font: 800 96px/1 var(--font-display); font-stretch: var(--display-stretch); letter-spacing: -0.05em; }

/* Animations */

@keyframes page-in { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
@keyframes fade-in { from { opacity: 0; } to { opacity: 1; } }
@keyframes fade-up { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }
@keyframes pop { from { transform: scale(0.4); } to { transform: scale(1); } }
@keyframes shimmer { from { transform: translateX(-100%); } to { transform: translateX(100%); } }
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes wave { 50% { transform: scaleY(0.35); } }
@keyframes float { 33% { transform: translate(40px, -30px) scale(1.06); } 66% { transform: translate(-30px, 30px) scale(0.95); } }
@keyframes loading { 0% { transform: scaleX(0); } 60% { transform: scaleX(0.75); } 100% { transform: scaleX(0.95); opacity: 0.4; } }
@keyframes toast-in { from { opacity: 0; transform: translateY(18px) scale(0.96); } to { opacity: 1; transform: none; } }
@keyframes toast-out { to { opacity: 0; transform: translateY(10px); visibility: hidden; } }
@keyframes menu-in { from { opacity: 0; transform: scale(0.96) translateY(-4px); } to { opacity: 1; transform: none; } }
@keyframes modal-in { from { opacity: 0; transform: translateY(14px) scale(0.97); } to { opacity: 1; transform: none; } }
@keyframes coin-in { from { opacity: 0; transform: scale(0.6) rotate(-20deg); } to { opacity: 1; transform: none; } }
@keyframes bump { 0% { transform: scale(1); } 35% { transform: scale(1.12); } 100% { transform: scale(1); } }

.reveal > * { animation: fade-up 420ms var(--ease) both; }
.reveal > *:nth-child(2) { animation-delay: 40ms; }
.reveal > *:nth-child(3) { animation-delay: 80ms; }
.reveal > *:nth-child(4) { animation-delay: 120ms; }
.reveal > *:nth-child(5) { animation-delay: 160ms; }
.reveal > *:nth-child(n+6) { animation-delay: 200ms; }

::view-transition-old(root), ::view-transition-new(root) { animation-duration: 160ms; }

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

/* RP context layers */
.code-editor-sm { min-height: 280px; }
.layers { margin: 0; padding-left: 20px; display: grid; gap: 6px; }
.mod-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.mod-list li { display: flex; align-items: center; gap: 10px; }
.mod-list .who { flex: 1; min-width: 0; }

/* VOD search for editors (ADR-0020) */

.search-bar { display: flex; gap: 8px; }
.search-input { position: relative; flex: 1; min-width: 0; }
.search-input > svg { position: absolute; left: 13px; top: 50%; transform: translateY(-50%); color: var(--text-faint); pointer-events: none; }
.search-input .input { width: 100%; height: 46px; padding-left: 40px; font-size: 15px; }
.search-submit { height: 46px; min-width: 132px; justify-content: center; }
.search-submit:disabled { opacity: 1; cursor: progress; }
.search-submit .when-idle, .search-submit .when-busy { display: inline-flex; align-items: center; gap: 7px; }
.search-submit .when-busy { display: none; }

/* While a search runs (htmx puts .htmx-request on #search-zone): the button says so,
   the question is dimmed, and a progress card replaces the previous results. */
.search-zone.htmx-request .search-submit .when-idle { display: none; }
.search-zone.htmx-request .search-submit .when-busy { display: inline-flex; }
.search-zone.htmx-request .search-input .input { opacity: 0.65; }
.search-progress { display: none; }
.search-zone.htmx-request .search-progress { display: block; animation: fade-in 160ms var(--ease) both; }
.search-zone.htmx-request .search-results { display: none; }
.search-progress-head { display: flex; align-items: center; gap: 12px; color: var(--accent-text); }
.search-progress-head > .spin { display: inline-flex; }
.search-progress-head h3 { margin: 0; color: var(--text); font-size: 16px; }
.search-progress-head p { margin: 2px 0 0; }
.search-progress-bar { margin: 16px 0 14px; }
.search-progress-bar span { width: 100%; }
.search-steps { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; font-size: 14px; }
.search-step { display: flex; align-items: center; gap: 10px; color: var(--text-faint); animation: search-step-on 200ms var(--ease) forwards; }
.search-step-icon { position: relative; width: 22px; height: 22px; border-radius: 50%; display: grid; place-items: center; background: var(--bg-sunken); color: var(--accent-text); }
.search-step-icon > span { position: absolute; inset: 0; display: grid; place-items: center; opacity: 0; }
.search-step-spin { animation: spin 0.9s linear infinite, search-step-now 1.4s linear forwards; }
.search-step-done { animation: search-step-show 200ms var(--ease) forwards; }
.search-step:nth-child(1) { animation-delay: 0s; }
.search-step:nth-child(1) .search-step-spin { animation-delay: 0s, 0s; }
.search-step:nth-child(1) .search-step-done { animation-delay: 1.4s; }
.search-step:nth-child(2) { animation-delay: 1.4s; }
.search-step:nth-child(2) .search-step-spin { animation-delay: 0s, 1.4s; }
.search-step:nth-child(2) .search-step-done { animation-delay: 2.8s; }
.search-step:nth-child(3) { animation-delay: 2.8s; }
.search-step:nth-child(3) .search-step-spin { animation: spin 0.9s linear infinite, search-step-show 200ms linear 2.8s forwards; }
.search-step:nth-child(3) .search-step-done { display: none; }
@keyframes search-step-on { to { color: var(--text); } }
@keyframes search-step-show { to { opacity: 1; } }
@keyframes search-step-now { 0%, 99% { opacity: 1; } 100% { opacity: 0; } }

.search-start h3 { margin: 0 0 6px; font-size: 16px; }
.search-start p { margin: 0; }
.search-start-label { margin-top: 16px !important; margin-bottom: 8px !important; text-transform: uppercase; letter-spacing: 0.06em; }
.search-examples { display: flex; flex-wrap: wrap; gap: 8px; }
.search-example { height: 32px; padding: 0 12px; cursor: pointer; font: inherit; font-size: 13.5px; }
.search-example:hover { color: var(--text); border-color: var(--border-strong); }
.search-example svg { color: var(--accent-text); }

.search-summary { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; margin-bottom: 12px; }
.search-summary p { margin: 0; min-width: 0; }
.search-hits { list-style: none; margin: 0; padding: 0; display: grid; gap: 14px; }
.search-hit { padding: 18px 20px; animation: fade-up 260ms var(--ease) both; animation-delay: calc(var(--i, 0) * 60ms); }
.search-hit-head { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.search-rank {
  width: 26px; height: 26px; border-radius: 8px; display: grid; place-items: center; flex: none;
  background: var(--bg-sunken); color: var(--text-muted); font: 700 13px var(--font-display);
}
.search-ts {
  display: inline-flex; align-items: center; gap: 6px; height: 32px; padding: 0 12px; border-radius: 9px; flex: none;
  background: var(--accent-soft); color: var(--accent-text); font: 650 15px var(--font-mono);
}
.search-ts:hover { text-decoration: none; filter: brightness(0.97); }
.search-hit-vod { display: flex; flex-direction: column; min-width: 0; flex: 1; }
.search-hit-vod strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.search-why { display: flex; gap: 8px; align-items: flex-start; margin: 14px 0 0; font-weight: 550; }
.search-why svg { color: var(--accent-text); flex: none; margin-top: 3px; }
.search-lines { display: grid; gap: 4px; margin-top: 12px; padding-left: 12px; border-left: 2px solid var(--border); }
.search-line { margin: 0; font-size: 13.5px; line-height: 1.55; color: var(--text-muted); }
.search-line a { color: var(--text-faint); margin-right: 4px; font-size: 12.5px; }
.search-line strong { color: var(--text); font-weight: 600; }
.search-line-streamer strong { color: var(--accent-text); }
.search-line mark { background: color-mix(in srgb, var(--accent) 32%, transparent); color: var(--text); border-radius: 3px; padding: 0 2px; }
.search-hit-actions { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 14px; }
@media (max-width: 640px) {
  .search-bar { flex-direction: column; }
  .search-submit { width: 100%; }
  .search-hit { padding: 16px; }
  .search-hit-vod { flex-basis: 100%; }
}

/* Passage editor (ADR-0009) */

.editor { display: grid; grid-template-columns: minmax(0, 1fr) 340px; gap: 20px; align-items: start; }
.editor-main { display: flex; flex-direction: column; gap: 20px; min-width: 0; }
.editor-side { position: sticky; top: calc(var(--topbar-h) + 20px); }
@media (max-width: 1080px) {
  .editor { grid-template-columns: minmax(0, 1fr); }
  .editor-side { position: static; }
}

.player-card { overflow: hidden; }
.player { position: relative; aspect-ratio: 16 / 9; background: #0b0a10; }
.player-frame, .player-frame iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; }
.player-poster { position: absolute; inset: 0; display: grid; place-items: center; transition: opacity var(--transition); }
.player-poster img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; opacity: 0.45; filter: blur(2px); }
.player-note {
  position: relative; display: flex; align-items: center; gap: 10px; max-width: 46ch; margin: 0 20px; padding: 10px 14px;
  border-radius: 12px; background: rgba(0, 0, 0, 0.6); color: #fff; font-size: 13.5px; backdrop-filter: blur(6px);
}
.player.is-ready .player-poster { opacity: 0; pointer-events: none; }
.player.is-failed .player-note .spin { display: none; }

/* Selection summary, with the live token cost. */
.sel-card .card-body { padding-top: 14px; }
.sel-total { font: 700 38px/1 var(--font-display); font-stretch: var(--display-stretch); letter-spacing: -0.035em; font-variant-numeric: tabular-nums; }
.sel-of { margin-top: 6px; }
.sel-bar { margin: 14px 0 4px; }
.sel-facts { display: grid; grid-template-columns: 1fr auto; gap: 8px 16px; margin: 14px 0 0; font-size: 14px; }
.sel-facts dt { color: var(--text-muted); }
.sel-facts dd { margin: 0; text-align: right; font-weight: 650; font-variant-numeric: tabular-nums; }

.cost {
  position: relative; overflow: hidden; margin-top: 16px; padding: 14px 16px; border-radius: var(--radius);
  background: var(--bg-sunken); border: 1px solid var(--border);
}
.cost::before {
  content: ""; position: absolute; inset: 0; pointer-events: none;
  background: radial-gradient(120% 120% at 100% 0%, color-mix(in srgb, var(--gold) 14%, transparent), transparent 60%);
}
.cost > * { position: relative; }
.cost-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.cost-label { font-size: 12px; font-weight: 650; letter-spacing: 0.05em; text-transform: uppercase; color: var(--text-muted); }
.cost-value { display: flex; align-items: center; gap: 10px; margin-top: 8px; }
.cost-coin {
  width: 34px; height: 34px; border-radius: 11px; display: grid; place-items: center; flex: none;
  background: var(--gold); color: #5a3200; box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.5);
}
.cost-num { display: inline-block; font: 750 32px/1 var(--font-display); font-stretch: var(--display-stretch); letter-spacing: -0.035em; font-variant-numeric: tabular-nums; }
.cost-num.bump { animation: bump 360ms var(--spring); }
.cost-unit { font-size: 14px; font-weight: 600; color: var(--text-muted); }
.cost-rule { margin-top: 6px; font-size: 12.5px; color: var(--text-faint); }
.cost-ledger { display: grid; grid-template-columns: 1fr auto; gap: 6px 12px; margin: 12px 0 0; padding-top: 12px; border-top: 1px dashed var(--border-strong); font-size: 13.5px; }
.cost-ledger dt { color: var(--text-muted); }
.cost-ledger dd { margin: 0; text-align: right; font-weight: 650; font-variant-numeric: tabular-nums; }
.cost-ledger dd.is-short { color: var(--danger); }
.cost .alert { margin: 12px 0 0; padding: 10px 12px; font-size: 13px; }
.cost-free { margin-top: 10px; }
.sel-actions { display: flex; flex-direction: column-reverse; gap: 8px; }
.sel-actions .btn { width: 100%; }
.sel-hint { margin: 14px 0 0; }

/* Phone: the cost and the launch button stay at hand. */
.launch-bar { display: none; }
@media (max-width: 1080px) {
  .launch-bar {
    position: sticky; bottom: calc(var(--bottom-ui) + 12px); z-index: 25; display: flex; align-items: center; gap: 12px; margin-top: 16px;
    padding: 10px 10px 10px 14px; border-radius: 16px; border: 1px solid var(--border);
    background: var(--bg-elevated); box-shadow: var(--shadow-lg);
  }
  .launch-bar .cost-coin { width: 30px; height: 30px; border-radius: 9px; }
  .launch-bar-text { min-width: 0; flex: 1; line-height: 1.2; }
  .launch-bar-text strong { font: 700 17px/1 var(--font-display); font-stretch: var(--display-stretch); }
  .launch-bar-text small { display: block; color: var(--text-muted); font-size: 12px; margin-top: 3px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
}

.tl { outline: none; }
.tl:focus-visible .tl-scroll { box-shadow: var(--ring); }
.tl-toolbar { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; margin-bottom: 12px; }
.tl-toolbar kbd { margin-left: 2px; }
@media (max-width: 1500px) { .tl-toolbar kbd { display: none; } }
.tl-clock { padding: 0 8px; font-size: 13.5px; font-variant-numeric: tabular-nums; white-space: nowrap; }
.tl-sep { width: 1px; height: 22px; margin: 0 4px; background: var(--border); }

.tl-scroll {
  overflow-x: auto; overflow-y: hidden; border: 1px solid var(--border); border-radius: var(--radius);
  background: var(--bg-sunken); scrollbar-width: thin;
}
.tl-canvas { position: relative; min-width: 100%; height: 104px; user-select: none; }
.tl-ruler, .tl-track { touch-action: none; }
.tl-ruler {
  position: absolute; left: 0; right: 0; top: 0; height: 28px; cursor: ew-resize;
  border-bottom: 1px solid var(--border); background: var(--bg-elevated);
}
.tl-ruler i { position: absolute; bottom: 0; width: 1px; height: 6px; background: var(--border-strong); }
.tl-ruler i.major { height: 11px; background: var(--text-faint); }
.tl-ruler i span {
  position: absolute; bottom: 12px; left: 4px; color: var(--text-faint); white-space: nowrap;
  font: 500 10.5px/1 var(--font-mono); font-style: normal;
}
.tl-track {
  position: absolute; left: 0; right: 0; top: 36px; bottom: 10px; cursor: crosshair;
  background-image: repeating-linear-gradient(-45deg, transparent 0 7px, color-mix(in srgb, var(--text-faint) 16%, transparent) 7px 8px);
}
.tl-seg {
  position: absolute; top: 0; bottom: 0; min-width: 4px; display: flex; align-items: center; overflow: hidden;
  border-radius: 9px; background: var(--accent); color: var(--on-accent); cursor: grab;
  box-shadow: inset 0 0 0 1px rgba(11, 11, 16, 0.12), 0 6px 18px -10px rgba(230, 170, 0, 0.7);
}
.tl-seg:active { cursor: grabbing; }
.tl-seg.is-selected { box-shadow: 0 0 0 2px var(--bg-sunken), 0 0 0 4px var(--accent), 0 8px 22px -10px rgba(230, 170, 0, 0.7); z-index: 1; }
.tl-seg-label {
  flex: 1; min-width: 0; padding: 0 14px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  font: 700 12px/1 var(--font-sans); pointer-events: none;
}
.tl-handle { position: absolute; top: 0; bottom: 0; width: 10px; cursor: ew-resize; z-index: 1; }
.tl-handle::after {
  content: ""; position: absolute; top: 50%; width: 3px; height: 22px; margin-top: -11px; border-radius: 2px;
  background: rgba(11, 11, 16, 0.5);
}
.tl-handle-start { left: 0; }
.tl-handle-start::after { left: 3px; }
.tl-handle-end { right: 0; }
.tl-handle-end::after { right: 3px; }

.tl-playhead { position: absolute; top: 0; bottom: 0; width: 0; z-index: 2; pointer-events: none; }
.tl-playhead::before { content: ""; position: absolute; top: 22px; bottom: 0; left: -1px; width: 2px; background: var(--accent-2); }
.tl-playhead span {
  position: absolute; top: 9px; left: -7px; width: 14px; height: 14px; border-radius: 4px 4px 7px 7px;
  background: var(--accent-2); box-shadow: 0 2px 6px rgba(0, 0, 0, 0.35); pointer-events: auto; cursor: ew-resize;
}
.tl-help { margin-top: 10px; }

.tl-list-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin: 22px 0 10px; }
.tl-list { display: flex; flex-direction: column; gap: 6px; }
.tl-row {
  display: grid; grid-template-columns: 30px 120px 16px 120px minmax(0, 1fr) auto; align-items: center; gap: 8px;
  padding: 6px 8px; border-radius: 12px; border: 1px solid transparent; transition: background var(--transition), border-color var(--transition);
}
.tl-row.is-selected { background: var(--accent-soft); border-color: color-mix(in srgb, var(--accent) 35%, transparent); }
.tl-row-num {
  width: 26px; height: 26px; border-radius: 8px; display: grid; place-items: center;
  background: var(--accent); color: var(--on-accent); font: 700 12px/1 var(--font-sans);
}
.tl-row-arrow { color: var(--text-faint); text-align: center; }
.tl-row-dur { color: var(--text-muted); font-size: 13px; font-variant-numeric: tabular-nums; }
.tl-time { font-variant-numeric: tabular-nums; }
.tl-time[aria-invalid] { border-color: var(--danger); box-shadow: 0 0 0 3px color-mix(in srgb, var(--danger) 20%, transparent); }
@media (max-width: 640px) {
  .tl-row { grid-template-columns: 26px minmax(0, 1fr) 12px minmax(0, 1fr) auto; }
  .tl-row-dur { display: none; }
  .tl-toolbar kbd { display: none; }
}

/* Tokens (ADR-0013) */

.balance-hero {
  position: relative; overflow: hidden; display: flex; align-items: center; gap: 22px; flex-wrap: wrap;
  padding: 24px; margin-bottom: 20px; border-radius: var(--radius-xl);
  background: var(--bg-elevated); border: 1px solid var(--border); box-shadow: var(--shadow-sm), var(--highlight);
}
.balance-hero::before {
  content: ""; position: absolute; inset: 0; pointer-events: none;
  background:
    radial-gradient(60% 140% at 0% 0%, color-mix(in srgb, var(--gold) 16%, transparent), transparent 60%),
    radial-gradient(50% 120% at 100% 100%, color-mix(in srgb, var(--accent) 10%, transparent), transparent 60%);
}
.balance-hero > * { position: relative; }
.balance-coin {
  width: 64px; height: 64px; border-radius: 20px; display: grid; place-items: center; flex: none;
  background: var(--gold); color: #5a3200; box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.55);
}
.balance-main { min-width: 0; }
.balance-num { display: flex; align-items: baseline; gap: 10px; }
.balance-num strong { font: 750 46px/1 var(--font-display); font-stretch: var(--display-stretch); letter-spacing: -0.04em; font-variant-numeric: tabular-nums; }
.balance-num span { font-size: 16px; font-weight: 600; color: var(--text-muted); }
.balance-sub { margin-top: 6px; color: var(--text-muted); font-size: 14px; }
.balance-lots { margin-left: auto; display: flex; gap: 8px; flex-wrap: wrap; }
.lot { padding: 10px 14px; border-radius: 12px; background: var(--bg-sunken); border: 1px solid var(--border); min-width: 140px; }
.lot strong { display: block; font: 700 18px/1.1 var(--font-display); font-stretch: var(--display-stretch); font-variant-numeric: tabular-nums; }
.lot span { font-size: 12px; color: var(--text-muted); }

.offer-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 14px; }
.offer {
  position: relative; display: flex; flex-direction: column; gap: 6px; padding: 18px; min-width: 0;
  border: 1px solid var(--border); border-radius: var(--radius-lg); background: var(--bg-elevated);
  transition: border-color var(--transition), transform var(--transition), box-shadow var(--transition);
}
.offer:hover { border-color: var(--border-strong); transform: translateY(-2px); box-shadow: var(--shadow); }
.offer-current { border-color: transparent; box-shadow: inset 0 0 0 2px var(--accent); }
.offer-name { font-weight: 700; }
.offer-tokens { font: 750 32px/1 var(--font-display); font-stretch: var(--display-stretch); letter-spacing: -0.035em; font-variant-numeric: tabular-nums; margin-top: 4px; }
.offer-tokens span { margin-left: 6px; font-size: 14px; font-weight: 600; font-family: inherit; color: var(--text-muted); letter-spacing: 0; }
.offer-price { font-weight: 650; margin: 4px 0 10px; font-size: 15px; }
.offer form { margin-top: auto; }
.sub-state { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; margin-bottom: 16px; }
.table .num { text-align: right; font-variant-numeric: tabular-nums; }
.token-delta { font-weight: 700; }
.token-delta.plus { color: var(--success); }
.rules { margin: 0; padding-left: 18px; display: flex; flex-direction: column; gap: 8px; color: var(--text-muted); }
.plan-state { display: flex; flex-wrap: wrap; align-items: baseline; gap: 2px 8px; }
@media (max-width: 640px) { .balance-lots { margin-left: 0; } .balance-num strong { font-size: 38px; } }

/* Legal pages and account (ADR-0014) */

.legal-links { display: flex; flex-wrap: wrap; justify-content: center; gap: 6px 16px; margin-top: 8px; }
.legal-links a { color: var(--text-muted); }
.legal-links-left .legal-links { justify-content: flex-start; margin-top: 18px; font-size: 13px; }
.legal-wrap { max-width: 880px; margin-inline: auto; }
.legal-doc .card-body { padding: 28px 30px; }
.legal-doc table { width: 100%; border-collapse: collapse; margin: 0 0 16px; font-size: 14px; line-height: 1.55; }
.legal-doc th, .legal-doc td { text-align: left; vertical-align: top; padding: 9px 12px; border-bottom: 1px solid var(--border); }
.legal-doc th { font-size: 12px; font-weight: 650; letter-spacing: 0.04em; text-transform: uppercase; color: var(--text-faint); }
.legal-doc .table-wrap, .legal-doc table { display: block; overflow-x: auto; }
.legal-missing { padding: 1px 6px; border-radius: 6px; background: var(--warning-soft); color: var(--warning); font-weight: 600; }
.legal-list { list-style: none; margin: 0 0 18px; padding: 0; display: grid; gap: 8px; }
.legal-list a { display: inline-flex; align-items: center; gap: 8px; font-weight: 600; }
.facts { display: grid; grid-template-columns: auto 1fr; gap: 8px 18px; margin: 0; font-size: 14px; }
.facts dt { color: var(--text-muted); }
.facts dd { margin: 0; }
@media (max-width: 640px) {
  .legal-doc .card-body { padding: 20px 18px; }
}
.auth-legal { margin-top: 28px; padding: 0; }
.check.consent { align-items: flex-start; font-size: 13.5px; line-height: 1.5; }
.check.consent input { flex: none; margin-top: 2px; }
.profile { display: flex; align-items: center; gap: 14px; margin-bottom: 18px; }

/* Public site (ADR-0015).
   Landing page, pricing and the legal pages for a visitor. Same tokens as the app;
   the closing call to action is the one deliberately dark block in both themes. */

:root {
  --em-color: var(--text);
  --em-mark: linear-gradient(transparent 60%, var(--brand-yellow) 60% 90%, transparent 90%);
  --site-max: 1160px;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) { --em-color: var(--brand-yellow); --em-mark: none; }
}
:root[data-theme="dark"] { --em-color: var(--brand-yellow); --em-mark: none; }

.site { display: flex; flex-direction: column; min-height: 100vh; min-height: 100dvh; }
.site-wrap { width: 100%; max-width: var(--site-max); margin-inline: auto; padding-inline: 20px; }
.skip-link { position: absolute; left: 12px; top: -60px; z-index: 100; padding: 10px 14px; border-radius: 10px; background: var(--accent); color: var(--on-accent); font-weight: 700; }
.skip-link:focus { top: 12px; }

/* Timecode chip: the brand's signature, [h:mm:ss]. */
.tc {
  display: inline-block; padding: 1px 6px; border-radius: 5px; vertical-align: 0.06em;
  background: var(--accent); color: var(--on-accent);
  font: 700 0.8em/1.45 var(--font-mono); white-space: nowrap; font-variant-numeric: tabular-nums;
}
.tc-sm { font-size: 11.5px; }

.site-top {
  position: sticky; top: 0; z-index: 30;
  background: var(--bg);
  border-bottom: 1px solid var(--border);
}
.site-top-row { display: flex; align-items: center; gap: 24px; height: 64px; }
.site-top .brand { padding: 0; }
.site-nav { display: flex; gap: 4px; margin-left: 12px; }
.site-nav a { padding: 8px 12px; border-radius: 9px; color: var(--text-muted); font-weight: 600; font-size: 14px; }
.site-nav a:hover, .site-nav a[aria-current="page"] { color: var(--text); background: var(--bg-hover); text-decoration: none; }
.site-actions { display: flex; align-items: center; gap: 8px; margin-left: auto; }

.site-main { flex: 1; }
.site-main > .legal-wrap, .site-main > .error-page { padding-block: 40px 64px; padding-inline: 20px; }

.site-h1 {
  margin: 0; max-width: 13ch; text-wrap: balance;
  font: 850 clamp(42px, 6.4vw, 80px)/0.96 var(--font-display); font-stretch: var(--display-stretch-xl); letter-spacing: -0.04em;
}
.site-h1 em { font-style: normal; white-space: nowrap; color: var(--em-color); background: var(--em-mark); }
.site-h1-md { font-size: clamp(36px, 4.6vw, 58px); max-width: 18ch; }
.site-h2 {
  margin: 0; max-width: 22ch; text-wrap: balance;
  font: 850 clamp(28px, 3.4vw, 42px)/1.04 var(--font-display); font-stretch: var(--display-stretch-xl); letter-spacing: -0.035em;
}
.site-lead { margin: 24px 0 0; max-width: 54ch; font-size: clamp(16.5px, 1.5vw, 19px); line-height: 1.6; color: var(--text-muted); }
.site-sub { margin: 14px 0 0; max-width: 60ch; font-size: 16px; line-height: 1.6; color: var(--text-muted); }
.site-kicker { margin: 0 0 12px; font: 700 12px/1 var(--font-mono); letter-spacing: 0.08em; text-transform: uppercase; color: var(--accent-text); }
.site-head { margin-bottom: 36px; }
.site-cta-row { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 32px; }
.site-note { display: flex; align-items: flex-start; gap: 8px; margin: 18px 0 0; font-size: 13.5px; color: var(--text-faint); }

.site-hero { padding-block: clamp(48px, 8vw, 96px) clamp(40px, 6vw, 72px); }
.site-hero-compact { padding-block: 48px 8px; }
.site-hero-grid { display: grid; grid-template-columns: minmax(0, 1.05fr) minmax(0, 0.95fr); gap: 56px; align-items: center; }

/* The hero's recap window. */
.demo {
  margin: 0; border: 1px solid var(--border); border-radius: 18px; overflow: hidden;
  background: var(--bg-elevated); box-shadow: var(--shadow-lg); animation: fade-up 700ms var(--ease) both;
}
.demo-bar { display: flex; align-items: center; gap: 12px; padding: 12px 16px; border-bottom: 1px solid var(--border); }
.demo-title { flex: 1; min-width: 0; font: 750 14px/1.2 var(--font-display); font-stretch: var(--display-stretch); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.demo-timeline {
  position: relative; height: 34px; margin: 16px 16px 0; border-radius: 9px;
  background: repeating-linear-gradient(-45deg, transparent 0 7px, color-mix(in srgb, var(--text-faint) 18%, transparent) 7px 8px), var(--bg-sunken);
}
.demo-seg { position: absolute; top: 5px; bottom: 5px; border-radius: 6px; background: var(--accent); }
.demo-head { position: absolute; top: -4px; bottom: -4px; width: 2px; border-radius: 2px; background: var(--brand-live); }
.demo-head::before { content: ""; position: absolute; top: -3px; left: -4px; width: 10px; height: 10px; border-radius: 50%; background: var(--brand-live); }
.demo-body { padding: 18px 18px 6px; }
.demo-label { margin: 0 0 6px; font: 700 11.5px/1 var(--font-mono); letter-spacing: 0.08em; text-transform: uppercase; color: var(--text-faint); }
.demo-text { margin: 0 0 14px; font-size: 15px; line-height: 1.65; }
.demo-facts { margin: 0; padding: 0; list-style: none; display: grid; gap: 8px; }
.demo-facts li { display: flex; gap: 8px; align-items: baseline; padding: 9px 12px; border-radius: 10px; background: var(--bg-sunken); font-size: 14px; }
.demo-foot { display: flex; align-items: center; flex-wrap: wrap; gap: 10px; margin: 14px 18px 18px; font-size: 13px; color: var(--text-muted); }
.tag-sheet {
  display: inline-flex; align-items: center; gap: 6px; padding: 4px 9px; border-radius: 999px;
  background: var(--accent-soft); color: var(--accent-text); font-weight: 700; font-size: 12px;
}

.site-band { border-block: 1px solid var(--border); background: var(--bg-elevated); }
.proof { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); }
.proof > div { display: grid; gap: 6px; padding: 28px 24px; }
.proof > div + div { border-left: 1px solid var(--border); }
.proof strong { font: 850 28px/1 var(--font-display); font-stretch: var(--display-stretch-xl); letter-spacing: -0.03em; font-variant-numeric: tabular-nums; }
.proof span { color: var(--text-muted); font-size: 14.5px; }

.site-section { padding-block: clamp(56px, 8vw, 96px); }
.site-section-tight { padding-block: 16px; }
.site-section-alt { background: var(--bg-sunken); border-block: 1px solid var(--border); }

.steps-public { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; counter-reset: none; }
.step-public { position: relative; padding: 26px 24px; border: 1px solid var(--border); border-radius: 16px; background: var(--bg-elevated); }
.step-public h3 { margin: 18px 0 8px; font: 800 19px/1.2 var(--font-display); font-stretch: var(--display-stretch); }
.step-public p { margin: 0; color: var(--text-muted); line-height: 1.6; }
.step-num {
  display: inline-grid; place-items: center; width: 40px; height: 40px; border-radius: 11px;
  background: var(--accent); color: var(--on-accent); font: 850 18px/1 var(--font-display); font-stretch: var(--display-stretch-xl);
}

.example-grid { display: grid; grid-template-columns: minmax(0, 1.45fr) minmax(0, 1fr); gap: 16px; align-items: start; }
.paper { padding: 26px 28px; border: 1px solid var(--border); border-radius: 16px; background: var(--bg-elevated); box-shadow: var(--shadow); min-width: 0; }
.paper p, .paper li { line-height: 1.75; font-size: 15.5px; }
.paper h4 { margin: 20px 0 8px; font: 700 12px/1 var(--font-mono); letter-spacing: 0.08em; text-transform: uppercase; color: var(--text-faint); }
.paper ul { margin: 0; padding-left: 18px; display: grid; gap: 6px; }
.paper-head { display: flex; align-items: center; gap: 14px; }
.paper-head h3 { margin: 0; font: 800 20px/1.15 var(--font-display); font-stretch: var(--display-stretch); }
.paper-head p { margin: 2px 0 0; font-size: 13.5px; color: var(--text-muted); line-height: 1.4; }
.paper-avatar {
  display: grid; place-items: center; width: 46px; height: 46px; flex: none; border-radius: 13px;
  background: linear-gradient(135deg, hsl(212 80% 52%), hsl(272 70% 56%)); color: #fff; font: 800 16px/1 var(--font-display);
}
.paper-note { margin: 18px 0 0; padding-top: 14px; border-top: 1px dashed var(--border-strong); font-size: 13.5px !important; color: var(--text-muted); }
.site-disclaimer { margin: 18px 0 0; font-size: 13px; color: var(--text-faint); }

/* A list, not a card grid: the two lead promises run larger, the rest follow as notes. */
.feature-list { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 32px 56px; }
.feature { padding-top: 18px; border-top: 1px solid var(--border); }
.feature h3 { display: flex; align-items: center; gap: 10px; margin: 0 0 8px; font: 800 17px/1.25 var(--font-display); font-stretch: var(--display-stretch); }
.feature p { margin: 0; color: var(--text-muted); line-height: 1.6; font-size: 14.5px; max-width: 52ch; }
.feature-ico { display: inline-flex; flex: none; color: var(--accent-text); }
.feature-lead { padding-top: 22px; border-top: 3px solid var(--accent); }
.feature-lead h3 { font-size: clamp(20px, 2.2vw, 24px); }
.feature-lead p { font-size: 16px; color: var(--text); }
.feature:last-child:nth-child(odd) { grid-column: 1 / -1; }

.price-teaser { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 48px; align-items: center; }
.price-teaser-card { display: grid; gap: 18px; justify-items: start; padding: 26px; border-radius: 16px; border: 1px solid var(--border); background: var(--bg-elevated); box-shadow: var(--shadow); }
.price-calc { display: grid; gap: 10px; width: 100%; }
.price-calc-bar { display: flex; gap: 3px; height: 28px; }
.price-calc-bar i { display: block; height: 100%; border-radius: 6px; background: var(--accent); }
.price-calc-bar i.off, .price-calc-legend i.off { background: repeating-linear-gradient(-45deg, transparent 0 5px, color-mix(in srgb, var(--text-faint) 30%, transparent) 5px 6px), var(--bg-sunken); }
.price-calc-legend { display: flex; flex-wrap: wrap; gap: 16px; font-size: 12.5px; color: var(--text-muted); }
.price-calc-legend span { display: inline-flex; align-items: center; gap: 6px; }
.price-calc-legend i { display: inline-block; width: 14px; height: 10px; border-radius: 3px; background: var(--accent); }
.price-teaser-line { margin: 0; font-size: 16px; line-height: 1.55; }

.site-faq .faq-list { max-width: 860px; }
.faq-list { display: grid; gap: 10px; }
.faq-item { border: 1px solid var(--border); border-radius: 14px; background: var(--bg-elevated); }
.faq-item summary {
  display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 18px 20px;
  cursor: pointer; list-style: none; font: 750 16px/1.35 var(--font-display); font-stretch: var(--display-stretch);
}
.faq-item summary::-webkit-details-marker { display: none; }
.faq-plus { display: grid; place-items: center; flex: none; width: 28px; height: 28px; border-radius: 8px; background: var(--bg-sunken); transition: transform var(--transition); }
.faq-item[open] .faq-plus { transform: rotate(45deg); }
.faq-item p { margin: 0; padding: 0 20px 20px; color: var(--text-muted); line-height: 1.7; max-width: 70ch; }

/* The closing call to action: the brand's night, whatever the theme. */
.site-final { position: relative; overflow: hidden; padding-block: clamp(64px, 9vw, 112px); background: var(--brand-night); color: #f2f1ec; text-align: center; }
.site-final::before {
  content: ""; position: absolute; inset: 0; pointer-events: none;
  background: radial-gradient(600px 300px at 50% 0%, rgba(255, 212, 59, 0.2), transparent 70%);
}
.site-final-inner { position: relative; display: grid; justify-items: center; gap: 4px; }
.site-final .site-h2 { margin-top: 18px; max-width: 20ch; }
.site-final .site-sub { color: #a3a2ae; margin-bottom: 28px; }
.site-final-mark svg { display: block; }

.site-foot { border-top: 1px solid var(--border); background: var(--bg-elevated); padding-block: 48px 28px; font-size: 14px; }
.site-foot-grid { display: grid; grid-template-columns: minmax(0, 1.6fr) repeat(3, minmax(0, 1fr)); gap: 32px; }
.site-foot-brand .brand { padding: 0 0 14px; }
.site-foot-brand p { margin: 0 0 6px; color: var(--text-muted); }
.site-foot nav { display: grid; gap: 8px; align-content: start; }
.site-foot h2 { margin: 0 0 4px; font: 700 12px/1 var(--font-mono); letter-spacing: 0.08em; text-transform: uppercase; color: var(--text-faint); }
.site-foot nav a { color: var(--text-muted); }
.site-foot nav a:hover { color: var(--text); }
.site-foot-bottom { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 8px 24px; margin-top: 40px; padding-top: 20px; border-top: 1px solid var(--border); color: var(--text-faint); font-size: 12.5px; }

/* Pricing page */
.site-crumbs { display: flex; gap: 8px; margin-bottom: 18px; font-size: 13.5px; color: var(--text-faint); }
.site-crumbs a { color: var(--text-muted); }
.rule-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; }
.rule-card { display: flex; gap: 16px; align-items: flex-start; padding: 22px; border-radius: 16px; border: 1px solid var(--border); background: var(--bg-elevated); }
.rule-card p { margin: 0; color: var(--text-muted); line-height: 1.55; }
.rule-card strong { color: var(--text); }
.rule-big { flex: none; display: grid; place-items: center; min-width: 52px; height: 52px; padding: 0 8px; border-radius: 13px; background: var(--accent); color: var(--on-accent); font: 850 26px/1 var(--font-display); font-stretch: var(--display-stretch-xl); }
.beta-card { display: flex; align-items: center; gap: 18px; flex-wrap: wrap; padding: 22px 24px; border-radius: 16px; border: 1px solid var(--accent-line); background: var(--gradient-soft), var(--bg-elevated); }
.beta-card > div { flex: 1; min-width: 240px; }
.beta-card h2 { margin: 0 0 4px; font: 800 19px/1.2 var(--font-display); font-stretch: var(--display-stretch); }
.beta-card p { margin: 0; color: var(--text-muted); }
.beta-ico { display: grid; place-items: center; width: 44px; height: 44px; border-radius: 12px; background: var(--accent); color: var(--on-accent); }
.plan-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; }
.plan { position: relative; display: grid; gap: 6px; align-content: start; padding: 26px 24px; border-radius: 16px; border: 1px solid var(--border); background: var(--bg-elevated); }
.plan h3 { margin: 0 0 6px; font: 800 18px/1.2 var(--font-display); font-stretch: var(--display-stretch); }
.plan-tokens { margin: 0; color: var(--text-muted); }
.plan-tokens strong { font: 850 40px/1 var(--font-display); font-stretch: var(--display-stretch-xl); letter-spacing: -0.04em; color: var(--text); font-variant-numeric: tabular-nums; }
.plan-hours { margin: 0; font-size: 13.5px; color: var(--text-faint); }
.plan-price { margin: 14px 0 0; font: 800 20px/1.2 var(--font-display); font-stretch: var(--display-stretch); }
.plan-price-soon { font-size: 15px; color: var(--text-faint); font-weight: 650; }
.plan-unit { margin: 0; font-size: 13px; color: var(--text-muted); }

@media (max-width: 1000px) {
  .site-hero-grid, .example-grid, .price-teaser { grid-template-columns: 1fr; gap: 36px; }
  .feature-list { gap: 28px 32px; }
  .site-foot-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .site-foot-brand { grid-column: 1 / -1; }
}
@media (max-width: 760px) {
  .site-nav { display: none; }
  .steps-public, .feature-list, .rule-grid, .plan-grid, .proof { grid-template-columns: 1fr; }
  .proof > div + div { border-left: 0; border-top: 1px solid var(--border); }
  .site-top-row { gap: 12px; }
  .site-wrap { padding-inline: 16px; }
  .paper { padding: 20px; }
}
@media (max-width: 480px) {
  .site-login { display: none; }
  .site-foot-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .site-cta-row .btn { width: 100%; }
}
@media (prefers-reduced-motion: reduce) {
  .demo { animation: none; }
}

/* Reading pages (ADR-0016): Explorer, public character, recap, pot */

.btn-glass { background: rgba(255, 255, 255, 0.14); border-color: rgba(255, 255, 255, 0.24); color: #fff; backdrop-filter: blur(8px); }
.btn-glass:hover { background: rgba(255, 255, 255, 0.22); color: #fff; }
.btn.is-following { color: var(--accent-text); border-color: color-mix(in srgb, var(--accent) 40%, transparent); }
.btn.is-following svg { fill: currentColor; }
.btn-glass.is-following { color: #fff; background: rgba(255, 255, 255, 0.26); }

.explorer-hero {
  position: relative; overflow: hidden; padding: 36px 32px 28px; margin-bottom: 8px;
  border-radius: var(--radius-lg); border: 1px solid var(--border);
  background: var(--gradient-soft), var(--bg-elevated);
}
.explorer-hero h1 { font-size: clamp(26px, 4vw, 38px); max-width: 22ch; margin-top: 6px; }
.explorer-hero .lead { max-width: 60ch; }
.explorer-search {
  display: flex; align-items: center; gap: 10px; margin-top: 20px; max-width: 620px;
  padding: 6px 6px 6px 16px; border-radius: 14px; background: var(--bg-elevated);
  border: 1px solid var(--border-strong); box-shadow: var(--shadow-sm); color: var(--text-faint);
}
.explorer-search .input { border: 0; background: transparent; box-shadow: none; padding-left: 0; height: 40px; flex: 1; min-width: 0; }
.explorer-search .input:focus { outline: none; box-shadow: none; }
.explorer-search:focus-within { border-color: var(--accent); box-shadow: var(--ring); }
.server-filter { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 16px; }
.server-filter .chip { text-decoration: none; }
.chip-count { margin-left: 4px; font-variant-numeric: tabular-nums; opacity: 0.7; }

.reader-card .char-stats { align-items: end; }
.reader-card-cta { display: inline-flex; align-items: center; gap: 4px; justify-content: flex-end; width: 100%; font-weight: 650; color: var(--accent-text); font-size: 13.5px; }

.recap-list { display: flex; flex-direction: column; }
.recap-row {
  display: grid; grid-template-columns: 132px minmax(0, 1fr) auto; gap: 16px; align-items: center;
  padding: 16px 20px; border-top: 1px solid var(--border); transition: background var(--transition);
}
.recap-row:first-child { border-top: 0; }
.recap-row:hover { background: var(--bg-hover); }
.recap-row-meta { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; font-size: 13px; color: var(--text-muted); }
.recap-row-meta .chip { text-decoration: none; }
.recap-row h3 { font-size: 15.5px; margin: 6px 0 4px; }
.recap-row-title { color: var(--text); }
.recap-row-title:hover { color: var(--accent-text); }
.recap-row-excerpt { margin: 0; color: var(--text-muted); font-size: 13.5px; line-height: 1.5; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
@media (max-width: 700px) {
  .recap-row { grid-template-columns: 96px minmax(0, 1fr); padding: 14px 16px; }
  .recap-row-action { grid-column: 1 / -1; justify-self: end; }
}

.reader-recap { padding: 28px 32px; }
@media (max-width: 640px) { .reader-recap { padding: 20px; } }

.people { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 10px; }
.person { display: flex; align-items: center; gap: 12px; padding: 10px 12px; border-radius: 12px; border: 1px solid var(--border); background: var(--bg-sunken); color: var(--text); }
.person > span:not(.avatar) { display: flex; flex-direction: column; min-width: 0; flex: 1; }
.person small { color: var(--text-muted); font-size: 12px; }
.person .avatar { flex: none; }
a.person.is-linked { background: var(--bg-elevated); transition: border-color var(--transition), background var(--transition); }
a.person.is-linked:hover { border-color: var(--accent); background: var(--accent-soft); }
a.person.is-linked > svg { color: var(--text-faint); flex: none; }

/* A streamer's pot (ADR-0016): the same header on the streamer's panel and the gift card. */
.pot-panel { overflow: hidden; scroll-margin-top: 80px; }
.pot-hero {
  display: flex; align-items: center; gap: 14px; padding: 18px 20px;
  background: linear-gradient(120deg, var(--gold-soft), transparent 85%), var(--bg-elevated);
  border-bottom: 1px solid var(--border);
}
.pot-icon {
  display: grid; place-items: center; flex: none; width: 46px; height: 46px; border-radius: 13px;
  background: var(--gold); color: #3a2400; box-shadow: 0 10px 22px -14px var(--gold);
}
.pot-icon-sm { width: 30px; height: 30px; border-radius: 9px; }
.pot-figure { min-width: 0; }
.pot-label { font-size: 12px; font-weight: 650; letter-spacing: 0.04em; text-transform: uppercase; color: var(--text-muted); }
.pot-amount { display: flex; align-items: baseline; gap: 6px; margin-top: 4px; }
.pot-amount strong { font: 750 30px/1 var(--font-display); font-stretch: var(--display-stretch); font-variant-numeric: tabular-nums; color: var(--text); }
.pot-amount span { font-size: 14px; color: var(--text-muted); }
.pot-sub { margin-top: 4px; font-size: 12.5px; color: var(--text-muted); }
.pot-body { display: flex; flex-direction: column; gap: 12px; padding: 16px 20px 20px; font-size: 13.5px; }
.pot-body p { margin: 0; }
.pot-desc { color: var(--text-muted); }
.pot-stat { display: flex; align-items: center; gap: 8px; font-weight: 600; }
.pot-stat svg { flex: none; color: var(--danger); fill: currentColor; }
.pot-lots { list-style: none; margin: 0; padding: 0; border: 1px solid var(--border); border-radius: 12px; overflow: hidden; }
.pot-lots li { display: flex; justify-content: space-between; gap: 12px; padding: 9px 12px; font-variant-numeric: tabular-nums; }
.pot-lots li + li { border-top: 1px solid var(--border); }
.pot-lots span { color: var(--text-muted); font-size: 12.5px; }
.pot-empty { display: flex; flex-direction: column; align-items: center; gap: 10px; padding: 14px; text-align: center; color: var(--text-muted); border: 1px dashed var(--border-strong); border-radius: 12px; }
.pot-rule { display: flex; gap: 8px; align-items: flex-start; font-size: 12.5px; color: var(--text-muted); }
.pot-rule svg { flex: none; margin-top: 2px; }
.gift-form { display: flex; flex-direction: column; }
.gift-form .check { align-items: flex-start; font-size: 13.5px; line-height: 1.45; }
.gift-form .check input { flex: none; margin-top: 1px; }
.gift-form .pot-rule { display: block; margin: 10px 0 0; text-align: center; }
.gift-form .label { display: block; margin-bottom: 8px; }
.gift-picks { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 10px; }
.gift-pick { cursor: pointer; font: inherit; font-weight: 650; min-width: 44px; justify-content: center; }
.gift-pick:disabled { opacity: 0.45; cursor: not-allowed; }
.gift-amount { display: flex; align-items: center; gap: 10px; margin-bottom: 12px; }
.gift-amount .input { width: 100px; }

.reader-invite { display: flex; align-items: center; gap: 18px; padding: 22px 24px; margin-top: 32px; flex-wrap: wrap; }
.reader-invite > div:not(.reader-invite-icon) { flex: 1; min-width: 220px; }
.reader-invite h2 { font-size: 17px; }
.reader-invite p { margin: 4px 0 0; }
.reader-invite-icon { display: grid; place-items: center; width: 48px; height: 48px; border-radius: 14px; background: var(--accent-soft); color: var(--accent-text); }
.reader-streamer-hint { margin-top: 28px; display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.reader-disclaimer { margin: 0 4px; }
.sidebar-guest p { margin: 0 2px 4px; }

/* Costs: spend filters and pagination (ADR-0018) */

.costs-section { margin-bottom: 22px; }
.spend-filters { display: flex; flex-direction: column; gap: 12px; padding: 16px 20px 4px; }
.spend-filters .filter-row { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; }
.filter-grid { display: grid !important; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); align-items: end; }
.filter { display: flex; flex-direction: column; gap: 5px; min-width: 0; }
.filter .input { width: 100%; text-overflow: ellipsis; }
.filter .input:disabled { opacity: 0.55; cursor: not-allowed; }
.filter-search { position: relative; flex: 1; min-width: 220px; color: var(--text-faint); }
.filter-search svg { position: absolute; left: 11px; top: 50%; transform: translateY(-50%); pointer-events: none; }
.filter-search .input { padding-left: 34px; }
.seg { display: inline-flex; gap: 2px; margin: 0; padding: 3px; border: 1px solid var(--border); border-radius: 11px; background: var(--bg-sunken); }
.seg-item {
  display: inline-flex; align-items: center; gap: 6px; height: 26px; padding: 0 10px; border-radius: 8px;
  color: var(--text-muted); font-size: 13px; font-weight: 600; cursor: pointer; white-space: nowrap;
  transition: background var(--transition), color var(--transition);
}
.seg-item input { position: absolute; opacity: 0; pointer-events: none; }
.seg-item:hover { color: var(--text); }
.seg-item:has(input:checked) { background: var(--bg-elevated); color: var(--text); box-shadow: var(--shadow-sm); }
.seg-item:has(input:focus-visible) { box-shadow: var(--ring); }
.seg-item:has(input:checked) svg { color: var(--accent-text); }
.filter-chips { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; padding: 8px 20px 4px; }
.filter-chips .chip { text-decoration: none; }
.filter-chips .chip svg:last-child { opacity: 0.7; }
.filter-clear { font-size: 13px; font-weight: 600; margin-left: 4px; }
.spend-table { margin-top: 12px; }
.spend-table .num { text-align: right; font-variant-numeric: tabular-nums; }
.spend-table td a { color: inherit; }
.spend-table td a:hover { color: var(--accent-text); }
.spend-table .chip { text-decoration: none; }
.spend-detail { display: flex; gap: 8px; align-items: baseline; flex-wrap: wrap; }
.spend-raw { font-size: 12px; margin-top: 2px; overflow-wrap: anywhere; }
@media (max-width: 640px) { .filter-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 760px) {
  .spend-table td { align-items: baseline; }
  .spend-table td > * { text-align: right; }
  .spend-detail { justify-content: flex-end; }
}

.pager {
  display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap;
  padding: 12px 20px; border-top: 1px solid var(--border); background: var(--bg-sunken);
  border-radius: 0 0 var(--radius-lg) var(--radius-lg);
}
.pager-summary { color: var(--text-muted); font-size: 13px; font-variant-numeric: tabular-nums; }
.pager-links { display: flex; gap: 4px; align-items: center; flex-wrap: wrap; }
.pager-link {
  display: inline-grid; place-items: center; min-width: 32px; height: 32px; padding: 0 8px; border-radius: 9px;
  border: 1px solid var(--border); background: var(--bg-elevated); color: var(--text-muted);
  font-size: 13px; font-weight: 600; font-variant-numeric: tabular-nums;
  transition: background var(--transition), color var(--transition), border-color var(--transition);
}
a.pager-link:hover { color: var(--text); border-color: var(--border-strong); text-decoration: none; }
.pager-link.is-current { background: var(--accent-soft); color: var(--accent-text); border-color: transparent; }
.pager-link.is-disabled { opacity: 0.4; }
.pager-gap { padding: 0 4px; color: var(--text-faint); }
.spend-table thead th { border-radius: 0 !important; border-top: 1px solid var(--border); }

/* Admin: accounts list, searched, filtered and paged; one "Gérer" window per account */

.users-filters .filter-row { flex-wrap: wrap; }
.users-filter-select { flex: 0 0 200px; }
.seg-scroll { position: relative; max-width: 100%; overflow-x: auto; scrollbar-width: none; }
.seg-scroll::-webkit-scrollbar { display: none; }
.users-scroll { margin-top: 12px; overflow-x: auto; }
.users-table thead th { border-radius: 0 !important; border-top: 1px solid var(--border); }
.users-table .cell-account { min-width: 220px; }
.users-table .user-actions { flex-wrap: nowrap; }
.user-id { min-width: 0; }
.user-id .name { overflow-wrap: anywhere; }
.user-login { overflow-wrap: anywhere; }
.chip-xs { height: 22px; padding: 0 7px; font-size: 11.5px; vertical-align: 1px; }
.users-foot {
  padding: 12px 20px; border-top: 1px solid var(--border); background: var(--bg-sunken);
  border-radius: 0 0 var(--radius-lg) var(--radius-lg); color: var(--text-muted); font-size: 13px;
}
@media (max-width: 760px) {
  .users-filter-select { flex: 1 1 100%; }
  .users-scroll { overflow: visible; }
  .users-table, .users-table tbody { display: block; }
  .users-table thead { display: none; }
  /* A card per account: who, status and plan, three short facts, then the buttons. */
  .users-table tr {
    display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 12px 14px;
    padding: 16px; border-bottom: 1px solid var(--border);
  }
  .users-table tr:last-child { border-bottom: 0; }
  .users-table td, .users-table td.num { display: block; min-width: 0; padding: 0; border: 0; text-align: left; }
  .users-table td[data-label]::before { content: attr(data-label); display: block; margin-bottom: 3px; color: var(--text-faint); font-size: 12px; }
  .users-table td { grid-column: span 2; }
  .users-table .cell-status, .users-table .cell-plan { grid-column: span 3; }
  .users-table .cell-account { grid-column: 1 / -1; min-width: 0; }
  .users-table .cell-actions { grid-column: 1 / -1; white-space: normal; }
  .users-table .user-actions > * { flex: 1 1 0; }
  .users-table .user-actions form .btn { width: 100%; }
}

dialog.manage { width: min(560px, calc(100vw - 32px)); max-height: calc(100dvh - 48px); overflow-y: auto; }
.manage .modal-head .user-row { min-width: 0; }
.manage .modal-head h2 { font-size: 19px; overflow-wrap: anywhere; }
.manage .modal-head p { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 10px; margin-top: 4px; }
.manage-body { padding-top: 12px; }
.manage-facts {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(88px, 1fr)); gap: 10px 14px;
  margin: 0 0 4px; padding: 12px 14px; border-radius: 12px; background: var(--bg-sunken);
}
.manage-facts dt { color: var(--text-faint); font-size: 12px; }
.manage-facts dd { margin: 2px 0 0; font-weight: 600; overflow-wrap: anywhere; }
.manage-part { padding: 16px 0 0; margin-top: 16px; border-top: 1px solid var(--border); }
.manage-part h3 { display: flex; align-items: center; gap: 8px; margin: 0 0 10px; font-size: 15px; }
.manage-part h3 svg { color: var(--text-faint); }
.manage-part > p { margin: 0 0 10px; }
.manage-part form { margin: 0; }
.manage-balance strong { font: 700 26px/1 var(--font-display); font-variant-numeric: tabular-nums; }
.manage-inline { display: flex; gap: 8px; }
.manage-inline .input { flex: 1 1 auto; min-width: 0; }
.manage-inline .btn { flex: none; }
.manage-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.manage-danger h3, .manage-danger h3 svg { color: var(--danger); }
@media (max-width: 640px) {
  dialog.manage { width: 100%; max-height: calc(100dvh - 24px); }
  .manage-actions > form { flex: 1 1 auto; }
  .manage-actions .btn, .manage-danger .btn { width: 100%; }
}

/* Discord (ADR-0019) */
.discord-grid { align-items: start; }
.discord-server { margin-bottom: 16px; }
.discord-server + .alert { margin-bottom: 16px; }
.discord-parts { border: 0; padding: 0; margin: 0 0 6px; display: grid; grid-template-columns: 1fr 1fr; gap: 4px 16px; }
.discord-parts legend { grid-column: 1 / -1; margin-bottom: 8px; }
.discord-parts-group .check { margin: 6px 0; }
.discord-parts-group > .small { margin-bottom: 4px; }
.discord-color { padding: 4px; width: 100%; cursor: pointer; }
.discord-test { display: flex; flex-direction: column; align-items: flex-start; gap: 4px; margin-bottom: 16px; }
.discord-test .field { width: 100%; margin: 0; }
.discord-posts { list-style: none; margin: 0; padding: 0; }
.discord-posts li { display: flex; align-items: flex-start; gap: 12px; padding: 12px 20px; border-top: 1px solid var(--border); }
.discord-posts li:first-child { border-top: 0; }
.discord-posts .status { flex: none; margin-top: 1px; }
.discord-post-text { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.discord-posts .danger { color: var(--danger); }
@media (max-width: 700px) { .discord-parts { grid-template-columns: 1fr; } }

/* The preview mimics Discord's dark theme, whatever the platform's theme. */
.dc-preview { background: #313338; color: #dbdee1; border-radius: 10px; padding: 14px 14px 16px 10px;
  font-size: 14.5px; line-height: 1.38; overflow: hidden; }
.dc-message { display: flex; gap: 12px; }
.dc-avatar { flex: none; width: 40px; height: 40px; border-radius: 50%; background: #FFD43B; color: #0B0B10;
  display: grid; place-items: center; font-weight: 800; font-size: 13px; letter-spacing: -0.04em; }
.dc-body { flex: 1; min-width: 0; }
.dc-head { display: flex; align-items: center; gap: 6px; margin-bottom: 2px; }
.dc-name { color: #f2f3f5; font-weight: 600; }
.dc-bot { background: #5865f2; color: #fff; font-size: 10px; font-weight: 600; padding: 1px 5px; border-radius: 4px; text-transform: uppercase; }
.dc-time { color: #949ba4; font-size: 12px; }
.dc-content { margin-bottom: 6px; overflow-wrap: anywhere; }
.dc-content p, .dc-description p { margin: 0 0 6px; }
.dc-mention { background: rgba(88, 101, 242, 0.3); color: #c9cdfb; border-radius: 3px; padding: 0 2px; font-weight: 500; }
.dc-embed { background: #2b2d31; border-left: 4px solid var(--dc-color, #FFD43B); border-radius: 4px; padding: 10px 14px 12px 12px;
  margin-top: 6px; max-width: 520px; font-size: 14px; overflow-wrap: anywhere; }
.dc-author { color: #f2f3f5; font-size: 13px; font-weight: 600; margin-bottom: 4px; }
.dc-title { display: block; color: #00a8fc; font-weight: 600; font-size: 15px; margin-bottom: 6px; }
.dc-description a, .dc-content a { color: #00a8fc; }
.dc-description ul, .dc-description ol { margin: 0 0 6px; padding-left: 20px; }
.dc-description strong { color: #f2f3f5; }
.dc-footer { color: #949ba4; font-size: 12px; margin-top: 8px; }

/* Costs: profitability per account (ADR-0021) */
.margin-summary { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; padding: 16px 20px 4px; }
.margin-summary > div { padding: 12px 14px; border: 1px solid var(--border); border-radius: var(--radius); background: var(--bg-sunken); min-width: 0; }
.margin-num { font-size: 20px; font-weight: 700; font-variant-numeric: tabular-nums; }
.margin-label { font-size: 13px; font-weight: 600; color: var(--text-muted); margin-top: 2px; }
.margin-sub { font-size: 12px; color: var(--text-faint); margin-top: 2px; }
.is-gain { color: var(--success); }
.is-loss { color: var(--danger); }
.margin-other td { background: var(--bg-sunken); }
.margin-note { margin: 0; padding: 10px 20px 16px; }
@media (max-width: 900px) { .margin-summary { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 760px) { .margin-table td > div { text-align: right; } }

/* Shorts of a VOD (ADR-0030): a grid of vertical videos, each with its text to post. */

.shorts-bar { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px 16px; margin-bottom: 14px; }
.shorts-bar .small { display: flex; align-items: center; gap: 6px; margin: 0; }
.moments-filters { display: flex; flex-wrap: wrap; gap: 8px; }
.moments-filters .chip { cursor: pointer; font: inherit; font-size: 13px; font-weight: 600; height: 32px; padding: 0 12px; }
.short-grid { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 16px; align-items: start; }
.short { overflow: hidden; scroll-margin-top: calc(var(--topbar-h) + 16px); }
.short-video { position: relative; aspect-ratio: 9 / 16; background: var(--brand-ink); }
.short-player { display: block; width: 100%; height: 100%; object-fit: contain; background: var(--brand-ink); }
.short-download { position: absolute; top: 10px; right: 10px; }
.short-placeholder {
  position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 10px; padding: 20px; text-align: center; color: #c9c8d3; background: var(--brand-ink);
}
.short-placeholder p { margin: 0; font-size: 14px; max-width: 26ch; }
.short-error { color: #ffb3bb; }
.short-body { padding: 14px 16px 16px; display: flex; flex-direction: column; gap: 10px; }
.short-title { margin: 0; font-size: 16px; line-height: 1.3; }
.moment-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 10px; font-size: 13px; }
.chip-tag-drole { color: var(--accent-text); background: var(--accent-soft); border-color: transparent; }
.chip-tag-action { color: var(--danger); background: var(--danger-soft); border-color: transparent; }
.chip-tag-histoire { color: var(--info); background: var(--info-soft); border-color: transparent; }
.short-post { display: flex; flex-direction: column; align-items: flex-start; gap: 8px; padding: 10px 12px; border-radius: var(--radius); background: var(--bg-sunken); }
.short-post p { margin: 0; font-size: 14px; line-height: 1.5; overflow-wrap: anywhere; }
.moment-why { margin: 0; }
.short-draft { margin: 0; display: flex; align-items: center; gap: 6px; }
.short-actions { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px; }
.short-actions form { margin: 0; }
.moments-admin { margin-top: 16px; }

/* The trial: the best short of each VOD, watermarked, until a subscription. */
.trial-band { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px 20px; padding: 16px 20px; margin-bottom: 16px; border-left: 4px solid var(--accent); }
.trial-band-text { min-width: 0; flex: 1 1 320px; }
.trial-band h2 { margin: 0 0 4px; font-size: 16px; }
.trial-band p { margin: 0; color: var(--text-muted); font-size: 14px; }

/* The short editor (ADR-0031): the 9:16 preview beside its settings; the camera is a
   rectangle on the 16:9 passage, moved by its body and resized by its corners. */
.short-editor { display: grid; grid-template-columns: minmax(240px, 360px) minmax(0, 1fr); gap: 24px; align-items: start; }
.editor-stage { position: sticky; top: 76px; display: flex; flex-direction: column; gap: 10px; }
.editor-stage > p { margin: 0; }
.editor-preview { position: relative; aspect-ratio: 9 / 16; border-radius: var(--radius-lg); overflow: hidden; background: var(--brand-ink); }
.editor-preview canvas { display: block; width: 100%; height: 100%; }
.editor-preview-empty { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 10px; padding: 24px; text-align: center; color: #e8e8ee; }
.editor-preview-empty p { margin: 0; font-size: 14px; max-width: 28ch; }
.editor-transport { display: flex; align-items: center; gap: 10px; }
.editor-scrub { flex: 1; min-width: 0; accent-color: var(--accent-text); }
.editor-panel { display: flex; flex-direction: column; gap: 16px; min-width: 0; }
.editor-panel .card { margin: 0; }
.editor-fields { display: flex; flex-direction: column; gap: 12px; }
.editor-fields .field, .editor-row .field { margin: 0; }
.editor-fields .check { margin: 0; }
.editor-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 12px; align-items: end; }
.editor-fields input[type=range] { width: 100%; accent-color: var(--accent-text); }
.color-field { display: flex; align-items: center; gap: 8px; font-size: 14px; cursor: pointer; }
.color-field input { width: 40px; height: 32px; padding: 2px; border: 1px solid var(--border); border-radius: 6px; background: var(--bg-elevated); cursor: pointer; }
.editor-lines { display: flex; flex-direction: column; gap: 8px; padding-top: 4px; border-top: 1px solid var(--border); }
.editor-lines h3 { margin: 8px 0 0; font-size: 14px; }
.editor-lines > p { margin: 0; }
.editor-line { display: grid; grid-template-columns: 64px minmax(0, 1fr); gap: 8px; align-items: center; }
.editor-submit { display: flex; flex-direction: column; gap: 10px; padding-bottom: 8px; }
.editor-submit .check, .editor-submit p { margin: 0; }
.editor-buttons { display: flex; flex-wrap: wrap; gap: 10px; }
.framing-layouts { border: 0; margin: 0 0 14px; padding: 0; display: grid; gap: 8px; }
.framing-option { display: flex; gap: 12px; align-items: flex-start; padding: 12px; border: 1px solid var(--border); border-radius: var(--radius); cursor: pointer; }
.framing-option:has(input:checked) { border-color: var(--accent-line); background: var(--accent-soft); }
.framing-option input { margin-top: 3px; accent-color: var(--accent-text); }
.framing-option strong { display: block; font-size: 14px; }
.framing-option .small { display: block; margin-top: 2px; }
.framing-shape { flex: none; width: 27px; height: 48px; border-radius: 4px; border: 2px solid var(--text-muted); display: flex; flex-direction: column; overflow: hidden; }
.framing-shape i { display: block; }
.framing-shape-cam i:first-child { height: 33%; background: var(--accent); }
.framing-shape-cam i:last-child { flex: 1; background: var(--text-muted); }
.framing-shape-crop i:first-child { flex: 1; background: var(--text-muted); }
.framing-shape-blur { justify-content: center; background: var(--bg-sunken); }
.framing-shape-blur i:first-child { height: 30%; background: var(--text-muted); }
.cam-editor { display: flex; flex-direction: column; gap: 10px; }
.cam-editor[hidden] { display: none; }
.cam-editor p { margin: 0; }
.cam-stage { position: relative; width: 100%; aspect-ratio: 16 / 9; border-radius: var(--radius); overflow: hidden; background: var(--brand-ink); touch-action: none; user-select: none; }
.cam-stage video, .cam-stage-empty { display: block; width: 100%; height: 100%; object-fit: fill; pointer-events: none; }
.cam-box { position: absolute; border: 3px solid var(--brand-yellow); outline: 2px solid var(--brand-ink); border-radius: 4px; cursor: move; touch-action: none; }
.cam-box:focus-visible { box-shadow: var(--ring); }
.cam-handle { position: absolute; width: 22px; height: 22px; padding: 0; border: 2px solid var(--brand-ink); border-radius: 50%; background: var(--brand-yellow); touch-action: none; }
.cam-handle-nw { left: -12px; top: -12px; cursor: nwse-resize; }
.cam-handle-ne { right: -12px; top: -12px; cursor: nesw-resize; }
.cam-handle-sw { left: -12px; bottom: -12px; cursor: nesw-resize; }
.cam-handle-se { right: -12px; bottom: -12px; cursor: nwse-resize; }
@media (max-width: 960px) {
  .short-editor { grid-template-columns: 1fr; }
  .editor-stage { position: static; max-width: 340px; width: 100%; margin: 0 auto; }
}
@media (max-width: 760px) {
  .short-grid { grid-template-columns: repeat(auto-fill, minmax(min(100%, 240px), 1fr)); }
}

/* Phones and touch screens.
   Under 960px the side menu becomes a drawer and a tab bar holds the pages used most.
   On a touch screen, controls grow to a finger's size and fields use 16px text so
   that iOS does not zoom into them. */

.tabbar { display: none; }
@media (max-width: 960px) {
  body.has-tabbar { --bottom-ui: calc(var(--tabbar-h) + env(safe-area-inset-bottom, 0px)); }
  body.has-tabbar .topbar .topbar-menu { display: none; }
  body.has-tabbar .main { padding-bottom: var(--bottom-ui); }
  .tabbar {
    position: fixed; left: 0; right: 0; bottom: 0; z-index: 32;
    display: grid; grid-auto-flow: column; grid-auto-columns: minmax(0, 1fr);
    height: var(--bottom-ui); padding: 0 4px env(safe-area-inset-bottom, 0px);
    background: var(--bg-elevated); border-top: 1px solid var(--border);
  }
  .tab-item {
    display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px; min-width: 0;
    padding: 0; border: 0; background: none; cursor: pointer; -webkit-tap-highlight-color: transparent;
    color: var(--text-muted); font: 600 11.5px/1.15 var(--font-sans); white-space: nowrap;
  }
  .tab-item:hover { text-decoration: none; color: var(--text); }
  .tab-ico {
    position: relative; display: grid; place-items: center; width: 52px; height: 30px; border-radius: 999px;
    transition: background var(--transition), color var(--transition);
  }
  .tab-item[aria-current="page"], .tab-item.is-current { color: var(--text); }
  .tab-item[aria-current="page"] .tab-ico, .tab-item.is-current .tab-ico { background: var(--accent-soft); color: var(--accent-text); }
  .tab-item:active .tab-ico { background: var(--bg-hover); }
  .tab-badge { position: absolute; top: -3px; left: 30px; display: inline-flex; }
  .tab-badge .nav-badge { margin: 0; min-width: 18px; height: 18px; padding: 0 5px; font-size: 10.5px; box-shadow: 0 0 0 2px var(--bg-elevated); }

  .toasts { left: 16px; right: 16px; bottom: calc(var(--bottom-ui) + 12px); max-width: none; }
  .footer .legal-links { gap: 2px 6px; }
  .footer .legal-links a { padding: 6px 4px; }
}

@media (max-width: 640px) {
  /* Stat tiles: icon above the figure, so the labels keep the width of the tile. */
  .stats { gap: 10px; margin-bottom: 20px; }
  .stat { flex-direction: column; align-items: flex-start; gap: 10px; padding: 14px; }
  .stat-icon { width: 34px; height: 34px; border-radius: 10px; }
  .stat-num { font-size: 22px; }

  /* Header and hero buttons share the width instead of stacking at random lengths. */
  .page-head .actions, .hero-actions { width: 100%; }
  .page-head .actions > .btn, .hero-actions > .btn, .hero-actions > form { flex: 1 1 auto; }
  .hero-actions > form .btn { width: 100%; }
  .hero .avatar-lg + div, .hero-inner > div { min-width: 0; }

  /* Tables turned into cards: the row's title comes first, without its label. */
  .table-cards tr { display: flex; flex-direction: column; }
  .table-cards .cell-title { order: -1; padding-bottom: 6px; }
  .table-cards .cell-title[data-label]::before { display: none; }

  /* Twitch VOD picker: compact rows, the thumbnail beside the title. */
  .picker { grid-template-columns: minmax(0, 1fr); gap: 10px; }
  .pick-card { display: grid; grid-template-columns: 128px minmax(0, 1fr); align-items: center; }
  .pick .vod-thumb { height: 100%; aspect-ratio: auto; min-height: 72px; }
  .pick-body { padding: 10px 12px; }
  .pick-check { top: 8px; left: 8px; width: 24px; height: 24px; border-radius: 8px; }
  .pick-badge { position: static; grid-column: 1 / -1; padding: 0 12px 10px; }
  .pick-badge .chip { background: var(--bg-sunken); color: var(--text-muted); }
  .pick:hover .pick-card { transform: none; }

  /* Bottom sheets: dialogs rise from the bottom, within reach of the thumb. */
  dialog.modal {
    width: 100%; max-width: 100%; max-height: calc(100dvh - 24px); margin: auto 0 0; overflow-y: auto;
    border-width: 1px 0 0; border-radius: var(--radius-xl) var(--radius-xl) 0 0;
  }
  dialog.modal[open] { animation: sheet-in 300ms var(--ease) both; }
  .modal-head { padding: 20px 18px 4px; }
  .modal-body { padding: 14px 18px 18px; }
  .confirm-body { padding: 22px 18px 18px; }
  .launch-body { padding: 22px 18px 18px; }
  .launch-cost strong { font-size: 44px; }
  .modal-actions {
    flex-wrap: nowrap; padding: 12px 16px calc(12px + env(safe-area-inset-bottom, 0px)); border-radius: 0;
  }
  .modal-actions > .btn, .modal-actions > form { flex: 1 1 0; min-width: 0; }
  .modal-actions > form .btn { width: 100%; }

  /* Quick search: a sheet under the top of the screen. */
  dialog.palette { width: calc(100vw - 16px); max-width: none; margin-top: 8px; max-height: calc(100dvh - 16px); }

  /* Explorer search: the button goes under the field. */
  .explorer-hero { padding: 24px 18px 20px; }
  .explorer-search { flex-wrap: wrap; padding: 4px 6px 6px 14px; }
  .explorer-search .input { flex: 1 1 0; }
  .explorer-search .btn { flex: 1 1 100%; }

  /* The tabs scroll sideways: a fade on the edge shows there are more. */
  .tabs { scroll-snap-type: x proximity; scroll-padding-inline: 8px; }
  .tabs .tab { scroll-snap-align: start; }
  .tabs[data-more] { mask-image: linear-gradient(to right, #000 calc(100% - 40px), transparent); }

  .card-head { padding: 16px 16px 0; }
  .card-body { padding: 14px 16px 18px; }
  .card-foot { padding: 12px 16px; }
  .reader-recap { padding: 20px 18px; }
  .prose { font-size: 16px; }
}

/* Touch screens: controls a finger can hit, fields iOS does not zoom into. */
@media (pointer: coarse) {
  .btn { height: 42px; }
  .btn-sm { height: 36px; }
  .btn-lg { height: 50px; }
  .icon-btn { width: 40px; height: 40px; }
  .input, select.input { height: 44px; font-size: 16px; }
  .input-sm { height: 38px; font-size: 16px; }
  textarea.input, .search-input .input { font-size: 16px; }
  a.chip { height: 30px; padding: 0 11px; }
  .nav a { height: 44px; }
  .menu-panel button, .menu-panel a { padding: 11px 12px; font-size: 14.5px; }
  .tab { height: 46px; }
  .pager-link { min-width: 40px; height: 40px; }
  .seg-item { height: 34px; }
  .check input, .switch input { width: 20px; height: 20px; }
  /* Keyboard hints mean nothing without a keyboard. */
  .search-trigger kbd, .palette-search kbd, .palette-foot { display: none; }
  .palette-close { display: inline-grid; }
}

@keyframes sheet-in { from { transform: translateY(100%); } to { transform: none; } }
