/* ═══════════════════════════════════════════════════════════════
   FEROCIOUS INTEL — v2 Design System
   Editorial-meets-terminal. Typography-led. Data as art.
   ═══════════════════════════════════════════════════════════════ */

@import url('https://fonts.googleapis.com/css2?family=Fraunces:ital,opsz,wght@0,9..144,400;0,9..144,500;0,9..144,600;0,9..144,700;1,9..144,400;1,9..144,500;1,9..144,600;1,9..144,700&family=Manrope:wght@400;500;600;700;800&family=JetBrains+Mono:wght@400;500;600&display=swap');

/* ═══ DESIGN TOKENS ═══ */
:root {
  /* Surface stack — warm near-black with subtle gradation */
  --ink: #0A0A0B;
  --surface-0: #0E0F11;
  --surface-1: #15171A;
  --surface-2: #1C1F23;
  --surface-3: #24272C;
  --surface-hover: #1A1D21;

  /* Hairlines — very subtle, not crunchy */
  --hairline: rgba(255, 255, 255, 0.06);
  --hairline-strong: rgba(255, 255, 255, 0.10);
  --hairline-focus: rgba(255, 138, 61, 0.35);

  /* Text — high contrast primary, restrained secondaries */
  --ink-100: #FAFAFA;
  --ink-300: #D4D4D8;
  --ink-500: #A1A1AA;
  --ink-700: #71717A;
  --ink-900: #3F3F46;

  /* Ferocious Crimson — confident, aggressive, unmistakable */
  --ember: #E11D48;
  --ember-hi: #F43F5E;
  --ember-soft: rgba(225, 29, 72, 0.12);
  --ember-softer: rgba(225, 29, 72, 0.06);
  --ember-edge: rgba(225, 29, 72, 0.35);

  /* Semantic — muted, refined. Status red is DISTINCT from brand red */
  --green: #4ADE80;
  --green-soft: rgba(74, 222, 128, 0.10);
  --red: #F87171; /* status red — lighter so it reads as "warning" not "brand" */
  --red-soft: rgba(248, 113, 113, 0.10);
  --amber: #FBBF24;
  --amber-soft: rgba(251, 191, 36, 0.10);
  --blue: #60A5FA;
  --blue-soft: rgba(96, 165, 250, 0.10);
  --purple: #C084FC;
  --purple-soft: rgba(192, 132, 252, 0.10);
  --gold-star: #FDE047;

  /* Typography */
  --font-display: 'Fraunces', Georgia, serif;
  --font-ui: 'Manrope', -apple-system, sans-serif;
  --font-mono: 'JetBrains Mono', monospace;

  /* Scale */
  --text-xs: 11px;
  --text-sm: 13px;
  --text-base: 15px;
  --text-md: 16px;
  --text-lg: 18px;
  --text-xl: 22px;
  --text-2xl: 28px;
  --text-3xl: 36px;
  --text-4xl: 48px;
  --text-5xl: 64px;
  --text-6xl: 84px;

  /* Spacing — 4px base */
  --s-1: 4px;
  --s-2: 8px;
  --s-3: 12px;
  --s-4: 16px;
  --s-5: 20px;
  --s-6: 24px;
  --s-8: 32px;
  --s-10: 40px;
  --s-12: 48px;
  --s-16: 64px;
  --s-20: 80px;

  /* Radii — mostly crisp */
  --r-xs: 4px;
  --r-sm: 6px;
  --r-md: 8px;
  --r-lg: 12px;
  --r-xl: 16px;

  /* Shadows — atmospheric, not plastic */
  --shadow-sm: 0 1px 2px rgba(0,0,0,0.2);
  --shadow-md: 0 4px 16px rgba(0,0,0,0.3);
  --shadow-lg: 0 16px 48px rgba(0,0,0,0.4);
  --shadow-ember: 0 0 0 1px var(--ember-edge), 0 8px 32px rgba(255,138,61,0.15);

  /* Sidebar */
  --sidebar-w: 240px;
  --sidebar-collapsed: 64px;

  /* Transitions */
  --t-fast: 120ms cubic-bezier(0.4, 0, 0.2, 1);
  --t-base: 200ms cubic-bezier(0.4, 0, 0.2, 1);
  --t-slow: 320ms cubic-bezier(0.4, 0, 0.2, 1);
}

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

html { -webkit-text-size-adjust: 100%; }

body {
  font-family: var(--font-ui);
  background: var(--ink);
  color: var(--ink-300);
  min-height: 100vh;
  font-size: var(--text-base);
  line-height: 1.55;
  font-feature-settings: 'ss01', 'cv11';
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overflow-x: hidden;
}
/* Locks page scroll when a mobile overlay (sidebar / player panel) is open.
   Without this, swiping inside the overlay scroll-chains to the page and the
   page content moves behind the overlay — feels broken and can push the overlay
   contents out of reach. */
body.no-scroll {
  overflow: hidden;
  position: fixed;
  width: 100%;
}

/* Subtle background — no grid, no scanlines, just atmosphere */
body::before {
  content: '';
  position: fixed;
  inset: 0;
  background:
    radial-gradient(ellipse 80% 40% at 20% 0%, rgba(225, 29, 72, 0.05) 0%, transparent 60%),
    radial-gradient(ellipse 70% 50% at 90% 100%, rgba(225, 29, 72, 0.02) 0%, transparent 50%);
  pointer-events: none;
  z-index: 0;
}

/* ═══ SCROLLBAR ═══ */
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb {
  background: var(--surface-3);
  border-radius: 10px;
  border: 2px solid var(--ink);
}
::-webkit-scrollbar-thumb:hover { background: var(--ink-900); }

/* ═══ TYPOGRAPHY UTILITIES ═══ */
.display {
  font-family: var(--font-display);
  font-style: italic;
  font-weight: 400;
  letter-spacing: -0.02em;
  line-height: 1;
  color: var(--ink-100);
}
.display-xl { font-size: var(--text-6xl); }
.display-lg { font-size: var(--text-5xl); }
.display-md { font-size: var(--text-4xl); }
.display-sm { font-size: var(--text-3xl); }

.mono { font-family: var(--font-mono); font-feature-settings: 'zero'; }

