/* Household Calendar. Ink on paper by day, navy by night. People are the only
   strong color on the page, so the eye reads "who" before anything else. */

@font-face { font-family: 'Atkinson'; font-weight: 400; font-display: swap; src: url('fonts/atkinson-400-latin.woff2') format('woff2'); unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+2000-206F, U+2074, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: 'Atkinson'; font-weight: 400; font-display: swap; src: url('fonts/atkinson-400-latin-ext.woff2') format('woff2'); unicode-range: U+0100-024F, U+0259, U+1E00-1EFF, U+20A0-20AB, U+20AD-20CF, U+2113, U+2C60-2C7F, U+A720-A7FF; }
@font-face { font-family: 'Atkinson'; font-weight: 700; font-display: swap; src: url('fonts/atkinson-700-latin.woff2') format('woff2'); unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+2000-206F, U+2074, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: 'Atkinson'; font-weight: 700; font-display: swap; src: url('fonts/atkinson-700-latin-ext.woff2') format('woff2'); unicode-range: U+0100-024F, U+0259, U+1E00-1EFF, U+20A0-20AB, U+20AD-20CF, U+2113, U+2C60-2C7F, U+A720-A7FF; }

:root {
  --bg: #F3F4F8;
  --paper: #FFFFFF;
  --ink: #17203A;
  --ink-soft: #4B536A;
  --line: #D5DAE5;
  --weekend: #E9ECF3;
  --accent: #10204A;      /* Schreiber navy: the one main button color */
  --accent-ink: #FFFFFF;
  --focus: #2F57D0;
  --past-band: 0.78; /* the lightest fade that keeps every person color at 3:1 */
  --radius: 10px;
  --hour: 52px;
  font-family: 'Atkinson', system-ui, -apple-system, 'Segoe UI', sans-serif;
  color: var(--ink);
  background: var(--bg);
  -webkit-text-size-adjust: 100%;
}
:root[data-theme='night'] {
  --bg: #0B1430;
  --paper: #15203F;
  --ink: #EEF1F8;
  --ink-soft: #B7BFD3;
  --line: #2C3962;
  --weekend: #111B39;
  --accent: #D6C7E8;
  --accent-ink: #10204A;
  --focus: #8EAEFF;
  --past-band: 0.58;
}

