/* ==========================================================================
   Family OS
   Brand DNA: a calm operating system for a home. Warm neutrals, one evergreen
   primary, and a bright hue per area. Content leads; chrome gets out of the way.
   Layout language follows the product references: photo heroes, period strips,
   grouped rows with colour rails, and a single floating create action.
   ========================================================================== */

@font-face {
    font-family: "Nunito";
    font-style: normal;
    font-weight: 400 800;
    font-display: swap;
    src: url("fonts/nunito-latin.woff2") format("woff2");
    unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+2000-206F, U+2074, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

@font-face {
    font-family: "Nunito";
    font-style: normal;
    font-weight: 400 800;
    font-display: swap;
    src: url("fonts/nunito-latin-ext.woff2") format("woff2");
    unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}

:root {
    color-scheme: light;

    --canvas: #faf9f7;
    --surface: #ffffff;
    --surface-2: #f3f1ed;
    --surface-3: #eae6e0;
    --line: #e8e4dd;
    --control-border: #817a72;
    --ink: #16181d;
    --muted: #6b6660;

    --primary: #125e4a;
    --primary-hover: #0e4b3b;
    --primary-press: #0a3a2d;
    --primary-soft: #e2efe9;
    --on-primary: #ffffff;

    --danger: #a3202b;
    --danger-soft: #fbe9ea;
    --warning: #8a4f0a;
    --warning-soft: #fbf0dd;
    --success: #12674a;
    --success-soft: #e2efe9;
    --info: #2b56b8;
    --info-soft: #e8edfb;
    --focus: #b45309;

    /* One bright hue per area, harmonised at a common chroma. */
    --h-calendar: #3767d6;      --h-calendar-soft: #e8edfb;
    --h-tasks: #7040cc;         --h-tasks-soft: #efe9fb;
    --h-chores: #0d7a84;        --h-chores-soft: #e0f2f3;
    --h-meals: #12674a;         --h-meals-soft: #e2efe9;
    --h-shopping: #bd5417;      --h-shopping-soft: #fceee1;
    --h-photos: #cf3f76;        --h-photos-soft: #fce9f0;

    --tile-ink: #ffffff;
    --brand-tile-from: #176f56;
    --brand-tile-to: #0d4f4f;
    --brand-tile-ink: #ffffff;

    --font: "Nunito", ui-rounded, "SF Pro Rounded", "Segoe UI Variable Text", "Segoe UI", system-ui, sans-serif;
    --fs-xs: 0.75rem;
    --fs-sm: 0.875rem;
    --fs-base: 1rem;
    --fs-md: 1.125rem;
    --fs-lg: 1.25rem;
    --fs-xl: 1.5rem;
    --fs-hero: clamp(1.75rem, 1.2rem + 2.4vw, 2.75rem);

    --w-regular: 400;
    --w-medium: 500;
    --w-semi: 600;
    --w-bold: 700;
    --w-black: 800;

    --s1: 0.25rem; --s2: 0.5rem; --s3: 0.75rem; --s4: 1rem;
    --s5: 1.25rem; --s6: 1.5rem; --s8: 2rem; --s10: 2.5rem; --s12: 3rem;

    --r-sm: 0.625rem;
    --r-md: 0.875rem;
    --r-lg: 1.25rem;
    --r-xl: 1.75rem;
    --r-pill: 999px;

    --shadow-1: 0 1px 2px rgb(22 24 29 / 5%), 0 6px 16px -10px rgb(22 24 29 / 22%);
    --shadow-2: 0 2px 6px rgb(22 24 29 / 7%), 0 18px 36px -18px rgb(22 24 29 / 30%);
    --shadow-3: 0 8px 20px rgb(22 24 29 / 12%), 0 32px 64px -24px rgb(22 24 29 / 36%);

    --tap: 2.75rem;
    --icon-sm: 1rem;
    --icon-md: 1.25rem;
    --icon-lg: 1.5rem;
    --disabled-opacity: 0.55;
    --selected-marker: 0.1875rem;
    --topbar: 3.5rem;
    --bottombar: 4rem;
    --rail: 15rem;
    --measure: 62rem;

    --t-fast: 130ms;
    --t-med: 220ms;
    --ease: cubic-bezier(0.2, 0, 0, 1);

    --z-nav: 10;
    --z-fab: 20;
    --z-sheet: 40;
    --z-skip: 100;

    font-family: var(--font);
    background: var(--canvas);
    color: var(--ink);
}

:root[data-theme="dark"] {
    color-scheme: dark;
    --canvas: #101211;
    --surface: #191c1b;
    --surface-2: #212523;
    --surface-3: #2b302e;
    --line: #2c312f;
    --control-border: #747b76;
    --ink: #f2efea;
    --muted: #a29e97;
    --primary: #3fae87;
    --primary-hover: #359a77;
    --primary-press: #359672;
    --primary-soft: #17342b;
    --on-primary: #05231a;
    --danger: #f0a2a2;
    --danger-soft: #3a1a1c;
    --warning: #eeb972;
    --warning-soft: #37280f;
    --success: #6fd6a8;
    --success-soft: #123326;
    --info: #a3bff2;
    --info-soft: #17233c;
    --focus: #f5c451;
    --h-calendar: #9bb4f2;      --h-calendar-soft: #1a2440;
    --h-tasks: #c3a5f0;         --h-tasks-soft: #271c3d;
    --h-chores: #66c6cd;        --h-chores-soft: #10312f;
    --h-meals: #6fd6a8;         --h-meals-soft: #123326;
    --h-shopping: #eda168;      --h-shopping-soft: #3a2413;
    --h-photos: #ef92b6;        --h-photos-soft: #3b1a2a;
    --tile-ink: #10120f;
    --brand-tile-from: #2b9a77;
    --brand-tile-to: #146060;
    --shadow-1: 0 1px 2px rgb(0 0 0 / 45%), 0 6px 16px -10px rgb(0 0 0 / 70%);
    --shadow-2: 0 2px 6px rgb(0 0 0 / 50%), 0 18px 36px -18px rgb(0 0 0 / 75%);
    --shadow-3: 0 8px 20px rgb(0 0 0 / 55%), 0 32px 64px -24px rgb(0 0 0 / 80%);
}

@media (prefers-color-scheme: dark) {
    :root:not([data-theme="light"]) {
        color-scheme: dark;
        --canvas: #101211;
        --surface: #191c1b;
        --surface-2: #212523;
        --surface-3: #2b302e;
        --line: #2c312f;
        --control-border: #747b76;
        --ink: #f2efea;
        --muted: #a29e97;
        --primary: #3fae87;
        --primary-hover: #359a77;
        --primary-press: #359672;
        --primary-soft: #17342b;
        --on-primary: #05231a;
        --danger: #f0a2a2;
        --danger-soft: #3a1a1c;
        --warning: #eeb972;
        --warning-soft: #37280f;
        --success: #6fd6a8;
        --success-soft: #123326;
        --info: #a3bff2;
        --info-soft: #17233c;
        --focus: #f5c451;
        --h-calendar: #9bb4f2;      --h-calendar-soft: #1a2440;
        --h-tasks: #c3a5f0;         --h-tasks-soft: #271c3d;
        --h-chores: #66c6cd;        --h-chores-soft: #10312f;
        --h-meals: #6fd6a8;         --h-meals-soft: #123326;
        --h-shopping: #eda168;      --h-shopping-soft: #3a2413;
        --h-photos: #ef92b6;        --h-photos-soft: #3b1a2a;
        --tile-ink: #10120f;
        --brand-tile-from: #2b9a77;
        --brand-tile-to: #146060;
        --shadow-1: 0 1px 2px rgb(0 0 0 / 45%), 0 6px 16px -10px rgb(0 0 0 / 70%);
        --shadow-2: 0 2px 6px rgb(0 0 0 / 50%), 0 18px 36px -18px rgb(0 0 0 / 75%);
        --shadow-3: 0 8px 20px rgb(0 0 0 / 55%), 0 32px 64px -24px rgb(0 0 0 / 80%);
    }
}

/* ------------------------------------------------------------------ base -- */

*, *::before, *::after { box-sizing: border-box; }
html { min-width: 0; background: var(--canvas); -webkit-text-size-adjust: 100%; }
body { min-width: 0; margin: 0; background: var(--canvas); color: var(--ink); font-family: var(--font); font-size: var(--fs-base); line-height: 1.5; -webkit-font-smoothing: antialiased; }
main, section, form, fieldset, li, p, dd { min-width: 0; overflow-wrap: anywhere; }
:where(h1, h2, h3, h4)[id] { scroll-margin-top: calc(var(--topbar) + var(--s4)); }
/* Headings carry family-supplied names, so a single long word must be breakable —
   at 200% text an unbreakable word is wider than a phone viewport. */
h1, h2, h3, h4 { min-width: 0; margin: 0; overflow-wrap: anywhere; font-weight: var(--w-black); letter-spacing: -0.02em; line-height: 1.15; text-wrap: balance; }
p { margin: 0; }
img { display: block; max-width: 100%; }
svg { flex: 0 0 auto; }
button, input, select, textarea { font: inherit; color: inherit; }
a { color: var(--primary); text-underline-offset: 0.16em; }
nav a, header a { text-decoration: none; }
.app-icon { width: var(--icon-md); height: var(--icon-md); }

/* tabindex="-1" marks a programmatic focus target: the routed heading, the skip-link
   landing, a dialog panel. Focus moves there so screen readers announce the new screen,
   but a sighted user did not navigate there, so it must not paint a focus ring. */
:where(a, button, input, select, textarea, summary, [tabindex]:not([tabindex="-1"])):focus-visible {
    outline: 0.1875rem solid var(--focus);
    outline-offset: 0.15rem;
}

/* The browser paints its own ring on a script-focused element too, so suppress that
   as well. Kept at zero specificity so any real control can still opt back in. */
:where([tabindex="-1"]):focus, :where([tabindex="-1"]):focus-visible { outline: none; }

.sr-only {
    position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
    overflow: hidden; clip-path: inset(50%); white-space: nowrap;
}

/* ---------------------------------------------------------------- brand -- */

.native-entry { min-height: 100vh; min-height: 100dvh; display: flex; flex-direction: column; padding: max(var(--s5), env(safe-area-inset-top)) max(var(--s5), env(safe-area-inset-right)) max(var(--s5), env(safe-area-inset-bottom)) max(var(--s5), env(safe-area-inset-left)); background: var(--canvas); }
.native-entry__header { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: var(--s4); }
.native-entry__content { flex: 1; display: grid; align-content: center; width: 100%; max-width: 32rem; margin-inline: auto; padding-block: var(--s8); }
.native-entry__content > section { min-width: 0; padding: clamp(1.25rem, 5vw, 2.5rem); border: 1px solid var(--line); border-radius: var(--r-xl); background: var(--surface); box-shadow: var(--shadow-1); }
.native-entry__footer { display: flex; justify-content: center; color: var(--muted); font-size: var(--fs-xs); }
.native-entry .native-sign-in-actions { display: grid; gap: var(--s3); }
.native-entry .native-sign-in-actions > * { white-space: normal; }
.native-sign-in-note { color: var(--muted); font-size: var(--fs-sm); }
.native-session-resolution { display: grid; gap: var(--s5); text-align: center; }

.brand { display: inline-flex; align-items: center; gap: var(--s3); color: var(--ink); text-decoration: none; }
.brand__mark { width: 2.25rem; height: 2.25rem; border-radius: 0.75rem; }
.brand__word { font-size: var(--fs-md); font-weight: var(--w-medium); letter-spacing: -0.03em; white-space: nowrap; }
.brand__word b { font-weight: var(--w-black); }
.brand--compact .brand__mark { width: 1.75rem; height: 1.75rem; }

/* -------------------------------------------------------------- buttons -- */

button, .btn {
    display: inline-flex; flex: 0 1 auto; align-items: center; justify-content: center; gap: var(--s2);
    min-width: 0;
    min-height: var(--tap); padding: 0.6rem var(--s5);
    border: 0; border-radius: var(--r-pill);
    background: var(--primary); color: var(--on-primary);
    font-size: var(--fs-base); font-weight: var(--w-bold); text-decoration: none;
    cursor: pointer; touch-action: manipulation;
}
:where(button, input, select, textarea):disabled { opacity: var(--disabled-opacity); cursor: not-allowed; }
:where([aria-busy="true"]) button:disabled, button[aria-busy="true"] { cursor: progress; }
.btn--ghost, .secondary-action { background: transparent; border: 1px solid var(--control-border); color: var(--ink); }
.btn--quiet { background: var(--surface-2); color: var(--ink); }
.btn--danger, .danger-action { background: var(--danger); color: var(--canvas); }
.btn--block { width: 100%; }

/* Circular icon button used over photos and in slim bars. */
/* flex: 0 0 auto keeps the square tap target intact when its row runs out of room —
   the adjacent chip is what gives way. */
.iconbtn {
    display: inline-grid; flex: 0 0 auto; width: var(--tap); height: var(--tap); min-height: var(--tap);
    place-items: center; padding: 0; border: 0; border-radius: var(--r-pill);
    background: var(--surface-2); color: var(--ink);
}
.iconbtn--onphoto { background: rgb(255 255 255 / 92%); color: #16181d; box-shadow: var(--shadow-1); }
.iconbtn svg { width: 1.25rem; height: 1.25rem; }

/* One create action per screen, thumb-reachable. */
.fab {
    position: fixed; z-index: var(--z-fab);
    right: max(var(--s5), env(safe-area-inset-right));
    bottom: calc(var(--bottombar) + var(--s5) + env(safe-area-inset-bottom));
    display: inline-grid; width: 3.5rem; height: 3.5rem; place-items: center;
    padding: 0; border-radius: var(--r-pill);
    background: var(--primary); color: var(--on-primary); box-shadow: var(--shadow-3);
}
.fab svg { width: 1.6rem; height: 1.6rem; }

input, select, textarea {
    width: 100%; min-height: var(--tap); padding: 0.6rem var(--s4);
    border: 1px solid var(--control-border); border-radius: var(--r-md);
    /* Keep editable text at the mobile readability floor even when a host sets a
       smaller root size; rem still lets browser text scaling grow it above 16px. */
    background: var(--surface); color: var(--ink); font-size: max(var(--fs-base), 16px);
}
input:disabled, select:disabled, textarea:disabled { background: var(--surface-2); }
input[aria-invalid="true"], select[aria-invalid="true"], textarea[aria-invalid="true"],
input.invalid, select.invalid, textarea.invalid {
    border-color: var(--danger);
    box-shadow: inset var(--selected-marker) 0 0 var(--danger);
}
input::placeholder, textarea::placeholder { color: var(--muted); opacity: 1; }
/* Tick boxes are not text fields: they keep their intrinsic size and sit beside their label. */
input[type="checkbox"], input[type="radio"] { width: 1.25rem; min-width: 0; min-height: 1.25rem; padding: 0; accent-color: var(--primary); }
label { display: grid; gap: var(--s2); font-size: var(--fs-sm); font-weight: var(--w-bold); }
label:has(input[type="checkbox"]), label:has(input[type="radio"]) {
    grid-template-columns: auto minmax(0, 1fr); align-items: center;
    min-height: var(--tap); font-size: var(--fs-base); font-weight: var(--w-medium);
}

/* ---------------------------------------------------------------- shell -- */

.skip-link {
    position: fixed; z-index: var(--z-skip); top: var(--s2); left: var(--s2);
    min-height: var(--tap); padding: var(--s3) var(--s5);
    transform: translateY(-150%); border-radius: var(--r-pill);
    background: var(--ink); color: var(--canvas);
}
.skip-link:focus { transform: translateY(0); }

.shell { display: grid; grid-template-columns: var(--rail) minmax(0, 1fr); min-height: 100dvh; background: var(--canvas); }

/* Desktop rail: quiet, icon-led, no boxes. */
.rail {
    position: sticky; top: 0; z-index: var(--z-nav);
    display: grid; grid-template-rows: auto minmax(0, 1fr) auto;
    min-width: 0; height: 100dvh; gap: var(--s5);
    padding: var(--s5) var(--s3);
    border-right: 1px solid var(--line); background: var(--surface);
}
.rail__brand { padding-inline: var(--s2); }
.rail__links { display: grid; min-width: 0; align-content: start; gap: 2px; }
.rail a {
    display: flex; align-items: center; gap: var(--s3);
    min-width: 0; min-height: var(--tap); padding: var(--s2) var(--s3);
    overflow: hidden;
    border-radius: var(--r-md); color: var(--muted); font-weight: var(--w-bold);
}
.rail a svg { width: 1.25rem; height: 1.25rem; }
.rail a.active { background: var(--primary-soft); color: var(--primary); }
.rail a.active { box-shadow: inset var(--selected-marker) 0 0 currentColor; }
.rail__foot { display: grid; gap: 2px; padding-top: var(--s4); border-top: 1px solid var(--line); }

.frame { min-width: 0; display: grid; grid-template-rows: auto minmax(0, 1fr); }

/* Slim top bar: identity, one context chip, and account. Nothing else. */
.topbar {
    position: sticky; top: 0; z-index: var(--z-nav);
    min-width: 0;
    display: flex; align-items: center; gap: var(--s3);
    min-height: var(--topbar);
    padding-block: var(--s2) var(--s2);
    padding-inline: calc(var(--s4) + env(safe-area-inset-left)) calc(var(--s4) + env(safe-area-inset-right));
    border-bottom: 1px solid var(--line); background: var(--surface);
}
.topbar__brand { display: none; }
.topbar__title { min-width: 0; flex: 1 1 auto; font-size: var(--fs-md); font-weight: var(--w-black); letter-spacing: -0.02em; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.topbar__actions { display: flex; flex: 0 0 auto; align-items: center; gap: var(--s2); }

/* A flex item defaults to min-width:auto, so without the explicit 0 a long family
   name refuses to shrink and widens the whole frame instead of ellipsing. */
.chip {
    display: inline-flex; align-items: center; gap: var(--s2);
    min-width: 0; min-height: 2rem; max-width: 100%; padding: 0 var(--s3);
    border-radius: var(--r-pill); background: var(--surface-2); color: var(--ink);
    font-size: var(--fs-sm); font-weight: var(--w-bold);
    overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
/* Child mode is a safety signal: the family name gives up room first. */
.chip--child { flex: 0 0 auto; background: var(--h-tasks-soft); color: var(--h-tasks); }
.chip--quiet { background: transparent; color: var(--muted); font-weight: var(--w-medium); }

.page { min-width: 0; width: min(100%, var(--measure)); margin-inline: auto; padding-bottom: calc(var(--s12) + env(safe-area-inset-bottom)); }

.bottombar { display: none; }

/* Account popover */
.menu { position: relative; }
.menu__panel {
    position: absolute; z-index: var(--z-sheet); right: 0; top: calc(100% + var(--s2));
    display: none; min-width: 13rem; padding: var(--s2);
    border: 1px solid var(--line); border-radius: var(--r-lg);
    background: var(--surface); box-shadow: var(--shadow-3);
}
.menu__panel.is-open { display: grid; gap: 2px; }
.menu__panel a { display: flex; align-items: center; gap: var(--s3); min-height: var(--tap); padding: var(--s2) var(--s3); border-radius: var(--r-md); color: var(--ink); font-weight: var(--w-bold); }
.menu__panel a svg { width: 1.15rem; height: 1.15rem; }

/* ----------------------------------------------------------------- hero -- */

/* Full-bleed photo header with the screen title laid over it. */
/* Width comes from the container, never from the aspect ratio: at 200% text a 12rem
   min-height would otherwise derive a 1024px width and burst a 320px screen. */
.hero { position: relative; width: auto; min-width: 0; max-width: 100%; min-height: 12rem; aspect-ratio: 16 / 6; overflow: hidden; background: var(--surface-3); }
.hero__motion { position: absolute; inset: 0; }
.hero__img { width: 100%; height: 100%; object-fit: cover; }
/* A framed picture is laid out whole and then scaled about its chosen point, so pulling the
   zoom below one shows more of it and pushing past one crops in. */
.hero__img[data-framed] { position: absolute; inset: 0; z-index: 0; object-fit: contain; }
/* Fills whatever the framed picture leaves: the same picture, blown past the edges so the blur
   has something to smear, and darkened so the title stays readable over it. */
.hero__wash { position: absolute; inset: 0; z-index: 0; width: 100%; height: 100%; object-fit: cover; scale: 1.25; filter: blur(1.75rem) saturate(1.15) brightness(0.8); }
.hero::after {
    position: absolute; inset: 0; pointer-events: none; content: "";
    background: linear-gradient(180deg, rgb(0 0 0 / 34%) 0%, rgb(0 0 0 / 6%) 38%, rgb(0 0 0 / 62%) 100%);
}
.hero__bar { position: absolute; z-index: 1; inset: var(--s3) var(--s3) auto var(--s3); display: flex; align-items: center; justify-content: space-between; gap: var(--s2); }
.hero__title { position: absolute; z-index: 1; inset: auto var(--s5) var(--s5) var(--s5); color: #fff; font-size: var(--fs-hero); font-weight: var(--w-black); letter-spacing: -0.03em; text-shadow: 0 2px 18px rgb(0 0 0 / 45%); }
.hero__sub { display: block; margin-top: var(--s1); font-size: var(--fs-base); font-weight: var(--w-semi); opacity: 0.92; text-shadow: 0 1px 10px rgb(0 0 0 / 55%); }
.hero__bar-start, .hero__bar-end { display: flex; align-items: center; gap: var(--s2); }
/* Until a household uploads photos the header carries the area's own hue. */
.hero--placeholder { background: linear-gradient(140deg, var(--brand-tile-from), var(--brand-tile-to)); }
.hero--placeholder[data-area="calendar"] { background: linear-gradient(140deg, var(--h-calendar), #1d3f8f); }
.hero--placeholder[data-area="meals"] { background: linear-gradient(140deg, var(--h-meals), #0a3f2f); }
.hero--placeholder[data-area="shopping"] { background: linear-gradient(140deg, var(--h-shopping), #7d3510); }
.hero--placeholder[data-area="photos"] { background: linear-gradient(140deg, var(--h-photos), #8a2450); }
.hero--placeholder::after { background: linear-gradient(180deg, rgb(0 0 0 / 12%), rgb(0 0 0 / 34%)); }
.hero--flat { aspect-ratio: auto; min-height: 0; max-height: none; background: none; padding: var(--s6) var(--s5) var(--s4); }
.hero--flat::after { display: none; }
.hero--flat .hero__title { position: static; color: var(--ink); text-shadow: none; }
.hero--flat .hero__sub { color: var(--muted); }

/* --------------------------------------------------------------- strips -- */

/* Period navigator: one centred row, chevrons at the edges. */
.strip {
    display: grid; grid-template-columns: var(--tap) minmax(0, 1fr) var(--tap);
    align-items: center; gap: var(--s2);
    padding: var(--s2) var(--s4);
    border-bottom: 1px solid var(--line); background: var(--surface);
}
.strip__label { text-align: center; font-size: var(--fs-md); font-weight: var(--w-black); }
.strip .iconbtn { background: transparent; }

/* Seven-day selector, as on the calendar reference. */
/* Seven equal columns fall under the 44px tap minimum on a 320px screen, so the days
   keep their size and the strip scrolls instead. */
.week {
    display: grid; grid-auto-flow: column; grid-auto-columns: minmax(var(--tap), 1fr);
    gap: var(--s1); padding: var(--s2) var(--s3) var(--s3);
    overflow-x: auto; overscroll-behavior-x: contain; scrollbar-width: none;
    border-bottom: 1px solid var(--line); background: var(--surface);
}
.week::-webkit-scrollbar { display: none; }
.week__day { display: grid; gap: var(--s1); justify-items: center; min-height: var(--tap); padding: var(--s1); border: 0; border-radius: var(--r-md); background: transparent; color: var(--muted); }
.week__dow { font-size: var(--fs-xs); font-weight: var(--w-bold); text-transform: uppercase; }
.week__num { display: grid; width: 2rem; height: 2rem; place-items: center; border-radius: var(--r-pill); color: var(--ink); font-size: var(--fs-base); font-weight: var(--w-bold); font-variant-numeric: tabular-nums; }
.week__day[aria-pressed="true"] .week__num { background: var(--primary); color: var(--on-primary); }
.week__day[data-today="true"] .week__dow { color: var(--primary); }

/* --------------------------------------------------------------- groups -- */

/* Grouped list with a sticky day header, mirroring the agenda reference. */
/* Grid items default to min-width:auto, so each level of the list needs the explicit
   0 or the row's fixed-width controls stop the whole group shrinking. */
.group { display: grid; min-width: 0; }
.group__head {
    position: sticky; top: var(--topbar); z-index: 2;
    display: flex; align-items: center; justify-content: space-between; gap: var(--s3);
    padding: var(--s2) var(--s5);
    background: var(--surface-2); color: var(--muted);
    font-size: var(--fs-xs); font-weight: var(--w-black); letter-spacing: 0.06em; text-transform: uppercase;
}
.group__head b { color: var(--ink); font-weight: var(--w-black); }
.group__body { display: grid; min-width: 0; gap: var(--s2); padding: var(--s3) var(--s5) var(--s5); }
.group__empty { padding: var(--s3) var(--s5) var(--s5); color: var(--muted); font-size: var(--fs-sm); }

/* Row with a left colour rail keyed to its category. */
.row {
    --rail-hue: var(--primary);
    display: grid; grid-template-columns: auto minmax(0, 1fr) auto; align-items: center; gap: var(--s4);
    min-width: 0; min-height: var(--tap); padding: var(--s3) var(--s4);
    border: 1px solid var(--line); border-inline-start: 4px solid var(--rail-hue);
    border-radius: var(--r-md); background: var(--surface); color: var(--ink); text-decoration: none;
}
.row[data-area="calendar"] { --rail-hue: var(--h-calendar); }
.row[data-area="tasks"] { --rail-hue: var(--h-tasks); }
.row[data-area="chores"] { --rail-hue: var(--h-chores); }
.row[data-area="meals"] { --rail-hue: var(--h-meals); }
.row[data-area="shopping"] { --rail-hue: var(--h-shopping); }
.row[data-state="done"] { opacity: 0.55; }
.row[data-state="late"] { border-color: var(--danger); }
/* Matches the tap-target width that leads the other row types, so a row with both a
   lead and a trailing action still fits a 320px screen at 200% text. */
.row__lead { display: grid; gap: 2px; justify-items: center; min-width: var(--tap); color: var(--muted); font-size: var(--fs-sm); font-weight: var(--w-bold); font-variant-numeric: tabular-nums; }
.row__kicker { color: var(--rail-hue); font-size: var(--fs-xs); font-weight: var(--w-black); letter-spacing: 0.05em; text-transform: uppercase; }
.row__body { display: grid; gap: 2px; min-width: 0; }
/* When the body itself is the link, it carries the row's colour, not a link's. */
.row__link { color: inherit; text-decoration: none; }
.row__title { font-size: var(--fs-base); font-weight: var(--w-bold); }
.row[data-state="done"] .row__title { text-decoration: line-through; }
.row__meta { display: flex; flex-wrap: wrap; gap: var(--s1) var(--s3); color: var(--muted); font-size: var(--fs-sm); }
.row__trail { display: flex; align-items: center; gap: var(--s2); color: var(--muted); }
.count { display: grid; min-width: 1.75rem; height: 1.75rem; place-items: center; padding-inline: 0.4rem; border-radius: var(--r-pill); background: var(--surface-2); color: var(--muted); font-size: var(--fs-sm); font-weight: var(--w-black); font-variant-numeric: tabular-nums; }
.count--alert { background: var(--danger-soft); color: var(--danger); }

/* Tickable row for tasks, chores, and shopping. */
/* The circle stays small; the button that carries it is a full tap target, so the
   ring is drawn as a pseudo-element rather than as the button's own border. */
.tick { position: relative; display: grid; width: var(--tap); height: var(--tap); min-height: 0; place-items: center; padding: 0; border: 0; background: transparent; color: transparent; }
.tick::before { content: ""; position: absolute; width: 1.6rem; height: 1.6rem; border: 2px solid var(--line); border-radius: var(--r-pill); }
.tick svg { position: relative; width: 1rem; height: 1rem; }
.tick[aria-pressed="true"]::before { border-color: var(--primary); background: var(--primary); }
.tick[aria-pressed="true"] { color: var(--on-primary); }

/* ---------------------------------------------------------------- tiles -- */

/* Big colour tiles for the pinned areas, as on the lists reference. */
.tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 12rem), 1fr)); gap: var(--s3); padding: var(--s4) var(--s5) 0; }
.tile {
    --hue: var(--primary); --hue-soft: var(--primary-soft);
    position: relative; display: grid; align-content: space-between; gap: var(--s6);
    min-height: 8.5rem; padding: var(--s4);
    border-radius: var(--r-lg); background: var(--hue); color: var(--tile-ink); text-decoration: none;
    overflow: hidden;
}
.tile[data-area="calendar"] { --hue: var(--h-calendar); --hue-soft: var(--h-calendar-soft); }
.tile[data-area="tasks"] { --hue: var(--h-tasks); --hue-soft: var(--h-tasks-soft); }
.tile[data-area="chores"] { --hue: var(--h-chores); --hue-soft: var(--h-chores-soft); }
.tile[data-area="meals"] { --hue: var(--h-meals); --hue-soft: var(--h-meals-soft); }
.tile[data-area="shopping"] { --hue: var(--h-shopping); --hue-soft: var(--h-shopping-soft); }
.tile[data-area="photos"] { --hue: var(--h-photos); --hue-soft: var(--h-photos-soft); }
.tile__glyph { position: absolute; right: -0.75rem; bottom: -0.75rem; opacity: 0.22; }
.tile__glyph svg { width: 5.5rem; height: 5.5rem; }
.tile__count { font-size: var(--fs-xl); font-weight: var(--w-black); line-height: 1; font-variant-numeric: tabular-nums; }
.tile__name { position: relative; font-size: var(--fs-md); font-weight: var(--w-black); }
/* No opacity here: fading the ink into the hue drops it under 4.5:1 on the lighter
   areas. Size and weight carry the hierarchy instead. */
.tile__note { position: relative; display: block; margin-top: 2px; font-size: var(--fs-sm); font-weight: var(--w-semi); }

/* A saturated fill carries the area colour well on a light canvas, but the same
   fill against near-black shouts. In dark the tile becomes a tinted surface and the
   hue moves to the count, the glyph, and a hairline instead. */
:root[data-theme="dark"] .tile { background: var(--hue-soft); color: var(--ink); border: 1px solid color-mix(in srgb, var(--hue) 26%, transparent); }
:root[data-theme="dark"] .tile__count { color: var(--hue); }
:root[data-theme="dark"] .tile__glyph { color: var(--hue); opacity: 0.14; }
:root[data-theme="dark"] .tile__note { color: var(--muted); opacity: 1; }

@media (prefers-color-scheme: dark) {
    :root:not([data-theme="light"]) .tile { background: var(--hue-soft); color: var(--ink); border: 1px solid color-mix(in srgb, var(--hue) 26%, transparent); }
    :root:not([data-theme="light"]) .tile__count { color: var(--hue); }
    :root:not([data-theme="light"]) .tile__glyph { color: var(--hue); opacity: 0.14; }
    :root:not([data-theme="light"]) .tile__note { color: var(--muted); opacity: 1; }
}

/* ------------------------------------------------------------ dashboard -- */

/* One vertical rhythm drives the whole screen. Every major block is separated by
   --dash-gap so nothing butts up against the section above it. */
.dash {
    --dash-gap: clamp(1.75rem, 3.2vw, 2.75rem);
    display: grid;
    /* An explicit shrinkable track prevents a descendant's min-content width from
       widening the page by a few pixels at desktop widths with 200% text. */
    grid-template-columns: minmax(0, 1fr);
    gap: var(--dash-gap);
    padding: clamp(1.5rem, 3vw, 2.25rem) clamp(1rem, 3vw, 2rem) var(--s12);
    container: dashboard / inline-size;
}

.dash__head { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: var(--s4); }
.dash__greeting { display: grid; flex: 1 1 22rem; gap: var(--s2); min-width: 0; }
.dash__greeting h1 { max-width: 24ch; }
.dash__greeting h1 { font-size: clamp(1.5rem, 1.1rem + 1.6vw, 2.125rem); }
.dash__date { color: var(--muted); font-size: var(--fs-base); font-weight: var(--w-semi); }

/* Whether the screen is live. Colour is a reinforcement; the state is always written out. */
.connection-state {
    display: inline-flex; align-items: center; gap: var(--s2);
    margin-block-start: var(--s2);
    color: var(--muted); font-size: var(--fs-sm); font-weight: var(--w-medium);
}
.connection-state__dot {
    width: 0.5rem; height: 0.5rem; border-radius: var(--r-pill);
    background: var(--muted); flex: none;
}
.connection-state[data-state="connected"] .connection-state__dot { background: var(--success); }
.connection-state[data-state="reconnecting"] .connection-state__dot { background: var(--warning); }
.connection-state[data-state="offline"] .connection-state__dot,
.connection-state[data-state="closed"] .connection-state__dot { background: var(--danger); }
/* Must be allowed to shrink: at flex-shrink 0 the row keeps its max-content width
   and its own flex-wrap never engages, so the buttons never stack. */
.dash__actions { display: flex; flex: 0 1 auto; min-width: 0; flex-wrap: wrap; gap: var(--s2); }

/* Score band: ring, one plain-language read, and the four numbers behind it. */
.band {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr);
    gap: clamp(1.25rem, 3vw, 2.5rem);
    align-items: center;
    padding: clamp(1.25rem, 2.6vw, 2rem);
    border: 1px solid var(--line);
    border-radius: var(--r-xl);
    background: linear-gradient(135deg, var(--primary-soft), var(--surface) 62%);
}
.band__copy { display: grid; gap: var(--s2); }
.band__copy h2 { font-size: var(--fs-lg); }
.band__copy p { max-width: 46rem; color: var(--muted); font-size: var(--fs-base); }

.ring { position: relative; display: grid; width: 7.5rem; height: 7.5rem; place-items: center; }
.ring svg { position: absolute; inset: 0; width: 100%; height: 100%; transform: rotate(-90deg); }
.ring__track { fill: none; stroke: var(--surface-3); stroke-width: 9; }
.ring__value { fill: none; stroke: var(--primary); stroke-width: 9; stroke-linecap: round; }
.ring__figure { display: grid; gap: 2px; justify-items: center; text-align: center; }
.ring__value-text { font-size: 1.75rem; font-weight: var(--w-black); line-height: 1; font-variant-numeric: tabular-nums; }
.ring__caption { color: var(--muted); font-size: 0.625rem; font-weight: var(--w-black); letter-spacing: 0.1em; text-transform: uppercase; }

.metrics { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 9rem), 1fr)); gap: var(--s5) var(--s6); margin-top: var(--s5); }
.metric { display: grid; gap: var(--s2); }
.metric__label { color: var(--muted); font-size: 0.6875rem; font-weight: var(--w-black); letter-spacing: 0.09em; text-transform: uppercase; }
/* Only dt and dd may sit inside a dl's div wrapper, so the bar lives in the dd. */
.metric__value { display: grid; gap: var(--s2); font-size: var(--fs-md); font-weight: var(--w-black); font-variant-numeric: tabular-nums; }
.metric__bar { display: block; height: 3px; border-radius: var(--r-pill); background: var(--surface-3); overflow: hidden; }
.metric__fill { display: block; height: 100%; border-radius: inherit; background: var(--metric-hue, var(--primary)); }
.metric[data-tone="late"] { --metric-hue: var(--danger); }
.metric[data-tone="late"] .metric__value { color: var(--danger); }

/* Section heading sits well clear of whatever came before it. */
.dash__section { display: grid; gap: var(--s4); }
.dash__section-head { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: var(--s3); }
.dash__section-head h2 { font-size: var(--fs-lg); }
.dash__section-head p { color: var(--muted); font-size: var(--fs-sm); }

.dash .tiles { padding: 0; }

.dash__cols { display: grid; grid-template-columns: minmax(0, 1.6fr) minmax(0, 1fr); gap: var(--s5); align-items: start; }
.dash__stack { display: grid; gap: var(--s5); }

/* Panel: the card shape used across the dashboard. */
.panel { display: grid; gap: var(--s4); padding: clamp(1rem, 2vw, 1.5rem); border: 1px solid var(--line); border-radius: var(--r-lg); background: var(--surface); }
/* A panel that sits inside a full-bleed region and needs to hold itself off the edges. */
.panel--inset { margin: var(--s5); }
.panel__head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: var(--s3); }
.panel__id { display: flex; align-items: center; gap: var(--s3); min-width: 0; }
.panel__glyph { display: grid; width: 2.25rem; height: 2.25rem; place-items: center; border-radius: var(--r-md); background: var(--panel-soft, var(--primary-soft)); color: var(--panel-hue, var(--primary)); }
.panel__glyph svg { width: 1.15rem; height: 1.15rem; }
.panel__titles { display: grid; gap: 1px; min-width: 0; }
.panel__titles h2, .panel__titles h3 { font-size: var(--fs-md); }
.panel__titles p { color: var(--muted); font-size: var(--fs-sm); }
/* A standalone link is still a tap target, so it carries the same minimum as a button. */
.panel__link { display: inline-flex; align-items: center; min-height: var(--tap); color: var(--primary); font-size: var(--fs-sm); font-weight: var(--w-bold); }
.panel__body { display: grid; gap: var(--s2); }

/* Task-style row: status circle, title, then a dotted meta line. */
.item { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; align-items: start; gap: var(--s3); padding: var(--s3) var(--s2); border-radius: var(--r-md); color: var(--ink); text-decoration: none; }
.item__mark { display: grid; width: 1.25rem; height: 1.25rem; min-height: 0; flex: 0 0 auto; place-items: center; margin-top: 2px; padding: 0; border: 2px solid var(--line); border-radius: var(--r-pill); background: transparent; color: transparent; }
.item__mark svg { width: 0.8rem; height: 0.8rem; }
.item[data-state="done"] .item__mark { border-color: var(--primary); background: var(--primary); color: var(--on-primary); }
.item__body { display: grid; gap: var(--s1); min-width: 0; }
.item__title { font-size: var(--fs-base); font-weight: var(--w-bold); }
.item[data-state="done"] .item__title { color: var(--muted); text-decoration: line-through; }
.item__meta { display: flex; flex-wrap: wrap; align-items: center; gap: var(--s1) var(--s3); color: var(--muted); font-size: var(--fs-sm); }
.item__meta span { display: inline-flex; align-items: center; gap: 0.35rem; }
.item__dot { width: 0.4rem; height: 0.4rem; border-radius: var(--r-pill); background: var(--dot-hue, var(--muted)); }
.item__meta [data-area="calendar"] { --dot-hue: var(--h-calendar); }
.item__meta [data-area="tasks"] { --dot-hue: var(--h-tasks); }
.item__meta [data-area="chores"] { --dot-hue: var(--h-chores); }
.item__meta [data-area="meals"] { --dot-hue: var(--h-meals); }
.item__meta [data-area="shopping"] { --dot-hue: var(--h-shopping); }
.item__late { color: var(--danger); font-weight: var(--w-bold); }
.item__time { flex: 0 0 auto; color: var(--muted); font-size: var(--fs-sm); font-weight: var(--w-bold); font-variant-numeric: tabular-nums; }

/* Compact area list for the side column. */
.arealist { display: grid; gap: 2px; }
.arealist a { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; align-items: center; gap: var(--s3); padding: var(--s2); border-radius: var(--r-md); color: var(--ink); text-decoration: none; }
.arealist__glyph { display: grid; width: 2rem; height: 2rem; place-items: center; border-radius: var(--r-sm); background: var(--area-soft); color: var(--area-hue); }
.arealist__glyph svg { width: 1.05rem; height: 1.05rem; }
.arealist a[data-area="calendar"] { --area-hue: var(--h-calendar); --area-soft: var(--h-calendar-soft); }
.arealist a[data-area="tasks"] { --area-hue: var(--h-tasks); --area-soft: var(--h-tasks-soft); }
.arealist a[data-area="chores"] { --area-hue: var(--h-chores); --area-soft: var(--h-chores-soft); }
.arealist a[data-area="meals"] { --area-hue: var(--h-meals); --area-soft: var(--h-meals-soft); }
.arealist a[data-area="shopping"] { --area-hue: var(--h-shopping); --area-soft: var(--h-shopping-soft); }
.arealist a[data-area="photos"] { --area-hue: var(--h-photos); --area-soft: var(--h-photos-soft); }
.arealist__name { display: grid; gap: 1px; min-width: 0; }
.arealist__name b { font-size: var(--fs-base); font-weight: var(--w-bold); }
.arealist__name span { color: var(--muted); font-size: var(--fs-sm); }

@media (hover: hover) {
    .item:hover, .arealist a:hover { background: var(--surface-2); }
}

@media (max-width: 64rem) {
    .dash__cols { grid-template-columns: minmax(0, 1fr); }
}

/* The rail grows with the user's text size, so viewport width alone does not describe
   the room left for dashboard content. Collapse the split when the dashboard's own
   inline size reaches the same readable boundary, including at 200% text. */
@container dashboard (max-width: 48rem) {
    .dash__cols { grid-template-columns: minmax(0, 1fr); }
}

@media (max-width: 40rem) {
    .band { grid-template-columns: minmax(0, 1fr); justify-items: start; }
    .ring { width: 6rem; height: 6rem; }
    .ring__value-text { font-size: 1.375rem; }
}

/* --------------------------------------------------------------- detail -- */

/* Circular-icon stat trio from the recipe reference. */
.stats { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(0, 1fr); gap: var(--s3); padding: var(--s5); border-bottom: 1px solid var(--line); }
.stat { display: grid; gap: var(--s2); justify-items: center; text-align: center; }
.stat__ring { display: grid; width: 2.75rem; height: 2.75rem; place-items: center; border: 1px solid var(--line); border-radius: var(--r-pill); color: var(--ink); }
.stat__ring svg { width: 1.25rem; height: 1.25rem; }
.stat__value { font-size: var(--fs-md); font-weight: var(--w-black); }
.stat__label { color: var(--muted); font-size: var(--fs-sm); }

.tags { display: flex; flex-wrap: wrap; gap: var(--s2); padding: var(--s5); border-bottom: 1px solid var(--line); }
.tag { display: inline-flex; align-items: center; gap: var(--s2); min-height: 2.25rem; padding: 0 var(--s4) 0 var(--s2); border: 1px solid var(--line); border-radius: var(--r-pill); font-size: var(--fs-base); font-weight: var(--w-bold); }
.tag__dot { display: grid; width: 1.5rem; height: 1.5rem; place-items: center; border-radius: var(--r-pill); background: var(--primary-soft); color: var(--primary); }
.tag__dot svg { width: 0.9rem; height: 0.9rem; }

.section-label { padding: var(--s5) var(--s5) var(--s2); color: var(--muted); font-size: var(--fs-xs); font-weight: var(--w-black); letter-spacing: 0.08em; text-transform: uppercase; }
.plainlist { display: grid; gap: var(--s2); margin: 0; padding: 0 var(--s5) var(--s5) var(--s8); }
.plainlist li { color: var(--ink); }

/* Sticky primary action at the foot of a detail screen. */
.stickycta { position: sticky; z-index: var(--z-fab); bottom: 0; display: grid; padding: var(--s4) var(--s5) calc(var(--s4) + env(safe-area-inset-bottom)); background: linear-gradient(180deg, transparent, var(--canvas) 35%); }

/* --------------------------------------------------------------- photos -- */

.photogrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 8rem), 1fr)); gap: var(--s2); padding: var(--s3); }
.photo-card { display: grid; min-width: 0; gap: var(--s1); }
.photo-card__edit { width: 100%; }
.photo-preview-loading { display: grid; place-items: center; width: 100%; height: 100%; color: var(--muted); background: var(--surface-2); }
.image-loading { position: absolute; z-index: 1; inset: 0; display: grid; place-items: center; pointer-events: none; }
.hero > .image-loading .loading-orbit > span, .hero__motion .image-loading .loading-orbit > span { background: var(--on-primary); }
.image-reveal > img { opacity: 0; }
.image-reveal[data-image-state="ready"] > img { opacity: 1; }
.image-reveal[data-image-state="ready"] > .image-loading, .image-reveal[data-image-state="error"] > .image-loading { display: none; }
@media (prefers-reduced-motion: no-preference) {
    .image-reveal > img { transition: opacity 350ms ease-out; }
}
.photo-selection { gap: var(--s2); }
.photo-selection__count { color: var(--muted); font-size: var(--fs-sm); }
.photo-selection__actions { display: flex; flex-wrap: wrap; gap: var(--s3); }
.photo-selection__actions > button { width: auto; flex: 1; display: inline-flex; align-items: center; justify-content: center; gap: var(--s2); }
.app-version { display: inline-block; font-size: var(--fs-xs); color: var(--muted); padding: var(--s2); }
.loading-state { display: grid; justify-items: center; gap: var(--s4); padding: var(--s7) var(--s5); color: var(--muted); }
.loading-state p { margin: 0; }
.loading-orbit { display: inline-flex; gap: 0.4rem; align-items: center; min-height: 1.5rem; }
.loading-orbit > span { width: 0.5rem; height: 0.5rem; border-radius: 50%; background: var(--primary); }
.loading-lines { display: grid; gap: var(--s3); width: min(24rem, 100%); }
.loading-lines > span { height: 0.65rem; border-radius: var(--r-pill); background: var(--surface-3); }
.loading-lines > span:nth-child(2) { width: 83%; }
.loading-lines > span:nth-child(3) { width: 61%; }
@media (prefers-reduced-motion: no-preference) {
    .loading-orbit > span { animation: loading-bounce 1.2s ease-in-out infinite; }
    .loading-orbit > span:nth-child(2) { animation-delay: 0.15s; }
    .loading-orbit > span:nth-child(3) { animation-delay: 0.3s; }
    .loading-lines { animation: loading-breathe 1.8s ease-in-out infinite alternate; }
    .hero[data-scroll-pan] .hero__motion {
        inset: calc(-1 * var(--hero-pan-room, 0px)) 0;
        transform: translateY(var(--hero-pan-y, 0px));
        will-change: transform;
    }
    /* Keep a saved crop at its original size; its blurred wash covers the moving edges. */
    .hero[data-scroll-pan] .hero__img[data-framed] {
        inset-block: var(--hero-pan-room, 0px);
        height: calc(100% - 2 * var(--hero-pan-room, 0px));
    }
}
@keyframes loading-bounce { 0%, 75%, 100% { transform: translateY(0); } 35% { transform: translateY(-0.4rem); } }
@keyframes loading-breathe { from { opacity: 0.5; } to { opacity: 1; } }
.photocell { position: relative; aspect-ratio: 1; padding: 0; border: 0; border-radius: var(--r-md); background: var(--surface-2); overflow: hidden; }
.photocell img { width: 100%; height: 100%; object-fit: cover; }
.photocell[aria-pressed="true"] { outline: 3px solid var(--primary); outline-offset: -3px; }
.photocell__pick { position: absolute; top: var(--s2); right: var(--s2); display: grid; width: 1.75rem; height: 1.75rem; place-items: center; border-radius: var(--r-pill); background: rgb(255 255 255 / 85%); color: var(--ink); font-size: var(--fs-sm); font-weight: var(--w-black); }
.photocell[aria-pressed="true"] .photocell__pick { background: var(--primary); color: var(--on-primary); }

