:root {
  --paper: #faf7f2;
  --ink: #1b1a17;
  --muted: #6a645a;
  --line: #e1dacc;
  --accent: #c2371a;
  --wash: #f1ebdf;
  --serif: "Iowan Old Style", "Palatino Linotype", Palatino, Georgia, serif;
  --sans: system-ui, -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  font-family: var(--sans);
  color: var(--ink);
  background: var(--paper);
  font-synthesis: none;
}
* { box-sizing: border-box; }
body { margin: 0; font-size: 17px; line-height: 1.5; }
a { color: inherit; text-underline-offset: 3px; text-decoration-thickness: 1px; }
a:hover { color: var(--accent); }
button, input { font: inherit; color: inherit; touch-action: manipulation; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; border-radius: 2px; }
.wrap { max-width: 1120px; margin: 0 auto; padding: 0 24px; }
.skip { position: absolute; left: -999px; }
.skip:focus { left: 16px; top: 12px; background: var(--ink); color: var(--paper); padding: 8px 12px; z-index: 10; }

header.site .wrap, footer.site .wrap { display: flex; align-items: baseline; justify-content: space-between; gap: 16px 24px; flex-wrap: wrap; }
header.site .wrap { padding-top: 20px; padding-bottom: 20px; }
.brand { font-family: var(--serif); font-size: 24px; font-weight: 700; letter-spacing: -0.4px; text-decoration: none; }
.site nav { display: flex; gap: 24px; flex-wrap: wrap; }
.site nav a { text-decoration: none; color: var(--muted); font-size: 15px; }
.site nav a[aria-current="page"] { color: var(--ink); box-shadow: 0 2px 0 var(--accent); }
footer.site { border-top: 1px solid var(--line); margin-top: 96px; }
footer.site .wrap { padding-top: 28px; padding-bottom: 40px; }

