/* =============================================================
   ESBO PRICE INTELLIGENCE — Design System v3
   Editorial Financial Terminal aesthetic
   Fraunces display · Schibsted Grotesk body · JetBrains Mono data
   ============================================================= */

@import url('https://fonts.googleapis.com/css2?family=Fraunces:ital,opsz,wght,SOFT@0,9..144,300..900,0..100;1,9..144,300..900,0..100&family=Schibsted+Grotesk:ital,wght@0,400..900;1,400..900&family=JetBrains+Mono:ital,wght@0,400..800;1,400..800&display=swap');

/* ── Reset ──────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 15px; -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale; }

/* ── Root tokens ────────────────────────────────────────────── */
:root {
  /* Backgrounds — warm charcoal, no blue-purple tint */
  --bg-base:        #0c0a08;
  --bg-sidebar:     #090807;
  --bg-card:        #131109;
  --bg-card-hover:  #1a1610;
  --bg-elevated:    #201c14;
  --bg-surface:     #0f0e0a;
  --bg-input:       #110f0c;

  /* Gold palette */
  --gold:           #c9a84c;
  --gold-light:     #dfc278;
  --gold-dim:       #6e5620;
  --gold-muted:     rgba(201,168,76,0.18);
  --gold-glow:      rgba(201,168,76,0.09);
  --gold-glow-md:   rgba(201,168,76,0.16);
  --gold-border:    rgba(201,168,76,0.24);
  --gold-subtle:    rgba(201,168,76,0.09);

  /* Text — warm near-white */
  --text-primary:   #f2ede5;
  --text-secondary: #8a8275;
  --text-dim:       #4e4840;
  --text-gold:      #c9a84c;
  --text-gold-lt:   #dfc278;

  /* Status */
  --up:             #4ade80;
  --up-bg:          rgba(74,222,128,0.10);
  --up-border:      rgba(74,222,128,0.22);
  --down:           #f87171;
  --down-bg:        rgba(248,113,113,0.10);
  --down-border:    rgba(248,113,113,0.22);
  --neutral:        #78b8d8;
  --neutral-bg:     rgba(120,184,216,0.10);
  --amber:          #e8aa38;
  --amber-bg:       rgba(232,170,56,0.10);

  /* Price matrix accents — used by tracker.html */
  --price-low:       #4ade80;
  --price-high:      #c084fc;
  --sunset-hot:      #fb923c;
  --sunset-hot-bg:   rgba(251,146,60,0.12);
  --sunset-hot-glow: rgba(251,146,60,0.22);
  --sunset-hot-soft: rgba(251,146,60,0.06);
  --sunset-hot-line: rgba(251,146,60,0.45);

  /* Venue brand colors — refined, not neon */
  --esb:            #c9a84c;
  --esb-bg:         rgba(201,168,76,0.10);
  --edge:           #78b8d8;
  --edge-bg:        rgba(120,184,216,0.10);
  --summit:         #b89fd0;
  --summit-bg:      rgba(184,159,208,0.10);
  --totr:           #5cbd96;
  --totr-bg:        rgba(92,189,150,0.10);

  /* Borders */
  --border:         rgba(255,255,255,0.07);
  --border-subtle:  rgba(255,255,255,0.04);
  --border-md:      rgba(255,255,255,0.12);

  /* Layout */
  --sidebar-w:      224px;
  --topbar-h:       54px;
  --pad:            1.5rem;

  /* Typography — editorial financial terminal */
  --font-display:   'Fraunces', 'Times New Roman', Georgia, serif;
  --font-body:      'Schibsted Grotesk', system-ui, sans-serif;
  --font-mono:      'JetBrains Mono', ui-monospace, 'SF Mono', Menlo, monospace;

  /* Radius */
  --r-xs:           3px;
  --r-sm:           5px;
  --r:              9px;
  --r-lg:           13px;
  --r-xl:           18px;

  /* Shadows */
  --shadow:         0 2px 14px rgba(0,0,0,0.48);
  --shadow-lg:      0 8px 40px rgba(0,0,0,0.70);
  --shadow-gold:    0 4px 28px rgba(201,168,76,0.14);
  --shadow-gold-lg: 0 0 60px rgba(201,168,76,0.09), 0 8px 40px rgba(0,0,0,0.65);
}

/* ── Base ───────────────────────────────────────────────────── */
body {
  font-family: var(--font-body);
  background: var(--bg-base);
  color: var(--text-primary);
  line-height: 1.5;
  min-height: 100vh;
  overflow-x: hidden;
}

/* Fine dot-grid texture — barely visible, like graph paper */
body::before {
  content: '';
  position: fixed;
  inset: 0;
  background-image: radial-gradient(circle, rgba(255,255,255,0.016) 1px, transparent 1px);
  background-size: 28px 28px;
  pointer-events: none;
  z-index: 0;
}

/* ── App shell ──────────────────────────────────────────────── */
.app {
  display: flex;
  min-height: 100vh;
  position: relative;
  z-index: 1;
}

/* =============================================================
   SIDEBAR
   ============================================================= */
.sidebar {
  width: var(--sidebar-w);
  min-height: 100vh;
  background: var(--bg-sidebar);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0; left: 0; bottom: 0;
  z-index: 100;
  overflow: hidden;
}

/* Top gold gradient rule */
.sidebar::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 2px;
  background: linear-gradient(90deg, transparent 0%, var(--gold) 35%, var(--gold-light) 55%, var(--gold) 75%, transparent 100%);
  z-index: 2;
}

/* Faint radial bloom from bottom — Art Deco sunburst allusion */
.sidebar::after {
  content: '';
  position: absolute;
  bottom: -60px; left: 50%;
  transform: translateX(-50%);
  width: 280px; height: 280px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(201,168,76,0.06) 0%, transparent 65%);
  pointer-events: none;
}

/* ── Brand area ─────────────────────────────────────────────── */
.sidebar-brand {
  padding: 1.35rem 1.25rem 1.1rem;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
  position: relative;
  z-index: 1;
}

.brand-row {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  margin-bottom: 0.65rem;
}

.brand-diamond-wrap {
  display: flex;
  align-items: center;
  gap: 0.3rem;
  flex-shrink: 0;
}

.brand-diamond {
  width: 7px; height: 7px;
  background: var(--gold);
  transform: rotate(45deg);
  flex-shrink: 0;
}

.brand-rule {
  height: 1px; flex: 1;
  background: linear-gradient(90deg, var(--gold-dim), transparent);
}

