/* ════════════════════════════════════════════════════════════════════════
   Kochen — Dark Glassmorphism (2026)
   Mobile-first, iPhone-optimiert
   ════════════════════════════════════════════════════════════════════════ */

:root {
    --bg-base:        #06070d;
    --glass-1:        rgba(255, 255, 255, 0.04);
    --glass-2:        rgba(255, 255, 255, 0.07);
    --glass-3:        rgba(255, 255, 255, 0.10);
    --glass-stroke:   rgba(255, 255, 255, 0.08);
    --glass-stroke-2: rgba(255, 255, 255, 0.16);

    --primary:        #ff7a45;
    --primary-hi:     #ff9d70;
    --primary-lo:     #e85a1e;
    --accent:         #e94e7d;
    --ai:             #7c5cff;
    --ai-hi:          #9d83ff;
    --success:        #2dd4a3;
    --success-hi:     #58e5be;
    --danger:         #ff3b5c;
    --warning:        #ffb946;
    --gold:           #ffd25e;

    --t1: #ffffff;
    --t2: rgba(255, 255, 255, 0.72);
    --t3: rgba(255, 255, 255, 0.50);
    --t4: rgba(255, 255, 255, 0.30);

    --r-xs: 8px; --r-sm: 12px; --r-md: 16px; --r-lg: 22px; --r-xl: 28px; --r-pill: 999px;
    --s-1: 4px; --s-2: 8px; --s-3: 12px; --s-4: 16px; --s-5: 20px; --s-6: 24px; --s-7: 32px;

    --font: 'Inter', -apple-system, BlinkMacSystemFont, 'SF Pro Display', 'Segoe UI', Roboto, sans-serif;

    --glow-primary: 0 12px 40px -8px rgba(255, 122, 69, 0.55);
    --glow-ai:      0 12px 40px -8px rgba(124, 92, 255, 0.55);
    --glow-success: 0 12px 40px -8px rgba(45, 212, 163, 0.45);
    --glow-danger:  0 12px 40px -8px rgba(255, 59, 92, 0.50);
    --glow-gold:    0 12px 40px -8px rgba(255, 210, 94, 0.45);

    --spring: cubic-bezier(0.34, 1.56, 0.64, 1);
    --ease-out: cubic-bezier(0.16, 1, 0.3, 1);

    --safe-t: env(safe-area-inset-top, 0px);
    --safe-b: env(safe-area-inset-bottom, 0px);
    --nav-h: 68px;
}

*, *::before, *::after { box-sizing: border-box; }
* { -webkit-tap-highlight-color: transparent; }
html, body {
    margin: 0; padding: 0;
    background: var(--bg-base); color: var(--t1);
    font-family: var(--font); font-size: 16px; line-height: 1.5;
    -webkit-font-smoothing: antialiased;
    overscroll-behavior-y: none;
}
body { min-height: 100vh; min-height: 100dvh; overflow-x: hidden; }
button { font-family: inherit; cursor: pointer; border: none; background: none; color: inherit; }
input, select, textarea { font-family: inherit; color: inherit; }
h1, h2, h3, h4, h5 { margin: 0; font-weight: 700; letter-spacing: -0.02em; }
h1 { font-size: 1.75rem; } h2 { font-size: 1.35rem; } h3 { font-size: 1.1rem; }
p, ul { margin: 0; padding: 0; }
ul { list-style: none; }
a { color: inherit; text-decoration: none; }
.hidden { display: none !important; }

/* ── Aurora Background ── */
body::before, body::after {
    content: ''; position: fixed; inset: 0; pointer-events: none; z-index: 0;
}
body::before {
    background:
        radial-gradient(900px circle at 12% 15%,  rgba(255, 122, 69, 0.30), transparent 55%),
        radial-gradient(800px circle at 92% 12%,  rgba(233, 78, 125, 0.24), transparent 55%),
        radial-gradient(700px circle at 8% 88%,   rgba(124, 92, 255, 0.22), transparent 55%),
        radial-gradient(900px circle at 88% 92%,  rgba(45, 212, 163, 0.20), transparent 55%);
    animation: aurora 22s ease-in-out infinite alternate;
    filter: blur(8px);
}
body::after { background: radial-gradient(circle at 50% 50%, transparent 0, var(--bg-base) 90%); }
@keyframes aurora {
    0%   { transform: translate3d(0, 0, 0)   rotate(0deg)   scale(1); }
    50%  { transform: translate3d(-20px, 30px, 0) rotate(2deg) scale(1.08); }
    100% { transform: translate3d(30px, -20px, 0) rotate(-2deg) scale(1.04); }
}
@media (prefers-reduced-motion: reduce) { body::before { animation: none; } }
#app { position: relative; z-index: 1; min-height: 100vh; min-height: 100dvh; }

