/* Lead Forward HQ's project site: black and white, with the site's orange only where something asks to be acted on. */
:root {
  --bg: #f4f4f5; --surface: #ffffff; --sunk: #ececee; --fg: #111113; --muted: #5f5f66; --line: #dedee2;
  --accent: #c8500f; --accent-soft: #fdeee4;
  --good: #1d7f55; --warn: #a96b12; --bad: #bb3b28;
  --k-referral: #000000; --k-clinical: #11786f; --k-logistics: #56627a; --k-payer: #7a45a8; --k-message: #7b8496;
  --k-liaison: #a96b12; --k-office: #1d7f55; --k-alert: #bb3b28; --k-drop: #a3564a; --k-milestone: #000000; --k-signing: #1d7f55; --k-setup: #56627a;
  --font-ui: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  --font-data: ui-monospace, "SF Mono", SFMono-Regular, Menlo, Consolas, monospace;
  --r: 10px;
  --brand: #000000;
  --cta: #ff6a1f; --on-cta: #140a04;
  /* One gutter between every card and inside every card, and one width where rows split into two equal halves. */
  --gap: 16px;
  --pad: 16px;
}
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) {
  --bg: #0b0b0c; --surface: #161618; --sunk: #111113; --fg: #ececee; --muted: #9a9aa1; --line: #2a2a2e;
  --accent: #ff8a3d; --accent-soft: #3a2111; --good: #4fc28e; --warn: #e2a64a; --bad: #f07a63;
  --k-referral: #93a2ff; --k-clinical: #4cc3b6; --k-logistics: #9aa6bd; --k-payer: #c193ee; --k-message: #8590a5;
  --k-liaison: #e2a64a; --k-office: #4fc28e; --k-alert: #f07a63; --k-drop: #d28d80; --k-milestone: #93a2ff; --k-signing: #4fc28e; --k-setup: #9aa6bd;
  color-scheme: dark } }
:root[data-theme="dark"] {
  --bg: #0b0b0c; --surface: #161618; --sunk: #111113; --fg: #ececee; --muted: #9a9aa1; --line: #2a2a2e;
  --accent: #ff8a3d; --accent-soft: #3a2111; --good: #4fc28e; --warn: #e2a64a; --bad: #f07a63;
  --k-referral: #93a2ff; --k-clinical: #4cc3b6; --k-logistics: #9aa6bd; --k-payer: #c193ee; --k-message: #8590a5;
  --k-liaison: #e2a64a; --k-office: #4fc28e; --k-alert: #f07a63; --k-drop: #d28d80; --k-milestone: #93a2ff; --k-signing: #4fc28e; --k-setup: #9aa6bd;
  color-scheme: dark }

* { box-sizing: border-box; }
body { background: var(--bg); color: var(--fg); font-family: var(--font-ui); font-size: 14px; line-height: 1.45; }
.wrap { max-width: 1240px; margin: 0 auto; padding-block: 16px 40px; padding-left: max(16px, env(safe-area-inset-left, 0px)); padding-right: max(16px, env(safe-area-inset-right, 0px)); display: grid; gap: var(--gap); }
h1, h2 { margin: 0; text-wrap: balance; }
h1 { font-size: 1.15rem; font-weight: 700; letter-spacing: -0.01em; }
h2 { font-size: 0.72rem; font-weight: 600; text-transform: uppercase; letter-spacing: 0.08em; color: var(--muted); }
.num { font-family: var(--font-data); font-variant-numeric: tabular-nums; }
.panel { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); padding: var(--pad); min-width: 0; }

/* Top bar */
.top { display: grid; gap: 12px var(--gap); grid-template-columns: 1fr; align-items: center; }
.brand small { display: block; color: var(--muted); font-size: 0.8rem; }
/* The clock reserves room for its longest reading ("Sep 30, 2027 12:45 PM Wednesday") so nothing around it moves as dates change. */
.clock { display: flex; align-items: baseline; gap: 10px; white-space: nowrap; }
.clock .date { min-width: 12ch; }
.clock .time { min-width: 8ch; }
.clock .day { min-width: 5.8rem; }
.clock .date { font-family: var(--font-data); font-size: 1.35rem; font-weight: 600; }
.clock .time { font-family: var(--font-data); font-size: 1rem; color: var(--muted); }
.clock .day { font-size: 0.8rem; color: var(--muted); }
.daybar { height: 4px; background: var(--sunk); border-radius: 2px; overflow: hidden; margin-top: 6px; }
.daybar i { display: block; height: 100%; width: 0; background: var(--accent); }
.controls { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.seg { display: inline-flex; border: 1px solid var(--line); border-radius: 8px; overflow: hidden; background: var(--sunk); }
.seg button { border: 0; background: transparent; color: var(--fg); font: 500 0.8rem var(--font-ui); padding: 7px 11px; cursor: pointer; }
.seg button + button { border-left: 1px solid var(--line); }
.seg button[aria-pressed="true"] { background: var(--fg); color: var(--surface); }
.btn { border: 1px solid var(--line); background: var(--surface); color: var(--fg); font: 500 0.8rem var(--font-ui); padding: 7px 11px; border-radius: 8px; cursor: pointer; }
button:focus-visible, select:focus-visible, input:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
@media (min-width: 720px) { .top { grid-template-columns: minmax(0, 1fr) auto; } .top .brand { grid-column: 1 / -1; } }
@media (min-width: 1240px) { .top { grid-template-columns: minmax(0, 1fr) auto auto; } .top .brand { grid-column: auto; } }
@media (max-width: 420px) { .clock .day { display: none; } }

/* Benchmarks */
.kpis { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--gap); }
@media (min-width: 640px) { .kpis { grid-template-columns: repeat(4, minmax(0, 1fr)); } }
@media (min-width: 1100px) { .kpis { grid-template-columns: repeat(8, minmax(0, 1fr)); } }
.kpi { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); padding: 12px var(--pad); display: grid; gap: 2px; min-width: 0; }
.kpi .label { font-size: 0.72rem; color: var(--muted); }
.kpi .value { font-family: var(--font-data); font-variant-numeric: tabular-nums; font-size: 1.2rem; font-weight: 600; }
.kpi .target { font-size: 0.7rem; color: var(--muted); display: flex; align-items: center; gap: 6px; }
.dot { width: 7px; height: 7px; border-radius: 50%; background: var(--line); flex: none; }
.ok .dot { background: var(--good); } .near .dot { background: var(--warn); } .miss .dot { background: var(--bad); }

