:root {
    --brandColor: #222;
    --brandColor-light: var(--grey);
    --green: #00a651;
    --grey: #f0f0f0;
    --grey-mid: #e0e0e0;
    --text: #1a1a1a;
    --text-muted: #888;
    --radius: 14px;
    --shadow: 0 2px 12px rgba(0,0,0,0.08);
    --shadow-lg: 0 8px 32px rgba(0,0,0,0.14);
    --bg: #f5f5f5;
    --bg-card: white;
    --bg-input: white;
    --text-secondary: #222;
    --text-light: #333;
    --border: #e0e0e0;
}

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

html {
    background: var(--bg-card);
}

html, body {
    height: 100%;
    height: 100svh;
    overflow: hidden;
    overscroll-behavior: none;
}

@supports (-webkit-touch-callout: none) {
    html, body {
        height: -webkit-fill-available;
    }
}

body {
    font-family: 'Outfit', sans-serif;
    background: var(--bg-card);
    color: var(--text);
    margin: 0 auto;
    display: flex;
    flex-direction: column;
    position: fixed;
    inset: 0;
    width: 100%;
}

/* Sync bar */
.sync-bar {
    display: none;
    height: 0;
    background: transparent;
    position: relative;
    overflow: hidden;
    flex-shrink: 0;
    transition: height 0.2s;
}

.sync-bar.syncing {
    display: block;
    height: 3px;
}

.sync-bar.error {
    display: block;    
    height: 0;
}

.sync-bar.syncing::after {
    content: '';
    position: absolute;
    left: -40%;
    width: 40%;
    height: 100%;
    background: var(--green);
    animation: syncSlide 0.9s ease-in-out infinite;
}

.sync-bar.error::after {
    content: '';
    position: absolute;
    inset: 0;
    background: transparent;
}

.sync-bar.ok::after {
    content: '';
    position: absolute;
    inset: 0;
    background: var(--green);
    opacity: 0.5;
}

@keyframes syncSlide {
    0% {
        left: -40%;
    }
    100% {
        left: 140%;
    }
}

/* Header */
.header {
    background: white;
    padding: 0 8px;
    padding-top: env(safe-area-inset-top);
    flex-shrink: 0;
    z-index: 100;
}

.header-top {
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 8px 0;
}

.header-center {
    display: flex;
    flex: 1;
    align-items: center;
    justify-content: center;
    gap: 8px;
    min-width: 0;
}

.header-logo-img {
    width: 36px;
    height: 36px;
    flex-shrink: 0;
}
.header-logo-dark { display: none; }

.header-list-name {
    font-size: 15px;
    font-weight: 600;
    color: var(--text);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.header-arrows-img {
    width: 16px;
    height: 16px;
    flex-shrink: 0;
    opacity: 0.5;
}

.header-icon-btn {
    background: none;
    border: none;
    color: var(--text);
    width: 38px;
    height: 38px;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    border-radius: 10px;
    transition: background 0.12s;
}

.header-icon-btn:active {
    background: var(--grey);
}

.icon-btn {
    background: rgba(255,255,255,0.18);
    border: none;
    border-radius: 10px;
    color: white;
    width: 38px;
    height: 38px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 1.4em;
    transition: background 0.15s;
}

.icon-btn:active {
    background: rgba(255,255,255,0.32);
}

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

.logo-text {
    display: flex;
    flex-direction: column;
}

.logo-icon {
    width: 28px;
    height: 28px;
    flex-shrink: 0;
    filter: brightness(0) invert(1);
}

.logo {
    font-size: 18px;
    font-weight: 500;
}

.logo span {
    opacity: 0.7;
    font-weight: 300;
}

.list-id-label {
    font-size: 10px;
    opacity: 0.65;
    letter-spacing: 0.04em;
}

.header-actions {
    display: flex;
    align-items: center;
    gap: 8px;
}

.locale-wrap {
    position: relative;
}
.locale-btn {
    width: auto;
    padding: 0 10px;
    gap: 4px;
    font-size: 12px;
    font-weight: 700;
    letter-spacing: 0.05em;
}
.locale-chevron {
    font-size: 11px;
    opacity: 0.75;
    margin-left: 1px;
}
/* (locale-dropdown removed — now a bottom sheet) */
.recent-list-btn {
    display: flex;
    align-items: center;
    gap: 8px;
    width: 100%;
    padding: 10px 12px;
    margin-bottom: 6px;
    background: var(--grey);
    border: none;
    border-radius: var(--radius);
    cursor: pointer;
    font-family: inherit;
    font-size: 14px;
    color: var(--text);
    text-align: left;
    transition: background 0.12s;
}
.recent-list-btn:hover { background: var(--grey-mid); }
.recent-list-btn:active { background: var(--brandColor-light); color: var(--brandColor); }

.locale-picker-btn {
    display: flex;
    align-items: center;
    gap: 12px;
    width: 100%;
    padding: 14px 16px;
    margin-bottom: 8px;
    background: var(--grey);
    border: none;
    border-radius: var(--radius);
    cursor: pointer;
    font-family: inherit;
    font-size: 15px;
    color: var(--text);
    text-align: left;
    transition: background 0.12s;
}
.locale-picker-btn:hover { background: var(--grey-mid); }
.locale-picker-btn:active { background: var(--brandColor-light); color: var(--brandColor); }
.locale-picker-code {
    font-weight: 700;
    font-size: 12px;
    letter-spacing: 0.05em;
    min-width: 24px;
    color: var(--brandColor);
}
.locale-picker-name { font-weight: 500; }

.locale-option {
    display: flex;
    align-items: center;
    gap: 10px;
    width: 100%;
    padding: 12px 16px;
    background: none;
    border: none;
    cursor: pointer;
    font-family: inherit;
    font-size: 14px;
    color: var(--text);
    text-align: left;
    transition: background 0.12s;
}
.locale-option:hover {
    background: var(--grey);
}
.locale-option.active {
    background: var(--brandColor-light);
    color: var(--brandColor);
}
.locale-opt-code {
    font-weight: 700;
    font-size: 12px;
    letter-spacing: 0.05em;
    min-width: 22px;
}
.locale-opt-name {
    font-weight: 400;
}

/* Search */
.search-input {
    width: 100%;
    background: rgba(255,255,255,0.95);
    border: none;
    border-radius: 10px;
    padding: 10px 38px 10px 14px;
    font-family: 'Outfit', sans-serif;
    font-size: 15px;
    color: var(--text);
    outline: none;
}

.search-input::placeholder {
    color: var(--text-muted);
}

.search-icon {
    position: absolute;
    right: 12px;
    top: 50%;
    transform: translateY(-50%);
    font-size: 16px;
    color: var(--text-muted);
    pointer-events: none;
}

/* Dropdown */
.search-dropdown {
    position: fixed;
    top: 133px;
    left: 50%;
    transform: translateX(-50%);
    width: min(480px,100vw);
    background: var(--bg-card);
    border-radius: 0 0 var(--radius) var(--radius);
    box-shadow: var(--shadow-lg);
    z-index: 200;
    max-height: 352px;
    overflow-y: auto;
    display: none;
}

.search-dropdown.show {
    display: block;
}

.search-result-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 5px;
    gap: 12px;
    transition: background 0.1s;
    cursor: pointer;
}

.search-result-item:last-child {
    border-bottom: none;
}

.search-result-item:active {
    background: var(--grey);
}

.sri-name {
    font-size: 14px;
    font-weight: 500;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    flex: 1;
    display: flex;
    align-items: center;
    gap: 8px;
}
.sri-name::before {
    content: '+';
    font-size: 18px;
    font-weight: 400;
    color: var(--text-muted);
    flex-shrink: 0;
    line-height: 1;
    min-width: 0;
}

.sri-added {
    font-size: 12px;
    font-weight: 500;
    color: var(--brandColor);
    white-space: nowrap;
    flex-shrink: 0;
}
.sri-recent {
    font-size: 14px;
    flex-shrink: 0;
    opacity: 0.5;
}

.sri-cat {
    font-size: 12px;
    color: var(--text-muted);
    white-space: nowrap;
    flex-shrink: 0;
    text-align: right;
}

.no-results {
    padding: 20px;
    text-align: center;
    color: var(--text-muted);
    font-size: 14px;
}

/* Bottom navigation */
.bottom-nav {
    position: fixed;
    bottom: 10px;
    left: 15px;
    right: 15px;
    background: white;
    border: 1px solid rgba(0,0,0,0.08);
    display: flex;
    z-index: 100;
    padding: 5px;
    gap: 10px;
    border-radius: 99px;
}

