/* t0 forecast - visual language after Bureau Oberhaeuser's "City
 * Statistics" (Dribbble 2243345): warm greige paper, near-black ink,
 * layered translucent-black data shapes, pill-shaped controls, generous
 * whitespace, and a single mint accent reserved for the thing that
 * matters (here: the forecast). One committed light theme, no cards, no
 * gradients, no shadows beyond the reference's soft pill lift.
 *
 * Chart identity is monochrome-plus-accent by design: the bands are
 * translucent ink washes, history/actuals/library ride luminance steps
 * and line style (solid/dashed), the mint median is the highlight. With
 * hue mostly absent, identity survives every kind of color blindness;
 * the legend, tooltip and table carry names per the dataviz rules.
 */

:root {
  color-scheme: light;
  --page: #e9e8e2;
  --panel: #f1f0ea;
  --ink: #191914;
  --ink-2: #4c4b43;
  --ink-muted: #8b897d;
  --hairline: #d4d2c7;
  --baseline: #b9b7aa;
  --grid: #dbd9cf;

  --accent: #14ae83;        /* mint: links, active states, forecast median */
  --accent-ink: #0c8261;    /* darker mint for text-sized uses */

  --series-forecast: #14ae83;
  --series-reference: #8b897d;
  --series-actuals: #6b695f;
  --ink-history: #23221c;
  --band-outer: rgba(25, 25, 20, 0.09);
  --band-inner: rgba(25, 25, 20, 0.17);

  --sans: "Avenir Next", Avenir, Futura, "Century Gothic", "Segoe UI", system-ui, sans-serif;
}

* { box-sizing: border-box; }

/* The UA's [hidden] rule loses to any display: set below; reassert it so
 * fields toggled with the hidden attribute really disappear. */
[hidden] { display: none !important; }

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

.page {
  max-width: 1080px;
  margin: 0 auto;
  padding: 0 24px 48px;
}

a { color: var(--accent-ink); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ---------------- navbar: full-width band ---------------- */

.sitebar {
  background: var(--panel);
  border-bottom: 1px solid var(--hairline);
}

.sitebar-inner {
  max-width: 1080px;
  margin: 0 auto;
  padding: 14px 24px;
  display: flex;
  align-items: center;
  gap: 20px;
}

.brand { display: inline-flex; align-items: center; gap: 11px; }
.logo { display: block; }
.brand-name { font-size: 20px; font-weight: 700; letter-spacing: -0.01em; }
.brand-sub {
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.16em;
  color: var(--ink-muted);
  margin-top: 3px;
}

.nav-links { margin-left: auto; display: flex; gap: 22px; align-items: center; font-size: 14px; }
.nav-links a { color: var(--ink-2); }
.nav-links a:hover { color: var(--ink); text-decoration: none; }

.nav-cta {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  border: 1px solid var(--hairline);
  border-radius: 999px;
  background: var(--panel);
  box-shadow: 0 1px 2px rgba(25, 25, 20, 0.06);
  padding: 6px 18px;
  font-weight: 600;
}
.nav-cta:hover { border-color: var(--accent); }
.nav-cta svg { color: var(--accent-ink); }

.lede { margin: 22px 0 24px; color: var(--ink-muted); font-size: 13.5px; font-weight: 300; }

/* ---------------- control panel ---------------- */

.panel {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(225px, 340px));
  gap: 26px;
  margin-bottom: 18px;
}

.field { display: flex; flex-direction: column; gap: 9px; min-width: 0; align-content: start; }

.field-label {
  font-size: 11.5px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  color: var(--ink-muted);
}

/* selects styled as the reference's pills */
select {
  font: inherit;
  font-size: 14px;
  color: var(--ink);
  background: var(--panel);
  border: 1px solid var(--hairline);
  border-radius: 999px;
  box-shadow: 0 1px 2px rgba(25, 25, 20, 0.06);
  padding: 7px 14px;
  max-width: 100%;
}

/* radio / checkbox rows as quiet pills; the chosen one carries the accent */
.check {
  display: flex;
  align-items: center;
  gap: 8px;
  border: 1px solid var(--hairline);
  border-radius: 999px;
  background: var(--panel);
  box-shadow: 0 1px 2px rgba(25, 25, 20, 0.06);
  padding: 6px 14px;
  font-size: 14px;
  cursor: pointer;
}
.check:hover { border-color: var(--ink-muted); }
.check:has(input:checked) { border-color: var(--accent); }
.check input { accent-color: var(--accent); margin: 0; }

.dim { color: var(--ink-muted); font-size: 12.5px; font-weight: 300; }

/* upload zones: pill panels with the accent doing the inviting */
#dropzone, #testzone {
  border: 1px dashed var(--baseline);
  border-radius: 18px;
  padding: 10px 16px;
  cursor: pointer;
  display: block;
  background: var(--panel);
}
#dropzone:hover, #testzone:hover, .dz-over { border-color: var(--accent); }
#dropzone input, #testzone input { display: none; }
.dz-strong { font-size: 14px; font-weight: 600; color: var(--accent-ink); display: block; }
.dz-hint { color: var(--ink-muted); font-size: 12.5px; font-weight: 300; display: block; }

/* ---------------- status ---------------- */

.status-row {
  display: flex;
  align-items: center;
  gap: 14px;
  min-height: 26px;
  margin-bottom: 18px;
  font-size: 13.5px;
  color: var(--ink-2);
}
#status.error { color: #c2452e; }