* { box-sizing: border-box; }
body { margin: 0; height: 100dvh; overflow: hidden; display: flex; flex-direction: column; background: var(--bg); color: var(--ink); font-size: 1rem; line-height: 1.35; }
button, input, select, textarea { font: inherit; color: inherit; }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; }
[hidden] { display: none !important; }
.visually-hidden { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.skip { position: absolute; left: -999px; top: 8px; background: var(--paper); padding: 8px 12px; border-radius: var(--radius); z-index: 10; }
.skip:focus { left: 8px; }
.quiet { color: var(--ink-soft); margin: 0; }

/* Buttons: one filled main action; everything else is quiet. */
.btn, .icon-btn {
  min-height: 44px; min-width: 44px; padding: 0 16px; border-radius: var(--radius);
  border: 1px solid var(--line); background: var(--paper); color: var(--ink); cursor: pointer;
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; font-weight: 700; text-decoration: none;
}
.icon-btn { padding: 0; font-size: 1.6rem; line-height: 1; }
.btn-main { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }
.btn-small { min-height: 36px; padding: 0 12px; font-size: 0.95rem; }
.btn:hover, .icon-btn:hover { border-color: var(--ink-soft); }

/* The bar */
.bar {
  display: flex; flex-wrap: wrap; align-items: center; gap: 12px 20px;
  padding: 14px 20px 10px; padding-top: max(14px, env(safe-area-inset-top));
}
.bar-title { margin-right: auto; }
.bar-title h1 { margin: 0; font-size: 1.35rem; letter-spacing: 0.01em; }
.bar-title p { margin: 0; color: var(--ink-soft); }
.views { display: inline-flex; flex-wrap: wrap; background: var(--paper); border: 1px solid var(--line); border-radius: calc(var(--radius) + 4px); padding: 3px; }
.views button { min-height: 40px; padding: 0 14px; border: 0; border-radius: var(--radius); background: transparent; cursor: pointer; font-weight: 700; color: var(--ink-soft); }
.views button[aria-pressed='true'] { background: var(--accent); color: var(--accent-ink); }
.stepper { display: inline-flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.stepper #period { margin: 0 0 0 8px; font-weight: 700; min-width: 9ch; }
.bar-actions { display: inline-flex; gap: 8px; }

.save-warning { margin: 0 20px 8px; padding: 10px 14px; border-radius: var(--radius); background: var(--paper); border: 2px solid var(--c-tomato); }

/* People rail: the color key and the filter in one */
.rail { display: flex; align-items: center; gap: 10px; padding: 0 20px 8px; overflow-x: auto; scrollbar-width: none; }
.rail-label { color: var(--ink-soft); font-size: 0.95rem; flex: none; }
.rail-chips, .pick-people { display: flex; flex-wrap: wrap; gap: 8px; }
.rail .rail-chips { flex-wrap: nowrap; }
.pick {
  --c: var(--ink-soft);
  min-height: 44px; padding: 0 14px 0 10px; border-radius: 999px; border: 2px solid var(--line);
  background: var(--paper); cursor: pointer; display: inline-flex; align-items: center; gap: 8px; font-weight: 700; white-space: nowrap;
}
.pick-dot { width: 14px; height: 14px; border-radius: 50%; background: var(--c); flex: none; }
.pick-label .pick-dot, .dot-label { border-radius: 3px; }
.pick[aria-pressed='true'] { border-color: var(--c); }
.pick[aria-pressed='false'] { color: var(--ink-soft); font-weight: 400; }
.pick[aria-pressed='false'] .pick-dot { background: transparent; box-shadow: inset 0 0 0 2px var(--c); }
.pick-reset, .pick-new { border-style: dashed; font-weight: 400; padding: 0 14px; }
.pick:has(.avatar) { padding-left: 6px; }

/* A picture: initials or an emoji, filled in the person's color while they show,
   a ring in their color while hidden. Initials use the paper color, tested at 4.5:1 on every person color. */
.avatar {
  --c: var(--ink-soft);
  flex: none; width: 1.75rem; height: 1.75rem; border-radius: 50%; display: inline-grid; place-items: center;
  background: var(--c); color: var(--paper); font-size: 0.8rem; font-weight: 700; line-height: 1; letter-spacing: 0.02em;
}
.avatar-label { border-radius: 28%; }
/* An emoji keeps its own colors, so it sits on paper inside a ring of the person's color (a fill would swallow a grey or green emoji). */
.avatar-emoji { font-size: 1.05rem; letter-spacing: 0; background: var(--paper); box-shadow: inset 0 0 0 3px var(--c); }
.pick[aria-pressed='false'] .avatar { background: var(--paper); color: var(--ink-soft); box-shadow: inset 0 0 0 2px var(--c); }
.pick[aria-pressed='false'] .avatar-emoji { filter: grayscale(1); }
.pick-all { --c: var(--ink-soft); }
.all-dots { display: inline-flex; gap: 3px; }
.all-dots .pick-dot { width: 10px; height: 10px; }
.new-person { display: inline-flex; gap: 6px; align-items: center; }
.new-person input { min-height: 44px; width: 12ch; padding: 0 10px; border-radius: var(--radius); border: 1px solid var(--line); background: var(--paper); }

.welcome { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; padding: 8px 0; }
.welcome-q { margin: 0; font-weight: 700; font-size: 1.15rem; }
.welcome input { min-height: 44px; padding: 0 12px; border-radius: var(--radius); border: 1px solid var(--line); background: var(--paper); width: 14ch; }

/* Countdowns: the days we're looking forward to */
.countdowns { display: flex; gap: 10px; padding: 0 20px 10px; overflow-x: auto; scrollbar-width: none; }
.count {
  display: inline-flex; align-items: baseline; gap: 8px; min-height: 44px; padding: 8px 14px 8px 16px; border-radius: var(--radius);
  border: 1px solid var(--line); background: var(--paper); cursor: pointer; position: relative; white-space: nowrap; flex: none;
}
.count::before { content: ''; position: absolute; left: 0; top: 6px; bottom: 6px; width: 5px; border-radius: 0 3px 3px 0; background: var(--bands); }
.count-n { font-weight: 700; font-size: 1.15rem; }

main { flex: 1; min-height: 0; padding: 0 20px 20px; display: flex; flex-direction: column; overflow-y: auto; }
main[data-view='schedule'] { overflow: hidden; }
main:focus { outline: none; }

/* An event: paper face, ink words, one band per person on the left edge. */
.ev {
  --bands: var(--ink-soft);
  position: relative; display: flex; gap: 6px; align-items: baseline; width: 100%; text-align: left; cursor: pointer;
  min-height: 32px; padding: 5px 8px 5px 13px; border-radius: 7px; border: 1px solid var(--line); background: var(--paper); color: var(--ink);
  overflow: hidden;
}
.ev::before { content: ''; position: absolute; left: 0; top: 0; bottom: 0; width: 6px; background: var(--bands); }
.ev-time { font-size: 0.85rem; color: var(--ink-soft); flex: none; font-variant-numeric: tabular-nums; }
.ev-title { font-weight: 700; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.ev-who { color: var(--ink-soft); font-size: 0.85rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ev.is-past { color: var(--ink-soft); }
.ev.is-past::before { opacity: var(--past-band); }
.ev.is-past .ev-title { font-weight: 400; }
.ev.is-allday.cont-before { border-top-left-radius: 0; border-bottom-left-radius: 0; }
.ev.is-allday.cont-after { border-top-right-radius: 0; border-bottom-right-radius: 0; }
.more { border: 0; background: none; color: var(--ink-soft); text-decoration: underline; cursor: pointer; min-height: 32px; padding: 0 4px; text-align: left; font-size: 0.95rem; }

.day-head { display: flex; align-items: center; gap: 8px; }
.day-wd { color: var(--ink-soft); font-size: 0.95rem; }
.day-num { font-weight: 700; font-size: 1.1rem; min-width: 1.9em; height: 1.9em; padding: 0 0.2em; display: inline-grid; place-items: center; border-radius: 50%; font-variant-numeric: tabular-nums; }
.is-today .day-num { background: var(--accent); color: var(--accent-ink); }

/* Schedule: columns over the hours */
.sched { flex: 1; min-height: 0; display: flex; flex-direction: column; background: var(--paper); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
.sched-row { display: grid; grid-template-columns: 56px repeat(var(--cols), minmax(0, 1fr)); }
.sched-head { border-bottom: 1px solid var(--line); }
.sched-head .sched-cell { padding: 10px 10px 8px; }
.sched-allday { border-bottom: 1px solid var(--line); }
.sched-allday .sched-cell { padding: 4px; display: flex; flex-direction: column; gap: 4px; min-height: 40px; }
.sched-cell + .sched-cell, .sched-col + .sched-col, .sched-grid .gutter + .sched-col { border-left: 1px solid var(--line); }
.gutter-label { font-size: 0.8rem; color: var(--ink-soft); padding: 12px 6px 0; text-align: right; }
.sched-body { flex: 1; min-height: 320px; overflow-y: auto; overscroll-behavior: contain; }
.hours { position: relative; height: calc(var(--hour) * 24); }
.hour { position: absolute; right: 8px; transform: translateY(-50%); font-size: 0.8rem; color: var(--ink-soft); white-space: nowrap; }
.sched-col {
  position: relative; cursor: copy;
  background-image: repeating-linear-gradient(to bottom, transparent 0, transparent calc(var(--hour) - 1px), var(--line) calc(var(--hour) - 1px), var(--line) var(--hour));
}
.is-weekend.sched-col, .sched-cell.is-weekend { background-color: var(--weekend); }
.ev-block { position: absolute; flex-direction: column; gap: 0; align-items: stretch; justify-content: flex-start; align-content: flex-start; padding-top: 3px; min-height: 0; }
.ev-block .ev-title { order: -1; white-space: normal; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; line-height: 1.2; }
.ev-block.is-short { flex-direction: row; align-items: center; gap: 6px; padding-top: 0; padding-bottom: 0; }
.ev-block.is-short .ev-title { -webkit-line-clamp: 1; flex: 0 1 auto; }
.now-line { position: absolute; left: 0; right: 0; height: 0; border-top: 2px solid var(--accent); z-index: 2; pointer-events: none; }
.now-line::before { content: ''; position: absolute; left: -5px; top: -6px; width: 10px; height: 10px; border-radius: 50%; background: var(--accent); }

/* Day: a list you can read from across the room */
.agenda { max-width: 760px; width: 100%; }
.agenda-title { display: flex; gap: 12px; align-items: baseline; margin: 6px 0 14px; font-size: 1.6rem; }
.agenda-date { color: var(--ink-soft); font-size: 1.1rem; font-weight: 400; }
.agenda-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 10px; }
.ev-row { display: grid; grid-template-columns: 10ch 1fr; grid-template-areas: 'when title' 'when who'; align-items: baseline; padding: 12px 16px 12px 22px; min-height: 64px; column-gap: 12px; }
.ev-row::before { width: 8px; }
.ev-row .ev-when { grid-area: when; font-weight: 700; color: var(--ink-soft); font-variant-numeric: tabular-nums; }
.ev-row .ev-title { grid-area: title; font-size: 1.2rem; white-space: normal; }
.ev-row .ev-who { grid-area: who; font-size: 0.95rem; }
.agenda .quiet { font-size: 1.2rem; padding: 24px 0; }

/* Week */
.week { flex: 1 0 auto; display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 0; background: var(--paper); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; flex: 1; }
.wk-day { display: flex; flex-direction: column; min-height: 220px; }
.wk-day + .wk-day { border-left: 1px solid var(--line); }
.wk-day.is-weekend { background: var(--weekend); }
.wk-head { flex: none; border: 0; background: none; text-align: left; padding: 10px; cursor: pointer; min-height: 44px; }
.wk-items { display: flex; flex-direction: column; gap: 6px; padding: 0 6px 8px; flex: 1 0 auto; }
.wk-items .ev:not(.is-allday) { flex-direction: column; gap: 0; align-items: stretch; }
.wk-items .ev-title { white-space: normal; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.wk-empty { flex: 1; min-height: 44px; border: 0; background: none; cursor: copy; }

/* Month */
.month { display: flex; flex-direction: column; flex: 1 0 auto; background: var(--paper); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
.m-names, .m-week { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); }
.m-names { border-bottom: 1px solid var(--line); }
.m-wd { padding: 8px 10px; color: var(--ink-soft); font-size: 0.9rem; }
.m-week { flex: 1; min-height: 104px; }
.m-week + .m-week { border-top: 1px solid var(--line); }
.m-cell { display: flex; flex-direction: column; gap: 3px; padding: 4px; min-width: 0; }
.m-cell + .m-cell { border-left: 1px solid var(--line); }
.m-cell.is-weekend { background: var(--weekend); }
.m-cell.is-out .m-num { color: var(--ink-soft); font-weight: 400; }
.m-num { align-self: flex-start; border: 0; background: none; cursor: pointer; font-weight: 700; min-width: max(36px, 2.1em); min-height: max(36px, 2.1em); border-radius: 50%; padding: 0; font-variant-numeric: tabular-nums; }
.m-cell.is-today .m-num { background: var(--accent); color: var(--accent-ink); }
.m-items { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.m-items .ev { min-height: 26px; padding: 2px 6px 2px 11px; font-size: 0.9rem; }
.m-dots { display: none; gap: 3px; flex-wrap: wrap; padding-left: 6px; }
.m-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--bands); }

/* Sheets */
.sheet { border: 0; padding: 0; border-radius: 16px; background: var(--paper); color: var(--ink); width: min(560px, calc(100vw - 24px)); max-height: calc(100dvh - 24px); box-shadow: 0 18px 60px rgb(0 0 0 / 0.28); }
.sheet-wide { width: min(760px, calc(100vw - 24px)); }
.sheet::backdrop { background: rgb(11 20 48 / 0.45); }
.sheet[open] { animation: rise 180ms ease-out; }
@keyframes rise { from { transform: translateY(12px); opacity: 0; } to { transform: none; opacity: 1; } }
.sheet-inner { display: flex; flex-direction: column; max-height: calc(100dvh - 24px); }
.sheet-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 16px 16px 8px 22px; }
.sheet-head h2 { margin: 0; font-size: 1.35rem; }
.sheet-head h2:focus { outline: none; }
.sheet-head .icon-btn { border: 0; }
/* The body scrolls and the title stays. Positioned, so hidden screen-reader labels inside it stay inside it too (they made the whole sheet scroll). */
.sheet-body { position: relative; padding: 6px 22px 22px; overflow-y: auto; min-height: 0; display: flex; flex-direction: column; gap: 14px; }
.sheet-actions { display: flex; flex-wrap: wrap; gap: 10px; padding-top: 6px; }
.event-look { position: relative; padding-left: 42px; }
.event-look::before { content: ''; position: absolute; left: 22px; top: 8px; bottom: 26px; width: 8px; border-radius: 4px; background: var(--bands); }
.look-when { margin: 0; font-weight: 700; font-size: 1.1rem; }
.look-line, .look-notes, .look-source { margin: 0; }
.look-notes { white-space: pre-wrap; }
.look-source { color: var(--ink-soft); }
.who-list { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 8px; }
.who { --c: var(--ink-soft); display: inline-flex; align-items: center; gap: 8px; min-height: 40px; padding: 4px 12px 4px 5px; border: 2px solid var(--c); border-radius: 999px; font-weight: 700; }
.who .dot-label { margin-left: 6px; }
.scope .btn { width: 100%; }

.field { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.field > label, .field .label { font-weight: 700; font-size: 0.95rem; }
.field input:not([type='checkbox']), .field select, .field textarea {
  min-height: 44px; padding: 8px 12px; border-radius: var(--radius); border: 1px solid var(--line); background: var(--bg); width: 100%;
}
.field input[type='time'] { margin-top: 6px; }
.field textarea { resize: vertical; }
.field-inline { flex-direction: row; align-items: center; gap: 10px; }
.field-inline input[type='checkbox'] { width: 22px; height: 22px; accent-color: var(--accent); margin: 0; }
.field-inline label { font-weight: 400; font-size: 1rem; }
.field-pair { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.form-error { margin: 0; color: var(--ink); font-weight: 700; }
.form-error:empty { margin-top: -14px; }
.form-error:not(:empty)::before { content: '! '; color: var(--c-tomato); }

.panel-sec { display: flex; flex-direction: column; gap: 10px; }
.panel-sec + .panel-sec { border-top: 1px solid var(--line); padding-top: 16px; }
.panel-sec h3 { margin: 0; font-size: 1.1rem; }
.rows { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 10px; }
.row { --c: var(--ink-soft); display: flex; flex-wrap: wrap; align-items: center; gap: 10px; }
.row-name { min-height: 44px; padding: 0 12px; border-radius: var(--radius); border: 1px solid var(--line); background: var(--bg); width: 14ch; font-weight: 700; }
.row-cal { flex-direction: column; align-items: flex-start; padding: 12px; border: 1px solid var(--line); border-radius: var(--radius); }
.row-cal-name { display: flex; flex-direction: column; }
.swatches { display: flex; flex-wrap: wrap; gap: 6px; }
.swatch { --c: var(--ink-soft); width: 32px; height: 32px; border-radius: 50%; border: 3px solid var(--paper); background: var(--c); box-shadow: 0 0 0 1px var(--line); cursor: pointer; padding: 0; }
.swatch[aria-checked='true'] { box-shadow: 0 0 0 3px var(--ink); }
.swatch-current { width: 44px; height: 44px; flex: none; }
.row .swatches { flex-basis: 100%; padding-left: 54px; }
.row-cal .swatches { padding-left: 0; }
.add-row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.add-row input:not([type='file']) { min-height: 44px; padding: 0 12px; border-radius: var(--radius); border: 1px solid var(--line); background: var(--bg); }
.settings { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 14px; }
.row-wide { width: min(100%, 24ch); }

/* People and labels in Household: one line each; tapping opens that one to change. */
.who-row { border: 1px solid var(--line); border-radius: var(--radius); background: var(--paper); }
.who-row.is-open { border-color: var(--ink-soft); }
.who-row-head {
  width: 100%; display: flex; align-items: center; gap: 12px; min-height: 56px; padding: 8px 12px; border: 0; background: none;
  border-radius: var(--radius); cursor: pointer; text-align: left;
}
.who-row-head .avatar { width: 2.25rem; height: 2.25rem; font-size: 0.95rem; }
.who-row-head .avatar-emoji { font-size: 1.3rem; box-shadow: inset 0 0 0 4px var(--c); }
.who-row-head .dot-label { width: 1.25rem; height: 1.25rem; margin: 0 0.5rem; }
.who-row-text { display: flex; flex-direction: column; flex: 1; min-width: 0; }
.who-row-name { font-weight: 700; overflow-wrap: anywhere; }
.who-row-act { color: var(--ink-soft); text-decoration: underline; flex: none; }
.who-edit { display: flex; flex-direction: column; gap: 14px; padding: 6px 14px 16px; border-top: 1px solid var(--line); }
.who-edit .row-name { min-height: 44px; }
fieldset.field { border: 0; margin: 0; padding: 0; }
fieldset.field legend { padding: 0; margin-bottom: 6px; }
.pictures { display: flex; flex-wrap: wrap; gap: 6px; }
.picture {
  width: max(44px, 2.75rem); height: max(44px, 2.75rem); border-radius: 50%; border: 1px solid var(--line); background: var(--bg); cursor: pointer; padding: 0;
  display: inline-grid; place-items: center; font-size: 1.35rem; line-height: 1;
}
.picture-none { font-size: 0.9rem; font-weight: 700; }
.picture .avatar { width: 1.9rem; height: 1.9rem; }
.picture[aria-checked='true'] { box-shadow: 0 0 0 3px var(--ink); border-color: var(--paper); }
.field .add-row input.emoji-input { width: 6ch; padding: 0; text-align: center; font-size: 1.2rem; }
.merge-target { padding-left: 8px; }
.affected { margin: 0; padding-left: 1.2em; display: flex; flex-direction: column; gap: 8px; }

/* The household's time zone: the current one, and a search when changing it. */
.tz-now { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; }
.tz-pick { display: flex; flex-direction: column; gap: 8px; }
.tz-pick input { min-height: 44px; padding: 0 12px; border-radius: var(--radius); border: 1px solid var(--line); background: var(--bg); width: min(100%, 32ch); }
.tz-results { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.tz-option { width: 100%; justify-content: space-between; font-weight: 400; text-align: left; }
.tz-option[aria-pressed='true'] { border-color: var(--ink); font-weight: 700; }
.tz-clock { color: var(--ink-soft); font-variant-numeric: tabular-nums; flex: none; }

.toast {
  position: fixed; inset: auto; margin: 0; border: 0; left: 50%; bottom: max(20px, env(safe-area-inset-bottom)); transform: translate(-50%, 20px); opacity: 0; pointer-events: none;
  display: flex; align-items: center; gap: 14px; padding: 10px 12px 10px 18px; border-radius: 12px; background: var(--ink); color: var(--paper);
  max-width: calc(100vw - 24px); transition: opacity 160ms, transform 160ms; z-index: 20;
}
.toast.is-on { opacity: 1; transform: translate(-50%, 0); pointer-events: auto; }
.toast .btn { background: var(--paper); color: var(--ink); border-color: var(--paper); }

/* Phones */
@media (max-width: 900px) {
  .bar-actions { order: 1; }
  .views { order: 2; flex-basis: 100%; }
  .views button { flex: 1; }
  .stepper { order: 3; flex-basis: 100%; }
}
@media (max-width: 640px) {
  .bar { padding: 12px 12px 8px; gap: 10px; }
  .bar-title h1 { font-size: 1.15rem; }
  .bar-actions #household { padding: 0 12px; }
  .rail, .countdowns { padding-left: 12px; padding-right: 12px; }
  .rail-label { display: none; }
  main { padding: 0 8px 12px; }
  .sched-row { grid-template-columns: 44px repeat(var(--cols), minmax(0, 1fr)); }
  .sched-head .sched-cell { padding: 8px 6px; }
  .ev-block.is-short .ev-time { display: none; }
  .day-head { flex-direction: column; gap: 0; align-items: flex-start; }
  .week { display: flex; flex-direction: column; }
  .wk-day { flex: none; }
  .wk-day { min-height: 0; flex-direction: row; align-items: flex-start; }
  .wk-day + .wk-day { border-left: 0; border-top: 1px solid var(--line); }
  .wk-head { width: 64px; flex: none; }
  .wk-items { padding: 8px 8px 8px 0; }
  .wk-empty { min-height: 36px; }
  .m-week { min-height: 64px; }
  .m-cell { padding: 2px; align-items: center; }
  .m-items { display: none; }
  .m-dots { display: flex; padding-left: 0; justify-content: center; }
  .ev-row { grid-template-columns: 8ch 1fr; padding: 10px 12px 10px 18px; }
  .field-pair { grid-template-columns: 1fr; }
  .sheet { width: 100vw; max-width: 100vw; margin: auto 0 0; border-radius: 16px 16px 0 0; max-height: 92dvh; }
  .sheet-inner { max-height: 92dvh; } /* the title and Close stay put; only the body scrolls */
}

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

/* Touch screens: every tap target at least 44 x 44 points (Schreiber Quality D). A mouse keeps the compact sizes. */
@media (pointer: coarse) {
  .ev, .more, .btn-small, .m-num, .wk-empty { min-height: 44px; }
  .m-num { min-width: 44px; }
  .swatch { width: 44px; height: 44px; }
  .m-items .ev { min-height: 44px; }
}
