/* CarryCurve — modern terminal / fixed-income-dashboard theme.
   Light + dark via CSS custom properties. System preference is the default;
   manual toggle in the topbar persists per user in localStorage. */

/* ───────── Theme tokens ───────── */

:root,
[data-theme="light"] {
  --bg:               #FAFBFC;   /* page background */
  --surface:          #FFFFFF;   /* cards / panels */
  --surface-2:        #F4F5F7;   /* striped rows, sunken */
  --surface-hover:    #EEF0F4;   /* row hover */
  --border:           #E1E4E8;   /* hairlines */
  --border-strong:    #C7CCD3;   /* heavier dividers */
  --text:             #0F172A;   /* primary ink */
  --text-secondary:   #475569;   /* labels, captions */
  --text-tertiary:    #94A3B0;   /* metadata, hints */
  --accent:           #1E40AF;   /* brand, primary action */
  --accent-hover:     #1D4ED8;
  --accent-soft:      #E0E7FF;
  --up:               #15803D;   /* positive bps / up arrow */
  --down:             #B91C1C;   /* negative bps / down arrow */
  --warn:             #B45309;
  --warn-soft:        #FEF3C7;
  --stale-soft:       #FEE2E2;
  --link:             #1E40AF;
  --code-bg:          #F4F5F7;
  --shadow:           0 1px 0 rgba(15, 23, 42, 0.04), 0 1px 3px rgba(15, 23, 42, 0.04);
  /* Per-currency colour palette — pros expect a consistent visual identity
     per market across views. Used in the topbar pills (when active),
     the cross-curve bar chart, the curve-overlay chart series, and
     small accent dots on the per-currency table rows. */
  --ccy-gbp:          #1E40AF;   /* deep blue — matches the brand */
  --ccy-usd:          #047857;   /* US Treasury green */
  --ccy-cad:          #C2410C;   /* maple-leaf burnt orange */
  --ccy-eur:          #6D28D9;   /* euro-flag-adjacent violet */
}

[data-theme="dark"] {
  --bg:               #0A0E1A;
  --surface:          #0F1320;
  --surface-2:        #151A28;
  --surface-hover:    #1B2030;
  --border:           #1F2536;
  --border-strong:    #2C3548;
  --text:             #E6E8EB;
  --text-secondary:   #94A0B0;
  --text-tertiary:    #5C6573;
  --accent:           #60A5FA;
  --accent-hover:     #3B82F6;
  --accent-soft:      #1E2A4A;
  --up:               #34D399;
  --down:             #F87171;
  --warn:             #FBBF24;
  --warn-soft:        #2A1F0E;
  --stale-soft:       #2A1414;
  --link:             #60A5FA;
  --code-bg:          #151A28;
  --shadow:           0 1px 0 rgba(0, 0, 0, 0.3), 0 1px 3px rgba(0, 0, 0, 0.4);
  /* Per-currency palette — slightly lighter in dark mode for contrast. */
  --ccy-gbp:          #60A5FA;
  --ccy-usd:          #34D399;
  --ccy-cad:          #FB923C;
  --ccy-eur:          #A78BFA;
}

/* If no manual choice has been made, respect the OS preference */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme]) {
    --bg:               #0A0E1A;
    --surface:          #0F1320;
    --surface-2:        #151A28;
    --surface-hover:    #1B2030;
    --border:           #1F2536;
    --border-strong:    #2C3548;
    --text:             #E6E8EB;
    --text-secondary:   #94A0B0;
    --text-tertiary:    #5C6573;
    --accent:           #60A5FA;
    --accent-hover:     #3B82F6;
    --accent-soft:      #1E2A4A;
    --up:               #34D399;
    --down:             #F87171;
    --warn:             #FBBF24;
    --warn-soft:        #2A1F0E;
    --stale-soft:       #2A1414;
    --link:             #60A5FA;
    --code-bg:          #151A28;
    --shadow:           0 1px 0 rgba(0, 0, 0, 0.3), 0 1px 3px rgba(0, 0, 0, 0.4);
    --ccy-gbp:          #60A5FA;
    --ccy-usd:          #34D399;
    --ccy-cad:          #FB923C;
    --ccy-eur:          #A78BFA;
  }
}