/* Rows of cards: one column on phones, two equal halves from 960px. Cards never resize with their content. */
.geo, .setup, .mid, .low { display: grid; gap: var(--gap); grid-template-columns: minmax(0, 1fr); align-items: stretch; }
@media (min-width: 960px) { .geo, .setup, .mid { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); } }
/* The metros card takes the map's height and scrolls inside, so the row never grows with the table. */
@media (min-width: 960px) { .geo > .metros { contain: size; display: flex; flex-direction: column; } .geo > .metros .tablebox { flex: 1; min-height: 0; overflow: auto; } }

/* Pipeline and chart */

.pipe { display: grid; gap: 7px; margin-top: 10px; }
.pipe .row { display: grid; grid-template-columns: 112px 1fr 52px; gap: 8px; align-items: center; font-size: 0.8rem; }
.pipe .bar { height: 10px; background: var(--sunk); border-radius: 5px; overflow: hidden; }
.pipe .bar i { display: block; height: 100%; background: var(--accent); border-radius: 5px; transition: width .25s; }
.pipe .row.out .bar i { background: var(--k-drop); }
.pipe .row.done .bar i { background: var(--k-clinical); }
.pipe .n { text-align: right; }
.chart svg { width: 100%; height: auto; display: block; margin-top: 8px; }
.legend { display: flex; gap: 14px; font-size: 0.75rem; color: var(--muted); margin-top: 6px; }
.legend span::before { content: ""; display: inline-block; width: 10px; height: 10px; border-radius: 2px; margin-right: 5px; vertical-align: -1px; background: var(--c); }

/* Setup */

