:root {
  color-scheme: dark;

  --surface: #0B0F14;
  --surface-raised: #121821;
  --surface-line: #1F2833;
  --ink: #EDF1F5;
  --ink-muted: #8A96A8;
  --ink-faint: #57616F;

  --accent: #9085e9;
  --accent-ink: #14101f;

  --status-pending: #3987e5;
  --status-processing: #d95926;
  --status-shipped: #199e70;
  --status-delivered: #c98500;

  --hero-sky-top: #131B26;
  --hero-sky-bottom: #0B0F14;
  --hero-building: #1B2531;
  --hero-window: #E7B45E;
  --hero-smoke: rgba(230, 236, 244, 0.32);
  --hero-belt: #1F2833;
  --hero-crate: #B98552;
  --hero-accent: #9085e9;
  --hero-accent-dim: #6a5fbd;
  --hero-eye-white: #f4f2ff;
  --hero-eye-pupil: #14101f;

  --mono: ui-monospace, "SF Mono", "Cascadia Code", "Roboto Mono", Consolas, monospace;
  --sans: -apple-system, BlinkMacSystemFont, "Segoe UI", system-ui, sans-serif;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--surface);
  color: var(--ink);
  font-family: var(--sans);
  line-height: 1.5;
}

/* ---- hero ---- */
.hero {
  position: relative;
  overflow: hidden;
  border-bottom: 1px solid var(--surface-line);
}

.hero-art {
  display: block;
  width: 100%;
  height: clamp(180px, 32vw, 280px);
}

@media (prefers-reduced-motion: no-preference) {
  .hero-smoke circle {
    animation: puff 4.5s ease-in infinite;
    transform-origin: center;
  }
  .hero-smoke circle:nth-child(2) { animation-delay: 1.1s; }
  .hero-smoke circle:nth-child(3) { animation-delay: 2.3s; }
}
@keyframes puff {
  0%   { opacity: 0; transform: translateY(0) scale(0.7); }
  15%  { opacity: 0.9; }
  100% { opacity: 0; transform: translateY(-34px) scale(1.5); }
}

.hero-copy {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: 0 clamp(1.25rem, 5vw, 3rem);
  max-width: 640px;
  background: linear-gradient(90deg, var(--surface) 0%, var(--surface) 28%, transparent 78%);
}

.eyebrow {
  font-family: var(--mono);
  font-size: 0.72rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--ink-muted);
  margin: 0 0 0.5rem;
}

.hero-copy h1 {
  margin: 0;
  font-size: clamp(1.9rem, 4vw, 2.6rem);
  font-family: var(--mono);
  font-weight: 600;
  letter-spacing: -0.01em;
}

.subtitle {
  color: var(--ink-muted);
  margin: 0.6rem 0 0;
  max-width: 44ch;
  font-size: 0.98rem;
}

main {
  max-width: 1100px;
  margin: 0 auto;
  padding: 0 clamp(1rem, 4vw, 2rem) 3rem;
}

section { margin-top: 2rem; }

/* ---- stat tiles ---- */
.stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 1px;
  background: var(--surface-line);
  border: 1px solid var(--surface-line);
  border-radius: 10px;
  overflow: hidden;
}

.stat {
  background: var(--surface-raised);
  padding: 1rem 1.25rem;
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
}

.stat-value {
  font-family: var(--mono);
  font-size: 1.5rem;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}

.stat-label {
  color: var(--ink-muted);
  font-size: 0.78rem;
}

/* ---- charts ---- */
.charts {
  display: grid;
  grid-template-columns: 2fr 1fr;
  gap: 1rem;
}
@media (max-width: 780px) {
  .charts { grid-template-columns: 1fr; }
}

.chart-card {
  background: var(--surface-raised);
  border: 1px solid var(--surface-line);
  border-radius: 10px;
  padding: 1.1rem 1.25rem 0.8rem;
}

.chart-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.75rem;
  flex-wrap: wrap;
  margin-bottom: 0.4rem;
}

.chart-head h2 {
  font-size: 0.98rem;
  margin: 0;
  font-weight: 600;
}

.chart-legend-hint {
  font-size: 0.74rem;
  color: var(--ink-faint);
  font-family: var(--mono);
}

.chart {
  width: 100%;
  height: 200px;
  overflow: visible;
}

.chart .grid-line {
  stroke: var(--surface-line);
  stroke-width: 1;
}

.chart .axis-label {
  fill: var(--ink-faint);
  font-family: var(--mono);
  font-size: 9px;
}

