:root {
  --bg: #eef3f0;
  --surface: #ffffff;
  --ink: #13261e;
  --muted: #3f5249;
  --line: #c3d0c9;
  --green: #1c5a41;
  --green-ink: #ffffff;
  --green-soft: #dceae2;
  --lamp: #f2b53d;
  --lamp-ink: #2a1c00;
  --frame: #34463d;
  --glass: #dfe7e3;
  --no: #a42a1e;
  --no-bg: #fbe7e4;
  --warn-bg: #fdf2d8;
  --info-bg: #e3eef7;
  --info-line: #2f5f86;
  --focus: #0b63c4;
  --r: 6px;
  color-scheme: light dark;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0e1915;
    --surface: #15241e;
    --ink: #e7efea;
    --muted: #aebdb5;
    --line: #2f4239;
    --green: #78c9a2;
    --green-ink: #0b1d15;
    --green-soft: #1d3329;
    --lamp: #f2bd52;
    --lamp-ink: #241800;
    --frame: #8fa59a;
    --glass: #22352d;
    --no: #ff9c8f;
    --no-bg: #3a1f1b;
    --warn-bg: #352b14;
    --info-bg: #182b3a;
    --info-line: #8cc0ea;
    --focus: #8cc0ff;
  }
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 17px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}
h1, h2, h3 { font-family: "Avenir Next", "Segoe UI Variable Display", "Segoe UI", system-ui, sans-serif; line-height: 1.2; }
a { color: var(--green); text-underline-offset: 2px; }
.wrap { max-width: 1040px; margin: 0 auto; padding: 0 16px; }
.skip { position: absolute; left: -9999px; }
.skip:focus { left: 16px; top: 8px; background: var(--surface); padding: 8px 12px; z-index: 10; }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; }
[hidden] { display: none !important; }
bdi { unicode-bidi: isolate; }

.top { padding: 28px 0 8px; }
.top h1 { font-size: clamp(1.75rem, 4.5vw, 2.5rem); margin: 0 0 6px; letter-spacing: -0.01em; }
.lede { margin: 0; max-width: 62ch; color: var(--muted); }

/* controls */
input[type="text"], select, textarea {
  font: inherit; font-size: 16px; color: var(--ink); background: var(--surface);
  border: 1px solid var(--line); border-radius: var(--r); padding: 9px 10px; min-height: 44px; max-width: 100%; font-weight: 400;
}
textarea { width: 100%; resize: vertical; }
input::placeholder, textarea::placeholder { color: var(--muted); opacity: 0.8; }
label { display: inline-flex; flex-direction: column; gap: 4px; font-weight: 600; }
label.check { flex-direction: row; align-items: center; gap: 10px; font-weight: 500; min-height: 44px; }
label.check input { width: 20px; height: 20px; accent-color: var(--green); }
fieldset { border: 0; margin: 0; padding: 0; min-width: 0; }
legend { font-weight: 600; padding: 0; margin-bottom: 4px; }
.btn {
  font: inherit; font-weight: 600; min-height: 44px; padding: 8px 16px; border-radius: var(--r); cursor: pointer;
  border: 1px solid var(--frame); background: var(--surface); color: var(--ink);
}
.btn:hover { background: var(--green-soft); }
.btn.primary { background: var(--green); border-color: var(--green); color: var(--green-ink); }
.btn.primary:hover { filter: brightness(1.08); }
.btn.quiet { border-color: transparent; text-decoration: underline; }
.btn.small { min-height: 40px; padding: 6px 12px; }
.btn.icon { min-width: 44px; padding: 6px; font-size: 1.25rem; line-height: 1; }
.btn:disabled { opacity: 0.4; cursor: default; }

.tool { padding-top: 12px; padding-bottom: 32px; }
.bar { background: var(--warn-bg); border-radius: var(--r); padding: 12px 14px; margin-bottom: 14px; }
.bar p { margin: 0 0 8px; }
.note { background: var(--warn-bg); padding: 10px 14px; border-radius: var(--r); }

.cal { display: flex; flex-wrap: wrap; gap: 14px 24px; align-items: flex-end; padding-bottom: 14px; }
.f-title { flex: 1 1 280px; }
.f-title input { width: 100%; }
.pair { display: flex; flex-wrap: wrap; gap: 8px 12px; }
.pair label { flex-direction: row; align-items: center; gap: 6px; font-weight: 500; }
.more { flex-basis: 100%; }
.more summary { cursor: pointer; font-weight: 600; min-height: 44px; display: inline-flex; align-items: center; color: var(--green); }
.more-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 12px 20px; padding: 8px 0 4px; }
.more-grid .wide { grid-column: 1 / -1; }
.more-grid input[type="text"], .more-grid select { width: 100%; }

