/* Hallmark · genre: playful→editorial · macrostructure: Workbench (native app shell) · design-system: DESIGN.md · designed-as-app
 * shell: top app bar + large collapsing title · bottom navigation bar (phone) / navigation rail (≥ 60rem)
 * patterns: inset grouped lists · drill-down settings · bottom sheet with grabber · snackbar
 * platform: Material 3 by default, Apple HIG under .plat-ios (tab bar, back chevron, switches, sheet grabber)
 * motion: state layers (opacity), page fade/slide ≤ 200ms, sheet rise/drag, all transform/opacity, reduced-motion safe
 * Hallmark · pre-emit critique: P5 H5 E4 S5 R5 V4
 */

/* ── base ───────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; }
html, body { overflow-x: clip; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; scroll-padding-top: calc(var(--appbar-h) + var(--sat) + var(--space-md)); }
body {
  margin: 0;
  min-height: 100dvh;
  background: var(--color-paper);
  color: var(--color-ink-2);
  font-family: var(--font-body);
  font-size: var(--text-base);
  line-height: var(--lh-normal);
  font-variant-numeric: tabular-nums;
  -webkit-font-smoothing: antialiased;
  padding-bottom: calc(var(--navbar-h) + var(--sab));
  padding-left: var(--sal); padding-right: var(--sar);
}

h1, h2, h3, h4 {
  font-family: var(--font-display);
  font-weight: 400;
  font-style: normal;
  color: var(--color-ink);
  line-height: var(--lh-tight);
  margin: 0;
  overflow-wrap: anywhere;
  min-width: 0;
  text-wrap: balance;
}
h1 { font-size: var(--text-title); }
h2 { font-size: var(--text-lg); }
h3 { font-size: var(--text-md); }
p { margin: 0; max-width: var(--measure); text-wrap: pretty; }
a { color: var(--color-accent); text-underline-offset: 0.2em; }
ul, ol { margin: 0; padding: 0; }
button, input, select, textarea { font: inherit; color: inherit; }
img, svg { display: block; max-width: 100%; }
[hidden] { display: none !important; }

:focus-visible { outline: 2px solid var(--color-focus); outline-offset: 2px; }
h1[tabindex="-1"]:focus, main:focus { outline: none; }

.visually-hidden {
  position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}
.muted { color: var(--color-muted); }
.small { font-size: var(--text-sm); }
.mono { font-family: var(--font-mono); font-size: 0.92em; }
.nowrap { white-space: nowrap; }
.stack > * + * { margin-top: var(--space-md); }
.stack-sm > * + * { margin-top: var(--space-xs); }
.stack-lg > * + * { margin-top: var(--space-xl); }
.row { display: flex; align-items: center; gap: var(--space-xs); flex-wrap: wrap; }
.row--between { justify-content: space-between; }
.grow { flex: 1 1 auto; min-width: 0; }

.skip {
  position: absolute; left: var(--space-md); top: -3rem; z-index: var(--z-toast);
  background: var(--color-ink); color: var(--color-paper); padding: var(--space-xs) var(--space-md);
  border-radius: var(--radius-input);
}
.skip:focus { top: calc(var(--sat) + var(--space-md)); }

/* phone app: controls are not text, and the grey tap flash is replaced by state layers */
.is-native body { -webkit-tap-highlight-color: transparent; }
.is-native .tab, .is-native .btn, .is-native .iconbtn, .is-native .li__main, .is-native .chip,
.is-native .fchip, .is-native .seg, .is-native .ds__d, .is-native .rrow, .is-native .appbar { -webkit-user-select: none; user-select: none; }
html:not(.is-native) body { -webkit-tap-highlight-color: transparent; }

/* ── state layer: one press/hover treatment for every tappable surface (M3) ── */
.tab__ic, .btn, .iconbtn, .li__main, .ds__d, .rrow, .fchip span, .seg a, .seg__opt span, .linkrow, .check, .toggle, .mcell, .mlist a, .wday__date, .cal__dh, .famhead {
  position: relative; isolation: isolate;
}
.tab__ic::before, .btn::before, .iconbtn::before, .li__main::before, .ds__d::before, .rrow::before, .fchip span::before, .seg a::before, .seg__opt span::before, .linkrow::before, .check::before, .toggle::before, .mcell::before, .mlist a::before, .wday__date::before, .cal__dh::before, .famhead::before {
  content: ""; position: absolute; inset: 0; border-radius: inherit; background: currentColor;
  opacity: 0; pointer-events: none; z-index: -1;
  transition: opacity var(--dur-micro) var(--ease-out);
}
@media (hover: hover) {
  .tab:hover .tab__ic::before, .btn:hover::before, .iconbtn:hover::before, .li__main:hover::before, .ds__d:hover::before, .rrow:hover::before, .fchip:hover span::before, .seg a:hover::before, .seg__opt:hover span::before, .linkrow:hover::before, .check:hover::before, .toggle:hover::before, .mcell:hover::before, .mlist a:hover::before, .wday__date:hover::before, .cal__dh:hover::before, .famhead:hover::before { opacity: 0.06; }
}
.tab:active .tab__ic::before, .btn:active::before, .iconbtn:active::before, .li__main:active::before, .ds__d:active::before, .rrow:active::before, .fchip:active span::before, .seg a:active::before, .seg__opt:active span::before, .linkrow:active::before, .check:active::before, .toggle:active::before, .mcell:active::before, .mlist a:active::before, .wday__date:active::before, .cal__dh:active::before, .famhead:active::before { opacity: 0.12; }

/* ── top app bar ────────────────────────────────── */
.appbar {
  position: sticky; top: 0; z-index: var(--z-nav); isolation: isolate;
  padding-top: var(--sat);
  background: var(--color-paper);
}
/* when the large title has scrolled away: container tint + hairline (an opacity layer), small title fades in */
.appbar::after {
  content: ""; position: absolute; inset: 0; z-index: -1; pointer-events: none;
  background: var(--color-paper-2); box-shadow: 0 var(--rule) 0 var(--color-rule);
  opacity: 0; transition: opacity var(--dur-short) var(--ease-out);
}
.appbar--scrolled::after { opacity: 1; }
.appbar__row {
  max-width: 76rem; margin: 0 auto; height: var(--appbar-h);
  display: grid; grid-template-columns: auto minmax(0, 1fr) auto; align-items: center; gap: var(--space-2xs);
  padding: 0 var(--space-2xs);
}
.appbar__lead, .appbar__acts { display: flex; align-items: center; min-width: 0; }
.appbar__lead:empty { width: var(--space-sm); }
.appbar__acts { justify-content: flex-end; gap: 2px; }
.appbar__title {
  font-family: var(--font-body); font-weight: 600; font-size: var(--text-md); color: var(--color-ink);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0;
  opacity: 0; transform: translateY(4px);
  transition: opacity var(--dur-short) var(--ease-out), transform var(--dur-short) var(--ease-out);
}
.appbar--scrolled .appbar__title, .appbar--always .appbar__title { opacity: 1; transform: none; }

/* icon buttons: 48 × 48 target, 40 × 40 visible state layer */
.iconbtn {
  appearance: none; border: 0; background: transparent; color: var(--color-ink-2); cursor: pointer;
  width: var(--touch); height: var(--touch); padding: 0; margin: 0; flex: none;
  display: inline-grid; place-items: center; border-radius: 50%; text-decoration: none;
}
.iconbtn svg { width: 1.5rem; height: 1.5rem; }
.iconbtn::before { inset: 4px; }
.iconbtn[aria-disabled="true"], .iconbtn:disabled { color: var(--color-rule-2); cursor: default; pointer-events: none; }
.iconbtn--date { overflow: hidden; }
.iconbtn--date input {
  position: absolute; inset: 0; width: 100%; height: 100%; opacity: 0; margin: 0; border: 0; padding: 0;
  font-size: 16px; cursor: pointer; z-index: 1;
}
.iconbtn--date:focus-within { outline: 2px solid var(--color-focus); outline-offset: -2px; }
.textbtn {
  appearance: none; border: 0; background: transparent; cursor: pointer; text-decoration: none;
  min-height: var(--touch); padding: 0 var(--space-sm); border-radius: var(--radius-pill);
  display: inline-flex; align-items: center; gap: var(--space-2xs);
  color: var(--color-accent); font-weight: 600; font-size: var(--text-sm); white-space: nowrap;
  position: relative; isolation: isolate;
}
.textbtn::before { content: ""; position: absolute; inset: 4px 0; border-radius: var(--radius-pill); background: currentColor; opacity: 0; z-index: -1; transition: opacity var(--dur-micro) var(--ease-out); }
.textbtn:active::before { opacity: 0.12; }
@media (hover: hover) { .textbtn:hover::before { opacity: 0.08; } }
.backbtn { color: var(--color-ink); }

