/* Layout: masthead, one row of section links, a page of title + data. Register: county casework software. */
:root {
  --bg: #ffffff; --bg-2: #f3f4f6; --bg-3: #e8eaee; --fg: #1c1e24; --fg-2: #4e5564; --rule: #c9cdd4; --rule-2: #e2e5ea;
  --link: #174a8c; --focus: #174a8c; --mark: #1c1e24; --demo-bg: #f6efd6; --demo-rule: #8a7a3a; --demo-fg: #3e3613;
  --font: system-ui, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif; --mono: ui-monospace, Menlo, Consolas, monospace;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) { --bg: #16181d; --bg-2: #1f2229; --bg-3: #2a2e37; --fg: #e8eaee; --fg-2: #aab0bc; --rule: #3c414c; --rule-2: #2c3039; --link: #8fb4e8; --focus: #8fb4e8; --mark: #e8eaee; --demo-bg: #2c2810; --demo-rule: #a89750; --demo-fg: #eadfae; color-scheme: dark; }
}
:root[data-theme="dark"] { --bg: #16181d; --bg-2: #1f2229; --bg-3: #2a2e37; --fg: #e8eaee; --fg-2: #aab0bc; --rule: #3c414c; --rule-2: #2c3039; --link: #8fb4e8; --focus: #8fb4e8; --mark: #e8eaee; --demo-bg: #2c2810; --demo-rule: #a89750; --demo-fg: #eadfae; color-scheme: dark; }

* { box-sizing: border-box; }
html, body { margin: 0; }
body { background: var(--bg); color: var(--fg); font: 14px/1.45 var(--font); padding-bottom: 72px; }
a { color: var(--link); }
a:focus-visible, button:focus-visible, select:focus-visible, input:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }
h1, h2, h3 { margin: 0; font-weight: 600; text-wrap: balance; }
h1 { font-size: 22px; line-height: 1.2; }
h2 { font-size: 16px; line-height: 1.3; margin-top: 28px; padding-bottom: 6px; border-bottom: 1px solid var(--rule); }
h3 { font-size: 14px; }
p { margin: 0; }
.num, td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; }
.mono { font-family: var(--mono); font-size: 13px; }
.muted { color: var(--fg-2); }

/* masthead */
.mast { border-bottom: 1px solid var(--rule); background: var(--bg-2); }
.mast .in { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: 6px 24px; padding: 10px 24px 8px; }
.mast .brand { display: flex; flex-wrap: wrap; align-items: baseline; gap: 14px; }
.mast .mark { font-weight: 800; letter-spacing: 0.04em; font-size: 15px; color: var(--fg); text-decoration: none; }
.mast .program { font-size: 16px; font-weight: 600; }
.mast .who { color: var(--fg-2); font-size: 13px; }
.mast .who b { color: var(--fg); font-weight: 600; }
nav.sections { display: flex; flex-wrap: wrap; gap: 0 4px; padding: 0 16px; border-bottom: 1px solid var(--rule); }
nav.sections a { display: block; padding: 8px 8px 7px; color: var(--fg); text-decoration: none; border-bottom: 3px solid transparent; margin-bottom: -1px; }
nav.sections a:hover { background: var(--bg-2); }
nav.sections a[aria-current="page"] { border-bottom-color: var(--mark); font-weight: 600; }

/* page */
main { padding: 18px 24px 24px; max-width: 1480px; }
.page-head { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: 8px 24px; }
.facts { color: var(--fg-2); margin-top: 2px; font-variant-numeric: tabular-nums; }
.facts b { color: var(--fg); font-weight: 600; }
.flash { margin-top: 12px; padding: 8px 12px; border: 1px solid var(--rule); background: var(--bg-2); }
.flash.error { border-color: var(--fg); }
.crumbs { font-size: 13px; color: var(--fg-2); margin-bottom: 6px; }
.crumbs a { color: var(--link); }

/* facts list on a record */
dl.rec { display: grid; grid-template-columns: max-content minmax(0, 1fr); gap: 4px 18px; margin: 14px 0 0; align-content: start; }
dl.rec dt { color: var(--fg-2); }
dl.rec dd { margin: 0; min-width: 0; }
.two { display: grid; grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); gap: 0 48px; }
.two > * { min-width: 0; }