.bottom-tab {
    flex: 1 1 0%;
    min-width: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 3px;
    background: none;
    border: none;
    cursor: pointer;
    color: var(--text-secondary);
    font-size: 13px;
    font-family: inherit;
    font-weight: 400;
    padding: 8px 4px;
    transition: color 0.15s;
    overflow: hidden;
}

.bottom-tab > span:not(.tab-icon),
.bottom-tab > span.bottom-tab-label {
    max-width: 100%;
    text-align: center;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.bottom-tab i {
    font-size: 22px;
}

.bottom-tab-label {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 4px;
    max-width: 100%;
    overflow: hidden;
}

.tab-count {
    font-size: 10px;
    font-weight: 700;
    background: var(--grey-mid);
    border-radius: 8px;
    padding: 1px 5px;
    line-height: 1.4;
}

.bottom-tab.active .tab-count {
    background: color-mix(in srgb, var(--brandColor) 15%, transparent);
}


.bottom-tab.active {
    color: #222;
    font-weight: 600;
    background-color: #2222220f;
    border-radius: 99px;    
}

/* Tab icon sets — Heroicons SVG, outline by default, filled when active */
.tab-icon-outline { display: block; width: 24px; height: 24px; }
.tab-icon-filled { display: none; width: 24px; height: 24px; }
.bottom-tab.active .tab-icon-outline { display: none; }
.bottom-tab.active .tab-icon-filled { display: block; }

.tab-nav-badge { display: none; }

/* Tab icon wrapper (used for Android indicator pill) */
.tab-icon {
    display: flex;
    align-items: center;
    justify-content: center;
}

/* ── iOS Liquid Glass floating tab bar ──────────────────────────────
   iOS 26 HIG: floating pill, horizontally centered, 68pt tall,
   liquid glass backdrop, active tab has inner frosted pill           */
#ios-nav-shelf {
    display: none;
}

.standalone .bottom-nav {
    bottom: 0;
}

/* ── Material Design 3 navigation bar ───────────────────────────────
   M3: 80dp bar, 24dp icons, 12sp/500 labels, 64×32dp indicator pill
   behind icon in secondary-container color on active tab             */
.platform-android .bottom-nav {
    bottom: 0;
    left: 0;
    right: 0;
    border-radius: 0;
    border: none;
    border-top: 1px solid rgba(0,0,0,0.08);
    box-shadow: none;
    padding-top: 10px;
    padding-bottom: 10px;
    align-items: center;
}

.platform-android .bottom-tab {
    color: #49454F;
    font-size: 12px;
    font-weight: 500;
    gap: 4px;
}

.platform-android .bottom-tab i {
    font-size: 24px;
}

.platform-android .bottom-tab .tab-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 64px;
    height: 32px;
    border-radius: 16px;
    transition: background 0.2s;
}

.platform-android .bottom-tab.active .tab-icon {
    background: rgba(0,0,0,0.08);
}

.platform-android .bottom-tab.active {
    background: none;
    border-radius: 0;
    color: #222;
    font-weight: 500;
}

main {
    flex: 1;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    padding: 0 0 calc(100px + 60px + 40px);
    background-color: var(--bg-card);
}


main.main--weekmenu {
    overflow: hidden;
    display: flex;
    flex-direction: column;
    padding: 0;
}

main.main--recipes {
    overflow: hidden;
    display: flex;
    flex-direction: column;
    padding: 0;
}

.rc-header {
    flex-shrink: 0;
    background: transparent;
    border-bottom: 1px solid rgba(0,0,0,0.07);
}

.rc-body {
    flex: 1;
    overflow-y: auto;
    background-color: var(--grey);  
    padding-top: 10px;  
    -webkit-overflow-scrolling: touch;
}

.week-days-area {
    flex: 1;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    padding-bottom: 180px;
}

.unplanned-sheet {
    flex-shrink: 0;
    background: var(--bg-card);
    border-radius: 20px 20px 0 0;
    box-shadow: 0 -2px 16px rgba(0,0,0,0.08);
    overflow: hidden;
}
.unplanned-sheet.is-resizing {
    transition: none;
}
.unplanned-sheet-handle-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 16px 4px;
    cursor: pointer;
}
.unplanned-sheet-handle {
    width: 36px;
    height: 4px;
    background: #ddd;
    border-radius: 2px;
    margin: 0 auto 0;
}
.unplanned-sheet-inner {
    height: calc(100% - 48px);
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
}
.unplanned-sheet-scroll {
    display: flex;
    gap: 8px;
    overflow-x: auto;
    padding: 4px 16px 8px;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
}
.unplanned-sheet-scroll::-webkit-scrollbar { display: none; }
.unplanned-sheet-scroll .meal-card-wrap {
    flex-shrink: 0;
    width: 260px;
}

/* Loading */
.loading-overlay {
    position: fixed;
    inset: 0;
    background: var(--bg-card);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    z-index: 999;
    gap: 16px;
}

.loading-overlay.hidden {
    display: none;
}

.loading-spinner {
    width: 42px;
    height: 42px;
    border: 4px solid var(--grey-mid);
    border-top-color: var(--brandColor);
    border-radius: 50%;
    animation: spin 0.7s linear infinite;
}

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

.loading-text {
    font-size: 15px;
    color: var(--text-muted);
    font-weight: 500;
}

/* Category */
.category-section {
    margin-bottom: 0;
}

.category-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: var(--grey);
    padding: 5px 16px;
    margin: 0px 15px;
    border-radius: 8px;
}

.category-section:first-child .category-header {
    border-top: none;
}


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

.cat-emoji {
    font-size: 22px;
}

.cat-name {
    font-weight: 600;
    font-size: 15px;
    color: var(--text);
}

.cat-count {
    background: #aaa;
    color: white;
    border-radius: 20px;
    padding: 2px 8px;
    font-size: 12px;
    font-weight: 700;
    min-width: 22px;
    text-align: center;
}

.category-items {
    margin-top: 4px;
    display: flex;
    flex-direction: column;
}

/* Item card */
.item-card {
    background: transparent;
    border-radius: 12px;
    padding: 7px 28px;
    display: flex;
    align-items: center;
    gap: 12px;
    transition: opacity 0.3s, transform 0.3s, max-height 0.35s, padding 0.35s;
}

.item-card.checking {
    opacity: 0;
    transform: translateX(60px);
    pointer-events: none;
    max-height: 0;
    padding: 0;
    overflow: hidden;
}

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

.item-checkbox {
    width: 24px;
    height: 24px;
    border: 2.5px solid var(--grey-mid);
    border-radius: 12px;
    cursor: pointer;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.15s, border-color 0.15s;
}

.item-checkbox.checked {
    background: var(--green);
    border-color: var(--green);
}

.item-checkbox.checked::after {
    content: '✓';
    color: white;
    font-size: 14px;
    font-weight: 700;
    line-height: 1;
}

.item-info {
    flex: 1;
    min-width: 0;
    overflow: hidden;
}

.item-name {
    font-weight: 500;
    font-size: 15px;
    line-height: 1.3;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    color: var(--text-secondary);
}

.item-note-inline {
    font-size: 13px;
    color: var(--text-muted);
    font-style: italic;
    font-weight: 400;
}

.item-qty {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-shrink: 0;
}

.qty-btn {
    width: 28px;
    height: 28px;
    border: 2px solid var(--grey-mid);
    border-radius: 8px;
    background: none;
    font-size: 18px;
    line-height: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    color: var(--text-muted);
    font-weight: 300;
    transition: border-color 0.12s, color 0.12s;
}

.qty-btn:active {
    border-color: var(--brandColor);
    color: var(--brandColor);
}

.qty-num {
    font-weight: 700;
    font-size: 16px;
    min-width: 20px;
    text-align: center;
}

.item-action-btn {
    position: relative;
    width: 34px;
    height: 34px;
    border: none;
    border-radius: 7px;
    background: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    transition: background 0.12s;
}
.item-action-btn::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 44px;
    height: 44px;
}

.item-action-btn:active {
    background: var(--grey-mid);
}

/* Empty */
.empty-state {
    text-align: center;
    padding: 60px 24px;
    color: var(--text-muted);
    height: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

.main--weekmenu .empty-state {
    height: 70%;
}

.empty-icon {
    font-size: 54px;
    margin-bottom: 14px;
}

.empty-title {
    font-size: 18px;
    font-weight: 600;
    color: var(--text);
    margin-bottom: 8px;
}

.empty-sub {
    font-size: 14px;
    line-height: 1.5;
}

/* Browse */
.browse-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
}