.label {
  font-family: var(--font-ui);
  font-size: var(--text-xs);
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--ink-500);
}

.title {
  font-family: var(--font-ui);
  font-weight: 700;
  letter-spacing: -0.015em;
  color: var(--ink-100);
}
.title-xl { font-size: var(--text-2xl); line-height: 1.2; }
.title-lg { font-size: var(--text-xl); line-height: 1.25; }
.title-md { font-size: var(--text-lg); line-height: 1.3; }

.muted { color: var(--ink-500); }
.dim { color: var(--ink-700); }

/* ═══ APP SHELL ═══ */
.app {
  display: grid;
  grid-template-columns: var(--sidebar-w) 1fr;
  min-height: 100vh;
  position: relative;
  z-index: 1;
}

/* ═══ SIDEBAR ═══ */
.sidebar {
  background: var(--surface-0);
  border-right: 1px solid var(--hairline);
  display: flex;
  flex-direction: column;
  position: sticky;
  top: 0;
  height: 100vh;
  height: 100dvh; /* dynamic viewport height — excludes mobile URL bar */
  overflow-y: auto;
  overscroll-behavior: contain; /* swipes inside sidebar stay inside */
  -webkit-overflow-scrolling: touch;
  /* Room for iOS home indicator and a comfortable bottom tap target */
  padding-bottom: env(safe-area-inset-bottom, 0px);
}

.sidebar-brand {
  padding: var(--s-6) var(--s-5);
  display: flex;
  align-items: baseline;
  gap: var(--s-2);
  border-bottom: 1px solid var(--hairline);
}
.sidebar-brand .mark {
  font-family: var(--font-display);
  font-style: italic;
  font-size: 26px;
  font-weight: 500;
  color: var(--ember);
  letter-spacing: -0.02em;
  line-height: 1;
}
.sidebar-brand .name {
  font-family: var(--font-ui);
  font-size: var(--text-md);
  font-weight: 700;
  color: var(--ink-100);
  letter-spacing: -0.02em;
}
.sidebar-brand .div {
  width: 1px;
  height: 14px;
  background: var(--hairline-strong);
  margin: 0 4px;
  align-self: center;
}

.sidebar-section {
  padding: var(--s-4) var(--s-3);
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.sidebar-section-label {
  font-family: var(--font-ui);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--ink-700);
  padding: var(--s-2) var(--s-3);
  margin-bottom: var(--s-1);
}

.nav-item {
  display: flex;
  align-items: center;
  gap: var(--s-3);
  padding: var(--s-2) var(--s-3);
  border-radius: var(--r-sm);
  color: var(--ink-500);
  font-family: var(--font-ui);
  font-size: var(--text-sm);
  font-weight: 500;
  text-decoration: none;
  cursor: pointer;
  border: none;
  background: none;
  width: 100%;
  text-align: left;
  transition: background var(--t-fast), color var(--t-fast);
}
.nav-item:hover {
  background: var(--surface-1);
  color: var(--ink-300);
}
.nav-item.active {
  background: var(--surface-1);
  color: var(--ink-100);
  position: relative;
}
.nav-item.active::before {
  content: '';
  position: absolute;
  left: 0;
  top: 25%;
  bottom: 25%;
  width: 2px;
  background: var(--ember);
  border-radius: 2px;
}
.nav-item svg {
  width: 16px;
  height: 16px;
  flex-shrink: 0;
  opacity: 0.7;
}
.nav-item.active svg { opacity: 1; color: var(--ember); }

.nav-badge {
  margin-left: auto;
  font-size: 10px;
  font-weight: 600;
  padding: 2px 6px;
  background: var(--surface-2);
  color: var(--ink-500);
  border-radius: var(--r-xs);
  font-family: var(--font-mono);
}

.sidebar-footer {
  margin-top: auto;
  padding: var(--s-4) var(--s-3);
  border-top: 1px solid var(--hairline);
}
.user-chip {
  display: flex;
  align-items: center;
  gap: var(--s-3);
  padding: var(--s-2) var(--s-3);
  border-radius: var(--r-sm);
  transition: background var(--t-fast);
  cursor: pointer;
}
.user-chip:hover { background: var(--surface-1); }
.user-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--ember), #9f1239);
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-display);
  font-style: italic;
  font-weight: 600;
  color: #fff;
  font-size: 14px;
  flex-shrink: 0;
  box-shadow: 0 0 0 1px rgba(255,255,255,0.08);
}
.user-info {
  flex: 1;
  min-width: 0;
  overflow: hidden;
}
.user-name {
  font-size: var(--text-sm);
  font-weight: 600;
  color: var(--ink-100);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.user-role {
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--ink-700);
}

/* ═══ MAIN CONTENT ═══ */
.main {
  padding: var(--s-8) var(--s-10);
  max-width: 1600px;
  width: 100%;
  min-width: 0; /* grid children have min-width:auto by default; this prevents
                   wide content (editorial Fraunces numbers, long tables) from
                   pushing the main column wider than the viewport on mobile */
  min-height: 100vh;
  overflow-x: hidden;
}

/* ═══ PAGE HEADER ═══ */
.page-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: var(--s-6);
  padding-bottom: var(--s-6);
  margin-bottom: var(--s-8);
  border-bottom: 1px solid var(--hairline);
}
.page-head-title {
  display: flex;
  flex-direction: column;
  gap: var(--s-2);
}
.page-eyebrow {
  font-family: var(--font-ui);
  font-size: var(--text-xs);
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--ember);
  display: flex;
  align-items: center;
  gap: var(--s-2);
}
.page-eyebrow::before {
  content: '';
  width: 16px;
  height: 1px;
  background: var(--ember);
  display: inline-block;
}
.page-h1 {
  font-family: var(--font-display);
  font-weight: 400;
  font-size: var(--text-4xl);
  line-height: 1;
  letter-spacing: -0.025em;
  color: var(--ink-100);
}
.page-h1 em {
  font-style: italic;
  color: var(--ember);
}
.page-sub {
  font-size: var(--text-base);
  color: var(--ink-500);
  max-width: 60ch;
}

