/* ═══════════════════════════════════════════════════════════════════════════
   Portfolio — on Expiry's design system
   Dusk (muted dark) and Mist (light, not white), following the system setting.
   Fonts are vendored in ./vendor/fonts — nothing is fetched from a CDN.
   ═══════════════════════════════════════════════════════════════════════════ */

@font-face {
  font-family: 'Instrument Sans';
  src: url('./vendor/fonts/instrument-sans.woff2') format('woff2');
  font-weight: 400 700;
  font-display: swap;
}
@font-face {
  font-family: 'IBM Plex Mono';
  src: url('./vendor/fonts/ibm-plex-mono-400.woff2') format('woff2');
  font-weight: 400;
  font-display: swap;
}
@font-face {
  font-family: 'IBM Plex Mono';
  src: url('./vendor/fonts/ibm-plex-mono-500.woff2') format('woff2');
  font-weight: 500;
  font-display: swap;
}

:root {
  --bg1: #141d21;
  --bg2: #0c1214;
  --glow1: rgba(63, 174, 140, 0.16);
  --glow2: rgba(224, 169, 78, 0.10);
  --glow3: rgba(232, 112, 95, 0.09);

  --glass: rgba(255, 255, 255, 0.055);
  --card: rgba(255, 255, 255, 0.045);
  --stroke: rgba(255, 255, 255, 0.095);
  --hi: rgba(255, 255, 255, 0.07);
  --tile: rgba(255, 255, 255, 0.07);
  --track: rgba(255, 255, 255, 0.07);
  --bar: rgba(14, 20, 22, 0.72);
  --hover: rgba(255, 255, 255, 0.04);

  --ink: #e9eeee;
  --ink2: #9ca9ac;
  --ink3: #6e7b7e;

  --accent: #46b994;
  --accent-deep: #176b53;

  /* Gains and losses are muted against near-black. The originals glared. */
  --up: #54c5a1;
  --up-bg: rgba(84, 197, 161, 0.14);
  --down: #f0806d;
  --down-bg: rgba(240, 128, 109, 0.15);
  --flat: #8b979b;
  --flat-bg: rgba(255, 255, 255, 0.07);

  --shadow-card: 0 6px 22px rgba(0, 0, 0, 0.14);
  color-scheme: dark;

  /* Carried over from the original token set. Dropping these silently broke
     layout: an undefined variable inside calc() invalidates the whole
     declaration, so `.tab-content`'s padding vanished entirely and every panel
     ran edge to edge. */
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  --radius: 16px;
  --radius-sm: 12px;
  --accent-2: var(--accent-deep);
  --accent-soft: var(--up-bg);
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.06);
  --shadow-md: var(--shadow-card);

  /* Aliases so any rule below that still uses the old names keeps working. */
  --surface-1: var(--card);
  --surface-2: var(--tile);
  --page: var(--bg1);
  --text-primary: var(--ink);
  --text-secondary: var(--ink2);
  --muted: var(--ink3);
  --border: var(--stroke);
  --gridline: var(--stroke);
  --positive: var(--up);
  --positive-bg: var(--up-bg);
  --negative: var(--down);
  --negative-bg: var(--down-bg);
  --flat-bg: var(--flat-bg);
}

@media (prefers-color-scheme: light) {
  :root {
    --bg1: #e4e9ec;
    --bg2: #d6dee1;
    --glow1: rgba(31, 120, 96, 0.16);
    --glow2: rgba(198, 140, 38, 0.13);
    --glow3: rgba(180, 70, 52, 0.11);

    --glass: rgba(255, 255, 255, 0.62);
    --card: rgba(255, 255, 255, 0.66);
    --stroke: rgba(255, 255, 255, 0.85);
    --hi: rgba(255, 255, 255, 0.90);
    --tile: rgba(255, 255, 255, 0.72);
    --track: rgba(20, 32, 31, 0.07);
    --bar: rgba(232, 237, 239, 0.72);
    --hover: rgba(255, 255, 255, 0.50);

    --ink: #14201f;
    --ink2: #54636a;
    --ink3: #7c8b92;

    --accent: #1b7259;
    --accent-deep: #145a46;

    --up: #1b7259;
    --up-bg: rgba(27, 114, 89, 0.11);
    --down: #ae3e2e;
    --down-bg: rgba(174, 62, 46, 0.11);
    --flat: #68767c;
    --flat-bg: rgba(20, 32, 31, 0.06);

    --shadow-card: 0 6px 22px rgba(20, 32, 31, 0.07);
    color-scheme: light;
  }
}