.sidebar-wordmark {
  font-family: var(--font-display);
  font-size: 1.3rem;
  font-weight: 700;
  letter-spacing: 0.22em;
  color: var(--text-gold-lt);
  text-transform: uppercase;
  line-height: 1;
  display: block;
  text-decoration: none;
}

.sidebar-sub {
  font-size: 0.6rem;
  font-weight: 600;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--text-dim);
  margin-top: 0.18rem;
}

/* ── Nav ────────────────────────────────────────────────────── */
.sidebar-nav {
  flex: 1;
  padding: 0.6rem 0 0.5rem;
  overflow-y: auto;
  scrollbar-width: none;
  position: relative;
  z-index: 1;
}
.sidebar-nav::-webkit-scrollbar { display: none; }

.nav-section {
  padding: 0 0 0.35rem;
}

.nav-label {
  font-size: 0.56rem;
  font-weight: 700;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--text-dim);
  padding: 0.85rem 1.25rem 0.3rem;
  display: block;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 0.7rem;
  padding: 0.58rem 1.25rem 0.58rem 1.1rem;
  font-size: 0.81rem;
  font-weight: 500;
  color: var(--text-secondary);
  text-decoration: none;
  position: relative;
  transition: color 0.14s, background 0.14s;
  border-left: 2px solid transparent;
  margin: 0 0.4rem 0 0;
  border-radius: 0 var(--r-sm) var(--r-sm) 0;
}

.nav-item:hover {
  color: var(--text-primary);
  background: rgba(255,255,255,0.03);
  border-left-color: rgba(255,255,255,0.1);
}

.nav-item.active {
  color: var(--text-gold);
  background: var(--gold-subtle);
  border-left-color: var(--gold);
}

.nav-item .nav-icon {
  width: 15px; height: 15px;
  flex-shrink: 0;
  opacity: 0.55;
  transition: opacity 0.14s;
}

.nav-item:hover .nav-icon,
.nav-item.active .nav-icon { opacity: 1; }

/* ── Sidebar footer ─────────────────────────────────────────── */
.sidebar-footer {
  padding: 0.85rem 1.25rem 1rem;
  border-top: 1px solid var(--border);
  flex-shrink: 0;
  position: relative;
  z-index: 1;
}

.status-row {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  margin-bottom: 0.3rem;
}

.status-dot {
  width: 6px; height: 6px;
  border-radius: 50%;
  flex-shrink: 0;
}

.status-dot.live  { background: var(--amber); }
.status-dot.stale { background: var(--text-dim); }
.status-dot.error { background: var(--down); }

.status-label {
  font-size: 0.68rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  color: var(--amber);
}

.sidebar-ts {
  font-size: 0.66rem;
  color: var(--text-dim);
  font-family: var(--font-mono);
}

/* =============================================================
   MAIN CONTENT
   ============================================================= */
.main {
  margin-left: var(--sidebar-w);
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
}

/* ── Topbar ─────────────────────────────────────────────────── */
.topbar {
  height: var(--topbar-h);
  background: rgba(9,11,15,0.88);
  border-bottom: 1px solid var(--border);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  position: sticky; top: 0;
  z-index: 50;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 var(--pad);
  flex-shrink: 0;
}

.topbar-left {
  display: flex;
  align-items: baseline;
  gap: 0.8rem;
}

.topbar-title {
  font-family: var(--font-display);
  font-size: 0.88rem;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--text-primary);
}

.topbar-crumb {
  font-size: 0.71rem;
  color: var(--text-dim);
}

.topbar-right {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.topbar-date {
  font-size: 0.7rem;
  font-family: var(--font-mono);
  color: var(--text-dim);
  letter-spacing: 0.04em;
}

.chip {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  padding: 0.18rem 0.55rem;
  border-radius: var(--r-xs);
  font-size: 0.62rem;
  font-weight: 700;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  white-space: nowrap;
}

.chip.live {
  background: var(--up-bg);
  color: var(--up);
  border: 1px solid var(--up-border);
}

.chip .dot {
  width: 5px; height: 5px;
  border-radius: 50%;
  background: currentColor;
  animation: blink 2.4s infinite;
}

/* ── Content area ───────────────────────────────────────────── */
.content {
  flex: 1;
  padding: var(--pad);
  overflow-y: auto;
}

/* =============================================================
   KPI STAT CARDS
   ============================================================= */
.stat-row {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 0.85rem;
  margin-bottom: 1.25rem;
}

.stat-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  padding: 1.1rem 1.2rem 1rem;
  box-shadow: var(--shadow);
  position: relative;
  overflow: hidden;
  transition: border-color 0.2s, box-shadow 0.2s;
  cursor: default;
}

/* Faint top shimmer */
.stat-card::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 1px;
  background: linear-gradient(90deg, transparent 5%, var(--gold-dim) 40%, var(--gold-dim) 60%, transparent 95%);
  opacity: 0.45;
}

.stat-card:hover {
  border-color: var(--gold-border);
  box-shadow: var(--shadow), var(--shadow-gold);
}

.stat-kicker {
  font-size: 0.6rem;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--text-dim);
  margin-bottom: 0.5rem;
  display: flex;
  align-items: center;
  gap: 0.45rem;
}

.stat-kicker::before {
  content: '';
  width: 14px; height: 1px;
  background: var(--gold);
  opacity: 0.45;
  flex-shrink: 0;
}

.stat-value {
  font-size: 1.7rem;
  font-weight: 700;
  font-family: var(--font-mono);
  color: var(--text-primary);
  line-height: 1;
  letter-spacing: -0.01em;
  margin-bottom: 0.45rem;
}

.stat-sub {
  font-size: 0.72rem;
  color: var(--text-secondary);
  display: flex;
  align-items: center;
  gap: 0.45rem;
  flex-wrap: wrap;
}

.delta {
  display: inline-flex;
  align-items: center;
  gap: 0.2rem;
  font-size: 0.65rem;
  font-weight: 700;
  padding: 0.12rem 0.42rem;
  border-radius: 999px;
  letter-spacing: 0.03em;
}

.delta.up      { background: var(--up-bg); color: var(--up); }
.delta.down    { background: var(--down-bg); color: var(--down); }
.delta.neutral { background: var(--neutral-bg); color: var(--neutral); }
.delta.gold    { background: var(--gold-subtle); color: var(--gold); border: 1px solid var(--gold-border); }

/* =============================================================
   PANELS
   ============================================================= */
.panel {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow);
  overflow: hidden;
}

.panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.85rem 1.1rem;
  border-bottom: 1px solid var(--border);
  gap: 1rem;
  flex-shrink: 0;
}

