/* House kit for data pages: dashboards, reports, tools. One stylesheet, no build step.

   Use it as it is before inventing anything. Copy this file into the project (or inline it
   in a single-file page) and build the page out of the classes below; kit.html beside it
   shows every one of them rendered.

   What is decided here, so a page does not decide it again:
   - Colour is a role, defined once per theme (light and dark). Every text token is at least
     4.5:1 on every surface it is used on. --mark is for non-text marks only.
   - Type scale: 12, 13, 14, 15 and 16 px for text (15 is body); 22 for a figure in a tile;
     20 to 24 for the page title; 42 to 56 for the one headline figure. Do not add sizes.
   - One accent (--accent). Per project you may change --accent, --accent-ink, --accent-wash
     and --track together; nothing else needs to move.
   - Chart series colours --s1 to --s6 are in a fixed order and validated for colour-vision
     deficiency in both themes. Text never wears a series colour.
   - Phone first: tab bar at the bottom under 980 px, a side rail above it. */

:root {
  color-scheme: light;
  --page: #f5f5f2;
  --surface: #fdfdfc;
  --sunken: #eeede8;
  --ink: #0b0b0b;
  --ink-2: #52514e;
  --ink-3: #666560;      /* 5.35 on page, 5.74 on surface, 4.98 on sunken */
  --mark: #85837d;       /* non-text marks only: swatches, keys, quiet fills */
  --line: rgba(11, 11, 11, .09);
  --line-2: rgba(11, 11, 11, .16);
  --grid: #e6e5df;
  --axis: #c3c2b7;
  --accent: #2a78d6;
  --accent-ink: #1c5cab;
  --accent-wash: rgba(42, 120, 214, .10);
  --pos: #006300;
  --warn: #7a4f00;
  --warn-wash: #fbf0d4;
  --warn-mark: #fab219;
  --crit: #b62d2d;
  --crit-wash: #faeaea;
  --s1: #2a78d6; --s2: #eb6834; --s3: #1baf7a; --s4: #eda100; --s5: #e87ba4; --s6: #008300;
  --s-other: #b4b3ab;
  --track: #cde2fb;
  --shadow: 0 1px 2px rgba(11, 11, 11, .04), 0 8px 24px rgba(11, 11, 11, .06);
  --font: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", sans-serif;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --page: #0d0d0d;
    --surface: #1a1a19;
    --sunken: #242422;
    --ink: #f0efec;
    --ink-2: #c3c2b7;
    --ink-3: #a3a199;
    --mark: #8f8d86;
    --line: rgba(255, 255, 255, .09);
    --line-2: rgba(255, 255, 255, .18);
    --grid: #2c2c2a;
    --axis: #3d3d3a;
    --accent: #3987e5;
    --accent-ink: #86b6ef;
    --accent-wash: rgba(57, 135, 229, .16);
    --pos: #2fb72f;
    --warn: #f3c04f;
    --warn-wash: rgba(250, 178, 25, .12);
    --crit: #f08a8a;
    --crit-wash: rgba(208, 59, 59, .16);
    --s1: #3987e5; --s2: #d95926; --s3: #199e70; --s4: #c98500; --s5: #d55181; --s6: #0ca30c;
    --s-other: #5c5b56;
    --track: #184f95;
    --shadow: 0 1px 2px rgba(0, 0, 0, .4), 0 12px 32px rgba(0, 0, 0, .45);
  }
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --page: #0d0d0d;
  --surface: #1a1a19;
  --sunken: #242422;
  --ink: #f0efec;
  --ink-2: #c3c2b7;
  --ink-3: #a3a199;
  --mark: #8f8d86;
  --line: rgba(255, 255, 255, .09);
  --line-2: rgba(255, 255, 255, .18);
  --grid: #2c2c2a;
  --axis: #3d3d3a;
  --accent: #3987e5;
  --accent-ink: #86b6ef;
  --accent-wash: rgba(57, 135, 229, .16);
  --pos: #2fb72f;
  --warn: #f3c04f;
  --warn-wash: rgba(250, 178, 25, .12);
  --crit: #f08a8a;
  --crit-wash: rgba(208, 59, 59, .16);
  --s1: #3987e5; --s2: #d95926; --s3: #199e70; --s4: #c98500; --s5: #d55181; --s6: #0ca30c;
  --s-other: #5c5b56;
  --track: #184f95;
  --shadow: 0 1px 2px rgba(0, 0, 0, .4), 0 12px 32px rgba(0, 0, 0, .45);
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--page);
  color: var(--ink);
  font: 15px/1.45 var(--font);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