.chart .area-fill { fill: var(--accent); opacity: 0.16; }
.chart .area-line {
  fill: none;
  stroke: var(--accent);
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.chart .area-point {
  fill: var(--surface-raised);
  stroke: var(--accent);
  stroke-width: 2;
  opacity: 0;
}
.chart .hover-target:hover ~ .area-point,
.chart .area-point.active { opacity: 1; }

.chart .bar {
  rx: 3;
}
.chart .bar-label, .chart .bar-value {
  font-family: var(--mono);
  font-size: 10.5px;
  fill: var(--ink-muted);
}
.chart .bar-value { fill: var(--ink); font-weight: 600; }

.chart .hover-target { cursor: default; }

.chart-tooltip {
  position: absolute;
  pointer-events: none;
  background: var(--ink);
  color: var(--surface);
  font-family: var(--sans);
  font-size: 0.76rem;
  padding: 0.4rem 0.6rem;
  border-radius: 6px;
  white-space: nowrap;
  box-shadow: 0 6px 18px rgba(0,0,0,0.35);
  opacity: 0;
  transition: opacity 0.1s ease;
  z-index: 5;
  transform: translate(-50%, -100%);
}
.chart-card { position: relative; }

.legend-row {
  display: flex;
  gap: 1rem;
  flex-wrap: wrap;
  margin-top: 0.6rem;
  font-family: var(--mono);
  font-size: 0.72rem;
  color: var(--ink-muted);
}
.legend-row .dot {
  width: 8px;
  height: 8px;
  border-radius: 2px;
  display: inline-block;
  margin-right: 0.35rem;
  vertical-align: middle;
}

/* ---- live stream ---- */
.live-dot {
  display: inline-block;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--status-processing);
  margin-right: 0.4rem;
  vertical-align: middle;
}
@media (prefers-reduced-motion: no-preference) {
  .live-dot { animation: live-pulse 1.4s ease-in-out infinite; }
}
@keyframes live-pulse {
  0%, 100% { opacity: 1; box-shadow: 0 0 0 0 color-mix(in oklab, var(--status-processing) 55%, transparent); }
  50% { opacity: 0.55; box-shadow: 0 0 0 5px transparent; }
}

.live-badge {
  display: inline-flex;
  align-items: center;
  font-family: var(--mono);
  font-size: 0.68rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--status-processing);
  margin-left: 0.6rem;
  vertical-align: middle;
}

.chart-head h2 {
  display: flex;
  align-items: center;
}

.live-feed-card { padding-bottom: 1rem; }

.live-feed {
  list-style: none;
  margin: 0.4rem 0 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 1px;
  background: var(--surface-line);
  border-radius: 8px;
  overflow: hidden;
  max-height: 280px;
  overflow-y: auto;
}

.live-feed-item {
  background: var(--surface-raised);
  padding: 0.5rem 0.75rem;
  font-family: var(--mono);
  font-size: 0.82rem;
  display: flex;
  align-items: center;
  gap: 0.6rem;
}

@media (prefers-reduced-motion: no-preference) {
  .live-feed-item.enter {
    animation: feed-in 0.35s ease-out;
  }
}
@keyframes feed-in {
  from { background: color-mix(in oklab, var(--status-processing) 20%, var(--surface-raised)); transform: translateX(-4px); opacity: 0; }
  to { background: var(--surface-raised); transform: translateX(0); opacity: 1; }
}

.live-feed-item .amount {
  margin-left: auto;
  color: var(--ink-muted);
}

/* ---- controls ---- */
.controls {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex-wrap: wrap;
}

label {
  font-size: 0.85rem;
  color: var(--ink-muted);
}

button, select {
  background: var(--surface-raised);
  color: var(--ink);
  border: 1px solid var(--surface-line);
  border-radius: 7px;
  padding: 0.55rem 0.95rem;
  cursor: pointer;
  font-size: 0.88rem;
  font-family: var(--sans);
}

button:hover { border-color: var(--ink-faint); }
button:focus-visible, select:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

button.ghost {
  background: transparent;
}

button.primary {
  background: var(--accent);
  color: var(--accent-ink);
  border-color: var(--accent);
  font-weight: 600;
}
button.primary:hover { filter: brightness(1.08); }

#timing {
  color: var(--ink-muted);
  font-size: 0.85rem;
  font-family: var(--mono);
}

/* ---- table ---- */
table {
  width: 100%;
  border-collapse: collapse;
  background: var(--surface-raised);
  border: 1px solid var(--surface-line);
  border-radius: 10px;
  overflow: hidden;
}

th, td {
  text-align: left;
  padding: 0.6rem 0.9rem;
  border-bottom: 1px solid var(--surface-line);
  font-size: 0.88rem;
  font-variant-numeric: tabular-nums;
}

tbody tr:last-child td { border-bottom: none; }

th {
  color: var(--ink-muted);
  font-weight: 500;
  font-size: 0.76rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  font-family: var(--mono);
}

.status-pill {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  font-family: var(--mono);
  font-size: 0.76rem;
  text-transform: capitalize;
}
.status-pill::before {
  content: "";
  width: 8px;
  height: 8px;
  border-radius: 2px;
  background: var(--pill-color);
}

@media (max-width: 620px) {
  table { font-size: 0.8rem; }
  th, td { padding: 0.45rem 0.6rem; }
}