.panel-title {
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--text-gold);
  display: flex;
  align-items: center;
  gap: 0.55rem;
}

.panel-title .bar {
  width: 3px; height: 13px;
  background: var(--gold);
  border-radius: 2px;
  flex-shrink: 0;
}

.panel-meta {
  font-size: 0.68rem;
  color: var(--text-dim);
  font-family: var(--font-mono);
}

.panel-body-pad { padding: 1rem 1.1rem; }

/* =============================================================
   MAIN GRID LAYOUTS
   ============================================================= */
.two-col {
  display: grid;
  grid-template-columns: minmax(0, 1.45fr) minmax(268px, 0.85fr);
  gap: 0.85rem;
  margin-bottom: 0.85rem;
}

.three-col {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.85rem;
}

/* =============================================================
   PRICE MATRIX TABLE (Executive Dashboard)
   ============================================================= */
.matrix-table {
  width: 100%;
  border-collapse: collapse;
}

.matrix-table thead th {
  padding: 0.7rem 0.9rem 0.6rem;
  font-family: var(--font-body);
  font-size: 0.58rem;
  font-weight: 600;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  border-bottom: 1px solid var(--gold-border);
  white-space: nowrap;
  background: var(--bg-surface);
  color: var(--text-dim);
}

.matrix-table thead th:first-child { text-align: left; }
.matrix-table thead th:not(:first-child) { text-align: center; }

.th-esb    { color: var(--esb); }
.th-edge   { color: var(--edge); }
.th-summit { color: var(--summit); }
.th-totr   { color: var(--totr); }

.matrix-table tbody td {
  padding: 0.72rem 0.9rem;
  font-size: 0.78rem;
  border-bottom: 1px solid var(--border-subtle);
  vertical-align: middle;
}

.matrix-table tbody td:first-child {
  text-align: left;
  font-family: var(--font-body);
  font-size: 0.78rem;
  font-weight: 500;
  color: var(--text-primary);
  letter-spacing: -0.005em;
}

.matrix-table tbody td:not(:first-child) { text-align: center; }
.matrix-table tbody tr:last-child td { border-bottom: none; }
.matrix-table tbody tr:hover td { background: var(--bg-card-hover); }

/* Unified price text — all prices render identically. The old
   fixed/dyn/gold split was visual noise; the reader doesn't care whether
   a given row is a scraped GA price or a reference price. */
.p-fixed,
.p-dyn,
.p-gold {
  font-family: var(--font-mono);
  font-feature-settings: 'tnum' 1, 'zero' 1, 'ss01' 1;
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.01em;
  font-weight: 500;
  font-size: 0.8rem;
  color: var(--text-primary);
}

/* Em-dash "not available" */
.p-na { color: var(--text-dim); font-size: 0.8rem; }

/* Sub-labels (text after a <br> inside a matrix cell) — English prose,
   not a price. Drop mono, render as a quiet single secondary tier. */
.matrix-table td br + .p-dyn {
  font-family: var(--font-body);
  font-feature-settings: normal;
  font-variant-numeric: normal;
  letter-spacing: 0;
  font-weight: 400;
  font-size: 0.66rem;
  color: var(--text-dim);
}

/* Linked price cells */
.matrix-table a.p-link {
  text-decoration: none;
  color: inherit;
  border-bottom: 1px dashed transparent;
  transition: border-color 0.15s, opacity 0.15s;
}
.matrix-table a.p-link:hover {
  border-bottom-color: currentColor;
  opacity: 0.85;
}
.matrix-table thead th a {
  color: inherit;
  text-decoration: none;
}
.matrix-table thead th a:hover { opacity: 0.75; }

.mini-badge {
  display: inline-flex;
  padding: 0.08rem 0.35rem;
  border-radius: var(--r-xs);
  font-size: 0.56rem;
  font-weight: 700;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  margin-left: 0.3rem;
  vertical-align: middle;
}

.mini-badge.fixed  { background: var(--gold-subtle); color: var(--gold); border: 1px solid var(--gold-border); }
.mini-badge.dyn    { display: none; } /* dynamic is the default — no badge */
.mini-badge.lowest { background: var(--up-bg); color: var(--up); }
.mini-badge.new    { background: rgba(167,139,250,0.12); color: var(--summit); }
.mini-badge.ref    { display: none; } /* reference prices — footnote explains it; no need for a per-cell pill */

/* =============================================================
   MARKET PULSE (right panel on dashboard)
   ============================================================= */
/* ── Venue snapshot cards (top of Market Pulse) ── */
.pulse-snap-card {
  padding: 0.85rem 1rem;
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
}
.pulse-snap-card:last-child { border-right: none; }

.pulse-snap-name {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  font-size: 0.62rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--text-dim);
  margin-bottom: 0.15rem;
}

.pulse-snap-range {
  font-family: var(--font-mono);
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--text-primary);
  letter-spacing: -0.02em;
}

.pulse-snap-label {
  font-size: 0.62rem;
  color: var(--text-dim);
  margin-bottom: 0.35rem;
}

.pulse-snap-stats {
  display: flex;
  gap: 0.65rem;
}

.pulse-snap-stat {
  display: flex;
  flex-direction: column;
  gap: 1px;
}

.pulse-snap-val {
  font-family: var(--font-mono);
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--text-primary);
}
.pulse-snap-val.up   { color: var(--up); }
.pulse-snap-val.down { color: var(--down); }

.pulse-snap-key {
  font-size: 0.56rem;
  color: var(--text-dim);
  letter-spacing: 0.04em;
  white-space: nowrap;
}

.pulse-snap-footer {
  display: flex;
  justify-content: space-between;
  font-size: 0.58rem;
  color: var(--text-dim);
  margin-top: 0.3rem;
  padding-top: 0.35rem;
  border-top: 1px solid var(--border-subtle);
}

.pulse-snap-empty {
  font-size: 0.72rem;
  color: var(--text-dim);
  padding: 1rem 0;
}

@media (max-width: 768px) {
  #pulseSnapshot {
    grid-template-columns: repeat(2, 1fr) !important;
  }
  .pulse-snap-card {
    border-bottom: 1px solid var(--border);
  }
  .pulse-snap-card:nth-child(2) { border-right: none; }
}

.pulse-list { display: flex; flex-direction: column; }

.pulse-item {
  display: flex;
  align-items: flex-start;
  gap: 0.7rem;
  padding: 0.8rem 1.1rem;
  border-bottom: 1px solid var(--border-subtle);
  transition: background 0.14s;
}