/* actions */
.actions { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 10px; margin-top: 14px; }
button, .btn { font: inherit; color: var(--fg); background: var(--bg); border: 1px solid var(--fg); border-radius: 3px; padding: 5px 12px; cursor: pointer; min-height: 32px; }
button:hover { background: var(--bg-2); }
button.primary { background: var(--fg); color: var(--bg); }
button.primary:hover { background: var(--fg-2); border-color: var(--fg-2); }
button.small { padding: 2px 8px; min-height: 26px; font-size: 13px; }
button[disabled] { opacity: 0.5; cursor: default; }
select, input[type="search"], input[type="text"], input[type="number"] { font: inherit; color: var(--fg); background: var(--bg); border: 1px solid var(--rule); border-radius: 3px; padding: 5px 8px; min-height: 32px; }
label.ctl { display: inline-flex; align-items: center; gap: 6px; color: var(--fg-2); }

/* tables */
.tbl-tools { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px 16px; margin: 14px 0 8px; }
.tbl-filters { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 12px; }
.tbl-wrap { overflow-x: auto; border: 1px solid var(--rule); }
table.data { border-collapse: collapse; width: 100%; min-width: 640px; }
table.data th, table.data td { text-align: left; padding: 6px 10px; border-bottom: 1px solid var(--rule-2); vertical-align: top; }
table.data th { background: var(--bg-2); font-weight: 600; white-space: nowrap; position: sticky; top: 0; }
table.data th button.sort { all: unset; cursor: pointer; display: inline-block; padding-right: 14px; position: relative; font: inherit; color: inherit; }
table.data th button.sort::after { content: ""; position: absolute; right: 2px; top: 50%; width: 0; height: 0; border: 4px solid transparent; transform: translateY(-50%); }
table.data th[aria-sort="ascending"] button.sort::after { border-bottom-color: var(--fg); transform: translateY(-80%); }
table.data th[aria-sort="descending"] button.sort::after { border-top-color: var(--fg); transform: translateY(-20%); }
table.data tbody tr:hover { background: var(--bg-2); }
table.data tbody tr.link { cursor: pointer; }
table.data td.nowrap, table.data th.nowrap { white-space: nowrap; }
table.data td.wrap { min-width: 200px; max-width: 420px; }
table.data tr.total td { font-weight: 600; border-top: 2px solid var(--rule); }
table.data td.empty { color: var(--fg-2); text-align: center; padding: 18px; }
.tbl-foot { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px 16px; margin-top: 8px; color: var(--fg-2); font-variant-numeric: tabular-nums; }
.tbl-foot .pager { display: flex; gap: 6px; }

/* compare two records side by side */
table.compare td.diff { font-weight: 600; }

/* definitions */
.defs dt { font-weight: 600; margin-top: 16px; }
.defs dd { margin: 4px 0 0; max-width: 72ch; }
.defs dd + dd { margin-top: 6px; }
.defs code { font-family: var(--mono); font-size: 13px; }

/* timeline */
ol.timeline { list-style: none; margin: 10px 0 0; padding: 0; }
ol.timeline li { display: grid; grid-template-columns: 110px minmax(0, 1fr); gap: 0 14px; padding: 4px 0; border-bottom: 1px solid var(--rule-2); }
ol.timeline li .d { color: var(--fg-2); white-space: nowrap; }

/* the demo strip: not the product */
.demo { position: fixed; left: 0; right: 0; bottom: 0; z-index: 10; background: var(--demo-bg); color: var(--demo-fg); border-top: 2px dashed var(--demo-rule); font-family: var(--mono); font-size: 13px; padding: 8px 24px; padding-bottom: calc(8px + env(safe-area-inset-bottom, 0px)); display: flex; flex-wrap: wrap; align-items: center; gap: 8px 18px; }
.demo .lbl { font-weight: 700; letter-spacing: 0.04em; }
.demo button { font-family: var(--mono); font-size: 13px; color: var(--demo-fg); border-color: var(--demo-rule); background: transparent; min-height: 28px; padding: 3px 10px; }
.demo button:hover { background: rgba(0,0,0,0.06); }
.demo .keys { margin-left: auto; opacity: 0.85; }
.demo .busy { font-style: normal; }