.browse-card {
    background: var(--bg-card);
    border-radius: var(--radius);
    padding: 16px 12px;
    box-shadow: var(--shadow);
    cursor: pointer;
    text-align: center;
    transition: transform 0.1s;
    border: 2px solid transparent;
}

.browse-card:active {
    transform: scale(0.97);
}

.bc-emoji {
    font-size: 32px;
    margin-bottom: 6px;
}

.bc-name {
    font-size: 13px;
    font-weight: 600;
    line-height: 1.3;
}

/* Panel */
.products-panel {
    position: fixed;
    bottom: 0;
    left: 50%;
    transform: translateX(-50%) translateY(100%);
    width: min(480px,100vw);
    background: var(--bg-card);
    border-radius: 20px 20px 0 0;
    box-shadow: none;
    z-index: 300;
    max-height: 65vh;
    display: flex;
    flex-direction: column;
    transition: transform 0.3s cubic-bezier(0.32,0.72,0,1);
}

.products-panel.open {
    transform: translateX(-50%) translateY(0);
    box-shadow: 0 -8px 32px rgba(0,0,0,0.14);
}

.panel-handle {
    width: 40px;
    height: 4px;
    background: var(--grey-mid);
    border-radius: 2px;
    margin: 10px auto 0;
    flex-shrink: 0;
}

.panel-header {
    padding: 12px 16px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-bottom: 1px solid var(--grey-mid);
    flex-shrink: 0;
}

.panel-title {
    font-size: 16px;
    font-weight: 700;
}

.panel-close {
    width: 30px;
    height: 30px;
    border: none;
    background: var(--grey);
    border-radius: 50%;
    cursor: pointer;
    font-size: 18px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.panel-products {
    overflow-y: auto;
    flex: 1;
    padding: 8px 12px 24px;
}

.product-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 11px 12px;
    border-bottom: 1px solid var(--grey);
    gap: 10px;
}

.product-item:last-child {
    border-bottom: none;
}

.pi-name {
    font-size: 14px;
    font-weight: 500;
    flex: 1;
}

.pi-add {
    background: var(--brandColor);
    color: white;
    border: none;
    border-radius: 8px;
    padding: 6px 14px;
    font-family: 'Outfit', sans-serif;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    flex-shrink: 0;
}

.pi-add.added {
    background: var(--green);
}

.panel-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.3);
    z-index: 299;
    display: none;
}

.panel-overlay.show {
    display: block;
}

/* Modals */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.4);
    z-index: 400;
    display: none;
    align-items: flex-end;
    justify-content: center;
}

.modal-overlay.show {
    display: flex;
}

/* connectModal: drops down from beneath the header */
#connectModal {
    display: flex;
    visibility: hidden;
    pointer-events: none;
    align-items: flex-start;
    background: transparent;
    z-index: 90;
    transition: background 0.25s;
}
#connectModal.show {
    visibility: visible;
    pointer-events: auto;
    background: rgba(0,0,0,0.15);
}
#connectModal .modal-box {
    border-radius: 0 0 20px 20px;
    padding-top: calc(54px + env(safe-area-inset-top, 0px));
    padding-bottom: 16px;
    transform: translateY(-100%);
    transition: transform 0.3s cubic-bezier(0.32,0.72,0,1);
    width: min(480px, 100vw);
    border-top: 1px solid rgba(0,0,0,0.08);
}
#connectModal.show .modal-box {
    transform: translateY(0);
}
#connectModal .menu-item {
    padding: 14px 0;
}
#connectInputSheet {
    padding: 20px 20px max(32px, env(safe-area-inset-bottom));
}

.modal-box {
    background: var(--bg-card);
    border-radius: 20px 20px 0 0;
    padding: 12px 20px 40px;
    width: min(480px,100vw);
}
.modal-box .sheet-header {
    margin-left: -20px;
    margin-right: -20px;
    padding-left: 8px;
    padding-right: 8px;
}

.modal-title {
    font-size: 17px;
    font-weight: 700;
    margin-bottom: 14px;
}

.modal-input {
    width: 100%;
    border: 2px solid var(--grey-mid);
    border-radius: 10px;
    padding: 12px 14px;
    font-family: 'Outfit', sans-serif;
    font-size: 15px;
    outline: none;
    resize: none;
    color: var(--text);
}

.modal-input:focus {
    border-color: var(--brandColor);
}

.modal-btns {
    display: flex;
    gap: 10px;
    margin-top: 12px;
}

.btn {
    flex: 1;
    padding: 12px;
    border-radius: 10px;
    border: none;
    font-family: 'Outfit', sans-serif;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
}

.btn-primary {
    background: var(--brandColor);
    color: white;
}

.btn-primary:disabled {
    background: var(--grey-mid);
    cursor: default;
}

.btn-secondary {
    background: var(--grey);
    color: var(--text);
}

/* Share modal */

.share-modal {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.4);
    z-index: 400;
    display: none;
    align-items: flex-end;
    justify-content: center;
}

.share-modal.show {
    display: flex;
}

.share-box {
    background: var(--bg-card);
    border-radius: 20px 20px 0 0;
    padding: 20px 20px max(32px, env(safe-area-inset-bottom));
    width: min(480px,100vw);
}

.share-title {
    font-size: 18px;
    font-weight: 700;
    margin-bottom: 4px;
}

.share-sub {
    font-size: 13px;
    color: var(--text-muted);
    margin-bottom: 16px;
}

.share-list-name {
    font-size: 14px;
    color: var(--text);
    margin-bottom: 12px;
}

.share-url-row {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 14px;
}

.share-link-box {
    flex: 1;
    background: var(--grey);
    border-radius: 10px;
    padding: 0 14px;
    height: 42px;
    font-size: 12px;
    color: var(--text-muted);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    border: 2px solid var(--grey-mid);
    font-family: monospace;
    min-width: 0;
    display: flex;
    align-items: center;
}

.share-icon-btn {
    flex-shrink: 0;
    width: 42px;
    height: 42px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--grey);
    border: 2px solid var(--grey-mid);
    border-radius: 10px;
    color: var(--text);
    cursor: pointer;
    transition: background 0.12s;
}
.share-icon-btn:active { background: var(--brandColor-light); color: var(--brandColor); border-color: var(--brandColor); }

.share-options {
    display: flex;
    gap: 10px;
    flex-direction: column;
}

.share-btn {
    display: flex;
    align-items: center;
    gap: 12px;
    background: var(--grey);
    border: none;
    border-radius: 12px;
    padding: 14px 16px;
    font-family: 'Outfit', sans-serif;
    font-size: 15px;
    font-weight: 500;
    cursor: pointer;
    text-align: left;
    transition: background 0.12s;
}

.share-btn:active {
    background: var(--grey-mid);
}

.share-btn-icon {
    font-size: 22px;
    width: 28px;
}

.share-btn-desc {
    color: #888;
    font-size: 12px;
}

.share-btn-cancel {
    background: transparent;
    color: #aaa;
    justify-content: center;
}

/* Bottom fade */
.bottom-fade {
    display: none;
}
.platform-ios .bottom-fade {
    display: none;
}

/* FAB */
.fab {
    position: fixed;
    bottom: 100px;
    right: 24px;
    background: var(--brandColor);
    color: #ffffff;
    border: none;
    border-radius: 50%;
    width: 52px;
    height: 52px;
    font-size: 1.75em;
    cursor: pointer;
    box-shadow: 0 4px 20px rgba(0,87,255,0.45);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 80;
    transition: transform 0.15s;
    padding-top: 3px;
}

.fab:active {
    transform: scale(0.96);
}

.add-custom-btn {
    width: 100%;
    background: var(--bg-card);
    border: 2px dashed var(--grey-mid);
    border-radius: var(--radius);
    padding: 14px;
    font-family: 'Outfit', sans-serif;
    font-size: 14px;
    color: var(--text-muted);
    cursor: pointer;
    margin-bottom: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    font-weight: 500;
    transition: border-color 0.15s, color 0.15s;
}

.add-custom-btn:active {
    border-color: var(--brandColor);
    color: var(--brandColor);
}

.checked-section {
    margin-top: 16px;
}

.checked-section .category-header {
    background: transparent;
}

.checked-title {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.08em;
    padding: 0 4px 8px;
}

