/* ---- tokens ---------------------------------------------------------- */
:root {
  color-scheme: light;
  --page:        #f9f9f7;
  --surface:     #fcfcfb;
  --ink:         #0b0b0b;
  --ink-2:       #52514e;
  --ink-muted:   #898781;
  --grid:        #e1e0d9;
  --baseline:    #c3c2b7;
  --border:      rgba(11, 11, 11, 0.10);
  --series-q:    #2a78d6;   /* quarterly / slot 1 blue  */
  --series-m:    #eb6834;   /* monthly   / slot 2 orange */
  --series-3:    #1baf7a;   /* slot 3 aqua */
  --series-4:    #4a3aa7;   /* slot 7 violet */
  --delta-up:    #d03b3b;   /* wait got longer  (critical) */
  --delta-down:  #006300;   /* wait got shorter (success text) */
  --chip-bg:     #f0efec;
  --font-display: "Bricolage Grotesque", system-ui, sans-serif;
  --font-body:    "Public Sans", system-ui, sans-serif;
  --font-mono:    "Spline Sans Mono", ui-monospace, monospace;
}
@media (prefers-color-scheme: dark) {
  :root {
    color-scheme: dark;
    --page:        #0d0d0d;
    --surface:     #1a1a19;
    --ink:         #ffffff;
    --ink-2:       #c3c2b7;
    --ink-muted:   #898781;
    --grid:        #2c2c2a;
    --baseline:    #383835;
    --border:      rgba(255, 255, 255, 0.10);
    --series-q:    #3987e5;
    --series-m:    #d95926;
    --series-3:    #199e70;
    --series-4:    #9085e9;
    --delta-up:    #e66767;
    --delta-down:  #0ca30c;
    --chip-bg:     #262624;
  }
}

/* ---- base ------------------------------------------------------------ */
* { box-sizing: border-box; }
[hidden] { display: none !important; }
/* Honeypot field: off-screen rather than [hidden]/type=hidden, since some
   bot form-fillers skip those but still populate anything in the DOM. */
.hp-field {
  position: absolute;
  left: -9999px;
  width: 1px;
  height: 1px;
  overflow: hidden;
}
body {
  margin: 0;
  background: var(--page);
  color: var(--ink);
  font-family: var(--font-body);
  font-size: 15px;
  line-height: 1.55;
}
.wrap { max-width: 960px; margin: 0 auto; padding: 0 20px; }
h1, h2 { font-family: var(--font-display); letter-spacing: -0.01em; }
h2 { font-size: 1.15rem; font-weight: 600; margin: 0; }
a { color: var(--series-q); }
:focus-visible { outline: 2px solid var(--series-q); outline-offset: 2px; }

/* ---- topbar ---------------------------------------------------------- */
.topbar { border-bottom: 1px solid var(--border); background: var(--surface); }
.topbar-inner {
  display: flex; align-items: center; justify-content: space-between;
  padding-top: 14px; padding-bottom: 14px; gap: 12px; flex-wrap: wrap;
}
.wordmark {
  font-family: var(--font-display);
  font-weight: 700; font-size: 1.25rem; letter-spacing: -0.02em;
  color: inherit; text-decoration: none;
}
.gov-chip {
  font-size: 0.78rem; color: var(--ink-2);
  background: var(--chip-bg); border: 1px solid var(--border);
  padding: 3px 10px; border-radius: 999px; white-space: nowrap;
}