/* Full-screen task surface, used for photo upload and other focused flows. */
.screen { position: fixed; inset: 0; z-index: var(--z-sheet); display: grid; grid-template-rows: auto minmax(0, 1fr) auto; background: var(--canvas); }
.screen__bar { display: flex; align-items: center; gap: var(--s3); min-height: var(--topbar); padding-inline: var(--s3); border-bottom: 1px solid var(--line); background: var(--surface); }
.screen__title { flex: 1 1 auto; text-align: center; font-size: var(--fs-md); font-weight: var(--w-black); }
.screen__body { overflow: auto; }
.screen__foot { display: grid; padding: var(--s4) var(--s5) calc(var(--s4) + env(safe-area-inset-bottom)); border-top: 1px solid var(--line); background: var(--surface); }

.dropzone { display: grid; gap: var(--s3); justify-items: center; margin: var(--s5); padding: var(--s10) var(--s5); border: 2px dashed var(--line); border-radius: var(--r-xl); background: var(--surface); text-align: center; }
.dropzone svg { width: 2.5rem; height: 2.5rem; color: var(--muted); }

/* ---------------------------------------------------------------- misc --- */

.empty { display: grid; gap: var(--s3); justify-items: center; padding: var(--s12) var(--s5); text-align: center; }
.empty svg { width: 2.5rem; height: 2.5rem; color: var(--muted); }
.empty p { max-width: 26rem; color: var(--muted); }