/* ───────── Reset + base ───────── */

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--text);
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', system-ui, Roboto, 'Helvetica Neue', sans-serif;
  font-size: 14px;
  line-height: 1.5;
  font-feature-settings: 'cv02', 'cv03', 'cv04', 'cv11';
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* Anything that looks like a number gets tabular figures so columns align */
.num,
.summary-table td,
.summary-table th,
.top5-table td,
.top5-table th,
.admin-users-table td,
.admin-users-table th,
.prose-table td,
.prose-table th,
output,
code {
  font-variant-numeric: tabular-nums lining-nums;
  font-feature-settings: 'tnum';
}

a {
  color: var(--link);
  text-decoration: none;
}
a:hover { text-decoration: underline; }

code {
  font-family: 'JetBrains Mono', ui-monospace, 'SFMono-Regular', Menlo, Consolas, monospace;
  font-size: 0.92em;
  background: var(--code-bg);
  padding: 1px 5px;
  border-radius: 3px;
  color: var(--text);
}

/* ───────── Topbar ───────── */

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 24px;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 10;
  font-size: 13px;
}

.topbar-left {
  display: flex;
  align-items: center;
  gap: 16px;
}

.brand {
  font-weight: 700;
  font-size: 16px;
  letter-spacing: -0.01em;
  color: var(--text);
  text-decoration: none;
}
.brand:hover { text-decoration: none; }
.brand .brand-suffix {
  color: var(--text-tertiary);
  font-weight: 500;
  margin-left: 4px;
}

.status-line {
  display: flex;
  align-items: center;
  gap: 14px;
  color: var(--text-secondary);
  font-family: 'JetBrains Mono', ui-monospace, monospace;
  font-size: 12px;
  font-variant-numeric: tabular-nums;
}
.status-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--up);
  display: inline-block;
  box-shadow: 0 0 0 2px var(--surface), 0 0 0 3px var(--up);
  opacity: 0.85;
}

.topbar nav {
  display: flex;
  gap: 18px;
  align-items: center;
}
.topbar nav a {
  color: var(--text-secondary);
  font-size: 13px;
  text-decoration: none;
}
.topbar nav a:hover { color: var(--text); }

.theme-toggle {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text-secondary);
  border-radius: 4px;
  padding: 4px 10px;
  font: inherit;
  font-size: 12px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 5px;
}
.theme-toggle:hover { background: var(--surface-hover); color: var(--text); }

.pro-pill {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.04em;
  color: var(--up);
  background: transparent;
  border: 1px solid var(--up);
  padding: 2px 7px;
  border-radius: 3px;
}

.admin-link {
  color: var(--down) !important;
  font-weight: 600;
}

/* ───── Currency selector + cross-curve nav (v2.0) ───────── */
.ccy-selector {
  display: inline-flex;
  gap: 2px;
  align-items: center;
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 1px;
}
.ccy-pill {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.04em;
  padding: 3px 8px;
  border-radius: 3px;
  color: var(--text-secondary);
  text-decoration: none;
  font-family: 'JetBrains Mono', ui-monospace, monospace;
}
.ccy-pill:hover { background: var(--surface-hover); color: var(--text); text-decoration: none; }
.ccy-pill.active { background: var(--accent); color: white; }
/* Per-currency active colour — overrides the generic .active style above. */
.ccy-pill.active[data-ccy="gbp"] { background: var(--ccy-gbp); }
.ccy-pill.active[data-ccy="usd"] { background: var(--ccy-usd); }
.ccy-pill.active[data-ccy="cad"] { background: var(--ccy-cad); }
.ccy-pill.active[data-ccy="eur"] { background: var(--ccy-eur); }
.ccy-pill.locked {
  color: var(--text-tertiary);
  opacity: 0.85;
}
.ccy-pill.locked:hover {
  background: var(--surface-hover);
  color: var(--text-secondary);
  text-decoration: none;
}
.ccy-pill .pro-tag {
  vertical-align: 1px;
  margin-left: 3px;
  font-size: 8px;
}
.ccy-dot {
  display: inline-block;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  margin-right: 5px;
  vertical-align: 1px;
}
.ccy-pill.active .ccy-dot {
  background: rgba(255, 255, 255, 0.85) !important;
}
.nav-link {
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-secondary);
  text-decoration: none;
  font-weight: 500;
}
.nav-link:hover { color: var(--text); text-decoration: none; }