/* ---- home ------------------------------------------------------------ */
.home-hero { padding: 44px 0 8px; max-width: 720px; }
.home-hero h1 {
  font-size: clamp(2.1rem, 5vw, 3.2rem); font-weight: 700;
  letter-spacing: -0.025em; line-height: 1.05; margin: 0 0 14px;
}
.home-sub { color: var(--ink-2); font-size: 1.02rem; margin: 0 0 22px; max-width: 560px; }
.home-stats { display: flex; gap: 36px; flex-wrap: wrap; margin-bottom: 26px; }
.home-stats div { display: flex; flex-direction: column; }
.home-stats strong { font-size: 1.5rem; font-weight: 700; letter-spacing: -0.01em; }
.home-stats span {
  color: var(--ink-muted); font-size: 0.75rem;
  text-transform: uppercase; letter-spacing: 0.06em;
}
.home-search {
  display: flex; flex-direction: column; gap: 4px; max-width: 420px;
  font-size: 0.78rem; font-weight: 600; color: var(--ink-2);
  text-transform: uppercase; letter-spacing: 0.05em;
}
.home-search .combo-input { width: 100%; padding: 11px 30px 11px 12px; font-size: 1rem; }
#resume-wrap { margin: 14px 0 0; font-size: 0.88rem; }
.home-grid-title { margin: 30px 0 14px; font-size: 1.05rem; }
.form-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(224px, 1fr));
  gap: 14px; margin-bottom: 28px;
}
.form-card {
  font: inherit; text-align: left; cursor: pointer;
  text-decoration: none;
  display: flex; flex-direction: column; gap: 3px;
  background: var(--surface); color: var(--ink);
  border: 1px solid var(--border); border-radius: 12px;
  padding: 16px 16px 14px;
}
.form-card:hover { border-color: var(--series-q); }
.fc-code { font-family: var(--font-display); font-weight: 700; font-size: 1.05rem; }
.fc-name { color: var(--ink-2); font-size: 0.8rem; min-height: 2.1em; }
.fc-wait { font-size: 1.55rem; font-weight: 700; letter-spacing: -0.01em; margin-top: 4px; }
.fc-wait small { font-size: 0.75rem; font-weight: 500; color: var(--ink-2); letter-spacing: 0; }
.fc-nowait { font-size: 0.95rem; font-weight: 500; color: var(--ink-muted); }
.fc-spark { width: 100%; height: 30px; margin: 2px 0; }
.fc-spark polyline { fill: none; stroke: var(--series-q); stroke-width: 2; }
.fc-delta { font-size: 0.75rem; font-weight: 600; }
.fc-delta.up { color: var(--delta-up); }
.fc-delta.down { color: var(--delta-down); }
.fc-pending { color: var(--ink-muted); font-size: 0.75rem; font-family: var(--font-mono); }
.breadcrumb { margin: 16px 0 0; font-size: 0.85rem; }
.breadcrumb a { text-decoration: none; }
.wordmark { cursor: pointer; }

/* ---- filters --------------------------------------------------------- */
.filters {
  display: flex; gap: 16px; flex-wrap: wrap;
  margin: 24px 0 8px;
}
.filters label {
  display: flex; flex-direction: column; gap: 4px;
  font-size: 0.78rem; font-weight: 600; color: var(--ink-2);
  text-transform: uppercase; letter-spacing: 0.05em;
}
select, input, textarea {
  font: inherit; color: var(--ink);
  background: var(--surface);
  border: 1px solid var(--baseline); border-radius: 8px;
  padding: 8px 10px; max-width: 340px;
}
.filters select { min-width: 220px; }

/* type-to-filter combobox (enhances the hidden native selects) */
.combo { position: relative; }
.combo-input {
  min-width: 220px; width: 100%; cursor: pointer;
  padding-right: 28px;
  background-image: linear-gradient(45deg, transparent 50%, var(--ink-muted) 50%),
                    linear-gradient(135deg, var(--ink-muted) 50%, transparent 50%);
  background-position: calc(100% - 16px) 55%, calc(100% - 11px) 55%;
  background-size: 5px 5px; background-repeat: no-repeat;
}
.combo-input:focus { cursor: text; }
.combo-list {
  position: absolute; z-index: 30; top: calc(100% + 4px); left: 0;
  min-width: 100%; max-width: 380px; max-height: 320px; overflow-y: auto;
  margin: 0; padding: 4px; list-style: none;
  background: var(--surface); border: 1px solid var(--baseline);
  border-radius: 10px; box-shadow: 0 8px 24px rgba(0, 0, 0, 0.12);
  font-size: 0.9rem; font-weight: 400; text-transform: none; letter-spacing: 0;
  color: var(--ink);
}
.combo-item { padding: 6px 10px; border-radius: 6px; cursor: pointer; white-space: nowrap; }
.combo-item.active { background: var(--chip-bg); }
.combo-item.selected { font-weight: 600; }
.combo-item.selected::after { content: " ✓"; color: var(--series-q); }
.combo-group {
  padding: 8px 10px 2px; font-size: 0.7rem; font-weight: 600;
  text-transform: uppercase; letter-spacing: 0.05em; color: var(--ink-muted);
}
.combo-empty { padding: 6px 10px; color: var(--ink-muted); }

