/* Fucina — design system (Material 3 inspired, same structure as FoodTrack, raspberry palette).
 *
 * Tokens:      colors (light/dark), radii, elevation
 * Components:  app bar, navigation bar, FAB, card, list row, tile (leading icon), status chip, banner,
 *              buttons, text fields, search bar, segmented button, chips, bottom sheet, menu, snackbar, empty state
 */
:root {
    --primary: #B4235A;
    --on-primary: #FFFFFF;
    --primary-container: #FFD9E2;
    --on-primary-container: #3E001D;
    --brand: #E84A7F; /* Fucina raspberry: logo, accents, splash */
    --bg: #FBF6F7;
    --surface: #FFFFFF;
    --surface-1: #FFFFFF; /* cards */
    --surface-2: #F6ECEF; /* hover / pressed / inputs */
    --surface-3: #EFE1E5;
    --card-border: rgba(60, 20, 35, .07);
    --card-shadow: 0 1px 2px rgba(60, 16, 32, .05), 0 2px 8px rgba(60, 16, 32, .04);
    --text: #22191C;
    --muted: #6B5E63;
    --outline: #9A8A90;
    --outline-variant: #E4D3D8;
    --danger: #BA1A1A;
    --danger-container: #FFDAD6;
    --on-danger-container: #410002;
    --warn: #8A5A00;
    --warn-container: #FFE7AE;
    --on-warn-container: #2E2000;
    --ok: #2E7D32;
    --scrim: rgba(0, 0, 0, .42);
    --shadow-1: 0 1px 2px rgba(0, 0, 0, .12), 0 1px 3px 1px rgba(0, 0, 0, .06);
    --shadow-3: 0 4px 8px 3px rgba(0, 0, 0, .12), 0 1px 3px rgba(0, 0, 0, .16);
    --r-sm: 8px;
    --r-md: 12px;
    --r-lg: 16px;
    --r-xl: 28px;
    --nav-h: 76px;
    color-scheme: light;
}

@media (prefers-color-scheme: dark) {
    :root:not([data-theme="light"]) {
        --primary: #FFB1C8;
        --on-primary: #5E1133;
        --primary-container: #8E0B43;
        --on-primary-container: #FFD9E2;
        --brand: #FF6F9C;
        --bg: #150F11;
        --surface: #1E1619;
        --surface-1: #221A1D;
        --surface-2: #2E2427;
        --surface-3: #392D31;
        --card-border: rgba(255, 255, 255, .06);
        --card-shadow: none;
        --text: #F1E4E8;
        --muted: #B9A6AD;
        --outline: #9A8A90;
        --outline-variant: #4A3B40;
        --danger: #FFB4AB;
        --danger-container: #93000A;
        --on-danger-container: #FFDAD6;
        --warn: #F4C25B;
        --warn-container: #5C4200;
        --on-warn-container: #FFE7AE;
        --ok: #8FD88B;
        --scrim: rgba(0, 0, 0, .6);
        color-scheme: dark;
    }
}

:root[data-theme="dark"] {
    --primary: #FFB1C8;
    --on-primary: #5E1133;
    --primary-container: #8E0B43;
    --on-primary-container: #FFD9E2;
    --brand: #FF6F9C;
    --bg: #150F11;
    --surface: #1E1619;
    --surface-1: #221A1D;
    --surface-2: #2E2427;
    --surface-3: #392D31;
    --card-border: rgba(255, 255, 255, .06);
    --card-shadow: none;
    --text: #F1E4E8;
    --muted: #B9A6AD;
    --outline: #9A8A90;
    --outline-variant: #4A3B40;
    --danger: #FFB4AB;
    --danger-container: #93000A;
    --on-danger-container: #FFDAD6;
    --warn: #F4C25B;
    --warn-container: #5C4200;
    --on-warn-container: #FFE7AE;
    --ok: #8FD88B;
    --scrim: rgba(0, 0, 0, .6);
    color-scheme: dark;
}

* {
    box-sizing: border-box;
    -webkit-tap-highlight-color: transparent;
}

html, body {
    margin: 0;
}

body {
    font: 15px/1.5 'Nunito', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
    letter-spacing: -.006em;
    background: var(--bg);
    color: var(--text);
    min-height: 100vh;
    min-height: 100dvh;
    overscroll-behavior-y: contain;
    -webkit-font-smoothing: antialiased;
}

body.no-scroll {
    overflow: hidden;
}

button, input, select, textarea {
    font: inherit;
    color: inherit;
}

a {
    color: var(--primary);
}

.ic {
    width: 24px;
    height: 24px;
    fill: currentColor;
    flex: none;
}

svg.pic {
    width: 26px;
    height: 26px;
    flex: none;
    color: inherit;
    overflow: visible;
}

[hidden] {
    display: none !important;
}

.muted {
    color: var(--muted);
}

.small {
    font-size: .84rem;
}

.center {
    text-align: center;
}

.spacer {
    height: 12px;
}

.grow {
    flex: 1;
    min-width: 0;
}

.stack {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.row {
    display: flex;
    gap: 10px;
    align-items: center;
}

.wrap {
    flex-wrap: wrap;
}

/* ---------- Layout ---------- */
#app {
    max-width: 720px;
    margin: 0 auto;
    min-height: 100vh;
    min-height: 100dvh;
    display: flex;
    flex-direction: column;
    background: var(--bg);
    position: relative;
}

main.view {
    flex: 1;
    padding: 16px 16px calc(var(--nav-h) + 96px + env(safe-area-inset-bottom));
}

main.view.no-nav {
    padding-bottom: calc(40px + env(safe-area-inset-bottom));
}

main.view.no-fab {
    padding-bottom: calc(var(--nav-h) + 28px + env(safe-area-inset-bottom));
}

@media (min-width: 721px) {
    body {
        background: var(--surface-1);
    }

    #app {
        box-shadow: var(--shadow-1);
    }
}

/* ---------- App bar (clean surface, green accents) ---------- */
.appbar {
    position: sticky;
    top: 0;
    z-index: 20;
    color: var(--text);
    background: color-mix(in srgb, var(--bg) 88%, transparent);
    -webkit-backdrop-filter: saturate(1.4) blur(14px);
    backdrop-filter: saturate(1.4) blur(14px);
    padding: calc(env(safe-area-inset-top) + 10px) 10px 10px 18px;
    display: flex;
    align-items: flex-end;
    gap: 4px;
    min-height: 64px;
    border-bottom: 1px solid transparent;
    transition: border-color .2s;
}

body.scrolled .appbar {
    border-bottom-color: var(--outline-variant);
}

.appbar .titles {
    flex: 1;
    min-width: 0;
}

.appbar .brand {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: .78rem;
    font-weight: 600;
    color: var(--primary);
}

.appbar .brand img {
    width: 18px;
    height: 18px;
}

