/* Household Brain: one calm system. Tokens first, then components, then screens. */
:root {
  --bg: #f6f3ec;
  --surface: #ffffff;
  --surface-2: #efe9dd;
  --text: #1d2320;
  --muted: #5d6762;
  --line: #e2dccf;
  --brand: #1f5e52;
  --brand-ink: #ffffff;
  --brand-soft: #e3efe9;
  --accent: #d9702a;
  --danger: #b83a27;
  --danger-soft: #f8e4df;
  --warn-soft: #f6ecd2;
  --ok: #2f7a47;
  --ok-soft: #e1f0e5;
  --shadow: 0 1px 2px rgba(20, 30, 25, .07), 0 4px 14px rgba(20, 30, 25, .05);
  --radius: 14px;
  --tap: 44px;
  --tabbar-h: 64px;
  --safe-b: env(safe-area-inset-bottom, 0px);
  --safe-t: env(safe-area-inset-top, 0px);
  --safe-l: env(safe-area-inset-left, 0px);
  --safe-r: env(safe-area-inset-right, 0px);
  --topbar-h: 56px;
  /* people: one colour each, used the same way everywhere */
  --p-teal: #1f7a6a; --p-coral: #c9502f; --p-blue: #2f6fb5; --p-amber: #9a6412; --p-rose: #b83f68; --p-green: #4a7f2a;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #121614; --surface: #1b211e; --surface-2: #232b27; --text: #edf1ee; --muted: #a2ada8; --line: #2d3732;
    --brand: #4fb39c; --brand-ink: #0c1512; --brand-soft: #1f3530;
    --danger: #ef7a67; --danger-soft: #3a211d; --warn-soft: #34301f; --ok: #6cc088; --ok-soft: #1d3326;
    --shadow: 0 1px 2px rgba(0, 0, 0, .4);
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #121614; --surface: #1b211e; --surface-2: #232b27; --text: #edf1ee; --muted: #a2ada8; --line: #2d3732;
  --brand: #4fb39c; --brand-ink: #0c1512; --brand-soft: #1f3530;
  --danger: #ef7a67; --danger-soft: #3a211d; --warn-soft: #34301f; --ok: #6cc088; --ok-soft: #1d3326;
  --shadow: 0 1px 2px rgba(0, 0, 0, .4); color-scheme: dark;
}

/* iOS inflates text in landscape unless told not to. */
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; background: var(--bg); color: var(--text); }
body {
  font: 16px/1.45 -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", Roboto, sans-serif;
  min-height: 100dvh;
  overflow-wrap: break-word;
  padding-bottom: calc(var(--tabbar-h) + var(--safe-b) + 24px);
  font-variant-numeric: tabular-nums;
}
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
button:focus-visible, a:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible, summary:focus-visible {
  outline: 3px solid color-mix(in srgb, var(--brand) 55%, transparent); outline-offset: 2px;
}
[hidden] { display: none !important; }
.ic { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; flex: 0 0 auto; }

/* ---- top bar ---- */
.topbar {
  position: sticky; top: 0; z-index: 5;
  display: flex; align-items: center; gap: 4px;
  padding: calc(var(--safe-t) + 8px) max(8px, var(--safe-r)) 8px max(16px, var(--safe-l));
  background: color-mix(in srgb, var(--bg) 90%, transparent);
  backdrop-filter: blur(12px);
}
.topbar.has-back { padding-left: max(4px, var(--safe-l)); }
.title { font-weight: 700; font-size: 1.25rem; line-height: 1.2; flex: 1; min-width: 0; overflow-wrap: anywhere; display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2; line-clamp: 2; overflow: hidden; }
.icon-btn { border: 0; background: transparent; width: var(--tap); height: var(--tap); border-radius: 12px; display: grid; place-items: center; color: var(--text); }
.icon-btn:active { background: var(--surface-2); }

main { padding: 4px max(16px, var(--safe-r)) 0 max(16px, var(--safe-l)); max-width: 680px; margin: 0 auto; min-width: 0; }
main, .card, .group { overflow-wrap: anywhere; }

/* ---- type + sections ---- */
h2.section {
  margin: 24px 2px 8px; font-size: .8rem; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); font-weight: 700;
  display: flex; align-items: center; gap: 8px;
}
h2.section::after { content: ""; flex: 1; height: 1px; background: var(--line); }
.muted { color: var(--muted); }
.small { font-size: .875rem; }
.empty { color: var(--muted); padding: 12px 4px; }
.kicker { font-size: .75rem; letter-spacing: .06em; text-transform: uppercase; font-weight: 700; color: var(--muted); }

.card { background: var(--surface); border-radius: var(--radius); box-shadow: var(--shadow); padding: 14px 16px; }
.card + .card { margin-top: 10px; }