@media (max-width: 720px) {
  .mast .in, main, .demo { padding-left: 16px; padding-right: 16px; }
  dl.rec { grid-template-columns: 1fr; gap: 0; }
  dl.rec dd { margin-bottom: 6px; }
  ol.timeline li { grid-template-columns: 1fr; }
  .demo .keys { display: none; }
}
@media (prefers-reduced-motion: reduce) { * { transition: none !important; } }

/* dashboards: a list of named dashboards, each one figure and one sentence */
.dash { display: grid; grid-template-columns: 220px minmax(0, 1fr); gap: 0 32px; align-items: start; }
.dash-list h2 { margin-top: 2px; font-size: 13px; color: var(--fg-2); font-weight: 600; border-bottom: 1px solid var(--rule); padding-bottom: 6px; }
.dash-list ol { list-style: none; margin: 4px 0 0; padding: 0; }
.dash-list li a { display: block; padding: 5px 8px; color: var(--fg); text-decoration: none; border-left: 3px solid transparent; }
.dash-list li a:hover { background: var(--bg-2); }
.dash-list li a[aria-current="page"] { border-left-color: var(--mark); font-weight: 600; background: var(--bg-2); }
.dash-main { min-width: 0; }
.sentence { max-width: 72ch; margin-top: 4px; }
.dash-filters { margin-top: 12px; }
.kpis { display: flex; flex-wrap: wrap; gap: 10px 36px; margin: 18px 0 6px; padding: 10px 0 14px; border-top: 1px solid var(--rule); border-bottom: 1px solid var(--rule); }
.kpi { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.kpi .n { font-size: 26px; line-height: 1.1; font-weight: 600; font-variant-numeric: tabular-nums; }
.kpi .l { color: var(--fg-2); font-size: 13px; }
.fig { margin: 14px 0 6px; }
.fig figcaption { font-size: 13px; color: var(--fg-2); margin-bottom: 4px; }
.chart svg { width: 100%; height: auto; max-width: 900px; display: block; }
.chart .grid { stroke: var(--rule-2); stroke-width: 1; }
.chart .tick { fill: var(--fg-2); font-size: 11px; font-family: var(--font); }
.chart .bar.s0, .chart .dot.s0 { fill: var(--fg); }
.chart .bar.s1, .chart .dot.s1 { fill: var(--fg-2); opacity: 0.55; }
.chart .bar.s2, .chart .dot.s2 { fill: none; stroke: var(--fg); stroke-width: 1; }
.chart .line { fill: none; stroke: var(--fg); stroke-width: 1.5; }
.chart .line.s1 { stroke: var(--fg-2); stroke-dasharray: 4 3; }
.legend { display: flex; flex-wrap: wrap; gap: 4px 16px; font-size: 13px; color: var(--fg-2); margin-bottom: 4px; }
.legend .lg::before { content: ""; display: inline-block; width: 10px; height: 10px; margin-right: 6px; vertical-align: -1px; background: var(--fg); }
.legend .lg.s1::before { background: var(--fg-2); opacity: 0.55; }
.legend .lg.s2::before { background: transparent; border: 1px solid var(--fg); width: 8px; height: 8px; }
.tabs { display: flex; gap: 2px; margin-top: 16px; border-bottom: 1px solid var(--rule); }
.tabs button { border: 1px solid var(--rule); border-bottom: 0; border-radius: 3px 3px 0 0; background: var(--bg-2); color: var(--fg); padding: 6px 14px; margin-bottom: -1px; }
.tabs button.on { background: var(--bg); border-color: var(--rule); border-bottom: 1px solid var(--bg); font-weight: 600; }
.dash-body .tbl { margin-top: 8px; }
@media (max-width: 860px) {
  .dash { grid-template-columns: 1fr; }
  .dash-list ol { display: flex; flex-wrap: wrap; gap: 2px 4px; }
  .dash-list li a { padding: 4px 8px; border-left: 0; border-bottom: 2px solid transparent; }
  .dash-list li a[aria-current="page"] { border-bottom-color: var(--mark); }
}

/* Keep filters inside the viewport while wide record tables scroll in their own boxes. */
.tbl-filters { min-width: 0; max-width: 100%; }
.ctl { flex-wrap: wrap; min-width: 0; max-width: 100%; }
.ctl select { min-width: 0; max-width: 100%; }