.appbar h1 {
    margin: 6px 0 0;
    font-size: 1.75rem;
    font-weight: 700;
    letter-spacing: -.025em;
    line-height: 1.15;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.appbar.small {
    align-items: center;
    padding-left: 6px;
}

.appbar.small h1 {
    font-size: 1.15rem;
    font-weight: 650;
    letter-spacing: -.015em;
    margin: 0 0 0 4px;
}

.appbar .icon-btn {
    color: inherit;
}

.household-chip {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    background: var(--primary-container);
    border: 0;
    color: var(--on-primary-container);
    border-radius: 999px;
    padding: 2px 9px 2px 7px;
    font-size: .74rem;
    font-weight: 600;
    cursor: pointer;
    max-width: 50vw;
    letter-spacing: 0;
}

.household-chip span {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.household-chip .ic {
    width: 14px;
    height: 14px;
}

.avatar {
    width: 38px;
    height: 38px;
    border-radius: 50%;
    background: linear-gradient(135deg, #F06292, #AD1457);
    color: #fff;
    display: grid;
    place-items: center;
    font-weight: 650;
    font-size: .88rem;
    border: 0;
    cursor: pointer;
    flex: none;
    letter-spacing: 0;
}

.appbar .avatar {
    margin: 0 4px 2px 6px;
    box-shadow: 0 0 0 2px var(--bg), 0 0 0 3.5px var(--primary-container);
}

.avatar.lg {
    width: 60px;
    height: 60px;
    font-size: 1.35rem;
}

/* ---------- Navigation bar & FAB ---------- */
.bottomnav {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 30;
    color: var(--muted);
    background: color-mix(in srgb, var(--surface) 92%, transparent);
    -webkit-backdrop-filter: saturate(1.4) blur(14px);
    backdrop-filter: saturate(1.4) blur(14px);
    border-top: 1px solid var(--outline-variant);
    display: flex;
    justify-content: space-around;
    padding: 10px 8px calc(10px + env(safe-area-inset-bottom));
    max-width: 720px;
    margin: 0 auto;
}

.bottomnav a {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    text-decoration: none;
    color: inherit;
    font-size: .74rem;
    font-weight: 600;
}

.bottomnav a .pill {
    width: 60px;
    height: 32px;
    border-radius: 999px;
    display: grid;
    place-items: center;
    transition: background .2s, color .2s;
}

.bottomnav a.active {
    color: var(--text);
}

.bottomnav a.active .pill {
    background: var(--primary-container);
    color: var(--on-primary-container);
}

.fab {
    position: fixed;
    z-index: 25;
    right: max(16px, calc(50vw - 360px + 16px));
    bottom: calc(var(--nav-h) + 18px + env(safe-area-inset-bottom));
    display: inline-flex;
    align-items: center;
    gap: 10px;
    height: 56px;
    padding: 0 20px 0 16px;
    border: 0;
    border-radius: var(--r-lg);
    background: var(--primary);
    color: var(--on-primary);
    font-weight: 650;
    font-size: .95rem;
    cursor: pointer;
    box-shadow: 0 6px 20px color-mix(in srgb, var(--primary) 35%, transparent), 0 2px 6px rgba(0, 0, 0, .12);
}

.fab:hover {
    filter: brightness(.97);
}

.no-nav ~ .fab, .fab.low {
    bottom: calc(20px + env(safe-area-inset-bottom));
}

/* ---------- Typography helpers ---------- */
.section-title {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 1.08rem;
    font-weight: 700;
    letter-spacing: -.015em;
    margin: 26px 4px 10px;
}

.section-title:first-child {
    margin-top: 4px;
}

.section-title .count {
    font-size: .76rem;
    font-weight: 650;
    color: var(--on-primary-container);
    background: var(--primary-container);
    border-radius: 999px;
    padding: 1px 8px;
}

.section-title .grow + .btn {
    margin: -6px 0;
}

.lead {
    font-size: .92rem;
    margin: 0 0 12px;
}

.helper {
    font-size: .8rem;
    color: var(--muted);
    margin: 6px 4px 0;
}

/* ---------- Card & list row ---------- */
.card {
    background: var(--surface-1);
    border-radius: 20px;
    border: 1px solid var(--card-border);
    box-shadow: var(--card-shadow);
    width: 100%;
    text-align: left;
    color: inherit;
    display: block;
    padding: 0;
    position: relative;
    overflow: hidden;
}

.card.clickable, button.card {
    cursor: pointer;
    transition: background .15s;
}

.card.clickable:hover, button.card:hover {
    border-color: color-mix(in srgb, var(--primary) 30%, transparent);
}

.card.clickable:active, button.card:active {
    transform: scale(.995);
}

.list-row {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 12px 6px 12px 14px;
    min-height: 64px;
    width: 100%;
    background: transparent;
    border: 0;
    text-align: left;
    color: inherit;
    text-decoration: none;
}

button.list-row, a.list-row {
    cursor: pointer;
}

.list-row .body {
    flex: 1;
    min-width: 0;
}

.list-row .title {
    font-size: 1rem;
    font-weight: 600;
    letter-spacing: -.01em;
    margin: 0;
    overflow-wrap: anywhere;
    line-height: 1.3;
}

.list-row .sub {
    font-size: .84rem;
    color: var(--muted);
    margin-top: 2px;
    overflow-wrap: anywhere;
}

.list-row .meta {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-top: 6px;
}

.list-row .trail {
    display: flex;
    align-items: center;
    color: var(--muted);
}

.list-row.big {
    padding: 16px 6px 16px 16px;
}

.list-row.big .title {
    font-size: 1.12rem;
    font-weight: 650;
}

.list-row.done .title {
    text-decoration: line-through;
    text-decoration-thickness: 1.5px;
    color: var(--muted);
}

.list-row.danger, .list-row.danger .tile {
    color: var(--danger);
}

.list-row.danger .tile {
    background: var(--danger-container);
    color: var(--on-danger-container);
}

.group {
    background: var(--surface-1);
    border-radius: 20px;
    overflow: hidden;
    border: 1px solid var(--card-border);
    box-shadow: var(--card-shadow);
}

.group > .list-row + .list-row {
    border-top: 1px solid var(--outline-variant);
}

.group > button.list-row:hover, .group > a.list-row:hover {
    background: var(--surface-2);
}

/* Leading tile: same container for pictograms and Material icons */
.tile {
    width: 44px;
    height: 44px;
    border-radius: var(--r-md);
    background: var(--primary-container);
    color: var(--on-primary-container);
    display: grid;
    place-items: center;
    flex: none;
}

.tile svg.pic {
    width: 28px;
    height: 28px;
}

.tile .ic {
    width: 22px;
    height: 22px;
}

.tile-lg {
    width: 56px;
    height: 56px;
    border-radius: var(--r-lg);
}

.tile-lg svg.pic {
    width: 34px;
    height: 34px;
}

.tile-xl {
    width: 80px;
    height: 80px;
    border-radius: 24px;
}

.tile-xl svg.pic {
    width: 46px;
    height: 46px;
}

.tile-xl .ic {
    width: 36px;
    height: 36px;
}

.tile-sm {
    width: 36px;
    height: 36px;
    border-radius: 10px;
}

.tile-sm svg.pic {
    width: 22px;
    height: 22px;
}

.tile-sm .ic {
    width: 20px;
    height: 20px;
}

/* Status chip */
.status {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    height: 24px;
    padding: 0 9px;
    border-radius: 999px;
    font-size: .75rem;
    font-weight: 650;
    letter-spacing: 0;
    white-space: nowrap;
}

.status .ic {
    width: 14px;
    height: 14px;
}

.status.danger {
    background: var(--danger-container);
    color: var(--on-danger-container);
}

.status.warn {
    background: var(--warn-container);
    color: var(--on-warn-container);
}

.status.ok {
    background: var(--primary-container);
    color: var(--on-primary-container);
}

.status.neutral {
    background: var(--surface-2);
    color: var(--muted);
}

.status.neutral {
    background: var(--surface-2);
}

/* Recipe card */
.recipe-card .cover {
    height: 168px;
    background: var(--surface-2) center/cover no-repeat;
}

.recipe-card .list-row {
    padding-top: 10px;
}

.hero-img {
    margin: -16px -16px 16px;
    height: 220px;
    background: var(--surface-2) center/cover no-repeat;
}

.meta-row {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
    margin: 4px 0 6px;
}

/* Numbered steps (procedure) */
.step {
    display: flex;
    gap: 14px;
    padding: 12px 14px;
    align-items: flex-start;
}

.step .num {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: var(--primary-container);
    color: var(--on-primary-container);
    display: grid;
    place-items: center;
    font-weight: 700;
    font-size: .85rem;
    flex: none;
}

.step p {
    margin: 3px 0 0;
    font-size: .93rem;
}

.group > .step + .step {
    border-top: 1px solid var(--outline-variant);
}

/* ---------- Banner ---------- */
.banner {
    display: flex;
    gap: 12px;
    border-radius: 20px;
    padding: 14px 14px 8px 16px;
    margin-bottom: 12px;
}

.banner > .ic {
    margin-top: 1px;
}

.banner .b-body {
    flex: 1;
    min-width: 0;
}

.banner h3 {
    margin: 0 0 4px;
    font-size: 1rem;
    font-weight: 600;
}

.banner p {
    margin: 0;
    font-size: .88rem;
    line-height: 1.45;
}

.banner .b-actions {
    display: flex;
    justify-content: flex-end;
    gap: 4px;
    margin: 6px -6px 0 0;
    flex-wrap: wrap;
}

.banner .btn-text {
    color: inherit;
}

.banner.danger {
    background: var(--danger-container);
    color: var(--on-danger-container);
}

.banner.warn {
    background: var(--warn-container);
    color: var(--on-warn-container);
}

.banner.info {
    background: var(--primary-container);
    color: var(--on-primary-container);
}

.banner.danger .btn-filled {
    background: var(--danger);
    color: #fff;
}

.banner.warn .btn-filled {
    background: var(--warn);
    color: #fff;
}

@media (prefers-color-scheme: dark) {
    :root:not([data-theme="light"]) .banner.danger .btn-filled, :root:not([data-theme="light"]) .banner.warn .btn-filled {
        color: #1A1C19;
    }
}

:root[data-theme="dark"] .banner.danger .btn-filled, :root[data-theme="dark"] .banner.warn .btn-filled {
    color: #1A1C19;
}

.banner.info .btn-filled {
    background: var(--primary);
    color: var(--on-primary);
}

/* ---------- Buttons ---------- */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    border: 0;
    border-radius: 999px;
    padding: 0 22px;
    height: 42px;
    font-weight: 650;
    letter-spacing: -.005em;
    font-size: .9rem;
    cursor: pointer;
    transition: filter .15s, background .15s;
    white-space: nowrap;
}

.btn .ic {
    width: 18px;
    height: 18px;
    margin-left: -4px;
}

.btn-filled {
    background: var(--primary);
    color: var(--on-primary);
}

.btn-filled:hover {
    filter: brightness(1.06);
    box-shadow: var(--shadow-1);
}

.btn-tonal {
    background: var(--primary-container);
    color: var(--on-primary-container);
}

.btn-tonal:hover {
    filter: brightness(.97);
}

.btn-outline {
    background: transparent;
    color: var(--primary);
    box-shadow: inset 0 0 0 1px var(--outline);
}

.btn-outline:hover, .btn-text:hover {
    background: color-mix(in srgb, var(--primary) 10%, transparent);
}

.btn-text {
    background: transparent;
    color: var(--primary);
    padding: 0 12px;
}

.btn-danger {
    background: var(--danger);
    color: #fff;
}

.btn-danger-text {
    background: transparent;
    color: var(--danger);
    padding: 0 12px;
}

.btn-danger-text:hover {
    background: color-mix(in srgb, var(--danger) 10%, transparent);
}

.btn:disabled {
    opacity: .45;
    cursor: default;
    filter: none;
    box-shadow: none;
}

.btn.loading {
    position: relative;
    color: transparent !important;
}

.btn.loading .ic {
    opacity: 0;
}

.btn.loading::after {
    content: '';
    position: absolute;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    border: 2px solid var(--on-primary);
    border-right-color: transparent;
    animation: spin .7s linear infinite;
}

.btn-text.loading::after, .btn-outline.loading::after, .btn-tonal.loading::after {
    border-color: var(--primary);
    border-right-color: transparent;
}

.btn-block {
    width: 100%;
    height: 48px;
}

.btn-row {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    margin: 12px 0;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

.icon-btn {
    border: 0;
    background: transparent;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: grid;
    place-items: center;
    cursor: pointer;
    color: inherit;
    flex: none;
}

.icon-btn:hover {
    background: color-mix(in srgb, currentColor 10%, transparent);
}

.icon-btn.sm {
    width: 36px;
    height: 36px;
}

.icon-btn.sm .ic {
    width: 20px;
    height: 20px;
}

.icon-btn.tonal {
    background: var(--primary-container);
    color: var(--on-primary-container);
}

.icon-btn.fav-on {
    color: #D93025;
}

.appbar .icon-btn.fav-on {
    color: #D93025;
}

/* ---------- Text fields (outlined) ---------- */
.field {
    position: relative;
    margin: 12px 0;
}

.field .input {
    width: 100%;
    border: 1px solid transparent;
    border-radius: 14px;
    background: var(--surface-2);
    padding: 18px 14px 7px;
    min-height: 56px;
    outline: none;
    font-size: .98rem;
    transition: border-color .15s, background .15s;
}

.field .input:hover {
    background: var(--surface-3);
}

.field textarea.input {
    resize: vertical;
    min-height: 88px;
    padding-top: 20px;
}

.field select.input {
    appearance: none;
    padding-right: 40px;
    cursor: pointer;
}

.field .chev {
    position: absolute;
    right: 12px;
    top: 15px;
    pointer-events: none;
    color: var(--muted);
}

.field select.input option {
    background: var(--surface);
    color: var(--text);
}

.field label {
    position: absolute;
    left: 14px;
    top: 16px;
    color: var(--muted);
    pointer-events: none;
    transition: all .15s;
    font-size: .98rem;
    max-width: calc(100% - 28px);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.field .input:focus {
    border-color: var(--primary);
    background: var(--surface);
    box-shadow: 0 0 0 3px color-mix(in srgb, var(--primary) 18%, transparent);
}

.field .input:focus + label, .field .input:not(:placeholder-shown) + label, .field select.input + label, .field input[type=date].input + label {
    top: 7px;
    font-size: .72rem;
    font-weight: 600;
}

.field .input:focus + label {
    color: var(--primary);
}

.field .input[readonly] {
    background: transparent;
    border-color: var(--outline-variant);
}

.field .hint {
    font-size: .76rem;
    margin: 4px 14px 0;
    color: var(--muted);
}

.field-row {
    display: flex;
    gap: 10px;
}

.field-row > .field {
    flex: 1;
    min-width: 0;
}

.check {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 10px 2px;
    cursor: pointer;
    font-size: .95rem;
}

.check input {
    width: 20px;
    height: 20px;
    accent-color: var(--primary);
    flex: none;
    margin: 0;
}

.check.right {
    justify-content: space-between;
}

.label {
    font-size: .78rem;
    font-weight: 600;
    color: var(--muted);
    margin: 14px 2px 6px;
}

/* Search bar */
.searchbar {
    display: flex;
    align-items: center;
    gap: 4px;
    background: var(--surface-1);
    border: 1px solid var(--card-border);
    box-shadow: var(--card-shadow);
    border-radius: var(--r-xl);
    height: 52px;
    padding: 0 6px 0 16px;
    margin-bottom: 4px;
}

.searchbar > .ic {
    color: var(--muted);
}

.searchbar input {
    flex: 1;
    min-width: 0;
    border: 0;
    background: transparent;
    outline: none;
    height: 100%;
    padding: 0 8px;
    font-size: 1rem;
}

.searchbar:focus-within {
    box-shadow: inset 0 0 0 2px var(--primary);
}

.sheet .searchbar {
    background: var(--surface-2);
    box-shadow: none;
    border-color: transparent;
}

/* Segmented button */
.seg {
    display: flex;
    gap: 4px;
    background: var(--surface-2);
    border-radius: 14px;
    padding: 4px;
    margin: 12px 0;
    height: 44px;
}

.seg button {
    flex: 1;
    border: 0;
    background: transparent;
    border-radius: 10px;
    padding: 0 6px;
    color: var(--muted);
    cursor: pointer;
    font-size: .84rem;
    font-weight: 500;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 4px;
    min-width: 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.seg button.sel {
    background: var(--surface);
    color: var(--text);
    font-weight: 650;
    box-shadow: 0 1px 3px rgba(0, 0, 0, .1);
}

.seg button .ic {
    width: 16px;
    height: 16px;
}

/* Filter / input chips */
.chips {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin: 8px 0;
}

.chip {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    border: 1px solid var(--outline-variant);
    background: var(--surface-1);
    border-radius: 999px;
    height: 32px;
    padding: 0 12px;
    font-size: .84rem;
    font-weight: 500;
    cursor: pointer;
    color: inherit;
}

.chip.sel {
    background: var(--primary-container);
    border-color: transparent;
    color: var(--on-primary-container);
}

.chip .ic {
    width: 16px;
    height: 16px;
}

.chip .x {
    display: inline-grid;
    margin-right: -6px;
    opacity: .7;
}

/* Read-only detail rows (product / list item detail) */
.details {
    background: var(--surface-2);
    border-radius: var(--r-lg);
    padding: 4px 16px;
    margin-bottom: 12px;
}

.details .d {
    display: flex;
    justify-content: space-between;
    gap: 16px;
    padding: 11px 0;
    font-size: .92rem;
}

.details .d + .d {
    border-top: 1px solid var(--outline-variant);
}

.details .d span:first-child {
    color: var(--muted);
}

.details .d span:last-child {
    font-weight: 600;
    text-align: right;
    overflow-wrap: anywhere;
}

/* ---------- Bottom sheet ---------- */
.sheet-backdrop {
    position: fixed;
    inset: 0;
    z-index: 100;
    background: rgba(0, 0, 0, 0);
    display: flex;
    align-items: flex-end;
    justify-content: center;
    transition: background .22s;
}

.sheet-backdrop.open {
    background: var(--scrim);
}

.sheet {
    width: 100%;
    max-width: 640px;
    max-height: 92vh;
    max-height: 92dvh;
    background: var(--surface);
    border-radius: var(--r-xl) var(--r-xl) 0 0;
    padding: 0 20px calc(14px + env(safe-area-inset-bottom));
    display: flex;
    flex-direction: column;
    transform: translateY(100%);
    transition: transform .24s cubic-bezier(.2, .8, .2, 1);
}

.sheet-backdrop.open .sheet {
    transform: translateY(0);
}

.sheet-handle {
    width: 32px;
    height: 4px;
    border-radius: 2px;
    background: var(--outline);
    opacity: .6;
    margin: 0 auto;
    padding: 11px 24px;
    background-clip: content-box;
    box-sizing: content-box;
    cursor: grab;
    touch-action: none;
}

.sheet-title {
    font-size: 1.3rem;
    font-weight: 700;
    letter-spacing: -.02em;
    margin: 2px 0 14px;
    text-align: left;
}

.sheet-body {
    overflow-y: auto;
    overflow-x: hidden;
    flex: 1;
    padding: 2px;
    margin: 0 -2px;
    min-width: 0;
}

.sheet-text {
    margin: 0 0 12px;
    font-size: .92rem;
    color: var(--muted);
}

.sheet-actions {
    display: flex;
    justify-content: flex-end;
    align-items: center;
    gap: 8px;
    padding-top: 14px;
    flex-wrap: wrap;
}

.sheet-actions .btn-danger-text, .sheet-actions .push-left {
    margin-right: auto;
}

.menu {
    margin: 0;
}

.menu-item {
    display: flex;
    align-items: center;
    gap: 16px;
    width: 100%;
    min-width: 0;
    border: 0;
    background: transparent;
    padding: 0 12px;
    height: 52px;
    font-size: 1rem;
    cursor: pointer;
    border-radius: var(--r-md);
    text-align: left;
}

.menu-item:hover {
    background: var(--surface-2);
}

.menu-item .ic {
    color: var(--muted);
}

.menu-item.danger, .menu-item.danger .ic {
    color: var(--danger);
}

.menu-item.selected {
    font-weight: 600;
    color: var(--primary);
}

.menu-item.selected .ic {
    color: var(--primary);
}

.menu-item span {
    flex: 1;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.pick-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-top: 12px;
}

/* ---------- Empty state ---------- */
.empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    padding: 32px 16px 20px;
    gap: 10px;
}

.empty .tile-xl {
    background: var(--surface-2);
    color: var(--muted);
}

.empty strong {
    font-size: 1.05rem;
    font-weight: 600;
}

.empty p {
    margin: 0;
    font-size: .9rem;
    color: var(--muted);
    max-width: 340px;
}

/* ---------- Auth ---------- */
.auth {
    min-height: 100vh;
    min-height: 100dvh;
    display: flex;
    flex-direction: column;
}

.auth-top {
    color: var(--text);
    padding: calc(env(safe-area-inset-top) + 56px) 24px 28px;
    text-align: center;
    background: radial-gradient(120% 90% at 50% 0%, color-mix(in srgb, var(--brand) 26%, transparent) 0%, transparent 70%);
}

.auth-top .logo {
    width: 84px;
    height: 84px;
    border-radius: 26px;
    display: grid;
    place-items: center;
    margin: 0 auto;
    background: var(--surface);
    box-shadow: 0 8px 28px color-mix(in srgb, var(--brand) 30%, transparent);
}

.auth-top .logo img {
    width: 52px;
    height: 52px;
}

.auth-top h1 {
    margin: 18px 0 4px;
    font-size: 2rem;
    font-weight: 750;
    letter-spacing: -.03em;
}

.auth-top p {
    margin: 0;
    color: var(--muted);
}

.auth-body {
    padding: 20px 20px 40px;
    max-width: 460px;
    width: 100%;
    margin: 0 auto;
}

.divider-text {
    display: flex;
    align-items: center;
    gap: 12px;
    color: var(--muted);
    font-size: .82rem;
    margin: 18px 0 6px;
}

.divider-text::before, .divider-text::after {
    content: '';
    flex: 1;
    height: 1px;
    background: var(--outline-variant);
}

.google-slot {
    display: flex;
    justify-content: center;
    min-height: 44px;
    margin: 8px 0;
}

.features {
    margin: 24px 0 0;
    padding: 0;
    list-style: none;
    display: grid;
    gap: 12px;
}

.features li {
    display: flex;
    gap: 14px;
    align-items: center;
    font-size: .9rem;
}

.err-box {
    display: flex;
    gap: 10px;
    align-items: flex-start;
    background: var(--danger-container);
    color: var(--on-danger-container);
    border-radius: var(--r-md);
    padding: 10px 12px;
    font-size: .9rem;
    margin: 8px 0;
}

.err-box .ic {
    width: 20px;
    height: 20px;
}

.code-box {
    font-family: ui-monospace, Menlo, Consolas, monospace;
    font-size: 1.6rem;
    letter-spacing: .18em;
    text-align: center;
    background: var(--surface-2);
    border-radius: var(--r-lg);
    padding: 16px;
    font-weight: 700;
    user-select: all;
}

/* ---------- Snackbar & loader ---------- */
#toast {
    position: fixed;
    left: 50%;
    bottom: calc(var(--nav-h) + 90px + env(safe-area-inset-bottom));
    transform: translate(-50%, 24px);
    opacity: 0;
    pointer-events: none;
    z-index: 200;
    background: #2F312D;
    color: #F0F1EC;
    padding: 0 8px 0 16px;
    min-height: 48px;
    border-radius: var(--r-sm);
    box-shadow: var(--shadow-3);
    transition: all .2s;
    display: flex;
    align-items: center;
    gap: 8px;
    max-width: min(560px, calc(100vw - 32px));
    width: max-content;
    font-size: .9rem;
}

#toast span {
    padding: 12px 8px 12px 0;
}

#toast.show {
    opacity: 1;
    transform: translate(-50%, 0);
    pointer-events: auto;
}

#toast.error {
    background: var(--danger);
    color: #fff;
}