/* ── large title ────────────────────────────────── */
.lt { display: flex; align-items: flex-end; gap: var(--space-xs); padding: var(--space-2xs) 0 var(--space-md); min-width: 0; }
.lt__text { flex: 1 1 auto; min-width: 0; display: grid; gap: var(--space-3xs); }
.lt__t { font-size: var(--text-title); line-height: 1.08; }
.lt__s { color: var(--color-muted); font-size: var(--text-sm); font-weight: 500; }
.lt__acts { display: flex; flex: none; margin-right: calc(-1 * var(--space-2xs)); }

/* ── bottom navigation bar (M3) ─────────────────── */
.tabs { display: flex; }
.tab {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: var(--space-2xs);
  color: var(--color-neutral); text-decoration: none; white-space: nowrap;
  font-size: var(--text-xs); font-weight: 600;
  min-width: 0; min-height: var(--touch);
}
.tab__ic {
  display: grid; place-items: center; width: 4rem; height: 2rem; border-radius: var(--radius-ind);
}
.tab__ic::after {
  content: ""; position: absolute; inset: 0; border-radius: inherit; background: var(--color-accent-wash); z-index: -2;
  opacity: 0; transform: scaleX(0.4); transition: opacity var(--dur-short) var(--ease-out), transform var(--dur-short) var(--ease-out);
}
.tab[aria-current="page"] .tab__ic::after { opacity: 1; transform: none; }
.tab__ic svg { width: 1.5rem; height: 1.5rem; }
.tab[aria-current="page"] { color: var(--color-ink); font-weight: 700; }
.tab[aria-current="page"] .tab__ic { color: var(--color-ink); }
.tab:focus-visible { outline: none; }
.tab:focus-visible .tab__ic { outline: 2px solid var(--color-focus); outline-offset: 2px; }

.tabbar {
  position: fixed; inset-inline: 0; bottom: 0; z-index: var(--z-nav);
  background: var(--color-paper-2);
  padding: 0 var(--sar) var(--sab) var(--sal);
}
.tabbar .tabs { height: var(--navbar-h); align-items: stretch; padding: var(--space-sm) var(--space-2xs) var(--space-md); }
.tabbar .tab { flex: 1 1 0; }

/* ── navigation rail (≥ 60rem) ──────────────────── */
.rail { display: none; }
@media (min-width: 60rem) {
  body { padding-bottom: 0; padding-left: calc(var(--rail-w) + var(--sal)); }
  .tabbar { display: none; }
  .rail {
    display: flex; flex-direction: column; align-items: center; gap: var(--space-xl);
    position: fixed; inset-block: 0; left: 0; z-index: var(--z-nav); width: calc(var(--rail-w) + var(--sal));
    padding: calc(var(--sat) + var(--space-md)) 0 var(--space-md) var(--sal);
    background: var(--color-paper-2);
  }
  .rail .tabs { flex-direction: column; gap: var(--space-md); }
  .rail__brand { display: grid; place-items: center; width: 3.5rem; height: 3.5rem; border-radius: var(--radius-card); text-decoration: none; background: var(--color-accent); color: var(--color-accent-ink); }
  .rail__mark { font-size: 1.6rem; line-height: 1; }
  .rail .tab { width: var(--rail-w); }
  .appbar__row { padding-inline: var(--space-md); }
}

/* ── page canvas + transitions ──────────────────── */
main { max-width: 76rem; margin: 0 auto; padding: 0 var(--space-md) var(--space-2xl); }
@media (min-width: 40rem) { main { padding-inline: var(--space-xl); } }

.view { animation-duration: var(--dur-page); animation-timing-function: var(--ease-out); animation-fill-mode: both; }
.view--fade { animation-name: v-fade; }
.view--push { animation-name: v-push; }
.view--pop { animation-name: v-pop; }
.view--next { animation-name: v-next; }
.view--prev { animation-name: v-prev; }
@keyframes v-fade { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
@keyframes v-push { from { opacity: 0; transform: translateX(32px); } to { opacity: 1; transform: none; } }
@keyframes v-pop  { from { opacity: 0; transform: translateX(-32px); } to { opacity: 1; transform: none; } }
@keyframes v-next { from { opacity: 0; transform: translateX(24px); } to { opacity: 1; transform: none; } }
@keyframes v-prev { from { opacity: 0; transform: translateX(-24px); } to { opacity: 1; transform: none; } }

/* ── buttons ────────────────────────────────────── */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: var(--space-xs);
  min-height: 2.5rem; padding: 0 var(--space-lg);
  border-radius: var(--radius-pill);
  border: var(--rule) solid var(--color-rule-2);
  background: transparent; color: var(--color-accent);
  font-weight: 600; font-size: var(--text-sm); white-space: nowrap; cursor: pointer; text-decoration: none;
}
.btn::after { content: ""; position: absolute; inset: -4px 0; } /* 48px target on a 40px button */
.btn svg { width: 1.125rem; height: 1.125rem; flex: none; }
.btn:disabled, .btn[aria-disabled="true"] { opacity: 0.5; cursor: not-allowed; }
.btn--primary { background: var(--color-accent); border-color: var(--color-accent); color: var(--color-accent-ink); }
.btn--ghost { border-color: transparent; padding-inline: var(--space-sm); }
.btn--block { width: 100%; }
.btn--sm { min-height: 2.25rem; padding: 0 var(--space-md); }
.btn--danger { color: var(--color-danger); }
.btn--destructive { background: var(--color-danger); border-color: var(--color-danger); color: var(--color-accent-ink); }

/* ── segmented control (M3 segmented buttons · iOS segmented control) ── */
.seg {
  display: flex; width: 100%; max-width: 32rem; padding: 0; gap: 0;
  border: var(--rule) solid var(--color-rule-2); border-radius: var(--radius-pill); overflow: hidden;
}
.seg a, .seg__opt { flex: 1 1 0; min-width: 0; position: relative; }
.seg a + a, .seg__opt + .seg__opt { border-left: var(--rule) solid var(--color-rule-2); }
.seg__opt input { position: absolute; opacity: 0; inset: 0; margin: 0; cursor: pointer; z-index: 1; }
.seg a, .seg__opt span {
  display: flex; align-items: center; justify-content: center; gap: var(--space-2xs); min-height: var(--touch); padding: 0 var(--space-xs);
  font-weight: 600; font-size: var(--text-sm); white-space: nowrap; color: var(--color-ink-2); text-decoration: none;
  overflow: hidden; text-overflow: ellipsis;
}
.seg a[aria-current="page"], .seg__opt input:checked + span { background: var(--color-accent-wash); color: var(--color-ink); }
.seg a[aria-current="page"]::after, .seg__opt input:checked + span::after {
  content: ""; width: 0.55rem; height: 0.3rem; margin-left: 2px; flex: none;
  border-left: 2px solid currentColor; border-bottom: 2px solid currentColor; transform: translateY(-2px) rotate(-45deg);
}
.seg__opt input:focus-visible + span { outline: 2px solid var(--color-focus); outline-offset: -3px; }
.seg--sm { max-width: 20rem; }
.toolbar { display: grid; gap: var(--space-sm); margin-bottom: var(--space-md); }

