@import url("https://fonts.googleapis.com/css2?family=IBM+Plex+Sans:wght@400;500;600;700&family=IBM+Plex+Mono:wght@400;500&display=swap");

:root {
  color-scheme: dark;
  --bg: #070b0f;
  --bg-soft: #0d141b;
  --panel: rgba(14, 22, 30, 0.9);
  --panel-strong: rgba(10, 17, 23, 0.96);
  --panel-hover: rgba(18, 28, 38, 0.96);
  --line: rgba(255, 255, 255, 0.08);
  --line-strong: rgba(255, 255, 255, 0.14);
  --text: #edf2f7;
  --text-soft: #b8c3cf;
  --text-muted: #7f8b98;
  --gold: #cda45a;
  --gold-soft: rgba(205, 164, 90, 0.14);
  --cyan: #66bdd6;
  --green: #61c38b;
  --red: #d77962;
  --amber: #b8944e;
  --shadow: 0 24px 80px rgba(0, 0, 0, 0.34);
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-height: 100vh;
  background:
    radial-gradient(circle at top left, rgba(205, 164, 90, 0.14), transparent 28%),
    radial-gradient(circle at top right, rgba(102, 189, 214, 0.1), transparent 24%),
    linear-gradient(180deg, #04070a 0%, var(--bg) 54%, #06090d 100%);
  color: var(--text);
  font-family: "IBM Plex Sans", "Segoe UI", sans-serif;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

a {
  color: inherit;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 24px;
  padding: 18px 28px;
  border-bottom: 1px solid var(--line);
  backdrop-filter: blur(18px);
  background: rgba(7, 11, 15, 0.84);
}

.topbar-brand,
.topbar-nav,
.topbar-meta,
.live-indicator {
  display: flex;
  align-items: center;
}

.topbar-brand {
  gap: 12px;
}

.brandmark {
  text-decoration: none;
  font-size: 15px;
  font-weight: 700;
  letter-spacing: -0.02em;
}

.brand-divider {
  width: 1px;
  height: 16px;
  background: var(--line-strong);
}

.brand-context {
  color: var(--text-muted);
  font-size: 12px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.topbar-nav {
  justify-content: center;
  gap: 8px;
}

.topbar-nav a {
  text-decoration: none;
  color: var(--text-soft);
  font-size: 13px;
  font-weight: 500;
  padding: 7px 12px;
  border-radius: 999px;
  border: 1px solid transparent;
  transition: color 0.18s ease, border-color 0.18s ease, background 0.18s ease;
}

.topbar-nav a:hover {
  color: var(--text);
  border-color: var(--line);
  background: rgba(255, 255, 255, 0.03);
}

.topbar-meta {
  justify-content: flex-end;
}

.live-indicator {
  gap: 10px;
  color: var(--text-soft);
  font-size: 12px;
}

.live-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--green);
  box-shadow: 0 0 0 6px rgba(97, 195, 139, 0.12);
}

.shell {
  max-width: 1320px;
  margin: 0 auto;
  padding: 36px 24px 56px;
}

.hero-panel,
.action-strip,
.status-card,
.card,
.panel,
.summary-card {
  background: linear-gradient(180deg, var(--panel) 0%, var(--panel-strong) 100%);
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
}

.hero-panel {
  display: grid;
  grid-template-columns: minmax(0, 1.5fr) minmax(320px, 0.9fr);
  gap: 24px;
  padding: 32px;
  border-radius: 28px;
  overflow: hidden;
}

.hero-copy {
  max-width: 760px;
}

.eyebrow,
.section-kicker,
.metric-label,
.summary-label {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.eyebrow {
  color: var(--gold);
  margin-bottom: 14px;
}

h1,
h2,
h3,
p {
  margin: 0;
}

h1 {
  max-width: 12ch;
  font-size: clamp(2.25rem, 4.8vw, 4.3rem);
  line-height: 1.05;
  letter-spacing: -0.05em;
}

.tagline {
  margin-top: 18px;
  max-width: 56ch;
  color: var(--text-soft);
  font-size: 17px;
}

.trust-row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 24px;
}

.trust-chip,
.metric-badge,
.source-badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 32px;
  padding: 0 12px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.03);
  color: var(--text-soft);
  font-size: 12px;
  font-weight: 500;
}