/* Toast */
.toast {
    position: fixed;
    top: 0;
    bottom: auto;
    left: 50%;
    height: auto;
    transform: translateX(-50%) translateY(-12px);
    background: #222;
    color: white;
    padding: 10px 20px;
    border-radius: 10px;
    font-size: 14px;
    font-weight: 500;
    z-index: 500;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s, transform 0.2s;
    white-space: nowrap;
}

.toast.show {
    opacity: 1;
    pointer-events: auto;
    transform: translateX(-50%) translateY(0);
}

.update-toast {
    display: flex;
    align-items: center;
    gap: 4px;
    white-space: nowrap;
}

.update-toast-btn {
    background: white;
    color: #000;
    border: none;
    border-radius: 6px;
    padding: 3px 10px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
}

.meal-toast {
    display: flex;
    align-items: center;
    gap: 4px;
    white-space: nowrap;
}

.meal-toast-undo {
    background: white;
    color: #000;
    border: none;
    border-radius: 6px;
    padding: 3px 10px;
    font-family: inherit;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
}

.today-pill {
    font-size: 11px;
    font-weight: 600;
    color: var(--text-muted);
    border: 1.5px solid var(--grey-mid);
    border-radius: 20px;
    padding: 2px 8px;
    line-height: 1.4;
}

/* New list modal */
.newlist-modal {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.5);
    z-index: 600;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
}

.newlist-box {
    background: var(--bg-card);
    border-radius: 20px;
    padding: 28px 24px;
    width: 100%;
    max-width: 400px;
    text-align: center;
}

.newlist-box h2 {
    font-size: 22px;
    font-weight: 700;
    margin-bottom: 8px;
}

.newlist-box p {
    font-size: 14px;
    color: var(--text-muted);
    margin-bottom: 24px;
    line-height: 1.5;
}

.unit-btn {
    padding: 5px 10px;
    border: 2px solid var(--grey-mid);
    border-radius: 8px;
    background: var(--bg-card);
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    color: var(--text-muted);
    transition: all 0.12s;
}

.unit-btn.active {
    border-color: var(--brandColor);
    color: var(--brandColor);
    background: #fff5f5;
}

.menu-item {
    display: flex;
    align-items: center;
    gap: 10px;
    width: 100%;
    padding: 14px 18px;
    background: none;
    border: none;
    text-align: left;
    font-family: 'Outfit', sans-serif;
    font-size: 14px;
    font-weight: 500;
    color: var(--text);
    cursor: pointer;
    transition: background 0.1s;
}

.menu-item:active {
    background: var(--grey);
}

/* Sheet overlay */
.sheet-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.4);
    z-index: 509;
    display: none;
}
.sheet-overlay.show {
    display: block;
}

/* Bottom sheets */
.bottom-sheet {
    position: fixed;
    bottom: 0;
    left: max(0px, calc(50% - 240px));
    right: max(0px, calc(50% - 240px));
    background: var(--bg-card);
    border-radius: 20px 20px 0 0;
    box-shadow: none;
    z-index: 510;
    display: flex;
    flex-direction: column;
    transform: translateY(100%);
    transition: transform 0.3s cubic-bezier(0.32,0.72,0,1);
    padding-bottom: max(8px, env(safe-area-inset-bottom));
    padding-top: 10px;
}
.bottom-sheet.open {
    transform: translateY(0);
    box-shadow: 0 -8px 32px rgba(0,0,0,0.14);
}

.sheet-handle {
    width: 40px;
    height: 4px;
    background: var(--grey-mid);
    border-radius: 2px;
    margin: 10px auto 6px;
    flex-shrink: 0;
}
.sheet-title {
    padding: 2px 18px 10px;
    font-size: 12px;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.06em;
    border-bottom: 1px solid var(--grey-mid);
    flex-shrink: 0;
}
.sheet-header {
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    align-items: center;
    padding: 4px 4px 12px;
    border-bottom: 1px solid var(--grey-mid);
    margin-bottom: 12px;
    flex-shrink: 0;
}
.sheet-header-title {
    font-size: 15px;
    font-weight: 600;
    color: var(--text);
    text-align: center;
    white-space: nowrap;
}
.weekmenu-action-item {
    display: flex;
    align-items: center;
    gap: 14px;
    width: 100%;
    padding: 16px 20px;
    background: none;
    border: none;
    font-size: 16px;
    font-family: inherit;
    color: var(--text-secondary);
    cursor: pointer;
    text-align: left;
}
.weekmenu-action-item:active { background: var(--grey); }
.weekmenu-action-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    border-radius: 10px;
    background: #e8f0ff;
    color: var(--brandColor);
    flex-shrink: 0;
}
.weekmenu-action-label {
    font-weight: 500;
}

.meal-catalog-toggle {
    display: flex;
    align-items: center;
    gap: 15px;
    font-size: 14px;
    font-weight: 400;
    color: var(--text-muted);
    margin: 4px 0 0;
}
.ui-switch { position: relative; display: inline-flex; align-items: center; cursor: pointer; }
.ui-switch input { opacity: 0; width: 0; height: 0; position: absolute; }
.ui-switch-track {
    width: 44px; height: 26px;
    background: var(--border);
    border-radius: 13px;
    transition: background 0.2s;
    position: relative;
}
.ui-switch-track::after {
    content: '';
    position: absolute;
    top: 3px; left: 3px;
    width: 20px; height: 20px;
    background: var(--bg-card);
    border-radius: 50%;
    box-shadow: 0 1px 3px rgba(0,0,0,0.2);
    transition: transform 0.2s;
}
.ui-switch input:checked + .ui-switch-track { background: var(--brandColor); }
.ui-switch input:checked + .ui-switch-track::after { transform: translateX(18px); }

.sheet-field-label {
    display: block;
    font-size: 14px;
    font-weight: 500;
    color: var(--text-muted);
    margin-bottom: 7px;
}
.sheet-btn-cancel {
    background: none;
    border: none;
    font-size: 15px;
    color: var(--text-muted);
    cursor: pointer;
    padding: 8px;
    text-align: left;
    min-height: 44px;
}
.sheet-btn-submit {
    background: none;
    border: none;
    font-size: 15px;
    font-weight: 600;
    color: var(--green);
    cursor: pointer;
    padding: 8px;
    text-align: right;
    min-height: 44px;
}
.sheet-btn-submit:disabled {
    color: var(--text-muted);
    cursor: default;
}

.menu-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 12px 10px 18px;
    border-bottom: 1px solid var(--grey-mid);
    font-size: 12px;
    color: var(--text-muted);
    font-weight: 500;
}

.menu-header-actions {
    display: flex;
    align-items: center;
    gap: 4px;
}

