@font-face { font-family: 'Sofia Sans Condensed'; src: url('fonts/sofia-sans-condensed-800.woff2') format('woff2'); font-weight: 800; font-display: swap; }

:root {
  --bg: #f4f2ee;
  --paper: #ffffff;
  --ink: #1f1d1a;
  --muted: #55504a;
  --line: #d6d1c8;
  --field: #8f877c;
  --accent: #1d4e89;      /* donation-bin blue */
  --accent-ink: #ffffff;
  --kraft: #a8743a;       /* paper bag */
  --kraft-tint: #f3e6d4;
  --err: #a3261b;
  --err-tint: #fbe9e6;
  --head: 'Sofia Sans Condensed', 'Arial Narrow', 'Roboto Condensed', system-ui, sans-serif;
  --body: system-ui, -apple-system, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  color-scheme: light dark;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #131518;
    --paper: #1c1f23;
    --ink: #ece8e1;
    --muted: #b5aea4;
    --line: #3a3e44;
    --field: #7d776f;
    --accent: #8fb6ec;
    --accent-ink: #0f1a2a;
    --kraft: #d3a26a;
    --kraft-tint: #2c241a;
    --err: #ff9d8f;
    --err-tint: #3a1d19;
  }
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--ink); font: 17px/1.5 var(--body); }
a { color: var(--accent); }
.wrap { max-width: 860px; margin: 0 auto; padding: 0 16px; }
.skip { position: absolute; left: -999px; top: 8px; background: var(--paper); color: var(--ink); padding: 8px 12px; z-index: 50; }
.skip:focus { left: 8px; }
.vh { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
h1, h2, h3 { font-family: var(--head); font-weight: 800; line-height: 1.1; }
h1 { font-size: clamp(34px, 7vw, 52px); margin: 0 0 8px; letter-spacing: -.01em; }
h2 { font-size: 30px; margin: 36px 0 10px; }
h3 { font-size: 22px; margin: 22px 0 6px; }
:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }

.top { padding: 28px 0 8px; }
.lede { font-size: 19px; margin: 0; max-width: 62ch; color: var(--muted); }