/* ── chips ──────────────────────────────────────── */
.chip {
  display: inline-flex; align-items: center; gap: 0.3em;
  padding: 0.125rem 0.5rem; border-radius: var(--radius-input);
  font-size: var(--text-xs); font-weight: 600; white-space: nowrap;
  background: var(--color-fill); color: var(--color-neutral);
}
.chip--green { background: var(--color-accent-wash); color: var(--color-ink); }
.chip--clay { background: var(--color-clay-wash); color: var(--color-ink); }
.chip--warn { background: var(--color-warn-wash); color: var(--color-ink); }
.chip--freeze { background: var(--ev-dinner); color: var(--ev-ink); }
.chip svg { width: 0.9em; height: 0.9em; }
.chips { display: flex; gap: var(--space-2xs); flex-wrap: wrap; align-items: center; }

/* filter chips: one swipeable line on phones */
.chipscroll {
  display: flex; gap: var(--space-xs); overflow-x: auto; scrollbar-width: none;
  margin-inline: calc(-1 * var(--space-md)); padding: var(--space-3xs) var(--space-md);
  scroll-padding-inline: var(--space-md); overscroll-behavior-x: contain;
}
.chipscroll::-webkit-scrollbar { display: none; }
@media (min-width: 40rem) { .chipscroll { margin-inline: 0; padding-inline: 0; flex-wrap: wrap; overflow: visible; } }
.chipset { display: flex; gap: var(--space-xs); flex-wrap: wrap; }
.fchip { position: relative; flex: none; }
.fchip input { position: absolute; opacity: 0; inset: 0; margin: 0; cursor: pointer; z-index: 1; }
.fchip span {
  display: inline-flex; align-items: center; gap: 0.35rem; min-height: 2rem; padding: 0 var(--space-sm); border-radius: var(--radius-input);
  border: var(--rule) solid var(--color-rule-2); background: transparent; font-size: var(--text-sm); font-weight: 600; white-space: nowrap; color: var(--color-ink-2);
}
.fchip::after { content: ""; position: absolute; inset: -8px 0; } /* 48px tall target */
.fchip input:checked + span { background: var(--color-accent-wash); border-color: transparent; color: var(--color-ink); }
.fchip input:checked + span::before { opacity: 0; }
.fchip input:checked + span > i {
  display: inline-block; width: 0.55rem; height: 0.3rem; border-left: 2px solid currentColor; border-bottom: 2px solid currentColor;
  transform: translateY(-2px) rotate(-45deg);
}
.fchip span > i { display: none; }
.fchip input:focus-visible + span { outline: 2px solid var(--color-focus); outline-offset: 2px; }

/* ── grouped lists (M3 lists in a container · iOS inset grouped) ── */
.group { min-width: 0; }
.group + .group, .group + .note, .note + .group { margin-top: var(--space-lg); }
.group__head { display: flex; align-items: baseline; justify-content: space-between; gap: var(--space-sm); padding: 0 var(--space-2xs) var(--space-xs); flex-wrap: wrap; }
.group__title { font-family: var(--font-body); font-size: var(--text-sm); font-weight: 700; color: var(--color-ink); }
.group__title--lg { font-family: var(--font-display); font-weight: 400; font-size: var(--text-lg); }
.group__meta { font-size: var(--text-sm); color: var(--color-muted); min-width: 0; }
.group__body { background: var(--color-surface); border-radius: var(--radius-group); overflow: hidden; }
.group__body > * + * { border-top: var(--rule) solid var(--color-rule); }
.group__body :focus-visible, .rlist :focus-visible, .mlist :focus-visible, .wday :focus-visible, .kit__card :focus-visible { outline-offset: -3px; }
.group__foot { font-size: var(--text-sm); color: var(--color-muted); padding: var(--space-xs) var(--space-2xs) 0; }
.group__pad { padding: var(--space-md); }

/* list row: whole row is the target; optional trailing action sits beside it */
.li { display: flex; align-items: stretch; min-width: 0; }
.li__main {
  appearance: none; border: 0; background: transparent; margin: 0; cursor: pointer; text-align: left; text-decoration: none; color: inherit;
  flex: 1 1 auto; min-width: 0; min-height: var(--row-h);
  display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; gap: var(--space-sm);
  padding: var(--space-sm) var(--space-md);
}
.li__main--lead { grid-template-columns: auto minmax(0, 1fr) auto; }
.li__text { display: grid; gap: 2px; min-width: 0; }
.li__over { font-size: var(--text-xs); font-weight: 700; color: var(--color-muted); }
.li__title { font-weight: 600; font-size: var(--text-base); color: var(--color-ink); line-height: var(--lh-snug); overflow-wrap: anywhere; }
.li__sub { font-size: var(--text-sm); color: var(--color-muted); line-height: 1.4; overflow-wrap: anywhere; }
.li__meta { display: flex; gap: var(--space-2xs); flex-wrap: wrap; margin-top: var(--space-3xs); }
.li__chev { width: 1.25rem; height: 1.25rem; color: var(--color-rule-2); }
.li__act { align-self: center; margin-right: var(--space-2xs); color: var(--color-accent); }
.li__lead {
  display: grid; place-items: center; width: 2.5rem; height: 2.5rem; border-radius: 50%; flex: none;
  background: var(--color-accent-wash); color: var(--color-ink); font-weight: 700; font-size: var(--text-sm);
}
.li__lead svg { width: 1.25rem; height: 1.25rem; }
.li__lead--clay { background: var(--color-clay-wash); }
.li__lead--warn { background: var(--color-warn-wash); }
.li__lead--dusk { background: var(--ev-dinner); color: var(--ev-ink); }
.li__lead--plum { background: var(--ev-prep); color: var(--ev-ink); }
.li__lead--sky { background: var(--ev-shop); color: var(--ev-ink); }
.li-note { padding: var(--space-sm) var(--space-md); font-size: var(--text-sm); color: var(--color-ink-2); line-height: 1.55; }
.li-note > .chip { margin-right: var(--space-2xs); vertical-align: 0.05em; }
.li-foot { padding: var(--space-xs) var(--space-md) var(--space-sm); font-size: var(--text-sm); color: var(--color-muted); }
.linkrow { /* a row that navigates or acts, centred label (iOS action rows) */
  appearance: none; border: 0; background: transparent; width: 100%; cursor: pointer; text-decoration: none;
  min-height: var(--row-h); padding: 0 var(--space-md); display: flex; align-items: center; gap: var(--space-sm);
  color: var(--color-accent); font-weight: 600; text-align: left;
}
.linkrow svg { width: 1.25rem; height: 1.25rem; flex: none; }
.linkrow--danger { color: var(--color-danger); }

/* notes, banners, hero */
.note { font-size: var(--text-sm); color: var(--color-muted); padding: 0 var(--space-2xs); }
.banner {
  background: var(--color-accent-wash); color: var(--color-ink); border-radius: var(--radius-group);
  padding: var(--space-md); display: grid; gap: var(--space-xs); margin-bottom: var(--space-lg);
}
.banner__t { font-weight: 700; font-family: var(--font-body); font-size: var(--text-base); color: var(--color-ink); }
.banner .row { margin-top: var(--space-2xs); }
.notice { color: var(--color-ink); background: var(--color-accent-wash); border-radius: var(--radius-input); padding: var(--space-xs) var(--space-sm); }

.hero {
  appearance: none; border: 0; width: 100%; text-align: left; cursor: pointer; color: var(--color-ink);
  display: grid; grid-template-columns: auto minmax(0, 1fr) auto; gap: var(--space-sm); align-items: center;
  padding: var(--space-md); border-radius: var(--radius-group); background: var(--ev-bg, var(--color-accent-wash));
  margin-bottom: var(--space-lg); position: relative; isolation: isolate;
}
.hero::before { content: ""; position: absolute; inset: 0; border-radius: inherit; background: currentColor; opacity: 0; z-index: -1; transition: opacity var(--dur-micro) var(--ease-out); }
.hero:active::before { opacity: 0.08; }
.hero__time { display: grid; place-items: center; min-width: 3.5rem; padding: var(--space-xs); border-radius: var(--radius-card); background: var(--color-surface); text-align: center; line-height: 1.1; }
.hero__h { font-family: var(--font-mono); font-size: var(--text-md); font-weight: 500; color: var(--color-ink); }
.hero__ap { font-size: var(--text-xs); color: var(--color-muted); font-weight: 600; }
.hero__over { font-size: var(--text-xs); font-weight: 700; text-transform: uppercase; color: var(--color-neutral); }
.hero__t { font-family: var(--font-display); font-size: var(--text-lg); line-height: var(--lh-snug); color: var(--color-ink); }
.hero__l { font-size: var(--text-sm); color: var(--color-ink-2); }
.hero { box-shadow: inset 0 0 0 2px var(--color-gold); }

