/* Mobile-first base styles. */

:root {
    --color-bg: #f6f4ee;
    --color-surface: #ffffff;
    --color-border: #d8d3c4;
    --color-text: #2d2a22;
    --color-muted: #6a6557;
    --color-accent: #6b8e4e;
    --color-accent-dark: #4f6c39;
    --color-error: #b3261e;
    --color-info: #2f6690;
    --color-pending: #8a7e4d;
    --color-hover: rgba(0, 0, 0, 0.05); /* subtle hover fill; overridden in dark */

    --radius: 12px;
    --radius-sm: 8px;
    --space-1: 0.5rem;
    --space-2: 1rem;
    --space-3: 1.5rem;
    --space-4: 2rem;

    --font-sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    --font-mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}

/*
 * Dark theme. The effective theme is decided in JS (theme.js): the stored
 * preference, else the system setting — it sets `data-theme` on <html>, so
 * only this single override block is needed. Warm dark palette to match the
 * warm light one; accents stay green.
 */
:root[data-theme="dark"] {
    --color-bg: #1b1a16;
    --color-surface: #26241e;
    --color-border: #3d3930;
    --color-text: #ece7db;
    --color-muted: #a9a28e;
    --color-accent: #7fa45a;
    --color-accent-dark: #9cbd78; /* lighter than accent in dark mode — used for links/secondary text + hovers */
    --color-error: #e3726a;
    --color-info: #79afdc;
    --color-pending: #cdbb6e;
    --color-hover: rgba(255, 255, 255, 0.07);
}
:root[data-theme="dark"] body { color-scheme: dark; }

*, *::before, *::after { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }

body {
    font-family: var(--font-sans);
    color: var(--color-text);
    background: var(--color-bg);
    line-height: 1.5;
    min-height: 100dvh;
    -webkit-text-size-adjust: 100%;
}

a { color: var(--color-accent-dark); }

/* Header */
.app-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--space-2);
    padding: var(--space-2) var(--space-3);
    background: var(--color-accent);
    color: #fff;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.08);
}
.app-header h1 {
    margin: 0;
    font-size: 1.25rem;
    font-weight: 600;
    letter-spacing: 0.02em;
}
.app-header h1 a { color: inherit; text-decoration: none; }
.app-header__slot { display: flex; align-items: center; gap: var(--space-1); }

.app-nav { position: relative; display: flex; align-items: center; gap: var(--space-1); }
.app-nav__link {
    text-decoration: none;
    padding: 0.25rem 0.5rem;
    border-radius: var(--radius-sm);
    font-weight: 500;
}

/* Hamburger toggle — visible on mobile, hidden on desktop. */
.app-nav__toggle {
    display: inline-flex; align-items: center; justify-content: center;
    min-width: 44px; min-height: 44px;
    background: transparent; border: none; color: #fff;
    font-size: 1.4rem; line-height: 1; cursor: pointer;
    border-radius: var(--radius-sm);
}
.app-nav__toggle:hover { background: rgba(255,255,255,0.15); }

/* Mobile: links + logout drop down as a light panel (readable dark text). */
.app-nav__menu {
    position: absolute; top: calc(100% + 6px); right: 0; z-index: 50;
    display: none; flex-direction: column; gap: 0.1rem;
    min-width: 190px; padding: 0.4rem;
    background: var(--color-surface); color: var(--color-text);
    border: 1px solid var(--color-border); border-radius: var(--radius);
    box-shadow: 0 6px 18px rgba(0, 0, 0, 0.18);
}
.app-nav--open .app-nav__menu { display: flex; }
.app-nav__menu .app-nav__link { color: var(--color-text); padding: 0.6rem 0.7rem; }
.app-nav__menu .app-nav__link:hover { background: var(--color-hover); }

.app-nav__logout {
    width: 100%; text-align: left;
    background: transparent; border: none; cursor: pointer; font: inherit;
    color: var(--color-error);
    padding: 0.6rem 0.7rem; border-radius: var(--radius-sm);
    border-top: 1px solid var(--color-border); margin-top: 0.15rem;
}
.app-nav__logout:hover { background: rgba(179, 38, 30, 0.08); }