/* ── Screen System ── */
.screen { display: none; min-height: 100vh; min-height: 100dvh; }
.screen.active { display: block; }
#loading-screen { display: none; }
#loading-screen.active { display: flex; align-items: center; justify-content: center; }
.loading-content { text-align: center; }
.loading-logo {
    font-size: 72px; margin-bottom: var(--s-5);
    animation: pulse 1.4s ease-in-out infinite;
    filter: drop-shadow(0 0 28px rgba(255, 122, 69, 0.6));
}
.loading-spinner {
    width: 36px; height: 36px; margin: 0 auto var(--s-4);
    border: 3px solid rgba(255, 255, 255, 0.08);
    border-top-color: var(--primary); border-right-color: var(--primary);
    border-radius: 50%; animation: spin 0.9s linear infinite;
}
.loading-content p { color: var(--t3); font-size: 13px; letter-spacing: 1px; text-transform: uppercase; }
@keyframes pulse { 0%,100%{transform:scale(1);opacity:1;} 50%{transform:scale(1.08);opacity:0.85;} }
@keyframes spin { to { transform: rotate(360deg); } }

/* ── Auth ── */
#auth-screen { padding: max(var(--safe-t), 24px) 20px calc(var(--safe-b) + 24px); }
#auth-screen.active { display: flex; align-items: center; justify-content: center; }
.auth-container {
    width: 100%; max-width: 420px;
    padding: var(--s-7) var(--s-6) var(--s-6);
    background: var(--glass-1);
    backdrop-filter: blur(28px) saturate(160%); -webkit-backdrop-filter: blur(28px) saturate(160%);
    border: 1px solid var(--glass-stroke);
    border-radius: var(--r-xl);
    box-shadow: 0 30px 80px -20px rgba(0,0,0,0.7), inset 0 1px 0 rgba(255,255,255,0.06);
}
.auth-header { text-align: center; margin-bottom: var(--s-6); }
.auth-logo {
    font-size: 56px; margin-bottom: var(--s-3);
    filter: drop-shadow(0 0 30px rgba(255, 122, 69, 0.65));
}
.auth-header h1 {
    font-size: 28px; font-weight: 800; letter-spacing: -0.03em;
    background: linear-gradient(135deg, #fff 0%, #ffd1bb 100%);
    -webkit-background-clip: text; background-clip: text; color: transparent;
}
.auth-header p { color: var(--t3); font-size: 13px; margin-top: var(--s-2); }
.auth-tabs {
    display: flex; gap: var(--s-1); padding: 4px;
    background: var(--glass-1); border: 1px solid var(--glass-stroke);
    border-radius: var(--r-pill); margin-bottom: var(--s-5);
}
.tab-btn {
    flex: 1; padding: 10px 16px;
    color: var(--t3); border-radius: var(--r-pill);
    font-size: 14px; font-weight: 600;
    transition: all 0.3s var(--ease-out);
}
.tab-btn.active { background: var(--glass-3); color: var(--t1); }
.auth-form { display: none; flex-direction: column; gap: var(--s-4); }
.auth-form.active { display: flex; }
.form-group { display: flex; flex-direction: column; gap: 6px; }
.form-group label {
    font-size: 11px; color: var(--t3);
    text-transform: uppercase; letter-spacing: 0.8px; font-weight: 600;
}
.form-group input, .form-group select, .form-group textarea {
    padding: 14px 16px;
    background: var(--glass-1); border: 1px solid var(--glass-stroke);
    border-radius: var(--r-md); color: var(--t1); font-size: 15px;
    transition: all 0.2s var(--ease-out);
}
.form-group input:focus, .form-group textarea:focus, .form-group select:focus {
    outline: none;
    border-color: rgba(255, 122, 69, 0.6);
    background: var(--glass-2);
    box-shadow: 0 0 0 4px rgba(255, 122, 69, 0.12);
}
.error-message {
    margin-top: var(--s-3); padding: 12px 14px;
    background: rgba(255, 59, 92, 0.10); border: 1px solid rgba(255, 59, 92, 0.35);
    border-radius: var(--r-md); color: #ffbecb; font-size: 13px; text-align: center;
}

/* ── Buttons ── */
.btn {
    display: inline-flex; align-items: center; justify-content: center; gap: 8px;
    padding: 12px 20px;
    background: var(--glass-2); border: 1px solid var(--glass-stroke-2);
    border-radius: var(--r-md); color: var(--t1);
    font-size: 15px; font-weight: 600;
    transition: transform 0.15s var(--spring), background 0.2s, border-color 0.2s;
}
.btn:hover { background: var(--glass-3); }
.btn:active { transform: scale(0.96); }
.btn:disabled { opacity: 0.5; cursor: not-allowed; transform: none; }
.btn-full { width: 100%; }
.btn-sm { padding: 8px 14px; font-size: 13px; border-radius: var(--r-sm); }
.btn-primary {
    background: linear-gradient(135deg, var(--primary), var(--primary-lo));
    border-color: transparent; box-shadow: var(--glow-primary), inset 0 1px 0 rgba(255,255,255,0.2);
}
.btn-primary.ai, .btn-primary.btn-ai {
    background: linear-gradient(135deg, var(--ai), #5b3fe0);
    box-shadow: var(--glow-ai), inset 0 1px 0 rgba(255,255,255,0.2);
}
.btn-secondary { background: var(--glass-2); border-color: var(--glass-stroke-2); }
.btn-success { background: linear-gradient(135deg, var(--success), var(--success-hi)); color: #001a14; border-color: transparent; box-shadow: var(--glow-success); }
.btn-danger { background: linear-gradient(135deg, var(--danger), #d12848); color: #fff; border-color: transparent; box-shadow: var(--glow-danger); }
.btn-icon-round {
    width: 42px; height: 42px;
    display: inline-flex; align-items: center; justify-content: center;
    background: var(--glass-2); border: 1px solid var(--glass-stroke-2);
    border-radius: var(--r-pill); color: var(--t1); font-size: 20px; font-weight: 700;
    flex-shrink: 0;
}
.btn-icon-round.ai {
    background: linear-gradient(135deg, var(--ai), #5b3fe0);
    box-shadow: var(--glow-ai); border-color: transparent;
}

/* ── App Header ── */
#main-app { display: none; padding-bottom: calc(var(--nav-h) + var(--safe-b) + 16px); }
#main-app.active { display: block; }
.app-header {
    position: sticky; top: 0; z-index: 50;
    display: flex; align-items: center; justify-content: space-between;
    padding: max(var(--safe-t), 12px) 16px 12px;
    background: rgba(6, 7, 13, 0.55);
    backdrop-filter: blur(20px) saturate(160%); -webkit-backdrop-filter: blur(20px) saturate(160%);
    border-bottom: 1px solid var(--glass-stroke);
}
.header-left { display: flex; align-items: center; gap: 10px; }
.header-logo { font-size: 24px; filter: drop-shadow(0 0 12px rgba(255, 122, 69, 0.5)); }
.header-title { font-weight: 700; font-size: 16px; letter-spacing: -0.01em; }
.header-right { display: flex; align-items: center; gap: 8px; }
.header-badge {
    display: inline-flex; align-items: center; gap: 5px;
    padding: 6px 11px;
    background: var(--glass-2); border: 1px solid var(--glass-stroke);
    border-radius: var(--r-pill); font-weight: 700; font-size: 13px;
}
.header-badge.ai-badge {
    background: rgba(124, 92, 255, 0.15);
    border-color: rgba(124, 92, 255, 0.3);
    color: var(--ai-hi);
}
.header-avatar {
    width: 36px; height: 36px;
    display: flex; align-items: center; justify-content: center;
    background: var(--glass-2); border: 1px solid var(--glass-stroke-2);
    border-radius: var(--r-pill); font-size: 18px;
}

/* ── App Content / Views ── */
.app-content { padding: 20px 16px; max-width: 720px; margin: 0 auto; }
.view { display: none; animation: viewIn 0.4s var(--ease-out); }
.view.active { display: block; }
@keyframes viewIn { from{opacity:0;transform:translateY(8px);} to{opacity:1;transform:translateY(0);} }

/* ── Bottom Nav ── */
.bottom-nav {
    position: fixed; left: 0; right: 0; bottom: 0; z-index: 60;
    display: flex; justify-content: space-around;
    padding: 8px 8px calc(8px + var(--safe-b));
    background: rgba(6, 7, 13, 0.7);
    backdrop-filter: blur(30px) saturate(160%); -webkit-backdrop-filter: blur(30px) saturate(160%);
    border-top: 1px solid var(--glass-stroke);
}
.nav-item {
    flex: 1; max-width: 80px;
    display: flex; flex-direction: column; align-items: center; gap: 3px;
    padding: 8px 4px; color: var(--t3);
    border-radius: var(--r-md); position: relative;
    transition: all 0.25s var(--ease-out);
}
.nav-icon { font-size: 22px; line-height: 1; filter: grayscale(0.5) brightness(0.85); transition: all 0.25s var(--ease-out); }
.nav-label { font-size: 10px; font-weight: 600; letter-spacing: 0.3px; text-transform: uppercase; }
.nav-item.active { color: var(--t1); }
.nav-item.active .nav-icon { filter: none; transform: translateY(-2px) scale(1.1); }
.nav-item.active::before {
    content: ''; position: absolute; top: 0; left: 50%; transform: translateX(-50%);
    width: 32px; height: 3px;
    background: linear-gradient(90deg, var(--primary), var(--accent));
    border-radius: 0 0 4px 4px;
    box-shadow: 0 0 14px rgba(255, 122, 69, 0.8);
}
.nav-item:active { transform: scale(0.92); }

/* ── HOME ── */
.hero-card {
    position: relative; overflow: hidden;
    padding: var(--s-6);
    background: var(--glass-1);
    backdrop-filter: blur(24px); -webkit-backdrop-filter: blur(24px);
    border: 1px solid var(--glass-stroke);
    border-radius: var(--r-xl);
    margin-bottom: var(--s-5);
}
.hero-card::before {
    content: ''; position: absolute; top: -50%; right: -30%;
    width: 280px; height: 280px;
    background: radial-gradient(circle, rgba(255, 122, 69, 0.35), transparent 60%);
    filter: blur(20px); pointer-events: none;
}
.hero-greeting { position: relative; margin-bottom: var(--s-5); }
.hero-day { font-size: 11px; color: var(--t3); text-transform: uppercase; letter-spacing: 1.2px; font-weight: 600; }
.hero-greeting h1 {
    margin-top: 4px; font-size: 26px; font-weight: 800; letter-spacing: -0.03em;
    background: linear-gradient(135deg, #fff, #ffd1bb);
    -webkit-background-clip: text; background-clip: text; color: transparent;
}
.hero-today { position: relative; }
.today-slots { display: flex; flex-direction: column; gap: 10px; }
.today-slot {
    display: flex; align-items: center; gap: 12px;
    padding: 14px 16px;
    background: var(--glass-2); border: 1px solid var(--glass-stroke);
    border-radius: var(--r-lg);
    cursor: pointer; transition: all 0.2s var(--ease-out);
}
.today-slot:hover { background: var(--glass-3); transform: translateY(-1px); }
.today-slot.cooked { opacity: 0.55; }
.slot-meal { font-size: 11px; color: var(--t3); text-transform: uppercase; letter-spacing: 0.6px; font-weight: 700; min-width: 60px; }
.slot-recipe { flex: 1; }
.slot-recipe-title { font-weight: 700; font-size: 14px; }
.slot-recipe-meta { font-size: 11px; color: var(--t3); margin-top: 2px; }
.slot-icon { font-size: 22px; }
.today-empty { text-align: center; padding: var(--s-5); color: var(--t3); }
.today-empty p { margin-bottom: var(--s-3); }

.quick-grid {
    display: grid; grid-template-columns: 1fr 1fr; gap: 10px;
    margin-bottom: var(--s-5);
}
.quick-action {
    display: flex; align-items: center; gap: 12px;
    padding: 14px 14px;
    background: var(--glass-1); border: 1px solid var(--glass-stroke);
    border-radius: var(--r-lg);
    text-align: left;
    transition: all 0.2s var(--ease-out);
}
.quick-action:hover { background: var(--glass-2); transform: translateY(-1px); }
.quick-action:active { transform: scale(0.97); }
.quick-action.ai {
    background: linear-gradient(135deg, rgba(124, 92, 255, 0.15), rgba(124, 92, 255, 0.05));
    border-color: rgba(124, 92, 255, 0.35);
}
.qa-icon {
    width: 40px; height: 40px;
    display: flex; align-items: center; justify-content: center;
    background: var(--glass-2); border-radius: var(--r-md);
    font-size: 20px; flex-shrink: 0;
}
.quick-action.ai .qa-icon {
    background: rgba(124, 92, 255, 0.25);
    box-shadow: 0 0 14px rgba(124, 92, 255, 0.35);
}
.qa-text { min-width: 0; }
.qa-title { display: block; font-weight: 700; font-size: 13px; }
.qa-sub { display: block; font-size: 11px; color: var(--t3); margin-top: 2px; }

.section-header {
    display: flex; align-items: center; justify-content: space-between;
    margin-bottom: var(--s-3);
}
.section-header h2 { font-size: 18px; font-weight: 800; letter-spacing: -0.02em; }
.section-header h3 { font-size: 15px; }
.recipe-strip {
    display: flex; gap: 10px; overflow-x: auto; padding-bottom: 6px;
    scrollbar-width: none;
}
.recipe-strip::-webkit-scrollbar { display: none; }
.strip-card {
    flex: 0 0 auto;
    width: 160px;
    background: var(--glass-1); border: 1px solid var(--glass-stroke);
    border-radius: var(--r-lg);
    padding: 12px;
    cursor: pointer;
    transition: transform 0.2s var(--spring);
}
.strip-card:active { transform: scale(0.97); }
.strip-icon {
    width: 100%; aspect-ratio: 1.2;
    display: flex; align-items: center; justify-content: center;
    font-size: 40px;
    background: var(--glass-2); border-radius: var(--r-md);
    margin-bottom: 8px;
}
.strip-title { font-weight: 700; font-size: 13px; line-height: 1.25; }
.strip-meta { font-size: 10px; color: var(--t3); margin-top: 4px; }

/* ── RECIPES VIEW ── */
.view-toolbar {
    display: flex; gap: 8px; margin-bottom: var(--s-4);
    align-items: center;
}
.search-bar {
    flex: 1; position: relative;
    background: var(--glass-2); border: 1px solid var(--glass-stroke);
    border-radius: var(--r-pill);
    display: flex; align-items: center;
    padding: 0 14px 0 12px;
}
.search-icon { font-size: 14px; color: var(--t3); margin-right: 8px; }
.search-bar input {
    flex: 1; padding: 11px 0;
    background: transparent; border: none; outline: none;
    color: var(--t1); font-size: 14px;
}
.filter-chips {
    display: flex; gap: 6px; margin-bottom: var(--s-4);
    overflow-x: auto; scrollbar-width: none;
}
.filter-chips::-webkit-scrollbar { display: none; }
.chip {
    flex-shrink: 0;
    padding: 7px 14px;
    background: var(--glass-2); border: 1px solid var(--glass-stroke);
    border-radius: var(--r-pill);
    color: var(--t2); font-size: 13px; font-weight: 600;
    transition: all 0.2s var(--ease-out);
}
.chip.active { background: rgba(255, 122, 69, 0.18); border-color: rgba(255, 122, 69, 0.5); color: var(--primary-hi); }

.recipe-grid {
    display: grid; grid-template-columns: 1fr 1fr; gap: 10px;
}
@media (min-width: 481px) { .recipe-grid { grid-template-columns: repeat(3, 1fr); } }
@media (min-width: 768px) { .recipe-grid { grid-template-columns: repeat(4, 1fr); } }
.recipe-card {
    background: var(--glass-1); border: 1px solid var(--glass-stroke);
    border-radius: var(--r-lg);
    overflow: hidden; cursor: pointer;
    display: flex; flex-direction: column;
    transition: transform 0.2s var(--spring);
}
.recipe-card:active { transform: scale(0.97); }
.recipe-card-image {
    aspect-ratio: 4/3;
    display: flex; align-items: center; justify-content: center;
    font-size: 44px;
    background: linear-gradient(135deg, rgba(255, 122, 69, 0.15), rgba(124, 92, 255, 0.08));
    position: relative;
}
.recipe-card-image img { width: 100%; height: 100%; object-fit: cover; }
.recipe-card-ai-tag {
    position: absolute; top: 8px; right: 8px;
    padding: 3px 8px;
    background: rgba(124, 92, 255, 0.85);
    border-radius: var(--r-pill);
    font-size: 10px; font-weight: 700; color: #fff;
    text-transform: uppercase; letter-spacing: 0.5px;
}
.recipe-card-body { padding: 10px 12px; flex: 1; display: flex; flex-direction: column; gap: 4px; }
.recipe-card-title { font-weight: 700; font-size: 13px; line-height: 1.3; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.recipe-card-meta { font-size: 10px; color: var(--t3); display: flex; align-items: center; gap: 6px; margin-top: auto; }
.recipe-card-fav { position: absolute; top: 8px; left: 8px; font-size: 18px; filter: drop-shadow(0 0 6px rgba(255, 210, 94, 0.7)); }

/* Empty State */
.empty-state { text-align: center; padding: var(--s-7) var(--s-4); color: var(--t3); }
.empty-icon { font-size: 48px; margin-bottom: 12px; opacity: 0.6; }
.empty-state p { margin-bottom: var(--s-3); }

/* ── PLAN VIEW ── */
.plan-header {
    display: flex; align-items: center; justify-content: space-between;
    margin-bottom: var(--s-3);
    padding: 0 4px;
}
.btn-nav-week {
    width: 36px; height: 36px;
    background: var(--glass-2); border: 1px solid var(--glass-stroke);
    border-radius: var(--r-pill);
    color: var(--t1); font-size: 18px; font-weight: 700;
}
.plan-week { font-weight: 700; font-size: 15px; flex: 1; text-align: center; }
.plan-actions {
    display: flex; gap: 6px; margin-bottom: var(--s-4); flex-wrap: wrap;
}
.plan-actions .btn { flex: 1; min-width: 100px; }
.plan-actions .btn.ai {
    background: linear-gradient(135deg, var(--ai), #5b3fe0);
    color: #fff; border-color: transparent;
    box-shadow: var(--glow-ai);
}

.plan-grid { display: flex; flex-direction: column; gap: 10px; }
.plan-day {
    padding: var(--s-3) var(--s-4);
    background: var(--glass-1); border: 1px solid var(--glass-stroke);
    border-radius: var(--r-lg);
}
.plan-day.today {
    background: linear-gradient(135deg, rgba(255, 122, 69, 0.12), rgba(255, 122, 69, 0.04));
    border-color: rgba(255, 122, 69, 0.35);
}
.plan-day-header {
    display: flex; align-items: center; justify-content: space-between;
    margin-bottom: 8px;
}
.plan-day-name { font-weight: 700; font-size: 14px; }
.plan-day-date { font-size: 11px; color: var(--t3); }
.plan-meals { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; }
.plan-meal {
    padding: 10px 12px;
    background: var(--glass-2); border: 1px solid var(--glass-stroke);
    border-radius: var(--r-md);
    cursor: pointer; min-height: 60px;
    display: flex; flex-direction: column; justify-content: center;
    transition: all 0.2s var(--ease-out);
}
.plan-meal:hover { background: var(--glass-3); }
.plan-meal.empty { color: var(--t3); }
.plan-meal-label { font-size: 10px; color: var(--t3); text-transform: uppercase; letter-spacing: 0.5px; font-weight: 700; margin-bottom: 4px; }
.plan-meal-title { font-size: 13px; font-weight: 600; line-height: 1.25; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.plan-meal.cooked { opacity: 0.5; }
.plan-meal.cooked .plan-meal-title { text-decoration: line-through; }

/* ── SHOPPING VIEW ── */
.shopping-meta {
    display: flex; align-items: center; justify-content: space-between;
    margin-bottom: var(--s-3);
    padding: 0 4px;
}
.meta-count { font-size: 13px; color: var(--t3); }
.shopping-list { display: flex; flex-direction: column; gap: 6px; }
.shopping-item {
    display: flex; align-items: center; gap: 12px;
    padding: 12px 14px;
    background: var(--glass-1); border: 1px solid var(--glass-stroke);
    border-radius: var(--r-md);
    transition: all 0.2s var(--ease-out);
}
.shopping-item.checked {
    background: rgba(45, 212, 163, 0.08);
    border-color: rgba(45, 212, 163, 0.25);
    opacity: 0.65;
}
.shopping-item.checked .shopping-name { text-decoration: line-through; color: var(--t3); }
.shopping-check {
    width: 28px; height: 28px;
    border: 2px solid var(--glass-stroke-2);
    border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    flex-shrink: 0;
    transition: all 0.2s var(--ease-out);
}
.shopping-item.checked .shopping-check {
    background: var(--success); border-color: var(--success);
    color: #001a14;
}
.shopping-info { flex: 1; min-width: 0; }
.shopping-name { font-weight: 600; font-size: 14px; }
.shopping-meta-row { font-size: 11px; color: var(--t3); margin-top: 2px; display: flex; gap: 8px; flex-wrap: wrap; }
.shopping-qty {
    font-weight: 700; font-variant-numeric: tabular-nums;
    color: var(--t2); font-size: 13px;
    padding: 4px 10px;
    background: var(--glass-2); border-radius: var(--r-pill);
}
.shopping-delete {
    width: 28px; height: 28px;
    color: var(--t3); font-size: 14px;
}
.purchases-section { margin-top: var(--s-6); }
.purchases-list { display: flex; flex-direction: column; gap: 8px; }
.purchase-card {
    padding: 12px 14px;
    background: var(--glass-1); border: 1px solid var(--glass-stroke);
    border-radius: var(--r-md);
}
.purchase-meta {
    display: flex; justify-content: space-between; align-items: center;
    margin-bottom: 6px;
}
.purchase-date { font-weight: 600; font-size: 12px; }
.purchase-count { font-size: 11px; color: var(--t3); }
.purchase-items { font-size: 11px; color: var(--t3); line-height: 1.5; }

/* ── PROFILE ── */
.profile-card {
    display: flex; align-items: center; gap: var(--s-4);
    padding: var(--s-5);
    background: var(--glass-1);
    backdrop-filter: blur(24px); -webkit-backdrop-filter: blur(24px);
    border: 1px solid var(--glass-stroke);
    border-radius: var(--r-xl);
    margin-bottom: var(--s-4);
}
.profile-avatar {
    width: 64px; height: 64px;
    display: flex; align-items: center; justify-content: center;
    background: linear-gradient(135deg, var(--primary), var(--primary-lo));
    border-radius: var(--r-pill); font-size: 32px;
    box-shadow: var(--glow-primary), inset 0 1px 0 rgba(255,255,255,0.2);
    flex-shrink: 0;
}
.profile-info { min-width: 0; }
.profile-info h3 { font-size: 18px; margin-bottom: 2px; }
.profile-info p { color: var(--t3); font-size: 12px; word-break: break-all; }

.settings-card {
    padding: var(--s-5);
    background: var(--glass-1);
    backdrop-filter: blur(24px); -webkit-backdrop-filter: blur(24px);
    border: 1px solid var(--glass-stroke);
    border-radius: var(--r-xl);
    margin-bottom: var(--s-4);
}
.settings-card h3 { font-size: 15px; margin-bottom: var(--s-3); }

.avatar-picker { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; }
.avatar-option {
    aspect-ratio: 1;
    background: var(--glass-2); border: 1px solid var(--glass-stroke);
    border-radius: var(--r-md);
    font-size: 24px;
    display: flex; align-items: center; justify-content: center;
    transition: all 0.2s var(--ease-out);
}
.avatar-option:hover { background: var(--glass-3); transform: scale(1.05); }
.avatar-option.selected {
    background: rgba(255, 122, 69, 0.15);
    border-color: rgba(255, 122, 69, 0.5);
    box-shadow: 0 0 0 1px rgba(255, 122, 69, 0.3);
}

.ai-stats { display: flex; flex-direction: column; gap: 8px; }
.stat-row {
    display: flex; justify-content: space-between; align-items: center;
    padding: 10px 12px;
    background: var(--glass-2); border-radius: var(--r-md);
    font-size: 13px; color: var(--t2);
}
.stat-value { font-weight: 700; font-variant-numeric: tabular-nums; color: var(--ai-hi); }

.family-empty { text-align: center; padding: var(--s-4); color: var(--t3); }
.family-empty p { margin-bottom: var(--s-3); }
.family-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.family-actions .btn { flex: 1; min-width: 130px; }
.family-info { display: flex; flex-direction: column; gap: 10px; }
.family-name { font-size: 17px; font-weight: 700; }
.family-invite {
    padding: 12px 14px;
    background: linear-gradient(135deg, rgba(255, 122, 69, 0.10), rgba(233, 78, 125, 0.05));
    border: 1px solid rgba(255, 122, 69, 0.3);
    border-radius: var(--r-md);
    display: flex; align-items: center; justify-content: space-between; gap: 10px;
}
.family-invite-code {
    font-family: 'SF Mono', Menlo, Consolas, monospace;
    font-size: 18px; font-weight: 800; letter-spacing: 3px;
    color: var(--gold);
}
.family-members { display: flex; flex-direction: column; gap: 6px; }
.family-member {
    display: flex; align-items: center; gap: 10px;
    padding: 10px 12px;
    background: var(--glass-2); border: 1px solid var(--glass-stroke);
    border-radius: var(--r-md);
    font-size: 13px;
}
.family-member-avatar { font-size: 20px; }
.family-member-name { flex: 1; font-weight: 600; }
.family-member-badge { padding: 2px 8px; background: rgba(255, 210, 94, 0.15); color: var(--gold); border-radius: var(--r-pill); font-size: 10px; font-weight: 700; text-transform: uppercase; }

/* ── MODAL ── */
.modal {
    position: fixed; inset: 0; z-index: 100;
    display: flex; align-items: flex-end; justify-content: center;
    background: rgba(3, 4, 10, 0.8);
    backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px);
    animation: overlayIn 0.25s var(--ease-out);
}
.modal.center { align-items: center; padding: 20px; }
@keyframes overlayIn { from { opacity: 0; } to { opacity: 1; } }
.modal-content {
    width: 100%; max-width: 560px; max-height: 92vh;
    overflow-y: auto;
    padding: var(--s-6) var(--s-5) calc(var(--s-5) + var(--safe-b));
    background: rgba(10, 12, 22, 0.95);
    backdrop-filter: blur(30px) saturate(160%); -webkit-backdrop-filter: blur(30px) saturate(160%);
    border: 1px solid var(--glass-stroke-2);
    border-radius: var(--r-xl) var(--r-xl) 0 0;
    animation: sheetUp 0.4s var(--spring);
    box-shadow: 0 -20px 60px -10px rgba(0,0,0,0.8);
}
.modal.center .modal-content { border-radius: var(--r-xl); animation: cardPop 0.4s var(--spring); }
@keyframes sheetUp { from { transform: translateY(100%); } to { transform: translateY(0); } }
@keyframes cardPop { from { opacity: 0; transform: scale(0.9); } to { opacity: 1; transform: scale(1); } }
.modal-header {
    display: flex; align-items: center; justify-content: space-between;
    margin-bottom: var(--s-4);
}
.modal-header h2 { font-size: 19px; }
.modal-close {
    width: 36px; height: 36px;
    display: flex; align-items: center; justify-content: center;
    background: var(--glass-2); border: 1px solid var(--glass-stroke);
    border-radius: var(--r-pill); font-size: 16px;
}
.modal-actions { display: flex; gap: 8px; margin-top: var(--s-5); }
.modal-actions .btn { flex: 1; }

/* Recipe detail modal specifics */
.recipe-detail-hero {
    aspect-ratio: 16/9;
    margin: calc(var(--s-6) * -1) calc(var(--s-5) * -1) var(--s-5);
    background: linear-gradient(135deg, rgba(255, 122, 69, 0.25), rgba(124, 92, 255, 0.15));
    display: flex; align-items: center; justify-content: center;
    font-size: 80px;
}
.recipe-detail-title { font-size: 22px; font-weight: 800; letter-spacing: -0.02em; margin-bottom: 6px; }
.recipe-detail-meta { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: var(--s-3); }
.recipe-detail-pill { padding: 4px 10px; background: var(--glass-2); border: 1px solid var(--glass-stroke); border-radius: var(--r-pill); font-size: 11px; }
.recipe-detail-pill.ai { background: rgba(124, 92, 255, 0.15); color: var(--ai-hi); border-color: rgba(124, 92, 255, 0.3); }
.recipe-detail-desc { color: var(--t2); font-size: 14px; line-height: 1.5; margin-bottom: var(--s-5); }
.recipe-detail-section h3 { font-size: 14px; margin-bottom: 10px; color: var(--t2); }
.recipe-detail-section { margin-bottom: var(--s-5); }
.ingredient-list { display: flex; flex-direction: column; gap: 6px; }
.ingredient-row {
    display: flex; align-items: center; gap: 10px;
    padding: 10px 12px;
    background: var(--glass-2); border: 1px solid var(--glass-stroke);
    border-radius: var(--r-md);
    font-size: 14px;
}
.ingredient-qty { font-weight: 800; font-variant-numeric: tabular-nums; color: var(--primary-hi); min-width: 70px; }
.recipe-instructions {
    padding: var(--s-4);
    background: var(--glass-2); border: 1px solid var(--glass-stroke);
    border-radius: var(--r-md);
    font-size: 14px; line-height: 1.7;
    white-space: pre-wrap;
}
.recipe-detail-toolbar {
    display: flex; gap: 6px;
    padding: var(--s-3) 0;
    border-top: 1px solid var(--glass-stroke);
    border-bottom: 1px solid var(--glass-stroke);
    margin-bottom: var(--s-4);
}
.recipe-detail-toolbar .btn { flex: 1; }

/* AI Modal */
.ai-prompt-box {
    padding: var(--s-4);
    background: linear-gradient(135deg, rgba(124, 92, 255, 0.10), rgba(124, 92, 255, 0.03));
    border: 1px solid rgba(124, 92, 255, 0.3);
    border-radius: var(--r-md);
    margin-bottom: var(--s-4);
}
.ai-prompt-box label { font-size: 11px; color: var(--ai-hi); text-transform: uppercase; letter-spacing: 0.8px; font-weight: 700; margin-bottom: 6px; display: block; }
.ai-prompt-box textarea {
    width: 100%; min-height: 80px; resize: vertical;
    padding: 12px;
    background: rgba(0,0,0,0.25); border: 1px solid var(--glass-stroke);
    border-radius: var(--r-sm); color: var(--t1); font-size: 14px;
    font-family: inherit;
}
.ai-prompt-box textarea:focus {
    outline: none; border-color: rgba(124, 92, 255, 0.5);
    box-shadow: 0 0 0 3px rgba(124, 92, 255, 0.1);
}
.ai-constraint-chips {
    display: flex; gap: 6px; flex-wrap: wrap;
    margin-bottom: var(--s-4);
}
.ai-chip {
    padding: 6px 12px;
    background: var(--glass-2); border: 1px solid var(--glass-stroke);
    border-radius: var(--r-pill);
    font-size: 12px; font-weight: 600; color: var(--t2);
}
.ai-chip.on { background: rgba(124, 92, 255, 0.18); border-color: rgba(124, 92, 255, 0.45); color: var(--ai-hi); }
.ai-thinking {
    display: flex; flex-direction: column; align-items: center; gap: 16px;
    padding: var(--s-7);
}
.ai-thinking .brain {
    font-size: 48px;
    animation: think 1.5s ease-in-out infinite;
    filter: drop-shadow(0 0 24px rgba(124, 92, 255, 0.7));
}
@keyframes think {
    0%, 100% { transform: rotate(-5deg) scale(1); }
    50% { transform: rotate(5deg) scale(1.1); }
}
.ai-thinking-text { color: var(--t2); font-size: 14px; text-align: center; }
.ai-thinking-text strong { color: var(--ai-hi); }

/* Picker Modal (recipe search/select for plan) */
.picker-list { display: flex; flex-direction: column; gap: 6px; max-height: 50vh; overflow-y: auto; }
.picker-item {
    display: flex; align-items: center; gap: 10px;
    padding: 10px 12px;
    background: var(--glass-2); border: 1px solid var(--glass-stroke);
    border-radius: var(--r-md); cursor: pointer;
    transition: all 0.2s var(--ease-out);
}
.picker-item:hover { background: var(--glass-3); }
.picker-item-icon { font-size: 22px; }
.picker-item-info { flex: 1; min-width: 0; }
.picker-item-title { font-weight: 600; font-size: 13px; }
.picker-item-meta { font-size: 11px; color: var(--t3); margin-top: 2px; }

/* Editor (Inline form for new/edit recipe) */
.editor-section { margin-bottom: var(--s-4); }
.editor-section label.section-label {
    display: block; font-size: 11px; color: var(--t3);
    text-transform: uppercase; letter-spacing: 0.8px; font-weight: 600;
    margin-bottom: 6px;
}
.ingredient-edit-row {
    display: grid; grid-template-columns: 60px 60px 1fr auto; gap: 6px;
    align-items: center; margin-bottom: 4px;
}
.ingredient-edit-row input {
    padding: 8px 10px;
    background: var(--glass-2); border: 1px solid var(--glass-stroke);
    border-radius: var(--r-sm); color: var(--t1); font-size: 13px;
}
.btn-remove-ing {
    width: 32px; height: 32px;
    background: rgba(255, 59, 92, 0.15); border: 1px solid rgba(255, 59, 92, 0.35);
    color: #ffbecb; border-radius: var(--r-sm);
}
.btn-add-ing {
    width: 100%; padding: 10px;
    background: var(--glass-2); border: 1px dashed var(--glass-stroke-2);
    border-radius: var(--r-md);
    color: var(--t3); font-weight: 600; font-size: 13px;
    margin-top: 4px;
}
.btn-add-ing:hover { background: var(--glass-3); color: var(--t1); }

/* ── Toasts ── */
#toast-container {
    position: fixed; top: max(var(--safe-t), 20px); left: 16px; right: 16px; z-index: 300;
    display: flex; flex-direction: column; gap: 8px; pointer-events: none;
}
.toast {
    pointer-events: auto;
    padding: 12px 14px;
    background: rgba(10, 12, 22, 0.95);
    backdrop-filter: blur(20px); -webkit-backdrop-filter: blur(20px);
    border: 1px solid var(--glass-stroke-2);
    border-radius: var(--r-md);
    color: var(--t1); font-size: 13px; font-weight: 600;
    box-shadow: 0 12px 32px -8px rgba(0,0,0,0.7);
    animation: toastIn 0.35s var(--spring);
}
.toast.success { border-color: rgba(45, 212, 163, 0.45); }
.toast.error   { border-color: rgba(255, 59, 92, 0.45); }
.toast.ai      { border-color: rgba(124, 92, 255, 0.45); background: linear-gradient(135deg, rgba(124, 92, 255, 0.15), rgba(10, 12, 22, 0.95)); }
@keyframes toastIn {
    from { opacity: 0; transform: translateY(-30px); }
    to   { opacity: 1; transform: translateY(0); }
}

@media (max-height: 700px) {
    .auth-container { padding: var(--s-6) var(--s-5); }
    .auth-logo { font-size: 44px; }
}