#toast button {
    background: transparent;
    border: 0;
    color: #FFB1C8;
    font-weight: 700;
    cursor: pointer;
    font-size: .88rem;
    padding: 8px;
}

.loader {
    display: grid;
    place-items: center;
    min-height: 60vh;
}

.loader::after {
    content: '';
    width: 36px;
    height: 36px;
    border-radius: 50%;
    border: 3px solid var(--primary);
    border-right-color: transparent;
    animation: spin .8s linear infinite;
}

/* ---------- Skeleton loader (shimmer) ---------- */
@keyframes skeleton-shimmer {
    0% {
        background-position: -200% 0;
    }
    100% {
        background-position: 200% 0;
    }
}

.skeleton {
    background: linear-gradient(90deg, var(--surface-2) 20%, var(--surface-3) 50%, var(--surface-2) 80%);
    background-size: 200% 100%;
    animation: skeleton-shimmer 1.5s ease-in-out infinite;
    border-radius: var(--r-sm);
    display: block;
}

.sk-line {
    height: 13px;
    border-radius: 6px;
}

.sk-line.w-80 {
    width: 80%;
}

.sk-line.w-60 {
    width: 60%;
}

.sk-line.w-40 {
    width: 40%;
}

.sk-line.w-30 {
    width: 30%;
}

