:root {
  --forest: #143528;
  --deep: #0c2419;
  --green: #1c7a43;
  --green-2: #145c34;
  --cream: #f3efe6;
  --paper: #fffcf7;
  --ink: #17241c;
  --muted: #5c675f;
  --line: #e4dcd0;
  --brass: #a68456;
  --clay: #8c3a32;
  --amber: #8a5a12;
  --shadow: 0 18px 40px rgba(20, 53, 40, 0.08);
  --serif: "Fraunces", Georgia, serif;
  --sans: "Outfit", "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }
html, body { margin: 0; }
html { -webkit-text-size-adjust: 100%; }
button, a, label, summary { touch-action: manipulation; }
.scrim { display: none; }
.tabbar { display: none; }
body {
  min-height: 100vh;
  font-family: var(--sans);
  color: var(--ink);
  background: var(--cream);
  font-size: 16px;
  line-height: 1.5;
}
h1, h2, h3 { font-family: var(--serif); font-weight: 560; letter-spacing: -0.03em; margin: 0; }
p { margin: 0; }
a { color: var(--green-2); }
button, input, select, textarea { font: inherit; color: inherit; }
img { max-width: 100%; }

.nav-toggle { position: absolute; opacity: 0; pointer-events: none; }
body:not(.view-login) { display: grid; grid-template-columns: 260px 1fr; }
.sidebar {
  background: var(--deep);
  color: #f6f3ec;
  min-height: 100vh;
  max-height: 100vh;
  padding: 22px 16px 18px;
  display: flex;
  flex-direction: column;
  gap: 18px;
  overflow: hidden;
}
.brand, .who { display: flex; gap: 12px; align-items: flex-start; }
.brand strong, .who strong { display: block; font-size: 15px; }
.brand small, .who span, .meta { color: #c9d5cc; font-size: 13px; }
.who { flex-direction: column; gap: 4px; padding: 12px; background: rgba(255,255,255,.04); border-radius: 14px; }
.who span { color: #d5e0d8; }
.mark {
  width: 42px; height: 42px; display: grid; place-items: center;
  border-radius: 12px; background: var(--green); color: white;
  font-family: var(--serif); font-weight: 640; letter-spacing: -0.04em;
}
.nav { display: flex; flex-direction: column; gap: 4px; overflow: auto; min-height: 0; }
.nav a {
  color: #e7efe9; text-decoration: none; padding: 10px 12px; border-radius: 10px;
}
.nav a.active, .nav a:hover { background: rgba(255,255,255,.08); }
.signout { margin-top: auto; }
.signout button {
  width: 100%; background: transparent; color: #d7e2da; border: 1px solid rgba(255,255,255,.18);
  border-radius: 10px; padding: 10px 12px; cursor: pointer; text-align: left;
}
.shell { min-width: 0; }
.sheet-head, .header-menu { display: none; }
.topbar {
  display: flex; align-items: center; gap: 12px;
  padding: 16px 28px;
  background: white;
  border-bottom: 1px solid var(--line);
  position: sticky; top: 0; z-index: 5;
}
.topbar-copy { min-width: 0; flex: 1; }
.focus-form { margin-left: auto; }
.focus-form label {
  display: flex; flex-direction: column; gap: 3px;
  font-size: 11px; font-weight: 700; letter-spacing: .04em; text-transform: uppercase; color: var(--muted);
}
.focus-form select { min-width: 220px; min-height: 40px; text-transform: none; letter-spacing: 0; font-weight: 600; font-size: 15px; }
.paper-pair { display: inline-flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.write { display: block; border-bottom: 1px solid #222; min-height: 28px; margin: 6px 0; }
.tick { display: inline-block; width: 15px; height: 15px; border: 1.5px solid #222; margin: 0 3px 0 0; vertical-align: -2px; }
.tick-cell, .ticks { white-space: nowrap; }
tr.tall td { height: 36px; }
.paper-block { break-inside: avoid; margin: 12px 0; }
.paper-block h3 { font-size: 15px; margin: 0 0 4px; }
.paper-block .write { border-bottom: 1px solid #b5b5b5; min-height: 26px; margin: 0; }
.paper-person { break-after: page; margin-bottom: 28px; }
.paper-person:last-child { break-after: auto; }
.paper-person h2 { margin: 2px 0 10px; padding-bottom: 6px; border-bottom: 2px solid #1a1a1a; }
.paper-person .log-head th,
.paper-person .log-body th {
  background: #f3f3f3; color: #111; font-weight: 650; vertical-align: middle; padding: 7px 8px;
}
.paper-person .log-body th { font-size: 13px; letter-spacing: 0; }
.paper-person .log-head td,
.paper-person .log-body td { padding: 6px 8px; }
.paper-person tr.tall td { height: 66px; vertical-align: middle; }
.paper-person td.write-cell { padding: 1px 6px 0; vertical-align: bottom; }
.paper-person .ruled { height: 63px; }
.paper-person .ruled span {
  display: block; height: 21px; border-bottom: 1px solid #b5b5b5; box-sizing: border-box;
}
.paper-person .ruled span:last-child { border-bottom: 0; }
.paper-person tr.one-row td {
  height: 26px; padding: 1px 6px; vertical-align: bottom; line-height: 1.2;
}
.paper-person tr.one-row td.write-cell { height: 26px; padding: 0 6px; }
.paper-person .ruled.one { height: 22px; }
.paper-person .ruled.one span,
.paper-person .ruled.one span:last-child {
  height: 22px; border-bottom: 1px solid #b5b5b5;
}
.paper-person .w-name { width: 22%; }
.paper-person .w-support { width: 16%; }
.paper-person .w-dose { width: 12%; }
.paper-person .w-time { width: 11%; }
.paper-person .w-count { width: 176px; }
.paper-person .w-tick { width: 74px; }
.paper-person .w-init { width: 92px; }
.paper-person .w-date { width: 14%; }
.paper-person .tick-cell,
.paper-person .ticks { text-align: center; }
.sig { display: grid; grid-template-columns: 1fr 1fr; gap: 8px 28px; margin-top: 18px; }
.sig p { margin: 0; font-size: 12px; color: #333; }
.sig span { display: block; border-bottom: 1px solid #222; min-height: 32px; margin-bottom: 4px; }
.paper-person .sig { grid-template-columns: 1.45fr .75fr; gap: 22px 48px; margin-top: 28px; }
.paper-person .sig-label {
  display: block; min-height: 0; height: auto; margin: 0 0 4px; padding: 0; border: 0;
  font-size: 12px; line-height: 1.3; color: #333;
}
.paper-person .sig-rule {
  display: block; height: 36px; min-height: 36px; margin: 0; border: 0; border-bottom: 1.5px solid #222;
}
.paper-person .log-foot {
  margin: 42px 0 0; padding: 0; border: 0; text-align: center;
  font-size: 11px; font-weight: 500; letter-spacing: .03em; text-transform: none; color: #8a8a8a;
}
.paper-person.sheet-fit .log-head,
.paper-person.sheet-fit .log-body { margin-top: 8px; }
.paper-person.sheet-fit .log-instructions,
.paper-person.sheet-fit .log-note { margin: 4px 0; line-height: 1.3; }
.paper-person.sheet-fit .sig { gap: 10px 36px; margin-top: 12px; }
.paper-person.sheet-fit .sig-rule { height: 26px; min-height: 26px; }
.paper-person.sheet-fit .log-foot { margin: 12px 0 0; }
.print-note { max-width: 720px; }
.swipe-hint { display: none; }
.topbar h1 { font-size: 28px; line-height: 1.1; }
.topbar small { display: block; color: var(--muted); font-size: 13px; font-weight: 500; }
.hello {
  background: linear-gradient(155deg, #0c2419 0%, #1c7a43 100%);
  color: white; border-radius: 22px; padding: 18px 18px 16px; margin-bottom: 14px;
}
.hello p { color: #d7e6dc; font-size: 14px; }
.hello h2 { color: white; font-size: 30px; margin: 2px 0 8px; }
.hello span { color: #f4f1ea; font-size: 14px; }
.quick { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; margin-bottom: 14px; }
.quick a {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px;
  min-height: 72px; padding: 10px 4px; border-radius: 16px;
  background: var(--paper); border: 1px solid var(--line); color: var(--ink);
  text-decoration: none; font-size: 13px; font-weight: 600;
}
.quick svg { width: 22px; height: 22px; color: var(--green-2); }
.stat { position: relative; overflow: hidden; }
.stat::before {
  content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 4px; background: var(--green);
}
.wrap { padding: 18px 28px 48px; }
.lede, .help, .meta { color: var(--muted); }
.lede { max-width: 760px; margin-bottom: 16px; }
.help { margin-bottom: 12px; }

.banner { padding: 12px 14px; border-radius: 12px; margin-bottom: 16px; }
.banner-error { background: #f8e6e3; color: var(--clay); }
.banner-ok { background: #e5f4ea; color: var(--green-2); }
.card {
  background: var(--paper); border: 1px solid var(--line); border-radius: 18px;
  padding: 18px; box-shadow: var(--shadow); margin-bottom: 16px;
}
.card h2 { font-size: 26px; margin-bottom: 8px; }
.ask-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }
.card h3 { font-size: 20px; margin: 8px 0; }
.stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; margin-bottom: 16px; }
.stat { background: var(--paper); border: 1px solid var(--line); border-radius: 18px; padding: 16px; }
.stat strong { display: block; font-family: var(--serif); font-size: 34px; line-height: 1; }
.stat span { color: var(--muted); font-size: 14px; }
.split { display: grid; grid-template-columns: 1.2fr .8fr; gap: 16px; align-items: start; }
.narrow { max-width: 520px; }
.stack { display: grid; gap: 12px; }
label { display: grid; gap: 6px; font-size: 14px; font-weight: 600; }
input, select, textarea {
  width: 100%; border: 1px solid #d9d0c3; background: white; border-radius: 10px;
  padding: 10px 12px; font-weight: 400;
}
textarea { resize: vertical; }
input:focus, select:focus, textarea:focus { outline: 2px solid #cfe3d4; border-color: var(--green); }
.field-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 12px; }
.btn, .btn-line, .btn-danger {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  border-radius: 999px; padding: 10px 16px; text-decoration: none; border: 0; cursor: pointer;
  background: var(--green); color: white; font-weight: 600;
}
.btn-line { background: transparent; color: var(--green-2); border: 1px solid #b7d2c2; }
.btn-danger { background: transparent; color: var(--clay); border: 1px solid #e3b7b2; }
.btn-small { padding: 7px 12px; font-size: 14px; }
.actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 14px; }
.back { margin-top: 0; }
.page-tools, .row-actions, .print-tools { display: flex; flex-wrap: wrap; gap: 10px; align-items: end; margin-bottom: 16px; }
.filters { display: flex; flex-wrap: wrap; gap: 10px; align-items: end; }
.empty { color: var(--muted); padding: 8px 0; }
.people { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 12px; }
.person {
  display: grid; gap: 10px; color: inherit; background: var(--paper);
  border: 1px solid var(--line); border-radius: 16px; padding: 16px;
}
.person > a { display: grid; gap: 4px; text-decoration: none; color: inherit; }
.person:hover { border-color: #b7d2c2; }
.person span, .person em { color: var(--muted); font-style: normal; font-size: 14px; }
.card-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-bottom: 8px; }
.card-head h2 { margin: 0; }
.actions details { width: auto; }
.actions summary {
  display: inline-flex; align-items: center; justify-content: center; min-height: 36px;
  padding: 7px 12px; border-radius: 999px; border: 1px solid #b7d2c2; background: transparent;
  color: var(--green-2); font-size: 14px; font-weight: 600; list-style: none;
}
.actions summary::-webkit-details-marker { display: none; }
.resident-head { margin-bottom: 12px; }
.resident-head h2 { margin-bottom: 4px; }
.resident-head .meta { margin: 0 0 12px; }
.fold-radio { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
.fold-nav { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 12px; }
.fold-nav label {
  display: inline-flex; align-items: center; justify-content: center; min-height: 40px;
  padding: 8px 14px; border-radius: 999px; border: 1px solid #b7d2c2; background: white;
  color: var(--green-2); font-weight: 600; cursor: pointer;
}
.fold-panel { display: none; }
#fold-profile:checked ~ #panel-profile,
#fold-adl:checked ~ #panel-adl,
#fold-meds:checked ~ #panel-meds,
#fold-behaviors:checked ~ #panel-behaviors,
#fold-notes:checked ~ #panel-notes,
#fold-binder:checked ~ #panel-binder,
#fold-paper:checked ~ #panel-paper,
#fold-access:checked ~ #panel-access { display: block; }
#fold-profile:checked ~ .fold-nav label[for="fold-profile"],
#fold-adl:checked ~ .fold-nav label[for="fold-adl"],
#fold-meds:checked ~ .fold-nav label[for="fold-meds"],
#fold-behaviors:checked ~ .fold-nav label[for="fold-behaviors"],
#fold-notes:checked ~ .fold-nav label[for="fold-notes"],
#fold-binder:checked ~ .fold-nav label[for="fold-binder"],
#fold-paper:checked ~ .fold-nav label[for="fold-paper"],
#fold-access:checked ~ .fold-nav label[for="fold-access"] { background: var(--green); color: white; border-color: var(--green); }
label.btn { cursor: pointer; }
.badge {
  display: inline-flex; align-items: center; border-radius: 999px; padding: 3px 8px;
  font-size: 12px; font-style: normal; font-weight: 600; background: #efe7da; color: var(--ink);
}
.badge-trial { background: #f4e4c8; color: var(--amber); }
.badge-licensed { background: #d9f0e2; color: var(--green-2); }
.badge-suspended, .badge-off { background: #f6ddd9; color: var(--clay); }
.home-row { padding: 12px 0; border-top: 1px solid var(--line); }
.home-row header { display: flex; justify-content: space-between; gap: 8px; align-items: center; }
.home-row h3 { font-size: 22px; }
.plain { list-style: none; margin: 12px 0 0; padding: 0; display: grid; gap: 12px; }
.plain li { display: grid; gap: 4px; padding-top: 10px; border-top: 1px solid var(--line); }
.plain a { font-weight: 600; text-decoration: none; }
.prose { white-space: pre-wrap; overflow-wrap: anywhere; }
.facts { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 12px; margin: 0 0 12px; }
.facts div { display: grid; gap: 2px; }
.facts dt { color: var(--muted); font-size: 13px; }
.facts dd { margin: 0; }
.checks { display: grid; gap: 8px; margin-bottom: 12px; }
.check { font-weight: 500; grid-template-columns: auto 1fr; align-items: center; }
.check input { width: auto; }
.is-off { color: var(--muted); }
.inline-form { display: flex; flex-wrap: wrap; gap: 10px; align-items: end; margin-top: 14px; }
.inline-form label { flex: 1 1 180px; }
.timeline { list-style: none; margin: 16px 0 0; padding: 0; display: grid; gap: 14px; }
.timeline li { border-top: 1px solid var(--line); padding-top: 12px; }
.timeline header { display: flex; justify-content: space-between; gap: 8px; }
.timeline span, .table-wrap { color: var(--muted); }
table { width: 100%; border-collapse: collapse; color: var(--ink); }
th, td { text-align: left; vertical-align: top; padding: 8px 10px; border-bottom: 1px solid var(--line); font-size: 14px; }
th { font-size: 12px; letter-spacing: .04em; text-transform: uppercase; color: var(--muted); }
.table-wrap { overflow-x: auto; color: inherit; }
.adl-list { display: grid; gap: 12px; }
.adl-item { display: grid; gap: 8px; padding-top: 10px; border-top: 1px solid var(--line); }
.behavior-person { margin: 8px 0 12px; }
.behavior-person h2 { margin: 0; font-size: 22px; }
.behavior-card { display: grid; gap: 10px; }
.behavior-card > summary {
  display: flex; align-items: center; gap: 12px; list-style: none; min-height: 44px;
}
.behavior-card > summary::-webkit-details-marker { display: none; }
.behavior-card > summary::after {
  content: "Open"; margin-left: auto; flex: none;
  border: 1px solid #b7d2c2; border-radius: 999px; padding: 6px 12px;
  font-family: var(--sans); font-size: 14px; font-weight: 600; letter-spacing: 0; color: var(--green-2);
}
.behavior-card[open] > summary::after { content: "Close"; }
.behavior-title { font-family: var(--serif); font-size: 26px; font-weight: 560; letter-spacing: -0.03em; }
.behavior-month { color: var(--muted); font-size: 14px; font-weight: 500; white-space: nowrap; }
.event-row { display: grid; grid-template-columns: 150px 72px 1fr; gap: 12px; align-items: end; }
.event-count { margin: 0; }
.event-count span { display: block; font-size: 14px; font-weight: 600; }
.event-count strong { display: flex; align-items: center; min-height: 44px; font-size: 22px; font-weight: 600; }
.event-label { margin: 4px 0 0; color: var(--muted); font-size: 13px; }
.event-remove { display: flex; align-items: center; gap: 8px; color: var(--muted); font-size: 14px; }
.event-remove input { width: 18px; height: 18px; }
.month-events .col-time { width: 14%; }
.month-events .col-count { width: 12%; }
.adl-item span { color: var(--muted); font-size: 13px; margin-left: 8px; }
.choices { display: flex; flex-wrap: wrap; gap: 8px; }
.choice {
  display: flex; align-items: center; gap: 6px; font-weight: 600; border: 1px solid var(--line);
  border-radius: 999px; padding: 6px 10px; background: white;
}
.choice input { width: auto; }
.choice-done:has(input:checked) { background: #e5f4ea; border-color: #b7d2c2; }
.choice-refused:has(input:checked) { background: #f8e6e3; border-color: #e3b7b2; }
.choice-not_recorded:has(input:checked) { background: #f4e4c8; border-color: #e6d2ae; }
.note-field { font-weight: 500; }
details { width: 100%; }
summary { cursor: pointer; color: var(--green-2); font-weight: 600; }
details form { margin-top: 8px; }
.fold-card > summary {
  font-family: var(--serif); font-size: 26px; font-weight: 560; letter-spacing: -0.03em;
  color: var(--ink); line-height: 1.2;
}
.fold-card[open] > summary { margin-bottom: 10px; }

.view-login { display: block; background:
  radial-gradient(circle at top left, rgba(28,122,67,.18), transparent 28%),
  var(--cream); }
.view-login .shell { min-height: 100vh; display: grid; place-items: center; }
.auth-wrap { width: min(480px, calc(100% - 32px)); padding: 24px 0; }
.auth-card {
  background: var(--paper); border: 1px solid var(--line); border-radius: 24px;
  padding: 28px; box-shadow: var(--shadow);
}
.auth-card h1 { font-size: 40px; margin: 10px 0; }
.auth-card .lede { margin-bottom: 18px; }

.log-sheet { background: white; color: black; border: 1px solid #222; padding: 18px; }
.log-agency, .log-cite, .log-foot { font-size: 12px; letter-spacing: .04em; text-transform: uppercase; }
.sig-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 28px; margin-top: 28px; }
.sig-grid div { border-top: 1px solid #222; padding-top: 6px; min-height: 48px; }
.plan-block { margin-top: 14px; }
.plan-block h3 { font-size: 18px; margin-bottom: 4px; }
.log-sheet h2 { font-size: 28px; margin: 4px 0; }
.log-instructions, .log-note { font-size: 13px; margin: 8px 0; }
.log-scroll { overflow-x: auto; }
.log-head, .log-body { width: 100%; border-collapse: collapse; margin-top: 12px; }
.log-scroll .log-body { min-width: 720px; }
.day-who { font-size: 18px; margin: 16px 0 0; }
.report-day { margin-top: 16px; break-inside: avoid; page-break-inside: avoid; }
.report-day h3 { font-family: var(--serif); font-size: 18px; margin: 0; }
.report-day .day-who { margin: 2px 0 0; font-size: 14px; }
.report-sheet { margin-top: 6px; table-layout: fixed; }
.report-sheet .col-name { width: 18%; }
.report-sheet .col-support { width: 14%; }
.report-sheet .col-dose { width: 12%; }
.report-sheet .col-time { width: 11%; }
.report-sheet .col-tick { width: 10%; }
.report-sheet .col-held { width: 13%; }
.report-sheet .col-init { width: 11%; }
.report-sheet th, .report-sheet td { padding: 4px 6px; vertical-align: middle; font-size: 13px; }
.tick.on::after {
  content: "✓";
  display: block;
  text-align: center;
  font-size: 12px;
  line-height: 13px;
  color: #111;
  font-weight: 700;
}
.day-chart { min-width: 0; }
.log-head th, .log-head td, .log-body th, .log-body td { border: 1px solid #222; color: black; }
.log-body th { text-transform: none; letter-spacing: 0; font-size: 13px; color: black; }

.report-card { max-width: 720px; }
.report-resident.is-off { opacity: .55; }
.report-blank {
  border: 0; margin: 4px 0 0; padding: 14px 0 0;
  border-top: 1px solid var(--line);
}
.report-blank legend { font-size: 14px; font-weight: 650; padding: 0; }
.report-sheets { display: flex; flex-wrap: wrap; gap: 8px 18px; margin: 8px 0 12px; }
.report-sheets label { display: flex; align-items: center; gap: 8px; font-weight: 600; }
.report-sheets input { width: auto; }
.report-month { max-width: 220px; }
.report-blank[hidden] { display: none; }
.month-home {
  font-family: var(--serif); font-size: 16px; font-weight: 560;
  margin: 0; letter-spacing: 0; text-transform: none; color: #111;
}
.month-form h2 { margin: 2px 0 4px; }
.month-cite { margin: 0 0 8px; font-size: 12px; letter-spacing: .03em; }
.month-id { display: grid; grid-template-columns: 1.4fr .7fr 1fr; gap: 8px 16px; margin: 8px 0 4px; }
.month-id p { margin: 0; font-size: 12px; color: #333; }
.month-id .write { min-height: 22px; margin-top: 2px; font-size: 15px; line-height: 20px; color: #111; }
.month-form .tick.on::after { font-size: 10px; line-height: 11px; }
.month-day { margin-top: 14px; break-inside: avoid; page-break-inside: avoid; }
.month-day h3 { font-size: 16px; margin: 0 0 4px; }
.month-continued { margin: 0 0 6px; font-size: 11px; letter-spacing: .02em; color: #555; }
.month-table { margin-top: 0; table-layout: fixed; }
.month-form .col-name { width: 22%; }
.month-form .col-support { width: 16%; }
.month-form .col-dose { width: 12%; }
.month-form .col-time { width: 11%; }
.month-form .col-tick { width: 9%; }
.month-form .col-held { width: 13%; }
.month-form .col-count { width: 168px; }
.month-form .col-init { width: 12%; }
.month-form .month-row td,
.month-form .month-table th { height: 22px; padding: 2px 5px; vertical-align: middle; font-size: 12px; }
.month-form .tick { width: 13px; height: 13px; margin: 0 2px 0 0; }
.month-line { display: block; height: 14px; border-bottom: 1px solid #b5b5b5; }
.month-notes { margin: 6px 0 0; font-size: 12px; color: #222; }
.month-notes span { display: block; border-bottom: 1px solid #222; height: 26px; margin-top: 2px; }
.month-sign {
  display: grid; grid-template-columns: 1.4fr .6fr; gap: 12px 40px;
  max-width: 480px; margin-top: 22px; break-inside: avoid; page-break-inside: avoid;
}
.month-sign p { margin: 0; font-size: 12px; color: #333; }
.month-sign span { display: block; border-bottom: 1px solid #222; height: 26px; margin-top: 2px; }

@media (max-width: 980px) {
  .stats, .split { grid-template-columns: 1fr; }
}
@media (max-width: 860px) {
  body:not(.view-login) { display: block; }
  body:has(#nav-toggle:checked) { overflow: hidden; }
  .sidebar {
    position: fixed; left: 0; right: 0; bottom: 0; top: auto;
    width: 100%; min-height: 0; max-height: min(82vh, 680px);
    border-radius: 22px 22px 0 0; z-index: 40;
    transform: translateY(110%); transition: transform .22s ease;
    padding: 8px 16px calc(14px + env(safe-area-inset-bottom));
    box-shadow: 0 -16px 40px rgba(0, 0, 0, .28);
  }
  .sidebar::before {
    content: ""; display: block; width: 42px; height: 4px; border-radius: 99px;
    background: rgba(255,255,255,.35); margin: 2px auto 8px;
  }
  .nav-toggle:checked ~ .sidebar { transform: none; }
  .nav-toggle:checked ~ .scrim {
    display: block; position: fixed; inset: 0; background: rgba(12, 36, 25, .5); z-index: 35;
  }
  .sheet-head {
    display: flex; align-items: center; justify-content: space-between; gap: 12px;
    color: white; font-size: 18px;
  }
  .sheet-close {
    display: inline-flex; align-items: center; justify-content: center;
    min-width: 76px; min-height: 44px; padding: 0 14px; border-radius: 999px;
    background: white; color: var(--deep); font-weight: 700; font-size: 15px; cursor: pointer;
  }
  .nav a { min-height: 48px; display: flex; align-items: center; font-size: 17px; }
  .signout button { min-height: 48px; }
  .topbar {
    background: var(--deep); color: white; border-bottom: 0; z-index: 8;
    padding: calc(12px + env(safe-area-inset-top)) 14px 12px;
    box-shadow: 0 8px 24px rgba(12, 36, 25, .18);
  }
  .topbar h1 { color: white; font-size: 22px; }
  .topbar small { color: #d5e0d8; }
  .topbar { flex-wrap: wrap; }
  .topbar .mark { width: 36px; height: 36px; flex: none; }
  .focus-form { order: 5; flex: 1 1 100%; margin: 8px 0 0; }
  .focus-form label { color: #d5e0d8; }
  .focus-form select { width: 100%; min-height: 44px; background: white; color: var(--ink); }
  .header-menu {
    display: inline-flex; align-items: center; justify-content: center;
    min-height: 40px; padding: 0 14px; border-radius: 999px; cursor: pointer;
    background: rgba(255,255,255,.12); color: white; font-weight: 700; font-size: 14px;
  }
  .wrap { padding: 8px 16px calc(96px + env(safe-area-inset-bottom)); }
  .tabbar {
    display: flex; position: fixed; left: 0; right: 0; bottom: 0; z-index: 30;
    background: #fffcf7; border-top: 1px solid var(--line);
    padding: 4px 6px calc(6px + env(safe-area-inset-bottom));
    box-shadow: 0 -8px 24px rgba(20, 53, 40, .06);
  }
  .tabbar a, .tabbar label {
    flex: 1; min-width: 0; min-height: 52px;
    display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px;
    color: var(--muted); text-decoration: none; font-size: 11px; font-weight: 600; cursor: pointer;
  }
  .tabbar svg { width: 22px; height: 22px; }
  .tabbar a.active, .tabbar label.active, .nav-toggle:checked ~ .tabbar .tab-more { color: var(--green-2); }
  input, select, textarea { font-size: 16px; }
  .btn, .choice, summary { min-height: 44px; }
  .choice { padding: 10px 14px; }
  .stats { grid-template-columns: 1fr 1fr; }
  .card { padding: 14px; border-radius: 16px; }
  .card h2, .fold-card > summary, .behavior-title { font-size: 22px; }
  .behavior-card > summary { flex-wrap: wrap; }
  .day-chart, .day-chart tbody, .day-chart tr, .day-chart td { display: block; width: auto; }
  .day-chart thead { display: none; }
  .day-chart tr { border: 1px solid #222; margin: 8px 0; padding: 8px 10px; }
  .day-chart td { border: 0; padding: 2px 0; }
  .day-chart td::before { content: attr(data-label); display: block; font-size: 11px; letter-spacing: .04em; text-transform: uppercase; color: #555; }
  .sig-grid { grid-template-columns: 1fr; }
  .auth-wrap { width: min(480px, calc(100% - 24px)); padding-top: calc(24px + env(safe-area-inset-top)); }
  body { overflow-x: clip; }
  .topbar-copy { overflow: hidden; }
  .topbar h1, .topbar small { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  body:has(.tab-more) .header-menu { display: none; }
  .hello { padding: 16px; }
  .hello h2 { font-size: 26px; }
  .quick a { min-height: 68px; }
  .field-row { grid-template-columns: 1fr; }
  .event-row { grid-template-columns: 1fr 1fr; }
  .event-row .event-note { grid-column: 1 / -1; }
  .card-head { flex-wrap: wrap; align-items: flex-start; }
  .card-head h2 { font-size: 22px; }
  .card-head .btn, .btn-small, .actions summary { min-height: 44px; }
  .choices { display: grid; grid-template-columns: 1fr 1fr; }
  .choice { justify-content: center; text-align: center; min-height: 48px; padding: 10px 8px; }
  .choice input { width: 18px; height: 18px; }
  .choices .choice:last-child:nth-child(odd) { grid-column: 1 / -1; }
  .view-adl .page-tools,
  .view-meds .page-tools,
  .view-behavior .page-tools { display: grid; grid-template-columns: 1fr 1fr; align-items: stretch; }
  .view-adl .page-tools > .btn,
  .view-meds .page-tools > .btn,
  .view-behavior .page-tools > .btn { width: 100%; }
  .view-adl .page-tools .filters,
  .view-meds .page-tools .filters,
  .view-behavior .page-tools .filters { grid-column: 1 / -1; display: grid; grid-template-columns: 1fr auto; }
  .fold-nav {
    flex-wrap: nowrap; overflow-x: auto; gap: 8px;
    scrollbar-width: none; -webkit-overflow-scrolling: touch;
  }
  .fold-nav::-webkit-scrollbar { display: none; }
  .fold-nav label { flex: none; }
  .save-bar {
    position: sticky; bottom: calc(64px + env(safe-area-inset-bottom)); z-index: 6;
    margin: 4px 0 0; padding: 10px 0 2px;
    background: linear-gradient(transparent, var(--cream) 36%);
  }
  .save-bar .btn { width: 100%; min-height: 50px; }
  .view-clock .actions .btn { width: 100%; min-height: 52px; }
  .print-tools .btn { flex: 1 1 140px; }
  .swipe-hint {
    display: block; margin: -6px 0 12px; color: var(--muted); font-size: 13px;
  }
  .log-sheet {
    overflow-x: auto; max-width: 100%;
    -webkit-overflow-scrolling: touch; overscroll-behavior-x: contain;
  }
  .log-sheet .log-body, .log-sheet .log-head { min-width: 680px; }
  .table-wrap { overflow: visible; }
  .table-wrap table, .table-wrap tbody, .table-wrap tr, .table-wrap td { display: block; width: 100%; }
  .table-wrap thead { display: none; }
  .table-wrap tr {
    border: 1px solid var(--line); border-radius: 14px; margin: 0 0 10px;
    padding: 10px 12px; background: white;
  }
  .table-wrap td { border: 0; padding: 4px 0; }
  .table-wrap td[data-label]::before {
    content: attr(data-label); display: block; font-size: 11px; font-weight: 700;
    letter-spacing: .04em; text-transform: uppercase; color: var(--muted);
  }
  .table-wrap td.no-label::before { content: none; }
}
@media (max-width: 420px) {
  .quick { gap: 6px; }
  .quick a { font-size: 12px; padding: 8px 2px; }
}
@media print {
  @page { margin: 0; }
  body { display: block !important; background: white; }
  .sidebar, .topbar, .print-tools, .print-note, .swipe-hint, .banner, .nav-toggle, .scrim, .tabbar { display: none !important; }
  .save-bar { position: static; background: none; padding: 0; }
  .table-wrap { overflow: visible; }
  .table-wrap table { display: table !important; width: 100%; }
  .table-wrap thead { display: table-header-group !important; }
  .table-wrap tbody { display: table-row-group !important; }
  .table-wrap tr { display: table-row !important; border: 0; margin: 0; padding: 0; border-radius: 0; background: transparent; }
  .table-wrap td { display: table-cell !important; width: auto; }
  .table-wrap td::before { content: none !important; }
  .wrap { padding-bottom: 0 !important; }
  .shell, .wrap, .log-sheet { display: block; width: auto; margin: 0; box-shadow: none; border: 0; }
  .shell, .wrap { padding: 0; }
  .log-sheet { padding: 0.5in; }
  .paper-person.sheet-fit { margin-bottom: 0; }
  .log-head th, .log-body th { display: table-cell; }
  thead { display: table-header-group; }
  .day-chart { display: table !important; width: 100%; }
  .day-chart thead { display: table-header-group !important; }
  .day-chart tbody { display: table-row-group !important; }
  .day-chart tr { display: table-row !important; border: 0; margin: 0; padding: 0; }
  .day-chart td, .day-chart th { display: table-cell !important; }
  .day-chart td::before { content: none !important; }
  .month-page { break-before: page; page-break-before: always; }
  .month-sign { grid-template-columns: 1.4fr .6fr; }
}
