:root {
  --bg: #f5f0e6; --card: #fffdf8; --ink: #1b2a23; --muted: #5d6b63; --line: #ddd5c4; --field: #857d6c;
  --green: #1f4d3a; --green-soft: #e3ece4; --gold: #d99a1c; --gold-soft: #fbefd2; --gold-text: #6b4900;
  --rust: #b24a26; --rust-text: #9c3f1e; --rust-soft: #f8e4da; --radius: 14px;
  --serif: "Iowan Old Style", "Palatino Linotype", Palatino, Georgia, serif;
  --sans: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--ink); font: 17px/1.5 var(--sans); }
h1, h2, h3, h4 { font-family: var(--serif); line-height: 1.15; margin: 0 0 .4em; text-wrap: balance; }
h1 { font-size: 2rem; } h2 { font-size: 1.5rem; } h3, h4 { font-size: 1.15rem; }
p { margin: 0 0 .8em; } a { color: var(--green); }
.muted { color: var(--muted); } .small { font-size: .875rem; }
[hidden] { display: none !important; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }

.topbar { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 14px 16px; max-width: 1100px; margin: 0 auto; }
.brand { font-family: var(--serif); font-weight: 700; font-size: 1.25rem; color: var(--green); text-decoration: none; letter-spacing: -.01em; }
.brand b { color: var(--gold-text); }
main { max-width: 560px; margin: 0 auto; padding: 8px 16px 40px; }
main.wide { max-width: 1100px; }

