:root {
  --paper: #f6f7f5;
  --white: #ffffff;
  --ink: #1e2b30;
  --muted: #56656b;
  --line: #d6dcd8;
  --harbor: #24506b;
  --harbor-deep: #183a4f;
  --folder: #e9dfc6;
  --folder-edge: #cdbf9c;
  --done: #3d7a57;
  --soon: #9a6512;
  --critical: #a8432f;
  --serif: "Literata", Georgia, "Times New Roman", serif;
  --sans: "Atkinson Hyperlegible", "Segoe UI", system-ui, sans-serif;
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--paper); color: var(--ink); font: 17px/1.55 var(--sans); }
h1, h2, h3 { font-family: var(--serif); font-weight: 600; line-height: 1.2; margin: 0 0 .5em; }
h2 { font-size: 1.3rem; }
h3 { font-size: 1.05rem; }
p { margin: 0 0 .8em; }
a { color: var(--harbor); }
button { font: inherit; color: inherit; }
:focus-visible { outline: 3px solid #e2a83a; outline-offset: 2px; }
.muted { color: var(--muted); }
.crit { color: var(--critical); }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

.demo-bar { display: flex; justify-content: space-between; gap: 16px; flex-wrap: wrap; background: var(--harbor-deep); color: #e3ecf1; padding: 10px 28px; font-size: .9rem; }
.demo-bar p { margin: 0; }
.demo-bar a { color: var(--white); }

.case-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 24px; flex-wrap: wrap; max-width: 1120px; margin: 0 auto; padding: 32px 28px 8px; }
.case-head h1 { font-size: 2rem; margin: 0; }
.case-meta { color: var(--muted); margin: 4px 0 0; }
.people { list-style: none; margin: 0; padding: 0; display: flex; gap: 8px; flex-wrap: wrap; }
.people li { background: var(--white); border: 1px solid var(--line); border-radius: 20px; padding: 4px 12px; font-size: .85rem; color: var(--muted); }
.people strong { color: var(--ink); margin-right: 4px; }

.tabs { display: flex; gap: 4px; max-width: 1120px; margin: 20px auto 0; padding: 0 28px; overflow-x: auto; }
.tabs [role="tab"] { border: 1px solid transparent; border-bottom: 0; background: transparent; padding: 10px 18px; border-radius: 8px 8px 0 0; cursor: pointer; color: var(--muted); font-weight: 700; white-space: nowrap; }
.tabs [role="tab"][aria-selected="true"] { background: var(--folder); border-color: var(--folder-edge); color: var(--ink); }

main { max-width: 1120px; margin: 0 auto; padding: 0 28px; }
[role="tabpanel"] { background: var(--white); border: 1px solid var(--line); border-top: 6px solid var(--folder); border-radius: 0 8px 8px 8px; padding: 32px; min-height: 420px; }

/* Readiness */
.ready-top { display: grid; grid-template-columns: 1fr 1.3fr; gap: 32px; align-items: start; margin-bottom: 28px; }
.pct { font-family: var(--serif); font-size: 2.6rem; font-weight: 600; margin: 0; line-height: 1.1; }
.answers { display: grid; gap: 8px; }
.answer { display: flex; justify-content: space-between; gap: 12px; padding: 10px 14px; border-radius: 6px; border: 1px solid var(--line); }
.answer.yes strong { color: var(--done); }
.answer.no strong { color: var(--soon); }
.phase-list { list-style: none; margin: 0 0 28px; padding: 0; }
.phase-list li { display: grid; grid-template-columns: 230px 1fr 170px; gap: 16px; align-items: center; padding: 8px 0; border-bottom: 1px solid #edf0ee; }
.ph-bar { height: 10px; background: #e6ebe7; border-radius: 5px; overflow: hidden; }
.ph-bar span { display: block; height: 100%; background: var(--done); transition: width .4s ease; }
.ph-count { font-size: .9rem; color: var(--muted); }
.next { padding-left: 1.2em; }
.next li { margin-bottom: 12px; }

/* What's missing */
.intro { color: var(--muted); }
.filters { display: flex; gap: 8px; flex-wrap: wrap; margin: 12px 0 20px; }
.filters button { border: 1px solid var(--line); background: var(--white); border-radius: 20px; padding: 6px 14px; cursor: pointer; }
.filters button[aria-pressed="true"] { background: var(--harbor); border-color: var(--harbor); color: var(--white); }
.gap-list { list-style: none; margin: 0; padding: 0; }
.gap-list > li { display: flex; justify-content: space-between; gap: 20px; align-items: flex-start; padding: 18px 0 18px 16px; border-bottom: 1px solid var(--line); border-left: 4px solid var(--line); margin-bottom: 4px; }
.gap-list > li.u-critical { border-left-color: var(--critical); }
.gap-list > li.u-soon { border-left-color: var(--soon); }
.gap-list h3 { margin: 2px 0 4px; }
.tag { font-size: .8rem; font-weight: 700; }
.u-critical .tag { color: var(--critical); }
.u-soon .tag { color: var(--soon); }
.u-routine .tag { color: var(--muted); }
.note { background: var(--paper); border-radius: 6px; padding: 8px 12px; font-size: .95rem; }
details summary { cursor: pointer; color: var(--harbor); font-size: .95rem; }
details p { margin-top: 6px; font-size: .95rem; }
.btn { display: inline-block; font-weight: 700; padding: 10px 16px; border-radius: 6px; border: 1.5px solid var(--harbor); background: var(--white); color: var(--harbor); text-decoration: none; cursor: pointer; white-space: nowrap; }
.btn:hover { background: var(--harbor); color: var(--white); }
.btn.small { padding: 7px 12px; font-size: .9rem; }
.empty { color: var(--muted); padding: 16px 0; }

/* Care */
.elders { display: grid; grid-template-columns: 1fr 1fr; gap: 24px; margin-bottom: 28px; }
.elder { border: 1px solid var(--line); border-radius: 8px; padding: 20px; }
fieldset { border: 0; padding: 0; margin: 0 0 16px; }
legend { font-weight: 700; font-size: .9rem; margin-bottom: 6px; }
.levels { display: flex; gap: 6px; margin-bottom: 8px; }
.levels button { width: 40px; height: 40px; border-radius: 6px; border: 1px solid var(--line); background: var(--white); cursor: pointer; font-weight: 700; }
.levels button[aria-pressed="true"] { background: var(--harbor); border-color: var(--harbor); color: var(--white); }
.adls { display: grid; grid-template-columns: 1fr 1fr; gap: 4px 12px; margin-bottom: 8px; }
.adls label { font-size: .95rem; display: flex; gap: 6px; align-items: center; }
.flag { color: var(--soon); font-weight: 700; font-size: .95rem; }
.calc, .hospice { border-top: 1px solid var(--line); padding-top: 24px; margin-top: 8px; }
.hospice p { max-width: 75ch; }
.calc-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; margin: 12px 0 16px; }
.calc-grid label { font-size: .85rem; font-weight: 700; display: flex; flex-direction: column; gap: 4px; }
.calc-grid input { font: inherit; font-weight: 400; padding: 8px 10px; border: 1px solid var(--line); border-radius: 6px; width: 100%; }
.calc-out { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; margin: 0 0 12px; }
.calc-out div { background: var(--paper); border-radius: 6px; padding: 12px 14px; }
.calc-out dt { font-size: .85rem; color: var(--muted); }
.calc-out dd { margin: 2px 0 0; font-family: var(--serif); font-size: 1.5rem; font-weight: 600; }

/* House */
.house-grid { display: grid; grid-template-columns: 1.3fr 1fr; gap: 36px; }
.house-grid .calc-grid { grid-template-columns: 1fr 1fr; }
.house-grid .calc-out { grid-template-columns: 1fr 1fr; }
.ledger { width: 100%; border-collapse: collapse; font-size: .95rem; margin-bottom: 16px; }
.ledger th, .ledger td { text-align: left; padding: 8px 6px; border-bottom: 1px solid var(--line); }
.ledger .num { text-align: right; font-variant-numeric: tabular-nums; }
.owed { list-style: none; padding: 0; margin: 0 0 12px; }
.owed li { display: flex; justify-content: space-between; padding: 6px 0; border-bottom: 1px solid #edf0ee; }

/* Packets */
.packet { background: var(--folder); border: 1px solid var(--folder-edge); border-radius: 8px; padding: 18px; }
.packet-page { background: var(--white); border-radius: 4px; padding: 28px 32px; max-width: 720px; box-shadow: 0 10px 24px -18px rgba(30, 43, 48, .5); }
.contents { list-style: none; padding: 0; margin: 0 0 20px; }
.contents li { display: flex; justify-content: space-between; padding: 7px 0; border-bottom: 1px dotted var(--line); }
.contents li span { font-size: .85rem; }
.contents .in span { color: var(--done); font-weight: 700; }
.contents .out { color: #9aa5a9; }
.entry { border-left: 3px solid var(--done); padding-left: 12px; }
.entry.redacted { border-left-color: var(--line); color: var(--muted); font-style: italic; }

.demo-foot { max-width: 1120px; margin: 0 auto; padding: 28px; display: flex; justify-content: space-between; align-items: center; gap: 16px; flex-wrap: wrap; color: var(--muted); font-size: .9rem; }
.demo-foot p { margin: 0; }

@media (max-width: 860px) {
  .ready-top, .elders, .house-grid { grid-template-columns: 1fr; }
  .phase-list li { grid-template-columns: 1fr auto; }
  .ph-bar { grid-column: 1 / -1; grid-row: 2; }
  .calc-grid { grid-template-columns: 1fr 1fr; }
  .calc-out { grid-template-columns: 1fr; }
}
@media (max-width: 560px) {
  main, .case-head, .tabs { padding-left: 16px; padding-right: 16px; }
  [role="tabpanel"] { padding: 20px; }
  .gap-list > li { flex-direction: column; }
  .adls { grid-template-columns: 1fr; }
}
@media (prefers-reduced-motion: reduce) { .ph-bar span { transition: none; } }
