/* Battery Pulse shared styles: tokens, header, footer, prose pages, snapshot charts. */
:root {
  --bg: #F6F7F9;
  --surface: #FFFFFF;
  --ink: #111A2B;
  --ink-2: #3B4558;
  --muted: #5F6A7E;
  --line: #D8DDE5;
  --cell: #F2B705;
  --cell-ink: #111A2B;
  --accent-text: #8A5A00;
  --focus: #1F5FD1;
  --track: #E6EAF0;
  --bar-muted: #B9C1CE;
  --f-display: "IBM Plex Sans Condensed", "Arial Narrow", sans-serif;
  --f-body: "IBM Plex Sans", system-ui, -apple-system, "Segoe UI", sans-serif;
  --f-mono: "IBM Plex Mono", ui-monospace, "SFMono-Regular", Menlo, monospace;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0D1320; --surface: #151D2D; --ink: #EEF1F6; --ink-2: #C3CAD6; --muted: #98A2B5;
    --line: #2A3448; --accent-text: #F5C842; --focus: #7EA8FF; --track: #222C3F; --bar-muted: #4A5568;
    color-scheme: dark;
  }
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--ink); font-family: var(--f-body); font-size: 15px; line-height: 1.5; padding-inline: 20px; padding-block: 0 48px; }
img { max-width: 100%; }
a { color: var(--ink); }
:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }

.bp-nav { max-width: 1180px; margin-inline: auto; display: flex; flex-wrap: wrap; align-items: center; gap: 8px 22px; padding-block: 16px; border-bottom: 1px solid var(--line); }
.bp-brand { font-family: var(--f-display); font-weight: 700; font-size: 20px; text-decoration: none; color: var(--ink); display: inline-flex; align-items: center; gap: 8px; margin-right: auto; }
.bp-brand i { display: inline-block; width: 10px; height: 16px; border: 2px solid var(--ink); border-radius: 2px; position: relative; }
.bp-brand i::after { content: ""; position: absolute; left: 1px; right: 1px; bottom: 1px; height: 60%; background: var(--cell); }
.bp-nav a.link { text-decoration: none; color: var(--ink-2); font-size: 14px; padding-block: 10px; }
.bp-nav a.link[aria-current="page"] { color: var(--ink); font-weight: 600; box-shadow: inset 0 -2px 0 var(--cell); }
.bp-nav a.join { text-decoration: none; font-size: 14px; font-weight: 600; background: var(--cell); color: var(--cell-ink); padding: 9px 14px; border-radius: 4px; }

.bp-foot { max-width: 1180px; margin: 48px auto 0; padding-top: 18px; border-top: 1px solid var(--line); display: flex; flex-wrap: wrap; gap: 8px 22px; font-size: 13px; color: var(--muted); }
.bp-foot a { color: var(--muted); }
.bp-foot .sp { margin-right: auto; }

.page { max-width: 1180px; margin-inline: auto; display: flex; flex-direction: column; gap: 28px; padding-top: 32px; }
.eyebrow { font-family: var(--f-mono); font-size: 12px; letter-spacing: 0.12em; text-transform: uppercase; color: var(--muted); }
.page h1 { font-family: var(--f-display); font-weight: 700; font-size: clamp(36px, 6vw, 60px); line-height: 1; margin: 0; text-wrap: balance; }
.lede { max-width: 64ch; font-size: 17px; color: var(--ink-2); margin: 0; }

.prose { max-width: 70ch; display: flex; flex-direction: column; gap: 14px; }
.prose h2 { font-family: var(--f-display); font-size: 26px; margin: 18px 0 0; line-height: 1.15; }
.prose p, .prose li { color: var(--ink-2); margin: 0; }
.prose ul { margin: 0; padding-left: 20px; display: flex; flex-direction: column; gap: 6px; }
.prose .meta { font-size: 13px; color: var(--muted); }

.tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 220px), 1fr)); gap: 14px; }
.tile { background: var(--surface); border: 1px solid var(--line); border-radius: 4px; padding: 18px; display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.tile .lab { font-size: 13px; color: var(--muted); }
.tile .big { font-family: var(--f-display); font-weight: 700; font-size: 40px; line-height: 1.05; font-variant-numeric: tabular-nums; }
.tile .big small { font-size: 20px; color: var(--muted); font-weight: 600; }
.tile .sub { font-size: 13px; color: var(--muted); }

.cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 420px), 1fr)); gap: 14px; }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: 4px; padding: 18px; display: flex; flex-direction: column; gap: 8px; min-width: 0; }
.card h2 { margin: 0; font-size: 17px; font-weight: 600; line-height: 1.3; }
.card .note { margin: 0; font-size: 13px; color: var(--muted); }
.bars { display: flex; flex-direction: column; gap: 6px; margin-top: 4px; }
.bar-row { display: grid; grid-template-columns: minmax(0, 11.5rem) minmax(0, 1fr); gap: 10px; align-items: center; font-size: 13px; }
.bar-row .lbl { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--ink); }
.bar-row .track { display: flex; align-items: center; gap: 8px; min-width: 0; }
.bar-row .fill { height: 14px; border-radius: 3px; background: var(--ink); flex: none; min-width: 2px; }
.bar-row .fill.muted { background: var(--bar-muted); }
.bar-row .fill.hot { background: var(--cell); }
.bar-row .val { font-family: var(--f-mono); font-size: 12px; color: var(--muted); white-space: nowrap; font-variant-numeric: tabular-nums; }
@media (max-width: 480px) { .bar-row { grid-template-columns: minmax(0, 8rem) minmax(0, 1fr); } }

.cta { background: var(--ink); color: var(--bg); border-radius: 4px; padding: 22px; display: flex; flex-wrap: wrap; gap: 12px 20px; align-items: center; }
.cta p { margin: 0; flex: 1 1 280px; font-size: 16px; }
.cta a { text-decoration: none; font-weight: 600; background: var(--cell); color: var(--cell-ink); padding: 12px 16px; border-radius: 4px; }
.method { max-width: 72ch; font-size: 13px; color: var(--muted); display: flex; flex-direction: column; gap: 8px; }
.method h2 { margin: 0; font-size: 16px; color: var(--ink); }
.method p { margin: 0; }