button, .btn { font: inherit; font-weight: 600; border: 0; border-radius: 12px; padding: 14px 18px; min-height: 50px; cursor: pointer;
  background: var(--green); color: #fff; text-decoration: none; display: inline-flex; align-items: center; justify-content: center; gap: 8px; }
[aria-disabled="true"] { opacity: .6; cursor: default; }
.btn.block, button.block { display: flex; width: 100%; }
.btn.ghost, button.ghost { background: transparent; color: var(--green); border: 2px solid var(--green); }
.btn.gold, button.gold { background: var(--gold); color: #2a1d00; }
button.link { background: none; color: var(--green); padding: 8px 4px; min-height: 44px; text-decoration: underline; font-weight: 500; }
button.sm, .btn.sm { padding: 8px 12px; min-height: 44px; font-size: .9rem; border-radius: 10px; }
.btn.danger, button.danger { background: var(--rust-text); color: #fff; }
/* A dark ring with a white one inside it shows on every background here, including the green and gold ones. */
:focus-visible { outline: 3px solid var(--ink); outline-offset: 2px; box-shadow: 0 0 0 2px #fff; }
a.tap { display: inline-block; padding: 12px 2px; margin: -12px 0; font-weight: 700; }

input, select, textarea { font: inherit; width: 100%; padding: 13px 12px; border: 2px solid var(--field); border-radius: 12px; background: #fff; color: var(--ink); }
::placeholder { color: var(--muted); opacity: 1; }
textarea { min-height: 110px; resize: vertical; }
label, legend { display: block; font-weight: 600; margin: 16px 0 6px; padding: 0; }
label .muted, legend .muted, label.plain { font-weight: 400; }
label.plain { margin: 0; }
fieldset { border: 0; padding: 0; margin: 0; min-width: 0; }

.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; margin: 0 0 14px; }
.stack > * + * { margin-top: 12px; }
.row { display: flex; gap: 10px; flex-wrap: wrap; }
.row > * { flex: 1 1 140px; }
.crumb { font-size: .85rem; font-weight: 600; color: var(--muted); margin: 0 0 6px; }
.steps { display: flex; gap: 6px; margin: 0 0 18px; }
.steps i { height: 5px; flex: 1; border-radius: 3px; background: var(--line); }
.steps i.on { background: var(--green); }

.needs { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.need { background: var(--card); color: var(--ink); border: 2px solid var(--field); border-radius: var(--radius); padding: 14px; min-height: 92px;
  flex-direction: column; align-items: flex-start; justify-content: flex-start; text-align: left; gap: 2px; }
.need strong { font-family: var(--serif); font-size: 1.15rem; }
.need span { font-weight: 400; font-size: .85rem; color: var(--muted); line-height: 1.3; }
.need:hover { border-color: var(--green); }
.need:last-child:nth-child(odd) { grid-column: 1 / -1; }   /* a tile alone on the last row takes the whole row */
.needs-head { margin: 22px 0 8px; font-size: 1.05rem; }
.needs.more .need { min-height: 0; }   /* the needs apart from the 7 basics: smaller tiles */
.privacy { margin-top: 18px; }

.check { display: flex; align-items: center; gap: 12px; padding: 12px; border: 2px solid var(--field); border-radius: 12px; background: #fff; margin: 0 0 8px; font-weight: 500; cursor: pointer; }
.check input { width: 22px; height: 22px; flex: none; accent-color: var(--green); }
.check:has(input:checked) { border-color: var(--green); background: var(--green-soft); }

.tag { display: inline-block; font-size: .75rem; font-weight: 700; letter-spacing: .04em; text-transform: uppercase; padding: 3px 8px; border-radius: 99px; background: var(--green-soft); color: var(--green); }
.tag.local { background: var(--gold-soft); color: var(--gold-text); }
.tag.unmet { background: var(--rust-soft); color: var(--rust-text); }
.reqs { list-style: none; padding: 0; margin: 6px 0 12px; }
.reqs li { padding: 7px 0 7px 26px; position: relative; border-top: 1px dashed var(--line); }
.reqs li::before { content: "✓"; position: absolute; left: 2px; color: var(--green); font-weight: 700; }
.reqs li.warn { background: var(--gold-soft); border-radius: 8px; padding-right: 8px; border-top-color: transparent; }
.reqs li.warn::before { content: "!"; left: 9px; color: var(--gold-text); }
.reqs li.warn small { display: block; color: var(--gold-text); font-weight: 600; }
.card .row { margin-top: 4px; }
.card .row > a[href^="tel:"] { flex: 2 1 170px; white-space: nowrap; }
.card .row > a[href^="http"] { flex: 1 1 100px; }
.toggle { display: flex; width: 100%; justify-content: space-between; background: transparent; color: var(--green); border-top: 1px dashed var(--line); border-radius: 0;
  padding: 12px 2px 4px; margin-top: 12px; min-height: 48px; font-weight: 600; text-align: left; }
.toggle::after { content: "+"; font-size: 1.4rem; line-height: 1; font-weight: 400; }
.toggle[aria-expanded="true"]::after { content: "−"; }
.more { padding-top: 4px; }
.flag { background: var(--gold-soft); color: var(--gold-text); border-radius: 8px; padding: 6px 10px; font-size: .9rem; font-weight: 600; }
.urgent { background: var(--rust-soft); border: 2px solid var(--rust-text); border-radius: var(--radius); padding: 14px; margin: 0 0 16px; }
.label { font-size: .78rem; font-weight: 700; letter-spacing: .05em; text-transform: uppercase; color: var(--muted); margin: 10px 0 2px; font-family: var(--sans); }
main > .group { border-top: 0; padding-top: 0; margin: 22px 0 10px; }

.hope { background: var(--green); color: #fff; border-radius: var(--radius); padding: 22px 18px; margin: 0 0 14px; }
.hope h2 { color: #fff; font-size: 1.6rem; } .hope p { margin: 0; color: #dfeae2; }
.hope em { color: #f4c95d; font-style: normal; }
.rep { display: flex; justify-content: space-between; align-items: center; gap: 10px; padding: 12px 0; border-top: 1px solid var(--line); flex-wrap: wrap; }
.rep:first-child, .group + .rep { border-top: 0; }
.group { margin: 18px 0 0; padding-top: 12px; border-top: 2px solid var(--line); }
.rep .who { flex: 1 1 180px; } .rep .who strong, .rep .who span { display: block; }
.maybe { color: var(--gold-text); font-weight: 600; }
.rep .acts { display: flex; gap: 6px; flex-wrap: wrap; }
.addway legend { margin-top: 4px; }
.notice { background: var(--gold-soft); border-radius: 12px; padding: 12px; font-size: .95rem; }
.error { background: var(--rust-soft); color: var(--rust-text); border-radius: 12px; padding: 12px; font-weight: 600; }
footer.help { max-width: 560px; margin: 0 auto; padding: 16px 16px 28px; text-align: center; color: var(--muted); border-top: 1px solid var(--line); }
.helpline { display: flex; gap: 8px; }
.helpline a { flex: 1 1 0; flex-direction: column; gap: 0; min-height: 56px; padding: 6px 4px; font-size: 1.1rem; line-height: 1.2; }
.helpline a span { font-size: .72rem; font-weight: 500; color: var(--muted); }
/* Each helpline button's note: shown on hover or keyboard focus, hidden again with Escape. */
.tipwrap { position: relative; flex: 1 1 0; display: flex; min-width: 0; }
.tip { position: absolute; bottom: 100%; left: 50%; transform: translateX(-50%); width: min(290px, calc(100vw - 32px)); margin: 0 0 12px; padding: 11px 13px;
  border-radius: 12px; background: var(--ink); color: #fff; font-size: .85rem; line-height: 1.45; text-align: left; box-shadow: 0 8px 24px rgba(27, 42, 35, .25);
  z-index: 20; opacity: 0; visibility: hidden; transition: opacity .12s, visibility .12s; }
.tip strong { color: #f4c95d; }
.tip::after { content: ""; position: absolute; top: 100%; left: 50%; margin-left: -8px; border: 8px solid transparent; border-top-color: var(--ink); }
.tip::before { content: ""; position: absolute; top: 100%; left: 0; right: 0; height: 14px; }   /* the pointer can move onto the note without it closing */
.tipwrap:first-child .tip { left: 0; transform: none; } .tipwrap:first-child .tip::after { left: 40px; }
.tipwrap:last-child .tip { left: auto; right: 0; transform: none; } .tipwrap:last-child .tip::after { left: auto; right: 32px; }
@media (hover: hover) { .tipwrap:hover .tip { opacity: 1; visibility: visible; } }
.tipwrap:has(a:focus-visible) .tip { opacity: 1; visibility: visible; }
.tips-off .tip { opacity: 0 !important; visibility: hidden !important; }
.helpwhat { margin: 12px 0 0; text-align: left; }
.helpwhat summary { text-align: center; font-size: .9rem; }
.helpwhat ul { margin: 4px 0 0; padding-left: 1.1em; font-size: .9rem; color: var(--ink); }
.helpwhat li { margin: 0 0 10px; }
.helpwhat strong { color: var(--green); }
/* "For me" or "For someone else", on the first screen */
.who-for { display: flex; flex-wrap: wrap; gap: 8px; margin: 4px 0 14px; }   /* on a very narrow phone the two buttons stack */
.who-for .seg { flex: 1 1 auto; min-height: 46px; padding: 8px 8px; background: var(--card); color: var(--green); border: 2px solid var(--field); font-size: .93rem; white-space: nowrap; }
.who-for .seg[aria-pressed="true"] { background: var(--green-soft); border-color: var(--green); }
.who-for .seg[aria-pressed="true"]::before { content: "✓"; font-weight: 700; }
.card.helper { background: #fff8e8; border: 2px solid var(--gold); }
.tips { margin: 6px 0 0; padding-left: 1.1em; } .tips li { margin: 0 0 10px; }
.leaders { margin: 28px 0 0; }
.nophone-link { margin: 14px 0 0; }
.ways { padding-left: 1.3em; margin: 0 0 18px; }
.ways li { margin: 0 0 12px; padding-left: 4px; }
.print-only { display: none; }
.nowrap { white-space: nowrap; }

/* ---------- on paper: for someone with no phone, a list they can carry ---------- */
@media print {
  @page { margin: 14mm; }
  body { background: #fff; color: #000; font-size: 11pt; }
  main { max-width: none; padding: 0; }
  .print-only { display: block !important; }
  .topbar .muted, footer.help, .crumb, .steps, button, .toggle, .no-print, #filter, label[for="filter"], a.btn[target="_blank"], a.btn[href="#"], a.btn[href^="mailto:"] { display: none !important; }
  .more[hidden] { display: block !important; }   /* what you need and how to get it, for every place */
  .card { border: 1px solid #888; break-inside: avoid; background: #fff; }
  .tag, .tag.local { background: none; border: 1px solid #888; color: #000; }
  .hope { background: none; border: 1px solid #888; padding: 10px 12px; }
  .hope h2, .hope p, .hope em { color: #000 !important; }
  .notice, .flag, .reqs li.warn, .urgent { background: none; border: 1px solid #888; }
  a { color: #000; }
  a.btn, .btn { background: none !important; color: #000 !important; border: 0; padding: 0; min-height: 0; font-weight: 700; display: inline; }
  .msgcopy { white-space: pre-wrap; border: 1px solid #888; border-radius: 8px; padding: 10px; font-family: var(--serif); }
  textarea { display: none; }
}

/* ---------- leader ---------- */
.status { font-size: .9rem; font-weight: 600; color: var(--green); flex: 1; text-align: right; }
/* On a phone the status line gets its own row with room kept for it, so the page does not jump when it changes. */
@media (max-width: 640px) { .topbar { flex-wrap: wrap; } .status { order: 3; flex: 1 0 100%; text-align: left; min-height: 1.5em; } }
.tabs { display: flex; gap: 6px; margin: -6px -6px 10px; padding: 6px; overflow-x: auto; }   /* the padding keeps the focus ring from being clipped */
.tabs button { background: transparent; color: var(--muted); border: 2px solid transparent; min-height: 44px; padding: 8px 14px; white-space: nowrap; }
.tabs button.on { color: var(--green); border-color: var(--green); background: var(--card); }
.filters { display: flex; gap: 8px; flex-wrap: wrap; margin: 0 0 14px; }
.filters > div { flex: 1 1 130px; }
.filters label { margin: 0 0 2px; color: var(--muted); }
.filters select { padding: 9px 10px; }
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 10px; margin: 0 0 14px; }
.stat { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px; }
.stat b { display: block; font-family: var(--serif); font-size: 2.1rem; line-height: 1; }
.stat span { font-size: .85rem; color: var(--muted); }
.stat.unmet b { color: var(--rust-text); }
.grid2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 14px; }
.grid2 > *, .stats > * { min-width: 0; }
/* Each row: name and its numbers in words, then the bar underneath, so the numbers never depend on colour or hover. */
.bar-row { display: grid; grid-template-columns: 1fr auto; gap: 2px 10px; margin: 10px 0; font-size: .92rem; }
.bar-row .n { text-align: right; font-variant-numeric: tabular-nums; color: var(--muted); }
.bar { grid-column: 1 / -1; height: 14px; background: var(--green-soft); border-radius: 5px; overflow: hidden; display: flex; gap: 2px; }
.bar i { display: block; height: 100%; background: var(--green); }
.bar i.u, .trend i.u, .legend i.u { background: repeating-linear-gradient(135deg, var(--rust) 0 4px, #f3c9b6 4px 7px); }
/* open page: the unmet part is under 5, so the bar is not split */
.bar i.h, .trend i.h, .legend i.h { background: repeating-linear-gradient(90deg, var(--muted) 0 2px, transparent 2px 5px); }
.legend { font-size: .8rem; color: var(--muted); display: flex; flex-wrap: wrap; gap: 4px 16px; margin: 0 0 8px; }
.legend i { display: inline-block; width: 22px; height: 12px; border-radius: 2px; background: var(--green); margin-right: 6px; vertical-align: -1px; }
.trend { display: flex; align-items: flex-end; gap: 2px; height: 110px; overflow: hidden; }
.trend div { flex: 1 1 0; min-width: 0; display: flex; flex-direction: column; justify-content: flex-end; gap: 1px; height: 100%; }
.trend i { display: block; background: var(--green); }
details summary { cursor: pointer; padding: 10px 0; color: var(--green); font-weight: 600; }
.tablewrap { overflow-x: auto; }
table { border-collapse: collapse; width: 100%; font-size: .9rem; }
th, td { text-align: left; padding: 8px 10px; border-bottom: 1px solid var(--line); vertical-align: top; font-weight: 400; }
thead th { font-size: .75rem; font-weight: 700; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); white-space: nowrap; }
tbody th { font-weight: 700; }
td.num { text-align: right; font-variant-numeric: tabular-nums; }
td.acts { white-space: nowrap; } td.acts button + button { margin-left: 4px; }
.gaps { list-style: none; padding: 0; margin: 0; }
.gaps li { border-top: 1px solid var(--line); padding: 12px 0 2px; }
.gaps p { margin: 0 0 .5em; max-width: 75ch; }
.field label { margin-top: 0; }
.hint { display: block; margin: -4px 0 6px; }
.field-error { margin: 8px 0 0; padding: 8px 10px; }
[aria-invalid="true"] { border-color: var(--rust-text); }
.checks { display: flex; flex-wrap: wrap; gap: 6px 14px; }
.checks label { display: flex; align-items: center; gap: 8px; margin: 0; font-weight: 500; min-height: 36px; }
.checks input { width: 20px; height: 20px; accent-color: var(--green); }
.plainset legend { margin-top: 0; }
.toolbar { display: flex; justify-content: space-between; align-items: center; gap: 10px; flex-wrap: wrap; margin: 0 0 12px; }
dialog.card { width: min(420px, calc(100vw - 32px)); max-height: calc(100vh - 32px); overflow: auto; margin: auto; color: var(--ink); }
dialog::backdrop { background: rgba(27, 42, 35, .55); }
@media (max-width: 480px) { h1 { font-size: 1.75rem; } }