button, input, select, textarea { font: inherit; color: inherit; }
a { color: inherit; text-decoration: none; }
h1, h2, h3, p { margin: 0; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 6px; }
[hidden] { display: none !important; }

/* ---- frame ------------------------------------------------------------ */

.app { min-height: 100vh; min-height: 100dvh; }
.side { display: none; }
.main { padding: 0 16px calc(84px + env(safe-area-inset-bottom)); max-width: 1180px; margin: 0 auto; }

.brand { display: flex; align-items: center; gap: 10px; font-weight: 650; letter-spacing: -.01em; }
.brand i {
  width: 26px; height: 26px; border-radius: 8px; background: var(--ink); color: var(--page);
  display: grid; place-items: center; font-style: normal; font-size: 13px; font-weight: 700;
}

.top {
  position: sticky; top: 0; z-index: 20; margin: 0 -16px; padding: 14px 16px 10px;
  background: color-mix(in srgb, var(--page) 88%, transparent);
  backdrop-filter: saturate(1.4) blur(14px); -webkit-backdrop-filter: saturate(1.4) blur(14px);
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
}
.top h1 { font-size: 20px; font-weight: 650; letter-spacing: -.02em; }
.top .tools { display: flex; align-items: center; gap: 8px; }

.sync {
  display: inline-flex; align-items: center; gap: 7px; height: 34px; padding: 0 12px;
  border-radius: 999px; background: var(--surface); border: 1px solid var(--line);
  font-size: 13px; color: var(--ink-2); white-space: nowrap;
}
.sync::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: #0ca30c; }
.sync.stale::before { background: var(--warn-mark); }
.sync.none::before { background: var(--mark); }
.icon-btn {
  width: 34px; height: 34px; border-radius: 999px; border: 1px solid var(--line);
  background: var(--surface); display: grid; place-items: center; cursor: pointer; color: var(--ink-2);
}
.icon-btn svg { width: 17px; height: 17px; }

.tabs {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 30;
  display: grid; grid-template-columns: repeat(5, 1fr);
  padding: 6px 6px calc(6px + env(safe-area-inset-bottom));
  background: color-mix(in srgb, var(--surface) 92%, transparent);
  backdrop-filter: blur(16px); -webkit-backdrop-filter: blur(16px);
  border-top: 1px solid var(--line);
}
.tabs a {
  display: grid; justify-items: center; gap: 3px; padding: 7px 2px 5px; border-radius: 12px;
  font-size: 12px; font-weight: 550; color: var(--ink-3);
}
.tabs a svg { width: 22px; height: 22px; }
.tabs a.on { color: var(--accent-ink); }

/* ---- type & primitives ------------------------------------------------- */

.eyebrow { font-size: 13px; font-weight: 550; color: var(--ink-2); }
.muted { color: var(--ink-3); }
.sub { font-size: 13px; color: var(--ink-3); }
.num { font-variant-numeric: tabular-nums; }
.money { white-space: nowrap; }
.money .cur { font-size: .62em; font-weight: 500; color: var(--ink-3); margin-right: .28em; letter-spacing: 0; }
.money .cur.neg { color: var(--ink-2); }
.money .cents { font-size: .62em; font-weight: 500; color: var(--ink-3); }
.money.plain .cur, .money.plain .cents { font-size: 1em; font-weight: inherit; color: inherit; margin-right: .2em; }
.money.plain .cents { margin: 0; }
.pos { color: var(--pos); }
.crit { color: var(--crit); }