/* Sadya: a kasavu border (gold double line) under every large title */
.lt { border-bottom: 6px double var(--color-gold); margin-bottom: var(--space-sm); }

/* each meal on Today wears its colour, the same key as the calendar */
.meal .group__title { display: inline-flex; align-items: center; gap: var(--space-xs); }
.meal .group__title::before { content: ""; width: 0.625rem; height: 0.625rem; border-radius: 50%; background: var(--ev-line); flex: none; }
.meal .group__body { background: var(--ev-bg); }
.meal .group__body > * + * { border-top-color: color-mix(in oklch, var(--ev-line) 25%, transparent); }
.meal .chip:not([class*="chip--"]) { background: color-mix(in oklch, var(--color-surface) 80%, transparent); }
.meal .chip--green { background: var(--color-surface); color: var(--color-accent); }
.li__lead--meal { background: var(--ev-bg); color: var(--ev-line); }

/* dish photos: a square thumbnail on rows, a 4:3 photo at the top of the recipe sheet */
.thumb { width: 3.5rem; height: 3.5rem; border-radius: var(--radius-card); object-fit: cover; flex: none; display: block; background: var(--color-fill); }
.thumb--none { display: grid; place-items: center; background: var(--ev-bg); color: var(--ev-line); }
.thumb--none svg { width: 1.5rem; height: 1.5rem; }
.meal .thumb--none { background: var(--color-surface); }
.rrow--photo { grid-template-columns: auto minmax(0, 1fr) auto; }
.sheet__photo { margin: 0 0 var(--space-md); }
.sheet__photo img { display: block; width: 100%; height: auto; aspect-ratio: 4 / 3; max-height: 16rem; object-fit: cover; border-radius: var(--radius-group); background: var(--color-fill); }
.sheet__photo figcaption { font-size: var(--text-xs); color: var(--color-muted); margin-top: var(--space-2xs); }
.sheet__photo figcaption a { color: inherit; }

/* ── Kitchen display (#/kitchen): today on a big screen such as the fridge ── */
/* text grows with the screen's shorter side, so a 1080px-wide fridge reads from across the kitchen */
html.kd-mode { font-size: clamp(16px, 8px + 1.3vmin, 28px); }
.kd__clock { font-family: var(--font-mono); font-size: var(--text-xl); font-weight: 500; color: var(--color-ink-2); font-variant-numeric: tabular-nums; white-space: nowrap; }
.kd__ap { font-size: 0.55em; margin-left: 0.15em; color: var(--color-muted); }
.kd__grid { display: grid; gap: var(--space-lg); align-items: start; }
.kd__meals, .kd__side { display: grid; gap: var(--space-lg); align-items: start; grid-template-columns: repeat(auto-fill, minmax(min(100%, 19rem), 1fr)); }
.kd__meals > .group, .kd__side > .group { margin: 0; }
/* wide screens: meals on the left, tonight and the shop list in a column on the right */
@media (min-width: 60rem) and (min-aspect-ratio: 5/4) {
  .kd__grid { grid-template-columns: minmax(0, 2fr) minmax(0, 1fr); }
  .kd__side { grid-template-columns: minmax(0, 1fr); }
}
.search-hint { padding-inline: var(--space-2xs); color: var(--color-muted); }
/* recipe rows carry their meal colour as a stripe on the leading edge */
.rrow[class*="ev--"] { box-shadow: inset 4px 0 0 var(--ev-line); }

/* ── Today ──────────────────────────────────────── */
.ds { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 2px; margin: 0 calc(-1 * var(--space-2xs)) var(--space-md); }
.ds__d {
  display: grid; justify-items: center; gap: 2px; padding: var(--space-xs) 0; border-radius: var(--radius-card);
  text-decoration: none; color: var(--color-ink-2); min-height: 3.75rem; min-width: 0;
}
.ds__w { font-size: var(--text-xs); font-weight: 600; color: var(--color-muted); }
.ds__n { display: grid; place-items: center; width: 2.25rem; height: 2.25rem; border-radius: 50%; font-weight: 600; font-size: var(--text-base); color: var(--color-ink); }
.ds__d--today .ds__n { color: var(--color-accent); box-shadow: inset 0 0 0 1.5px var(--color-accent); }
.ds__d[aria-current="page"] .ds__n { background: var(--color-accent); color: var(--color-accent-ink); box-shadow: none; }
.ds__d--we .ds__w { color: var(--color-accent-2); }
.ds__d--off { opacity: 0.35; pointer-events: none; }
.ds__dot { width: 4px; height: 4px; border-radius: 50%; background: var(--color-warn); }
.ds__dot--none { background: transparent; }