html {
  background: linear-gradient(168deg, var(--bg1), var(--bg2));
  -webkit-text-size-adjust: 100%;
  -webkit-tap-highlight-color: transparent;
  overflow-x: hidden;
  overscroll-behavior: none;
}

body {
  background: transparent;
  color: var(--ink);
  font-family: 'Instrument Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  font-size: 15px;
  line-height: 1.5;
  min-height: 100dvh;
  overflow-x: hidden;
}

/* Ambient glows, so the frosted panels have something to blur. */
body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  background:
    radial-gradient(58% 34% at 12% 2%, var(--glow1), transparent 68%),
    radial-gradient(48% 30% at 96% 34%, var(--glow2), transparent 66%),
    radial-gradient(52% 30% at 40% 100%, var(--glow3), transparent 68%);
}

/* Figures are monospaced so digits line up column to column. */
.mono, .num {
  font-family: 'IBM Plex Mono', ui-monospace, SFMono-Regular, monospace;
  font-variant-numeric: tabular-nums;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--page);
  color: var(--text-primary);
  /* font-family intentionally omitted — set once on body in the token block
     above. Re-declaring it here silently overrode Instrument Sans. */
  -webkit-tap-highlight-color: transparent;
}

body { min-height: 100dvh; }
input, select, button { font-family: inherit; }
button { -webkit-tap-highlight-color: transparent; }

.muted { color: var(--text-secondary); }
.small { font-size: 0.8rem; }

::selection { background: var(--accent-soft); }

/* ---------------- App shell ---------------- */
#app { min-height: 100dvh; display: flex; flex-direction: column; }

.app-header {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: max(16px, calc(var(--safe-top) + 8px)) 18px 14px;
  background: color-mix(in srgb, var(--surface-1) 88%, transparent);
  backdrop-filter: blur(16px) saturate(1.4);
  -webkit-backdrop-filter: blur(16px) saturate(1.4);
  border-bottom: 1px solid var(--gridline);
}
.app-header-title h1 {
  font-size: 1.2rem;
  margin: 0;
  font-weight: 800;
  letter-spacing: -0.01em;
}
.app-header-title p { margin: 2px 0 0; }
.app-header-actions { display: flex; gap: 6px; }
.icon-btn {
  background: var(--surface-2);
  border: 1px solid var(--border);
  color: var(--text-primary);
  border-radius: 12px;
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: transform 0.15s ease, background 0.15s ease;
}
.icon-btn:active { background: var(--gridline); transform: scale(0.92); }
.icon-btn.spinning svg { animation: spin 0.9s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

.tab-content {
  flex: 1;
  padding: 18px 16px calc(96px + var(--safe-bottom));
  max-width: 720px;
  width: 100%;
  margin: 0 auto;
}

.tab-panel[hidden] { display: none; }
.tab-panel { animation: fade-in 0.25s ease; }
@keyframes fade-in {
  from { opacity: 0; transform: translateY(4px); }
  to { opacity: 1; transform: translateY(0); }
}

.section-title {
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--muted);
  margin: 26px 0 10px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}
.section-title:first-child { margin-top: 0; }

/* ---------------- Hero stat card ---------------- */
.hero-card {
  background: linear-gradient(155deg, var(--accent) 0%, var(--accent-2) 100%);
  border-radius: var(--radius);
  padding: 26px 22px 22px;
  color: #ffffff;
  box-shadow: var(--shadow-md);
  position: relative;
  overflow: hidden;
  text-align: center;
}
.hero-card::after {
  content: "";
  position: absolute;
  inset: 0;
  background: radial-gradient(120% 100% at 100% 0%, rgba(255,255,255,0.16), transparent 60%);
  pointer-events: none;
}
.hero-invested-row {
  display: flex;
  align-items: baseline;
  justify-content: center;
  gap: 6px;
  font-size: 0.82rem;
  color: rgba(255,255,255,0.75);
  position: relative;
}
.hero-invested-row b { color: rgba(255,255,255,0.92); font-weight: 700; }
.hero-label {
  font-size: 0.74rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: rgba(255,255,255,0.7);
  margin: 18px 0 0;
  position: relative;
}
.hero-value-bhd {
  font-size: 2.5rem;
  font-weight: 800;
  letter-spacing: -0.02em;
  margin: 6px 0 0;
  font-variant-numeric: tabular-nums;
  line-height: 1.1;
  color: #ffffff;
  position: relative;
}
.hero-value-usd {
  font-size: 1.05rem;
  font-weight: 600;
  color: rgba(255,255,255,0.82);
  margin: 4px 0 0;
  font-variant-numeric: tabular-nums;
  position: relative;
}
.hero-chip-row { margin-top: 16px; display: flex; justify-content: center; flex-wrap: wrap; gap: 8px; position: relative; }
.hero-chip {
  display: inline-flex;
  align-items: baseline;
  gap: 5px;
  background: rgba(255,255,255,0.16);
  border: 1px solid rgba(255,255,255,0.22);
  border-radius: 999px;
  padding: 7px 14px;
  font-size: 0.85rem;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}
