:root,
:root[data-theme="dark"] {
  color-scheme: dark;
  --font-sans: "Inter", "Segoe UI", "PingFang SC", "Microsoft YaHei UI", "Noto Sans SC", system-ui, sans-serif;
  --font-mono: "JetBrains Mono", "Cascadia Code", "Fira Code", Consolas, monospace;

  --bg: #070b14;
  --bg-glow-a: rgba(56, 189, 248, 0.14);
  --bg-glow-b: rgba(129, 140, 248, 0.12);
  --surface: #0d1322;
  --surface-2: #121a2e;
  --surface-3: #18223a;
  --surface-glass: rgba(13, 19, 34, 0.86);
  --ink: #f1f5f9;
  --ink-2: #cbd5e1;
  --muted: #94a3b8;
  --muted-2: #64748b;

  --border: rgba(148, 163, 184, 0.14);
  --border-strong: rgba(148, 163, 184, 0.24);
  --border-glow: rgba(56, 189, 248, 0.34);
  --inner-shine: inset 0 1px 0 rgba(255, 255, 255, 0.05);

  --accent: #6366f1;
  --accent-bright: #818cf8;
  --accent-soft: rgba(129, 140, 248, 0.16);
  --emerald: #10b981;
  --emerald-bright: #10b981;
  --emerald-soft: rgba(16, 185, 129, 0.15);
  --cyan: #38bdf8;
  --cyan-soft: rgba(56, 189, 248, 0.15);
  --amber: #f59e0b;
  --amber-bright: #f59e0b;
  --amber-soft: rgba(245, 158, 11, 0.16);
  --rose: #f43f5e;
  --rose-bright: #f43f5e;
  --rose-soft: rgba(244, 63, 94, 0.15);
  --brand-grad: linear-gradient(135deg, #38bdf8 0%, #6366f1 100%);

  --hero-bg: linear-gradient(135deg, #0d2b36 0%, #111c3a 48%, #1d1b4b 100%);
  --hero-border: rgba(56, 189, 248, 0.34);
  --hero-ink: #f8fafc;
  --hero-muted: rgba(226, 232, 240, 0.84);

  --shadow-card: 0 1px 2px rgba(0, 0, 0, 0.35), 0 12px 32px rgba(0, 0, 0, 0.24);
  --shadow-float: 0 20px 55px rgba(0, 0, 0, 0.60);
  --grid-stroke: rgba(148, 163, 184, 0.14);
  --chart-text: #94a3b8;
  --table-head: rgba(255, 255, 255, 0.03);
  --table-hover: rgba(56, 189, 248, 0.07);
  --input-bg: #080d18;
  --focus-ring: rgba(56, 189, 248, 0.55);
}

:root[data-theme="light"] {
  color-scheme: light;
  --bg: #f6f8fb;
  --bg-glow-a: rgba(37, 99, 235, 0.07);
  --bg-glow-b: rgba(2, 132, 199, 0.06);
  --surface: #ffffff;
  --surface-2: #f8fafc;
  --surface-3: #f1f5f9;
  --surface-glass: rgba(255, 255, 255, 0.90);
  --ink: #0f172a;
  --ink-2: #334155;
  --muted: #475569;
  --muted-2: #64748b;

  --border: #e2e8f0;
  --border-strong: #cbd5e1;
  --border-glow: rgba(37, 99, 235, 0.32);
  --inner-shine: inset 0 1px 0 rgba(255, 255, 255, 0.95);

  --accent: #2563eb;
  --accent-bright: #2563eb;
  --accent-soft: #eff6ff;
  --emerald: #059669;
  --emerald-bright: #059669;
  --emerald-soft: #ecfdf5;
  --cyan: #0284c7;
  --cyan-soft: #e0f2fe;
  --amber: #d97706;
  --amber-bright: #d97706;
  --amber-soft: #fffbeb;
  --rose: #e11d48;
  --rose-bright: #e11d48;
  --rose-soft: #fff1f2;
  --brand-grad: linear-gradient(135deg, #0284c7 0%, #2563eb 100%);

  --hero-bg: linear-gradient(135deg, #0f3a4a 0%, #173668 52%, #1e40af 100%);
  --hero-border: rgba(37, 99, 235, 0.35);
  --hero-ink: #ffffff;
  --hero-muted: rgba(239, 246, 255, 0.88);

  --shadow-card: 0 1px 2px rgba(15, 23, 42, 0.04), 0 8px 24px rgba(15, 23, 42, 0.04);
  --shadow-float: 0 20px 60px rgba(15, 23, 42, 0.16);
  --grid-stroke: #e2e8f0;
  --chart-text: #475569;
  --table-head: #f8fafc;
  --table-hover: #f1f5f9;
  --input-bg: #ffffff;
  --focus-ring: rgba(37, 99, 235, 0.45);
}

*, ::before, ::after { box-sizing: border-box; }
html { font-size: 14px; }
body {
  min-width: 320px;
  margin: 0;
  font-family: var(--font-sans);
  color: var(--ink);
  background-color: var(--bg);
  background-image:
    radial-gradient(900px circle at 12% -8%, var(--bg-glow-a), transparent 55%),
    radial-gradient(700px circle at 88% 0%, var(--bg-glow-b), transparent 50%);
  background-attachment: fixed;
  -webkit-font-smoothing: antialiased;
  overflow-x: clip;
}
button, input, select, textarea { font: inherit; color: inherit; }
button, a, input, select, textarea { -webkit-tap-highlight-color: transparent; }
a { color: var(--accent-bright); text-decoration: none; }
button { cursor: pointer; }
button:disabled { cursor: not-allowed; opacity: 0.48; }
:focus-visible { outline: 2px solid var(--focus-ring); outline-offset: 2px; }
h1, h2, h3, p, dl, dd, pre { margin: 0; }
code, pre { font-family: var(--font-mono); }
[hidden] { display: none !important; }
.muted { color: var(--muted); }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
.positive { color: var(--emerald-bright); }
.debit { color: var(--rose-bright); }
.held { color: var(--amber-bright); }
.tabular { font-variant-numeric: tabular-nums; }

.money { font-variant-numeric: tabular-nums; white-space: nowrap; }
.money-cur { opacity: 0.78; margin-right: 1px; font-weight: 600; }
.money-frac { opacity: 0.65; font-size: 0.88em; font-weight: 550; letter-spacing: -0.01em; }

.initial { min-height: 100vh; display: grid; place-items: center; padding: 36px; color: var(--muted); }
.initial-loader { display: inline-flex; align-items: center; gap: 10px; padding: 12px 18px; border-radius: 999px; border: 1px solid var(--border); background: var(--surface); box-shadow: var(--shadow-card); }
.pulse-dot { width: 9px; height: 9px; border-radius: 50%; background: var(--emerald-bright); box-shadow: 0 0 0 4px var(--emerald-soft); }

/* Layout Shell */
.layout { min-height: 100vh; display: grid; grid-template-columns: 236px minmax(0, 1fr); }
.sidebar {
  background: var(--surface-glass);
  backdrop-filter: blur(16px);
  border-right: 1px solid var(--border);
  padding: 20px 14px 16px;
  height: 100vh;
  position: sticky;
  top: 0;
  display: flex;
  flex-direction: column;
  z-index: 10;
}
.brand { display: flex; align-items: center; gap: 11px; padding: 4px 8px; }
.brand img { border-radius: 10px; box-shadow: 0 4px 14px rgba(99, 102, 241, 0.25); flex-shrink: 0; }
.brand strong { display: block; font-size: 17px; font-weight: 750; line-height: 1.25; letter-spacing: 0.02em; }
.brand span { display: block; font-size: 11px; font-weight: 600; color: var(--muted); margin-top: 2px; }

.sidebar nav { display: grid; gap: 22px; margin-top: 28px; }
.nav-group { display: grid; gap: 4px; }
.nav-label { color: var(--muted-2); font-size: 11px; font-weight: 700; letter-spacing: 0.06em; text-transform: uppercase; padding: 0 12px 6px; }
.nav-item {
  min-height: 42px;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 12px;
  color: var(--ink-2);
  border-radius: 10px;
  border: 1px solid transparent;
  font-weight: 600;
  transition: background-color 0.16s ease, color 0.16s ease, border-color 0.16s ease;
}
.nav-item svg { flex: 0 0 18px; height: 18px; opacity: 0.85; }
.nav-short { display: none; }
.nav-item:hover { background: var(--surface-2); color: var(--ink); border-color: var(--border); }
.nav-item.active {
  background: var(--accent-soft);
  color: var(--accent-bright);
  border-color: var(--border-glow);
  box-shadow: var(--inner-shine);
}
.nav-item.active svg { opacity: 1; }

.sidebar-foot {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: auto;
  padding: 13px 8px 4px;
  border-top: 1px solid var(--border);
}
.avatar {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  flex-shrink: 0;
  border-radius: 10px;
  background: linear-gradient(135deg, var(--accent), var(--cyan));
  color: #ffffff;
  font-weight: 750;
  font-size: 13px;
}
.sidebar-foot > div { min-width: 0; flex: 1; }
.sidebar-foot strong, .sidebar-foot div span { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sidebar-foot strong { font-size: 12.5px; font-weight: 700; }
.sidebar-foot div span { font-size: 11px; margin-top: 2px; color: var(--muted); }

.workspace { min-width: 0; display: flex; flex-direction: column; }
.topbar {
  height: 62px;
  background: var(--surface-glass);
  backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 28px;
  position: sticky;
  top: 0;
  z-index: 9;
}
.top-context, .top-actions { display: flex; align-items: center; gap: 9px; }
.top-context span { color: var(--muted); font-weight: 500; font-size: 12.5px; }
.top-context svg { width: 14px; height: 14px; color: var(--muted-2); }
.top-context strong { font-size: 13.5px; font-weight: 700; }

.environment {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  color: var(--emerald-bright);
  background: var(--emerald-soft);
  border: 1px solid rgba(16, 185, 129, 0.28);
  border-radius: 999px;
  font-size: 11.5px;
  font-weight: 700;
  padding: 5px 11px;
  white-space: nowrap;
}
.environment i { width: 7px; height: 7px; border-radius: 50%; background: var(--emerald-bright); box-shadow: 0 0 8px var(--emerald); }
.environment.offline { color: var(--amber-bright); background: var(--amber-soft); border-color: rgba(245, 158, 11, 0.3); }
.environment.offline i { background: var(--amber-bright); box-shadow: none; }

.theme-toggle {
  min-height: 32px;
  padding: 5px 10px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--surface-2);
  color: var(--ink-2);
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  font-weight: 600;
  white-space: nowrap;
  transition: border-color 0.16s ease, background-color 0.16s ease;
}
.theme-toggle:hover { border-color: var(--border-strong); background: var(--surface-3); color: var(--ink); }
.theme-toggle svg { width: 14px; height: 14px; }
.compact-logout { display: none !important; }

.content { width: min(100%, 1520px); margin: 0 auto; padding: 24px 28px 42px; }
.page-heading { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; margin-bottom: 20px; flex-wrap: wrap; }
.page-heading h1 { font-size: 28px; font-weight: 780; letter-spacing: -0.02em; line-height: 1.2; }
.page-heading p { color: var(--muted); margin-top: 6px; line-height: 1.55; font-size: 13px; }
.heading-actions { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }

/* Cards */
.card {
  border: 1px solid var(--border);
  background: var(--surface);
  border-radius: 16px;
  box-shadow: var(--shadow-card), var(--inner-shine);
  min-width: 0;
  transition: border-color 0.18s ease;
}
.card-padding { padding: 18px 20px; }

/* 4-Card KPI Grid */
.stat-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
  margin-bottom: 12px;
}
.stat {
  position: relative;
  min-height: 156px;
  padding: 16px 18px 15px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 10px;
  overflow: hidden;
}
.stat:hover { border-color: var(--border-strong); }
.stat-top { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.stat-label { display: flex; align-items: center; gap: 9px; color: var(--ink-2); font-size: 12.5px; font-weight: 680; }
.stat-val { font-size: clamp(22px, 2.1vw, 31px); letter-spacing: -0.035em; font-variant-numeric: tabular-nums; font-weight: 760; line-height: 1.12; overflow-wrap: anywhere; }
.stat-foot { display: flex; align-items: center; justify-content: space-between; gap: 8px; font-size: 11.5px; color: var(--muted); line-height: 1.45; flex-wrap: wrap; }
.stat-foot b { color: var(--ink); font-weight: 680; }
.stat-pill { font-size: 10.5px; font-weight: 700; padding: 2px 7px; border-radius: 999px; background: var(--surface-3); color: var(--muted); border: 1px solid var(--border); white-space: nowrap; }
.stat-pill.good { color: var(--emerald-bright); background: var(--emerald-soft); border-color: rgba(16, 185, 129, 0.28); }
.stat-pill.warn { color: var(--amber-bright); background: var(--amber-soft); border-color: rgba(245, 158, 11, 0.28); }

.primary-stat {
  color: var(--hero-ink);
  background: var(--hero-bg);
  border-color: var(--hero-border);
}
.primary-stat::before {
  content: "";
  position: absolute;
  inset: -40px -60px auto auto;
  width: 210px;
  height: 210px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(52, 211, 153, 0.24) 0%, rgba(99, 102, 241, 0.08) 55%, transparent 72%);
  pointer-events: none;
}
.primary-stat::after {
  content: "";
  position: absolute;
  width: 190px;
  height: 190px;
  border: 1px solid rgba(255, 255, 255, 0.14);
  top: -54px;
  right: -72px;
  pointer-events: none;
  border-radius: 50%;
  box-shadow: 0 0 0 24px rgba(255, 255, 255, 0.03), 0 0 0 50px rgba(255, 255, 255, 0.02);
}
.primary-stat > * { position: relative; z-index: 1; }
.primary-stat .stat-label { color: var(--hero-muted); }
.primary-stat .stat-val { font-size: clamp(28px, 3vw, 40px); color: #ffffff; }
.primary-stat .stat-foot { color: var(--hero-muted); }
.primary-stat .stat-foot b { color: #ffffff; }
.primary-stat .stat-label > span.hero-icon {
  display: grid;
  place-items: center;
  width: 30px;
  height: 30px;
  background: rgba(255, 255, 255, 0.14);
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: 9px;
  color: #34d399;
}
.primary-stat .stat-label > span.hero-icon svg { width: 17px; height: 17px; }

.health-meter { display: grid; gap: 5px; }
.health-meter-track { width: 100%; height: 6px; border-radius: 999px; background: rgba(255, 255, 255, 0.16); overflow: hidden; display: block; }
.health-meter-svg { display: block; width: 100%; height: 6px; }
.health-meter-labels { display: flex; justify-content: space-between; font-size: 11px; color: var(--hero-muted); }

.tile-icon { width: 32px; height: 32px; display: inline-grid; flex-shrink: 0; place-items: center; border-radius: 9px; color: var(--accent-bright); background: var(--accent-soft); }
.tile-icon svg { width: 17px; height: 17px; }
.tile-icon.amber { color: var(--amber-bright); background: var(--amber-soft); }
.tile-icon.mint { color: var(--emerald-bright); background: var(--emerald-soft); }
.tile-icon.cyan { color: var(--cyan); background: var(--cyan-soft); }
.tile-icon.slate { color: var(--ink-2); background: var(--surface-3); }

/* Ledger Identity Verification Bar */
.wallet-equation {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 14px;
  padding: 10px 14px;
  margin-bottom: 16px;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: var(--surface);
  font-size: 12px;
  color: var(--muted);
}
.eq-formula { display: flex; flex-wrap: wrap; align-items: center; gap: 5px 8px; }
.eq-term { display: inline-flex; align-items: center; gap: 4px; padding: 3px 8px; border-radius: 7px; background: var(--surface-2); border: 1px solid var(--border); }
.eq-term b { color: var(--ink); font-variant-numeric: tabular-nums; }
.eq-op { color: var(--muted-2); font-weight: 700; }
.eq-verified {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 9px;
  border-radius: 999px;
  background: var(--emerald-soft);
  color: var(--emerald-bright);
  border: 1px solid rgba(16, 185, 129, 0.28);
  font-size: 11px;
  font-weight: 700;
}
.eq-verified svg { width: 13px; height: 13px; }
.sample-note { margin-left: auto; font-size: 11px; color: var(--muted); padding: 2px 8px; border-radius: 999px; background: var(--surface-2); border: 1px solid var(--border); }

/* Middle Analytics Grid (7:5 asymmetric) */
.middle-grid { display: grid; grid-template-columns: minmax(0, 7fr) minmax(0, 5fr); gap: 16px; margin-bottom: 16px; align-items: stretch; }
.lower-grid { display: grid; grid-template-columns: minmax(0, 7fr) minmax(0, 5fr); gap: 16px; align-items: start; }
.overview-side { display: grid; gap: 16px; min-width: 0; }

.analytics, .rank-card, .debug-card, .record-card, .model-card, .key-card, .endpoint-card, .quickstart-card { padding: 18px 20px; }
.section-heading { display: flex; justify-content: space-between; align-items: flex-start; gap: 10px; margin-bottom: 14px; }
.section-heading h2 { font-size: 16px; font-weight: 740; line-height: 1.35; letter-spacing: -0.01em; }
.section-heading p { color: var(--muted); margin-top: 3px; font-size: 12px; line-height: 1.45; }

/* Interactive Chart */
.chart-controls { display: flex; gap: 6px; flex-wrap: wrap; }
.chart-controls select {
  min-height: 30px;
  width: auto;
  color: var(--ink-2);
  font-size: 12px;
  font-weight: 600;
  background: var(--surface-2);
  border-color: var(--border);
  padding: 4px 10px;
  border-radius: 8px;
}
.chart-summary-row {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  justify-content: space-between;
  gap: 10px 16px;
  padding: 2px 0 10px;
}
.chart-total small { display: block; color: var(--muted); font-size: 11px; margin-bottom: 3px; }
.chart-total strong { display: block; font-size: 26px; font-weight: 760; letter-spacing: -0.035em; font-variant-numeric: tabular-nums; line-height: 1.1; }
.chart-pills { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.metric-pill {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 4px 9px;
  border-radius: 999px;
  font-size: 11.5px;
  font-weight: 650;
  font-variant-numeric: tabular-nums;
  background: var(--surface-2);
  border: 1px solid var(--border);
  color: var(--ink-2);
}
.metric-pill.indigo { color: var(--accent-bright); background: var(--accent-soft); border-color: rgba(99, 102, 241, 0.25); }
.metric-pill.cyan { color: var(--cyan); background: var(--cyan-soft); border-color: rgba(34, 211, 238, 0.25); }
.metric-pill.emerald { color: var(--emerald-bright); background: var(--emerald-soft); border-color: rgba(16, 185, 129, 0.25); }

.chart-stage { position: relative; width: 100%; }
.chart { display: block; width: 100%; max-height: 205px; overflow: visible; touch-action: pan-y; user-select: none; }
.chart text { font-size: 11.5px; fill: var(--chart-text); font-family: inherit; font-weight: 550; font-variant-numeric: tabular-nums; }
.chart .grid-line { stroke: var(--grid-stroke); stroke-width: 1; stroke-dasharray: 4 4; }
.chart-line { fill: none; stroke-width: 2.6; stroke-linecap: round; stroke-linejoin: round; }
.chart-bar-in { fill: rgba(56, 189, 248, 0.42); }
.chart-bar-out { fill: rgba(129, 140, 248, 0.48); }
.chart-hit-area { fill: transparent; cursor: crosshair; }
.point-dot { fill: var(--surface); stroke: var(--emerald-bright); stroke-width: 2; transition: r 0.12s ease; }
.chart[data-metric="tokens"] .point-dot { stroke: var(--cyan); }
.point-halo, .point-guide { display: none; }
.chart-point[data-selected] .point-guide { display: inline; stroke: var(--cyan); stroke-width: 1.3; stroke-dasharray: 4 3; }
.chart-point[data-selected] .point-halo { display: inline; fill: rgba(56, 189, 248, 0.28); }
.chart-point[data-selected] .point-dot { fill: var(--cyan); stroke: #ffffff; stroke-width: 2; }

.chart-tooltip {
  position: absolute;
  top: 6px;
  left: 80px;
  z-index: 4;
  min-width: 178px;
  max-width: 235px;
  padding: 9px 11px;
  border-radius: 11px;
  background: var(--surface-glass);
  backdrop-filter: blur(14px);
  border: 1px solid var(--border-strong);
  box-shadow: var(--shadow-float);
  pointer-events: none;
  font-size: 11.5px;
  line-height: 1.45;
  transition: left 0.1s ease-out, opacity 0.12s ease;
}
.chart-tooltip-head { display: flex; justify-content: space-between; align-items: center; gap: 8px; color: var(--muted); font-size: 11px; margin-bottom: 3px; }
.chart-tooltip-val { font-size: 14px; font-weight: 760; color: var(--ink); font-variant-numeric: tabular-nums; }
.chart-tooltip-sub { margin-top: 3px; color: var(--muted); font-size: 11px; font-variant-numeric: tabular-nums; }

.chart-inspector {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 12px;
  align-items: center;
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1px solid var(--border);
}
.chart-date { display: flex; align-items: center; gap: 7px; white-space: nowrap; font-size: 12px; }
.chart-date select { width: auto; min-height: 30px; font-size: 12px; border-radius: 8px; padding: 4px 8px; }
.chart-reading {
  border-radius: 8px;
  padding: 5px 10px;
  background: var(--emerald-soft);
  border: 1px solid rgba(16, 185, 129, 0.22);
  font-size: 12px;
  color: var(--emerald-bright);
  font-weight: 650;
  font-variant-numeric: tabular-nums;
}
.chart-legend { margin-left: auto; display: flex; align-items: center; gap: 10px; font-size: 11px; color: var(--muted); }
.legend-dot { display: inline-flex; align-items: center; gap: 5px; }
.legend-dot i { width: 8px; height: 8px; border-radius: 3px; display: inline-block; }
.legend-dot.in i { background: var(--cyan); }
.legend-dot.out i { background: var(--accent-bright); }
.legend-dot.amt i { background: var(--emerald); }

/* Donut + Model Distribution */
.donut-layout { display: grid; grid-template-columns: 158px minmax(0, 1fr); gap: 16px; align-items: center; }
.donut-wrap { position: relative; width: 158px; height: 158px; margin: 0 auto; }
.donut-chart { display: block; width: 100%; height: 100%; transform: rotate(-90deg); }
.donut-track { fill: none; stroke: var(--surface-3); stroke-width: 18; }
.donut-seg { fill: none; stroke-width: 18; transition: stroke-width 0.16s ease, opacity 0.16s ease; cursor: pointer; }
.donut-seg.active { stroke-width: 22; }
.donut-center {
  position: absolute;
  inset: 22px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  pointer-events: none;
  padding: 4px;
}
.donut-center small { font-size: 10.5px; color: var(--muted); line-height: 1.2; max-width: 96px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.donut-center strong { font-size: 14px; font-weight: 760; font-variant-numeric: tabular-nums; margin-top: 3px; line-height: 1.15; }
.donut-center span { font-size: 10.5px; color: var(--accent-bright); font-weight: 680; margin-top: 2px; }

.rank-list { list-style: none; padding: 0; margin: 0; max-height: 215px; overflow: auto; display: grid; gap: 10px; }
.rank-list li {
  padding: 9px 11px;
  border-radius: 10px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  transition: border-color 0.14s ease, background-color 0.14s ease;
}
.rank-list li:hover, .rank-list li.active { border-color: var(--border-glow); background: var(--surface-3); }
.rank-row-head { display: flex; justify-content: space-between; align-items: center; gap: 8px; font-size: 12.5px; }
.rank-name { display: inline-flex; align-items: center; gap: 7px; min-width: 0; }
.rank-name strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.swatch { width: 9px; height: 9px; border-radius: 3px; flex-shrink: 0; }
.swatch-0 { background: #38bdf8; }
.swatch-1 { background: #818cf8; }
.swatch-2 { background: #10b981; }
.swatch-3 { background: #f59e0b; }
.rank-row-head b { font-variant-numeric: tabular-nums; margin-left: auto; font-size: 12.5px; }
.rank-meta { display: flex; justify-content: space-between; gap: 6px; margin-top: 4px; font-size: 11px; color: var(--muted); }
.rank-list progress { display: block; width: 100%; height: 5px; margin-top: 7px; border: 0; overflow: hidden; border-radius: 999px; appearance: none; background: var(--surface-3); }
.rank-list progress::-webkit-progress-bar { background: var(--surface-3); border-radius: 999px; }
.rank-list progress::-webkit-progress-value { background: linear-gradient(90deg, var(--accent), var(--cyan)); border-radius: 999px; }
.rank-list li:nth-child(2n) progress::-webkit-progress-value { background: linear-gradient(90deg, var(--emerald), var(--cyan)); }
.rank-list progress::-moz-progress-bar { background: var(--accent); border-radius: 999px; }
.chart-empty { min-height: 150px; display: grid; place-items: center; }

/* Buttons & Form Controls */
.button {
  min-height: 34px;
  padding: 7px 13px;
  border-radius: 9px;
  background: transparent;
  border: 1px solid transparent;
  color: var(--ink);
  display: inline-flex;
  justify-content: center;
  align-items: center;
  gap: 6px;
  font-weight: 650;
  font-size: 12.5px;
  line-height: 1.25;
  white-space: nowrap;
  max-width: 100%;
  transition: background-color 0.15s ease, border-color 0.15s ease, transform 0.08s ease;
}
.button:active:not(:disabled) { transform: translateY(1px); }
.button svg { width: 15px; height: 15px; flex-shrink: 0; }
.button.primary {
  color: #ffffff;
  background: linear-gradient(135deg, var(--accent), #4f46e5);
  border-color: rgba(129, 140, 248, 0.45);
  box-shadow: 0 4px 14px rgba(79, 70, 229, 0.28);
}
.button.primary:hover:not(:disabled) { background: linear-gradient(135deg, #4f46e5, #4338ca); }
.button.white { color: #064e3b; background: #ffffff; min-height: 32px; border-color: rgba(255, 255, 255, 0.8); }
.button.white:hover:not(:disabled) { background: #ecfdf5; }
.button.secondary { background: var(--surface-2); border-color: var(--border-strong); color: var(--ink); }
.button.secondary:hover:not(:disabled), .button.ghost:hover:not(:disabled) { background: var(--surface-3); border-color: var(--border-glow); }
.button.text { color: var(--accent-bright); font-size: 12px; padding-inline: 8px; min-height: 30px; }
.button.text:hover:not(:disabled) { background: var(--accent-soft); }
.button.danger { color: var(--rose-bright); }
.button.danger-solid { color: #fff; background: var(--rose); border-color: var(--rose); box-shadow: none; }
.button.danger-solid:hover:not(:disabled) { background: #be123c; }
.icon-button {
  display: inline-grid;
  place-items: center;
  background: transparent;
  color: var(--muted);
  border: 1px solid transparent;
  border-radius: 8px;
  width: 32px;
  height: 32px;
  flex: 0 0 32px;
  padding: 0;
}
.icon-button:hover { color: var(--ink); background: var(--surface-3); border-color: var(--border); }
.icon-button svg { width: 16px; height: 16px; }

label { display: grid; gap: 6px; color: var(--ink-2); font-size: 12px; font-weight: 650; min-width: 0; }
input, select, textarea {
  width: 100%;
  min-width: 0;
  border: 1px solid var(--border-strong);
  border-radius: 9px;
  background: var(--input-bg);
  color: var(--ink);
  min-height: 36px;
  padding: 7px 10px;
  font-size: 13px;
  font-weight: 450;
  line-height: 1.4;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}
input:focus, select:focus, textarea:focus { border-color: var(--accent-bright); outline: none; box-shadow: 0 0 0 3px var(--accent-soft); }
input::placeholder, textarea::placeholder { color: var(--muted-2); }
textarea { min-height: 68px; resize: vertical; }
.form-stack, .debug-form { display: grid; gap: 11px; }
.form-stack > .button, .debug-form > .button { justify-self: start; }
.debug-form > .run-button { justify-self: stretch; }

/* Quickstart & Code Snippets */
.endpoint-copy-row { display: flex; gap: 8px; align-items: center; }
.endpoint-copy-row input { font-family: var(--font-mono); font-size: 12px; }
.tab-bar { display: inline-flex; gap: 4px; padding: 3px; border-radius: 9px; background: var(--surface-2); border: 1px solid var(--border); margin: 12px 0 9px; }
.tab-btn {
  border: 0;
  background: transparent;
  color: var(--muted);
  font-size: 11.5px;
  font-weight: 650;
  padding: 5px 10px;
  border-radius: 6px;
}
.tab-btn.active { background: var(--surface-3); color: var(--ink); box-shadow: 0 1px 2px rgba(0,0,0,0.18); }
.code-box {
  position: relative;
  border-radius: 11px;
  border: 1px solid var(--border);
  background: var(--input-bg);
  padding: 12px 13px;
  overflow-x: auto;
}
.code-box pre { font-size: 11.5px; line-height: 1.6; color: var(--ink-2); white-space: pre; }
.code-box-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 6px; padding-bottom: 6px; border-bottom: 1px solid var(--border); font-size: 11px; color: var(--muted); }

.debug-options { color: var(--muted); font-size: 12px; border: 1px solid var(--border); border-radius: 9px; padding: 8px 10px; background: var(--surface-2); }
.debug-options summary { cursor: pointer; font-weight: 650; color: var(--ink-2); }
.debug-options[open] label, .debug-options[open] small { display: grid; margin-top: 8px; }
.debug-options small { line-height: 1.5; }
.debug-result { background: var(--surface-2); border: 1px solid var(--border-glow); border-radius: 10px; padding: 11px 12px; font-size: 12.5px; overflow-wrap: anywhere; }
.debug-result p { white-space: pre-wrap; line-height: 1.6; color: var(--ink); }
.debug-result > div { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-top: 8px; padding-top: 8px; border-top: 1px solid var(--border); }
.debug-result small { color: var(--muted); }
.debug-result.debug-error { background: var(--rose-soft); border-color: rgba(244, 63, 94, 0.35); color: var(--rose-bright); }
.debug-result.debug-error p { color: var(--rose-bright); }
.debug-layout { align-items: start; }
.endpoint-card dl { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; margin-top: 14px; }

/* Tables & Records */
.table-tools { display: flex; gap: 8px; margin: 0 0 12px; flex-wrap: wrap; align-items: center; }
.table-tools select { width: 118px; }
.search-control { display: flex; position: relative; width: min(100%, 310px); }
.staff-search .search-control { flex: 1 1 420px; width: auto; max-width: 100%; }
.search-control svg { width: 16px; height: 16px; position: absolute; left: 10px; top: 10px; pointer-events: none; color: var(--muted-2); }
.search-control input { padding-left: 32px; }

.filter-chips { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 12px; }
.chip {
  padding: 5px 11px;
  border-radius: 999px;
  font-size: 11.5px;
  font-weight: 650;
  border: 1px solid var(--border);
  background: var(--surface-2);
  color: var(--muted);
  display: inline-flex;
  align-items: center;
  gap: 5px;
}
.chip:hover { color: var(--ink); border-color: var(--border-strong); }
.chip.active { background: var(--accent-soft); color: var(--accent-bright); border-color: var(--border-glow); }
.chip b { font-variant-numeric: tabular-nums; opacity: 0.88; }

.table-wrap { overflow-x: auto; }
.records-table { border-collapse: collapse; width: 100%; text-align: left; font-size: 12.5px; }
.records-table thead { background: var(--table-head); color: var(--muted); white-space: nowrap; }
.records-table th { padding: 10px 9px; font-weight: 650; font-size: 11.5px; border-bottom: 1px solid var(--border); }
.records-table td { padding: 10px 9px; border-bottom: 1px solid var(--border); font-variant-numeric: tabular-nums; vertical-align: middle; }
.records-table tr:last-child td { border-bottom: 0; }
.records-table tbody tr { transition: background-color 0.12s ease; }
.records-table tbody tr:hover { background: var(--table-hover); }
.records-table tbody tr.selected-row { background: var(--accent-soft); }
.record-id { display: flex; align-items: center; gap: 9px; }
.record-id .tile-icon { width: 30px; height: 30px; }
.record-id .tile-icon svg { width: 15px; height: 15px; }
.record-id strong { display: block; font-weight: 680; color: var(--ink); }
.records-table small { display: block; color: var(--muted); margin-top: 2px; font-size: 11px; }
.record-id .record-ref { max-width: 170px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-family: var(--font-mono); font-size: 10.5px; }
.table-date { white-space: nowrap; color: var(--muted); font-size: 11.5px; }
.table-action { text-align: right; white-space: nowrap; }
.records-table .note-count {
  display: inline-flex;
  align-items: center;
  vertical-align: middle;
  margin: 0 6px 0 0;
  padding: 3px 8px;
  border-radius: 999px;
  color: var(--amber-bright);
  background: var(--amber-soft);
  border: 1px solid rgba(245, 158, 11, 0.3);
  font-size: 11px;
  font-weight: 700;
  white-space: nowrap;
}
.amount-cell { font-weight: 720; white-space: nowrap; }
.activity-table td { white-space: nowrap; }
.activity-table .activity-reference { color: var(--accent-bright); }

.badge {
  color: var(--ink-2);
  background: var(--surface-3);
  border: 1px solid var(--border);
  display: inline-flex;
  align-items: center;
  gap: 5px;
  border-radius: 999px;
  padding: 3px 8px;
  line-height: 1.3;
  font-size: 11px;
  font-weight: 680;
  white-space: nowrap;
}
.badge::before { content: ""; width: 5px; height: 5px; border-radius: 50%; background: currentColor; }
.b-settled, .b-credited, .b-active { background: var(--emerald-soft); color: var(--emerald-bright); border-color: rgba(16, 185, 129, 0.28); }
.b-pending, .b-review { background: var(--amber-soft); color: var(--amber-bright); border-color: rgba(245, 158, 11, 0.3); }
.b-reserved, .b-in_flight { background: var(--accent-soft); color: var(--accent-bright); border-color: rgba(99, 102, 241, 0.3); }
.b-released, .b-revoked { background: var(--surface-3); color: var(--muted); border-color: var(--border); }
.empty, .loading { color: var(--muted); padding: 34px 12px; text-align: center; }

/* Staff Split Workbench */
.staff-summary-strip {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 16px;
}
.staff-mini-stat {
  padding: 13px 15px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}
.staff-mini-stat small { display: block; color: var(--muted); font-size: 11.5px; }
.staff-mini-stat strong { display: block; font-size: 21px; font-weight: 760; margin-top: 3px; font-variant-numeric: tabular-nums; }
.staff-split {
  display: grid;
  grid-template-columns: minmax(0, 1.72fr) minmax(300px, 0.88fr);
  gap: 14px;
  align-items: start;
}
.staff-split .record-card { padding: 16px; }
.staff-split .records-table th,
.staff-split .records-table td { padding: 9px 6px; font-size: 12px; }
.staff-split .record-id .record-ref { max-width: 118px; }
.staff-split .table-date { white-space: normal; min-width: 78px; line-height: 1.3; }
.staff-split .table-action { display: flex; flex-direction: column; align-items: flex-end; gap: 4px; }
.staff-split .records-table .note-count { margin: 0; }
.staff-inspector {
  padding: 18px;
  position: sticky;
  top: 78px;
}
.inspector-wallet-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  margin: 12px 0;
}
.inspector-wallet-box {
  padding: 9px 11px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--surface-2);
}
.inspector-wallet-box small { display: block; font-size: 11px; color: var(--muted); }
.inspector-wallet-box strong { display: block; font-size: 14px; font-weight: 740; margin-top: 3px; font-variant-numeric: tabular-nums; }
.inspector-actions { margin-top: 14px; display: flex; gap: 8px; flex-wrap: wrap; }

/* Models & Keys */
.model-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 340px), 1fr)); gap: 16px; }
.model-card p { color: var(--muted); line-height: 1.6; font-size: 13px; }
.model-card code { font-size: 11.5px; color: var(--accent-bright); overflow-wrap: anywhere; }
.model-prices, .details-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; margin: 14px 0; }
dl div { padding: 9px 11px; border-radius: 10px; background: var(--surface-2); border: 1px solid var(--border); }
dl dt { font-size: 11px; color: var(--muted); }
dl dd { font-size: 13px; font-weight: 680; margin-top: 4px; overflow-wrap: anywhere; font-variant-numeric: tabular-nums; }
.status-bar { background: var(--amber-soft); color: var(--amber-bright); border: 1px solid rgba(245, 158, 11, 0.3); padding: 11px 14px; margin-bottom: 16px; border-radius: 11px; font-weight: 600; }
.key-row { display: flex; align-items: center; gap: 12px; border-top: 1px solid var(--border); padding: 12px 0; }
.key-row:first-of-type { border-top: 0; padding-top: 4px; }
.key-info { flex: 1; min-width: 0; overflow-wrap: anywhere; }
.key-info small { display: block; margin-top: 4px; color: var(--muted); }

/* Login Page */
.login-layout {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
  position: relative;
}
.login-theme-bar { position: absolute; top: 20px; right: 24px; }
.login-card {
  width: min(100%, 520px);
  border: 1px solid var(--border-strong);
  border-radius: 22px;
  background: var(--surface);
  padding: 30px;
  box-shadow: var(--shadow-float), var(--inner-shine);
}
.login-card .brand { padding: 0; }
.login-intro { margin: 20px 0 18px; }
.login-intro h1 { font-size: 26px; font-weight: 780; margin: 12px 0 7px; letter-spacing: -0.02em; }
.login-intro p { color: var(--muted); line-height: 1.6; font-size: 13px; }
.login-pills { display: flex; flex-wrap: wrap; gap: 7px; margin: 12px 0 4px; }
.login-pill {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 650;
  color: var(--cyan);
  background: var(--cyan-soft);
  border: 1px solid rgba(56, 189, 248, 0.25);
}
.login-roles { display: grid; gap: 10px; }
.role-option {
  padding: 13px 13px;
  display: flex;
  align-items: center;
  text-align: left;
  gap: 11px;
  border: 1px solid var(--border);
  border-radius: 13px;
  color: var(--ink);
  background: var(--surface-2);
  transition: border-color 0.16s ease, background-color 0.16s ease, transform 0.1s ease;
}
.role-option:hover { border-color: var(--border-glow); background: var(--accent-soft); transform: translateY(-1px); }
.role-option > span:nth-child(2) { flex: 1; }
.role-option strong { font-size: 13.5px; }
.role-option small { display: block; margin-top: 3px; color: var(--muted); line-height: 1.4; font-size: 12px; }
.role-option > svg { width: 16px; color: var(--muted); flex-shrink: 0; }

/* Slide-Over Detail Drawer (native <dialog>) */
dialog.detail-drawer {
  width: min(650px, calc(100vw - 16px));
  height: 100dvh;
  max-height: 100dvh;
  margin: 0 0 0 auto;
  padding: 0;
  border: 0;
  border-left: 1px solid var(--border-strong);
  border-radius: 20px 0 0 20px;
  background: var(--surface);
  color: var(--ink);
  box-shadow: var(--shadow-float);
  overflow-y: auto;
}
dialog::backdrop { background: rgba(4, 7, 15, 0.65); backdrop-filter: blur(5px); }
.dialog-head {
  background: var(--surface-glass);
  backdrop-filter: blur(12px);
  padding: 15px 20px;
  border-bottom: 1px solid var(--border);
  display: flex;
  justify-content: space-between;
  align-items: center;
  position: sticky;
  top: 0;
  z-index: 2;
}
.dialog-head h2 { font-size: 17px; font-weight: 740; }
.dialog-content { padding: 18px 20px 26px; }
.dialog-content p { line-height: 1.55; }
.dialog-alert { padding: 9px 11px; margin-bottom: 12px; border-radius: 9px; color: var(--rose-bright); background: var(--rose-soft); border: 1px solid rgba(244, 63, 94, 0.3); font-size: 12.5px; }
.detail-ref {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 6px 8px 6px 12px;
  gap: 8px;
}
.detail-ref code { font-size: 12px; overflow-wrap: anywhere; color: var(--accent-bright); }
.details-grid { margin: 14px 0 4px; }
.dialog-block { border-top: 1px solid var(--border); margin-top: 15px; padding-top: 15px; }
.dialog-block h3 { margin-bottom: 9px; font-size: 13.5px; font-weight: 720; }

/* Formula Breakdown Card inside Drawer */
.formula-card {
  margin-top: 14px;
  padding: 13px 14px;
  border-radius: 12px;
  background: var(--surface-2);
  border: 1px solid var(--border-strong);
  display: grid;
  gap: 8px;
}
.formula-card-title { font-size: 12px; font-weight: 700; color: var(--ink-2); display: flex; justify-content: space-between; align-items: center; }
.formula-rows { display: grid; gap: 6px; font-size: 12px; font-variant-numeric: tabular-nums; }
.formula-row { display: flex; justify-content: space-between; gap: 8px; color: var(--muted); }
.formula-row b { color: var(--ink); }
.formula-total { border-top: 1px dashed var(--border-strong); padding-top: 7px; margin-top: 2px; display: flex; justify-content: space-between; font-size: 12.5px; font-weight: 740; color: var(--ink); }

.account-overview summary { width: fit-content; color: var(--accent-bright); cursor: pointer; font-weight: 680; font-size: 13px; }
#account-analytics { display: grid; gap: 10px; margin-top: 10px; }
.dialog-block p + button { margin-top: 8px; }

.timeline { list-style: none; padding: 0; margin: 0 0 8px; display: grid; gap: 7px; }
.timeline li {
  position: relative;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 9px 11px 9px 26px;
  display: flex;
  justify-content: space-between;
  gap: 10px;
  font-size: 12px;
  overflow-wrap: anywhere;
}
.timeline li::before {
  content: "";
  position: absolute;
  left: 11px;
  top: 14px;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--accent-bright);
}
.timeline li[data-kind="credit"]::before { background: var(--emerald-bright); }
.timeline li[data-kind="hold"]::before { background: var(--amber-bright); }
.timeline li[data-kind="charge"]::before { background: var(--rose-bright); }
.timeline li[data-kind="release"]::before { background: var(--cyan); }
.timeline small { display: block; margin-top: 3px; color: var(--muted); }
.timeline p { margin-top: 5px; white-space: pre-wrap; color: var(--ink-2); }
.ledger-values { text-align: right; font-variant-numeric: tabular-nums; }
.form-inline { display: grid; grid-template-columns: 1fr 1fr; gap: 9px; }

.notice { display: none; }
.notice.show {
  position: fixed;
  display: block;
  left: 50%;
  bottom: 20px;
  z-index: 20;
  transform: translateX(-50%);
  background: #064e3b;
  color: #ecfdf5;
  border: 1px solid rgba(52, 211, 153, 0.45);
  max-width: calc(100% - 24px);
  width: max-content;
  box-shadow: var(--shadow-float);
  border-radius: 10px;
  padding: 10px 15px;
  font-size: 13px;
  font-weight: 600;
}
.notice.error { background: #7f1d1d; color: #fef2f2; border-color: rgba(251, 113, 133, 0.45); }

/* Responsive Breakpoints */
@media (max-width: 1200px) {
  .stat-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .staff-split { grid-template-columns: 1fr; }
  .staff-inspector { position: static; }
  .staff-summary-strip { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 1120px) {
  .layout { grid-template-columns: 196px minmax(0, 1fr); }
  .sidebar { padding-inline: 11px; }
  .content { padding-inline: 20px; }
  .topbar { padding-inline: 20px; }
  .middle-grid, .lower-grid { grid-template-columns: 1fr; }
}
@media (max-width: 880px) {
  .layout { display: block; }
  .sidebar {
    position: relative;
    height: auto;
    padding: 12px 14px 10px;
    border-right: 0;
    border-bottom: 1px solid var(--border);
    background: var(--surface);
    backdrop-filter: none;
  }
  .sidebar .brand { padding: 0 2px; }
  .sidebar .brand img { width: 32px; height: 32px; }
  .sidebar .brand strong { font-size: 16px; }
  .sidebar nav { display: flex; gap: 4px; margin-top: 10px; }
  .nav-group { display: contents; }
  .nav-label, .sidebar-foot { display: none; }
  .nav-item { flex: 1; min-height: 36px; justify-content: center; gap: 5px; font-size: 12px; padding: 6px 5px; white-space: nowrap; }
  .nav-item svg { flex-basis: 14px; height: 14px; }
  .topbar { height: 48px; }
  .compact-logout { display: inline-flex !important; font-size: 11.5px; min-height: 30px; padding: 4px 8px; }
}
@media (max-width: 640px) {
  html { font-size: 13px; }
  .sidebar { padding: 10px 12px; border-bottom: 1px solid var(--border); }
  .sidebar nav {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 15;
    display: flex;
    gap: 3px;
    margin-top: 0;
    padding: 6px 8px calc(6px + env(safe-area-inset-bottom, 0px));
    background: var(--surface-glass);
    backdrop-filter: blur(18px);
    border-top: 1px solid var(--border-strong);
  }
  .nav-item { flex-direction: column; gap: 3px; min-height: 46px; min-width: 0; padding: 5px 3px; border-radius: 9px; }
  .nav-item svg { flex: 0 0 16px; height: 16px; width: 16px; }
  .nav-full { display: none; }
  .nav-short { display: inline; font-size: 11px; }
  .content { padding: 16px 12px 84px; }
  .topbar { padding: 0 12px; }
  .top-context span, .top-context svg { display: none; }
  .environment { padding: 4px 8px; font-size: 10.5px; }
  .theme-toggle span { display: none; }
  .page-heading { margin-bottom: 14px; align-items: flex-start; }
  .page-heading h1 { font-size: 22px; }
  .page-heading p { font-size: 12px; margin-top: 4px; }
  .stat-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 9px; margin-bottom: 10px; }
  .primary-stat { grid-column: 1 / -1; min-height: 130px; }
  .stat-grid > .stat:last-child { grid-column: 1 / -1; min-height: 102px; }
  .stat { padding: 12px; min-height: 114px; gap: 7px; }
  .stat-top { flex-wrap: wrap; gap: 5px; }
  .primary-stat .stat-val { font-size: clamp(30px, 9.5vw, 38px); }
  .stat-val { font-size: 19px; }
  .stat-label { font-size: 11.5px; gap: 6px; }
  .section-heading { flex-wrap: wrap; }
  .wallet-equation { padding: 9px 10px; gap: 6px 8px; font-size: 11px; }
  .sample-note { margin-left: 0; }
  .middle-grid, .lower-grid { gap: 12px; margin-bottom: 12px; }
  .analytics, .rank-card, .debug-card, .record-card, .model-card, .key-card, .endpoint-card, .quickstart-card { padding: 13px; }
  .donut-layout { grid-template-columns: 1fr; }
  .chart text { font-size: 15px; }
  .chart text[text-anchor="end"] { font-size: 13px; }
  .chart-tooltip { display: none; }
  .chart-date select { min-height: 36px; font-size: 13px; }
  .chart-legend { margin-left: 0; }
  .table-tools select { flex: 0 0 96px; }
  .records-table thead { position: absolute; clip-path: inset(50%); width: 1px; height: 1px; overflow: hidden; }
  .records-table, .records-table tbody { display: block; }
  .records-table tr { display: grid; grid-template-columns: 1fr 1fr; padding: 9px 4px; border-top: 1px solid var(--border); gap: 3px 8px; }
  .records-table td { display: block; border: 0; min-width: 0; padding: 3px 2px; font-size: 11.5px; }
  .records-table td[data-label]::before { content: attr(data-label); font-size: 10px; color: var(--muted); display: block; margin-bottom: 2px; font-weight: 500; }
  .records-table td:first-child { grid-column: 1 / -1; padding-bottom: 6px; }
  .records-table td:first-child::before { display: none; }
  .activity-table td:nth-child(3), .activity-table td:nth-child(2) { grid-row: 2; }
  .activity-table td:nth-child(3) { grid-column: 1; }
  .activity-table td:nth-child(2) { grid-column: 2; }
  .record-id .record-ref { max-width: none; white-space: normal; overflow-wrap: anywhere; }
  .table-action { grid-column: 2; justify-self: end; align-self: center; }
  .staff-summary-strip { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
  dialog.detail-drawer {
    width: 100vw;
    height: auto;
    max-height: 90dvh;
    margin: auto 0 0 0;
    border-left: 0;
    border-top: 1px solid var(--border-strong);
    border-radius: 20px 20px 0 0;
  }
  input, select, textarea { font-size: 16px; }
  .table-tools input, .table-tools select { font-size: 13px; }
}

.video-workspace { align-items: start; }
.video-options { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 9px; }
.video-quote, .video-job-top, .video-progress, .video-job-actions { display: flex; align-items: center; gap: 9px; flex-wrap: wrap; }
.video-quote, .video-job-top { justify-content: space-between; }
.video-quote, .video-progress { font-size: 12px; color: var(--muted); }
.video-job-list { display: grid; gap: 8px; }
.video-job { display: grid; gap: 7px; padding: 11px; border: 1px solid var(--border); border-radius: 10px; background: var(--surface-2); }
.video-progress progress { flex: 1; min-width: 60px; height: 8px; accent-color: var(--accent-bright); }
.video-job-actions a { white-space: nowrap; }
@media (max-width: 360px) { .video-options { grid-template-columns: repeat(2, minmax(0, 1fr)); } }

.filing { color: var(--muted); font-size: 12px; text-align: center; padding: 14px 8px; }
.filing a { color: inherit; }