.tabs { display: flex; gap: 4px; border-bottom: 2px solid var(--line); margin-top: 4px; overflow-x: auto; }
.tabs button {
  font: inherit; font-weight: 650; background: none; border: 0; color: var(--muted); padding: 10px 14px; min-height: 48px;
  border-bottom: 3px solid transparent; margin-bottom: -2px; cursor: pointer; white-space: nowrap;
}
.tabs button[aria-selected="true"] { color: var(--ink); border-bottom-color: var(--lamp); }
.dot { display: inline-block; width: 9px; height: 9px; border-radius: 50%; background: var(--no); vertical-align: 2px; margin-left: 4px; }
.panel { padding: 16px 0 8px; }
.row-btns { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; margin: 14px 0; }
.sum { margin: 0 0 12px; font-weight: 600; }

/* lit windows: the site's one recurring mark */
.win {
  display: inline-grid; place-items: center; width: 2.4rem; height: 2.4rem; flex: none;
  border: 2px solid var(--frame); border-radius: 3px; background: var(--glass); color: var(--muted);
  font-weight: 800; font-variant-numeric: tabular-nums;
}
.win.lit { background: var(--lamp); color: var(--lamp-ink); border-color: var(--frame); }

/* households */
.hh { list-style: none; margin: 0; padding: 0; }
.hh .none { color: var(--muted); padding: 12px 0; }
.h { border-bottom: 1px solid var(--line); padding: 10px 0; }
.h-main { display: grid; grid-template-columns: 2rem minmax(0, 1.3fr) 9rem minmax(0, 1.3fr) 44px; gap: 8px; align-items: center; }
.h-main input { width: 100%; }
.h-n { color: var(--muted); font-weight: 700; text-align: right; font-variant-numeric: tabular-nums; }
.h-sub { display: flex; gap: 10px; align-items: center; margin: 6px 0 0 2.5rem; flex-wrap: wrap; }
.h-sum { color: var(--muted); }
.h-sum b { color: var(--ink); }
.picker { margin: 10px 0 4px 2.5rem; max-width: 460px; }
.seg { display: inline-flex; flex-wrap: wrap; border: 1px solid var(--frame); border-radius: var(--r); overflow: hidden; }
.seg label { flex-direction: row; font-weight: 600; position: relative; }
.seg input { position: absolute; opacity: 0; inset: 0; margin: 0; cursor: pointer; }
.seg span { display: inline-flex; align-items: center; min-height: 44px; padding: 6px 14px; }
.seg input:checked + span { background: var(--green); color: var(--green-ink); }
.seg input:focus-visible + span { outline: 3px solid var(--focus); outline-offset: -3px; }
.month { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 4px; margin: 12px 0 6px; }
.wd { text-align: center; color: var(--muted); font-size: 1rem; font-weight: 600; }
.day {
  font: inherit; font-weight: 700; min-height: 44px; border-radius: 3px; cursor: pointer;
  border: 1px solid var(--line); background: var(--surface); color: var(--ink); font-variant-numeric: tabular-nums;
}
.day.no { background: var(--no-bg); color: var(--no); border-color: var(--no); text-decoration: line-through; text-decoration-thickness: 2px; }
.day.want { background: var(--lamp); color: var(--lamp-ink); border-color: var(--frame); }
.key { display: flex; gap: 8px; align-items: center; color: var(--muted); margin: 4px 0 10px; }
.key .day { display: inline-grid; place-items: center; width: 28px; min-height: 28px; text-decoration: none; cursor: default; }
.key .day + .day, .key .day:nth-of-type(2) { margin-left: 10px; }
.pin { flex-direction: row; align-items: center; gap: 10px; font-weight: 600; }
.paste { margin-top: 8px; }
.paste summary, .streets summary, .kept summary { cursor: pointer; font-weight: 600; min-height: 44px; display: inline-flex; align-items: center; color: var(--green); }
.paste label { display: block; font-weight: 500; margin-bottom: 6px; }