.cooks { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--space-xs); margin-bottom: var(--space-lg); }
.cook { display: flex; align-items: center; gap: var(--space-xs); padding: var(--space-xs); padding-right: var(--space-sm); background: var(--color-surface); border-radius: var(--radius-pill); min-width: 0; }
.cook .li__lead { width: 2.25rem; height: 2.25rem; }
.cook__t { display: grid; min-width: 0; line-height: 1.25; }
.cook__k { font-size: var(--text-xs); color: var(--color-muted); font-weight: 600; }
.cook__n { font-size: var(--text-sm); font-weight: 700; color: var(--color-ink); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.day-layout { display: grid; gap: var(--space-lg); }
.day-layout > div > .group + .group { margin-top: var(--space-lg); }
@media (min-width: 60rem) {
  .day-layout { grid-template-columns: minmax(0, 1fr) minmax(0, 22rem); align-items: start; }
  .day-layout__side { position: sticky; top: calc(var(--appbar-h) + var(--sat) + var(--space-md)); }
}
.leftover-note { font-size: var(--text-sm); color: var(--color-ink-2); }

/* ── checklists (list rows with a leading checkbox) ── */
.checklist { list-style: none; display: grid; }
.checklist > li + li { border-top: var(--rule) solid var(--color-rule); }
.check { display: flex; gap: var(--space-md); align-items: flex-start; padding: var(--space-sm) var(--space-md); cursor: pointer; min-height: var(--row-h); }
.check input {
  appearance: none; flex: none; width: 1.375rem; height: 1.375rem; margin: 0.0625rem 0 0;
  border: 2px solid var(--color-neutral); border-radius: 5px; background: transparent;
  display: grid; place-content: center; cursor: pointer;
}
.check input::after {
  content: ""; width: 0.7rem; height: 0.38rem; border-left: 2px solid var(--color-accent-ink); border-bottom: 2px solid var(--color-accent-ink);
  transform: translateY(-1px) rotate(-45deg) scale(0.6); opacity: 0;
  transition: opacity var(--dur-micro) var(--ease-out), transform var(--dur-micro) var(--ease-out);
}
.check input:checked { background: var(--color-accent); border-color: var(--color-accent); }
.check input:checked::after { opacity: 1; transform: translateY(-1px) rotate(-45deg) scale(1); }
.check input:focus-visible { outline: 2px solid var(--color-focus); outline-offset: 3px; }
.check input:checked ~ .check__body .check__text { color: var(--color-muted); text-decoration: line-through; text-decoration-color: var(--color-rule-2); }
.check__body { min-width: 0; display: grid; gap: 2px; flex: 1; }
.check__text { color: var(--color-ink); }
.check__sub { font-size: var(--text-sm); color: var(--color-muted); }
.buy { display: flex; align-items: baseline; justify-content: space-between; gap: 0 var(--space-sm); flex-wrap: wrap; }
.buy .check__text { min-width: 0; }
.buy__amt { margin-left: auto; }
.buy__amt { font-family: var(--font-mono); color: var(--color-ink); white-space: nowrap; font-size: var(--text-sm); flex: none; }

/* ── week list ──────────────────────────────────── */
.week { display: grid; gap: var(--space-sm); }
.wday { display: grid; background: var(--color-surface); border-radius: var(--radius-group); overflow: hidden; }
.wday__head { display: flex; align-items: center; justify-content: space-between; gap: var(--space-sm); padding: var(--space-xs) var(--space-xs) var(--space-xs) var(--space-md); border-bottom: var(--rule) solid var(--color-rule); }
.wday--weekend .wday__head { background: var(--color-clay-wash); }
.wday__date { font-weight: 700; color: var(--color-ink); text-decoration: none; display: inline-flex; align-items: center; gap: var(--space-2xs); min-height: var(--touch); padding: 0 var(--space-xs); border-radius: var(--radius-pill); margin-left: calc(-1 * var(--space-xs)); }
.wday__date svg { width: 1rem; height: 1rem; color: var(--color-muted); }
.wday__grid { display: grid; }
.wday__grid > * + * { border-top: var(--rule) solid var(--color-rule); }
.wslot { display: grid; grid-template-columns: 6.5rem minmax(0, 1fr); gap: var(--space-xs); font-size: var(--text-sm); padding: var(--space-xs) var(--space-md); }
.wslot__k { color: var(--color-muted); font-weight: 600; }
.wslot__v { color: var(--color-ink-2); min-width: 0; }
@media (min-width: 60rem) {
  .wday__grid { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .wday__grid > * + * { border-top: 0; border-left: var(--rule) solid var(--color-rule); }
  .wslot { grid-template-columns: minmax(0, 1fr); gap: 2px; padding: var(--space-sm) var(--space-md); }
}
.week-layout { display: grid; gap: var(--space-xl); }
@media (min-width: 72rem) { .week-layout { grid-template-columns: minmax(0, 1fr) minmax(0, 24rem); align-items: start; } }
.uses { font-size: var(--text-sm); color: var(--color-muted); }

details.disclose > summary {
  list-style: none; cursor: pointer; min-height: var(--row-h); padding: 0 var(--space-md);
  display: flex; align-items: center; justify-content: space-between; gap: var(--space-sm);
  font-weight: 600; color: var(--color-ink);
}
details.disclose > summary::-webkit-details-marker { display: none; }
details.disclose > summary svg { width: 1.25rem; height: 1.25rem; color: var(--color-muted); transition: transform var(--dur-short) var(--ease-out); flex: none; }
details.disclose[open] > summary svg { transform: rotate(90deg); }
details.disclose > summary:focus-visible { outline: 2px solid var(--color-focus); outline-offset: -2px; }
.tiplist { list-style: none; display: grid; gap: var(--space-sm); }
.tiplist strong { color: var(--color-ink); display: block; }
details.disclose .tiplist { padding: 0 var(--space-md) var(--space-md); }

/* ── month ──────────────────────────────────────── */
.month { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 2px; }
.month__dow { font-size: var(--text-xs); font-weight: 600; color: var(--color-muted); padding: var(--space-2xs); text-align: center; }
.mcell {
  min-height: 5.5rem; background: var(--color-surface); border-radius: var(--radius-input);
  padding: var(--space-2xs) var(--space-xs); font-size: var(--text-xs); color: var(--color-ink-2); text-decoration: none;
  display: grid; align-content: start; gap: 2px; min-width: 0; overflow-wrap: anywhere;
}
.mcell--off { background: transparent; box-shadow: inset 0 0 0 1px var(--color-rule); }
.mcell--today { box-shadow: inset 0 0 0 2px var(--color-accent); }
.mcell__n { font-weight: 700; color: var(--color-ink); }
.mcell__d { display: none; }
@media (min-width: 48rem) { .mcell__d { display: block; } .mcell { min-height: 7rem; } }
.month { display: none; }
@media (min-width: 48rem) { .month { display: grid; } .mlist { display: none; } }
.mlist { list-style: none; display: grid; background: var(--color-surface); border-radius: var(--radius-group); overflow: hidden; }
.mlist li + li { border-top: var(--rule) solid var(--color-rule); }
.mlist a {
  display: grid; grid-template-columns: 4rem minmax(0, 1fr); gap: var(--space-sm); align-items: baseline;
  padding: var(--space-sm) var(--space-md); text-decoration: none; color: var(--color-ink-2); font-size: var(--text-sm); min-height: var(--touch);
}
.mlist__d { font-weight: 700; color: var(--color-ink); white-space: nowrap; }
.mlist__we .mlist__d { color: var(--color-accent-2); }
.mlist__today a { box-shadow: inset 3px 0 0 var(--color-accent); }

/* ── shop ───────────────────────────────────────── */
.progress-card { background: var(--color-surface); border-radius: var(--radius-group); padding: var(--space-md); display: grid; gap: var(--space-sm); margin-bottom: var(--space-lg); }
.progress-card__n { font-size: var(--text-xl); font-weight: 700; color: var(--color-ink); line-height: 1; }
.progress { height: 6px; background: var(--color-paper-3); border-radius: var(--radius-pill); overflow: hidden; }
.progress__bar { height: 100%; background: var(--color-accent); transform-origin: left; transition: transform var(--dur-short) var(--ease-out); }
.aisles { display: grid; gap: var(--space-lg); }
.aisles > .group + .group { margin-top: 0; }
@media (min-width: 60rem) { .aisles { grid-template-columns: repeat(2, minmax(0, 1fr)); align-items: start; } }

/* ── recipes ────────────────────────────────────── */
.searchbar {
  display: flex; align-items: center; gap: var(--space-xs); min-height: 3.5rem; padding: 0 var(--space-2xs) 0 var(--space-md);
  border-radius: var(--radius-pill); background: var(--color-fill); margin-bottom: var(--space-sm);
}
.searchbar svg { width: 1.375rem; height: 1.375rem; color: var(--color-neutral); flex: none; }
.searchbar input { flex: 1 1 auto; min-width: 0; border: 0; background: transparent; min-height: 3rem; font-size: var(--text-base); outline: none; }
.searchbar input::placeholder { color: var(--color-muted); }
.searchbar:focus-within { box-shadow: inset 0 0 0 2px var(--color-focus); }
.searchbar input::-webkit-search-cancel-button { -webkit-appearance: none; }
.filters { display: grid; gap: var(--space-xs); margin-bottom: var(--space-md); }
.rcount { font-size: var(--text-sm); color: var(--color-muted); padding: 0 var(--space-2xs) var(--space-xs); }
.rlist { background: var(--color-surface); border-radius: var(--radius-group); overflow: hidden; }
.rrow {
  appearance: none; border: 0; background: transparent; width: 100%; margin: 0; cursor: pointer; text-align: left; color: inherit;
  display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: var(--space-sm); align-items: center;
  padding: var(--space-sm) var(--space-md); min-height: var(--row-h);
}
.rrow + .rrow { border-top: var(--rule) solid var(--color-rule); }
.rrow--off { opacity: 0.6; }
@media (min-width: 48rem) {
  .rlist { display: grid; gap: var(--space-sm); grid-template-columns: repeat(auto-fill, minmax(min(100%, 18rem), 1fr)); background: none; border-radius: 0; overflow: visible; }
  .rrow { background: var(--color-surface); border-radius: var(--radius-group); align-items: start; padding: var(--space-md); }
  .rrow + .rrow { border-top: 0; }
}
.kit { display: grid; gap: var(--space-sm); grid-template-columns: repeat(auto-fill, minmax(min(100%, 18rem), 1fr)); }
.kit__card { background: var(--color-surface); border-radius: var(--radius-group); display: grid; align-content: start; overflow: hidden; }
.kit__body { padding: var(--space-md); display: grid; gap: var(--space-2xs); }
.kit__t { font-family: var(--font-body); font-size: var(--text-base); font-weight: 700; color: var(--color-ink); }
.kit__card details.disclose { border-top: var(--rule) solid var(--color-rule); }
.kit__card details.disclose > summary { font-size: var(--text-sm); color: var(--color-accent); min-height: var(--touch); }
.kit__list { list-style: none; padding: 0 var(--space-xs) var(--space-xs); display: grid; }
.kit__list button { appearance: none; border: 0; background: none; cursor: pointer; text-align: left; width: 100%; min-height: 2.75rem; padding: 0 var(--space-xs); border-radius: var(--radius-input); color: var(--color-ink); font-size: var(--text-sm); font-weight: 600; position: relative; isolation: isolate; }
.kit__list button::before { content: ""; position: absolute; inset: 0; border-radius: inherit; background: currentColor; opacity: 0; z-index: -1; transition: opacity var(--dur-micro) var(--ease-out); }
.kit__list button:active::before { opacity: 0.1; }

/* ── bottom sheet ───────────────────────────────── */
dialog.sheet {
  border: 0; padding: 0; margin: auto auto 0; width: 100%; max-width: 40rem; max-height: calc(94dvh - var(--sat));
  border-radius: var(--radius-sheet) var(--radius-sheet) 0 0;
  background: var(--color-surface); color: var(--color-ink-2); box-shadow: var(--shadow-sheet);
  overflow: hidden; display: none; flex-direction: column;
}
dialog.sheet[open] { display: flex; animation: sheet-in var(--dur-sheet) var(--ease-out); }
dialog.sheet::backdrop { background: var(--scrim); animation: scrim-in var(--dur-sheet) var(--ease-out); }
dialog.sheet.sheet--settled { animation: none; }
dialog.sheet.sheet--closing { animation: sheet-out var(--dur-page) var(--ease-in) forwards; }
dialog.sheet.sheet--closing::backdrop { animation: scrim-out var(--dur-page) var(--ease-in) forwards; }
@keyframes sheet-in { from { transform: translateY(100%); } to { transform: none; } }
@keyframes sheet-out { from { transform: translateY(var(--drag, 0px)); } to { transform: translateY(100%); } }
@keyframes scrim-in { from { opacity: 0; } to { opacity: 1; } }
@keyframes scrim-out { from { opacity: 1; } to { opacity: 0; } }
@media (min-width: 48rem) {
  dialog.sheet { margin: auto; border-radius: var(--radius-sheet); max-height: 88dvh; }
  .sheet__grab { visibility: hidden; height: var(--space-md); }
  @keyframes sheet-in { from { transform: translateY(24px); opacity: 0; } to { transform: none; opacity: 1; } }
  @keyframes sheet-out { from { opacity: 1; } to { transform: translateY(24px); opacity: 0; } }
}
.sheet__grab { flex: none; display: grid; place-items: center; height: 1.5rem; cursor: grab; touch-action: none; }
.sheet__grab span { width: 2rem; height: 0.25rem; border-radius: var(--radius-pill); background: var(--color-rule-2); opacity: 0.7; }
.sheet__scroll { overflow-y: auto; flex: 1 1 auto; min-height: 0; padding: 0 var(--space-md) calc(var(--space-xl) + var(--sab)); overscroll-behavior: contain; }
@media (min-width: 40rem) { .sheet__scroll { padding-inline: var(--space-xl); } }
.sheet__head {
  position: sticky; top: 0; z-index: 2; background: var(--color-surface);
  display: flex; align-items: flex-start; gap: var(--space-sm); padding: var(--space-2xs) 0 var(--space-sm);
  margin-inline: calc(-1 * var(--space-2xs)); padding-inline: var(--space-2xs); touch-action: none;
}
.sheet__head h2 { font-size: var(--text-xl); }
.sheet__close { margin-left: auto; width: 2.5rem; height: 2.5rem; background: var(--color-fill); }
.sheet__close::before { inset: 0; }
.sheet__close::after { content: ""; position: absolute; inset: -4px; }
.sheet__close svg { width: 1.25rem; height: 1.25rem; }
.sheet__sec { display: grid; gap: var(--space-sm); }
.sheet .group__body { background: var(--color-paper); }
.sheet__sec > h3 { font-family: var(--font-body); font-size: var(--text-xs); font-weight: 700; text-transform: uppercase; color: var(--color-muted); }
.sheet__actions { display: grid; gap: var(--space-xs); }
.qtylist { list-style: none; display: grid; grid-template-columns: minmax(0, 1fr) auto; column-gap: 0; }
.qtylist .q-amt { padding-left: var(--space-md) !important; }
.qtylist li { display: contents; }
.qtylist .q-name, .qtylist .q-amt { padding: var(--space-xs) 0; border-bottom: var(--rule) solid var(--color-rule); }
.qtylist .q-amt { text-align: right; font-family: var(--font-mono); font-size: var(--text-sm); color: var(--color-ink); white-space: nowrap; }
.toollist { list-style: none; display: flex; flex-wrap: wrap; gap: var(--space-xs); }
.toollist li { padding: 0.25rem 0.65rem; border-radius: var(--radius-input); background: var(--color-fill); font-size: var(--text-sm); }
.steps { list-style: none; counter-reset: step; display: grid; gap: var(--space-md); max-width: var(--measure); }
.steps li { counter-increment: step; display: grid; grid-template-columns: 1.75rem minmax(0, 1fr); gap: var(--space-sm); line-height: 1.55; }
.steps li::before {
  content: counter(step); display: grid; place-items: center; width: 1.75rem; height: 1.75rem; border-radius: 50%;
  background: var(--color-accent-wash); color: var(--color-ink); font-weight: 700; font-size: var(--text-sm); margin-top: 0.05rem;
}
.steps .amt { font-weight: 700; color: var(--color-ink); white-space: nowrap; }
.stepper { display: inline-flex; align-items: center; gap: var(--space-2xs); background: var(--color-fill); border-radius: var(--radius-pill); }
.stepper output { min-width: 5.5rem; text-align: center; font-weight: 700; font-size: var(--text-sm); color: var(--color-ink); }
.servings { display: flex; align-items: center; justify-content: space-between; gap: var(--space-sm); flex-wrap: wrap; }

/* reminders status (phone app) */
.nt-next { list-style: none; margin: 0; padding: 0; display: grid; gap: var(--space-2xs); font-size: var(--text-sm); }
.nt-next li { display: flex; gap: var(--space-sm); flex-wrap: wrap; }
.nt-next__when { font-family: var(--font-mono); color: var(--color-muted); min-width: 9.5rem; }
#nt-status { padding: var(--space-sm) var(--space-md); }

/* ── settings forms: label left, control right ──── */
.frow { display: flex; align-items: center; gap: var(--space-sm); min-height: var(--row-h); padding: var(--space-2xs) var(--space-md); min-width: 0; }
.frow__label { flex: 1 1 auto; min-width: 0; display: grid; gap: 2px; color: var(--color-ink); font-weight: 500; }
.frow__value { color: var(--color-muted); font-family: var(--font-mono); font-size: var(--text-sm); }
.frow--stack { flex-direction: column; align-items: stretch; gap: var(--space-xs); padding-block: var(--space-sm); }
.frow .select, .frow .input--trail {
  appearance: none; -webkit-appearance: none; border: 0; background-color: transparent; text-align: right; text-align-last: right;
  color: var(--color-accent); font-weight: 600; min-height: var(--touch); padding: 0 1.5rem 0 var(--space-xs); max-width: 60%; min-width: 0;
  cursor: pointer; border-radius: var(--radius-input); text-overflow: ellipsis;
}
.frow__chev { width: 1.125rem; height: 1.125rem; margin-left: -1.5rem; pointer-events: none; color: var(--color-accent); flex: none; }
.frow .input--trail { padding-right: var(--space-xs); max-width: 9rem; font-variant-numeric: tabular-nums; }
.frow .input--trail[type="date"] { max-width: 11rem; }
.frow .select:focus-visible, .frow .input--trail:focus-visible { outline: 2px solid var(--color-focus); outline-offset: 0; }
.frow select option { color: var(--color-ink); background: var(--color-surface); }
.input, .textarea {
  width: 100%; min-height: var(--touch); padding: var(--space-xs) var(--space-sm);
  border: var(--rule) solid var(--color-rule-2); border-radius: var(--radius-input); background: var(--color-paper);
}
.input--name { border: 0; background: transparent; padding: 0; font-weight: 700; font-size: var(--text-md); color: var(--color-ink); min-height: var(--touch); }
.input--name:focus-visible { outline: 2px solid var(--color-focus); outline-offset: 2px; border-radius: 4px; }
.textarea { min-height: 5.5rem; resize: vertical; }
.input:focus-visible, .textarea:focus-visible { outline: 2px solid var(--color-focus); outline-offset: 0; border-color: var(--color-focus); }
.input[aria-invalid="true"], .input--trail[aria-invalid="true"] { color: var(--color-danger); }
.field-err { font-size: var(--text-sm); color: var(--color-danger); padding: 0 var(--space-md) var(--space-sm); }

/* switch — M3: 52 × 32 outlined track, thumb grows when on · iOS: 51 × 31 filled track */
/* palette picker: radio rows with the palette's accent and meal colours */
.palrow { display: flex; align-items: center; gap: var(--space-md); cursor: pointer; padding: var(--space-sm) var(--space-md); min-height: var(--row-h); }
.palrow input { appearance: none; -webkit-appearance: none; flex: none; width: 1.375rem; height: 1.375rem; margin: 0; border-radius: 50%; border: 2px solid var(--color-rule-2); display: grid; place-items: center; cursor: pointer; }
.palrow input:checked { border-color: var(--color-accent); }
.palrow input:checked::after { content: ""; width: 0.7rem; height: 0.7rem; border-radius: 50%; background: var(--color-accent); }
.palrow input:focus-visible { outline: 2px solid var(--color-focus); outline-offset: 2px; }
.palrow__sw { display: flex; gap: 4px; margin-top: var(--space-2xs); }
.palrow__sw i { width: 1.25rem; height: 1.25rem; border-radius: 6px; box-shadow: inset 0 0 0 1px color-mix(in oklch, var(--color-ink) 12%, transparent); }
.toggle { display: flex; align-items: center; gap: var(--space-md); cursor: pointer; padding: var(--space-sm) var(--space-md); min-height: var(--row-h); }
.toggle__body { display: grid; gap: 2px; min-width: 0; flex: 1 1 auto; }
.toggle__label { font-weight: 500; color: var(--color-ink); }
.toggle__hint { font-size: var(--text-sm); color: var(--color-muted); }
.toggle input {
  appearance: none; -webkit-appearance: none; flex: none; width: 3.25rem; height: 2rem; border-radius: var(--radius-pill); margin: 0;
  background: var(--color-paper-3); border: 2px solid var(--color-neutral); position: relative; cursor: pointer;
  transition: background-color var(--dur-short) var(--ease-out), border-color var(--dur-short) var(--ease-out);
}
.toggle input::after {
  content: ""; position: absolute; top: 50%; left: 0.125rem; width: 1.5rem; height: 1.5rem; border-radius: 50%;
  background: var(--color-neutral); transform: translateY(-50%) scale(0.667);
  transition: transform var(--dur-short) var(--ease-out), background-color var(--dur-short) var(--ease-out);
}
.toggle input:checked { background: var(--color-accent); border-color: var(--color-accent); }
.toggle input:checked::after { background: var(--color-accent-ink); transform: translate(1.15rem, -50%); }
.toggle input:focus-visible { outline: 2px solid var(--color-focus); outline-offset: 3px; }
fieldset { border: 0; margin: 0; padding: 0; min-width: 0; }
fieldset:disabled .toggle { cursor: not-allowed; opacity: 0.5; }
fieldset:disabled .toggle input:checked { background: var(--color-neutral); border-color: var(--color-neutral); }

.daypick { display: flex; gap: var(--space-2xs); flex-wrap: wrap; }
.daypick label { position: relative; }
.daypick label::after { content: ""; position: absolute; inset: -4px -2px; } /* 48px target on a 40px circle */
.daypick input { position: absolute; opacity: 0; inset: 0; margin: 0; cursor: pointer; z-index: 1; }
.daypick span {
  display: grid; place-items: center; width: 2.5rem; height: 2.5rem; border-radius: 50%;
  border: var(--rule) solid var(--color-rule-2); font-size: var(--text-sm); font-weight: 700; color: var(--color-ink-2);
}
.daypick input:checked + span { background: var(--color-accent); color: var(--color-accent-ink); border-color: var(--color-accent); }
.daypick input:focus-visible + span { outline: 2px solid var(--color-focus); outline-offset: 2px; }
.fchips-pad { padding: var(--space-sm) var(--space-md) var(--space-md); }

.rota { width: 100%; border-collapse: collapse; font-size: var(--text-sm); }
.rota th, .rota td { padding: 0 var(--space-2xs); text-align: left; height: var(--row-h); }
.rota th:first-child { padding-left: var(--space-md); width: 3.5rem; }
.rota thead th { color: var(--color-muted); font-weight: 600; height: 2.5rem; font-size: var(--text-xs); }
.rota tbody th { color: var(--color-ink); font-weight: 600; }
.rota tbody tr { border-top: var(--rule) solid var(--color-rule); }
.rota .select {
  appearance: none; -webkit-appearance: none; width: 100%; border: 0; min-height: 2.5rem; border-radius: var(--radius-input);
  background: var(--color-fill); color: var(--color-ink); font-weight: 600; padding: 0 var(--space-xs); cursor: pointer;
}
.rota .select:focus-visible { outline: 2px solid var(--color-focus); outline-offset: 0; }

/* Family index header */
.famhead {
  display: flex; align-items: center; gap: var(--space-sm); margin-bottom: var(--space-lg); padding: var(--space-sm) var(--space-md);
  background: var(--color-surface); border-radius: var(--radius-group); text-decoration: none; color: inherit; min-height: var(--row-h);
}
.famhead .li__text { flex: 1 1 auto; }
.famhead .avatars .li__lead { box-shadow: 0 0 0 3px var(--color-surface); }
.avatars { display: flex; }
.avatars .li__lead { width: 2.75rem; height: 2.75rem; box-shadow: 0 0 0 3px var(--color-paper); font-size: var(--text-base); }
.avatars .li__lead + .li__lead { margin-left: -0.6rem; }

/* ── calendar (Outlook-style) ───────────────────── */
.cal { --time-col: 3.4rem; border-radius: var(--radius-group); background: var(--color-surface); overflow: clip; }
.cal__head {
  display: grid; grid-template-columns: var(--time-col) repeat(var(--cols), minmax(0, 1fr));
  position: sticky; top: calc(var(--appbar-h) + var(--sat)); z-index: var(--z-sticky);
  background: var(--color-surface); border-bottom: var(--rule) solid var(--color-rule);
}
.cal__dh {
  display: grid; justify-items: center; gap: 1px; padding: var(--space-xs) 2px; text-decoration: none; color: var(--color-ink-2);
  border-left: var(--rule) solid var(--color-rule); min-width: 0; text-align: center;
}
.cal__dh--we { background: var(--color-paper-2); }
.cal__dow { font-size: var(--text-xs); font-weight: 600; color: var(--color-muted); }
.cal__dnum { font-weight: 600; font-size: var(--text-md); line-height: 1.1; color: var(--color-ink); display: grid; place-items: center; width: 2.1rem; height: 2.1rem; border-radius: 50%; }
.cal__dh--today .cal__dnum { background: var(--color-accent); color: var(--color-accent-ink); }
.cal__cooks { font-size: 0.68rem; color: var(--color-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 100%; }
.cal__body { display: grid; grid-template-columns: var(--time-col) repeat(var(--cols), minmax(0, 1fr)); position: relative; }
.cal__times { position: relative; }
.cal__times span { position: absolute; right: 6px; transform: translateY(-50%); font-size: 0.68rem; color: var(--color-muted); white-space: nowrap; }
.cal__times span:first-child { transform: none; }
.cal__day {
  position: relative; border-left: var(--rule) solid var(--color-rule); min-width: 0;
  background-image: repeating-linear-gradient(to bottom, var(--cal-hour-line) 0 1px, transparent 1px var(--hour));
}
.cal__day--we { background-color: var(--color-paper-2); }
.ev {
  position: absolute; appearance: none; border: 0; margin: 0; cursor: pointer; text-align: left;
  background: var(--ev-bg); color: var(--ev-ink); border-left: 3px solid var(--ev-line);
  border-radius: 6px; padding: 2px 6px; overflow: hidden; display: grid; align-content: start; gap: 1px;
  font-size: 0.72rem; line-height: 1.25; min-width: 0;
  transition: transform var(--dur-micro) var(--ease-out);
}
.ev:active { transform: scale(0.98); }
.ev:focus-visible { outline: 2px solid var(--color-focus); outline-offset: 1px; z-index: 2; }
.ev__t { font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ev__l { overflow: hidden; display: -webkit-box; -webkit-line-clamp: 4; -webkit-box-orient: vertical; overflow-wrap: anywhere; }
.ev--breakfast { --ev-bg: var(--ev-breakfast); --ev-line: var(--ev-breakfast-line); }
.ev--lunch { --ev-bg: var(--ev-lunch); --ev-line: var(--ev-lunch-line); }
.ev--tea { --ev-bg: var(--ev-tea); --ev-line: var(--ev-tea-line); }
.ev--dinner { --ev-bg: var(--ev-dinner); --ev-line: var(--ev-dinner-line); }
.ev--prep { --ev-bg: var(--ev-prep); --ev-line: var(--ev-prep-line); }
.ev--shop { --ev-bg: var(--ev-shop); --ev-line: var(--ev-shop-line); }
.cal__now { position: absolute; left: 0; right: 0; height: 2px; background: var(--cal-now); z-index: 3; pointer-events: none; }
.cal__now::before { content: ""; position: absolute; left: -4px; top: -3px; width: 8px; height: 8px; border-radius: 50%; background: var(--cal-now); }
.cal__legend { list-style: none; display: flex; flex-wrap: wrap; gap: var(--space-xs) var(--space-md); margin: var(--space-md) 0 var(--space-xs); color: var(--color-neutral); }
.cal__legend li { display: inline-flex; align-items: center; gap: 0.4rem; }
.cal__key { display: inline-block; width: 0.9rem; height: 0.9rem; border-radius: 3px; background: var(--ev-bg); border-left: 3px solid var(--ev-line); }
@media (max-width: 40rem) { .cal { --time-col: 2.6rem; } .cal__times span { font-size: 0.62rem; right: 3px; } .ev { padding: 2px 4px; font-size: 0.68rem; } }

/* ── snackbar (M3) ──────────────────────────────── */
.toast {
  position: fixed; left: calc(var(--sal) + var(--space-sm)); right: calc(var(--sar) + var(--space-sm));
  bottom: calc(var(--navbar-h) + var(--sab) + var(--space-xs)); z-index: var(--z-toast);
  margin: 0 auto; max-width: 36rem; min-height: 3rem;
  background: var(--color-inverse); color: var(--color-inverse-ink); border-radius: 4px;
  padding: var(--space-2xs) var(--space-2xs) var(--space-2xs) var(--space-md);
  display: flex; align-items: center; gap: var(--space-sm); box-shadow: var(--shadow-sheet);
  font-size: var(--text-sm); animation: toast-in var(--dur-short) var(--ease-out);
}
.toast > span { flex: 1 1 auto; padding-block: var(--space-xs); }
.toast .textbtn { color: var(--color-inverse-accent); }
@media (min-width: 60rem) { .toast { bottom: calc(var(--sab) + var(--space-xl)); left: calc(var(--sal) + var(--rail-w) + var(--space-xl)); right: auto; } }
@keyframes toast-in { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }

.empty { text-align: center; padding: var(--space-2xl) var(--space-md); display: grid; gap: var(--space-sm); justify-items: center; }

/* ── iOS (Apple HIG): nav bar 44pt centred title, floating tab bar, chevron back, iOS switch ── */
.plat-ios {
  --appbar-h: 2.75rem;
  --navbar-h: 4.5rem;
  --radius-group: 14px;
  --radius-sheet: 22px;
}
.plat-ios .appbar__row { grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr); }
.plat-ios .appbar__title { text-align: center; font-size: var(--text-base); }
.plat-ios .appbar__lead:empty { width: auto; }
.plat-ios .appbar--scrolled { background: transparent; }
.plat-ios .appbar::after { transition: none; background: var(--color-bar); -webkit-backdrop-filter: saturate(1.6) blur(20px); backdrop-filter: saturate(1.6) blur(20px); }
.plat-ios .backbtn { color: var(--color-accent); padding-left: 0; gap: 0; font-size: var(--text-base); font-weight: 500; }
.plat-ios .backbtn svg { width: 1.6rem; height: 1.6rem; }
.plat-ios .tabbar {
  left: calc(var(--sal) + var(--space-md)); right: calc(var(--sar) + var(--space-md)); bottom: calc(var(--sab) + var(--space-xs));
  padding: 0; border-radius: var(--radius-pill);
  background: var(--color-bar); -webkit-backdrop-filter: saturate(1.8) blur(24px); backdrop-filter: saturate(1.8) blur(24px);
  box-shadow: var(--shadow-float), inset 0 0 0 var(--rule) var(--color-rule);
}
.plat-ios body { padding-bottom: calc(var(--navbar-h) + var(--sab) + var(--space-md)); }
.plat-ios .tabbar .tabs { height: 3.875rem; padding: var(--space-2xs); gap: 0; }
.plat-ios .tab { gap: 2px; font-size: 0.625rem; font-weight: 600; border-radius: var(--radius-pill); }
.plat-ios .tab__ic { width: auto; height: 1.75rem; }
.plat-ios .tab__ic::before, .plat-ios .tab__ic::after { display: none; }
.plat-ios .tab[aria-current="page"] { color: var(--color-accent); background: var(--color-accent-wash); }
.plat-ios .tab[aria-current="page"] .tab__ic { color: var(--color-accent); }
.plat-ios .toast { border-radius: var(--radius-card); bottom: calc(var(--navbar-h) + var(--sab) + var(--space-lg)); }
.plat-ios .toggle input { width: 3.1875rem; height: 1.9375rem; border: 0; background: var(--color-paper-3); }
.plat-ios .toggle input::after { left: 2px; width: 1.6875rem; height: 1.6875rem; background: var(--color-surface); box-shadow: var(--shadow-thumb); transform: translateY(-50%); }
.plat-ios .toggle input:checked { background: var(--color-accent); }
.plat-ios .toggle input:checked::after { background: var(--color-surface); transform: translate(1.25rem, -50%); }
.plat-ios .sheet__grab span { width: 2.25rem; height: 0.3125rem; }
.plat-ios .seg { border: 0; background: var(--color-fill); padding: 2px; border-radius: var(--radius-input); }
.plat-ios .seg a, .plat-ios .seg__opt span { border-radius: 6px; min-height: 2.75rem; }
.plat-ios .seg a + a, .plat-ios .seg__opt + .seg__opt { border-left: 0; }
.plat-ios .seg a[aria-current="page"], .plat-ios .seg__opt input:checked + span { background: var(--color-surface); box-shadow: var(--shadow-knob); }
.plat-ios .seg a[aria-current="page"]::after, .plat-ios .seg__opt input:checked + span::after { display: none; }
.plat-ios .searchbar { border-radius: var(--radius-card); min-height: 2.75rem; }
.plat-ios .searchbar input { min-height: 2.5rem; }
@media (min-width: 60rem) {
  .plat-ios body { padding-bottom: 0; }
}

/* ── reduced motion & print ─────────────────────── */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 1ms !important; transition-duration: 0ms !important; }
  .view { animation: none !important; }
  dialog.sheet[open], dialog.sheet::backdrop { animation: scrim-in 120ms linear !important; }
  .toast { animation: scrim-in 120ms linear !important; }
  dialog.sheet.sheet--settled { animation: none !important; }
  dialog.sheet.sheet--closing, dialog.sheet.sheet--closing::backdrop { animation: scrim-out 120ms linear forwards !important; }
  .ev:active { transform: none; }
}

@media print {
  .appbar, .tabbar, .rail, .no-print, .toast, .chipscroll, .searchbar { display: none !important; }
  body { background: none; color: inherit; padding: 0 !important; }
  main { padding: 0; max-width: none; }
  .group__body, .progress-card { border-radius: 0; }
  .aisles { grid-template-columns: 1fr 1fr; }
  .check input { border-color: currentColor; }
}
