/* ==========================================================================
   Vioneer dashboard — design tokens + component styles.

   The same night as the landing page and the public pages, so signing up
   does not land on what looks like another product: near-black with a blue
   cast, smoked-glass cards with a faint top light, hairline rules, the
   product's blue on the primary buttons and a lifted blue for the accent.
   Two faces: Geist for everything read, and, light and tightly tracked, for
   page titles and the big figures; Geist Mono for labels (small tracked
   capitals), figures in tables and anything machine-shaped. Both are
   self-hosted from /fonts (SIL OFL, licences alongside), so the dashboard
   still works offline.

   Dark by default, with a full light palette behind data-theme="light". The
   viewer's choice comes from the topbar toggle and is persisted; the OS
   preference is deliberately NOT consulted, so a first visit is always dark,
   like the site around it.

   Contrast: every text token clears WCAG AA (4.5:1) on every surface it can
   sit on, in both themes, status colours on their tinted badges included.
   The chart colours are validated categorical trios for their own card
   surface (dark, on #0d0f17: CVD ΔE 9.7; light, on white: ΔE 11.6; chroma
   floor, lightness band and 3:1 contrast all pass). Dark series 1 is
   deliberately not the accent: the accent is tuned for text contrast and
   sits above the dark lightness band. Status hues are reserved for state and
   are never used as a chart series.
   ========================================================================== */

/* Geist and Geist Mono: variable (weights 100-900), upright and italic, the
   latin subset (SIL OFL, licences alongside in /fonts). Geist Fallback is
   Arial reshaped to Geist's metrics, so text does not jump when Geist lands. */
