/* ── Reset & root ───────────────────────────────────────────────────── */
*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    -webkit-tap-highlight-color: transparent;
}

html, body {
    /* height: 100%;
    overflow: hidden;
    background: #0f0f0f;*/
    height: 100%;
    overflow-x: hidden; /* was: overflow: hidden */
    overflow-y: auto; /* was: overflow: hidden */
    background: #0f0f0f;
}

:root {
    --g: #2D6A4F;
    --gl: #EAF3DE;
    --gm: #52B788;
    --g2: #1B4332;
    --cream: #F7F5F0;
    --white: #ffffff;
    --dark: #111111;
    --muted: #6E6E6E;
    --border: rgba(0,0,0,0.07);
    --border2: rgba(0,0,0,0.12);
    --amber: #B45309;
    --amberl: #FEF3C7;
    --red: #DC2626;
    --redl: #FEE2E2;
    --blue: #1D4ED8;
    --bluel: #DBEAFE;
    --radius: 22px;
    --radiuss: 14px;
    --radiusxs: 10px;
    --shadow: 0 2px 16px rgba(0,0,0,0.08);
}

body {
    font-family: 'DM Sans', sans-serif;
    background: #0f0f0f;
    display: flex;
    justify-content: center;
    align-items: center;
}

/* ── Device shell ───────────────────────────────────────────────────── */
.device {
    width: 390px;
    height: 844px;
    background: var(--cream);
    border-radius: 48px;
    overflow: hidden;
    position: relative;
    box-shadow: 0 0 0 10px #1a1a1a, 0 0 0 11px #333, 0 30px 80px rgba(0,0,0,0.6);
}

.notch {
    position: absolute;
    top: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 120px;
    height: 34px;
    background: #0f0f0f;
    border-radius: 0 0 20px 20px;
    z-index: 100;
}

/* ── Screen ─────────────────────────────────────────────────────────── */
.screen {
    position: absolute;
    inset: 0;
    display: flex;
    flex-direction: column;
    background: var(--cream);
    overflow: hidden;
}

/* ── Status bar ─────────────────────────────────────────────────────── */
.statusbar {
    height: 50px;
    padding: 14px 24px 0;
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 13px;
    font-weight: 600;
    color: var(--dark);
    flex-shrink: 0;
    position: relative;
    z-index: 10;
}

/* ── Scrollable content ─────────────────────────────────────────────── */
.scrollable {
    flex: 1;
    overflow-y: auto;
    overflow-x: hidden;
    -webkit-overflow-scrolling: touch;
    padding: 0 20px 120px;
}

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

/* ── Bottom nav ─────────────────────────────────────────────────────── */
.bottom-nav {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 88px;
    background: rgba(247,245,240,0.95);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-top: 0.5px solid var(--border2);
    display: flex;
    align-items: flex-start;
    padding-top: 10px;
    z-index: 50;
}

.nav-item {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 3px;
    cursor: pointer;
    font-size: 10px;
    font-weight: 500;
    color: var(--muted);
    transition: color 0.15s;
    padding: 4px 0;
    background: none;
    border: none;
    font-family: 'DM Sans', sans-serif;
}

.nav-item i { font-size: 24px; transition: transform 0.15s; }
.nav-item.active { color: var(--g); }
.nav-item.active i { transform: scale(1.1); }

.nav-item.center-btn {
    width: 56px;
    height: 56px;
    border-radius: 50%;
    background: var(--g);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-top: -24px;
    box-shadow: 0 4px 20px rgba(45,106,79,0.4);
    flex: none;
    font-size: 26px;
    cursor: pointer;
    border: none;
    padding: 0;
}

.nav-item.center-btn i { color: white; font-size: 26px; }

/* ── Top bar ────────────────────────────────────────────────────────── */
.topbar {
    padding: 8px 20px 12px;
    display: flex;
    align-items: center;
    gap: 12px;
    flex-shrink: 0;
}