.section { margin-top: 28px; }
.section > header { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; margin-bottom: 12px; }
.section > header h2 { font-size: 16px; font-weight: 650; letter-spacing: -.01em; }
.section > header a, .link { font-size: 14px; font-weight: 550; color: var(--accent-ink); cursor: pointer; }
.section > header a { display: inline-flex; align-items: center; min-height: 32px; margin: -6px 0; }
.section > header .sub { text-align: right; }
.section > header.stack { display: block; }
.section > header.stack .tags { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }

.card {
  background: var(--surface); border: 1px solid var(--line); border-radius: 18px; padding: 18px;
}
.card.flush { padding: 4px 0; }
.card.flush > .pad { padding: 14px 18px; }
.grid { display: grid; gap: 14px; }

.hero { padding: 6px 2px 0; }
.hero .figure { font-size: 42px; line-height: 1.08; font-weight: 650; letter-spacing: -.035em; margin-top: 6px; }
.hero .delta { margin-top: 8px; font-size: 14px; color: var(--ink-2); display: flex; flex-wrap: wrap; gap: 6px 10px; align-items: center; }

.stats { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.stat { background: var(--surface); border: 1px solid var(--line); border-radius: 16px; padding: 14px 15px; min-width: 0; }
.stat .v { font-size: 22px; font-weight: 650; letter-spacing: -.025em; margin-top: 5px; line-height: 1.15; }
.stat .s { font-size: 13px; color: var(--ink-3); margin-top: 5px; }
.stat.wide { grid-column: 1 / -1; }

.pill {
  display: inline-flex; align-items: center; gap: 5px; height: 22px; padding: 0 8px; border-radius: 999px;
  font-size: 12px; font-weight: 600; background: var(--sunken); color: var(--ink-2); white-space: nowrap;
}
.pill.accent { background: var(--accent-wash); color: var(--accent-ink); }
.pill.warn { background: var(--warn-wash); color: var(--warn); }
.pill.crit { background: var(--crit-wash); color: var(--crit); }
.pill.pos { background: color-mix(in srgb, var(--pos) 12%, transparent); color: var(--pos); }
.delta-chip { font-weight: 600; font-variant-numeric: tabular-nums; }

/* ---- rows --------------------------------------------------------------- */

.rows { list-style: none; margin: 0; padding: 0; }
.row {
  display: grid; grid-template-columns: 38px minmax(0, 1fr) auto; gap: 12px; align-items: center;
  padding: 12px 18px; position: relative;
}
.row + .row::before, .day + .row::before {
  content: ""; position: absolute; left: 68px; right: 18px; top: 0; border-top: 1px solid var(--line);
}
.day + .row::before { display: none; }
button.row { width: 100%; text-align: left; background: none; border: 0; cursor: pointer; }
button.row:hover { background: color-mix(in srgb, var(--ink) 3%, transparent); }
.av {
  width: 38px; height: 38px; border-radius: 12px; background: var(--sunken); color: var(--ink-2);
  display: grid; place-items: center;
}
.av svg { width: 19px; height: 19px; }
.av.in { background: color-mix(in srgb, var(--pos) 11%, transparent); color: var(--pos); }
.row .t { font-weight: 550; overflow-wrap: anywhere; }
.row .m { font-size: 13px; color: var(--ink-3); overflow-wrap: anywhere; margin-top: 1px; }
.row .a { text-align: right; font-weight: 600; font-variant-numeric: tabular-nums; white-space: nowrap; }
.row .a small { display: block; font-size: 12px; font-weight: 450; color: var(--ink-3); margin-top: 1px; }
.row .more { grid-column: 2 / -1; font-size: 13px; color: var(--ink-2); padding: 2px 0 4px; display: grid; gap: 3px; }
.row .more b { font-weight: 550; color: var(--ink-3); margin-right: 6px; }
.day {
  display: flex; justify-content: space-between; align-items: baseline; padding: 14px 18px 4px;
  font-size: 13px; font-weight: 600; color: var(--ink-3);
}
.day:not(:first-child) { border-top: 1px solid var(--line); margin-top: 4px; }

/* ---- ranked bars (a breakdown by category: one hue, sorted, never a donut) -- */

.bars { display: grid; gap: 2px; }
.bar {
  display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 4px 12px; align-items: baseline;
  padding: 9px 0; width: 100%; background: none; border: 0; text-align: left; cursor: default;
}
button.bar { cursor: pointer; border-radius: 10px; }
button.bar:hover .bar-name { color: var(--accent-ink); }
.bar-name { font-weight: 550; overflow-wrap: anywhere; }
.bar-name small { font-weight: 450; color: var(--ink-3); font-size: 13px; margin-left: 6px; }
.bar-val { font-weight: 600; font-variant-numeric: tabular-nums; white-space: nowrap; align-self: start; }
.bar-val small { font-weight: 450; color: var(--ink-3); font-size: 13px; margin-left: 8px; display: inline-block; min-width: 3.1em; text-align: right; }
.bar-track { grid-column: 1 / -1; height: 8px; border-radius: 999px; background: var(--sunken); overflow: hidden; }
.bar-fill { height: 100%; border-radius: 999px; background: var(--s1); min-width: 3px; }
.bar.on .bar-name { color: var(--accent-ink); }
.bar .bar-note { grid-column: 1 / -1; font-size: 13px; color: var(--ink-3); }
.sub-bars { margin: 2px 0 10px; padding: 4px 0 4px 14px; border-left: 2px solid var(--line-2); }
.sub-bars .bar { padding: 6px 0; }
.sub-bars .bar-name { font-weight: 450; font-size: 14px; }
.sub-bars .bar-val { font-weight: 550; font-size: 14px; }
.sub-bars .bar-track { height: 4px; }
.sub-bars .bar-fill { background: var(--mark); }

.meter { height: 8px; border-radius: 999px; background: var(--track); overflow: hidden; }
.meter > i { display: block; height: 100%; border-radius: 999px; background: var(--s1); }
.meter.hot > i { background: var(--warn-mark); }
.meter.hot { background: var(--warn-wash); }

.split { display: flex; height: 10px; gap: 2px; border-radius: 999px; overflow: hidden; }
.split > i { display: block; height: 100%; min-width: 4px; }
.legend { display: flex; flex-wrap: wrap; gap: 6px 16px; font-size: 13px; color: var(--ink-2); }
.legend span { display: inline-flex; align-items: center; gap: 6px; }
.legend i { width: 10px; height: 10px; border-radius: 3px; display: inline-block; }
.legend i.line { height: 2px; width: 14px; border-radius: 2px; }

/* ---- controls ----------------------------------------------------------- */

.filters { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin: 4px 0 14px; }
.field {
  height: 38px; border-radius: 12px; border: 1px solid var(--line-2); background: var(--surface);
  padding: 0 12px; min-width: 0;
}
select.field { padding-right: 30px; appearance: none; -webkit-appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath d='M2.5 4.5 6 8l3.5-3.5' fill='none' stroke='%2385837d' stroke-width='1.6' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 10px center; }
.search { flex: 1 1 200px; }
.filter-set { display: flex; gap: 8px; min-width: 0; }
.filter-set .field { flex: 0 0 auto; }
.seg { display: inline-flex; padding: 3px; border-radius: 12px; background: var(--sunken); gap: 2px; max-width: 100%; overflow-x: auto; scrollbar-width: none; }
.seg::-webkit-scrollbar { display: none; }
.seg button {
  height: 32px; padding: 0 13px; border: 0; border-radius: 9px; background: none; cursor: pointer;
  font-size: 14px; font-weight: 550; color: var(--ink-2); white-space: nowrap;
}
.seg button.on { background: var(--surface); color: var(--ink); box-shadow: 0 1px 2px rgba(0, 0, 0, .10); }
.btn {
  height: 38px; padding: 0 16px; border-radius: 12px; border: 1px solid var(--line-2); background: var(--surface);
  font-weight: 550; cursor: pointer;
}
.btn.quiet { border-color: transparent; background: none; color: var(--accent-ink); }
.stepper { display: inline-flex; align-items: center; gap: 4px; }
.stepper .icon-btn { width: 34px; height: 34px; }
.stepper b { min-width: 9.5em; text-align: center; font-weight: 650; letter-spacing: -.01em; font-size: 16px; }

/* ---- a sideways strip of like items (periods, statements, steps) ---------- */

.strip { display: flex; gap: 8px; overflow-x: auto; padding: 2px 16px 6px; margin: 0 -16px; scrollbar-width: none; scroll-snap-type: x proximity; }
.strip::-webkit-scrollbar { display: none; }
.strip-item {
  flex: 0 0 auto; min-width: 124px; text-align: left; padding: 12px 13px; border-radius: 14px; cursor: pointer;
  border: 1px solid var(--line); background: var(--surface); scroll-snap-align: start;
}
.strip-item.on { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent); }
.strip-item b { display: block; font-weight: 600; font-size: 14px; }
.strip-item span.v { display: block; font-weight: 650; font-variant-numeric: tabular-nums; margin: 3px 0 6px; letter-spacing: -.01em; }