/* ---- people ---- */
.avatar {
  width: 32px; height: 32px; border-radius: 50%; flex: 0 0 auto; display: inline-grid; place-items: center;
  background: var(--c, #6b7570); color: #fff; font-weight: 700; font-size: .85rem; line-height: 1;
}
.avatar.lg { width: 40px; height: 40px; font-size: 1rem; }
.who { display: inline-flex; align-items: center; gap: 6px; }
.who .avatar { width: 20px; height: 20px; font-size: .65rem; }
.swatches { display: flex; gap: 10px; flex-wrap: wrap; }
.swatch { width: var(--tap); height: var(--tap); border-radius: 50%; border: 3px solid transparent; background: var(--c); padding: 0; display: grid; place-items: center; color: #fff; }
.swatch[aria-pressed="true"] { border-color: var(--text); }

/* ---- summary chips (Home + wall) ---- */
.stat-row { display: flex; gap: 8px; flex-wrap: wrap; margin: 8px 0 2px; }
.stat { display: inline-flex; align-items: baseline; gap: 6px; min-width: 0; max-width: 100%; overflow-wrap: anywhere; padding: 7px 12px; border-radius: 999px; background: var(--surface); box-shadow: var(--shadow); font-size: .9rem; color: var(--muted); }
.stat b { font-size: 1.1rem; color: var(--text); }
.stat.bad { background: var(--danger-soft); color: var(--danger); } .stat.bad b { color: var(--danger); }
.stat.warn { background: var(--warn-soft); }
.stat.good { background: var(--ok-soft); color: var(--ok); } .stat.good b { color: var(--ok); }

/* ---- the task row: who, what, one clear action ---- */
.task { display: flex; align-items: center; gap: 4px; min-width: 0; background: var(--surface); border-radius: var(--radius); box-shadow: var(--shadow); margin: 8px 0; padding: 6px 8px 6px 12px; }
.task .avatar { margin-right: 4px; }
.task-body > * { min-width: 0; }
.task-body { flex: 1; min-width: 0; text-align: left; border: 0; background: none; padding: 8px 4px; min-height: 52px; display: flex; flex-direction: column; justify-content: center; }
.task-title { font-weight: 600; overflow-wrap: anywhere; min-width: 0; }
.task-meta { overflow-wrap: anywhere; font-size: .82rem; color: var(--muted); margin-top: 1px; }
.task-meta .due-bad { color: var(--danger); font-weight: 700; }
.task.waiting { background: color-mix(in srgb, var(--warn-soft) 55%, var(--surface)); }
.task-go {
  flex: 0 0 auto; min-height: var(--tap); padding: 0 14px; border-radius: 999px; border: 1.5px solid var(--brand);
  background: transparent; color: var(--brand); font-weight: 700; font-size: .9rem; display: inline-flex; align-items: center; gap: 6px; max-width: min(46%, 12em); min-width: var(--tap); justify-content: center;
}
.task-go .ic { width: 18px; height: 18px; }
.task-go:active { background: var(--brand-soft); }
.task-go span { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* quiet list of schedule lines */
.deadline { display: flex; gap: 12px; align-items: baseline; padding: 10px 2px; border-bottom: 1px solid var(--line); }
.deadline:last-child { border-bottom: 0; }
.deadline .when { flex: 0 0 auto; min-width: 72px; max-width: 40%; overflow-wrap: anywhere; color: var(--muted); font-size: .9rem; }
.deadline > :last-child { flex: 1; min-width: 0; overflow-wrap: anywhere; }
.deadline.overdue .when { color: var(--danger); font-weight: 700; }

/* ---- generic buttons ---- */
.btn { border: 0; border-radius: 12px; min-height: var(--tap); padding: 12px 16px; max-width: 100%; overflow-wrap: anywhere; font-weight: 700; background: var(--brand); color: var(--brand-ink); width: 100%; }
.btn.secondary { background: var(--surface-2); color: var(--text); }
.btn.danger { background: transparent; color: var(--danger); }
.btn.sm { min-height: var(--tap); padding: 8px 14px; width: auto; }
.btn:active { filter: brightness(.94); }
a.btn { display: block; text-align: center; text-decoration: none; }
.link { border: 0; background: none; color: var(--brand); font-weight: 600; padding: 10px 4px; min-height: var(--tap); flex: 0 0 auto !important; }
.row { display: flex; gap: 8px; }
.row > * { flex: 1; min-width: 0; }
/* buttons in a row wrap to the next line rather than splitting a word ("Somethin g else") */
.row > .btn { min-width: min-content; overflow-wrap: break-word; }
.row { flex-wrap: wrap; }
.stack { display: grid; grid-template-columns: minmax(0, 1fr); gap: 8px; }

/* ---- list rows (settings hub, areas, routines) ---- */
.list-btn { display: flex; justify-content: space-between; align-items: center; gap: 12px; width: 100%; min-height: 56px; text-align: left; border: 0; background: var(--surface); color: inherit; padding: 10px 14px; border-radius: var(--radius); margin: 6px 0; box-shadow: var(--shadow); text-decoration: none; }
.list-btn > span:first-child { flex: 1; min-width: 0; }
.list-btn { overflow-wrap: anywhere; }
.list-btn .go { color: var(--muted); display: inline-flex; align-items: center; gap: 6px; flex: 0 0 auto; }
.list-btn.radar { border-left: 0; }
.hub-ico { width: 40px; height: 40px; border-radius: 12px; background: var(--brand-soft); color: var(--brand); display: grid; place-items: center; flex: 0 0 auto; }
.hub-row { display: flex; align-items: center; gap: 12px; min-width: 0; }
.hub-row > :last-child { min-width: 0; flex: 1; }
.hub-row .t { font-weight: 600; }
.group { background: var(--surface); border-radius: var(--radius); box-shadow: var(--shadow); padding: 4px 14px; margin: 6px 0; }
.group .list-btn { box-shadow: none; padding-left: 0; padding-right: 0; margin: 0; border-bottom: 1px solid var(--line); border-radius: 0; background: transparent; }
.group .list-btn:last-child { border-bottom: 0; }
.tag { display: inline-block; font-size: .75rem; padding: 2px 8px; border-radius: 999px; background: var(--surface-2); color: var(--muted); margin-left: 6px; }
.tag.stale { background: var(--warn-soft); color: var(--text); }

/* ---- disclosure: secondary content stays one tap away ---- */
details.more-box { margin: 18px 0 0; }
details.more-box > summary {
  list-style: none; cursor: pointer; min-height: var(--tap); display: flex; align-items: center; gap: 8px; padding: 0 2px;
  font-size: .8rem; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); font-weight: 700;
}
details.more-box > summary::-webkit-details-marker { display: none; }
details.more-box > summary::after { content: ""; flex: 1; height: 1px; background: var(--line); }
details.more-box > summary .ic { width: 16px; height: 16px; transition: transform .15s; }
details.more-box[open] > summary .ic { transform: rotate(90deg); }
details summary { cursor: pointer; }

/* ---- briefing + nudges: flat, quiet ---- */
.brief { background: var(--brand-soft); box-shadow: none; }
.brief h3 { margin: 4px 0; font-size: 1.05rem; }
.brief p { margin: 0 0 12px; }
.nudge { border: 1.5px solid color-mix(in srgb, var(--brand) 40%, transparent); margin-top: 10px; }
.nudge p { margin: 6px 0 10px; }
.tonight { margin-top: 10px; background: var(--warn-soft); box-shadow: none; }
.digest-line { padding: 5px 0; line-height: 1.4; }

/* ---- bottom navigation: the + lives in the bar, never over content ---- */
.tabbar {
  position: fixed; z-index: 10; left: 0; right: 0; bottom: 0;
  height: calc(var(--tabbar-h) + var(--safe-b)); padding: 0 var(--safe-r) var(--safe-b) var(--safe-l);
  display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); align-items: center;
  background: var(--surface); border-top: 1px solid var(--line);
}
.tabbar a {
  position: relative; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; height: 100%;
  color: var(--muted); text-decoration: none; font-size: .72rem; font-weight: 600; min-width: 0; min-height: var(--tap); white-space: nowrap;
}
.tabbar a.active { color: var(--brand); }
.fab {
  justify-self: center; width: 56px; height: 56px; border-radius: 50%; border: 0; margin-top: -18px;
  background: var(--accent); color: #fff; display: grid; place-items: center; box-shadow: 0 6px 16px rgba(217, 112, 42, .4);
}
.fab .ic { width: 28px; height: 28px; stroke-width: 2.2; }
.fab:active { transform: scale(.94); }
.badge {
  position: absolute; top: 6px; left: calc(50% + 6px); min-width: 20px; height: 20px; padding: 0 6px; border-radius: 10px;
  background: var(--danger); color: #fff; font-size: .72rem; font-weight: 700; display: grid; place-items: center;
}

/* ---- triage flashcards ---- */
.triage-head { display: flex; justify-content: space-between; align-items: baseline; margin: 8px 2px 12px; }
.flashcard {
  min-height: 30svh; min-width: 0; max-width: 100%; display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center;
  font-size: 1.4rem; font-weight: 600; padding: 28px 22px; background: var(--surface); border-radius: 20px; box-shadow: var(--shadow);
  animation: slide-in .18s ease-out; overflow-wrap: anywhere;
}
.flashcard .source { font-size: .8rem; color: var(--muted); font-weight: 500; margin-top: 14px; }
.flashcard.jit { border: 2px solid var(--accent); }
@keyframes slide-in { from { transform: translateX(24px); opacity: 0; } to { transform: none; opacity: 1; } }
@keyframes slide-in-back { from { transform: translateX(-24px); opacity: 0; } to { transform: none; opacity: 1; } }
.flashcard.enter-back { animation-name: slide-in-back; }
/* Swipe through the pile: the card follows the finger, then flies off. */
.flashcard { touch-action: pan-y; user-select: none; -webkit-user-select: none; transition: transform .17s ease-out, opacity .17s ease-out; cursor: grab; }
.flashcard.dragging { transition: none; cursor: grabbing; }
.flashcard.fly-left { transform: translateX(-120%) rotate(-6deg) !important; opacity: 0; }
.flashcard.fly-right { transform: translateX(120%) rotate(6deg) !important; opacity: 0; }
.triage-nav { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin: 10px 0 0; }
.triage-nav .btn { display: inline-flex; align-items: center; gap: 4px; flex: 0 0 auto; }
.triage-nav .btn svg { width: 18px; height: 18px; }
#tri-back svg { transform: rotate(180deg); }
.triage-nav > span { text-align: center; min-width: 0; }
.suggests { text-align: center; margin: 14px 0 10px; color: var(--muted); min-height: 1.4em; }
.suggests b { color: var(--brand); }
.macro-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.macro { min-width: 0; overflow-wrap: anywhere; border: 2px solid transparent; background: var(--surface); border-radius: 14px; min-height: 60px; padding: 14px 10px; font-weight: 700; box-shadow: var(--shadow); }
.macro.suggested { border-color: var(--brand); background: var(--brand-soft); }
.macro-sub { display: block; font-weight: 500; font-size: .8rem; color: var(--muted); margin-top: 3px; }
.choice.add-kind { min-height: 0; padding: 12px 16px; border: 2px solid transparent; }
.choice.add-kind.active { border-color: var(--brand); background: var(--brand-soft); }
.macro.discard { grid-column: 1 / -1; color: var(--danger); min-height: var(--tap); padding: 10px; box-shadow: none; background: transparent; }

/* ---- lists ---- */
.list-picker { display: flex; gap: 8px; margin: 8px 0 4px; flex-wrap: wrap; }
.chip { max-width: 100%; overflow-wrap: anywhere; border: 1px solid var(--line); background: var(--surface); min-height: var(--tap); padding: 8px 14px; border-radius: 999px; font-weight: 600; }
.chip.active { background: var(--brand); color: var(--brand-ink); border-color: var(--brand); }
.chip.off { opacity: .45; text-decoration: line-through; }
.chip:disabled { opacity: .4; }
.chip-wrap { display: flex; flex-wrap: wrap; gap: 8px; margin: 8px 0; }
.chip-wrap .chip { font-weight: 500; font-size: .92rem; text-align: left; }
.chip .count { font-size: .75rem; opacity: .7; margin-left: 2px; }
.list-picker a.chip { text-decoration: none; color: inherit; display: inline-flex; align-items: center; }
.list-picker a.chip.active { color: var(--brand-ink); }
.check { min-width: 0; overflow-wrap: anywhere; display: flex; align-items: center; gap: 12px; min-height: 52px; padding: 8px 4px; border-bottom: 1px solid var(--line); }
.check:last-child { border-bottom: 0; }
.check > span { min-width: 0; }
.check input { width: 24px; height: 24px; accent-color: var(--brand); flex: 0 0 auto; }
.check.done span { text-decoration: line-through; color: var(--muted); }
.check.have { opacity: .55; }
.spec { padding: 6px 2px; }

/* ---- calendar ---- */
.day { margin-top: 18px; }
.day h3 { margin: 0 0 6px; font-size: .85rem; color: var(--muted); position: sticky; top: calc(var(--safe-t) + var(--topbar-h)); background: var(--bg); padding: 4px 0; z-index: 1; }
.day.today h3 { color: var(--brand); }
.event { display: flex; gap: 10px; align-items: center; min-width: 0; min-height: 48px; padding: 8px 12px; background: var(--surface); border-radius: 12px; margin: 6px 0; box-shadow: var(--shadow); }
.event > :first-child { flex: 1; min-width: 0; overflow-wrap: anywhere; }
.event .src { font-size: .8rem; color: var(--muted); margin-left: auto; flex: 0 1 auto; max-width: 40%; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; display: inline-flex; align-items: center; gap: 6px; }
.event.task { background: transparent; box-shadow: none; border: 1px dashed var(--line); }

/* ---- forms + sheets ---- */
.field { display: grid; grid-template-columns: minmax(0, 1fr); gap: 6px; margin: 12px 0; }
.field label { font-size: .875rem; color: var(--muted); font-weight: 600; }
input[type=text], input[type=date], input[type=time], input[type=datetime-local], input[type=password], input[type=number], select, textarea {
  width: 100%; border: 1px solid var(--line); background: var(--surface); border-radius: 12px; padding: 12px; font-size: 16px; min-height: var(--tap);
}
textarea { min-height: 110px; resize: vertical; }
.seg { display: flex; background: var(--surface-2); border-radius: 12px; padding: 3px; }
.seg button { flex: 1; min-width: 0; overflow-wrap: anywhere; border: 0; background: transparent; min-height: var(--tap); padding: 8px; border-radius: 10px; font-weight: 600; }
.seg button.active { background: var(--surface); box-shadow: var(--shadow); }
.seg.wrap { flex-wrap: wrap; }
.seg.mini { flex: 0 0 auto; }
.seg.mini button { padding: 6px 10px; min-height: var(--tap); }

.backdrop { position: fixed; inset: 0; background: rgba(0, 0, 0, .4); z-index: 30; }
.sheet {
  position: fixed; z-index: 31; left: 0; right: 0; bottom: 0; max-height: 90dvh; overflow-x: hidden; overflow-y: auto; overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
  background: var(--bg); border-radius: 22px 22px 0 0; padding: 10px max(16px, var(--safe-r)) calc(18px + var(--safe-b)) max(16px, var(--safe-l));
  overflow-wrap: anywhere;
  animation: up .18s ease-out; max-width: 640px; margin: 0 auto;
}
/* The grip: a full-width strip so it's easy to catch with a thumb; it stays put while the sheet scrolls. */
.sheet-grip {
  position: sticky; top: -10px; z-index: 2; margin: -10px calc(-1 * max(16px, var(--safe-r))) 4px calc(-1 * max(16px, var(--safe-l)));
  height: 30px; display: flex; align-items: center; justify-content: center; background: var(--bg);
  touch-action: none; cursor: grab; -webkit-tap-highlight-color: transparent; user-select: none;
}
.sheet-grip::before { content: ""; width: 44px; height: 5px; border-radius: 3px; background: var(--line); }
.sheet-grip:active { cursor: grabbing; }
.sheet-grip:focus-visible::before { background: var(--accent); }
.sheet h2 { margin: 4px 0 10px; font-size: 1.2rem; }
.sheet h2.section { font-size: .8rem; margin: 22px 2px 8px; }
@keyframes up { from { transform: translateY(30px); opacity: 0; } to { transform: none; opacity: 1; } }
@keyframes side-in { from { transform: translateX(32px); opacity: 0; } to { transform: none; opacity: 1; } }
.choice > :last-child { min-width: 0; }
.choice { display: flex; gap: 14px; min-width: 0; align-items: center; width: 100%; text-align: left; border: 0; background: var(--surface); padding: 14px 16px; border-radius: var(--radius); box-shadow: var(--shadow); margin: 8px 0; min-height: 64px; }
.choice .ico { width: 44px; height: 44px; border-radius: 12px; background: var(--brand-soft); color: var(--brand); display: grid; place-items: center; flex: 0 0 auto; }

.toast {
  position: fixed; z-index: 40; left: 50%; transform: translateX(-50%);
  bottom: calc(var(--tabbar-h) + var(--safe-b) + 16px);
  background: var(--text); color: var(--bg); padding: 12px 16px; border-radius: 12px; font-weight: 600; width: max-content; max-width: min(90vw, 32em); overflow-wrap: anywhere;
}

/* ---- loading ---- */
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes net-slide { from { transform: translateX(-100%); } to { transform: translateX(250%); } }
.spinner { display: inline-block; width: 1em; height: 1em; margin-right: 8px; vertical-align: -0.15em; border: 2px solid currentColor; border-right-color: transparent; border-radius: 50%; animation: spin .7s linear infinite; }
.btn.busy { opacity: .85; cursor: progress; }
.btn.busy::before { content: ""; display: inline-block; width: 1em; height: 1em; margin-right: 8px; vertical-align: -0.15em; border: 2px solid currentColor; border-right-color: transparent; border-radius: 50%; animation: spin .7s linear infinite; }
.page-loading { display: flex; align-items: center; justify-content: center; padding: 60px 0; color: var(--muted); }
.net-bar { position: fixed; top: 0; left: 0; right: 0; height: 3px; z-index: 100; overflow: hidden; opacity: 0; transition: opacity .15s; pointer-events: none; }
.net-bar.on { opacity: 1; }
.net-bar::after { content: ""; position: absolute; inset: 0; width: 40%; background: var(--brand); animation: net-slide 1.1s ease-in-out infinite; }

/* ---- the remaining feature screens ---- */
.blindspot { border-left: 4px solid var(--accent); border-radius: 4px var(--radius) var(--radius) 4px; }
.blindspot h4, .rec h4 { margin: 0 0 4px; }
.blindspot p, .rec p { margin: 0 0 6px; }
.blindspot > .btn { margin-top: 10px; }
.brief-list { margin-top: 8px; }
.brief-list .deadline, .brief-item .deadline { width: 100%; background: none; border-left: 0; border-right: 0; border-top: 0; color: inherit; text-align: left; font: inherit; cursor: pointer; }
.deadline.gap .when, .deadline.gap strong { color: var(--accent); }
.brief-item { border-bottom: 1px solid var(--line); padding-bottom: 2px; }
.brief-item .deadline { border-bottom: 0; }
.brief-item .brief-owners { margin: 0 0 8px; padding-left: 84px; }
.brief-owners .chip { min-height: 36px; padding: 4px 12px; font-size: .88rem; }
.no-owner { color: var(--accent); font-weight: 600; }
.brief-area { padding: 10px 0; border-top: 1px solid var(--line); margin-top: 8px; }
.brief-toggle { display: flex; justify-content: space-between; align-items: center; gap: 8px; width: 100%; min-height: var(--tap); background: none; border: 0; padding: 4px 2px; color: inherit; text-align: left; font: inherit; cursor: pointer; }
@media (max-width: 420px) { .brief-item .brief-owners { padding-left: 0; } }
.member-row { display: grid; grid-template-columns: 52px minmax(0, 1fr) minmax(0, 110px); gap: 8px; margin: 8px 0; }
.member-row input[type=date] { grid-column: 2 / -1; }
.g-progress { height: 4px; background: var(--line); border-radius: 2px; overflow: hidden; margin: 6px 2px 10px; }
.g-progress div { height: 100%; background: var(--brand); transition: width .2s ease; }
.g-card { background: var(--surface); border-radius: 20px; box-shadow: var(--shadow); padding: 22px 18px 16px; animation: slide-in .18s ease-out; }
.g-question { font-size: 1.3rem; font-weight: 650; margin-bottom: 8px; }
.g-card textarea { min-height: 64px; margin-top: 6px; }
.breakdown-btn { margin: 0; }
.breakdown-btn.suggested { background: var(--accent); color: #fff; }
.small-card { min-height: 0; font-size: 1rem; padding: 14px 16px; margin-bottom: 8px; animation: none; }
.bd-row { display: flex; gap: 10px; align-items: flex-start; background: var(--surface); border-radius: 14px; padding: 10px 12px; margin: 8px 0; box-shadow: var(--shadow); }
.bd-row > input[type=checkbox] { width: 24px; height: 24px; margin-top: 12px; accent-color: var(--brand); flex: 0 0 24px; }
.bd-fields { flex: 1; min-width: 0; display: grid; gap: 6px; }
.bd-fields input[type=text], .bd-fields textarea { padding: 9px 10px; }
.bd-fields textarea { min-height: 0; resize: none; }
.bd-meta { min-width: 0; display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.bd-meta input[type=date] { width: auto; padding: 6px 8px; font-size: 14px; }
.bd-meta .tag { margin-left: 0; }
.ledger-card { width: 100%; text-align: left; border: 0; color: inherit; font: inherit; cursor: pointer; }
.ledger-row { display: grid; grid-template-columns: minmax(0, 7.5em) minmax(0, 1fr) auto; gap: 8px; align-items: center; margin: 6px 0; }
.ledger-row .who { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ledger-row .bars { display: grid; gap: 3px; }
.ledger-row .bar { display: block; height: 7px; border-radius: 4px; min-width: 3px; }
.bar.think, .dot.think { background: var(--accent); }
.bar.do, .dot.do { background: var(--brand); }
.ledger-key { margin-top: 4px; display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.dot { display: inline-block; width: 9px; height: 9px; border-radius: 50%; }
.ledger-grid { display: grid; grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr) auto; gap: 4px 10px; margin-top: 8px; }
.standard { background: var(--surface-2); border-radius: 10px; padding: 8px 10px; }
.others-line { margin: 12px 4px 0; text-align: center; }
.meal-row { display: flex; align-items: center; gap: 6px; margin: 8px 0; min-width: 0; }
.meal-row.past { opacity: .5; }
.meal-main { flex: 1; min-width: 0; overflow-wrap: anywhere; display: grid; grid-template-columns: 3.2em minmax(0, 1fr); gap: 10px; align-items: center; text-align: left; border: 0; background: var(--surface); color: inherit; font: inherit; padding: 12px 14px; border-radius: 14px; box-shadow: var(--shadow); min-height: 56px; }
.meal-main .when { font-weight: 700; color: var(--muted); }
.more { border: 0; background: var(--surface); border-radius: 999px; width: var(--tap); height: var(--tap); flex: 0 0 var(--tap); box-shadow: var(--shadow); font-size: 1.1rem; }
.area-row > :first-child { min-width: 0; overflow-wrap: anywhere; }
.area-row { min-width: 0; display: flex; justify-content: space-between; align-items: center; gap: 8px; background: var(--surface); border-radius: 12px; padding: 8px 8px 8px 14px; margin: 6px 0; box-shadow: var(--shadow); }
.sticky-foot { position: sticky; bottom: calc(-18px - var(--safe-b)); background: var(--bg); padding: 10px 0 4px; margin-top: 10px; padding-bottom: calc(18px + var(--safe-b)); border-top: 1px solid var(--line); }
code { font-size: .85em; background: var(--surface-2); padding: 1px 5px; border-radius: 5px; overflow-wrap: anywhere; }

/* ================================================================== ACTIONABLE ITEMS
   Every row opens a sheet; the sheet holds every ending (done, not happening), moves, hand-overs, edits and follow-ons. */
.sheet:focus { outline: none; }
.task { cursor: pointer; }
button.deadline.tap, button.event { width: 100%; border: 0; font: inherit; color: inherit; text-align: left; cursor: pointer; }
button.deadline.tap { background: transparent; min-height: var(--tap); border-bottom: 1px solid var(--line); }
button.deadline.tap:last-child { border-bottom: 0; }
.event.off > :first-child { color: var(--muted); text-decoration: line-through; }
.event.off .tag { text-decoration: none; }
.cal-tools { justify-content: space-between; align-items: center; margin-top: 6px; }
.cal-tools > * { flex: 0 1 auto; }

/* toast with one action (Undo) */
.toast.has-action { display: flex; align-items: center; gap: 12px; padding: 8px 8px 8px 16px; }
.toast-msg { flex: 1; min-width: 0; overflow-wrap: anywhere; }
.toast-note { display: block; font-weight: 400; font-size: .85rem; opacity: .85; margin-top: 4px; }
.toast-btn { flex: 0 0 auto; min-height: var(--tap); min-width: var(--tap); padding: 0 14px; border: 0; border-radius: 10px; background: color-mix(in srgb, var(--bg) 18%, transparent); color: var(--bg); font-weight: 700; max-width: 45%; overflow-wrap: anywhere; }
.toast-btn:active { background: color-mix(in srgb, var(--bg) 30%, transparent); }
body.wall .toast { bottom: calc(24px + var(--safe-b)); font-size: 1.05rem; }

/* the item sheet */
.item-title { font-size: 1.3rem; line-height: 1.3; overflow-wrap: anywhere; min-width: 0; }
.item-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 2px 6px; margin: 0 0 10px; min-width: 0; }
.item-meta .due-bad, .due-bad { color: var(--danger); font-weight: 700; }
.item-notes { white-space: pre-wrap; overflow-wrap: anywhere; margin: 0 0 10px; }
.item-ended { background: var(--surface-2); border-radius: 10px; padding: 8px 10px; }
.item-primary { margin-top: 6px; }
.item-primary .btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; }
.item-k { margin: 16px 2px 6px; }
.item-more { margin-top: 12px; }
.item-more .btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; flex: 0 1 auto; }
.item-more .btn .ic { width: 18px; height: 18px; }
.item-edit { margin: 4px 0 8px; }
.item-edit .field:first-child { margin-top: 0; }
textarea.short { min-height: 64px; }
.pick-row { align-items: center; }
.pick-row input { flex: 1 1 10em; }
.pick-row .btn { flex: 0 0 auto; }
.item-loading { margin-top: 16px; }
.item-delete { margin-top: 22px; }
.confirm-row { background: var(--danger-soft); border-radius: 12px; padding: 12px; display: grid; gap: 10px; }
.btn.danger-solid { background: var(--danger); color: #fff; }
.linked-ev.off strong { color: var(--muted); text-decoration: line-through; }
.linked-ev .row .btn { flex: 1 1 auto; }

/* people chips: "who's this?" on the wall, "hand over" everywhere */
.who-chips { display: flex; flex-wrap: wrap; gap: 8px; min-width: 0; }
.who-chip { display: inline-flex; align-items: center; gap: 8px; min-height: var(--tap); max-width: 100%; padding: 4px 14px 4px 5px; border-radius: 999px; border: 1.5px solid var(--line); background: var(--surface); font-weight: 600; text-align: left; min-width: 0; }
.who-chip > span:last-child { min-width: 0; overflow-wrap: anywhere; }
.who-chip .avatar { width: 32px; height: 32px; }
.who-chip.active { border-color: var(--brand); background: var(--brand-soft); box-shadow: inset 0 0 0 1px var(--brand); }
.who-chip.current { border-style: dashed; border-color: var(--brand); }
.who-bar { background: var(--surface); border-radius: var(--radius); padding: 10px 12px; margin: 0 0 12px; box-shadow: var(--shadow); display: grid; gap: 8px; }
.who-bar.nag { box-shadow: 0 0 0 3px var(--danger); }

/* follow-ons */
.fo-list { display: grid; gap: 6px; }
.fo-row { display: flex; align-items: center; gap: 6px; min-width: 0; background: var(--surface); border-radius: 12px; box-shadow: var(--shadow); padding: 2px 6px 2px 2px; }
.fo-main { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; border: 0; background: none; color: inherit; font: inherit; text-align: left; padding: 8px 10px; min-height: var(--tap); }
button.fo-main { cursor: pointer; }
.fo-title { font-weight: 600; overflow-wrap: anywhere; min-width: 0; }
.fo-meta { font-size: .82rem; color: var(--muted); overflow-wrap: anywhere; display: flex; flex-wrap: wrap; align-items: center; gap: 4px; }
.fo-row.closed .fo-title { color: var(--muted); font-weight: 500; }
.fo-row.skipped .fo-title { color: var(--muted); text-decoration: line-through; }
.fo-x { flex: 0 0 auto; min-height: var(--tap); padding: 0 12px; border-radius: 999px; border: 1px solid var(--line); background: transparent; font-weight: 600; font-size: .85rem; max-width: 40%; overflow-wrap: anywhere; }
.state-chip { display: inline-block; padding: 1px 8px; border-radius: 999px; background: var(--surface-2); color: var(--text); font-size: .75rem; font-weight: 600; }
.state-chip.s-Active { background: var(--brand-soft); }
.state-chip.s-WaitingOnExternal { background: var(--warn-soft); }
.state-chip.s-Done { background: var(--ok-soft); color: var(--ok); }
.state-chip.s-Cancelled { background: var(--danger-soft); color: var(--danger); }

/* Home cards: tidied up, still doing this?, dinners */
.tidied-card { margin-top: 12px; background: var(--surface-2); box-shadow: none; }
.tidied-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; min-width: 0; }
.tidied-head > strong { min-width: 0; }
.tidied-card > p { margin: 2px 0 6px; }
.tidied-row { display: flex; align-items: center; gap: 10px; padding: 6px 0; border-top: 1px solid var(--line); min-width: 0; }
.tidied-row > span { flex: 1; min-width: 0; overflow-wrap: anywhere; }
.tidied-row .btn { flex: 0 0 auto; }
.stale-card { margin: 8px 0; border-left: 4px solid var(--accent); }
.stale-title { display: block; margin: 2px 0; overflow-wrap: anywhere; }
.stale-btns, .stale-move { margin-top: 10px; }
.stale-move { align-items: center; }
.stale-move input { flex: 1 1 10em; }
.stale-move .btn { flex: 0 0 auto; }
.dinners-card { margin-top: 12px; border: 1.5px dashed color-mix(in srgb, var(--accent) 60%, transparent); }
.dinners-card > p { margin: 4px 0 10px; }
.night-list { display: grid; gap: 6px; margin-bottom: 10px; }
.night { display: grid; grid-template-columns: 4.2em minmax(0, 1fr) auto; align-items: center; gap: 8px; min-height: 48px; width: 100%; text-align: left; font: inherit; color: inherit;
  border: 1.5px solid var(--line); border-radius: 12px; background: var(--surface); padding: 6px 10px; cursor: pointer; }
.night.proposed { border-style: dashed; border-color: color-mix(in srgb, var(--accent) 70%, transparent); }
.night .when { font-weight: 700; color: var(--muted); }
.night .what { min-width: 0; overflow-wrap: anywhere; }
.night.skipped .what { color: var(--muted); }
.night .tag { margin: 0; }
.tag.proposed-tag { background: var(--warn-soft); color: var(--text); font-weight: 600; }
.shop-line { margin-top: 10px; }

/* the night sheet */
.night-now { display: flex; flex-direction: column; gap: 2px; padding: 12px 14px; border-radius: 14px; background: var(--surface); box-shadow: var(--shadow); min-width: 0; }
.night-now.proposed { border: 1.5px dashed color-mix(in srgb, var(--accent) 70%, transparent); box-shadow: none; }
.night-now .tag { align-self: flex-start; margin: 0 0 4px; }
.night-now strong { font-size: 1.1rem; overflow-wrap: anywhere; }
.night-opt { min-height: 56px; margin: 6px 0; }
.clamp2 { display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2; line-clamp: 2; overflow: hidden; }
.nf-row { align-items: center; margin: 4px 0 8px; }
.nf-row input { flex: 1 1 12em; }
.nf-row .btn { flex: 0 0 auto; }
.suggest-row { align-items: center; }
.suggest-row .btn { flex: 0 0 auto; }

/* shopping: aisle by aisle */
.aisle + .aisle { margin-top: 10px; }
.aisle-h { margin: 10px 2px 2px; font-size: .75rem; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); font-weight: 700; }
.sheet .aisle-h:first-child { margin-top: 14px; }
.shop-row { display: flex; align-items: center; gap: 4px; min-width: 0; border-bottom: 1px solid var(--line); }
.shop-row .check { flex: 1; border-bottom: 0; }
.aisle .shop-row:last-child, .aisle .check:last-child { border-bottom: 0; }
.shop-title { font-weight: 500; }
.shop-for { display: block; }
.shop-more { flex: 0 0 auto; color: var(--muted); }
.have-row .tag { margin-left: 8px; }
.shop-trip { margin-top: 10px; }
#pantry { margin-top: 8px; }
.meal-row.proposed .meal-main { border: 1.5px dashed color-mix(in srgb, var(--accent) 70%, transparent); box-shadow: none; }
.meal-main .tag { margin-left: 8px; }

