/* ==========================================================================
   MealMate - Design System
   Hell, frisch und einladend. Mobile First. Alle Farben, Abstände und Radien
   kommen aus CSS-Variablen, damit Hell/Dunkel und spätere Anpassungen an
   einer Stelle passieren. Seitenspezifisches liegt in *.razor.css.
   ========================================================================== */

/* --- 1. Tokens ---------------------------------------------------------- */

:root {
    color-scheme: light;

    /* Marke: warmes Tangerine + frisches Kräutergrün + Sonnengelb */
    --accent: #ff6a3d;
    --accent-strong: #f0532a;
    --accent-2: #ff9f43;
    --accent-soft: #fff0e8;
    --accent-contrast: #ffffff;
    --accent-gradient: linear-gradient(135deg, #ff7a45 0%, #ff5a5f 100%);
    --sunny-gradient: linear-gradient(135deg, #ffb547 0%, #ff7a45 100%);
    --fresh-gradient: linear-gradient(135deg, #34c77b 0%, #1fa67a 100%);

    --success: #16a065;
    --success-soft: #e5f7ee;
    --warning: #d98207;
    --warning-soft: #fff4dc;
    --danger: #e5484d;
    --danger-soft: #ffeceb;
    --info: #3a7bf0;
    --info-soft: #eaf1ff;

    /* Farbtöne für Kategorien, Icons und Illustrationen */
    --tone-green: #1fa463;   --tone-green-bg: #e3f7ec;
    --tone-orange: #f26a2e;  --tone-orange-bg: #ffeee4;
    --tone-yellow: #c98a00;  --tone-yellow-bg: #fff5d6;
    --tone-red: #e04b4b;     --tone-red-bg: #ffe9e8;
    --tone-pink: #e0457b;    --tone-pink-bg: #ffe8f0;
    --tone-blue: #2f74e0;    --tone-blue-bg: #e7f0ff;
    --tone-sky: #1a93b8;     --tone-sky-bg: #e0f5fb;
    --tone-violet: #7b55e0;  --tone-violet-bg: #efeaff;
    --tone-neutral: #7a6f67; --tone-neutral-bg: #f3efea;

    --bg: #fffaf5;
    --bg-elevated: #ffffff;
    --surface: #ffffff;
    --surface-2: #fbf5ef;
    --surface-3: #f3ebe3;
    --border: #f0e6dc;
    --border-strong: #e3d6c9;

    --text: #2a1d16;
    --text-muted: #7d6e64;
    --text-subtle: #a99a8f;

    --shadow-sm: 0 1px 2px rgba(120, 66, 30, .05), 0 2px 6px rgba(120, 66, 30, .04);
    --shadow: 0 4px 12px rgba(120, 66, 30, .06), 0 12px 32px rgba(120, 66, 30, .07);
    --shadow-lg: 0 12px 28px rgba(120, 66, 30, .10), 0 32px 64px rgba(120, 66, 30, .12);
    --shadow-accent: 0 8px 22px rgba(255, 106, 61, .32);

    --r-xs: 10px;
    --r-sm: 14px;
    --r: 20px;
    --r-lg: 24px;
    --r-xl: 32px;
    --r-pill: 999px;

    --nav-width: 264px;
    --topbar-height: 68px;
    --bottombar-height: 72px;
    --page-max: 1200px;

    --font: "Plus Jakarta Sans", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
    --font-display: "Bricolage Grotesque", "Plus Jakarta Sans", system-ui, sans-serif;
    --ease: cubic-bezier(.2, .8, .2, 1);
    --spring: cubic-bezier(.34, 1.56, .64, 1);
}

/* Dunkles Design nur auf ausdrücklichen Wunsch (Umschalter / Einstellungen). */
:root[data-theme="dark"] {
    color-scheme: dark;

    --accent: #ff7d55;
    --accent-strong: #ff9670;
    --accent-soft: #3a2219;
    --accent-contrast: #ffffff;

    --success: #3ccf8e;
    --success-soft: #15302a;
    --warning: #f4b13e;
    --warning-soft: #352814;
    --danger: #ff6b6b;
    --danger-soft: #3a1d1e;
    --info: #7ea8ff;
    --info-soft: #1b2540;

    --tone-green: #4fd58f;   --tone-green-bg: #173126;
    --tone-orange: #ff8f5c;  --tone-orange-bg: #3a2419;
    --tone-yellow: #f5c451;  --tone-yellow-bg: #362c14;
    --tone-red: #ff7b7b;     --tone-red-bg: #3a1e1f;
    --tone-pink: #ff7fab;    --tone-pink-bg: #3a1d2a;
    --tone-blue: #7ea8ff;    --tone-blue-bg: #1b2540;
    --tone-sky: #5fd0f0;     --tone-sky-bg: #15303a;
    --tone-violet: #ad93ff;  --tone-violet-bg: #2a2140;
    --tone-neutral: #b3a69c; --tone-neutral-bg: #2c2522;

    --bg: #171211;
    --bg-elevated: #211a18;
    --surface: #211a18;
    --surface-2: #2a2220;
    --surface-3: #352b28;
    --border: #352c29;
    --border-strong: #463a36;

    --text: #fbf4ef;
    --text-muted: #b6a79d;
    --text-subtle: #85776e;

    --shadow-sm: 0 1px 2px rgba(0, 0, 0, .4);
    --shadow: 0 4px 12px rgba(0, 0, 0, .3), 0 12px 32px rgba(0, 0, 0, .35);
    --shadow-lg: 0 12px 32px rgba(0, 0, 0, .45), 0 32px 64px rgba(0, 0, 0, .45);
    --shadow-accent: 0 8px 22px rgba(255, 106, 61, .25);
}

/* --- 2. Basis ----------------------------------------------------------- */

*,
*::before,
*::after {
    box-sizing: border-box;
}

html {
    -webkit-text-size-adjust: 100%;
    scroll-behavior: smooth;
}

body {
    margin: 0;
    background: var(--bg);
    color: var(--text);
    font-family: var(--font);
    font-size: 15px;
    line-height: 1.55;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    overflow-x: hidden;
}

h1, h2, h3, h4 {
    margin: 0;
    font-weight: 700;
    letter-spacing: -.02em;
    line-height: 1.18;
}

h1, h2 {
    font-family: var(--font-display);
    font-weight: 800;
    letter-spacing: -.03em;
}

h1 { font-size: 1.85rem; }
h2 { font-size: 1.3rem; }
h3 { font-size: 1.05rem; }

p { margin: 0 0 .75rem; }

a {
    color: var(--accent-strong);
    text-decoration: none;
}

a:hover { text-decoration: underline; text-underline-offset: 3px; }

img { max-width: 100%; display: block; }

:focus-visible {
    outline: 2.5px solid color-mix(in srgb, var(--accent) 70%, transparent);
    outline-offset: 2px;
    border-radius: 8px;
}

/* Blazor setzt nach jeder Navigation den Fokus auf die Überschrift. */
h1:focus,
h1:focus-visible {
    outline: none;
}

::selection {
    background: color-mix(in srgb, var(--accent) 30%, transparent);
    color: var(--text);
}

/* Icons */
.ico { flex-shrink: 0; display: inline-block; vertical-align: -.18em; }
.ico-text { display: inline-block; line-height: 1; }

/* --- 3. App-Shell ------------------------------------------------------- */

.app {
    min-height: 100dvh;
    display: flex;
    flex-direction: column;
    background:
        radial-gradient(1200px 520px at 100% -10%, color-mix(in srgb, var(--accent-2) 9%, transparent), transparent 60%),
        radial-gradient(900px 480px at -10% 110%, color-mix(in srgb, var(--tone-green) 6%, transparent), transparent 60%),
        var(--bg);
}

.app-body {
    flex: 1;
    display: flex;
    min-width: 0;
}

.sidebar {
    display: none;
    width: var(--nav-width);
    flex-shrink: 0;
    background: var(--bg-elevated);
    border-right: 1px solid var(--border);
    padding: 1.4rem 1rem 1.25rem;
    position: sticky;
    top: 0;
    height: 100dvh;
    overflow-y: auto;
    flex-direction: column;
}

.brand {
    display: flex;
    align-items: center;
    gap: .65rem;
    font-family: var(--font-display);
    font-weight: 800;
    font-size: 1.3rem;
    letter-spacing: -.035em;
    color: var(--text);
    margin: 0 .35rem 1.6rem;
    text-decoration: none;
}

.brand:hover { text-decoration: none; }

.brand-mark {
    --mark: 36px;
    width: var(--mark);
    height: var(--mark);
    border-radius: calc(var(--mark) * .32);
    background: var(--accent-gradient);
    display: grid;
    place-items: center;
    flex-shrink: 0;
    box-shadow: var(--shadow-accent);
    transform: rotate(-6deg);
    transition: transform .3s var(--spring);
}

.brand:hover .brand-mark { transform: rotate(0) scale(1.05); }

.nav-section {
    display: flex;
    flex-direction: column;
    gap: 3px;
}

.nav-label {
    font-size: .7rem;
    text-transform: uppercase;
    letter-spacing: .1em;
    color: var(--text-subtle);
    font-weight: 700;
    margin: 1.4rem .8rem .45rem;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: .75rem;
    padding: .65rem .8rem;
    border-radius: var(--r-sm);
    color: var(--text-muted);
    font-weight: 600;
    font-size: .93rem;
    transition: background .15s var(--ease), color .15s var(--ease), transform .15s var(--ease);
}

.nav-item:hover {
    background: var(--surface-2);
    color: var(--text);
    text-decoration: none;
}

.nav-item .icon { color: var(--text-subtle); transition: color .15s var(--ease); }
.nav-item:hover .icon { color: var(--accent); }

.nav-item.active {
    background: var(--accent-soft);
    color: var(--accent-strong);
    font-weight: 700;
}

.nav-item.active .icon { color: var(--accent); }

.nav-item .count {
    margin-left: auto;
    background: var(--surface-3);
    color: var(--text-muted);
    font-size: .72rem;
    font-weight: 800;
    padding: .1rem .5rem;
    border-radius: var(--r-pill);
}

.nav-item.active .count {
    background: var(--accent);
    color: var(--accent-contrast);
}

/* Kleiner Teaser unten in der Seitenleiste */
.nav-promo {
    margin-top: auto;
    position: relative;
    display: block;
    border-radius: var(--r);
    overflow: hidden;
    min-height: 128px;
    color: #fff;
    text-decoration: none;
    box-shadow: var(--shadow);
    transform: translateY(0);
    transition: transform .2s var(--ease), box-shadow .2s var(--ease);
}

.sidebar .nav-promo { margin-top: 1.5rem; }

.nav-promo:hover { text-decoration: none; transform: translateY(-2px); box-shadow: var(--shadow-lg); }

.nav-promo img {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform .5s var(--ease);
}

.nav-promo:hover img { transform: scale(1.05); }

.nav-promo::after {
    content: "";
    position: absolute;
    inset: 0;
    background: linear-gradient(to top, rgba(40, 16, 6, .78), rgba(40, 16, 6, .05) 70%);
}

.nav-promo-body {
    position: absolute;
    inset: auto 0 0;
    z-index: 1;
    padding: .85rem .95rem;
    display: flex;
    flex-direction: column;
    font-size: .78rem;
    line-height: 1.35;
}

.nav-promo-body strong { font-size: .95rem; font-family: var(--font-display); }

/* Topbar */

.topbar {
    position: sticky;
    top: 0;
    z-index: 30;
    height: var(--topbar-height);
    display: flex;
    align-items: center;
    gap: .6rem;
    padding: 0 1rem;
    background: color-mix(in srgb, var(--bg) 82%, transparent);
    backdrop-filter: saturate(180%) blur(16px);
    -webkit-backdrop-filter: saturate(180%) blur(16px);
    border-bottom: 1px solid color-mix(in srgb, var(--border) 70%, transparent);
}

.topbar .brand { margin: 0; }

.topbar-spacer { flex: 1; }

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

.page {
    width: 100%;
    max-width: var(--page-max);
    margin: 0 auto;
    padding: 1.25rem 1rem calc(var(--bottombar-height) + 2.25rem);
    animation: page-in .35s var(--ease);
}

@keyframes page-in { from { opacity: 0; transform: translateY(6px) } to { opacity: 1; transform: none } }

.page-head {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 1rem;
    flex-wrap: wrap;
    margin-bottom: 1.4rem;
}

.page-head .subtitle {
    color: var(--text-muted);
    font-size: .95rem;
    margin: .3rem 0 0;
}

.eyebrow {
    display: inline-flex;
    align-items: center;
    gap: .35rem;
    font-size: .75rem;
    font-weight: 800;
    letter-spacing: .08em;
    text-transform: uppercase;
    color: var(--accent);
    margin-bottom: .35rem;
}

/* Bottom Navigation (Mobile) */

.bottombar {
    position: fixed;
    left: .6rem;
    right: .6rem;
    bottom: calc(.6rem + env(safe-area-inset-bottom, 0px));
    z-index: 40;
    height: var(--bottombar-height);
    display: flex;
    align-items: stretch;
    padding: .35rem;
    background: color-mix(in srgb, var(--bg-elevated) 90%, transparent);
    backdrop-filter: saturate(180%) blur(18px);
    -webkit-backdrop-filter: saturate(180%) blur(18px);
    border: 1px solid var(--border);
    border-radius: 24px;
    box-shadow: var(--shadow-lg);
}

.bottombar a {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 3px;
    color: var(--text-subtle);
    font-size: .66rem;
    font-weight: 700;
    text-decoration: none;
    position: relative;
    border-radius: 18px;
    transition: color .15s var(--ease), background .15s var(--ease);
}

.bottombar a .icon {
    display: grid;
    place-items: center;
    width: 40px;
    height: 28px;
    border-radius: var(--r-pill);
    transition: background .2s var(--ease), transform .25s var(--spring);
}

.bottombar a.active { color: var(--accent-strong); }
.bottombar a.active .icon { background: var(--accent-soft); color: var(--accent); transform: translateY(-1px); }

/* Mittlerer Eintrag (Swipe) als hervorgehobener Button */
.bottombar a[href="/swipe"] .icon {
    width: 46px;
    height: 46px;
    margin-top: -20px;
    border-radius: 16px;
    background: var(--accent-gradient);
    color: #fff;
    box-shadow: var(--shadow-accent);
    transform: rotate(-6deg);
}

.bottombar a[href="/swipe"].active .icon { transform: rotate(0) scale(1.05); color: #fff; background: var(--accent-gradient); }

/* --- 4. Bausteine ------------------------------------------------------- */

.card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--r);
    padding: 1.1rem;
    box-shadow: var(--shadow-sm);
}

.card-lg { border-radius: var(--r-lg); padding: 1.35rem; }

.card-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: .5rem .75rem;
    margin-bottom: .9rem;
}

.card-head h2, .card-head h3 {
    font-size: 1.05rem;
    font-family: var(--font);
    font-weight: 800;
    letter-spacing: -.02em;
    display: flex;
    align-items: center;
    gap: .5rem;
}

.card-head .ico { color: var(--accent); }

.grid {
    display: grid;
    gap: 1rem;
}

.grid-2 { grid-template-columns: minmax(0, 1fr); }
.grid-auto { grid-template-columns: repeat(auto-fill, minmax(min(100%, 230px), 1fr)); }
.grid-cards { grid-template-columns: repeat(auto-fill, minmax(min(100%, 260px), 1fr)); }
.grid-stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }

.stack { display: flex; flex-direction: column; gap: .75rem; }
.row { display: flex; align-items: center; gap: .6rem; flex-wrap: wrap; }

/* Zeile aus mehreren Eingabefeldern: am Desktop nebeneinander,
   auf schmalen Geräten bricht sie um (siehe Media Query unten). */
.row-fields {
    display: flex;
    align-items: flex-end;
    gap: .5rem;
    flex-wrap: nowrap;
}

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

.row-tight { display: flex; align-items: center; gap: .35rem; }
.spacer { flex: 1; }

/* Buttons */

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: .5rem;
    border: 1px solid transparent;
    border-radius: var(--r-pill);
    padding: .62rem 1.15rem;
    font: inherit;
    font-weight: 700;
    font-size: .9rem;
    line-height: 1.2;
    cursor: pointer;
    background: var(--surface-2);
    color: var(--text);
    transition: transform .15s var(--spring), background .15s var(--ease), box-shadow .2s var(--ease), opacity .15s, border-color .15s;
    text-decoration: none;
    white-space: nowrap;
}

.btn:hover { text-decoration: none; background: var(--surface-3); }
.btn:active { transform: scale(.96); }

.btn:disabled,
.btn[disabled] {
    opacity: .5;
    cursor: not-allowed;
    transform: none;
}