.back-btn {
    width: 38px;
    height: 38px;
    border-radius: 50%;
    background: var(--white);
    border: 0.5px solid var(--border2);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 18px;
    color: var(--dark);
    flex-shrink: 0;
}

.topbar-title { font-size: 18px; font-weight: 500; color: var(--dark); }

/* ── Cards ──────────────────────────────────────────────────────────── */
.card {
    background: var(--white);
    border-radius: var(--radius);
    border: 0.5px solid var(--border);
    padding: 20px;
    margin-bottom: 14px;
}

.card-sm { border-radius: var(--radiuss); padding: 14px 16px; }

/* ── Buttons ────────────────────────────────────────────────────────── */
.btn {
    border: none;
    border-radius: var(--radiuss);
    padding: 16px 20px;
    font-family: 'DM Sans', sans-serif;
    font-size: 16px;
    font-weight: 500;
    cursor: pointer;
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    transition: opacity 0.15s, transform 0.1s;
}

.btn:active { transform: scale(0.98); }
.btn-primary { background: var(--g); color: white; }
.btn-primary:disabled { opacity: 0.4; cursor: not-allowed; }
.btn-secondary { background: var(--white); color: var(--g); border: 1.5px solid var(--g); }
.btn-ghost { background: transparent; color: var(--muted); font-size: 14px; }

/* ── Badges ─────────────────────────────────────────────────────────── */
.badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 4px 10px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 500;
}

.badge-g { background: var(--gl); color: var(--g); }
.badge-a { background: var(--amberl); color: var(--amber); }
.badge-r { background: var(--redl); color: var(--red); }
.badge-b { background: var(--bluel); color: var(--blue); }

/* ── Typography ─────────────────────────────────────────────────────── */
.serif { font-family: 'DM Serif Display', serif; }

.label {
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 0.07em;
    text-transform: uppercase;
    color: var(--muted);
    margin: 20px 0 10px;
}

/* ── Dot pulse ──────────────────────────────────────────────────────── */
.dots { display: flex; gap: 5px; align-items: center; }

.dots span {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: var(--g);
    animation: dp 1.2s ease-in-out infinite;
}

.dots span:nth-child(2) { animation-delay: .2s; }
.dots span:nth-child(3) { animation-delay: .4s; }

@keyframes dp {
    0%, 80%, 100% { opacity: .2; }
    40% { opacity: 1; }
}

/* ── Progress bar ───────────────────────────────────────────────────── */
.prog-track {
    height: 5px;
    background: var(--gl);
    border-radius: 3px;
    overflow: hidden;
    margin-top: 8px;
}

.prog-fill {
    height: 100%;
    background: var(--g);
    border-radius: 3px;
    transition: width .4s ease;
}

/* ── Check circle ───────────────────────────────────────────────────── */
.circle {
    width: 26px;
    height: 26px;
    border-radius: 50%;
    border: 2px solid var(--border2);
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all .15s;
    cursor: pointer;
    background: var(--white);
}

.circle.on { background: var(--g); border-color: var(--g); color: white; }

/* ── List item row ──────────────────────────────────────────────────── */
.item-row {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 0;
    border-bottom: 0.5px solid var(--border);
    cursor: pointer;
}

.item-row:last-child { border-bottom: none; }
.item-label { flex: 1; font-size: 15px; color: var(--dark); transition: all .15s; }
.item-label.done { color: var(--muted); text-decoration: line-through; }
.item-qty { font-size: 13px; color: var(--muted); flex-shrink: 0; }

/* ── Upload zone ────────────────────────────────────────────────────── */
.upload-zone {
    border: 2px dashed var(--gm);
    border-radius: var(--radius);
    padding: 36px 20px;
    text-align: center;
    cursor: pointer;
    position: relative;
    transition: all .2s;
    background: var(--white);
    margin-bottom: 14px;
}

.upload-zone:hover, .upload-zone.drag {
    background: var(--gl);
    border-color: var(--g);
}