.sk-title {
    height: 20px;
    width: 45%;
    border-radius: 8px;
    margin-bottom: 6px;
}

.sk-tile {
    width: 44px;
    height: 44px;
    border-radius: var(--r-md);
    flex-shrink: 0;
}

.sk-tile.lg {
    width: 56px;
    height: 56px;
}

.sk-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    flex-shrink: 0;
}

.sk-chip {
    height: 26px;
    width: 64px;
    border-radius: 999px;
    flex-shrink: 0;
}

.sk-card {
    background: var(--surface-1);
    border: 1px solid var(--card-border);
    border-radius: var(--r-lg);
    padding: 14px 16px;
    display: flex;
    align-items: center;
    gap: 14px;
    box-shadow: var(--card-shadow);
}

.sk-card .sk-body {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 6px;
    min-width: 0;
}

.sk-banner {
    background: var(--surface-1);
    border: 1px solid var(--card-border);
    border-radius: var(--r-xl);
    padding: 16px 18px;
    display: flex;
    gap: 14px;
    align-items: center;
    box-shadow: var(--card-shadow);
    margin-bottom: 16px;
}

.sk-stack {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.sk-view {
    padding: 0 16px 24px;
    max-width: 960px;
    margin: 0 auto;
    width: 100%;
    box-sizing: border-box;
}

.sk-appbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 0;
    margin-bottom: 8px;
}