.btn-primary {
    background: var(--accent-gradient);
    color: var(--accent-contrast);
    box-shadow: var(--shadow-accent);
}

.btn-primary:hover {
    background: var(--accent-gradient);
    filter: brightness(1.05);
    transform: translateY(-1px);
    box-shadow: 0 12px 26px rgba(255, 106, 61, .38);
}

.btn-primary:active { transform: scale(.96); }

.btn-ghost {
    background: var(--surface);
    border-color: var(--border-strong);
    color: var(--text);
}

.btn-ghost:hover { background: var(--surface-2); border-color: var(--text-subtle); }

.btn-quiet {
    background: transparent;
    color: var(--text-muted);
    padding: .45rem .7rem;
}

.btn-quiet:hover { background: var(--surface-2); color: var(--text); }

.btn-danger { background: var(--danger); color: #fff; }
.btn-danger:hover { background: var(--danger); filter: brightness(1.06); }
.btn-success { background: var(--fresh-gradient); color: #fff; box-shadow: 0 8px 20px rgba(31, 166, 122, .28); }
.btn-success:hover { background: var(--fresh-gradient); filter: brightness(1.05); }
.btn-soft { background: var(--accent-soft); color: var(--accent-strong); }
.btn-soft:hover { background: color-mix(in srgb, var(--accent) 16%, var(--surface)); }

.btn-sm { padding: .4rem .8rem; font-size: .8rem; gap: .35rem; }
.btn-lg { padding: .85rem 1.5rem; font-size: 1rem; }
.btn-block { width: 100%; }

.btn-icon {
    width: 40px;
    height: 40px;
    padding: 0;
    border-radius: 14px;
    background: var(--surface);
    border: 1px solid var(--border);
    color: var(--text-muted);
    display: inline-grid;
    place-items: center;
    cursor: pointer;
    flex-shrink: 0;
    font: inherit;
    transition: background .15s var(--ease), color .15s var(--ease), transform .15s var(--spring);
}

.btn-icon:hover { background: var(--surface-2); color: var(--accent); text-decoration: none; }
.btn-icon:active { transform: scale(.92); }

/* Chips / Badges */

.chip {
    display: inline-flex;
    align-items: center;
    gap: .3rem;
    padding: .24rem .65rem;
    border-radius: var(--r-pill);
    background: var(--surface-2);
    color: var(--text-muted);
    font-size: .75rem;
    font-weight: 700;
    border: 1px solid transparent;
    white-space: nowrap;
    line-height: 1.35;
}

.chip-button {
    cursor: pointer;
    font-family: inherit;
    border-color: var(--border);
    background: var(--surface);
    padding: .4rem .85rem;
    font-size: .8rem;
    transition: background .15s var(--ease), color .15s var(--ease), border-color .15s, transform .15s var(--spring);
}

.chip-button:active { transform: scale(.95); }

/* "✕" innerhalb eines Chips (z. B. Grundzutaten entfernen) */
.chip > button {
    border: 0;
    background: transparent;
    color: inherit;
    font: inherit;
    font-size: .7rem;
    line-height: 1;
    padding: 0;
    margin-left: .15rem;
    opacity: .55;
    cursor: pointer;
    display: inline-grid;
    place-items: center;
}

.chip > button:hover { opacity: 1; color: var(--danger); }

.chip-button:hover { background: var(--surface-2); color: var(--text); border-color: var(--border-strong); }
.chip-button.selected { background: var(--text); border-color: var(--text); color: var(--bg); }

.chip-success { background: var(--success-soft); color: var(--success); }
.chip-warning { background: var(--warning-soft); color: var(--warning); }
.chip-danger { background: var(--danger-soft); color: var(--danger); }
.chip-info { background: var(--info-soft); color: var(--info); }
.chip-accent { background: var(--accent-soft); color: var(--accent-strong); }

.badge-dot {
    position: absolute;
    top: -5px;
    right: -5px;
    min-width: 19px;
    height: 19px;
    padding: 0 5px;
    border-radius: var(--r-pill);
    background: var(--accent-gradient);
    color: #fff;
    font-size: .64rem;
    font-weight: 800;
    display: grid;
    place-items: center;
    border: 2px solid var(--bg);
}

/* Farbtöne (Hintergrund + Vordergrund) */

.tone-green { --tone: var(--tone-green); --tone-bg: var(--tone-green-bg); }
.tone-orange { --tone: var(--tone-orange); --tone-bg: var(--tone-orange-bg); }
.tone-yellow { --tone: var(--tone-yellow); --tone-bg: var(--tone-yellow-bg); }
.tone-red { --tone: var(--tone-red); --tone-bg: var(--tone-red-bg); }
.tone-pink { --tone: var(--tone-pink); --tone-bg: var(--tone-pink-bg); }
.tone-blue { --tone: var(--tone-blue); --tone-bg: var(--tone-blue-bg); }
.tone-sky { --tone: var(--tone-sky); --tone-bg: var(--tone-sky-bg); }
.tone-violet { --tone: var(--tone-violet); --tone-bg: var(--tone-violet-bg); }
.tone-neutral { --tone: var(--tone-neutral); --tone-bg: var(--tone-neutral-bg); }

/* Rundes/abgerundetes Icon-Feld in einem Farbton: <span class="icon-tile tone-green"><Icon/></span> */
.icon-tile {
    --size: 44px;
    width: var(--size);
    height: var(--size);
    border-radius: calc(var(--size) * .32);
    display: inline-grid;
    place-items: center;
    flex-shrink: 0;
    background: var(--tone-bg, var(--accent-soft));
    color: var(--tone, var(--accent));
}

.icon-tile-sm { --size: 34px; }
.icon-tile-lg { --size: 56px; }

/* Lebensmittel-Vorschaubild (FoodThumb) */
.food-thumb {
    --thumb: 48px;
    width: var(--thumb);
    height: var(--thumb);
    border-radius: calc(var(--thumb) * .3);
    display: inline-grid;
    place-items: center;
    flex-shrink: 0;
    background: var(--tone-bg, var(--surface-2));
    color: var(--tone, var(--text-muted));
    overflow: hidden;
}

.food-thumb.has-photo {
    background: linear-gradient(145deg, #fff, var(--surface-2));
    border: 1px solid var(--border);
}

.food-thumb img {
    width: 82%;
    height: 82%;
    object-fit: contain;
    filter: drop-shadow(0 3px 4px rgba(80, 40, 10, .14));
}

:root[data-theme="dark"] .food-thumb.has-photo { background: linear-gradient(145deg, #f7efe8, #e9ddd2); }

/* Formulare */

.field { display: flex; flex-direction: column; gap: .35rem; }

.field label,
.form-label {
    font-size: .8rem;
    font-weight: 700;
    color: var(--text-muted);
}

.input,
.select,
input[type="text"],
input[type="email"],
input[type="password"],
input[type="number"],
input[type="date"],
input[type="search"],
input[type="url"],
textarea,
select {
    width: 100%;
    padding: .7rem .9rem;
    border: 1.5px solid var(--border);
    border-radius: var(--r-sm);
    background: var(--surface);
    color: var(--text);
    font: inherit;
    font-size: .93rem;
    transition: border-color .15s var(--ease), box-shadow .15s var(--ease), background .15s;
}

.input:hover, input:hover, textarea:hover, select:hover { border-color: var(--border-strong); }

textarea { resize: vertical; min-height: 92px; }

select {
    appearance: none;
    -webkit-appearance: none;
    padding-right: 2.3rem;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%23a99a8f' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right .8rem center;
}

.input:focus,
.select:focus,
input:focus,
textarea:focus,
select:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 4px color-mix(in srgb, var(--accent) 16%, transparent);
}

input[type="checkbox"], input[type="radio"] {
    width: 1.15rem;
    height: 1.15rem;
    accent-color: var(--accent);
    cursor: pointer;
}

.check {
    display: flex;
    align-items: center;
    gap: .6rem;
    font-size: .9rem;
    font-weight: 600;
    color: var(--text);
    cursor: pointer;
}

/* Suchfeld mit Icon: <div class="search-field"><Icon Name="search"/><input/></div> */
.search-field { position: relative; display: block; }
.search-field > .ico { position: absolute; left: .95rem; top: 50%; transform: translateY(-50%); color: var(--text-subtle); pointer-events: none; }
.search-field > input { padding-left: 2.6rem; border-radius: var(--r-pill); background: var(--surface); }

.form-grid {
    display: grid;
    gap: .9rem;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
}

.validation-message, .text-danger {
    color: var(--danger);
    font-size: .82rem;
    font-weight: 600;
}

/* Segmented Control */

.segmented {
    display: inline-flex;
    padding: 4px;
    gap: 2px;
    background: var(--surface-3);
    border-radius: var(--r-pill);
    max-width: 100%;
    overflow-x: auto;
    scrollbar-width: none;
}

.segmented::-webkit-scrollbar { display: none; }

.segmented button {
    border: 0;
    background: transparent;
    color: var(--text-muted);
    font: inherit;
    font-weight: 700;
    font-size: .82rem;
    padding: .45rem .95rem;
    border-radius: var(--r-pill);
    cursor: pointer;
    white-space: nowrap;
    display: inline-flex;
    align-items: center;
    gap: .35rem;
    transition: background .15s var(--ease), color .15s var(--ease), box-shadow .15s;
}

.segmented button:hover { color: var(--text); }

.segmented button.active {
    background: var(--surface);
    color: var(--text);
    box-shadow: var(--shadow-sm);
}

/* Scrollbare Filterleiste */

.filter-bar {
    display: flex;
    gap: .5rem;
    overflow-x: auto;
    padding: .1rem .1rem .45rem;
    scrollbar-width: none;
    -ms-overflow-style: none;
}

.filter-bar::-webkit-scrollbar { display: none; }

/* Kennzahlen */

.stat {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--r);
    padding: 1rem 1.05rem;
    display: flex;
    flex-direction: column;
    gap: .1rem;
    box-shadow: var(--shadow-sm);
    position: relative;
    overflow: hidden;
    min-width: 0;
}

.stat .stat-icon {
    width: 40px;
    height: 40px;
    border-radius: 13px;
    display: grid;
    place-items: center;
    background: var(--tone-bg, var(--accent-soft));
    color: var(--tone, var(--accent));
    margin-bottom: .6rem;
}

.stat .stat-label {
    font-size: .8rem;
    font-weight: 600;
    color: var(--text-muted);
}

.stat .stat-value {
    font-family: var(--font-display);
    font-size: 1.65rem;
    font-weight: 800;
    letter-spacing: -.03em;
    line-height: 1.15;
    overflow-wrap: anywhere;
}

.stat .stat-hint { font-size: .76rem; color: var(--text-subtle); font-weight: 500; }

.stat-accent {
    background: var(--accent-gradient);
    border-color: transparent;
    color: #fff;
    box-shadow: var(--shadow-accent);
}

.stat-accent::after {
    content: "";
    position: absolute;
    right: -30px;
    top: -30px;
    width: 120px;
    height: 120px;
    border-radius: 50%;
    background: rgba(255, 255, 255, .14);
}

.stat-accent .stat-icon { background: rgba(255, 255, 255, .22); color: #fff; }
.stat-accent .stat-label, .stat-accent .stat-hint { color: rgba(255, 255, 255, .88); }

/* Listen */

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

.list-row {
    display: flex;
    align-items: center;
    gap: .8rem;
    padding: .75rem 0;
    border-bottom: 1px solid var(--border);
}

.list-row:last-child { border-bottom: 0; }

button.list-row, a.list-row { color: inherit; text-decoration: none; border-radius: var(--r-sm); transition: background .15s; }
button.list-row:hover, a.list-row:hover { background: var(--surface-2); }

.list-title { font-weight: 700; font-size: .94rem; display: block; }
.list-sub { font-size: .8rem; color: var(--text-muted); display: block; }

.avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    display: grid;
    place-items: center;
    background: var(--tone-bg, var(--surface-3));
    color: var(--tone, var(--text));
    font-weight: 800;
    font-size: .8rem;
    flex-shrink: 0;
    text-decoration: none;
    border: 2px solid var(--surface);
}

.avatar:hover { text-decoration: none; }

.avatar-me {
    background: var(--sunny-gradient);
    color: #fff;
    box-shadow: 0 0 0 2px var(--accent-soft);
}

.avatar-stack { display: flex; }
.avatar-stack .avatar { margin-left: -8px; }
.avatar-stack .avatar:first-child { margin-left: 0; }

/* Fortschritt */

.bar {
    height: 8px;
    border-radius: var(--r-pill);
    background: var(--surface-3);
    overflow: hidden;
}

.bar > span {
    display: block;
    height: 100%;
    border-radius: var(--r-pill);
    background: var(--accent-gradient);
    transition: width .5s var(--ease);
}

.bar.bar-success > span { background: var(--fresh-gradient); }

.ring {
    --value: 0;
    --size: 56px;
    --ring-color: var(--success);
    width: var(--size);
    height: var(--size);
    border-radius: 50%;
    display: grid;
    place-items: center;
    flex-shrink: 0;
    background: conic-gradient(var(--ring-color) calc(var(--value) * 1%), var(--surface-3) 0);
    position: relative;
}

.ring::after {
    content: "";
    position: absolute;
    inset: 6px;
    border-radius: 50%;
    background: var(--surface);
}

.ring > span {
    position: relative;
    z-index: 1;
    font-size: .8rem;
    font-weight: 800;
}

/* Leerzustand */

.empty {
    text-align: center;
    padding: 2.5rem 1rem;
    color: var(--text-muted);
    display: flex;
    flex-direction: column;
    align-items: center;
}

.empty-art {
    width: 76px;
    height: 76px;
    border-radius: 26px;
    display: grid;
    place-items: center;
    background: var(--tone-bg, var(--accent-soft));
    color: var(--tone, var(--accent));
    margin-bottom: 1rem;
    position: relative;
    transform: rotate(-5deg);
}

.empty-art::after {
    content: "";
    position: absolute;
    inset: -8px;
    border-radius: 32px;
    border: 2px dashed color-mix(in srgb, var(--tone, var(--accent)) 30%, transparent);
    transform: rotate(9deg);
}

.empty h3 { color: var(--text); margin-bottom: .35rem; font-size: 1.1rem; }
.empty p { font-size: .9rem; max-width: 42ch; margin-inline: auto; }
.empty .btn { margin-top: .5rem; }

/* Dialog */

.modal-backdrop {
    position: fixed;
    inset: 0;
    z-index: 100;
    background: rgba(42, 22, 10, .38);
    backdrop-filter: blur(5px);
    -webkit-backdrop-filter: blur(5px);
    display: flex;
    align-items: flex-end;
    justify-content: center;
    padding: 0;
    animation: fade .2s var(--ease);
}

.modal {
    background: var(--bg-elevated);
    width: 100%;
    max-width: 560px;
    max-height: 92dvh;
    overflow-y: auto;
    border-radius: var(--r-xl) var(--r-xl) 0 0;
    padding: 1.2rem 1.2rem calc(1.2rem + env(safe-area-inset-bottom, 0px));
    box-shadow: var(--shadow-lg);
    animation: slide-up .3s var(--ease);
}

.modal-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: .75rem;
    margin-bottom: 1rem;
}

.modal-head h2 { font-size: 1.3rem; }

.modal-actions {
    display: flex;
    gap: .5rem;
    justify-content: flex-end;
    margin-top: 1.2rem;
    flex-wrap: wrap;
}

.modal-grabber {
    width: 44px;
    height: 5px;
    border-radius: var(--r-pill);
    background: var(--border-strong);
    margin: -.2rem auto .9rem;
}

@keyframes fade { from { opacity: 0 } to { opacity: 1 } }
@keyframes slide-up { from { transform: translateY(28px); opacity: .5 } to { transform: none; opacity: 1 } }

/* Hinweise */

.alert {
    padding: .8rem 1rem;
    border-radius: var(--r-sm);
    font-size: .88rem;
    font-weight: 600;
    display: flex;
    gap: .6rem;
    align-items: flex-start;
}

.alert .ico { margin-top: .1rem; }
.alert-error { background: var(--danger-soft); color: var(--danger); }
.alert-success { background: var(--success-soft); color: var(--success); }
.alert-info { background: var(--info-soft); color: var(--info); }
.alert-warning { background: var(--warning-soft); color: var(--warning); }

.toast-host {
    position: fixed;
    left: 50%;
    transform: translateX(-50%);
    bottom: calc(var(--bottombar-height) + 1.5rem + env(safe-area-inset-bottom, 0px));
    z-index: 200;
    display: flex;
    flex-direction: column;
    gap: .5rem;
    width: min(calc(100vw - 2rem), 420px);
    pointer-events: none;
}

.toast {
    pointer-events: auto;
    display: flex;
    align-items: center;
    gap: .6rem;
    background: var(--text);
    color: var(--bg);
    border-radius: var(--r);
    padding: .8rem 1rem;
    font-size: .9rem;
    font-weight: 600;
    box-shadow: var(--shadow-lg);
    animation: toast-in .35s var(--spring);
    cursor: pointer;
}

@keyframes toast-in { from { transform: translateY(16px) scale(.96); opacity: 0 } to { transform: none; opacity: 1 } }

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

/* --- 5. Fachliche Bausteine --------------------------------------------- */

/* Lebensmittel-Karte */

.food-card {
    display: flex;
    align-items: center;
    gap: .85rem;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--r);
    padding: .75rem .9rem .75rem .75rem;
    box-shadow: var(--shadow-sm);
    cursor: pointer;
    text-align: left;
    width: 100%;
    font: inherit;
    color: inherit;
    position: relative;
    overflow: hidden;
    transition: transform .18s var(--ease), box-shadow .2s var(--ease), border-color .2s;
}

.food-card::before {
    content: "";
    position: absolute;
    left: 0;
    top: 14px;
    bottom: 14px;
    width: 4px;
    border-radius: 0 4px 4px 0;
    background: transparent;
}

.food-card:hover { transform: translateY(-2px); box-shadow: var(--shadow); border-color: var(--border-strong); }

.food-card.expiry-expired::before { background: var(--danger); }
.food-card.expiry-critical::before { background: var(--warning); }
.food-card.expiry-soon::before { background: #f2c94c; }
.food-card.expiry-ok::before { background: var(--success); }

/* Älterer Name - entspricht .food-thumb ohne Foto */
.food-emoji {
    width: 48px;
    height: 48px;
    border-radius: 15px;
    background: var(--surface-2);
    color: var(--text-muted);
    display: grid;
    place-items: center;
    font-size: 1.35rem;
    flex-shrink: 0;
}

.food-body { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: .2rem; }

.food-name {
    font-weight: 700;
    font-size: .95rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.food-meta {
    display: flex;
    gap: .45rem;
    align-items: center;
    font-size: .78rem;
    color: var(--text-muted);
    flex-wrap: wrap;
}

.food-meta .ico { color: var(--text-subtle); }

/* Lange Chips (z. B. "seit 22 Tagen abgelaufen") dürfen die Menge nicht überdecken. */
.food-meta .chip { max-width: 100%; overflow: hidden; text-overflow: ellipsis; display: inline-block; }
.food-meta .chip .ico { vertical-align: -.2em; }

.food-qty {
    font-family: var(--font-display);
    font-weight: 800;
    font-size: 1rem;
    white-space: nowrap;
    letter-spacing: -.02em;
}

/* Rezept-Karte */

.recipe-card {
    display: flex;
    flex-direction: column;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--r-lg);
    overflow: hidden;
    box-shadow: var(--shadow-sm);
    text-decoration: none;
    color: inherit;
    transition: transform .2s var(--ease), box-shadow .25s var(--ease);
}

.recipe-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-lg);
    text-decoration: none;
}