.hero-summary {
  display: grid;
  gap: 14px;
}

.summary-card {
  border-radius: 20px;
  padding: 18px 18px 16px;
}

.summary-label {
  color: var(--text-muted);
}

.summary-value {
  margin-top: 10px;
  font-size: 24px;
  font-weight: 700;
  letter-spacing: -0.04em;
}

.summary-meta {
  margin-top: 6px;
  color: var(--text-soft);
  font-size: 13px;
}

.action-strip {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  margin-top: 18px;
  padding: 20px 24px;
  border-radius: 22px;
}

.action-copy {
  display: grid;
  gap: 4px;
}

.action-copy strong {
  font-size: 14px;
  font-weight: 600;
}

.action-copy span {
  color: var(--text-soft);
  font-size: 14px;
}

.hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
}

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  padding: 0 18px;
  border-radius: 999px;
  text-decoration: none;
  font-size: 13px;
  font-weight: 600;
  background: linear-gradient(135deg, #b99458 0%, #d2ad6c 100%);
  color: #11161c;
  border: 1px solid rgba(205, 164, 90, 0.3);
  transition: transform 0.18s ease, filter 0.18s ease;
}

.button:hover {
  transform: translateY(-1px);
  filter: brightness(1.04);
}

.button-muted {
  background: rgba(255, 255, 255, 0.03);
  color: var(--text);
  border-color: var(--line);
}

.section {
  margin-top: 42px;
}

.section-head {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 24px;
  margin-bottom: 18px;
}

.section-kicker {
  color: var(--gold);
  margin-bottom: 6px;
}

.section-head h2 {
  font-size: 28px;
  letter-spacing: -0.04em;
}

.section-head p {
  max-width: 48ch;
  color: var(--text-soft);
  font-size: 14px;
}

.status-grid,
.cards,
.chart-grid,
.chart-grid-three,
.source-strip {
  display: grid;
  gap: 16px;
}