.page-head-actions {
  display: flex;
  gap: var(--s-2);
  align-items: center;
}

/* ═══ BUTTONS ═══ */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--s-2);
  font-family: var(--font-ui);
  font-size: var(--text-sm);
  font-weight: 600;
  padding: 10px 16px;
  border-radius: var(--r-sm);
  border: 1px solid transparent;
  cursor: pointer;
  transition: all var(--t-fast);
  white-space: nowrap;
  line-height: 1;
  letter-spacing: -0.005em;
}
.btn svg { width: 14px; height: 14px; }

.btn-primary {
  background: var(--ember);
  color: #FFFFFF;
  font-weight: 700;
  border-color: var(--ember-hi);
  box-shadow: 0 1px 0 rgba(255,255,255,0.1) inset, 0 0 0 1px rgba(0,0,0,0.3);
}
.btn-primary:hover {
  background: var(--ember-hi);
  box-shadow: 0 0 0 3px var(--ember-soft), 0 1px 0 rgba(255,255,255,0.12) inset;
}
.btn-primary:active { transform: translateY(1px); }

.btn-secondary {
  background: var(--surface-1);
  color: var(--ink-100);
  border-color: var(--hairline-strong);
}
.btn-secondary:hover {
  background: var(--surface-2);
  border-color: var(--hairline-focus);
}

.btn-ghost {
  background: transparent;
  color: var(--ink-500);
  border-color: var(--hairline);
}
.btn-ghost:hover {
  color: var(--ink-300);
  border-color: var(--hairline-strong);
  background: var(--surface-0);
}

.btn-icon {
  padding: 8px;
  width: 36px;
  height: 36px;
}
.btn-sm {
  padding: 6px 12px;
  font-size: var(--text-xs);
  letter-spacing: 0;
}
.btn-lg {
  padding: 12px 20px;
  font-size: var(--text-base);
}

.btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
  transform: none !important;
}

/* ═══ INPUTS ═══ */
.field {
  display: flex;
  flex-direction: column;
  gap: var(--s-2);
}
.field-label {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--ink-700);
}

.input, .select {
  width: 100%;
  background: var(--surface-0);
  border: 1px solid var(--hairline);
  color: var(--ink-100);
  padding: 10px 14px;
  border-radius: var(--r-sm);
  font-family: var(--font-ui);
  font-size: var(--text-sm);
  transition: border-color var(--t-fast), background var(--t-fast);
}
.input:hover, .select:hover {
  border-color: var(--hairline-strong);
}
.input:focus, .select:focus {
  outline: none;
  border-color: var(--ember);
  background: var(--surface-1);
}
.input::placeholder { color: var(--ink-700); }

.select {
  appearance: none;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'><path fill='none' stroke='%23A1A1AA' stroke-width='1.5' d='M3 5l3 3 3-3'/></svg>");
  background-repeat: no-repeat;
  background-position: right 12px center;
  padding-right: 32px;
  cursor: pointer;
}

.input-group {
  display: flex;
  align-items: center;
  background: var(--surface-0);
  border: 1px solid var(--hairline);
  border-radius: var(--r-sm);
  padding: 0 12px;
  gap: var(--s-2);
  transition: border-color var(--t-fast);
}
.input-group:focus-within {
  border-color: var(--ember);
  background: var(--surface-1);
}
.input-group .input {
  border: none;
  padding: 10px 0;
  background: transparent;
}
.input-group .input:focus { background: transparent; }
.input-group svg {
  width: 14px;
  height: 14px;
  color: var(--ink-700);
  flex-shrink: 0;
}

/* ═══ CARDS ═══ */
.card {
  background: var(--surface-0);
  border: 1px solid var(--hairline);
  border-radius: var(--r-lg);
  overflow: hidden;
}
.card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--s-4);
  padding: var(--s-5) var(--s-6);
  border-bottom: 1px solid var(--hairline);
}
.card-head-title {
  font-family: var(--font-ui);
  font-size: var(--text-sm);
  font-weight: 700;
  letter-spacing: 0.04em;
  color: var(--ink-100);
  text-transform: uppercase;
}
.card-body { padding: var(--s-6); }
.card-slim .card-body { padding: var(--s-4) var(--s-5); }

/* ═══ STAT BLOCK ═══ Signature: editorial italic numbers */
.stat-row {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 1px;
  background: var(--hairline);
  border: 1px solid var(--hairline);
  border-radius: var(--r-lg);
  overflow: hidden;
  margin-bottom: var(--s-8);
}
.stat-row.cols-5 { grid-template-columns: repeat(5, 1fr); }
.stat-row.cols-6 { grid-template-columns: repeat(6, 1fr); }

.stat {
  background: var(--surface-0);
  padding: var(--s-5) var(--s-6);
  display: flex;
  flex-direction: column;
  gap: var(--s-2);
  position: relative;
  transition: background var(--t-fast);
}
.stat:hover { background: var(--surface-1); }
.stat-label {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--ink-700);
}
.stat-value {
  font-family: var(--font-display);
  font-style: italic;
  font-weight: 400;
  font-size: var(--text-3xl);
  line-height: 1;
  color: var(--ink-100);
  letter-spacing: -0.02em;
}
.stat-value.numeric {
  font-family: var(--font-mono);
  font-style: normal;
  font-weight: 500;
  font-size: var(--text-2xl);
  letter-spacing: -0.01em;
}
.stat-meta {
  display: flex;
  align-items: center;
  gap: var(--s-2);
  font-size: var(--text-xs);
  color: var(--ink-500);
}
.stat-delta {
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  font-weight: 500;
}
.stat-delta.up { color: var(--green); }
.stat-delta.down { color: var(--red); }