.start { padding: 56px 0 40px; max-width: 760px; }
.eyebrow { margin: 0 0 12px; font-size: 13px; letter-spacing: 1.6px; text-transform: uppercase; color: var(--accent); font-weight: 600; }
h1 { font-family: var(--serif); font-size: clamp(36px, 6.4vw, 64px); line-height: 1.04; letter-spacing: -1.4px; margin: 0 0 18px; font-weight: 700; text-wrap: balance; overflow-wrap: break-word; }
.lead { font-size: 19px; color: var(--muted); margin: 0 0 32px; max-width: 34em; }
.date-field { display: flex; flex-wrap: wrap; align-items: center; gap: 12px 20px; }
.date-field label { font-family: var(--serif); font-size: 24px; font-weight: 700; }
.date-field input { font-size: 20px; padding: 12px 14px; border: 1.5px solid var(--ink); border-radius: 6px; background: #fff; min-height: 52px; min-width: 190px; }
.countdown { margin: 18px 0 0; font-weight: 600; }
.error { color: var(--accent); margin: 6px 0 0; min-height: 0; }
.error:empty { display: none; }
.notice { color: var(--muted); border-left: 3px solid var(--line); padding-left: 14px; }

.workspace { display: grid; grid-template-columns: 280px minmax(0, 1fr); gap: 56px; align-items: start; border-top: 1px solid var(--ink); padding-top: 32px; }
.controls { position: sticky; top: 20px; display: grid; gap: 22px; }
fieldset { border: 0; padding: 0; margin: 0; }
legend { padding: 0; font-size: 13px; letter-spacing: 1.2px; text-transform: uppercase; color: var(--muted); font-weight: 600; margin-bottom: 10px; }
.flag { display: grid; grid-template-columns: 22px 1fr; gap: 10px; padding: 7px 0; font-size: 15.5px; line-height: 1.35; cursor: pointer; }
input[type="checkbox"] { width: 20px; height: 20px; margin: 1px 0 0; accent-color: var(--ink); cursor: pointer; }
.progress { display: grid; gap: 6px; font-size: 15px; font-weight: 600; }
progress { appearance: none; -webkit-appearance: none; width: 100%; height: 6px; border: 0; border-radius: 3px; background: var(--line); overflow: hidden; }
progress::-webkit-progress-bar { background: var(--line); }
progress::-webkit-progress-value { background: var(--ink); transition: width 0.35s ease; }
progress::-moz-progress-bar { background: var(--ink); }
.actions { display: grid; gap: 10px; justify-items: start; }
button { cursor: pointer; border: 1.5px solid var(--ink); background: var(--ink); color: var(--paper); border-radius: 6px; padding: 11px 16px; min-height: 46px; font-size: 15.5px; font-weight: 600; text-align: left; width: 100%; }
button:hover:not(:disabled) { background: var(--accent); border-color: var(--accent); }
button.secondary { background: transparent; color: var(--ink); }
button.secondary:hover:not(:disabled) { color: var(--paper); }
button:disabled { opacity: 0.4; cursor: not-allowed; }
button.link, .analytics-settings { border: 0; background: none; color: var(--muted); padding: 0; min-height: 32px; width: auto; font-weight: 400; text-decoration: underline; text-underline-offset: 3px; }
button.link:hover:not(:disabled), .analytics-settings:hover { background: none; color: var(--accent); }
.note { font-size: 14px; color: var(--muted); margin: 0; }

.plan h2 { font-family: var(--serif); font-size: 28px; line-height: 1.2; letter-spacing: -0.4px; margin: 0 0 8px; }
.group { padding-top: 28px; animation: rise 0.3s ease both; }
.group h3 { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 12px; margin: 0; padding-bottom: 8px; border-bottom: 1px solid var(--ink); font-size: 14px; letter-spacing: 1.2px; text-transform: uppercase; }
.group h3 small { font-size: 14px; letter-spacing: 0; text-transform: none; font-weight: 400; color: var(--muted); }
.group.overdue h3 { color: var(--accent); border-color: var(--accent); }
.group.move h3 { border-bottom-width: 3px; }
.group ol { list-style: none; margin: 0; padding: 0; }
.task { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 2px 20px; padding: 13px 0; border-bottom: 1px solid var(--line); transition: opacity 0.25s ease; }
.task label { display: grid; grid-template-columns: 22px 1fr; gap: 12px; cursor: pointer; }
.title { font-weight: 600; line-height: 1.35; }
.fixed { font-size: 11px; letter-spacing: 0.8px; text-transform: uppercase; text-decoration: none; border: 1px solid currentColor; border-radius: 3px; padding: 1px 5px; margin-left: 4px; color: var(--muted); font-weight: 600; vertical-align: 1px; white-space: nowrap; }
.due { text-align: right; font-variant-numeric: tabular-nums; font-size: 15.5px; white-space: nowrap; }
.due small { display: block; font-size: 13.5px; color: var(--muted); }
.task details, .task .note { grid-column: 1 / -1; margin-left: 34px; }
.task summary { cursor: pointer; color: var(--muted); font-size: 14px; width: fit-content; padding: 2px 0; }
.task details p { margin: 4px 0 6px; color: var(--muted); font-size: 15.5px; max-width: 62ch; }
.task[data-state="overdue"] .due, .task[data-state="overdue"] .due small { color: var(--accent); font-weight: 600; }
.task[data-state="soon"] .due { font-weight: 700; }
.task[data-state="done"] { opacity: 0.5; }
.task[data-state="done"] .title { text-decoration: line-through; }
.empty { color: var(--muted); padding: 28px 0; }
@keyframes rise { from { opacity: 0; transform: translateY(6px); } }

.article { max-width: 720px; margin-top: 88px; }
.article.page { margin-top: 48px; }
.article h2 { font-family: var(--serif); font-size: 28px; line-height: 1.2; letter-spacing: -0.4px; margin: 48px 0 12px; }
.article h3 { font-size: 18px; margin: 28px 0 8px; }
.article p { margin: 0 0 14px; }
table { width: 100%; border-collapse: collapse; margin: 20px 0; font-size: 15.5px; }
caption { text-align: left; font-weight: 600; padding-bottom: 8px; }
th, td { text-align: left; padding: 9px 12px 9px 0; border-bottom: 1px solid var(--line); vertical-align: top; }
thead th { font-size: 13px; letter-spacing: 1px; text-transform: uppercase; color: var(--muted); border-bottom-color: var(--ink); }
.all-tasks { columns: 2; column-gap: 40px; padding-left: 20px; font-size: 15.5px; }
.all-tasks li { break-inside: avoid; margin-bottom: 6px; }

.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
a.button { display: inline-block; background: var(--ink); color: var(--paper); border: 1.5px solid var(--ink); border-radius: 6px; padding: 13px 20px; font-weight: 600; text-decoration: none; }
a.button:hover { background: var(--accent); border-color: var(--accent); color: var(--paper); }
.article ul, .article ol { padding-left: 22px; margin: 0 0 14px; }
.article li { margin-bottom: 6px; }

/* Handover protocol: a ruled paper form, one numbered section per step. */
.protocol { max-width: 760px; }
.protocol:empty { display: none; }
.step { border-top: 1px solid var(--ink); padding: 26px 0 34px; }
.step h2 { display: flex; align-items: baseline; gap: 14px; font-family: var(--serif); font-size: 28px; line-height: 1.2; letter-spacing: -0.4px; margin: 0 0 14px; }
.step h2 span { font-size: 15px; font-family: var(--sans); font-weight: 600; color: var(--accent); font-variant-numeric: tabular-nums; }
.protocol label, .protocol legend { display: block; font-size: 14.5px; font-weight: 600; margin: 16px 0 6px; padding: 0; letter-spacing: 0; text-transform: none; color: var(--ink); }
.protocol label small { font-weight: 400; color: var(--muted); font-size: 13.5px; margin-left: 4px; }
.protocol input:not([type="radio"], [type="file"]), .protocol textarea, .protocol select { display: block; width: 100%; font: inherit; color: inherit; font-size: 17px; padding: 11px 12px; min-height: 48px; border: 1.5px solid var(--ink); border-radius: 6px; background: #fff; }
.protocol textarea { resize: vertical; line-height: 1.4; }
.protocol [aria-invalid="true"] { border-color: var(--accent); }
.protocol .error { font-size: 14px; }
.choice { display: flex; gap: 10px; flex-wrap: wrap; }
.choice label { margin: 0; cursor: pointer; flex: 1 1 140px; }
.choice input { position: absolute; opacity: 0; }
.choice span { display: block; text-align: center; padding: 12px 14px; min-height: 48px; border: 1.5px solid var(--ink); border-radius: 6px; background: #fff; font-weight: 600; font-size: 15.5px; }
.choice input:checked + span { background: var(--ink); color: var(--paper); }
.choice input[value="maengel"]:checked + span { background: var(--accent); border-color: var(--accent); }
.choice input:focus-visible + span { outline: 2px solid var(--accent); outline-offset: 3px; }
.choice.wide legend { float: left; width: 100%; }
.rooms, .rows, .photos { list-style: none; margin: 0; padding: 0; }
.room { border-top: 1px solid var(--line); padding: 20px 0 22px; }
.room-head { display: flex; align-items: center; gap: 14px; margin-bottom: 12px; }
.protocol .room-name { font-family: var(--serif); font-size: 21px; font-weight: 700; border-color: transparent; border-bottom-color: var(--line); border-radius: 0; background: transparent; padding-left: 0; }
.protocol .room-name:focus { border-bottom-color: var(--ink); outline: 0; }
.photos { display: grid; grid-template-columns: repeat(auto-fill, minmax(96px, 1fr)); gap: 8px; margin-top: 14px; }
.photos:empty { display: none; }
.photos li { position: relative; aspect-ratio: 4 / 3; background: var(--wash); border-radius: 4px; overflow: hidden; }
.photos img { width: 100%; height: 100%; object-fit: cover; display: block; }
.photos button { position: absolute; top: 4px; right: 4px; width: 32px; min-height: 32px; padding: 0; text-align: center; border-radius: 16px; font-size: 20px; line-height: 1; }
.file { position: relative; margin-top: 14px !important; }
.file input { position: absolute; inset: 0; opacity: 0; width: 100%; cursor: pointer; }
.file span { display: block; text-align: center; padding: 12px 14px; border: 1.5px dashed var(--ink); border-radius: 6px; font-size: 15.5px; }
.file:focus-within span { outline: 2px solid var(--accent); outline-offset: 3px; }
.row { display: grid; gap: 0 12px; align-items: end; border-top: 1px solid var(--line); padding: 4px 0 14px; }
.row.meter { grid-template-columns: 1.1fr 1.4fr 1fr 0.8fr auto; }
.row.key { grid-template-columns: 2fr 1fr auto; }
.row .error { grid-column: 1 / -1; }
.row > button { min-height: 48px; }
.adder { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 0 10px; align-items: end; margin-top: 8px; border-top: 1px solid var(--line); }
.adder label { grid-column: 1 / -1; }
.adder input { grid-column: 1 / -1; margin-top: 8px; grid-row: 3; }
.adder input[hidden] { display: none !important; }
.adder button { width: auto; min-height: 48px; }
.total { font-weight: 600; margin: 12px 0 0; }
.pads { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; margin-top: 8px; }
.pad-label { font-size: 14.5px; font-weight: 600; margin: 16px 0 6px; }
.pad canvas { display: block; width: 100%; aspect-ratio: 3 / 1; background: #fff; border: 1.5px solid var(--ink); border-radius: 6px; touch-action: none; cursor: crosshair; }
.pad-foot { display: flex; justify-content: space-between; align-items: center; gap: 12px; }
.step .actions { margin: 6px 0 12px; }
.step .note + .note { margin-top: 6px; }
#draft-delete { margin-top: 6px; }

.analytics-consent { position: fixed; z-index: 100; bottom: 16px; left: 16px; right: 16px; max-width: 640px; margin: auto; background: #fff; border: 1px solid var(--ink); border-radius: 8px; padding: 20px; }
.analytics-consent[hidden] { display: none; }
.analytics-consent .actions { display: flex; gap: 10px; flex-wrap: wrap; }
.analytics-consent button { width: auto; }

@media (max-width: 860px) {
  .workspace { grid-template-columns: minmax(0, 1fr); gap: 36px; }
  .controls { position: static; }
  #flags { display: grid; grid-template-columns: repeat(auto-fit, minmax(250px, 1fr)); column-gap: 28px; }
  .actions { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 14px; }
  .actions button { width: auto; }
  .start { padding: 32px 0 28px; }
  .article { margin-top: 64px; }
}
@media (max-width: 520px) {
  .row.meter { grid-template-columns: 1fr 1fr; }
  .row.meter > button, .row.key > button { justify-self: start; }
  .pads { grid-template-columns: 1fr; }
  .step h2 { font-size: 24px; }
  body { font-size: 16px; }
  .wrap { padding: 0 18px; }
  .task { grid-template-columns: minmax(0, 1fr); }
  .due { text-align: left; margin-left: 34px; font-size: 14.5px; }
  .due small { display: inline; margin-left: 8px; }
  .all-tasks { columns: 1; }
  .date-field input { width: 100%; }
  .actions button:not(.link) { width: 100%; }
  table { font-size: 14.5px; }
  th, td { overflow-wrap: anywhere; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}
@media print {
  :root { --paper: #fff; }
  header.site nav, footer.site, .controls, .article, .protocol, .skip, .lead, .date-field, .eyebrow, .error, .analytics-consent, .task summary { display: none !important; }
  .workspace { display: block; border: 0; padding: 0; }
  .start { padding: 0 0 8px; }
  h1 { font-size: 26px; margin-bottom: 6px; }
  .group { padding-top: 14px; animation: none; break-inside: auto; }
  .task { padding: 6px 0; break-inside: avoid; grid-template-columns: minmax(0, 1fr) auto; }
  .task[data-state="done"] { opacity: 1; }
  .task details { display: none; }
  body { font-size: 12px; }
}