.app-nav__theme {
    width: 100%; text-align: left;
    background: transparent; border: none; cursor: pointer; font: inherit;
    color: var(--color-text);
    padding: 0.6rem 0.7rem; border-radius: var(--radius-sm);
}
.app-nav__theme:hover { background: var(--color-hover); }

/* Desktop: inline bar, no hamburger. */
@media (min-width: 640px) {
    .app-nav__toggle { display: none; }
    .app-nav__menu {
        position: static; display: flex; flex-direction: row; align-items: center;
        gap: var(--space-1); min-width: 0; padding: 0;
        background: transparent; color: inherit; border: none; box-shadow: none;
    }
    .app-nav__menu .app-nav__link { color: #fff; padding: 0.25rem 0.5rem; }
    .app-nav__menu .app-nav__link:hover { background: rgba(255, 255, 255, 0.15); }
    .app-nav__logout {
        width: auto; margin-top: 0; border: 1px solid rgba(255, 255, 255, 0.5);
        color: #fff; padding: 0.25rem 0.6rem;
    }
    .app-nav__logout:hover { background: rgba(255, 255, 255, 0.15); }
    .app-nav__theme {
        width: auto; color: #fff; padding: 0.25rem 0.5rem;
        border: 1px solid rgba(255, 255, 255, 0.5);
    }
    .app-nav__theme:hover { background: rgba(255, 255, 255, 0.15); }
}

/* Layout */
.app-main {
    padding: var(--space-3);
    max-width: 640px;
    margin: 0 auto;
    display: flex;
    flex-direction: column;
    gap: var(--space-3);
}

.stack { display: flex; flex-direction: column; gap: var(--space-3); }

.card {
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius);
    padding: var(--space-3);
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.04);
    display: flex;
    flex-direction: column;
    gap: var(--space-2);
}
.card h2 {
    margin: 0;
    font-size: 1.1rem;
    color: var(--color-text);
}
.card h3 {
    margin: var(--space-2) 0 0;
    font-size: 0.95rem;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--color-muted);
}

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

/* Forms */
.form { display: flex; flex-direction: column; gap: var(--space-2); }
.form__actions { display: flex; flex-wrap: wrap; gap: var(--space-1); }

.field { display: flex; flex-direction: column; gap: 0.25rem; }
.field__label { font-weight: 500; font-size: 0.9rem; }
.field__hint { margin: 0; color: var(--color-muted); font-size: 0.85rem; }

.input {
    font: inherit;
    color: inherit;
    padding: 0.6rem 0.75rem;
    border-radius: var(--radius-sm);
    border: 1px solid var(--color-border);
    background: var(--color-surface);
    min-height: 44px;
}
.input:focus {
    outline: 2px solid var(--color-accent);
    outline-offset: 1px;
    border-color: var(--color-accent);
}

/* Buttons */
.btn {
    font: inherit;
    font-weight: 600;
    padding: 0.65rem 1rem;
    min-height: 44px;
    border-radius: var(--radius-sm);
    border: 1px solid transparent;
    cursor: pointer;
    background: var(--color-accent);
    color: #fff;
}
.btn:disabled { opacity: 0.6; cursor: progress; }
.btn--primary { background: var(--color-accent); color: #fff; }
.btn--primary:hover:not(:disabled) { background: var(--color-accent-dark); }
.btn--secondary {
    background: var(--color-surface);
    color: var(--color-accent-dark);
    border-color: var(--color-accent-dark);
}
.btn--ghost {
    background: transparent;
    color: var(--color-muted);
    border-color: var(--color-border);
}
.btn--ghost:hover:not(:disabled) { background: rgba(0,0,0,0.04); }

/* Notices */
.notice {
    margin: 0;
    padding: 0.6rem 0.75rem;
    border-radius: var(--radius-sm);
    font-size: 0.95rem;
}
.notice--error { background: rgba(179, 38, 30, 0.1); color: var(--color-error); }
.notice--info { background: rgba(47, 102, 144, 0.1); color: var(--color-info); }
.notice--ok { background: rgba(107, 142, 78, 0.15); color: var(--color-accent-dark); }

/* Members + invitation */
.member-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: var(--space-1); }
.member-list__item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--space-2);
    padding: var(--space-1) 0;
    border-bottom: 1px solid var(--color-border);
}
.member-list__item:last-child { border-bottom: none; }
.member-list__info { display: flex; flex-direction: column; }
.member-list__info .muted { font-size: 0.85rem; }

