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

:root {
  --bg: #0f1418;
  --bg-2: #13202b;
  --panel: rgba(19, 32, 43, 0.85);
  --panel-border: rgba(255, 255, 255, 0.08);
  --text: #e6f1ff;
  --muted: #9fb3c8;
  --good: #4ade80;
  --warn: #fbbf24;
  --stress: #fb923c;
  --danger: #f87171;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: 'Space Grotesk', system-ui, sans-serif;
  color: var(--text);
  background: radial-gradient(1200px 600px at 20% 0%, #1f2f3b 0%, transparent 60%),
    radial-gradient(900px 400px at 80% 10%, #223042 0%, transparent 55%),
    linear-gradient(160deg, var(--bg) 0%, var(--bg-2) 100%);
  min-height: 100vh;
}

.site-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 28px 32px 12px;
  gap: 20px;
}

.site-header h1 {
  margin: 0;
  font-size: 28px;
  font-weight: 700;
  letter-spacing: 0.4px;
}

.subtitle {
  margin: 6px 0 0;
  color: var(--muted);
}

.controls {
  display: flex;
  align-items: center;
  gap: 12px;
  font-family: 'IBM Plex Mono', monospace;
  font-size: 13px;
  color: var(--muted);
  flex-wrap: wrap;
}

.controls select,
.controls button {
  background: var(--panel);
  border: 1px solid var(--panel-border);
  color: var(--text);
  padding: 8px 10px;
  border-radius: 8px;
  font-family: inherit;
}

.toggle-group {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 6px 10px;
  border-radius: 8px;
  border: 1px solid var(--panel-border);
  background: rgba(15, 20, 24, 0.35);
}

.toggle {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  cursor: pointer;
  user-select: none;
}

.toggle input {
  accent-color: var(--warn);
}

.controls button {
  cursor: pointer;
  transition: transform 120ms ease, border-color 120ms ease;
}

.controls button:hover {
  transform: translateY(-1px);
  border-color: var(--warn);
}

.grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 18px;
  padding: 12px 32px 40px;
}

.card {
  background: var(--panel);
  border: 1px solid var(--panel-border);
  border-radius: 16px;
  padding: 18px 18px 12px;
  backdrop-filter: blur(6px);
  box-shadow: 0 16px 30px rgba(0, 0, 0, 0.25);
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.card-muted {
  border-color: rgba(255, 255, 255, 0.05);
  background: rgba(19, 32, 43, 0.6);
}

.card-emphasis {
  border-color: rgba(90, 255, 182, 0.35);
  background: linear-gradient(135deg, rgba(90, 255, 182, 0.12), rgba(19, 32, 43, 0.85));
  box-shadow: 0 18px 40px rgba(90, 255, 182, 0.15);
}

.card h2 {
  font-size: 15px;
  margin: 0;
  font-weight: 600;
  line-height: 1.3;
}

.card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
}

.card-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.card-footer {
  margin-top: 8px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.pill {
  font-size: 11px;
  color: #c8d7e6;
  border: 1px solid rgba(121, 155, 186, 0.35);
  background: rgba(24, 38, 52, 0.8);
  border-radius: 999px;
  padding: 2px 8px;
  font-family: 'IBM Plex Mono', monospace;
  text-decoration: none;
}

.pill-link:hover {
  border-color: rgba(121, 155, 186, 0.7);
  color: #e7f1fa;
}

.site-footer {
  padding: 28px 28px 40px;
}

.attribution {
  display: flex;
  flex-wrap: wrap;
  gap: 10px 14px;
  align-items: center;
  font-size: 12px;
  color: var(--muted);
}

.attribution-copy {
  flex-basis: 100%;
  margin: 6px 0 4px;
  color: var(--muted);
  line-height: 1.5;
  font-size: 12px;
}

.attribution-links {
  display: flex;
  flex-wrap: wrap;
  gap: 10px 14px;
  align-items: center;
}

.attribution .label {
  font-weight: 600;
  color: #d7e6f7;
  margin-right: 4px;
}

.attribution a {
  color: #9fb3c8;
  text-decoration: none;
  border-bottom: 1px solid rgba(159, 179, 200, 0.35);
}

.attribution a:hover {
  color: #e7f1fa;
  border-bottom-color: rgba(231, 241, 250, 0.7);
}

.card-muted h2 {
  font-size: 14px;
  font-weight: 500;
}

.card .meta {
  color: var(--muted);
  font-size: 11px;
  font-family: 'IBM Plex Mono', monospace;
}

.help-text {
  font-size: 11px;
  line-height: 1.4;
  color: var(--muted);
  margin-top: 8px;
}

.help-text a {
  color: #8fe8d1;
  text-decoration: none;
  border-bottom: 1px solid rgba(143, 232, 209, 0.4);
}

.help-text a:hover {
  color: #d7fff4;
  border-bottom-color: rgba(215, 255, 244, 0.8);
}

.value {
  font-size: 26px;
  font-weight: 700;
  margin: 2px 0 6px;
  display: flex;
  align-items: baseline;
  gap: 8px;
}

.value-number {
  font-size: 30px;
  font-weight: 700;
}

.value-unit {
  font-size: 13px;
  font-weight: 500;
  color: var(--muted);
}

.value-muted {
  color: var(--muted);
  font-weight: 500;
}

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

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

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

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

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

.canvas-wrap {
  position: relative;
  height: 180px;
}

.chart-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 10px;
  font-size: 11px;
  color: var(--muted);
  margin-top: 6px;
  margin-bottom: 4px;
}