/* month picker popover */
.mp-panel {
  position: absolute; z-index: 30; top: calc(100% + 4px); left: 0;
  width: 248px; padding: 10px;
  background: var(--surface); border: 1px solid var(--baseline);
  border-radius: 10px; box-shadow: 0 8px 24px rgba(0, 0, 0, 0.12);
  font-weight: 400; text-transform: none; letter-spacing: 0;
}
.mp-head {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 8px; font-size: 0.95rem;
}
.mp-nav {
  font: inherit; font-size: 1.1rem; line-height: 1; cursor: pointer;
  background: none; border: 1px solid var(--baseline); border-radius: 6px;
  color: var(--ink); padding: 2px 9px;
}
.mp-nav:disabled { opacity: 0.35; cursor: default; }
.mp-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 4px; }
.mp-month {
  font: inherit; font-size: 0.85rem; cursor: pointer;
  background: none; border: none; border-radius: 6px;
  color: var(--ink); padding: 7px 0;
}
.mp-month:hover:not(:disabled) { background: var(--chip-bg); }
.mp-month:disabled { color: var(--ink-muted); opacity: 0.4; cursor: default; }
.mp-month.selected { background: var(--series-q); color: #fff; }
#filed-month { cursor: pointer; min-width: 150px; }
textarea { max-width: none; resize: vertical; }

/* ---- hero ------------------------------------------------------------ */
.hero { padding: 20px 0 28px; }
.hero-eyebrow {
  font-family: var(--font-display); font-weight: 600;
  font-size: 1.3rem; margin: 0 0 6px;
}
.hero-row { display: flex; align-items: flex-end; gap: 28px; flex-wrap: wrap; }
.hero-figure {
  font-size: 4.2rem; font-weight: 700; line-height: 1;
  letter-spacing: -0.03em;
}
.hero-unit { font-size: 1.4rem; font-weight: 500; color: var(--ink-2); margin-left: 8px; }
.hero-label {
  margin: 4px 0 0; color: var(--ink-muted);
  font-size: 0.8rem; text-transform: uppercase; letter-spacing: 0.08em;
}
.hero-side { padding-bottom: 6px; }
.delta { margin: 0 0 4px; font-weight: 600; font-size: 0.95rem; }
.delta.up   { color: var(--delta-up); }
.delta.down { color: var(--delta-down); }
.asof { margin: 0; color: var(--ink-muted); font-size: 0.82rem; font-family: var(--font-mono); }
.hero-note { color: var(--ink-2); font-size: 0.85rem; margin: 10px 0 0; }
.form-about { color: var(--ink-2); font-size: 0.88rem; max-width: 680px; margin: 0 0 20px; }

/* the wait ruler: month ticks with now + year-ago markers */
.ruler { position: relative; height: 44px; margin-top: 18px; max-width: 640px; }
.ruler .track {
  position: absolute; top: 24px; left: 0; right: 0;
  border-top: 1px solid var(--baseline);
}
.ruler .tick {
  position: absolute; top: 24px; width: 1px; height: 6px;
  background: var(--baseline);
}
.ruler .tick.major { height: 10px; }
.ruler .tick-label {
  position: absolute; top: 34px; transform: translateX(-50%);
  font-family: var(--font-mono); font-size: 0.68rem; color: var(--ink-muted);
}
.ruler .marker {
  position: absolute; top: 12px; transform: translateX(-50%);
  width: 3px; height: 18px; border-radius: 2px; background: var(--series-q);
}
.ruler .marker.ghost {
  background: transparent; border-left: 2px dashed var(--ink-muted); width: 0;
}
.ruler .marker-label {
  position: absolute; top: -4px; transform: translateX(-50%);
  font-size: 0.68rem; font-family: var(--font-mono);
  color: var(--ink-2); white-space: nowrap;
}

/* ---- cards ----------------------------------------------------------- */
.card {
  background: var(--surface);
  border: 1px solid var(--border); border-radius: 12px;
  padding: 20px 22px; margin-bottom: 20px;
}
.card-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; }
.card-sub { margin: 2px 0 14px; color: var(--ink-muted); font-size: 0.82rem; }
.plot { position: relative; height: 280px; }
.plot-short { height: 230px; }
.burn-title { font-family: var(--font-display); font-size: 1rem; font-weight: 600; margin: 14px 0 0; }
.table-toggle {
  font: inherit; font-size: 0.78rem; color: var(--series-q);
  background: none; border: none; cursor: pointer; padding: 2px 4px;
}
.table-view { overflow-x: auto; margin-top: 12px; }
.table-view table {
  border-collapse: collapse; width: 100%; font-size: 0.82rem;
}
.table-view th, .table-view td {
  text-align: right; padding: 5px 10px;
  border-bottom: 1px solid var(--grid);
  font-variant-numeric: tabular-nums;
}
.table-view th:first-child, .table-view td:first-child {
  text-align: left; font-family: var(--font-mono);
}
.table-view th { color: var(--ink-2); font-weight: 600; }