/* dates */
.msgs .msg { margin: 0 0 10px; padding: 10px 14px; border-radius: var(--r); background: var(--warn-bg); }
.msgs .msg.bad { background: var(--no-bg); }
.msgs .msg.info { background: var(--info-bg); }
.fixes { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 8px; }
.dates { list-style: none; margin: 0; padding: 0; columns: 2 420px; column-gap: 32px; }
.d { display: grid; grid-template-columns: 2.4rem 2.6rem minmax(0, 1fr); gap: 10px; align-items: center; padding: 6px 0; border-bottom: 1px solid var(--line); break-inside: avoid; }
.d-day { color: var(--muted); font-weight: 600; }
.d-who { display: flex; flex-direction: column; min-width: 0; overflow-wrap: anywhere; }
.who .addr { color: var(--muted); }
.who.open { color: var(--muted); font-style: italic; }
.tag { display: inline-block; font-size: 1rem; font-weight: 600; padding: 0 6px; border-radius: 3px; background: var(--green-soft); color: var(--ink); white-space: nowrap; }
.tag.fixed { background: var(--glass); }

/* trail */
.trail-head { display: flex; flex-wrap: wrap; gap: 14px 28px; align-items: flex-end; margin-bottom: 14px; }
.trail h3 { font-size: 1.1rem; margin: 18px 0 6px; }
.stops { margin: 0; padding-left: 2.2em; }
.stops li { padding: 4px 0; }
.stops li > span:last-child { margin-left: 6px; }
.stops li::marker { color: var(--muted); font-weight: 600; }
.stops .win { width: 2rem; height: 2rem; font-size: 0.9rem; vertical-align: middle; }
.stops li.new { font-weight: 600; }
.street-list { list-style: none; padding: 0; margin: 6px 0; max-width: 420px; }
.street-list li { display: flex; justify-content: space-between; align-items: center; gap: 10px; padding: 4px 0; border-bottom: 1px solid var(--line); }
.mv { display: flex; gap: 6px; }

.out { border-top: 2px solid var(--line); margin-top: 18px; padding-top: 6px; }
.out h2 { font-size: 1.25rem; margin: 10px 0; }
.out-row { display: flex; flex-wrap: wrap; gap: 12px 24px; align-items: flex-end; }
.out-btns { display: flex; gap: 10px; margin: 0; flex-wrap: wrap; }
.kept { margin-top: 18px; }
.kept-list { list-style: none; padding: 0; margin: 4px 0; }
.kept-list li { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 8px; padding: 8px 0; border-bottom: 1px solid var(--line); }
.kept-list .none { color: var(--muted); }
.when { color: var(--muted); }

.toast {
  position: fixed; left: 50%; bottom: 16px; transform: translateX(-50%); width: min(560px, calc(100% - 32px));
  background: var(--ink); color: var(--bg); padding: 10px 14px; border-radius: var(--r); display: flex; gap: 12px;
  align-items: center; justify-content: space-between; z-index: 20; pointer-events: none;
}
.toast .btn { pointer-events: auto; background: var(--bg); color: var(--ink); border-color: var(--bg); }

.prose { padding-top: 8px; padding-bottom: 32px; }
.prose h2 { font-size: 1.45rem; margin: 30px 0 8px; }
.prose h3 { font-size: 1.1rem; margin: 20px 0 4px; }
.prose p { max-width: 70ch; margin: 0 0 12px; }
.site-foot { border-top: 1px solid var(--line); padding: 20px 0 32px; color: var(--muted); }
.sb-footer p { margin: 0 0 8px; max-width: 80ch; }
.sb-more { overflow-wrap: anywhere; }
.sb-footer a { color: var(--muted); }

.print-root { display: none; }

@media (max-width: 640px) {
  .h-main { grid-template-columns: 1.6rem 7rem minmax(0, 1fr) 44px; }
  .h-name { grid-column: 2 / 4; grid-row: 1; }
  .h-del { grid-column: 4; grid-row: 1; }
  .h-num { grid-column: 2; grid-row: 2; }
  .h-street { grid-column: 3 / 5; grid-row: 2; }
  .h-sub { margin-left: 2.2rem; }
  .picker { margin-left: 0; }
  .d { grid-template-columns: 2.4rem 2.4rem minmax(0, 1fr); gap: 8px; }
}
@media (max-width: 400px) { .tabs button { padding: 10px 9px; } }
@media (prefers-reduced-motion: reduce) { * { scroll-behavior: auto !important; transition: none !important; } }