.recipe-thumb {
    aspect-ratio: 4 / 3;
    display: grid;
    place-items: center;
    position: relative;
    background: var(--surface-2);
    overflow: hidden;
    color: rgba(255, 255, 255, .92);
}

.recipe-thumb > img {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform .6s var(--ease);
}

.recipe-card:hover .recipe-thumb > img { transform: scale(1.06); }

.recipe-thumb::after {
    content: "";
    position: absolute;
    inset: 0;
    background: linear-gradient(to bottom, rgba(0, 0, 0, .18), transparent 35%);
    pointer-events: none;
}

.recipe-thumb .match-pill {
    position: absolute;
    top: .7rem;
    right: .7rem;
    z-index: 1;
    background: rgba(255, 255, 255, .94);
    color: #2a1d16;
    border-radius: var(--r-pill);
    padding: .25rem .65rem;
    font-size: .74rem;
    font-weight: 800;
    box-shadow: var(--shadow-sm);
    backdrop-filter: blur(6px);
}

.recipe-thumb .cookable {
    position: absolute;
    top: .7rem;
    left: .7rem;
    z-index: 1;
    display: inline-flex;
    align-items: center;
    gap: .25rem;
    background: var(--fresh-gradient);
    color: #fff;
    border-radius: var(--r-pill);
    padding: .25rem .65rem;
    font-size: .72rem;
    font-weight: 800;
    box-shadow: 0 4px 12px rgba(31, 166, 122, .35);
}