/* Hero stat — for page-level headline numbers */
.hero-stat {
  background: var(--surface-0);
  border: 1px solid var(--hairline);
  border-radius: var(--r-lg);
  padding: var(--s-8) var(--s-10);
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: var(--s-10);
  margin-bottom: var(--s-8);
  position: relative;
  overflow: hidden;
}
.hero-stat::before {
  content: '';
  position: absolute;
  top: 0; left: 0;
  width: 3px;
  height: 100%;
  background: var(--ember);
}
.hero-stat-primary {
  display: flex;
  flex-direction: column;
  gap: var(--s-3);
}
.hero-stat-value {
  font-family: var(--font-display);
  font-style: italic;
  font-weight: 400;
  font-size: var(--text-6xl);
  line-height: 0.95;
  color: var(--ink-100);
  letter-spacing: -0.03em;
}
.hero-stat-value sub {
  font-size: var(--text-xl);
  color: var(--ink-700);
  vertical-align: baseline;
  margin-left: var(--s-3);
  font-style: normal;
  font-family: var(--font-mono);
  font-weight: 400;
}

/* ═══ BADGES ═══ */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-family: var(--font-ui);
  font-size: var(--text-xs);
  font-weight: 600;
  padding: 3px 8px;
  border-radius: 4px;
  border: 1px solid transparent;
  letter-spacing: 0.02em;
  white-space: nowrap;
}
.badge::before {
  content: '';
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: currentColor;
  flex-shrink: 0;
}
.badge.no-dot::before { display: none; }

.badge-blue { color: var(--blue); background: var(--blue-soft); border-color: rgba(96,165,250,0.25); }
.badge-purple { color: var(--purple); background: var(--purple-soft); border-color: rgba(192,132,252,0.25); }
.badge-amber { color: var(--amber); background: var(--amber-soft); border-color: rgba(251,191,36,0.25); }
.badge-gold-star { color: var(--gold-star); background: rgba(253,224,71,0.08); border-color: rgba(253,224,71,0.25); }
.badge-green { color: var(--green); background: var(--green-soft); border-color: rgba(74,222,128,0.25); }
.badge-red { color: var(--red); background: var(--red-soft); border-color: rgba(248,113,113,0.25); }
.badge-ember { color: var(--ember); background: var(--ember-soft); border-color: var(--ember-edge); }
.badge-neutral { color: var(--ink-300); background: var(--surface-2); border-color: var(--hairline-strong); }

.badge-dot { /* compact - just a dot + text */
  padding: 3px 6px;
}

/* ═══ TABLE ═══ */
.table-wrap {
  background: var(--surface-0);
  border: 1px solid var(--hairline);
  border-radius: var(--r-lg);
  overflow: hidden;
}
.table-wrap.scroll { overflow-x: auto; }

table {
  width: 100%;
  border-collapse: collapse;
  font-size: var(--text-sm);
}
thead th {
  font-family: var(--font-ui);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--ink-700);
  text-align: left;
  padding: var(--s-4) var(--s-5);
  border-bottom: 1px solid var(--hairline);
  background: var(--surface-0);
  white-space: nowrap;
  position: sticky;
  top: 0;
  z-index: 1;
}
tbody td {
  padding: var(--s-4) var(--s-5);
  border-bottom: 1px solid var(--hairline);
  color: var(--ink-300);
  vertical-align: middle;
}
tbody tr:last-child td { border-bottom: none; }
tbody tr {
  transition: background var(--t-fast);
  position: relative;
}
tbody tr:hover {
  background: var(--surface-hover);
}
tbody tr.highlight {
  background: linear-gradient(90deg, var(--ember-softer) 0%, transparent 40%);
}

.td-rank {
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  color: var(--ink-700);
  width: 40px;
}
.td-name {
  font-weight: 600;
  color: var(--ink-100);
}
.td-num {
  font-family: var(--font-mono);
  font-size: var(--text-sm);
  color: var(--ink-300);
  text-align: right;
}
.td-coord {
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  color: var(--ink-500);
}

.link {
  color: var(--ink-100);
  cursor: pointer;
  text-decoration: none;
  border-bottom: 1px dashed var(--hairline-strong);
  transition: border-color var(--t-fast), color var(--t-fast);
}
.link:hover {
  color: var(--ember);
  border-bottom-color: var(--ember);
}

/* ═══ FILTER BAR ═══ Consistent, pinned toolbar */
.filter-bar {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: var(--s-3);
  padding: var(--s-4) var(--s-5);
  background: var(--surface-0);
  border: 1px solid var(--hairline);
  border-radius: var(--r-lg);
  margin-bottom: var(--s-4);
}
.filter-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.filter-group label {
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--ink-700);
}
.filter-group .select {
  padding: 8px 12px;
  font-size: var(--text-sm);
}

/* ═══ PROGRESS BAR ═══ */
.progress {
  width: 100%;
  height: 3px;
  background: var(--hairline);
  border-radius: 999px;
  overflow: hidden;
  position: relative;
}
.progress-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--ember) 0%, var(--ember-hi) 100%);
  border-radius: 999px;
  transition: width var(--t-slow);
  position: relative;
}
.progress-fill::after {
  content: '';
  position: absolute;
  top: 0; right: 0; bottom: 0;
  width: 20px;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,0.3));
  animation: progress-glow 1.2s ease-in-out infinite;
}
@keyframes progress-glow {
  0%, 100% { opacity: 0; }
  50% { opacity: 1; }
}

/* ═══ SPINNER ═══ */
.spinner {
  display: inline-block;
  width: 14px;
  height: 14px;
  border: 2px solid var(--hairline-strong);
  border-top-color: var(--ember);
  border-radius: 50%;
  animation: spin 0.6s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ═══ LIVE DOT ═══ */
.live-dot {
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--green);
  box-shadow: 0 0 0 3px var(--green-soft);
  animation: pulse 2s ease-in-out infinite;
}
@keyframes pulse {
  0%, 100% { box-shadow: 0 0 0 3px var(--green-soft); }
  50% { box-shadow: 0 0 0 6px rgba(74,222,128,0.15); }
}

/* ═══ SIDE PANEL (Player detail) ═══ */
.side-panel {
  position: fixed;
  top: 0;
  right: -540px;
  width: 540px;
  max-width: 100vw;
  height: 100vh;
  height: 100dvh;
  background: var(--surface-0);
  border-left: 1px solid var(--hairline);
  box-shadow: -16px 0 48px rgba(0,0,0,0.6);
  overflow-y: auto;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
  transition: right var(--t-base);
  z-index: 200;
  padding: 0;
  padding-bottom: env(safe-area-inset-bottom, 0px);
}
.side-panel.open { right: 0; }
.side-panel-close {
  position: absolute;
  top: var(--s-4);
  right: var(--s-4);
  background: var(--surface-2);
  border: 1px solid var(--hairline);
  color: var(--ink-500);
  width: 32px;
  height: 32px;
  border-radius: var(--r-sm);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all var(--t-fast);
}
.side-panel-close:hover {
  color: var(--ink-100);
  border-color: var(--hairline-strong);
}