.invitation { display: flex; flex-direction: column; gap: var(--space-1); }
.invitation__code {
    font-family: var(--font-mono);
    font-size: 1.5rem;
    letter-spacing: 0.2em;
    padding: 0.5rem 0.75rem;
    background: rgba(107, 142, 78, 0.12);
    border-radius: var(--radius-sm);
    align-self: flex-start;
}

/* List header (title + action button) */
.list-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--space-2);
    flex-wrap: wrap;
}

textarea.input {
    min-height: 7rem;
    resize: vertical;
    line-height: 1.45;
    font-family: inherit;
}

/* Meal list */
.meal-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; }
.meal-list__item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.75rem 0;
    border-bottom: 1px solid var(--color-border);
    cursor: pointer;
    gap: var(--space-2);
}
.meal-list__item:last-child { border-bottom: none; }
.meal-list__item:hover { background: rgba(0,0,0,0.02); }
.meal-list__main { display: flex; flex-direction: column; gap: 0.25rem; min-width: 0; }
.meal-list__tags { display: flex; flex-wrap: wrap; gap: 0.25rem; }
.meal-list__chev { color: var(--color-muted); font-size: 1.5rem; line-height: 1; }

/* Meal detail */
.meal-detail__description {
    white-space: pre-wrap;
    margin: 0;
}
.meal-detail__tags { display: flex; flex-wrap: wrap; gap: 0.25rem; }
.small { font-size: 0.85rem; }

/* Link chips (URLs detected in meal description) */
.link-chips { display: flex; flex-direction: column; gap: 0.25rem; }
.link-chip {
    padding: 0.5rem 0.75rem;
    background: rgba(47, 102, 144, 0.08);
    border-radius: var(--radius-sm);
    border: 1px solid rgba(47, 102, 144, 0.2);
    font-size: 0.95rem;
    overflow-wrap: anywhere;
}
.link-chip a { color: var(--color-info); text-decoration: none; font-weight: 500; }
.link-chip a:hover { text-decoration: underline; }
.link-chip__error { color: var(--color-muted); font-size: 0.85rem; }