.notice { display: grid; gap: var(--s2); margin: var(--s4) var(--s5); padding: var(--s4); border-inline-start: 4px solid var(--info); border-radius: var(--r-md); background: var(--info-soft); color: var(--ink); }
.notice[data-tone="warning"] { border-inline-start-color: var(--warning); background: var(--warning-soft); }
.notice[data-tone="danger"] { border-inline-start-color: var(--danger); background: var(--danger-soft); }
.notice[data-tone="success"] { border-inline-start-color: var(--success); background: var(--success-soft); }
.notice h2 { font-size: var(--fs-md); }
.notice p { color: var(--muted); }

/* ---------------------------------------------------------- responsive -- */

@media (max-width: 60rem) {
    .shell { grid-template-columns: minmax(0, 1fr); }
    .rail { display: none; }
    .rail.is-open {
        position: fixed; inset: var(--topbar) 0 auto 0; z-index: var(--z-sheet);
        display: grid; grid-template-rows: auto auto; height: auto; max-height: calc(100dvh - var(--topbar));
        overflow: auto; border-right: 0; border-bottom: 1px solid var(--line); box-shadow: var(--shadow-3);
    }
    .rail.is-open .rail__brand { display: none; }
    .topbar__brand { display: inline-flex; }
    .page { padding-bottom: calc(var(--bottombar) + var(--s8) + env(safe-area-inset-bottom)); }

    /* Bottom bar: the primary destinations, one thumb away. */
    .bottombar {
        position: fixed; z-index: var(--z-nav); inset: auto 0 0 0;
        display: grid; grid-auto-flow: column; grid-auto-columns: minmax(0, 1fr);
        padding-block: var(--s1) calc(var(--s1) + env(safe-area-inset-bottom));
        padding-inline: calc(var(--s2) + env(safe-area-inset-left)) calc(var(--s2) + env(safe-area-inset-right));
        border-top: 1px solid var(--line); background: var(--surface);
    }
    .bottombar a { display: grid; gap: 2px; justify-items: center; min-width: 0; min-height: var(--tap); padding: var(--s2) var(--s1); border-radius: var(--r-md); color: var(--muted); font-size: 0.6875rem; font-weight: var(--w-bold); text-align: center; }
    .bottombar a svg { width: 1.35rem; height: 1.35rem; }
    .bottombar a span { max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
    .bottombar a.active { color: var(--primary); }
    .bottombar a.active { box-shadow: inset 0 calc(0rem - var(--selected-marker)) 0 currentColor; }
    .fab { bottom: calc(var(--bottombar) + var(--s4) + env(safe-area-inset-bottom)); }
    .group__head { top: var(--topbar); }
}

@media (min-width: 60.0625rem) {
    button, .btn { flex-shrink: 0; min-width: fit-content; white-space: nowrap; }
    .fab { bottom: calc(var(--s6) + env(safe-area-inset-bottom)); }
    /* Inset on desktop. The width has to subtract the inset explicitly: aspect-ratio
       keeps the box from resolving an auto width against its margins. */
    .hero { border-radius: var(--r-xl); margin: var(--s5) var(--s5) 0; width: calc(100% - (var(--s5) * 2)); }
    .strip, .week { border-radius: var(--r-lg); margin: var(--s4) var(--s5) 0; width: calc(100% - (var(--s5) * 2)); border: 1px solid var(--line); }
    .group__head { top: var(--topbar); border-radius: var(--r-sm); }
}

@media (max-width: 30rem) {
    .stats { padding: var(--s4); }
    .group__body, .group__head, .tiles, .section-label { padding-inline: var(--s4); }
    .hero__title { inset: auto var(--s4) var(--s4) var(--s4); }
}

@media (prefers-reduced-motion: no-preference) {
    button, .btn, .row, .tile, .rail a, .bottombar a { transition: background-color var(--t-fast) var(--ease), color var(--t-fast) var(--ease), border-color var(--t-fast) var(--ease), transform var(--t-med) var(--ease), box-shadow var(--t-med) var(--ease); }
}

@media (hover: hover) {
    /* Solid buttons only. The quiet variants must be excluded here rather than corrected
       below: `button:not(...):not(...):hover` outweighs `.iconbtn:hover`, so the generic
       rule would paint dark ink on the dark primary and the glyph would disappear. */
    button:not(:disabled):not(:active):not(.iconbtn):not(.tick):not(.btn--ghost):not(.btn--quiet):not(.secondary-action):hover,
    .btn:not(:active):not(.btn--ghost):not(.btn--quiet):hover { background: var(--primary-hover); }
    .btn--ghost:hover, .secondary-action:hover, .btn--quiet:hover { background: var(--surface-2); color: var(--ink); }
    /* An icon button already rests on --surface-2, so it needs the next step up to
       register as hovered at all. */
    .iconbtn:hover { background: var(--surface-3); color: var(--ink); }
    .rail a:hover, .bottombar a:hover, .menu__panel a:hover { background: var(--surface-2); color: var(--ink); }
    .row:hover { border-color: var(--rail-hue); }
    .tile:hover { transform: translateY(-2px); box-shadow: var(--shadow-2); }
    .photocell:hover { outline: 3px solid var(--line); outline-offset: -3px; }
    input:not(:disabled):hover, select:not(:disabled):hover, textarea:not(:disabled):hover {
        border-color: color-mix(in srgb, var(--ink) 62%, var(--control-border));
    }
}

/* Same specificity trap as the hover rules: `button:not(:disabled):active` outweighs
   `.iconbtn:active`, so the quiet variants are excluded here rather than corrected after. */
button:not(:disabled):not(.iconbtn):not(.tick):not(.btn--ghost):not(.btn--quiet):not(.secondary-action):active,
.btn:not(.btn--ghost):not(.btn--quiet):active { background: var(--primary-press); transform: scale(0.98); }
.btn--ghost:active, .secondary-action:active, .btn--quiet:active { background: var(--surface-3); }
.iconbtn:active { background: var(--line); }

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after { animation-duration: 0.01ms !important; transition-duration: 0.01ms !important; scroll-behavior: auto !important; }
    button:active, .btn:active, .tile:hover { transform: none; }
}