/* ───── Methodology + freshness badges (v2.0) ────────────── */
.viewer-meta {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  font-size: 12px;
  color: var(--text-secondary);
  margin-bottom: 12px;
  padding: 6px 0;
}
.viewer-meta .meta-label {
  text-transform: uppercase;
  font-size: 10px;
  letter-spacing: 0.1em;
  color: var(--text-tertiary);
}
.viewer-meta a { color: var(--text); font-weight: 600; }
.badge {
  display: inline-block;
  font-family: 'JetBrains Mono', ui-monospace, monospace;
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  padding: 2px 6px;
  border-radius: 3px;
  border: 1px solid;
  white-space: nowrap;
}
.badge-native       { color: var(--up);    border-color: var(--up);    background: transparent; }
.badge-bootstrapped { color: var(--warn);  border-color: var(--warn);  background: transparent; }
.badge-freshness    { color: var(--text-secondary); border-color: var(--border); }
.badge-fresh        { color: var(--up);    border-color: var(--up); }
.badge-stale        { color: var(--down);  border-color: var(--down); }
.badge-unavailable  { color: var(--text-tertiary); border-color: var(--text-tertiary); font-style: italic; }
.badge-ccy          { color: var(--text); border-color: var(--border-strong); background: var(--surface-2); }

/* Per-currency row accent on the cross-curve table.
   The `--row-accent` custom property is set inline per row from the
   currency-colour CSS variable, so a single rule paints any row in the
   right colour without per-currency selectors. */
.cross-curve-table tbody tr {
  border-left: 3px solid transparent;
}
.cross-curve-table tbody tr[style*="--row-accent"] {
  border-left-color: var(--row-accent);
}
.ccy-row-dot {
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  margin-right: 6px;
  vertical-align: 0;
}

/* ───────── Layout ───────── */

.container {
  max-width: 1240px;
  margin: 0 auto;
  padding: 20px 24px;
}

/* ───────── Banners ───────── */

.banner {
  border-radius: 4px;
  padding: 10px 14px;
  margin: 0 0 16px;
  font-size: 13px;
  border: 1px solid;
}
.banner.stale {
  background: var(--stale-soft);
  color: var(--down);
  border-color: var(--down);
}
.banner.caveat {
  background: var(--warn-soft);
  color: var(--warn);
  border-color: var(--warn);
}

/* ───────── Hero ───────── */

.hero {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 20px 22px;
  margin-bottom: 18px;
  box-shadow: var(--shadow);
}
.hero .meta {
  display: flex;
  align-items: center;
  gap: 14px;
  font-family: 'JetBrains Mono', ui-monospace, monospace;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-tertiary);
  margin-bottom: 8px;
}
.hero .meta .as-of { color: var(--text-secondary); font-weight: 500; }
.hero .meta strong { color: var(--text); font-weight: 600; }
.hero h1 {
  font-family: 'Inter', sans-serif;
  font-size: 22px;
  font-weight: 600;
  line-height: 1.25;
  letter-spacing: -0.015em;
  margin: 0 0 14px;
  color: var(--text);
}

/* ───────── Controls ───────── */

.controls {
  display: flex;
  align-items: center;
  gap: 24px;
  flex-wrap: wrap;
  padding: 10px 0;
  margin-bottom: 14px;
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
}

.horizon-pills {
  border: 0;
  padding: 0;
  margin: 0;
  display: flex;
  align-items: center;
  gap: 4px;
}
.horizon-pills legend {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-tertiary);
  margin-right: 10px;
  padding: 0;
  font-weight: 500;
}
.pill {
  appearance: none;
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text-secondary);
  padding: 5px 12px;
  font-family: inherit;
  font-size: 13px;
  font-weight: 500;
  font-variant-numeric: tabular-nums;
  cursor: pointer;
  border-radius: 4px;
}
.pill:hover { background: var(--surface-hover); color: var(--text); border-color: var(--border-strong); }
.pill.active {
  background: var(--accent);
  color: white;
  border-color: var(--accent);
  font-weight: 600;
}
.pill.locked {
  color: var(--text-tertiary);
  cursor: not-allowed;
  opacity: 0.7;
}
.pill.locked:hover {
  background: transparent;
  color: var(--text-tertiary);
  border-color: var(--border);
}
.pill .pro-tag { vertical-align: 1px; margin-left: 4px; }