.recipe-info { padding: .95rem 1rem 1.05rem; display: flex; flex-direction: column; gap: .55rem; flex: 1; }
.recipe-info h3 { font-size: 1.06rem; font-weight: 800; }

.recipe-meta {
    display: flex;
    align-items: center;
    gap: .35rem .85rem;
    flex-wrap: wrap;
    font-size: .8rem;
    color: var(--text-muted);
    font-weight: 600;
}

.recipe-meta > span:not(.chip) { display: inline-flex; align-items: center; gap: .3rem; }
.recipe-meta .ico { color: var(--accent); }
.recipe-flag { align-self: flex-start; }
.recipe-progress { margin-top: auto; display: flex; flex-direction: column; gap: .4rem; padding-top: .2rem; }
.recipe-progress .bar { height: 6px; }
.recipe-missing { font-size: .78rem; color: var(--text-muted); }

/* Swipe */

.swipe-stage {
    position: relative;
    width: min(100%, 400px);
    margin: 0 auto;
    aspect-ratio: 3 / 4.3;
    max-height: 64dvh;
    touch-action: pan-y;
}

.swipe-card {
    position: absolute;
    inset: 0;
    border-radius: var(--r-xl);
    overflow: hidden;
    background: var(--surface);
    box-shadow: var(--shadow-lg);
    border: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    user-select: none;
    -webkit-user-select: none;
    will-change: transform;
    cursor: grab;
}

