/* ════════════════════════════════════════════════════════════════════════
   Komisses — 4A "Moestuin" theme
   Loaded AFTER styles.css. Defines the colour tokens (light + dark) and maps
   the legacy variables onto them, then restyles the shell components.
   Token values mirror the design canvas (komisses-tokens.css).
   ════════════════════════════════════════════════════════════════════════ */

/* ── 1. Tokens ─────────────────────────────────────────────────────────── */
:root {
    color-scheme: light;
    --km-bg: #F4EEDD;
    --km-surface: #FFFFFF;
    --km-surface-2: #FBF7EC;
    --km-ink: #233127;
    --km-muted: #56634F;
    --km-muted-2: #7C8873;
    --km-line: #E2D9BF;
    --km-line-soft: #EFE8D6;
    --km-line-strong: #DCD2B6;
    --km-hl: #F1F7EC;

    --km-accent: #2F7A4C;
    --km-on-accent: #FFFFFF;
    --km-accent-ink: #1F5A36;
    --km-accent-soft: #CFE0C3;
    --km-accent-tint: #DCEBD3;

    --km-scrim: rgba(35, 49, 39, 0.42);
    --km-shadow: rgba(35, 49, 39, 0.18);
    --km-toast-bg: #233127;
    --km-toast-ink: #F4EEDD;
    --km-toast-action: #CFE0C3;
    --km-danger: #A3335A;

    --km-font: 'DM Sans', system-ui, sans-serif;
    --km-font-display: 'Young Serif', Georgia, serif;

    /* Legacy variables → tokens (so all existing rules follow the theme) */
    --brandColor: var(--km-accent);
    --brandColor-light: var(--km-accent-tint);
    --green: var(--km-accent);
    --grey: var(--km-surface-2);
    --grey-mid: var(--km-line);
    --text: var(--km-ink);
    --text-muted: var(--km-muted);
    --text-secondary: var(--km-ink);
    --text-light: var(--km-ink);
    --bg: var(--km-bg);
    --bg-card: var(--km-surface);
    --bg-input: var(--km-surface);
    --border: var(--km-line);
    --radius: 18px;
    --shadow: 0 2px 12px var(--km-shadow);
    --shadow-lg: 0 8px 32px var(--km-shadow);
}

@media (prefers-color-scheme: dark) {
    :root {
        color-scheme: dark;
        --km-bg: #121814;
        --km-surface: #1C241F;
        --km-surface-2: #171E19;
        --km-ink: #ECEFE6;
        --km-muted: #A3AE9B;
        --km-muted-2: #77846F;
        --km-line: #2A352D;
        --km-line-soft: #232C25;
        --km-line-strong: #3B483E;
        --km-hl: #1F3527;

        --km-accent: #6CC48C;
        --km-on-accent: #0D1F13;
        --km-accent-ink: #93D9AA;
        --km-accent-soft: #26402F;
        --km-accent-tint: #1F3527;

        --km-scrim: rgba(0, 0, 0, 0.6);
        --km-shadow: rgba(0, 0, 0, 0.45);
        --km-toast-bg: #ECEFE6;
        --km-toast-ink: #121814;
        --km-toast-action: #2F7A4C;
        --km-danger: #EE8FB2;

        /* re-assert legacy mapping over styles.css dark block */
        --bg: var(--km-bg);
        --bg-card: var(--km-surface);
        --bg-input: var(--km-surface);
        --text: var(--km-ink);
        --text-secondary: var(--km-ink);
        --text-muted: var(--km-muted);
        --text-light: var(--km-ink);
        --grey: var(--km-surface-2);
        --grey-mid: var(--km-line);
        --border: var(--km-line);
        --brandColor-light: var(--km-accent-tint);
        --shadow: 0 2px 12px var(--km-shadow);
        --shadow-lg: 0 8px 32px var(--km-shadow);
    }
}

/* ── 2. Base ───────────────────────────────────────────────────────────── */
html, body {
    background: var(--km-bg);
}
body {
    font-family: var(--km-font);
    color: var(--km-ink);
}
.modal-input,
.btn,
.list-search-input,
input, textarea, select, button {
    font-family: var(--km-font);
}

/* ── 3. Header: menu · list picker pill · share ────────────────────────── */
.header {
    background: var(--km-bg);
}
.header-icon-btn {
    width: 44px;
    height: 44px;
    border-radius: 999px;
    color: var(--km-ink);
}
.header-icon-btn:active { background: var(--km-surface-2); }
.header-center {
    flex: 0 1 auto;
    margin: 0 auto;
    height: 44px;
    padding: 0 14px 0 16px;
    gap: 6px;
    border-radius: 999px;
    background: var(--km-surface-2);
}
.header-logo-img,
.header-logo-dark,
.header-arrows-img { display: none !important; }
.header-list-name {
    font-size: 16px;
    font-weight: 700;
    color: var(--km-ink);
}
.header-center::after {
    content: '';
    width: 16px;
    height: 16px;
    flex-shrink: 0;
    background: var(--km-accent);
    -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2.8' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E") center / contain no-repeat;
            mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2.8' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E") center / contain no-repeat;
}

/* ── 4. Bottom navigation ──────────────────────────────────────────────── */
.bottom-nav {
    background: var(--km-surface);
    border-color: var(--km-line);
}
.bottom-tab,
.platform-android .bottom-tab {
    color: var(--km-muted);
}
.bottom-tab.active,
.platform-android .bottom-tab.active {
    color: var(--km-accent-ink);
    font-weight: 700;
    background-color: var(--km-accent-soft);
}
.platform-android .bottom-tab.active { background: none; }
.platform-android .bottom-tab.active .tab-icon { background: var(--km-accent-soft); }
@media (min-width: 768px) {
    /* Desktop sidenav: no surface fill, let the page background show */
    .bottom-nav,
    .standalone .bottom-nav,
    .platform-ios .bottom-nav,
    .platform-android .bottom-nav {
        background: transparent;
    }
}
.bottom-tab.active .tab-nav-badge {
    background: var(--km-accent);
    color: var(--km-on-accent);
}
.tab-nav-badge {
    background: var(--km-line);
    color: var(--km-ink);
}

/* ── 5. Buttons, inputs, FAB ───────────────────────────────────────────── */
.btn { border-radius: 999px; padding: 14px; }
.btn-primary { background: var(--km-accent); color: var(--km-on-accent); }
.btn-primary:disabled { background: var(--km-line); color: var(--km-muted); }
.btn-secondary { background: var(--km-surface-2); color: var(--km-ink); border: 2px solid var(--km-line); }
.modal-input {
    border-radius: 18px;
    border-color: var(--km-line);
    background: var(--km-surface);
}
.modal-input:focus { border-color: var(--km-accent); }
.fab,
.platform-ios .fab {
    background: var(--km-accent);
    color: var(--km-on-accent);
    box-shadow: 0 6px 20px var(--km-shadow);
}

/* ── 6. Overlays, sheets, toasts ───────────────────────────────────────── */
.sheet-overlay,
.modal-overlay { background: var(--km-scrim); }
.bottom-sheet,
.modal-box { background: var(--km-surface-2); border-radius: 28px 28px 0 0; }
.sheet-handle { width: 40px; height: 5px; border-radius: 999px; background: var(--km-line-strong); }
.sheet-header-title {
    font-family: var(--km-font-display);
    font-weight: 400;
    font-size: 18px;
}
.sheet-btn-submit { color: var(--km-accent); }
.toast {
    background: var(--km-toast-bg);
    color: var(--km-toast-ink);
    border-radius: 999px;
    box-shadow: 0 8px 24px var(--km-shadow);
}

/* ── 7. Add-product search sheet ───────────────────────────────────────── */
.list-search-row {
    height: 48px;
    border-radius: 18px;
    background: var(--km-surface);
    border: 2px solid var(--km-line);
}
.list-search-row:focus-within { border-color: var(--km-accent); }
.list-search-done-btn {
    width: 48px;
    height: 48px;
    background: var(--km-accent);
    color: var(--km-on-accent);
}
.fab-section-label { color: var(--km-muted); }

/* ════════════════════════════════════════════════════════════════════════
   Fase 2 — Lijst
   ════════════════════════════════════════════════════════════════════════ */

/* ── 8. Category colour tokens (icon colour + tint) ────────────────────── */
:root {
    --km-cat-grn: #2F7A4C;   --km-cat-grn-tint: #DCEBD3;
    --km-cat-frt: #B3261E;   --km-cat-frt-tint: #F8DAD7;
    --km-cat-dai: #9A7200;   --km-cat-dai-tint: #FFF1B8;
    --km-cat-bak: #A3335A;   --km-cat-bak-tint: #F3D9E2;
    --km-cat-mea: #2B6CB0;   --km-cat-mea-tint: #DCE8F6;
    --km-cat-dri: #6B5B95;   --km-cat-dri-tint: #E4DFF0;
    --km-cat-fro: #0B7285;   --km-cat-fro-tint: #D0EDF2;
    --km-cat-gra: #8C5A2B;   --km-cat-gra-tint: #F1E1CC;
    --km-cat-ing: #4F7A28;   --km-cat-ing-tint: #E3EDCF;
    --km-cat-swe: #B0306E;   --km-cat-swe-tint: #F7D8E7;
    --km-cat-ont: #A15C00;   --km-cat-ont-tint: #FBE6C4;
    --km-cat-hyg: #9C4D8F;   --km-cat-hyg-tint: #F1DDEE;
    --km-cat-cle: #2E6F8E;   --km-cat-cle-tint: #D6E7EE;
    --km-cat-pet: #475569;   --km-cat-pet-tint: #E2E6EC;
    --km-cat-other: #56634F; --km-cat-other-tint: #E6E1D0;
}
@media (prefers-color-scheme: dark) {
    :root {
        --km-cat-grn: #6CC48C;   --km-cat-grn-tint: #1F3527;
        --km-cat-frt: #F28B82;   --km-cat-frt-tint: #3A1E1C;
        --km-cat-dai: #E9C55A;   --km-cat-dai-tint: #352C12;
        --km-cat-bak: #EE8FB2;   --km-cat-bak-tint: #3A2230;
        --km-cat-mea: #8AB8EC;   --km-cat-mea-tint: #1C2A3D;
        --km-cat-dri: #B9ABE6;   --km-cat-dri-tint: #2A2541;
        --km-cat-fro: #6CCBDB;   --km-cat-fro-tint: #14313A;
        --km-cat-gra: #D9A774;   --km-cat-gra-tint: #33261A;
        --km-cat-ing: #A8CF7E;   --km-cat-ing-tint: #26301A;
        --km-cat-swe: #EC8BBB;   --km-cat-swe-tint: #3A1E2D;
        --km-cat-ont: #F0AE5A;   --km-cat-ont-tint: #36270F;
        --km-cat-hyg: #DA97CE;   --km-cat-hyg-tint: #33202F;
        --km-cat-cle: #82BEDB;   --km-cat-cle-tint: #1C303A;
        --km-cat-pet: #A9B4C4;   --km-cat-pet-tint: #262B33;
        --km-cat-other: #A3AE9B; --km-cat-other-tint: #2D2B24;
    }
}

