:root {
  color-scheme: dark;
  --bg: #10110f;
  --panel: #191b17;
  --panel-2: #20231e;
  --text: #f1efe4;
  --muted: #a7aa9b;
  --line: #34382f;
  --rx: #7bd88f;
  --tx: #f0b35a;
  --accent: #d7ff63;
  --danger: #ff776b;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background:
    linear-gradient(135deg, rgba(215, 255, 99, 0.08), transparent 34%),
    repeating-linear-gradient(0deg, rgba(255, 255, 255, 0.025) 0 1px, transparent 1px 4px),
    var(--bg);
  color: var(--text);
  font-family: ui-monospace, "SFMono-Regular", Menlo, Monaco, Consolas, monospace;
}

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

.topbar {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 20px;
}

.eyebrow {
  margin: 0 0 8px;
  color: var(--accent);
  font-size: 12px;
  text-transform: uppercase;
}

h1,
h2,
p {
  margin: 0;
}

h1 {
  font-size: clamp(34px, 5vw, 70px);
  line-height: 0.92;
  letter-spacing: 0;
}

h2 {
  font-size: 15px;
  letter-spacing: 0;
}

.actions {
  display: flex;
  gap: 10px;
}

button,
select {
  height: 40px;
  border: 1px solid var(--line);
  background: var(--panel);
  color: var(--text);
  border-radius: 6px;
  padding: 0 12px;
  font: inherit;
}

button {
  cursor: pointer;
  background: var(--accent);
  color: #17180f;
  border-color: var(--accent);
  font-weight: 700;
}

.status {
  min-height: 28px;
  color: var(--muted);
  font-size: 13px;
  margin-bottom: 14px;
}

.status.error {
  color: var(--danger);
}

.metrics {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 12px;
}

.metric,
.panel {
  border: 1px solid var(--line);
  background: rgba(25, 27, 23, 0.92);
  border-radius: 8px;
}

.metric {
  padding: 16px;
  min-height: 118px;
}

.metric span,
.metric small {
  display: block;
  color: var(--muted);
  font-size: 12px;
}

.metric strong {
  display: block;
  margin: 13px 0 8px;
  font-size: clamp(24px, 3vw, 42px);
  line-height: 1;
  letter-spacing: 0;
}

.metric.accent {
  border-color: rgba(215, 255, 99, 0.55);
  background: linear-gradient(180deg, rgba(215, 255, 99, 0.12), rgba(25, 27, 23, 0.92));
}

.panel {
  padding: 16px;
}

.chart-panel {
  margin-bottom: 12px;
}

.panel-head {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 18px;
}

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

.legend i {
  display: inline-block;
  width: 10px;
  height: 10px;
  margin-right: 6px;
  border-radius: 2px;
}

.legend .rx {
  background: var(--rx);
}

.legend .tx {
  background: var(--tx);
}

.chart {
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: minmax(7px, 1fr);
  align-items: end;
  gap: 4px;
  height: 310px;
  padding-top: 10px;
  border-top: 1px solid var(--line);
}

.bar {
  position: relative;
  display: flex;
  flex-direction: column-reverse;
  min-width: 7px;
  height: var(--h);
  min-height: 2px;
  border-radius: 4px 4px 0 0;
  overflow: hidden;
  background: #2b2f27;
}

.bar.zero {
  opacity: 0.25;
}

.bar-rx {
  background: var(--rx);
  height: var(--rxh);
}

.bar-tx {
  background: var(--tx);
  height: var(--txh);
}

.bar:hover::after {
  content: attr(data-tip);
  position: absolute;
  left: 50%;
  bottom: calc(100% + 8px);
  transform: translateX(-50%);
  z-index: 2;
  width: max-content;
  max-width: 260px;
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #0b0c0a;
  color: var(--text);
  font-size: 12px;
  white-space: pre;
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.35);
}

.grid {
  display: grid;
  grid-template-columns: 1.4fr 0.8fr;
  gap: 12px;
}

.daily-list {
  display: grid;
  gap: 10px;
  margin-top: 14px;
}

.day-row {
  display: grid;
  grid-template-columns: 120px 1fr 110px;
  align-items: center;
  gap: 12px;
  color: var(--muted);
  font-size: 13px;
}

.day-meter {
  height: 12px;
  background: #2b2f27;
  border-radius: 999px;
  overflow: hidden;
}

.day-meter span {
  display: block;
  height: 100%;
  width: var(--w);
  background: linear-gradient(90deg, var(--rx), var(--tx));
}

.assumptions {
  display: grid;
  gap: 12px;
  margin: 14px 0 0;
}

.assumptions div {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--line);
}

dt {
  color: var(--muted);
}

dd {
  margin: 0;
  text-align: right;
}

@media (max-width: 820px) {
  .shell {
    width: min(100vw - 20px, 520px);
    padding: 18px 0 30px;
  }

  .topbar,
  .panel-head {
    align-items: stretch;
    flex-direction: column;
  }

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

  .actions {
    width: 100%;
  }

  select,
  button {
    flex: 1;
  }

  .chart {
    height: 230px;
    gap: 3px;
  }

  .day-row {
    grid-template-columns: 92px 1fr;
  }

  .day-row strong {
    grid-column: 2;
  }
}