/* Chips (selectable tag in pickers / list) */
.chip {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    padding: 0.3rem 0.65rem;
    border: 1px solid var(--color-border);
    background: var(--color-surface);
    color: var(--color-text);
    border-radius: 999px;
    font: inherit;
    font-size: 0.85rem;
    cursor: pointer;
    line-height: 1.2;
}
.chip--static { cursor: default; background: rgba(107, 142, 78, 0.1); border-color: rgba(107, 142, 78, 0.25); }
.chip--on { background: var(--color-accent); color: #fff; border-color: var(--color-accent-dark); }
.chip--add {
    background: transparent;
    border-style: dashed;
    color: var(--color-muted);
}
.chip--editable { cursor: default; background: rgba(107, 142, 78, 0.08); }
.chip__action {
    border: none;
    background: transparent;
    cursor: pointer;
    padding: 0 0.15rem;
    color: var(--color-muted);
    font-size: 0.9rem;
    line-height: 1;
}
.chip__action--danger:hover { color: var(--color-error); }

/* Tag picker */
.tag-picker { display: flex; flex-direction: column; gap: var(--space-2); }
.tag-picker__group { display: flex; flex-direction: column; gap: 0.3rem; }
.tag-picker__group-head {
    display: flex; align-items: center; justify-content: space-between;
    gap: var(--space-1);
}
.tag-picker__group-name {
    font-weight: 600; color: var(--color-muted);
    text-transform: uppercase; letter-spacing: 0.05em; font-size: 0.8rem;
}
.tag-picker__chips { display: flex; flex-wrap: wrap; gap: 0.3rem; }
.tag-picker__create { display: flex; flex-wrap: wrap; gap: 0.4rem; align-items: center; margin-top: 0.4rem; }
.tag-picker__create .input { flex: 1 1 12rem; }

/* Tags-admin sections */
.tag-section { display: flex; flex-direction: column; gap: 0.4rem; padding: 0.5rem 0; border-top: 1px solid var(--color-border); }
.tag-section:first-of-type { border-top: none; }
.tag-section__head { display: flex; justify-content: space-between; align-items: center; gap: var(--space-1); flex-wrap: wrap; }
.tag-section__head h3 { margin: 0; }
.tag-section__chips { display: flex; flex-wrap: wrap; gap: 0.3rem; align-items: center; }

.inline-form { display: flex; gap: 0.3rem; flex-wrap: wrap; align-items: center; }
.inline-form--inline .input { width: 9rem; }
.inline-form .input { min-height: 36px; padding: 0.35rem 0.55rem; }
.inline-form .btn { min-height: 36px; padding: 0.35rem 0.7rem; font-size: 0.9rem; }

/* ---------------- Sync indicator pill ---------------- */

.sync-pill {
    font: inherit;
    font-size: 0.8rem;
    font-weight: 600;
    padding: 0.4rem 0.8rem;
    border-radius: 999px;
    border: 1px solid rgba(255,255,255,0.4);
    background: rgba(255,255,255,0.18);
    color: #fff;
    cursor: pointer;
    line-height: 1.2;
    /* 44 px touch target per CLAUDE.md mobile-first guidance — the pill is
       the primary affordance for opening the conflict view. */
    min-height: 44px;
    min-width: 44px;
    white-space: nowrap;
}
.sync-pill:hover { background: rgba(255,255,255,0.3); }
.sync-pill--syncing { background: rgba(255,255,255,0.35); }
.sync-pill--offline { background: rgba(0,0,0,0.2); border-color: rgba(255,255,255,0.25); }
.sync-pill--pending { background: rgba(255,200,50,0.6); color: var(--color-text); border-color: rgba(0,0,0,0.1); }
.sync-pill--conflict { background: var(--color-error); border-color: var(--color-error); }
.sync-pill--error { background: rgba(179, 38, 30, 0.7); }

/* ---------------- Conflict merge table ---------------- */

.conflict-merge {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.9rem;
}
.conflict-merge th, .conflict-merge td {
    padding: 0.5rem 0.5rem;
    border-bottom: 1px solid var(--color-border);
    text-align: left;
    vertical-align: top;
    min-width: 0;
    overflow-wrap: anywhere;
}
.conflict-merge thead th {
    color: var(--color-muted);
    font-weight: 600;
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}
.conflict-merge__cell { transition: background 0.1s ease; }
.conflict-merge__cell:hover { background: rgba(0,0,0,0.03); }
.conflict-merge__cell--active {
    background: rgba(107, 142, 78, 0.15);
    border-left: 3px solid var(--color-accent);
}
.conflict-merge__choice {
    color: var(--color-accent-dark);
    font-weight: 600;
    white-space: nowrap;
}
.conflict-value {
    font-family: var(--font-mono);
    font-size: 0.85rem;
}

/* ---------------- Optimistic-pending indicator ---------------- */

.entry--pending, .chip--pending { opacity: 0.75; }
.entry__pending { color: var(--color-muted); font-weight: normal; font-size: 0.85rem; }

/* ---------------- Stats ---------------- */

.preset-row { display: flex; flex-wrap: wrap; gap: 0.3rem; }

.stat-table { width: 100%; border-collapse: collapse; }
.stat-table th, .stat-table td {
    padding: 0.4rem 0.5rem;
    text-align: left;
    border-bottom: 1px solid var(--color-border);
    font-size: 0.95rem;
}
.stat-table th { color: var(--color-muted); font-weight: 600; font-size: 0.8rem; text-transform: uppercase; letter-spacing: 0.04em; }
.stat-th--right, .stat-td--right { text-align: right; }
.stat-th--sortable {
    cursor: pointer;
    user-select: none;
    /* Touch target ≥ 44 px per CLAUDE.md mobile-first guidance. */
    padding: 0.75rem 0.5rem;
    min-height: 44px;
}
.stat-th--sortable:hover { color: var(--color-text); }

.tag-dist-cat { display: flex; flex-direction: column; gap: 0.4rem; padding: 0.5rem 0; border-top: 1px solid var(--color-border); }
.tag-dist-cat:first-of-type { border-top: none; padding-top: 0; }
.tag-dist-cat__head { display: flex; justify-content: space-between; align-items: baseline; gap: var(--space-1); }

.tag-dist-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 0.25rem; }
.tag-dist-row {
    display: grid;
    grid-template-columns: minmax(6rem, 1fr) minmax(4rem, 2fr) auto;
    gap: 0.5rem;
    align-items: center;
    font-size: 0.9rem;
}
.tag-dist-row__name { color: var(--color-text); }
.tag-dist-row__bar {
    display: block;
    height: 0.55rem;
    background: rgba(107, 142, 78, 0.12);
    border-radius: 999px;
    overflow: hidden;
}
.tag-dist-row__bar-fill {
    display: block;
    height: 100%;
    background: var(--color-accent);
    border-radius: 999px;
    min-width: 2px;
}
.tag-dist-row__num { text-align: right; white-space: nowrap; }