.panel-hero {
  padding: var(--s-8) var(--s-8) var(--s-6);
  border-bottom: 1px solid var(--hairline);
  background:
    linear-gradient(180deg, var(--ember-softer) 0%, transparent 100%),
    var(--surface-0);
}
.panel-eyebrow {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--ember);
  margin-bottom: var(--s-3);
}
.panel-name {
  font-family: var(--font-display);
  font-style: italic;
  font-weight: 400;
  font-size: var(--text-3xl);
  line-height: 1;
  color: var(--ink-100);
  letter-spacing: -0.025em;
  margin-bottom: var(--s-3);
}
.panel-meta {
  display: flex;
  flex-wrap: wrap;
  gap: var(--s-4);
  font-size: var(--text-xs);
  color: var(--ink-500);
  font-family: var(--font-mono);
}
.panel-meta-item {
  display: flex;
  align-items: center;
  gap: 4px;
}
.panel-meta-item strong {
  color: var(--ink-300);
  font-weight: 500;
}

.panel-section {
  padding: var(--s-6) var(--s-8);
  border-bottom: 1px solid var(--hairline);
}
.panel-section:last-child { border-bottom: none; }
.panel-section-title {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--ink-700);
  margin-bottom: var(--s-4);
}
.panel-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: var(--s-5) var(--s-6);
}
.panel-stat-label {
  font-size: var(--text-xs);
  color: var(--ink-500);
  margin-bottom: 2px;
}
.panel-stat-value {
  font-family: var(--font-mono);
  font-size: var(--text-md);
  color: var(--ink-100);
  font-weight: 500;
}
.panel-stat-value.hero {
  font-family: var(--font-display);
  font-style: italic;
  font-size: var(--text-2xl);
  font-weight: 400;
  line-height: 1.1;
}

.panel-actions {
  padding: var(--s-5) var(--s-8);
  display: flex;
  gap: var(--s-2);
  flex-wrap: wrap;
  background: var(--surface-0);
  position: sticky;
  bottom: 0;
  border-top: 1px solid var(--hairline);
}

/* ═══ TOAST ═══ */
.toast-wrap {
  position: fixed;
  bottom: var(--s-6);
  right: var(--s-6);
  display: flex;
  flex-direction: column;
  gap: var(--s-2);
  z-index: 1000;
}
.toast {
  background: var(--surface-2);
  border: 1px solid var(--hairline-strong);
  border-radius: var(--r-sm);
  padding: var(--s-3) var(--s-4);
  font-size: var(--text-sm);
  color: var(--ink-100);
  display: flex;
  align-items: center;
  gap: var(--s-3);
  min-width: 280px;
  max-width: 420px;
  box-shadow: var(--shadow-md);
  animation: toast-in var(--t-slow) ease-out;
}
.toast.ok { border-left: 3px solid var(--green); }
.toast.err { border-left: 3px solid var(--red); }
.toast.info { border-left: 3px solid var(--ember); }
@keyframes toast-in {
  from { opacity: 0; transform: translateX(20px); }
  to { opacity: 1; transform: translateX(0); }
}

/* ═══ EMPTY STATE ═══ */
.empty {
  padding: var(--s-12) var(--s-6);
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--s-4);
}
.empty-icon {
  width: 48px;
  height: 48px;
  color: var(--ink-900);
}
.empty-title {
  font-family: var(--font-display);
  font-style: italic;
  font-weight: 400;
  font-size: var(--text-xl);
  color: var(--ink-300);
  letter-spacing: -0.02em;
}
.empty-desc {
  font-size: var(--text-sm);
  color: var(--ink-700);
  max-width: 38ch;
}

/* ═══ LEGACY COMPAT — bridges old markup to new aesthetic ═══ */
/* Page show/hide */
.page { display: none; animation: pg-in var(--t-slow) ease-out; }
.page.active { display: block; }
@keyframes pg-in { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: none; } }

/* Legacy page header → new editorial treatment */
.page-header {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: var(--s-6);
  padding-bottom: var(--s-6);
  margin-bottom: var(--s-6);
  border-bottom: 1px solid var(--hairline);
}
.page-title-row { display: flex; flex-direction: column; gap: var(--s-2); }
.page-title {
  font-family: var(--font-display);
  font-style: italic;
  font-weight: 400;
  font-size: var(--text-4xl);
  letter-spacing: -0.025em;
  color: var(--ink-100);
  line-height: 1;
}
.page-subtitle { font-size: var(--text-base); color: var(--ink-500); max-width: 60ch; }

/* Legacy bar/row → modern flex layout */
.bar {
  display: flex;
  align-items: flex-end;
  gap: var(--s-3);
  flex-wrap: wrap;
  margin-bottom: var(--s-4);
}
.row { display: flex; gap: var(--s-4); flex-wrap: wrap; margin-bottom: var(--s-4); }
.row > .card { flex: 1 1 360px; min-width: 0; }
.spacer { flex: 1; }

/* Legacy card → crisp surface */
.card {
  background: var(--surface-0);
  border: 1px solid var(--hairline);
  border-radius: var(--r-lg);
  padding: var(--s-5) var(--s-6);
  margin-bottom: var(--s-4);
  overflow: hidden;
}
.card-elevated { box-shadow: var(--shadow-md); }
.card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--s-4);
  margin-bottom: var(--s-4);
  padding-bottom: var(--s-3);
  border-bottom: 1px solid var(--hairline);
}
.card-title {
  font-family: var(--font-ui);
  font-size: var(--text-sm);
  font-weight: 700;
  letter-spacing: 0.04em;
  color: var(--ink-100);
  text-transform: uppercase;
  display: flex;
  align-items: center;
  gap: var(--s-2);
}
.card-desc { color: var(--ink-500); font-size: var(--text-sm); margin-bottom: var(--s-3); max-width: 70ch; }