.pro-tag {
  display: inline-block;
  font-style: normal;
  font-size: 9px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--accent);
  border: 1px solid var(--accent);
  padding: 0 4px;
  border-radius: 2px;
  font-family: 'Inter', sans-serif;
  font-weight: 700;
  background: var(--accent-soft);
}

.custom-horizon {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 13px;
  color: var(--text-secondary);
}
.ch-label {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-tertiary);
  font-weight: 500;
}
.custom-horizon input[type="range"] {
  -webkit-appearance: none;
  appearance: none;
  width: 130px;
  height: 18px;
  background: transparent;
  cursor: pointer;
  margin: 0;
}
.custom-horizon input[type="range"]::-webkit-slider-runnable-track {
  height: 3px;
  background: var(--border-strong);
  border-radius: 3px;
}
.custom-horizon input[type="range"]::-moz-range-track {
  height: 3px;
  background: var(--border-strong);
  border-radius: 3px;
}
.custom-horizon input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 14px;
  height: 14px;
  background: var(--accent);
  border-radius: 50%;
  margin-top: -5.5px;
  cursor: pointer;
}
.custom-horizon input[type="range"]::-moz-range-thumb {
  width: 14px;
  height: 14px;
  background: var(--accent);
  border: 0;
  border-radius: 50%;
  cursor: pointer;
}
.custom-horizon input[type="range"][disabled] { cursor: not-allowed; opacity: 0.5; }
.custom-horizon output {
  font-family: 'JetBrains Mono', ui-monospace, monospace;
  font-variant-numeric: tabular-nums;
  font-size: 12px;
  color: var(--text-secondary);
  min-width: 70px;
}

.ultra-toggle {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  color: var(--text);
}
.ultra-toggle input { accent-color: var(--accent); cursor: pointer; }
.ultra-toggle input[disabled] { cursor: not-allowed; }

/* Pro `as_of` date picker (v2.1). */
.as-of-picker {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 13px;
  color: var(--text);
}
.as-of-picker label {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--text-secondary);
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.as-of-picker input[type="date"] {
  background: var(--surface);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 5px 8px;
  font-family: 'JetBrains Mono', ui-monospace, monospace;
  font-size: 12px;
  cursor: pointer;
}
.as-of-picker input[type="date"]:focus {
  outline: 2px solid var(--accent);
  outline-offset: 1px;
}
.as-of-picker input[type="date"][disabled] {
  cursor: not-allowed;
  opacity: 0.55;
}
.as-of-picker.locked { opacity: 0.7; }
.as-of-reset {
  font-size: 12px;
  color: var(--accent);
  cursor: pointer;
  text-decoration: none;
  border-bottom: 1px dotted var(--accent);
}
.as-of-reset:hover { color: var(--accent-hover); border-bottom-color: var(--accent-hover); }