/* ---- estimate card --------------------------------------------------- */
.estimate-controls {
  display: flex; align-items: flex-end; gap: 12px; flex-wrap: wrap;
  margin-bottom: 14px;
}
.estimate-controls label {
  display: flex; flex-direction: column; gap: 4px;
  font-size: 0.78rem; font-weight: 600; color: var(--ink-2);
  text-transform: uppercase; letter-spacing: 0.05em;
}
.estimate-controls .btn-secondary { margin-top: 0; }
.estimate-headline {
  font-family: var(--font-display); font-weight: 600;
  font-size: 1.25rem; margin: 6px 0 12px;
}
.estimate-scenarios {
  list-style: none; margin: 0 0 12px; padding: 0; max-width: 560px;
}
.estimate-scenarios li {
  display: flex; justify-content: space-between; gap: 16px;
  padding: 7px 0; border-bottom: 1px solid var(--grid);
  font-size: 0.9rem; color: var(--ink-2);
}
.estimate-scenarios strong { color: var(--ink); font-variant-numeric: tabular-nums; }
#estimate-card .fine { margin-bottom: 6px; max-width: 640px; }

/* ---- action cards ---------------------------------------------------- */
.two-up { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
@media (max-width: 720px) { .two-up { grid-template-columns: 1fr; } }
.action-card p { color: var(--ink-2); font-size: 0.9rem; }
.action-card form { display: flex; flex-direction: column; gap: 10px; }
.action-card label {
  display: flex; flex-direction: column; gap: 4px;
  font-size: 0.8rem; font-weight: 600; color: var(--ink-2);
}
.action-card input, .action-card select, .action-card textarea { max-width: none; }
.field-row { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.btn-primary, .btn-secondary {
  font: inherit; font-weight: 600; cursor: pointer;
  border-radius: 8px; padding: 10px 16px; margin-top: 4px;
}
.btn-primary {
  background: var(--series-q); color: #fff; border: 1px solid var(--series-q);
}
.btn-primary:hover { filter: brightness(1.08); }
.btn-secondary {
  background: none; color: var(--ink); border: 1px solid var(--baseline);
}
.btn-secondary:hover { border-color: var(--ink-2); }
.fine { font-size: 0.75rem; color: var(--ink-muted); margin: 0; }
.form-msg { font-size: 0.85rem; margin: 0; min-height: 1.2em; }
.form-msg.ok { color: var(--delta-down); }
.form-msg.err { color: var(--delta-up); }

/* ---- alert management ------------------------------------------------ */
.linklike {
  background: none; border: none; padding: 0; cursor: pointer;
  font: inherit; font-size: inherit; color: var(--series-q);
}
.alert-list { list-style: none; margin: 8px 0 14px; padding: 0; }
.alert-list li {
  display: flex; justify-content: space-between; align-items: center;
  gap: 12px; padding: 8px 0; border-bottom: 1px solid var(--grid);
  font-size: 0.9rem;
}
.alert-empty { color: var(--ink-muted); }
.alert-del {
  background: none; border: none; cursor: pointer;
  color: var(--ink-muted); font-size: 0.95rem;
  padding: 2px 8px; border-radius: 6px;
}
.alert-del:hover { color: var(--delta-up); background: var(--chip-bg); }

/* ---- updates page ---------------------------------------------------- */
.update-entry h2 { font-size: 1.02rem; }
.update-items {
  list-style: none; margin: 8px 0 0; padding: 0;
  font-size: 0.88rem; color: var(--ink-2);
}
.update-items li { padding: 5px 0; border-bottom: 1px solid var(--grid); }
.update-items li:last-child { border-bottom: none; }
.topbar-nav { font-size: 0.85rem; margin-left: auto; margin-right: 14px; }
.topbar-nav a { color: var(--ink-2); text-decoration: none; }
.topbar-nav a:hover { color: var(--ink); }

/* ---- footer ---------------------------------------------------------- */
footer {
  border-top: 1px solid var(--border);
  margin-top: 36px; padding: 24px 0 40px;
  color: var(--ink-2); font-size: 0.85rem;
}
footer .fine { margin-top: 10px; }

/* hold the previous render dimmed while refetching — no skeleton flash */
body.fetching .chart-card, body.fetching .hero { opacity: 0.55; }
#data-err { margin: 8px 0 0; }

@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; animation: none !important; }
}