.legend-item {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 2px 6px;
  border-radius: 999px;
  background: rgba(15, 20, 24, 0.45);
  border: 1px solid rgba(255, 255, 255, 0.08);
}

.legend-swatch {
  display: inline-block;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  border: 1px solid rgba(255, 255, 255, 0.2);
}

.legend-text {
  font-family: 'IBM Plex Mono', monospace;
  font-size: 10px;
}

.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12px;
  color: var(--text);
  margin-top: 8px;
}

.data-table th,
.data-table td {
  padding: 6px 8px;
  text-align: left;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.data-table th {
  font-size: 11px;
  color: var(--muted);
  font-family: 'IBM Plex Mono', monospace;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.data-table tbody tr:hover {
  background: rgba(15, 20, 24, 0.35);
}

.price-bar-table {
  font-size: 12px;
}

.price-bar-label {
  width: 38%;
  color: #d7e6f7;
  font-family: 'IBM Plex Mono', monospace;
}

.price-bar-cell {
  width: 62%;
}

.price-bar {
  position: relative;
  height: 18px;
  background: rgba(255, 255, 255, 0.04);
  border-radius: 999px;
  overflow: hidden;
  display: flex;
  align-items: center;
  padding: 0 8px;
}

.price-bar-fill {
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  background: linear-gradient(90deg, rgba(93, 228, 199, 0.6), rgba(93, 228, 199, 0.2));
}

.price-bar-fill.negative {
  background: linear-gradient(90deg, rgba(255, 107, 107, 0.6), rgba(255, 107, 107, 0.2));
}

.price-bar-value {
  position: relative;
  z-index: 1;
  font-size: 11px;
  color: #e7f1fa;
}

.has-tooltip {
  position: relative;
}

.has-tooltip::after {
  content: attr(data-tooltip);
  position: absolute;
  left: 0;
  bottom: 120%;
  background: rgba(8, 12, 16, 0.95);
  color: #e7f1fa;
  border: 1px solid rgba(255, 255, 255, 0.15);
  padding: 6px 8px;
  border-radius: 8px;
  font-size: 11px;
  line-height: 1.3;
  white-space: nowrap;
  opacity: 0;
  pointer-events: none;
  transform: translateY(4px);
  transition: opacity 120ms ease, transform 120ms ease;
  z-index: 5;
}

.has-tooltip:hover::after {
  opacity: 1;
  transform: translateY(0);
}

.section-card {
  grid-column: 1 / -1;
  padding: 16px 20px;
  border-radius: 16px;
  background: linear-gradient(120deg, rgba(93, 228, 199, 0.18), rgba(255, 179, 71, 0.18));
  border: 1px solid rgba(255, 255, 255, 0.12);
  text-transform: uppercase;
  letter-spacing: 2px;
  font-size: 12px;
  font-weight: 700;
  color: var(--text);
  margin-top: 10px;
  margin-bottom: 6px;
}

.section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.section-toggle {
  display: flex;
  align-items: center;
  gap: 8px;
  font-family: 'IBM Plex Mono', monospace;
  font-size: 11px;
  text-transform: none;
  letter-spacing: 0.5px;
}

.section-toggle select {
  background: rgba(15, 20, 24, 0.35);
  border: 1px solid rgba(255, 255, 255, 0.12);
  color: var(--text);
  padding: 6px 8px;
  border-radius: 8px;
  font-family: inherit;
}

@media (max-width: 720px) {
  .site-header {
    flex-direction: column;
    align-items: flex-start;
  }
  .grid {
    padding: 10px 18px 32px;
  }
}