/* Dashboard */
:root { --s1: #111A2B; --s2: #E0A800; --hatch: #C9D0DB; --tile0: #EEF1F5; --r1: #D6E2F2; --r2: #8FAED6; --r3: #3F6AA8; --r4: #142B55; }
@media (prefers-color-scheme: dark) { :root { --s1: #DCE3EE; --s2: #F2B705; --hatch: #4A5568; --tile0: #1B2436; --r1: #2A3E61; --r2: #3F6AA8; --r3: #7FA3D9; --r4: #C9DAF2; } }
.legend { display: flex; flex-wrap: wrap; gap: 6px 18px; font-size: 13px; color: var(--ink-2); }
.legend span { display: inline-flex; align-items: center; gap: 6px; }
.legend i { width: 12px; height: 12px; border-radius: 2px; display: inline-block; }
.pair { display: flex; flex-direction: column; gap: 10px; margin-top: 4px; }
.pair-row { display: grid; grid-template-columns: minmax(0, 12rem) minmax(0, 1fr); gap: 10px; align-items: center; font-size: 13px; }
.pair-row .lbl { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pair-row .bars { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.pair-row .b { display: flex; align-items: center; gap: 8px; min-width: 0; }
.pair-row .f { height: 11px; border-radius: 2px; flex: none; }
.pair-row .v { font-family: var(--f-mono); font-size: 12px; color: var(--muted); white-space: nowrap; font-variant-numeric: tabular-nums; }
@media (max-width: 480px) { .pair-row { grid-template-columns: minmax(0, 7.5rem) minmax(0, 1fr); } }
.stack { display: flex; height: 34px; border-radius: 3px; overflow: hidden; margin-top: 6px; }
.stack div { display: flex; align-items: center; justify-content: center; font-size: 12px; font-weight: 600; color: #fff; min-width: 0; overflow: hidden; white-space: nowrap; }
.stack-key { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 6px 16px; font-size: 13px; color: var(--ink-2); margin-top: 8px; }
.stack-key b { font-family: var(--f-mono); font-weight: 600; color: var(--ink); }
.tilemap { display: grid; grid-template-columns: repeat(12, minmax(0, 1fr)); gap: 3px; margin-top: 6px; position: relative; }
.st { aspect-ratio: 1; border-radius: 3px; display: flex; flex-direction: column; align-items: center; justify-content: center; font-size: 11px; font-weight: 600; line-height: 1.1; min-width: 0; }
.st small { font-family: var(--f-mono); font-weight: 500; font-size: 10px; opacity: .85; }
.st.hatch { background: repeating-linear-gradient(135deg, var(--hatch) 0 3px, transparent 3px 6px); color: var(--ink); border: 1px solid var(--hatch); }
.wide { grid-column: 1 / -1; }
.finding { margin: 0; font-size: 15px; color: var(--ink); }

/* Region charts (static images made in R) */
.seg { display: inline-flex; flex-wrap: wrap; gap: 6px; margin-top: 4px; }
.seg button { font: inherit; font-size: 13px; padding: 7px 12px; border-radius: 4px; border: 1px solid var(--line); background: var(--surface); color: var(--ink-2); cursor: pointer; }
.seg button[aria-pressed="true"] { background: var(--ink); color: var(--bg); border-color: var(--ink); font-weight: 600; }
.chart { margin: 6px 0 0; background: #fff; border-radius: 3px; overflow-x: auto; -webkit-overflow-scrolling: touch; }
.chart img { display: block; width: 100%; height: auto; }
@media (max-width: 640px) { .chart img { width: 640px; max-width: none; } }

/* Readiness self-assessment */
.private-note { margin: 0; max-width: 64ch; font-size: 14px; color: var(--ink-2); background: var(--surface); border: 1px solid var(--line); border-left: 4px solid var(--cell); border-radius: 4px; padding: 10px 14px; }
.ra { display: flex; flex-direction: column; gap: 26px; max-width: 880px; }
.ra fieldset { border: 0; margin: 0; padding: 0; min-width: 0; }
.ra-role legend, .ra-area h2 { font-family: var(--f-display); font-weight: 700; font-size: 24px; line-height: 1.15; margin: 0 0 12px; padding: 0; }
.ra-opts { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 250px), 1fr)); gap: 8px; }
.opt { display: flex; gap: 10px; align-items: flex-start; background: var(--surface); border: 1px solid var(--line); border-radius: 4px; padding: 10px 12px; cursor: pointer; font-size: 14px; }
.opt input { margin-top: 3px; accent-color: var(--ink); }
.opt:has(input:checked) { border-color: var(--ink); box-shadow: inset 0 0 0 1px var(--ink); }
.ra-area { display: flex; flex-direction: column; gap: 10px; }
.ra-q { background: var(--surface); border: 1px solid var(--line) !important; border-radius: 4px; padding: 14px 16px !important; display: flex; flex-direction: column; gap: 10px; }
.ra-q.missing { border-color: #C0392B !important; box-shadow: inset 3px 0 0 #C0392B; }
.ra-q legend { float: left; width: 100%; font-size: 15px; font-weight: 500; display: flex; gap: 10px; margin-bottom: 10px; }
.ra-q legend + * { clear: both; }
.qn { font-family: var(--f-mono); font-size: 12px; color: var(--muted); min-width: 1.6em; padding-top: 2px; }
.ra-scale { display: flex; flex-wrap: wrap; gap: 6px; }
.pill { position: relative; cursor: pointer; }
.pill input { position: absolute; opacity: 0; inset: 0; margin: 0; cursor: pointer; }
.pill span { display: inline-block; font-size: 13px; padding: 7px 12px; border: 1px solid var(--line); border-radius: 999px; color: var(--ink-2); background: var(--bg); }
.pill.na span { border-style: dashed; }
.pill input:checked + span { background: var(--ink); color: var(--bg); border-color: var(--ink); font-weight: 600; }
.pill input:focus-visible + span { outline: 2px solid var(--focus); outline-offset: 2px; }
.ra-bar { position: sticky; bottom: 0; display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px; background: var(--surface); border: 1px solid var(--line); border-radius: 4px; padding: 10px 14px; font-size: 14px; color: var(--ink-2); }
.ra-go, .cta-actions a { font: inherit; font-weight: 600; background: var(--cell); color: var(--cell-ink); border: 0; padding: 11px 16px; border-radius: 4px; cursor: pointer; text-decoration: none; }
.results { display: flex; flex-direction: column; gap: 14px; max-width: 880px; }
.res-head { display: flex; flex-wrap: wrap; gap: 16px; align-items: flex-start; justify-content: space-between; }
.res-head > div:first-child { flex: 1 1 320px; display: flex; flex-direction: column; gap: 6px; }
.res-head h2 { font-family: var(--f-display); font-size: 36px; margin: 0; line-height: 1.05; }
.score { background: var(--ink); color: var(--bg); border-radius: 4px; padding: 14px 20px; text-align: center; min-width: 140px; }
.score b { display: block; font-family: var(--f-display); font-size: 56px; line-height: 1; color: var(--cell); font-variant-numeric: tabular-nums; }
.score span { font-size: 13px; }
.results .card h3 { margin: 0; font-size: 17px; }
.steps { margin: 0; padding-left: 22px; display: flex; flex-direction: column; gap: 10px; color: var(--ink-2); }
.cta-actions { display: flex; flex-wrap: wrap; gap: 10px; }
button.ghost { font: inherit; font-weight: 600; background: transparent; color: var(--bg); border: 1px solid currentColor; padding: 10px 14px; border-radius: 4px; cursor: pointer; }
button.ghost.dark { color: var(--ink); }
.res-actions { display: flex; flex-wrap: wrap; gap: 10px; }
@media print {
  body { background: #fff; }
  .bp-nav, .bp-foot, .cta, .res-actions, #copied, .ra, .private-note { display: none !important; }
  .card, .score { break-inside: avoid; }
}
.results .bar-row { grid-template-columns: minmax(0, 15rem) minmax(0, 1fr); }
@media (max-width: 480px) { .results .bar-row { grid-template-columns: minmax(0, 10rem) minmax(0, 1fr); } .results .bar-row .lbl { white-space: normal; } }
@media (max-width: 560px) { .bp-brand { flex-basis: 100%; } }

/* Peer comparison */
.tally { margin: 0; font-family: var(--f-mono); font-size: 12px; letter-spacing: .06em; text-transform: uppercase; color: var(--accent-text); }
.compare { border-top: 4px solid var(--cell); }
.cmp-form { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 240px), 1fr)); gap: 12px; margin-top: 4px; }
.cmp-form label { display: flex; flex-direction: column; gap: 4px; font-size: 13px; font-weight: 600; color: var(--ink-2); }
.cmp-form input[type=email], .cmp-form input[type=text], .cmp-form select { font: inherit; font-weight: 400; font-size: 15px; color: var(--ink); background: var(--bg); border: 1px solid var(--line); border-radius: 4px; padding: 9px 10px; min-width: 0; }
.cmp-form .consent, .cmp-form .note, .cmp-form > div, .cmp-form .finding { grid-column: 1 / -1; }
.cmp-form .consent { flex-direction: row; align-items: flex-start; gap: 8px; font-weight: 400; }
.cmp-form .consent input { margin-top: 3px; accent-color: var(--ink); }
.cmp-form .hp { position: absolute; left: -9999px; width: 1px; height: 1px; overflow: hidden; }
.cmp-form button:disabled, .cmp-form input:disabled { opacity: .55; cursor: progress; }
.cta-row { display: flex; flex-wrap: wrap; gap: 10px; }
.err { margin: 0; color: #B3261E; font-size: 14px; font-weight: 600; }
@media (prefers-color-scheme: dark) { .err { color: #FF8A80; } }
.groups { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 200px), 1fr)); gap: 10px; margin-top: 6px; }
.grp { border: 1px solid var(--line); border-radius: 4px; padding: 12px; display: flex; flex-direction: column; gap: 4px; background: var(--bg); }
.grp .gl { font-size: 13px; color: var(--ink-2); }
.grp .gv { font-size: 14px; } .grp .gv b { font-family: var(--f-display); font-size: 30px; line-height: 1; }
.grp .gs { font-size: 12px; color: var(--muted); }
.grp.wait .gv { font-weight: 600; color: var(--muted); }
.gbar { position: relative; height: 6px; border-radius: 3px; background: linear-gradient(90deg, var(--track), var(--bar-muted)); margin-top: 6px; }
.gbar i { position: absolute; top: -4px; width: 4px; height: 14px; border-radius: 2px; background: var(--cell); transform: translateX(-2px); box-shadow: 0 0 0 1px var(--ink); }
.compare h4 { margin: 14px 0 4px; font-size: 14px; }
.cmp-areas { display: flex; flex-direction: column; gap: 7px; }
.arow { display: grid; grid-template-columns: minmax(0, 15rem) minmax(0, 1fr) 5.5rem; gap: 10px; align-items: center; font-size: 13px; }
.arow .at { position: relative; height: 14px; background: var(--track); border-radius: 3px; }
.arow .you { position: absolute; left: 0; top: 0; bottom: 0; background: var(--ink); border-radius: 3px; }
.arow .med { position: absolute; top: -3px; bottom: -3px; width: 3px; background: var(--cell); transform: translateX(-1px); box-shadow: 0 0 0 1px var(--surface); }
.arow .av { font-family: var(--f-mono); font-size: 12px; color: var(--muted); white-space: nowrap; }
@media (max-width: 520px) { .arow { grid-template-columns: minmax(0, 1fr) 5rem; } .arow .at { grid-column: 1 / -1; grid-row: 2; } }
@media print { .compare form, .err { display: none !important; } }
.compare #cmp-note { margin-top: 10px; }

/* Policy tracker */
.pt-h { font-family: var(--f-display); font-size: 26px; margin: 0 0 12px; line-height: 1.15; }
.pt-filter { display: flex; flex-wrap: wrap; gap: 6px; }
.pt-filter button { font: inherit; font-size: 13px; padding: 7px 12px; border-radius: 999px; border: 1px solid var(--line); background: var(--surface); color: var(--ink-2); cursor: pointer; }
.pt-filter button[aria-pressed="true"] { background: var(--ink); color: var(--bg); border-color: var(--ink); font-weight: 600; }
.pt-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 10px; max-width: 900px; }
.pt-item { display: grid; grid-template-columns: 9.5rem minmax(0, 1fr); gap: 16px; background: var(--surface); border: 1px solid var(--line); border-radius: 4px; padding: 14px 16px; }
.pt-when { display: flex; flex-direction: column; gap: 4px; }
.pt-date { font-family: var(--f-display); font-weight: 700; font-size: 18px; line-height: 1.1; }
.pt-count { font-family: var(--f-mono); font-size: 12px; color: var(--muted); }
.pt-count.soon { color: var(--accent-text); font-weight: 600; }
.pt-body { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.pt-body h3 { margin: 0; font-size: 16px; line-height: 1.3; }
.pt-body p { margin: 0; font-size: 14px; color: var(--ink-2); }
.pt-area { align-self: flex-start; font-family: var(--f-mono); font-size: 11px; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); border: 1px solid var(--line); border-radius: 3px; padding: 2px 6px; }
.pt-meta { font-size: 12.5px !important; color: var(--muted) !important; }
.pt-meta a { color: var(--muted); }
.pt-list.pending .pt-date, .pt-list.recent .pt-date { font-size: 15px; color: var(--ink-2); }
.pt-table-wrap { overflow-x: auto; }
.pt-table { border-collapse: collapse; width: 100%; font-size: 14px; min-width: 520px; }
.pt-table th, .pt-table td { border-bottom: 1px solid var(--line); padding: 8px 10px; text-align: right; font-variant-numeric: tabular-nums; }
.pt-table th[scope="row"], .pt-table thead th:first-child { text-align: left; font-weight: 500; }
.pt-table thead th { font-family: var(--f-mono); font-size: 12px; color: var(--muted); font-weight: 600; }
.pt-table td.now { background: var(--cell); color: var(--cell-ink); font-weight: 700; }
@media (max-width: 560px) { .pt-item { grid-template-columns: 1fr; gap: 8px; } }