@font-face {
  font-family: 'Geist';
  font-style: normal;
  font-weight: 100 900;
  font-display: swap;
  src: url('/fonts/geist-latin-wght-normal.woff2') format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

@font-face {
  font-family: 'Geist';
  font-style: italic;
  font-weight: 100 900;
  font-display: swap;
  src: url('/fonts/geist-latin-wght-italic.woff2') format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

@font-face {
  font-family: 'Geist Mono';
  font-style: normal;
  font-weight: 100 900;
  font-display: swap;
  src: url('/fonts/geist-mono-latin-wght-normal.woff2') format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

@font-face {
  font-family: 'Geist Mono';
  font-style: italic;
  font-weight: 100 900;
  font-display: swap;
  src: url('/fonts/geist-mono-latin-wght-italic.woff2') format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

@font-face {
  font-family: 'Geist Fallback';
  src: local('Arial');
  ascent-override: 95.94%;
  descent-override: 28.16%;
  line-gap-override: 0%;
  size-adjust: 104.76%;
}

:root {
  color-scheme: dark;

  /* surfaces: near-black with a blue cast, each card a step up */
  --bg: #06070b;
  --surface: #0d0f17;
  --surface-2: #131621;
  --surface-3: #1b1f2c;
  --surface-hover: #131621;
  --sidebar-bg: #080a10;
  --border: #1c2030;
  --border-strong: #2b3043;

  /* ink */
  --text: #eef0f7;
  --text-2: #b9bdcd;
  --text-3: #858aa0;

  /* accent (also what is selected, and the focus ring) */
  --accent: #8c9dff;
  --accent-hover: #adb8ff;
  --accent-dim: #3a4580;
  --accent-wash: rgba(124, 147, 255, 0.12);
  --accent-wash-strong: rgba(124, 147, 255, 0.2);

  /* primary buttons: the product's blue, as on the landing page; white on it
     clears 4.5:1 down its whole length */
  --btn: #4560f0;
  --btn-hover: #5670f7;
  --btn-grad: linear-gradient(180deg, #5770fd 0%, #3e57ea 100%);
  --btn-grad-hover: linear-gradient(180deg, #6680ff 0%, #4a62f2 100%);
  --btn-glow: 0 10px 24px -12px rgba(62, 87, 234, 0.9);
  --on-btn: #ffffff;

  /* chart series */
  --series-1: #6a83f4;
  --series-2: #e0713a;
  --series-3: #1fae83;
  /* everything past the named series, folded together: a neutral, 3:1 on the card */
  --series-other: #6b6b75;
  --grid: #1c2030;

  /* status — reserved, never a series colour */
  --ok: #3fb950;
  --ok-wash: rgba(63, 185, 80, 0.14);
  --warn: #d6a01f;
  --warn-wash: rgba(214, 160, 31, 0.14);
  --danger: #ff786f;
  --danger-wash: rgba(255, 120, 111, 0.14);

  /* depth: a card catches a faint light along its top and throws a long
     shadow; the page has a glow up where the light comes from */
  --card-bg: linear-gradient(180deg, rgba(255, 255, 255, 0.03), rgba(255, 255, 255, 0) 46%), var(--surface);
  --card-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.04), 0 24px 48px -34px rgba(0, 0, 0, 0.95);
  --page-glow:
    radial-gradient(50% 36% at 64% -6%, rgba(96, 116, 255, 0.11), transparent 72%),
    radial-gradient(30% 26% at 92% 4%, rgba(183, 148, 246, 0.06), transparent 70%);
  --shadow-1: 0 1px 2px rgba(0, 0, 0, 0.5);
  --shadow-2: 0 22px 46px -16px rgba(0, 0, 0, 0.85), 0 0 0 1px rgba(255, 255, 255, 0.04);
  --shadow-3: 0 40px 80px -30px rgba(0, 0, 0, 0.92), 0 0 0 1px rgba(255, 255, 255, 0.05);

  /* theme-dependent one-offs */
  --topbar-bg: rgba(6, 7, 11, 0.76);
  --glass-bg: rgba(13, 15, 23, 0.9);
  --scrim: rgba(0, 0, 0, 0.66);
  --scrim-soft: rgba(0, 0, 0, 0.6);
  --on-accent: #06070b;
  --inset-hairline: rgba(255, 255, 255, 0.07);
  --scroll-thumb-hover: #4a5068;
  --border-hover: #3d4358;
  --danger-text: #ffb4ae;
  --danger-border: rgba(255, 120, 111, 0.34);
  --ok-text: #9ae6a5;
  --ok-border: rgba(63, 185, 80, 0.3);
  --warn-border: rgba(214, 160, 31, 0.32);
  --accent-border: rgba(140, 157, 255, 0.34);

  /* code blocks are ink in both themes, like the landing page's */
  --code-bg: #07080d;
  --code-text: #e7e9f2;
  --code-dim: #8a8fa3;
  --code-rule: #1c2030;

  /* the spectrum the glass V lets out, as on the landing page */
  --sp-1: #b794f6;
  --sp-2: #8b9dff;
  --sp-3: #5ab0ff;
  --sp-4: #4fd1a5;
  --sp-5: #ffb36b;
  --sp-6: #ff7ab6;
  --spectrum: linear-gradient(90deg, var(--sp-1), var(--sp-2), var(--sp-3), var(--sp-4), var(--sp-5), var(--sp-6));
  --spectrum-text: linear-gradient(100deg, #cdbbff 0%, #98a8ff 28%, #6cbcff 52%, #5fdcb2 76%, #a8efcf 100%);

  /* type */
  --font-sans: 'Geist', 'Geist Fallback', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto,
    'Helvetica Neue', Arial, 'Noto Sans', sans-serif;
  --font-mono: 'Geist Mono', ui-monospace, SFMono-Regular, 'SF Mono', Menlo, Consolas,
    'Liberation Mono', monospace;
  /* Titles and the big figures: the same Geist, light and tightly tracked. */
  --font-display: var(--font-sans);

  /* metrics */
  --sidebar-w: 248px;
  --topbar-h: 62px;
  --radius: 12px;
  --radius-sm: 9px;
  --radius-lg: 18px;
  --ease: cubic-bezier(0.22, 0.61, 0.36, 1);
}

/*
 * Light palette — opt-in.
 *
 * Dark is the default for everyone, including viewers whose OS asks for light;
 * light applies only when the viewer picks it with the topbar toggle, which
 * stamps data-theme="light" on <html> (see the bootstrap in index.html, which
 * runs before first paint so there is no flash of the wrong theme).
 */
:root[data-theme='light'] {
  color-scheme: light;

  --bg: #ffffff;
  --surface: #ffffff;
  --surface-2: #f4f4f5;
  --surface-3: #e4e4e7;
  --surface-hover: #f4f4f5;
  --sidebar-bg: #f7f7f8;
  --border: #e4e4e7;
  --border-strong: #d4d4d8;

  --text: #0a0a0b;
  --text-2: #3f3f46;
  --text-3: #5f5f67;

  --accent: #1d3fd8;
  --accent-hover: #1733b5;
  --accent-dim: #8fa0ea;
  --accent-wash: rgba(29, 63, 216, 0.08);
  --accent-wash-strong: rgba(29, 63, 216, 0.15);

  --btn: #1d3fd8;
  --btn-hover: #1733b5;
  --btn-grad: linear-gradient(180deg, #3654ea 0%, #1d3fd8 100%);
  --btn-grad-hover: linear-gradient(180deg, #2b49e0 0%, #1733b5 100%);
  --btn-glow: 0 8px 18px -10px rgba(29, 63, 216, 0.6);
  --on-btn: #ffffff;

  --series-1: #1d3fd8;
  --series-2: #c2410c;
  --series-3: #08876f;
  --series-other: #8e8e98;
  --grid: #ececef;

  --ok: #116230;
  --ok-wash: rgba(17, 98, 48, 0.12);
  --warn: #7a4804;
  --warn-wash: rgba(122, 72, 4, 0.13);
  --danger: #a0251c;
  --danger-wash: rgba(160, 37, 28, 0.11);

  --card-bg: var(--surface);
  --card-shadow: 0 1px 2px rgba(16, 24, 40, 0.04);
  --page-glow: none;
  --shadow-1: 0 1px 2px rgba(16, 24, 40, 0.06);
  --shadow-2: 0 16px 36px -12px rgba(16, 24, 40, 0.2);
  --shadow-3: 0 36px 72px -28px rgba(16, 24, 40, 0.38), 0 0 0 1px rgba(16, 24, 40, 0.03);

  --topbar-bg: rgba(255, 255, 255, 0.9);
  --glass-bg: rgba(255, 255, 255, 0.96);
  --scrim: rgba(10, 10, 11, 0.42);
  --scrim-soft: rgba(10, 10, 11, 0.36);
  --on-accent: #ffffff;
  --inset-hairline: rgba(10, 10, 11, 0.08);
  --scroll-thumb-hover: #a1a1aa;
  --border-hover: #a1a1aa;
  --danger-text: #8a1f18;
  --danger-border: rgba(160, 37, 28, 0.3);
  --ok-text: #0f5a2c;
  --ok-border: rgba(17, 98, 48, 0.3);
  --warn-border: rgba(122, 72, 4, 0.3);
  --accent-border: rgba(29, 63, 216, 0.3);

  --code-bg: #121318;
  --code-text: #e9e5da;
  --code-dim: #8d897e;
  --code-rule: #262831;

  --spectrum-text: linear-gradient(100deg, #6d3fd6 0%, #3b57e8 35%, #1873d4 65%, #0f8f6a 100%);
}

/* ── base ────────────────────────────────────────────────────────────────── */

*,
*::before,
*::after {
  box-sizing: border-box;
}

html,
body {
  height: 100%;
}

body {
  margin: 0;
  /* The glow sits up where the light comes from, and stays there. */
  background: var(--page-glow), var(--bg);
  background-attachment: fixed;
  color: var(--text);
  font-family: var(--font-sans);
  font-size: 14px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
  overflow-wrap: break-word;
}

h1,
h2,
h3,
h4,
p,
figure {
  margin: 0;
}

a {
  color: var(--accent);
  text-decoration: none;
}

a:hover {
  color: var(--accent-hover);
}

button,
input,
select,
textarea {
  font: inherit;
  color: inherit;
}

:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
  border-radius: 4px;
}

::selection {
  background: var(--accent-wash-strong);
}

/* Scrollbars: thin and recessive so panels read as one surface. */
* {
  scrollbar-width: thin;
  scrollbar-color: var(--border-strong) transparent;
}

*::-webkit-scrollbar {
  width: 10px;
  height: 10px;
}

*::-webkit-scrollbar-thumb {
  background: var(--border-strong);
  border: 3px solid transparent;
  background-clip: padding-box;
  border-radius: 999px;
}

*::-webkit-scrollbar-thumb:hover {
  background: var(--scroll-thumb-hover);
  background-clip: padding-box;
}

/* Code wears the product's mono. The browser's own rule for these is the bare
   generic `monospace`, which is not inherited from a styled parent, so the
   <code> inside every snippet block used to fall back to Consolas/Courier. */
code,
kbd,
pre,
samp {
  font-family: var(--font-mono);
}

.mono {
  font-family: var(--font-mono);
  font-size: 0.92em;
}

/* Numbers are set in the mono, the same rule the landing page follows. */
.num {
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
}

.muted {
  color: var(--text-2);
}

.dim {
  color: var(--text-3);
}

/* A line of small print under what it explains. */
.note {
  font-size: 12.5px;
  line-height: 1.5;
  color: var(--text-3);
}

.nowrap {
  white-space: nowrap;
}

/* The hidden attribute always wins. Components set display (flex, grid,
   inline-flex), which otherwise beats the browser's own [hidden] rule: the
   sign-in form showed the signup-only Name field, and the playground's Stop
   button stayed visible with nothing running. */
[hidden] {
  display: none !important;
}

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

/* ── boot / noscript ─────────────────────────────────────────────────────── */

.boot {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  color: var(--text-3);
  gap: 10px;
  font-size: 13px;
  letter-spacing: 0.02em;
}

.boot .spinner {
  width: 16px;
  height: 16px;
}

.spinner {
  display: inline-block;
  width: 14px;
  height: 14px;
  border: 2px solid var(--border-strong);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
  flex: none;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

@media (prefers-reduced-motion: reduce) {
  * {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

/* ── app shell ───────────────────────────────────────────────────────────── */

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

.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 16px 14px;
  background: var(--sidebar-bg);
  border-right: 1px solid var(--border);
  z-index: 40;
}

.brand {
  --brand-h: 28px;
  display: flex;
  align-items: center;
  padding: 4px 8px 16px;
  color: var(--text);
  font-weight: 600;
  letter-spacing: -0.025em;
  font-size: 18px;
}

.brand:hover {
  color: var(--text);
}

/* The logo: the V mark, then the wordmark, or the site name as text when
   the operator has renamed it. Mark and wordmark share one 100-unit-high
   coordinate space and the wordmark's viewBox starts at the mark's edge, so at
   the same height they sit exactly as drawn. A text name gets a 10px gap
   instead, which the wordmark cancels. */
.brand-mark {
  flex: none;
  width: var(--brand-h, 28px);
  height: var(--brand-h, 28px);
}

.brand-name {
  display: inline-flex;
  padding-left: 10px;
}

.brand-word {
  display: block;
  width: calc(var(--brand-h, 28px) * 2.98);
  height: var(--brand-h, 28px);
  margin-left: -10px;
}

/* The page's logo symbols. Kept rendered, at no size: gradients inside a
   display:none SVG do not paint. */
.or-sprite {
  position: absolute;
  width: 0;
  height: 0;
  overflow: hidden;
}

.nav {
  display: flex;
  flex-direction: column;
  gap: 2px;
  overflow-y: auto;
  flex: 1 1 auto;
  min-height: 0;
}

.nav-group {
  padding: 18px 10px 8px;
  font: 500 10.5px/1 var(--font-mono);
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--text-3);
}

.nav-link {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  border-radius: var(--radius-sm);
  color: var(--text-2);
  font-size: 14px;
  font-weight: 500;
  transition: background 0.12s var(--ease), color 0.12s var(--ease);
}

.nav-link svg {
  width: 16px;
  height: 16px;
  flex: none;
  opacity: 0.85;
}

.nav-link:hover {
  background: var(--surface-2);
  color: var(--text);
}

/* The current page: lit, with a line of the accent down its edge. */
.nav-link[aria-current="page"],
.nav-link[aria-current="page"]:hover {
  background: var(--accent-wash);
  color: var(--text);
  box-shadow: inset 2px 0 0 var(--accent);
}

.nav-link[aria-current="page"] svg {
  color: var(--accent);
  opacity: 1;
  filter: drop-shadow(0 0 6px var(--accent-wash-strong));
}

.sidebar-foot {
  border-top: 1px solid var(--border);
  padding: 12px 10px 2px;
  font-size: 11.5px;
  color: var(--text-3);
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.sidebar-foot code {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--text-2);
  word-break: break-all;
}

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

.topbar {
  position: sticky;
  top: 0;
  z-index: 30;
  height: var(--topbar-h);
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0 28px;
  background: var(--topbar-bg);
  -webkit-backdrop-filter: saturate(1.5) blur(14px);
  backdrop-filter: saturate(1.5) blur(14px);
  border-bottom: 1px solid var(--border);
}

/* The page's name, as a label: the page itself carries it large. */
.topbar h1 {
  color: var(--text-2);
  font: 500 11.5px/1 var(--font-mono);
  letter-spacing: 0.16em;
  text-transform: uppercase;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.topbar-spacer {
  flex: 1 1 auto;
}

.hamburger {
  display: none;
  background: none;
  border: 0;
  padding: 6px;
  border-radius: var(--radius-sm);
  color: var(--text-2);
  cursor: pointer;
}

.hamburger:hover {
  background: var(--surface-2);
  color: var(--text);
}

.hamburger svg {
  width: 18px;
  height: 18px;
  display: block;
}

.theme-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  flex: none;
  padding: 0;
  border-radius: var(--radius);
  border: 1px solid var(--border-strong);
  background: var(--surface);
  color: var(--text-2);
  cursor: pointer;
  transition:
    color 0.14s var(--ease),
    background 0.14s var(--ease),
    border-color 0.14s var(--ease);
}

.theme-toggle:hover {
  color: var(--text);
  background: var(--surface-hover);
  border-color: var(--border-hover);
}

.theme-toggle svg {
  width: 16px;
  height: 16px;
}

.theme-icon {
  display: inline-flex;
}

.balance-pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  height: 36px;
  padding: 0 14px;
  border-radius: 999px;
  border: 1px solid var(--border-strong);
  background: var(--surface);
  color: var(--text);
  font-size: 13px;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.balance-pill:hover {
  border-color: var(--accent-dim);
  color: var(--text);
}

.balance-pill .label {
  color: var(--text-3);
  font-size: 11px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.balance-pill.is-low {
  border-color: var(--danger-border);
}

.balance-pill .value {
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
}

.balance-pill.is-low .value {
  color: var(--danger);
}

.view {
  flex: 1 1 auto;
  padding: 28px 28px 72px;
  max-width: 1280px;
  width: 100%;
  min-width: 0;
}

/* ── user menu ───────────────────────────────────────────────────────────── */

.menu {
  position: relative;
}

.avatar-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  height: 36px;
  padding: 0 6px 0 4px;
  background: none;
  border: 1px solid transparent;
  border-radius: 999px;
  cursor: pointer;
  color: var(--text-2);
}

.avatar-btn:hover {
  background: var(--surface-2);
  border-color: var(--border);
  color: var(--text);
}

.avatar {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: var(--surface-3);
  color: var(--text);
  display: grid;
  place-items: center;
  font-size: 11px;
  font-weight: 650;
  flex: none;
  box-shadow: inset 0 0 0 1px var(--border-strong);
}

.avatar-btn svg {
  width: 12px;
  height: 12px;
}

.menu-pop {
  position: absolute;
  right: 0;
  top: calc(100% + 8px);
  min-width: 232px;
  background: var(--glass-bg);
  -webkit-backdrop-filter: blur(18px);
  backdrop-filter: blur(18px);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-2);
  padding: 6px;
  z-index: 60;
}

.menu-head {
  padding: 8px 10px 10px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 6px;
}

.menu-head .name {
  font-weight: 600;
  font-size: 13px;
}

.menu-head .email {
  font-size: 12px;
  color: var(--text-3);
  word-break: break-all;
}

.menu-item {
  display: flex;
  width: 100%;
  align-items: center;
  gap: 9px;
  padding: 7px 10px;
  border: 0;
  background: none;
  border-radius: var(--radius-sm);
  color: var(--text-2);
  font-size: 13px;
  text-align: left;
  cursor: pointer;
}

.menu-item:hover {
  background: var(--surface-2);
  color: var(--text);
}

.menu-item svg {
  width: 15px;
  height: 15px;
  opacity: 0.8;
}

.menu-item.danger:hover {
  color: var(--danger);
}

/* ── page header ─────────────────────────────────────────────────────────── */

.page-head {
  display: flex;
  align-items: flex-end;
  gap: 16px;
  flex-wrap: wrap;
  margin-bottom: 22px;
}

.page-head h2 {
  font: 300 clamp(30px, 2.8vw, 38px) / 1.05 var(--font-display);
  letter-spacing: -0.04em;
}

.page-head p {
  color: var(--text-3);
  font-size: 14px;
  margin-top: 10px;
  max-width: 64ch;
}

.page-head .actions {
  margin-left: auto;
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

/* ── cards & grids ───────────────────────────────────────────────────────── */

.card {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--card-shadow);
  padding: 20px;
  min-width: 0;
}

.card.pad-0 {
  padding: 0;
  overflow: hidden;
}

.card-head {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 12px;
  flex-wrap: wrap;
}

.card-head h3 {
  font-size: 14.5px;
  font-weight: 600;
  letter-spacing: -0.015em;
}

.card-head .sub {
  font-size: 12px;
  color: var(--text-3);
}

.card-head .right {
  margin-left: auto;
  display: flex;
  gap: 8px;
  align-items: center;
}

.grid {
  display: grid;
  gap: 14px;
}

.grid.cols-2 {
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
}

.grid.cols-3 {
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
}

.grid.cols-4 {
  grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
}

.grid.split {
  grid-template-columns: minmax(0, 1.6fr) minmax(0, 1fr);
}

.grid.split-3 {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

/* Preset top-up amounts. `is-active` is the chosen one, which stays in step
   with the free-text amount box either way it is changed. */
.row.chips {
  gap: 8px;
  flex-wrap: wrap;
}

.btn.chip {
  height: 32px;
  padding: 0 14px;
  border-radius: 999px;
  font-variant-numeric: tabular-nums;
}

.btn.chip.is-active {
  border-color: var(--accent);
  background: var(--accent-wash);
  color: var(--accent);
  font-weight: 600;
}

@media (max-width: 1100px) {
  .grid.split-3 {
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  }
}

@media (max-width: 720px) {
  .grid.split-3 {
    grid-template-columns: minmax(0, 1fr);
  }
}

@media (max-width: 940px) {
  .grid.split {
    grid-template-columns: minmax(0, 1fr);
  }
}

.stack {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.row {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

/* ── stat tiles ──────────────────────────────────────────────────────────── */

.stat {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--card-shadow);
  padding: 16px 18px 14px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-width: 0;
}

.stat .label {
  font: 500 10.5px/1.35 var(--font-mono);
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--text-3);
}

/* Figures big enough to read across the room: Geist, light and tight. */
.stat .value {
  font-family: var(--font-display);
  font-size: 27px;
  font-weight: 300;
  letter-spacing: -0.02em;
  font-variant-numeric: lining-nums tabular-nums;
  line-height: 1.1;
}

.stat .value.sm {
  font-size: 21px;
}

.stat .foot {
  font-size: 11.5px;
  color: var(--text-3);
  display: flex;
  align-items: center;
  gap: 6px;
  min-height: 18px;
}

.stat .spark {
  margin-top: 6px;
  height: 30px;
}

.hero {
  display: flex;
  align-items: flex-start;
  gap: 22px;
  flex-wrap: wrap;
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--card-shadow);
  padding: 24px;
}

.hero .figure {
  font-family: var(--font-display);
  font-size: 46px;
  line-height: 1;
  font-weight: 300;
  letter-spacing: -0.025em;
  font-variant-numeric: lining-nums tabular-nums;
}

.hero .figure.neg {
  color: var(--danger);
}

.hero .label {
  font: 500 10.5px/1.35 var(--font-mono);
  color: var(--text-3);
  letter-spacing: 0.12em;
  text-transform: uppercase;
  margin-bottom: 6px;
}

.hero .side {
  margin-left: auto;
  display: flex;
  gap: 26px;
  flex-wrap: wrap;
}

.hero .side .label {
  text-transform: none;
  letter-spacing: 0;
  font-size: 11.5px;
}

.hero .side .v {
  font-family: var(--font-mono);
  font-size: 17px;
  font-weight: 500;
  letter-spacing: -0.02em;
  font-variant-numeric: tabular-nums;
}

/* ── overview (views/overview.js) ────────────────────────────────────────── */

.ov {
  gap: 16px;
}

/* The sections arrive one after another (each gets its delay in JS). */
@media (prefers-reduced-motion: no-preference) {
  .ov > * {
    animation: ov-rise 0.48s var(--ease) both;
  }

  .ov-gauge > i {
    animation: ov-fill 1.1s 0.15s var(--ease) both;
  }
}

@keyframes ov-rise {
  from {
    opacity: 0;
    transform: translateY(6px);
  }
}

@keyframes ov-fill {
  from {
    transform: scaleX(0);
  }
}

/* The balance: the figure, how long it lasts, and the way to add to it. */
.ov-hero {
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 1.4fr) minmax(250px, 0.85fr);
  gap: 24px 44px;
  padding: 26px 28px 24px;
  overflow: hidden;
}

/* The prism's spectrum along the top edge, as on the public pages. */
.ov-hero::before {
  content: '';
  position: absolute;
  inset: 0 0 auto;
  height: 2px;
  background: var(--spectrum);
  box-shadow: 0 0 18px rgba(124, 147, 255, 0.45);
}

/* The light the spectrum throws down into the card. */
.ov-hero::after {
  content: '';
  position: absolute;
  inset: 0 0 auto;
  height: 140px;
  background: linear-gradient(180deg, rgba(124, 147, 255, 0.07), transparent);
  pointer-events: none;
}

.ov-hero > * {
  position: relative;
  z-index: 1;
}

.ov-hero.tone-warn::before {
  background: var(--warn);
}

.ov-hero.tone-danger::before {
  background: var(--danger);
}

.ov-eyebrow {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 22px;
  color: var(--text-3);
  font: 500 10.5px/1.3 var(--font-mono);
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.ov-eyebrow .badge {
  font-family: var(--font-sans);
  font-size: 11.5px;
}

.ov-eyebrow .badge {
  letter-spacing: 0;
  text-transform: none;
}

.ov-eyebrow .badge svg {
  width: 13px;
  height: 13px;
}

.ov-balance {
  margin-top: 10px;
  font: 300 clamp(46px, 4.6vw, 62px) / 1 var(--font-display);
  letter-spacing: -0.025em;
  font-variant-numeric: lining-nums tabular-nums;
}

.ov-balance.neg {
  color: var(--danger);
}

.ov-runway {
  max-width: 540px;
  margin-top: 22px;
}

/* How far the balance reaches, on a 90-day track marked at 30 and 60. */
.ov-gauge {
  position: relative;
  height: 8px;
  overflow: hidden;
  border-radius: 999px;
  background: var(--surface-3);
}

.ov-gauge > i {
  position: absolute;
  inset: 0 auto 0 0;
  border-radius: inherit;
  background: var(--accent);
  transform-origin: left center;
}

.ov-gauge.warn > i {
  background: var(--warn);
}

.ov-gauge.danger > i {
  background: var(--danger);
}

.ov-gauge::after {
  content: '';
  position: absolute;
  inset: 0;
  background:
    linear-gradient(var(--surface), var(--surface)) calc(100% / 3 - 1px) 0 / 2px 100% no-repeat,
    linear-gradient(var(--surface), var(--surface)) calc(200% / 3 - 1px) 0 / 2px 100% no-repeat;
}

.ov-gauge-scale {
  display: flex;
  justify-content: space-between;
  margin-top: 7px;
  color: var(--text-3);
  font: 400 11px/1 var(--font-mono);
}

.ov-runway-text {
  margin-top: 14px;
  color: var(--text-2);
  font-size: 14.5px;
}

.ov-runway-text strong {
  color: var(--text);
  font-weight: 600;
}

.ov-footnote {
  margin-top: 6px;
  color: var(--text-3);
  font-size: 12px;
}

.ov-hero-side {
  display: flex;
  flex-direction: column;
  gap: 20px;
  padding-left: 32px;
  border-left: 1px solid var(--border);
}

.ov-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.ov-facts {
  display: grid;
  margin: 0;
}

.ov-facts > div {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 0;
  border-top: 1px solid var(--border);
}

.ov-facts dt {
  color: var(--text-3);
  font-size: 13px;
}

.ov-facts dd {
  margin: 0;
  font: 500 14.5px/1.2 var(--font-mono);
  letter-spacing: -0.02em;
  font-variant-numeric: tabular-nums;
  text-align: right;
}

.ov-facts dd a {
  margin-left: 10px;
  font: 500 12.5px/1 var(--font-sans);
  letter-spacing: 0;
}

/* The window's heading, with the control that sets it. */
.ov-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: 12px 16px;
  margin-top: 12px;
}

.ov-bar h2 {
  font: 400 25px/1.1 var(--font-display);
  letter-spacing: -0.03em;
}

.ov-bar .sub {
  margin-top: 4px;
  color: var(--text-3);
  font-size: 12.5px;
}

.ov-bar .right {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  margin-left: auto;
}

/* Four figures, each beside the window before it. */
.ov-kpis {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
}

.ov-kpi {
  display: flex;
  flex-direction: column;
  min-width: 0;
  padding: 18px 20px 16px;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background: var(--card-bg);
  box-shadow: var(--card-shadow);
}

.ov-kpi-label {
  overflow: hidden;
  color: var(--text-3);
  font: 500 10.5px/1.35 var(--font-mono);
  letter-spacing: 0.12em;
  text-overflow: ellipsis;
  text-transform: uppercase;
  white-space: nowrap;
}

.ov-kpi-value {
  margin-top: 10px;
  font: 300 31px/1.05 var(--font-display);
  letter-spacing: -0.02em;
  font-variant-numeric: lining-nums tabular-nums;
}

.ov-delta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 4px 7px;
  margin-top: 9px;
  color: var(--text-3);
  font-size: 11.5px;
}

.ov-delta b {
  padding: 2px 7px;
  border-radius: 999px;
  background: var(--surface-2);
  color: var(--text);
  font: 600 11.5px/1.3 var(--font-mono);
  font-variant-numeric: tabular-nums;
}

.ov-kpi-foot {
  margin-top: 9px;
  color: var(--text-3);
  font-size: 12px;
}

.ov-kpi-foot strong {
  color: var(--text);
  font-weight: 600;
}

.ov-kpi .spark {
  margin-top: auto;
  padding-top: 12px;
}

/* What you paid as a share of list price: the rest of the track is the saving. */
.ov-paid {
  height: 6px;
  margin-top: auto;
  overflow: hidden;
  border-radius: 999px;
  background: var(--accent-wash-strong);
}

/* At the foot of its tile, level with the other tiles' trend lines. */
.ov-kpi .ov-paid {
  margin-top: auto;
  margin-bottom: 12px;
}

.ov-paid > i {
  display: block;
  height: 100%;
  border-radius: 999px;
  background: var(--accent);
}

.ov-cell {
  display: flex;
  min-width: 0;
}

.ov-cell > .card {
  flex: 1;
  min-width: 0;
}

.chart-legend {
  margin-bottom: 12px;
}

/* Spend by model: the split as one bar, then a row per part. */
.ov-share {
  display: flex;
  gap: 2px;
  height: 10px;
  margin: 4px 0 14px;
}

.ov-share > i {
  min-width: 3px;
  height: 100%;
}

.ov-share > i:first-child {
  border-radius: 4px 0 0 4px;
}

.ov-share > i:last-child {
  border-radius: 0 4px 4px 0;
}

.ov-share > i:only-child {
  border-radius: 4px;
}

.ov-rows {
  display: grid;
  margin: 0;
  padding: 0;
  list-style: none;
}

.ov-row {
  display: grid;
  grid-template-columns: 10px minmax(0, 1fr) auto auto;
  align-items: center;
  gap: 3px 10px;
  padding: 11px 0;
  border-top: 1px solid var(--border);
}

.ov-row:first-child {
  border-top: 0;
}

.ov-sw {
  width: 10px;
  height: 10px;
  border-radius: 3px;
}

.ov-name {
  overflow: hidden;
  font-size: 13.5px;
  font-weight: 500;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.ov-val {
  font: 500 13.5px/1.2 var(--font-mono);
  font-variant-numeric: tabular-nums;
  text-align: right;
}

.ov-pc {
  min-width: 4ch;
  color: var(--text-3);
  font: 400 12px/1.2 var(--font-mono);
  text-align: right;
}

.ov-meta {
  grid-column: 2 / -1;
  overflow: hidden;
  color: var(--text-3);
  font-size: 12px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* Spend by key: one hue, the bar's length is the amount. */
.ov-row-bar {
  grid-template-columns: minmax(0, 1fr) auto;
}

.ov-row-bar .ov-meta {
  grid-column: 1 / -1;
}

.ov-keybar {
  display: block;
  grid-column: 1 / -1;
  height: 5px;
  margin-top: 4px;
  border-radius: 999px;
  background: var(--surface-2);
}

.ov-keybar > i {
  display: block;
  height: 100%;
  border-radius: 999px;
  background: var(--accent);
}

.ov-more {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  margin-top: 12px;
  font-size: 12.5px;
  font-weight: 500;
}

.ov-more svg {
  width: 14px;
  height: 14px;
}

/* Reliability: the success rate, then the times. */
.ov-rate {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 4px 10px;
  margin: 2px 0 10px;
}

.ov-rate-value {
  font: 300 34px/1.05 var(--font-display);
  letter-spacing: -0.02em;
  font-variant-numeric: lining-nums tabular-nums;
}

.ov-rate-label {
  color: var(--text-3);
  font-size: 13px;
}

/* Connect a client: the two base URLs, ready to copy. */
.ov-connect {
  display: grid;
  grid-template-columns: minmax(0, 0.85fr) minmax(0, 1.5fr);
  gap: 16px 36px;
  align-items: center;
}

.ov-connect h3 {
  font-size: 14.5px;
  font-weight: 600;
  letter-spacing: -0.015em;
}

.ov-connect p {
  margin: 6px 0 12px;
  color: var(--text-3);
  font-size: 13px;
}

.ov-urls {
  display: grid;
  gap: 8px;
  margin: 0;
}

.ov-urls > div {
  display: grid;
  grid-template-columns: 150px minmax(0, 1fr);
  align-items: center;
  gap: 12px;
}

.ov-urls dt {
  color: var(--text-3);
  font-size: 12.5px;
}

.ov-urls dd {
  display: flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
  margin: 0;
  padding: 4px 4px 4px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface-2);
}

.ov-urls code {
  flex: 1;
  overflow: hidden;
  font: 400 12.5px/1.4 var(--font-mono);
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* The first request, in three steps. */
.ov-steps {
  margin: 0;
  padding: 0;
  list-style: none;
}

.ov-step {
  display: grid;
  grid-template-columns: 28px minmax(0, 1fr) auto;
  gap: 4px 14px;
  align-items: start;
  padding: 16px 0;
  border-top: 1px solid var(--border);
  counter-increment: ov-step;
}

.ov-step:first-child {
  border-top: 0;
  padding-top: 4px;
}

.ov-step-mark {
  display: grid;
  place-items: center;
  width: 28px;
  height: 28px;
  border: 1px solid var(--border-strong);
  border-radius: 50%;
  color: var(--text-2);
  font: 600 13px/1 var(--font-sans);
}

.ov-step-mark:empty::before {
  content: counter(ov-step);
}

.ov-step.done .ov-step-mark {
  border-color: var(--ok-border);
  background: var(--ok-wash);
  color: var(--ok);
}

.ov-step-mark svg {
  width: 15px;
  height: 15px;
}

.ov-step-body h4 {
  margin-top: 4px;
  font-size: 14.5px;
  font-weight: 600;
}

.ov-step.done .ov-step-body h4 {
  color: var(--text-3);
}

.ov-step-body p {
  margin-top: 3px;
  color: var(--text-3);
  font-size: 13px;
}

.ov-step-body .code {
  margin-top: 12px;
}

.ov-steps {
  counter-reset: ov-step;
}

@media (max-width: 1100px) {
  .ov-kpis {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 860px) {
  .ov-hero {
    grid-template-columns: minmax(0, 1fr);
  }

  .ov-hero-side {
    padding-top: 20px;
    padding-left: 0;
    border-top: 1px solid var(--border);
    border-left: 0;
  }

  .ov-connect {
    grid-template-columns: minmax(0, 1fr);
  }
}

@media (max-width: 560px) {
  .ov-hero {
    padding: 20px 16px 18px;
  }

  .ov-balance {
    font-size: 42px;
  }

  .ov-kpis {
    gap: 10px;
  }

  .ov-kpi {
    padding: 13px 13px 11px;
  }

  .ov-kpi-value {
    font-size: 18px;
  }

  .ov-delta span {
    display: none;
  }

  .ov-urls > div {
    grid-template-columns: minmax(0, 1fr);
    gap: 4px;
  }

  .ov-actions .btn {
    flex: 1 1 auto;
  }
}

/* ── summary strip (API keys, Activity) ──────────────────────────────────── */

/* A row of figures in one card. The 1px gap over the border colour draws the
   dividers, so cells that wrap onto a second row stay ruled too. */
.statbar {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
  gap: 1px;
  overflow: hidden;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background: var(--border);
}

.statbar > div {
  min-width: 0;
  padding: 14px 20px 15px;
  background: var(--surface);
}

.statbar .k {
  color: var(--text-3);
  font-size: 12px;
}

.statbar .v {
  margin-top: 3px;
  overflow: hidden;
  font: 500 20px/1.2 var(--font-mono);
  letter-spacing: -0.03em;
  font-variant-numeric: tabular-nums;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.statbar .v.word {
  font: 600 15px/1.6 var(--font-sans);
  letter-spacing: -0.01em;
}

.statbar .s {
  margin-top: 2px;
  overflow: hidden;
  color: var(--text-3);
  font-size: 11.5px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* ── Docs (views/docs.js) ────────────────────────────────────────────────── */

/* The public set-up guides, a tile each. */
.guide-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 10px;
}

.guide {
  display: flex;
  flex-direction: column;
  gap: 3px;
  min-width: 0;
  padding: 12px 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--text);
  text-decoration: none;
  transition:
    border-color 0.15s var(--ease),
    background-color 0.15s var(--ease);
}

.guide:hover {
  border-color: var(--border-hover);
  background: var(--surface-hover);
}

.guide-name {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  font-size: 13.5px;
  font-weight: 600;
}

.guide-name svg {
  width: 13px;
  height: 13px;
  color: var(--text-3);
}

.guide-what {
  overflow: hidden;
  color: var(--text-3);
  font-size: 12px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* ── Playground (views/playground.js) ────────────────────────────────────── */

/* Prompts to start from, under the empty chat. */
.pg-starters {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 8px;
  max-width: 620px;
  margin: 16px auto 0;
}

.pg-starters .btn {
  height: auto;
  min-height: 32px;
  padding: 6px 13px;
  border-radius: 999px;
  color: var(--text-2);
  font-weight: 450;
  line-height: 1.35;
  text-align: left;
  white-space: normal;
}

/* ── Activity (views/activity.js) ────────────────────────────────────────── */

/* The maker's logo, the model's name, then the id the request named. */
.act-model {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.act-model-text {
  min-width: 0;
}

.act-model-name {
  overflow: hidden;
  font-size: 13px;
  font-weight: 550;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.act-model-id {
  margin-top: 1px;
  overflow: hidden;
  color: var(--text-3);
  font: 400 11px/1.3 var(--font-mono);
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* On a phone the quick ranges take a row of their own, each button a share. */
@media (max-width: 560px) {
  .filters .field.wide {
    flex-basis: 100%;
  }

  .filters .field.wide .seg {
    display: flex;
  }

  .filters .field.wide .seg button {
    flex: 1 1 auto;
  }
}

/* ── API keys (views/keys.js) ────────────────────────────────────────────── */

/* One row per key: a table's columns on a wide screen, a small stack on a
   narrow one, so a phone never scrolls sideways to reach a key's buttons. */
.keylist {
  margin: 0;
  padding: 0;
  list-style: none;
}

.keylist > li {
  display: grid;
  /* Fixed, not auto, for the buttons: every row then shares the header's columns. */
  grid-template-columns:
    minmax(170px, 1.5fr) minmax(96px, 0.6fr) minmax(120px, 1fr) minmax(130px, 1fr)
    minmax(120px, 1fr) minmax(110px, 0.8fr) 204px;
  gap: 8px 18px;
  align-items: center;
  padding: 15px 20px;
  border-top: 1px solid var(--border);
}

.keylist > li:first-child {
  border-top: 0;
}

.keylist > .kl-head {
  padding-block: 11px;
  background: var(--surface-2);
  color: var(--text-3);
  font-size: 11.5px;
  font-weight: 550;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.keylist > li.is-off .kl-key,
.keylist > li.is-off .kl-use,
.keylist > li.is-off .kl-budget {
  opacity: 0.55;
}

.kl-key {
  min-width: 0;
}

.kl-name {
  display: block;
  overflow: hidden;
  color: var(--text);
  font-size: 14px;
  font-weight: 600;
  text-decoration: none;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.kl-name:hover {
  color: var(--accent);
}

.kl-mask {
  margin-top: 2px;
  overflow: hidden;
  color: var(--text-3);
  font-size: 11.5px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.kl-v {
  font: 500 13.5px/1.3 var(--font-mono);
  font-variant-numeric: tabular-nums;
}

.kl-v.word {
  font: 500 13px/1.3 var(--font-sans);
}

.kl-s {
  margin-top: 2px;
  overflow: hidden;
  color: var(--text-3);
  font-size: 11.5px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.kl-budget .meter {
  min-width: 0;
  margin-top: 6px;
}

.kl-actions {
  display: flex;
  flex-wrap: nowrap;
  justify-content: flex-end;
  gap: 4px;
}

.kl-actions .btn.danger-ghost:hover {
  border-color: var(--danger-border);
  background: var(--danger-wash);
  color: var(--danger);
}

@media (max-width: 1080px) {
  .keylist > li {
    grid-template-columns: minmax(0, 1fr) auto;
    grid-template-areas:
      'key status'
      'use budget'
      'rules last'
      'actions actions';
    gap: 10px 16px;
    align-items: start;
  }

  .keylist > .kl-head {
    display: none;
  }

  .keylist > li:nth-child(2) {
    border-top: 0;
  }

  .kl-key {
    grid-area: key;
  }

  .kl-status {
    grid-area: status;
    justify-self: end;
  }

  .kl-use {
    grid-area: use;
  }

  .kl-budget {
    grid-area: budget;
    min-width: 130px;
  }

  .kl-rules {
    grid-area: rules;
  }

  .kl-last {
    grid-area: last;
    min-width: 130px;
  }

  .kl-actions {
    grid-area: actions;
    justify-content: flex-start;
    padding-top: 4px;
  }
}

/* ── buttons ─────────────────────────────────────────────────────────────── */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  height: 36px;
  padding: 0 14px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-strong);
  background: var(--surface);
  color: var(--text);
  box-shadow: 0 1px 1px rgba(0, 0, 0, 0.12);
  font-size: 13.5px;
  font-weight: 500;
  cursor: pointer;
  white-space: nowrap;
  transition: background 0.12s var(--ease), border-color 0.12s var(--ease),
    opacity 0.12s var(--ease), box-shadow 0.16s var(--ease), transform 0.16s var(--ease);
}

.btn:hover:not(:disabled) {
  background: var(--surface-2);
  border-color: var(--border-hover);
}

.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.btn svg {
  width: 14px;
  height: 14px;
  flex: none;
}

/* The product's blue, lit from above, as the landing page's Send. */
.btn.primary {
  background: var(--btn-grad);
  border-color: transparent;
  color: var(--on-btn);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.22),
    var(--btn-glow);
}

.btn.primary:hover:not(:disabled) {
  background: var(--btn-grad-hover);
  border-color: transparent;
}

@media (prefers-reduced-motion: no-preference) {
  .btn.primary:hover:not(:disabled) {
    transform: translateY(-1px);
  }

  .btn.primary:active:not(:disabled) {
    transform: translateY(0) scale(0.985);
  }
}

.btn.ghost {
  background: transparent;
  border-color: transparent;
  box-shadow: none;
  color: var(--text-2);
}

.btn.ghost:hover:not(:disabled) {
  background: var(--surface-2);
  color: var(--text);
}

.btn.danger {
  color: var(--danger);
  border-color: var(--danger-border);
  background: transparent;
}

.btn.danger:hover:not(:disabled) {
  background: var(--danger-wash);
  border-color: var(--danger);
}

.btn.sm {
  height: 28px;
  padding: 0 10px;
  font-size: 12.5px;
  gap: 5px;
}

.btn.sm svg {
  width: 12px;
  height: 12px;
}

.btn.icon {
  width: 36px;
  padding: 0;
}

.btn.icon.sm {
  width: 28px;
}

.btn.block {
  width: 100%;
}

/* ── segmented control ──────────────────────────────────────────────────── */

.seg {
  display: inline-flex;
  padding: 3px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 999px;
  gap: 2px;
}

.seg button {
  border: 0;
  background: none;
  color: var(--text-3);
  font-size: 12.5px;
  font-weight: 500;
  padding: 5px 12px;
  border-radius: 999px;
  cursor: pointer;
  white-space: nowrap;
}

.seg button:hover {
  color: var(--text);
}

.seg button[aria-pressed="true"] {
  background: var(--surface);
  color: var(--text);
  box-shadow:
    0 0 0 1px var(--border),
    var(--shadow-1);
}

/* ── forms ───────────────────────────────────────────────────────────────── */

.field {
  display: flex;
  flex-direction: column;
  gap: 5px;
  min-width: 0;
}

.field > label,
.label {
  font-size: 12.5px;
  font-weight: 500;
  color: var(--text-2);
}

.field .hint {
  font-size: 12px;
  color: var(--text-3);
}

/* Fields are set into the card, a step darker than it. */
.input,
.select,
.textarea {
  width: 100%;
  background: var(--bg);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  color: var(--text);
  padding: 7px 11px;
  font-size: 13.5px;
  min-height: 36px;
  transition: border-color 0.12s var(--ease), box-shadow 0.12s var(--ease);
}

.input::placeholder,
.textarea::placeholder {
  color: var(--text-3);
}

.input:focus,
.select:focus,
.textarea:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 4px var(--accent-wash);
}

.input.mono,
.textarea.mono {
  font-family: var(--font-mono);
  font-size: 12.5px;
}

.textarea {
  resize: vertical;
  min-height: 76px;
  line-height: 1.55;
}

.select {
  appearance: none;
  background-image: linear-gradient(45deg, transparent 50%, var(--text-3) 50%),
    linear-gradient(135deg, var(--text-3) 50%, transparent 50%);
  background-position: calc(100% - 17px) 15px, calc(100% - 12px) 15px;
  background-size: 5px 5px, 5px 5px;
  background-repeat: no-repeat;
  padding-right: 32px;
}

.select option {
  background: var(--surface-2);
  color: var(--text);
}

.check {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  color: var(--text-2);
  cursor: pointer;
  user-select: none;
}

.check input {
  width: 15px;
  height: 15px;
  accent-color: var(--accent);
  cursor: pointer;
  flex: none;
}

.range {
  width: 100%;
  accent-color: var(--accent);
}

.form-error {
  background: var(--danger-wash);
  border: 1px solid var(--danger-border);
  color: var(--danger-text);
  border-radius: var(--radius-sm);
  padding: 8px 11px;
  font-size: 12.5px;
}

.form-ok {
  background: var(--ok-wash);
  border: 1px solid var(--ok-border);
  color: var(--ok-text);
  border-radius: var(--radius-sm);
  padding: 8px 11px;
  font-size: 12.5px;
}

/* ── tables ──────────────────────────────────────────────────────────────── */

.table-wrap {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

table.tbl {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
  min-width: 520px;
}

table.tbl th {
  text-align: left;
  font: 500 10.5px/1.3 var(--font-mono);
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--text-3);
  padding: 10px 12px;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
  background: var(--surface);
  position: sticky;
  top: 0;
  z-index: 1;
}

table.tbl td {
  padding: 10px 12px;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}

table.tbl tbody tr:last-child td {
  border-bottom: 0;
}

table.tbl tbody tr.clickable {
  cursor: pointer;
}

table.tbl tbody tr.clickable:hover {
  background: var(--surface-hover);
}

table.tbl td.right,
table.tbl th.right {
  text-align: right;
  font-variant-numeric: tabular-nums;
}

.pager {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-top: 1px solid var(--border);
  font-size: 12px;
  color: var(--text-3);
  flex-wrap: wrap;
}

.pager .spacer {
  flex: 1 1 auto;
}

/* ── badges & meters ─────────────────────────────────────────────────────── */

.badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 1px 8px;
  border-radius: 999px;
  font-size: 11.5px;
  font-weight: 550;
  border: 1px solid var(--border-strong);
  background: var(--surface-2);
  color: var(--text-2);
  white-space: nowrap;
}

.badge .dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: currentColor;
  flex: none;
}

.badge.ok {
  color: var(--ok);
  border-color: var(--ok-border);
  background: var(--ok-wash);
}

.badge.warn {
  color: var(--warn);
  border-color: var(--warn-border);
  background: var(--warn-wash);
}

.badge.danger {
  color: var(--danger);
  border-color: var(--danger-border);
  background: var(--danger-wash);
}

.badge.accent {
  color: var(--accent);
  border-color: var(--accent-border);
  background: var(--accent-wash);
}

.meter {
  height: 5px;
  border-radius: 999px;
  background: var(--surface-3);
  overflow: hidden;
  min-width: 70px;
}

.meter > i {
  display: block;
  height: 100%;
  border-radius: 999px;
  background: var(--accent);
}

.meter.warn > i {
  background: var(--warn);
}

.meter.danger > i {
  background: var(--danger);
}

/* ── code blocks ─────────────────────────────────────────────────────────── */

/* Ink in both themes, like the landing page's code card. */
.code {
  position: relative;
  background: var(--code-bg);
  border: 1px solid var(--code-rule);
  border-radius: var(--radius);
  overflow: hidden;
}

.code-lang {
  position: absolute;
  top: 11px;
  left: 16px;
  font-family: var(--font-mono);
  font-size: 10.5px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--code-dim);
  pointer-events: none;
}

.code:has(.code-lang) pre {
  padding-top: 32px;
}

.code pre {
  margin: 0;
  padding: 14px 48px 16px 16px;
  overflow-x: auto;
  font-family: var(--font-mono);
  font-size: 12.5px;
  line-height: 1.7;
  color: var(--code-text);
  tab-size: 2;
}

.code .copy {
  position: absolute;
  top: 8px;
  right: 8px;
  opacity: 0;
  transition: opacity 0.12s var(--ease);
}

.code .copy .btn {
  border-color: var(--code-rule);
  background: #1b1c22;
  color: var(--code-text);
  box-shadow: none;
}

.code .copy .btn:hover:not(:disabled) {
  border-color: var(--code-dim);
  background: #24252c;
}

.code:hover .copy,
.code:focus-within .copy {
  opacity: 1;
}

/* Touch devices never hover — keep the affordance visible there. */
@media (hover: none) {
  .code .copy {
    opacity: 1;
  }
}

.copy-inline {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.key-reveal {
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--surface-2);
  border: 1px dashed var(--accent-dim);
  border-radius: var(--radius);
  padding: 10px 12px;
  font-family: var(--font-mono);
  font-size: 12.5px;
  word-break: break-all;
  color: var(--text);
}

.key-reveal .k {
  flex: 1 1 auto;
  min-width: 0;
}

/* ── empty / loading states ─────────────────────────────────────────────── */

.empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  padding: 44px 20px;
  text-align: center;
  color: var(--text-3);
}

.empty svg {
  width: 26px;
  height: 26px;
  opacity: 0.55;
}

.empty .t {
  color: var(--text-2);
  font-weight: 550;
  font-size: 13.5px;
}

.empty .d {
  font-size: 12.5px;
  max-width: 46ch;
}

.loading-block {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 56px 0;
  color: var(--text-3);
  font-size: 13px;
}

.skeleton {
  background: linear-gradient(90deg, var(--surface-2) 25%, var(--surface-3) 37%, var(--surface-2) 63%);
  background-size: 400% 100%;
  animation: shimmer 1.4s ease infinite;
  border-radius: 6px;
}

@keyframes shimmer {
  0% {
    background-position: 100% 0;
  }
  100% {
    background-position: 0 0;
  }
}

.is-stale {
  opacity: 0.45;
  transition: opacity 0.15s var(--ease);
}

/* ── charts ──────────────────────────────────────────────────────────────── */

.chart {
  position: relative;
  width: 100%;
  min-width: 0;
}

.chart svg {
  display: block;
  width: 100%;
  overflow: visible;
  touch-action: pan-y;
}

.chart svg:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
  border-radius: 6px;
}

.chart .axis-text {
  font-size: 10.5px;
  fill: var(--text-3);
  font-variant-numeric: tabular-nums;
  font-family: var(--font-sans);
}

.chart .mark-label {
  font-size: 11px;
  fill: var(--text-2);
  font-family: var(--font-sans);
  font-variant-numeric: tabular-nums;
}

.chart .mark-name {
  font-size: 12px;
  fill: var(--text);
  font-family: var(--font-sans);
}

.chart-tip {
  position: absolute;
  pointer-events: none;
  z-index: 20;
  min-width: 132px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-2);
  padding: 9px 11px;
  font-size: 12px;
  transform: translate(-50%, -100%);
  transition: opacity 0.1s var(--ease);
  white-space: nowrap;
}

.chart-tip .x {
  color: var(--text-3);
  font-size: 11px;
  margin-bottom: 5px;
}

.chart-tip .r {
  display: flex;
  align-items: center;
  gap: 8px;
  line-height: 1.5;
}

.chart-tip .r .k {
  width: 12px;
  height: 2px;
  border-radius: 2px;
  flex: none;
}

.chart-tip .r .v {
  font-weight: 620;
  font-variant-numeric: tabular-nums;
  margin-left: auto;
  padding-left: 10px;
}

.chart-tip .r .n {
  color: var(--text-3);
}

/* A stacked column's parts are blocks, so their keys are too. */
.chart-tip .r .k.sq {
  width: 9px;
  height: 9px;
  border-radius: 2px;
}

.chart-tip .r.total {
  margin-top: 5px;
  padding-top: 5px;
  border-top: 1px solid var(--border);
}

.chart-tip .r.total .n {
  color: var(--text-2);
  font-weight: 600;
}

.legend {
  display: flex;
  gap: 14px;
  flex-wrap: wrap;
  font-size: 12px;
  color: var(--text-2);
}

.legend .item {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.legend .swatch {
  width: 13px;
  height: 3px;
  border-radius: 2px;
  flex: none;
}

.legend .swatch.rect {
  width: 10px;
  height: 10px;
  border-radius: 3px;
}

details.data-table {
  margin-top: 10px;
  border-top: 1px solid var(--border);
  padding-top: 8px;
}

details.data-table > summary {
  cursor: pointer;
  font-size: 11.5px;
  color: var(--text-3);
  list-style: none;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

details.data-table > summary::-webkit-details-marker {
  display: none;
}

details.data-table > summary::before {
  content: "▸";
  font-size: 9px;
}

details.data-table[open] > summary::before {
  content: "▾";
}

details.data-table > summary:hover {
  color: var(--text-2);
}

details.data-table .table-wrap {
  max-height: 260px;
  overflow: auto;
  margin-top: 8px;
}

details.data-table table.tbl {
  min-width: 0;
  font-size: 12px;
}

/* ── dialog ──────────────────────────────────────────────────────────────── */

.scrim {
  position: fixed;
  inset: 0;
  background: var(--scrim);
  backdrop-filter: blur(2px);
  z-index: 100;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding: 6vh 16px 24px;
  overflow-y: auto;
  animation: fade 0.13s var(--ease);
}

@keyframes fade {
  from {
    opacity: 0;
  }
}

.dialog {
  width: 100%;
  max-width: 520px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 18px;
  box-shadow: var(--shadow-3);
  animation: pop 0.15s var(--ease);
}

.dialog.wide {
  max-width: 780px;
}

@keyframes pop {
  from {
    transform: translateY(8px) scale(0.99);
    opacity: 0;
  }
}

.dialog header {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
}

.dialog header h3 {
  font: 400 21px/1.2 var(--font-display);
  letter-spacing: -0.025em;
}

.dialog header .btn {
  margin-left: auto;
}

.dialog .body {
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.dialog footer {
  display: flex;
  gap: 8px;
  justify-content: flex-end;
  padding: 14px 20px;
  border-top: 1px solid var(--border);
  flex-wrap: wrap;
}

.dl {
  display: grid;
  grid-template-columns: minmax(110px, auto) minmax(0, 1fr);
  gap: 6px 14px;
  font-size: 12.5px;
}

.dl dt {
  color: var(--text-3);
}

/* Every .dl in the app lists counts, money, ids or URLs, so the values take
   the mono, like the line items on the landing page's receipt. */
.dl dd {
  margin: 0;
  word-break: break-word;
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
}

/* ── toasts ──────────────────────────────────────────────────────────────── */

.toasts {
  position: fixed;
  right: 16px;
  bottom: 16px;
  z-index: 200;
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-width: min(360px, calc(100vw - 32px));
}

.toast {
  display: flex;
  align-items: flex-start;
  gap: 9px;
  background: var(--glass-bg);
  -webkit-backdrop-filter: blur(16px);
  backdrop-filter: blur(16px);
  border: 1px solid var(--border-strong);
  border-left: 3px solid var(--accent);
  border-radius: var(--radius);
  box-shadow: var(--shadow-2);
  padding: 11px 14px;
  font-size: 13.5px;
  animation: slide-in 0.16s var(--ease);
}

.toast.ok {
  border-left-color: var(--ok);
}

.toast.err {
  border-left-color: var(--danger);
}

@keyframes slide-in {
  from {
    transform: translateX(12px);
    opacity: 0;
  }
}

/* ── auth screen ─────────────────────────────────────────────────────────── */

/* The handoff from the landing page: the same prism of colour behind a large
   headline, the same type and the same white cards, so "Create a free
   account" does not land on what looks like another product. The no-JS and
   boot-error fallbacks render a bare .auth-card straight inside .auth, so the
   card has to stand on its own too. */
.auth {
  position: relative;
  isolation: isolate;
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 56px 24px;
  overflow: hidden;
  background: var(--bg);
}

/* The landing page's night: a glow up where the light comes in, a field of
   dots fading out from it, and the glass V hanging over the welcome. */
.auth-sky {
  position: absolute;
  inset: 0;
  z-index: -1;
  pointer-events: none;
}

.auth-sky > i {
  position: absolute;
  inset: 0;
}

.auth-glow {
  background:
    radial-gradient(38% 42% at 28% 16%, rgba(96, 116, 255, 0.26), transparent 72%),
    radial-gradient(30% 34% at 76% 72%, rgba(183, 148, 246, 0.1), transparent 70%),
    radial-gradient(40% 30% at 50% 100%, rgba(79, 209, 165, 0.05), transparent 70%),
    linear-gradient(180deg, #070912, var(--bg) 72%);
}

.auth-dots {
  background: radial-gradient(circle at 1px 1px, rgba(255, 255, 255, 0.12) 1px, transparent 1.4px) 0 0 / 28px 28px;
  opacity: 0.5;
  -webkit-mask-image: radial-gradient(60% 56% at 32% 28%, #000 10%, transparent 76%);
  mask-image: radial-gradient(60% 56% at 32% 28%, #000 10%, transparent 76%);
}

[data-theme='light'] .auth-glow {
  background:
    radial-gradient(38% 42% at 28% 16%, rgba(29, 63, 216, 0.1), transparent 72%),
    radial-gradient(30% 34% at 76% 72%, rgba(124, 58, 237, 0.06), transparent 70%);
}

[data-theme='light'] .auth-dots {
  background-image: radial-gradient(circle at 1px 1px, rgba(10, 10, 11, 0.12) 1px, transparent 1.4px);
}

.auth-v {
  display: block;
  width: clamp(140px, 14vw, 190px);
  height: auto;
  margin: 0 0 30px -4px;
  filter: drop-shadow(0 22px 44px rgba(48, 70, 220, 0.42));
}

@media (prefers-reduced-motion: no-preference) {
  .auth-v {
    animation:
      auth-v-in 1.1s var(--ease) both,
      auth-hover 7s ease-in-out 1.1s infinite alternate;
  }
}

@keyframes auth-v-in {
  from {
    opacity: 0;
    transform: translateY(-12px) scale(0.96);
  }
}

@keyframes auth-hover {
  to {
    transform: translateY(-8px);
  }
}

.auth-sheet {
  position: relative;
  width: 100%;
  max-width: 1040px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(320px, 420px);
  grid-template-areas:
    'head card'
    'clauses card';
  gap: 0 clamp(40px, 7vw, 104px);
  align-items: start;
}

.auth-head {
  grid-area: head;
  align-self: end;
}

.auth-sheet > .auth-card {
  grid-area: card;
  align-self: center;
}

.auth-brand {
  --brand-h: 30px;
  display: inline-flex;
  align-items: center;
  color: var(--text);
  font-size: 19px;
  font-weight: 600;
  letter-spacing: -0.025em;
}

.auth-head .auth-brand {
  margin-bottom: 36px;
}

a.auth-brand:hover {
  color: var(--text);
}

.auth-title {
  margin-bottom: 20px;
  font: 300 clamp(38px, 4.4vw, 62px) / 1 var(--font-display);
  letter-spacing: -0.05em;
  text-wrap: balance;
}

/* The end of the title carries the light, as in the landing page's headlines. */
.auth-title em {
  font-style: normal;
}

@supports ((-webkit-background-clip: text) or (background-clip: text)) {
  .auth-title em {
    background: var(--spectrum-text);
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
    -webkit-box-decoration-break: clone;
    box-decoration-break: clone;
  }
}

.auth-lede {
  max-width: 28em;
  color: var(--text-3);
  font-size: 19px;
  line-height: 1.5;
}

/* The same promises as the landing page, each under an icon the way its
   features are set. */
.auth-clauses {
  grid-area: clauses;
  display: grid;
  gap: 18px;
  margin: 40px 0 0;
  padding: 0;
  list-style: none;
}

.auth-clauses li {
  display: grid;
  grid-template-columns: 36px minmax(0, 1fr);
  gap: 14px;
  align-items: start;
  color: var(--text-3);
  font-size: 14.5px;
  line-height: 1.55;
}

.auth-clause-icon {
  display: grid;
  place-items: center;
  width: 36px;
  height: 36px;
  border-radius: var(--radius);
  background: var(--accent-wash);
  color: var(--accent);
}

.auth-clause-icon svg {
  width: 18px;
  height: 18px;
}

.auth-clauses p {
  padding-top: 7px;
}

.auth-clauses strong {
  color: var(--text);
  font-weight: 600;
}

/* Smoked glass over the night, lit along its top edge. */
.auth-card {
  width: 100%;
  max-width: 420px;
  padding: 30px;
  display: flex;
  flex-direction: column;
  gap: 20px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.04), rgba(255, 255, 255, 0) 40%),
    var(--glass-bg);
  -webkit-backdrop-filter: blur(20px);
  backdrop-filter: blur(20px);
  border: 1px solid var(--border-strong);
  border-radius: 24px;
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.05),
    var(--shadow-3);
}

/* Two modes, marked with an underline the way the landing marks its tabs. */
.auth-tabs {
  display: flex;
  gap: 24px;
  border-bottom: 1px solid var(--border);
}

.auth-tabs button {
  position: relative;
  padding: 0 0 13px;
  border: 0;
  background: none;
  color: var(--text-3);
  font-size: 14.5px;
  font-weight: 500;
  cursor: pointer;
}

.auth-tabs button:hover,
.auth-tabs button[aria-selected="true"] {
  color: var(--text);
}

.auth-tabs button[aria-selected="true"]::after {
  content: '';
  position: absolute;
  left: 0;
  right: 0;
  bottom: -1px;
  height: 2px;
  border-radius: 2px 2px 0 0;
  background: var(--accent);
}

.auth .input {
  min-height: 44px;
  font-size: 15px;
}

.auth .btn.primary.block {
  height: 48px;
  border-radius: var(--radius);
  font-size: 15.5px;
}

.auth-foot {
  text-align: center;
  font-size: 13px;
  color: var(--text-3);
  line-height: 1.6;
}

/* Laid out, not shown, until the session probe says how the site signs in. */
.auth-card.is-pending > * {
  visibility: hidden;
}

/* Privy sign-in: Google, X, then a code by email. */
.auth-providers {
  display: grid;
  gap: 10px;
}

.auth-providers .btn {
  height: 46px;
  gap: 9px;
  border-radius: var(--radius);
  font-size: 14.5px;
}

.auth-providers .btn svg {
  width: 17px;
  height: 17px;
}

.auth-divider {
  display: flex;
  align-items: center;
  gap: 12px;
  color: var(--text-3);
  font-size: 12.5px;
}

.auth-divider::before,
.auth-divider::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--border);
}

.auth-note {
  margin: 0;
  color: var(--text-2);
  font-size: 14px;
  line-height: 1.55;
  overflow-wrap: anywhere;
}

.auth .input.auth-code {
  font-size: 18px;
  letter-spacing: 0.25em;
  font-variant-numeric: tabular-nums;
}

.auth-busy {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  min-height: 140px;
  color: var(--text-2);
  font-size: 14.5px;
}

@media (max-width: 860px) {
  .auth {
    place-items: start center;
    padding-top: 36px;
  }

  .auth-sheet {
    max-width: 460px;
    grid-template-columns: minmax(0, 1fr);
    grid-template-areas:
      'head'
      'card'
      'clauses';
    gap: 28px;
  }

  .auth-head .auth-brand {
    margin-bottom: 28px;
  }

  .auth-title {
    font-size: clamp(34px, 8.8vw, 44px);
  }

  .auth-v {
    width: 120px;
    margin-bottom: 22px;
  }

  .auth-lede {
    font-size: 17px;
  }

  .auth-sheet > .auth-card {
    max-width: none;
  }

  .auth-card {
    padding: 24px;
  }

  .auth-clauses {
    margin-top: 0;
  }
}

/* ── models ──────────────────────────────────────────────────────────────── */

/* A maker's logo, in a tile. The colour logos keep their own colours; the
   one-colour ones (OpenAI, xAI) take the text colour, so either theme reads
   them. See src/web/lib/vendor-logos.js. */
.vendor-logo {
  display: inline-grid;
  place-items: center;
  flex: none;
  width: 36px;
  height: 36px;
  border-radius: 10px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  color: var(--text);
}

.vendor-logo svg {
  display: block;
  width: 22px;
  height: 22px;
}

.vendor-logo.lg {
  width: 40px;
  height: 40px;
  border-radius: 11px;
}

.vendor-logo.lg svg {
  width: 24px;
  height: 24px;
}

.vendor-logo.sm {
  width: 18px;
  height: 18px;
  border: 0;
  border-radius: 5px;
  background: none;
}

.vendor-logo.sm svg {
  width: 16px;
  height: 16px;
}

/* stroke icons standing in for a logo: image models, the marketplace */
.vendor-logo svg[stroke] {
  color: var(--text-2);
}

.vendor-logo.initial {
  font-size: 14px;
  font-weight: 650;
  color: var(--text-2);
}

.vendor-logo.sm.initial {
  font-size: 11px;
}

/* search, type, sort and layout, on one line while there is room */
.models-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}

.models-toolbar .search {
  position: relative;
  flex: 1 1 240px;
  min-width: 0;
}

.models-toolbar .search > svg {
  position: absolute;
  left: 11px;
  top: 50%;
  width: 15px;
  height: 15px;
  transform: translateY(-50%);
  color: var(--text-3);
  pointer-events: none;
}

.models-toolbar .search .input {
  padding-left: 33px;
}

.models-toolbar .select {
  width: auto;
  min-width: 150px;
}

.view-toggle button {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.view-toggle svg {
  width: 14px;
  height: 14px;
}

/* the makers, as logo chips: a filter, and the catalogue's table of contents */
.maker-rail {
  display: flex;
  gap: 6px;
  padding: 2px 1px 4px;
  overflow-x: auto;
  scrollbar-width: none;
}

.maker-rail::-webkit-scrollbar {
  display: none;
}

.maker-chip {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  flex: none;
  height: 32px;
  padding: 0 12px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--surface);
  color: var(--text-2);
  font-size: 12.5px;
  font-weight: 500;
  white-space: nowrap;
  cursor: pointer;
  transition:
    border-color 0.12s var(--ease),
    background 0.12s var(--ease),
    color 0.12s var(--ease);
}

.maker-chip:has(.vendor-logo) {
  padding-left: 8px;
}

.maker-chip .n {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--text-3);
}

.maker-chip:hover {
  border-color: var(--border-strong);
  color: var(--text);
}

.maker-chip[aria-pressed="true"] {
  border-color: var(--accent-border);
  background: var(--accent-wash);
  color: var(--text);
}

.maker-chip[aria-pressed="true"] .n {
  color: var(--accent);
}

.maker-chip:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

/* one maker's models, under its logo */
.model-group {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.model-group + .model-group {
  margin-top: 12px;
}

.model-group-head {
  display: flex;
  align-items: center;
  gap: 12px;
}

.model-group-title {
  display: flex;
  flex-direction: column;
  gap: 1px;
  min-width: 0;
}

.model-group-title h3 {
  margin: 0;
  font-size: 15px;
  font-weight: 600;
  letter-spacing: -0.01em;
}

.model-group-title .note {
  font-size: 12px;
  color: var(--text-3);
}

.model-group-head .rule {
  flex: 1;
  min-width: 24px;
  height: 1px;
  margin-left: 6px;
  background: var(--border);
}

/* the same width in every group: a maker with one model gets one card's width */
.grid.models-grid {
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
}

/* the card */
.model-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  min-width: 0;
  transition:
    border-color 0.12s var(--ease),
    box-shadow 0.12s var(--ease);
}

.model-card:hover {
  border-color: var(--border-strong);
  box-shadow: var(--shadow-1);
}

.model-card.off {
  opacity: 0.6;
}

@media (prefers-reduced-motion: no-preference) {
  .model-card.rise {
    animation: model-rise 0.38s var(--ease) both;
  }
}

@keyframes model-rise {
  from {
    opacity: 0;
    transform: translateY(6px);
  }
}

.mc-head {
  display: flex;
  align-items: flex-start;
  gap: 12px;
}

.mc-title {
  flex: 1;
  min-width: 0;
}

.mc-title h4 {
  margin: 1px 0 0;
  font-size: 14.5px;
  font-weight: 600;
  line-height: 1.3;
  letter-spacing: -0.012em;
  overflow-wrap: anywhere;
}

/* the id a request names, with a copy button that shows on hover */
.mc-id {
  display: flex;
  align-items: center;
  gap: 2px;
  min-width: 0;
  margin-top: 1px;
}

.mc-id code {
  min-width: 0;
  font-family: var(--font-mono);
  font-size: 11.5px;
  color: var(--text-3);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.mc-id .btn {
  flex: none;
  width: 22px;
  height: 22px;
  min-height: 0;
  padding: 0;
  opacity: 0;
  transition: opacity 0.12s var(--ease);
}

.mc-id .btn svg {
  width: 12px;
  height: 12px;
}

.model-card:hover .mc-id .btn,
.tbl tr:hover .mc-id .btn,
.mc-id .btn:focus-visible {
  opacity: 1;
}

@media (hover: none) {
  .mc-id .btn {
    opacity: 1;
  }
}

.mc-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 4px 8px;
  font-size: 12px;
  color: var(--text-3);
}

.mc-meta > span:not(.badge) ~ span:not(.badge)::before {
  content: '·';
  margin-right: 8px;
}

/* input and output side by side, the figures that matter most */
.mc-prices {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface-2);
  overflow: hidden;
}

.mc-prices .p {
  min-width: 0;
  padding: 9px 12px 10px;
}

.mc-prices .p + .p {
  border-left: 1px solid var(--border);
}

/* an image model's sizes, on one row */
.mc-prices.tiers {
  grid-template-columns: none;
  grid-auto-flow: column;
  grid-auto-columns: minmax(0, 1fr);
}

.mc-prices .k {
  font-size: 11px;
  color: var(--text-3);
}

.mc-prices .k .u {
  opacity: 0.75;
}

.mc-prices .v {
  margin-top: 2px;
  font-family: var(--font-mono);
  font-size: 16px;
  font-weight: 600;
  letter-spacing: -0.02em;
  font-variant-numeric: tabular-nums;
  overflow-wrap: anywhere;
}

.mc-prices.tiers .v {
  font-size: 14px;
}

.mc-sub {
  margin-top: -6px;
  font-size: 11.5px;
  color: var(--text-3);
  font-variant-numeric: tabular-nums;
}

.mc-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  min-height: 24px;
  margin-top: auto;
}

.mc-save {
  min-width: 0;
  font-size: 12px;
  font-weight: 600;
  color: var(--accent);
  font-variant-numeric: tabular-nums;
}

.mc-try {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  flex: none;
  padding: 3px 5px 3px 10px;
  border-radius: 999px;
  font-size: 12.5px;
  font-weight: 550;
  color: var(--text-2);
  text-decoration: none;
  transition:
    color 0.12s var(--ease),
    background 0.12s var(--ease);
}

.mc-try svg {
  width: 13px;
  height: 13px;
  transition: transform 0.14s var(--ease);
}

.mc-try:hover {
  color: var(--accent);
  background: var(--accent-wash);
}

.mc-try:hover svg {
  transform: translateX(2px);
}

.mc-note {
  padding-top: 8px;
  border-top: 1px dashed var(--border);
  font-size: 11.5px;
  color: var(--text-3);
}

/* the compare table */
.mt-model {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.mt-name {
  min-width: 0;
}

.mt-name strong {
  font-weight: 600;
}

.mt-save {
  font-weight: 600;
  color: var(--accent);
  font-variant-numeric: tabular-nums;
}

.admin-strip {
  border-top: 1px dashed var(--border-strong);
  padding-top: 10px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  font-size: 12px;
}

/* ── playground ──────────────────────────────────────────────────────────── */

.pg {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 300px;
  gap: 14px;
  align-items: start;
}

@media (max-width: 1040px) {
  .pg {
    grid-template-columns: minmax(0, 1fr);
  }
  .pg .pg-side {
    order: -1;
  }
}

.pg-chat {
  display: flex;
  flex-direction: column;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  min-height: 420px;
}

.pg-log {
  flex: 1 1 auto;
  overflow-y: auto;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 14px;
  max-height: min(58vh, 620px);
  min-height: 240px;
}

.msg {
  display: flex;
  gap: 10px;
  min-width: 0;
}

.msg .who {
  width: 26px;
  height: 26px;
  border-radius: 7px;
  flex: none;
  display: grid;
  place-items: center;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.03em;
  background: var(--surface-3);
  color: var(--text-2);
}

.msg.user .who {
  background: var(--accent-wash-strong);
  color: var(--accent);
}

.msg .bubble {
  min-width: 0;
  flex: 1 1 auto;
}

.msg .content {
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  font-size: 13.5px;
  line-height: 1.62;
}

.msg .meta {
  margin-top: 6px;
  font-size: 11px;
  color: var(--text-3);
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  font-variant-numeric: tabular-nums;
}

.msg.err .content {
  color: var(--danger-text);
}

.caret {
  display: inline-block;
  width: 7px;
  height: 14px;
  background: var(--accent);
  vertical-align: text-bottom;
  animation: blink 1s steps(2, start) infinite;
  margin-left: 1px;
}

@keyframes blink {
  50% {
    opacity: 0;
  }
}

.pg-compose {
  border-top: 1px solid var(--border);
  padding: 10px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  background: var(--surface);
}

.pg-compose textarea {
  min-height: 62px;
  max-height: 220px;
}

.pg-compose .bar {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.pg-compose .bar .spacer {
  flex: 1 1 auto;
}

kbd {
  font-family: var(--font-mono);
  font-size: 10.5px;
  border: 1px solid var(--border-strong);
  border-bottom-width: 2px;
  border-radius: 4px;
  padding: 0 4px;
  color: var(--text-3);
  background: var(--surface-2);
}

/* ── docs ────────────────────────────────────────────────────────────────── */

.tabs {
  display: flex;
  gap: 4px;
  border-bottom: 1px solid var(--border);
  overflow-x: auto;
  margin-bottom: 14px;
}

.tabs button {
  border: 0;
  background: none;
  padding: 8px 12px;
  color: var(--text-3);
  font-size: 13px;
  font-weight: 550;
  cursor: pointer;
  border-bottom: 2px solid transparent;
  white-space: nowrap;
}

.tabs button:hover {
  color: var(--text-2);
}

.tabs button[aria-selected="true"] {
  color: var(--text);
  border-bottom-color: var(--accent);
}

.callout {
  display: flex;
  gap: 10px;
  padding: 12px 14px;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: var(--surface-2);
  font-size: 13px;
  color: var(--text-2);
}

.callout svg {
  width: 15px;
  height: 15px;
  flex: none;
  margin-top: 1px;
  color: var(--accent);
}

.callout.warn {
  border-color: var(--warn-border);
  background: var(--warn-wash);
}

.callout.warn svg {
  color: var(--warn);
}

/* ── credits ─────────────────────────────────────────────────────────────── */

/* The balance: the figure and what it means for the customer's requests on
   top, the month's numbers in a strip underneath. */
.balance {
  position: relative;
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--card-shadow);
  overflow: hidden;
}

/* The prism's spectrum along the top edge, as on the Overview. */
.balance::before {
  content: '';
  position: absolute;
  inset: 0 0 auto;
  height: 2px;
  background: var(--spectrum);
  box-shadow: 0 0 18px rgba(124, 147, 255, 0.45);
}

.balance-main {
  padding: 26px 26px 24px;
}

.balance .label {
  font: 500 10.5px/1.35 var(--font-mono);
  color: var(--text-3);
  letter-spacing: 0.14em;
  text-transform: uppercase;
  margin-bottom: 8px;
}

.balance .figure {
  font-family: var(--font-display);
  font-size: 52px;
  line-height: 1;
  font-weight: 300;
  letter-spacing: -0.025em;
  font-variant-numeric: lining-nums tabular-nums;
}

.balance .figure.neg {
  color: var(--danger);
}

.outlook {
  display: flex;
  align-items: baseline;
  gap: 8px;
  margin-top: 10px;
  font-size: 13.5px;
  color: var(--text-2);
}

.outlook .dot {
  flex: none;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--ok);
  transform: translateY(-1px);
}

.outlook.warn .dot {
  background: var(--warn);
}

.outlook.danger {
  color: var(--danger-text);
}

.outlook.danger .dot {
  background: var(--danger);
}

.balance .fine {
  margin-top: 4px;
  font-size: 12.5px;
  color: var(--text-3);
}

.balance-stats {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  border-top: 1px solid var(--border);
  background: var(--surface-2);
}

.balance-stats > div {
  min-width: 0;
  padding: 13px 24px 14px;
  border-left: 1px solid var(--border);
}

.balance-stats > div:first-child {
  border-left: 0;
}

.balance-stats .k {
  font-size: 11.5px;
  color: var(--text-3);
}

.balance-stats .v {
  margin-top: 1px;
  font-family: var(--font-mono);
  font-size: 17px;
  font-weight: 500;
  letter-spacing: -0.02em;
  font-variant-numeric: tabular-nums;
}

/* A heading for a part of the page, a step above a card's own. */
.section-head {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  min-height: 32px;
  margin-top: 14px;
}

.section-head h3 {
  font: 400 24px/1.1 var(--font-display);
  letter-spacing: -0.03em;
}

.section-head .sub {
  font-size: 12.5px;
  color: var(--text-3);
}

.section-head .right {
  margin-left: auto;
}

/* Ways to add credit: how to pay on the left, at full height; a voucher, and
   what has arrived, beside it. */
.fund {
  display: grid;
  gap: 14px;
  grid-template-columns: minmax(0, 1.7fr) minmax(0, 1fr);
  grid-template-rows: auto 1fr;
  grid-template-areas:
    'pay voucher'
    'pay recent';
}

/* Nothing has arrived, or could: the voucher has the side to itself. */
.fund.no-recent {
  grid-template-rows: auto;
  grid-template-areas: 'pay voucher';
}

.fund-pay {
  grid-area: pay;
}

.fund-voucher {
  grid-area: voucher;
}

.fund-recent {
  grid-area: recent;
}

.deposit {
  display: flex;
  flex-direction: column;
  gap: 18px;
}

/* Inside, the panels space themselves. */
.fund-pay .card-head {
  margin-bottom: 0;
}

/* Where a form's outcome is reported: no room taken until there is one. */
.form-note:empty {
  display: none;
}

.deposit-top {
  display: flex;
  align-items: flex-start;
  gap: 22px;
}

.qr {
  flex: none;
  width: 156px;
}

/* White in both themes: a reader expects a dark code on a light ground. */
.qr-tile {
  border: 1px solid var(--border);
  border-radius: 12px;
  background: #fff;
  overflow: hidden;
  line-height: 0;
}

.qr-tile svg {
  display: block;
  width: 100%;
  height: auto;
}

.qr-caption {
  margin-top: 7px;
  text-align: center;
  font-size: 11.5px;
  color: var(--text-3);
}

.deposit-address {
  display: flex;
  flex-direction: column;
  gap: 10px;
  min-width: 0;
  padding-top: 2px;
}

/* The ends are what people check an address by, so they carry the weight. One
   click selects the whole of it. */
.address {
  font-family: var(--font-mono);
  font-size: 16.5px;
  line-height: 1.5;
  letter-spacing: -0.01em;
  color: var(--text-3);
  word-break: break-all;
  user-select: all;
}

.address b {
  font-weight: 600;
  color: var(--text);
}

.deposit-address .sub {
  max-width: 46ch;
  font-size: 12.5px;
  color: var(--text-3);
}

/* A label sits close to what it names. */
.deposit-address .label + .exact,
.deposit-address .label + .address {
  margin-top: -6px;
}

/* The part of a panel that changes as the customer goes: spaced as the panel is. */
.deposit-body {
  display: flex;
  flex-direction: column;
  gap: 18px;
}

/* A code that carries an amount as well as an address is denser, so it is drawn larger. */
.qr.wide {
  width: 184px;
}

/* The amount, to the cent, is the whole instruction: nothing on the card is larger. */
.exact {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 4px 10px;
}

.exact .num {
  font-size: 30px;
  font-weight: 500;
  line-height: 1.1;
  letter-spacing: -0.04em;
  user-select: all;
}

.exact .unit {
  font-size: 14px;
  color: var(--text-3);
}

.facts {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px 22px;
  padding-top: 16px;
  border-top: 1px solid var(--border);
}

.facts .k {
  font-size: 11.5px;
  color: var(--text-3);
}

.facts .v {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0 6px;
  min-height: 24px;
  font-size: 13px;
}

.facts .v .btn {
  margin: -2px 0 -2px -2px;
}

.live {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  font-size: 12px;
  color: var(--text-3);
  white-space: nowrap;
}

.live i {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--ok);
  animation: live 2.2s var(--ease) infinite;
}

.live.off i {
  background: var(--text-3);
  animation: none;
}

@keyframes live {
  0% {
    box-shadow: 0 0 0 0 var(--ok-border);
  }
  70%,
  100% {
    box-shadow: 0 0 0 6px transparent;
  }
}

.steps {
  display: flex;
  flex-direction: column;
  gap: 13px;
  margin: 0;
  padding: 0;
  list-style: none;
  counter-reset: step;
}

.steps li {
  display: grid;
  grid-template-columns: 22px minmax(0, 1fr);
  gap: 11px;
  font-size: 12.5px;
  color: var(--text-3);
  counter-increment: step;
}

.steps li::before {
  content: counter(step);
  display: grid;
  place-items: center;
  width: 22px;
  height: 22px;
  border: 1px solid var(--border-strong);
  border-radius: 50%;
  font-family: var(--font-mono);
  font-size: 11.5px;
  color: var(--text-2);
}

.steps b {
  display: block;
  font-size: 13px;
  font-weight: 550;
  color: var(--text);
}

.deposits {
  display: flex;
  flex-direction: column;
  margin: 0;
  padding: 0;
  list-style: none;
}

.deposits li {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 3px 12px;
  padding: 11px 0;
  border-top: 1px solid var(--border);
}

.deposits li:first-child {
  padding-top: 2px;
  border-top: 0;
}

.deposits li:last-child {
  padding-bottom: 2px;
}

.deposits .amt {
  font-size: 15px;
  font-weight: 500;
  letter-spacing: -0.02em;
}

.deposits .amt.ok {
  color: var(--ok);
}

.deposits .meta {
  grid-column: 1 / -1;
  display: flex;
  flex-wrap: wrap;
  gap: 2px 10px;
  font-size: 12px;
  color: var(--text-3);
}

/* A deposit that landed while the page was open. */
.deposits li.is-new {
  animation: arrived 2.6s var(--ease);
}

@keyframes arrived {
  from {
    box-shadow: -18px 0 0 var(--ok-wash), 18px 0 0 var(--ok-wash);
    background: var(--ok-wash);
  }
}

.tx-link {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: inherit;
  color: inherit;
  text-decoration: underline;
  text-decoration-color: var(--border-strong);
  text-underline-offset: 3px;
}

.tx-link:hover {
  color: var(--accent);
  text-decoration-color: currentColor;
}

.tx-link svg {
  flex: none;
  width: 11px;
  height: 11px;
}

/* ── rewards ─────────────────────────────────────────────────────────────── */

/* One linked wallet a row: which it is, what it holds now, what it has held
   on average this period, and the way to unlink it. */
.wallets {
  margin: 0;
  padding: 0;
  list-style: none;
}

.wallets li {
  display: grid;
  grid-template-columns: minmax(0, 1.3fr) minmax(0, 1fr) minmax(0, 1fr) auto;
  align-items: center;
  gap: 8px 18px;
  padding: 14px 18px;
  border-top: 1px solid var(--border);
}

.wallets li:first-child {
  border-top: 0;
}

.wallets .who {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 2px 6px;
  min-width: 0;
}

.wallets .who .tx-link {
  font-size: 14px;
}

.wallets .since {
  flex-basis: 100%;
  font-size: 12px;
  color: var(--text-3);
}

.wallets .fig .k {
  font-size: 11.5px;
  color: var(--text-3);
}

.wallets .fig .v {
  font-family: var(--font-mono);
  font-size: 14px;
  font-variant-numeric: tabular-nums;
}

/* A wallet's part of what the account holds. */
.w-share {
  max-width: 180px;
  height: 4px;
  margin-top: 6px;
  overflow: hidden;
  border-radius: 999px;
  background: var(--surface-3);
}

.w-share > i {
  display: block;
  height: 100%;
  border-radius: 999px;
  background: var(--accent);
}

/* A line under a figure in the strip: where it comes from, or what is next. */
.balance-stats .s {
  margin-top: 2px;
  overflow: hidden;
  color: var(--text-3);
  font-size: 11.5px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* Steps side by side when there is room: the Rewards page's "How it works". */
@media (min-width: 900px) {
  .steps.across {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 22px;
  }
}

/* A token amount's unit is quieter than the amount, and keeps a figure on one line. */
.balance-stats .v .unit {
  white-space: nowrap;
  font-family: var(--font-sans);
  font-size: 11.5px;
  font-weight: 450;
  letter-spacing: 0;
  color: var(--text-3);
}

/* Facts that open a card rather than follow something. */
.facts.plain {
  padding-top: 0;
  border-top: 0;
}

/* A button for each wallet the browser has. */
.wallet-choices {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.wallet-choices img {
  width: 20px;
  height: 20px;
  border-radius: 5px;
}

/* The message to sign, exactly as it will be signed. */
.sign-message {
  margin: 0;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface-2);
  font-family: var(--font-mono);
  font-size: 12px;
  line-height: 1.5;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  max-height: 220px;
  overflow: auto;
}

.by-hand summary {
  cursor: pointer;
  font-size: 13px;
  color: var(--text-2);
}

.by-hand[open] summary {
  margin-bottom: 12px;
}

@media (max-width: 720px) {
  /* The wallet on a line of its own, its two figures side by side under it. */
  .wallets li {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .wallets .who,
  .wallets li > .btn {
    grid-column: 1 / -1;
  }

  .wallets li > .btn {
    justify-self: start;
  }
}

table.tbl.ledger {
  min-width: 640px;
}

.ledger .when {
  white-space: nowrap;
}

.ledger .ref {
  font-size: 11.5px;
}

.ledger .amount.credit {
  font-weight: 550;
  color: var(--ok);
}

@media (max-width: 1180px) {
  /* Too narrow for a side column: how to pay runs the full width, and the two
     smaller cards share the row beneath it. */
  .fund {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    grid-template-rows: auto;
    grid-template-areas:
      'pay pay'
      'recent voucher';
  }

  .fund.no-recent {
    grid-template-areas:
      'pay pay'
      'voucher voucher';
  }
}

@media (max-width: 720px) {
  /* One column, with what has arrived straight after the address it went to. */
  .fund {
    grid-template-columns: minmax(0, 1fr);
    grid-template-areas:
      'pay'
      'recent'
      'voucher';
  }

  .fund.no-recent {
    grid-template-areas:
      'pay'
      'voucher';
  }

  /* The ledger folds each row into two lines: what it was and how much, then
     when and what was left. Its type is said by the first line already. */
  table.tbl.ledger {
    min-width: 0;
  }

  table.tbl.ledger,
  table.tbl.ledger tbody {
    display: block;
  }

  table.tbl.ledger thead {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(0 0 0 0);
  }

  table.tbl.ledger tr {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    grid-template-areas:
      'detail amount'
      'when after';
    gap: 3px 14px;
    padding: 11px 14px;
    border-bottom: 1px solid var(--border);
  }

  table.tbl.ledger tbody tr:last-child {
    border-bottom: 0;
  }

  table.tbl.ledger td {
    display: block;
    min-width: 0;
    padding: 0;
    border: 0;
  }

  table.tbl.ledger td.type {
    display: none;
  }

  table.tbl.ledger td.detail {
    grid-area: detail;
  }

  table.tbl.ledger td.amount {
    grid-area: amount;
  }

  table.tbl.ledger td.when {
    grid-area: when;
    font-size: 12px;
  }

  table.tbl.ledger td.after {
    grid-area: after;
    font-size: 12px;
    color: var(--text-3);
  }

  table.tbl.ledger td.after::before {
    content: 'Balance ';
    font-family: var(--font-sans);
  }

  .ledger .ref {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .balance-stats {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .balance-stats > div:nth-child(odd) {
    border-left: 0;
  }

  .balance-stats > div:nth-child(n + 3) {
    border-top: 1px solid var(--border);
  }
}

@media (max-width: 560px) {
  .balance-main {
    padding: 18px 16px 16px;
  }

  .balance .figure {
    font-size: 40px;
  }

  .balance-stats > div {
    padding: 11px 16px 12px;
  }

  .section-head h3 {
    font-size: 16px;
  }

  /* Too long for the title's line: it takes its own, from the left. */
  .deposit > .card-head .right {
    width: 100%;
    margin-left: 0;
  }

  .deposit-top {
    flex-direction: column;
    align-items: stretch;
  }

  .qr {
    align-self: center;
    width: 172px;
  }

  .qr.wide {
    width: 208px;
  }

  .address {
    font-size: 15px;
  }

  .deposit-address .btn {
    width: 100%;
  }

  .facts {
    grid-template-columns: minmax(0, 1fr);
  }
}

/* ── filter bar ──────────────────────────────────────────────────────────── */

.filters {
  display: flex;
  gap: 8px;
  align-items: flex-end;
  flex-wrap: wrap;
  margin-bottom: 14px;
}

.filters .field {
  min-width: 130px;
}

.filters .field > label {
  font-size: 11px;
  color: var(--text-3);
}

.filters .grow {
  flex: 1 1 180px;
}

/* ── responsive ──────────────────────────────────────────────────────────── */

@media (max-width: 900px) {
  .app {
    grid-template-columns: minmax(0, 1fr);
  }

  .sidebar {
    position: fixed;
    left: 0;
    top: 0;
    width: min(84vw, 280px);
    transform: translateX(-102%);
    transition: transform 0.18s var(--ease);
    box-shadow: var(--shadow-3);
  }

  .app.nav-open .sidebar {
    transform: none;
  }

  .nav-scrim {
    position: fixed;
    inset: 0;
    background: var(--scrim-soft);
    z-index: 35;
    animation: fade 0.13s var(--ease);
  }

  .hamburger {
    display: inline-flex;
  }

  .view {
    padding: 22px 20px 56px;
  }

  .topbar {
    padding: 0 16px;
  }
}

@media (max-width: 560px) {
  /* The page's label gives up some tracking before it gives up letters. */
  .topbar h1 {
    font-size: 10.5px;
    letter-spacing: 0.08em;
  }

  .hero {
    padding: 16px;
  }

  .hero .figure {
    font-size: 36px;
  }

  .hero .side {
    margin-left: 0;
    gap: 18px;
  }

  .card {
    padding: 13px;
  }

  .view {
    padding: 18px 16px 48px;
  }

  .balance-pill .label {
    display: none;
  }

  .page-head h2 {
    font-size: 24px;
  }

  .stat .value {
    font-size: 19px;
  }

  .filters .field {
    min-width: 0;
    flex: 1 1 46%;
  }

  .toasts {
    left: 10px;
    right: 10px;
    max-width: none;
  }
}

@media (max-width: 400px) {
  .topbar h1 {
    font-size: 14px;
  }
}