.swipe-card:active { cursor: grabbing; }

.swipe-card.behind {
    transform: scale(.94) translateY(16px);
    opacity: .9;
    pointer-events: none;
}

.swipe-card.behind-2 {
    transform: scale(.88) translateY(32px);
    opacity: .55;
    pointer-events: none;
}

.swipe-card.dragging { transition: none; }
.swipe-card.settling { transition: transform .35s var(--ease), opacity .35s var(--ease); }

.swipe-visual {
    flex: 1;
    display: grid;
    place-items: center;
    position: relative;
    background-size: cover;
    background-position: center;
    color: rgba(255, 255, 255, .9);
    overflow: hidden;
}

.swipe-visual > img {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    pointer-events: none;
    -webkit-user-drag: none;
}

.swipe-visual::after {
    content: "";
    position: absolute;
    inset: auto 0 0;
    height: 62%;
    background: linear-gradient(to top, rgba(20, 8, 2, .85), rgba(20, 8, 2, .35) 55%, transparent);
}

.swipe-overlay {
    position: absolute;
    inset: auto 0 0;
    padding: 1.1rem 1.2rem 1.15rem;
    color: #fff;
    z-index: 2;
    display: flex;
    flex-direction: column;
    gap: .5rem;
}

.swipe-overlay h2 { font-size: 1.65rem; text-shadow: 0 2px 14px rgba(0, 0, 0, .4); }

.swipe-overlay .chip {
    background: rgba(255, 255, 255, .2);
    color: #fff;
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
}

.swipe-details {
    background: var(--surface);
    padding: .85rem 1.05rem;
    border-top: 1px solid var(--border);
    font-size: .84rem;
    color: var(--text-muted);
    min-height: 74px;
}

.swipe-stamp {
    position: absolute;
    top: 1.6rem;
    font-family: var(--font-display);
    font-size: 1.7rem;
    font-weight: 800;
    letter-spacing: .06em;
    padding: .3rem .9rem;
    border-radius: 14px;
    border: 4px solid;
    opacity: 0;
    z-index: 3;
    pointer-events: none;
    background: rgba(255, 255, 255, .85);
    transition: opacity .1s linear;
}

.swipe-stamp.like { left: 1.3rem; color: var(--success); border-color: var(--success); transform: rotate(-14deg); }
.swipe-stamp.nope { right: 1.3rem; color: var(--danger); border-color: var(--danger); transform: rotate(14deg); }

.swipe-actions {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 1.25rem;
    margin-top: 1.4rem;
}

.swipe-btn {
    width: 66px;
    height: 66px;
    border-radius: 50%;
    border: 1px solid var(--border);
    background: var(--surface);
    box-shadow: var(--shadow);
    cursor: pointer;
    display: grid;
    place-items: center;
    transition: transform .2s var(--spring), box-shadow .2s var(--ease), background .2s;
}