/* ── 9. Category icon ──────────────────────────────────────────────────── */
.cat-icon {
    --ic: var(--km-cat-other);
    --ic-tint: var(--km-cat-other-tint);
    width: 34px;
    height: 34px;
    flex-shrink: 0;
    border-radius: 999px;
    background: var(--ic-tint);
    color: var(--ic);
    display: inline-flex;
    align-items: center;
    justify-content: center;
}
.cat-icon svg { width: 20px; height: 20px; }
.cat-icon-sm { width: 32px; height: 32px; }
.cat-icon-sm svg { width: 18px; height: 18px; }
.cat-icon-xl { width: 112px; height: 112px; --ic: var(--km-accent); --ic-tint: var(--km-accent-tint); }
.cat-icon-xl svg { width: 52px; height: 52px; stroke-width: 1.4; }
.cat-ic-grn { --ic: var(--km-cat-grn); --ic-tint: var(--km-cat-grn-tint); }
.cat-ic-frt { --ic: var(--km-cat-frt); --ic-tint: var(--km-cat-frt-tint); }
.cat-ic-dai { --ic: var(--km-cat-dai); --ic-tint: var(--km-cat-dai-tint); }
.cat-ic-bak { --ic: var(--km-cat-bak); --ic-tint: var(--km-cat-bak-tint); }
.cat-ic-mea { --ic: var(--km-cat-mea); --ic-tint: var(--km-cat-mea-tint); }
.cat-ic-dri { --ic: var(--km-cat-dri); --ic-tint: var(--km-cat-dri-tint); }
.cat-ic-fro { --ic: var(--km-cat-fro); --ic-tint: var(--km-cat-fro-tint); }
.cat-ic-gra { --ic: var(--km-cat-gra); --ic-tint: var(--km-cat-gra-tint); }
.cat-ic-ing { --ic: var(--km-cat-ing); --ic-tint: var(--km-cat-ing-tint); }
.cat-ic-swe { --ic: var(--km-cat-swe); --ic-tint: var(--km-cat-swe-tint); }
.cat-ic-ont { --ic: var(--km-cat-ont); --ic-tint: var(--km-cat-ont-tint); }
.cat-ic-hyg { --ic: var(--km-cat-hyg); --ic-tint: var(--km-cat-hyg-tint); }
.cat-ic-cle { --ic: var(--km-cat-cle); --ic-tint: var(--km-cat-cle-tint); }
.cat-ic-pet { --ic: var(--km-cat-pet); --ic-tint: var(--km-cat-pet-tint); }

/* ── 10. Category card ─────────────────────────────────────────────────── */
#main .category-section {
    background: var(--km-surface);
    border-radius: 22px;
    margin: 0 16px 14px;
    padding: 10px 8px 4px;
}
#main .category-header,
#main .category-section:first-child .category-header {
    background: transparent;
    margin: 0;
    padding: 0 6px 6px;
    border: none;
}
.cat-left { gap: 10px; }
.cat-name {
    font-family: var(--km-font-display);
    font-weight: 400;
    font-size: 17px;
    color: var(--km-ink);
}
#main .checked-section { background: transparent; }
#main .checked-section .cat-name {
    font-family: var(--km-font);
    font-size: 13px;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--km-muted);
}
.category-items { margin-top: 0; }

/* ── 11. Item row ──────────────────────────────────────────────────────── */
#main .item-card {
    border-radius: 0;
    min-height: 44px;
    padding: 4px 10px 4px 6px;
    gap: 12px;
    border-top: 1px solid var(--km-line-soft);
}
#main .checked-section .item-card { border-top-color: transparent; }
.item-checkbox {
    width: 24px;
    height: 24px;
    margin: 0 4px;
    border: 2px solid var(--km-muted-2);
    border-radius: 999px;
    position: relative;
}
.item-checkbox::before {            /* 44px touch target */
    content: '';
    position: absolute;
    inset: -10px;
}
.item-checkbox.checked {
    background: var(--km-accent);
    border-color: var(--km-accent);
}
.item-checkbox.checked::after {
    content: '';
    width: 13px;
    height: 13px;
    background: var(--km-on-accent);
    -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='3.6' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M5 12.5l4.5 4.5L19 7.5'/%3E%3C/svg%3E") center / contain no-repeat;
            mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='3.6' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M5 12.5l4.5 4.5L19 7.5'/%3E%3C/svg%3E") center / contain no-repeat;
}
.item-name {
    font-size: 15px;
    font-weight: 500;
    color: var(--km-ink);
}
.item-note-inline { color: var(--km-muted); }
.item-qty-label {
    font-family: var(--km-font-display) !important;
    font-size: 15px !important;
    font-weight: 400 !important;
    color: var(--km-cat-bak) !important;
}
/* Delete moved to the detail sheet */
#main .item-card .item-action-btn { display: none; }

/* ── 12. Progress ──────────────────────────────────────────────────────── */
.list-progress {
    display: flex;
    align-items: center;
    gap: 10px;
    margin: 0 20px 12px;
}
.list-progress-track {
    flex: 1;
    height: 6px;
    border-radius: 999px;
    background: var(--km-line);
    overflow: hidden;
}
.list-progress-fill {
    height: 100%;
    border-radius: 999px;
    background: var(--km-accent);
    transition: width 0.3s ease;
}
.list-progress-label { font-size: 14px; color: var(--km-muted); white-space: nowrap; }
.list-progress-label b { color: var(--km-ink); }

/* ── 13. Empty state ───────────────────────────────────────────────────── */
.empty-icon { margin-bottom: 16px; font-size: 0; }
.empty-title {
    font-family: var(--km-font-display);
    font-weight: 400;
    font-size: 24px;
    color: var(--km-ink);
}

/* ── 14. Frequently added / search results ─────────────────────────────── */
.frequently-added,
.list-search-results {
    background: var(--km-surface);
    border-radius: 22px;
    padding: 4px 0;
}
.search-result-item {
    justify-content: flex-start;
    min-height: 54px;
    padding: 6px 12px;
    border-top: 1px solid var(--km-line-soft);
}
.search-result-item:first-of-type { border-top: none; }
.search-result-item:active { background: var(--km-hl); }
.sri-name { font-size: 16px; }
.sri-name::before { display: none; }
.sri-added { color: var(--km-accent-ink); font-weight: 700; margin-left: auto; }
.sri-recent { margin-left: auto; }
.fab-section-label {
    padding: 4px 4px 8px;
    font-size: 13px;
    font-weight: 700;
    letter-spacing: 0.08em;
    color: var(--km-muted);
}

/* ── 15. Detail sheet (quantity, unit, note, delete) ───────────────────── */
#noteModal .modal-title {
    font-family: var(--km-font-display);
    font-weight: 400;
    font-size: 26px;
}
#noteModal .qty-btn {
    width: 44px !important;
    height: 44px !important;
    border-radius: 999px;
    border: none;
    background: var(--km-surface);
    color: var(--km-ink);
}
#detailQty {
    border: 2px solid var(--km-line) !important;
    border-radius: 14px !important;
    height: 44px !important;
    color: var(--km-ink);
    font-family: var(--km-font-display) !important;
    font-weight: 400 !important;
}
.unit-btn {
    min-width: 44px;
    height: 44px;
    border-radius: 999px;
    border: 2px solid var(--km-line);
    background: var(--km-surface);
    color: var(--km-muted);
    font-family: var(--km-font);
}
.unit-btn.active {
    background: var(--km-accent-soft);
    border-color: var(--km-accent-soft);
    color: var(--km-accent-ink);
    font-weight: 700;
}
.btn-danger-outline {
    flex: 0 0 auto;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 14px 20px;
    background: transparent;
    border: 2px solid var(--km-cat-bak-tint);
    color: var(--km-danger);
}

/* ── 16. Mobile browse grid ────────────────────────────────────────────── */
.bc-emoji .cat-icon { width: 44px; height: 44px; }
.bc-emoji .cat-icon svg { width: 24px; height: 24px; }

/* ════════════════════════════════════════════════════════════════════════
   Fase 3 — Menu, onboarding, delen, weekmenu, recepten
   ════════════════════════════════════════════════════════════════════════ */