@media (forced-colors: active) {
    *, *::before, *::after { box-shadow: none !important; }
    .row, .tile, .chip, .count, .iconbtn, .topbar, .rail, .bottombar, .menu__panel, .stat__ring, .tag, .notice, .photocell { border: 1px solid CanvasText; }
    .rail a.active, .bottombar a.active { outline: 2px solid CanvasText; outline-offset: -2px; }
}

/* ------------------------------------------------------------- settings -- */
/* Administration and account screens. Same rhythm and panel shape as the planning
   screens, tuned for forms and records rather than day-to-day scanning. */

.journey-page {
    --dash-gap: clamp(1.5rem, 2.8vw, 2.25rem);
    display: grid; grid-template-columns: minmax(0, 1fr); gap: var(--dash-gap);
    padding: clamp(1.5rem, 3vw, 2.25rem) clamp(1rem, 3vw, 2rem) var(--s12);
    container: journey / inline-size;
}
.journey-heading, .page-heading { display: grid; gap: var(--s2); }
.journey-heading h1, .page-heading h1 { font-size: clamp(1.5rem, 1.1rem + 1.6vw, 2.125rem); }
.journey-heading > p:last-child, .page-heading > p:last-child { max-width: 54rem; color: var(--muted); }
.eyebrow { color: var(--muted); font-size: 0.6875rem; font-weight: var(--w-black); letter-spacing: 0.09em; text-transform: uppercase; }

