/* What-if planner — a self-contained, modern two-pane planner UI.
   Layered on styles.css but visually independent (its own shell, not the reports chrome). */

.wi-body {
    --wi-accent: #0077b6;
    --wi-accent-2: #00b4d8;
    --wi-accent-dark: #005a8c;
    --wi-ink: #0f172a;
    --wi-body: #475569;
    --wi-muted: #94a3b8;
    --wi-line: #e2e8f0;
    --wi-line-soft: #f1f5f9;
    --wi-surface: #ffffff;
    --wi-bg: #f1f5f9;
    --wi-ok: #16a34a;
    --wi-warn: #d97706;
    --wi-bad: #dc2626;
    --wi-radius: 12px;
    --wi-shadow: 0 1px 2px rgba(15, 23, 42, .04), 0 4px 16px rgba(15, 23, 42, .06);
    margin: 0;
    background: var(--wi-bg);
    color: var(--wi-ink);
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

.wi-app { max-width: 1400px; margin: 0 auto; padding: 1.25rem 1.5rem 2rem; }

/* ── header ───────────────────────────────────────────────────────── */
.wi-header {
    display: flex; align-items: center; justify-content: space-between; gap: 1rem;
    padding-bottom: 1rem; margin-bottom: 1.25rem; border-bottom: 1px solid var(--wi-line);
    flex-wrap: wrap;
}
.wi-brand { display: flex; align-items: center; gap: 1rem; }
.wi-brand h1 { margin: 0; font-size: 1.4rem; letter-spacing: -0.01em; }
.wi-tagline { margin: 0.1rem 0 0; color: var(--wi-body); font-size: 0.86rem; }
.wi-back {
    color: var(--wi-accent); text-decoration: none; font-weight: 600; font-size: 0.9rem;
    white-space: nowrap; padding: 0.35rem 0.6rem; border-radius: 8px; background: #eff6ff;
}
.wi-back:hover { background: #dbeafe; }
.wi-head-right { display: flex; align-items: center; gap: 1rem; }

/* ── shell: sticky controls + fluid forecast ──────────────────────── */
.wi-shell { display: grid; grid-template-columns: 340px 1fr; gap: 1.5rem; align-items: start; }
.wi-controls {
    position: sticky; top: 1rem; align-self: start;
    background: var(--wi-surface); border: 1px solid var(--wi-line);
    border-radius: var(--wi-radius); box-shadow: var(--wi-shadow);
    max-height: calc(100vh - 2rem); overflow: hidden auto;
}
.wi-edition { padding: 1rem 1rem 0.85rem; border-bottom: 1px solid var(--wi-line-soft); }
.wi-edition label { display: block; font-size: 0.72rem; text-transform: uppercase; letter-spacing: 0.05em; color: var(--wi-muted); margin-bottom: 0.35rem; font-weight: 700; }
.wi-edition select { width: 100%; }

.wi-forecast { min-width: 0; }

/* form controls, shared look */
.wi-controls select, .wi-controls input[type="number"] {
    padding: 0.45rem 0.6rem; border: 1px solid var(--wi-line); border-radius: 8px;
    background: #fff; font-size: 0.9rem; color: var(--wi-ink);
}
.wi-controls select:focus, .wi-controls input:focus {
    outline: none; border-color: var(--wi-accent); box-shadow: 0 0 0 3px rgba(0, 119, 182, .12);
}

/* ── empty states ─────────────────────────────────────────────────── */
.wi-empty { padding: 1.5rem 1rem; color: var(--wi-muted); font-size: 0.9rem; text-align: center; }
.wi-forecast-empty {
    background: var(--wi-surface); border: 1px dashed var(--wi-line); border-radius: var(--wi-radius);
    padding: 4rem 1rem;
}
.wi-empty-ic { font-size: 2.5rem; color: var(--wi-line); margin-bottom: 0.5rem; }
.wi-forecast-empty p { margin: 0.2rem 0; }

/* ── controls form ────────────────────────────────────────────────── */
.wi-form { padding: 0.9rem 1rem 1.1rem; }
.wi-form-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 0.75rem; }
.wi-calib { font-size: 0.75rem; color: var(--wi-muted); font-weight: 600; }

.wi-opts { display: flex; flex-direction: column; gap: 0.85rem; }
.wi-opt-lbl { display: block; font-size: 0.72rem; text-transform: uppercase; letter-spacing: 0.04em; color: var(--wi-muted); font-weight: 700; margin-bottom: 0.35rem; }
.wi-opt-row { display: flex; gap: 0.6rem; }
.wi-hint { margin: 0.45rem 0 0; font-size: 0.72rem; line-height: 1.35; color: var(--wi-body); background: #eff6ff; border-left: 3px solid var(--wi-accent); border-radius: 0 6px 6px 0; padding: 0.4rem 0.55rem; }
.wi-field { display: flex; flex-direction: column; gap: 0.28rem; font-size: 0.78rem; color: var(--wi-body); flex: 1; }
.wi-field select, .wi-field input { width: 100%; }

/* segmented control */
.wi-seg { display: inline-flex; background: var(--wi-bg); border: 1px solid var(--wi-line); border-radius: 9px; padding: 3px; width: 100%; }
.wi-seg label { flex: 1; text-align: center; cursor: pointer; }
.wi-seg label input { position: absolute; opacity: 0; pointer-events: none; }
.wi-seg label span {
    display: block; padding: 0.4rem 0.5rem; border-radius: 7px; font-size: 0.82rem;
    font-weight: 600; color: var(--wi-body); transition: background .12s, color .12s;
}
.wi-seg label:has(input:checked) span { background: #fff; color: var(--wi-accent-dark); box-shadow: var(--wi-shadow); }

/* toggle switch */
.wi-switch { display: inline-flex; align-items: center; gap: 0.55rem; cursor: pointer; font-size: 0.85rem; color: var(--wi-body); }
.wi-switch input { position: absolute; opacity: 0; width: 0; height: 0; }
.wi-slider { position: relative; flex: none; width: 38px; height: 22px; background: #cbd5e1; border-radius: 999px; transition: background .15s; }
.wi-slider::after { content: ""; position: absolute; top: 2px; left: 2px; width: 18px; height: 18px; background: #fff; border-radius: 50%; box-shadow: 0 1px 2px rgba(0,0,0,.25); transition: transform .15s; }
.wi-switch input:checked + .wi-slider, .wi-detail-switch input:checked + .wi-slider { background: var(--wi-accent); }
.wi-switch input:checked + .wi-slider::after, .wi-detail-switch input:checked + .wi-slider::after { transform: translateX(16px); }

.wi-detail-switch { display: inline-flex; align-items: center; gap: 0.45rem; cursor: pointer; font-size: 0.82rem; color: var(--wi-body); font-weight: 600; }
.wi-detail-switch input { position: absolute; opacity: 0; width: 0; height: 0; }

/* advanced options disclosure */
.wi-more { margin: 0.9rem 0; border-top: 1px solid var(--wi-line-soft); padding-top: 0.75rem; }
.wi-more > summary { cursor: pointer; font-size: 0.8rem; font-weight: 700; color: var(--wi-body); list-style: none; }
.wi-more > summary::before { content: "▸ "; color: var(--wi-muted); }
.wi-more[open] > summary::before { content: "▾ "; }
.wi-more > summary::-webkit-details-marker { display: none; }
.wi-more > .wi-switch { margin: 0.7rem 0; }

/* cut list */
.wi-cutlist-head { display: flex; align-items: baseline; justify-content: space-between; margin: 0.9rem 0 0.4rem; padding-top: 0.85rem; border-top: 1px solid var(--wi-line-soft); }
.wi-cutlist-head > span:first-child { font-size: 0.72rem; text-transform: uppercase; letter-spacing: 0.04em; color: var(--wi-muted); font-weight: 700; }
.wi-cut-hint { font-size: 0.7rem; color: var(--wi-muted); }
.wi-cutlist { display: flex; flex-direction: column; }
.wi-cut-sex { font-size: 0.72rem; font-weight: 700; color: var(--wi-accent-dark); text-transform: uppercase; letter-spacing: 0.04em; margin: 0.6rem 0 0.3rem; }
.wi-cut { display: flex; align-items: center; justify-content: space-between; gap: 0.5rem; padding: 0.3rem 0; border-bottom: 1px solid var(--wi-line-soft); }
.wi-cut-id { display: flex; flex-direction: column; min-width: 0; }
.wi-cut-ev { font-size: 0.84rem; font-weight: 600; color: var(--wi-ink); }
.wi-cut-band { font-size: 0.7rem; font-weight: 700; color: #0369a1; background: #e0f2fe; padding: 0 0.3rem; border-radius: 4px; }
.wi-cut-base { font-size: 0.72rem; color: var(--wi-muted); font-variant-numeric: tabular-nums; }
.wi-step { display: inline-flex; align-items: center; flex: none; }
.wi-step-btn {
    width: 26px; height: 28px; border: 1px solid var(--wi-line); background: #fff; color: var(--wi-accent-dark);
    font-size: 1rem; font-weight: 700; cursor: pointer; line-height: 1;
}
.wi-step-btn:first-child { border-radius: 7px 0 0 7px; }
.wi-step-btn:last-child { border-radius: 0 7px 7px 0; }
.wi-step-btn:hover { background: #eff6ff; }
.wi-step-btn:active { background: #dbeafe; }
.wi-delta {
    width: 3.6rem; text-align: center; border: 1px solid var(--wi-line); border-left: 0; border-right: 0;
    border-radius: 0; padding: 0.3rem 0.2rem; font-size: 0.82rem; font-variant-numeric: tabular-nums;
    -moz-appearance: textfield; appearance: textfield;
}
.wi-delta::-webkit-outer-spin-button, .wi-delta::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }

.wi-reset {
    margin-top: 1rem; width: 100%; padding: 0.5rem; border: 1px solid var(--wi-line); border-radius: 8px;
    background: #fff; color: var(--wi-body); font-weight: 600; font-size: 0.82rem; cursor: pointer;
}
.wi-reset:hover { background: var(--wi-bg); }

/* busy indicator */
.htmx-indicator { width: 14px; height: 14px; border-radius: 50%; border: 2px solid var(--wi-line); border-top-color: var(--wi-accent); opacity: 0; }
.htmx-request .htmx-indicator, .htmx-indicator.htmx-request { opacity: 1; animation: wi-spin .6s linear infinite; }
@keyframes wi-spin { to { transform: rotate(360deg); } }

/* ── forecast dashboard ───────────────────────────────────────────── */
.wi-dash { display: flex; flex-direction: column; gap: 1rem; }
.num { text-align: right; font-variant-numeric: tabular-nums; }
.muted { color: var(--wi-muted); }
.neg { color: var(--wi-bad); }
.pos { color: var(--wi-ok); }
.wi-sub { color: var(--wi-muted); font-size: 0.8rem; margin: 0; }

/* hero */
.wi-hero {
    display: flex; align-items: center; gap: 1.5rem; flex-wrap: wrap;
    background: linear-gradient(135deg, var(--wi-accent-dark), var(--wi-accent)); color: #fff;
    border-radius: var(--wi-radius); padding: 1.1rem 1.4rem; box-shadow: var(--wi-shadow);
}
.wi-hero-total { display: flex; flex-direction: column; }
.wi-hero-lbl { font-size: 0.72rem; text-transform: uppercase; letter-spacing: 0.06em; opacity: 0.85; font-weight: 700; }
.wi-hero-figure { display: flex; align-items: baseline; gap: 0.6rem; }
.wi-hero-num { font-size: 2.6rem; font-weight: 800; line-height: 1; letter-spacing: -0.02em; font-variant-numeric: tabular-nums; }
.wi-hero-base { font-size: 0.78rem; opacity: 0.8; }
/* total starts-by-year histogram in the hero (light bars on the gradient) */
.wi-hero-chart { display: flex; align-items: flex-end; gap: 0.6rem; }
.wi-hc-col { display: flex; flex-direction: column; align-items: center; gap: 0.15rem; }
.wi-hc-track { height: 42px; display: flex; align-items: flex-end; }
.wi-hc-bar { width: 30px; min-height: 3px; background: rgba(255, 255, 255, 0.45); border-radius: 4px 4px 0 0; }
.wi-hc-bar.fc { background: #fff; }
.wi-hc-v { font-size: 0.66rem; font-weight: 700; font-variant-numeric: tabular-nums; opacity: 0.95; }
.wi-hc-y { font-size: 0.62rem; opacity: 0.85; }
.wi-hero-sexes { display: flex; gap: 1.25rem; margin-left: auto; }
.wi-hero-sex { display: flex; flex-direction: column; gap: 0.15rem; }
.wi-sex-name { font-size: 0.7rem; text-transform: uppercase; letter-spacing: 0.03em; opacity: 0.85; }
.wi-sex-num { font-size: 1.3rem; font-weight: 700; font-variant-numeric: tabular-nums; }

/* delta chips */
.wi-chip { font-size: 0.78rem; font-weight: 700; padding: 0.1rem 0.45rem; border-radius: 999px; background: rgba(255,255,255,.22); font-variant-numeric: tabular-nums; }
.wi-chip.sm { font-size: 0.68rem; padding: 0.05rem 0.35rem; }
.wi-hero .wi-chip.pos { background: rgba(255,255,255,.25); }
.wi-dash .wi-evtable .wi-chip.pos { background: #dcfce7; color: #166534; }
.wi-dash .wi-evtable .wi-chip.neg { background: #fee2e2; color: #991b1b; }
.wi-dash .wi-evtable .wi-chip.flat { background: var(--wi-line-soft); color: var(--wi-muted); }
.wi-hero-sex .wi-chip.pos { background: rgba(220,252,231,.9); color: #14532d; }
.wi-hero-sex .wi-chip.neg { background: rgba(254,226,226,.95); color: #7f1d1d; }

/* cuts-applied strip */
.wi-cuts-applied { display: flex; align-items: center; gap: 0.5rem; flex-wrap: wrap; }
.wi-tag { font-size: 0.68rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.03em; padding: 0.12rem 0.5rem; border-radius: 999px; background: var(--wi-accent); color: #fff; }
.wi-tag.sm { background: #fef3c7; color: #92400e; text-transform: none; }
.wi-cut-pill { font-size: 0.78rem; background: #fff; border: 1px solid var(--wi-line); border-radius: 999px; padding: 0.15rem 0.6rem; font-variant-numeric: tabular-nums; }
.wi-cut-pill em { color: var(--wi-accent); font-style: normal; font-weight: 600; }

/* cards */
.wi-card { background: var(--wi-surface); border: 1px solid var(--wi-line); border-radius: var(--wi-radius); box-shadow: var(--wi-shadow); padding: 1rem 1.15rem; }
.wi-card-head { display: flex; align-items: baseline; gap: 0.6rem; margin-bottom: 0.8rem; flex-wrap: wrap; }
.wi-card-head h3 { margin: 0; font-size: 1rem; }

/* funnel flow */
.wi-flow { display: flex; flex-direction: column; gap: 0.5rem; }
.wi-flow-row { display: grid; grid-template-columns: 200px 1fr auto; align-items: center; gap: 0.75rem; }
.wi-flow-lbl { font-size: 0.85rem; color: var(--wi-body); font-weight: 600; }
.wi-flow-row.step .wi-flow-lbl { padding-left: 0.9rem; font-weight: 500; color: var(--wi-body); position: relative; }
.wi-flow-row.step .wi-flow-lbl::before { content: "↳"; position: absolute; left: 0; color: var(--wi-muted); }
.wi-flow-track { height: 12px; background: var(--wi-line-soft); border-radius: 999px; overflow: hidden; }
.wi-flow-fill { height: 100%; border-radius: 999px; background: linear-gradient(90deg, var(--wi-accent-2), var(--wi-accent)); }
.wi-flow-fill.accent { background: linear-gradient(90deg, var(--wi-accent), var(--wi-accent-dark)); }
.wi-flow-val { font-size: 0.92rem; font-weight: 700; font-variant-numeric: tabular-nums; white-space: nowrap; }
.wi-flow-val small { font-weight: 500; color: var(--wi-muted); font-size: 0.74rem; }
.wi-flow-row.growth { grid-template-columns: 200px 1fr; }
.wi-flow-row.growth .wi-flow-lbl { padding-left: 0.9rem; }
.wi-growth { font-size: 0.85rem; color: var(--wi-accent-dark); }
.wi-growth small { color: var(--wi-muted); font-weight: 500; }
.wi-flow-row.starts { margin-top: 0.2rem; padding-top: 0.5rem; border-top: 1px dashed var(--wi-line); }
.wi-flow-row.starts .wi-flow-lbl { font-weight: 700; color: var(--wi-ink); }
.wi-flow-row.starts .wi-flow-val strong { font-size: 1.05rem; color: var(--wi-accent-dark); }

/* note callout */
.wi-note { background: #eff6ff; border: 1px solid #bfdbfe; border-left: 3px solid var(--wi-accent); padding: 0.6rem 0.9rem; font-size: 0.84rem; border-radius: 8px; color: #1e3a5f; }

/* schedule stats */
.wi-sched-cards { display: flex; flex-wrap: wrap; gap: 0.75rem; }
.wi-stat { display: flex; flex-direction: column; gap: 0.15rem; background: var(--wi-bg); border: 1px solid var(--wi-line); border-radius: 10px; padding: 0.55rem 0.9rem; min-width: 130px; }
.wi-stat-lbl { font-size: 0.7rem; text-transform: uppercase; letter-spacing: 0.03em; color: var(--wi-muted); font-weight: 700; }
.wi-stat-val { font-size: 1.15rem; font-weight: 700; font-variant-numeric: tabular-nums; }

/* status flags */
.wi-flag { display: inline-block; font-size: 0.68rem; font-weight: 700; padding: 0.08rem 0.45rem; border-radius: 999px; white-space: nowrap; }
.wi-flag.wi-safe, .wi-flag.wi-healthy, .wi-flag.wi-ok { background: #dcfce7; color: #166534; }
.wi-flag.wi-at-risk, .wi-flag.wi-tight { background: #fef9c3; color: #854d0e; }
.wi-flag.wi-under, .wi-flag.wi-over { background: #fee2e2; color: #991b1b; }
.wi-pct { font-size: 0.78rem; color: var(--wi-muted); font-variant-numeric: tabular-nums; }

/* cohort watch */
.wi-cohort-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 1.25rem; }
.wi-cohort-lbl { font-size: 0.8rem; font-weight: 700; color: var(--wi-body); margin-bottom: 0.45rem; display: flex; align-items: center; gap: 0.5rem; flex-wrap: wrap; }
.wi-cohort-lbl .wi-sub { font-weight: 400; }
.wi-spark { display: flex; align-items: flex-end; gap: 0.5rem; height: 84px; padding-top: 0.3rem; }
.wi-spark-col { display: flex; flex-direction: column; align-items: center; justify-content: flex-end; flex: 1; height: 100%; gap: 0.15rem; }
.wi-spark-bar { width: 100%; max-width: 34px; background: linear-gradient(180deg, var(--wi-accent-2), var(--wi-accent)); border-radius: 4px 4px 0 0; min-height: 3px; }
.wi-spark-v { font-size: 0.68rem; font-weight: 700; color: var(--wi-body); font-variant-numeric: tabular-nums; }
.wi-spark-x { font-size: 0.66rem; color: var(--wi-muted); }
.wi-spark-next .wi-spark-bar { background: repeating-linear-gradient(45deg, var(--wi-accent-2), var(--wi-accent-2) 4px, #bae6fd 4px, #bae6fd 8px); }
.wi-spark-next .wi-spark-x { color: var(--wi-accent-dark); font-weight: 700; }
/* the edition-year estimate bar (the year being forecast) gets a ring */
.wi-spark-target .wi-spark-bar { outline: 2px solid var(--wi-accent-dark); outline-offset: 1px; }
.wi-spark-target .wi-spark-v { color: var(--wi-accent-dark); }
/* actual / estimate legend */
.wi-cohort-legend { display: flex; align-items: center; gap: 0.75rem; margin-top: 0.5rem; font-size: 0.72rem; color: var(--wi-body); flex-wrap: wrap; }
.wi-cohort-legend i { display: inline-block; width: 12px; height: 10px; border-radius: 2px; vertical-align: -1px; margin-right: 0.2rem; }
.wi-lg-act { background: linear-gradient(180deg, var(--wi-accent-2), var(--wi-accent)); }
.wi-lg-cur { background: repeating-linear-gradient(45deg, #cbd5e1, #cbd5e1 3px, #eef2f7 3px, #eef2f7 6px); }
.wi-lg-est { background: repeating-linear-gradient(45deg, var(--wi-accent-2), var(--wi-accent-2) 3px, #bae6fd 3px, #bae6fd 6px); }
/* current (still-partial) calendar year: grey hatch, set apart from the blue forecast bar */
.wi-spark-current .wi-spark-bar { background: repeating-linear-gradient(45deg, #cbd5e1, #cbd5e1 4px, #eef2f7 4px, #eef2f7 8px); }
.wi-spark-current .wi-spark-x { color: var(--wi-body); font-weight: 600; }
/* small info icon with native hover tooltip */
.wi-info { display: inline-flex; align-items: center; justify-content: center; width: 12px; height: 12px; margin-left: 2px;
    border-radius: 50%; background: var(--wi-muted); color: #fff; font-size: 0.58rem; font-weight: 700; font-style: normal;
    line-height: 1; cursor: help; vertical-align: 1px; }
.wi-info:hover { background: var(--wi-accent); }
.wi-cohort-side { border-left: 1px solid var(--wi-line-soft); padding-left: 1.25rem; }
.wi-feeder { display: flex; gap: 0.5rem; margin-bottom: 0.9rem; flex-wrap: wrap; }
.wi-feeder-age { font-size: 0.82rem; background: var(--wi-bg); border: 1px solid var(--wi-line); border-radius: 8px; padding: 0.2rem 0.55rem; font-variant-numeric: tabular-nums; }
.wi-feeder-age b { color: var(--wi-accent-dark); }
.wi-flag.wi-building { background: #dcfce7; color: #166534; }
.wi-flag.wi-steady { background: var(--wi-line-soft); color: var(--wi-body); }
.wi-flag.wi-thinning { background: #fee2e2; color: #991b1b; }

/* per-event tables */
.wi-evgroup-head { margin: 0.3rem 0 0.4rem; font-size: 0.95rem; color: var(--wi-accent-dark); }
.wi-table-wrap { background: var(--wi-surface); border: 1px solid var(--wi-line); border-radius: var(--wi-radius); box-shadow: var(--wi-shadow); overflow-x: auto; }
.wi-evtable { width: 100%; border-collapse: collapse; font-size: 0.86rem; }
.wi-evtable th, .wi-evtable td { padding: 0.5rem 0.7rem; text-align: left; border-bottom: 1px solid var(--wi-line-soft); white-space: nowrap; }
.wi-evtable thead th { position: sticky; top: 0; background: #f8fafc; font-size: 0.7rem; text-transform: uppercase; letter-spacing: 0.03em; color: var(--wi-muted); font-weight: 700; z-index: 1; }
.wi-evtable tbody tr:last-child td { border-bottom: 0; }
.wi-evtable tbody tr:hover { background: #fafcff; }
.wi-row-cut { background: #fffdf3; }
.wi-row-cut:hover { background: #fef9e7 !important; }
.wi-ev { font-weight: 600; }
.wi-band { font-weight: 600; color: #0369a1; }
.wi-time, .wi-starters, .wi-wa { font-variant-numeric: tabular-nums; }
/* per-event mini trend (2 actual years + forecast) */
.wi-bars { display: inline-flex; align-items: flex-end; gap: 2px; height: 22px; }
.wi-bar { width: 7px; min-height: 2px; background: var(--wi-accent-2); border-radius: 2px 2px 0 0; }
.wi-bar.fc { background: var(--wi-accent-dark); }

/* age-group trends: per-band total starts by year */
.wi-aget-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(118px, 1fr)); gap: 0.9rem; }
.wi-aget { background: var(--wi-bg); border: 1px solid var(--wi-line); border-radius: 10px; padding: 0.6rem 0.7rem; }
.wi-aget-label { font-weight: 700; font-size: 0.9rem; color: var(--wi-accent-dark); margin-bottom: 0.45rem; }
.wi-aget-bars { display: flex; align-items: flex-end; gap: 0.45rem; }
.wi-aget-col { display: flex; flex-direction: column; align-items: center; gap: 0.12rem; flex: 1; }
.wi-aget-track { height: 44px; width: 100%; display: flex; align-items: flex-end; justify-content: center; }
.wi-aget-bar { width: 100%; max-width: 24px; min-height: 3px; background: linear-gradient(180deg, var(--wi-accent-2), var(--wi-accent)); border-radius: 3px 3px 0 0; }
.wi-aget-bar.fc { background: repeating-linear-gradient(45deg, var(--wi-accent-2), var(--wi-accent-2) 4px, #bae6fd 4px, #bae6fd 8px); }
.wi-aget-v { font-size: 0.68rem; font-weight: 700; font-variant-numeric: tabular-nums; }
.wi-aget-y { font-size: 0.64rem; color: var(--wi-muted); }

/* master-detail event view: compact clickable list + side detail panel */
.wi-ev-split { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.05fr); gap: 1rem; align-items: start; }
.wi-ev-list { background: var(--wi-surface); border: 1px solid var(--wi-line); border-radius: var(--wi-radius); box-shadow: var(--wi-shadow); overflow: hidden; }
.wi-ev-head, .wi-ev-item { display: grid; grid-template-columns: 1fr 3.4rem 2.8rem 0.8rem; align-items: center; gap: 0.5rem; padding: 0.45rem 0.7rem; }
.wi-ev-head.has-vs, .wi-ev-item.has-vs { grid-template-columns: 1fr 3.4rem 2.8rem 3.6rem 0.8rem; }
.wi-hero-qual { font-size: 0.76rem; opacity: 0.9; margin-top: 0.15rem; font-variant-numeric: tabular-nums; }
/* qualification-pace read (behind / on-track / ahead of the historical norm at this lead) */
.wi-pace { font-size: 0.68rem; font-weight: 700; padding: 0.05rem 0.4rem; border-radius: 999px; white-space: nowrap; }
.wi-pace.behind { background: #fef9c3; color: #854d0e; }
.wi-pace.ontrack { background: #dcfce7; color: #166534; }
.wi-pace.ahead { background: #dbeafe; color: #1e40af; }
.wi-hero-qual .wi-pace { background: rgba(255,255,255,.28); color: #fff; }
.wi-ev-head { font-size: 0.66rem; text-transform: uppercase; letter-spacing: 0.03em; color: var(--wi-muted); font-weight: 700; background: #f8fafc; border-bottom: 1px solid var(--wi-line); }
.wi-ev-item { border: 0; border-bottom: 1px solid var(--wi-line-soft); background: none; cursor: pointer; text-align: left; font: inherit; width: 100%; }
.wi-ev-item:last-child { border-bottom: 0; }
.wi-ev-item:hover { background: #fafcff; }
.wi-ev-item.active { background: #eff6ff; box-shadow: inset 3px 0 0 var(--wi-accent); }
.wi-ev-name { font-weight: 600; font-size: 0.84rem; display: flex; align-items: center; gap: 0.35rem; min-width: 0; }
.wi-ev-starts strong { font-size: 0.92rem; }
.wi-ev-caret { color: var(--wi-muted); text-align: right; font-size: 1.05rem; }
.wi-ev-item.active .wi-ev-caret { color: var(--wi-accent); }

.wi-ev-detail { align-self: start; position: sticky; top: 1rem; background: var(--wi-surface); border: 1px solid var(--wi-line); border-radius: var(--wi-radius); box-shadow: var(--wi-shadow); padding: 1rem 1.15rem; min-height: 130px; }
.wi-ev-detail-empty { color: var(--wi-muted); font-size: 0.9rem; text-align: center; padding: 2.5rem 0.5rem; }
.wi-evc-head h4 { margin: 0 0 0.85rem; font-size: 1.02rem; display: flex; align-items: center; gap: 0.4rem; flex-wrap: wrap; }
.wi-evc-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 0.75rem 1.1rem; }
.wi-evc-cell { display: flex; flex-direction: column; gap: 0.2rem; }
.wi-evc-big { grid-column: 1 / -1; padding-bottom: 0.55rem; border-bottom: 1px solid var(--wi-line-soft); }
.wi-evc-lbl { font-size: 0.66rem; text-transform: uppercase; letter-spacing: 0.03em; color: var(--wi-muted); font-weight: 700; }
.wi-evc-val { font-size: 0.9rem; font-variant-numeric: tabular-nums; }
.wi-evc-big .wi-evc-val { font-size: 1.2rem; }
.wi-wa { color: #7c3aed; font-weight: 600; }

/* detail columns: hidden until the Details switch adds .wi-show-adv on #wi-forecast */
.wi-adv { display: none; }
.wi-show-adv .wi-adv { display: table-cell; }

.wi-ci-note { line-height: 1.4; }

/* ── right-pane tabs ──────────────────────────────────────────────── */
.wi-tabs { display: flex; gap: 0.25rem; border-bottom: 1px solid var(--wi-line); margin-bottom: 0.25rem; }
.wi-tab { border: 0; background: none; font: inherit; font-size: 0.86rem; font-weight: 600; color: var(--wi-muted);
    cursor: pointer; padding: 0.55rem 0.9rem; border-bottom: 2px solid transparent; margin-bottom: -1px; border-radius: 6px 6px 0 0; }
.wi-tab:hover { color: var(--wi-body); background: var(--wi-line-soft); }
.wi-tab.active { color: var(--wi-accent-dark); border-bottom-color: var(--wi-accent); }
.wi-tabpane { display: none; }
.wi-tabpane.wi-active { display: block; }
.wi-tabpane.wi-active[data-pane="overview"] { display: flex; flex-direction: column; gap: 1.1rem; }

/* ── sortable tables (Events / Limits tabs) ───────────────────────── */
.wi-tablewrap { background: var(--wi-surface); border: 1px solid var(--wi-line); border-radius: var(--wi-radius);
    box-shadow: var(--wi-shadow); overflow: hidden; }
.wi-table { width: 100%; border-collapse: collapse; font-size: 0.85rem; }
.wi-table th, .wi-table td { padding: 0.5rem 0.8rem; text-align: left; }
.wi-table td.num, .wi-table th.num { text-align: right; font-variant-numeric: tabular-nums; }
.wi-th { font-size: 0.66rem; text-transform: uppercase; letter-spacing: 0.03em; color: var(--wi-muted); font-weight: 700;
    background: #f8fafc; border-bottom: 1px solid var(--wi-line); cursor: pointer; user-select: none; white-space: nowrap; }
.wi-th:hover { color: var(--wi-body); background: #eef2f7; }
.wi-th::after { content: "\2195"; opacity: 0.28; margin-left: 0.3rem; font-size: 0.85em; }
.wi-th.sort-asc::after { content: "\2191"; opacity: 0.9; color: var(--wi-accent); }
.wi-th.sort-desc::after { content: "\2193"; opacity: 0.9; color: var(--wi-accent); }
.wi-table tbody tr { border-bottom: 1px solid var(--wi-line-soft); }
.wi-table tbody tr:last-child { border-bottom: 0; }
.wi-table tbody tr:hover { background: #fafcff; }
.wi-table tbody tr.wi-row-cut { background: #fff7ed; }
.wi-table tbody tr.wi-row-cut:hover { background: #ffedd5; }
.wi-table td strong { font-weight: 700; }
.wi-dash .wi-table .wi-chip.pos { background: #dcfce7; color: #166534; }
.wi-dash .wi-table .wi-chip.neg { background: #fee2e2; color: #991b1b; }
.wi-dash .wi-table .wi-chip.flat { background: var(--wi-line-soft); color: var(--wi-muted); }

/* ── footer ───────────────────────────────────────────────────────── */
.wi-footer { margin-top: 2rem; padding-top: 1rem; border-top: 1px solid var(--wi-line); text-align: center; color: var(--wi-muted); font-size: 0.8rem; }

/* ── responsive ───────────────────────────────────────────────────── */
@media (max-width: 900px) {
    .wi-shell { grid-template-columns: 1fr; }
    .wi-controls { position: static; max-height: none; }
    .wi-hero-sexes { margin-left: 0; }
    .wi-flow-row { grid-template-columns: 130px 1fr auto; }
    .wi-cohort-grid { grid-template-columns: 1fr; }
    .wi-cohort-side { border-left: 0; padding-left: 0; border-top: 1px solid var(--wi-line-soft); padding-top: 0.9rem; }
    .wi-ev-split { grid-template-columns: 1fr; }
    .wi-ev-detail { position: static; }
}

/* ── info / "how the model works" page ────────────────────────────── */
.wi-info-link { font-size: 0.82rem; font-weight: 600; color: var(--wi-accent-dark); text-decoration: none;
    border: 1px solid var(--wi-line); border-radius: 999px; padding: 0.3rem 0.7rem; white-space: nowrap; }
.wi-info-link:hover { background: var(--wi-line-soft); }
.wi-info-page { max-width: 760px; margin: 0 auto; display: flex; flex-direction: column; gap: 1rem; padding: 0.5rem 0 2rem; }
.wi-info-page .wi-card h3 { margin: 0 0 0.5rem; font-size: 1.08rem; color: var(--wi-accent-dark); }
.wi-info-page p { margin: 0.4rem 0; line-height: 1.55; color: var(--wi-ink); }
.wi-funnel-steps { list-style: none; counter-reset: step; margin: 0.6rem 0 0; padding: 0; display: flex; flex-direction: column; gap: 0.55rem; }
.wi-funnel-steps li { counter-increment: step; position: relative; padding: 0.6rem 0.8rem 0.6rem 2.6rem;
    background: var(--wi-bg); border-radius: 10px; line-height: 1.5; }
.wi-funnel-steps li::before { content: counter(step); position: absolute; left: 0.7rem; top: 0.6rem;
    width: 1.5rem; height: 1.5rem; border-radius: 50%; background: var(--wi-accent); color: #fff;
    font-weight: 700; font-size: 0.85rem; display: flex; align-items: center; justify-content: center; }
.wi-funnel-steps li b { display: block; margin-bottom: 0.1rem; }
.wi-funnel-steps li:not(:last-child)::after { content: "↓"; position: absolute; left: 1.35rem; bottom: -0.5rem;
    color: var(--wi-muted); font-size: 0.85rem; }
.wi-info-list { margin: 0.5rem 0 0; padding-left: 1.1rem; display: flex; flex-direction: column; gap: 0.5rem; }
.wi-info-list li { line-height: 1.5; }
.wi-rejected { background: #fff7ed; border-color: #fed7aa; }
.wi-rejected h3 { color: #9a3412 !important; }
.wi-info-foot { text-align: center; margin-top: 0.5rem; }

/* info page: static facts table */
.wi-facts-table { width: 100%; border-collapse: collapse; font-size: 0.88rem; margin: 0.5rem 0; }
.wi-facts-table th, .wi-facts-table td { padding: 0.4rem 0.6rem; border-bottom: 1px solid var(--wi-line-soft); text-align: left; }
.wi-facts-table th { font-size: 0.68rem; text-transform: uppercase; letter-spacing: 0.03em; color: var(--wi-muted); font-weight: 700; border-bottom: 1px solid var(--wi-line); }
.wi-facts-table td.num, .wi-facts-table th.num { text-align: right; font-variant-numeric: tabular-nums; }
.wi-facts-table tbody tr.wi-facts-hi { background: #eff6ff; font-weight: 600; }

/* Rollo open-event (50m free) estimate note in the hero */
.wi-hero-open { display:block; margin-top:0.3rem; font-size:0.8rem; opacity:0.92; font-variant-numeric:tabular-nums;
    border-top:1px dashed rgba(255,255,255,.35); padding-top:0.3rem; cursor:help; }
.wi-hero-open small { opacity:0.8; }
.wi-hero-open strong { font-weight:700; }

/* birth-year cohort heatmap */
.wi-ch-wrap { overflow-x: auto; }
.wi-ch-table { border-collapse: collapse; font-size: 0.82rem; font-variant-numeric: tabular-nums; }
.wi-ch-table th { font-size: 0.66rem; text-transform: uppercase; letter-spacing: 0.02em; color: var(--wi-muted); font-weight: 700; padding: 0.3rem 0.4rem; }
.wi-ch-table th.num { text-align: center; }
.wi-ch-by { font-weight: 700; color: var(--wi-ink); padding: 0.2rem 0.5rem; white-space: nowrap; }
.wi-ch-cell { width: 2.6rem; text-align: center; padding: 0.35rem 0.2rem; border: 1px solid #fff; color: var(--wi-ink); }
.wi-ch-partial { outline: 1px dashed var(--wi-muted); outline-offset: -2px; }
.wi-ch-str { font-weight: 700; font-size: 0.78rem; padding: 0.1rem 0.4rem; border-radius: 999px; }
.wi-ch-str.weak { background: #fee2e2; color: #991b1b; }
.wi-ch-str.strong { background: #dcfce7; color: #166534; }
.wi-ch-str.mid { background: var(--wi-line-soft); color: var(--wi-muted); }

/* cohort page: both/boys/girls toggle */
.wi-ch-toggle { display: inline-flex; gap: 0.2rem; background: var(--wi-bg); border: 1px solid var(--wi-line); border-radius: 9px; padding: 3px; margin-bottom: 0.7rem; }
.wi-ch-toggle button { border: 0; background: none; font: inherit; font-size: 0.82rem; font-weight: 600; color: var(--wi-body); cursor: pointer; padding: 0.3rem 0.8rem; border-radius: 7px; }
.wi-ch-toggle button.active { background: #fff; color: var(--wi-accent-dark); box-shadow: var(--wi-shadow); }
.wi-ch-scope[hidden] { display: none; }

/* cohort page: competition coverage bands */
.wi-ch-cov td { padding: 0; border: 1px solid #fff; }
.wi-ch-covname { font-size: 0.68rem; font-weight: 700; white-space: nowrap; padding: 0.15rem 0.5rem !important; text-align: right; }
.wi-ch-covcell { height: 0.7rem; text-align: center; font-weight: 700; }
.wi-ch-legend { display: flex; flex-wrap: wrap; gap: 0.4rem 1rem; margin: 0.5rem 0; font-size: 0.78rem; color: var(--wi-body); }
.wi-ch-legend span { display: inline-flex; align-items: center; gap: 0.35rem; }
.wi-ch-legend i { width: 0.9rem; height: 0.9rem; border-radius: 3px; display: inline-block; }
.wi-ch-legend i.faint { opacity: 0.25; }
