:root {
  --bg: #0e0e10;
  --panel: #121316;
  --text: #eaeaff;
  --muted: #8f95b3;
  --border: #2a2c33;
  --accent: #06b6d4;   /* brand cyan — UI chrome only */
  --bar: #0891b2;      /* chart mark — darker step of the same hue, validated vs --panel */
  --bar-hover: #06b6d4;
  --error: #f28b82;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 15px/1.5 system-ui, -apple-system, "Segoe UI", sans-serif;
}

.top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  max-width: 880px;
  margin: 0 auto;
  padding: 20px 16px 4px;
}
.top h1 { margin: 0; font-size: 20px; font-weight: 650; }
.top .accent { color: var(--accent); font-weight: 500; }

.container { max-width: 880px; margin: 0 auto; padding: 12px 16px 48px; }

.card {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 18px 20px;
  margin-top: 16px;
}
.card-title { margin: 0 0 14px; font-size: 14px; font-weight: 600; color: var(--muted); }

.muted { color: var(--muted); }
.error { color: var(--error); font-size: 14px; }
.notice { color: var(--muted); font-size: 14px; margin: 14px 2px 0; }

/* ---- gate ---- */
.gate-card { max-width: 440px; margin: 12vh auto 0; }
.gate-card h2 { margin: 0 0 6px; font-size: 17px; }
.gate-card p { margin: 0 0 14px; font-size: 14px; }
#gateForm { display: flex; gap: 8px; }
#gateForm input { flex: 1; }

/* ---- controls ---- */
.controls {
  display: flex;
  flex-wrap: wrap;
  align-items: end;
  gap: 12px;
  margin-top: 16px;
}
.controls label { display: flex; flex-direction: column; gap: 4px; font-size: 12px; color: var(--muted); }

input, button {
  font: inherit;
  border-radius: 8px;
  border: 1px solid var(--border);
}
input {
  background: var(--bg);
  color: var(--text);
  padding: 8px 10px;
}
input:focus-visible, button:focus-visible, .col:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
input[type="date"] { color-scheme: dark; }

button {
  background: var(--accent);
  border-color: transparent;
  color: #06272e;
  font-weight: 600;
  padding: 8px 16px;
  cursor: pointer;
}
button:hover { filter: brightness(1.1); }
button.ghost {
  background: transparent;
  border-color: var(--border);
  color: var(--muted);
  font-weight: 500;
  padding: 6px 12px;
}
button.ghost:hover { color: var(--text); filter: none; }

/* ---- stat tile ---- */
.stat-label { font-size: 13px; color: var(--muted); }
.stat-value { font-size: 34px; font-weight: 700; font-variant-numeric: tabular-nums; margin: 2px 0; }
.stat-sub { font-size: 12px; }

/* ---- chart ---- */
.chart-card { position: relative; }
.plot { position: relative; height: 200px; }
.gridline {
  position: absolute;
  left: 0; right: 0;
  border-top: 1px solid var(--border);
  pointer-events: none;
}
.g100 { top: 0; }
.g50 { top: 50%; }
.glabel {
  position: absolute;
  top: -8px; left: 0;
  font-size: 10px;
  color: var(--muted);
  background: var(--panel);
  padding-right: 6px;
}
.cols {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: flex-end;
  gap: 2px;
  border-bottom: 1px solid var(--border);
}
.col {
  flex: 1;
  height: 100%;
  display: flex;
  align-items: flex-end;
  position: relative;
}
.col .bar {
  width: 100%;
  background: var(--bar);
  border-radius: 4px 4px 0 0;
}
.col:hover .bar, .col:focus-visible .bar { background: var(--bar-hover); }
.xlabels { position: relative; height: 18px; margin-top: 6px; }
.xlabels span {
  position: absolute;
  transform: translateX(-50%);
  font-size: 11px;
  color: var(--muted);
  white-space: nowrap;
}
.tooltip {
  position: absolute;
  transform: translate(-50%, -100%);
  background: #1c1e24;
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 5px 9px;
  font-size: 12px;
  white-space: nowrap;
  pointer-events: none;
  z-index: 2;
}

/* ---- table ---- */
table { width: 100%; border-collapse: collapse; font-size: 14px; }
th, td { text-align: left; padding: 7px 4px; border-bottom: 1px solid var(--border); }
th { color: var(--muted); font-weight: 600; font-size: 12px; }
tr:last-child td { border-bottom: none; }
.num { text-align: right; font-variant-numeric: tabular-nums; }
