@font-face {
  font-family: 'Departure Mono';
  src: url('./assets/fonts/DepartureMono-Regular.woff2') format('woff2');
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}

:root {
  --ground: #12100E;
  --maroon: #3A1420;
  --panel: #221E1A;
  --panel-alt: #1A1613;
  --line: #453E37;
  --cream: #EFE9E2;
  --paper: #FFF6E8;
  --muted: #B0A79D;
  --magenta: #E74079;
  --salmon: #D9A097;
  --radius: 10px;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }

body {
  margin: 0;
  min-height: 100vh;
  background-color: var(--ground);
  background-image: radial-gradient(720px 440px at 0% 0%, rgba(58, 20, 32, 0.85), rgba(18, 16, 14, 0) 70%);
  color: var(--cream);
  font-family: 'Inter Tight', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  font-size: 15px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--salmon); text-decoration: none; }
a:hover { color: var(--paper); text-decoration: underline; }

.mono {
  font-family: 'Departure Mono', ui-monospace, SFMono-Regular, Menlo, monospace;
  font-variant-numeric: tabular-nums;
}

.wrap {
  max-width: 1180px;
  margin: 0 auto;
  padding: 24px 20px 64px;
}

/* Header */
.topbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding-bottom: 18px;
  border-bottom: 1px solid var(--line);
}

.brand {
  display: flex;
  align-items: center;
  gap: 14px;
}

.brand img {
  width: 36px;
  height: 36px;
  display: block;
  border-radius: 6px;
}

.brand-meta {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.brand-addr {
  font-size: 12px;
  color: var(--muted);
  letter-spacing: 0.04em;
}

.brand-tag {
  font-size: 12px;
  color: var(--salmon);
}

.as-of-pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 12px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 999px;
  font-size: 12px;
  color: var(--cream);
}

.pulse-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--magenta);
  box-shadow: 0 0 0 3px rgba(231, 64, 121, 0.22);
}

/* Hero */
.hero {
  padding: 28px 0 22px;
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  justify-content: space-between;
  gap: 20px;
}

.hero h1 {
  margin: 0 0 8px;
  font-family: 'Instrument Serif', Georgia, serif;
  font-weight: 400;
  font-size: clamp(2.3rem, 5vw, 3.6rem);
  line-height: 1.04;
  color: var(--paper);
  letter-spacing: -0.01em;
}

.hero h1 em {
  font-style: italic;
  color: var(--magenta);
}

.hero-sub {
  margin: 0;
  max-width: 640px;
  color: var(--muted);
  font-size: 15px;
  font-weight: 500;
}

/* Controls */
.controls-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 18px;
}

.seg-group {
  display: inline-flex;
  background: var(--panel-alt);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 3px;
  gap: 2px;
}

.seg-btn {
  appearance: none;
  border: 0;
  background: transparent;
  color: var(--muted);
  font-family: 'Inter Tight', sans-serif;
  font-size: 13px;
  font-weight: 600;
  padding: 7px 12px;
  border-radius: 6px;
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease;
}

.seg-btn:hover { color: var(--cream); }
.seg-btn.active {
  background: var(--panel);
  color: var(--paper);
  box-shadow: inset 0 0 0 1px var(--line);
}

.action-btn {
  appearance: none;
  border: 1px solid var(--line);
  background: var(--panel);
  color: var(--salmon);
  font-family: 'Departure Mono', monospace;
  font-size: 12px;
  padding: 7px 12px;
  border-radius: 7px;
  cursor: pointer;
}
.action-btn:hover {
  border-color: var(--salmon);
  color: var(--paper);
}

/* View navigation tabs */
.view-nav {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 22px;
  padding-bottom: 14px;
  border-bottom: 1px solid var(--line);
}

.tab-btn {
  appearance: none;
  border: 1px solid var(--line);
  background: var(--panel-alt);
  color: var(--muted);
  font-family: 'Inter Tight', sans-serif;
  font-size: 13px;
  font-weight: 600;
  padding: 8px 14px;
  border-radius: 999px;
  cursor: pointer;
}
.tab-btn:hover { color: var(--cream); border-color: #675d53; }
.tab-btn.active {
  background: var(--panel);
  color: var(--paper);
  border-color: var(--magenta);
}

/* KPI Strip */
.kpi-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(175px, 1fr));
  gap: 12px;
  margin-bottom: 20px;
}

.kpi-card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 15px 16px;
}

.kpi-label {
  font-size: 12px;
  color: var(--muted);
  font-weight: 600;
  letter-spacing: 0.02em;
  display: flex;
  justify-content: space-between;
  gap: 6px;
}