/* ---------- paper ---------- */
@page { margin: 12mm; }
@media print {
  body { background: #fff; color: #000; font-size: 11pt; }
  body > *:not(#print) { display: none !important; }
  .print-root { display: block !important; }
  .sheet { color: #000; }
  .p-title { font-size: 22pt; margin: 0 0 2mm; }
  .p-sub { margin: 0 0 5mm; font-size: 11pt; }
  .p-foot { margin: 4mm 0 0; font-size: 10pt; }
  .p-cont { break-before: page; font-weight: 700; font-size: 12pt; margin: 0 0 3mm; }
  .p-grid { list-style: none; margin: 0; padding: 0; display: grid; gap: 2mm; }
  .p-grid.c3 { grid-template-columns: repeat(3, 1fr); }
  .p-grid.c4 { grid-template-columns: repeat(4, 1fr); }
  .p-grid.c5 { grid-template-columns: repeat(5, 1fr); }
  .p-grid li { border: 1.5pt solid #333; padding: 2mm 2.5mm; display: flex; flex-direction: column; gap: 0.6mm; break-inside: avoid; }
  .p-grid.c3 li { min-height: 44mm; }
  .p-grid.c4 li { min-height: 33mm; }
  .p-grid.c5 li { min-height: 26mm; }
  .p-grid.multi li { min-height: 0; }
  .p-grid.multi .t-addr { font-size: 9.5pt; margin-top: 0.8mm; }
  .t-top { display: flex; align-items: center; gap: 2mm; margin-bottom: 1mm; }
  .t-num {
    display: inline-grid; place-items: center; min-width: 10mm; height: 9mm; padding: 0 1mm; font-weight: 800; font-size: 15pt;
    background: #f2b53d; border: 1pt solid #333; -webkit-print-color-adjust: exact; print-color-adjust: exact;
  }
  .t-day { font-weight: 600; font-size: 10pt; }
  .t-addr { font-weight: 700; font-size: 10.5pt; line-height: 1.2; }
  .t-name { font-size: 10pt; line-height: 1.2; }
  .c5 .t-addr { font-size: 10pt; }
  .t-line { display: block; border-bottom: 0.75pt solid #777; height: 6mm; }

  .tlist .p-sub { font-size: 10.5pt; }
  .t-table { width: calc(100% - 2px); margin: 0 1px; border-collapse: collapse; table-layout: fixed; font-size: 10.5pt; }
  .t-table .c1 { width: 11%; } .t-table .c2 { width: 33%; } .t-table .c3 { width: 16%; } .t-table .c4 { width: 40%; }
  .t-table th, .t-table td { border: 0.75pt solid #555; padding: 1.2mm 2mm; text-align: left; vertical-align: top; overflow-wrap: break-word; }
  .t-table thead th { background: #eee; -webkit-print-color-adjust: exact; print-color-adjust: exact; }
  .t-table tr.st th { font-size: 11.5pt; border-top: 1.5pt solid #000; }
  .t-table tr.st { break-after: avoid; }
  .t-table tr { break-inside: avoid; }
  .t-table tr.blank td { height: 9mm; }
  .t-table .wd { color: #333; }

  .slip-page { display: grid; grid-template-columns: 1fr 1fr; grid-template-rows: repeat(4, 62mm); align-content: start; break-after: page; break-inside: avoid; width: calc(100% - 2px); margin: 0 1px; }
  .slip-page.rows3 { grid-template-rows: repeat(3, 82mm); }
  .slip-page.rows2 { grid-template-rows: repeat(2, 122mm); }
  .slip:nth-child(odd) { border-left: 1pt dashed #666; }
  .slip:nth-child(-n+2) { border-top: 1pt dashed #666; }
  .slip-page:last-child { break-after: auto; }
  .slip { border-right: 1pt dashed #666; border-bottom: 1pt dashed #666; padding: 3mm 4.5mm; overflow: hidden; display: flex; flex-direction: column; gap: 1.2mm; }
  .slip p { margin: 0; }
  .s-cal { font-size: 9pt; line-height: 1.25; font-weight: 600; color: #333; }
  .s-to { font-size: 11pt; font-weight: 700; }
  .s-win { display: flex; align-items: center; gap: 3mm; }
  .s-num {
    display: inline-grid; place-items: center; min-width: 13mm; height: 12mm; padding: 0 1.5mm; font-size: 21pt; font-weight: 800;
    background: #f2b53d; border: 1.25pt solid #333; -webkit-print-color-adjust: exact; print-color-adjust: exact;
  }
  .s-num.blank { background: #fff; }
  .s-when { font-size: 10.5pt; line-height: 1.3; }
  .s-when b { font-size: 12pt; }
  .s-text { font-size: 10.5pt; line-height: 1.3; }
  .s-note { font-size: 9.5pt; line-height: 1.3; font-style: italic; }
  .s-fill { display: inline-block; width: 45mm; border-bottom: 0.75pt solid #555; height: 4.5mm; vertical-align: bottom; }
}