@media (prefers-reduced-motion: reduce) {
    * {
        transition: none !important;
        animation-duration: .01s !important;
    }
}

/* Misc components */
.page-title {
    margin: 0 0 6px;
    font-size: 1.55rem;
    font-weight: 750;
    letter-spacing: -.025em;
    line-height: 1.2;
}

.tile.photo {
    background-size: cover;
    background-position: center;
}

.chips.scroll {
    flex-wrap: nowrap;
    overflow-x: auto;
    margin: 10px -16px 4px;
    padding: 0 16px;
    scrollbar-width: none;
}

.chips.scroll::-webkit-scrollbar {
    display: none;
}

.chips.scroll .chip {
    flex: none;
}

.switch {
    width: 44px;
    height: 26px;
    border-radius: 999px;
    background: var(--surface-3);
    position: relative;
    transition: background .2s;
    margin-right: 10px;
    box-shadow: inset 0 0 0 1.5px var(--outline);
}

.switch::after {
    content: '';
    position: absolute;
    top: 5px;
    left: 5px;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: var(--outline);
    transition: all .2s;
}

.switch.on {
    background: var(--primary);
    box-shadow: none;
}

.switch.on::after {
    left: 23px;
    top: 3px;
    width: 20px;
    height: 20px;
    background: var(--on-primary);
}

/* ---------- Tutorial ---------- */
.tour-ovl {
    position: fixed;
    inset: 0;
    z-index: 150;
    background: var(--scrim);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 16px;
    opacity: 0;
    transition: opacity .2s;
}

.tour-ovl.open {
    opacity: 1;
}

.tour {
    width: 100%;
    max-width: 420px;
    max-height: calc(100dvh - 32px);
    background: var(--surface);
    border-radius: 28px;
    padding: 14px 20px calc(18px + env(safe-area-inset-bottom));
    display: flex;
    flex-direction: column;
    box-shadow: 0 24px 64px rgba(0, 0, 0, .3);
    transform: translateY(12px);
    transition: transform .2s;
    overflow: hidden;
}

.tour-ovl.open .tour {
    transform: none;
}

@media (max-width: 480px) {
    .tour-ovl {
        padding: 0;
        align-items: stretch;
    }

    .tour {
        max-width: none;
        max-height: none;
        border-radius: 0;
        padding-top: calc(14px + env(safe-area-inset-top));
    }
}

.tour-top {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 8px;
    min-height: 40px;
    margin-bottom: 10px;
}

.tour-lang {
    margin: 0;
    height: 36px;
    flex: 0 1 auto;
}

.tour-lang button {
    padding: 0 10px;
}

.tour-stage {
    flex: 1;
    overflow-y: auto;
    touch-action: pan-y;
}

.tour-slide {
    animation: tourIn .25s ease;
    text-align: center;
}

@keyframes tourIn {
    from {
        opacity: 0;
        transform: translateX(16px);
    }
}