.menu-header-btn {
    background: var(--grey);
    border: none;
    width: 40px;
    height: 40px;
    cursor: pointer;
    color: #333;
    font-size: 18px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

/* Utility classes for inline styles */
.hidden {
    display: none;
}

.hidden-init {
    display: none;
}

.flex-center {
    display: flex;
    align-items: center;
}

.flex-col {
    display: flex;
    flex-direction: column;
}

.flex-between {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.flex-end {
    display: flex;
    align-items: center;
    justify-content: flex-end;
}

.gap-6 {
    gap: 6px;
}

.gap-8 {
    gap: 8px;
}

.gap-10 {
    gap: 10px;
}

.gap-12 {
    gap: 12px;
}

.mb-8 {
    margin-bottom: 8px;
}

.mb-10 {
    margin-bottom: 10px;
}

.mb-12 {
    margin-bottom: 12px;
}

.mb-14 {
    margin-bottom: 14px;
}

.mb-16 {
    margin-bottom: 16px;
}

.p-0 {
    padding: 0;
}

.w-full {
    width: 100%;
}

.icon-sm {
    width: 22px;
    height: 22px;
    margin-right: 8px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5em;
    vertical-align: middle;
    flex-shrink: 0;
}

.divider-line {
    flex: 1;
    height: 1px;
    background: var(--grey-mid);
}

.divider-text {
    padding: 0 12px;
    color: var(--text-muted);
    font-size: 12px;
}

.emoji-xl {
    font-size: 48px;
    margin-bottom: 12px;
}

.description-text {
    color: var(--text-muted);
    font-size: 14px;
}

.relative {
    position: relative;
}

.error-text {
    color: #e74c3c;
    font-size: 13px;
    display: none;
}

.monospace {
    font-family: monospace;
}

.word-break {
    word-break: break-all;
}

.pre-wrap {
    white-space: pre-wrap;
}

.fixed-overlay {
    position: fixed;
    inset: 0;
}

.fixed-top-right {
    position: fixed;
    z-index: 451;
}

.nerd-modal-content {
    overflow-y: auto;
    flex: 1;
    font-size: 12px;
    font-family: monospace;
    color: var(--text-muted);
    white-space: pre-wrap;
    word-break: break-all;
}

.nerd-modal-style {
    max-height: 70vh;
    display: flex;
    flex-direction: column;
}

.hidden-input {
    position: fixed;
    opacity: 0;
    pointer-events: none;
    width: 1px;
    height: 1px;
    bottom: 50px;
    right: 50px;
}

.fab-search-modal {
    height: auto;
}
.fab-search-modal.with-results {
    max-height: 40vh;
}


.fab-search-header {
    padding: 10px 16px 4px;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    gap: 10px;
}

.fab-search-close {
    background: none;
    border: none;
    font-size: 22px;
    cursor: pointer;
    color: var(--text-muted);
    padding: 4px;
    flex-shrink: 0;
}

.fab-search-results {
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
}
.fab-search-modal.with-results .fab-search-results {
    flex: 1;
}

.fab-section-label {
    padding: 8px 5px 4px;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: #aaa;
}

.icon-colored {
    width: 22px;
    height: 22px;
    color: #333;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5em;
    margin-right: 8px;
    vertical-align: middle;
    flex-shrink: 0;
}

.list-id-display {
    font-weight: 700;
    color: var(--text);
    font-size: 14px;
}

.p-top-12 {
    padding-top: 12px;
}

.p-bottom-10 {
    padding-bottom: 10px;
}

.p-side-18 {
    padding-left: 18px;
    padding-right: 18px;
}

.lni{
    display: inline-flex;
    align-items: center;
}

.platform-ios .fab {
    right: 16px;
    width: 56px;
    height: 56px;
    background: var(--brandColor);
    color: #ffffff;
    box-shadow: 0 4px 24px rgba(0,0,0,0.08), 0 1px 4px rgba(0,0,0,0.06);
}

.platform-android .fab {
    width: 56px;
    height: 56px;
}


/* List search bar */
.list-search-sheet {
    padding-left: 16px;
    padding-right: 16px;
    padding-bottom: 0;
    height: 28vh;
    overflow: hidden;
}

.list-search-wrap {
    display: flex;
    flex-direction: column;
    flex: 1;
    min-height: 0;
}

.list-search-inputs {
    display: flex;
    align-items: center;
    gap: 10px;
    margin: 10px 0px;
    flex-shrink: 0;
}

.list-search-row {
    display: flex;
    align-items: center;
    gap: 8px;
    background: var(--grey);
    border-radius: 12px;
    padding: 0 14px;
    height: 40px;
    flex: 1;
    min-width: 0;
    border: 1.5px solid var(--border);
    transition: border-color 0.15s;
}
.list-search-row:focus-within {
    border-color: #000;
}

.list-search-done-btn {
    flex-shrink: 0;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    border: none;
    background: var(--brandColor);
    color: #fff;
    font-size: 18px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: transform 0.15s;
}
.list-search-done-btn:active {
    transform: scale(0.94);
}

.list-search-icon {
    font-size: 16px;
    color: var(--text-muted);
    flex-shrink: 0;
    line-height: 1;
}

.list-search-input {
    flex: 1;
    height: 100%;
    background: none;
    border: none;
    padding: 0;
    font-family: 'Outfit', sans-serif;
    font-size: 15px;
    color: var(--text);
    outline: none;
    min-width: 0;
}

.list-search-input::placeholder {
    color: var(--text-muted);
}

.list-search-clear-btn {
    display: none;
    flex-shrink: 0;
    align-items: center;
    justify-content: center;
    width: 22px;
    height: 22px;
    border-radius: 50%;
    background: var(--grey);
    border: none;
    padding: 0;
    font-size: 12px;
    color: var(--text-muted);
    cursor: pointer;
    line-height: 1;
}
.list-search-clear-btn:active {
    background: var(--grey-mid);
}
.list-search-input:not(:placeholder-shown) ~ .list-search-clear-btn {
    display: flex;
}

.frequently-added,
.list-search-results {
    display: none;
    padding: 0;
    box-shadow: none;
    flex: 1;
    min-height: 0;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
}

.frequently-added.show,
.list-search-results.show {
    display: block;
}

/* Week menu */
.main--weekmenu {
    background: var(--bg);
}

/* Flat recipe list */
.meal-flat-list {
    padding: 10px 12px 100px;
    display: flex;
    flex-direction: column;
    gap: 8px;
    overflow-y: auto;
    flex: 1;
}

/* Filter bar */
.weekmenu-filter-bar {
    display: flex;
    flex-shrink: 0;
    gap: 5px;
}
.weekmenu-filter-bar:not(.rc-filter-bar) {
    padding: 10px 14px;
    background: var(--bg-card);
    border-bottom: 1px solid rgba(0,0,0,0.07);
}
.weekmenu-filter-btn {
    padding: 4px 10px;
    height: 32px;
    border-radius: 20px;
    border: 1.5px solid rgba(0,0,0,0.15);
    background: transparent;
    color: var(--text-muted);
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    font-family: inherit;
    display: flex;
    align-items: center;
    box-sizing: border-box;
    transition: border-color 0.15s, color 0.15s;
}
.weekmenu-filter-btn.active {
    color: var(--brandColor);
    border-color: var(--brandColor);
}

/* Segmented control (Open / Afgevinkt): one rounded border box, two segments */
.weekmenu-segmented {
    display: flex;
    height: 32px;
    border-radius: 20px;
    border: 1.5px solid rgba(0,0,0,0.15);
    box-sizing: border-box;
    overflow: hidden;
}
.weekmenu-segment-btn {
    padding: 4px 14px;
    height: 100%;
    border: none;
    background: transparent;
    color: var(--text-muted);
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    font-family: inherit;
    display: flex;
    align-items: center;
    box-sizing: border-box;
    transition: background-color 0.15s, color 0.15s;
}
.weekmenu-segment-btn + .weekmenu-segment-btn {
    border-left: 1.5px solid rgba(0,0,0,0.15);
}
.weekmenu-segment-btn.active {
    color: var(--brandColor);
    background: rgba(0,0,0,0.06);
}
.weekmenu-filter-bar--search {
    gap: 10px;
}
.weekmenu-search-field {
    flex: 1;
    position: relative;
    display: flex;
    align-items: center;
}
.weekmenu-search-input {
    flex: 1;
    height: 36px;
    border-radius: 10px;
    border: var(--brandColor) 1.5px solid;
    background: var(--bg-card);
    padding: 0 32px 0 12px;
    font-size: 15px;
    font-family: inherit;
    color: var(--text);
    outline: none;
    width: 100%;
    box-sizing: border-box;
}
.weekmenu-search-input::placeholder {
    color: var(--text-muted);
}
.weekmenu-search-clear {
    position: absolute;
    right: 6px;
    background: none;
    border: none;
    color: var(--text-muted);
    font-size: 14px;
    cursor: pointer;
    padding: 4px;
    line-height: 1;
}
.weekmenu-cancel-btn {
    background: none;
    border: none;
    color: var(--brandColor);
    font-size: 14px;
    font-weight: 500;
    font-family: inherit;
    cursor: pointer;
    padding: 0;
    white-space: nowrap;
    flex-shrink: 0;
}

.meal-flat-list--no-images .meal-thumb,
.meal-flat-list--no-images .meal-thumb-placeholder {
    display: none;
}

.weekmenu-search-btn {
    margin-left: auto;
    width: 34px;
    height: 34px;
    border-radius: 17px;
    border: none;
    background: transparent;
    color: var(--text);
    font-size: 20px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    transition: background 0.15s;
}
.weekmenu-search-btn:active {
    background: var(--grey-mid);
}

/* Meal item checkbox (left side of card) */
.meal-item-checkbox {
    width: 24px;
    height: 24px;
    border: 2.5px solid var(--grey-mid);
    border-radius: 12px;
    cursor: pointer;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.15s, border-color 0.15s;
}
.meal-item-checkbox.checked {
    background: var(--green);
    border-color: var(--green);
}
.meal-item-checkbox.checked::after {
    content: '';
    width: 6px;
    height: 10px;
    border: 2px solid white;
    border-top: none;
    border-left: none;
    transform: rotate(45deg) translate(-1px, -1px);
    display: block;
}

/* Drag handle */
.meal-drag-handle {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 44px;
    color: #ccc;
    cursor: grab;
    flex-shrink: 0;
    touch-action: none;
    -webkit-touch-callout: none;
    margin: -8px -10px -8px -10px;
}
.meal-drag-handle:active {
    cursor: grabbing;
    color: #999;
}
.meal-drag-placeholder {
    border: 2px dashed var(--border);
    border-radius: 14px;
    background: var(--grey);
    flex-shrink: 0;
}

/* Day label on card right side */
.meal-day-label {
    font-size: 11px;
    font-weight: 600;
    color: var(--text-muted);
    flex-shrink: 0;
    min-width: 22px;
    text-align: center;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}
.meal-day-section {
    margin-bottom: 0;
}
.meal-day-section--past {
    opacity: 0.5;
}
.meal-day-section--past {
    opacity: 0.7;
}

.meal-card-wrap {
    display: flex;
    flex-direction: column;
}

.meal-day-badge {
    position: relative;
    width: 34px;
    height: 34px;
    border: none;
    border-radius: 7px;
    background: var(--grey);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    color: var(--text-muted);
    transition: background 0.12s;
    flex-shrink: 0;
}
.meal-day-badge::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 44px;
    height: 44px;
}

.meal-day-badge:active {
    background: var(--grey-mid);
}


.meal-daypicker {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    flex-basis: 100%;
    padding-top: 4px;
    border-top: 1px solid var(--grey-light);
}
.meal-daypicker.hidden {
    display: none;
}

.meal-inline-picker {
    display: flex;
    flex-direction: row;
    gap: 6px;
    padding: 6px 14px 8px;
    background: var(--bg-card);
}

.meal-inline-picker.hidden {
    display: none;
}

.meal-inline-picker .day-chip {
    font-size: 12px;
    padding: 6px 0;
}

.day-chip--clear {
    flex: 0 0 auto;
    padding: 6px 10px !important;
    color: var(--text-muted);
}

.meal-day-header {
    padding: 20px 16px 6px;
    font-weight: 600;
    font-size: 12px;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.08em;
}
.meal-day-section:first-child .meal-day-header {
    padding-top: 12px;
}
.meal-day-header--today {
    color: var(--brandColor);
}

.meal-day-items {
    display: flex;
    flex-direction: column;
    gap: 8px;
    padding: 0 12px 4px;
    min-height: 8px;
    border-radius: 12px;
    transition: background 0.15s;
}

/* Drop zones */
.meal-day-empty {
    min-height: 72px;
    display: flex;
    align-items: center;
    justify-content: center;
}
.meal-drop-slot {
    display: none;
    width: 100%;
    border: 2px dashed var(--border);
    border-radius: 10px;
    padding: 20px 12px;
    text-align: center;
    color: var(--text-muted);
    font-size: 12px;
}
/* Always show drop slot on empty days */
.meal-day-empty .meal-drop-slot { display: block; }
/* Highlight when dragging over */
.drop-zone.drag-over { background: var(--brandColor-light); }
.drop-zone.drag-over .meal-drop-slot { border-color: var(--brandColor); color: var(--brandColor); }

/* Unplanned shelf */
.unplanned-shelf-label {
    font-size: 11px;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.08em;
}

/* Shelf cards */
.shelf-card {
    flex-shrink: 0;
    width: 90px;
    border-radius: 12px;
    background: var(--bg-card);
    box-shadow: 0 1px 4px rgba(0,0,0,0.08), 0 4px 12px rgba(0,0,0,0.05);
    overflow: hidden;
    -webkit-user-select: none;
    user-select: none;
}
.shelf-card-img {
    width: 100%;
    height: 56px;
    object-fit: cover;
    display: block;
}
.shelf-card-placeholder {
    width: 100%;
    height: 56px;
    background: var(--grey);
}
.shelf-card-title {
    font-size: 11px;
    font-weight: 500;
    padding: 5px 7px 6px;
    line-height: 1.3;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.meal-thumb {
    width: 75px;
    height: 55px;
    border-radius: 8px;
    object-fit: cover;
    flex-shrink: 0;
    -webkit-touch-callout: none;
    pointer-events: none;
}
.meal-thumb-placeholder {
    background: var(--grey);
    display: flex;
    align-items: center;
    justify-content: center;
    color: #bbb;
}
.meal-card {
    background: var(--bg-card);
    border-radius: 14px;
    padding: 12px 14px;
    display: flex;
    align-items: center;
    touch-action: manipulation;
    -webkit-touch-callout: none;
    flex-wrap: wrap;
    gap: 10px;
    box-shadow: 0 0px 0px rgba(0, 0, 0, 0.07), 0 3px 5px rgba(0, 0, 0, 0.04);
    /* transition: opacity 0.3s, transform 0.3s, max-height 0.35s, padding 0.35s; */
    border: 1px solid #EFEFEF;
    cursor: pointer;
}


.meal-card.meal-checked {
    opacity: 0.6;
}
.meal-card.meal-checked .item-name {
    text-decoration: line-through;
    color: var(--text-muted);
}
.meal-card.checking {
    opacity: 0;
    transform: translateX(60px);
    pointer-events: none;
    max-height: 0;
    padding: 0;
    overflow: hidden;
}

.meal-info {
    flex: 1;
    min-width: 0;
}

.meal-ref {
    display: block;
    font-size: 12px;
    color: var(--text-muted);
    margin-top: 2px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.meal-ref--url {
    color: var(--brandColor);
}
.meal-ref-link {
    color: var(--brandColor);
    text-decoration: none;
}

.meal-ref-link:active {
    text-decoration: underline;
}

#mealSheet, #catalogSheet {
    padding-left: 20px;
    padding-right: 20px;
    padding-bottom: 20px;
}
#mealSheet .sheet-header, #catalogSheet .sheet-header {
    margin-left: -20px;
    margin-right: -20px;
    padding-left: 8px;
    padding-right: 8px;
}

/* Met "Toevoegen aan databank" aan is de inhoud hoger dan het scherm: laten scrollen,
   kop (Annuleren / Toevoegen) blijft bovenaan staan. */
#mealSheet {
    max-height: calc(100dvh - 72px);
    overflow-y: auto;
    overscroll-behavior: contain;
    -webkit-overflow-scrolling: touch;
}
#mealSheet > * { flex-shrink: 0; }
#mealSheet .sheet-header {
    position: sticky;
    top: -10px;
    z-index: 2;
    background: var(--km-surface-2, var(--bg-card));
}

