:root {
  color-scheme: light;
  --bg: #f7f7f4;
  --panel: #ffffff;
  --text: #171717;
  --muted: #62645e;
  --line: #deded6;
  --positive: #0f7b55;
  --negative: #b42318;
  --market-up: #c63d32;
  --market-down: #198f68;
  --neutral: #6a4d00;
  --accent: #1f5d8c;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--text);
  font-family:
    Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI",
    sans-serif;
}

.shell {
  width: min(1120px, calc(100vw - 32px));
  margin: 0 auto;
  padding: 32px 0 28px;
}

.topbar,
.metric-head,
.section-head,
.summary,
footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.eyebrow {
  margin: 0 0 6px;
  color: var(--accent);
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0;
  text-transform: uppercase;
}

h1,
h2,
p {
  margin: 0;
}

h1 {
  font-size: 34px;
  line-height: 1.12;
}

h2 {
  font-size: 24px;
  line-height: 1.2;
}

button {
  min-width: 72px;
  height: 40px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  color: var(--text);
  font-weight: 700;
  cursor: pointer;
}

button:disabled {
  cursor: wait;
  opacity: 0.6;
}

.status {
  margin: 28px 0 16px;
  padding: 14px 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  font-weight: 700;
}

.status.positive {
  border-color: color-mix(in srgb, var(--positive) 35%, var(--line));
  color: var(--positive);
}

.status.negative {
  border-color: color-mix(in srgb, var(--negative) 35%, var(--line));
  color: var(--negative);
}

.status.neutral {
  border-color: color-mix(in srgb, var(--neutral) 30%, var(--line));
  color: var(--neutral);
}

.grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 16px;
}

.metric,
.summary,
.chart-card {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
}

.metric {
  min-height: 270px;
  padding: 18px;
}

.metric-head {
  color: var(--muted);
  font-size: 14px;
  font-weight: 700;
}

.metric-head strong {
  color: var(--accent);
  font-size: 13px;
}

.value {
  margin-top: 26px;
  font-size: 38px;
  font-weight: 800;
  line-height: 1;
}

.meta {
  margin-top: 16px;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.55;
}

.mini-chart {
  width: 100%;
  min-height: 86px;
  margin-top: 20px;
}

.mini-chart svg {
  display: block;
  width: 100%;
  height: 86px;
}

.mini-chart rect.positive {
  fill: color-mix(in srgb, var(--market-up) 78%, white);
}

.mini-chart rect.negative {
  fill: color-mix(in srgb, var(--market-down) 78%, white);
}

.mini-line {
  fill: none;
  stroke-width: 3;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.mini-area {
  opacity: 0.09;
}

.mini-chart circle {
  stroke: var(--panel);
  stroke-width: 2;
}

.mini-zero-line {
  stroke: var(--line);
  stroke-dasharray: 4 5;
}

.mini-empty {
  display: grid;
  min-height: 86px;
  place-items: center;
  border: 1px dashed var(--line);
  border-radius: 8px;
  color: var(--muted);
  font-size: 13px;
  text-align: center;
}

.summary {
  margin-top: 16px;
  padding: 22px;
}

.summary > p {
  max-width: 620px;
  color: var(--muted);
  line-height: 1.6;
}

.trends {
  margin-top: 22px;
}

.section-head {
  margin-bottom: 12px;
}

.cache-badge {
  display: inline-flex;
  align-items: center;
  min-height: 32px;
  padding: 0 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

.chart-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 16px;
}

.chart-card {
  min-height: 214px;
  padding: 18px;
}

.chart {
  width: 100%;
  min-height: 136px;
  margin-top: 18px;
}

.chart svg {
  display: block;
  width: 100%;
  height: 136px;
}

.chart path {
  fill: none;
  stroke-width: 3;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.chart circle {
  stroke: var(--panel);
  stroke-width: 2;
}

.zero-line {
  stroke: var(--line);
  stroke-dasharray: 4 5;
}

.empty-chart {
  display: grid;
  min-height: 136px;
  place-items: center;
  border: 1px dashed var(--line);
  border-radius: 8px;
  color: var(--muted);
  font-size: 14px;
  text-align: center;
}

footer {
  margin-top: 20px;
  color: var(--muted);
  font-size: 13px;
}

@media (max-width: 820px) {
  .topbar,
  .section-head,
  .summary,
  footer {
    align-items: flex-start;
    flex-direction: column;
  }

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

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

  h1 {
    font-size: 28px;
  }

  .value {
    font-size: 34px;
  }
}