/* Current-scope strip: quiet context, not a competing card. */
.journey-context {
    display: grid; gap: var(--s1);
    padding: var(--s3) var(--s4);
    border-inline-start: 3px solid var(--primary); border-radius: var(--r-md);
    background: var(--surface-2);
}
.journey-context p { margin: 0; }
.journey-context strong { font-weight: var(--w-black); }
.journey-context__detail { color: var(--muted); font-size: var(--fs-sm); }
.journey-context[data-scope="child"] { border-inline-start-color: var(--h-tasks); }
.journey-context[data-scope="support"] { border-inline-start-color: var(--info); }

.journey-section, .card {
    display: grid; grid-template-columns: minmax(0, 1fr); gap: var(--s4);
    padding: clamp(1rem, 2vw, 1.5rem);
    border: 1px solid var(--line); border-radius: var(--r-lg); background: var(--surface);
}
.journey-section > header { display: grid; grid-template-columns: minmax(0, 1fr); gap: 2px; }
.journey-section > header h2, .journey-section > header h3 { font-size: var(--fs-md); }
.journey-section > header p { max-width: 54rem; color: var(--muted); font-size: var(--fs-sm); }

.journey-form { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 13rem), 1fr)); gap: var(--s4); align-items: end; }
.journey-form__wide { grid-column: 1 / -1; }