/* ---- charts -------------------------------------------------------------- */

.chart { position: relative; }
.chart.fill { min-height: 200px; }
.chart svg { display: block; width: 100%; touch-action: pan-y; overflow: visible; }
.chart text { font: 12px var(--font); fill: var(--ink-3); font-variant-numeric: tabular-nums; }
.chart .lbl { fill: var(--ink-2); font-weight: 600; }
.chart .gridline { stroke: var(--grid); stroke-width: 1; }
.chart .baseline { stroke: var(--axis); stroke-width: 1; }
.chart .cross { stroke: var(--axis); stroke-width: 1; }
.tip {
  position: fixed; z-index: 60; pointer-events: none; min-width: 150px; max-width: 260px;
  background: var(--surface); border: 1px solid var(--line-2); border-radius: 12px; padding: 9px 12px;
  box-shadow: var(--shadow); font-size: 13px;
}
.tip h4 { margin: 0 0 5px; font-size: 12px; font-weight: 550; color: var(--ink-3); }
.tip div { display: flex; align-items: center; gap: 7px; justify-content: space-between; padding: 1px 0; }
.tip div i { width: 12px; height: 2px; border-radius: 2px; flex: 0 0 auto; }
.tip div span { color: var(--ink-2); flex: 1; }
.tip div b { font-weight: 650; font-variant-numeric: tabular-nums; }