.pulse-item:last-child { border-bottom: none; }
.pulse-item:hover { background: var(--bg-card-hover); }

.pulse-indicator {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  flex-shrink: 0;
  padding-top: 2px;
}

.pulse-dot {
  width: 7px; height: 7px;
  border-radius: 50%;
  flex-shrink: 0;
}

.pulse-dot.up      { background: var(--up); box-shadow: 0 0 5px var(--up); }
.pulse-dot.down    { background: var(--down); box-shadow: 0 0 5px var(--down); }
.pulse-dot.neutral { background: var(--text-dim); }

.pulse-line {
  width: 1px; height: 100%;
  min-height: 20px;
  background: var(--border);
}

.pulse-body { flex: 1; min-width: 0; }

.pulse-header {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 0.2rem;
}

.venue-pill {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  font-size: 0.65rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.venue-pip {
  width: 5px; height: 5px;
  border-radius: 50%;
  flex-shrink: 0;
}

.venue-pip.esb    { background: var(--esb); }
.venue-pip.edge   { background: var(--edge); }
.venue-pip.summit { background: var(--summit); }
.venue-pip.totr   { background: var(--totr); }

.pulse-desc {
  font-size: 0.77rem;
  color: var(--text-secondary);
  line-height: 1.45;
}

.pulse-change {
  font-family: var(--font-mono);
  font-weight: 700;
  font-size: 0.8rem;
  align-self: center;
  flex-shrink: 0;
}

.pulse-change.up   { color: var(--up); }
.pulse-change.down { color: var(--down); }
.pulse-change.none { color: var(--text-dim); }

.pulse-date {
  font-size: 0.62rem;
  color: var(--text-dim);
  font-family: var(--font-mono);
  margin-top: 0.2rem;
}

/* =============================================================
   POSITIONING BAND (bottom of dashboard)
   ============================================================= */
.position-band {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.position-cell {
  padding: 1rem 1.15rem;
  border-right: 1px solid var(--border);
}

.position-cell:last-child { border-right: none; }

.pos-venue-head {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 0.6rem;
}

.pos-color { width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0; }
.pos-color.esb    { background: var(--esb); }
.pos-color.edge   { background: var(--edge); }
.pos-color.summit { background: var(--summit); }
.pos-color.totr   { background: var(--totr); }

.pos-name {
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text-primary);
}

.pos-price {
  font-family: var(--font-mono);
  font-size: 1.4rem;
  font-weight: 700;
  line-height: 1;
  margin-bottom: 0.18rem;
}

.pos-price.esb    { color: var(--esb); }
.pos-price.edge   { color: var(--edge); }
.pos-price.summit { color: var(--summit); }
.pos-price.totr   { color: var(--totr); }

.pos-label {
  font-size: 0.65rem;
  color: var(--text-dim);
  margin-bottom: 0.6rem;
}

.pos-attr {
  font-size: 0.71rem;
  color: var(--text-secondary);
  display: flex;
  align-items: flex-start;
  gap: 0.4rem;
  margin-bottom: 0.22rem;
  line-height: 1.4;
}

.pos-attr::before {
  content: '◆';
  color: var(--text-dim);
  font-size: 0.38rem;
  flex-shrink: 0;
  margin-top: 0.38rem;
}

/* =============================================================
   TRACKER PAGE — Calendar Table
   ============================================================= */
.filter-bar {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.7rem var(--pad);
  background: var(--bg-surface);
  border-bottom: 1px solid var(--border);
  flex-wrap: wrap;
}

.filter-group {
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

.filter-label {
  font-size: 0.62rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--text-dim);
  white-space: nowrap;
}

.filter-sep {
  width: 1px; height: 18px;
  background: var(--border);
  flex-shrink: 0;
}

input[type="date"],
select.f-select {
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--r-sm);
  color: var(--text-primary);
  font-family: var(--font-body);
  font-size: 0.77rem;
  padding: 0.32rem 0.65rem;
  outline: none;
  transition: border-color 0.15s, box-shadow 0.15s;
  cursor: pointer;
}

input[type="date"]:focus,
select.f-select:focus {
  border-color: var(--gold-border);
  box-shadow: 0 0 0 2px var(--gold-subtle);
}

.btn {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.35rem 0.85rem;
  border-radius: var(--r-sm);
  font-size: 0.74rem;
  font-weight: 600;
  font-family: var(--font-body);
  cursor: pointer;
  transition: all 0.15s;
  border: none;
  outline: none;
  white-space: nowrap;
}

.btn-gold {
  background: var(--gold-muted);
  color: var(--gold-light);
  border: 1px solid var(--gold-border);
}

.btn-gold:hover {
  background: rgba(201,168,76,0.26);
  box-shadow: var(--shadow-gold);
}

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

.btn-ghost:hover {
  background: var(--bg-card-hover);
  color: var(--text-primary);
  border-color: var(--border-md);
}

/* Calendar table */
.cal-wrap { overflow-x: auto; }

.cal-table {
  width: 100%;
  border-collapse: collapse;
  min-width: 600px;
}

.cal-table thead th {
  position: sticky; top: 0; z-index: 10;
  padding: 0.6rem 1rem;
  background: var(--bg-surface);
  font-size: 0.6rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}

.cal-table thead th:first-child { text-align: left; color: var(--text-dim); }
.cal-table thead th.esb    { color: var(--esb); text-align: center; }
.cal-table thead th.edge   { color: var(--edge); text-align: center; }
.cal-table thead th.summit { color: var(--summit); text-align: center; }
.cal-table thead th.totr   { color: var(--totr); text-align: center; }

.cal-table tbody tr {
  cursor: pointer;
  transition: background 0.1s;
}

.cal-table tbody tr:hover { background: var(--bg-card-hover); }

.cal-table tbody td {
  padding: 0.5rem 1rem;
  font-size: 0.79rem;
  border-bottom: 1px solid var(--border-subtle);
  font-family: var(--font-mono);
  text-align: center;
}

.cal-table tbody td:first-child {
  text-align: left;
  font-family: var(--font-body);
}

.cal-date { font-size: 0.79rem; font-weight: 500; color: var(--text-primary); }
.cal-dow  { font-size: 0.62rem; color: var(--text-dim); margin-top: 0.1rem; }

.cal-price { font-size: 0.8rem; font-weight: 500; }
.cal-price.low  { color: var(--up); font-weight: 700; }
.cal-price.high { color: var(--down); }
.cal-price.mid  { color: var(--text-primary); }
.cal-price.na   { color: var(--text-dim); font-size: 0.7rem; }