.badge-historical {
  display: inline-block;
  font-family: 'JetBrains Mono', ui-monospace, monospace;
  font-size: 10px;
  padding: 2px 6px;
  border-radius: 3px;
  background: var(--accent-soft);
  color: var(--accent);
  border: 1px solid var(--accent);
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

/* ───────── Chart ───────── */

.chart-section {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 14px 18px 8px;
  margin-bottom: 18px;
  box-shadow: var(--shadow);
}
.chart-wrap {
  height: 340px;
  position: relative;
}
.chart-caption {
  font-size: 12px;
  color: var(--text-tertiary);
  margin: 8px 0 0;
  padding-top: 8px;
  border-top: 1px solid var(--border);
  font-variant-numeric: tabular-nums;
}
.chart-caption strong { color: var(--text-secondary); font-weight: 600; }
.chart-section::after { content: none; }

/* ───────── Tables ───────── */

.summary-grid { display: block; }

.summary-table, .top5-table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 6px;
  overflow: hidden;
  font-size: 13px;
  margin-bottom: 16px;
  box-shadow: var(--shadow);
}
.summary-table caption, .top5-table caption {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-secondary);
  background: var(--surface-2);
  text-align: left;
  padding: 8px 12px;
  border-bottom: 1px solid var(--border);
  caption-side: top;
}
.summary-table caption .cap-note,
.top5-table caption .cap-note {
  font-weight: 400;
  text-transform: none;
  letter-spacing: 0;
  font-size: 11px;
  color: var(--text-tertiary);
  margin-left: 8px;
}
.summary-table thead th,
.top5-table thead th {
  font-size: 10px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  font-weight: 600;
  color: var(--text-tertiary);
  padding: 7px 12px;
  text-align: right;
  border-bottom: 1px solid var(--border);
  background: var(--surface);
}
.summary-table tbody td,
.top5-table tbody td {
  padding: 8px 12px;
  text-align: right;
  border-bottom: 1px solid var(--border);
  font-family: 'JetBrains Mono', ui-monospace, monospace;
  font-variant-numeric: tabular-nums;
  color: var(--text);
}
.summary-table thead th:first-child, .summary-table tbody td:first-child,
.top5-table thead th:first-child, .top5-table tbody td:first-child {
  text-align: left;
  font-family: 'Inter', sans-serif;
  font-weight: 600;
}
.summary-table tbody tr:last-child td,
.top5-table tbody tr:last-child td { border-bottom: 0; }
.summary-table tbody tr:hover,
.top5-table tbody tr:hover {
  background: var(--surface-hover);
}
.summary-table tr.active td,
.top5-table tr.active td {
  background: var(--accent-soft);
}
.summary-table tr.row-locked td {
  color: var(--text-tertiary);
  font-style: italic;
}
.summary-table tr.row-locked td:first-child { font-style: normal; }
.summary-table .pct .locked {
  color: var(--accent);
  font-style: normal;
  font-size: 11px;
  letter-spacing: 0.04em;
  font-family: 'Inter', sans-serif;
}
.summary-table small { color: var(--text-tertiary); font-size: 11px; }

/* Up / down indicators */
.delta-up { color: var(--up); font-weight: 600; }
.delta-down { color: var(--down); font-weight: 600; }
.delta-flat { color: var(--text-tertiary); }

/* ───────── Pro panel + exports + newsletter ───────── */

.pro-panel, .exports, .newsletter {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 18px 22px;
  margin-top: 16px;
  box-shadow: var(--shadow);
}
.pro-panel h3, .exports h3, .newsletter h3 {
  font-family: 'Inter', sans-serif;
  font-weight: 600;
  font-size: 15px;
  margin: 0 0 12px;
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 12px;
  color: var(--text);
}
.pro-panel h3 .price {
  font-weight: 500;
  font-size: 13px;
  color: var(--text-secondary);
  font-variant-numeric: tabular-nums;
}
.pro-panel p, .exports p, .newsletter p { color: var(--text-secondary); font-size: 13px; }

.pro-feature-list {
  list-style: none;
  padding: 0;
  margin: 0 0 14px;
}
.pro-feature-list li {
  padding: 8px 0;
  font-size: 13px;
  color: var(--text-secondary);
  border-bottom: 1px solid var(--border);
}
.pro-feature-list li:last-child { border-bottom: 0; }
.pro-feature-list li strong {
  color: var(--text);
  font-weight: 600;
}

.pro-actions {
  display: flex;
  gap: 16px;
  align-items: flex-start;
  flex-wrap: wrap;
  margin-top: 4px;
}
/* High-contrast CTA palette — needs to read well in both themes. The
   default `--accent` is too light in dark mode (`#60A5FA` white-on-
   light-blue is ~1.5:1, well below WCAG 4.5:1), so the CTA pins to a
   deeper blue that holds contrast in both palettes. */
:root {
  --cta-bg:       #1D4ED8;
  --cta-bg-hover: #1E40AF;
}
[data-theme="dark"] {
  --cta-bg:       #2563EB;
  --cta-bg-hover: #1D4ED8;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --cta-bg:       #2563EB;
    --cta-bg-hover: #1D4ED8;
  }
}

.subscribe-button,
.subscribe-button:link,
.subscribe-button:visited {
  background: var(--cta-bg);
  color: #FFFFFF;
  text-decoration: none;
  padding: 8px 18px;
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  font-family: 'Inter', sans-serif;
  border-radius: 4px;
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.15);
}
.subscribe-button:hover,
.subscribe-button:focus,
.subscribe-button:active {
  background: var(--cta-bg-hover);
  text-decoration: none;
  color: #FFFFFF;
  outline: none;
}