.status-grid {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.cards {
  grid-template-columns: repeat(4, minmax(0, 1fr));
  margin-bottom: 18px;
}

.chart-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.chart-grid-three {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.source-strip {
  grid-template-columns: repeat(3, minmax(0, 1fr));
  margin-bottom: 18px;
}

.chart-span {
  grid-column: 1 / -1;
}

.status-card,
.card,
.panel {
  position: relative;
  border-radius: 22px;
  overflow: hidden;
}

.status-card,
.card {
  padding: 18px 18px 16px;
  min-height: 148px;
}

.panel {
  padding: 18px 18px 10px;
  min-height: 340px;
}

.metric-head,
.metric-badge-row,
.panel-head {
  display: flex;
  align-items: start;
  justify-content: space-between;
  gap: 12px;
}

.metric-label {
  color: var(--text-muted);
}

.metric-value {
  margin-top: 12px;
  font-size: 30px;
  font-weight: 700;
  letter-spacing: -0.05em;
  line-height: 1;
}

.metric-meta {
  margin-top: 10px;
  color: var(--text-soft);
  font-size: 13px;
}

.metric-note {
  margin-top: 8px;
  color: var(--text-muted);
  font-size: 12px;
}

.metric-badge-row {
  margin-top: 14px;
  align-items: center;
}

.metric-badge,
.source-badge {
  font-size: 11px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.metric-badge.tone-live,
.source-badge.tone-live {
  color: var(--green);
  background: rgba(97, 195, 139, 0.12);
  border-color: rgba(97, 195, 139, 0.22);
}

.metric-badge.tone-partial,
.source-badge.tone-partial {
  color: var(--amber);
  background: rgba(184, 148, 78, 0.14);
  border-color: rgba(184, 148, 78, 0.24);
}

.metric-badge.tone-alert,
.source-badge.tone-alert {
  color: var(--red);
  background: rgba(215, 121, 98, 0.12);
  border-color: rgba(215, 121, 98, 0.22);
}

.metric-badge.tone-calm,
.source-badge.tone-calm {
  color: var(--cyan);
  background: rgba(102, 189, 214, 0.12);
  border-color: rgba(102, 189, 214, 0.22);
}

.panel-head {
  margin-bottom: 14px;
}

.panel-head h3 {
  font-size: 16px;
  font-weight: 600;
  letter-spacing: -0.02em;
}

.panel-head p {
  color: var(--text-muted);
  font-size: 13px;
  max-width: 34ch;
}

.chart-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 12px;
  margin-bottom: 12px;
  color: var(--text-soft);
  font-size: 12px;
}

.chart-legend-time {
  width: 100%;
  color: var(--text-muted);
  font-size: 11px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.chart-legend-item {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 28px;
  padding: 0 10px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.02);
}

.chart-legend-swatch {
  width: 10px;
  height: 10px;
  border-radius: 999px;
  flex: 0 0 auto;
}

.chart-legend-label {
  color: var(--text-muted);
}

.chart-surface {
  width: 100%;
  height: 256px;
  border-radius: 18px;
  overflow: hidden;
  border: 1px solid var(--line);
  background: #0d1117;
}

.chart-surface .tv-lightweight-charts {
  border-radius: 18px;
}

.notes-panel {
  min-height: 0;
  padding-bottom: 18px;
}

.notes {
  margin: 0;
  padding-left: 20px;
  color: var(--text-soft);
}

.notes li + li {
  margin-top: 10px;
}

.footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-top: 40px;
  padding-top: 18px;
  border-top: 1px solid var(--line);
  color: var(--text-muted);
  font-size: 13px;
}

.fatal {
  padding: 32px;
  color: #ffd2ca;
  white-space: pre-wrap;
}

/* Loading & error states */
.loading-state {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 60vh;
  color: var(--text-muted);
  font-size: 15px;
}

.loading-state::before {
  content: "";
  display: inline-block;
  width: 18px;
  height: 18px;
  margin-right: 12px;
  border: 2px solid var(--line-strong);
  border-top-color: var(--gold);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

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

.error-state {
  padding: 32px;
  border-radius: 22px;
  background: var(--panel);
  border: 1px solid rgba(215, 121, 98, 0.22);
  color: var(--red);
  font-size: 14px;
  text-align: center;
}

/* Active nav indicator */
.topbar-nav a.active {
  color: var(--text);
  border-color: var(--line-strong);
  background: rgba(255, 255, 255, 0.06);
}

/* Subtle card hover */
.status-card:hover,
.card:hover {
  border-color: var(--line-strong);
  background: var(--panel-hover);
  transition: border-color 0.2s ease, background 0.2s ease;
}

/* Mobile nav hamburger */
.nav-toggle {
  display: none;
  background: none;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 8px 10px;
  color: var(--text-soft);
  font-size: 18px;
  cursor: pointer;
  line-height: 1;
}

@media (max-width: 1120px) {
  .topbar {
    grid-template-columns: 1fr;
    justify-items: start;
  }

  .topbar-nav {
    justify-content: start;
    flex-wrap: wrap;
  }

  .hero-panel {
    grid-template-columns: 1fr;
  }

  .status-grid,
  .cards {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .source-strip,
  .chart-grid-three {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 840px) {
  .shell {
    padding: 24px 16px 44px;
  }

  .topbar {
    padding: 16px;
  }

  .action-strip,
  .section-head,
  .footer {
    flex-direction: column;
    align-items: start;
  }

  .chart-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 640px) {
  .status-grid,
  .cards {
    grid-template-columns: 1fr;
  }

  .hero-panel,
  .action-strip,
  .panel,
  .status-card,
  .card {
    border-radius: 18px;
  }

  h1 {
    max-width: none;
    font-size: clamp(1.75rem, 6vw, 2.25rem);
  }

  .summary-value,
  .metric-value {
    font-size: 25px;
  }

  .topbar {
    padding: 12px 16px;
  }

  .nav-toggle {
    display: block;
  }

  .topbar-nav {
    display: none;
  }

  .topbar-nav.open {
    display: flex;
    width: 100%;
    padding-top: 12px;
    border-top: 1px solid var(--line);
    margin-top: 8px;
  }

  .topbar-meta {
    display: none;
  }

  .hero-panel {
    padding: 20px;
  }

  .tagline {
    font-size: 15px;
  }

  .chart-surface {
    height: 200px;
  }

  .section-head h2 {
    font-size: 22px;
  }

  .panel {
    min-height: 280px;
  }
}
