@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700;800&family=DM+Serif+Display&display=swap');

/* ══════════════════════════════════════════════════════════════════════
   Soum's Board — Shared CSS (iOS-inspired design system)
   ══════════════════════════════════════════════════════════════════════ */

/* ── DESIGN TOKENS — Reading Room palette ─────────────────────────────
   Forest green on warm paper, warm-charcoal chrome. The forest is the
   single point of saturated color; the dark warm-neutral chrome and
   cream paper bg do all the structural work.                           */
:root {
  /* Typography */
  --font: -apple-system, "SF Pro Display", BlinkMacSystemFont, "Inter", "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --font-mono: "SF Mono", ui-monospace, SFMono-Regular, Menlo, monospace;

  /* iOS System Colors (escape hatch — rarely used) */
  --ios-blue: #007AFF;
  --ios-green: #34C759;
  --ios-red: #FF3B30;
  --ios-orange: #FF9500;
  --ios-yellow: #FFCC00;
  --ios-purple: #AF52DE;
  --ios-pink: #FF2D55;
  --ios-teal: #5AC8FA;
  --ios-indigo: #5856D6;

  /* Semantic Colors — Light (cream paper) */
  --bg: #FAF7F0;
  --surface: #ffffff;
  --surface2: #F2EEE3;
  --surface-glass: rgba(255, 252, 245, 0.78);
  --border: #E2DCCC;
  --separator: rgba(40, 32, 20, 0.08);
  --blue: #2D5016;
  --blue-light: #E4ECDB;
  --green: #3D7A4E;
  --green-light: #E2EFE3;
  --orange: #B5670E;
  --orange-light: #FBEAD3;
  --red: #A8261C;
  --red-light: #FBE9E5;
  --navy: #1F1D18;
  --gray: #7C7766;
  --text: #1A1814;
  --text2: #4A4639;
  --text3: #8E8773;
  --hover: #EEEAE0;
  --panel-bg: #ffffff;
  --input-bg: #ffffff;
  --input-border: #D2CCB8;

  /* Radii */
  --radius: 14px;
  --radius-sm: 10px;
  --radius-xl: 28px;
  --radius-pill: 100px;

  /* Shadows */
  --shadow: 0 1px 3px rgba(0, 0, 0, 0.06), 0 2px 8px rgba(0, 0, 0, 0.04);
  --shadow-lg: 0 4px 16px rgba(0, 0, 0, 0.08), 0 1px 4px rgba(0, 0, 0, 0.04);
  --shadow-sheet: 0 -4px 32px rgba(0, 0, 0, 0.12);

  /* Motion */
  --ease-spring: cubic-bezier(0.34, 1.56, 0.64, 1);
  --ease-smooth: cubic-bezier(0.25, 0.1, 0.25, 1);
  --duration: 0.2s;

  /* Layout */
  --sidebar-w: 220px;
  --sidebar-collapsed: 54px;
  --header-h: 56px;
  --tab-bar-h: 83px;
}

[data-theme="dark"] {
  /* Paper darkens to warm coffee, forest brightens to moss */
  --bg: #14120D;
  --surface: #1F1D18;
  --surface2: #1A1813;
  --surface-glass: rgba(31, 29, 24, 0.78);
  --border: #3A352B;
  --separator: rgba(255, 250, 230, 0.06);
  --blue: #7FA859;
  --blue-light: #1F3A0F;
  --green: #5BAE74;
  --green-light: #122E1C;
  --orange: #DF9450;
  --orange-light: #3A1F08;
  --red: #DD7568;
  --red-light: #361211;
  --navy: #2A2722;
  --gray: #A8A28C;
  --text: #F4F1E3;
  --text2: #B5B09A;
  --text3: rgba(244, 241, 227, 0.32);
  --hover: rgba(255, 250, 230, 0.06);
  --panel-bg: #1F1D18;
  --input-bg: #2A2722;
  --input-border: #4D4839;
  --shadow: inset 0 1px 0 rgba(255,255,255,0.05), 0 1px 2px rgba(0,0,0,0.2), 0 4px 12px rgba(0,0,0,0.3), 0 0 0 1px rgba(255,255,255,0.06);
  --shadow-lg: 0 4px 16px rgba(0, 0, 0, 0.4), 0 1px 4px rgba(0, 0, 0, 0.2);
  --shadow-sheet: 0 -4px 32px rgba(0, 0, 0, 0.5);
  --heading-accent: #B5D284;
}

/* ── DESIGN SYSTEM TOKEN SUPPLEMENT ───────────────────────────────────
   Sourced from soum-s-board-design-system bundle. Existing aliases
   (--surface2, --text2, --text3) are preserved; the system's hyphenated
   variants (--surface-2, --text-2, --text-3) are added as siblings.    */