.kpi-scope {
  font-size: 10px;
  padding: 1px 6px;
  border-radius: 4px;
  border: 1px solid var(--line);
  color: var(--muted);
}

.kpi-value {
  margin-top: 8px;
  font-size: 26px;
  line-height: 1.1;
  color: var(--paper);
}

.kpi-note {
  margin-top: 6px;
  font-size: 12px;
  color: var(--muted);
}

/* Insights Strip */
.insight-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 12px;
  margin-bottom: 24px;
}

.insight-card {
  background: var(--panel-alt);
  border: 1px solid var(--line);
  border-left: 3px solid var(--salmon);
  border-radius: var(--radius);
  padding: 14px 16px;
}

.insight-card.accent { border-left-color: var(--magenta); }

.insight-kicker {
  font-size: 11px;
  color: var(--salmon);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin-bottom: 4px;
}

.insight-headline {
  font-size: 15px;
  font-weight: 600;
  color: var(--paper);
  margin: 0 0 4px;
}

.insight-body {
  margin: 0;
  font-size: 13px;
  color: var(--muted);
}

/* Panels */
.panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 18px 20px;
  margin-bottom: 18px;
}

.panel-head {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
}

.panel-title {
  margin: 0;
  font-size: 17px;
  font-weight: 600;
  color: var(--paper);
}

.panel-sub {
  margin: 3px 0 0;
  font-size: 13px;
  color: var(--muted);
}

.two-col {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(340px, 1fr));
  gap: 16px;
}

/* Charts & Tables */
.chart-wrap {
  width: 100%;
  overflow-x: auto;
}

.chart-wrap svg {
  display: block;
  width: 100%;
  height: auto;
}

.legend {
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
  font-size: 12px;
  color: var(--muted);
  margin-top: 10px;
}

.legend-item {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

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

.bar-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.bar-row {
  display: grid;
  grid-template-columns: 118px 1fr 78px;
  align-items: center;
  gap: 10px;
  font-size: 13px;
}

.bar-track {
  height: 10px;
  background: var(--ground);
  border: 1px solid var(--line);
  border-radius: 4px;
  overflow: hidden;
}

.bar-fill {
  height: 100%;
  background: var(--salmon);
  border-radius: 3px;
}

.bar-fill.magenta { background: var(--magenta); }
.bar-fill.paper { background: var(--paper); }

table.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

table.data-table th,
table.data-table td {
  text-align: left;
  padding: 9px 10px;
  border-bottom: 1px solid var(--line);
}

table.data-table th {
  color: var(--muted);
  font-weight: 600;
  font-size: 12px;
}

table.data-table td.num,
table.data-table th.num {
  text-align: right;
}

/* Activity Feed */
.feed-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.feed-item {
  display: grid;
  grid-template-columns: 118px 1fr auto;
  gap: 12px;
  align-items: center;
  padding: 10px 12px;
  background: var(--panel-alt);
  border: 1px solid var(--line);
  border-radius: 8px;
  font-size: 13px;
}

.feed-badge {
  display: inline-block;
  padding: 2px 7px;
  border-radius: 4px;
  font-size: 11px;
  border: 1px solid var(--line);
  color: var(--paper);
  background: var(--panel);
  text-align: center;
}

.feed-badge.paid { border-color: var(--magenta); color: var(--magenta); }
.feed-badge.created { border-color: var(--salmon); color: var(--salmon); }

/* Tooltip */
.tooltip {
  position: fixed;
  pointer-events: none;
  z-index: 100;
  background: #1A1613;
  border: 1px solid var(--salmon);
  border-radius: 8px;
  padding: 9px 12px;
  font-size: 12px;
  color: var(--paper);
  max-width: 280px;
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.55);
  opacity: 0;
  transition: opacity 0.12s ease;
}

.tooltip.show { opacity: 1; }

/* Methods & Footer */
.methods-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 14px;
  font-size: 13px;
  color: var(--muted);
}

.methods-grid code {
  display: block;
  padding: 8px 10px;
  margin-top: 6px;
  background: var(--ground);
  border: 1px solid var(--line);
  border-radius: 6px;
  color: var(--cream);
  font-size: 11.5px;
  overflow-x: auto;
}

.footer {
  margin-top: 32px;
  padding-top: 18px;
  border-top: 1px solid var(--line);
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 12px;
  font-size: 12.5px;
  color: var(--muted);
}

.view-section[hidden] { display: none; }

@media (max-width: 680px) {
  .wrap { padding: 16px 14px 48px; }
  .feed-item { grid-template-columns: 1fr; gap: 6px; }
  .bar-row { grid-template-columns: 96px 1fr 64px; }
  .two-col { grid-template-columns: 1fr; }
}