progress {
  appearance: none;
  width: 220px;
  height: 3px;
  border: 0;
  background: var(--hairline);
}
progress::-webkit-progress-bar { background: var(--hairline); }
progress::-webkit-progress-value { background: var(--accent); }
progress::-moz-progress-bar { background: var(--accent); }

/* ---------------- chart ---------------- */

.chart-card { margin-bottom: 26px; }

.chart-head h1 { font-size: 22px; margin: 0; font-weight: 700; letter-spacing: -0.01em; }
.chart-head p { margin: 3px 0 14px; font-size: 13.5px; font-weight: 300; }

.chart-root { position: relative; }
.chart-root canvas { display: block; width: 100%; outline-offset: 3px; }
.chart-root canvas:focus-visible { outline: 2px solid var(--accent); }

.chart-tooltip {
  position: absolute;
  background: #fbfaf6;
  border: 1px solid var(--hairline);
  border-radius: 10px;
  box-shadow: 0 1px 3px rgba(25, 25, 20, 0.08);
  padding: 9px 12px;
  pointer-events: none;
  font-size: 13px;
  min-width: 160px;
  z-index: 2;
}
.tt-title { color: var(--ink-muted); font-size: 11.5px; letter-spacing: 0.06em; margin-bottom: 5px; }
.tt-row { display: flex; align-items: center; gap: 8px; margin-top: 3px; }
.tt-key { width: 14px; height: 2px; flex: none; }
.tt-value { font-weight: 600; font-variant-numeric: tabular-nums; }
.tt-name { color: var(--ink-2); font-size: 12.5px; font-weight: 300; }

.legend {
  display: flex;
  gap: 20px;
  flex-wrap: wrap;
  padding: 12px 2px 0;
  font-size: 13px;
  font-weight: 300;
  color: var(--ink-2);
}
.legend .key { display: inline-block; width: 18px; height: 2px; vertical-align: middle; margin-right: 6px; }
.key-history { background: var(--ink-history); }
.key-actuals { background: var(--series-actuals); }
.key-forecast { background: var(--series-forecast); }
.key-library {
  background: repeating-linear-gradient(90deg, var(--series-reference) 0 5px, transparent 5px 9px);
}
.key-band {
  display: inline-block;
  width: 14px;
  height: 10px;
  background: var(--band-inner);
  vertical-align: middle;
  margin: 0 4px 0 8px;
}

/* ---------------- metrics: captions, not cards ---------------- */

.tiles {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(165px, 1fr));
  gap: 20px 26px;
  margin-bottom: 26px;
  padding-top: 16px;
  border-top: 1px solid var(--hairline);
}

.tile .t-label {
  font-size: 11.5px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--ink-muted);
}
.tile .t-value { font-size: 26px; font-weight: 300; margin-top: 3px; letter-spacing: -0.01em; }
.tile .t-sub { font-size: 12.5px; font-weight: 300; color: var(--ink-2); margin-top: 1px; }

/* ---------------- table view ---------------- */

.table-view { border-top: 1px solid var(--hairline); margin-bottom: 22px; }
.table-view summary {
  cursor: pointer;
  padding: 12px 2px;
  font-size: 13px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--ink-muted);
}
.table-view summary:hover { color: var(--ink-2); }

.table-actions { padding: 2px 0 12px; }
.table-actions button {
  font: inherit;
  font-size: 13.5px;
  font-weight: 600;
  color: var(--accent-ink);
  background: var(--panel);
  border: 1px solid var(--hairline);
  border-radius: 999px;
  box-shadow: 0 1px 2px rgba(25, 25, 20, 0.06);
  padding: 6px 16px;
  cursor: pointer;
}
.table-actions button:hover { border-color: var(--accent); }

.table-wrap { overflow-x: auto; padding-bottom: 14px; }
.table-wrap table { border-collapse: collapse; width: 100%; font-size: 13px; }
.table-wrap th, .table-wrap td {
  text-align: right;
  padding: 5px 12px;
  border-bottom: 1px solid var(--grid);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}
.table-wrap th {
  color: var(--ink-muted);
  font-weight: 600;
  font-size: 11.5px;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  border-bottom: 1px solid var(--baseline);
}
.table-wrap th:first-child, .table-wrap td:first-child { text-align: left; }

/* ---------------- footer ---------------- */

footer {
  border-top: 1px solid var(--hairline);
  padding-top: 16px;
  font-size: 13px;
  font-weight: 300;
  color: var(--ink-2);
}

.foot-grid { display: flex; gap: 24px; flex-wrap: wrap; align-items: baseline; }

.foot-credit { display: flex; flex-direction: column; gap: 2px; max-width: 560px; }
.foot-title { font-weight: 700; font-size: 14px; color: var(--ink); }

.foot-links { margin-left: auto; display: flex; gap: 10px; flex-wrap: wrap; }
.foot-links a {
  border: 1px solid var(--hairline);
  border-radius: 999px;
  background: var(--panel);
  box-shadow: 0 1px 2px rgba(25, 25, 20, 0.06);
  padding: 4px 14px;
  font-size: 12.5px;
  color: var(--ink-2);
}
.foot-links a:hover { text-decoration: none; border-color: var(--accent); color: var(--ink); }

footer p.dim { margin: 12px 0 0; max-width: 760px; }

@media (max-width: 640px) {
  .page { padding: 22px 16px 40px; }
  .panel { gap: 18px; }
  .topbar { flex-wrap: wrap; gap: 10px; }
  .nav-links { margin-left: 0; }
}
