/* ═══════════════════════════════════════════════════════════════
   DUAH CAPITAL — Macro Flow Monitor
   Premium Dark Trading Terminal Theme
   ═══════════════════════════════════════════════════════════════ */

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

/* ─── CSS Custom Properties ────────────────────────────────── */
:root {
  /* Core palette */
  --bg-primary: #060a13;
  --bg-secondary: #0c1220;
  --bg-card: #111827;
  --bg-card-hover: #1a2332;
  --bg-elevated: #1e293b;
  --bg-input: #0f172a;

  /* Borders */
  --border-subtle: rgba(255, 255, 255, 0.06);
  --border-default: rgba(255, 255, 255, 0.1);
  --border-accent: rgba(0, 212, 255, 0.3);

  /* Text */
  --text-primary: #f1f5f9;
  --text-secondary: #94a3b8;
  --text-tertiary: #64748b;
  --text-muted: #475569;

  /* Accent colors */
  --accent-cyan: #00d4ff;
  --accent-cyan-glow: rgba(0, 212, 255, 0.15);
  --accent-green: #10b981;
  --accent-green-bright: #34d399;
  --accent-red: #ef4444;
  --accent-red-bright: #f87171;
  --accent-amber: #f59e0b;
  --accent-amber-bright: #fbbf24;
  --accent-purple: #a78bfa;
  --accent-blue: #3b82f6;
  --accent-pink: #ec4899;

  /* Impact colors */
  --impact-high: #ef4444;
  --impact-medium: #f59e0b;
  --impact-low: #64748b;

  /* Glassmorphism */
  --glass-bg: rgba(17, 24, 39, 0.85);
  --glass-border: rgba(255, 255, 255, 0.08);
  --glass-blur: 20px;

  /* Sizing */
  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 14px;
  --radius-xl: 20px;

  /* Shadows */
  --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.3);
  --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.4);
  --shadow-lg: 0 8px 32px rgba(0, 0, 0, 0.5);
  --shadow-glow-cyan: 0 0 20px rgba(0, 212, 255, 0.15);
  --shadow-glow-green: 0 0 20px rgba(16, 185, 129, 0.15);
  --shadow-glow-red: 0 0 20px rgba(239, 68, 68, 0.15);
}

/* ─── Reset & Base ─────────────────────────────────────────── */
*, *::before, *::after {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html {
  font-size: 14px;
  scroll-behavior: smooth;
}

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  background: var(--bg-primary);
  color: var(--text-primary);
  min-height: 100vh;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  max-width: 100vw;
}

/* Scrollbar */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--text-muted); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--text-tertiary); }

/* ─── Background Animation ──────────────────────────────────── */
body::before {
  content: '';
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  background:
    radial-gradient(ellipse at 20% 50%, rgba(0, 212, 255, 0.03) 0%, transparent 60%),
    radial-gradient(ellipse at 80% 20%, rgba(167, 139, 250, 0.02) 0%, transparent 50%),
    radial-gradient(ellipse at 50% 100%, rgba(16, 185, 129, 0.02) 0%, transparent 50%);
  pointer-events: none;
  z-index: 0;
}

/* ═══════════════════════════════════════════════════════════════
   HEADER
   ═══════════════════════════════════════════════════════════════ */
.header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: linear-gradient(180deg, rgba(6, 10, 19, 0.98) 0%, rgba(6, 10, 19, 0.92) 100%);
  backdrop-filter: blur(var(--glass-blur));
  border-bottom: 1px solid var(--border-subtle);
  padding: 0 24px;
  height: 64px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

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

.logo {
  display: flex;
  align-items: center;
  gap: 10px;
}

.logo-icon {
  width: 36px;
  height: 36px;
  border-radius: 8px;
  background: linear-gradient(135deg, var(--accent-cyan), var(--accent-purple));
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  font-size: 14px;
  color: #fff;
  letter-spacing: -0.5px;
}

.logo-text {
  font-weight: 700;
  font-size: 18px;
  letter-spacing: -0.3px;
}

.logo-text span {
  color: var(--accent-cyan);
}

.logo-sub {
  font-size: 11px;
  color: var(--text-tertiary);
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 1.5px;
  padding-left: 16px;
  border-left: 1px solid var(--border-default);
}

.header-right {
  display: flex;
  align-items: center;
  gap: 20px;
}

.connection-status {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 11px;
  color: var(--text-tertiary);
  font-weight: 500;
}

.status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--accent-green);
  animation: pulse-glow 2s infinite;
}

.status-dot.offline { background: var(--accent-red); animation: none; }

@keyframes pulse-glow {
  0%, 100% { box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.4); }
  50% { box-shadow: 0 0 0 6px rgba(16, 185, 129, 0); }
}

.ny-clock {
  font-family: 'JetBrains Mono', monospace;
  font-size: 13px;
  font-weight: 600;
  color: var(--accent-cyan);
  background: var(--bg-card);
  padding: 6px 14px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-accent);
  letter-spacing: 0.5px;
}

.ny-clock small {
  color: var(--text-tertiary);
  font-weight: 400;
  font-size: 10px;
  margin-left: 4px;
}

.next-event-badge {
  background: linear-gradient(135deg, rgba(239, 68, 68, 0.15), rgba(239, 68, 68, 0.05));
  border: 1px solid rgba(239, 68, 68, 0.3);
  padding: 6px 14px;
  border-radius: var(--radius-sm);
  font-size: 11px;
  font-weight: 600;
  color: var(--accent-red-bright);
  display: flex;
  align-items: center;
  gap: 6px;
}

.next-event-badge .countdown {
  font-family: 'JetBrains Mono', monospace;
  color: var(--accent-amber-bright);
}

/* ─── Manual Snapshot Button ───────────────────────────────── */
.btn-snapshot {
  background: linear-gradient(135deg, var(--accent-cyan), var(--accent-blue));
  color: #fff;
  border: none;
  padding: 8px 18px;
  border-radius: var(--radius-sm);
  font-weight: 600;
  font-size: 12px;
  cursor: pointer;
  transition: all 0.2s;
  display: flex;
  align-items: center;
  gap: 6px;
  font-family: inherit;
}

.btn-snapshot:hover {
  transform: translateY(-1px);
  box-shadow: var(--shadow-glow-cyan);
}

.btn-snapshot:active {
  transform: translateY(0);
}

.btn-snapshot.capturing {
  opacity: 0.7;
  pointer-events: none;
}

/* ═══════════════════════════════════════════════════════════════
   MAIN LAYOUT
   ═══════════════════════════════════════════════════════════════ */
.main-container {
  position: relative;
  z-index: 1;
  padding: 20px 24px;
  max-width: 1920px;
  width: 100%;
  margin: 0 auto;
  display: grid;
  gap: 20px;
  box-sizing: border-box;
  overflow-x: hidden;
}

/* ─── Section Cards ────────────────────────────────────────── */
.card {
  background: var(--glass-bg);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-lg);
  backdrop-filter: blur(var(--glass-blur));
  overflow: hidden;
  transition: border-color 0.3s;
}

.card:hover {
  border-color: var(--border-default);
}

.card-header {
  padding: 16px 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--border-subtle);
}

.card-title {
  font-size: 13px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 1.2px;
  color: var(--text-secondary);
  display: flex;
  align-items: center;
  gap: 8px;
}