/* Records read as rows on the panel, not as cards inside a card. */
.journey-list { display: grid; gap: 0; margin: 0; padding: 0; list-style: none; }
.journey-list > li {
    display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between;
    gap: var(--s3); padding: var(--s4) 0; border: 0; border-top: 1px solid var(--line); background: none;
}
.journey-list > li:first-child { border-top: 0; padding-top: 0; }
.journey-list__content { display: grid; gap: 2px; min-width: 0; }
.journey-list__content > * { margin: 0; }
.journey-list__content > *:first-child { font-weight: var(--w-bold); }
.journey-list__content > *:not(:first-child) { color: var(--muted); font-size: var(--fs-sm); }
.journey-actions { display: flex; min-width: 0; max-width: 100%; flex-wrap: wrap; align-items: center; gap: var(--s2); }
.display-list .journey-list__content { flex: 1 1 16rem; }
.display-list .journey-list__content label { display: flex; align-items: flex-start; gap: var(--s2); }
.display-list .journey-list__content input { flex: 0 0 auto; }
.display-list__remove { flex: 0 0 auto; white-space: nowrap; }

/* A large root font makes the journey container cross this boundary even on a
   desktop viewport. Stack long administration actions instead of using their
   max-content width to widen the page. */
@container journey (max-width: 48rem) {
    .journey-actions > button, .journey-section > button {
        flex: 1 1 100%; width: 100%; min-width: 0; white-space: normal; overflow-wrap: anywhere;
    }
}

.device-authorization {
    display: grid; gap: var(--s3); justify-items: start;
    padding: clamp(1rem, 2vw, 1.5rem);
    border: 1px solid var(--line); border-inline-start: 4px solid var(--info);
    border-radius: var(--r-lg); background: var(--surface-2);
}
.device-authorization header { display: grid; gap: var(--s1); }
.device-authorization h2 { font-size: var(--fs-lg); }
.device-authorization__address, .device-authorization__code {
    max-width: 100%; padding: var(--s2) var(--s4); border-radius: var(--r-md);
    background: var(--surface); color: var(--ink); font-weight: var(--w-black);
    overflow-wrap: anywhere; user-select: text;
}
.device-authorization__code { font-size: clamp(1.75rem, 5vw, 3.25rem); letter-spacing: 0.16em; }
.device-authorization__status { color: var(--muted); }
.device-authorization[data-state="denied"],
.device-authorization[data-state="expired"],
.device-authorization[data-state="failed"] { border-inline-start-color: var(--danger); }
.device-authorization[data-state="retrying"],
.device-authorization[data-state="sloweddown"] { border-inline-start-color: var(--warning); }