/* Legacy input-group → compact labeled field */
.input-group {
  display: flex;
  flex-direction: column;
  gap: 4px;
  background: transparent;
  border: none;
  padding: 0;
}
.input-group label {
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--ink-700);
}
.input-group .input {
  background: var(--surface-0);
  border: 1px solid var(--hairline);
  color: var(--ink-100);
  padding: 8px 12px;
  border-radius: var(--r-sm);
  font-family: var(--font-ui);
  font-size: var(--text-sm);
  min-width: 140px;
  transition: border-color var(--t-fast), background var(--t-fast);
}
.input-group .input:focus {
  outline: none;
  border-color: var(--ember);
  background: var(--surface-1);
}
.input-group .input.input-num { min-width: 90px; }
.input-group .input:focus-within { background: transparent; }

/* Legacy alert-bar → subtle info strip */
.alert-bar {
  display: flex;
  align-items: center;
  gap: var(--s-2);
  padding: var(--s-3) var(--s-4);
  background: var(--ember-softer);
  border: 1px solid var(--ember-edge);
  border-radius: var(--r-sm);
  font-size: var(--text-xs);
  color: var(--ink-300);
  margin-bottom: var(--s-4);
}
.alert-bar svg { color: var(--ember); }

/* Legacy table wrapper */
.tw {
  background: var(--surface-0);
  border: 1px solid var(--hairline);
  border-radius: var(--r-md);
  overflow-x: auto;
  margin-top: var(--s-3);
}
.tw table { width: 100%; border-collapse: collapse; font-size: var(--text-sm); }
.tw thead th {
  font-family: var(--font-ui);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--ink-700);
  text-align: left;
  padding: var(--s-3) var(--s-4);
  border-bottom: 1px solid var(--hairline);
  background: var(--surface-0);
  white-space: nowrap;
}
.tw tbody td {
  padding: var(--s-3) var(--s-4);
  border-bottom: 1px solid var(--hairline);
  color: var(--ink-300);
  vertical-align: middle;
}
.tw tbody tr:last-child td { border-bottom: none; }
.tw tbody tr { transition: background var(--t-fast); }
.tw tbody tr:hover { background: var(--surface-hover); cursor: pointer; }

/* Legacy empty state */
.empty-state {
  padding: var(--s-12) var(--s-6);
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--s-3);
  color: var(--ink-700);
}
.empty-icon { width: 40px; height: 40px; color: var(--ink-900); margin-bottom: var(--s-2); }
.empty-title {
  font-family: var(--font-display);
  font-style: italic;
  font-weight: 400;
  font-size: var(--text-xl);
  color: var(--ink-300);
  letter-spacing: -0.02em;
}
.empty-desc { font-size: var(--text-sm); color: var(--ink-700); max-width: 42ch; line-height: 1.6; }
.empty-state-sm {
  padding: var(--s-6) var(--s-4);
  text-align: center;
  color: var(--ink-700);
  font-size: var(--text-xs);
}

/* Legacy stat grid */
.sg {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 1px;
  background: var(--hairline);
  border: 1px solid var(--hairline);
  border-radius: var(--r-md);
  overflow: hidden;
  margin-bottom: var(--s-4);
}
.sg > div, .sg .sg-item {
  background: var(--surface-0);
  padding: var(--s-4) var(--s-5);
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.sg .sg-label, .sg .dim {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--ink-700);
}
.sg .sg-value {
  font-family: var(--font-mono);
  font-size: var(--text-lg);
  color: var(--ink-100);
  font-weight: 500;
}

/* Old stat-card shim (.st / .v / .l) */
.sg .st {
  background: var(--surface-0);
  padding: var(--s-4) var(--s-5);
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.sg .st .v {
  font-family: var(--font-display);
  font-style: italic;
  font-size: var(--text-2xl);
  font-weight: 400;
  color: var(--ink-100);
  letter-spacing: -0.02em;
  line-height: 1.1;
}
.sg .st .v[style*="mono"], .sg .st .v.mono {
  font-family: var(--font-mono);
  font-style: normal;
  font-size: var(--text-lg);
}
.sg .st .l {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--ink-700);
}

/* Old tag pill (used in rankings table) */
.tag {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 3px;
  font-size: 11px;
  font-family: var(--font-mono);
  font-weight: 500;
  background: var(--surface-2);
  color: var(--ink-300);
  border: 1px solid var(--hairline-strong);
  letter-spacing: 0.02em;
}

/* Old power cell */
.power {
  font-family: var(--font-mono);
  font-weight: 500;
  color: var(--ink-100);
}

/* Legacy progress */
.progress-row {
  display: flex;
  align-items: center;
  gap: var(--s-3);
  padding: var(--s-2) 0;
  font-size: var(--text-xs);
  color: var(--ink-500);
}
.progress-label { color: var(--ink-300); }
.progress-track {
  width: 100%;
  height: 3px;
  background: var(--hairline);
  border-radius: 999px;
  overflow: hidden;
  margin-top: var(--s-2);
}
.progress-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--ember) 0%, var(--ember-hi) 100%);
  border-radius: 999px;
  transition: width var(--t-base);
}

.loading-bar { height: 2px; background: var(--hairline); border-radius: 999px; overflow: hidden; margin: var(--s-2) 0; }
.loading-bar .fill {
  height: 100%;
  width: 30%;
  background: var(--ember);
  animation: load-slide 1.4s ease-in-out infinite;
}
@keyframes load-slide {
  0% { transform: translateX(-100%); }
  100% { transform: translateX(400%); }
}