details.table-view { margin-top: 10px; }
details.table-view summary { font-size: 13px; color: var(--ink-3); cursor: pointer; list-style: none; display: inline-flex; gap: 6px; align-items: center; min-height: 32px; }
details.table-view summary::-webkit-details-marker { display: none; }
details.table-view summary::before { content: "›"; display: inline-block; transition: transform .15s; }
details.table-view[open] summary::before { transform: rotate(90deg); }

.tbl { width: 100%; border-collapse: collapse; font-size: 14px; }
.tbl th { text-align: left; font-size: 12px; font-weight: 550; color: var(--ink-3); padding: 8px 10px 8px 0; border-bottom: 1px solid var(--line-2); white-space: nowrap; }
.tbl td { padding: 10px 10px 10px 0; border-bottom: 1px solid var(--line); vertical-align: baseline; }
.tbl tr:last-child td { border-bottom: 0; }
.tbl .r { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; padding-right: 0; }
.tbl th.r { padding-right: 0; }
.tbl td .sub { display: block; }
.scroll-x { overflow-x: auto; margin: 0 -18px; padding: 0 18px; }

/* ---- notices ------------------------------------------------------------- */

.notice {
  display: grid; grid-template-columns: auto minmax(0, 1fr) auto; gap: 12px; align-items: center;
  padding: 12px 16px; border-radius: 16px; background: var(--surface); color: var(--ink);
  border: 1px solid var(--line); max-width: 560px;
}
.notice .mark {
  width: 34px; height: 34px; border-radius: 12px; display: grid; place-items: center;
  background: var(--warn-wash); color: var(--warn);
}
.notice svg { width: 18px; height: 18px; }
.notice b { font-weight: 600; }
.notice .link { display: inline-flex; align-items: center; min-height: 32px; }
.notice .sub { color: var(--ink-2); }
.item { padding: 16px 18px; display: grid; gap: 6px; }
.item + .item { border-top: 1px solid var(--line); }
.item h3 { font-size: 15px; font-weight: 600; display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.item p { color: var(--ink-2); font-size: 14px; max-width: 68ch; }
.kv { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 8px 16px; font-size: 14px; }
.kv dt { color: var(--ink-2); }
.kv dd { margin: 0; text-align: right; font-weight: 600; font-variant-numeric: tabular-nums; }
.kv .total { border-top: 1px solid var(--line-2); padding-top: 8px; }

.empty { padding: 34px 18px; text-align: center; color: var(--ink-3); }
.empty b { display: block; color: var(--ink); font-weight: 600; margin-bottom: 4px; }
.err { padding: 34px 18px; text-align: center; }
.sk { border-radius: 10px; background: linear-gradient(90deg, var(--sunken) 25%, color-mix(in srgb, var(--sunken) 55%, var(--surface)) 50%, var(--sunken) 75%); background-size: 200% 100%; animation: sk 1.2s linear infinite; }
@keyframes sk { to { background-position: -200% 0; } }
.stale-frame { opacity: .55; transition: opacity .12s; }
.foot { margin: 36px 2px 0; font-size: 13px; color: var(--ink-3); display: flex; flex-wrap: wrap; gap: 6px 16px; max-width: 76ch; }
.foot a { color: var(--ink-2); text-decoration: underline; text-underline-offset: 2px; display: inline-flex; align-items: center; min-height: 32px; margin: -6px 0; }

/* ---- wide screens -------------------------------------------------------- */

@media (min-width: 720px) {
  .stats { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .stat.wide { grid-column: auto; }
  .hero .figure { font-size: 52px; }
  .cols { display: grid; grid-template-columns: minmax(0, 1.15fr) minmax(0, 1fr); column-gap: 22px; row-gap: 0; align-items: start; }
  .cols.even { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
  .cols > .section { margin-top: 28px; }
  .cols.stretch { align-items: stretch; }
  .cols.stretch > .section { display: flex; flex-direction: column; }
  .cols.stretch > .section > .card { flex: 1; display: flex; flex-direction: column; }
  .cols.stretch .chart.fill { flex: 1; }
}

@media (min-width: 980px) {
  .app { display: grid; grid-template-columns: 232px minmax(0, 1fr); }
  .side {
    display: flex; flex-direction: column; gap: 4px; position: sticky; top: 0; height: 100vh; padding: 22px 14px;
    border-right: 1px solid var(--line);
  }
  .side .brand { padding: 4px 10px 22px; font-size: 16px; }
  .side nav { display: grid; gap: 2px; }
  .side nav a {
    display: flex; align-items: center; gap: 12px; height: 40px; padding: 0 12px; border-radius: 12px;
    font-weight: 550; color: var(--ink-2);
  }
  .side nav a svg { width: 19px; height: 19px; }
  .side nav a:hover { background: color-mix(in srgb, var(--ink) 4%, transparent); }
  .side nav a.on { background: var(--accent-wash); color: var(--accent-ink); }
  .side nav a .count { margin-left: auto; }
  .side .bottom { margin-top: auto; display: grid; gap: 10px; padding: 0 10px; font-size: 13px; color: var(--ink-3); }
  .tabs { display: none; }
  .main { padding: 0 40px 64px; margin: 0; max-width: 1220px; width: 100%; }
  .top { margin: 0 -40px; padding: 22px 40px 14px; }
  .top h1 { font-size: 24px; }
  .top .brand { display: none; }
  .hero .figure { font-size: 56px; }
  .row { padding: 12px 20px; }
  .strip { margin: 0; padding: 2px 0 6px; }
  .sticky { position: sticky; top: 86px; }
  .narrow-read { max-width: 780px; }
}

@media (max-width: 719px) {
  .filters .search { flex-basis: 100%; }
  .filter-set { flex-basis: 100%; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .filter-set .field { font-size: 14px; padding: 0 26px 0 10px; background-position: right 8px center; width: 100%; }
  .stats.three { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
  .stats.three .stat { padding: 11px 12px; border-radius: 14px; }
  .stats.three .stat .v { font-size: 16px; }
  .stats.three .eyebrow { font-size: 12px; }
  .tbl { font-size: 13px; }
  .filters .seg { flex: 1 1 100%; }
  .filters .seg button { flex: 1; padding: 0 6px; }
}
@media (max-width: 979px) { .only-wide { display: none !important; } }
@media (min-width: 980px) { .only-narrow { display: none !important; } }
@media (prefers-reduced-motion: reduce) { * { animation: none !important; transition: none !important; } }
@media print { .tabs, .side, .top .tools { display: none !important; } body { background: #fff; } }

/* ---- reading pages (a report, a write-up): see report.html ---------------- */

.report {
  --font-display: "Iowan Old Style", "Palatino Linotype", Palatino, "Book Antiqua", Georgia, serif;
  max-width: 1120px; margin: 0 auto; padding: 0 20px 72px;
}
.report .masthead {
  display: flex; flex-wrap: wrap; justify-content: space-between; gap: 4px 16px; padding: 18px 0 14px;
  border-bottom: 1px solid var(--line-2); font-size: 13px; color: var(--ink-2);
}
.report .masthead b { color: var(--ink); font-weight: 650; }
/* The first screen: the result and what it rests on, with the chart that carries the argument beside it. */
.report .lead { display: grid; gap: 22px 40px; padding: 26px 0 8px; align-items: start; }
.report .lead .figure { font-family: var(--font-display); font-size: 54px; line-height: 1; font-weight: 600; letter-spacing: -.02em; }
.report .lead .figure small { font-size: .32em; font-weight: 500; color: var(--ink-3); letter-spacing: 0; margin-left: .3em; }
.report .lead .claim { font-family: var(--font-display); font-size: 19px; line-height: 1.4; margin-top: 12px; max-width: 32ch; }
.report .lead .basis { font-size: 13px; color: var(--ink-2); margin-top: 10px; max-width: 46ch; }
.report .facts { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0; margin-top: 18px; border-top: 1px solid var(--line); }
.report .facts > div { padding: 12px 14px 12px 0; border-bottom: 1px solid var(--line); }
.report .facts > div:nth-child(even) { padding-left: 14px; border-left: 1px solid var(--line); }
.report .facts b { display: block; font-size: 18px; font-weight: 650; letter-spacing: -.01em; font-variant-numeric: tabular-nums; }
.report .facts span { font-size: 13px; color: var(--ink-2); }
.report h2 { font-family: var(--font-display); font-size: 24px; font-weight: 600; letter-spacing: -.01em; margin: 44px 0 6px; padding-top: 22px; border-top: 1px solid var(--line-2); }
.report h3 { font-size: 15px; font-weight: 650; margin: 0 0 4px; }
.report .two { display: grid; gap: 24px 40px; align-items: start; margin-top: 16px; }
.prose { max-width: 68ch; color: var(--ink-2); }
.prose + .prose { margin-top: 10px; }
.callout { border-left: 3px solid var(--line-2); padding: 2px 0 2px 14px; color: var(--ink-2); max-width: 68ch; }
.callout b { color: var(--ink); font-weight: 600; }
.caption { font-size: 13px; color: var(--ink-3); margin-top: 8px; max-width: 76ch; }
@media (min-width: 860px) {
  .report { padding: 0 40px 96px; }
  .report .lead { grid-template-columns: minmax(0, 5fr) minmax(0, 7fr); padding-top: 34px; }
  .report .lead .figure { font-size: 84px; }
  .report .two { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
}
@media print { .report { max-width: none; padding: 0; } .report h2 { break-after: avoid; } }