.hol-tag {
  display: inline-block;
  padding: 0.06rem 0.32rem;
  border-radius: var(--r-xs);
  font-size: 0.57rem;
  font-weight: 700;
  background: var(--amber-bg);
  color: var(--amber);
  letter-spacing: 0.04em;
  margin-left: 0.35rem;
  font-family: var(--font-body);
  vertical-align: middle;
}

/* Expanded row */
.cal-expand {
  background: var(--bg-elevated);
  border-bottom: 1px solid var(--border);
}

.cal-expand td {
  padding: 0.75rem 1rem;
  font-family: var(--font-body);
  font-size: 0.78rem;
  color: var(--text-secondary);
  text-align: left !important;
}

/* =============================================================
   SUNSET PAGE
   ============================================================= */
.sunset-filters {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 0.75rem;
  margin-bottom: 1rem;
}

.f-field {
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
}

.f-field label {
  font-size: 0.6rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--text-dim);
}

.f-field select,
.f-field input[type="number"] {
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--r-sm);
  color: var(--text-primary);
  font-family: var(--font-body);
  font-size: 0.78rem;
  padding: 0.42rem 0.65rem;
  outline: none;
  width: 100%;
  transition: border-color 0.15s;
}

.f-field select:focus,
.f-field input[type="number"]:focus {
  border-color: var(--gold-border);
  box-shadow: 0 0 0 2px var(--gold-subtle);
}

.sunset-split {
  display: grid;
  grid-template-columns: minmax(0, 1.65fr) minmax(240px, 0.7fr);
  gap: 0.85rem;
}

.insight-panel {
  background: var(--bg-card);
  border: 1px solid var(--gold-border);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-gold);
  overflow: hidden;
  align-self: start;
  position: sticky;
  top: calc(var(--topbar-h) + 1rem);
}

.insight-panel .panel-header { background: var(--gold-subtle); }

.insight-item {
  padding: 0.85rem 1.1rem;
  border-bottom: 1px solid var(--border-subtle);
}

.insight-item:last-child { border-bottom: none; }

.insight-label {
  font-size: 0.59rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--text-dim);
  margin-bottom: 0.25rem;
}

.insight-value {
  font-size: 1.15rem;
  font-weight: 700;
  font-family: var(--font-mono);
  color: var(--gold-light);
  line-height: 1.1;
}

.insight-note {
  font-size: 0.7rem;
  color: var(--text-secondary);
  margin-top: 0.2rem;
  line-height: 1.45;
}

/* Sunset detail cards */
.sunset-date-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  overflow: hidden;
  margin-bottom: 0.65rem;
}

.sunset-date-card summary {
  list-style: none;
  cursor: pointer;
  padding: 0.85rem 1.05rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
  transition: background 0.14s;
}

.sunset-date-card summary::-webkit-details-marker { display: none; }
.sunset-date-card summary:hover { background: var(--bg-card-hover); }
.sunset-date-card[open] summary { border-bottom: 1px solid var(--border); }

.sunset-card-title { font-size: 0.82rem; font-weight: 700; color: var(--text-primary); }

.sunset-card-meta { display: flex; gap: 0.5rem; align-items: center; flex-wrap: wrap; }

.sunset-detail { padding: 0.9rem 1.05rem; }

/* =============================================================
   TRENDS PAGE
   ============================================================= */
.tab-row {
  display: flex;
  gap: 0;
  border-bottom: 1px solid var(--border);
  margin-bottom: 1rem;
}

.tab-btn {
  padding: 0.6rem 1.25rem;
  font-size: 0.77rem;
  font-weight: 600;
  color: var(--text-secondary);
  background: transparent;
  border: none;
  border-bottom: 2px solid transparent;
  cursor: pointer;
  transition: color 0.14s, border-color 0.14s;
  margin-bottom: -1px;
  letter-spacing: 0.03em;
  font-family: var(--font-body);
}

.tab-btn:hover { color: var(--text-primary); }

.tab-btn.active {
  color: var(--gold);
  border-bottom-color: var(--gold);
}

.tab-pane { display: none; }
.tab-pane.active { display: block; }

.chart-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  padding: 1.25rem 1.5rem 1.35rem;
  box-shadow: var(--shadow);
  margin-bottom: 1rem;
}

.chart-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1rem;
  gap: 1rem;
}

.chart-title {
  font-size: 0.71rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--text-dim);
}

.venue-legend {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex-wrap: wrap;
}

.legend-item {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  font-size: 0.7rem;
  color: var(--text-secondary);
  cursor: pointer;
  transition: opacity 0.14s;
}

.legend-item:hover { opacity: 0.8; }

.legend-dot {
  width: 8px; height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
}

.chart-wrap {
  position: relative;
  width: 100%;
  height: 280px;
}

/* =============================================================
   METHODOLOGY PAGE
   ============================================================= */
.method-hero {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  padding: 1.5rem 1.6rem;
  margin-bottom: 1rem;
  box-shadow: var(--shadow);
  position: relative;
  overflow: hidden;
}

.method-hero::after {
  content: '';
  position: absolute;
  right: -30px; bottom: -30px;
  width: 180px; height: 180px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(201,168,76,0.08) 0%, transparent 70%);
  pointer-events: none;
}

.method-eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.62rem;
  font-weight: 700;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--gold);
  margin-bottom: 0.65rem;
}

.method-eyebrow::before {
  content: '';
  width: 20px; height: 1px;
  background: var(--gold);
}

.method-hero h1 {
  font-family: var(--font-display);
  font-size: 1.35rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  color: var(--text-primary);
  margin-bottom: 0.5rem;
}

.method-hero p {
  font-size: 0.82rem;
  color: var(--text-secondary);
  max-width: 60ch;
  line-height: 1.65;
}

.method-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.85rem;
}

.method-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  padding: 1.15rem 1.2rem;
  box-shadow: var(--shadow);
}

.method-icon {
  width: 30px; height: 30px;
  border-radius: var(--r);
  background: var(--gold-subtle);
  border: 1px solid var(--gold-border);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--gold);
  margin-bottom: 0.7rem;
  flex-shrink: 0;
}

.method-card h3 {
  font-family: var(--font-display);
  font-size: 0.82rem;
  letter-spacing: 0.08em;
  color: var(--text-primary);
  margin-bottom: 0.5rem;
}

.method-card p,
.method-card li {
  font-size: 0.77rem;
  color: var(--text-secondary);
  line-height: 1.65;
}

.method-card ul {
  list-style: none;
  padding: 0;
  margin-top: 0.45rem;
}