/* ── 17. Shared pills & chips ──────────────────────────────────────────── */
.weekmenu-filter-btn,
.gen-pref-btn,
.gen-tog,
.rc-clear-btn {
    height: 38px;
    padding: 0 14px;
    border-radius: 999px;
    border: 1.5px solid var(--km-line);
    background: var(--km-surface);
    color: var(--km-ink);
    font-family: var(--km-font);
    font-size: 14px;
}
.weekmenu-filter-btn.active,
.gen-pref-btn.on,
.gen-tog.on {
    background: var(--km-accent-soft);
    border-color: var(--km-accent-soft);
    color: var(--km-accent-ink);
    font-weight: 700;
}
.ui-switch-track { width: 52px; height: 32px; border-radius: 999px; background: var(--km-line); }
.ui-switch-track::after { top: 3px; left: 3px; width: 26px; height: 26px; background: #FFFFFF; }
.ui-switch input:checked + .ui-switch-track { background: var(--km-accent); }
.ui-switch input:checked + .ui-switch-track::after { transform: translateX(20px); }

/* ── 18. Menu sheet & list switcher ────────────────────────────────────── */
.menu-item {
    min-height: 52px;
    padding: 0 18px;
    gap: 12px;
    font-family: var(--km-font);
    font-size: 16px;
    color: var(--km-ink);
}
.menu-item:active { background: var(--km-hl); }
.icon-colored,
#menuPopup .menu-item i,
#connectModal .menu-item i { color: var(--km-accent); }
#menuItemRemove, #menuItemRemove i { color: var(--km-danger); }
#menuItemNerd, #menuItemNerd i { color: var(--km-muted) !important; }
#connectModal .modal-box { background: var(--km-surface-2); }
.recent-list-btn {
    min-height: 52px;
    border-radius: 18px;
    background: var(--km-surface);
    color: var(--km-ink);
    font-family: var(--km-font);
    font-size: 16px;
}
.recent-list-btn:active { background: var(--km-accent-tint); color: var(--km-accent-ink); }

/* ── 19. Onboarding (language + new list) ──────────────────────────────── */
.newlist-modal { background: var(--km-bg); }
.newlist-box {
    background: transparent;
    padding: 24px 8px;
}
.newlist-box h2 {
    font-family: var(--km-font-display);
    font-weight: 400;
    font-size: 32px;
    color: var(--km-ink);
}
.newlist-box p,
.description-text { font-size: 16px; color: var(--km-muted); }
.emoji-xl {
    width: 96px;
    height: 96px;
    margin: 0 auto 16px;
    border-radius: 999px;
    background: var(--km-accent-tint);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 44px;
}
.locale-picker-btn {
    min-height: 64px;
    border-radius: 20px;
    background: var(--km-surface);
    border: 2px solid var(--km-line);
    font-size: 17px;
    color: var(--km-ink);
}
.locale-picker-btn:active { border-color: var(--km-accent); background: var(--km-surface); color: var(--km-ink); }
.locale-picker-code {
    width: 40px;
    height: 40px;
    border-radius: 999px;
    background: var(--km-accent-tint);
    color: var(--km-accent-ink);
    display: inline-flex;
    align-items: center;
    justify-content: center;
}
.locale-option { min-height: 56px; font-size: 16px; color: var(--km-ink); }
.locale-option.active { background: var(--km-accent-soft); color: var(--km-accent-ink); font-weight: 700; }
.divider-line { background: var(--km-line); }

/* ── 20. Share sheet ───────────────────────────────────────────────────── */
.share-modal { background: var(--km-scrim); }
.share-box { background: var(--km-surface-2); border-radius: 28px 28px 0 0; }
.share-title { font-family: var(--km-font-display); font-weight: 400; font-size: 26px; }
.share-sub { font-size: 15px; color: var(--km-muted); }
.share-link-box {
    height: 52px;
    border-radius: 16px;
    background: var(--km-surface);
    border: 1.5px solid var(--km-line);
    font-size: 14px;
    color: var(--km-ink);
    display: flex;
    align-items: center;
}
.share-icon-btn {
    width: 52px;
    height: 52px;
    border-radius: 16px;
    background: var(--km-accent-tint);
    border: none;
    color: var(--km-accent-ink);
}
.share-icon-btn:last-child { background: var(--km-accent); color: var(--km-on-accent); }

/* ── 21. Week menu ─────────────────────────────────────────────────────── */
.weekmenu-filter-bar:not(.rc-filter-bar) {
    background: var(--km-bg);
    border-bottom: none;
    padding: 10px 16px;
}
.weekmenu-segmented {
    background: var(--km-surface-2) !important;
    border: none !important;
    border-radius: 999px !important;
    padding: 4px;
    height: 48px !important;
}
.weekmenu-segment-btn {
    border-radius: 999px;
    padding: 0 16px;
    font-family: var(--km-font);
    font-size: 15px;
    color: var(--km-muted);
}
.weekmenu-segment-btn + .weekmenu-segment-btn { border-left: none; }
.weekmenu-segment-btn.active {
    background: var(--km-accent-soft);
    color: var(--km-accent-ink);
    font-weight: 700;
}
.meal-flat-list { padding: 4px 16px 110px; }
.meal-card {
    background: var(--km-surface);
    border-radius: 20px;
    box-shadow: none;
    padding: 10px 12px;
}
.meal-thumb { border-radius: 14px; width: 56px; height: 56px; }
.meal-thumb-placeholder { background: var(--km-cat-bak-tint); }
.meal-item-checkbox {
    border: 2px solid var(--km-muted-2);
    border-radius: 999px;
}
.meal-item-checkbox.checked { background: var(--km-accent); border-color: var(--km-accent); }
.meal-item-checkbox.checked::after { border-color: var(--km-on-accent); }
.meal-ref { font-size: 13px; color: var(--km-muted); }
.meal-ref--url { color: var(--km-accent-ink); }
.meal-drag-handle { color: var(--km-line-strong); }
.meal-toast-undo {
    background: transparent;
    color: var(--km-toast-action);
    font-weight: 700;
}
.weekmenu-action-item { min-height: 76px; color: var(--km-ink); }
.weekmenu-action-icon {
    width: 48px;
    height: 48px;
    border-radius: 999px;
    background: var(--km-accent-tint);
    color: var(--km-accent);
}
.weekmenu-action-item:nth-child(3) .weekmenu-action-icon { background: var(--km-cat-dai-tint); color: var(--km-cat-dai); }
.weekmenu-action-item:nth-child(4) .weekmenu-action-icon { background: var(--km-cat-bak-tint); color: var(--km-cat-bak); }
.weekmenu-action-label { font-size: 17px; font-weight: 700; }
.gen-trigger-btn { background: var(--km-accent); color: var(--km-on-accent); padding: 16px 28px; }
.gen-section { border-bottom: none; }
.gen-label { font-size: 14px; font-weight: 700; color: var(--km-ink); text-transform: none; letter-spacing: 0; }
.gen-stepper-btn { width: 44px; height: 44px; border: none; background: var(--km-surface); }

/* ── 22. Recipes ───────────────────────────────────────────────────────── */
.rc-header { border-bottom: none; background: var(--km-bg); }
.rc-body { background: var(--km-bg); }
.rc-search-bar {
    height: 48px;
    padding: 0 14px;
    border-radius: 18px;
    background: var(--km-surface);
    border: 2px solid var(--km-line);
}
.rc-search-bar:focus-within { border-color: var(--km-accent); }
.rc-card {
    border-radius: 22px;
    background: var(--km-surface);
    box-shadow: none;
}
.rc-card-placeholder { background: var(--km-cat-mea-tint); }
.rc-card-body { padding: 10px 12px 12px; }
.rc-card-title { font-size: 15px; font-weight: 700; }
.rc-add-btn {
    border-radius: 999px;
    background: var(--km-accent-tint);
    color: var(--km-accent-ink);
    padding: 6px 10px;
}
.rc-list { background: var(--km-surface); border-radius: 22px; margin: 0 16px; padding: 4px 0; }
.rc-row { border-bottom: 1px solid var(--km-line-soft); min-height: 56px; }
.rc-row:last-child { border-bottom: none; }
.rc-region-dropdown { background: var(--km-surface); border-color: var(--km-line); border-radius: 18px; box-shadow: 0 8px 24px var(--km-shadow); }
.rc-region-option.selected { color: var(--km-accent-ink); }
.rc-skeleton-card { border-radius: 22px; box-shadow: none; }

/* ════════════════════════════════════════════════════════════════════════
   Fase 4 — Structuur volgens de ontwerpschermen
   ════════════════════════════════════════════════════════════════════════ */

/* ── 23. Page background (main was white → cards vanished) ─────────────── */
html, body, main, #main { background-color: var(--km-bg); }

/* ── 24. Page head: serif title per tab + progress ─────────────────────── */
.km-pagehead { padding: 8px 20px 4px; flex-shrink: 0; background: var(--km-bg); }
.km-pagehead-row { display: flex; align-items: center; gap: 12px; }
.km-title {
    flex: 1;
    margin: 0;
    font-family: var(--km-font-display);
    font-weight: 400;
    font-size: 38px;
    line-height: 1.05;
    color: var(--km-ink);
}
.km-title-action {
    display: none;
    align-items: center;
    gap: 6px;
    height: 44px;
    padding: 0 14px 0 10px;
    border: none;
    border-radius: 999px;
    background: var(--km-accent);
    color: var(--km-on-accent);
    font-family: var(--km-font);
    font-size: 14px;
    font-weight: 700;
    cursor: pointer;
}
body[data-tab="recipes"] .km-title-action { display: inline-flex; }
#kmProgress .list-progress { margin: 8px 0 0; }
#kmProgress:empty { display: none; }

/* ── 25. Add bar (replaces the floating + on mobile) ───────────────────── */
.km-addbar { display: none; padding: 10px 16px 6px; flex-shrink: 0; background: var(--km-bg); }
.km-addbar-btn {
    width: 100%;
    height: 56px;
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 0 7px 0 16px;
    box-sizing: border-box;
    background: var(--km-surface);
    border: 2px solid var(--km-accent-soft);
    border-radius: 22px;
    text-align: left;
    cursor: pointer;
}
.km-addbar-search { stroke: var(--km-accent); flex-shrink: 0; }
.km-addbar-label { flex: 1; font-size: 16px; color: var(--km-muted); }
.km-addbar-plus {
    width: 40px;
    height: 40px;
    flex-shrink: 0;
    border-radius: 999px;
    background: var(--km-accent);
    color: var(--km-on-accent);
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Layout-volgorde (body is een flex-kolom): kop · inhoud · toevoegbalk onderaan.
   Geldt op mobiel én desktop; geen zwevende + meer. */
.km-pagehead { order: 2; }
main, #main { order: 3; padding-bottom: 16px !important; }
.km-addbar { order: 4; }
body[data-tab="list"] .km-addbar,
body[data-tab="weekmenu"]:not(.km-wm-empty) .km-addbar { display: block; }
.fab, .platform-ios .fab, .platform-android .fab { display: none !important; }

@media (max-width: 767px) {
    .header { order: 1; }
    .bottom-nav { order: 5; }

    /* ── 26. Bottom nav: flat, indicator pill behind the icon ─────────── */
    .bottom-nav,
    .standalone .bottom-nav,
    .platform-ios .bottom-nav,
    .platform-android .bottom-nav {
        position: relative;
        inset: auto;
        flex-shrink: 0;
        display: flex;
        justify-content: space-around;
        gap: 0;
        padding: 6px 12px max(18px, env(safe-area-inset-bottom));
        background: var(--km-bg);
        border: none;
        border-radius: 0;
        box-shadow: none;
    }
    .bottom-tab,
    .bottom-tab.active,
    .platform-android .bottom-tab,
    .platform-android .bottom-tab.active {
        flex: 0 1 auto;
        min-width: 88px;
        padding: 0;
        gap: 2px;
        background: none;
        border-radius: 0;
        color: var(--km-muted);
        font-size: 12px;
        font-weight: 500;
    }
    .bottom-tab .tab-icon,
    .platform-android .bottom-tab .tab-icon {
        width: 56px;
        height: 34px;
        border-radius: 999px;
        background: transparent;
    }
    .bottom-tab.active .tab-icon,
    .platform-android .bottom-tab.active .tab-icon {
        background: var(--km-accent-soft);
        color: var(--km-accent-ink);
    }
    .bottom-tab.active .bottom-tab-label { color: var(--km-accent-ink); font-weight: 700; }
}
.tab-icon svg { width: 24px; height: 24px; display: block; }
.bottom-tab-label { gap: 0; }
.tab-nav-badge,
.bottom-tab.active .tab-nav-badge {
    display: inline;
    background: none;
    color: inherit;
    font-size: inherit;
    font-weight: inherit;
    padding: 0;
    min-width: 0;
    height: auto;
    border-radius: 0;
    position: static;
}
.tab-nav-badge::before { content: '\00a0·\00a0'; }

/* ── 27. List: category count, note under name ─────────────────────────── */
#main .category-header { display: flex; align-items: center; justify-content: space-between; }
.cat-count {
    padding-right: 6px;
    font-size: 13px;
    font-weight: 700;
    color: var(--ic);
}
.item-note {
    font-size: 13px;
    font-style: italic;
    color: var(--km-muted);
    line-height: 1.3;
}
#main .item-info { display: flex; flex-direction: column; justify-content: center; }
#main { padding-top: 12px; }
#main .category-section { margin: 0 16px 14px; }

/* ── 28. Empty states (L0 / W2) ────────────────────────────────────────── */
.km-empty {
    min-height: 100%;
    box-sizing: border-box;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 10px;
    padding: 0 36px 40px;
    text-align: center;
}
.km-empty .empty-icon { margin: 0; }
.km-empty .cat-icon-xl,
.km-empty-ic {
    width: 112px;
    height: 112px;
    border-radius: 999px;
    background: var(--km-surface-2);
    color: var(--km-accent);
    display: flex;
    align-items: center;
    justify-content: center;
}
.km-empty-ic--wm { color: var(--km-cat-ont); }
.km-empty .empty-title { margin-top: 8px; }
.km-empty-sub { font-size: 16px; line-height: 1.4; color: var(--km-muted); }
.km-quick { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; margin-top: 12px; }
.km-quick-btn {
    height: 40px;
    padding: 0 14px;
    border-radius: 999px;
    background: var(--km-surface);
    border: 1.5px solid var(--km-line);
    color: var(--km-ink);
    font-family: var(--km-font);
    font-size: 15px;
    cursor: pointer;
}
.km-empty-actions { width: 100%; display: flex; flex-direction: column; gap: 10px; margin-top: 16px; }
.km-empty-actions .gen-trigger-btn {
    width: 100%;
    height: 56px;
    margin: 0;
    border-radius: 999px;
    font-size: 16px;
    font-weight: 700;
}
.km-btn-outline {
    width: 100%;
    height: 56px;
    border-radius: 999px;
    border: 2px solid var(--km-accent-soft);
    background: transparent;
    color: var(--km-accent-ink);
    font-family: var(--km-font);
    font-size: 16px;
    font-weight: 700;
    cursor: pointer;
}

/* ── 29. Week menu cards (W1) ──────────────────────────────────────────── */
main.main--weekmenu .weekmenu-filter-bar:not(.rc-filter-bar) { padding: 14px 16px 10px; }
.weekmenu-segment-btn { height: 40px; }
.weekmenu-filter-bar .rc-view-toggle {
    width: 44px;
    height: 44px;
    padding: 0;
    border: none;
    background: var(--km-surface-2);
    color: var(--km-muted);
    display: inline-flex;
    align-items: center;
    justify-content: center;
}
.meal-flat-list { display: flex; flex-direction: column; gap: 8px; padding: 0 16px 16px; }
.meal-card-wrap { margin: 0; }
.meal-card {
    display: flex;
    align-items: center;
    gap: 4px;
    min-height: 72px;
    padding: 8px 8px 8px 0;
    border-radius: 20px;
    border: none;
}
.meal-drag-handle { width: 14px; margin-left: 2px; opacity: .7; }
.meal-item-checkbox { width: 24px; height: 24px; margin: 0 10px 0 4px; flex-shrink: 0; position: relative; }
.meal-item-checkbox::before { content: ''; position: absolute; inset: -10px; }
.meal-thumb { width: 56px; height: 56px; border-radius: 14px; flex-shrink: 0; object-fit: cover; }
.meal-thumb-placeholder {
    background: var(--km-accent-tint);
    color: var(--km-accent);
    display: flex;
    align-items: center;
    justify-content: center;
}
.meal-info { flex: 1; min-width: 0; padding-left: 8px; display: flex; flex-direction: column; }
.meal-info .item-name { font-size: 16px; font-weight: 500; }
.meal-edit-btn { width: 44px; height: 44px; color: var(--km-muted) !important; display: flex !important; align-items: center; justify-content: center; }
.meal-checked .item-name { color: var(--km-muted); text-decoration: line-through; }

/* ── 30. Recipes (R1): search first, chips, photo grid ─────────────────── */
.rc-search-row { display: flex; gap: 8px; padding: 14px 16px 10px; background: var(--km-bg); }
.rc-search-bar { flex: 1; height: 48px; border: 2px solid var(--km-accent-soft); }
.rc-search-bar .km-search-ic { stroke: var(--km-accent); flex-shrink: 0; }
.rc-search-input { font-size: 16px; color: var(--km-ink); background: transparent; }
.rc-search-input::placeholder { color: var(--km-muted); }
.rc-search-row .rc-view-toggle {
    width: 48px;
    height: 48px;
    padding: 0;
    border: none;
    border-radius: 16px;
    background: var(--km-surface-2);
    color: var(--km-muted);
    display: inline-flex;
    align-items: center;
    justify-content: center;
}
.rc-filter-bar { padding: 0 16px 12px; background: var(--km-bg); border: none; }
.rc-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; padding: 0 16px 16px; }
.rc-card { display: flex; flex-direction: column; overflow: hidden; }
.rc-card-img,
.rc-card-placeholder { width: 100%; height: 112px; object-fit: cover; display: block; border-radius: 0; }
.rc-card-placeholder { background: var(--km-accent-tint); }
.rc-card-body { display: flex; flex-direction: column; align-items: stretch; gap: 2px; padding: 10px 12px 12px; }
.rc-card-title {
    font-size: 15px;
    font-weight: 700;
    line-height: 1.25;
    white-space: normal;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}
.rc-card-meta { font-size: 12px; color: var(--km-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.rc-card .rc-add-btn {
    width: 100%;
    height: 36px;
    margin-top: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 4px;
    font-size: 13px;
    font-weight: 700;
}
.rc-card .rc-add-label { display: inline; }

/* ── 31. Fixes after visual check ──────────────────────────────────────── */
.cat-count { background: none; min-width: 0; border-radius: 0; padding: 0 6px 0 0; font-size: 13px; color: var(--ic); }
.rc-search-row { margin: 0; }

/* ── 32. Product detail sheet (L5) ─────────────────────────────────────── */
#noteModal .modal-box { padding: 0 20px 24px; }
.km-detail-handle { display: block; margin: 10px auto 12px; }
.km-detail-head { display: flex; align-items: center; gap: 12px; }
.km-detail-ic .cat-icon { width: 48px; height: 48px; }
.km-detail-ic .cat-icon svg { width: 26px; height: 26px; }
#noteModal .modal-title { margin: 0; line-height: 1.1; text-align: left; }
.km-detail-sub { font-size: 14px; color: var(--km-muted); }
.km-field-label { font-size: 14px; font-weight: 700; color: var(--km-ink); margin: 22px 0 8px; }
.km-qty-row { margin-bottom: 0 !important; gap: 8px !important; }
#noteModal .qty-btn { background: var(--km-bg); }
#noteModal .qty-btn:last-of-type { background: var(--km-accent); color: var(--km-on-accent); }
#detailQty { width: 52px !important; }
.km-unit-group {
    display: grid !important;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 0 !important;
    padding: 4px;
    background: var(--km-surface);
    border: 1.5px solid var(--km-line);
    border-radius: 999px;
}
.km-unit-group .unit-btn { min-width: 0; height: 40px; border: none; background: transparent; font-size: 15px; }
.km-unit-group .unit-btn.active { background: var(--km-accent-soft); }
#noteInput { min-height: 56px; }
.km-note-chips { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; }
.km-note-chip {
    height: 36px;
    padding: 0 12px;
    border-radius: 999px;
    border: 1.5px solid var(--km-line);
    background: transparent;
    color: var(--km-ink);
    font-family: var(--km-font);
    font-size: 14px;
    cursor: pointer;
}
#noteModal .modal-btns { margin-top: 24px; gap: 10px; }
#noteModal .modal-btns .btn { height: 54px; padding: 0 20px; font-size: 16px; font-weight: 700; }
#noteModal .modal-btns .btn-primary { flex: 1; }

/* ── 33. Menu sheet (L6): grouped white cards ──────────────────────────── */
#menuPopup { padding: 0 12px 20px; }
.km-menu-group {
    background: var(--km-surface);
    border-radius: 20px;
    padding: 4px 0;
    margin-top: 10px;
    overflow: hidden;
}
.km-menu-group .menu-item { width: 100%; height: 52px; min-height: 52px; padding: 0 14px; border-radius: 0; }
.km-menu-group .menu-item + .menu-item { border-top: 1px solid var(--km-line-soft); }
.menu-share-icon { flex-shrink: 0; margin-right: 0; }

/* ── 34. List switcher (L7): floating card, lists + 2×2 actions ────────── */
#connectModal { background: transparent; }
#connectModal.show { background: var(--km-scrim); }
#connectModal .modal-box {
    position: fixed;
    top: 64px;
    left: 12px;
    right: 12px;
    width: auto;
    max-width: 480px;
    margin: 0 auto;
    padding: 10px;
    border-radius: 24px;
    background: var(--km-surface-2);
    border: none;
    transform: translateY(-12px);
    opacity: 0;
    transition: transform .25s cubic-bezier(.2,.8,.2,1), opacity .2s;
    box-shadow: 0 16px 40px var(--km-shadow);
}
#connectModal.show .modal-box { transform: none; opacity: 1; }
.km-switch-label {
    padding: 6px 8px 8px;
    font-size: 13px;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--km-muted);
}
#connectModalRecentBtns { background: var(--km-surface); border-radius: 18px; overflow: hidden; }
#connectModalRecentBtns .recent-list-btn {
    width: 100%;
    height: 60px;
    margin: 0;
    padding: 0 14px;
    gap: 12px;
    border-radius: 0;
    border: none;
    background: transparent;
    font-family: var(--km-font-display);
    font-size: 18px;
    text-align: left;
}
#connectModalRecentBtns .recent-list-btn + .recent-list-btn { border-top: 1px solid var(--km-line-soft); }
#connectModalRecentBtns .recent-list-btn svg { display: none; }
#connectModalRecentBtns .recent-list-btn::before {
    content: '';
    width: 24px;
    height: 24px;
    flex-shrink: 0;
    border-radius: 999px;
    border: 2px solid var(--km-line-strong);
    box-sizing: border-box;
}
#connectModalRecentBtns .recent-list-btn.is-current::before { border: 7px solid var(--km-accent); }
.km-switch-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-top: 10px; }
.km-switch-act {
    height: 52px;
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 0 12px;
    border: none;
    border-radius: 16px;
    background: var(--km-surface);
    color: var(--km-ink);
    font-family: var(--km-font);
    font-size: 15px;
    cursor: pointer;
}
.km-switch-act i, .km-switch-act svg { color: var(--km-accent); font-size: 20px; flex-shrink: 0; }