/* Legacy search-bar */
.search-bar {
  display: flex;
  align-items: center;
  gap: var(--s-3);
  flex-wrap: wrap;
  margin-bottom: var(--s-4);
}
.search-input-wrap {
  flex: 1;
  min-width: 240px;
  display: flex;
  align-items: center;
  background: var(--surface-0);
  border: 1px solid var(--hairline);
  border-radius: var(--r-sm);
  padding: 0 12px;
  gap: var(--s-2);
  transition: border-color var(--t-fast);
}
.search-input-wrap:focus-within { border-color: var(--ember); background: var(--surface-1); }
.search-input-wrap .search-icon { width: 16px; height: 16px; color: var(--ink-700); flex-shrink: 0; }
.search-main-input {
  border: none !important;
  background: transparent !important;
  padding: 10px 0 !important;
  font-size: var(--text-md) !important;
  color: var(--ink-100);
  width: 100%;
  outline: none;
}
.search-main-input:focus { outline: none !important; }
.search-controls { display: flex; align-items: flex-end; gap: var(--s-3); flex-wrap: wrap; }

/* Legacy select/input sans group wrapper */
.input {
  background: var(--surface-0);
  border: 1px solid var(--hairline);
  color: var(--ink-100);
  padding: 10px 12px;
  border-radius: var(--r-sm);
  font-family: var(--font-ui);
  font-size: var(--text-sm);
  transition: border-color var(--t-fast);
}
.input:focus { outline: none; border-color: var(--ember); background: var(--surface-1); }
select.input {
  appearance: none;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'><path fill='none' stroke='%23A1A1AA' stroke-width='1.5' d='M3 5l3 3 3-3'/></svg>");
  background-repeat: no-repeat;
  background-position: right 10px center;
  padding-right: 32px;
  cursor: pointer;
}

/* Legacy btn-danger, btn-ghost, btn-sm */
.btn-danger {
  background: var(--surface-1);
  color: var(--red);
  border-color: rgba(248,113,113,0.35);
}
.btn-danger:hover { background: var(--red-soft); border-color: var(--red); }

/* Dim utility from legacy */
.dim { color: var(--ink-700); font-weight: 500; }

/* Legacy compare widget */
.compare-grid {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  gap: var(--s-3);
  align-items: center;
  margin: var(--s-3) 0;
}
.compare-side { display: flex; flex-direction: column; gap: var(--s-2); }
.compare-vs {
  font-family: var(--font-display);
  font-style: italic;
  font-size: var(--text-xl);
  color: var(--ember);
}

/* Legacy badge (small inline count) */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

/* Status dots */
.status-dot {
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
}
.status-dot.status-ok { background: var(--green); box-shadow: 0 0 0 3px var(--green-soft); }
.status-dot.status-danger { background: var(--red); box-shadow: 0 0 0 3px var(--red-soft); }

/* Legacy missions filter bar (keep old class working) */
.mi-filter-bar {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: var(--s-3);
  padding: var(--s-4);
  background: var(--surface-1);
  border: 1px solid var(--hairline);
  border-radius: var(--r-md);
  margin-bottom: var(--s-4);
}
.mi-filter-group { display: flex; flex-direction: column; gap: 6px; }
.mi-filter-group label {
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--ink-700);
}
.mi-filter-group select {
  background: var(--surface-0);
  border: 1px solid var(--hairline);
  color: var(--ink-100);
  padding: 7px 12px;
  border-radius: var(--r-sm);
  font-family: var(--font-ui);
  font-size: var(--text-sm);
  appearance: none;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'><path fill='none' stroke='%23A1A1AA' stroke-width='1.5' d='M3 5l3 3 3-3'/></svg>");
  background-repeat: no-repeat;
  background-position: right 10px center;
  padding-right: 32px;
  cursor: pointer;
  transition: border-color var(--t-fast);
}
.mi-filter-group select:focus { outline: none; border-color: var(--ember); }

/* Toast host (existing #toast + new stuff) */
#toast {
  position: fixed;
  bottom: var(--s-6);
  right: var(--s-6);
  display: flex;
  flex-direction: column;
  gap: var(--s-2);
  z-index: 1000;
  pointer-events: none;
}
.toast-item {
  background: var(--surface-2);
  border: 1px solid var(--hairline-strong);
  border-radius: var(--r-sm);
  padding: var(--s-3) var(--s-4);
  font-size: var(--text-sm);
  color: var(--ink-100);
  min-width: 260px;
  max-width: 420px;
  box-shadow: var(--shadow-md);
  animation: toast-in var(--t-slow) ease-out;
  pointer-events: auto;
}
.toast-ok { border-left: 3px solid var(--green); }
.toast-err { border-left: 3px solid var(--red); }
.toast-info { border-left: 3px solid var(--ember); }

/* Legacy log output */
.log-output {
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  background: var(--ink);
  border: 1px solid var(--hairline);
  border-radius: var(--r-md);
  padding: var(--s-4);
  max-height: 560px;
  overflow-y: auto;
  color: var(--ink-300);
  line-height: 1.6;
}
.log-controls { display: flex; gap: var(--s-2); align-items: center; }
.toggle-label {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: var(--text-xs);
  color: var(--ink-500);
  cursor: pointer;
}
.toggle-label input { accent-color: var(--ember); }

/* Legacy player panel (will be deprecated once new side-panel adopted) */
#player-panel {
  position: fixed;
  top: 0;
  right: -520px;
  width: 520px;
  max-width: 100vw;
  height: 100vh;
  height: 100dvh; /* excludes mobile URL bar */
  background: var(--surface-0);
  border-left: 1px solid var(--hairline);
  box-shadow: -16px 0 48px rgba(0,0,0,0.6);
  overflow-y: auto;
  overflow-x: hidden;
  overscroll-behavior: contain; /* swipes inside panel stay inside */
  -webkit-overflow-scrolling: touch;
  transition: right var(--t-base);
  z-index: 200;
  box-sizing: border-box;
  padding-bottom: env(safe-area-inset-bottom, 0px);
}
#player-panel.open { right: 0; }
/* On phones/tablets, the panel becomes a full-screen overlay */
@media (max-width: 1024px) {
  #player-panel {
    width: 100vw;
    right: -100vw;
    border-left: none;
  }
}
/* Constrain all children of the panel to the panel's width so nothing
   pushes out horizontally — long player names, UIDs, rich tables, etc. */