/* ---------------- Meal filter ---------------- */

.meal-filter { display: flex; flex-direction: column; gap: var(--space-1); }
.meal-filter__row { display: flex; gap: var(--space-1); align-items: center; }
.meal-filter__search-wrap { position: relative; flex: 1 1 auto; min-width: 0; }
.meal-filter__search { width: 100%; padding-right: 2.5rem; }
.meal-filter__toggle { white-space: nowrap; flex: 0 0 auto; }

/* Cross-in-circle overlaid on the search field's right edge. Hidden until
   there's something to clear (query or active tags). */
.meal-filter__clear {
    position: absolute;
    top: 50%;
    right: 0.4rem;
    transform: translateY(-50%);
    display: none;
    align-items: center;
    justify-content: center;
    width: 1.6rem;
    height: 1.6rem;
    padding: 0;
    border: none;
    border-radius: 50%;
    background: var(--color-border);
    color: var(--color-text);
    font-size: 0.85rem;
    line-height: 1;
    cursor: pointer;
}
.meal-filter__clear--visible { display: flex; }
.meal-filter__clear:hover { background: var(--color-accent); color: #fff; }

/* Tag chips collapse away until the Filter toggle is pressed. */
.meal-filter__chips { display: none; flex-direction: column; gap: 0.4rem; }
.meal-filter__chips--open { display: flex; }
.meal-filter__group { display: flex; flex-direction: column; gap: 0.2rem; }
.meal-filter__group-name {
    font-weight: 600;
    color: var(--color-muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    font-size: 0.75rem;
}
.meal-filter__group-chips { display: flex; flex-wrap: wrap; gap: 0.25rem; }

/* ---------------- Plan / Week View ---------------- */

.plan { display: flex; flex-direction: column; gap: var(--space-1); }

.plan-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--space-1);
    padding: var(--space-1) var(--space-2);
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius);
    margin-bottom: var(--space-1);
}
.plan-header__center {
    display: flex; flex-direction: column; align-items: center; gap: 0.1rem;
}
/* Date/KW doubles as the "jump to current week" control (replaces the Heute button). */
.plan-header__jump {
    background: transparent; border: none; cursor: pointer;
    font: inherit; color: inherit;
    padding: 0.25rem 0.6rem; border-radius: var(--radius-sm);
    min-height: 44px;
}
.plan-header__jump:hover { background: var(--color-hover); }
.plan-header__sub {
    font-size: 0.75rem;
    color: var(--color-muted);
    text-transform: uppercase;
    letter-spacing: 0.06em;
}

.day-panel { display: flex; flex-direction: column; }

.day-panel__head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--space-1);
    width: 100%;
    padding: 0.6rem var(--space-2);
    background: var(--color-accent);
    color: #fff;
    border: none;
    border-radius: var(--radius);
    margin-bottom: 0.25rem;
    font: inherit;
    font-weight: 600;
    cursor: pointer;
    text-align: left;
    min-height: 44px;
}
.day-panel__head:hover { background: var(--color-accent-dark); }
.day-panel__head--open { border-bottom-left-radius: 0; border-bottom-right-radius: 0; }
.day-panel__head--today { box-shadow: inset 0 0 0 2px rgba(255,255,255,0.4); }
.day-panel__chev { font-size: 0.9rem; opacity: 0.8; }

.day-panel--open > .slot:last-child {
    border-bottom-left-radius: var(--radius);
    border-bottom-right-radius: var(--radius);
}