/* ── 35. iPhone: less space under the tab bar ──────────────────────────────
   In Safari (not installed) the browser toolbar already sits below the page,
   so no safe-area padding. Installed as an app: only the home-indicator inset. */
@media (max-width: 767px) {
    .bottom-nav,
    .platform-ios .bottom-nav,
    .platform-android .bottom-nav { padding-bottom: 8px; }
    .standalone .bottom-nav,
    .standalone.platform-ios .bottom-nav {
        padding-bottom: max(8px, calc(env(safe-area-inset-bottom) - 12px));
    }
    html, body { height: auto; }
    body { inset: 0; }
}

/* ── 36. Progress next to the page title ───────────────────────────────── */
.km-pagehead { padding-bottom: 0; }
.km-title { flex: 0 0 auto; }
#kmProgress { flex: 1; min-width: 0; display: flex; justify-content: flex-end; }
#kmProgress .list-progress {
    margin: 0;
    width: 100%;
    max-width: 200px;
    flex-direction: column-reverse;
    align-items: stretch;
    gap: 6px;
}
#kmProgress .list-progress-label { font-size: 13px; text-align: right; }
#kmProgress .list-progress-track { flex: none; height: 6px; width: 100%; }

/* ── 37. Add-product sheet (L2 / L3) ───────────────────────────────────── */
@media (max-width: 767px) {
    .list-search-sheet {
        height: calc(100% - var(--km-sheet-gap));
        max-height: none;
        padding: 0;
        border-radius: 28px 28px 0 0;
        background: var(--km-surface-2);
        display: flex;
        flex-direction: column;
    }
}
.km-search-handle { display: block; flex-shrink: 0; margin: 10px auto 6px; }
.list-search-inputs { margin: 0; gap: 8px; padding: 6px 16px 14px; }
.list-search-row {
    height: 52px;
    padding: 0 6px 0 14px;
    gap: 10px;
    border-radius: 20px;
    background: var(--km-surface);
    border: 2px solid var(--km-accent-soft);
}
.list-search-row:focus-within { border-color: var(--km-accent); }
.list-search-icon { stroke: var(--km-accent); color: var(--km-accent); flex-shrink: 0; }
.list-search-input { font-family: var(--km-font); font-size: 16px; color: var(--km-ink); }
.list-search-input::placeholder { color: var(--km-muted); }
.list-search-clear-btn {
    width: 36px;
    height: 36px;
    background: transparent;
    color: var(--km-muted);
}
.list-search-clear-btn:active { background: var(--km-surface-2); }
.list-search-done-btn {
    width: 52px;
    height: 52px;
    background: var(--km-accent);
    color: var(--km-on-accent);
}
.frequently-added,
.list-search-results { background: transparent; border-radius: 0; padding: 0 12px 16px; }
.fab-section-label { padding: 0 8px 6px; }
.km-sr-card { background: var(--km-surface); border-radius: 22px; padding: 4px 0; overflow: hidden; }
.km-sr-card .search-result-item {
    display: flex;
    align-items: center;
    gap: 12px;
    min-height: 54px;
    padding: 0 8px 0 12px;
    border: none;
    border-top: 1px solid var(--km-line-soft);
    background: transparent;
    cursor: pointer;
}
.km-sr-card .search-result-item:first-child { border-top: none; }
.km-sr-card .search-result-item:active { background: var(--km-hl); }
.km-sr-card .cat-icon-sm { width: 34px; height: 34px; }
.km-sr-card .sri-name { flex: 1; min-width: 0; font-size: 16px; font-weight: 500; color: var(--km-ink); }
.km-sr-card .sri-name b { color: var(--km-accent-ink); font-weight: 700; }
.sri-add-btn {
    width: 44px;
    height: 44px;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
}
.sri-add-btn svg {
    width: 32px;
    height: 32px;
    padding: 7px;
    box-sizing: border-box;
    border-radius: 999px;
    background: var(--km-accent-tint);
    color: var(--km-accent-ink);
}
.sri-onlist {
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 0 10px;
    font-size: 13px;
    font-weight: 700;
    color: var(--km-accent-ink);
    white-space: nowrap;
}
.km-sr-card .sri-name { display: block; gap: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* ── 38. New product sheet (L4) ────────────────────────────────────────── */
#customModal .modal-box { padding: 0 20px max(24px, env(safe-area-inset-bottom)); }
#customModal .sheet-header { height: 52px; padding: 0; margin: 0; }
#customModal .sheet-btn-cancel { color: var(--km-muted); font-size: 16px; }
#customModal .sheet-header-title { font-size: 19px; }
.km-pill-submit {
    height: 40px;
    padding: 0 16px;
    border: none;
    border-radius: 999px;
    background: var(--km-accent);
    color: var(--km-on-accent) !important;
    font-family: var(--km-font);
    font-size: 15px;
    font-weight: 700;
}
#customModal .km-field-label { display: block; margin: 16px 0 6px; }
#customName {
    height: 54px;
    padding: 0 16px;
    border: 2px solid var(--km-line);
    border-radius: 18px;
    font-size: 17px;
    margin: 0;
}
#customName:focus { border-color: var(--km-accent); }
.km-cat-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.km-cat-opt {
    display: flex;
    align-items: center;
    gap: 10px;
    height: 52px;
    padding: 0 10px;
    box-sizing: border-box;
    border-radius: 16px;
    border: 2px solid var(--km-line);
    background: var(--km-surface);
    color: var(--km-ink);
    font-family: var(--km-font);
    font-size: 15px;
    text-align: left;
    cursor: pointer;
    min-width: 0;
}
.km-cat-opt span:last-child { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.km-cat-opt .cat-icon { width: 30px; height: 30px; }
.km-cat-opt .cat-icon svg { width: 18px; height: 18px; }
.km-cat-opt.on { background: var(--ic-tint); border-color: var(--ic); font-weight: 700; }
.km-cat-opt.on .cat-icon { background: var(--ic); color: var(--km-surface); }
.km-cat-more {
    margin-top: 12px;
    height: 44px;
    padding: 0;
    border: none;
    background: none;
    color: var(--km-accent-ink);
    font-family: var(--km-font);
    font-size: 15px;
    font-weight: 700;
    cursor: pointer;
}

/* ── 39. Smaller page title ── */
.km-title { font-size: 30px; }

/* ── 40. Pill submit sits right in the 1fr column, sized to its label ── */
.sheet-header .km-pill-submit {
    justify-self: end;
    width: auto;
    min-height: 0;
    padding: 0 16px;
    text-align: center;
    white-space: nowrap;
}
#customModal .sheet-header-title { padding: 0 8px; overflow: hidden; text-overflow: ellipsis; }
#customModal .sheet-header { display: flex; gap: 6px; }
#customModal .sheet-btn-cancel { padding: 8px 0; }
#customModal .sheet-header-title { flex: 1; min-width: 0; padding: 0; font-size: 18px; }

/* ── 41. Installed app (home screen): fill the whole screen ────────────────
   As a home-screen app iOS reports a viewport that stops short of the bottom
   edge, so `inset: 0` left a band under the tab bar. Use the large viewport
   height instead. The tab bar keeps a small inset for the home indicator.   */
@media (max-width: 767px) {
    html:has(body.standalone) { height: 100vh; height: 100lvh; }
    body.standalone {
        top: 0;
        bottom: auto;
        height: 100vh;
        height: 100lvh;
    }
}

/* ── 42. +10px under the tab bar in the installed app (home indicator) ── */
@media (max-width: 767px) {
    .standalone .bottom-nav,
    .standalone.platform-ios .bottom-nav { padding-bottom: max(18px, calc(env(safe-area-inset-bottom) - 2px)); }
}

/* ── 43. Week menu / recipes scroll inside main: no extra bottom padding ── */
@media (max-width: 767px) {
    #main.main--weekmenu, #main.main--recipes { padding-bottom: 0 !important; }
}

/* ── 44. Same 12px between page title and first content in every tab ───── */
.km-title-action { margin: -8px 0; }
#main.main--weekmenu .weekmenu-filter-bar:not(.rc-filter-bar) { padding-top: 0; }
#main.main--recipes .rc-search-row { padding-top: 0; }
#main { padding-top: 24px; }
#customCatMore { display: none; }
#customModal .modal-box { max-height: calc(100% - 72px); overflow-y: auto; }
.km-cat-opt { height: auto; min-height: 52px; padding: 6px 10px; }
.km-cat-opt span:last-child { white-space: normal; overflow: visible; line-height: 1.2; font-size: 14px; }

/* ── 45. Week menu: drag grip on the right ── */
.meal-drag-handle { order: 10; width: 32px; height: 44px; margin: 0 4px 0 0; display: flex; align-items: center; justify-content: center; flex-shrink: 0; color: var(--km-muted-2); opacity: 1; }
.meal-item-checkbox { margin-left: 14px; }
.meal-edit-btn { order: 8; }
.meal-cart-btn, .meal-cart-done { order: 9; }
.rc-filter-bar { padding: 0 0px 12px; }

/* Desktop: geen tabbalk onder de toevoegbalk, dus wat meer ruimte onderaan */
@media (min-width: 768px) {
    .km-addbar { padding-bottom: 16px; }
}

/* ── 46. Add bar: search area + separate plus button ───────────────────── */
.km-addbar-btn { cursor: default; }
.km-addbar-main {
    flex: 1;
    min-width: 0;
    height: 100%;
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 0;
    border: none;
    background: none;
    text-align: left;
    font-family: var(--km-font);
    cursor: pointer;
}
.km-addbar-plus { border: none; padding: 0; cursor: pointer; }
.km-addbar-plus:active { transform: scale(0.94); }
.km-title-action { margin-left: auto; }

/* ── 47. Recipe search sheet (week menu) ───────────────────────────────── */
.km-recipe-sheet {
    height: calc(100% - var(--km-sheet-gap));
    padding: 0;
    border-radius: 28px 28px 0 0;
    background: var(--km-surface-2);
    display: flex;
    flex-direction: column;
}
.km-recipe-sheet .list-search-wrap { min-height: 0; }
#kmRecipeResults { display: block; overflow-y: auto; -webkit-overflow-scrolling: touch; flex: 1; min-height: 0; }
.km-rs-row { min-height: 64px !important; cursor: default !important; }
.km-rs-thumb {
    width: 44px;
    height: 44px;
    flex-shrink: 0;
    border-radius: 12px;
    object-fit: cover;
    background: var(--km-accent-tint);
}
.km-rs-thumb--ph {
    display: block;
    background: var(--km-accent-tint) center / 22px no-repeat url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%232F7A4C' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M7 3v8M5 3v5a2 2 0 0 0 4 0V3M7 11v10M17 21V3c-2 1.5-3 4-3 7v4h3'/%3E%3C/svg%3E");
}
.km-rs-text { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.km-rs-text .sri-name { flex: none; }
.km-rs-meta { font-size: 12px; color: var(--km-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
button.sri-add-btn { border: none; background: none; padding: 0; cursor: pointer; }

/* ── 48. Recipes: + button next to search replaces header button ───────── */
body[data-tab="recipes"] .km-title-action { display: none; }
.km-rc-add {
    width: 48px;
    height: 48px;
    flex-shrink: 0;
    border: none;
    border-radius: 999px;
    background: var(--km-accent);
    color: var(--km-on-accent);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
}
.km-rc-add:active { transform: scale(0.94); }

/* ── 49. Let title descenders (j, g) overlap the content area instead of being clipped ── */
.km-pagehead { position: relative; z-index: 2; background: transparent; }
.km-title { overflow: visible; padding-bottom: 0; }
#kmProgress { align-self: flex-end; padding-bottom: 6px; }
#kmProgress .list-progress { width: auto; }

/* ── 50. Ingrediënten naar lijstje (I1–I3) ─────────────────────────────── */
.meal-cart-btn {
    width: 44px; height: 44px; flex-shrink: 0; border: 0; border-radius: 999px;
    background: var(--km-accent-tint); color: var(--km-accent-ink);
    display: flex; align-items: center; justify-content: center; cursor: pointer;
}
.meal-cart-done {
    height: 32px; padding: 0 10px 0 8px; flex-shrink: 0; border: 0; border-radius: 999px;
    background: var(--km-accent-soft); color: var(--km-accent-ink);
    display: flex; align-items: center; gap: 4px; margin-right: 2px;
    font: 700 13px var(--km-font); cursor: pointer; white-space: nowrap;
}
.ingr-sheet { max-height: calc(100% - var(--km-sheet-gap)); height: calc(100% - var(--km-sheet-gap)); padding-top: 0; }
.ingr-sheet .sheet-header { padding: 0 16px; height: 52px; margin: 0; border-bottom: 0; }
.ingr-sheet .sheet-btn-cancel { color: var(--km-muted); font-size: 16px; justify-self: start; }
.ingr-body { flex: 1; min-height: 0; overflow-y: auto; padding: 0 16px 12px; -webkit-overflow-scrolling: touch; }
.ingr-head { display: flex; align-items: center; gap: 12px; padding: 8px 4px 14px; }
.ingr-head-text { flex: 1; min-width: 0; }
.ingr-title { font-family: var(--km-font-display); font-size: 22px; line-height: 1.15; color: var(--km-ink); }
.ingr-src { font-size: 13px; color: var(--km-accent-ink); margin-top: 2px; }
.ingr-stepper {
    display: flex; align-items: center; flex-shrink: 0; padding: 4px; border-radius: 999px;
    background: var(--km-surface); border: 1.5px solid var(--km-line);
}
.ingr-stepper button {
    width: 40px; height: 40px; border: 0; border-radius: 999px; cursor: pointer;
    background: var(--km-bg); color: var(--km-ink);
    display: flex; align-items: center; justify-content: center;
}
.ingr-stepper-val { min-width: 54px; display: flex; flex-direction: column; align-items: center; line-height: 1; }
.ingr-stepper-val b { font-family: var(--km-font-display); font-weight: 400; font-size: 20px; color: var(--km-ink); }
.ingr-stepper-val small { font-size: 11px; color: var(--km-muted); margin-top: 2px; }
.ingr-section { font-size: 14px; font-weight: 700; color: var(--km-ink); margin: 6px 4px 8px; }
.ingr-section + .ingr-hint { margin-top: -4px; }
.ingr-card + .ingr-section { margin-top: 20px; }
.ingr-hint { font-size: 13px; color: var(--km-muted); margin: 0 4px 8px; }
.ingr-card { background: var(--km-surface); border-radius: 20px; padding: 0 12px; }
.ingr-row {
    width: 100%; display: flex; align-items: center; gap: 12px; min-height: 56px; padding: 6px 0;
    border: 0; border-bottom: 1px solid var(--km-line-soft); background: none; text-align: left;
    font: inherit; color: inherit; cursor: pointer; box-sizing: border-box;
}
.ingr-row:last-child { border-bottom: 0; }
.ingr-check {
    width: 26px; height: 26px; flex-shrink: 0; border-radius: 999px; box-sizing: border-box;
    border: 2px solid var(--km-muted-2); display: flex; align-items: center; justify-content: center;
}
.ingr-row.on .ingr-check { background: var(--km-accent); border-color: var(--km-accent); color: var(--km-on-accent); }
.ingr-row-text { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.ingr-name { font-size: 16px; font-weight: 500; color: var(--km-muted); }
.ingr-row.on .ingr-name { color: var(--km-ink); }
.ingr-sub { font-size: 13px; color: var(--km-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ingr-qty { font-size: 15px; font-weight: 700; color: var(--km-muted); flex-shrink: 0; }
.ingr-row.on .ingr-qty { color: var(--km-ink); }
.ingr-qty.is-text, .ingr-row.on .ingr-qty.is-text { color: var(--km-muted); font-weight: 500; }
.ingr-empty { font-size: 16px; line-height: 1.4; color: var(--km-muted); margin: 4px 4px 14px; }
.ingr-paste { width: 100%; box-sizing: border-box; resize: none; font-size: 16px; }
.ingr-footer { padding: 10px 16px 6px; border-top: 1px solid var(--km-line-soft); }
.ingr-footer:empty { display: none; }
.ingr-add-btn {
    width: 100%; height: 56px; border: 0; border-radius: 999px; cursor: pointer;
    background: var(--km-accent); color: var(--km-on-accent);
    font: 700 16px var(--km-font); display: flex; align-items: center; justify-content: center; gap: 8px;
}
.ingr-add-btn:disabled { opacity: .45; cursor: default; }

/* ── 51. Page head verbergen tijdens scrollen ──────────────────────────── */
.km-pagehead {
    max-height: 120px;
    transition: max-height .22s ease, opacity .18s ease, padding .22s ease;
}
.km-pagehead.km-pagehead--hidden {
    max-height: 0;
    opacity: 0;
    padding-top: 0;
    padding-bottom: 0;
    overflow: hidden;
    pointer-events: none;
}
.meal-week-cart {
    display: flex; align-items: center; gap: 12px; width: 100%; min-height: 64px; padding: 0 16px;
    border: 2px dashed var(--km-line-strong); border-radius: 20px; background: none; box-sizing: border-box;
    color: var(--km-accent-ink); text-align: left; font: inherit; cursor: pointer;
}
.meal-week-cart-text { flex: 1; display: flex; flex-direction: column; }
.meal-week-cart-text b { font-size: 16px; font-weight: 700; }
.meal-week-cart-text small { font-size: 13px; color: var(--km-muted); }
.ingr-src.is-muted { color: var(--km-muted); }
.ingr-skipped { margin: -6px 4px 12px; }

/* ── 51. Recepten: zoekbalk onderaan, zoals de toevoegbalk op de andere tabs ── */
/* Zoekveld staat nu bovenaan in Recepten (boven de filterchips) */
body:not([data-tab="recipes"]) #kmRcSearchBar { display: none !important; }

/* ── 51. Weekmenu gallery view: afbeelding boven naam en knoppen ── */
.meal-flat-list:not(.meal-flat-list--no-images) .meal-card {
    flex-wrap: wrap;
    padding-top: 0;
    overflow: hidden;
}
.meal-flat-list:not(.meal-flat-list--no-images) .meal-thumb {
    order: -1;
    flex: 0 0 calc(100% + 4px);
    width: calc(100% + 4px);
    height: auto;
    aspect-ratio: 16 / 9;
    max-height: 240px;
    margin: 0 -4px 4px 0;
    border-radius: 0;
}
.meal-flat-list:not(.meal-flat-list--no-images) .meal-thumb-placeholder svg { width: 40px; height: 40px; }

/* ── 52. "Op lijstje": rond icoon zonder label ── */
.meal-cart-done {
    width: 44px; height: 44px; padding: 0; gap: 0; margin-right: 0;
    justify-content: center;
    background: rgba(128, 128, 128, .16); color: var(--km-muted);
}

/* ── 53. Kookboek scannen (I4–I6) ─────────────────────────────────────── */
:root { --km-warn: #B04E14; --km-warn-tint: #FBE1CF; }
@media (prefers-color-scheme: dark) { :root { --km-warn: #F2A46E; --km-warn-tint: #3B2A1D; } }
.ingr-scan-btn {
    display: flex; align-items: center; gap: 14px; min-height: 76px; padding: 0 16px; margin: 0 0 4px;
    border-radius: 20px; background: var(--km-accent); color: var(--km-on-accent); cursor: pointer;
}
.ingr-scan-btn input { position: absolute; width: 1px; height: 1px; opacity: 0; pointer-events: none; }
.ingr-scan-btn:focus-within { outline: 3px solid var(--km-accent-soft); outline-offset: 2px; }
.ingr-scan-ic {
    width: 44px; height: 44px; flex-shrink: 0; border-radius: 999px; background: rgba(255,255,255,0.18);
    display: flex; align-items: center; justify-content: center;
}
.ingr-scan-text { display: flex; flex-direction: column; }
.ingr-scan-text b { font-size: 16px; font-weight: 700; }
.ingr-scan-text small { font-size: 13px; opacity: 0.9; }
.ingr-or { font-size: 13px; color: var(--km-muted); margin: 16px 4px 8px; }
.ingr-scan-error { font-size: 14px; color: var(--km-warn); margin: -6px 4px 12px; }
.ingr-scan-note {
    display: flex; align-items: center; gap: 10px; margin: 0 0 12px; padding: 12px 14px; border-radius: 18px;
    background: var(--km-warn-tint); color: var(--km-ink); font-size: 14px; line-height: 1.35;
}
.ingr-scan-note > span { color: var(--km-warn); flex-shrink: 0; display: flex; }
.ingr-sub.is-warn { color: var(--km-warn); }

/* ── 54. Weekmenu-kaart: minder ruimte tussen vinkje en naam (22 → 12 px) ── */
.meal-card .meal-item-checkbox { margin-right: 8px; }
.meal-card .meal-info { padding-left: 0; }

/* ── 55. Foto bij eigen recept (recept-sheet) ─────────────────────────── */
.meal-photo { margin-bottom: 10px; }
.meal-photo input[type=file] { position: absolute; width: 1px; height: 1px; opacity: 0; pointer-events: none; }
.meal-photo-add {
    display: grid; grid-template-columns: auto 1fr; column-gap: 12px; align-items: center;
    min-height: 64px; padding: 10px 16px; box-sizing: border-box; cursor: pointer;
    border: 2px dashed var(--km-line-strong); border-radius: 18px; color: var(--km-accent-ink);
}
.meal-photo-add svg { grid-row: span 2; }
.meal-photo-add span { font-size: 16px; font-weight: 700; }
.meal-photo-add small { font-size: 13px; color: var(--km-muted); }
.meal-photo-add:focus-within, .meal-photo-btn:focus-within { outline: 3px solid var(--km-accent-soft); outline-offset: 2px; }
.meal-photo-img { display: block; width: 100%; aspect-ratio: 16 / 9; object-fit: cover; border-radius: 18px; background: var(--km-surface); }
.meal-photo-actions { display: flex; gap: 8px; margin-top: 8px; }
.meal-photo-btn {
    height: 40px; padding: 0 16px; border-radius: 999px; border: 1.5px solid var(--km-line); background: var(--km-surface);
    color: var(--km-ink); font: 600 14px var(--km-font); display: inline-flex; align-items: center; cursor: pointer;
}
.meal-photo-remove { color: var(--km-danger); }

/* ── 56. Zoekveld: invoerveld zonder eigen achtergrond ────────────────────
   In dark mode gaf `input[type="text"]` (styles.css) het veld een effen
   rechthoek die over de afgeronde rand van .list-search-row schilderde. */
.list-search-row .list-search-input,
.list-search-row .list-search-input:focus {
    background: transparent;
    border: none;
    border-radius: 0;
    box-shadow: none;
    -webkit-appearance: none;
    appearance: none;
}
.list-search-row { overflow: hidden; }

/* ── 57. Recepten-filtermenu (Bron/Regio): actieve optie ook in dark ───── */
.rc-region-option { color: var(--km-ink); border-radius: 12px; }
.rc-region-option:hover { background: var(--km-surface-2); }
.rc-region-option.selected,
.rc-region-option.selected:hover {
    background: var(--km-accent-tint);
    color: var(--km-accent-ink);
    font-weight: 700;
}

/* ── 58. Placeholder-illustratie voor recepten zonder foto ─────────────── */
.rc-ph {
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--km-accent-tint);
    color: var(--km-accent);
    overflow: hidden;
}
.rc-ph svg { width: 88px; height: 66px; flex-shrink: 0; }
.rc-card-placeholder.rc-ph svg { width: 92px; height: 69px; }
.km-rs-thumb--ph.rc-ph { background-image: none; }
.km-rs-thumb--ph.rc-ph svg,
.meal-thumb-placeholder.rc-ph svg { width: 40px; height: 30px; stroke-width: 3.6; }
.meal-flat-list:not(.meal-flat-list--no-images) .meal-thumb-placeholder.rc-ph svg { width: 96px; height: 72px; stroke-width: 2.4; }
.rc-edit-ph.rc-ph { aspect-ratio: 16 / 9; }
.rc-edit-ph.rc-ph svg { width: 120px; height: 90px; stroke-width: 2.2; }

/* ── 59. Recept bewerken (sheet) ───────────────────────────────────────── */
#recipeEditSheet {
    padding: 10px 0 0;
    max-height: calc(100dvh - var(--km-sheet-gap));
    background: var(--km-surface-2);
}
#recipeEditSheet .sheet-header { padding-left: 8px; padding-right: 8px; flex-shrink: 0; }
.rc-edit-scroll {
    flex: 1;
    min-height: 0;
    overflow-y: auto;
    overscroll-behavior: contain;
    -webkit-overflow-scrolling: touch;
    padding: 6px 20px max(24px, env(safe-area-inset-bottom));
}
#recipeEditSheet .modal-input { display: block; width: 100%; box-sizing: border-box; }
#recipeEditSheet .meal-photo { margin-bottom: 16px; }
.rc-edit-ref-row { display: flex; gap: 8px; align-items: center; margin-bottom: 10px; }
.rc-edit-ref-row .modal-input { flex: 1; min-width: 0; margin: 0; }
.rc-edit-open {
    display: none;
    flex-shrink: 0;
    width: 48px;
    height: 48px;
    border-radius: 999px;
    background: var(--km-accent-tint);
    color: var(--km-accent-ink);
    align-items: center;
    justify-content: center;
}
.rc-edit-open.show { display: inline-flex; }
.rc-edit-label { margin: 14px 0 8px; }
.rc-edit-opts { display: flex; flex-wrap: wrap; gap: 8px; }
.rc-edit-reset {
    display: block;
    margin: 24px auto 4px;
    padding: 10px 16px;
    border: none;
    background: none;
    color: var(--km-danger);
    font: 600 15px var(--km-font);
    cursor: pointer;
}
.rc-card, .rc-row { cursor: pointer; }

/* ── 60. Lijstwisselaar: vinkje bij actieve lijst, acties in één kolom ─── */
#connectModalRecentBtns .recent-list-btn::before { content: none; display: none; }
#connectModalRecentBtns .recent-list-btn {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 16px;
    color: var(--km-ink);
}
.km-switch-name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
#connectModalRecentBtns .recent-list-btn.is-current {
    background: var(--km-accent-tint);
    color: var(--km-accent-ink);
    font-weight: 700;
}
.km-switch-check {
    width: 26px;
    height: 26px;
    flex-shrink: 0;
    border-radius: 999px;
    background: var(--km-accent);
    color: var(--km-on-accent);
    display: inline-flex;
    align-items: center;
    justify-content: center;
}
#connectModalRecentBtns .recent-list-btn .km-switch-check svg { display: block; }
.km-switch-actions {
    display: flex;
    flex-direction: column;
    gap: 0;
    margin-top: 10px;
    background: var(--km-surface);
    border-radius: 18px;
    overflow: hidden;
}
.km-switch-act {
    width: 100%;
    height: 52px;
    gap: 12px;
    padding: 0 16px;
    border-radius: 0;
    background: transparent;
    text-align: left;
}
.km-switch-act + .km-switch-act { border-top: 1px solid var(--km-line-soft); }
.km-switch-act:active { background: var(--km-surface-2); }
.km-switch-act svg { color: var(--km-accent); filter: none; }
/* Deel-icoon is nu een inline SVG in currentColor: de oude invert-filter
   (voor een zwarte afbeelding) maakte het roze in dark mode. */
@media (prefers-color-scheme: dark) { .menu-share-icon { filter: none; } }
.meal-photo-btn { gap: 6px; }

/* ── 61. Bovenste balk ook verbergen tijdens scrollen (samen met paginakop).
   De safe-area bovenaan (statusbalk iPhone) blijft staan. */
.header-top {
    max-height: 80px;
    transition: max-height .22s ease, opacity .18s ease, padding .22s ease;
}
body.km-topbar-hidden .header-top {
    max-height: 0;
    opacity: 0;
    padding-top: 0;
    padding-bottom: 0;
    overflow: hidden;
    pointer-events: none;
}

/* ── 62. Desktop-zijnavigatie: items plat tegen de linkerrand ──────────── */
@media (min-width: 768px) {
    .bottom-tab,
    .bottom-tab.active,
    .platform-android .bottom-tab,
    .platform-android .bottom-tab.active { border-radius: 0 999px 999px 0; }
}

/* ── 64. Recepten-filters: Spotify-stijl drill-down + gecombineerde chip ── */
.rc-combo {
    display: inline-flex;
    align-items: stretch;
    flex-shrink: 0;
    height: 38px;
    padding: 0;
    border: none;
    border-radius: 999px;
    overflow: hidden;
    cursor: pointer;
    font-family: var(--km-font);
    font-size: 14px;
    background: none;
}
.rc-combo > span { display: inline-flex; align-items: center; white-space: nowrap; }
.rc-combo-main {
    padding: 0 12px 0 14px;
    background: var(--km-accent-soft);
    color: var(--km-accent-ink);
    font-weight: 700;
}
.rc-combo-sub {
    padding: 0 14px 0 12px;
    background: color-mix(in srgb, var(--km-accent-soft) 45%, var(--km-surface));
    color: var(--km-accent-ink);
    font-weight: 500;
}
.rc-combo:active { transform: scale(0.97); }
.rc-filter-pills .weekmenu-filter-btn,
.rc-filter-pills .rc-clear-btn { flex-shrink: 0; white-space: nowrap; }
.rc-sub-chip { animation: rcSubIn .22s ease both; }
@keyframes rcSubIn { from { opacity: 0; transform: translateX(-8px); } to { opacity: 1; transform: none; } }
@media (prefers-reduced-motion: reduce) { .rc-sub-chip { animation: none; } }
/* Gecombineerde chip zoals de referentie: twee volledig afgeronde pillen, het
   optie-deel schuift onder de groepschip door (overlap). */
.rc-combo { overflow: visible; border-radius: 999px; }
.rc-combo-main { position: relative; z-index: 1; border-radius: 999px; padding: 0 14px; }
.rc-combo-sub { border-radius: 999px; margin-left: -26px; padding: 0 14px 0 38px; }

/* ── 65. Recepten-filters: kruisje vast links, enkel de chips scrollen ─── */
.rc-filter-scroll-wrap > .rc-clear-btn { flex-shrink: 0; margin: 0 0 0 14px; }
/* Met vast kruisje: chips starten vlak ernaast en vervagen eronder bij scrollen */
.rc-filter-scroll-wrap:has(> .rc-clear-btn) #rcFilterPills {
    padding-left: 6px;
    -webkit-mask-image: linear-gradient(to right, transparent 0, #000 10px);
            mask-image: linear-gradient(to right, transparent 0, #000 10px);
}
.rc-filter-scroll-wrap > .rc-fixed-chip { flex-shrink: 0; white-space: nowrap; margin-left: 4px; }

/* ── 66. Weekmenu herschikken: lang drukken i.p.v. greep ───────────────── */
.meal-card { -webkit-touch-callout: none; -webkit-user-select: none; user-select: none; }
.meal-drag-clone { transform: scale(1.03); transition: none; overflow: visible !important; background: transparent !important; box-shadow: none !important; border: 0 !important; gap: 0 !important; }
.meal-drag-clone .meal-card-wrap { margin: 0 !important; background: transparent !important; }
.meal-drag-clone .meal-card { box-shadow: 0 12px 32px var(--km-shadow, rgba(0,0,0,.2)); }
.meal-drag-placeholder { border: 2px dashed var(--km-line-strong); border-radius: 22px; background: transparent; box-sizing: border-box; margin-bottom: 10px; }

/* ── 67. Lijstje: geen plusknop in de zoekbalk (tikken op de balk volstaat) ── */
body[data-tab="list"] #kmAddBarPlus { display: none; }
/* Lijstje: + i.p.v. vergrootglas in de toevoegbalk */
.km-addbar-addicon { display: none; }
body[data-tab="list"] .km-addbar-main > .km-addbar-search:not(.km-addbar-addicon) { display: none; }
body[data-tab="list"] .km-addbar-addicon { display: block; }

/* ── 68. Weekmenu & Recepten: + als aparte ronde knop naast het zoekveld ── */
.km-addbar-btn {
    background: none;
    border: none;
    border-radius: 0;
    padding: 0;
    gap: 10px;
}
.km-addbar-main {
    height: 56px;
    padding: 0 16px;
    box-sizing: border-box;
    background: var(--km-surface);
    border: 2px solid var(--km-accent-soft);
    border-radius: 22px;
}
.km-addbar-plus { width: 50px; height: 50px; } /* 90%: oogt even groot als het 56px-veld */
.km-addbar-plus svg { width: 22px; height: 22px; }

/* ── 69. Recept-sheet: schakelaar links van het label ──────────────────── */
.meal-catalog-toggle { justify-content: flex-start; }
.meal-catalog-toggle-label { cursor: pointer; }

/* ── 70. Lijstwisselaar: vinkje links van de naam; lege plek houdt namen uitgelijnd ── */
#connectModalRecentBtns .recent-list-btn { justify-content: flex-start; gap: 12px; }
.km-switch-check--empty { background: transparent; }

/* ── 71. Desktop: geen scheidingslijn tussen zijnavigatie en inhoud ────── */
@media (min-width: 768px) {
    .bottom-nav,
    .standalone .bottom-nav,
    .platform-ios .bottom-nav,
    .platform-android .bottom-nav { border: none; box-shadow: none; }
}

/* ── 72. Desktop: productzoekpaneel hoger (was 28vh) ───────────────────── */
@media (min-width: 768px) {
    .list-search-sheet { height: 330px; }
}

/* ── 73. Desktop: typen in de balk onderaan, resultaten als popup erboven ──
   Mobiel blijft ongewijzigd (knop opent het zoekpaneel). */
.km-addbar-field { display: none; }
@media (min-width: 768px) {
    .km-addbar-main { display: none; }
    .km-addbar-field {
        display: flex;
        flex: 1;
        min-width: 0;
        height: 56px;
        align-items: center;
        gap: 10px;
        padding: 0 16px;
        box-sizing: border-box;
        background: var(--km-surface);
        border: 2px solid var(--km-accent-soft);
        border-radius: 22px;
        cursor: text;
    }
    .km-addbar-field:focus-within { border-color: var(--km-accent); }
    .km-addbar-field .km-addbar-input {
        flex: 1;
        min-width: 0;
        height: 100%;
        padding: 0;
        border: none;
        border-radius: 0;
        background: transparent;
        box-shadow: none;
        outline: none;
        color: var(--km-ink);
        font: 16px var(--km-font);
    }
    .km-addbar-field .km-addbar-input::placeholder { color: var(--km-muted); }
    .km-addbar-field .km-addbar-addicon { display: none; }
    body[data-tab="list"] .km-addbar-field .km-addbar-search:not(.km-addbar-addicon) { display: none; }
    body[data-tab="list"] .km-addbar-field .km-addbar-addicon { display: block; }

    .bottom-sheet.km-popover {
        transform: none !important;
        height: auto !important;
        max-height: min(60vh, 520px);
        padding: 8px 0;
        border-radius: 20px;
        box-shadow: 0 16px 48px var(--km-shadow, rgba(0, 0, 0, .2));
    }
    .km-popover .km-search-handle,
    .km-popover .list-search-inputs { display: none; }
    .km-popover .list-search-wrap { overflow-y: auto; min-height: 0; }
    .km-popover #kmRecipeResults { flex: none; overflow: visible; }
}

/* ── 52. Recepten: zoekveld bovenaan, boven de filterchips ── */
.rc-search-row { padding: 6px 16px 10px; }
.rc-filter-pills { padding-left: 16px; padding-right: 16px; }
.rc-search-bar { cursor: text; }
.rc-search-input { height: 100%; }
.rc-search-input::-webkit-search-cancel-button { -webkit-appearance: none; display: none; }
.rc-search-clear[hidden] { display: none; }
.rc-search-row { align-items: center; }
.rc-search-plus { width: 42px; height: 42px; }

/* ── 53. Recept bewerken: acties onderaan ── */
.rc-edit-actions { display: flex; flex-direction: column; gap: 4px; margin: 24px 0 8px; }
.rc-edit-wm {
    display: flex; align-items: center; justify-content: center; gap: 8px;
    width: 100%; height: 52px; border: none; border-radius: 18px;
    background: var(--km-accent); color: var(--km-on-accent);
    font: 700 16px var(--km-font); cursor: pointer;
}
.rc-edit-wm:active { transform: scale(0.98); }
.rc-edit-delete {
    width: 100%; padding: 14px 16px; border: none; background: none;
    color: var(--km-danger); font: 600 16px var(--km-font); cursor: pointer;
}

/* ── 54. Toasts helemaal bovenaan; hoge bottom sheets laten er ruimte voor ── */
:root { --km-sheet-gap: calc(env(safe-area-inset-top, 0px) + 64px); }
.toast { top: calc(env(safe-area-inset-top, 0px) + 10px) !important; z-index: 1000; }
#mealSheet { max-height: calc(100dvh - var(--km-sheet-gap)); }

/* ── 55. Recepten-filters drill-down: suboptie-chips dicht op elkaar, lichte overlap ──
   Elke volgende chip schuift onder de vorige door (z-index loopt af, inline gezet). */
.rc-filter-pills--drill { gap: 0; }
/* Eerste optie plakt tegen de groepschip en schuift er 20px onder door */
.rc-filter-scroll-wrap > .rc-fixed-chip, .rc-filter-scroll-wrap > .rc-clear-btn { position: relative; z-index: 10; }
.rc-filter-scroll-wrap:has(> .rc-clear-btn) .rc-filter-pills--drill#rcFilterPills {
    margin-left: -22px;
    padding-left: 0;
    -webkit-mask-image: none;
            mask-image: none;
}
.rc-filter-pills--drill .rc-sub-chip:first-child { padding-left: 32px; }
.rc-filter-pills--drill .rc-sub-chip { position: relative; }
.rc-filter-pills--drill .rc-sub-chip + .rc-sub-chip { margin-left: -20px; padding-left: 32px; }
/* Opties in de drill-down: zelfde stijl als het optie-deel van de gecombineerde chip
   (geen grijze rand), maar neutraal wit; enkel de gekozen optie is groen.
   Een rand in de paginakleur tekent de overlappende ronde kant uit. */
.rc-filter-pills--drill .rc-sub-chip,
.rc-filter-scroll-wrap > .rc-fixed-chip {
    border: 2px solid var(--km-bg);
}
.rc-filter-pills--drill .rc-sub-chip:not(.active) {
    background: var(--km-surface);
    color: var(--km-ink);
    font-weight: 500;
}

/* ── 56. Gecombineerde chip: groepsdeel donkergroen (zoals de plusknop), optie-deel lichtgroen ── */
.rc-combo-main { background: var(--km-accent); color: var(--km-on-accent); }
.rc-combo-sub { background: var(--km-accent-soft); color: var(--km-accent-ink); }

/* ── 57. Recepten: per regio een horizontale carrousel ── */
.rc-shelves { padding-bottom: 16px; }
.rc-shelf { container-type: inline-size; margin-bottom: 22px; }
.rc-shelf-head {
    display: flex; align-items: baseline; justify-content: space-between; gap: 12px;
    padding: 0 16px; margin-bottom: 10px;
}
.rc-shelf-title { margin: 0; font: 700 19px var(--km-font); color: var(--km-ink); }
.rc-shelf-all {
    border: none; background: none; padding: 4px 0; cursor: pointer;
    color: var(--km-accent); font: 700 15px var(--km-font); white-space: nowrap;
}
.rc-shelf-track {
    display: flex; gap: 10px;
    overflow-x: auto; overscroll-behavior-x: contain;
    scroll-snap-type: x mandatory; scroll-padding: 0 16px;
    padding: 0 16px 4px;
    scrollbar-width: none; -webkit-overflow-scrolling: touch;
}
.rc-shelf-track::-webkit-scrollbar { display: none; }
/* Mobiel 2 kaartjes zichtbaar; bredere schermen meer */
.rc-shelf-track > .rc-card { flex: 0 0 calc((100cqw - 32px - 10px) / 2); scroll-snap-align: start; }
@container (min-width: 600px) { .rc-shelf-track > .rc-card { flex-basis: calc((100cqw - 32px - 20px) / 3); } }
@container (min-width: 820px) { .rc-shelf-track > .rc-card { flex-basis: calc((100cqw - 32px - 30px) / 4); } }
@container (min-width: 1100px) { .rc-shelf-track > .rc-card { flex-basis: calc((100cqw - 32px - 40px) / 5); } }

/* ── 58. Recept-foto's: placeholder tonen tot de foto geladen is ── */
.rc-ph--img { position: relative; }
.rc-ph-photo {
    position: absolute; inset: 0;
    width: 100%; height: 100%;
    object-fit: cover; border-radius: inherit;
    opacity: 0; transition: opacity .25s ease;
}
.rc-ph--img.is-loaded .rc-ph-photo { opacity: 1; }
@media (prefers-reduced-motion: reduce) { .rc-ph-photo { transition: none; } }

/* ── 59. Receptkaartje: icoonknoppen onderaan (link links, week menu rechts) ── */
.rc-card-body { flex: 1; }
.rc-card-actions {
    display: flex; align-items: center; gap: 8px;
    margin-top: auto; padding-top: 10px;
}
.rc-card-ic {
    width: 40px; height: 40px; flex-shrink: 0;
    border: 0; border-radius: 999px; padding: 0;
    background: var(--km-accent-tint); color: var(--km-accent-ink);
    display: inline-flex; align-items: center; justify-content: center;
    cursor: pointer; text-decoration: none;
}
.rc-card-ic:active { transform: scale(0.94); }
.rc-card-wm { margin-left: auto; }
/* Link-knop grijs, zelfde grijs als de afgevinkte winkelkar-knop in Week menu */
a.rc-card-ic { background: rgba(128, 128, 128, .16); color: var(--km-muted); }

/* ── 60. Week menu: zoekbalk + plusknop bovenaan, onder de paginatitel ── */
body[data-tab="weekmenu"] .km-addbar { order: 2; padding: 24px 16px 0; }
@media (min-width: 768px) {
    body[data-tab="weekmenu"] .km-addbar { padding-bottom: 0; }
}
/* Zelfde ritme als Recepten: 24px titel → zoekbalk, 10px zoekbalk → filters */
body[data-tab="weekmenu"]:not(.km-wm-empty) #main { padding-top: 12px; }

/* ── 61. Week menu: foto/lijst-wissel rechts naast de paginatitel ── */
.km-title-tools { display: none; margin-left: auto; }
body[data-tab="weekmenu"] .km-title-tools { display: flex; }
.km-view-toggle {
    width: 44px; height: 44px; padding: 0; flex-shrink: 0;
    border: none; border-radius: 999px;
    background: var(--km-surface-2); color: var(--km-muted);
    display: inline-flex; align-items: center; justify-content: center;
    cursor: pointer; margin: -8px 0;
}
.km-view-toggle:active { transform: scale(0.94); }
.km-rs-empty { padding: 6px 4px 12px; font-size: 14px; color: var(--km-muted); }


/* ── 63. Lijstje: "+" in het veld "Voeg producten toe" als gevulde groene knop ── */
body[data-tab="list"] svg.km-addbar-addicon,
#listSearchBar .list-search-icon {
    width: 28px; height: 28px; padding: 6px; box-sizing: border-box; flex-shrink: 0;
    border-radius: 999px;
    background: var(--km-accent);
    color: var(--km-on-accent); stroke: var(--km-on-accent);
    stroke-width: 3;
    margin-left: -6px;
}

/* ── 64. Week menu: zoekbalk en plusknop even groot als in Recepten (48px / 42px) ── */
body[data-tab="weekmenu"] #kmAddBar .km-addbar-btn { height: 48px; gap: 8px; }
body[data-tab="weekmenu"] #kmAddBar .km-addbar-main,
body[data-tab="weekmenu"] #kmAddBar .km-addbar-field { height: 48px; border-radius: 18px; padding: 0 14px; gap: 8px; }
body[data-tab="weekmenu"] #kmAddBar .km-addbar-plus { width: 42px; height: 42px; }
body[data-tab="weekmenu"] #kmAddBar .km-addbar-plus svg { width: 20px; height: 20px; }