.tour-slide h2 {
    font-size: 1.4rem;
    font-weight: 750;
    letter-spacing: -.02em;
    margin: 18px 0 8px;
}

.tour-slide p {
    margin: 0 auto;
    color: var(--muted);
    max-width: 340px;
}

.illo {
    position: relative;
    height: 230px;
    border-radius: 22px;
    background: radial-gradient(120% 100% at 50% 0%, var(--primary-container), var(--surface-2));
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    padding: 16px;
}

.illo.col {
    flex-direction: column;
    gap: 8px;
}

.tour-logo {
    width: 104px;
    height: 104px;
    border-radius: 30px;
    background: var(--surface);
    display: grid;
    place-items: center;
    box-shadow: 0 10px 30px color-mix(in srgb, var(--brand) 35%, transparent);
}

.tour-logo img {
    width: 66px;
    height: 66px;
    border-radius: 16px;
}

.illo .float {
    position: absolute;
    animation: bob 3s ease-in-out infinite;
}

.illo .float .tile, .illo .float .occ {
    box-shadow: var(--shadow-1);
}

.illo .float .tile {
    background: var(--surface);
}

.illo .f1 {
    left: 16%;
    top: 18%;
}

.illo .f2 {
    right: 16%;
    top: 22%;
    animation-delay: .6s;
}

.illo .f3 {
    left: 22%;
    bottom: 16%;
    animation-delay: 1.2s;
}

.illo .f4 {
    right: 20%;
    bottom: 18%;
    animation-delay: 1.8s;
}

@keyframes bob {
    50% {
        transform: translateY(-8px);
    }
}

.tour-card {
    display: flex;
    align-items: center;
    gap: 10px;
    width: 100%;
    max-width: 300px;
    background: var(--surface);
    border-radius: 16px;
    padding: 8px 12px 8px 8px;
    box-shadow: var(--shadow-1);
    text-align: left;
}

.tour-card > div {
    flex: 1;
    min-width: 0;
}

.tour-card strong {
    display: block;
    font-size: .9rem;
}

.tour-card small {
    color: var(--muted);
    font-size: .74rem;
}

.tour-card .meta {
    margin-top: 3px;
    display: flex;
    gap: 4px;
    flex-wrap: wrap;
}

.tour-card .status {
    height: 20px;
    font-size: .68rem;
}

.tour-card > .ic {
    color: var(--primary);
}

.tour-card.done strong {
    text-decoration: line-through;
    color: var(--muted);
}

.tour-card .tile, .tour-card .occ, .tour-card .thumb {
    width: 38px;
    height: 38px;
    border-radius: 11px;
}

.tour-card .occ .ic, .tour-card .thumb .ic {
    width: 20px;
    height: 20px;
}

.tour-card .star {
    display: inline-flex;
    color: #E0A100;
    vertical-align: -2px;
    margin-right: 4px;
}

.tour-card .star .ic {
    width: 15px;
    height: 15px;
}

.tour-pill {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: var(--primary);
    color: var(--on-primary);
    border-radius: 999px;
    padding: 6px 14px;
    font-weight: 650;
    font-size: .82rem;
    text-decoration: none;
}

a.tour-pill:hover {
    filter: brightness(1.06);
}

.tour-pill .ic {
    width: 18px;
    height: 18px;
}

.tour-banner {
    width: 100%;
    max-width: 320px;
    margin: 0;
    text-align: left;
    padding: 10px 12px;
}

.tour-banner h3 {
    font-size: .86rem;
}

.tour-banner p {
    font-size: .76rem;
    margin: 2px 0 0;
    max-width: none;
}

.tour-avatars {
    display: flex;
}

.tour-avatars .avatar {
    width: 54px;
    height: 54px;
    font-size: 1rem;
    border: 3px solid var(--surface);
    margin-left: -12px;
}

.tour-avatars .avatar:first-child {
    margin-left: 0;
}

.tour-chat {
    display: flex;
    flex-direction: column;
    gap: 6px;
    width: 100%;
    max-width: 300px;
    text-align: left;
}

.tour-chat .msg {
    max-width: 86%;
}

.tour-chat .bubble {
    background: var(--surface);
    box-shadow: var(--shadow-1);
    padding: 6px 11px;
}

.tour-chat .msg.mine .bubble {
    background: var(--primary);
    color: var(--on-primary);
}

.tour-chat .bubble p {
    font-size: .82rem;
    margin: 0;
    color: inherit;
    max-width: none;
}

.tour-dots {
    display: flex;
    justify-content: center;
    gap: 6px;
    margin: 18px 0 14px;
}

.tour-dots button {
    width: 8px;
    height: 8px;
    border-radius: 999px;
    border: 0;
    background: var(--outline-variant);
    padding: 0;
    cursor: pointer;
    transition: width .2s, background .2s;
}

.tour-dots button.on {
    width: 24px;
    background: var(--primary);
}

.tour-actions {
    display: flex;
    justify-content: space-between;
    gap: 8px;
}

.tour-actions .btn-filled {
    min-width: 140px;
    height: 46px;
}

/* ---------- Wide screens (desktop, landscape tablets) ----------
 * Navigation drawer on the left instead of the bottom bar, main action in the app bar,
 * cards in responsive grids, bottom sheets shown as centred dialogs. */
.sidenav {
    display: none;
}

.content {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
}

.recipe-layout, .week-grid {
    display: block;
}

.desk-only {
    display: none !important;
}