.method-card li {
  display: flex;
  align-items: flex-start;
  gap: 0.45rem;
  margin-bottom: 0.28rem;
}

.method-card li::before {
  content: '◆';
  color: var(--gold-dim);
  font-size: 0.38rem;
  flex-shrink: 0;
  margin-top: 0.4rem;
}

/* =============================================================
   AUTH PAGE
   ============================================================= */
.auth-body {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg-base);
  position: relative;
  overflow: hidden;
}

/* Radial glow behind card */
.auth-body::before {
  content: '';
  position: fixed;
  top: 50%; left: 50%;
  transform: translate(-50%, -50%);
  width: 700px; height: 700px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(201,168,76,0.06) 0%, transparent 60%);
  pointer-events: none;
  z-index: 0;
}

/* Fine diagonal line pattern */
.auth-body::after {
  content: '';
  position: fixed; inset: 0;
  background-image: repeating-linear-gradient(
    -45deg,
    transparent 0px, transparent 58px,
    rgba(201,168,76,0.013) 58px, rgba(201,168,76,0.013) 59px
  );
  pointer-events: none;
  z-index: 0;
}

.auth-card {
  width: 100%;
  max-width: 375px;
  background: var(--bg-card);
  border: 1px solid var(--gold-border);
  border-radius: var(--r-xl);
  padding: 2.5rem 2.1rem 2rem;
  box-shadow: var(--shadow-gold-lg);
  position: relative;
  z-index: 1;
  animation: auth-appear 0.55s cubic-bezier(0.16,1,0.3,1) both;
}

@keyframes auth-appear {
  from { opacity: 0; transform: translateY(14px) scale(0.97); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}

.auth-card::before {
  content: '';
  position: absolute;
  top: 0; left: 12%; right: 12%;
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--gold-light), transparent);
}

.auth-ornament {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  justify-content: center;
  margin-bottom: 1.45rem;
}

.auth-orn-line {
  height: 1px;
  width: 38px;
  background: linear-gradient(90deg, transparent, var(--gold-dim));
}

.auth-orn-line.r { background: linear-gradient(90deg, var(--gold-dim), transparent); }

.auth-orn-diamond {
  width: 8px; height: 8px;
  background: var(--gold);
  transform: rotate(45deg);
  flex-shrink: 0;
}

.auth-wordmark {
  text-align: center;
  font-family: var(--font-display);
  font-size: 1.7rem;
  font-weight: 700;
  letter-spacing: 0.24em;
  color: var(--gold-light);
  text-transform: uppercase;
  line-height: 1;
  margin-bottom: 0.3rem;
}

.auth-tagline {
  text-align: center;
  font-size: 0.58rem;
  font-weight: 700;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--text-dim);
  margin-bottom: 2rem;
}

.auth-divider {
  height: 1px;
  background: var(--border);
  margin: 0 0 1.5rem;
  position: relative;
}

.auth-divider::after {
  content: 'SECURE ACCESS';
  position: absolute;
  top: 50%; left: 50%;
  transform: translate(-50%, -50%);
  font-size: 0.52rem;
  font-weight: 700;
  letter-spacing: 0.2em;
  color: var(--text-dim);
  background: var(--bg-card);
  padding: 0 0.75rem;
  white-space: nowrap;
}

.auth-field {
  margin-bottom: 1rem;
}

.auth-field-label {
  display: block;
  font-size: 0.6rem;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--text-dim);
  margin-bottom: 0.42rem;
}

.auth-input-wrap { position: relative; }

.auth-input {
  width: 100%;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--r);
  color: var(--text-primary);
  font-family: var(--font-mono);
  font-size: 0.9rem;
  letter-spacing: 0.1em;
  padding: 0.72rem 2.6rem 0.72rem 0.9rem;
  outline: none;
  transition: border-color 0.2s, box-shadow 0.2s;
}

.auth-input::placeholder { color: var(--text-dim); letter-spacing: 0.05em; font-size: 0.8rem; }
.auth-input:focus { border-color: var(--gold-border); box-shadow: 0 0 0 3px var(--gold-subtle); }

.auth-input.shake {
  animation: shake 0.32s ease;
  border-color: rgba(248,113,113,0.6);
  box-shadow: 0 0 0 3px rgba(248,113,113,0.1);
}

@keyframes shake {
  0%, 100% { transform: translateX(0); }
  20%, 60%  { transform: translateX(-5px); }
  40%, 80%  { transform: translateX(5px); }
}

.auth-eye {
  position: absolute;
  right: 0.9rem; top: 50%;
  transform: translateY(-50%);
  color: var(--text-dim);
  cursor: pointer;
  transition: color 0.15s;
  background: none; border: none; padding: 0;
  line-height: 1;
}

.auth-eye:hover { color: var(--text-secondary); }

.auth-submit {
  width: 100%;
  padding: 0.78rem;
  margin-top: 0.5rem;
  background: linear-gradient(135deg, rgba(201,168,76,0.22), rgba(201,168,76,0.13));
  border: 1px solid var(--gold-border);
  border-radius: var(--r);
  color: var(--gold-light);
  font-family: var(--font-display);
  font-size: 0.74rem;
  font-weight: 700;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  cursor: pointer;
  transition: background 0.2s, box-shadow 0.2s;
  outline: none;
}

.auth-submit:hover {
  background: linear-gradient(135deg, rgba(201,168,76,0.32), rgba(201,168,76,0.2));
  box-shadow: var(--shadow-gold);
}

.auth-error {
  text-align: center;
  font-size: 0.7rem;
  color: var(--down);
  margin-top: 0.65rem;
  min-height: 1.1em;
  opacity: 0;
  transition: opacity 0.2s;
}

.auth-error.show { opacity: 1; }

.auth-footer-note {
  text-align: center;
  margin-top: 1.5rem;
  font-size: 0.59rem;
  color: var(--text-dim);
  letter-spacing: 0.08em;
  line-height: 1.6;
}

/* =============================================================
   GENERAL UTILITIES
   ============================================================= */
.text-gold   { color: var(--text-gold); }
.text-sec    { color: var(--text-secondary); }
.text-dim    { color: var(--text-dim); }
.font-mono   { font-family: var(--font-mono); }
.font-display{ font-family: var(--font-display); }

.section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 0.85rem;
}

.section-title {
  font-family: var(--font-display);
  font-size: 0.8rem;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--text-gold);
}

.divider { height: 1px; background: var(--border); margin: 1rem 0; }