/* ---------- form bits ---------- */
.btn {
  font: 600 16px var(--body); color: var(--ink); background: var(--paper); border: 1px solid var(--field);
  border-radius: 6px; padding: 9px 16px; min-height: 44px; cursor: pointer;
}
a.btn { display: inline-flex; align-items: center; text-decoration: none; }
.btn:hover { border-color: var(--ink); }
.btn:disabled { opacity: .45; cursor: default; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.btn.quiet { background: transparent; border-color: transparent; text-decoration: underline; text-underline-offset: 3px; }
.btn.icon { min-width: 44px; padding: 0; font-size: 20px; line-height: 1; }
.btn.small { min-height: 40px; padding: 6px 12px; font-size: 15px; }
select, input[type="text"], input[type="number"], input[type="date"] {
  font: 16px var(--body); color: var(--ink); background: var(--paper); border: 1px solid var(--field);
  border-radius: 6px; padding: 8px 10px; min-height: 44px; width: 100%;
}
select { padding-right: 28px; }
.f { display: flex; flex-direction: column; gap: 4px; font-weight: 600; font-size: 16px; }
.f.inline { flex-direction: row; align-items: center; gap: 8px; }
.f.inline select { width: auto; }

/* ---------- dates ---------- */
.setup { padding: 16px 0 6px; }
.fields { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 12px; }
.fields .f-start { grid-column: span 2; }
@media (max-width: 420px) { .fields .f-start { grid-column: 1 / -1; } }
.span { margin: 14px 0 4px; font-size: 18px; }
.status p { margin: 0 0 10px; }
.strip { display: grid; grid-template-columns: repeat(20, 1fr); gap: 4px; max-width: 460px; margin: 6px 0 4px; }
.strip i { display: block; aspect-ratio: 3 / 4; border: 2px solid var(--kraft); border-radius: 2px 2px 4px 4px; }
.strip i.on { background: var(--kraft); }
.strip i.now { box-shadow: 0 0 0 2px var(--bg), 0 0 0 4px var(--accent); }

.bar { background: var(--kraft-tint); border-radius: 8px; padding: 12px 14px; margin: 12px 0; }
.bar p { margin: 0 0 8px; }
.bar .bar-act { display: flex; flex-wrap: wrap; gap: 8px; margin: 0; }
.warn { background: var(--err-tint); color: var(--ink); border-radius: 8px; padding: 10px 14px; margin: 12px 0; }

/* ---------- tabs ---------- */
.tabs { display: flex; gap: 4px; border-bottom: 2px solid var(--line); margin-top: 18px; }
.tabs [role="tab"] {
  font: 700 17px var(--body); color: var(--muted); background: none; border: 0; border-bottom: 3px solid transparent;
  margin-bottom: -2px; padding: 10px 12px; min-height: 48px; cursor: pointer; white-space: nowrap;
}
.tabs [role="tab"][aria-selected="true"] { color: var(--ink); border-bottom-color: var(--accent); }
@media (max-width: 360px) { .tabs [role="tab"] { padding: 10px 7px; font-size: 16px; } }
.panel { padding: 14px 0 6px; }
.msg { margin: 0 0 10px; padding: 10px 12px; border-radius: 6px; }
.msg.info { background: var(--kraft-tint); }
.msg.err { background: var(--err-tint); color: var(--err); font-weight: 600; }
.row-act { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; margin: 12px 0; }
.hint { color: var(--muted); margin: 4px 0; }

/* ---------- rooms ---------- */
.rooms { list-style: none; margin: 0; padding: 0; }
.rooms li { padding: 8px 0; border-bottom: 1px solid var(--line); }
.rooms li.none { color: var(--muted); }
.room { display: grid; grid-template-columns: 1fr; gap: 6px; }
.r-ctl { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.r-size { width: 128px; padding-right: 22px; }
.r-days { width: 72px; }
.r-out { font-weight: 700; color: var(--muted); white-space: nowrap; }
@media (min-width: 680px) { .r-out { min-width: 7.5em; } }
.r-mv { display: inline-flex; gap: 2px; margin-left: auto; }
.r-mv .btn { border-color: var(--line); }
@media (min-width: 680px) {
  .room { grid-template-columns: 1fr auto; align-items: center; }
}

/* ---------- day by day ---------- */
.days { list-style: none; margin: 0; padding: 0; }
.days li { border-bottom: 1px solid var(--line); }
.day { display: grid; grid-template-columns: 44px 1fr auto; column-gap: 8px; align-items: center; padding: 8px 4px; scroll-margin: 80px; }
.day.done { background: var(--kraft-tint); }
.day.now .d-when b { color: var(--accent); }
.tick { appearance: none; -webkit-appearance: none; margin: 0 auto; width: 30px; height: 30px; border: 2px solid var(--field); border-radius: 5px; background: var(--paper); cursor: pointer; display: grid; place-content: center; }
.tick::before { content: ''; width: 16px; height: 9px; border: solid var(--accent-ink); border-width: 0 0 3px 3px; transform: rotate(-45deg) translate(1px, -1px); opacity: 0; }
.tick:checked { background: var(--accent); border-color: var(--accent); }
.tick:checked::before { opacity: 1; }
.d-main { display: flex; flex-direction: column; min-width: 0; cursor: pointer; padding: 2px 0; }
.d-when { color: var(--muted); font-size: 16px; }
.d-area { font-weight: 700; overflow-wrap: anywhere; }
.part { font-weight: 400; color: var(--muted); }
.bags { display: inline-flex; align-items: center; gap: 4px; }
.bags[hidden] { display: none; }
.b-n { min-width: 4.2em; text-align: center; }
.note { grid-column: 2 / -1; margin: 6px 0 2px; }
.day .note { background: var(--paper); padding: 8px 10px; border-radius: 6px; }
.days li.rest { display: flex; gap: 12px; padding: 6px 4px 6px 56px; color: var(--muted); font-size: 16px; }
@media (max-width: 420px) {
  .day { grid-template-columns: 40px 1fr; }
  .bags { grid-column: 2; }
  .days li.rest { padding-left: 52px; }
}

/* ---------- summary ---------- */
#summary h2 { margin-top: 4px; }
.big { display: flex; flex-wrap: wrap; gap: 8px 28px; font-size: 20px; margin: 0 0 12px; }
.big b { font-family: var(--head); font-size: 44px; line-height: 1; margin-right: 6px; }
.by { border-collapse: collapse; min-width: 260px; max-width: 100%; }
.by th, .by td { text-align: left; padding: 6px 16px 6px 0; border-bottom: 1px solid var(--line); overflow-wrap: anywhere; }
.by td:last-child, .by th:last-child { text-align: right; padding-right: 0; }
.notes { padding-left: 20px; }
.notes li { margin: 4px 0; overflow-wrap: anywhere; }
.when { color: var(--muted); }

/* ---------- actions ---------- */
.actions { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; padding: 18px 0 8px; border-top: 2px solid var(--line); margin-top: 14px; }
.kept { margin: 8px 0 24px; }
.kept summary { cursor: pointer; font-weight: 600; min-height: 44px; display: flex; align-items: center; }
.kept-list { list-style: none; padding: 0; margin: 4px 0; }
.kept-list li { display: flex; flex-wrap: wrap; gap: 6px 12px; justify-content: space-between; align-items: center; padding: 8px 0; border-bottom: 1px solid var(--line); }
.kept-list li.none { color: var(--muted); }

.toast {
  position: fixed; left: 50%; bottom: 16px; transform: translateX(-50%); z-index: 40; width: max-content; max-width: calc(100% - 32px);
  background: var(--ink); color: var(--bg); border-radius: 8px; padding: 10px 14px; display: flex; gap: 12px; align-items: center;
  pointer-events: none;
}
.toast[hidden] { display: none; }
.toast .btn { pointer-events: auto; background: var(--bg); color: var(--ink); }

/* ---------- explanation ---------- */
.prose { padding-bottom: 24px; }
.prose p { max-width: 70ch; }
.prose .src { color: var(--muted); font-size: 16px; margin-top: 24px; }

/* ---------- footer ---------- */
.site-foot { border-top: 1px solid var(--line); padding: 20px 0 32px; color: var(--muted); font-size: 15px; }
.sb-footer p { margin: 0 0 10px; overflow-wrap: anywhere; }
.sb-footer a { color: var(--muted); }
.sb-credit a { color: var(--ink); }

.print-root { display: none; }
/* the hidden box that measures printed room names (an A4 calendar square, less padding) */
.c-measure { position: absolute; left: -9999px; top: 0; visibility: hidden; display: block; width: .92in; font-family: var(--body); font-weight: 700; line-height: 1.08; overflow-wrap: break-word; }
.fs110 { font-size: 11pt; } .fs105 { font-size: 10.5pt; } .fs100 { font-size: 10pt; }
.fs95 { font-size: 9.5pt; } .fs90 { font-size: 9pt; } .fs85 { font-size: 8.5pt; }

@media (prefers-reduced-motion: reduce) { * { scroll-behavior: auto !important; transition: none !important; } }

/* ---------- print ---------- */
@page { margin: 12mm; }
@media print {
  body { background: #fff; color: #000; font-size: 10pt; }
  body > *:not(.print-root) { display: none !important; }
  .print-root { display: block; }
  .sheet { break-after: page; }
  .sheet:last-child { break-after: auto; }
  .p-head { margin: 0 0 8pt; }
  .p-head h2 { font-size: 20pt; margin: 0 0 2pt; color: #000; }
  .p-head p { margin: 0; font-size: 11pt; }
  .p-note, .p-sum { font-size: 10pt; margin: 4pt 0 8pt; }
  .pbox { display: inline-grid; place-content: center; width: 11pt; height: 11pt; border: 1pt solid #000; vertical-align: middle; }
  .pbox svg { width: 9pt; height: 9pt; }
  /* calendar: one week a row */
  .pcal { width: calc(100% - 2px); margin: 0 1px; border-collapse: collapse; table-layout: fixed; }
  .pcal th { font-size: 9pt; font-weight: 700; text-align: left; padding: 2pt 4pt; border-bottom: 1pt solid #000; }
  .pcal td { border: .75pt solid #666; vertical-align: top; padding: 3pt 4pt; font-size: 9pt; }
  .c-in { height: 1.05in; overflow: hidden; display: flex; flex-direction: column; }
  .c-in > span { display: block; }
  .w8 .c-in { height: .9in; }
  .pcal tr { break-inside: avoid; }
  .c-top { display: flex !important; justify-content: space-between; gap: 2pt; }
  .c-date { font-weight: 700; }
  .c-k { color: #333; }
  .c-area { font-weight: 700; line-height: 1.08; margin-top: 2pt; overflow-wrap: break-word; overflow: hidden; flex: 0 0 auto; color: #000; }
  .c-area.cl1, .c-area.cl2, .c-area.cl3 { display: -webkit-box !important; -webkit-box-orient: vertical; }
  .c-area.cl1 { -webkit-line-clamp: 1; } .c-area.cl2 { -webkit-line-clamp: 2; } .c-area.cl3 { -webkit-line-clamp: 3; }
  .c-part { font-size: 8.5pt; color: #333; white-space: nowrap; margin-top: 1pt; flex: 0 0 auto; }
  .c-foot { margin-top: auto; flex: 0 0 auto; display: flex !important; align-items: center; gap: 6pt; }
  .c-bags { font-size: 8.5pt; color: #333; display: inline-flex; align-items: flex-end; gap: 2pt; }
  .c-line { display: inline-block; width: 20pt; border-bottom: .75pt solid #555; height: 9pt; }
  .pcal td.out { border-color: #bbb; color: #888; }
  .pcal td.off { color: #333; }
  .c-off { font-style: italic; margin-top: 3pt; }
  /* checklist: a line to write on for each day */
  .plist { width: calc(100% - 2px); margin: 0 1px; border-collapse: collapse; table-layout: fixed; }
  .plist col.c1 { width: 6%; } .plist col.c2 { width: 6%; } .plist col.c3 { width: 15%; }
  .plist col.c4 { width: 26%; } .plist col.c5 { width: 7%; } .plist col.c6 { width: 40%; }
  .plist th { font-size: 9pt; text-align: left; padding: 2pt 4pt; border-bottom: 1pt solid #000; }
  .plist thead { display: table-header-group; }
  .plist tr { break-inside: avoid; }
  .plist td { padding: 3pt 4pt; height: .4in; border-bottom: .75pt solid #888; font-size: 10pt; vertical-align: bottom; overflow-wrap: break-word; }
  .l-area { font-weight: 700; }
  .l-date { white-space: nowrap; }
}