#player-panel * { max-width: 100%; box-sizing: border-box; }
#player-panel table { width: 100%; table-layout: fixed; word-break: break-word; }
#player-panel .coords, #player-panel .power { overflow-wrap: anywhere; }
#player-panel .panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--s-5) var(--s-6);
  border-bottom: 1px solid var(--hairline);
  position: sticky;
  top: 0;
  background: var(--surface-0);
  z-index: 2;
}
#player-panel .panel-title {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--ember);
}
#player-panel .close {
  background: var(--surface-2);
  border: 1px solid var(--hairline);
  color: var(--ink-500);
  width: 32px;
  height: 32px;
  border-radius: var(--r-sm);
  cursor: pointer;
  font-size: 18px;
  line-height: 1;
}
#player-panel .close:hover { color: var(--ink-100); border-color: var(--hairline-strong); }

/* Player panel content padding so headings and tables have breathing room */
#panel-content {
  padding: var(--s-5) var(--s-6);
}
#panel-content h2 { overflow-wrap: anywhere; }
#panel-content table td { padding: 4px 0; vertical-align: top; }
#panel-content .panel-actions {
  display: flex;
  gap: var(--s-2);
  flex-wrap: wrap;
  padding: var(--s-3) 0;
}
#panel-content .panel-actions .btn { flex: 0 0 auto; }
@media (max-width: 640px) {
  #panel-content { padding: var(--s-4); }
  #panel-content .panel-actions .btn { font-size: var(--text-xs); padding: 6px 10px; }
}

/* Admin sub-tabs */
.admin-sub { margin-top: var(--s-4); }
.admin-tab-btn { background: transparent !important; }
.admin-tab-btn.active {
  background: var(--surface-1) !important;
  color: var(--ink-100) !important;
  border-color: var(--ember-edge) !important;
}

/* Canvas for map */
#map-canvas {
  width: 100%;
  height: 640px;
  max-height: 75vh;
  background: var(--ink);
  border-radius: var(--r-md);
  border: 1px solid var(--hairline);
  margin-top: var(--s-3);
  display: block;
}
#map-tooltip {
  position: fixed;
  background: var(--surface-2);
  border: 1px solid var(--hairline-strong);
  border-radius: var(--r-sm);
  padding: 6px 10px;
  font-size: var(--text-xs);
  color: var(--ink-100);
  pointer-events: none;
  z-index: 500;
  display: none;
}

/* Compare grid inside war room */
.db-pager { display: flex; gap: var(--s-2); flex-wrap: wrap; margin-bottom: var(--s-3); font-size: var(--text-xs); color: var(--ink-500); }
.db-pager button {
  background: var(--surface-1);
  border: 1px solid var(--hairline);
  color: var(--ink-300);
  padding: 6px 10px;
  border-radius: var(--r-xs);
  cursor: pointer;
  font-size: var(--text-xs);
  font-family: var(--font-ui);
}
.db-pager button:hover { background: var(--surface-2); color: var(--ink-100); }

/* Section labels */
.section-label {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--ink-500);
  padding: var(--s-3) 0;
}

/* ═══ UTILITIES ═══ */
.flex { display: flex; }
.flex-col { flex-direction: column; }
.items-center { align-items: center; }
.items-end { align-items: flex-end; }
.justify-between { justify-content: space-between; }
.gap-1 { gap: var(--s-1); }
.gap-2 { gap: var(--s-2); }
.gap-3 { gap: var(--s-3); }
.gap-4 { gap: var(--s-4); }
.gap-6 { gap: var(--s-6); }
.w-full { width: 100%; }
.text-right { text-align: right; }
.text-center { text-align: center; }

/* ═══ RESPONSIVE ═══ */
@media (max-width: 1024px) {
  .app { grid-template-columns: 1fr; }
  .sidebar {
    position: fixed;
    left: -100%;
    width: 280px;
    z-index: 300;
    transition: left var(--t-base);
  }
  .sidebar.open { left: 0; }
  .main { padding: var(--s-5); }
  .hero-stat { flex-direction: column; align-items: flex-start; padding: var(--s-6); }
  .hero-stat-value { font-size: var(--text-5xl); }
  .page-h1 { font-size: var(--text-3xl); }
  .stat-row { grid-template-columns: repeat(2, 1fr); }
  .stat-row.cols-5, .stat-row.cols-6 { grid-template-columns: repeat(2, 1fr); }
  .side-panel { width: 100%; right: -100%; }
  .panel-grid { grid-template-columns: 1fr; }
}

/* Mobile topbar — for mobile since sidebar is hidden */
.topbar {
  display: none;
  padding: var(--s-4) var(--s-5);
  background: var(--surface-0);
  border-bottom: 1px solid var(--hairline);
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: 0;
  z-index: 50;
}
@media (max-width: 1024px) {
  .topbar { display: flex; }
  .topbar .sidebar-brand {
    padding: 0;
    border: none;
  }
}
.hamburger {
  background: none;
  border: none;
  color: var(--ink-300);
  cursor: pointer;
  padding: var(--s-2);
  display: flex;
  border-radius: var(--r-sm);
}
.hamburger:hover { background: var(--surface-1); }

@media (max-width: 640px) {
  thead th, tbody td { padding: var(--s-3); font-size: var(--text-xs); }
  .hero-stat-value { font-size: var(--text-4xl); }
  .page-h1 { font-size: var(--text-2xl); }
  .page-title { font-size: var(--text-3xl); }
  .filter-bar { grid-template-columns: repeat(2, 1fr); padding: var(--s-3); }
  .main { padding: var(--s-4); }
  .panel-hero { padding: var(--s-5); }
  .panel-section { padding: var(--s-4) var(--s-5); }
  .panel-name { font-size: var(--text-2xl); }
  /* Shrink the editorial italic stat values so they fit in 2-column grid cells */
  .stat-value, .sg .st .v { font-size: var(--text-xl); }
  .stat-value.numeric { font-size: var(--text-lg); }
  .hero-stat-value { letter-spacing: -0.025em; }
  /* Stack row cards vertically on phone */
  .row > .card { flex: 1 1 100%; }
  /* Stack page-header actions below the title on phone */
  .page-header { flex-direction: column; align-items: flex-start; gap: var(--s-3); }
  .page-head-actions { flex-wrap: wrap; }
  /* Scrollable tables don't push the viewport wide */
  .tw, .table-wrap { max-width: 100%; }
}