.card-title .icon {
  font-size: 16px;
}

.card-body {
  padding: 16px 20px;
}

/* ═══════════════════════════════════════════════════════════════
   ECONOMIC CALENDAR
   ═══════════════════════════════════════════════════════════════ */
.calendar-section {
  grid-column: 1 / -1;
}

.calendar-filters {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.calendar-filter-btn {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  color: var(--text-secondary);
  padding: 5px 14px;
  border-radius: 20px;
  font-size: 11px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
  font-family: inherit;
}

.calendar-filter-btn:hover,
.calendar-filter-btn.active {
  background: var(--accent-cyan-glow);
  border-color: var(--accent-cyan);
  color: var(--accent-cyan);
}

.calendar-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12.5px;
}

.calendar-table thead th {
  padding: 10px 12px;
  text-align: left;
  font-weight: 600;
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--text-tertiary);
  border-bottom: 1px solid var(--border-subtle);
  position: sticky;
  top: 0;
  background: var(--bg-card);
  z-index: 2;
}

.calendar-table tbody tr {
  border-bottom: 1px solid var(--border-subtle);
  transition: background 0.2s;
}

.calendar-table tbody tr:hover {
  background: rgba(0, 212, 255, 0.03);
}

.calendar-table tbody tr.today {
  background: rgba(0, 212, 255, 0.04);
}

.calendar-table tbody tr.today:hover {
  background: rgba(0, 212, 255, 0.07);
}

.calendar-table td {
  padding: 10px 12px;
  vertical-align: middle;
}

.day-label {
  font-weight: 700;
  color: var(--accent-cyan);
  font-size: 11px;
  white-space: nowrap;
}

.time-label {
  font-family: 'JetBrains Mono', monospace;
  font-size: 11px;
  color: var(--text-secondary);
}

.currency-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 2px 8px;
  border-radius: 4px;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.5px;
  background: var(--bg-elevated);
  color: var(--text-secondary);
}