/* Coverage banner */
.coverage-banner {
  margin-bottom: 1rem;
  padding: 0.6rem 1rem;
  background: var(--neutral-bg);
  border: 1px solid rgba(96,165,250,0.2);
  border-radius: var(--r);
  font-size: 0.75rem;
  color: var(--neutral);
}

/* Empty state */
.empty-state {
  padding: 2.5rem 1rem;
  text-align: center;
  font-size: 0.82rem;
  color: var(--text-dim);
}

/* =============================================================
   ANIMATIONS
   ============================================================= */
@keyframes fade-up {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: translateY(0); }
}

.fade-up      { animation: fade-up 0.4s ease both; }
.anim-d1      { animation-delay: 0.04s; }
.anim-d2      { animation-delay: 0.08s; }
.anim-d3      { animation-delay: 0.13s; }
.anim-d4      { animation-delay: 0.18s; }
.anim-d5      { animation-delay: 0.23s; }

/* =============================================================
   LIGHT MODE
   ============================================================= */
[data-theme="light"] {
  /* Backgrounds — muted warm parchment, dialed down from prior ivory */
  --bg-base:        #ddd0b6;
  --bg-sidebar:     #d0c2a4;
  --bg-card:        #ebe0c5;
  --bg-card-hover:  #e4d7b7;
  --bg-elevated:    #e7dcbe;
  --bg-surface:     #d8cbac;
  --bg-input:       #e8ddc0;

  /* Text — darker for actual readability */
  --text-primary:   #1c140a;
  --text-secondary: #4e4330;
  --text-dim:       #6b5b42;
  --text-gold:      #7a5812;
  --text-gold-lt:   #966d1e;

  /* Gold tuned for light surfaces */
  --gold:           #a17a1f;
  --gold-light:     #b88d2b;
  --gold-dim:       #7a5812;

  /* Borders */
  --border:         rgba(56,38,8,0.20);
  --border-subtle:  rgba(56,38,8,0.11);
  --border-md:      rgba(56,38,8,0.28);

  /* Gold stays gold */
  --gold-muted:     rgba(161,122,31,0.20);
  --gold-glow:      rgba(161,122,31,0.12);
  --gold-glow-md:   rgba(161,122,31,0.20);
  --gold-border:    rgba(122,88,18,0.32);
  --gold-subtle:    rgba(161,122,31,0.14);

  /* Status */
  --up:             #16a34a;
  --up-bg:          rgba(22,163,74,0.14);
  --up-border:      rgba(22,163,74,0.26);
  --down:           #dc2626;
  --down-bg:        rgba(220,38,38,0.14);
  --down-border:    rgba(220,38,38,0.26);
  --neutral:        #155eaf;
  --neutral-bg:     rgba(21,94,175,0.14);
  --amber:          #8a4e0a;
  --amber-bg:       rgba(138,78,10,0.14);

  /* Price matrix accents — dark versions that read on cream bg */
  --price-low:       #0e7a2f;
  --price-high:      #6b2eab;
  --sunset-hot:      #9a3c0c;
  --sunset-hot-bg:   rgba(154,60,12,0.12);
  --sunset-hot-glow: rgba(154,60,12,0.22);
  --sunset-hot-soft: rgba(154,60,12,0.05);
  --sunset-hot-line: rgba(154,60,12,0.42);

  /* Venue brand colors — adjusted for light bg */
  --esb:            #8e640d;
  --esb-bg:         rgba(142,100,13,0.14);
  --edge:           #0c5d7c;
  --edge-bg:        rgba(12,93,124,0.14);
  --summit:         #6f46ae;
  --summit-bg:      rgba(111,70,174,0.14);
  --totr:           #0b7558;
  --totr-bg:        rgba(11,117,88,0.14);

  /* Shadows */
  --shadow:         0 6px 22px rgba(56,38,8,0.12);
  --shadow-lg:      0 16px 42px rgba(56,38,8,0.18);
  --shadow-gold:    0 8px 28px rgba(161,122,31,0.18);
  --shadow-gold-lg: 0 0 60px rgba(161,122,31,0.14), 0 16px 42px rgba(56,38,8,0.16);
}