#mealSheet .modal-input, #catalogSheet .modal-input {
    display: block;
    width: 100%;
}

.day-chips {
    display: flex;
    flex-direction: row;
    gap: 8px;
}

.day-chip {
    flex: 1;
    padding: 8px 0;
    border: 2px solid var(--grey-mid);
    border-radius: 10px;
    background: var(--bg-card);
    font-family: inherit;
    font-size: 13px;
    font-weight: 600;
    color: var(--text-muted);
    cursor: pointer;
    transition: border-color 0.15s, background 0.15s, color 0.15s;
}

.day-chip.active {
    border-color: var(--brandColor);
    background: var(--brandColor-light);
    color: var(--brandColor);
}
.day-chip.today {
    color: var(--brandColor);
    font-weight: 700;
}
.day-chip.today.active {
    color: var(--brandColor);
}

/* ── Generator sheet ─────────────────────────────────────────────────── */
.generator-sheet {
    max-height: 80vh;
    display: flex;
    flex-direction: column;
}
.generator-scroll {
    overflow-y: auto;
    padding: 0 20px 32px;
    flex: 1;
}
.gen-section {
    padding: 14px 0;
    border-bottom: 0.5px solid var(--grey-mid);
}
.gen-label {
    font-size: 11px;
    font-weight: 500;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: .06em;
    margin: 0 0 12px;
}
.gen-stepper-btn {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    border: 0.5px solid #666;
    background: var(--grey-light);
    font-size: 18px;
    cursor: pointer;
    color: var(--text);
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: inherit;
}
.gen-pref-btn {
    padding: 7px 14px;
    border-radius: 999px;
    border: 0.5px solid #666;
    background: var(--bg);
    color: #666;
    font-size: 13px;
    font-family: inherit;
    cursor: pointer;
    white-space: nowrap;
}
.gen-pref-btn.on {
    background: var(--brandColor-light);
    color: var(--brandColor);
    border-color: var(--brandColor);
}
.gen-tog {
    padding: 7px 13px;
    border-radius: 999px;
    border: 0.5px solid #666;
    background: var(--bg);
    color: #666;
    font-size: 13px;
    font-family: inherit;
    cursor: pointer;
    white-space: nowrap;
}
.gen-tog.on {
    background: var(--brandColor-light);
    color: var(--brandColor);
    border-color: var(--brandColor);
}
.gen-tick-label {
    font-size: 11px;
    color: var(--text-muted);
    text-align: center;
    line-height: 1;
    user-select: none;
}
#gen-vegi-slider {
    -webkit-appearance: none;
    appearance: none;
    height: 4px;
    border-radius: 2px;
    outline: none;
    cursor: pointer;
    border: none;
    display: block;
    width: 100%;
    background: var(--grey-mid);
}
#gen-vegi-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 18px; height: 18px;
    border-radius: 50%;
    background: var(--brandColor);
    cursor: pointer;
    border: 2px solid #fff;
    box-shadow: 0 0 0 1px var(--brandColor);
}
#gen-vegi-slider::-moz-range-thumb {
    width: 18px; height: 18px;
    border-radius: 50%;
    background: var(--brandColor);
    cursor: pointer;
    border: 2px solid #fff;
    box-shadow: 0 0 0 1px var(--brandColor);
}
.gen-trigger-btn {
    margin-top: 20px;
    padding: 12px 24px;
    border-radius: 999px;
    border: none;
    background: var(--brandColor-light);
    color: var(--brandColor);
    font-size: 15px;
    font-weight: 600;
    font-family: inherit;
    cursor: pointer;
}

