:root {
  --bg-ink: #0e1b2a;
  --bg-sky: #d8e6f2;
  --card: rgba(255, 255, 255, 0.88);
  --text: #1a1f2a;
  --muted: #4e5b69;
  --line: rgba(16, 30, 44, 0.12);
  --positive: #0f8a5f;
  --negative: #c13f2d;
  --neutral: #2d6db3;
  --glow: rgba(255, 255, 255, 0.46);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: "Space Grotesk", sans-serif;
  color: var(--text);
  background:
    radial-gradient(circle at 12% 10%, #f0b57a 0%, transparent 32%),
    radial-gradient(circle at 92% 18%, #7ebfbe 0%, transparent 30%),
    linear-gradient(145deg, var(--bg-sky), #f7f4ea 52%, #b9cad7);
  min-height: 100vh;
}

.noise-layer {
  position: fixed;
  inset: 0;
  pointer-events: none;
  opacity: 0.05;
  background-image: radial-gradient(#10253a 0.6px, transparent 0.6px);
  background-size: 5px 5px;
}

.layout {
  max-width: 1180px;
  margin: 0 auto;
  padding: 2.2rem 1rem 2.8rem;
  position: relative;
}

.hero {
  background: linear-gradient(120deg, rgba(14, 27, 42, 0.9), rgba(31, 69, 105, 0.86));
  color: #f3f7fb;
  border-radius: 20px;
  padding: 1.5rem;
  box-shadow: 0 18px 35px rgba(16, 25, 43, 0.24);
  animation: rise 540ms ease;
}

.hero-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
}

.top-nav {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.top-nav a {
  color: #d7e5f2;
  text-decoration: none;
  border: 1px solid rgba(214, 231, 247, 0.34);
  border-radius: 999px;
  padding: 0.3rem 0.7rem;
  font-size: 0.8rem;
  transition: background-color 160ms ease, color 160ms ease;
}

.top-nav a:hover,
.top-nav a[aria-current="page"] {
  color: #102740;
  background: #dbebfa;
}

.kicker {
  margin: 0;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  font-size: 0.78rem;
  color: #97b6d6;
}

h1 {
  margin: 0.35rem 0 0;
  font-size: clamp(1.7rem, 3.5vw, 2.6rem);
  letter-spacing: -0.02em;
}

.subhead {
  margin: 0.7rem 0 0;
  max-width: 62ch;
  color: #d1deea;
}

.hero-controls {
  margin-top: 1rem;
  display: flex;
  gap: 0.7rem;
  align-items: end;
  flex-wrap: wrap;
}

.hero-controls label {
  display: grid;
  gap: 0.2rem;
  font-size: 0.78rem;
  color: #bed1e4;
}

.hero-controls input,
.hero-controls select {
  border-radius: 9px;
  border: 1px solid rgba(197, 216, 235, 0.5);
  background: rgba(255, 255, 255, 0.14);
  color: #f4f8fc;
  padding: 0.35rem 0.5rem;
  min-width: 116px;
  font-family: "IBM Plex Mono", monospace;
}

.helper {
  margin-top: 0.95rem;
}

.helper h2 {
  margin: 0;
  font-size: 0.98rem;
}

.helper p {
  margin: 0.35rem 0 0;
  color: var(--muted);
  font-size: 0.9rem;
}

.hero-controls button,
.cta-link {
  border: 1px solid rgba(197, 216, 235, 0.6);
  border-radius: 10px;
  background: rgba(227, 238, 250, 0.18);
  color: #ecf5fc;
  padding: 0.42rem 0.74rem;
  text-decoration: none;
  font-family: "Space Grotesk", sans-serif;
  cursor: pointer;
}

.hero-controls button:hover,
.cta-link:hover {
  background: rgba(227, 238, 250, 0.32);
}

.hero-meta {
  margin-top: 1rem;
  display: flex;
  gap: 1rem;
  flex-wrap: wrap;
  font-family: "IBM Plex Mono", monospace;
  font-size: 0.84rem;
  color: #b9cde0;
}

.status-message {
  margin: 0.6rem 0 0;
  min-height: 1.1rem;
  font-size: 0.85rem;
  color: #d8e5f2;
}

.status-message.error {
  color: #ffd2c8;
}

.cards {
  margin-top: 1rem;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.9rem;
}

.metric-card {
  padding: 1rem;
  border-radius: 16px;
  background: var(--card);
  border: 1px solid var(--line);
  backdrop-filter: blur(4px);
  box-shadow: 0 10px 26px rgba(17, 31, 44, 0.12);
  transform: translateY(6px);
  opacity: 0;
  animation: stagger 420ms ease forwards;
}

.metric-card:nth-child(2) {
  animation-delay: 90ms;
}

.metric-card:nth-child(3) {
  animation-delay: 170ms;
}

.metric-card h3 {
  margin: 0;
  font-size: 0.9rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted);
}

.metric-card .value {
  margin-top: 0.5rem;
  font-size: 2rem;
  line-height: 1;
  font-weight: 700;
}

.metric-card .meta {
  margin-top: 0.45rem;
  font-size: 0.9rem;
  color: var(--muted);
}

.positive .value {
  color: var(--positive);
}

.negative .value {
  color: var(--negative);
}

.neutral .value {
  color: var(--neutral);
}

.panel-grid {
  margin-top: 1rem;
  display: grid;
  grid-template-columns: 1.2fr 1fr;
  gap: 0.9rem;
}

.panel {
  background: rgba(255, 255, 255, 0.86);
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 1rem;
}

.panel-header h2 {
  margin: 0;
  font-size: 1.1rem;
}

.panel-header p {
  margin: 0.3rem 0 0.7rem;
  color: var(--muted);
  font-size: 0.9rem;
}

.bar-list,
.stack-list {
  display: grid;
  gap: 0.55rem;
}

.bar-row {
  display: grid;
  grid-template-columns: 62px 1fr 75px;
  gap: 0.5rem;
  align-items: center;
}

.bar-row.clickable {
  cursor: pointer;
  border-radius: 8px;
  padding: 0.2rem;
  transition: background-color 150ms ease;
}

.bar-row.clickable:hover,
.bar-row.clickable:focus-visible {
  background: rgba(33, 70, 107, 0.1);
  outline: none;
}

.bar-label,
.bar-value,
.stack-label {
  font-family: "IBM Plex Mono", monospace;
  font-size: 0.8rem;
}

.bar-track {
  height: 11px;
  border-radius: 999px;
  background: #e2e8ef;
  overflow: hidden;
}

.bar-fill {
  height: 100%;
  background: linear-gradient(90deg, #1f6bb2, #2ca47a);
}

.stack-row {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 0.6rem;
  align-items: center;
  border-bottom: 1px solid var(--line);
  padding-bottom: 0.35rem;
}

.stack-values {
  display: flex;
  gap: 0.4rem;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.scope-list {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
  margin-bottom: 0.8rem;
}

.scope-pill {
  padding: 0.28rem 0.5rem;
  border-radius: 999px;
  font-family: "IBM Plex Mono", monospace;
  font-size: 0.73rem;
  background: rgba(16, 37, 58, 0.08);
}

.geo-list {
  display: grid;
  gap: 0.42rem;
}

.geo-row {
  display: grid;
  grid-template-columns: 1fr 1fr auto auto;
  gap: 0.55rem;
  align-items: center;
  border-bottom: 1px solid var(--line);
  padding-bottom: 0.35rem;
  font-family: "IBM Plex Mono", monospace;
  font-size: 0.76rem;
}

.geo-impact {
  font-weight: 600;
}

.pill {
  padding: 0.2rem 0.45rem;
  border-radius: 999px;
  font-family: "IBM Plex Mono", monospace;
  font-size: 0.72rem;
  background: rgba(16, 37, 58, 0.07);
}

@keyframes rise {
  from {
    transform: translateY(10px);
    opacity: 0;
  }
  to {
    transform: translateY(0);
    opacity: 1;
  }
}

@keyframes stagger {
  to {
    transform: translateY(0);
    opacity: 1;
  }
}

@media (max-width: 900px) {
  .hero-controls {
    align-items: stretch;
  }

  .hero-controls button,
  .cta-link {
    width: 100%;
    text-align: center;
  }

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

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

  .bar-row {
    grid-template-columns: 56px 1fr 68px;
  }

  .geo-row {
    grid-template-columns: 1fr;
    gap: 0.2rem;
  }
}