[data-theme="light"] body {
  background:
    radial-gradient(circle at top left, rgba(161,122,31,0.09), transparent 30%),
    linear-gradient(180deg, #d8cbac 0%, var(--bg-base) 28%, #d2c3a3 100%);
  color: var(--text-primary);
}

/* Light mode — chart canvas keeps a slightly warm surface so dark gridlines read */
[data-theme="light"] canvas {
  border-radius: var(--r);
  background: var(--bg-card);
}

/* Light mode texture override */
[data-theme="light"] body::before {
  background-image: radial-gradient(circle, rgba(0,0,0,0.035) 1px, transparent 1px);
}

[data-theme="light"] .sidebar {
  background: linear-gradient(180deg, #d6c8a8 0%, var(--bg-sidebar) 100%);
  border-right-color: rgba(56,38,8,0.22);
}

[data-theme="light"] .sidebar-sub,
[data-theme="light"] .nav-label,
[data-theme="light"] .sidebar-ts,
[data-theme="light"] .topbar-crumb,
[data-theme="light"] .topbar-date,
[data-theme="light"] .panel-meta,
[data-theme="light"] .stat-kicker,
[data-theme="light"] .filter-label,
[data-theme="light"] .page-intro-text,
[data-theme="light"] .page-intro-date,
[data-theme="light"] .section-rule-label,
[data-theme="light"] .pulse-date,
[data-theme="light"] .cal-dow,
[data-theme="light"] .p-na,
[data-theme="light"] .empty-state {
  color: var(--text-dim);
}

[data-theme="light"] .brand-rule,
[data-theme="light"] .pi-rule {
  background: linear-gradient(90deg, rgba(141,104,24,0.42), transparent);
}

[data-theme="light"] .nav-item {
  color: var(--text-secondary);
}

[data-theme="light"] .nav-item:hover {
  color: var(--text-primary);
  background: rgba(180,135,39,0.08);
  border-left-color: rgba(141,104,24,0.28);
}

[data-theme="light"] .nav-item.active {
  color: var(--text-gold);
  background: linear-gradient(90deg, rgba(180,135,39,0.16), rgba(180,135,39,0.05));
  border-left-color: var(--gold);
  box-shadow: inset 0 0 0 1px rgba(141,104,24,0.12);
}

[data-theme="light"] .nav-item .nav-icon {
  opacity: 0.72;
}

[data-theme="light"] .status-label {
  color: var(--amber);
}

[data-theme="light"] .topbar {
  background: rgba(225,214,188,0.94);
  border-bottom-color: rgba(56,38,8,0.20);
  box-shadow: 0 6px 24px rgba(56,38,8,0.08);
}

[data-theme="light"] .topbar-title {
  color: #2a1f10;
}

[data-theme="light"] .chip.live {
  background: rgba(22,163,74,0.14);
  border-color: rgba(22,163,74,0.28);
}

[data-theme="light"] .content {
  background: linear-gradient(180deg, rgba(235,224,197,0.35), transparent 28%);
}

[data-theme="light"] .stat-card,
[data-theme="light"] .panel,
[data-theme="light"] .offer-card,
[data-theme="light"] .theme-toggle,
[data-theme="light"] details.slim-section > summary {
  background: linear-gradient(180deg, rgba(235,224,197,0.96), rgba(225,213,184,0.98));
  border-color: rgba(56,38,8,0.22);
  box-shadow: var(--shadow);
}

[data-theme="light"] .stat-card::before {
  background: linear-gradient(90deg, transparent 5%, rgba(161,122,31,0.80) 40%, rgba(161,122,31,0.80) 60%, transparent 95%);
  opacity: 0.78;
}

[data-theme="light"] .panel-header,
[data-theme="light"] .filter-bar {
  background: rgba(216,203,172,0.72);
  border-bottom-color: rgba(56,38,8,0.18);
}

[data-theme="light"] .matrix-table thead th,
[data-theme="light"] .cal-table thead th,
[data-theme="light"] .cal-expand {
  background: var(--bg-surface);
  border-bottom-color: rgba(73,53,20,0.12);
}

[data-theme="light"] .matrix-table tbody td:first-child,
[data-theme="light"] .cal-table tbody td:first-child,
[data-theme="light"] .pulse-desc,
[data-theme="light"] .pos-attr,
[data-theme="light"] .offer-desc,
[data-theme="light"] .offer-meta,
[data-theme="light"] .stat-sub,
[data-theme="light"] .pos-label {
  color: var(--text-secondary);
}

[data-theme="light"] .matrix-table tbody tr:hover td,
[data-theme="light"] .cal-table tbody tr:hover,
[data-theme="light"] .pulse-item:hover,
[data-theme="light"] .offer-card:hover {
  background: rgba(180,135,39,0.08);
}

[data-theme="light"] .mini-badge.ref {
  display: none; /* REF badges removed from the matrix entirely */
}

[data-theme="light"] .delta.gold {
  background: rgba(141,104,24,0.10);
  color: var(--text-gold);
  border-color: rgba(141,104,24,0.18);
}

[data-theme="light"] .btn-ghost:hover,
[data-theme="light"] .offers-past-btn.active {
  background: rgba(180,135,39,0.10);
}

[data-theme="light"] .pulse-dot.neutral {
  background: var(--text-dim);
}

[data-theme="light"] .pulse-snap-card {
  border-right-color: rgba(42,30,18,0.12);
}
[data-theme="light"] .pulse-snap-footer {
  border-top-color: rgba(42,30,18,0.10);
}

/* Light mode scrollbar */
[data-theme="light"] ::-webkit-scrollbar-thumb { background: rgba(0,0,0,0.15); }
[data-theme="light"] ::-webkit-scrollbar-thumb:hover { background: rgba(0,0,0,0.25); }

/* Light mode — price matrix (tracker.html) structural overrides
   The tracker's row borders and hover state use rgba(255,255,255,...)
   which is invisible on a cream background. Replace with dark equivalents. */
[data-theme="light"] .price-matrix thead th {
  background: var(--bg-card);
  color: var(--text-secondary);
  border-bottom-color: rgba(56,38,8,0.20);
}
[data-theme="light"] .price-matrix tbody td {
  border-top-color: rgba(56,38,8,0.08);
}
[data-theme="light"] .price-matrix td.price-cell {
  border-left-color: rgba(56,38,8,0.08);
}
[data-theme="light"] .price-matrix td.price-cell.sold {
  color: rgba(56,38,8,0.55);
  opacity: 0.82;
  font-style: italic;
}
[data-theme="light"] .price-matrix tr.section-header td {
  background: rgba(216,203,172,0.60);
  color: var(--text-dim);
  border-top-color: rgba(56,38,8,0.14);
  border-bottom-color: rgba(56,38,8,0.14);
}
[data-theme="light"] .price-matrix tbody tr:not(.section-header):not(.sunset-divider):hover td {
  background: rgba(56,38,8,0.05);
}
[data-theme="light"] .matrix-legend {
  background: var(--bg-card);
  border-top-color: rgba(56,38,8,0.14);
  color: var(--text-dim);
}
[data-theme="light"] .matrix-legend .legend-swatch {
  border-color: rgba(56,38,8,0.20);
}

/* ── Theme toggle button ──────────────────────────────────────── */
.theme-toggle {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 32px; height: 32px;
  border-radius: var(--r-sm);
  border: 1px solid var(--border-md);
  background: var(--bg-elevated);
  color: var(--text-secondary);
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s, color 0.15s;
  flex-shrink: 0;
}
.theme-toggle:hover {
  border-color: var(--gold-border);
  color: var(--gold);
  background: var(--gold-glow-md);
}
.theme-toggle svg { width: 15px; height: 15px; fill: currentColor; }

/* =============================================================
   SCROLLBAR
   ============================================================= */
::-webkit-scrollbar { width: 5px; height: 5px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.1); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: rgba(255,255,255,0.18); }

/* =============================================================
   RESPONSIVE
   ============================================================= */
@media (max-width: 1280px) {
  .two-col { grid-template-columns: 1fr; }
  .position-band { grid-template-columns: repeat(2, 1fr); }
  .position-cell:nth-child(2) { border-right: none; }
  .position-cell:nth-child(3),
  .position-cell:nth-child(4) { border-top: 1px solid var(--border); }
}

@media (max-width: 960px) {
  :root { --sidebar-w: 0px; }
  .sidebar { display: none; }
  .main { margin-left: 0; }
  .stat-row { grid-template-columns: repeat(2, 1fr); }
  .sunset-filters { grid-template-columns: repeat(2, 1fr); }
  .method-grid { grid-template-columns: 1fr; }
  .sunset-split { grid-template-columns: 1fr; }
}

@media (max-width: 640px) {
  .stat-row { grid-template-columns: 1fr 1fr; }
  .content { padding: 0.85rem; }
  .filter-bar { flex-direction: column; align-items: flex-start; }
  .position-band { grid-template-columns: 1fr; }
  .position-cell { border-right: none; border-top: 1px solid var(--border); }
  .position-cell:first-child { border-top: none; }
}