.hero-chip .chip-pct { font-weight: 600; opacity: 0.85; font-size: 0.78rem; }

/* ---------------- Metric cards (24h / 30d / 12mo) ---------------- */
.metrics-top-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
  margin-top: 10px;
}
.metric-card-lg {
  border-radius: var(--radius-sm);
  padding: 12px 10px;
  background: var(--flat-bg);
  min-width: 0;
}
.metric-card-lg.pos { background: var(--positive-bg); }
.metric-card-lg.neg { background: var(--negative-bg); }
.metric-card-lg .stat-label { margin: 0 0 6px; color: var(--text-secondary); font-weight: 600; font-size: 0.66rem; }
.metric-card-lg .money-bhd { font-size: 0.92rem; }
.metric-card-lg .money-usd { font-size: 0.64rem; }
.metric-card-lg .pct-suffix { display: block; font-size: 0.78em; }

/* ---------------- Generic money pair (BHD primary, USD secondary) ---------------- */
.money-bhd {
  display: block;
  font-size: 1.05rem;
  font-weight: 800;
  color: var(--text-primary);
  font-variant-numeric: tabular-nums;
  line-height: 1.25;
}
.money-usd {
  display: block;
  font-size: 0.76rem;
  font-weight: 500;
  color: var(--muted);
  margin-top: 1px;
  font-variant-numeric: tabular-nums;
}
.money-bhd.delta.pos { color: var(--positive); }
.money-bhd.delta.neg { color: var(--negative); }
.money-bhd.delta.flat { color: var(--muted); }
.money-bhd .pct-suffix { font-weight: 600; font-size: 0.82em; opacity: 0.85; }

/* ---------------- Plain secondary stats ---------------- */
.secondary-stats { display: flex; gap: 10px; margin-top: 10px; }
.secondary-stat {
  flex: 1;
  background: var(--surface-1);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 12px 14px;
}
.secondary-stat .stat-label { margin: 0 0 4px; }

.delta { font-weight: 700; }
.delta.pos { color: var(--positive); }
.delta.neg { color: var(--negative); }
.delta.flat { color: var(--muted); }

.stat-label {
  font-size: 0.72rem;
  color: var(--text-secondary);
  margin: 0 0 6px;
  font-weight: 600;
}

/* ---------------- Allocation bar ---------------- */
.allocation-card {
  background: var(--surface-1);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 14px;
  margin-top: 10px;
  box-shadow: var(--shadow-sm);
}
.allocation-track {
  display: flex;
  height: 10px;
  border-radius: 999px;
  overflow: hidden;
  background: var(--gridline);
}
.allocation-seg { height: 100%; }
.allocation-legend { display: flex; flex-wrap: wrap; gap: 14px; margin-top: 12px; }
.allocation-legend-item {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 0.78rem;
  color: var(--text-secondary);
}
.allocation-dot { width: 9px; height: 9px; border-radius: 50%; flex: none; }