.unlock-form {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  align-items: stretch;
  flex: 1 1 300px;
}
.unlock-form label {
  width: 100%;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-tertiary);
  margin-bottom: 2px;
  font-weight: 500;
}
.unlock-form input[type=email],
.newsletter-form input[type=email] {
  flex: 1 1 240px;
  padding: 7px 10px;
  border: 1px solid var(--border);
  background: var(--bg);
  font-family: inherit;
  font-size: 13px;
  color: var(--text);
  border-radius: 4px;
  outline: none;
}
.unlock-form input[type=email]:focus,
.newsletter-form input[type=email]:focus {
  border-color: var(--accent);
}
.unlock-form button,
.newsletter-form button {
  padding: 7px 16px;
  background: var(--text);
  color: var(--bg);
  border: 0;
  font-family: inherit;
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  cursor: pointer;
  border-radius: 4px;
}
.unlock-form button:hover,
.newsletter-form button:hover { background: var(--accent); color: white; }

.newsletter-form { display: flex; gap: 8px; margin: 10px 0 4px; flex-wrap: wrap; }

.download-list {
  list-style: none;
  padding: 0;
  margin: 8px 0 0;
}
.download-list li {
  padding: 8px 0;
  font-size: 13px;
  border-bottom: 1px solid var(--border);
  display: flex;
  justify-content: space-between;
  gap: 16px;
  color: var(--text);
  font-family: 'JetBrains Mono', ui-monospace, monospace;
}
.download-list li:last-child { border-bottom: 0; }
.download-list.locked li { color: var(--text-tertiary); }
.download-list .locked { color: var(--text-tertiary); font-style: italic; }

/* ───────── Long-read pages ───────── */

.prose {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 24px 28px;
  max-width: 760px;
  margin: 0 auto;
  box-shadow: var(--shadow);
  color: var(--text);
}
.prose h1 {
  font-family: 'Inter', sans-serif;
  font-size: 24px;
  font-weight: 600;
  letter-spacing: -0.015em;
  margin: 0 0 6px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--border);
  color: var(--text);
}
.prose h2 {
  font-family: 'Inter', sans-serif;
  font-size: 16px;
  font-weight: 600;
  letter-spacing: -0.005em;
  margin: 24px 0 8px;
  color: var(--text);
}
.prose p, .prose li { font-size: 14px; line-height: 1.6; color: var(--text); }
.prose p em, .prose li em { color: var(--text-secondary); }
.prose pre {
  background: var(--code-bg);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 10px 14px;
  font-family: 'JetBrains Mono', ui-monospace, monospace;
  font-size: 12.5px;
  color: var(--text);
  overflow-x: auto;
}
.prose-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
  margin: 8px 0;
}
.prose-table th, .prose-table td {
  padding: 8px 10px;
  border-bottom: 1px solid var(--border);
  text-align: left;
  color: var(--text);
}
.prose-table th {
  font-size: 10px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text-tertiary);
  font-weight: 600;
  background: var(--surface-2);
}

/* ───────── Admin ───────── */

.admin.admin-wide { max-width: 1180px; }

.admin-nav {
  display: flex;
  gap: 4px;
  margin: 0 0 16px;
  padding: 0 0 10px;
  border-bottom: 1px solid var(--border);
}
.admin-nav a {
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-tertiary);
  padding: 6px 12px;
  border-radius: 4px;
  text-decoration: none;
  font-weight: 500;
}
.admin-nav a:hover { color: var(--text); background: var(--surface-hover); text-decoration: none; }
.admin-nav a.active {
  background: var(--accent-soft);
  color: var(--accent);
}
.filter-active { color: var(--accent); font-weight: 700; }

.admin-users-table { font-size: 12.5px; }
.admin-users-table .actions { white-space: nowrap; font-family: 'Inter', sans-serif; }
.admin-users-table .actions form { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin: 0; }
.admin-users-table .cb { font-size: 11px; color: var(--text-tertiary); }
.admin-btn {
  background: var(--text);
  color: var(--bg);
  border: 0;
  padding: 4px 10px;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  font-family: 'Inter', sans-serif;
  cursor: pointer;
  border-radius: 3px;
}
.admin-btn:hover { background: var(--accent); color: white; }
.admin-btn.danger { background: var(--down); color: white; }
.admin-btn.danger:hover { background: var(--text); }