@media (min-width: 960px) {
    body {
        background: var(--bg);
    }

    #app {
        max-width: none;
        flex-direction: row;
        box-shadow: none;
    }

    .content {
        max-width: 1280px;
        margin: 0 auto;
        width: 100%;
    }

    .bottomnav {
        display: none;
    }

    .desk-only {
        display: grid !important;
    }

    .mob-only {
        display: none !important;
    }

    .sidenav {
        display: flex;
        flex-direction: column;
        gap: 4px;
        position: sticky;
        top: 0;
        height: 100vh;
        height: 100dvh;
        width: 272px;
        flex: none;
        z-index: 30;
        padding: 20px 14px 16px;
        background: var(--surface-1);
        border-right: 1px solid var(--outline-variant);
        overflow-y: auto;
    }

    .sn-brand {
        display: flex;
        align-items: center;
        gap: 10px;
        padding: 4px 12px 14px;
        color: var(--text);
        text-decoration: none;
        font-size: 1.2rem;
        letter-spacing: -.02em;
    }

    .sn-brand img {
        width: 30px;
        height: 30px;
    }

    .sn-household {
        display: flex;
        align-items: center;
        gap: 10px;
        width: 100%;
        border: 0;
        border-radius: var(--r-lg);
        background: var(--primary-container);
        color: var(--on-primary-container);
        padding: 9px 12px;
        cursor: pointer;
        text-align: left;
        margin-bottom: 10px;
    }

    .sn-household:hover {
        filter: brightness(.97);
    }

    .sn-household small {
        display: block;
        font-size: .7rem;
        font-weight: 600;
        opacity: .75;
    }

    .sn-household span span, .sn-household .grow > span {
        display: block;
        font-weight: 650;
        font-size: .9rem;
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
    }

    .sn-links {
        display: flex;
        flex-direction: column;
        gap: 2px;
    }

    .sn-link {
        display: flex;
        align-items: center;
        gap: 14px;
        height: 48px;
        padding: 0 14px;
        border-radius: 999px;
        color: var(--muted);
        text-decoration: none;
        font-weight: 600;
        font-size: .95rem;
        transition: background .15s, color .15s;
    }

    .sn-link:hover {
        background: var(--surface-2);
        color: var(--text);
    }

    .sn-link.active {
        background: var(--primary-container);
        color: var(--on-primary-container);
    }

    .sn-link span:nth-child(2) {
        flex: 1;
    }

    .sn-badge {
        min-width: 22px;
        height: 22px;
        border-radius: 999px;
        padding: 0 7px;
        display: grid;
        place-items: center;
        font-size: .72rem;
        font-weight: 700;
        background: var(--surface-3);
        color: var(--text);
    }

    .sn-badge.warn {
        background: var(--warn-container);
        color: var(--on-warn-container);
    }

    .sn-user {
        display: flex;
        align-items: center;
        gap: 12px;
        padding: 10px;
        border-radius: var(--r-lg);
        color: inherit;
        text-decoration: none;
        border: 1px solid var(--outline-variant);
    }

    .sn-user:hover, .sn-user.active {
        background: var(--surface-2);
    }

    .sn-user strong, .sn-user small {
        display: block;
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
    }

    .sn-user strong {
        font-size: .9rem;
    }

    .sn-user small {
        font-size: .75rem;
        color: var(--muted);
    }

    .sn-user > .ic {
        color: var(--muted);
    }

    .appbar {
        padding: 26px 32px 16px;
        min-height: 92px;
        align-items: center;
        gap: 8px;
    }

    .appbar .brand, .appbar > .avatar {
        display: none;
    }

    .appbar h1 {
        margin: 0;
        font-size: 2rem;
    }

    .appbar.small {
        padding-left: 22px;
    }

    .appbar.small h1 {
        font-size: 1.6rem;
        font-weight: 700;
        margin-left: 6px;
    }

    .appbar .fab {
        position: static;
        height: 44px;
        padding: 0 20px 0 16px;
        border-radius: 999px;
        font-size: .9rem;
        box-shadow: none;
        margin-left: 8px;
    }

    .appbar .fab .ic {
        width: 20px;
        height: 20px;
    }

    .appbar .fab:hover {
        box-shadow: var(--shadow-1);
        filter: brightness(1.06);
    }

    main.view, main.view.no-nav, main.view.no-fab {
        padding: 6px 32px 56px;
    }

    main.view.narrow {
        max-width: 820px;
        width: 100%;
    }

    main.view .stack {
        display: grid;
        grid-template-columns: repeat(auto-fill, minmax(330px, 1fr));
        gap: 14px;
    }

    main.view .stack:has(> .recipe-card) {
        grid-template-columns: repeat(auto-fill, minmax(290px, 1fr));
    }

    .recipe-card {
        display: flex;
        flex-direction: column;
    }

    .recipe-card .cover {
        height: 180px;
    }

    .recipe-card .list-row {
        flex: 1;
        align-items: flex-start;
    }

    .searchbar {
        max-width: 720px;
    }

    .chips.scroll {
        margin-left: 0;
        margin-right: 0;
        padding: 0;
        flex-wrap: wrap;
    }

    .banner {
        max-width: 1000px;
    }

    .recipe-layout {
        display: grid;
        grid-template-columns: minmax(0, 1.05fr) minmax(0, 1fr);
        gap: 36px;
        align-items: start;
    }

    .recipe-layout .hero-img {
        margin: 0 0 18px;
        height: 320px;
        border-radius: 24px;
    }

    .recipe-layout .col-b {
        position: sticky;
        top: 104px;
    }

    .recipe-layout .col-b > .section-title:first-child {
        margin-top: 4px;
    }

    .week-grid {
        display: grid;
        grid-template-columns: repeat(auto-fill, minmax(230px, 1fr));
        gap: 14px;
    }

    .week-grid .day {
        margin: 0;
    }

    .week-nav {
        max-width: 520px;
    }

    /* Bottom sheets become centred dialogs */
    .sheet-backdrop {
        align-items: center;
        padding: 32px;
    }

    .sheet {
        max-width: 580px;
        max-height: 86vh;
        border-radius: var(--r-xl);
        padding: 22px 24px 18px;
        box-shadow: 0 24px 64px rgba(0, 0, 0, .28);
        opacity: 0;
        transform: translateY(14px) scale(.98);
        transition: transform .2s cubic-bezier(.2, .8, .2, 1), opacity .18s;
    }

    .sheet-backdrop.open .sheet {
        opacity: 1;
        transform: none;
    }

    .sheet-handle {
        display: none;
    }

    .sheet-title {
        margin-top: 0;
    }

    .sheet.menu-sheet {
        max-width: 400px;
        padding: 16px 12px 10px;
    }

    .sheet.menu-sheet .sheet-title {
        padding: 0 12px;
        font-size: 1.1rem;
    }

    .sheet.menu-sheet .menu-item {
        height: 46px;
        font-size: .95rem;
    }

    .sheet-backdrop.popover {
        display: block;
        padding: 0;
        background: transparent !important;
    }

    .sheet-backdrop.popover .sheet {
        position: fixed;
        width: 290px;
        max-width: calc(100vw - 24px);
        padding: 8px 6px;
        border-radius: var(--r-lg);
        border: 1px solid var(--outline-variant);
        box-shadow: 0 12px 32px rgba(0, 0, 0, .18);
        transform: scale(.96);
        transform-origin: top right;
        transition: transform .12s, opacity .12s;
    }

    .sheet-backdrop.popover.open .sheet {
        transform: none;
    }

    .sheet-backdrop.popover .sheet-title {
        font-size: .78rem;
        font-weight: 650;
        color: var(--muted);
        margin: 4px 12px 4px;
        padding: 0;
        letter-spacing: 0;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
    }

    .sheet-backdrop.popover .menu-item {
        height: 42px;
        font-size: .92rem;
        gap: 12px;
        padding: 0 12px;
    }

    .sheet-backdrop.popover .menu-item .ic {
        width: 20px;
        height: 20px;
    }

    #toast {
        bottom: 28px;
        left: calc(50% + 136px);
    }

    /* Sign-in: brand panel on the left, form on the right */
    .auth {
        flex: 1;
        flex-direction: row;
    }

    .auth-top {
        flex: 1.1;
        display: flex;
        flex-direction: column;
        justify-content: center;
        align-items: flex-start;
        text-align: left;
        padding: 64px 7vw;
        background: radial-gradient(110% 80% at 0% 0%, color-mix(in srgb, var(--brand) 30%, transparent) 0%, transparent 70%), var(--surface-1);
        border-right: 1px solid var(--outline-variant);
    }

    .auth-top .logo {
        margin: 0;
    }

    .auth-top h1 {
        font-size: 2.6rem;
    }

    .auth-top p {
        font-size: 1.05rem;
    }

    .auth-top .features {
        margin-top: 36px;
        max-width: 420px;
        gap: 16px;
    }

    .auth-top .features li {
        font-size: .98rem;
    }

    .auth-body {
        flex: 1;
        display: flex;
        flex-direction: column;
        justify-content: center;
        padding: 48px;
        max-width: 520px;
    }
}

@media (min-width: 1400px) {
    .sidenav {
        width: 300px;
    }
}

/* ---------- Tutorial animations ----------
 * Each slide's illustration animates in (staggered cards, popping chips) and then keeps a gentle loop
 * on one detail: the logo ring, occasion badges, link preview scan, invite pill, secret claim, chat bubbles. */