/* Collapsed day: badge + inline menu preview (reference screenshot). */
.day-row {
    display: flex;
    align-items: stretch;
    gap: 0;
    width: 100%;
    padding: 0;
    margin-bottom: 0.25rem;
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius);
    overflow: hidden;
    font: inherit;
    color: inherit;
    text-align: left;
    cursor: pointer;
    min-height: 44px;
}
.day-row:hover { border-color: var(--color-accent); }
.day-row__badge {
    flex: 0 0 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--color-accent);
    color: #fff;
    font-weight: 700;
}
.day-row__preview {
    flex: 1 1 auto;
    min-width: 0;
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: 0.1rem;
    padding: 0.45rem var(--space-2);
}
.day-row__line {
    font-size: 0.9rem;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.day-row__slot { font-weight: 600; color: var(--color-muted); }
.day-row__empty {
    flex: 1 1 auto;
    display: flex;
    align-items: center;
    padding: 0.45rem var(--space-2);
    color: var(--color-muted);
}
.day-row__chev {
    flex: 0 0 auto;
    display: flex;
    align-items: center;
    padding: 0 var(--space-2);
    color: var(--color-muted);
    font-size: 0.9rem;
}
/* Empty days are a flat light-green block, like the screenshot. */
.day-row--empty { background: rgba(107, 142, 78, 0.16); border-color: transparent; }
.day-row--empty .day-row__badge { background: var(--color-accent); opacity: 0.85; }
.day-row--today { box-shadow: inset 0 0 0 2px var(--color-accent); }

.slot {
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-top: none;
    padding: 0.6rem var(--space-2);
    display: flex; flex-direction: column; gap: 0.4rem;
}
.slot:first-of-type { border-top: 1px solid var(--color-border); }

.slot__head {
    display: flex; align-items: center; justify-content: space-between;
    gap: var(--space-1);
}
.slot__name {
    font-weight: 600;
    color: var(--color-muted);
    text-transform: uppercase;
    letter-spacing: 0.06em;
    font-size: 0.8rem;
}
.slot__actions { display: flex; gap: 0.2rem; }
.slot__actions .btn { min-height: 36px; min-width: 36px; padding: 0.25rem 0.6rem; }

.entry {
    display: grid;
    grid-template-columns: 1fr auto;
    grid-template-areas:
        "body actions"
        "link link";
    gap: 0.3rem;
    padding: 0.4rem 0.6rem;
    background: rgba(107, 142, 78, 0.06);
    border-radius: var(--radius-sm);
    border: 1px solid rgba(107, 142, 78, 0.18);
}
.entry--eaten {
    background: rgba(107, 142, 78, 0.15);
    border-color: rgba(107, 142, 78, 0.4);
}
.entry__body {
    grid-area: body;
    background: transparent;
    border: none;
    padding: 0.4rem 0;
    text-align: left;
    font: inherit;
    color: inherit;
    cursor: pointer;
    min-height: 44px;
    display: flex; align-items: center;
}
.entry__body:hover { color: var(--color-accent-dark); }
.entry__main { display: flex; flex-direction: column; gap: 0.15rem; min-width: 0; }
.entry__note { color: var(--color-muted); font-size: 0.9rem; }
.entry__link {
    grid-area: link;
    color: var(--color-info);
    font-size: 0.85rem;
    text-decoration: none;
    overflow-wrap: anywhere;
    padding: 0.25rem 0;
}
.entry__link:hover { text-decoration: underline; }
.entry__actions {
    grid-area: actions;
    display: flex; flex-direction: column; gap: 0.2rem;
}
.entry__actions .btn { min-height: 44px; min-width: 44px; padding: 0.3rem 0.55rem; font-size: 1.05rem; }

/* ---------------- Modal / Meal picker ---------------- */

.modal-overlay {
    position: fixed; inset: 0;
    background: rgba(0,0,0,0.4);
    display: flex; align-items: center; justify-content: center;
    padding: var(--space-2);
    z-index: 100;
}
.modal {
    background: var(--color-surface);
    border-radius: var(--radius);
    width: 100%;
    max-width: 480px;
    max-height: 90dvh;
    display: flex; flex-direction: column;
    overflow: hidden;
    box-shadow: 0 8px 32px rgba(0,0,0,0.2);
}
.modal__head {
    display: flex; align-items: center; justify-content: space-between;
    padding: var(--space-2);
    border-bottom: 1px solid var(--color-border);
}
.modal__head h3 { margin: 0; }
/* X-in-circle close control for modal headers. */
.modal__close {
    flex: 0 0 auto;
    display: inline-flex; align-items: center; justify-content: center;
    width: 2.25rem; height: 2.25rem; padding: 0;
    border: none; border-radius: 50%;
    background: var(--color-border); color: var(--color-text);
    font-size: 0.95rem; line-height: 1; cursor: pointer;
}
.modal__close:hover { background: var(--color-accent); color: #fff; }
.modal__body { padding: var(--space-2); overflow-y: auto; display: flex; flex-direction: column; gap: var(--space-1); }

.picker-list-wrap { display: contents; }
.picker-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 0.25rem; }
.picker-list__item {
    padding: 0.5rem 0.6rem;
    border: 1px solid var(--color-border);
    border-radius: var(--radius-sm);
    cursor: pointer;
    display: flex; flex-direction: column; gap: 0.25rem;
}
.picker-list__item:hover { background: rgba(0,0,0,0.03); }
/* Exact name match — nudge it visually as the obvious pick. */
.picker-list__item--exact {
    border-color: var(--color-accent);
    box-shadow: inset 0 0 0 1px var(--color-accent);
}
/* Quick-create row — dashed accent border to read as an action, not a meal. */
.picker-list__item--new {
    border-style: dashed;
    border-color: var(--color-accent);
    color: var(--color-accent-dark);
}
.picker-list__item--new:hover { background: rgba(107, 142, 78, 0.08); }
/* Section header inside the picker list (e.g. "Rezept-Vorschläge"). */
.picker-list__section {
    list-style: none;
    padding: 0.5rem 0.2rem 0.15rem;
    font-size: 0.72rem; font-weight: 700; text-transform: uppercase;
    letter-spacing: 0.05em; color: var(--color-muted);
}
/* External recipe suggestion — dashed info-coloured border to set it apart. */
.picker-list__item--recipe { border-style: dashed; border-color: var(--color-info); }
.picker-list__item--recipe:hover { background: var(--color-hover); }
.picker-list__item--muted { cursor: default; border-style: dashed; }
.picker-list__item--muted:hover { background: transparent; }
.picker-list__tags { display: flex; flex-wrap: wrap; gap: 0.2rem; }
.chip--small { font-size: 0.75rem; padding: 0.15rem 0.45rem; }

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

.modal-overlay--bottom { align-items: flex-end; padding: 0; }
.action-sheet {
    background: var(--color-surface);
    width: 100%;
    max-width: 480px;
    border-top-left-radius: var(--radius);
    border-top-right-radius: var(--radius);
    padding: var(--space-2);
    display: flex; flex-direction: column; gap: 0.4rem;
    padding-bottom: max(var(--space-2), env(safe-area-inset-bottom));
}
.action-sheet__head {
    font-weight: 600;
    color: var(--color-muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    font-size: 0.8rem;
    text-align: center;
    padding-bottom: 0.4rem;
    border-bottom: 1px solid var(--color-border);
}
.action-sheet__items { display: flex; flex-direction: column; gap: 0.3rem; }
.action-sheet__item {
    font: inherit;
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-sm);
    padding: 0.85rem 1rem;
    cursor: pointer;
    text-align: center;
    min-height: 48px;
    color: var(--color-text);
}
.action-sheet__item:hover { background: rgba(0,0,0,0.03); }
.action-sheet__item--danger { color: var(--color-error); }
.action-sheet__cancel {
    font: inherit;
    background: rgba(0,0,0,0.05);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-sm);
    padding: 0.85rem 1rem;
    cursor: pointer;
    text-align: center;
    min-height: 48px;
    margin-top: 0.4rem;
    color: var(--color-muted);
    font-weight: 600;
}

/* ---------------- Edit / move modals ---------------- */

.edit-meal-row {
    display: flex; justify-content: space-between; align-items: center;
    gap: var(--space-1);
    padding: 0.5rem 0.6rem;
    border: 1px solid var(--color-border);
    border-radius: var(--radius-sm);
}
.pick-grid { display: flex; flex-wrap: wrap; gap: 0.3rem; }
.pick-grid .chip { min-height: 40px; padding: 0.4rem 0.8rem; }

@media (min-width: 720px) {
    .app-header h1 { font-size: 1.5rem; }
}