.journey-notice, .journey-confirmation {
    display: grid; gap: var(--s2);
    padding: var(--s4);
    border-inline-start: 3px solid var(--info); border-radius: var(--r-md); background: var(--info-soft);
}
.journey-notice--warning { border-inline-start-color: var(--warning); background: var(--warning-soft); }
.journey-notice--danger, .journey-confirmation, .danger-zone { border-inline-start-color: var(--danger); background: var(--danger-soft); }
.journey-status { min-height: 1.5rem; color: var(--muted); font-size: var(--fs-sm); }
.journey-feedback:has(p) { padding: var(--s3) var(--s4); border-inline-start: 3px solid var(--info); border-radius: var(--r-md); background: var(--info-soft); font-weight: var(--w-bold); }
.journey-feedback--success:has(p) { border-inline-start-color: var(--success); background: var(--success-soft); }
.journey-feedback--validation:has(p), .journey-feedback--error:has(p) { border-inline-start-color: var(--danger); background: var(--danger-soft); }
.journey-feedback--conflict:has(p), .journey-feedback--offline:has(p) { border-inline-start-color: var(--warning); background: var(--warning-soft); }

.capability-summary { display: flex; flex-wrap: wrap; gap: var(--s2); margin: 0; padding: 0; list-style: none; }
.capability-summary li { padding: var(--s1) var(--s3); border-radius: var(--r-pill); background: var(--surface-2); font-size: var(--fs-sm); font-weight: var(--w-bold); }

.state-panel {
    display: grid; gap: var(--s3); justify-items: start; max-width: 44rem; margin: var(--s5);
    padding: clamp(1rem, 2vw, 1.5rem);
    border: 1px solid var(--line); border-inline-start: 3px solid var(--info); border-radius: var(--r-lg);
    background: var(--surface);
}
.state-panel--slow, .state-panel--offline, .state-panel--conflict { border-inline-start-color: var(--warning); }
.state-panel--validation, .state-panel--unauthorized, .state-panel--error { border-inline-start-color: var(--danger); }
.state-panel__label { padding: var(--s1) var(--s3); border-radius: var(--r-pill); background: var(--surface-2); color: var(--muted); font-size: var(--fs-sm); font-weight: var(--w-black); }
.state-panel h2 { font-size: var(--fs-md); }
.state-panel p { color: var(--muted); }
.status-badge { display: inline-flex; align-items: center; min-height: 2rem; padding: 0 var(--s3); border-radius: var(--r-pill); background: var(--surface-2); font-size: var(--fs-sm); font-weight: var(--w-bold); }
summary { min-height: var(--tap); padding: var(--s3); border-radius: var(--r-md); font-weight: var(--w-bold); cursor: pointer; }
.theme-preference, .theme-preferences { display: grid; gap: var(--s2); }

/* Pending uploads: thumbnail, description field, and a way to change your mind. */
.uploadlist { display: grid; gap: var(--s3); padding: 0 var(--s5) var(--s5); }
.uploadlist__row { display: grid; grid-template-columns: 4rem minmax(0, 1fr) auto; gap: var(--s4); align-items: center; padding: var(--s3); border: 1px solid var(--line); border-radius: var(--r-md); background: var(--surface); }
.uploadlist__thumb { width: 4rem; height: 4rem; border-radius: var(--r-sm); object-fit: cover; }
.uploadlist__body { display: grid; gap: var(--s1); min-width: 0; }
.uploadlist__labels { display: block; padding: 0 var(--s5) var(--s3); }
/* Framing preview: the same proportions and the same blurred fill as the real header, so what
   is set here is what appears there. */
/* One column by default. A tracked minimum here would be a floor the phone cannot go under,
   and at large text that floor is wider than the screen. */
.framer { display: grid; gap: var(--s4); }
.framer > * { min-width: 0; }
/* The photo module tracks the actual banner proportions at the current viewport and text size. */
.framer__stage { position: relative; width: auto; min-width: 0; max-width: 100%; aspect-ratio: 16 / 6; overflow: hidden; border-radius: var(--r-md); background: var(--surface-3); cursor: grab; touch-action: none; }
.framer__stage:active { cursor: grabbing; }
.framer__stage img { pointer-events: none; user-select: none; }
.framer__wash { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; scale: 1.25; filter: blur(1.75rem) saturate(1.15) brightness(0.8); }
.framer__img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.framer__img[data-framed] { object-fit: contain; }
.framer__controls { display: grid; gap: var(--s2); align-content: start; }
.framer__controls label { display: grid; grid-template-columns: 1fr auto; align-items: center; gap: var(--s1); }
.range-value { font-variant-numeric: tabular-nums; color: var(--muted); font-size: var(--fs-sm); }
.framer__controls input[type="range"] { grid-column: 1 / -1; width: 100%; min-width: 0; height: var(--tap); padding: 0; border: 0; background: transparent; accent-color: var(--primary); cursor: pointer; }
.uploadlist__note { margin: 0; color: var(--muted); font-size: var(--fs-xs); }
/* Says how far through preparing or sending the pictures are, rather than just spinning. */
.uploadprogress { inline-size: 100%; block-size: 0.5rem; accent-color: var(--primary); }

/* ---------------------------------------------------------------- sheet -- */

/* Bottom sheet on phones, centred panel on desktop. */
.sheet-scrim { position: fixed; inset: 0; z-index: var(--z-sheet); display: grid; align-items: end; background: rgb(0 0 0 / 48%); }
.sheet {
    display: grid; grid-template-rows: auto minmax(0, 1fr) auto;
    width: 100%; max-height: 92dvh;
    border-radius: var(--r-xl) var(--r-xl) 0 0;
    background: var(--surface); box-shadow: var(--shadow-3);
}
.sheet__head { display: flex; align-items: flex-start; justify-content: space-between; gap: var(--s3); padding: var(--s5) var(--s5) var(--s3); }
.sheet__titles { display: grid; gap: 2px; min-width: 0; }
.sheet__titles h2 { font-size: var(--fs-lg); }
.sheet__titles p { color: var(--muted); font-size: var(--fs-sm); }
.sheet__body { display: grid; gap: var(--s4); align-content: start; padding: 0 var(--s5) var(--s5); overflow: auto; }
.sheet__foot { display: grid; gap: var(--s2); padding: var(--s4) var(--s5) calc(var(--s5) + env(safe-area-inset-bottom)); border-top: 1px solid var(--line); }
.sheet__row { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 9rem), 1fr)); gap: var(--s3); }
/* Says in plain words what the controls above it add up to. */
.sheet__note { margin: 0; color: var(--muted); font-size: var(--fs-xs); }

@media (min-width: 40rem) {
    .sheet-scrim { align-items: center; justify-items: center; padding: var(--s5); }
    .sheet { width: min(36rem, 100%); max-height: 86dvh; border-radius: var(--r-xl); }
}

/* ----------------------------------------------------------------- meals -- */