/* Blazor InputFile sits inside the zone — cover it with opacity:0 */
.upload-input {
    position: absolute;
    inset: 0;
    opacity: 0;
    cursor: pointer;
    width: 100%;
    height: 100%;
}

.upload-zone i.big {
    font-size: 48px;
    color: var(--g);
    display: block;
    margin-bottom: 12px;
}

.upload-zone h3 { font-size: 17px; font-weight: 500; color: var(--dark); margin-bottom: 6px; }
.upload-zone p { font-size: 13px; color: var(--muted); line-height: 1.5; }

/* ── AI status bar ──────────────────────────────────────────────────── */
.ai-bar {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 13px 16px;
    background: var(--gl);
    border-radius: var(--radiuss);
    margin-bottom: 14px;
    font-size: 14px;
    color: var(--g);
    font-weight: 500;
}

.ai-bar.err { background: var(--redl); color: var(--red); }

/* ── Category heading ───────────────────────────────────────────────── */
.cat-head {
    font-size: 11px;
    font-weight: 600;
    letter-spacing: .07em;
    text-transform: uppercase;
    color: var(--muted);
    margin: 18px 0 8px;
    display: flex;
    align-items: center;
    gap: 6px;
}

.cat-head i { font-size: 14px; }

/* ── Stat row ───────────────────────────────────────────────────────── */
.stat-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 0;
    border-bottom: 0.5px solid var(--border);
    font-size: 14px;
}

.stat-row:last-child { border-bottom: none; }
.stat-l { color: var(--muted); display: flex; align-items: center; gap: 7px; }
.stat-v { font-weight: 500; color: var(--dark); }

/* ── Category bar (Insights) ────────────────────────────────────────── */
.cat-bar { display: flex; align-items: center; gap: 10px; padding: 7px 0; }
.cat-bar-lbl { font-size: 13px; color: var(--dark); width: 100px; flex-shrink: 0; }
.cat-bar-track { flex: 1; height: 7px; background: var(--gl); border-radius: 4px; overflow: hidden; }
.cat-bar-fill { height: 100%; border-radius: 4px; background: var(--g); }
.cat-bar-val { font-size: 13px; font-weight: 500; color: var(--dark); width: 46px; text-align: right; flex-shrink: 0; }

/* ── Store pill ─────────────────────────────────────────────────────── */
.store-pill {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 14px;
    background: var(--white);
    border: 0.5px solid var(--border2);
    border-radius: 20px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    margin: 3px;
    transition: all .15s;
    font-family: 'DM Sans', sans-serif;
    color: var(--dark);
}

.store-pill.on { background: var(--g); color: white; border-color: var(--g); }

/* ── List card ──────────────────────────────────────────────────────── */
.list-card {
    background: var(--white);
    border-radius: var(--radius);
    border: 0.5px solid var(--border);
    padding: 16px;
    margin-bottom: 12px;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 14px;
    transition: transform .1s;
}

.list-card:active { transform: scale(0.98); }

.list-icon {
    width: 50px;
    height: 50px;
    border-radius: 16px;
    background: var(--gl);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 22px;
    color: var(--g);
    flex-shrink: 0;
}

.list-info { flex: 1; min-width: 0; }
.list-name { font-size: 16px; font-weight: 500; color: var(--dark); }
.list-meta { font-size: 13px; color: var(--muted); margin-top: 2px; }

/* ── Hero card ──────────────────────────────────────────────────────── */
.hero-card {
    background: var(--g);
    color: white;
    border-radius: var(--radius);
    padding: 22px;
    margin-bottom: 14px;
    cursor: pointer;
}

.hero-card h3 { font-size: 13px; opacity: .75; margin-bottom: 4px; font-weight: 400; }
.hero-card .big { font-size: 38px; font-weight: 600; font-family: 'DM Serif Display', serif; line-height: 1; }
.hero-card .sub { font-size: 13px; opacity: .75; margin-top: 6px; }