.currency-badge.USD { background: rgba(59, 130, 246, 0.15); color: #60a5fa; }
.currency-badge.EUR { background: rgba(167, 139, 250, 0.15); color: #a78bfa; }
.currency-badge.GBP { background: rgba(236, 72, 153, 0.15); color: #f472b6; }
.currency-badge.CAD { background: rgba(239, 68, 68, 0.15); color: #f87171; }
.currency-badge.AUD { background: rgba(245, 158, 11, 0.15); color: #fbbf24; }
.currency-badge.NZD { background: rgba(16, 185, 129, 0.15); color: #34d399; }
.currency-badge.JPY { background: rgba(239, 68, 68, 0.15); color: #fca5a5; }
.currency-badge.CHF { background: rgba(148, 163, 184, 0.15); color: #cbd5e1; }
.currency-badge.CNY { background: rgba(239, 68, 68, 0.15); color: #fca5a5; }
.currency-badge.All { background: rgba(245, 158, 11, 0.15); color: #fbbf24; }

.impact-dot {
  width: 10px;
  height: 10px;
  border-radius: 2px;
  display: inline-block;
}

.impact-dot.high { background: var(--impact-high); box-shadow: 0 0 6px rgba(239, 68, 68, 0.4); }
.impact-dot.medium { background: var(--impact-medium); box-shadow: 0 0 6px rgba(245, 158, 11, 0.3); }
.impact-dot.low, .impact-dot.holiday { background: var(--impact-low); }

.event-name {
  font-weight: 500;
  color: var(--text-primary);
}

.data-cell {
  font-family: 'JetBrains Mono', monospace;
  font-size: 11.5px;
}

.data-cell.actual { font-weight: 600; }
.data-cell.beat { color: var(--accent-green-bright); }
.data-cell.miss { color: var(--accent-red-bright); }
.data-cell.inline { color: var(--text-secondary); }
.data-cell.editable-actual {
  color: var(--accent-cyan);
  cursor: pointer;
  opacity: 0.6;
  font-size: 11px;
  font-style: italic;
  transition: opacity 0.15s;
}
.data-cell.editable-actual:hover {
  opacity: 1;
  text-decoration: underline dotted;
}

.calendar-scroll-container {
  max-height: 380px;
  overflow-y: auto;
}

/* ═══════════════════════════════════════════════════════════════
   CENTRAL BANK RATES
   ═══════════════════════════════════════════════════════════════ */
.central-bank-section {
  grid-column: 1 / -1;
}

.central-bank-updated {
  font-size: 11px;
  font-weight: 400;
  color: var(--text-tertiary);
  margin-left: 10px;
  letter-spacing: 0.3px;
  text-transform: none;
}

.central-bank-source {
  font-size: 11px;
  color: var(--text-tertiary);
  font-weight: 500;
}

.central-bank-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  flex-wrap: wrap;
}

.central-bank-sort {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px;
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
}

.central-bank-sort-btn {
  background: transparent;
  border: 1px solid transparent;
  color: var(--text-tertiary);
  padding: 4px 9px;
  border-radius: 4px;
  font-size: 10.5px;
  font-weight: 700;
  cursor: pointer;
  font-family: inherit;
  transition: all 0.2s;
}

.central-bank-sort-btn:hover,
.central-bank-sort-btn.active {
  color: var(--accent-cyan);
  border-color: rgba(0, 212, 255, 0.22);
  background: rgba(0, 212, 255, 0.08);
}

.central-bank-source a {
  color: var(--accent-cyan);
  text-decoration: none;
}

.central-bank-source a:hover {
  text-decoration: underline dotted;
}

.central-bank-scroll-container {
  max-height: 360px;
  overflow: auto;
}

.central-bank-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12.5px;
  min-width: 1080px;
}

.central-bank-table thead th {
  padding: 10px 12px;
  text-align: left;
  font-weight: 600;
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--text-tertiary);
  border-bottom: 1px solid var(--border-subtle);
  position: sticky;
  top: 0;
  background: var(--bg-card);
  z-index: 2;
}

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

.central-bank-row {
  transition: background 0.2s;
}

.central-bank-row:hover {
  background: rgba(0, 212, 255, 0.03);
}

.central-bank-name {
  display: flex;
  align-items: center;
  gap: 10px;
}

.central-bank-chip {
  width: 44px;
  min-width: 44px;
  height: 28px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-sm);
  background: rgba(0, 212, 255, 0.09);
  border: 1px solid rgba(0, 212, 255, 0.18);
  color: var(--accent-cyan);
  font-family: 'JetBrains Mono', monospace;
  font-size: 11px;
  font-weight: 700;
}

.central-bank-flag {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  font-size: 12px;
  line-height: 1;
  margin-right: 6px;
}

.central-bank-full {
  color: var(--text-primary);
  font-weight: 700;
  line-height: 1.25;
  display: flex;
  align-items: center;
}

.central-bank-policy,
.central-bank-ref {
  display: block;
  color: var(--text-tertiary);
  font-size: 10.5px;
  margin-top: 3px;
}

.central-bank-rate,
.central-bank-meeting,
.central-bank-bps {
  font-family: 'JetBrains Mono', monospace;
  font-weight: 600;
}

.central-bank-rate {
  color: var(--text-primary);
}

.central-bank-meeting {
  color: var(--text-secondary);
  white-space: nowrap;
}

.central-bank-move {
  display: inline-flex;
  align-items: center;
  padding: 3px 8px;
  border-radius: 4px;
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.5px;
  text-transform: uppercase;
  margin-right: 8px;
}

.central-bank-move.cut {
  background: rgba(16, 185, 129, 0.12);
  color: var(--accent-green-bright);
}

.central-bank-move.hike {
  background: rgba(239, 68, 68, 0.12);
  color: var(--accent-red-bright);
}

.central-bank-move.hold {
  background: rgba(148, 163, 184, 0.12);
  color: var(--text-secondary);
}

.central-bank-move.unavailable {
  background: rgba(148, 163, 184, 0.10);
  color: var(--text-tertiary);
}

.central-bank-bps {
  color: var(--text-secondary);
  font-size: 11.5px;
  white-space: nowrap;
}

.rate-odds {
  min-width: 250px;
}

.rate-odds-unavailable {
  max-width: 340px;
  min-width: 250px;
  color: var(--text-tertiary);
  font-size: 10.5px;
  line-height: 1.4;
}

.rate-odds-line {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  font-family: 'JetBrains Mono', monospace;
  font-size: 10.5px;
  font-weight: 600;
}

.rate-odds-line .cut { color: var(--accent-green-bright); }
.rate-odds-line .hold { color: var(--text-tertiary); }
.rate-odds-line .hike { color: var(--accent-red-bright); }

.rate-odds-bar {
  height: 7px;
  display: flex;
  overflow: hidden;
  border-radius: 999px;
  background: var(--bg-input);
  border: 1px solid var(--border-subtle);
  margin-top: 7px;
}

.rate-odds-bar span {
  display: block;
  min-width: 0;
}

.rate-odds-bar .cut { background: var(--accent-green); }
.rate-odds-bar .hold { background: var(--text-muted); }
.rate-odds-bar .hike { background: var(--accent-red); }

/* ═══════════════════════════════════════════════════════════════
   WATCHLIST
   ═══════════════════════════════════════════════════════════════ */
.watchlist-section {
  grid-column: 1 / -1;
}

.watchlist-tabs {
  display: flex;
  gap: 4px;
}

.watchlist-tab {
  background: transparent;
  border: 1px solid transparent;
  color: var(--text-tertiary);
  padding: 7px 18px;
  border-radius: var(--radius-sm) var(--radius-sm) 0 0;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
  font-family: inherit;
  text-transform: uppercase;
  letter-spacing: 0.8px;
}

.watchlist-tab:hover {
  color: var(--text-secondary);
  background: var(--bg-card);
}

.watchlist-tab.active {
  background: var(--bg-card);
  color: var(--accent-cyan);
  border-color: var(--border-default);
  border-bottom-color: var(--bg-card);
}

.watchlist-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 12px;
  padding: 4px 0;
}

.ticker-card {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 14px 16px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  transition: all 0.25s;
  cursor: default;
}

.ticker-card:hover {
  border-color: var(--border-accent);
  background: var(--bg-card-hover);
  box-shadow: var(--shadow-glow-cyan);
  transform: translateY(-2px);
}

.ticker-card.positive:hover { box-shadow: var(--shadow-glow-green); }
.ticker-card.negative:hover { box-shadow: var(--shadow-glow-red); }

.ticker-top {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
}

.ticker-info {
  display: flex;
  align-items: center;
  gap: 10px;
}

.ticker-icon {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: 800;
  background: linear-gradient(135deg, var(--bg-elevated), var(--bg-secondary));
  border: 1px solid var(--border-subtle);
  color: var(--text-secondary);
  flex-shrink: 0;
}

.ticker-icon.indices { background: linear-gradient(135deg, #1e3a5f, #0c1e33); color: var(--accent-cyan); }
.ticker-icon.energy { background: linear-gradient(135deg, #3d2c0a, #1a1300); color: var(--accent-amber); }
.ticker-icon.bonds { background: linear-gradient(135deg, #1a2a1a, #0d1a0d); color: var(--accent-green); }
.ticker-icon.yields { background: linear-gradient(135deg, #2a1a2a, #1a0d1a); color: var(--accent-purple); }
.ticker-icon.fx { background: linear-gradient(135deg, #1a1e3d, #0d0f1e); color: var(--accent-blue); }

.ticker-symbol {
  font-weight: 700;
  font-size: 13px;
  letter-spacing: -0.2px;
}

.ticker-name {
  font-size: 10.5px;
  color: var(--text-tertiary);
  margin-top: 1px;
}

.ticker-delayed {
  font-size: 8px;
  color: var(--accent-amber);
  font-weight: 700;
  padding: 1px 5px;
  background: rgba(245, 158, 11, 0.1);
  border-radius: 3px;
  letter-spacing: 0.5px;
}

.ticker-price-row {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
}

.ticker-price {
  font-family: 'JetBrains Mono', monospace;
  font-size: 20px;
  font-weight: 700;
  letter-spacing: -0.5px;
}

.ticker-change {
  text-align: right;
}

.ticker-change-value {
  font-family: 'JetBrains Mono', monospace;
  font-size: 12px;
  font-weight: 600;
  display: block;
}

.ticker-change-pct {
  font-family: 'JetBrains Mono', monospace;
  font-size: 11px;
  font-weight: 500;
  display: block;
  margin-top: 1px;
}

.positive .ticker-change-value,
.positive .ticker-change-pct { color: var(--accent-green-bright); }

.negative .ticker-change-value,
.negative .ticker-change-pct { color: var(--accent-red-bright); }

.ticker-unavailable {
  color: var(--text-muted);
  font-style: italic;
  font-size: 12px;
}

.ticker-price.unavailable {
  color: var(--text-muted);
  font-size: 14px;
}

/* Price flash animation */
@keyframes flash-green {
  0% { background: rgba(16, 185, 129, 0.15); }
  100% { background: transparent; }
}

@keyframes flash-red {
  0% { background: rgba(239, 68, 68, 0.15); }
  100% { background: transparent; }
}

.ticker-card.flash-up { animation: flash-green 0.6s ease-out; }
.ticker-card.flash-down { animation: flash-red 0.6s ease-out; }

/* ─── Loading shimmer ────────────────────────────────────── */
.shimmer {
  background: linear-gradient(90deg, var(--bg-card) 25%, var(--bg-elevated) 50%, var(--bg-card) 75%);
  background-size: 200% 100%;
  animation: shimmer 1.5s infinite;
  border-radius: var(--radius-sm);
}

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

.shimmer-price { width: 100px; height: 24px; }
.shimmer-change { width: 60px; height: 14px; }

/* ═══════════════════════════════════════════════════════════════
   YIELD REGIME HUB
   ═══════════════════════════════════════════════════════════════ */
.yield-regime-section {
  grid-column: 1 / -1;
}

.regime-grid {
  display: grid;
  grid-template-columns: 300px 1fr 1fr;
  gap: 20px;
}

.regime-main {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.regime-badge {
  font-size: 28px;
  font-weight: 800;
  letter-spacing: -0.5px;
  background: linear-gradient(135deg, var(--accent-cyan), var(--accent-purple));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.regime-badge.bear-flattener   { background: linear-gradient(135deg, #ef4444, #f59e0b); -webkit-background-clip: text; background-clip: text; }
.regime-badge.bear-steepener   { background: linear-gradient(135deg, #ef4444, #a78bfa); -webkit-background-clip: text; background-clip: text; }
.regime-badge.bull-flattener   { background: linear-gradient(135deg, #10b981, #3b82f6); -webkit-background-clip: text; background-clip: text; }
.regime-badge.bull-steepener   { background: linear-gradient(135deg, #10b981, #f59e0b); -webkit-background-clip: text; background-clip: text; }
.regime-badge.steepener-twist  { background: linear-gradient(135deg, #22d3ee, #10b981); -webkit-background-clip: text; background-clip: text; }
.regime-badge.flattener-twist  { background: linear-gradient(135deg, #f59e0b, #a78bfa); -webkit-background-clip: text; background-clip: text; }
.regime-badge.parallel-bear-shift { background: linear-gradient(135deg, #ef4444, #7c3aed); -webkit-background-clip: text; background-clip: text; }
.regime-badge.parallel-bull-shift { background: linear-gradient(135deg, #10b981, #22d3ee); -webkit-background-clip: text; background-clip: text; }
.regime-badge.stagflationary-twist { background: linear-gradient(135deg, #d97706, #9ca3af); -webkit-background-clip: text; background-clip: text; }

.regime-name-row {
  display: flex;
  align-items: baseline;
  gap: 10px;
  flex-wrap: wrap;
}

.regime-updated-label {
  font-size: 12px;
  font-weight: 500;
  color: var(--text-muted);
  letter-spacing: 0.2px;
  opacity: 0.75;
  white-space: nowrap;
}


.regime-risk {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 14px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 700;
  width: fit-content;
}

.regime-risk.risk-off {
  background: rgba(239, 68, 68, 0.12);
  border: 1px solid rgba(239, 68, 68, 0.3);
  color: var(--accent-red-bright);
}

.regime-risk.risk-on {
  background: rgba(16, 185, 129, 0.12);
  border: 1px solid rgba(16, 185, 129, 0.3);
  color: var(--accent-green-bright);
}

.regime-risk.neutral {
  background: rgba(148, 163, 184, 0.12);
  border: 1px solid rgba(148, 163, 184, 0.3);
  color: var(--text-secondary);
}

.regime-description {
  font-size: 13px;
  color: var(--text-secondary);
  line-height: 1.6;
}

.regime-dollar {
  font-size: 12px;
  color: var(--text-tertiary);
  margin-top: 4px;
}

.regime-dollar strong {
  color: var(--text-secondary);
}

.spreads-grid {
  display: grid;
  gap: 12px;
}

.spread-card {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 14px 16px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.spread-label {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.spread-value {
  font-family: 'JetBrains Mono', monospace;
  font-size: 18px;
  font-weight: 700;
}

.spread-value.negative { color: var(--accent-red-bright); }
.spread-value.positive { color: var(--accent-green-bright); }

.key-levels-grid {
  display: grid;
  gap: 12px;
}

.level-card {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 14px 16px;
}

.level-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 10px;
}

.level-title {
  font-size: 12px;
  font-weight: 700;
  color: var(--text-secondary);
}

.level-current {
  font-family: 'JetBrains Mono', monospace;
  font-size: 16px;
  font-weight: 700;
  color: var(--accent-cyan);
}

.level-bar {
  height: 6px;
  background: var(--bg-secondary);
  border-radius: 3px;
  position: relative;
  margin: 6px 0;
}

.level-bar-fill {
  height: 100%;
  border-radius: 3px;
  background: linear-gradient(90deg, var(--accent-green), var(--accent-cyan), var(--accent-red));
  position: absolute;
  top: 0;
  left: 0;
}

.level-bar-marker {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: #fff;
  border: 2px solid var(--accent-cyan);
  position: absolute;
  top: -3px;
  transform: translateX(-50%);
  box-shadow: 0 0 8px rgba(0, 212, 255, 0.4);
}

.level-bounds {
  display: flex;
  justify-content: space-between;
  font-family: 'JetBrains Mono', monospace;
  font-size: 10px;
  color: var(--text-muted);
}

.regime-notes {
  margin-top: 16px;
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 14px 16px;
}

.regime-notes-title {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--text-tertiary);
  margin-bottom: 8px;
}

.regime-notes-text {
  font-size: 12.5px;
  color: var(--text-secondary);
  line-height: 1.7;
}

.regime-notes textarea {
  width: 100%;
  background: var(--bg-input);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  font-family: inherit;
  font-size: 12.5px;
  padding: 10px 12px;
  min-height: 80px;
  resize: vertical;
  line-height: 1.6;
}

.regime-notes textarea:focus {
  outline: none;
  border-color: var(--accent-cyan);
  box-shadow: 0 0 0 2px rgba(0, 212, 255, 0.1);
}

.regime-history {
  margin-top: 8px;
  overflow: hidden;
}

.regime-history-row {
  display: grid;
  grid-template-columns: 2fr 3fr 2fr 1.5fr;
  gap: 8px;
  padding: 6px 0;
  border-bottom: 1px solid var(--border-subtle);
  font-size: 11px;
  color: var(--text-tertiary);
}

.regime-history-row:last-child { border-bottom: none; }

/* ═══════════════════════════════════════════════════════════════
   SNAPSHOTS
   ═══════════════════════════════════════════════════════════════ */
.snapshots-section {
  grid-column: 1 / -1;
}

.snapshot-timeline {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.snapshot-entry {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  overflow: hidden;
  transition: border-color 0.2s;
}

.snapshot-entry:hover {
  border-color: var(--border-default);
}

.snapshot-header {
  padding: 7px 14px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  row-gap: 8px;
  cursor: pointer;
  user-select: none;
}

.snapshot-header:hover {
  background: rgba(255, 255, 255, 0.02);
}

.snapshot-time-info {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  flex: 1;
  min-width: 250px;
}

.snapshot-time-badge {
  font-family: 'JetBrains Mono', monospace;
  font-size: 10px;
  font-weight: 600;
  background: var(--accent-cyan-glow);
  color: var(--accent-cyan);
  padding: 2px 7px;
  border-radius: 3px;
  border: 1px solid var(--border-accent);
  white-space: nowrap;
}

.snapshot-event-label {
  font-size: 11px;
  font-weight: 400;
  color: var(--text-secondary);
  white-space: normal;
  word-break: break-word;
  line-height: 1.4;
  overflow: visible;
  max-width: calc(100% - 80px);
}

.snapshot-timestamp {
  font-family: 'JetBrains Mono', monospace;
  font-size: 10px;
  color: var(--text-muted);
  white-space: nowrap;
}

.snapshot-toggle {
  font-size: 13px;
  color: var(--text-tertiary);
  transition: transform 0.3s;
  margin-left: 4px;
}

.snapshot-entry.expanded .snapshot-toggle {
  transform: rotate(180deg);
}

.snapshot-body {
  display: none;
  padding: 0 14px 12px;
}

.snapshot-entry.expanded .snapshot-body {
  display: block;
}

.snapshot-prices-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12px;
}

.snapshot-prices-table th {
  padding: 8px 10px;
  text-align: left;
  font-weight: 600;
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.8px;
  color: var(--text-tertiary);
  border-bottom: 1px solid var(--border-subtle);
}

.snapshot-prices-table td {
  padding: 7px 10px;
  border-bottom: 1px solid var(--border-subtle);
  font-family: 'JetBrains Mono', monospace;
  font-size: 11.5px;
}

.snapshot-prices-table tr:last-child td { border-bottom: none; }

.snapshot-category-header {
  font-weight: 700;
  color: var(--accent-cyan);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 1px;
  padding: 10px 10px 6px;
  font-family: 'Inter', sans-serif;
}

.snapshot-delete {
  background: none;
  border: 1px solid rgba(239, 68, 68, 0.2);
  color: var(--accent-red);
  padding: 4px 10px;
  border-radius: 4px;
  font-size: 10px;
  font-weight: 600;
  cursor: pointer;
  font-family: inherit;
  transition: all 0.2s;
}

.snapshot-delete:hover {
  background: rgba(239, 68, 68, 0.1);
  border-color: rgba(239, 68, 68, 0.4);
}

.snapshot-download {
  background: none;
  border: 1px solid rgba(0, 212, 255, 0.2);
  color: var(--accent-cyan);
  padding: 4px 10px;
  border-radius: 4px;
  font-size: 10px;
  font-weight: 600;
  cursor: pointer;
  font-family: inherit;
  transition: all 0.2s;
}

.snapshot-download:hover {
  background: rgba(0, 212, 255, 0.08);
  border-color: rgba(0, 212, 255, 0.4);
  box-shadow: 0 0 8px rgba(0, 212, 255, 0.15);
}

.snapshot-actions {
  display: flex;
  gap: 6px;
  align-items: center;
  flex-shrink: 0;
  flex-wrap: wrap;
}

/* ─── Comparison Mode ──────────────────────────────────────── */
.comparison-row {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 12px;
  margin-bottom: 12px;
  padding: 12px;
  background: var(--bg-card);
  border-radius: var(--radius-md);
  border: 1px solid var(--border-subtle);
}

.comparison-col-header {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--text-tertiary);
  padding-bottom: 8px;
  border-bottom: 1px solid var(--border-subtle);
  margin-bottom: 6px;
}

/* ─── Empty States ─────────────────────────────────────────── */
.empty-state {
  text-align: center;
  padding: 40px 20px;
  color: var(--text-muted);
}

.empty-state .icon {
  font-size: 40px;
  margin-bottom: 12px;
  opacity: 0.5;
}

.empty-state p {
  font-size: 13px;
  max-width: 400px;
  margin: 0 auto;
  line-height: 1.6;
}

/* ═══════════════════════════════════════════════════════════════
   REACTION HEATMAP
   ═══════════════════════════════════════════════════════════════ */
.heatmap-section {
  grid-column: 1 / -1;
}

.heatmap-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(110px, 1fr));
  gap: 6px;
}

.heatmap-cell {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  padding: 10px 8px;
  text-align: center;
  transition: all 0.2s;
}

.heatmap-cell:hover {
  transform: scale(1.05);
  z-index: 2;
}

.heatmap-cell .symbol { font-size: 11px; font-weight: 700; margin-bottom: 4px; }
.heatmap-cell .pct {
  font-family: 'JetBrains Mono', monospace;
  font-size: 14px;
  font-weight: 700;
}

/* Heatmap intensity levels */
.heatmap-cell.strong-positive { background: rgba(16, 185, 129, 0.25); border-color: rgba(16, 185, 129, 0.4); }
.heatmap-cell.positive { background: rgba(16, 185, 129, 0.12); border-color: rgba(16, 185, 129, 0.25); }
.heatmap-cell.slight-positive { background: rgba(16, 185, 129, 0.06); }
.heatmap-cell.neutral { background: var(--bg-card); }
.heatmap-cell.slight-negative { background: rgba(239, 68, 68, 0.06); }
.heatmap-cell.negative { background: rgba(239, 68, 68, 0.12); border-color: rgba(239, 68, 68, 0.25); }
.heatmap-cell.strong-negative { background: rgba(239, 68, 68, 0.25); border-color: rgba(239, 68, 68, 0.4); }

.heatmap-cell.strong-positive .pct { color: #34d399; }
.heatmap-cell.positive .pct { color: #6ee7b7; }
.heatmap-cell.slight-positive .pct { color: #a7f3d0; }
.heatmap-cell.neutral .pct { color: var(--text-tertiary); }
.heatmap-cell.slight-negative .pct { color: #fca5a5; }
.heatmap-cell.negative .pct { color: #f87171; }
.heatmap-cell.strong-negative .pct { color: #ef4444; }

/* ═══════════════════════════════════════════════════════════════
   MODAL
   ═══════════════════════════════════════════════════════════════ */
.modal-overlay {
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(0, 0, 0, 0.7);
  backdrop-filter: blur(4px);
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  visibility: hidden;
  transition: all 0.3s;
}

.modal-overlay.active {
  opacity: 1;
  visibility: visible;
}

.modal {
  background: var(--bg-secondary);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-lg);
  padding: 24px;
  width: 90%;
  max-width: 600px;
  max-height: 80vh;
  overflow-y: auto;
  transform: scale(0.95) translateY(10px);
  transition: transform 0.3s;
}

.modal-overlay.active .modal {
  transform: scale(1) translateY(0);
}

.modal-title {
  font-size: 18px;
  font-weight: 700;
  margin-bottom: 16px;
}

.modal-actions {
  display: flex;
  gap: 10px;
  justify-content: flex-end;
  margin-top: 20px;
}

.btn {
  padding: 8px 20px;
  border-radius: var(--radius-sm);
  font-weight: 600;
  font-size: 13px;
  cursor: pointer;
  font-family: inherit;
  transition: all 0.2s;
  border: 1px solid transparent;
}

.btn-primary {
  background: var(--accent-cyan);
  color: #000;
}

.btn-primary:hover {
  background: #33ddff;
  box-shadow: var(--shadow-glow-cyan);
}

.btn-ghost {
  background: transparent;
  border-color: var(--border-default);
  color: var(--text-secondary);
}

.btn-ghost:hover {
  background: var(--bg-card);
}

/* Form elements */
.form-group {
  margin-bottom: 14px;
}

.form-group label {
  display: block;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.8px;
  color: var(--text-tertiary);
  margin-bottom: 6px;
}

.form-group input, .form-group select, .form-group textarea {
  width: 100%;
  background: var(--bg-input);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  font-family: inherit;
  font-size: 13px;
  padding: 8px 12px;
}

.form-group input:focus, .form-group select:focus, .form-group textarea:focus {
  outline: none;
  border-color: var(--accent-cyan);
  box-shadow: 0 0 0 2px rgba(0, 212, 255, 0.1);
}

.form-group select {
  cursor: pointer;
}

/* ═══════════════════════════════════════════════════════════════
   RESPONSIVE
   ═══════════════════════════════════════════════════════════════ */
@media (max-width: 1200px) {
  .regime-grid {
    grid-template-columns: 1fr 1fr;
  }

  .regime-main {
    grid-column: 1 / -1;
  }
}


/* ─── Toasts ───────────────────────────────────────────────── */
.toast-container {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 2000;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.toast {
  background: var(--bg-secondary);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-md);
  padding: 12px 18px;
  font-size: 13px;
  color: var(--text-primary);
  box-shadow: var(--shadow-lg);
  display: flex;
  align-items: center;
  gap: 10px;
  animation: toast-in 0.3s ease-out;
  min-width: 280px;
}

.toast.success { border-left: 3px solid var(--accent-green); }
.toast.error { border-left: 3px solid var(--accent-red); }
.toast.info { border-left: 3px solid var(--accent-cyan); }

@keyframes toast-in {
  from { opacity: 0; transform: translateY(20px) scale(0.95); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

@keyframes toast-out {
  from { opacity: 1; transform: translateY(0) scale(1); }
  to { opacity: 0; transform: translateY(-10px) scale(0.95); }
}

/* ─── Refresh indicator ────────────────────────────────────── */
.refresh-indicator {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 10px;
  color: var(--text-muted);
}

.refresh-indicator .spinner {
  width: 12px;
  height: 12px;
  border: 2px solid var(--border-subtle);
  border-top-color: var(--accent-cyan);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

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

.refresh-indicator.hidden { visibility: hidden; }

/* ─── Section nav ──────────────────────────────────────────── */
.section-nav {
  position: fixed;
  right: 12px;
  top: 50%;
  transform: translateY(-50%);
  z-index: 50;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.section-nav a {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--text-muted);
  transition: all 0.2s;
  display: block;
}

.section-nav a:hover,
.section-nav a.active {
  background: var(--accent-cyan);
  box-shadow: 0 0 8px rgba(0, 212, 255, 0.4);
  transform: scale(1.3);
}



/* ─── Last updated bar ─────────────────────────────────────── */
.last-updated-bar {
  grid-column: 1 / -1;
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 11px;
  color: var(--text-muted);
  padding: 0 4px;
}

.auto-refresh-toggle {
  display: flex;
  align-items: center;
  gap: 6px;
  cursor: pointer;
  user-select: none;
  font-size: 11px;
  color: var(--text-tertiary);
}

.auto-refresh-toggle input[type="checkbox"] {
  accent-color: var(--accent-cyan);
}

/* ═══════════════════════════════════════════════════════════════
   CUSTOM CALENDAR DATE PICKER
   ═══════════════════════════════════════════════════════════════ */
.cal-picker-wrapper {
  position: relative;
  display: inline-block;
}

.cal-trigger-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: var(--bg-card);
  border: 1px solid var(--border-default);
  color: var(--text-secondary);
  padding: 5px 12px;
  border-radius: var(--radius-sm);
  font-size: 11px;
  font-weight: 600;
  cursor: pointer;
  font-family: inherit;
  transition: all 0.2s;
  white-space: nowrap;
  min-width: 130px;
}

.cal-trigger-btn:hover {
  border-color: var(--accent-cyan);
  color: var(--accent-cyan);
}

.cal-trigger-btn.has-date {
  border-color: var(--accent-cyan);
  color: var(--accent-cyan);
  background: var(--accent-cyan-glow);
}

.cal-trigger-btn .cal-icon { font-size: 13px; }
.cal-trigger-btn .cal-clear {
  margin-left: auto;
  font-size: 12px;
  opacity: 0.5;
  padding: 0 2px;
  transition: opacity 0.2s;
}
.cal-trigger-btn .cal-clear:hover { opacity: 1; color: var(--accent-red); }

.cal-dropdown {
  display: none;
  position: absolute;
  top: calc(100% + 6px);
  right: 0;
  z-index: 9999;
  background: var(--bg-card);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-lg), 0 0 30px rgba(0,0,0,0.5);
  padding: 12px;
  width: 260px;
  animation: cal-fade-in 0.15s ease;
}

.cal-dropdown.open { display: block; }

@keyframes cal-fade-in {
  from { opacity: 0; transform: translateY(-6px); }
  to   { opacity: 1; transform: translateY(0); }
}

.cal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 10px;
}

.cal-nav {
  background: none;
  border: none;
  color: var(--text-tertiary);
  cursor: pointer;
  font-size: 16px;
  padding: 4px 8px;
  border-radius: var(--radius-sm);
  transition: all 0.15s;
  line-height: 1;
}
.cal-nav:hover { background: var(--bg-elevated); color: var(--accent-cyan); }

.cal-month-label {
  font-size: 12px;
  font-weight: 700;
  color: var(--text-primary);
  letter-spacing: 0.5px;
}

.cal-weekdays {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 2px;
  margin-bottom: 4px;
}

.cal-weekday {
  text-align: center;
  font-size: 9px;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  padding: 4px 0;
}

.cal-days {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 2px;
}

.cal-day {
  text-align: center;
  padding: 6px 2px;
  border-radius: 6px;
  font-size: 11px;
  font-weight: 500;
  cursor: pointer;
  color: var(--text-secondary);
  transition: all 0.15s;
  border: 1px solid transparent;
}

.cal-day:hover:not(.empty):not(.future) {
  background: var(--bg-elevated);
  color: var(--text-primary);
  border-color: var(--border-default);
}

.cal-day.today {
  color: var(--accent-cyan);
  border-color: rgba(0, 212, 255, 0.3);
}

.cal-day.selected {
  background: var(--accent-cyan-glow);
  color: var(--accent-cyan);
  border-color: var(--accent-cyan);
  font-weight: 700;
}

.cal-day.empty { cursor: default; }

.cal-day.future {
  color: var(--text-muted);
  cursor: not-allowed;
  opacity: 0.4;
}

.cal-footer {
  display: flex;
  justify-content: flex-end;
  margin-top: 10px;
  padding-top: 8px;
  border-top: 1px solid var(--border-subtle);
}

.cal-clear-btn {
  background: none;
  border: 1px solid var(--border-subtle);
  color: var(--text-tertiary);
  font-size: 10px;
  padding: 4px 10px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-family: inherit;
  transition: all 0.2s;
}
.cal-clear-btn:hover {
  border-color: var(--accent-red);
  color: var(--accent-red);
}

/* ═══════════════════════════════════════════════════════════════
   MOBILE BOTTOM NAVIGATION BAR
   ═══════════════════════════════════════════════════════════════ */
.mobile-bottom-nav {
  display: none; /* hidden on desktop */
}

@media (max-width: 900px) {
  /* ─── Show mobile bottom nav ─────────────────────────────── */
  .mobile-bottom-nav {
    display: flex;
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    z-index: 200;
    background: rgba(6, 10, 19, 0.96);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-top: 1px solid var(--border-subtle);
    padding: 6px 0 max(env(safe-area-inset-bottom, 0px), 6px);
    gap: 0;
  }

  .mobile-nav-item {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 3px;
    padding: 6px 0;
    text-decoration: none;
    color: var(--text-muted);
    transition: color 0.2s;
    -webkit-tap-highlight-color: transparent;
    min-height: 48px; /* WCAG touch target */
  }

  .mobile-nav-item.active {
    color: var(--accent-cyan);
  }

  .mobile-nav-item.active .mobile-nav-icon {
    transform: scale(1.1);
  }

  .mobile-nav-icon {
    font-size: 20px;
    line-height: 1;
    transition: transform 0.2s;
    display: block;
  }

  .mobile-nav-label {
    font-size: 9px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    line-height: 1;
  }

  /* ─── Push main content above bottom nav ─────────────────── */
  .main-container {
    padding: 12px 12px calc(72px + env(safe-area-inset-bottom, 0px));
    gap: 12px;
  }

  /* ─── Toast above bottom nav ─────────────────────────────── */
  .toast-container {
    bottom: calc(84px + env(safe-area-inset-bottom, 0px));
    right: 12px;
  }

  /* ─── Compact mobile header ──────────────────────────────── */
  .header {
    height: auto;
    padding: 10px 14px;
    flex-direction: row;
    flex-wrap: wrap;
    gap: 8px;
  }

  .header-left {
    flex: 1;
    min-width: 0;
  }

  .header-right {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: nowrap;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    max-width: 100%;
  }

  .header-right::-webkit-scrollbar { display: none; }

  .logo-sub { display: none; }

  .ny-clock {
    font-size: 11px;
    padding: 5px 10px;
    white-space: nowrap;
  }

  .next-event-badge {
    display: none; /* hidden on mobile — space too tight */
  }

  .connection-status {
    display: none; /* hidden on mobile */
  }

  .btn-snapshot {
    font-size: 11px;
    padding: 7px 12px;
    white-space: nowrap;
  }

  /* ─── Cards ─────────────────────────────────────────────── */
  .card-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 10px;
    padding: 12px 14px;
  }

  .card-body {
    padding: 12px 14px;
  }

  .card-title {
    font-size: 12px;
  }

  /* ─── Calendar ────────────────────────────────────────────── */
  .calendar-filters {
    width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    flex-wrap: nowrap;
    padding-bottom: 4px;
    scrollbar-width: none;
  }

  .calendar-filters::-webkit-scrollbar { display: none; }

  .calendar-filter-btn {
    flex-shrink: 0;
    padding: 5px 12px;
    font-size: 10.5px;
  }

  .calendar-scroll-container {
    max-height: 300px;
  }

  /* Calendar table horizontal scroll */
  .calendar-table {
    font-size: 10.5px;
    min-width: 500px; /* force horizontal scroll */
  }

  /* ─── Watchlist tabs ─────────────────────────────────────── */
  .watchlist-tabs {
    width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    flex-wrap: nowrap;
    gap: 4px;
    padding-bottom: 4px;
    scrollbar-width: none;
    justify-content: flex-start !important;
  }

  .watchlist-tabs::-webkit-scrollbar { display: none; }

  .watchlist-tab {
    flex-shrink: 0;
    padding: 6px 12px;
    font-size: 11px;
    border-radius: var(--radius-sm);
    white-space: nowrap;
  }

  .watchlist-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 8px;
  }

  .ticker-card {
    padding: 10px 12px;
  }

  .ticker-price {
    font-size: 16px;
  }

  /* ─── Heatmap ──────────────────────────────────────────────── */
  .heatmap-grid {
    grid-template-columns: repeat(auto-fill, minmax(78px, 1fr));
    gap: 5px;
  }

  .heatmap-cell {
    padding: 8px 5px;
  }

  .heatmap-cell .symbol { font-size: 9.5px; }
  .heatmap-cell .pct    { font-size: 12px; }

  /* ─── Regime Grid ───────────────────────────────────────────── */
  .regime-grid {
    grid-template-columns: 1fr;
    gap: 14px;
  }

  .regime-badge {
    font-size: 22px;
  }

  /* ─── Reports card header ───────────────────────────────────── */
  .reports-section .card-header > div:last-child {
    flex-wrap: wrap;
    gap: 6px;
    width: 100%;
  }

  .cal-picker-wrapper,
  #btnGenPreMarket,
  #btnGenClose,
  #btnUploadReport {
    flex: 1;
    min-width: 70px;
    justify-content: center;
    text-align: center;
  }

  /* ─── Regime modal ──────────────────────────────────────────── */
  .modal {
    padding: 16px;
    width: 95%;
    max-height: 90vh;
  }

  .modal div[style*="grid-template-columns: 1fr 1fr 1fr"] {
    grid-template-columns: 1fr !important;
  }

  /* ─── Comparison rows ───────────────────────────────────────── */
  .comparison-row {
    grid-template-columns: 1fr;
  }

  /* ─── Snapshot overrides ────────────────────────────────────── */
  .snapshot-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 8px;
  }

  .snapshot-time-info {
    width: 100%;
    min-width: 0;
    flex-wrap: wrap;
  }

  .snapshot-event-label {
    white-space: normal;
    overflow: visible;
    word-break: break-word;
    font-size: 10px;
    line-height: 1.4;
    margin-top: 4px;
    max-width: 100%;
  }

  .snapshot-actions {
    width: 100%;
    justify-content: flex-start;
    flex-wrap: wrap;
    padding-top: 4px;
    border-top: 1px solid rgba(255, 255, 255, 0.05);
  }

  /* Ranking snapshot section headers */
  .snapshot-body > div > div[style*="display:flex"] {
    flex-wrap: wrap;
    gap: 6px;
  }

  .snapshot-toggle {
    margin-left: auto;
  }

  /* ─── Section nav (desktop dots) hidden on mobile ────────────── */
  .section-nav { display: none; }
}

/* Extra small phones (< 390px) */
@media (max-width: 390px) {
  .watchlist-grid {
    grid-template-columns: 1fr;
  }

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

  .logo-text {
    font-size: 15px;
  }

  .main-container {
    padding: 8px 10px;
    gap: 12px;
  }
}


/* ═══════════════════════════════════════════════════════════════
   PWA INSTALL BANNER
   ═══════════════════════════════════════════════════════════════ */
.pwa-install-banner {
  position: fixed;
  bottom: calc(72px + env(safe-area-inset-bottom, 0px));
  left: 12px;
  right: 12px;
  z-index: 300;
  background: var(--bg-secondary);
  border: 1px solid var(--border-accent);
  border-radius: var(--radius-lg);
  padding: 14px 16px;
  box-shadow: var(--shadow-lg), 0 0 20px rgba(0, 212, 255, 0.1);
  display: none; /* JS shows it */
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  animation: toast-in 0.3s ease-out;
}

@media (min-width: 901px) {
  .pwa-install-banner {
    bottom: 24px;
    left: auto;
    right: 24px;
    max-width: 380px;
  }
}

.pwa-install-content {
  display: flex;
  align-items: center;
  gap: 12px;
  flex: 1;
  min-width: 0;
}

.pwa-install-icon {
  width: 44px;
  height: 44px;
  border-radius: 10px;
  flex-shrink: 0;
  object-fit: cover;
}

.pwa-install-title {
  font-size: 13px;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 2px;
}

.pwa-install-sub {
  font-size: 10.5px;
  color: var(--text-tertiary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.pwa-install-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

.pwa-install-btn {
  background: var(--accent-cyan);
  color: #000;
  border: none;
  padding: 7px 16px;
  border-radius: var(--radius-sm);
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
  font-family: inherit;
  transition: all 0.2s;
  white-space: nowrap;
}

.pwa-install-btn:hover {
  background: #33ddff;
  box-shadow: var(--shadow-glow-cyan);
}

.pwa-dismiss-btn {
  background: none;
  border: 1px solid var(--border-subtle);
  color: var(--text-muted);
  width: 28px;
  height: 28px;
  border-radius: 50%;
  cursor: pointer;
  font-size: 13px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s;
}

.pwa-dismiss-btn:hover {
  border-color: var(--accent-red);
  color: var(--accent-red);
}

/* ─── Safe area insets (notch / home indicator) ─────────────── */
body {
  padding-bottom: env(safe-area-inset-bottom, 0);
}

/* Ensure sticky header respects notch on iOS in landscape */
.header {
  padding-top: max(env(safe-area-inset-top, 0px), 0px);
  padding-left: max(env(safe-area-inset-left, 0px), 24px);
  padding-right: max(env(safe-area-inset-right, 0px), 24px);
}

@media (max-width: 900px) {
  .header {
    padding-left: max(env(safe-area-inset-left, 0px), 14px);
    padding-right: max(env(safe-area-inset-right, 0px), 14px);
  }
}

/* ═══════════════════════════════════════════════════════════════
   MORNING REPORT PANEL
   ═══════════════════════════════════════════════════════════════ */
.morning-report-panel {
  grid-column: 1 / -1;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}

.mr-card {
  background: var(--bg-card);
  border-radius: var(--radius-lg);
  border: 1px solid var(--border-subtle);
  overflow: hidden;
  transition: border-color 0.3s;
  display: flex;
  flex-direction: column;
}

.mr-card--macro {
  border-left: 3px solid rgba(255, 214, 0, 0.7);
  background: linear-gradient(135deg, rgba(255,214,0,0.04) 0%, var(--bg-card) 60%);
}

.mr-card--macro:hover {
  border-color: rgba(255, 214, 0, 0.5);
  border-left-color: rgba(255, 214, 0, 0.9);
}

.mr-card--econ {
  border-left: 3px solid rgba(0, 210, 120, 0.7);
  background: linear-gradient(135deg, rgba(0,210,120,0.04) 0%, var(--bg-card) 60%);
}

.mr-card--econ:hover {
  border-color: rgba(0, 210, 120, 0.5);
  border-left-color: rgba(0, 210, 120, 0.9);
}

.mr-card-header {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 16px 10px;
  border-bottom: 1px solid var(--border-subtle);
  flex-wrap: wrap;
}

.mr-card-title {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.8px;
  text-transform: uppercase;
  color: var(--text-secondary);
  flex: 1;
}

.mr-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
  animation: mr-pulse 2.5s ease-in-out infinite;
}

.mr-dot--yellow {
  background: #ffd600;
  box-shadow: 0 0 6px rgba(255, 214, 0, 0.6);
}

.mr-dot--green {
  background: #00d278;
  box-shadow: 0 0 6px rgba(0, 210, 120, 0.6);
}

@keyframes mr-pulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50%       { opacity: 0.6; transform: scale(0.8); }
}

.mr-badge {
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.6px;
  text-transform: uppercase;
  padding: 3px 9px;
  border-radius: 20px;
  flex-shrink: 0;
  background: rgba(255,255,255,0.06);
  color: var(--text-muted);
  border: 1px solid var(--border-subtle);
  transition: all 0.3s;
}

.mr-badge--risk-on {
  background: rgba(0, 210, 120, 0.15);
  color: #00d278;
  border-color: rgba(0, 210, 120, 0.4);
}

.mr-badge--risk-off {
  background: rgba(255, 80, 80, 0.15);
  color: #ff5050;
  border-color: rgba(255, 80, 80, 0.4);
}

.mr-meta {
  font-size: 10px;
  color: var(--text-muted);
  white-space: nowrap;
  flex-shrink: 0;
}

.mr-card-body {
  padding: 14px 16px;
  flex: 1;
  overflow-y: auto;
  max-height: 220px;
  font-size: 12px;
  line-height: 1.6;
  color: var(--text-secondary);
}

.mr-loading {
  color: var(--text-muted);
  font-size: 11px;
  font-style: italic;
}

.mr-macro-text {
  color: var(--text-secondary);
  font-size: 12px;
  line-height: 1.65;
}

.mr-macro-text strong {
  color: var(--text-primary);
}

/* Economic data sub-sections */
.mr-econ-section {
  margin-bottom: 12px;
}

.mr-econ-section:last-child {
  margin-bottom: 0;
}

.mr-econ-label {
  font-size: 9.5px;
  font-weight: 800;
  letter-spacing: 1px;
  text-transform: uppercase;
  color: var(--text-muted);
  margin-bottom: 5px;
  padding-bottom: 3px;
  border-bottom: 1px solid rgba(255,255,255,0.05);
}

.mr-econ-item {
  font-size: 11.5px;
  color: var(--text-secondary);
  padding: 3px 0;
  line-height: 1.5;
  display: flex;
  align-items: flex-start;
  gap: 5px;
}

.mr-econ-item::before {
  content: '•';
  color: var(--text-muted);
  flex-shrink: 0;
  margin-top: 0.5px;
}

.mr-econ-item .mr-beat { color: #00d278; font-weight: 600; }
.mr-econ-item .mr-miss { color: #ff5050; font-weight: 600; }

.mr-unavailable {
  color: var(--text-muted);
  font-size: 11px;
  font-style: italic;
  text-align: center;
  padding: 20px 0;
}

@media (max-width: 900px) {
  .morning-report-panel {
    grid-template-columns: 1fr;
  }

  .mr-card-body {
    max-height: 180px;
  }

  .mr-meta {
    display: none;
  }
}

/* ═══════════════════════════════════════════════════════════════
   COLLAPSIBLE SECTIONS
   ═══════════════════════════════════════════════════════════════ */

/* The card-header becomes a toggle button on collapsible sections */
.collapsible-card .card-header {
  cursor: pointer;
  user-select: none;
  transition: background 0.2s;
}
.collapsible-card .card-header:hover {
  background: rgba(255, 255, 255, 0.03);
}

/* Chevron icon */
.collapse-chevron {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: rgba(255,255,255,0.06);
  border: 1px solid rgba(255,255,255,0.08);
  color: var(--text-tertiary);
  font-size: 11px;
  flex-shrink: 0;
  transition: transform 0.3s cubic-bezier(0.4,0,0.2,1), background 0.2s, color 0.2s;
  margin-left: 8px;
}
.collapsible-card .card-header:hover .collapse-chevron {
  background: rgba(0,212,255,0.1);
  color: var(--accent-cyan);
}
.collapsible-card.collapsed .collapse-chevron {
  transform: rotate(-90deg);
}

/* Count badge shown when collapsed */
.collapse-count-badge {
  display: none;
  font-size: 10px;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 12px;
  background: rgba(0,212,255,0.12);
  color: var(--accent-cyan);
  border: 1px solid rgba(0,212,255,0.2);
  letter-spacing: 0.3px;
  margin-left: 10px;
  white-space: nowrap;
}
.collapsible-card.collapsed .collapse-count-badge {
  display: inline-flex;
  align-items: center;
}

/* Animated body */
.collapsible-body {
  max-height: 4000px; /* large enough to never clip */
  overflow: hidden;
  transition: max-height 0.4s cubic-bezier(0.4,0,0.2,1),
              opacity 0.3s ease,
              padding 0.3s ease;
  opacity: 1;
}
.collapsible-card.collapsed .collapsible-body {
  max-height: 0;
  opacity: 0;
  pointer-events: none;
}

/* On mobile: start collapsed by default (class added via JS) */
@media (max-width: 768px) {
  .collapsible-card .collapse-chevron {
    width: 28px;
    height: 28px;
    font-size: 13px;
  }
}