:root {
  /* Type stacks */
  --font-sans: -apple-system, "SF Pro Display", BlinkMacSystemFont, "Inter", "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --font-serif: "DM Serif Display", Georgia, serif;

  /* Type scale */
  --fs-10: 10px;
  --fs-11: 11px;
  --fs-12: 12px;
  --fs-13: 13px;
  --fs-15: 15px;
  --fs-17: 17px;
  --fs-22: 22px;
  --fs-28: 28px;
  --fs-34: 34px;

  --lh-tight: 1.2;
  --lh-snug: 1.4;
  --lh-body: 1.5;
  --lh-loose: 1.6;

  --tracking-tight: -0.02em;
  --tracking-snug: -0.005em;
  --tracking-wide: 0.04em;
  --tracking-wider: 0.06em;
  --tracking-widest: 0.10em;

  --weight-regular: 400;
  --weight-medium: 500;
  --weight-semibold: 600;
  --weight-bold: 700;
  --weight-black: 800;

  /* Brand palette — Forest green + warm charcoal */
  --brand-forest:    #2D5016;   /* core, primary action            */
  --brand-forest-2:  #3D6B1F;   /* highlight, gradient top         */
  --brand-forest-3:  #1F3A0F;   /* depth, gradient bottom          */
  --brand-forest-4:  #14260A;   /* deepest, accent stroke          */
  --brand-forest-5:  #7FA859;   /* lighter, dark-mode + active rail*/

  --brand-chrome-1:  #2A2722;   /* highlight, gradient top         */
  --brand-chrome-2:  #1F1D18;   /* primary chrome                  */
  --brand-chrome-3:  #16140F;   /* deeper                          */
  --brand-chrome-4:  #0E0C08;   /* deepest                         */

  /* Earthy status — paper-flavored */
  --brand-green:     #3D7A4E;
  --brand-orange:    #B5670E;
  --brand-red:       #A8261C;

  /* Back-compat aliases — anything legacy that called the primary
     "blue" or "navy" still works without rewriting components. */
  --brand-blue:    var(--brand-forest);
  --brand-blue-2:  var(--brand-forest-2);
  --brand-blue-3:  var(--brand-forest-3);
  --brand-navy:    var(--brand-chrome-2);
  --brand-navy-2:  var(--brand-chrome-1);
  --brand-navy-3:  var(--brand-chrome-3);
  --brand-navy-4:  var(--brand-chrome-4);

  /* Brand gradients */
  --gradient-mark:        linear-gradient(180deg, #3D6B1F 0%, #2D5016 60%, #1F3A0F 100%);
  --gradient-primary:     linear-gradient(180deg, #3D6B1F 0%, #2D5016 100%);
  --gradient-done:        linear-gradient(180deg, #4A9461 0%, #3D7A4E 100%);
  --gradient-sidebar:
    radial-gradient(110% 60% at 0% 0%, #3A352B 0%, transparent 55%),
    radial-gradient(110% 80% at 100% 100%, #08060A 0%, transparent 60%),
    linear-gradient(180deg, #2A2722 0%, #1F1D18 60%, #0E0C08 100%);
  --gradient-header:      linear-gradient(135deg, #2A2722 0%, #1F1D18 60%, #16140F 100%);
  --gradient-active-rail: linear-gradient(180deg, #B5D284 0%, #2D5016 100%);

  /* Brand shadows — forest-tinted bevels */
  --shadow-mark:
    inset 0 1px 0 rgba(255,255,255,0.22),
    inset 0 -1px 0 rgba(0,0,0,0.18),
    0 4px 10px rgba(45, 80, 22, 0.34),
    0 0 0 1px rgba(255,255,255,0.06);
  --shadow-mark-lg:
    inset 0 2px 0 rgba(255,255,255,0.22),
    inset 0 -2px 0 rgba(0,0,0,0.18),
    0 14px 30px rgba(45, 80, 22, 0.42),
    0 0 0 1px rgba(255,255,255,0.06);
  --shadow-primary:
    inset 0 1px 0 rgba(255,255,255,0.20),
    0 1px 2px rgba(20, 14, 6, 0.12),
    0 4px 12px rgba(45, 80, 22, 0.28);

  /* Hyphenated semantic aliases mirroring the design system */
  --surface-2: var(--surface2);
  --text-2: var(--text2);
  --text-3: var(--text3);

  /* Spacing scale */
  --space-1: 4px;
  --space-2: 8px;
  --space-3: 12px;
  --space-4: 16px;
  --space-5: 20px;
  --space-6: 24px;
  --space-8: 32px;
  --space-10: 40px;
  --space-12: 48px;

  /* Additional radii */
  --radius-lg: 20px;
  --radius-circle: 50%;

  /* Focus rings — forest-green-tinted */
  --shadow-focus-blue: 0 0 0 3px rgba(61, 107, 31, 0.28);
  --shadow-focus-soft: 0 0 0 3px rgba(61, 107, 31, 0.20);

  /* Motion durations */
  --duration-fast: 0.15s;
  --duration-slow: 0.3s;

  /* Layout */
  --content-max: 1500px;

  /* Texture — dark chrome surfaces only (sidebar, header) */
  --noise-svg: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='180' height='180'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='2' seed='4'/><feColorMatrix values='0 0 0 0 1  0 0 0 0 1  0 0 0 0 1  0 0 0 0.6 0'/></filter><rect width='100%' height='100%' filter='url(%23n)'/></svg>");
  --noise-opacity: 0.18;
}

[data-theme="dark"] {
  --surface-2: var(--surface2);
  --text-2: var(--text2);
  --text-3: var(--text3);
}

/* ══════════════════════════════════════════════════════════════════════
   SEMANTIC TYPE ROLES — apply to elements directly
   (Do not rename existing classes; these are additive.)
   ══════════════════════════════════════════════════════════════════════ */

.t-display {
  font-family: var(--font-sans); font-size: var(--fs-28); font-weight: var(--weight-bold);
  letter-spacing: var(--tracking-tight); line-height: var(--lh-tight); color: var(--text);
}
.t-header {
  font-family: var(--font-sans); font-size: var(--fs-17); font-weight: var(--weight-semibold);
  color: #fff;
}
.t-card-title {
  font-family: var(--font-sans); font-size: var(--fs-15); font-weight: var(--weight-semibold);
  line-height: var(--lh-snug); color: var(--text);
}
.t-stat {
  font-family: var(--font-sans); font-size: var(--fs-34); font-weight: var(--weight-bold);
  letter-spacing: var(--tracking-tight); line-height: 1;
}
.t-body {
  font-family: var(--font-sans); font-size: var(--fs-13); line-height: var(--lh-loose); color: var(--text);
}
.t-body-2 {
  font-family: var(--font-sans); font-size: var(--fs-12); color: var(--text-2);
}
.t-caption {
  font-family: var(--font-sans); font-size: var(--fs-11); color: var(--text-3);
}
.t-label {
  font-family: var(--font-sans); font-size: var(--fs-11); font-weight: var(--weight-medium);
  text-transform: uppercase; letter-spacing: var(--tracking-wider); color: var(--text-3);
}
.t-eyebrow {
  font-family: var(--font-sans); font-size: var(--fs-10); font-weight: var(--weight-medium);
  text-transform: uppercase; letter-spacing: var(--tracking-widest); color: var(--gray);
}
.t-column-name {
  font-family: var(--font-sans); font-size: var(--fs-13); font-weight: var(--weight-semibold);
  text-transform: uppercase; letter-spacing: var(--tracking-wide); color: var(--text-3);
}
.t-mono {
  font-family: var(--font-mono); font-size: var(--fs-12);
}
.t-micro {
  font-family: var(--font-sans); font-size: var(--fs-10); font-weight: var(--weight-semibold); color: var(--gray);
}

/* ── RESET ───────────────────────────────────────────────────────────── */
* { box-sizing: border-box; margin: 0; padding: 0; }
body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  transition: background var(--duration) var(--ease-smooth), color var(--duration) var(--ease-smooth);
  overflow-x: hidden;
}

/* ── SIDEBAR (v2 — design-system) ─────────────────────────────────────── */
.sidebar {
  position: fixed; left: 0; top: 0; bottom: 0;
  width: var(--sidebar-w);
  background: var(--gradient-sidebar);
  box-shadow: 0 24px 60px rgba(0,0,0,0.5), inset 0 1px 0 rgba(255,255,255,0.08);
  display: flex; flex-direction: column;
  z-index: 150;
  border-right: 1px solid rgba(255,255,255,0.08);
  transition: width var(--duration) var(--ease-smooth);
  overflow: hidden;
}
.sidebar::after {
  content: ''; position: absolute; inset: 0; pointer-events: none;
  background-image: var(--noise-svg);
  opacity: var(--noise-opacity); mix-blend-mode: overlay;
}
[data-theme="dark"] .sidebar {
  background:
    radial-gradient(110% 60% at 0% 0%, #2A2722 0%, transparent 55%),
    radial-gradient(110% 80% at 100% 100%, #07050B 0%, transparent 60%),
    linear-gradient(180deg, #1F1D18 0%, #14120D 60%, #0E0C08 100%);
}
.sidebar.collapsed { width: var(--sidebar-collapsed); }
.sidebar.collapsed .sidebar-label,
.sidebar.collapsed .sidebar-mark,
.sidebar.collapsed .sidebar-section,
.sidebar.collapsed .sidebar-badge,
.sidebar.collapsed .sidebar-item span:not(.sidebar-icon) { display: none; }
.sidebar.collapsed .sidebar-item { justify-content: center; padding: 10px 0; }
.sidebar.collapsed .sidebar-icon { margin: 0; }
.sidebar.collapsed .sidebar-logo { justify-content: center; padding: 18px 0 16px; }
.sidebar-toggle {
  background: none; border: none; color: rgba(255,255,255,0.4); cursor: pointer;
  font-size: 14px; padding: 4px 6px; border-radius: 5px;
  transition: color var(--duration), background var(--duration);
  margin-left: auto; flex-shrink: 0;
}
.sidebar-toggle:hover { color: white; background: rgba(255,255,255,0.08); }
.sidebar.collapsed .sidebar-toggle { margin: 0 auto; }
.sidebar-logo {
  display: flex; align-items: center; gap: 10px;
  padding: 18px 14px 16px;
  border-bottom: 1px solid rgba(255,250,230,0.10);
  flex-shrink: 0; position: relative; z-index: 1;
}
.sidebar-mark {
  width: 30px; height: 30px; border-radius: 8px;
  background: var(--gradient-mark);
  box-shadow: var(--shadow-mark);
  display: flex; align-items: center; justify-content: center;
  font-size: 11px; font-weight: 800; color: white; letter-spacing: -0.5px; flex-shrink: 0;
  position: relative;
}
.sidebar-mark::after {
  content: ''; position: absolute; inset: 2px; border-radius: 6px;
  background: radial-gradient(70% 50% at 50% 0%, rgba(255,255,255,0.18) 0%, transparent 70%);
  pointer-events: none;
}
.sidebar-label { line-height: 1.2; overflow: hidden; }
.sidebar-label span { display: block; font-size: 13px; font-weight: 600; color: rgba(255,255,255,0.9); white-space: nowrap; }
.sidebar-label small { font-size: 11px; color: rgba(255,255,255,0.35); }
.sidebar-nav {
  flex: 1; padding: 10px 14px;
  display: flex; flex-direction: column; gap: 2px;
  overflow-y: auto; position: relative; z-index: 1;
}
.sidebar-section {
  font-size: 9.5px; font-weight: 700; text-transform: uppercase;
  letter-spacing: 0.18em; color: rgba(255,255,255,0.30);
  padding: 14px 10px 6px; white-space: nowrap; overflow: hidden;
}
.sidebar-item {
  position: relative;
  display: flex; align-items: center; gap: 10px;
  padding: 8px 10px; border-radius: var(--radius-sm);
  color: rgba(255,255,255,0.55); font-size: 13px; font-weight: 500;
  text-decoration: none; transition: all var(--duration) var(--ease-smooth);
  white-space: nowrap; cursor: pointer; border: none;
  font-family: inherit; width: 100%; background: transparent;
  min-height: 44px;
}
.sidebar-item:hover { color: rgba(255,255,255,0.92); background: rgba(255,255,255,0.06); }
.sidebar-item.active {
  color: white; font-weight: 600;
  background: linear-gradient(90deg, rgba(127,168,89,0.30) 0%, rgba(127,168,89,0.10) 100%);
}
.sidebar-item.active::before {
  content: ''; position: absolute; left: -10px; top: 6px; bottom: 6px;
  width: 3px; border-radius: 0 3px 3px 0;
  background: var(--gradient-active-rail);
  box-shadow: 0 0 12px rgba(181,210,132,0.45);
}
.sidebar-icon { width: 20px; height: 20px; flex-shrink: 0; font-size: 15px; display: inline-flex; align-items: center; justify-content: center; }
.sidebar-icon svg { width: 18px; height: 18px; display: block; }
.sidebar-badge {
  margin-left: auto;
  background: #ef4444; color: #fff;
  font-size: 9.5px; font-weight: 700;
  padding: 1px 6px; border-radius: 100px;
  min-width: 16px; text-align: center; line-height: 1.4;
  box-shadow: 0 1px 2px rgba(0,0,0,0.20);
}
.sidebar-badge.hidden { display: none; }
.sidebar-footer {
  padding: 10px 14px 16px;
  border-top: 1px solid rgba(255,250,230,0.10);
  display: flex; flex-direction: column; gap: 2px; flex-shrink: 0;
  position: relative; z-index: 1;
}
.sidebar-mode {
  display: flex; align-items: center;
  background: rgba(0,0,0,0.25); border-radius: var(--radius-sm);
  padding: 3px; gap: 2px; margin: 0 2px 6px; border: 1px solid rgba(255,255,255,0.1);
}
.sidebar-mode a {
  flex: 1; padding: 5px 0; border-radius: 7px;
  font-size: 11px; font-weight: 600; color: rgba(255,255,255,0.45);
  text-align: center; text-decoration: none; transition: all 0.15s;
}
.sidebar-mode a.active { background: rgba(255,255,255,0.15); color: white; }

/* ── HEADER (Frosted Glass Nav Bar) ──────────────────────────────────── */
header {
  background: var(--gradient-header);
  color: white;
  padding: 0 20px;
  display: flex; align-items: center;
  height: var(--header-h);
  position: sticky; top: 0; z-index: 200;
  border-bottom: 1px solid rgba(255,255,255,0.08);
  gap: 12px;
}
/* Header v2 noise overlay (CP-5) — same treatment as sidebar v2 */
header::after {
  content: ''; position: absolute; inset: 0; pointer-events: none;
  background-image: var(--noise-svg);
  opacity: var(--noise-opacity); mix-blend-mode: overlay;
}
header > * { position: relative; }

/* Header v2 — page-context block (CP-5) */
.h-context {
  display: flex; flex-direction: column; gap: 0; line-height: 1.15;
  min-width: 0;
}
.h-eyebrow {
  font-size: 9.5px; font-weight: 600; letter-spacing: 0.20em;
  text-transform: uppercase; color: rgba(255,255,255,0.55);
}
.h-page {
  font-size: 16px; font-weight: 600; color: #fff;
  letter-spacing: -0.005em; margin-top: 1px;
}

/* Header v2 — inline frosted search (CP-5) */
.h-search {
  flex: 1; max-width: 380px; margin: 0 auto; position: relative;
}
.h-search input {
  width: 100%; box-sizing: border-box;
  padding: 7px 12px 7px 32px;
  background: rgba(255,255,255,0.10);
  border: 1px solid rgba(255,255,255,0.10);
  border-radius: 100px;
  font-family: inherit; font-size: 12.5px; color: #fff; outline: none;
}
.h-search input::placeholder { color: rgba(255,255,255,0.50); }
.h-search input:focus { background: rgba(255,255,255,0.16); border-color: rgba(255,255,255,0.25); }
.h-search .h-kbd {
  position: absolute; right: 8px; top: 50%; transform: translateY(-50%);
  font-family: var(--font-mono, ui-monospace, SFMono-Regular, Menlo, monospace);
  font-size: 9px; color: rgba(255,255,255,0.55);
  background: rgba(255,255,255,0.08); border: 1px solid rgba(255,255,255,0.12);
  border-radius: 4px; padding: 1px 5px;
}
.h-search-icon {
  position: absolute; left: 10px; top: 50%; transform: translateY(-50%);
  width: 14px; height: 14px; color: rgba(255,255,255,0.55);
}
/* Search dropdown */
.search-dropdown {
  position: absolute; top: calc(100% + 8px); left: 0; right: 0;
  background: var(--surface); border-radius: var(--radius); box-shadow: var(--shadow-lg);
  border: 1px solid var(--border); max-height: 360px; overflow-y: auto;
  display: none; z-index: 500;
}
.search-dropdown.open { display: block; }
.search-loading, .search-empty {
  padding: 16px; text-align: center; font-size: 13px; color: var(--text2);
}
.search-spinner {
  display: inline-block; width: 14px; height: 14px; border: 2px solid var(--border);
  border-top-color: var(--blue); border-radius: 50%; margin-right: 8px;
  animation: spin 0.6s linear infinite; vertical-align: middle;
}
@keyframes spin { to { transform: rotate(360deg); } }
.search-group-label {
  font-size: 10px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.08em;
  color: var(--gray); padding: 10px 14px 4px;
}
.search-result {
  display: block; padding: 10px 14px; text-decoration: none;
  border-bottom: 1px solid var(--separator, rgba(60,60,67,0.06));
  transition: background 0.1s;
}
.search-result:last-child { border-bottom: none; }
.search-result:hover, .search-result.active { background: var(--hover); }
.search-result-title { font-size: 13px; font-weight: 600; color: var(--text); line-height: 1.3; }
.search-result-meta { font-size: 11px; color: var(--gray); margin-top: 2px; }
.search-see-all {
  display: block; padding: 12px 14px; text-align: center;
  font-size: 12px; font-weight: 600; color: var(--blue); text-decoration: none;
  border-top: 1px solid var(--border); transition: background 0.1s;
}
.search-see-all:hover { background: var(--hover); }

.h-icon-btn {
  width: 30px; height: 30px; border-radius: 8px;
  border: 1px solid rgba(255,255,255,0.10);
  background: rgba(255,255,255,0.06);
  color: rgba(255,255,255,0.80);
  cursor: pointer;
  display: inline-flex; align-items: center; justify-content: center;
  transition: background 0.15s, color 0.15s;
}
.h-icon-btn svg { width: 15px; height: 15px; display: block; }
.h-icon-btn:hover { background: rgba(255,255,255,0.12); color: #fff; }
.h-avatar {
  width: 30px; height: 30px; border-radius: 50%;
  background: var(--gradient-primary);
  color: #fff; font-size: 10px; font-weight: 800; letter-spacing: -0.3px;
  display: inline-flex; align-items: center; justify-content: center;
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.20), 0 1px 2px rgba(0,0,0,0.20);
}
.header-left { display: flex; align-items: center; gap: 10px; flex-shrink: 0; }
.header-icon {
  width: 30px; height: 30px; border-radius: 8px;
  background: var(--gradient-mark);
  box-shadow: var(--shadow-mark);
  display: flex; align-items: center; justify-content: center;
  font-size: 11px; font-weight: 800; color: white; text-decoration: none;
  position: relative;
}
.header-icon::after {
  content: ''; position: absolute; inset: 2px; border-radius: 6px;
  background: radial-gradient(70% 50% at 50% 0%, rgba(255,255,255,0.18) 0%, transparent 70%);
  pointer-events: none;
}
header h1 { font-size: 17px; font-weight: 600; color: white; }
header p { font-size: 11px; color: rgba(255,255,255,0.45); margin-top: 1px; }
.header-center { flex: 1; display: flex; justify-content: center; align-items: center; position: relative; }
.header-right { display: flex; align-items: center; gap: 6px; flex-shrink: 0; }
.btn {
  background: var(--hover); color: var(--text);
  border: none; border-radius: var(--radius-sm);
  padding: 6px 13px; font-size: 13px; cursor: pointer;
  display: flex; align-items: center; gap: 5px;
  transition: background var(--duration); text-decoration: none;
}
.btn:hover { background: var(--surface2); }

/* ── DESIGN-SYSTEM BUTTONS ───────────────────────────────────────────
   Opt-in classes for new surfaces. Existing .save-btn / .add-card-btn /
   etc. are untouched so we don't risk regressing existing screens.   */
.btn-primary {
  background: var(--gradient-primary);
  color: #fff; border: none; border-radius: var(--radius-sm);
  padding: 10px 18px; font-size: 14px; font-weight: var(--weight-semibold);
  font-family: inherit; cursor: pointer;
  box-shadow: var(--shadow-primary);
  transition: transform 0.1s, box-shadow var(--duration-fast), filter var(--duration-fast);
  letter-spacing: var(--tracking-snug);
}
.btn-primary:hover { filter: brightness(1.04); }
.btn-primary:active {
  transform: scale(0.98);
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.22), 0 1px 2px rgba(20,14,6,0.12);
}
.btn-secondary {
  background: var(--surface); color: var(--text);
  border: 1px solid var(--border); border-radius: var(--radius-sm);
  padding: 9px 16px; font-size: 14px; font-weight: var(--weight-semibold);
  font-family: inherit; cursor: pointer;
  box-shadow: 0 1px 2px rgba(20,14,6,0.06);
  transition: background var(--duration-fast), border-color var(--duration-fast);
}
.btn-secondary:hover { background: var(--surface2); }
.btn-secondary:active { transform: scale(0.98); }
.btn-ghost {
  background: transparent; color: var(--text2);
  border: none; border-radius: 8px;
  padding: 9px 12px; font-size: 14px; font-weight: var(--weight-medium);
  font-family: inherit; cursor: pointer;
  transition: background var(--duration-fast), color var(--duration-fast);
}
.btn-ghost:hover { background: var(--hover); color: var(--text); }
.btn-destructive {
  background: transparent; color: var(--red);
  border: 1px solid #f5c2c2; border-radius: var(--radius-sm);
  padding: 9px 16px; font-size: 14px; font-weight: var(--weight-semibold);
  font-family: inherit; cursor: pointer;
  transition: background var(--duration-fast), border-color var(--duration-fast);
}
.btn-destructive:hover { background: var(--red-light); }

.theme-btn { color: white;
  background: none; border: none; color: var(--text2);
  font-size: 18px; cursor: pointer; padding: 4px 6px;
  border-radius: 6px; line-height: 1; opacity: 0.7;
}
.theme-btn:hover { opacity: 1; background: var(--hover); }
.mode-pill {
  display: inline-flex; align-items: center;
  background: rgba(0,0,0,0.22); border-radius: 100px; padding: 3px;
  gap: 2px; border: 1px solid rgba(255,255,255,0.10);
}
.mode-pill a {
  padding: 4px 12px; border-radius: 100px;
  font-size: 11.5px; font-weight: 600;
  color: rgba(255,255,255,0.55); text-decoration: none;
  transition: all 0.15s;
}
.mode-pill a.active {
  background: rgba(255,255,255,0.95); color: #1e2f54;
  box-shadow: 0 1px 2px rgba(15,37,64,0.20);
}

/* ── NAV TABS ────────────────────────────────────────────────────────── */
.nav-tabs { display: flex; gap: 2px; align-items: center; }
.nav-tab {
  padding: 6px 14px; border-radius: var(--radius-pill);
  font-size: 13px; font-weight: 500; color: rgba(255,255,255,0.6);
  background: transparent; border: none; cursor: pointer;
  text-decoration: none; transition: all var(--duration) var(--ease-smooth);
  white-space: nowrap; font-family: inherit;
}
.nav-tab:hover { color: white; background: rgba(255,255,255,0.1); }
.nav-tab.active { color: white; background: rgba(255,255,255,0.18); font-weight: 600; }
.nav-more { position: relative; }
.nav-more-btn {
  padding: 6px 10px; border-radius: 7px; font-size: 13px;
  color: rgba(255,255,255,0.55); background: transparent; border: none;
  cursor: pointer; transition: all 0.12s; line-height: 1;
}
.nav-more-btn:hover, .nav-more.open .nav-more-btn { color: white; background: rgba(255,255,255,0.1); }
.nav-dropdown {
  display: none; position: absolute; top: calc(100% + 8px); right: 0;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); min-width: 150px; z-index: 300;
  overflow: hidden; box-shadow: var(--shadow-lg);
}
.nav-more.open .nav-dropdown { display: block; }
.nav-dropdown a {
  display: block; padding: 10px 14px; color: var(--text2);
  font-size: 13px; text-decoration: none;
  border-bottom: 1px solid var(--separator);
}
.nav-dropdown a:last-child { border-bottom: none; }
.nav-dropdown a:hover { background: var(--hover); color: var(--text); }

/* ── MOBILE NAV ──────────────────────────────────────────────────────── */
.nav-mobile-trigger {
  display: none; align-items: center; gap: 6px;
  background: rgba(255,255,255,0.12); border: 1px solid rgba(255,255,255,0.18);
  border-radius: var(--radius-sm); padding: 6px 12px;
  cursor: pointer; color: white; font-size: 13px;
  font-weight: 600; font-family: inherit;
}
.nav-mobile-trigger .chevron { font-size: 10px; opacity: 0.5; transition: transform 0.15s; display: inline-block; }
.nav-mobile-trigger.open .chevron { transform: rotate(180deg); }
.nav-mobile-dropdown {
  display: none; position: absolute; top: calc(100% + 8px);
  left: 50%; transform: translateX(-50%);
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); min-width: 200px; z-index: 500;
  overflow: hidden; box-shadow: var(--shadow-lg);
}
.nav-mobile-dropdown.open { display: block; }
.nav-mobile-dropdown a {
  display: block; padding: 13px 18px; color: var(--text2);
  font-size: 15px; text-decoration: none;
  border-bottom: 1px solid var(--separator);
}
.nav-mobile-dropdown a:last-child { border-bottom: none; }
.nav-mobile-dropdown a.active { color: var(--blue); font-weight: 600; }
.nav-mobile-dropdown a:hover { background: var(--hover); color: var(--text); }

/* ── PAGE BODY ───────────────────────────────────────────────────────── */
.page-body { margin-left: var(--sidebar-w); transition: margin-left var(--duration) var(--ease-smooth); }

/* ── TOAST (Top-center pill) ─────────────────────────────────────────── */
#toast {
  position: fixed; top: 16px; left: 50%; transform: translateX(-50%) translateY(-20px);
  background: var(--surface-glass);
  backdrop-filter: blur(20px) saturate(180%);
  -webkit-backdrop-filter: blur(20px) saturate(180%);
  color: var(--text); padding: 10px 20px;
  border-radius: var(--radius-pill); border: 1px solid var(--border);
  font-size: 13px; font-weight: 600;
  opacity: 0; transition: all 0.3s var(--ease-spring);
  pointer-events: none; z-index: 9999;
  box-shadow: var(--shadow-lg);
}
#toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

/* ── PULL TO REFRESH ──────────────────────────────────────────────────── */
.ptr-indicator { position: fixed; top: -50px; left: 50%; transform: translateX(-50%); width: 36px; height: 36px; border-radius: 50%; background: var(--surface); border: 1px solid var(--border); box-shadow: var(--shadow); display: flex; align-items: center; justify-content: center; font-size: 16px; z-index: 9999; transition: top 0.2s; }
.ptr-indicator.pulling { top: 12px; }
.ptr-indicator.refreshing { top: 12px; animation: ptr-spin 0.6s linear infinite; }
@keyframes ptr-spin { to { transform: translateX(-50%) rotate(360deg); } }

/* ── UTILITIES ───────────────────────────────────────────────────────── */
.hidden { display: none !important; }

/* ── MOBILE BREAKPOINT ───────────────────────────────────────────────── */
@media (max-width: 640px) {
  .sidebar { display: none !important; }
  .page-body { margin-left: 0 !important; }

  /* Header: hide desktop-only elements, show mobile nav trigger */
  header { padding: 0 12px; gap: 8px; }
  .h-context { display: none; }
  .mode-pill { display: none; }
  .h-icon-btn { display: none; }
  .h-avatar { display: none; }
  .h-kbd { display: none; }
  .h-search { max-width: none; flex: 1; margin: 0; }
  .h-search input { font-size: 14px; padding: 9px 12px 9px 32px; }

  /* Mobile nav trigger */
  .nav-mobile-trigger {
    display: flex; align-items: center; gap: 4px;
    background: rgba(255,255,255,0.10); border: 1px solid rgba(255,255,255,0.15);
    border-radius: 8px; padding: 6px 12px;
    color: white; font-size: 13px; font-weight: 600; cursor: pointer;
    font-family: inherit;
  }
  .nav-mobile-trigger .chevron { font-size: 10px; opacity: 0.6; }
  .nav-mobile-dropdown { display: none; position: absolute; top: calc(var(--header-h) - 4px); right: 12px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-sm); box-shadow: var(--shadow-lg); z-index: 300; min-width: 160px; padding: 6px 0; }
  .nav-mobile-dropdown.open { display: block; }
  .nav-mobile-dropdown a { display: block; padding: 10px 16px; font-size: 14px; color: var(--text); text-decoration: none; font-weight: 500; }
  .nav-mobile-dropdown a:hover, .nav-mobile-dropdown a.active { background: var(--hover); color: var(--blue); }

  /* Touch targets */
  .filter-btn, .nav-mobile-trigger, .sidebar-mode a,
  .add-link-btn, .clear-due, .section-collapse-btn,
  .add-card-btn, .hide-col-btn { min-height: 44px; display: inline-flex; align-items: center; }
  .nav-mobile-trigger { min-height: 44px; }
  .theme-btn { min-width: 44px; min-height: 44px; }
}
@media (min-width: 641px) {
  .nav-mobile-trigger { display: none; }
  .nav-mobile-dropdown { display: none !important; }
}

/* ── DESIGN-SYSTEM STAT STRIP ─────────────────────────────────────────
   Opt-in surface for new pages. The current board's `.stat-card` is
   left as-is.                                                          */
.stat-strip {
  position: relative; display: grid; align-items: stretch;
  grid-template-columns: repeat(var(--stat-cols, 4), 1fr);
  background: var(--surface); border-radius: var(--radius-lg);
  padding: 14px 20px; box-shadow: var(--shadow); border: 1px solid var(--border);
}
.stat-strip .stat { position: relative; padding: 6px 22px; display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.stat-strip .stat + .stat::before {
  content: ''; position: absolute; left: 0; top: 8px; bottom: 8px;
  width: 1px; background: var(--separator);
}
.stat-strip .stat:first-child { padding-left: 0; }
.stat-strip .stat:last-child  { padding-right: 0; }
.stat-strip .stat-label {
  font-size: var(--fs-10); font-weight: var(--weight-semibold);
  text-transform: uppercase; letter-spacing: 0.14em; color: var(--text3);
  display: flex; align-items: center; gap: 6px;
}
.stat-strip .stat-label .glyph { font-size: 11px; opacity: 0.85; }
.stat-strip .stat-row { display: flex; align-items: baseline; gap: 10px; margin-top: 4px; }
.stat-strip .stat-value {
  font-size: 38px; font-weight: var(--weight-bold); line-height: 1;
  letter-spacing: -0.025em; color: var(--navy);
}
.stat-strip .stat-value.blue   { color: var(--blue); }
.stat-strip .stat-value.orange { color: var(--orange); }
.stat-strip .stat-value.red    { color: var(--red); }
.stat-strip .stat-value.green  { color: var(--green); }
.stat-strip .stat-trend {
  font-size: var(--fs-10); font-weight: var(--weight-semibold);
  padding: 2px 7px; border-radius: 4px; line-height: 1.3; letter-spacing: -0.005em;
  background: var(--surface2); color: var(--text2);
}
.stat-strip .stat-trend.up   { background: var(--green-light); color: var(--green); }
.stat-strip .stat-trend.down { background: var(--red-light); color: var(--red); }
@media (max-width: 640px) {
  .stat-strip { grid-template-columns: repeat(2, 1fr); padding: 12px 14px; }
  .stat-strip .stat-value { font-size: 26px; }
  .stat-strip .stat + .stat:nth-child(odd)::before { display: none; }
}

/* ── ARCHIVE VIEW BANNER ─────────────────────────────────────────────────── */
.archive-banner {
  background: var(--orange-light); color: var(--orange);
  border-bottom: 1px solid var(--orange);
  padding: 8px 24px; font-size: var(--fs-12, 12px); font-weight: 600;
  letter-spacing: 0.01em;
}
.archive-banner a { color: var(--orange); text-decoration: underline; }