/* ── 2-col grid ─────────────────────────────────────────────────────── */
.grid2 {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
    margin-bottom: 14px;
}

.metric {
    background: var(--white);
    border-radius: var(--radiuss);
    border: 0.5px solid var(--border);
    padding: 14px;
    text-align: center;
}

.metric .ml { font-size: 11px; color: var(--muted); text-transform: uppercase; letter-spacing: .06em; font-weight: 600; }
.metric .mv { font-size: 24px; font-weight: 600; margin-top: 4px; }

/* ── Avatar ─────────────────────────────────────────────────────────── */
.av {
    width: 30px;
    height: 30px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 11px;
    font-weight: 600;
    color: white;
    border: 2px solid var(--white);
    margin-left: -6px;
}

/* ── Paywall plan card ──────────────────────────────────────────────── */
.plan-card {
    background: var(--white);
    border-radius: var(--radiuss);
    border: 1.5px solid var(--border);
    padding: 18px;
    cursor: pointer;
    transition: border-color .15s;
}

.plan-card.selected { border-color: var(--g); }

/* ── Image preview ──────────────────────────────────────────────────── */
.img-preview {
    width: 100%;
    border-radius: var(--radiuss);
    object-fit: contain;
    max-height: 260px;
    display: block;
    background: #000;
}

/* ── Tip ────────────────────────────────────────────────────────────── */
.tip {
    background: var(--amberl);
    border-radius: var(--radiuss);
    padding: 13px 16px;
    font-size: 13px;
    color: var(--amber);
    display: flex;
    gap: 10px;
    align-items: flex-start;
    margin-bottom: 14px;
}

/* ── Unplanned item ─────────────────────────────────────────────────── */
.unplan {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 9px 0;
    border-bottom: 0.5px solid var(--border);
    font-size: 14px;
}

.unplan:last-child { border-bottom: none; }

/* ── Member row ─────────────────────────────────────────────────────── */
.member-row {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 0;
    border-bottom: 0.5px solid var(--border);
}

.member-row:last-child { border-bottom: none; }

/* ── Fade-in animation ──────────────────────────────────────────────── */
@keyframes fadeUp {
    from { opacity: 0; transform: translateY(8px); }
    to   { opacity: 1; transform: translateY(0); }
}

.fadein { animation: fadeUp .3s ease both; }

/* ── Toast ──────────────────────────────────────────────────────────── */
.toast {
    position: absolute;
    bottom: 100px;
    left: 20px;
    right: 20px;
    background: var(--dark);
    color: white;
    border-radius: var(--radiusxs);
    padding: 12px 16px;
    font-size: 14px;
    text-align: center;
    z-index: 300;
    display: none;
    animation: toastIn .3s ease;
}

.toast.toast-show { display: block; }

@keyframes toastIn {
    from { opacity: 0; transform: translateY(10px); }
    to   { opacity: 1; transform: translateY(0); }
}

/* ── Form elements ──────────────────────────────────────────────────── */
input[type=text] {
    width: 100%;
    padding: 13px 16px;
    border: 0.5px solid var(--border2);
    border-radius: var(--radiusxs);
    font-family: 'DM Sans', sans-serif;
    font-size: 15px;
    color: var(--dark);
    background: var(--white);
    outline: none;
    margin-bottom: 10px;
}

input[type=text]:focus { border-color: var(--g); }

textarea {
    width: 100%;
    padding: 13px 16px;
    border: 0.5px solid var(--border2);
    border-radius: var(--radiusxs);
    font-family: 'DM Sans', sans-serif;
    font-size: 15px;
    color: var(--dark);
    background: var(--white);
    outline: none;
    resize: none;
    height: 80px;
    margin-bottom: 10px;
}

textarea:focus { border-color: var(--g); }

/* Rainbow Walleye CSS */
@media (max-width: 768px) {
    .main-content {
        padding: 2rem;
    }

    .device {
        width: 100%;
        height: 85vh;
        border-radius: 0;
        box-shadow: none;
    }
}