.swipe-btn:hover { transform: scale(1.1); box-shadow: var(--shadow-lg); }
.swipe-btn:active { transform: scale(.92); }
.swipe-btn.nope { color: var(--danger); }
.swipe-btn.nope:hover { background: var(--danger-soft); }
.swipe-btn.like { color: #fff; background: var(--accent-gradient); border-color: transparent; box-shadow: var(--shadow-accent); width: 76px; height: 76px; }
.swipe-btn.info { width: 50px; height: 50px; color: var(--info); }
.swipe-btn.info:hover { background: var(--info-soft); }

/* Match-Overlay */

.match-screen {
    position: fixed;
    inset: 0;
    z-index: 300;
    display: grid;
    place-items: center;
    padding: 1.25rem;
    background:
        radial-gradient(600px 400px at 20% 10%, rgba(255, 210, 120, .55), transparent 60%),
        linear-gradient(150deg, rgba(255, 112, 67, .98), rgba(255, 82, 110, .97));
    color: #fff;
    text-align: center;
    animation: fade .25s var(--ease);
    overflow-y: auto;
}

.match-screen h1 {
    font-size: clamp(2.4rem, 10vw, 3.6rem);
    letter-spacing: -.04em;
    text-shadow: 0 6px 24px rgba(0, 0, 0, .2);
}

.match-emoji { font-size: clamp(4rem, 22vw, 7rem); animation: pop .5s var(--spring); }

.match-photo {
    width: clamp(150px, 46vw, 220px);
    aspect-ratio: 1;
    border-radius: 50%;
    object-fit: cover;
    border: 6px solid #fff;
    box-shadow: 0 20px 50px rgba(80, 20, 0, .35);
    margin: 0 auto;
    animation: pop .55s var(--spring);
}

@keyframes pop {
    0% { transform: scale(.3) rotate(-12deg); opacity: 0 }
    70% { transform: scale(1.08) rotate(3deg); opacity: 1 }
    100% { transform: scale(1) rotate(0) }
}

.match-screen .btn-primary { background: #fff; color: var(--accent-strong); box-shadow: 0 10px 30px rgba(80, 20, 0, .25); }
.match-screen .btn-ghost { background: transparent; border-color: rgba(255, 255, 255, .6); color: #fff; }
.match-screen .btn-ghost:hover { background: rgba(255, 255, 255, .15); }

/* Zutatenliste */

.ingredient-row {
    display: flex;
    align-items: center;
    gap: .7rem;
    padding: .6rem 0;
    border-bottom: 1px dashed var(--border);
}

.ingredient-row:last-child { border-bottom: 0; }
.ingredient-row .state { width: 1.4rem; display: grid; place-items: center; flex-shrink: 0; }
.ingredient-row .name { flex: 1; font-weight: 600; font-size: .92rem; min-width: 0; }
.ingredient-row .amount { font-size: .84rem; color: var(--text-muted); white-space: nowrap; font-weight: 600; }
.ingredient-row.missing .name { color: var(--text-muted); }

/* Einkaufsliste */

.shopping-row {
    display: flex;
    align-items: center;
    gap: .75rem;
    padding: .7rem .25rem;
    border-bottom: 1px solid var(--border);
}

.shopping-row:last-child { border-bottom: 0; }
.shopping-row.done .shopping-name { text-decoration: line-through; color: var(--text-subtle); }
.shopping-row.done .food-thumb { opacity: .5; filter: grayscale(.6); }
.shopping-name { font-weight: 650; font-size: .94rem; }
.shopping-sub { font-size: .76rem; color: var(--text-muted); }

/* Statistik-Balken */

.chart-bars {
    display: flex;
    align-items: flex-end;
    gap: .45rem;
    height: 170px;
    padding-top: .5rem;
}

.chart-bars .bar-col {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: .4rem;
    min-width: 0;
    height: 100%;
    justify-content: flex-end;
}

.chart-bars .bar-fill {
    width: 100%;
    max-width: 42px;
    border-radius: 10px 10px 4px 4px;
    background: var(--sunny-gradient);
    min-height: 4px;
    transition: height .5s var(--ease);
}

.chart-bars .bar-label {
    font-size: .66rem;
    color: var(--text-subtle);
    font-weight: 600;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 100%;
}

.rank-row {
    display: flex;
    align-items: center;
    gap: .7rem;
    padding: .45rem 0;
}

.rank-row .rank-bar {
    flex: 1;
    height: 8px;
    border-radius: var(--r-pill);
    background: var(--surface-3);
    overflow: hidden;
}

.rank-row .rank-bar > span {
    display: block;
    height: 100%;
    background: var(--accent-gradient);
    border-radius: var(--r-pill);
}

/* Haushalts-Wechsler */

.household-switch {
    display: flex;
    align-items: center;
    gap: .5rem;
    padding: .3rem .7rem .3rem .3rem;
    border-radius: var(--r-pill);
    border: 1px solid var(--border);
    background: var(--surface);
    cursor: pointer;
    font: inherit;
    font-weight: 700;
    font-size: .86rem;
    color: var(--text);
    max-width: 220px;
    box-shadow: var(--shadow-sm);
    transition: background .15s, border-color .15s;
}

.household-switch:hover { background: var(--surface-2); border-color: var(--border-strong); }

.household-ico {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    display: grid;
    place-items: center;
    background: var(--sunny-gradient);
    color: #fff;
    flex-shrink: 0;
}

.household-switch .label {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.code-box {
    font-family: ui-monospace, "Cascadia Code", Menlo, monospace;
    font-size: 1.1rem;
    font-weight: 800;
    letter-spacing: .18em;
    background: var(--accent-soft);
    color: var(--accent-strong);
    border: 1.5px dashed color-mix(in srgb, var(--accent) 45%, transparent);
    border-radius: var(--r-sm);
    padding: .5rem .9rem;
    display: inline-block;
}

/* Skeleton */

.skeleton {
    background: linear-gradient(90deg, var(--surface-2) 25%, var(--surface-3) 37%, var(--surface-2) 63%);
    background-size: 400% 100%;
    animation: shimmer 1.3s ease-in-out infinite;
    border-radius: var(--r);
    height: 76px;
}

@keyframes shimmer { from { background-position: 100% 0 } to { background-position: 0 0 } }

/* Hero-Banner mit Foto (Dashboard, Rezeptdetail ...) */

.hero {
    position: relative;
    border-radius: var(--r-xl);
    overflow: hidden;
    background: var(--accent-gradient);
    color: #fff;
    box-shadow: var(--shadow);
    isolation: isolate;
}

.hero > img.hero-bg {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    z-index: -2;
}

.hero::before {
    content: "";
    position: absolute;
    inset: 0;
    z-index: -1;
    background: linear-gradient(100deg, rgba(36, 14, 4, .78) 0%, rgba(36, 14, 4, .45) 50%, rgba(36, 14, 4, .05) 100%);
}

.hero h1, .hero h2 { color: #fff; }
.hero .muted { color: rgba(255, 255, 255, .82); }

/* --- 6. Auth-Seiten ------------------------------------------------------ */

.auth-shell {
    min-height: 100dvh;
    display: grid;
    grid-template-columns: 1fr;
    background:
        radial-gradient(900px 500px at 0% -10%, color-mix(in srgb, var(--accent) 14%, transparent), transparent 60%),
        radial-gradient(700px 500px at 100% 110%, color-mix(in srgb, var(--tone-green) 10%, transparent), transparent 55%),
        var(--bg);
}

.auth-panel {
    display: grid;
    place-items: center;
    padding: 1.5rem 1rem 2.5rem;
}

.auth-card {
    width: min(100%, 440px);
    background: var(--bg-elevated);
    border: 1px solid var(--border);
    border-radius: var(--r-xl);
    padding: 1.75rem 1.5rem;
    box-shadow: var(--shadow-lg);
    animation: page-in .4s var(--ease);
}

.auth-card .brand { margin: 0 0 1.6rem; }
.auth-card h1 { font-size: 1.85rem; margin-bottom: .35rem; }
.auth-card .lead { color: var(--text-muted); font-size: .94rem; margin-bottom: 1.4rem; }

.auth-visual { display: none; }

.demo-hint {
    margin-top: 1.1rem;
    padding: .8rem .95rem;
    border-radius: var(--r-sm);
    background: var(--tone-yellow-bg);
    border: 1px dashed color-mix(in srgb, var(--tone-yellow) 40%, transparent);
    font-size: .8rem;
    color: var(--text-muted);
}

@media (min-width: 960px) {
    .auth-shell { grid-template-columns: minmax(440px, 1fr) 1.1fr; }

    .auth-card { box-shadow: none; border: 0; background: transparent; padding: 1rem; }

    .auth-visual {
        display: block;
        position: relative;
        margin: 1rem 1rem 1rem 0;
        border-radius: 36px;
        overflow: hidden;
        background: linear-gradient(160deg, #ffe7d6, #ffd2bd 45%, #ffc2a8);
        min-height: calc(100dvh - 2rem);
    }

    .auth-collage {
        position: absolute;
        inset: 0;
        display: grid;
        grid-template-columns: 1fr 1fr;
        grid-template-rows: 1fr 1fr;
        gap: 14px;
        padding: 14px;
    }

    .auth-collage img {
        width: 100%;
        height: 100%;
        object-fit: cover;
        border-radius: 26px;
        animation: page-in .7s var(--ease) both;
    }

    .auth-collage .c2 { animation-delay: .08s; }
    .auth-collage .c3 { animation-delay: .16s; }
    .auth-collage .c4 { animation-delay: .24s; }

    .auth-visual::after {
        content: "";
        position: absolute;
        inset: 0;
        background: linear-gradient(to top, rgba(36, 14, 4, .82) 0%, rgba(36, 14, 4, .25) 45%, transparent 70%);
    }

    .auth-visual-copy {
        position: absolute;
        inset: auto 0 0;
        z-index: 2;
        padding: 2.5rem;
        color: #fff;
    }

    .auth-visual-copy h2 { font-size: clamp(1.9rem, 2.6vw, 2.6rem); line-height: 1.08; margin-bottom: .8rem; }
    .auth-visual-copy p { max-width: 46ch; color: rgba(255, 255, 255, .85); font-size: 1rem; margin: 0; }

    .auth-floating {
        position: absolute;
        z-index: 3;
        display: flex;
        align-items: center;
        gap: .65rem;
        background: rgba(255, 255, 255, .95);
        color: #2a1d16;
        border-radius: 18px;
        padding: .6rem .9rem .6rem .6rem;
        font-size: .8rem;
        line-height: 1.3;
        box-shadow: 0 16px 40px rgba(60, 20, 0, .22);
        animation: float 5s ease-in-out infinite;
    }

    .auth-floating .muted { color: #7d6e64; }
    .auth-floating img { width: 40px; height: 40px; object-fit: contain; }

    .auth-floating-ico {
        width: 38px;
        height: 38px;
        border-radius: 12px;
        display: grid;
        place-items: center;
        background: var(--accent-gradient);
        color: #fff;
    }

    .match-float { top: 9%; left: 42%; }
    .fridge-float { top: 47%; right: 8%; animation-delay: -2.5s; }
}

@keyframes float { 0%, 100% { transform: translateY(0) } 50% { transform: translateY(-8px) } }

/* Kompatibilität für die mitgelieferten Identity-Seiten (Bootstrap-Klassen) */

.row { margin: 0; }
.col-md-4, .col-lg-6, .col-xl-6, .col-md-6, .col { width: 100%; }
.form-floating { position: relative; margin-bottom: .9rem; }
.form-floating > label { display: block; font-size: .8rem; font-weight: 700; color: var(--text-muted); margin-bottom: .3rem; }
.form-control { width: 100%; }
.btn-lg.w-100, .w-100 { width: 100%; }
.mb-3 { margin-bottom: .9rem; }
.mt-3 { margin-top: .9rem; }
.text-center { text-align: center; }
hr { border: 0; border-top: 1px solid var(--border); margin: 1.2rem 0; }
.list-group { display: flex; flex-direction: column; gap: .25rem; }
.list-group-item { padding: .5rem 0; border-bottom: 1px solid var(--border); }
.nav-pills { display: flex; gap: .4rem; flex-wrap: wrap; margin-bottom: 1.1rem; }
.nav-pills .nav-link { padding: .45rem .95rem; border-radius: var(--r-pill); background: var(--surface); border: 1px solid var(--border); font-size: .85rem; font-weight: 700; color: var(--text-muted); }
.nav-pills .nav-link:hover { text-decoration: none; color: var(--text); background: var(--surface-2); }
.nav-pills .nav-link.active { background: var(--text); border-color: var(--text); color: var(--bg); }

/* --- 7. Blazor-Basis ----------------------------------------------------- */

#blazor-error-ui {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    z-index: 1000;
    display: none;
    padding: .85rem 1rem;
    background: var(--danger);
    color: #fff;
    font-weight: 600;
    text-align: center;
}

#blazor-error-ui .dismiss { cursor: pointer; float: right; }
#blazor-error-ui a { color: #fff; text-decoration: underline; }

.blazor-reconnect-modal { font-family: var(--font); }

.loading-page {
    display: grid;
    place-items: center;
    min-height: 50dvh;
    color: var(--text-muted);
    gap: .6rem;
}

.spinner {
    width: 30px;
    height: 30px;
    border-radius: 50%;
    border: 3px solid var(--surface-3);
    border-top-color: var(--accent);
    animation: spin .8s linear infinite;
}

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

/* --- 8. Utilities & Responsive ------------------------------------------ */

.muted { color: var(--text-muted); }
.subtle { color: var(--text-subtle); }
.small { font-size: .82rem; }
.tiny { font-size: .72rem; }
.strong { font-weight: 700; }
.mono { font-family: ui-monospace, "Cascadia Code", Menlo, monospace; }
.display { font-family: var(--font-display); letter-spacing: -.03em; }
.text-success { color: var(--success); }
.text-warning { color: var(--warning); }
.text-danger { color: var(--danger); }
.text-accent { color: var(--accent); }
.nowrap { white-space: nowrap; }
.truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.hide-mobile { display: none; }
.mt-1 { margin-top: .35rem; }
.mt-2 { margin-top: .7rem; }
.mt-4 { margin-top: 1.4rem; }
.mb-0 { margin-bottom: 0; }
.mb-2 { margin-bottom: .7rem; }
.gap-0 { gap: 0; }

/* Auf schmalen Geräten dürfen Eingabezeilen umbrechen, statt zu überlaufen. */
@media (max-width: 639px) {
    .row-fields { flex-wrap: wrap; }

    .household-switch { max-width: 150px; padding-right: .55rem; }

    .topbar { gap: .45rem; padding: 0 .85rem; }

    .btn-icon { width: 38px; height: 38px; border-radius: 12px; }

    .swipe-btn { width: 58px; height: 58px; }
    .swipe-btn.like { width: 68px; height: 68px; }

    .page-head h1 { font-size: 1.65rem; }

    .card, .stat { padding: .9rem; }

    .stat .stat-value { font-size: 1.4rem; }

    .page-head > .row, .page-head > div:last-child:not(:first-child) { width: 100%; }
}

/* Sehr schmale Handys (z. B. iPhone SE, 320px) */
@media (max-width: 360px) {
    .topbar { gap: .35rem; padding: 0 .6rem; }
    .topbar .brand-mark { --mark: 30px !important; }
    .household-switch { max-width: 112px; font-size: .8rem; }
    .household-switch .household-ico { display: none; }
    .topbar button.btn-icon[aria-label="Design umschalten"] { display: none; }
    .btn-icon { width: 36px; height: 36px; }
    .avatar { width: 34px; height: 34px; }
    .page { padding-left: .75rem; padding-right: .75rem; }
    .bottombar { left: .4rem; right: .4rem; }
    .bottombar a { font-size: .6rem; }
    .btn { white-space: normal; text-align: center; }
    .card-head h2, .card-head h3 { min-width: 0; overflow-wrap: anywhere; }
}

@media (min-width: 640px) {
    body { font-size: 15.5px; }

    .page { padding: 1.6rem 1.5rem calc(var(--bottombar-height) + 2.5rem); }
    h1 { font-size: 2.15rem; }

    .modal-backdrop { align-items: center; padding: 1.5rem; }
    .modal { border-radius: var(--r-xl); padding: 1.5rem; }
    .modal-grabber { display: none; }

    .bottombar { left: 50%; right: auto; transform: translateX(-50%); width: min(520px, calc(100% - 2rem)); }
}

@media (min-width: 768px) {
    .grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (min-width: 1024px) {
    .sidebar { display: flex; }
    .bottombar { display: none; }
    .hide-mobile { display: initial; }
    .hide-desktop { display: none !important; }

    .page { padding: 2rem 2.25rem 3rem; }
    .grid-stats { grid-template-columns: repeat(4, minmax(0, 1fr)); }
    .topbar { padding: 0 2.25rem; }
    .toast-host { bottom: 1.75rem; }
}

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation-duration: .01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: .01ms !important;
    }
}

@media print {
    .sidebar, .bottombar, .topbar, .swipe-actions { display: none !important; }
}

/* Nur für Screenreader sichtbar */
.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}
