:root {
  /* Coppell ISD brand tokens: data-raw/BRAND.md (coppellisd.com/page/branding). Logo is not used. */
  --cisd-red: #cc0033;        /* primary red: accent, selection, focus */
  --cisd-maroon: #940804;     /* middle-school family: secondary accent */
  --cisd-black: #000000;      /* masthead, headings */
  --cisd-grey: #ababab;       /* non-text only (rules, axes) */
  --cisd-white: #ffffff;
  --red: var(--cisd-red);
  --maroon: var(--cisd-maroon);
  --ink: #111111;
  --ink-2: #333333;           /* dark text grey from the district site */
  --muted: #595959;           /* AA on white (7:1) */
  --grey: var(--cisd-grey);
  --line: #e3e3e3;
  --surface: var(--cisd-white);
  --surface-2: #f4f4f3;
  /* chart data colors are colorblind-safe, not brand colors (red = selection only) */
  --blue: #2a78d6;
  --blue-deep: #184f95;
  --orange: #eb6834;
  --font: 'Inter', system-ui, -apple-system, 'Segoe UI', Helvetica, Arial, sans-serif;
  --font-display: 'Playfair Display', Georgia, serif;
  --r: 6px;
  --bar-h: 56px;
  color-scheme: light;
}
* { box-sizing: border-box; }
html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }
body { margin: 0; font: 400 15px/1.5 var(--font); color: var(--ink-2); background: var(--surface); overflow-x: hidden; /* clip below: hidden on body can break position:sticky in iOS WebKit */ font-variant-numeric: tabular-nums; }
::selection { background: var(--red); color: #fff; }
.wrap { width: 100%; max-width: 1200px; margin: 0 auto; padding: 0 16px; }
a { color: var(--red); text-underline-offset: 2px; }
a:hover { color: var(--maroon); }
:focus-visible { outline: 2px solid var(--red); outline-offset: 2px; }
.skip { position: absolute; left: -999px; top: 8px; background: #000; color: #fff; padding: 8px 12px; z-index: 3000; }
.skip:focus { left: 8px; }
h1, h2 { font-family: var(--font-display); color: var(--ink); font-weight: 700; text-wrap: balance; }
h1 { font-size: 1.75rem; line-height: 1.15; margin: 0; letter-spacing: -0.01em; }
h2 { font-size: 1.6rem; line-height: 1.2; margin: 0 0 .75rem; }
h3 { font: 600 1rem/1.35 var(--font); color: var(--ink); margin: 1.5rem 0 .5rem; text-wrap: balance; }
p { margin: 0 0 .75rem; max-width: 72ch; }

.masthead { background: var(--cisd-black); color: #fff; border-top: 0; border-bottom: 0; }
.masthead h1 { color: #fff; }
.masthead-row { display: flex; flex-wrap: wrap; gap: 8px 24px; align-items: flex-end; justify-content: space-between; padding-top: 18px; padding-bottom: 10px; }
.sectionnav { display: flex; gap: 4px 16px; flex-wrap: wrap; font-size: .875rem; }
.sectionnav a { color: #fff; text-decoration: none; padding: 6px 0; border-bottom: 2px solid transparent; }
.sectionnav a:hover { border-bottom-color: var(--cisd-red); color: #fff; }
.disclaimer { font-size: .8125rem; color: #e6e6e6; border-top: 1px solid #333; padding: 10px 0 12px; margin: 0; max-width: none; }
.disclaimer a { color: #fff; }
.masthead :focus-visible { outline-color: #fff; }

.filterbar { position: sticky; top: 0; z-index: 1200; background: #fff; border-bottom: 1px solid var(--line); box-shadow: 0 1px 8px rgba(0,0,0,.06); }
.filterbar-row { display: flex; flex-wrap: wrap; gap: 8px 16px; align-items: flex-end; padding-top: 8px; padding-bottom: 8px; }
.filter-panel { display: flex; flex-wrap: wrap; gap: 8px 16px; align-items: flex-end; }
.filter-toggle { display: none; }
.field { display: flex; flex-direction: column; gap: 3px; font-size: .75rem; color: var(--muted); font-weight: 600; letter-spacing: .02em; }
.field > span { text-transform: none; }
select { font: 500 .875rem var(--font); color: var(--ink); padding: 7px 28px 7px 10px; border: 1px solid #b5b5b5; border-radius: var(--r); background: #fff; min-height: 36px; max-width: 100%; }
select:hover { border-color: var(--ink); }
.btn { font: 600 .8125rem var(--font); min-height: 36px; padding: 0 12px; border-radius: var(--r); border: 1px solid #b5b5b5; background: #fff; color: var(--ink); cursor: pointer; transition: background-color .15s, border-color .15s; }
.btn:hover { border-color: var(--ink); background: var(--surface-2); }
.btn.ghost { border-color: transparent; color: var(--ink-2); text-decoration: underline; text-underline-offset: 3px; }
.btn.primary { background: var(--red); border-color: var(--red); color: #fff; }
.btn.primary:hover { background: var(--maroon); border-color: var(--maroon); }
.btn:disabled { opacity: .45; cursor: not-allowed; }
.count { display: inline-block; min-width: 18px; padding: 0 5px; border-radius: 9px; background: var(--red); color: #fff; font-size: .7rem; line-height: 18px; text-align: center; margin-left: 4px; }
.seg { display: inline-flex; flex-wrap: wrap; gap: 0; border-radius: var(--r); }
.seg button { font: 500 .8125rem var(--font); min-height: 36px; padding: 0 11px; border: 1px solid #b5b5b5; margin-left: -1px; background: #fff; color: var(--ink-2); cursor: pointer; transition: background-color .15s; }
.seg button:first-child { border-radius: var(--r) 0 0 var(--r); margin-left: 0; }
.seg button:last-child { border-radius: 0 var(--r) var(--r) 0; }
.seg button:not([aria-pressed="true"]):hover:not(:disabled) { background: var(--surface-2); }
.seg button[aria-pressed="true"] { background: var(--cisd-black); color: #fff; border-color: var(--cisd-black); position: relative; z-index: 1; }
.seg button[aria-pressed="true"]:hover { background: #222; color: #fff; }
.seg button:disabled { color: #8a8a8a; background: var(--surface-2); cursor: not-allowed; }
.seg button:focus-visible { z-index: 2; }
.check { display: inline-flex; align-items: center; gap: 6px; font-size: .8125rem; min-height: 36px; color: var(--ink-2); cursor: pointer; }
.check input { width: 16px; height: 16px; accent-color: var(--red); }
.menu { position: relative; }
.menu summary { list-style: none; cursor: pointer; font: 500 .875rem var(--font); color: var(--ink); padding: 7px 28px 7px 10px; border: 1px solid #b5b5b5; border-radius: var(--r); min-height: 36px; min-width: 160px; background: #fff url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6'%3E%3Cpath d='M1 1l4 4 4-4' fill='none' stroke='%23333' stroke-width='1.5'/%3E%3C/svg%3E") no-repeat right 10px center; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 230px; display: block; }
.menu summary::-webkit-details-marker { display: none; }
.menu[open] summary { border-color: var(--ink); }
.menu-body { position: absolute; z-index: 1300; top: calc(100% + 4px); left: 0; width: 280px; max-width: calc(100vw - 32px); max-height: 340px; overflow: auto; background: #fff; border: 1px solid #b5b5b5; border-radius: var(--r); box-shadow: 0 8px 24px rgba(0,0,0,.14); padding: 6px; }
.menu-body label { display: flex; align-items: center; gap: 8px; padding: 6px 8px; font-size: .875rem; color: var(--ink); font-weight: 400; cursor: pointer; border-radius: 4px; }
.menu-body label:hover { background: var(--surface-2); }
.menu-body input { accent-color: var(--red); width: 16px; height: 16px; }
.menu-body .grp { font-size: .7rem; font-weight: 600; color: var(--muted); padding: 8px 8px 2px; text-transform: none; }
.menu-body .menu-actions { display: flex; gap: 8px; padding: 4px 8px 6px; border-bottom: 1px solid var(--line); margin-bottom: 4px; }
.isolate { margin: 0 0 8px; font-size: .8125rem; color: var(--ink); max-width: none; }
.isolate button { margin-left: 8px; }

main { padding-bottom: 48px; }
section { padding: 40px 0 8px; border-top: 1px solid var(--line); margin-top: 24px; }
section:first-of-type { border-top: 0; margin-top: 0; padding-top: 24px; }
.lede { font-size: 1.0625rem; color: var(--ink); }
.takeaway { font-size: 1.0625rem; font-weight: 600; color: var(--ink); margin-bottom: 12px; }
.note { font-size: .8125rem; color: var(--muted); margin-top: 8px; }
.hint { font-size: .8125rem; color: var(--muted); margin: 0; align-self: center; }
.controls { display: flex; flex-wrap: wrap; gap: 10px 20px; align-items: flex-end; margin-bottom: 14px; }
.status { padding: 32px 0; color: var(--muted); }
.status.error { color: var(--maroon); font-weight: 600; }
.scroll { overflow-x: auto; -webkit-overflow-scrolling: touch; }

.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); margin: 16px 0 0; border-top: 2px solid var(--ink); }
.kpi { padding: 14px 16px 14px 0; border-bottom: 1px solid var(--line); }
.kpi dt { font-size: .8125rem; font-weight: 600; color: var(--ink-2); margin: 0 0 4px; }
.kpi dd { margin: 0; }
.kpi .v { font-variant-numeric: proportional-nums; display: block; font-size: 1.875rem; font-weight: 700; color: var(--ink); line-height: 1.15; letter-spacing: -0.01em; }
.kpi .v small { font-size: 1rem; font-weight: 600; }
.kpi .s { display: block; font-size: .8125rem; color: var(--muted); margin-top: 2px; }
.neg { color: #a8400f; } .pos { color: var(--blue-deep); }

.chart { position: relative; width: 100%; }
.chart svg { display: block; width: 100%; height: auto; overflow: visible; touch-action: pan-y; }
.chart svg:focus-visible { outline: 2px solid var(--red); outline-offset: 4px; }
.chart text { font-family: var(--font); font-variant-numeric: tabular-nums; }
.ax text { fill: var(--muted); font-size: 11.5px; }
.ax line, .ax path { stroke: var(--grey); }
.grid line { stroke: var(--line); }
.legend { display: flex; flex-wrap: wrap; gap: 4px 16px; font-size: .8125rem; color: var(--ink-2); margin: 8px 0 0; }
.legend .sw { display: inline-block; width: 18px; height: 3px; margin-right: 6px; vertical-align: middle; border-radius: 2px; }
.legend .sq { display: inline-block; width: 12px; height: 12px; margin-right: 6px; vertical-align: -1px; border-radius: 2px; }
.legend .ramp { display: inline-block; width: 160px; height: 10px; border-radius: 2px; vertical-align: middle; margin: 0 6px; }
.small-multiples { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 16px; }
.sm h4 { font: 600 .8125rem var(--font); margin: 0 0 2px; color: var(--ink); }

.tableview { margin-top: 10px; font-size: .8125rem; }
.tableview summary { cursor: pointer; color: var(--ink-2); font-weight: 600; padding: 6px 0; }
table { border-collapse: collapse; font-size: .8125rem; }
table.data th, table.data td { padding: 5px 10px; border-bottom: 1px solid var(--line); text-align: right; white-space: nowrap; }
table.data th:first-child, table.data td:first-child { text-align: left; }
table.data th { font-weight: 600; color: var(--ink); background: var(--surface-2); position: sticky; top: 0; }
table.data caption { text-align: left; color: var(--muted); padding: 4px 0; }

/* matrix */
.matrix-wrap { border: 1px solid var(--line); border-radius: var(--r); max-height: 640px; overflow: auto; }
table.mx { width: max-content; min-width: 100%; font-size: .75rem; }
table.mx th, table.mx td { padding: 0; border: 1px solid #fff; text-align: center; }
table.mx thead th { position: sticky; top: 0; z-index: 3; background: var(--surface-2); color: var(--ink); font-weight: 600; padding: 7px 4px; min-width: 46px; }
table.mx tbody th { position: sticky; left: 0; z-index: 2; background: #fff; text-align: left; padding: 0 12px 0 8px; font-weight: 500; color: var(--ink); white-space: nowrap; min-width: 150px; box-shadow: 1px 0 0 var(--line); }
table.mx thead th:first-child { left: 0; z-index: 4; text-align: left; padding-left: 8px; }
table.mx tr.lvl th { background: var(--surface-2); font-size: .7rem; color: var(--muted); font-weight: 600; padding: 4px 8px; }
table.mx td button { all: unset; box-sizing: border-box; display: flex; align-items: center; justify-content: center; width: 100%; min-width: 46px; height: 32px; cursor: pointer; font-variant-numeric: tabular-nums; font-size: .75rem; }
table.mx td button:hover { box-shadow: inset 0 0 0 2px var(--ink); }
table.mx td button:focus-visible { box-shadow: inset 0 0 0 2px var(--red); outline: 2px solid var(--red); outline-offset: -2px; z-index: 5; position: relative; }
table.mx td.na { background: var(--surface-2); }
table.mx td.sel button { box-shadow: inset 0 0 0 2px var(--red); font-weight: 700; }
table.mx tr.selrow th { color: var(--red); font-weight: 700; }
table.mx td.tot { font-weight: 600; background: #fff; color: var(--ink); padding: 0 8px; }
table.mx tfoot td, table.mx tfoot th { background: #fff; font-weight: 600; color: var(--ink); padding: 6px 4px; border-top: 2px solid var(--ink); }
.hatch-sw { display: inline-block; width: 14px; height: 14px; vertical-align: -2px; margin-right: 6px; border: 1px solid #cfcfcf; }
.blank-sw { display: inline-block; width: 14px; height: 14px; vertical-align: -2px; margin-right: 6px; border: 1px solid #cfcfcf; background: var(--surface-2); }

/* map */
.mapgrid { display: grid; grid-template-columns: minmax(0, 1fr) 300px; gap: 20px; }
.mapbox { height: 560px; border: 1px solid var(--line); border-radius: var(--r); background: #e8e8e8; isolation: isolate; z-index: 0; }
.mapside { font-size: .875rem; }
.mapside h3 { margin-top: 0; font-size: 1.1rem; }
.mapside dl { display: grid; grid-template-columns: auto 1fr; gap: 4px 12px; margin: 8px 0 12px; }
.mapside dt { color: var(--muted); } .mapside dd { margin: 0; text-align: right; font-weight: 600; color: var(--ink); }
.leaflet-container { font-family: var(--font); }
.leaflet-tooltip.ct { font: 500 12px/1.4 var(--font); color: var(--ink); border: 1px solid #b5b5b5; box-shadow: 0 2px 8px rgba(0,0,0,.15); padding: 6px 8px; }
.leaflet-tooltip.ct b { display: block; font-weight: 600; }
.maplegend { align-items: center; }

/* tooltip */
.tip { position: fixed; z-index: 4000; pointer-events: none; background: #fff; color: var(--ink); border: 1px solid #b5b5b5; border-radius: var(--r); box-shadow: 0 6px 20px rgba(0,0,0,.16); padding: 8px 10px; font-size: .78rem; line-height: 1.4; max-width: min(300px, calc(100vw - 16px)); }
.tip b { font-weight: 600; }
.tip .row { display: flex; justify-content: space-between; gap: 14px; align-items: baseline; }
.tip .row span:first-child { display: inline-flex; align-items: center; gap: 6px; }
.tip i { width: 10px; height: 3px; border-radius: 2px; display: inline-block; }
.tip .sub { color: var(--muted); font-size: .72rem; }

/* profile & transfers & sources */
.pf-head { display: grid; gap: 4px; margin-bottom: 12px; }
.pf-head h3 { font-size: 1.25rem; margin: 0; }
.pf-facts { display: flex; flex-wrap: wrap; gap: 6px 20px; font-size: .875rem; color: var(--ink-2); }
.pf-facts b { color: var(--ink); }
.badge { display: inline-block; font-size: .72rem; font-weight: 600; padding: 2px 8px; border-radius: 10px; background: var(--surface-2); color: var(--ink); border: 1px solid var(--line); }
.badge.warn { background: #fff4e5; border-color: #f0c28a; color: #6b3b00; }
.badge.maroon { background: #fbefee; border-color: #d9a3a1; color: var(--cisd-maroon); }
.badge.red { background: #fff0f3; border-color: #f2a9ba; color: var(--maroon); }
.pf-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 16px 12px; margin-top: 12px; }
.block { margin: 0 0 32px; }
.block > h3:first-child { margin-top: 24px; }
.empty { background: var(--surface-2); border-radius: var(--r); padding: 16px 18px; font-size: .9rem; max-width: 78ch; }
.empty strong { color: var(--ink); }
.empty ul { margin: 6px 0 0 18px; padding: 0; }
.two { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 24px; }
.unver { font-size: .72rem; font-weight: 600; color: #6b3b00; background: #fff4e5; border: 1px solid #f0c28a; border-radius: 10px; padding: 1px 7px; margin-left: 6px; white-space: nowrap; }
.timeline { list-style: none; padding: 0; margin: 8px 0; }
.timeline li { display: grid; grid-template-columns: 100px 1fr; gap: 12px; padding: 8px 0; border-bottom: 1px solid var(--line); font-size: .875rem; max-width: 90ch; }
.timeline time { font-weight: 600; color: var(--ink); }
.src-year { margin: 0 0 12px; font-size: .875rem; }
dl.defs { display: grid; grid-template-columns: minmax(140px, 220px) 1fr; gap: 6px 20px; font-size: .875rem; max-width: 90ch; }
dl.defs dt { font-weight: 600; color: var(--ink); } dl.defs dd { margin: 0; }
.dl-list { display: flex; flex-wrap: wrap; gap: 8px; list-style: none; padding: 0; }
.foot { padding-top: 24px; padding-bottom: 32px; font-size: .8125rem; color: var(--muted); border-top: 1px solid var(--line); }

/* additions: charts, cohorts, map, tablet filter collapse */
.chart-title { margin: 0 0 4px; font: 600 .9rem var(--font); color: var(--ink); }
.chart-title.spaced { margin-top: 16px; }
.sm-chg { margin: 0 0 2px; font-size: .75rem; color: var(--muted); }
.gap-sw { display: inline-block; width: 14px; height: 14px; vertical-align: -2px; margin-right: 6px; border: 1px solid #cfcfcf; background: #e6e6e6; }
.tip .mut { color: var(--muted); font-weight: 500; }
.leaflet-tooltip-pane { z-index: 900 !important; }
.co-cell { all: unset; display: flex; width: 100%; height: 30px; box-sizing: border-box; align-items: center; justify-content: center; gap: 6px; cursor: pointer; font-size: .78rem; }
.co-cell:focus-visible { outline: 2px solid var(--red); outline-offset: -3px; box-shadow: inset 0 0 0 4px #fff; }
.co-cell:hover { box-shadow: inset 0 0 0 2px var(--ink); }
.hint-narrow { display: none; }
.sheet-head { display: none; }
@media (max-width: 900px) { .sheet-head { display: flex; } }
abbr[title] { text-decoration: underline dotted; text-underline-offset: 2px; cursor: help; }
#sources table.data td:nth-child(2), #sources table.data th:nth-child(2) { text-align: left; white-space: normal; }
#f-grade .menu-body { left: auto; right: 0; }
@media (max-width: 900px) {
  .filter-toggle { display: inline-block; }
  .filter-panel { display: none; }
  .filter-panel.open { display: flex; flex-direction: column; align-items: stretch; gap: 14px; position: fixed; inset: 0; z-index: 2500; background: #fff; overflow: auto; padding: 0 16px 24px; }
  .sheet-head { display: flex; justify-content: space-between; align-items: center; position: sticky; top: 0; background: #fff; padding: 12px 0; border-bottom: 1px solid var(--line); margin-bottom: 4px; font-size: 1.05rem; }
  .menu summary { max-width: none; width: 100%; }
  .menu-body { position: static; width: 100%; max-width: none; margin-top: 4px; }
  #f-grade .menu-body { right: auto; }
  .seg { width: 100%; } .seg button { flex: 1 1 auto; padding: 0 6px; }
}
@media (max-width: 860px) {
  .mapgrid { grid-template-columns: 1fr; }
  .mapbox { height: 420px; }
}
@media (max-width: 640px) {
  :root { --bar-h: 52px; }
  h1 { font-size: 1.4rem; } h2 { font-size: 1.35rem; }
  .sectionnav { flex-wrap: nowrap; overflow-x: auto; width: 100%; padding-bottom: 2px; scrollbar-width: thin; -webkit-mask-image: linear-gradient(90deg, #000 88%, transparent); mask-image: linear-gradient(90deg, #000 88%, transparent); }
  .sectionnav a { white-space: nowrap; }
  .hint-narrow { display: block; }
  .filterbar-row { gap: 8px; }
  .filterbar-row .btn.ghost { padding: 0 6px; }
  .kpi .v { font-size: 1.6rem; }
  .timeline li { grid-template-columns: 1fr; gap: 0; }
  dl.defs { grid-template-columns: 1fr; gap: 0; } dl.defs dd { margin-bottom: 10px; }
  .mapbox { height: 380px; }
}
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } * { transition: none !important; } }
@media print { .filterbar, .sectionnav { display: none; } }

.count[hidden] { display: none; }
@media (max-width: 640px) { .filter-panel .btn.ghost { align-self: flex-start; } }

/* ===== pass 2: control states, popovers, chips, deltas, skeletons, map cartography, impact events ===== */
:root { --card-rule: #d4d4d4; --red-tint: #fbeaee; --pos-tint: #e4eefa; --neg-tint: #fdeadf; --sh-pop: 0 10px 28px rgba(0,0,0,.16); --sh-tip: 0 4px 14px rgba(0,0,0,.12); --t-fast: .12s ease; --t-base: .18s ease; }
body { font-synthesis: none; text-rendering: optimizeLegibility; }
.sr { position: absolute; left: -9999px; }
:focus-visible { box-shadow: 0 0 0 5px rgba(204,0,51,.22); }
.masthead :focus-visible { box-shadow: 0 0 0 5px rgba(255,255,255,.3); }
table.mx td button:focus-visible, .co-cell:focus-visible { box-shadow: inset 0 0 0 4px #fff; }
.btn, .seg button, .icon-btn, .chip button { transition: background-color var(--t-fast), border-color var(--t-fast), color var(--t-fast); }
.field > span { font-size: .6875rem; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; }
@media (hover: none) { .seg button:not([aria-pressed="true"]):hover { background: #fff; } .btn:hover { background: #fff; } }

/* switches */
.switches { display: flex; flex-wrap: wrap; gap: 0 18px; align-items: center; padding-left: 4px; border-left: 1px solid var(--line); margin-left: 4px; }
.switch { display: inline-flex; align-items: center; gap: 8px; min-height: 36px; position: relative; cursor: pointer; font-size: .8125rem; color: var(--ink-2); }
.switch input { position: absolute; inset: 0; opacity: 0; margin: 0; cursor: pointer; width: 100%; height: 100%; }
.switch .track { width: 34px; height: 20px; border: 1px solid var(--muted); border-radius: 999px; background: var(--surface-2); position: relative; flex: none; transition: background-color var(--t-fast), border-color var(--t-fast); }
.switch .thumb { position: absolute; top: 3px; left: 3px; width: 12px; height: 12px; border-radius: 50%; background: var(--ink-2); transition: transform var(--t-fast), background-color var(--t-fast); }
.switch input:checked + .track { background: #000; border-color: #000; }
.switch input:checked + .track .thumb { background: #fff; transform: translateX(14px); }
.switch input:focus-visible + .track { outline: 2px solid var(--red); outline-offset: 2px; }
.switch input:disabled + .track { opacity: .45; }

/* utility icon buttons and per-chart popovers */
.tools { position: relative; display: flex; gap: 6px; }
[hidden] { display: none !important; }
section { position: relative; }
.controls > .tools { position: absolute; right: 0; top: 36px; margin: 0; }
@media (max-width: 640px) { .controls > .tools { top: 34px; } }
.icon-btn { width: 32px; height: 32px; display: grid; place-items: center; padding: 0; border: 1px solid var(--card-rule); border-radius: var(--r); background: #fff; color: var(--ink-2); cursor: pointer; }
.icon-btn svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }
.icon-btn:hover { border-color: var(--ink); color: var(--ink); }
.icon-btn[aria-pressed="true"], .icon-btn[aria-expanded="true"] { background: #000; border-color: #000; color: #fff; }
.popover { position: absolute; top: calc(100% + 6px); right: 0; z-index: 1350; width: min(340px, calc(100vw - 32px)); max-height: min(62vh, 460px); overflow: auto; overscroll-behavior: contain; background: #fff; border: 1px solid var(--card-rule); border-radius: 8px; box-shadow: var(--sh-pop); padding: 10px 14px 12px; font-size: .8125rem; line-height: 1.45; text-align: left; }
.popover[hidden] { display: none; }
.popover h4 { margin: 2px 0 6px; font: 600 .875rem var(--font); color: var(--ink); }
.popover dl { display: grid; grid-template-columns: auto 1fr; gap: 6px 12px; margin: 0 0 8px; }
.popover dt { font-weight: 600; color: var(--ink); } .popover dd { margin: 0; }
.popover .note { margin: 6px 0 0; }
@media (max-width: 640px) { .popover { position: fixed; left: 16px; right: 16px; bottom: 16px; top: auto; width: auto; max-height: 70vh; } }
.tools { z-index: 20; }
section > h2 { padding-right: 120px; }

/* chips */
.chips { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; padding: 0 0 8px; }
.chips[hidden] { display: none; }
.chip { display: inline-flex; align-items: center; gap: 6px; padding: 3px 4px 3px 10px; border: 1px solid rgba(204,0,51,.3); border-radius: 999px; background: var(--red-tint); color: var(--maroon); font: 600 .8125rem var(--font); }
.chip--isolate, .chip--event { border-style: dashed; border-color: var(--red); }
.chip button { width: 22px; height: 22px; border: 0; border-radius: 50%; background: rgba(204,0,51,.1); color: var(--maroon); cursor: pointer; line-height: 1; font-size: 1rem; }
.chip button:hover { background: var(--red); color: #fff; }

/* KPI delta pills */
.delta { display: inline-flex; align-items: center; margin-left: 8px; padding: 2px 9px; border-radius: 999px; font: 600 .75rem/1.5 var(--font); color: var(--ink); vertical-align: middle; background: var(--surface-2); letter-spacing: 0; }
.delta--down { background: var(--neg-tint); } .delta--up { background: var(--pos-tint); }

/* skeletons */
.skeleton { border: 1px solid var(--line); border-radius: 10px; background: linear-gradient(90deg, #fff 0, var(--surface-2) 50%, #fff 100%) 0 0 / 200% 100%; animation: sheen 1.4s ease-in-out infinite; }
.sk-kpis { height: 96px; margin-bottom: 16px; } .sk-chart { height: 300px; }
@keyframes sheen { to { background-position: -200% 0; } }
@media (prefers-reduced-motion: reduce) { * { transition: none !important; animation: none !important; scroll-behavior: auto !important; } }

/* map cartography */
.mapwrap { position: relative; min-width: 0; }
.leaflet-tooltip.ct { border-radius: 6px; border: 1px solid var(--card-rule); box-shadow: var(--sh-tip); padding: 7px 9px; font-size: 12px; white-space: normal; max-width: 260px; }
.leaflet-tooltip.maplabel { background: transparent; border: 0; box-shadow: none; padding: 0; font: 600 11px/1.15 var(--font); color: var(--ink); text-shadow: 1.5px 0 #fff, -1.5px 0 #fff, 0 1.5px #fff, 0 -1.5px #fff, 1px 1px #fff, -1px 1px #fff, 1px -1px #fff, -1px -1px #fff; white-space: nowrap; pointer-events: none; }
.leaflet-tooltip.maplabel::before { display: none; }
.maplabel .rl { font-weight: 700; color: var(--maroon); }
.leaflet-tooltip .role-line { color: var(--maroon); display: inline; }
.map-legend { background: rgba(255,255,255,.94); border: 1px solid rgba(0,0,0,.12); border-radius: 7px; box-shadow: 0 6px 20px rgba(0,0,0,.10); padding: 6px 10px; margin: 0 0 10px 10px !important; font: 500 .75rem/1.35 var(--font); color: var(--ink); max-width: min(420px, calc(100vw - 80px)); }
.map-legend summary { cursor: pointer; font-weight: 600; list-style: none; }
.map-legend summary::-webkit-details-marker { display: none; }
.map-legend summary::before { content: "+ "; } .map-legend details[open] summary::before { content: "\2212  "; }
.map-legend .lg-row { display: flex; flex-wrap: wrap; align-items: center; gap: 2px 8px; margin-top: 4px; }
.map-legend .ramp { display: inline-block; width: 110px; height: 9px; border-radius: 2px; border: 1px solid rgba(0,0,0,.15); }
.map-legend .ramp.sm { width: 70px; }
.map-legend .lg-warn { color: #6b3b00; font-weight: 600; }
.flow-label span { position: absolute; transform: translate(-50%, -50%); background: #fff; border: 1px solid #111; border-radius: 4px; padding: 0 5px; font: 700 11px/16px var(--font); color: #111; white-space: nowrap; box-shadow: var(--sh-tip); }
.mapside { background: #fff; border: 1px solid var(--card-rule); border-radius: 10px; padding: 14px 16px; align-self: start; box-shadow: 0 1px 2px rgba(0,0,0,.04), 0 3px 12px rgba(0,0,0,.05); }
.mapside h4 { margin: 14px 0 4px; font: 600 .8125rem var(--font); color: var(--ink); }
.side-ev { margin: 0; padding-left: 18px; font-size: .8125rem; } .side-ev span { color: var(--muted); }
.linklike { all: unset; cursor: pointer; color: var(--red); text-decoration: underline; text-underline-offset: 2px; }
.linklike:hover { color: var(--maroon); } .linklike:focus-visible { outline: 2px solid var(--red); outline-offset: 2px; }

/* roles */
.role-tag { display: inline-block; padding: 1px 8px; border-radius: 999px; font: 600 .72rem/1.5 var(--font); border: 1.5px solid #111; background: #fff; color: #111; margin-right: 4px; }
.role-sending { border-color: #940804; color: #940804; } .role-receiving { border-color: #cc0033; background: var(--red-tint); color: #8a0022; }
.role-closed { border-style: dashed; } .role-program_from { border-style: dotted; } .role-program_to { background: var(--surface-2); }

/* impact events */
.ev-block { position: relative; margin: 0 0 20px; }
.ev-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 12px; }
.ev-head h3 { margin: 0 0 6px; }
.ev-timeline { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 0; border: 1px solid var(--card-rule); border-radius: 10px; background: #fff; overflow: hidden; }
.ev-col { padding: 10px 12px 12px; border-right: 1px solid var(--line); min-width: 0; }
.ev-col:last-child { border-right: 0; }
.ev-col.is-year { background: #f0f0f0; }
.ev-year { font: 700 .8125rem var(--font); color: var(--ink); margin-bottom: 8px; } .ev-year span { font-weight: 500; color: var(--muted); }
.ev-row { display: flex; flex-wrap: wrap; gap: 6px 4px; }
.ev-dot { all: unset; box-sizing: border-box; display: flex; flex-direction: column; align-items: center; gap: 1px; width: 46px; padding: 4px 0 3px; border-radius: 8px; cursor: pointer; border: 1px solid transparent; transition: background-color var(--t-fast), border-color var(--t-fast); }
.ev-dot:hover { background: var(--surface-2); border-color: var(--card-rule); }
.ev-dot:focus-visible { outline: 2px solid var(--red); outline-offset: 1px; box-shadow: 0 0 0 4px rgba(204,0,51,.22); }
.ev-dot.on { background: var(--red-tint); border-color: var(--red); }
.ev-d { font: 500 .6875rem var(--font); color: var(--ink-2); white-space: nowrap; }
.ev-shape { fill: #333; stroke: #fff; stroke-width: 1; } .ev-shape .open { fill: #fff; stroke: #333; stroke-width: 2; } .ev-shape .ink { stroke: #fff; stroke-width: 1.8; fill: none; }
.ev-shape.sel { fill: var(--red); } .ev-shape.sel .open { stroke: var(--red); }
@media (max-width: 900px) { .ev-timeline { display: flex; overflow-x: auto; scroll-snap-type: x proximity; } .ev-col { flex: 0 0 min(300px, 78vw); scroll-snap-align: start; } }
.ev-grid { display: grid; grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr); gap: 16px; margin: 16px 0; align-items: start; }
.ev-grid[hidden] { display: none; }
@media (max-width: 900px) { .ev-grid { grid-template-columns: 1fr; } }
.ev-card { background: #fff; border: 1px solid var(--card-rule); border-radius: 10px; padding: 14px 16px; box-shadow: 0 1px 2px rgba(0,0,0,.04), 0 3px 12px rgba(0,0,0,.05); min-width: 0; }
.ev-card h3 { margin: 6px 0 4px; font-size: 1.05rem; }
.ev-card h4 { margin: 12px 0 4px; font: 600 .8125rem var(--font); color: var(--ink); }
.ev-top { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.ev-type { display: inline-flex; align-items: center; gap: 6px; font: 600 .75rem var(--font); color: var(--ink-2); }
.ev-meta { font-size: .8125rem; color: var(--muted); margin-bottom: 6px; }
.ev-unc { font-size: .8125rem; background: #fff8ec; border: 1px solid #f0c28a; border-radius: 6px; padding: 6px 10px; color: #4a2b00; }
.ev-flows { margin: 0 0 6px; padding-left: 18px; font-size: .875rem; }
.ev-evidence { margin-top: 10px; font-size: .8125rem; } .ev-evidence summary { cursor: pointer; font-weight: 600; }
.ev-src { margin: 6px 0 0; padding-left: 18px; } .ev-src li { margin-bottom: 3px; } .ev-ty { display: inline-block; font-size: .6875rem; font-weight: 600; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); } .ev-when { color: var(--muted); }
table.impact td.zr { text-align: left; white-space: normal; min-width: 130px; font-size: .75rem; }
table.impact .role-line { margin-top: 3px; } table.impact tr.tot td { border-top: 2px solid var(--ink); }
table.ev-table td.wrap-cell { white-space: normal; text-align: left; min-width: 180px; }
table.data tr.is-selected { background: var(--red-tint); }
#mp-tablewrap, #tr-tablewrap { margin-top: 10px; border: 1px solid var(--card-rule); border-radius: 8px; background: #fff; }
#mp-tablewrap[hidden], #tr-tablewrap[hidden] { display: none; }
.ev-key, #ev-key { margin-top: 8px; }
#ev-key .ev-shape { vertical-align: -3px; margin-right: 4px; }

@media (max-width: 640px) { .chips { flex-wrap: nowrap; overflow-x: auto; padding-bottom: 6px; } .chip { flex: none; max-width: 78vw; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; } .chips .btn { flex: none; } }
table.ev-table th, table.ev-table td { text-align: left; } table.ev-table td:last-child { text-align: right; }

/* matrix: one table per level */
.mx-stack { }
.mx-h { margin: 22px 0 6px; font: 600 1rem var(--font); } .mx-h:first-child { margin-top: 4px; } .mx-h span { font-weight: 500; color: var(--muted); }
#mx-wrap .matrix-wrap { max-height: none; margin-bottom: 4px; }
#mx-wrap table.mx { width: max-content; min-width: min(100%, 620px); }
#mx-wrap table.mx td button { min-width: 56px; }
#mx-wrap table.mx tfoot th { text-align: left; padding-left: 8px; background: #fff; position: sticky; left: 0; z-index: 2; }
#mx-wrap table.mx-dist { min-width: min(100%, 620px); } #mx-wrap table.mx-dist td, #mx-wrap table.mx-dist tbody th { padding: 8px 10px; font-weight: 600; text-align: center; } #mx-wrap table.mx-dist tbody th { text-align: left; }

/* ===== polish pass: one spacing scale, solid surfaces, no stripes ===== */
:root { --sp-1: 4px; --sp-2: 8px; --sp-3: 12px; --sp-4: 16px; --sp-5: 24px; --sp-6: 48px; --ctl: 36px; }
.wrap { max-width: 1280px; padding: 0 24px; }
@media (max-width: 640px) { .wrap { padding: 0 16px; } }

/* masthead: one solid black block */
.masthead { background: #000; color: #fff; border: 0; box-shadow: none; position: relative; }
.masthead-row { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: var(--sp-2) var(--sp-5); padding-top: 14px; padding-bottom: 14px; }
.brand .eyebrow { margin: 0 0 2px; font: 700 .6875rem/1 var(--font); letter-spacing: .14em; color: #fff; max-width: none; }
.brand .eyebrow i { display: inline-block; width: 8px; height: 8px; background: var(--cisd-red); margin-right: 8px; vertical-align: 0; }
.masthead h1 { font: 700 1.375rem/1.2 var(--font-display); letter-spacing: 0; color: #fff; }
.sectionnav { display: flex; flex-wrap: nowrap; gap: var(--sp-5); font-size: .875rem; overflow: visible; width: auto; padding: 0; -webkit-mask-image: none; mask-image: none; }
.sectionnav a { color: #fff; opacity: .86; padding: 6px 0; border-bottom: 2px solid transparent; transition: opacity var(--t-fast), border-color var(--t-fast); }
.sectionnav a:hover { opacity: 1; border-bottom-color: var(--cisd-red); }
.nav-toggle { display: none; min-height: var(--ctl); padding: 0 14px; border: 1px solid #555; border-radius: var(--r); background: #000; color: #fff; font: 600 .8125rem var(--font); cursor: pointer; }
.nav-toggle[aria-expanded="true"] { background: #fff; color: #000; }
.disclaimer { margin: 0; max-width: none; padding: 8px 0; background: #f2f2f2; color: var(--ink-2); font-size: .8125rem; border: 0; }
.disclaimer .wrap { display: block; }
.disclaimer a { color: var(--ink); font-weight: 600; }
@media (max-width: 900px) {
  .nav-toggle { display: inline-flex; align-items: center; }
  .sectionnav { display: none; flex-direction: column; gap: 0; width: 100%; padding-bottom: 6px; }
  .sectionnav.open { display: flex; }
  .sectionnav a { padding: 11px 0; border-top: 1px solid #262626; border-bottom: 0; }
  .masthead h1 { font-size: 1.15rem; }
}

/* toolbar: one solid white surface, 36px controls, grouped by hairlines */
.filterbar { background: #fff; border-bottom: 1px solid var(--line); box-shadow: none; }
.filterbar-row { display: flex; align-items: flex-end; flex-wrap: wrap; gap: var(--sp-2) 0; padding-top: 10px; padding-bottom: 10px; }
.filter-panel { flex: 1 1 auto; display: flex; flex-wrap: wrap; align-items: flex-end; gap: var(--sp-2) 0; }
.filterbar-row > .field, .filter-panel > .field { padding: 0 var(--sp-4); border-left: 1px solid var(--line); }
.filterbar-row > .field:first-child { padding-left: 0; border-left: 0; }
.field { gap: 4px; }
select, .menu summary, .btn, .seg button, .nav-toggle { min-height: var(--ctl); }
select, .menu summary { height: var(--ctl); padding-top: 0; padding-bottom: 0; display: flex; align-items: center; }
.menu summary { display: block; line-height: calc(var(--ctl) - 2px); }
.btn { display: inline-flex; align-items: center; justify-content: center; }
.btn.quiet { gap: 6px; border-color: var(--card-rule); color: var(--ink-2); font-weight: 500; padding: 0 12px; text-decoration: none; }
.btn.quiet svg { width: 14px; height: 14px; fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }
.btn.quiet:hover { border-color: var(--ink); color: var(--ink); background: #fff; }
.tb-actions { margin-left: auto; display: flex; gap: var(--sp-2); padding-left: var(--sp-4); }
@media (max-width: 900px) {
  .filterbar-row > .field, .filter-panel > .field { padding: 0; border-left: 0; }
  .filterbar-row > .field:first-child { flex: 1 1 auto; }
  .tb-actions { margin-left: 0; padding-left: 0; }
  .filter-panel.open .btn.quiet { flex: 1; }
  .filter-panel.open .tb-actions { flex-direction: row; }
}

/* solid active states, no stripes */
.seg button[aria-pressed="true"], .seg button[aria-pressed="true"]:hover { box-shadow: none; }
.switch input:checked + .track { box-shadow: none; }
.kpis { border-top: 0; gap: var(--sp-2) var(--sp-5); }
.kpi { border-bottom: 0; padding: 12px 16px 12px 0; }
.ev-col.is-year { box-shadow: none; background: #f3f3f3; }
table.data tr.is-selected { box-shadow: none; }
table.mx tfoot td, table.mx tfoot th { border-top: 1px solid var(--ink); }
table.impact tr.tot td { border-top: 1px solid var(--ink); }
.matrix-wrap, #mp-tablewrap, #tr-tablewrap { border: 0; border-radius: 0; }
#mx-wrap .matrix-wrap { border: 0; }

/* one spacing scale and heading ladder */
section { border-top: 0; margin-top: 0; padding: var(--sp-6) 0 0; }
section:first-of-type { padding-top: var(--sp-5); }
h2 { font-size: 1.5rem; margin: 0 0 var(--sp-3); }
h3 { font: 600 1rem/1.35 var(--font); margin: var(--sp-5) 0 var(--sp-2); }
h4 { font: 600 .875rem/1.35 var(--font); }
.lede, .takeaway { font-size: 1.0625rem; line-height: 1.5; color: var(--ink); margin: 0 0 var(--sp-4); max-width: 70ch; }
.lede { font-weight: 400; } .takeaway { font-weight: 500; }
.controls { gap: var(--sp-3) var(--sp-5); margin-bottom: var(--sp-4); }
.note { font-size: .8125rem; color: var(--muted); margin: var(--sp-2) 0 0; max-width: 78ch; }
.grid line { stroke: #eeeeee; }
.legend { margin-top: var(--sp-3); }
.foot { margin-top: var(--sp-6); }
.mapside, .ev-card, .ev-timeline { box-shadow: none; }

/* info buttons and shared hover/focus/tap popover */
.info-btn { all: unset; box-sizing: border-box; display: inline-grid; place-items: center; width: 22px; height: 22px; vertical-align: middle; margin-left: 6px; border-radius: 50%; color: var(--muted); cursor: pointer; transition: color var(--t-fast), background-color var(--t-fast); }
.info-btn svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 1.5; stroke-linecap: round; }
.info-btn:hover, .info-btn[aria-expanded="true"] { color: var(--ink); background: var(--surface-2); }
.info-btn:focus-visible { outline: 2px solid var(--red); outline-offset: 2px; }
.icon-btn.info-btn { all: revert; }
.icon-btn.info-btn { width: 32px; height: 32px; display: grid; place-items: center; padding: 0; margin: 0; border: 1px solid var(--card-rule); border-radius: var(--r); background: #fff; color: var(--ink-2); cursor: pointer; }
.icon-btn.info-btn svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; }
.icon-btn.info-btn:hover, .icon-btn.info-btn[aria-expanded="true"] { background: #000; border-color: #000; color: #fff; }
h2 .info-btn, h3 .info-btn { margin-left: 8px; }
.infopop { position: fixed; z-index: 3500; background: #fff; border: 1px solid var(--card-rule); border-radius: 8px; box-shadow: var(--sh-pop); padding: 10px 14px 12px; font: 400 .8125rem/1.45 var(--font); color: var(--ink-2); text-align: left; }
.infopop[hidden] { display: none; }
.infopop h4 { margin: 2px 0 6px; font: 600 .875rem var(--font); color: var(--ink); }
.infopop dl { display: grid; grid-template-columns: auto 1fr; gap: 6px 12px; margin: 0 0 8px; }
.infopop dt { font-weight: 600; color: var(--ink); } .infopop dd { margin: 0; }
.infopop p { margin: 0 0 6px; max-width: none; } .infopop .note { margin: 6px 0 0; }
.popover.src { display: none !important; }
.filter-toggle { display: none; }
@media (max-width: 900px) { .filter-toggle { display: inline-flex; } }
@media (max-width: 900px) { .filter-panel { display: none; } .filter-panel.open { display: flex; } }

/* ===== pass 3 ===== */
/* matrix: one shared grid */
:root { --mx-name: 210px; --mx-col: clamp(64px, calc((min(100vw, 1280px) - 48px - var(--mx-name)) / 10), 104px); }
@media (max-width: 640px) { :root { --mx-name: 132px; --mx-col: 56px; } }
#mx-wrap table.mx { table-layout: fixed; width: 100%; min-width: calc(var(--mx-name) + var(--mx-col) * 10); }
#mx-wrap table.mx col.c-name { width: var(--mx-name); }
#mx-wrap table.mx col.c-d { width: var(--mx-col); }
#mx-wrap table.mx .sp { border: 0 !important; background: transparent !important; padding: 0; box-shadow: none; }
#mx-wrap table.mx thead th { min-width: 0; }
#mx-wrap table.mx tbody th { min-width: 0; width: var(--mx-name); overflow: hidden; text-overflow: ellipsis; }
#mx-wrap table.mx td button { min-width: 0; }
.namebtn { all: unset; box-sizing: border-box; display: block; width: 100%; min-height: 32px; line-height: 32px; cursor: pointer; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: inherit; }
.namebtn:hover { text-decoration: underline; text-underline-offset: 3px; }
.namebtn:focus-visible { outline: 2px solid var(--red); outline-offset: -2px; }
table.mx td.mask, table.mx td.mask button { background: #e6e6e6; color: #595959; }
table.mx td .blank { display: block; height: 32px; }
.mask-sw, .blank-sw { display: inline-block; width: 16px; height: 16px; vertical-align: -3px; margin-right: 6px; border-radius: 2px; background: #e6e6e6; text-align: center; font: 600 11px/16px var(--font); color: #595959; }
.blank-sw { background: var(--surface-2); border: 1px solid #d4d4d4; }
.dash-sw { display: inline-block; width: 22px; height: 0; border-top: 3px dotted #595959; margin-right: 6px; vertical-align: middle; }
.legend .ramp { width: 140px; margin: 0 8px; }
.cmask { background: #e6e6e6; color: #595959; }

/* sticky toolbar shadow only when stuck */
.filterbar { transition: box-shadow var(--t-base); }
.stack.is-stuck.x-old { box-shadow: 0 1px 0 var(--line), 0 8px 14px -10px rgba(0,0,0,.28); }

/* badges, flags */
.yr-badge { display: inline-block; vertical-align: middle; margin-left: 4px; padding: 2px 9px; border-radius: 999px; background: #111; color: #fff; font: 600 .6875rem/1.5 var(--font); letter-spacing: .02em; }
.yr-note { display: inline-block; vertical-align: middle; margin-left: 6px; font: 500 .75rem var(--font); color: var(--muted); }
.flag { display: inline-block; vertical-align: middle; margin-left: 4px; padding: 2px 9px; border-radius: 999px; background: #e6e6e6; color: #333; font: 600 .6875rem/1.5 var(--font); }
.unver { background: #e6e6e6; border-color: #cfcfcf; color: #333; }
.menu-hint { margin-left: auto; align-self: center; font-size: .75rem; color: var(--muted); }
.ev-unc { background: var(--surface-2); border: 1px solid var(--line); color: var(--ink-2); }
.muted { color: var(--muted); }
.chip--isolate, .chip--event { border-style: solid; background: var(--red-tint); }
.role-closed { border-style: solid; }
.badge.warn { background: var(--surface-2); border-color: #cfcfcf; color: var(--ink-2); }
.lg-title { font-weight: 600; margin: 6px 0 2px; }
.lg-class { display: flex; align-items: center; gap: 8px; margin-top: 2px; }
.lg-class b, .map-legend .ramp.classes b { display: inline-block; width: 18px; height: 12px; border: 1px solid rgba(0,0,0,.12); }
.map-legend .ramp.classes { display: inline-flex; width: auto; height: auto; border: 0; }
.map-legend .ramp.classes b { width: 22px; border-radius: 0; }
.lg-ring { width: 12px; height: 12px; border: 2px dashed #111; border-radius: 50%; display: inline-block; }
.lg-dot { width: 12px; height: 12px; border: 1.5px dashed #595959; background: #fff; border-radius: 50%; display: inline-block; margin-left: 8px; }
.lg-sw { display: inline-block; width: 14px; height: 14px; border-radius: 3px; }
.lg-sw.dark { background: rgba(17,17,17,.5); } .lg-sw.ring { border: 2px solid #111; background: #fff; border-radius: 50%; }
.pf-switch { margin: 6px 0 4px; }
.mapside dd .muted { font-weight: 400; }
.foot-r p, .foot-l p { margin: 0; max-width: none; }

/* masthead: no eyebrow */
.disclaimer .dot { margin: 0 6px; color: #8a8a8a; }
.disclaimer a.bw { font-weight: 500; color: var(--ink-2); text-decoration: none; }
.disclaimer a.bw:hover { text-decoration: underline; }

/* footer */
.foot { margin-top: var(--sp-6); background: #000; color: #d9d9d9; border: 0; padding: 0; font-size: .8125rem; }
.foot-row { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 16px 40px; padding-top: 28px; padding-bottom: 32px; }
.foot a { color: #fff; text-decoration: none; }
.foot a:hover { text-decoration: underline; text-underline-offset: 3px; }
.foot .foot-sm { color: #bdbdbd; margin-top: 4px; }
.foot .foot-credit { font: 600 1rem var(--font); color: #fff; }
.foot .foot-cta { color: #fff; font-weight: 500; }
.foot-r { text-align: right; }
.foot :focus-visible { outline-color: #fff; box-shadow: none; }
@media (max-width: 640px) { .foot-r { text-align: left; } }

/* where students live */
#wmap { height: 580px; }
@media (max-width: 860px) { #wmap { height: 420px; } }
@media (max-width: 640px) { #wmap { height: 400px; } }
#where .switches { margin-left: 0; border-left: 0; padding-left: 0; }

/* attendance table cell */
table.impact td.zr { white-space: nowrap; line-height: 1.35; }
.kpis { grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); }
@media (max-width: 640px) { .kpis { grid-template-columns: 1fr 1fr; } .kpi .v { font-size: 1.4rem; } }
@media (max-width: 640px) { .chips { flex-wrap: wrap; overflow: visible; } .chip { max-width: 100%; white-space: normal; } }
.info-btn { min-width: 22px; position: relative; }
.info-btn::after { content: ""; position: absolute; inset: -4px; }
.icon-btn.info-btn:focus-visible { outline: 2px solid var(--red); outline-offset: 2px; box-shadow: 0 0 0 5px rgba(204,0,51,.22); }
.mapside dd { white-space: nowrap; }
#wh-chart { max-width: 860px; }
@media (max-width: 640px) { .chips { flex-wrap: nowrap; overflow-x: auto; } .chips .btn { order: -1; } .chip { flex: none; white-space: nowrap; max-width: none; } }
.sf { display: none; }
@media (max-width: 640px) { .lf { display: none; } .sf { display: inline; } }
.mx-leg { margin: 6px 0 4px; font-size: .75rem; color: var(--muted); }
.mx-leg .ramp { width: 120px; height: 8px; }
.leaflet-tooltip.ct { width: max-content; min-width: 150px; max-width: 280px; }
.ev-grid { grid-template-columns: minmax(0, 1fr) minmax(0, 1.3fr); }
table.impact th, table.impact td { padding: 5px 7px; }
table.impact th { white-space: normal; vertical-align: bottom; }

/* residence flows */
.fl-panels { display: grid; grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr) minmax(0, .9fr); gap: 0 20px; align-items: start; margin-top: 4px; }
@media (max-width: 900px) { .fl-panels { grid-template-columns: 1fr; } }
table.flm { border-collapse: collapse; font-size: .75rem; width: 100%; min-width: 900px; table-layout: fixed; }
table.flm th, table.flm td { padding: 0; height: 30px; text-align: center; border: 1px solid #fff; font-variant-numeric: tabular-nums; }
table.flm thead th { background: var(--surface-2); color: var(--ink); font-weight: 600; padding: 6px 2px; line-height: 1.2; font-size: .6875rem; overflow-wrap: anywhere; hyphens: auto; vertical-align: bottom; height: auto; }
table.flm tbody th, table.flm tfoot th { text-align: left; padding: 0 8px; font-weight: 500; color: var(--ink); width: 150px; background: #fff; }
table.flm thead th:first-child { text-align: left; padding-left: 8px; width: 150px; }
table.flm td.diag { background: #111; color: #fff; font-weight: 600; }
table.flm td.wh { background: #e6e6e6; color: #595959; }
table.flm td.tot, table.flm tfoot td { font-weight: 600; color: var(--ink); background: #fff; }
table.flm tfoot td, table.flm tfoot th { border-top: 1px solid var(--ink); font-weight: 600; }
.range { display: inline-flex; align-items: center; gap: 10px; min-height: 36px; }
.range input { width: 160px; accent-color: var(--red); }
.range output { font: 500 .8125rem var(--font); color: var(--ink); min-width: 84px; text-transform: none; letter-spacing: 0; }


/* ===== pass 4: tabs, At a glance, small-multiple levels, forecast ===== */
.h1-sub { font-weight: 600; opacity: .82; margin-left: 2px; }
.h1-sub::before { content: "\00b7"; margin-right: 10px; opacity: .7; }
.mast-meta { margin: 0; font-size: .8125rem; color: #cfcfcf; max-width: none; }
.masthead-row { padding-bottom: 6px; }
.masthead > .wrap:last-child { padding-bottom: 0; }
.tabs { display: block; }
.tablist { display: flex; gap: 2px; overflow-x: auto; scrollbar-width: none; -webkit-overflow-scrolling: touch; margin: 0 -4px; }
.tablist::-webkit-scrollbar { display: none; }
.tablist button { all: unset; box-sizing: border-box; flex: none; cursor: pointer; padding: 11px 14px 10px; font: 500 .9375rem/1.2 var(--font); color: #d9d9d9; border-radius: 6px 6px 0 0; white-space: nowrap; transition: color .15s, background-color .15s; }
.tablist button:hover { color: #fff; background: #2a2a2a; }
.tablist button[aria-selected="true"] { color: #fff; font-weight: 700; background: var(--cisd-red); }
.tablist button:focus-visible { outline: 2px solid #fff; outline-offset: -3px; }
.masthead { border-bottom: 0; }
@media (max-width: 640px) { .tablist button { padding: 12px 12px 10px; font-size: .875rem; } .mast-meta { display: none; } .tabs { position: relative; } .tabs::after { content: ""; position: absolute; right: 0; top: 0; bottom: 0; width: 28px; background: linear-gradient(90deg, transparent, #000); pointer-events: none; } }
.disclaimer { border-top: 0; }
.tabpanel { padding: 0; margin: 0; border: 0; }
.tabpanel:focus { outline: none; }
.tabpanel > section:first-of-type { padding-top: var(--sp-5); }
.tabpanel[hidden] { display: none; }
.filterbar.is-quiet .filter-panel, .filterbar.is-quiet .filterbar-row > .filter-toggle { display: none; }
.filterbar.is-quiet .chips { display: none; }

/* KPI cards: label / number / quiet line / optional pill; baselines align across cards */
.kpis { grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); }
.kpi { display: flex; flex-direction: column; }
.kpi dd { display: flex; flex-direction: column; gap: 3px; flex: 1; }
.kpi .v { display: flex; align-items: baseline; flex-wrap: wrap; gap: 0 4px; white-space: nowrap; }
.kpi .v .num { font-size: 1.875rem; }
.kpi .v small { font-size: .875rem; font-weight: 500; color: var(--muted); margin-right: 2px; }
.kpi .v .delta { margin-left: 6px; align-self: center; }
.kpi .s { margin-top: 0; }
@media (max-width: 640px) { .kpi .v .num { font-size: 1.4rem; } .kpi .v { white-space: normal; } }

/* At a glance */
#tab-glance > section { padding-top: var(--sp-6); }
#tab-glance > section:first-of-type { padding-top: var(--sp-5); }
.g-field { max-width: 360px; margin-bottom: var(--sp-3); }
.g-field select { width: 100%; font-size: 1rem; }
.g-hint { color: var(--muted); }
.g-sentences { list-style: none; margin: var(--sp-3) 0; padding: 0; max-width: 70ch; }
.g-sentences li { font-size: 1.0625rem; line-height: 1.5; color: var(--ink); padding: 6px 0; border-bottom: 1px solid var(--line); }
.g-sentences li:first-child { font-size: 1.25rem; font-weight: 600; }
.linkbtn { all: unset; box-sizing: border-box; cursor: pointer; color: var(--red); font: 600 .875rem var(--font); text-decoration: underline; text-underline-offset: 3px; padding: 4px 0; }
.linkbtn:hover { color: var(--maroon); }
.linkbtn:focus-visible { outline: 2px solid var(--red); outline-offset: 2px; }
.g-leg { margin: 0 0 var(--sp-2); }
.g-lvl { margin-top: var(--sp-4); }
table.g-table { width: 100%; max-width: 760px; font-size: .9375rem; }
table.g-table td, table.g-table th { padding: 8px 10px; }
table.g-table .g-grp th { background: var(--surface-2); font-size: .75rem; text-transform: none; color: var(--muted); padding: 6px 10px; text-align: left; position: static; }
table.g-table tr.selrow th, table.g-table tr.selrow td { color: var(--red); font-weight: 600; }
table.g-table th[scope=row] { background: #fff; font-weight: 500; position: static; }
.ar { font-size: .7rem; margin-right: 2px; } .ar.up { color: var(--blue-deep); } .ar.dn { color: #a8400f; }
.mut { color: var(--muted); font-weight: 400; }
.g-find { list-style: none; margin: 0; padding: 0; display: grid; gap: var(--sp-4); max-width: 70ch; }
.g-find li { padding-bottom: var(--sp-3); border-bottom: 1px solid var(--line); }
.g-find p { font-size: 1.0625rem; color: var(--ink); margin: 0 0 4px; }

/* campus small multiples: level subheadings */
.sm-groups .sm-lvl { margin: var(--sp-5) 0 var(--sp-2); font-size: .9375rem; }
.sm-groups .sm-lvl:first-child { margin-top: 0; }
.sm-same { font-weight: 400; color: var(--muted); font-size: .8125rem; }
.sm-chg { margin: 0 0 2px; font-size: .75rem; color: var(--muted); }
.nodata { display: inline-block; margin-left: 8px; font-size: .6875rem; font-weight: 500; color: var(--muted); }
.cm-note { margin-left: 6px; font-size: .75rem; color: var(--muted); }
.menu-body label .cm-note:empty { display: none; }

/* forecast track record */
.fc-controls { display: flex; flex-wrap: wrap; gap: var(--sp-3) var(--sp-5); align-items: flex-end; margin-bottom: var(--sp-3); }
.fc-leg { display: flex; flex-wrap: wrap; gap: 4px 16px; font-size: .8125rem; margin: var(--sp-2) 0; }
.fc-leg i { display: inline-block; width: 18px; height: 3px; margin-right: 6px; vertical-align: middle; border-radius: 2px; }
.fc-leg i.bold { height: 4px; background: #000; }
table.fc-t td.bias-up { color: var(--blue-deep); } table.fc-t td.bias-dn { color: #a8400f; }
table.fc-t td.fc-ctx { white-space: normal; text-align: left; min-width: 240px; max-width: 320px; }
.fc-flag { display: inline-block; font-size: .75rem; font-weight: 600; padding: 2px 8px; border-radius: 4px; background: var(--surface-2); color: var(--ink); border: 1px solid var(--line); }
.fc-empty { max-width: 70ch; }
.fc-none { color: var(--muted); }
.nodata { display: block; margin-left: 0; }

/* scroll stability: filter chips overlay the content instead of resizing the sticky bar; no browser scroll anchoring fights */
body { overflow-anchor: none; }

/* sortable matrix headers */
table.mx th.sortable { padding: 0; }
table.mx .sortbtn { all: unset; box-sizing: border-box; cursor: pointer; display: inline-flex; align-items: center; justify-content: center; gap: 3px; width: 100%; min-height: 32px; padding: 0 4px; font: inherit; color: inherit; }
table.mx .sortbtn:hover { background: #e6e6e6; }
table.mx .sortbtn:focus-visible { outline: 2px solid var(--red); outline-offset: -2px; }
table.mx th.sorted { background: #e6e6e6; }
.sortind { font-size: .625rem; }
.mx-reset { margin-left: 12px; font-weight: 500; }
table.g-table th.sortable { padding: 0; }
table.g-table .sortbtn { all: unset; cursor: pointer; display: inline-flex; gap: 4px; padding: 5px 10px; font-weight: 600; width: 100%; box-sizing: border-box; justify-content: flex-end; }
table.g-table th.sortable:first-child .sortbtn { justify-content: flex-start; }
table.g-table .sortbtn:focus-visible { outline: 2px solid var(--red); outline-offset: -2px; }

/* anchors land below the sticky filter bar (scroll-margin, NOT scroll-padding on html: padding made focusing a filter control scroll the page) */
section[id], h2[id], h3[id], .tabpanel { scroll-margin-top: calc(var(--bar-h) + 12px); }

/* ---- one sticky header stack: tab bar + filter toolbar. Masthead and disclaimer scroll away. ---- */
.stack { position: sticky; top: 0; z-index: 1200; background: #fff; transition: box-shadow var(--t-base, .2s); }
.stack.is-stuck { box-shadow: 0 8px 14px -10px rgba(0,0,0,.35); }
.tabbar { background: #000; border-bottom: 0; }
.tabbar .tablist { margin: 0 -4px; }
.tabbar .tablist button { padding: 10px 14px 9px; }
.filterbar { position: relative; top: auto; box-shadow: none !important; }
.filterbar-row { padding-top: 6px; padding-bottom: 6px; }
.masthead-row { padding-top: 12px; padding-bottom: 12px; }
.masthead > .wrap:last-child { padding-bottom: 12px; }
.disclaimer { padding: 6px 0; }
@media (max-width: 640px) {
  .tabbar .tablist button { padding: 10px 12px 8px; }
  .tabbar .tabs { position: relative; }
  .tabbar .tabs::after { content: ""; position: absolute; right: 0; top: 0; bottom: 0; width: 28px; background: linear-gradient(90deg, transparent, #000); pointer-events: none; }
}

.filterbar.is-quiet { display: none; }
.g-cmp { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; margin: 8px 0 0; }
.g-cmp .chip button { all: unset; cursor: pointer; padding: 0 6px; }
.g-fnote { margin-bottom: 10px; }
.foot-l { flex: 1 1 520px; max-width: 68ch; }
.foot-r { margin-left: auto; }
@media (max-width: 640px) {
  .filterbar-row > .field:first-child > span { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
  .filterbar-row { padding-top: 5px; padding-bottom: 5px; align-items: center; }
}


/* ---- round 2 (A3): tables that scroll inside their own container with a sticky first column; no page overflow ---- */
.scroll { max-width: 100%; overflow-x: auto; -webkit-overflow-scrolling: touch; }
table.fc-t th:first-child, table.fc-t td:first-child, table.cap-t th:first-child, table.cap-t td:first-child, table.g-table th:first-child { position: sticky; left: 0; background: #fff; z-index: 1; text-align: left; }
table.cap-t tr.cap-grp th { background: var(--surface-2); }
table.g-table .g-full2 { display: none; }
@media (max-width: 640px) {
  table.g-table { font-size: .875rem; }
  table.g-table td, table.g-table th { padding: 8px 6px; }
  table.g-table .g-fullc { display: none; }
  table.g-table .g-full2 { display: block; font-size: .75rem; font-weight: 400; color: var(--muted); }
  table.g-table th[scope=row] { white-space: normal; }
  table.g-table .sortbtn { padding: 5px 6px; }
}
.mx-stack, #mx-wrap { max-width: 100%; }

/* Forecasts tab */
.fp-take { margin-bottom: var(--sp-3); }
.fp-grp { margin: var(--sp-5) 0 var(--sp-2); font-size: .9375rem; }
.fp-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: var(--sp-4) var(--sp-4); }
.fp-grid .sm h4 { margin: 0 0 2px; font-size: .875rem; }
.fp-leg { display: flex; flex-wrap: wrap; gap: 4px 16px; font-size: .8125rem; margin: var(--sp-2) 0; }
.fp-leg i { display: inline-block; vertical-align: middle; margin-right: 6px; }
.fp-leg .ln { width: 20px; height: 3px; background: #333; }
.fp-leg .ds { width: 20px; height: 0; border-top: 3px dashed #333; }
.fp-leg .dot { width: 9px; height: 9px; border-radius: 50%; border: 2px solid #333; background: #fff; }
table.cap-t { border-collapse: separate; border-spacing: 0; }
table.cap-t th, table.cap-t td { white-space: nowrap; }
table.cap-t td.c { text-align: center; min-width: 64px; font-variant-numeric: tabular-nums; border-bottom: 2px solid #fff; }
table.cap-t td.c.b0 { background: #cfe0f5; color: #111; }
table.cap-t td.c.b1 { background: #f3f3f3; color: #111; }
table.cap-t td.c.b2 { background: #fbd9a8; color: #111; }
table.cap-t td.c.b3 { background: #f08a5d; color: #111; font-weight: 600; }
table.cap-t td.c.bx { background: #fff; color: var(--muted); font-style: italic; }
table.cap-t td.why { text-align: left; white-space: normal; min-width: 230px; }
table.cap-t tr.cap-grp th { background: var(--surface-2); font-size: .75rem; color: var(--muted); text-align: left; padding: 6px 10px; }
.cap-leg { display: flex; flex-wrap: wrap; gap: 4px 16px; font-size: .8125rem; margin: var(--sp-2) 0; }
.cap-leg i { display: inline-block; width: 16px; height: 14px; margin-right: 6px; vertical-align: -2px; border: 1px solid #cfcfcf; }

table.g-table .g-vs { font-weight: 400; color: var(--muted); font-size: .75rem; margin-left: 3px; }
@media (max-width: 640px) { table.g-table .g-vs { display: none; } }

/* matrix-cell isolation line above the trend chart */
.iso-line { margin: 0 0 8px; padding: 6px 10px; font-size: .875rem; background: var(--red-tint, #fdecee); border-radius: 4px; }
.iso-line[hidden] { display: none; }

/* ---- round 3 (G3): phone tables keep their numbers on first view: the sticky first column is capped and wraps ---- */
@media (max-width: 520px) {
  table.fc-t th:first-child, table.fc-t td:first-child, table.cap-t th:first-child, table.cap-t td:first-child,
  table.cmp-table th:first-child, table.cmp-table td:first-child, #pr-sum table.data th:first-child, #pr-sum table.data td:first-child {
    width: 38vw; min-width: 38vw; max-width: 38vw; white-space: normal; overflow-wrap: break-word; line-height: 1.25; font-size: .8125rem; padding-left: 6px; padding-right: 6px; box-sizing: border-box;
  }
  table.fc-t th, table.fc-t td, table.cmp-table th, table.cmp-table td, #pr-sum table.data th, #pr-sum table.data td { padding-left: 7px; padding-right: 7px; }
  table.fc-t th:not(:first-child), #pr-sum table.data th:not(:first-child) { white-space: normal; vertical-align: bottom; line-height: 1.2; font-size: .75rem; }
}
table.pr-zt th.grp-h { text-align: center; border-bottom: 1px solid var(--line); }
table.pr-zt .grp-sep { border-left: 1px solid var(--line); }
table.pr-zt thead th { vertical-align: bottom; white-space: normal; min-width: 4.4rem; }
table.pr-zt thead th:first-child { min-width: 0; }
table.pr-zt tr.total td { font-weight: 700; border-top: 2px solid var(--ink); }
#pr-sum table.pr-zt thead tr:nth-child(2) th:first-child { width: auto; min-width: 4.4rem; max-width: none; text-align: right; font-size: .75rem; padding-left: 7px; padding-right: 7px; }
.nb { white-space: nowrap; }
.cap-t tr.cap-gh th { background: #fff; border-bottom: 0; padding-bottom: 0; } .cap-t th.cap-ghz { text-align: center; font-size: .75rem; color: var(--muted); border-bottom: 1px solid var(--ink); }

/* tab-bar overflow arrows (phone/tablet) */
.tabs .tab-arrow { position: absolute; top: 0; bottom: 0; width: 56px; border: 0; padding: 0; color: #fff; font: 600 1.35rem/1 Inter, system-ui, sans-serif; cursor: pointer; z-index: 2; display: flex; align-items: center; justify-content: center; }
.tabs .tab-arrow[hidden] { display: none; }
.tabs .tab-arrow--next { right: 0; background: linear-gradient(90deg, rgba(0,0,0,0), #000 50%); justify-content: flex-end; padding-right: 6px; }
.tabs .tab-arrow--prev { left: 0; background: linear-gradient(270deg, rgba(0,0,0,0), #000 50%); justify-content: flex-start; padding-left: 6px; }
.tabs .tab-arrow:focus-visible { outline: 2px solid #fff; outline-offset: -3px; }
.tabbar .tabs::after, .tabs::after { content: none !important; }   /* replaced by the arrows */
.tabbar .tabs, .tabs { position: relative; }
/* phone: slightly taller tab bar for easier tapping (owner) */
@media (max-width: 640px) {
  .tabbar .tablist button { padding: 15px 14px 13px; font-size: .95rem; }
  .tabs .tab-arrow { font-size: 1.6rem; }
}

/* ================= Phone pass (M1): reclaim the screen, one-handed filters, bottom sheets, 44px targets ================= */
/* new sheet parts: hidden on desktop */
.sheet-grab, .sheet-foot, .sheet-x, .sheet-backdrop, .filter-toggle .ft-ico, .filter-toggle .ft-chev, .filter-toggle .ft-sum { display: none; }
.sheet-x { width: 44px; height: 44px; padding: 0; border: 0; background: transparent; color: var(--ink); cursor: pointer; place-items: center; border-radius: 50%; }
.sheet-x svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; }
.sheet-x:focus-visible { outline: 2px solid var(--red); outline-offset: -2px; }
.sheet-grab { height: 22px; position: relative; touch-action: none; flex: none; }
.sheet-grab::before { content: ""; position: absolute; left: 50%; top: 9px; width: 40px; height: 5px; margin-left: -20px; border-radius: 3px; background: #c4c4c4; }
@media (max-width: 900px) {
  .sheet-x { display: inline-grid; }
  .sheet-head { min-height: 52px; padding: 4px 0 4px; }
  .sheet-foot { display: flex; gap: 10px; position: sticky; bottom: 0; margin: auto -16px 0; padding: 12px 16px calc(12px + env(safe-area-inset-bottom)); background: #fff; border-top: 1px solid var(--line); z-index: 3; }
  .sheet-foot .btn { min-height: 48px; flex: 1; font-size: 1rem; }
  .sheet-foot .btn.primary { flex: 2; }
  .tb-actions #f-reset { display: none; }
  .sheet-backdrop { display: block; position: fixed; inset: 0; z-index: 2400; background: rgba(0,0,0,.45); touch-action: none; }
}
@keyframes sheetUp { from { transform: translateY(36%); opacity: .3; } to { transform: none; opacity: 1; } }

@media (max-width: 640px) {
  :root { --bar-h: 96px; }
  /* ---- sticky stack: section picker + Filters + share, ALWAYS visible in portrait (no auto-hide) ---- */
  .stack { transition: box-shadow var(--t-base, .2s); transform: none; padding-top: env(safe-area-inset-top, 0px); }
  .tabbar .tablist button { min-height: 44px; padding: 0 14px; display: inline-flex; align-items: center; font-size: .9375rem; line-height: 1.2; }
  .filterbar-row { flex-wrap: nowrap; padding-top: 3px; padding-bottom: 3px; gap: 0; }
  .filter-toggle { display: flex; flex: 1 1 auto; width: 100%; min-width: 0; min-height: 44px; align-items: center; justify-content: flex-start; gap: 8px; padding: 0 14px; font-size: .9375rem; text-align: left; }
  .filter-toggle .ft-ico { display: block; width: 16px; height: 16px; flex: none; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; }
  .filter-toggle .ft-label { font-weight: 700; flex: none; }
  .filter-toggle .count { display: none; }
  .filter-toggle .ft-sum { display: block; flex: 1 1 auto; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 500; color: var(--ink-2); }
  .filter-toggle .ft-chev { display: block; width: 10px; height: 6px; flex: none; fill: none; stroke: #333; stroke-width: 1.6; }
  html.sheet-lock { overscroll-behavior: none; }

  /* ---- filters bottom sheet ---- */
  .filter-panel { display: flex; flex-direction: column; flex-wrap: nowrap; align-items: stretch; gap: 18px; position: fixed; inset: auto 0 0 0; top: 40px; z-index: 2500; background: #fff; border-radius: 16px 16px 0 0; box-shadow: 0 -8px 30px rgba(0,0,0,.28); overflow-x: hidden; overflow-y: auto; overscroll-behavior: contain; padding: 0 16px; visibility: hidden; transform: translateY(100%); transition: transform .22s ease, visibility 0s .22s; }
  .filter-panel.open { display: flex; inset: auto 0 0 0; top: 40px; padding: 0 16px; visibility: visible; transform: none; transition: transform .22s ease; }
  .filter-panel .sheet-grab { display: block; margin: 0 -16px; }
  .filter-panel .sheet-head { margin: 0; padding: 0 0 4px; top: 0; border-bottom: 1px solid var(--line); z-index: 3; }
  .filter-panel .sheet-head strong { font-size: 1.1875rem; }
  .filter-panel .sheet-x { margin-right: -10px; }
  .filter-panel > .field { gap: 8px; }
  .filter-panel > .field > span { font-size: .75rem; }
  .filter-panel select { width: 100%; height: 52px; font-size: 1rem; padding: 0 14px; }
  .filter-panel .seg { width: 100%; flex-wrap: nowrap; }
  .filter-panel .seg button { min-height: 48px; font-size: .9375rem; padding: 0 4px; }
  .filter-panel .menu summary { min-height: 52px; height: 52px; line-height: 50px; font-size: 1rem; padding: 0 36px 0 14px; width: 100%; max-width: none; }
  .filter-panel .menu-body { max-height: none; box-shadow: none; border-color: var(--line); padding: 4px; }
  .filter-panel .menu-body label { min-height: 48px; padding: 0 10px; font-size: 1rem; gap: 14px; }
  .filter-panel .menu-body input { width: 22px; height: 22px; }
  .filter-panel .menu-body .grp { font-size: .8125rem; padding: 12px 10px 4px; }
  .filter-panel .menu-body .menu-actions { align-items: center; padding: 4px 6px 8px; }
  .filter-panel .menu-body .menu-actions .btn { min-height: 44px; }
  .filter-panel .tb-actions { padding: 0; margin: 0; }
  .filter-panel .tb-actions .btn { min-height: 44px; flex: 1; }

  /* ---- info (i) as a bottom sheet ---- */
  .infopop.as-sheet { display: flex; flex-direction: column; left: 0; right: 0; bottom: 0; top: auto; width: auto; max-width: none; max-height: 82vh; padding: 0; border: 0; border-radius: 16px 16px 0 0; box-shadow: 0 -10px 34px rgba(0,0,0,.3); font-size: .9375rem; line-height: 1.55; z-index: 3600; animation: sheetUp .2s ease-out; overflow: hidden; }
  .infopop.as-sheet .sheet-grab { display: block; }
  .infopop.as-sheet .sheet-x { display: inline-grid; position: absolute; top: 2px; right: 4px; }
  .infopop.as-sheet .sheet-content { flex: 1 1 auto; overflow-y: auto; overscroll-behavior: contain; padding: 0 18px calc(20px + env(safe-area-inset-bottom)); }
  .infopop.as-sheet h4 { font-size: 1.0625rem; margin: 0 40px 8px 0; }
  .infopop.as-sheet dl { grid-template-columns: 1fr; gap: 0; }
  .infopop.as-sheet dt { margin-top: 10px; }
  .sheet-backdrop.info-back { display: block; z-index: 3550; }

  /* ---- touch targets: >= 44px by hit area, not by visual bloat ---- */
  .seg button { min-height: 44px; padding: 0 13px; }
  .btn, .nav-toggle { min-height: 44px; }
  select, .menu summary { min-height: 44px; height: 44px; }
  .switch { min-height: 44px; }
  .icon-btn { position: relative; }
  .icon-btn::after { content: ""; position: absolute; inset: -6px; }
  .tools { gap: 12px; }
  .info-btn::after { inset: -11px; }
  .icon-btn.info-btn::after { inset: -6px; }
  .linkbtn { position: relative; }
  .linkbtn::after { content: ""; position: absolute; inset: -12px -4px; }
  .chip button { position: relative; }
  .chip button::after { content: ""; position: absolute; inset: -11px; }
  table.g-table .sortbtn { min-height: 44px; }
  details:not(.menu) > summary { min-height: 44px; display: flex; align-items: center; }
  .disclaimer a, .foot a, #sources td a, #sources p a { display: inline-block; padding: 14px 0; margin: -14px 0; }

  /* ---- At a glance is the phone home: Pick your school first, big picker, 2-column KPI cards ---- */
  #tab-glance:not([hidden]) { display: flex; flex-direction: column; }
  #tab-glance > #g-pick { order: -1; padding-top: var(--sp-4); }
  #tab-glance > section { padding-top: var(--sp-5); }
  #tab-glance > #glance { padding-top: var(--sp-5); }
  .g-field { max-width: none; }
  .g-field select { height: 56px; font-size: 1.125rem; padding: 0 14px; width: 100%; }
  .kpis { grid-template-columns: 1fr 1fr; gap: 0 16px; margin-top: 8px; }
  .kpi { padding: 10px 0; min-width: 0; }
  .kpi dt { font-size: .75rem; margin-bottom: 2px; }
  .kpi .v .num { font-size: 1.5rem; }
  .kpi .v small { font-size: .75rem; }
  .kpi .v .delta { margin-left: 0; margin-top: 2px; }
  .kpi .s { font-size: .75rem; line-height: 1.35; }
  .g-sortf { margin: 0 0 8px; }
  .g-cardkey { font-size: .8125rem; color: var(--muted); margin: 0 0 2px; }
  .g-cards { list-style: none; margin: 0 0 8px; padding: 0; }
  .g-card { display: grid; grid-template-columns: 1fr auto; grid-template-areas: "n s" "c f"; gap: 2px 12px; align-items: center; padding: 10px 0; border-bottom: 1px solid var(--line); min-height: 56px; }
  .gc-n { grid-area: n; font-weight: 600; font-size: 1.0625rem; min-width: 0; }
  .gc-s { grid-area: s; font-weight: 700; font-size: 1.25rem; text-align: right; font-variant-numeric: tabular-nums; }
  .gc-c { grid-area: c; display: flex; align-items: center; gap: 8px; font-size: .8125rem; }
  .gc-c .delta { margin-left: 0; }
  .gc-f { grid-area: f; text-align: right; font-size: .875rem; }
  .g-card.selrow .gc-n { color: var(--red); }
}

/* ================= Phone fix (N1): nowrap years, share, toast, grade scoping, readable captions ================= */
.nb, .yr, .yr-badge { white-space: nowrap; }
.share-btn { display: none; }
.filter-panel label.is-off { opacity: .45; }
.toast { position: fixed; left: 50%; bottom: calc(20px + env(safe-area-inset-bottom)); transform: translate(-50%, 16px); max-width: calc(100vw - 32px); padding: 12px 18px; border-radius: 10px; background: #111; color: #fff; font-size: .9375rem; line-height: 1.35; z-index: 4000; opacity: 0; pointer-events: none; transition: opacity .18s ease, transform .18s ease; box-shadow: 0 8px 24px rgba(0,0,0,.3); }
.toast.on { opacity: 1; transform: translate(-50%, 0); }
@media (prefers-reduced-motion: reduce) { .toast { transition: none; } }
@media (max-width: 640px) {
  .share-btn { display: inline-grid; place-items: center; flex: none; width: 44px; min-width: 44px; height: 44px; padding: 0; margin-left: 8px; }
  .share-btn svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
  .filterbar.is-quiet .share-btn { display: none; }
  .kpi dt, .kpi .v small, .kpi .s { font-size: .8125rem; }
  .g-cardkey, .gc-c { font-size: .8125rem; }
  .g-cmp { margin: 10px 0 12px; }
  .g-cmp .chip { min-height: 32px; display: inline-flex; align-items: center; }
  main [id] { scroll-margin-top: calc(var(--bar-h) + 8px); }
  #tab-glance [id] , #tab-schools [id], #tab-transfers [id], #tab-forecasts [id] { scroll-margin-top: calc(var(--bar-h) + 8px); }
}
@supports (overflow: clip) { body { overflow-x: clip; } }
/* landscape phones: auto-hide the sticky stack too (main.js toggles .is-away) */
@media (pointer: coarse) and (max-height: 500px) {
  .stack { transition: transform .18s ease; }
  .stack.is-away { transform: translateY(-100%); box-shadow: none; }
}
@media (pointer: coarse) and (max-height: 500px) and (prefers-reduced-motion: reduce) { .stack { transition: none; } }

/* Level filter: blocks that cannot honour it say so with one small muted chip on the heading; whole tabs that ignore it disable the control */
.lvl-na { display: inline-flex; align-items: center; gap: 0; vertical-align: middle; margin-left: 8px; padding: 0 2px 0 9px; border: 1px solid var(--card-rule, #d6d6d6); border-radius: 999px; background: none; color: var(--muted, #6b6b6b); font: 500 .75rem/1.6 var(--font); letter-spacing: 0; text-transform: none; white-space: nowrap; }
.lvl-na[hidden] { display: none; }
.lvl-na .info-btn { margin-left: 2px; width: 20px; height: 20px; }
.lvl-na .info-btn svg { width: 14px; height: 14px; }
.field.is-na { opacity: .55; cursor: not-allowed; }
.field.is-na .seg button { cursor: not-allowed; color: #8a8a8a; background: var(--surface-2); pointer-events: none; }
.field.is-na .seg button[aria-pressed="true"] { background: var(--surface-2); color: #8a8a8a; border-color: #b5b5b5; }

/* ---- Phone text density (P4): tiles = label, value, one short line; the rest lives in the tile's (i) ---- */
.kpi, .oe-stat { position: relative; }
.kpi dt { padding-right: 30px; }
.oe-stat span { padding-right: 30px; }
.kpi-i { position: absolute; top: -8px; right: -8px; width: 44px; height: 44px; margin: 0; z-index: 1; }
.kpi-i::after { content: none; }
.kpi-i svg { width: 17px; height: 17px; }
.oe-stat .kpi-i { top: 0; right: 0; }
.kpis .kpi .s { white-space: normal; }
.pd-i { width: 22px; height: 22px; }
.pd-i::after { inset: -11px; }
.note .pd-src { color: var(--muted); }
@media (max-width: 640px) {
  .kpi dt { font-size: .8125rem; }
  .kpi .s { font-size: .8125rem; line-height: 1.3; }
  .kpis { gap: 4px 16px; }
  .kpi { padding: 8px 0 10px; }
}
@media (max-width: 640px) {
  .kpi .v.has-d small { display: none; }
  #tab-transfers .oe-stats, #tab-transfers .re-stats { grid-template-columns: 1fr 1fr; gap: 8px; }
  #tab-transfers .oe-stat { padding: 10px 12px; }
  #tab-transfers .oe-stat b { font-size: 1.5rem; }
  #tab-transfers .oe-stat span { font-size: .8125rem; }
  #tab-transfers .oe-stat .kpi-i { top: -2px; right: -2px; }
}

/* ================= Navigation (NAV1): phone section picker + sheet, Previous / Next links ================= */
.tab-picker, .tp-sheet, .tp-back { display: none; }
.tabpager { display: flex; justify-content: space-between; align-items: center; gap: 16px; margin: var(--sp-6, 48px) 0 var(--sp-5, 24px); padding-top: var(--sp-4, 16px); border-top: 1px solid var(--line); }
.tp-pg { display: flex; flex-direction: column; min-height: 44px; justify-content: center; text-decoration: none; color: var(--ink); min-width: 0; }
.tp-pg-k { font-size: .75rem; font-weight: 600; letter-spacing: .04em; text-transform: uppercase; color: var(--muted); }
.tp-pg-t { font-size: .9375rem; font-weight: 600; }
.tp-pg--next { margin-left: auto; text-align: right; align-items: flex-end; }
.tp-pg--next .tp-pg-t { font-size: 1.125rem; font-weight: 700; color: var(--red); }
.tp-pg--prev .tp-pg-t { font-size: .875rem; font-weight: 500; color: var(--ink-2); }
.tp-pg:hover .tp-pg-t { text-decoration: underline; text-underline-offset: 3px; }
.tp-pg:focus-visible { outline: 2px solid var(--red); outline-offset: 4px; border-radius: 4px; }
@media (max-width: 640px) {
  .tabbar { display: none; }
  .tab-picker { display: inline-flex; align-items: center; justify-content: space-between; gap: 8px; flex: 0 0 auto; max-width: 54%; min-height: 44px; margin-right: 8px; padding: 0 12px; font-size: .9375rem; font-weight: 700; background: var(--cisd-black); color: #fff; border-color: var(--cisd-black); }
  .filterbar:not(.is-quiet) .filter-toggle { width: auto; flex: 1 1 0; }
  .tab-picker:hover { background: #222; border-color: #222; }
  .tab-picker:focus-visible { outline: 2px solid var(--red); outline-offset: 2px; }
  .tab-picker .tp-label { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
  .tab-picker .tp-chev { width: 10px; height: 6px; flex: none; fill: none; stroke: currentColor; stroke-width: 1.7; }
  .filterbar.is-quiet { display: block; }
  .filterbar.is-quiet .tab-picker { flex: 1 1 auto; max-width: none; margin-right: 0; }
  .tp-back { display: block; position: fixed; inset: 0; z-index: 2400; background: rgba(0,0,0,.45); touch-action: none; }
  .tp-back[hidden], .tp-sheet[hidden] { display: none; }
  .tp-sheet { display: flex; flex-direction: column; position: fixed; inset: 0; z-index: 2600; background: #fff; overscroll-behavior: contain; padding-bottom: env(safe-area-inset-bottom); }
  .tp-head { display: flex; align-items: center; justify-content: space-between; min-height: 56px; padding: 0 8px 0 16px; border-bottom: 1px solid var(--line); flex: none; }
  .tp-head strong { font-size: 1.1875rem; color: var(--ink); }
  .tp-head .sheet-x { display: inline-grid; }
  .tp-sheet nav { flex: 1 1 auto; overflow-y: auto; overscroll-behavior: contain; }
  .tp-list { list-style: none; margin: 0; padding: 0; }
  .tp-list li { border-bottom: 1px solid var(--line); }
  .tp-item { all: unset; box-sizing: border-box; display: grid; grid-template-columns: 1fr auto; gap: 2px 12px; align-items: center; width: 100%; min-height: 64px; padding: 10px 16px; cursor: pointer; }
  .tp-item:focus-visible { outline: 2px solid var(--red); outline-offset: -3px; }
  .tp-name { font-size: 1.0625rem; font-weight: 700; color: var(--ink); }
  .tp-desc { grid-column: 1; font-size: .875rem; line-height: 1.35; color: var(--muted); }
  .tp-now { grid-column: 2; grid-row: 1 / span 2; font-size: .75rem; font-weight: 700; color: var(--red); }
  .tp-item[aria-current] { background: var(--red-tint, #fbeaee); box-shadow: inset 4px 0 0 var(--red); }
  .tp-item[aria-current] .tp-name { color: var(--red); }
  .tabpager { margin-top: var(--sp-5, 24px); }
}
@media (prefers-reduced-motion: no-preference) { .tp-sheet { animation: tpIn .16s ease-out; } }
@keyframes tpIn { from { opacity: .4; transform: translateY(12px); } to { opacity: 1; transform: none; } }
@media print { .tabpager, .tp-sheet, .tp-back { display: none !important; } }

/* sortable.js: progressive column sorting on every data table */
th.tsort { padding: 0; }
.tsort-btn { all: unset; box-sizing: border-box; cursor: pointer; display: inline-flex; align-items: center; gap: 4px; min-height: 28px; padding: 5px 10px; font: inherit; color: inherit; text-align: inherit; }
th.tsort[style*="right"] .tsort-btn, th.tsort.num .tsort-btn, th.tsort.r .tsort-btn { justify-content: flex-end; }
.tsort-btn:hover { background: rgba(0,0,0,.06); }
.tsort-btn:focus-visible { outline: 2px solid var(--red); outline-offset: -2px; }
.tsort-ind { display: inline-block; min-width: .7em; font-size: .75rem; line-height: 1; }
th.tsort:not([aria-sort="none"]) { background: #e6e6e6; }
/* map scroll-wheel hint (wheelzoom.js) */
.wz-hint { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; z-index: 1000; pointer-events: none; background: rgba(0,0,0,.35); color: #fff; font-size: 15px; font-weight: 600; opacity: 0; transition: opacity .2s; }
.wz-hint.on { opacity: 1; }
/* new-build notice (update.js) */
.upd-bar { position: fixed; left: 50%; bottom: calc(16px + env(safe-area-inset-bottom)); transform: translateX(-50%); z-index: 3000; background: #111; color: #fff; border-radius: 999px; padding: 8px 8px 8px 16px; font-size: 14px; box-shadow: 0 4px 16px rgba(0,0,0,.25); display: flex; align-items: center; gap: 4px; white-space: nowrap; }
.upd-bar button { background: #c8102e; color: #fff; border: 0; border-radius: 999px; padding: 8px 14px; min-height: 36px; font: inherit; font-weight: 600; cursor: pointer; }

/* level notice (levelna.js): slim line at the top of a block the Level filter cannot apply to; shown only while a Level is selected */
.lvl-note { margin: 4px 0 12px; padding: 6px 10px; border-left: 3px solid var(--card-rule, #d6d6d6); background: #f6f6f6; color: var(--muted, #595959); font-size: .8125rem; line-height: 1.45; max-width: 80ch; }
.lvl-note b { font-weight: 600; color: var(--ink, #111); }
.lvl-note[hidden] { display: none; }