.row-status-cancelled td { color: var(--text-tertiary); }
.row-status-deleted td { color: var(--text-tertiary); font-style: italic; }
.row-status-past_due td { color: var(--warn); }

/* ───────── Subscribe page ───────── */

.plan-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  margin: 20px 0 12px;
}
@media (max-width: 600px) { .plan-grid { grid-template-columns: 1fr; } }
.plan {
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 18px;
  background: var(--surface);
}
.plan h2 {
  margin: 0 0 4px;
  font-family: 'Inter', sans-serif;
  font-size: 16px;
  font-weight: 600;
  color: var(--text);
}
.plan .price {
  font-family: 'JetBrains Mono', ui-monospace, monospace;
  font-size: 26px;
  font-weight: 600;
  margin: 4px 0 14px;
  color: var(--text);
  font-variant-numeric: tabular-nums;
}
.plan .price small {
  font-size: 12px;
  color: var(--text-tertiary);
  font-weight: 400;
  font-family: 'Inter', sans-serif;
}
.plan button {
  width: 100%;
  padding: 10px 18px;
  background: var(--accent);
  color: white;
  border: 0;
  font-family: 'Inter', sans-serif;
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  cursor: pointer;
  border-radius: 4px;
}
.plan button:hover:not([disabled]) { background: var(--accent-hover); }
.plan button[disabled] {
  background: var(--surface-2);
  color: var(--text-tertiary);
  cursor: not-allowed;
}
.plan .note {
  color: var(--text-secondary);
  font-size: 12px;
  margin: 8px 0 0;
}

/* ───────── Delete-account confirmation ───────── */

.delete-form { margin: 16px 0; }
.delete-button {
  background: var(--down);
  color: white;
  border: 0;
  padding: 10px 22px;
  font-family: 'Inter', sans-serif;
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  cursor: pointer;
  border-radius: 4px;
}
.delete-button:hover { background: var(--text); }

.unlock-error {
  background: var(--stale-soft);
  border: 1px solid var(--down);
  border-radius: 4px;
  padding: 10px 14px;
  font-size: 13px;
  color: var(--down);
  margin: 14px 0;
}

/* ───────── Footer ───────── */

.sitefooter {
  max-width: 1240px;
  margin: 36px auto 36px;
  padding: 16px 24px 0;
  color: var(--text-tertiary);
  font-size: 12px;
  line-height: 1.5;
  border-top: 1px solid var(--border);
}
.sitefooter p { margin: 4px 0; }
.sitefooter a { color: var(--text-tertiary); text-decoration: underline; }
.sitefooter a:hover { color: var(--text); }
.sitefooter strong { color: var(--text-secondary); }

/* ───────── Cookie banner ───────── */

.cookie-banner {
  position: fixed;
  bottom: 16px;
  left: 16px;
  right: 16px;
  background: var(--text);
  color: var(--bg);
  padding: 10px 14px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  font-size: 12.5px;
  max-width: 720px;
  margin: 0 auto;
  border-radius: 6px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.25);
  z-index: 50;
}
.cookie-banner[hidden] { display: none; }
.cookie-banner .cookie-actions { display: flex; gap: 8px; flex-shrink: 0; }
.cookie-banner button {
  background: var(--bg);
  color: var(--text);
  border: 0;
  padding: 5px 12px;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  cursor: pointer;
  font-family: 'Inter', sans-serif;
  border-radius: 3px;
}
.cookie-banner button.cookie-secondary {
  background: transparent;
  color: var(--bg);
  border: 1px solid var(--bg);
}

/* ───────── Empty state ───────── */

.empty-state pre {
  background: var(--code-bg);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 10px 14px;
  font-family: 'JetBrains Mono', ui-monospace, monospace;
  font-size: 12.5px;
  color: var(--text);
}

/* ───────── Mobile ───────── */

@media (max-width: 760px) {
  .container { padding: 14px 12px; }
  .topbar { padding: 8px 12px; flex-direction: column; align-items: flex-start; gap: 8px; }
  .status-line { font-size: 11px; gap: 10px; flex-wrap: wrap; }
  .hero h1 { font-size: 18px; }
  .chart-wrap { height: 260px; }
  .controls { gap: 12px; }
  .summary-table, .top5-table { font-size: 12px; }
}