#generatorSheet {
    padding-left: 0;
    padding-right: 0;
}
#generatorSheet .sheet-handle {
    margin-top: 12px;
}
#generatorSheet .sheet-header {
    margin: 0 0 0 0;
    padding-left: 8px;
    padding-right: 8px;
}

/* Recipe catalog tab */
/* Skeleton loading */
@keyframes skeleton-shimmer {
    0%   { background-position: -400px 0; }
    100% { background-position: 400px 0; }
}
.skeleton {
    background: linear-gradient(90deg, var(--grey) 25%, var(--grey-mid) 50%, var(--grey) 75%);
    background-size: 800px 100%;
    animation: skeleton-shimmer 1.4s ease-in-out infinite;
    border-radius: 6px;
}
.rc-skeleton-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
    padding: 0 14px;
}
.rc-skeleton-card {
    background: var(--bg-card);
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 1px 4px rgba(0,0,0,0.08);
}
.rc-skeleton-img {
    width: 100%;
    aspect-ratio: 16/9;
}
.rc-skeleton-body {
    padding: 8px 10px;
    display: flex;
    flex-direction: column;
    gap: 6px;
}
.rc-skeleton-title { height: 13px; width: 75%; }
.rc-skeleton-sub   { height: 11px; width: 45%; }
.rc-skeleton-list  { display: flex; flex-direction: column; padding: 8px 0; }
.rc-skeleton-row {
    display: flex;
    align-items: center;
    padding: 10px 16px;
    gap: 12px;
    border-bottom: 1px solid var(--grey);
}
.rc-skeleton-row-text { height: 15px; flex: 1; max-width: 60%; }
.rc-skeleton-row-btn  { height: 28px; width: 80px; border-radius: 6px; flex-shrink: 0; }

.rc-list {
    display: flex;
    flex-direction: column;
    padding: 8px 0;
}

.rc-row {
    display: flex;
    align-items: center;
    padding: 10px 16px;
    gap: 12px;
    cursor: pointer;
    border-bottom: 1px solid var(--grey);
}

.rc-row:hover .rc-row-name {
    color: var(--brandColor);
}

.rc-row:active {
    background: var(--grey);
}

.rc-row-name {
    flex: 1;
    font-size: 15px;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.rc-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
    padding: 0px 14px;
}

.rc-card {
    background: var(--bg-card);
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 1px 4px rgba(0,0,0,0.08);
    cursor: pointer;
    display: flex;
    flex-direction: column;
}

.rc-card-img {
    width: 100%;
    aspect-ratio: 16/9;
    object-fit: cover;
}

.rc-card-placeholder {
    width: 100%;
    aspect-ratio: 16/9;
    background: var(--grey);
}

.rc-card-body {
    padding: 8px 10px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.rc-card-title {
    flex: 1;
    font-size: 13px;
    font-weight: 600;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.rc-add-btn {
    background: none;
    border: none;
    cursor: pointer;
    color: var(--brandColor);
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 4px 6px;
    border-radius: 6px;
    font-size: 13px;
    font-weight: 600;
    flex-shrink: 0;
    white-space: nowrap;
}

.rc-add-btn:active {
    opacity: 0.6;
}

/* Hide text label on mobile, show on desktop */
.rc-add-label {
    display: none;
}

.rc-filter-bar {
    padding-top: 10px;
    flex-wrap: nowrap;
    align-items: center;
    justify-content: space-between;
    min-width: 0;
}

.rc-filter-scroll-wrap {
    display: flex;
    align-items: center;
    flex: 1;
    min-width: 0;
    gap: 2px;
}

.rc-filter-pills {
    display: flex;
    flex-wrap: nowrap;
    gap: 6px;
    overflow-x: auto;
    scrollbar-width: none;
    -ms-overflow-style: none;
    flex: 1;
    min-width: 0;
    padding-left: 14px;
}

.rc-filter-pills::-webkit-scrollbar {
    display: none;
}

.rc-scroll-btn {
    display: none;
    background: none;
    border: 1px solid rgba(0,0,0,0.12);
    border-radius: 50%;
    width: 28px;
    height: 28px;
    font-size: 20px;
    line-height: 1;
    cursor: pointer;
    color: var(--text);
    flex-shrink: 0;
    align-items: center;
    justify-content: center;
    padding: 0;
}

@media (max-width: 767px) {
    .rc-scroll-left, .rc-scroll-right { display: none !important; }
}

.rc-region-wrap {
    position: relative;
    flex-shrink: 0;
}

.rc-region-arrow {
    font-size: 10px;
    margin-left: 2px;
    display: inline-block;
}

.rc-region-dropdown {
    display: none;
    position: fixed;
    background: var(--bg-card);
    border: 1px solid rgba(0,0,0,0.1);
    border-radius: 10px;
    box-shadow: 0 4px 16px rgba(0,0,0,0.12);
    z-index: 1000;
    min-width: 140px;
    padding: 4px;
    flex-direction: column;
}

.rc-region-dropdown.open {
    display: flex;
}

.rc-region-option {
    background: none;
    border: none;
    text-align: left;
    padding: 9px 14px;
    font-size: 14px;
    cursor: pointer;
    border-radius: 7px;
    color: var(--text);
    white-space: nowrap;
}

.rc-region-option:hover {
    background: var(--grey);
}

.rc-region-option.selected {
    color: var(--brandColor);
    font-weight: 600;
}

.rc-filter-sep {
    color: rgba(0,0,0,0.2);
    font-size: 14px;
    flex-shrink: 0;
    align-self: center;
    user-select: none;
}

.rc-view-btns {
    display: flex;
    gap: 4px;
    flex-shrink: 0;
}

.rc-view-btn-desktop {
    display: none;
}

.rc-view-toggle {
    display: inline-flex;
}

.rc-clear-btn {
    background: var(--grey);
    border: 1.5px solid rgba(0,0,0,0.15);
    border-radius: 20px;
    cursor: pointer;
    color: var(--text-light);
    font-size: 13px;
    padding: 4px 10px;
    flex-shrink: 0;
    line-height: 1;
    white-space: nowrap;
}

.rc-search-row {
    display: flex;
    align-items: center;
    gap: 8px;
    margin: 10px 14px;
}

.rc-search-bar {
    display: flex;
    align-items: center;
    gap: 8px;
    flex: 1;
    padding: 8px 12px;
    border-bottom: none;
    background: var(--grey);
    border-radius: 10px;
}


.rc-search-input {
    flex: 1;
    border: none;
    background: none;
    outline: none;
    font-size: 15px;
    color: var(--text);
    min-width: 0;
}

.rc-search-input::placeholder {
    color: var(--text-light);
}

.rc-search-clear {
    background: none;
    border: none;
    cursor: pointer;
    color: var(--text-light);
    font-size: 14px;
    padding: 2px 4px;
    line-height: 1;
}

/* ── Desktop sidenav ─────────────────────────────────────────────────
   On wide screens, convert the bottom nav into a left-side nav rail  */
@media (min-width: 768px) {
    body {
        flex-direction: column;
        padding-top: 58px;
        padding-left: 220px;
    }

    header {
        position: fixed;
        top: 0;
        left: 0;
        right: 0;
        z-index: 101;
    }

    .bottom-nav {
        position: fixed;
        top: 58px;
        left: 0;
        bottom: 0;
        right: auto;
        width: 220px;
        flex-direction: column;
        align-items: stretch;
        justify-content: flex-start;
        border: none;
        border-right: 1px solid rgba(0,0,0,0.08);
        border-radius: 0;
        padding: 16px 12px 24px 0;
        gap: 4px;
        box-shadow: none;
        z-index: 100;
        background: transparent;
    }

    .bottom-tab {
        flex: 0 0 auto;
        flex-direction: row;
        justify-content: flex-start;
        gap: 12px;
        padding: 12px 16px;
        border-radius: 0 12px 12px 0;
        font-size: 15px;
        text-align: left;
    }

    .bottom-tab > span:not(.tab-icon),
    .bottom-tab > span.bottom-tab-label {
        text-align: left;
        flex: 1;
        display: flex;
        align-items: center;
        justify-content: space-between;
    }

    .bottom-tab .tab-nav-badge {
        margin-left: auto;
    }

    .bottom-tab.active {
        background: color-mix(in srgb, #222 8%, transparent);
    }

    main {
        padding-bottom: 40px;
    }

    main > .category-section:first-child,
    main > .filter-bar + .category-section {
        margin-top: 15px;
    }

    .platform-android .bottom-nav {
        padding-top: 16px;
        align-items: stretch;
    }

    .platform-android .bottom-tab .tab-icon {
        width: 40px;
        height: 40px;
        border-radius: 20px;
    }

    .fab {
        right: 24px;
        bottom: 32px;
    }

    .browse-grid {
        grid-template-columns: 1fr;
        padding: 20px;
    }

    .category-header {
        padding: 5px 16px;
    }

    .cat-name {
        font-size: 14px;
    }

    .item-card {
        padding: 5px 15px;
    }

    .tab-nav-badge {
        display: inline-flex;
        align-items: center;
        justify-content: center;
        background: var(--grey-mid);
        color: var(--text);
        font-size: 11px;
        font-weight: 700;
        min-width: 18px;
        height: 18px;
        border-radius: 9px;
        padding: 0 5px;
        margin-left: 6px;
        line-height: 1;
    }

    .bottom-tab.active .tab-nav-badge {
        background: var(--brandColor);
        color: white;
    }

    main.main--weekmenu {
        padding-top: 0;
    }

    #menuPopup {
        left: 0;
        right: auto;
        top: 58px;
        bottom: 0;
        width: 280px;
        border-radius: 0;
        transform: translateX(-100%);
        transition: transform 0.25s cubic-bezier(0.32,0.72,0,1);
        box-shadow: none;
        padding-top: 0;
        overflow-y: auto;
    }
    #menuPopup.open {
        transform: translateX(0);
        box-shadow: 4px 0 24px rgba(0,0,0,0.1);
    }
    #menuPopup .sheet-handle { display: none; }

    .sheet-overlay {
        left: 220px;
        top: 58px;
        background: rgba(0,0,0,0.15);
    }

    #main .sri-add {
        background: none;
        color: var(--brandColor);
        border: none;
        font-weight: 600;
        padding: 6px 0;
        font-size: 14px;
        cursor: pointer;
        flex-shrink: 0;
    }

    #main .sri-add.added {
        color: var(--green);
    }

    .rc-add-label {
        display: inline;
    }

    .rc-scroll-btn {
        display: none; /* shown by JS only when pills overflow */
    }

    .rc-view-toggle {
        display: none;
    }

    .rc-view-btn-desktop {
        display: inline-flex;
    }

    .rc-grid {
        grid-template-columns: repeat(3, 1fr);
    }
}