@keyframes ftPopIn {
    from {
        opacity: 0;
        transform: scale(.6);
    }
    70% {
        opacity: 1;
        transform: scale(1.06);
    }
    to {
        opacity: 1;
        transform: none;
    }
}

@keyframes ftRiseIn {
    from {
        opacity: 0;
        transform: translateY(18px);
    }
    to {
        opacity: 1;
        transform: none;
    }
}

@keyframes ftRing {
    from {
        transform: scale(.9);
        opacity: .55;
    }
    to {
        transform: scale(1.7);
        opacity: 0;
    }
}

@keyframes ftWiggle {
    0%, 45%, 100% {
        transform: rotate(0);
    }
    10% {
        transform: rotate(-14deg);
    }
    20% {
        transform: rotate(11deg);
    }
    30% {
        transform: rotate(-7deg);
    }
    38% {
        transform: rotate(3deg);
    }
}

@keyframes ftPulseWarn {
    0%, 100% {
        box-shadow: 0 0 0 0 color-mix(in srgb, var(--warn) 45%, transparent);
    }
    60% {
        box-shadow: 0 0 0 7px transparent;
    }
}

@keyframes ftPulse {
    0%, 100% {
        box-shadow: 0 0 0 0 color-mix(in srgb, var(--primary) 45%, transparent);
    }
    60% {
        box-shadow: 0 0 0 9px transparent;
    }
}

@keyframes ftScan {
    0%, 100% {
        left: 10px;
    }
    50% {
        left: calc(100% - 12px);
    }
}

@keyframes ftBounce {
    0%, 60%, 100% {
        transform: none;
    }
    20% {
        transform: translateY(-4px) rotate(-8deg);
    }
    40% {
        transform: translateY(0) rotate(4deg);
    }
}

.illo.col > * {
    animation: ftRiseIn .45s cubic-bezier(.2, .8, .2, 1) both;
}

.illo.col > :nth-child(2) {
    animation-delay: .12s;
}

.illo.col > :nth-child(3) {
    animation-delay: .24s;
}

.illo.col > :nth-child(4) {
    animation-delay: .36s;
}

.ill-welcome .tour-logo {
    position: relative;
    animation: ftPopIn .6s cubic-bezier(.2, .8, .2, 1) both;
}

.ill-welcome .tour-logo::before, .ill-welcome .tour-logo::after {
    content: '';
    position: absolute;
    inset: 0;
    border-radius: inherit;
    border: 2px solid var(--brand);
    animation: ftRing 2.6s ease-out .6s infinite;
    pointer-events: none;
}

.ill-welcome .tour-logo::after {
    animation-delay: 1.9s;
}

.ill-welcome .float .occ {
    animation: ftPopIn .5s cubic-bezier(.2, .8, .2, 1) both;
}

.ill-welcome .f1 .occ {
    animation-delay: .35s;
}

.ill-welcome .f2 .occ {
    animation-delay: .5s;
}

.ill-welcome .f3 .occ {
    animation-delay: .65s;
}

.ill-welcome .f4 .occ {
    animation-delay: .8s;
}

.ill-lists .tour-card .occ {
    animation: ftPopIn .45s cubic-bezier(.2, .8, .2, 1) both;
}

.ill-lists .tour-card:nth-child(1) .occ {
    animation-delay: .25s;
}

.ill-lists .tour-card:nth-child(2) .occ {
    animation-delay: .37s;
}

.ill-lists .tour-card:nth-child(3) .occ {
    animation-delay: .49s;
}

.ill-lists .tour-card .status {
    animation: ftPopIn .4s both;
    animation-delay: .6s;
}

.ill-wishes .status.warn {
    animation: ftPulseWarn 1.8s ease-in-out .7s infinite;
}

.ill-wishes .tour-pill {
    position: relative;
    overflow: hidden;
}

.ill-wishes .tour-pill::after {
    content: '';
    position: absolute;
    top: 5px;
    bottom: 5px;
    width: 2px;
    border-radius: 2px;
    background: rgba(255, 255, 255, .9);
    box-shadow: 0 0 8px 1px rgba(255, 255, 255, .8);
    animation: ftScan 2s ease-in-out .5s infinite;
}

.ill-friends .tour-avatars .avatar {
    animation: ftPopIn .45s cubic-bezier(.2, .8, .2, 1) both;
}

.ill-friends .tour-avatars .avatar:nth-child(1) {
    animation-delay: .15s;
}

.ill-friends .tour-avatars .avatar:nth-child(2) {
    animation-delay: .3s;
}

.ill-friends .tour-avatars .avatar:nth-child(3) {
    animation-delay: .45s;
}

.ill-friends .tour-pill {
    animation: ftRiseIn .45s cubic-bezier(.2, .8, .2, 1) .24s both, ftPulse 2.2s ease-in-out 1s infinite;
}

.ill-claim .status.taken {
    animation: ftPopIn .45s cubic-bezier(.2, .8, .2, 1) .45s both;
}

.ill-claim .status.warn {
    animation: ftPulseWarn 1.8s ease-in-out .7s infinite;
}

.ill-claim .tour-pill > .ic {
    animation: ftBounce 1.8s ease-in-out .8s infinite;
}

.ill-chat .tour-chat .msg {
    animation: ftRiseIn .45s cubic-bezier(.2, .8, .2, 1) both;
}

.ill-chat .tour-chat .msg:nth-child(1) {
    animation-delay: .15s;
}

.ill-chat .tour-chat .msg:nth-child(2) {
    animation-delay: .35s;
}

.ill-chat .banner > .ic {
    animation: ftWiggle 2.4s ease-in-out .7s infinite;
}

.ill-donate .tour-card .tile {
    animation: ftPopIn .45s cubic-bezier(.2, .8, .2, 1) both;
}

.ill-donate .tour-card:nth-child(1) .tile {
    animation-delay: .2s;
}

.ill-donate .tour-card:nth-child(2) .tile {
    animation-delay: .35s;
}

.ill-donate .tour-pill {
    animation: ftRiseIn .45s cubic-bezier(.2, .8, .2, 1) .24s both, ftPulse 2.2s ease-in-out 1s infinite;
}

@media (prefers-reduced-motion: reduce) {
    .illo *, .illo *::before, .illo *::after, .illo.col > * {
        animation: none !important;
    }
}

.sheet.tall {
    height: 92vh;
    height: 92dvh;
}

@media (min-width: 960px) {
    .sheet.tall {
        height: 82vh;
        max-width: 640px;
    }
}

.scan-detail {
    display: block;
    margin-top: 6px;
    font-size: .72rem;
    color: var(--muted);
    opacity: .8;
    font-family: ui-monospace, Menlo, Consolas, monospace;
    overflow-wrap: anywhere;
}

.sn-admin {
    border: 1px solid var(--outline-variant);
    margin-bottom: 8px;
    color: var(--text);
}

.sn-admin > .ic:last-child {
    width: 18px;
    height: 18px;
    color: var(--muted);
}

.sn-admin span {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.btn-google {
    width: 100%;
    max-width: 400px;
    height: 44px;
    background: var(--surface);
    color: var(--text);
    box-shadow: inset 0 0 0 1px var(--outline-variant);
    font-weight: 600;
}

.btn-google:hover {
    background: var(--surface-2);
}

.btn-google .g {
    display: inline-grid;
    margin-left: -4px;
}