.status { display: inline-flex; align-items: center; gap: 6px; font-size: 0.78rem; font-weight: 600; margin-top: 8px; }
.cap { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px 16px; margin-top: 12px; }
@media (min-width: 520px) { .cap { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
.cap div { display: grid; gap: 1px; min-width: 0; }
.cap span { font-size: 0.7rem; color: var(--muted); }
.cap b { font-family: var(--font-data); font-variant-numeric: tabular-nums; font-size: 1rem; font-weight: 600; }
.payers { display: flex; gap: 14px; flex-wrap: wrap; margin-top: 12px; font-size: 0.78rem; }
.payers span b { font-family: var(--font-data); }
.tasks { list-style: none; padding: 0; margin: 10px 0 0; display: grid; gap: 6px; font-size: 0.8rem; }
.tasks li { display: grid; grid-template-columns: 16px 1fr auto; gap: 8px; align-items: baseline; }
.tasks li time { font-family: var(--font-data); font-size: 0.72rem; color: var(--muted); }
.tasks li .mark { width: 9px; height: 9px; border-radius: 50%; border: 2px solid var(--warn); align-self: center; }
.tasks li.done .mark { border-color: var(--good); background: var(--good); }
.tasks li.done span { color: var(--muted); }
.pipe .row.wait .bar i { background: var(--warn); }
.muted { color: var(--muted); }

/* Feed and metros */

.feedhead { display: flex; justify-content: space-between; align-items: center; gap: 10px; flex-wrap: wrap; }
.filters { display: flex; flex-wrap: wrap; }
.feed { list-style: none; margin: 10px 0 0; padding: 0; display: grid; gap: 0; max-height: 560px; overflow-y: auto; }
.feed li { display: grid; grid-template-columns: 74px 1fr; gap: 10px; padding: 8px 4px; border-top: 1px solid var(--line); font-size: 0.84rem; }
.feed li:first-child { border-top: 0; }
.feed li.click { cursor: pointer; } .feed li.click:hover { background: var(--sunk); }
.feed time { font-family: var(--font-data); font-size: 0.72rem; color: var(--muted); padding-top: 2px; }
.feed .k { font-size: 0.66rem; font-weight: 600; text-transform: uppercase; letter-spacing: 0.07em; color: var(--kc); display: block; }
.feed .alert, .feed .milestone { font-weight: 600; }
.tablebox { overflow-x: auto; margin-top: 10px; }
table { width: 100%; border-collapse: collapse; font-size: 0.8rem; }
th { text-align: left; font-weight: 600; color: var(--muted); font-size: 0.7rem; padding: 6px 6px; border-bottom: 1px solid var(--line); white-space: nowrap; }
td { padding: 7px 6px; border-bottom: 1px solid var(--line); white-space: nowrap; }
td.r, th.r { text-align: right; }
.funnel { display: flex; gap: 2px; height: 8px; width: 90px; }
.funnel i { flex: 1; background: var(--sunk); border-radius: 1px; position: relative; overflow: hidden; }
.funnel i b { position: absolute; inset: 0 auto 0 0; background: var(--accent); }

/* Tables keep set column widths; long names trim with an ellipsis instead of pushing columns around. */
table.fixed { table-layout: fixed; min-width: 520px; }
table.fixed td, table.fixed th { overflow: hidden; text-overflow: ellipsis; }
table.fixed .funnel { width: 100%; max-width: 90px; }
.num, td.r { font-variant-numeric: tabular-nums; }
/* Number cards hold two lines for the label and two for the caption, so the row keeps one height as numbers change. */
.kpi { align-content: start; }
.kpi .label { line-height: 1.3; min-height: calc(2 * 1.3em); }
.kpi .target { line-height: 1.3; min-height: calc(2 * 1.3em); align-items: flex-start; }
.kpi .target .dot { margin-top: 0.35em; }
.kpi .value { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
/* Lists that change while the clock runs hold a set height, so cards below never jump. */
.tasks { height: 15.5rem; overflow-y: auto; align-content: start; }
.feed { height: 560px; }
.payers { min-height: 1.2rem; }
#mapstats { min-height: calc(2 * 1.45em); }

/* Settings */
/* Settings: four equal fields, each a label row, one 38px control and a short hint, all aligned on the same lines. */
details.panel summary { cursor: pointer; font-weight: 600; font-size: 0.85rem; list-style: none; display: flex; align-items: center; justify-content: space-between; gap: var(--gap); }
details.panel summary::-webkit-details-marker { display: none; }
.chev { width: 16px; height: 16px; color: var(--muted); transition: transform .2s; }
details[open] .chev { transform: rotate(180deg); }
.settings { display: grid; gap: var(--gap); grid-template-columns: minmax(0, 1fr); margin-top: var(--gap); }
@media (min-width: 600px) { .settings { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (min-width: 960px) { .settings { grid-template-columns: repeat(4, minmax(0, 1fr)); } }
.field { display: grid; grid-template-rows: auto 38px auto; gap: 8px; align-content: start; min-width: 0; }
.fhead { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; min-height: 1.2rem; }
.fhead label { font-size: 0.78rem; font-weight: 600; color: var(--fg); }
.fhead output { font-family: var(--font-data); font-size: 0.8rem; color: var(--accent); font-weight: 600; }
.ctl { height: 38px; width: 100%; box-sizing: border-box; border: 1px solid var(--line); border-radius: 8px; background: var(--sunk); color: var(--fg); font: 0.85rem var(--font-ui); padding: 0 10px; }
.ctl.num { font-family: var(--font-data); }
.ctl.range { display: flex; align-items: center; padding: 0 12px; }
.ctl.range input { width: 100%; margin: 0; accent-color: var(--accent); }
.hint { margin: 0; font-size: 0.74rem; color: var(--muted); line-height: 1.35; }
.check { display: grid; grid-template-columns: 16px 1fr; gap: 8px; align-items: start; font-size: 0.74rem; color: var(--muted); line-height: 1.35; cursor: pointer; }
.check input { margin: 1px 0 0; width: 16px; height: 16px; accent-color: var(--accent); }
.about { display: grid; gap: 8px; margin-top: var(--gap); padding-top: var(--gap); border-top: 1px solid var(--line); }
.about b { color: var(--fg); font-weight: 600; }
.note { color: var(--muted); font-size: 0.78rem; margin: 0; max-width: 80ch; }

/* Patient drawer */
.drawer { position: fixed; inset: 0; background: color-mix(in srgb, var(--fg) 35%, transparent); display: flex; justify-content: flex-end; z-index: 48; }
.drawer .sheet { background: var(--surface); width: min(440px, 100%); height: 100%; overflow-y: auto; padding: 18px; padding-top: calc(18px + env(safe-area-inset-top, 0px)); padding-right: max(18px, env(safe-area-inset-right, 0px)); padding-bottom: calc(18px + env(safe-area-inset-bottom, 0px)); border-left: 1px solid var(--line); display: grid; gap: 14px; align-content: start; }
.facts { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px 14px; font-size: 0.8rem; }
.facts dt { color: var(--muted); font-size: 0.7rem; } .facts dd { margin: 0; font-weight: 500; }
.tl { list-style: none; padding: 0; margin: 0; display: grid; gap: 10px; }
.tl li { display: grid; grid-template-columns: 92px 1fr; gap: 10px; font-size: 0.82rem; }
.tl time { font-family: var(--font-data); font-size: 0.72rem; color: var(--muted); }
.tl strong { display: block; font-size: 0.72rem; text-transform: uppercase; letter-spacing: 0.06em; color: var(--accent); }
/* Referral map beside the metros */

.maphead { display: flex; justify-content: space-between; align-items: center; gap: 10px; flex-wrap: wrap; }
.mapbox { position: relative; margin-top: 10px; }
.mapbox svg { width: 100%; height: auto; aspect-ratio: 897 / 969; max-height: 78vh; display: block; touch-action: manipulation; background: var(--surface); }
@media (max-width: 640px) { .mapbox svg { aspect-ratio: 3 / 2; } }
.st { fill: var(--sunk); opacity: .55; stroke: var(--line); stroke-width: 1; vector-effect: non-scaling-stroke; stroke-linejoin: round; }
.st.ours { opacity: 1; }
.stname.ours { opacity: .8; }
.stname { fill: var(--muted); opacity: .45; font-family: var(--font-ui); font-weight: 600; letter-spacing: .12em; text-transform: uppercase; }
.cl { cursor: pointer; }
.cl.s0 { fill: var(--muted); opacity: .18; }
.cl.s1 { fill: var(--muted); opacity: .55; }
.cl.s2 { fill: var(--warn); opacity: .9; }
.cl.s3 { fill: var(--accent); opacity: .92; }
.cl.alerted { stroke: var(--bad); stroke-width: 1.5; vector-effect: non-scaling-stroke; }
.cl.picked { stroke: var(--fg); stroke-width: 2; vector-effect: non-scaling-stroke; }
.mlabel { font-family: var(--font-ui); font-weight: 600; fill: var(--fg); paint-order: stroke; stroke: var(--surface); stroke-width: 3px; stroke-linejoin: round; cursor: pointer; }
.mlabel.closed { fill: var(--muted); font-weight: 500; }
.tlabel { font-family: var(--font-ui); fill: var(--muted); paint-order: stroke; stroke: var(--surface); stroke-linejoin: round; pointer-events: none; }
.hub { fill: var(--surface); stroke: var(--fg); stroke-width: 1.6; vector-effect: non-scaling-stroke; }
.hub.planned { stroke: var(--muted); stroke-dasharray: 2 2; }
.lz { fill: var(--k-liaison); stroke: var(--surface); stroke-width: 1; vector-effect: non-scaling-stroke; }
.fx-ring { fill: none; stroke-width: 1.5; vector-effect: non-scaling-stroke; }
.fx-line { fill: none; stroke: var(--k-logistics); stroke-width: 1; stroke-dasharray: 3 3; vector-effect: non-scaling-stroke; }
.tip { position: absolute; pointer-events: none; background: var(--surface); border: 1px solid var(--line); border-radius: 8px; padding: 8px 10px; font-size: 0.78rem; box-shadow: 0 6px 20px color-mix(in srgb, var(--fg) 14%, transparent); max-width: 260px; z-index: 5; }
.tip b { display: block; font-size: 0.84rem; }
.tip span { color: var(--muted); display: block; }
.maplegend { display: flex; flex-wrap: wrap; gap: 6px 14px; font-size: 0.74rem; color: var(--muted); margin-top: 8px; }
.maplegend i { display: inline-block; width: 9px; height: 9px; border-radius: 50%; margin-right: 5px; vertical-align: -1px; background: var(--c); opacity: var(--o, 1); }
.maplegend i.ring { background: none; border: 1.5px solid var(--c); }
.maplegend i.sq { border-radius: 1px; transform: rotate(45deg) scale(.85); }
.mapnote { display: flex; justify-content: space-between; gap: 10px; flex-wrap: wrap; margin-top: 6px; }
tr.tier td { font-size: 0.68rem; font-weight: 600; color: var(--muted); text-transform: uppercase; letter-spacing: 0.07em; padding-top: 12px; }
tr.mrow { cursor: pointer; } tr.mrow:hover td { background: var(--sunk); }
.plist { list-style: none; padding: 0; margin: 0; display: grid; }
.plist li { display: grid; grid-template-columns: 1fr auto; gap: 8px; padding: 7px 4px; border-top: 1px solid var(--line); font-size: 0.82rem; cursor: pointer; }
.plist li:hover { background: var(--sunk); }
.plist li span { color: var(--muted); font-size: 0.74rem; }
@media (prefers-reduced-motion: reduce) { .pipe .bar i { transition: none; } }

/* Dataset page */
.dtop .controls { justify-content: flex-end; }
.seedbox { display: flex; align-items: center; gap: 8px; font-size: 0.78rem; font-weight: 600; }
.seedbox .ctl { width: 96px; height: 34px; }
a.btn { text-decoration: none; display: inline-flex; align-items: center; }
.tabs { justify-self: start; }
.kpis5 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
@media (min-width: 640px) { .kpis5 { grid-template-columns: repeat(4, minmax(0, 1fr)); } }
.kpis5 .label, .kpis5 .target { min-height: 0; }
#building { margin-top: var(--gap); }
.dgrid { display: grid; gap: var(--gap); grid-template-columns: minmax(0, 1fr); margin-top: var(--gap); }
@media (min-width: 960px) { .dgrid { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); } }
.dsec { grid-column: 1 / -1; margin: 8px 0 0; font-size: 0.95rem; font-weight: 700; }
.hist { width: 100%; height: auto; display: block; margin: 8px 0 6px; }
.hist rect[data-tip]:hover + rect, .hist .hbar:hover { opacity: .8; }
.brow { grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr) 56px 52px !important; }
.brow { align-items: start !important; }
.brow > span:first-child { white-space: normal; overflow-wrap: anywhere; line-height: 1.3; }
.brow > .bar { margin-top: 4px; }
/* Phones: each label on its own line above its bar, so it reads in full. */
@media (max-width: 639px) {
  .brow { grid-template-columns: minmax(0, 1fr) 56px 52px !important; row-gap: 4px !important; }
  .brow > span:first-child { grid-column: 1 / -1; }
  .brow > .bar { margin-top: 3px; }
}
.checks { list-style: none; padding: 0; margin: 10px 0 0; display: grid; gap: 0; }
.checks li { display: grid; grid-template-columns: 22px 1fr auto; gap: 10px; align-items: center; padding: 8px 0; border-top: 1px solid var(--line); font-size: 0.84rem; }
.checks li:first-child { border-top: 0; }
.checks .mark { width: 18px; height: 18px; border-radius: 50%; display: grid; place-items: center; font-size: 0.7rem; font-weight: 700; color: var(--surface); background: var(--good); }
.checks li.fail .mark { background: var(--bad); }
.checks li.fail .num { color: var(--bad); font-weight: 600; }
.checks .num { font-size: 0.78rem; color: var(--muted); }
.dfilters { display: grid; gap: 12px; grid-template-columns: repeat(2, minmax(0, 1fr)); }
.dfilters .grow { grid-column: 1 / -1; }
@media (min-width: 640px) { .dfilters { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px var(--gap); } }
@media (min-width: 1100px) { .dfilters { grid-template-columns: minmax(0, 2fr) repeat(4, minmax(0, 1fr)); } .dfilters .grow { grid-column: auto; } }
.fsel { display: grid; gap: 6px; font-size: 0.78rem; font-weight: 600; min-width: 0; }
.tablehead { display: flex; justify-content: space-between; align-items: center; gap: var(--gap); flex-wrap: wrap; margin-top: var(--gap); }
.pager { display: flex; gap: 8px; }
.pager .btn:disabled { opacity: .45; cursor: default; }
.dtable th.sortable { cursor: pointer; user-select: none; }
.dtable th.sortable:hover { color: var(--fg); }
.dbody { display: grid; gap: 18px; }
.csec { display: grid; gap: 8px; }
.codes { list-style: none; padding: 0; margin: 0; display: grid; gap: 6px; font-size: 0.82rem; }
.codes li { display: grid; grid-template-columns: 64px 1fr; gap: 8px; }
.codes li:not(:has(.num)) { grid-template-columns: 1fr; }
.codes .num { color: var(--accent); font-size: 0.76rem; padding-top: 1px; }
.cline { margin: 0; font-size: 0.82rem; }

/* Phones: the numbers read as one compact list (label and caption left, value right, one line each), and the
   controls sit in two even full-width rows. Fixed one-line rows keep the list from moving as numbers change. */
@media (max-width: 639px) {
  .kpis, .kpis5 { grid-template-columns: minmax(0, 1fr); gap: 0; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); overflow: hidden; }
  .kpi { border: 0; border-radius: 0; border-top: 1px solid var(--line); padding: 10px var(--pad); grid-template-columns: minmax(0, 1fr) auto; grid-template-areas: "label value" "target value"; column-gap: 12px; row-gap: 2px; align-items: center; }
  .kpi:first-child { border-top: 0; }
  .kpi .label { grid-area: label; min-height: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-size: 0.8rem; color: var(--fg); font-weight: 500; }
  .kpi .target { grid-area: target; min-height: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; display: block; }
  .kpi .target .dot { display: inline-block; margin: 0 6px 0 0; vertical-align: 1px; }
  .kpi .value { grid-area: value; text-align: right; min-width: 6ch; font-size: 1.1rem; }
  .controls { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 8px; }
  .controls > .btn { grid-column: span 3; }
  .controls > .seg { grid-column: 1 / -1; display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .controls .btn, .controls .seg button { justify-content: center; text-align: center; padding-inline: 4px; }
  .dtop .controls { grid-template-columns: auto minmax(0, 1fr); }
  .dtop .controls > .btn { grid-column: auto; }
  .tabs { justify-self: stretch; display: grid; grid-auto-flow: column; grid-auto-columns: minmax(0, 1fr); }
  .tabs button { padding-inline: 4px; }
}

/* The feed filter: a toggle group where it fits, a dropdown on phones. */
.feedsel { display: none; width: auto; height: 34px; }
@media (max-width: 639px) { .feedhead .filters { display: none; } .feedsel { display: block; } }
/* Nothing inside the page may push it wider than the screen; long dropdown options trim instead. */
.wrap > * { min-width: 0; }
select.ctl { max-width: 100%; min-width: 0; text-overflow: ellipsis; }

/* The data tables size each column to fit its title and what it holds, at every width, and scroll sideways inside
   their card when they are wider than it. Titles never clip; only a long name trims, with an ellipsis. */
table.dtable { table-layout: auto; width: max-content; min-width: 100%; }
table.dtable col { width: auto !important; }
table.dtable th { overflow: visible; text-overflow: clip; padding-inline: 10px; }
table.dtable td { padding-inline: 10px; max-width: 320px; overflow: hidden; text-overflow: ellipsis; }
.tablebox { -webkit-overflow-scrolling: touch; overscroll-behavior-x: contain; }


/* Page head: every page opens with the same eyebrow, large title and lede, below the menu circle. */
.top { padding-top: 0; }
/* The header names the site, so pages carry no eyebrow of their own. */
.top .eyebrow { display: none; }
.eyebrow { font-size: 0.72rem; font-weight: 600; text-transform: uppercase; letter-spacing: 0.1em; color: var(--muted); margin: 0 0 6px; }
.top h1 { font-size: clamp(1.6rem, 4.5vw, 2.2rem); line-height: 1.1; letter-spacing: -0.02em; }
.lede { font-size: 0.95rem; color: var(--muted); max-width: 62ch; margin: 8px 0 0; }

/* The menu, as the Timatsu app's (nav.mjs moves it). The circle is glass over the page. */
:root { --well: #e7e9ef; --pane-fill: color-mix(in srgb, #fff 62%, transparent); --r-screen: 2.75rem; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) { --well: #161c2b; --pane-fill: color-mix(in srgb, #161d2d 62%, transparent); } }
:root[data-theme="dark"] { --well: #161c2b; --pane-fill: color-mix(in srgb, #161d2d 62%, transparent); }
.glass { background: var(--pane-fill); -webkit-backdrop-filter: blur(24px) saturate(180%); backdrop-filter: blur(24px) saturate(180%); box-shadow: inset 0 1px 0 color-mix(in srgb, #fff 55%, transparent), 0 0 0 1px color-mix(in srgb, var(--fg) 7%, transparent), 0 8px 24px -14px rgb(0 0 0 / 0.16); color: var(--fg); }
@media (prefers-reduced-transparency: reduce) { .glass { background: var(--surface); } }
.fc { position: fixed; z-index: 50; top: calc(env(safe-area-inset-top, 0px) + 10px); left: max(16px, env(safe-area-inset-left, 0px)); width: 44px; height: 44px; border: 0; border-radius: 50%; display: grid; place-items: center; padding: 0; cursor: pointer; -webkit-tap-highlight-color: transparent; }
.fc svg, .sn svg { fill: none; stroke: currentColor; stroke-linecap: round; stroke-linejoin: round; }
.fc svg { width: 20px; height: 20px; stroke-width: 2; }
/* The circle's two lines turn into a close mark while the menu is open. */
.fc svg path { transform-box: view-box; transform-origin: 12px 12px; transition: transform 0.2s cubic-bezier(0.3, 0.5, 0.1, 1); }
.fc[aria-expanded="true"] .l1 { transform: rotate(45deg) translateY(3.5px); }
.fc[aria-expanded="true"] .l2 { transform: rotate(-45deg) translateY(-3.5px); }
@media (prefers-reduced-motion: reduce) { .fc svg path { transition: none; } }
.fc:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

.stage, .stage-in { display: contents; }
.stage-veil, .sn-dim { display: none; }

/* The menu itself: a quiet panel on the well, one row per page beside its icon. Hidden until it opens. */
.sn { position: fixed; z-index: 45; box-sizing: border-box; display: flex; flex-direction: column; background: var(--well); color: var(--fg); font-family: var(--font-ui); visibility: hidden; }
.sn-list { display: flex; flex-direction: column; }
/* The menu's top row is the circle's own space, so the first page row starts below it. */
.sn-k { margin: 0 0 8px; height: 44px; }
.sn a { display: flex; align-items: center; gap: 12px; height: 48px; padding: 0 8px; border-radius: 1.25rem; color: var(--fg); text-decoration: none; font-size: 1rem; font-weight: 400; -webkit-tap-highlight-color: transparent; }
.sn a:active { background: color-mix(in srgb, var(--fg) 6%, transparent); }
.sn a[aria-current="page"] { font-weight: 600; }
.sn-h { margin: 12px 0 4px; padding: 0 8px; font-size: 0.7rem; font-weight: 600; text-transform: uppercase; letter-spacing: 0.1em; color: var(--muted); }
.sn-k + .sn-h { margin-top: 8px; }
.sn-sec-h { display: flex; align-items: center; gap: 12px; width: 100%; height: 48px; padding: 0 8px; border: 0; border-radius: 1.25rem; background: none; color: var(--fg); font: 400 1rem var(--font-ui); text-align: left; cursor: pointer; -webkit-tap-highlight-color: transparent; }
.sn-sec-h:active { background: color-mix(in srgb, var(--fg) 6%, transparent); }
.sn-sec-h .sn-l { flex: 1; }
.sn-sec:has([aria-current="page"]) .sn-sec-h { font-weight: 600; }
.sn-plus { position: relative; width: 20px; height: 20px; flex: none; color: var(--muted); }
.sn-plus::before, .sn-plus::after { content: ""; position: absolute; left: 4px; right: 4px; top: 9.25px; height: 1.5px; border-radius: 1px; background: currentColor; transition: transform 0.2s cubic-bezier(0.3, 0.5, 0.1, 1); }
.sn-plus::after { transform: rotate(90deg); }
.sn-sec-h[aria-expanded="true"] .sn-plus::after { transform: rotate(0deg); }
.sn-list > * { flex-shrink: 0; }
.sn-sub { display: grid; grid-template-columns: minmax(0, 1fr); padding: 0 0 6px 32px; }
.sn-sub a, .sn-off { display: flex; align-items: center; gap: 10px; min-height: 40px; padding: 8px; border-radius: 1rem; font-size: 0.92rem; color: var(--fg); text-decoration: none; }
.sn-sub a .sn-l, .sn-off .sn-l { flex: 1; min-width: 0; line-height: 1.3; }
.sn-off { color: var(--muted); }
.sn-st { display: flex; align-items: center; gap: 5px; flex: none; font-style: normal; font-size: 0.72rem; color: var(--muted); }
.sn-st::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: transparent; box-shadow: inset 0 0 0 1.5px var(--muted); }
.sn-st.building { color: var(--warn); }
.sn-st.building::before { background: var(--warn); box-shadow: none; }
.sn-st.live { color: var(--good); }
.sn-st.live::before { background: var(--good); box-shadow: none; }
@media (prefers-reduced-motion: reduce) { .sn-plus::before, .sn-plus::after { transition: none; } }
.sn-rule { border: 0; border-top: 1px solid var(--line); margin: 12px 8px; }
.sn-i { flex: none; width: 20px; height: 20px; display: grid; place-items: center; }
.sn svg { width: 20px; height: 20px; stroke-width: 1.6; }
.sn-foot { margin-top: auto; display: flex; align-items: center; gap: 12px; color: var(--muted); font-size: 0.76rem; line-height: 1.35; }
.sn-av { flex: none; width: 40px; height: 40px; border-radius: 50%; display: grid; place-items: center; background: var(--fg); color: var(--surface); font-size: 0.85rem; font-weight: 600; letter-spacing: 0.02em; }
.sn-who { display: grid; min-width: 0; }
.sn-who b { font-size: 0.95rem; font-weight: 600; color: var(--fg); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sn-who small { font-size: 0.8rem; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* The menu lies under the page, which slides right to show it. On a wide screen it stays a column's width. */
.sn { top: 0; bottom: 0; left: 0; width: min(calc(100vw - 5rem), 320px); padding: 0 16px; overflow: hidden; }
.sn-list { flex: 1; min-height: 0; overflow-y: auto; overscroll-behavior: contain; padding: calc(env(safe-area-inset-top, 0px) + 10px) 0 12px; }
.sn-foot { padding: 12px 8px calc(env(safe-area-inset-bottom, 0px) + 16px); }
html[data-drawer] .sn { visibility: visible; will-change: transform; }
html[data-drawer] body { background: var(--well); }
html[data-drawer] .sn-dim { display: block; position: fixed; z-index: 46; inset: 0; pointer-events: none; background: rgb(0 0 0 / 0.35); will-change: opacity; }
.stage-in > *, .sn { touch-action: pan-y; }
html[data-drawer] .stage { display: block; position: fixed; z-index: 60; inset: 0; overflow: hidden; border-radius: var(--r-screen); background: var(--bg); box-shadow: -12px 0 32px -16px rgb(0 0 0 / 0.22); will-change: transform; }
html[data-drawer] .stage-in { display: block; }
html[data-drawer] .stage .glass { -webkit-backdrop-filter: none; backdrop-filter: none; }
html[data-drawer] .stage-veil { display: block; position: absolute; z-index: 5; inset: 0; touch-action: none; }
/* The circle stays where it is, above the page as it slides away, and becomes the menu's close button. */
html[data-drawer] .fc { z-index: 70; }

@media (hover: hover) { .sn a:hover, .sn-sec-h:hover { background: color-mix(in srgb, var(--fg) 6%, transparent); } }

/* One set of edges on every page: tables start and end flush with their card's own padding, so a column lines up with
   the card's heading above it. */
th:first-child, td:first-child, table.dtable th:first-child, table.dtable td:first-child { padding-left: 0; }
th:last-child, td:last-child, table.dtable th:last-child, table.dtable td:last-child { padding-right: 0; }

/* The feedback chat. Phone first: a sheet up from the bottom, kept above the keyboard (--kb); wider screens get a panel
   above the circle. */
.fb-launch { position: fixed; z-index: 50; right: max(16px, env(safe-area-inset-right, 0px)); bottom: calc(env(safe-area-inset-bottom, 0px) + 16px); width: 52px; height: 52px; border: 0; border-radius: 50%; display: grid; place-items: center; color: var(--fg); cursor: pointer; -webkit-tap-highlight-color: transparent; }
.fb-launch svg { width: 24px; height: 24px; fill: none; stroke: currentColor; stroke-linecap: round; stroke-linejoin: round; }
.fb-launch:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.fb-dot { position: absolute; top: 9px; right: 9px; width: 10px; height: 10px; border-radius: 50%; background: var(--accent); box-shadow: 0 0 0 2px var(--surface); }
html[data-drawer] .fb-launch, html[data-feedback] .fb-launch { visibility: hidden; }
.fb-scrim { position: fixed; z-index: 80; inset: 0; background: rgb(0 0 0 / 0.3); opacity: 0; transition: opacity 0.2s ease; }
html[data-feedback] .fb-scrim { opacity: 1; }
.fb-sheet { --kb: 0px; position: fixed; z-index: 81; left: 8px; right: 8px; bottom: calc(var(--kb) + env(safe-area-inset-bottom, 0px) + 8px); height: min(calc(100svh - var(--kb) - env(safe-area-inset-top, 0px) - env(safe-area-inset-bottom, 0px) - 56px), 680px); display: flex; flex-direction: column; background: var(--surface); color: var(--fg); border: 1px solid var(--line); border-radius: 24px; box-shadow: 0 20px 60px -20px rgb(0 0 0 / 0.4); overflow: hidden; font-family: var(--font-ui); transform: translateY(24px); opacity: 0; transition: transform 0.22s cubic-bezier(0.3, 0.5, 0.1, 1), opacity 0.18s ease; }
.fb-sheet.in { transform: none; opacity: 1; }
.fb-head { display: flex; align-items: flex-start; gap: 12px; padding: 16px 12px 12px var(--pad); border-bottom: 1px solid var(--line); }
.fb-head > div { flex: 1; min-width: 0; }
.fb-head h2 { font-size: 1.05rem; font-weight: 650; text-transform: none; letter-spacing: -0.01em; color: var(--fg); }
.fb-head p { margin: 4px 0 0; font-size: 0.8rem; color: var(--muted); line-height: 1.4; }
.fb-x { flex: none; width: 36px; height: 36px; border: 0; border-radius: 50%; background: var(--sunk); color: var(--fg); display: grid; place-items: center; cursor: pointer; }
.fb-x svg, .fb-btn svg, .fb-unpic svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-linecap: round; stroke-linejoin: round; }
.fb-log { flex: 1; min-height: 0; overflow-y: auto; overscroll-behavior: contain; padding: 12px var(--pad); display: flex; flex-direction: column; gap: 14px; }
.fb-empty { margin: auto 0; text-align: center; color: var(--muted); font-size: 0.9rem; }
.fb-note { display: grid; gap: 4px; justify-items: start; max-width: 88%; }
.fb-note.mine { align-self: flex-end; justify-items: end; }
.fb-meta { margin: 0; font-size: 0.72rem; color: var(--muted); }
.fb-meta b { font-weight: 600; color: var(--fg); }
.fb-bubble { background: var(--sunk); border-radius: 18px; padding: 10px 14px; display: grid; gap: 8px; font-size: 0.95rem; line-height: 1.45; overflow-wrap: anywhere; }
.fb-note.mine .fb-bubble { background: var(--accent-soft); }
.fb-bubble p { margin: 0; }
.fb-bubble img { display: block; max-width: 100%; max-height: 260px; border-radius: 12px; }
.fb-form { display: grid; gap: 10px; padding: 10px var(--pad) 12px; border-top: 1px solid var(--line); }
.fb-kinds { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); }
.fb-kinds button { padding: 8px 4px; }
.fb-bar { display: grid; gap: 6px; background: var(--sunk); border: 1px solid var(--line); border-radius: 20px; padding: 8px; }
.fb-in { width: 100%; box-sizing: border-box; min-height: 40px; max-height: 160px; resize: none; border: 0; background: transparent; color: var(--fg); font: 1rem/1.4 var(--font-ui); padding: 8px 6px; outline: none; }
.fb-row { display: flex; align-items: center; gap: 8px; }
.fb-say { flex: 1; min-width: 0; font-size: 0.78rem; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.fb-btn { flex: none; width: 36px; height: 36px; border: 1px solid var(--line); border-radius: 50%; background: var(--surface); color: var(--fg); display: grid; place-items: center; cursor: pointer; padding: 0; }
.fb-mic[aria-pressed="true"] { background: var(--bad); border-color: var(--bad); color: #fff; }
.fb-send { background: var(--cta); border-color: var(--cta); color: var(--on-cta); }
.fb-send:disabled { background: var(--line); border-color: var(--line); color: var(--muted); cursor: default; }
.fb-pic { position: relative; justify-self: start; }
.fb-pic img { display: block; height: 72px; border-radius: 10px; }
.fb-unpic { position: absolute; top: -6px; right: -6px; width: 24px; height: 24px; border: 0; border-radius: 50%; background: var(--fg); color: var(--surface); display: grid; place-items: center; cursor: pointer; padding: 0; }
.fb-unpic svg { width: 14px; height: 14px; }
@media (min-width: 720px) {
  .fb-scrim { background: transparent; }
  .fb-sheet { left: auto; right: max(16px, env(safe-area-inset-right, 0px)); bottom: calc(env(safe-area-inset-bottom, 0px) + 80px); width: 400px; height: min(620px, calc(100svh - 112px)); border-radius: 18px; transform: translateY(12px) scale(0.98); transform-origin: bottom right; }
  .fb-sheet.in { transform: none; }
  html[data-feedback] .fb-launch { visibility: visible; }
}
@media (prefers-reduced-motion: reduce) { .fb-sheet, .fb-scrim { transition: none; } }

/* The page header: fixed, solid in the page color so Safari extends it up under the clock; the menu circle sits in its left place. */
header.bar { position: sticky; z-index: 40; top: 0; width: 100%; box-sizing: border-box; height: calc(env(safe-area-inset-top, 0px) + 64px); padding: env(safe-area-inset-top, 0px) max(16px, env(safe-area-inset-right, 0px)) 0 max(16px, env(safe-area-inset-left, 0px)); display: flex; align-items: center; justify-content: center; background: var(--brand); color: #fff; font-family: var(--font-ui); }
.bar-brand { display: grid; place-items: center; min-width: 44px; height: 44px; color: #fff; text-decoration: none; -webkit-tap-highlight-color: transparent; }
.lfhq { font-size: 21px; font-weight: 800; letter-spacing: -0.03em; line-height: 1; color: #fff; }
.lfhq b { font-weight: 800; color: var(--cta); }
.bar-me { position: absolute; right: max(16px, env(safe-area-inset-right, 0px)); top: calc(env(safe-area-inset-top, 0px) + 10px); width: 44px; height: 44px; border: 0; border-radius: 50%; display: grid; place-items: center; background: rgb(255 255 255 / 0.18); box-shadow: inset 0 0 0 1px rgb(255 255 255 / 0.3); color: #fff; font: 600 0.85rem var(--font-ui); letter-spacing: 0.02em; cursor: pointer; padding: 0; }
.bar-me:focus-visible, .bar-brand:focus-visible { outline: 2px solid #fff; outline-offset: 2px; }
/* While the menu is open, a tap anywhere on the page strip, header included, closes it. */
html[data-drawer] header.bar { pointer-events: none; }
/* At rest the menu circle is the header's own (.bar-menu); the floating one (.fc) shows only while the menu is open, as glass on the menu. */
.bar-menu { position: absolute; left: max(16px, env(safe-area-inset-left, 0px)); top: calc(env(safe-area-inset-top, 0px) + 10px); width: 44px; height: 44px; border: 0; border-radius: 50%; display: grid; place-items: center; padding: 0; background: rgb(255 255 255 / 0.18); box-shadow: inset 0 0 0 1px rgb(255 255 255 / 0.3); color: #fff; cursor: pointer; -webkit-tap-highlight-color: transparent; }
.bar-menu svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; }
.bar-menu:focus-visible { outline: 2px solid #fff; outline-offset: 2px; }
html:not([data-drawer]) .fc { visibility: hidden; }
html[data-drawer] .bar-menu, html[data-panel] .bar-menu { visibility: hidden; }
/* The feedback circle in the brand blue, matching the header. */
.fb-launch.glass { background: var(--brand); color: #fff; box-shadow: 0 8px 24px -8px rgb(28 36 98 / 0.55); -webkit-backdrop-filter: none; backdrop-filter: none; }
.fb-launch .fb-dot { background: #fff; box-shadow: 0 0 0 2px var(--brand); }
/* Safari colors its own top bar edge from the page's background, so the page itself is the brand blue behind
   everything, and the body carries the light page color over it. */
html { background: var(--brand); }
body { min-height: 100vh; min-height: 100svh; }

/* Moving between pages: the page cross-fades while the header, the menu circle and the feedback circle stay put. */
@view-transition { navigation: auto; }
header.bar { view-transition-name: lf-bar; }
.fb-launch { view-transition-name: lf-feedback; }
::view-transition-old(root), ::view-transition-new(root) { animation-duration: 0.18s; }
@media (prefers-reduced-motion: reduce) { @view-transition { navigation: none; } }
/* The guide's replies in the feedback chat, and its typing dots while it writes. */
.fb-note.guide .fb-bubble { background: var(--sunk); }
.fb-att { font-size: 0.8rem; color: var(--muted); }
.fb-typing { display: inline-flex; gap: 4px; padding: 4px 2px; }
.fb-typing i { width: 7px; height: 7px; border-radius: 50%; background: var(--muted); opacity: 0.4; animation: fb-blink 1.2s infinite ease-in-out; }
.fb-typing i:nth-child(2) { animation-delay: 0.2s; }
.fb-typing i:nth-child(3) { animation-delay: 0.4s; }
@keyframes fb-blink { 0%, 80%, 100% { opacity: 0.25; } 40% { opacity: 0.9; } }
@media (prefers-reduced-motion: reduce) { .fb-typing i { animation: none; opacity: 0.6; } }
#pchart { display: grid; gap: 10px; margin: 14px 0 6px; }
#pchart[hidden] { display: none; }
#pchart p { margin: 0; }
#pchart h3 { margin: 4px 0 0; font-size: 0.72rem; font-weight: 600; text-transform: uppercase; letter-spacing: 0.08em; color: var(--muted); }
#pchart svg { display: block; width: 100%; height: auto; }
#pchart .added { margin: 0; padding: 0; list-style: none; display: grid; gap: 8px; font-size: 0.85rem; line-height: 1.45; }
#pchart .added strong { display: block; font-size: 0.72rem; font-weight: 600; text-transform: uppercase; letter-spacing: 0.06em; color: var(--accent); }