/* ── Dark Mode ───────────────────────────────────────────────────────────── */
@media (prefers-color-scheme: dark) {
    :root {
        --bg:              #121212;
        --bg-card:         #1e1e1e;
        --bg-input:        #2a2a2a;
        --text:            #f0f0f0;
        --text-secondary:  #d0d0d0;
        --text-muted:      #a0a0a0;
        --text-light:      #c0c0c0;
        --grey:            #2a2a2a;
        --grey-mid:        #3a3a3a;
        --border:          #3a3a3a;
        --brandColor-light:#0a3d25;
        --shadow:          0 2px 12px rgba(0,0,0,0.5);
        --shadow-lg:       0 8px 32px rgba(0,0,0,0.7);
    }

    /* Bottom nav */
    .bottom-nav {
        background: #222222;
        border-top-color: transparent;
    }
    .bottom-tab {
        color: var(--text-muted);
    }
    .bottom-tab.active {
        color: #fff;
        background-color: rgba(255,255,255,0.08);
    }
    .platform-android .bottom-tab {
        color: var(--text-muted);
    }
    .platform-android .bottom-tab.active {
        color: #fff;
    }
    .platform-android .bottom-tab.active .tab-icon {
        background: rgba(255,255,255,0.12);
    }

    /* Inputs */
    .modal-input,
    input[type="text"],
    input[type="url"] {
        background: var(--bg-input);
        border-color: var(--border);
        color: var(--text);
    }

    /* Sheet handle */
    .unplanned-sheet-handle { background: #555; }

    /* Toggle switch off-state */
    .ui-switch-track { background: #555; }

    /* Toast: was near-black, make it a bit lighter than page bg */
    .toast { background: #2e2e2e; color: var(--text); }

    /* Update-available toast action button */
    .toast-action-btn { color: var(--brandColor); }

    /* Category badge */
    .category-count { background: #555; color: var(--text); }

    /* Drag/drop placeholder */
    .meal-drag-placeholder {
        border-color: var(--border);
        background: var(--grey);
    }

    /* Category header */
    .category-header { background: var(--grey); }

    /* Logo swap */
    .header-logo-light { display: none; }
    .header-logo-dark  { display: block; }

    /* Header + list search bar: dark bg in dark mode */
    .header { background: var(--bg-card); }
    .header-icon-btn { color: var(--text); }
    .header-icon-btn:active { background: var(--grey); }
    .header-arrows-img { filter: invert(1); }

    /* FAB: main action color inverts — black bg/white icon in light, white bg/black icon in dark */
    .fab,
    .platform-ios .fab,
    .platform-android .fab {
        background: #fff;
        color: #000;
        box-shadow: 0 4px 16px rgba(0,0,0,0.5);
    }

    /* Primary buttons (e.g. Opslaan in product/list modals): white bg, black text */
    .btn-primary { background: #fff; color: #000; }
    .btn-primary:disabled { background: var(--grey-mid); color: var(--text-muted); }

    /* Region / filter dropdowns */
    .rc-region-dropdown {
        background: var(--bg-card);
        border-color: var(--border);
        color: var(--text);
    }
    .rc-scroll-btn { border-color: var(--border); }

    /* Colored icon (was brandColor #222, invisible on dark) */
    .icon-colored { color: var(--text); }

    /* Menu/share icons that are flat black SVG images */
    .menu-share-icon { filter: invert(1); }

    /* Nerd-stuff panel: info text */
    .nerd-label { color: var(--text-muted); }

    /* Unit button (active tint was pinkish #fff5f5, invisible on dark) */
    .unit-btn.active { background: #fff; color: #000; border-color: #fff; }

    /* Week menu: match body bg, not card surface */
    .main--weekmenu { background: var(--bg); }

    /* Meal cards: subtle border, no harsh white */
    .meal-card { border-color: var(--border); }

    /* Filter chips: inactive = subtle grey fill (no border), active = accent filled */
    .weekmenu-filter-btn {
        border-color: transparent;
        background: var(--grey-mid);
        color: var(--text-muted);
    }
    .weekmenu-filter-btn.active {
        background: #fff;
        border-color: transparent;
        color: #000;
    }
    .weekmenu-segmented {
        border-color: var(--border);
    }
    .weekmenu-segment-btn + .weekmenu-segment-btn {
        border-left-color: var(--border);
    }
    .weekmenu-segment-btn.active {
        background: #fff;
        color: #000;
    }
    .rc-region-option.selected {
        background: #fff;
        color: #000;
    }
    .weekmenu-action-icon {
        background: rgba(255,255,255,0.1);
        color: #fff;
    }

    /* --brandColor (#222) is invisible on dark surfaces */
    .meal-ref--url,
    .meal-ref-link,
    .rc-add-btn { color: var(--text); }
}