/* Slot colour rails, matching the plan reference. */
.row[data-slot="breakfast"] { --rail-hue: #c2571a; }
.row[data-slot="lunch"] { --rail-hue: #a67c00; }
.row[data-slot="dinner"] { --rail-hue: var(--h-meals); }
.row[data-slot="custom"] { --rail-hue: var(--h-tasks); }
:root[data-theme="dark"] .row[data-slot="breakfast"] { --rail-hue: #eda168; }
:root[data-theme="dark"] .row[data-slot="lunch"] { --rail-hue: #dcb75a; }
@media (prefers-color-scheme: dark) {
    :root:not([data-theme="light"]) .row[data-slot="breakfast"] { --rail-hue: #eda168; }
    :root:not([data-theme="light"]) .row[data-slot="lunch"] { --rail-hue: #dcb75a; }
}

/* A day with nothing planned still offers its own add button. */
/* Visually light, but the hit area still has to reach the tap minimum — a small
   glyph on a transparent square, not a small square. */
.group__head .iconbtn { width: var(--tap); height: var(--tap); background: transparent; color: var(--primary); }
.group__head .iconbtn svg { width: 1.1rem; height: 1.1rem; }
.daygroup { display: grid; min-width: 0; }
.daygroup__empty { display: flex; align-items: center; justify-content: space-between; gap: var(--s3); padding: var(--s3) var(--s5) var(--s5); color: var(--muted); font-size: var(--fs-sm); }

/* Detail screen */
.detail { display: grid; gap: 0; }
.detail__lede { display: grid; gap: var(--s3); justify-items: center; padding: var(--s6) var(--s5); text-align: center; }
.detail__lede h2 { font-size: var(--fs-xl); }
.detail__lede a { font-weight: var(--w-bold); }
.detail__notes { max-width: 34rem; color: var(--muted); }
.detail__back { position: absolute; inset: var(--s3) auto auto var(--s3); z-index: 1; }
.group__head > span:first-child { display: inline-flex; flex-wrap: wrap; gap: var(--s2); min-width: 0; }
.section-head { display: flex; align-items: center; justify-content: space-between; gap: var(--s3); padding-right: var(--s5); }
.section-head .section-label { padding-bottom: var(--s2); }
.ingredient { display: grid; gap: var(--s3); padding: var(--s4); border: 1px solid var(--line); border-radius: var(--r-md); background: var(--surface-2); }
.ingredient b { font-size: var(--fs-base); }

/* ---------------------------------------------------------------- recipes -- */

.recipe { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: var(--s4); align-items: start; padding: var(--s4); border: 1px solid var(--line); border-inline-start: 4px solid var(--h-meals); border-radius: var(--r-md); background: var(--surface); }
.recipe__body { display: grid; gap: var(--s1); min-width: 0; }
.recipe__ingredients { color: var(--muted); font-size: var(--fs-sm); }
.recipe__actions { display: flex; flex-wrap: wrap; gap: var(--s2); }
.field-help { color: var(--muted); font-size: var(--fs-sm); }

@media (max-width: 40rem) {
    .recipe { grid-template-columns: minmax(0, 1fr); }
}

/* --------------------------------------------------------------- calendar -- */

/* Time on the left, a colour block carrying the event, as on the agenda reference. */
.event { display: grid; grid-template-columns: 3.75rem minmax(0, 1fr); gap: var(--s3); align-items: start; min-width: 0; }
.event__when { display: grid; gap: 1px; justify-items: end; padding-top: var(--s2); text-align: right; }
.event__time { color: var(--ink); font-size: var(--fs-sm); font-weight: var(--w-bold); font-variant-numeric: tabular-nums; }
.event__length { color: var(--muted); font-size: var(--fs-xs); }
.event__block {
    --hue: var(--h-calendar);
    /* Stretch text rows to the available grid track. With start alignment they use
       max-content width and long loaded values can escape at 200% text. */
    display: grid; grid-template-columns: minmax(0, 1fr); gap: 2px; justify-content: stretch; justify-items: stretch;
    width: auto; min-width: 0; max-width: 100%; min-height: var(--tap); padding: var(--s3) var(--s4);
    border: 0; border-radius: var(--r-md);
    background: var(--hue); color: var(--tile-ink); text-align: left; white-space: normal; overflow-wrap: anywhere;
}
.event__block[data-hue="calendar"] { --hue: var(--h-calendar); }
.event__block[data-hue="tasks"] { --hue: var(--h-tasks); }
.event__block[data-hue="chores"] { --hue: var(--h-chores); }
.event__block[data-hue="meals"] { --hue: var(--h-meals); }
.event__block[data-hue="shopping"] { --hue: var(--h-shopping); }
.event__block[data-hue="photos"] { --hue: var(--h-photos); }
.event__title { font-size: var(--fs-md); font-weight: var(--w-black); }
.event__where, .event__who { display: inline-flex; align-items: center; gap: var(--s1); font-size: var(--fs-sm); font-weight: var(--w-semi); opacity: 0.9; }
.event__where svg { width: 0.9rem; height: 0.9rem; }


.filterbar { display: flex; flex-wrap: wrap; align-items: center; gap: var(--s3); padding: var(--s3) var(--s5) 0; }

/* Bottom action bar: today, create, filter. */
.actionbar {
    position: sticky; bottom: 0; z-index: var(--z-fab);
    display: grid; grid-auto-flow: column; grid-auto-columns: minmax(0, 1fr);
    gap: var(--s2); margin-top: var(--s5);
    padding: var(--s3) var(--s5) calc(var(--s3) + env(safe-area-inset-bottom));
    border-top: 1px solid var(--line); background: var(--surface);
}
.actionbar__item { display: grid; gap: 2px; justify-items: center; min-height: var(--tap); padding: var(--s2); border-radius: var(--r-md); background: transparent; color: var(--muted); font-size: var(--fs-xs); font-weight: var(--w-bold); }
.actionbar__item svg { width: 1.25rem; height: 1.25rem; }
.actionbar__item--primary { color: var(--primary); }

/* Multi-select pickers inside sheets. */
.picker { display: grid; gap: var(--s2); }
.picker__item { display: grid; grid-template-columns: auto minmax(0, 1fr); align-items: center; gap: var(--s3); min-height: var(--tap); font-weight: var(--w-medium); }
.picker__row { display: block; width: 100%; min-height: var(--tap); padding: var(--s3) var(--s4); border: 1px solid var(--line); border-radius: var(--r-md); background: var(--surface); color: var(--ink); font-weight: var(--w-bold); text-align: left; }
.picker__row.is-on { border-color: var(--primary); background: var(--primary-soft); color: var(--primary); }

@media (max-width: 60rem) {
    .actionbar { bottom: calc(var(--bottombar) + env(safe-area-inset-bottom)); }
}

/* --------------------------------------------------------------- lists ---- */

.count--clear { background: var(--primary-soft); color: var(--primary); }
.count--clear svg { width: 0.9rem; height: 0.9rem; }
.done { margin: var(--s4) var(--s5) 0; }
.done > summary { color: var(--muted); font-size: var(--fs-sm); }
.done .group__body { padding-inline: 0; }

/* --------------------------------------------------------------- chores --- */

.standings { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(0, 1fr); gap: var(--s3); padding: var(--s4) var(--s5) 0; }
.standing { display: grid; gap: 2px; justify-items: center; padding: var(--s3); border: 1px solid var(--line); border-radius: var(--r-md); background: var(--surface); text-align: center; }
.standing__points { font-size: var(--fs-lg); font-weight: var(--w-black); font-variant-numeric: tabular-nums; }
.standing__name { color: var(--muted); font-size: var(--fs-sm); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 100%; }

/* Watch list: compact artwork cards, with actions in the shared photo-style sheet. */
.watch-page { min-width: 0; }
.watch-group__header { display: flex; align-items: center; justify-content: space-between; gap: 1rem; flex-wrap: wrap; }
.watch-group { min-width: 0; margin-top: 2rem; }
.watch-group__header h2 { display: flex; align-items: center; gap: .6rem; font-size: 1.25rem; }
.watch-group__arrows { display: flex; gap: .5rem; }
.watch-shelf { display: grid; grid-auto-flow: column; grid-auto-columns: clamp(15rem, 28vw, 21rem); gap: 1rem; overflow-x: auto; overscroll-behavior-x: contain; scroll-snap-type: x proximity; padding: .35rem .15rem 1rem; margin: 0; list-style: none; }
.watch-shelf:empty { display: none; }
.watch-card { scroll-snap-align: start; min-width: 0; }
.watch-card__cover { position: relative; display: block; width: 100%; padding: 0; text-align: left; border: 1px solid var(--line); border-radius: var(--r-lg); overflow: hidden; background: var(--surface-2); }
.watch-card__cover .watch-artwork { aspect-ratio: 16 / 11; }
.watch-card__badges { position: absolute; inset: .7rem auto auto .7rem; display: inline-flex; max-width: calc(100% - 1.4rem); overflow: hidden; border-radius: var(--r-pill); box-shadow: 0 1px 6px rgb(0 0 0 / 18%); }
.watch-kind, .watch-provider { display: inline-flex; align-items: center; min-height: 1.8rem; padding: .3rem .6rem; font-size: .75rem; line-height: 1.2; font-weight: var(--w-bold); white-space: nowrap; }
.watch-kind { background: rgb(12 18 25 / 88%); color: #fff; }
.watch-provider { background: #edf2f5; color: #17202a; }
.watch-provider[data-provider="netflix"] { background: #b20710; color: #fff; }
.watch-provider[data-provider="prime"] { background: #005e8c; color: #fff; }
.watch-provider[data-provider="disney"] { background: #073d46; color: #ccfff8; }
.watch-provider[data-provider="apple"] { background: #111; color: #fff; }
.watch-provider[data-provider="max"] { background: #002be7; color: #fff; }
.watch-provider[data-provider="hulu"] { background: #1ce783; color: #10251c; }
.watch-provider[data-provider="paramount"] { background: #0057d9; color: #fff; }
.watch-provider[data-provider="peacock"] { background: #ffda00; color: #141414; }
.watch-provider[data-provider="iplayer"] { background: #bb0050; color: #fff; }
.watch-provider[data-provider="now"] { background: #006d72; color: #fff; }
.watch-provider[data-provider="itvx"] { background: #d8fc25; color: #202316; }
.watch-card__caption { position: absolute; inset: auto 0 0; padding: 2.4rem .9rem .9rem; background: linear-gradient(transparent, rgb(7 12 19 / 94%) 48%); color: #fff; }
.watch-card__title { display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; overflow-wrap: anywhere; white-space: normal; font-size: 1.05rem; line-height: 1.3; font-weight: var(--w-bold); text-shadow: 0 1px 3px #000; }
.watch-card__cover .watch-artwork__fallback { padding-bottom: 3rem; }
.watch-card__cover .watch-artwork__fallback span { display: none; }
.watch-artwork { aspect-ratio: 2 / 3; position: relative; overflow: hidden; background: var(--surface-2); }
.watch-artwork .image-reveal { position: absolute; inset: 0; }
.watch-artwork img { width: 100%; height: 100%; object-fit: cover; }
.watch-artwork__fallback { display: grid; align-content: center; justify-items: center; gap: .8rem; height: 100%; padding: 1rem; text-align: center; color: var(--muted); background: linear-gradient(145deg, var(--primary-soft), var(--surface-2)); }
.watch-artwork__fallback svg { width: 3rem; height: 3rem; }
.watch-artwork__fallback span { color: var(--ink); font-weight: var(--w-bold); }
.watch-status { display: grid; gap: .6rem; margin: .75rem 0 1rem; }
.watch-status button { display: flex; align-items: center; justify-content: flex-start; gap: .75rem; min-height: 48px; text-align: left; }
.watch-status button[aria-pressed="true"] { opacity: 1; color: var(--primary); background: var(--primary-soft); border-color: var(--primary); }
.watch-open { display: inline-flex; align-items: center; gap: .5rem; margin-top: .5rem; }
.watch-actions { display: flex; gap: .75rem; }
.watch-actions button { display: inline-flex; align-items: center; justify-content: center; gap: .5rem; flex: 1; }
.watch-empty { padding: 1.25rem; border: 1px dashed var(--line); border-radius: var(--r-lg); color: var(--muted); }
.watch-editor { min-width: 0; }
.watch-editor__link { display: flex; align-items: center; gap: .5rem; flex-wrap: wrap; }
.watch-editor__link input { flex: 1 1 15rem; min-width: 0; }
.watch-editor__fields { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 18rem), 1fr)); gap: 1rem; margin: 1rem 0 0; border: 0; padding: 0; min-inline-size: 0; }
.watch-editor label { display: grid; gap: .35rem; }
.watch-editor label span, .watch-editor form > p { color: var(--muted); font-size: .9rem; }
.watch-editor .journey-actions { margin-top: 1rem; }
.app-update-download { display: grid; gap: .75rem; flex: 1 1 100%; min-width: 0; }
.app-update-download .loading-state { padding: .5rem 0; }
.app-update-download progress { width: 100%; height: .65rem; accent-color: var(--primary); }
.app-update-download .notice, .app-update-download p { margin: 0; }

/* Shopping remains interactive while the server circuit reconnects. */
body.shopping-local-active #components-reconnect-modal { display: none !important; }
.shopping-sync { color: var(--muted); font-size: .875rem; padding: .5rem 1rem; }
.shopping-sync-footer { display: grid; justify-items: start; gap: .75rem; padding: 1rem; }
.shopping-sync-footer .shopping-sync { margin: 0; padding: 0; }
.shopping-sync-footer .notice { width: 100%; }

.shopping-checklist .row[data-state="done"] { opacity: 1; }