@media (max-width: 599px) { #wall-btn { display: none; } }

/* ---- tablets used as a normal app ---- */
@media (min-width: 768px) {
  main { max-width: 760px; padding-top: 8px; }
  .sheet { border-radius: 22px; bottom: 5dvh; max-width: 560px; }
}

/* Wide landscape (tablet on its side, PC): the sheet becomes a right-anchored side panel. */
@media (min-width: 900px) and (orientation: landscape) {
  .sheet {
    left: auto; right: 0; top: 0; bottom: 0; margin: 0; width: min(440px, 45vw); max-width: none; max-height: none; height: 100dvh;
    border-radius: 22px 0 0 22px; padding-top: calc(10px + var(--safe-t)); animation-name: side-in;
  }
  .sheet-grip { top: calc(-10px - var(--safe-t)); margin-top: calc(-10px - var(--safe-t)); height: calc(30px + var(--safe-t)); align-items: flex-end; padding-bottom: 12px; }
}

/* Short landscape (a phone on its side): every pixel of height counts. */
@media (orientation: landscape) and (max-height: 500px) {
  :root { --tabbar-h: 48px; --topbar-h: 48px; }
  .topbar { padding-top: calc(var(--safe-t) + 2px); padding-bottom: 2px; }
  .title { font-size: 1.1rem; }
  body { padding-bottom: calc(var(--tabbar-h) + var(--safe-b) + 12px); }
  .tabbar a { flex-direction: row; gap: 6px; font-size: .78rem; }
  .tabbar .ic { width: 20px; height: 20px; }
  .badge { position: static; margin-left: 2px; }
  .fab { width: var(--tap); height: var(--tap); margin-top: 0; }
  .fab .ic { width: 24px; height: 24px; }
  .toast { bottom: calc(var(--tabbar-h) + var(--safe-b) + 8px); }
  .flashcard { min-height: 0; font-size: 1.15rem; padding: 16px 18px; }
  .sheet { left: 0; right: 0; top: auto; bottom: 0; width: auto; height: auto; max-height: 100dvh; max-width: none; border-radius: 0; padding-top: calc(8px + var(--safe-t)); }
  .sheet-grip { top: calc(-8px - var(--safe-t)); margin-top: calc(-8px - var(--safe-t)); height: 24px; }
}

/* ================================================================== WALL MODE
   A mounted tablet: read from across the room, nothing to hunt for.
   --u is the base size. It scales with the screen (the rem term keeps it honouring the user's text size)
   and is capped by height so short landscape screens do not overflow. */
body.wall { padding: 0; overflow: hidden; height: 100dvh; }
body.wall .topbar, body.wall .tabbar { display: none; }
body.wall main { max-width: none; padding: 0; height: 100dvh; margin: 0; }
.wall-root {
  --u: clamp(15px, min(.55rem + 1.05vw, .5rem + 2vh), 30px);
  font-size: var(--u); height: 100dvh; display: grid; grid-template-columns: minmax(0, 1fr); grid-template-rows: auto minmax(0, 1fr); gap: calc(var(--u) * .8);
  padding: calc(var(--u) * 1 + var(--safe-t)) calc(var(--u) * 1.2 + var(--safe-r)) calc(var(--u) * .9 + var(--safe-b)) calc(var(--u) * 1.2 + var(--safe-l));
  background: var(--bg); overflow-wrap: anywhere; min-width: 0;
}
.wall-head { display: flex; align-items: center; flex-wrap: wrap; gap: calc(var(--u) * .4) calc(var(--u) * 1.2); min-width: 0; }
.wall-head > div { min-width: 0; }
.wall-date { font-size: 2em; font-weight: 700; line-height: 1.1; }
.wall-clock { font-size: 2em; font-weight: 300; color: var(--muted); white-space: nowrap; }
.wall-head .stat-row { margin: 0 0 0 auto; min-width: 0; justify-content: flex-end; }
.wall-head .stat { font-size: 1em; padding: .35em .8em; }
.wall-head .stat b { font-size: 1.35em; }
.wall-exit { border: 0; background: transparent; color: var(--muted); width: max(2.4em, var(--tap)); height: max(2.4em, var(--tap)); border-radius: 50%; display: grid; place-items: center; flex: 0 0 auto; }
.wall-exit .ic { width: 1.2em; height: 1.2em; }
.wall-grid { display: grid; grid-template-columns: minmax(12em, 1fr) minmax(0, 2.4fr); gap: calc(var(--u) * .9); min-height: 0; min-width: 0; }
/* Each column is a size container: items adapt to the column, not the screen. It scrolls rather than clips. */
.wall-col {
  container-type: inline-size; background: var(--surface); border-radius: 1em; box-shadow: var(--shadow); padding: .9em 1em; min-height: 0; min-width: 0;
  overflow-x: hidden; overflow-y: auto; overscroll-behavior: contain; scrollbar-width: thin; display: flex; flex-direction: column; gap: .5em;
}
.wall-col > * { flex: 0 0 auto; min-width: 0; }
.wall-col h3 { margin: 0; font-size: .8em; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); }
.wall-people { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 14em), 1fr)); grid-auto-rows: minmax(0, 1fr); gap: calc(var(--u) * .9); min-height: 0; min-width: 0; }
.wall-person { border-top: .3em solid var(--c); }
.wall-person-head { display: flex; align-items: center; gap: .6em; min-width: 0; }
.wall-person-head .avatar { width: 2.1em; height: 2.1em; font-size: 1em; }
.wall-person-head .name { flex: 1; min-width: 0; font-weight: 700; font-size: 1.25em; line-height: 1.15; display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2; line-clamp: 2; overflow: hidden; }
.wall-person-head .n { flex: 0 0 auto; margin-left: auto; color: var(--muted); font-size: .95em; white-space: nowrap; }
.wall-item { display: flex; align-items: center; gap: .6em; padding: .45em 0; border-bottom: 1px solid var(--line); min-height: max(3em, 48px); min-width: 0; }
.wall-item:last-child { border-bottom: 0; }
.wall-item .t { flex: 1; min-width: 0; font-size: 1.05em; font-weight: 600; line-height: 1.25; overflow-wrap: anywhere; }
.wall-item .tt { display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2; line-clamp: 2; overflow: hidden; }
.wall-item .s { display: block; font-size: .78em; font-weight: 400; color: var(--muted); overflow-wrap: anywhere; }
.wall-item .s.bad { color: var(--danger); font-weight: 700; }
.wall-tick { flex: 0 0 auto; width: max(2.6em, var(--tap)); height: max(2.6em, var(--tap)); border-radius: 50%; border: .13em solid var(--c, var(--brand)); background: transparent; color: var(--c, var(--brand)); display: grid; place-items: center; }
.wall-tick .ic { width: 1.3em; height: 1.3em; }
.wall-tick:active { background: var(--c, var(--brand)); color: #fff; }
.wall-line { display: flex; gap: .8em; align-items: baseline; padding: .4em 0; border-bottom: 1px solid var(--line); font-size: 1.05em; min-width: 0; }
.wall-line:last-child { border-bottom: 0; }
.wall-line .w { flex: 0 0 auto; min-width: 4.6em; color: var(--muted); font-size: .9em; }
.wall-line > span:last-child { flex: 1; min-width: 0; overflow-wrap: anywhere; display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 3; line-clamp: 3; overflow: hidden; }
.wall-line.bad .w, .wall-line.bad { color: var(--danger); }
.wall-line.bad .w { font-weight: 700; }
.wall-more { color: var(--muted); font-size: .85em; padding-top: .3em; }
.wall-wait { grid-column: 1 / -1; display: flex; gap: .5em 1.2em; flex-wrap: wrap; align-items: baseline; padding: .6em 1em; background: var(--warn-soft); border-radius: 1em; font-size: .95em; min-width: 0; max-height: 7em; overflow-y: auto; }
.wall-wait > * { min-width: 0; max-width: 100%; overflow-wrap: anywhere; }
.wall-done-all { display: grid; place-items: center; text-align: center; color: var(--muted); font-size: 1.3em; height: 100%; }
.wall-empty { color: var(--muted); font-size: .95em; padding: .4em 0; }
/* wall: everything is a tap target */
.wall-item { cursor: pointer; }
.wall-open, .wall-line, .wall-wait-item { border: 0; background: none; color: inherit; font: inherit; text-align: left; padding: 0; cursor: pointer; }
.wall-open { min-height: max(2.6em, var(--tap)); display: flex; flex-direction: column; justify-content: center; }
.wall-item .t.wall-open { font-size: 1.05em; }
.wall-line { width: 100%; min-height: var(--tap); padding: .4em 0; border-bottom: 1px solid var(--line); }
.wall-wait-item { min-height: var(--tap); text-decoration: underline; text-decoration-color: color-mix(in srgb, currentColor 35%, transparent); text-underline-offset: .2em; }
.wall-col h3.wall-sub { margin-top: .8em; }
.wall-dinners { display: grid; gap: .4em; }
.wall-night { display: flex; flex-wrap: wrap; align-items: baseline; gap: .2em .6em; width: 100%; min-height: max(2.6em, 48px); padding: .4em .7em; border: .1em solid var(--line); border-radius: .7em;
  background: var(--surface); color: inherit; font: inherit; text-align: left; cursor: pointer; min-width: 0; }
.wall-night.proposed { border-style: dashed; border-width: .12em; border-color: color-mix(in srgb, var(--accent) 75%, transparent); }
.wall-night .w { flex: 0 0 auto; min-width: 4.2em; color: var(--muted); font-size: .9em; }
.wall-night .what { flex: 1 1 8em; min-width: 0; font-weight: 600; overflow-wrap: anywhere; display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2; line-clamp: 2; overflow: hidden; }
.wall-night .tag { margin: 0; font-size: .75em; }
.wall-dinner-ctl { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: .4em; color: var(--muted); font-size: .9em; min-width: 0; }
.wall-dinner-ctl > span { min-width: 0; }
.wall-pill { flex: 0 0 auto; min-height: var(--tap); padding: 0 1em; border-radius: 999px; border: 0; background: var(--brand); color: var(--brand-ink); font: inherit; font-weight: 700; max-width: 100%; overflow-wrap: anywhere; }
.wall-tile { display: flex; align-items: center; gap: .6em; width: 100%; min-height: max(2.6em, 48px); padding: .5em .8em; border: 0; border-radius: .8em; background: var(--brand-soft); color: inherit; font: inherit; font-weight: 600; text-align: left; cursor: pointer; margin-top: .4em; min-width: 0; }
.wall-tile > span { min-width: 0; overflow-wrap: anywhere; }
.wall-tile .ic { width: 1.2em; height: 1.2em; }
.wall-tidied { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: .4em; padding: .2em .2em .2em .7em; background: var(--surface-2); border-radius: .8em; font-size: .9em; color: var(--muted); min-width: 0; }
.wall-tidied > span { display: inline-flex; align-items: center; gap: .4em; min-width: 0; }
.wall-tidied .ic { width: 1.1em; height: 1.1em; }
.wall-tidied .wall-pill { background: transparent; color: var(--brand); }
/* narrow columns: drop the secondary line, tighten the rest, never overflow */
@container (max-width: 13em) {
  .wall-line .w { min-width: 3.6em; }
  .wall-person-head .n { display: none; }
}
/* only in a really narrow column does the status line (Overdue, Today, step) give way */
@container (max-width: 9em) {
  .wall-item .s { display: none; }
}
@container (max-width: 11em) {
  .wall-item { gap: .4em; }
  .wall-line { flex-direction: column; gap: 0; }
}
/* portrait or a narrow screen: one scrolling page instead of fixed columns */
@media (max-width: 700px) and (min-height: 501px), (orientation: portrait) {
  .wall-root { --u: clamp(16px, .55rem + 1.6vw, 28px); }
  body.wall { overflow: auto; height: auto; }
  body.wall main { height: auto; }
  .wall-root { height: auto; min-height: 100dvh; grid-template-rows: none; grid-auto-rows: auto; }
  .wall-grid { grid-template-columns: minmax(0, 1fr); }
  .wall-people { grid-auto-rows: auto; }
  .wall-col { overflow: visible; }
  .wall-head .stat-row { margin-left: 0; width: 100%; justify-content: flex-start; }
}
/* phone on its side: keep the columns, but scroll the people sideways instead of squashing them */
@media (orientation: landscape) and (max-height: 500px) {
  .wall-root { --u: clamp(13px, .45rem + 2.2vh, 17px); gap: calc(var(--u) * .5); padding-top: calc(var(--u) * .5 + var(--safe-t)); padding-bottom: calc(var(--u) * .5 + var(--safe-b)); }
  .wall-date, .wall-clock { font-size: 1.5em; }
  .wall-head { gap: calc(var(--u) * .3) calc(var(--u) * .9); }
  .wall-grid { grid-template-columns: minmax(11em, 26vw) minmax(0, 1fr); }
  .wall-people {
    grid-template-columns: none; grid-auto-flow: column; grid-auto-columns: minmax(15em, 42vw); grid-auto-rows: 100%;
    overflow-x: auto; overflow-y: hidden; scroll-snap-type: x mandatory; overscroll-behavior-x: contain; padding-bottom: 2px;
  }
  .wall-person { scroll-snap-align: start; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; }
}

/* ---- Counts and lines that open what's behind them */
button.stat { border: 0; font: inherit; cursor: pointer; }
button.stat:active { transform: scale(.97); }
button.digest-line { display: flex; justify-content: space-between; align-items: center; gap: 8px; width: 100%; min-height: var(--tap); padding: 4px 0; background: none; border: 0; color: inherit; font: inherit; text-align: left; cursor: pointer; }
button.digest-line + button.digest-line { border-top: 1px solid var(--line, rgba(127,127,127,.15)); }
button.digest-line .go { flex: 0 0 auto; color: var(--muted); }
.link-text { display: block; width: 100%; background: none; border: 0; padding: 0; margin: 6px 0 10px; color: inherit; font: inherit; text-align: left; text-decoration: underline; text-decoration-color: var(--muted); text-underline-offset: 3px; cursor: pointer; }
.ledger-grid .link { min-height: 0; padding: 0; text-align: left; font-weight: 400; color: var(--brand); text-decoration: underline; text-underline-offset: 3px; }
.ledger-grid .link.num { font-weight: 700; text-align: right; }
button.ledger-card { display: block; width: 100%; text-align: left; font: inherit; color: inherit; border: 0; cursor: pointer; }
.area-row .area-name { flex: 1; min-width: 0; background: none; border: 0; padding: 6px 0; color: inherit; font: inherit; text-align: left; overflow-wrap: anywhere; cursor: pointer; }
.tag.muted-tag { opacity: .7; }
.trolley-h { display: flex; align-items: center; justify-content: space-between; }
.trolley-h .link { min-height: 0; padding: 2px 4px; font-size: .8rem; letter-spacing: 0; text-transform: none; }
.pb-row + .pb-row { border-top: 1px solid var(--line, rgba(127,127,127,.15)); }
.pb-runs { margin: 0 0 8px 34px; }
button.wall-person-head { width: 100%; background: none; border: 0; padding: 0; color: inherit; font: inherit; text-align: left; cursor: pointer; }
button.wall-more { background: none; border: 0; font: inherit; cursor: pointer; text-decoration: underline; }
.macro-sugg { min-height: 0; padding: 0 2px; display: inline; }

/* ---- Food: the week at a glance and school lunches */
.food-hint { margin: 8px 4px; }
.food-day { margin: 12px 0; }
.food-day.past { opacity: .5; }
.food-day-h { font-size: .85rem; font-weight: 700; color: var(--muted); margin: 0 4px 6px; text-transform: uppercase; letter-spacing: .03em; }
.food-line { display: grid; grid-template-columns: 1.8em minmax(0, 1fr) auto; align-items: center; gap: 8px; width: 100%; min-height: var(--tap); margin: 6px 0; padding: 10px 12px;
  text-align: left; font: inherit; color: inherit; background: var(--surface); border: 1.5px solid var(--line); border-radius: 14px; }
.food-line.proposed { border-style: dashed; border-color: color-mix(in srgb, var(--accent) 70%, transparent); }
.food-line .who { font-size: 1.15rem; text-align: center; }
.food-line .what { min-width: 0; overflow-wrap: anywhere; }
.food-line .tag { margin-left: 0; }
.lunch-who { display: block; font-weight: 700; margin-bottom: 4px; }
.lunch-chips { display: flex; flex-wrap: wrap; gap: 4px; }
.lunch-chip { font-size: .8rem; padding: 2px 8px; border-radius: 999px; background: var(--surface-2); max-width: 100%; overflow-wrap: anywhere; }
.lunch-chip.sip { background: color-mix(in srgb, var(--accent) 16%, var(--surface-2)); }
.lunch-chip.tuck { background: var(--warn-soft); }
.food-setup { margin-top: 12px; }
.food-setup p { margin: 4px 0 10px; }
.food-off { margin: 4px; }
.food-glance { display: block; margin-top: 12px; color: inherit; text-decoration: none; }
.glance-row { display: grid; grid-template-columns: 1.8em minmax(0, 1fr); gap: 8px; align-items: start; margin: 6px 0; overflow-wrap: anywhere; }
.glance-row .who { font-size: 1.15rem; text-align: center; }
.link-like { color: var(--brand); font-weight: 600; display: inline-flex; align-items: center; gap: 2px; }
.lunch-item { margin: 6px 0; }
.lunch-opts { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; padding: 8px 4px 4px; }
.lunch-opts .row { width: 100%; }
.lunch-opts .nf-row { width: 100%; }
.danger-link { color: var(--danger); }
.stepper { display: grid; grid-template-columns: minmax(0, 1fr) auto 2.2em auto; align-items: center; gap: 6px; margin: 4px 0; }
.stepper b { text-align: center; }
.lunch-food-form { margin: 8px 0; width: 100%; }
.tag.qty { margin: 0 6px 0 0; font-weight: 700; color: var(--text); }

/* ---- Search: "did we already add it?" */
.search-scope { margin: 6px 2px 4px; }
.search-sum { margin: 10px 2px 0; }
.search-hit { margin: 6px 0; }
.search-hit span { min-width: 0; overflow-wrap: anywhere; }
.search-hit.closed strong { color: var(--muted); }
#search-add { margin-top: 8px; }
#search-q { width: 100%; box-sizing: border-box; }