/* ---------------- Group preview (dashboard) ---------------- */
.group-preview-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.group-preview-card {
  background: var(--surface-1);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  text-align: left;
  cursor: pointer;
  color: inherit;
  font: inherit;
  box-shadow: var(--shadow-sm);
  transition: transform 0.12s ease, box-shadow 0.12s ease;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.group-preview-card:active { transform: scale(0.97); }
.group-avatar-row { display: flex; align-items: center; justify-content: space-between; }
.group-avatar {
  width: 34px; height: 34px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-weight: 800; font-size: 0.9rem; color: #fff; flex: none;
}
.group-preview-card h3 { margin: 0; font-size: 0.85rem; font-weight: 700; color: var(--text-secondary); }
.chevron-affordance { color: var(--muted); }

/* ---------------- Holdings panel (single flat list, industry-standard) ---------------- */
.holdings-panel {
  background: var(--surface-1);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
}
.holding-row + .holding-row { border-top: 1px solid var(--gridline); }

.holding-summary {
  width: 100%;
  display: flex;
  align-items: center;
  padding: 12px 14px;
  background: transparent;
  border: none;
  color: inherit;
  font: inherit;
  cursor: pointer;
  text-align: left;
  gap: 12px;
  transition: background 0.12s ease;
}
.holding-summary:active { background: var(--surface-2); }

.ticker-logo {
  position: relative;
  width: 38px;
  height: 38px;
  border-radius: 50%;
  overflow: hidden;
  flex: none;
  background: var(--surface-2);
  border: 1px solid var(--border);
}
.ticker-logo img { width: 100%; height: 100%; object-fit: cover; display: block; }
.ticker-logo-fallback {
  position: absolute;
  inset: 0;
  display: none;
  align-items: center;
  justify-content: center;
  font-size: 0.72rem;
  font-weight: 800;
  color: #fff;
}

.holding-id { flex: 1; min-width: 0; }
.holding-ticker { font-weight: 700; font-size: 0.98rem; }
.holding-name { font-size: 0.76rem; color: var(--muted); margin-top: 1px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.holding-meta { font-size: 0.76rem; color: var(--muted); margin-top: 2px; }
.holding-values { text-align: right; flex: none; }
.holding-values .money-bhd { font-size: 1rem; }
.holding-values .delta-pill {
  display: inline-block;
  margin-top: 3px;
  padding: 2px 7px;
  border-radius: 999px;
  font-size: 0.72rem;
  font-weight: 700;
}
.delta-pill.pos { background: var(--positive-bg); color: var(--positive); }
.delta-pill.neg { background: var(--negative-bg); color: var(--negative); }
.delta-pill.flat { background: var(--flat-bg); color: var(--muted); }

.chevron { flex: none; color: var(--muted); transition: transform 0.22s ease; }
.holding-row:has(.holding-detail.open) .chevron { transform: rotate(180deg); }

.holding-detail {
  border-top: 1px solid var(--gridline);
  padding: 0 14px;
  max-height: 0;
  overflow: hidden;
  transition: max-height 0.25s ease, padding 0.25s ease;
}
.holding-detail.open { max-height: 1000px; padding: 12px 14px 14px; }

.metrics-row { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; margin: 4px 0 10px; }
.metric-box { background: var(--flat-bg); border-radius: 10px; padding: 9px 10px; min-width: 0; }
.metric-box.pos { background: var(--positive-bg); }
.metric-box.neg { background: var(--negative-bg); }
.metric-box .stat-label { font-size: 0.64rem; margin-bottom: 4px; }
.metric-box .money-bhd { font-size: 0.86rem; }
.metric-box .money-usd { font-size: 0.66rem; }

.lot-row { display: flex; justify-content: space-between; padding: 8px 0; border-top: 1px solid var(--gridline); font-size: 0.8rem; gap: 10px; }
.lot-row:first-child { border-top: none; }
.lot-row .lot-left { color: var(--text-secondary); }
.lot-row .lot-right { text-align: right; }
.lot-row .money-bhd { font-size: 0.84rem; }

.empty-note { color: var(--muted); font-size: 0.85rem; padding: 26px 4px; text-align: center; }

/* ---------------- Skeleton loading ---------------- */
.skeleton {
  background: linear-gradient(100deg, var(--surface-2) 30%, var(--gridline) 50%, var(--surface-2) 70%);
  background-size: 250% 100%;
  animation: shimmer 1.4s ease-in-out infinite;
  border-radius: var(--radius-sm);
}
@keyframes shimmer {
  0% { background-position: 200% 0; }
  100% { background-position: -50% 0; }
}
.skeleton-hero { height: 190px; border-radius: var(--radius); }
.skeleton-row { height: 60px; margin-bottom: 9px; }

/* ---------------- Add form ---------------- */
.card {
  background: var(--surface-1);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px;
  box-shadow: var(--shadow-sm);
}
.add-form { display: flex; flex-direction: column; gap: 13px; min-width: 0; }
.add-form label {
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 0.83rem;
  font-weight: 600;
  color: var(--text-secondary);
  min-width: 0;
}
.add-form input, .add-form select {
  width: 100%;
  min-width: 0;
  padding: 12px 13px;
  border-radius: 11px;
  border: 1px solid var(--border);
  background: var(--page);
  color: var(--text-primary);
  font-size: 1rem;
  transition: border-color 0.15s ease;
}
.add-form input:focus, .add-form select:focus { outline: none; border-color: var(--accent); }
.form-row { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 10px; }

.btn {
  border: none;
  border-radius: 12px;
  padding: 13px 16px;
  font-size: 1rem;
  font-weight: 700;
  cursor: pointer;
  transition: transform 0.12s ease, opacity 0.12s ease;
}
.btn-primary { background: var(--accent); color: #fff; }
.btn-primary:active { transform: scale(0.98); opacity: 0.9; }
.btn:disabled { opacity: 0.6; }

.status-text { font-size: 0.85rem; margin: 0; font-weight: 600; }
.status-text.ok { color: var(--positive); }
.status-text.err { color: var(--negative); }

/* ---------------- Bottom nav ---------------- */
.bottom-nav {
  position: fixed;
  bottom: calc(10px + var(--safe-bottom));
  left: 12px;
  right: 12px;
  display: flex;
  gap: 2px;
  background: color-mix(in srgb, var(--surface-1) 92%, transparent);
  backdrop-filter: blur(18px) saturate(1.4);
  -webkit-backdrop-filter: blur(18px) saturate(1.4);
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 6px;
  z-index: 10;
  box-shadow: var(--shadow-md);
  max-width: 720px;
  margin: 0 auto;
}
.nav-btn {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  background: none;
  border: none;
  color: var(--muted);
  padding: 8px 2px 7px;
  font-size: 0.65rem;
  font-weight: 600;
  cursor: pointer;
  border-radius: 14px;
  transition: background 0.18s ease, color 0.18s ease;
}
.nav-btn.active { color: var(--accent); background: var(--accent-soft); }
.nav-btn:active { transform: scale(0.94); }

/* ---------------- Toast ---------------- */
.toast {
  position: fixed;
  left: 50%;
  bottom: calc(96px + var(--safe-bottom));
  transform: translateX(-50%);
  background: var(--text-primary);
  color: var(--surface-1);
  padding: 11px 18px;
  border-radius: 999px;
  font-size: 0.85rem;
  font-weight: 600;
  z-index: 50;
  max-width: 90vw;
  text-align: center;
  box-shadow: var(--shadow-md);
  animation: toast-in 0.2s ease;
}
@keyframes toast-in {
  from { opacity: 0; transform: translate(-50%, 8px); }
  to { opacity: 1; transform: translate(-50%, 0); }
}

@media (min-width: 720px) {
  .group-preview-grid { grid-template-columns: repeat(2, 1fr); }
}

/* ── sign-in gate ─────────────────────────────────────────────────────────── */
/* Uses the app's own tokens so it reads as the same product, and inherits the
   light/dark handling already defined above. */

.signin {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: var(--page);
}

.signin-card {
  width: 100%;
  max-width: 340px;
  display: flex;
  flex-direction: column;
  background: var(--surface-1);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 28px 22px;
  text-align: center;
}

.signin-card h1 {
  font-size: 20px;
  font-weight: 700;
  margin: 0 0 4px;
  color: var(--text-primary);
}

.signin-card p {
  font-size: 13px;
  color: var(--text-secondary);
  margin: 0 0 20px;
}

.signin-card input {
  width: 100%;
  padding: 12px 14px;
  margin-bottom: 10px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--surface-2);
  color: var(--text-primary);
  font: inherit;
  font-size: 16px; /* 16px stops iOS zooming the page on focus */
}

.signin-card input:focus {
  outline: none;
  border-color: var(--accent);
}

.signin-card button {
  width: 100%;
  margin-top: 8px;
  padding: 12px 14px;
  border: 0;
  border-radius: 10px;
  background: var(--accent);
  color: #fff;
  font: inherit;
  font-weight: 600;
  cursor: pointer;
}

.signin-card button:disabled {
  opacity: 0.6;
  cursor: default;
}

.signin-error {
  min-height: 18px;
  font-size: 12.5px;
  color: var(--negative);
  margin: 2px 0 0;
}

/* ── revamp: header, hero, chart, tiles ───────────────────────────────────── */

.app-header {
  position: sticky;
  top: 0;
  z-index: 20;
  padding-top: calc(14px + env(safe-area-inset-top));
  background: var(--bar);
  backdrop-filter: blur(20px) saturate(150%);
  -webkit-backdrop-filter: blur(20px) saturate(150%);
  border-bottom: 1px solid var(--stroke);
}
.app-header h1 { font-size: 19px; font-weight: 700; letter-spacing: -0.01em; }

.panel {
  background: var(--glass);
  border: 1px solid var(--stroke);
  border-radius: 16px;
  padding: 16px;
  margin-bottom: 14px;
  backdrop-filter: blur(20px) saturate(150%);
  -webkit-backdrop-filter: blur(20px) saturate(150%);
  box-shadow: inset 0 1px 0 var(--hi), var(--shadow-card);
}
.panel-title {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--ink3);
}

/* Hero — typographic, not a gradient slab. The old blue card spent a third of
   the first screen on one number and fought the near-black everything else. */
.hero { padding: 20px 16px 18px; }
.hero-label {
  font-size: 11px; font-weight: 600; letter-spacing: 0.08em;
  text-transform: uppercase; color: var(--ink3); margin-bottom: 6px;
}
.hero-value {
  font-size: clamp(34px, 11vw, 46px);
  font-weight: 700; line-height: 1.05; letter-spacing: -0.02em;
  color: var(--ink);
}
.hero-value .cur { font-size: 0.52em; font-weight: 600; color: var(--ink2); margin-right: 6px; }
.hero-sub { margin-top: 4px; font-size: 14px; color: var(--ink2); }
.hero-change { display: inline-flex; align-items: center; gap: 6px; margin-top: 12px;
  padding: 6px 11px; border-radius: 999px; font-size: 13px; font-weight: 600; }
.hero-change.up   { background: var(--up-bg);   color: var(--up); }
.hero-change.down { background: var(--down-bg); color: var(--down); }
.hero-change .since { font-weight: 400; opacity: 0.75; }

/* Timeframe tiles — neutral ground, colour carried by the figure alone. */
.stat-row { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-bottom: 14px; }
.stat {
  background: var(--tile); border: 1px solid var(--stroke);
  border-radius: 14px; padding: 11px 10px; min-width: 0;
}
.stat-label {
  font-size: 10.5px; font-weight: 600; letter-spacing: 0.05em;
  text-transform: uppercase; color: var(--ink3); margin-bottom: 5px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.stat-value { font-size: 15px; font-weight: 700; line-height: 1.2; }
.stat-value.up { color: var(--up); } .stat-value.down { color: var(--down); }
.stat-value.flat { color: var(--flat); }
.stat-pct { font-size: 11.5px; color: var(--ink3); margin-top: 2px; }

/* Chart */
.chart-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 12px; }
.range-toggle { display: flex; gap: 2px; background: var(--track); border-radius: 999px; padding: 2px; }
.range-toggle button {
  border: 0; background: none; color: var(--ink3); cursor: pointer;
  font: inherit; font-size: 11.5px; font-weight: 600;
  padding: 5px 10px; border-radius: 999px;
}
.range-toggle button.on { background: var(--tile); color: var(--ink); }
.chart-body { position: relative; height: 168px; }
.chart-body svg { display: block; width: 100%; height: 100%; overflow: visible; }
.chart-empty {
  display: flex; align-items: center; justify-content: center;
  height: 100%; font-size: 13px; color: var(--ink3);
}
.chart-caption {
  display: flex; justify-content: space-between; gap: 10px;
  margin-top: 10px; font-size: 11.5px; color: var(--ink3);
}
.chart-line { fill: none; stroke: var(--accent); stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; }
.chart-area { fill: url(#chartFill); }
.chart-grid { stroke: var(--stroke); stroke-width: 1; }
.chart-dot  { fill: var(--accent); }

/* Growth sits on the right of the hero at display size — it is the figure the
   eye goes to, and it was previously buried inside the pill as small text. */
.hero-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-top: 14px;
  flex-wrap: wrap;
}
.hero-foot .hero-change { margin-top: 0; }
.hero-pct {
  font-size: clamp(22px, 6.5vw, 30px);
  font-weight: 700;
  line-height: 1;
  letter-spacing: -0.01em;
  margin-left: auto;
}
.hero-pct.up   { color: var(--up); }
.hero-pct.down { color: var(--down); }
