/* ============================================================
   BasketMate — Main Stylesheet
   ============================================================

   TABLE OF CONTENTS
   -----------------
   1.  FONTS & RESET
   2.  DESIGN TOKENS (CSS Variables)
   3.  BASE & UTILITIES
   4.  SPLASH SCREEN
   5.  ONBOARDING
   6.  HOME SCREEN
       6a. Header
       6b. Store Grid
   7.  STORE SCREEN
       7a. Store Header
       7b. Main Layout (Aisles + List panels)
       7c. Aisle Cards
       7d. List Container & Items
   8.  AISLE PANEL OVERLAY
       8a. Panel Chips
   9.  SHOPPING MODE
   10. BOTTOM NAVIGATION
   11. MODALS
   12. SETTINGS PANEL
   13. FAVOURITES
   14. MISC COMPONENTS
       14a. Toast
       14b. Empty State
       14c. Product Library
       14d. List Tabs
       14e. Chip Buttons
       14f. Price Lookup Button
   15. ANIMATIONS & KEYFRAMES
   16. DRAG & DROP
   17. SCROLLBARS
   18. MOBILE RESPONSIVE

   ============================================================ */


/* ============================================================
   1. FONTS & RESET
   ============================================================ */

@import url('https://fonts.googleapis.com/css2?family=DM+Sans:ital,opsz,wght@0,9..40,300;0,9..40,400;0,9..40,500;0,9..40,600;0,9..40,700;0,9..40,800;1,9..40,400&display=swap');

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
button { font-family: inherit; cursor: pointer; }
input, textarea, select { font-family: inherit; }


/* ============================================================
   2. DESIGN TOKENS
   ============================================================ */

:root {
    --font: 'DM Sans', sans-serif;

    /* Neutrals */
    --ink-900: #0F0F14;
    --ink-800: #1C1C2E;
    --ink-700: #2D2D44;
    --ink-400: #6B6B8A;
    --ink-200: #B8B8CC;
    --ink-100: #E8E8F0;
    --ink-50:  #F4F4F8;
    --white:   #FFFFFF;

    /* Semantic */
    --bg-page:   #F0F0F6;
    --bg-card:   #FFFFFF;
    --bg-header: #F0F0F6;
    --text-primary:   var(--ink-900);
    --text-secondary: var(--ink-400);
    --text-tertiary:  var(--ink-200);

    /* Store accent (set dynamically per store) */
    --accent: #2563EB;
    --accent-dim: rgba(37,99,235,0.12);

    /* Status colours */
    --green:    #059669;
    --green-bg: #ECFDF5;
    --red:      #DC2626;
    --red-bg:   #FEF2F2;

    /* Elevation */
    --shadow-xs: 0 1px 2px rgba(15,15,20,0.06);
    --shadow-sm: 0 2px 8px rgba(15,15,20,0.08), 0 1px 2px rgba(15,15,20,0.04);
    --shadow-md: 0 8px 24px rgba(15,15,20,0.10), 0 2px 6px rgba(15,15,20,0.06);
    --shadow-lg: 0 20px 48px rgba(15,15,20,0.14), 0 4px 12px rgba(15,15,20,0.08);

    /* Border radius */
    --r-sm:   8px;
    --r-md:   12px;
    --r-lg:   18px;
    --r-xl:   24px;
    --r-full: 999px;

    /* Layout */
    --nav-h:    76px;
    --header-h: 60px;
}


/* ============================================================
   3. BASE & UTILITIES
   ============================================================ */

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

body {
    font-family: var(--font);
    background: var(--bg-page);
    color: var(--text-primary);
    height: 100vh;
    overflow: hidden;
    -webkit-font-smoothing: antialiased;
    padding-bottom: var(--nav-h);
}

.hidden { display: none !important; }


/* ============================================================
   4. SPLASH SCREEN
   ============================================================ */

#splashScreen {
    position: fixed;
    inset: 0;
    background: white;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    z-index: 9999;
    gap: 40px;
    padding: 40px 24px;
    transition: opacity 0.6s ease, transform 0.6s ease;
}

#splashScreen.fade-out {
    opacity: 0;
    transform: scale(1.04);
    pointer-events: none;
}

.splash-logo {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
    animation: splashLogoIn 0.7s cubic-bezier(0.34,1.56,0.64,1) forwards;
}

.splash-icon {
    width: 88px;
    height: 88px;
    border-radius: 24px;
    box-shadow: 0 8px 32px rgba(13,148,136,0.25);
}

.splash-title {
    font-family: 'DM Sans', sans-serif;
    font-size: 34px;
    font-weight: 800;
    color: var(--ink-900);
    letter-spacing: -1px;
}

.splash-title span { color: #0D9488; }

.splash-sub {
    font-size: 14px;
    font-weight: 500;
    color: var(--text-secondary);
    letter-spacing: 0.2px;
}

.splash-stores {
    display: flex;
    gap: 16px;
    flex-wrap: wrap;
    justify-content: center;
    max-width: 320px;
}

.splash-store {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    opacity: 0;
    transform: translateY(16px);
    animation: splashStoreIn 0.4s cubic-bezier(0.34,1.56,0.64,1) forwards;
}

.splash-store-avatar {
    width: 56px;
    height: 56px;
    border-radius: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
    overflow: hidden;
    background: white;
    border: 1px solid var(--ink-100);
}

.splash-store-avatar img {
    width: 36px;
    height: 36px;
    object-fit: contain;
}

.splash-store-avatar.initials {
    font-size: 20px;
    font-weight: 800;
    color: white;
}

.splash-store-name {
    font-size: 11px;
    font-weight: 600;
    color: var(--text-secondary);
    letter-spacing: 0.2px;
}

.splash-loader {
    width: 200px;
    height: 3px;
    background: var(--ink-100);
    border-radius: var(--r-full);
    overflow: hidden;
}

.splash-bar {
    height: 100%;
    width: 0%;
    background: #0D9488;
    border-radius: var(--r-full);
    animation: loadBar 2s ease forwards;
}

.splash-brand {
    font-size: 13px;
    color: var(--text-secondary);
    font-weight: 500;
}

.splash-brand span {
    font-weight: 700;
    color: var(--ink-700);
}

/* Next button (onboarding) */
.splash-next-btn {
    margin-top: 8px;
    padding: 14px 48px;
    background: #0D9488;
    color: white;
    border: none;
    border-radius: 99px;
    font-size: 17px;
    font-weight: 700;
    letter-spacing: 0.3px;
    cursor: pointer;
    box-shadow: 0 4px 18px rgba(13,148,136,0.35);
    transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.splash-next-btn:active {
    transform: scale(0.96);
    box-shadow: 0 2px 8px rgba(13,148,136,0.25);
}


/* ============================================================
   5. ONBOARDING
   ============================================================ */

#onboardingScreen {
    position: fixed;
    inset: 0;
    background: white;
    display: flex;
    flex-direction: column;
    align-items: center;
    z-index: 9999;
    padding: 0 0 24px;
    transition: opacity 0.6s ease, transform 0.6s ease;
}

#onboardingScreen.fade-out {
    opacity: 0;
    transform: scale(1.04);
    pointer-events: none;
}

.ob-topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    padding: 16px 20px 0;
}

.ob-brand { display: flex; align-items: center; gap: 8px; }
.ob-brand-icon { width: 32px; height: 32px; border-radius: 8px; }
.ob-brand-name { font-size: 18px; font-weight: 800; color: var(--ink-900); letter-spacing: -0.5px; }
.ob-brand-name span { color: #0D9488; }

.ob-skip-btn {
    background: none;
    border: none;
    font-size: 14px;
    font-weight: 600;
    color: var(--text-secondary);
    cursor: pointer;
    padding: 4px 8px;
}

.ob-slides {
    flex: 1;
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 12px 20px 0;
}

.ob-slide { display: none; flex-direction: column; align-items: center; gap: 20px; width: 100%; }
.ob-slide.active { display: flex; }
.ob-phone { display: flex; justify-content: center; }

.ob-phone-shell {
    width: 190px;
    height: 340px;
    background: #1a1a2e;
    border-radius: 32px;
    border: 5px solid #2d2d44;
    box-shadow: 0 16px 48px rgba(0,0,0,0.22), inset 0 0 0 1px rgba(255,255,255,0.06);
    display: flex;
    flex-direction: column;
    align-items: center;
    overflow: hidden;
    position: relative;
}

.ob-phone-notch {
    width: 60px;
    height: 10px;
    background: #2d2d44;
    border-radius: 0 0 10px 10px;
    margin-bottom: 4px;
    flex-shrink: 0;
}

.ob-phone-screen {
    flex: 1;
    width: 100%;
    background: #f8fafc;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

.ob-screen-header { background: #005EA5; padding: 8px 10px 6px; }
.ob-screen-title { font-size: 11px; font-weight: 800; color: white; }
.ob-screen-sub { font-size: 8px; font-weight: 600; color: #64748b; padding: 6px 10px 4px; }

.ob-aisle-row {
    font-size: 7px;
    font-weight: 600;
    color: #374151;
    padding: 4px 5px;
    border-radius: 5px;
    background: white;
    box-shadow: 0 1px 2px rgba(0,0,0,0.06);
}

.ob-aisle-active { background: #F47920; color: white; }
.ob-aisle-add { color: #F47920; background: none; border: 1px dashed #F47920; box-shadow: none; text-align: center; }

.ob-list-item {
    font-size: 7px;
    font-weight: 600;
    color: #1e293b;
    padding: 3px 5px;
    border-radius: 4px;
    background: #f8fafc;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.ob-list-check { color: #22c55e; font-size: 8px; }

.ob-mini-row {
    background: white;
    border-radius: 8px;
    padding: 6px 8px;
    display: flex;
    align-items: center;
    gap: 7px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.06);
}

.ob-mini-row-logo { width: 24px; height: 24px; border-radius: 5px; object-fit: contain; flex-shrink: 0; }
.ob-mini-row-text { display: flex; flex-direction: column; gap: 1px; }
.ob-mini-row-name { font-size: 8px; font-weight: 700; color: #1e293b; }
.ob-mini-row-sub { font-size: 6.5px; color: #94a3b8; }

.ob-text { text-align: center; padding: 0 8px; }
.ob-step-label { font-size: 11px; font-weight: 700; color: #0D9488; text-transform: uppercase; letter-spacing: 1px; margin-bottom: 6px; }
.ob-heading { font-size: 22px; font-weight: 800; color: var(--ink-900); letter-spacing: -0.5px; margin: 0 0 8px; }
.ob-desc { font-size: 14px; color: var(--text-secondary); line-height: 1.5; margin: 0; }

.ob-dots { display: flex; gap: 8px; padding: 12px 0 8px; }
.ob-dot { width: 8px; height: 8px; border-radius: 50%; background: #e2e8f0; transition: all 0.3s ease; }
.ob-dot.active { width: 24px; border-radius: 4px; background: #0D9488; }

.ob-prod-row {
    background: white;
    border-radius: 6px;
    padding: 5px 7px;
    display: flex;
    align-items: center;
    gap: 6px;
    box-shadow: 0 1px 2px rgba(0,0,0,0.05);
}

.ob-prod-star { font-size: 8px; }
.ob-prod-name { font-size: 7.5px; font-weight: 600; color: #1e293b; }
.ob-prod-add { border: 1px dashed #005EA5; background: #f0f7ff; box-shadow: none; }

.ob-shop-item {
    background: white;
    border-radius: 8px;
    padding: 6px 8px;
    font-size: 7.5px;
    font-weight: 600;
    color: #1e293b;
    box-shadow: 0 1px 3px rgba(0,0,0,0.06);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.ob-shop-done { opacity: 0.6; background: #f8fafc; }

.ob-aisle-row { font-size: 7px; font-weight: 600; color: #374151; padding: 4px 5px; border-radius: 5px; background: white; box-shadow: 0 1px 2px rgba(0,0,0,0.06); }


/* ============================================================
   6. HOME SCREEN
   ============================================================ */

#homeScreen {
    height: 100vh;
    display: flex;
    flex-direction: column;
    background: var(--bg-page);
}

/* --- 6a. Header --- */
.home-header {
    background: var(--bg-header);
    padding: 0 20px;
    height: var(--header-h);
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-shrink: 0;
}

.home-title {
    font-size: 22px;
    font-weight: 800;
    color: var(--ink-900);
    letter-spacing: -0.5px;
}

.home-title span { color: var(--ink-200); font-weight: 300; }

.connection-badge {
    font-size: 11px;
    font-weight: 600;
    padding: 5px 12px;
    border-radius: var(--r-full);
    background: var(--ink-100);
    color: var(--ink-400);
    letter-spacing: 0.3px;
    border: 1px solid var(--ink-100);
}

.settings-btn {
    background: none;
    border: none;
    cursor: pointer;
    padding: 6px;
    border-radius: 8px;
    color: #005EA5;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: opacity 0.2s, background 0.2s;
}
.settings-btn:active { background: rgba(0,94,165,0.1); }

/* Home content */
.home-content {
    flex: 1;
    overflow-y: auto;
    padding: 24px 16px 100px;
}

.home-sub {
    font-size: 13px;
    font-weight: 500;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-bottom: 16px;
    padding: 0 4px;
}

/* --- 6b. Store Grid --- */
.store-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }

.store-card {
    background: var(--bg-card);
    border-radius: var(--r-lg);
    cursor: pointer;
    position: relative;
    overflow: hidden;
    box-shadow: var(--shadow-sm);
    transition: transform 0.18s cubic-bezier(0.34,1.56,0.64,1), box-shadow 0.18s ease;
    -webkit-tap-highlight-color: transparent;
    border: 1px solid rgba(0,0,0,0.04);
}

.store-card:active { transform: scale(0.97); box-shadow: var(--shadow-xs); }

.store-card-accent {
    position: absolute;
    left: 0; top: 0; bottom: 0;
    width: 4px;
    border-radius: var(--r-lg) 0 0 var(--r-lg);
}

.store-card-body {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 16px 16px 16px 22px;
}

.store-card-avatar {
    width: 52px; height: 52px;
    border-radius: var(--r-md);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.store-card-avatar-logo {
    background: white !important;
    border: 1px solid var(--ink-100);
    box-shadow: var(--shadow-xs);
}

.store-card-initials { font-size: 17px; font-weight: 800; color: white; letter-spacing: -0.5px; }
.store-card-info { flex: 1; min-width: 0; }
.store-card-name { font-size: 16px; font-weight: 700; color: var(--text-primary); letter-spacing: -0.2px; line-height: 1.2; }
.store-card-status { font-size: 12px; font-weight: 500; color: var(--text-secondary); margin-top: 3px; }
.store-card-status.has-items { color: var(--green); font-weight: 600; }
.store-card-arrow { color: var(--ink-200); flex-shrink: 0; display: flex; align-items: center; }

.store-card-delete {
    position: absolute;
    top: 50%; right: 12px;
    transform: translateY(-50%);
    background: var(--ink-50);
    border: none;
    color: var(--ink-400);
    width: 28px; height: 28px;
    border-radius: var(--r-full);
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity 0.2s, background 0.2s;
}

@keyframes bounceIn {
    0%   { transform: scale(0.3); opacity: 0; }
    50%  { transform: scale(1.15); opacity: 1; }
    75%  { transform: scale(0.95); }
    100% { transform: scale(1); }
}

.store-card-delete-outside {
    position: absolute;
    top: 50%;
    right: -14px;
    transform: translateY(-50%);
    width: 28px; height: 28px;
    border-radius: 50%;
    background: #fee2e2;
    color: #dc2626;
    border: none;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    z-index: 10;
    box-shadow: 0 1px 4px rgba(0,0,0,0.15);
}
.store-card-delete-outside:hover { background: #fca5a5; }

.store-card-delete-visible {
    opacity: 1 !important;
    background: #fee2e2;
    color: #dc2626;
    width: 32px; height: 32px;
}

.store-card-delete-visible:hover { background: #fca5a5; }
.store-card:hover .store-card-delete { opacity: 1; }
.store-card-delete:active { background: var(--red-bg); color: var(--red); opacity: 1; }

@media (max-width: 700px) { .store-card-delete { opacity: 0.4; } }


/* ============================================================
   7. STORE SCREEN
   ============================================================ */

#storeScreen { height: 100vh; display: flex; flex-direction: column; }

/* --- 7a. Store Header --- */
.store-header {
    background: var(--accent);
    height: var(--header-h);
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 0 16px;
    flex-shrink: 0;
    box-shadow: 0 2px 12px rgba(0,0,0,0.15);
}

.store-title { font-size: 18px; font-weight: 800; color: white; letter-spacing: -0.3px; flex-shrink: 0; }
.stats-bar { flex: 1; font-size: 12px; font-weight: 500; color: rgba(255,255,255,0.75); text-align: center; }

.clear-btn-sm {
    background: rgba(255,255,255,0.15);
    border: none;
    color: white;
    font-size: 12px;
    font-weight: 600;
    padding: 7px 12px;
    border-radius: var(--r-full);
    white-space: nowrap;
    flex-shrink: 0;
    transition: background 0.2s;
    letter-spacing: 0.2px;
}
.clear-btn-sm:active { background: rgba(255,255,255,0.28); }

/* --- 7b. Main Layout --- */
.main-layout {
    display: grid;
    grid-template-columns: 1fr 1fr;
    flex: 1;
    overflow: hidden;
}

.aisles-panel, .list-panel {
    display: flex;
    flex-direction: column;
    overflow: hidden;
    height: calc(100vh - var(--header-h) - var(--nav-h));
}

.aisles-panel { background: var(--bg-card); border-right: 1px solid var(--ink-100); }
.list-panel   { background: var(--bg-page); }

.panel-header {
    padding: 14px 16px 12px;
    background: var(--bg-card);
    border-bottom: 1px solid var(--ink-100);
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-shrink: 0;
}

.panel-header h2 { font-size: 13px; font-weight: 700; color: var(--accent); text-transform: uppercase; letter-spacing: 0.8px; }
.panel-sub { font-size: 11px; font-weight: 500; color: var(--text-secondary); }

.aisles-container {
    flex: 1;
    overflow-y: auto;
    padding: 12px;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

/* --- 7c. Aisle Cards --- */
.aisle-card {
    background: var(--bg-page);
    border-radius: var(--r-md);
    border: 1px solid var(--ink-100);
    cursor: pointer;
    transition: all 0.15s ease;
}

.aisle-card:active { background: #E8E8F8; transform: scale(0.98); }

.aisle-card-header {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 14px 12px;
}

.aisle-card-icon    { font-size: 16px; flex-shrink: 0; }
.aisle-card-meta    { flex: 1; min-width: 0; }

.aisle-card-name {
    font-size: 15px;
    font-weight: 600;
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    letter-spacing: -0.1px;
}

.aisle-card-count {
    font-size: 12px;
    font-weight: 500;
    color: var(--text-secondary);
    margin-top: 2px;
}

.aisle-in-list-count {
    font-size: 12px;
    font-weight: 600;
    color: var(--green);
    margin-top: 2px;
}

.aisle-manage-btn, .aisle-delete-btn {
    width: 34px; height: 34px;
    border: 1px solid var(--ink-100);
    background: var(--bg-card);
    border-radius: var(--r-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    flex-shrink: 0;
    transition: background 0.15s;
}

.aisle-manage-btn:active { background: var(--ink-50); }
.aisle-delete-btn:active  { background: var(--red-bg); }

.aisle-card-arrow { font-size: 16px; color: var(--ink-200); flex-shrink: 0; font-weight: 300; }

.add-aisle-btn {
    width: 100%;
    padding: 11px;
    background: transparent;
    color: var(--accent);
    border: 1.5px dashed rgba(37,99,235,0.3);
    border-radius: var(--r-md);
    font-size: 13px;
    font-weight: 600;
    letter-spacing: 0.2px;
    transition: all 0.2s;
}
.add-aisle-btn:active { background: var(--accent-dim); }

/* --- 7d. List Container & Items --- */
.list-container {
    flex: 1;
    overflow-y: auto;
    padding: 10px;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.aisle-group {
    background: var(--bg-card);
    border-radius: var(--r-lg);
    overflow: hidden;
    box-shadow: var(--shadow-sm);
    border: 1px solid rgba(0,0,0,0.04);
}

.aisle-group-header {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 14px;
    background: var(--accent);
    font-size: 12px;
    font-weight: 700;
    color: white;
    letter-spacing: 0.3px;
    text-transform: uppercase;
}

.aisle-group-count {
    background: rgba(255,255,255,0.2);
    border-radius: var(--r-full);
    padding: 2px 8px;
    font-size: 11px;
    margin-left: auto;
    font-weight: 600;
}

.item-card {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 13px 14px;
    border-bottom: 1px solid var(--ink-100);
    transition: background 0.2s;
}

.item-card:last-child { border-bottom: none; }
.item-card.checked    { background: var(--green-bg); }

.checkbox {
    width: 22px; height: 22px;
    border-radius: var(--r-full);
    border: 2px solid var(--ink-200);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 11px;
    color: white;
    flex-shrink: 0;
    cursor: pointer;
    transition: all 0.2s;
}

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

.item-name {
    flex: 1;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    letter-spacing: -0.1px;
    text-align: center;
}

.item-name.crossed { text-decoration: line-through; color: var(--text-secondary); font-weight: 400; }

.qty-badge {
    background: var(--accent);
    color: white;
    font-size: 11px;
    font-weight: 700;
    padding: 3px 8px;
    border-radius: var(--r-full);
    flex-shrink: 0;
    letter-spacing: 0.2px;
}

.del-btn {
    width: 30px; height: 30px;
    border: none;
    border-radius: var(--r-sm);
    background: var(--ink-50);
    font-size: 13px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    transition: background 0.15s;
}
.del-btn:active { background: var(--red-bg); color: var(--red); }


/* ============================================================
   8. AISLE PANEL OVERLAY
   ============================================================ */

.aisle-panel-overlay {
    display: none;
    position: fixed;
    inset: 0;
    z-index: 150;
    background: var(--bg-page);
    flex-direction: column;
    padding-bottom: var(--nav-h);
}

.aisle-panel-overlay.show { display: flex; }
.aisle-panel { display: flex; flex-direction: column; height: 100%; }

.aisle-panel-header {
    display: flex;
    align-items: center;
    padding: 0 20px;
    height: var(--header-h);
    background: var(--accent);
    flex-shrink: 0;
}

.aisle-panel-title { font-size: 20px; font-weight: 800; color: white; letter-spacing: -0.4px; }

.aisle-panel-products {
    flex: 1;
    overflow-y: auto;
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

/* --- 8a. Panel Chips --- */
.panel-chip {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 17px 18px;
    background: var(--bg-card);
    border-radius: var(--r-lg);
    box-shadow: var(--shadow-sm);
    cursor: pointer;
    border: 1px solid rgba(0,0,0,0.04);
    transition: all 0.15s cubic-bezier(0.34,1.56,0.64,1);
}

.panel-chip:active { transform: scale(0.97); }
.panel-chip.in-list { border-color: var(--green); background: var(--green-bg); }

.panel-chip-name { font-size: 16px; font-weight: 500; color: var(--text-primary); letter-spacing: -0.2px; }

.panel-chip-badge {
    font-size: 11px;
    font-weight: 700;
    padding: 5px 12px;
    border-radius: var(--r-full);
    white-space: nowrap;
    letter-spacing: 0.3px;
    text-transform: uppercase;
}

.panel-chip-badge.add { background: var(--accent-dim); color: var(--accent); }
.panel-chip-badge.in  { background: var(--green-bg); color: var(--green); border: 1.5px solid rgba(5,150,105,0.2); }

.panel-chip-wrapper {
    display: flex;
    align-items: center;
    gap: 8px;
}

.panel-chip-wrapper .panel-chip { flex: 1; }

.panel-chip-wrapper .chip-fav-btn {
    flex-shrink: 0;
    width: 40px; height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg-card);
    border-radius: var(--r-md);
    box-shadow: var(--shadow-xs);
    border: 1px solid var(--ink-100);
    font-size: 18px;
    opacity: 0.35;
    padding: 0;
}

.panel-chip-wrapper .chip-fav-btn.active { opacity: 1; }
.panel-chip-wrapper .chip-fav-btn:active { transform: scale(1.2); background: #fef9c3; }


/* ============================================================
   9. SHOPPING MODE
   ============================================================ */

.shopping-mode-overlay {
    position: fixed;
    inset: 0;
    z-index: 160;
    background: var(--bg-page);
    display: flex;
    flex-direction: column;
    padding-bottom: var(--nav-h);
}

.shopping-mode-overlay.hidden { display: none; }

.shopping-mode-header {
    background: var(--accent);
    padding: 14px 20px 16px;
    display: flex;
    flex-direction: column;
    gap: 2px;
    flex-shrink: 0;
}

.shopping-mode-header-top { display: flex; align-items: center; justify-content: space-between; }

.shopping-mode-label {
    font-size: 11px;
    font-weight: 700;
    color: rgba(255,255,255,0.6);
    text-transform: uppercase;
    letter-spacing: 1.2px;
}

.shopping-mode-title { font-size: 22px; font-weight: 800; color: white; letter-spacing: -0.5px; margin-top: 2px; }

.shopping-mode-stats {
    font-size: 11px;
    font-weight: 700;
    color: white;
    background: rgba(255,255,255,0.2);
    padding: 4px 12px;
    border-radius: var(--r-full);
    letter-spacing: 0.3px;
}

.shopping-mode-list {
    flex: 1;
    overflow-y: auto;
    padding: 16px 16px 30px;
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.shop-aisle-group { display: flex; flex-direction: column; gap: 6px; }

.shop-aisle-header {
    font-size: 11px;
    font-weight: 700;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 1px;
    padding: 0 4px;
    margin-bottom: 2px;
}

.shop-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 18px 20px;
    background: var(--bg-card);
    border-radius: var(--r-lg);
    box-shadow: var(--shadow-sm);
    cursor: pointer;
    border: 1px solid rgba(0,0,0,0.04);
    transition: all 0.2s cubic-bezier(0.34,1.56,0.64,1);
    min-height: 62px;
}

.shop-item:active { transform: scale(0.97); }
.shop-item.checked { background: var(--green-bg); border-color: rgba(5,150,105,0.2); opacity: 0.65; }

.shop-item-name { font-size: 17px; font-weight: 500; letter-spacing: -0.2px; flex: 1; text-align: center; }
.shop-item-name.crossed { text-decoration: line-through; color: var(--text-secondary); font-weight: 400; }

.shop-qty-badge {
    background: var(--accent);
    color: white;
    font-size: 12px;
    font-weight: 700;
    padding: 5px 12px;
    border-radius: var(--r-full);
    flex-shrink: 0;
    letter-spacing: 0.3px;
}

.shop-done-badge {
    background: var(--green);
    color: white;
    font-size: 13px;
    font-weight: 700;
    width: 30px; height: 30px;
    border-radius: var(--r-full);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.shop-store-header {
    padding: 12px 16px;
    margin: 8px 0 0;
    border-radius: 10px 10px 0 0;
}


/* ============================================================
   10. BOTTOM NAVIGATION
   ============================================================ */

.bottom-nav {
    position: fixed;
    bottom: 0; left: 0; right: 0;
    height: var(--nav-h);
    background: rgba(240,240,246,0.96);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 500;
    border-top: 1px solid var(--ink-100);
    padding-bottom: env(safe-area-inset-bottom);
}

.nav-home-screen,
.nav-store-screen {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    position: relative;
    height: var(--nav-h);
}

/* Home button (home screen) */
.nav-btn-home {
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--home-btn-color, #0D9488);
    border: none;
    width: 60px; height: 60px;
    border-radius: 20px;
    position: absolute;
    left: 50%; top: 50%;
    transform: translate(-50%, -58%);
    box-shadow: 0 8px 24px var(--home-btn-shadow, rgba(13,148,136,0.5));
    transition: background 0.4s ease, box-shadow 0.4s ease, transform 0.2s cubic-bezier(0.34,1.56,0.64,1);
    -webkit-tap-highlight-color: transparent;
    padding: 0;
}
.nav-btn-home:active { transform: translate(-50%, -48%) scale(0.92); }

/* Back button (store screen) */
.nav-btn-back {
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--home-btn-color, #0D9488);
    border: none;
    width: 60px; height: 60px;
    border-radius: 20px;
    position: absolute;
    left: 50%; top: 50%;
    transform: translate(-50%, -58%);
    box-shadow: 0 8px 24px var(--home-btn-shadow, rgba(13,148,136,0.5));
    transition: background 0.4s ease, box-shadow 0.4s ease, transform 0.2s cubic-bezier(0.34,1.56,0.64,1);
    -webkit-tap-highlight-color: transparent;
    cursor: pointer;
    padding: 0;
}
.nav-btn-back:active { transform: translate(-50%, -48%) scale(0.92); }

.nav-home-icon { display: flex; align-items: center; justify-content: center; }

/* Side buttons */
.nav-btn-add, .nav-btn-shop {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    background: none;
    border: none;
    padding: 8px 16px;
    border-radius: var(--r-md);
    transition: background 0.15s;
    position: absolute;
    right: calc(50% + 44px);
}

.nav-btn-shop { right: calc(50% + 44px); }
.nav-btn-add:active, .nav-btn-shop:active { background: var(--ink-100); }

.nav-btn-code {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    background: none;
    border: none;
    padding: 8px 16px;
    border-radius: var(--r-md);
    transition: background 0.15s;
    position: absolute;
    left: calc(50% + 44px);
    cursor: pointer;
}
.nav-btn-code:active { background: var(--ink-100); }

.nav-icon-wrap {
    width: 36px; height: 36px;
    background: var(--ink-100);
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 17px;
}

.nav-label {
    font-size: 10px;
    font-weight: 600;
    color: var(--ink-400);
    letter-spacing: 0.4px;
    text-transform: uppercase;
}


/* ============================================================
   11. MODALS
   ============================================================ */

.modal-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(15,15,20,0.6);
    backdrop-filter: blur(8px);
    z-index: 200;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

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

.modal {
    background: var(--bg-card);
    border-radius: var(--r-xl);
    padding: 28px 24px;
    width: 100%;
    max-width: 400px;
    max-height: 88vh;
    overflow-y: auto;
    box-shadow: var(--shadow-lg);
    animation: popIn 0.22s cubic-bezier(0.34,1.56,0.64,1);
}

.modal h3 { font-size: 20px; font-weight: 800; color: var(--text-primary); letter-spacing: -0.4px; margin-bottom: 6px; }
.modal .modal-sub { font-size: 14px; font-weight: 400; color: var(--text-secondary); margin-bottom: 4px; line-height: 1.5; }

.modal-actions { display: flex; gap: 10px; margin-top: 24px; }

.modal-btn {
    flex: 1;
    padding: 14px;
    border: none;
    border-radius: var(--r-md);
    font-size: 15px;
    font-weight: 700;
    letter-spacing: -0.1px;
    min-height: 50px;
    transition: opacity 0.15s, transform 0.15s;
}

.modal-btn:active  { opacity: 0.8; transform: scale(0.98); }
.modal-btn.cancel  { background: var(--ink-50); color: var(--text-primary); }
.modal-btn.danger  { background: var(--red); color: white; }
.modal-btn.confirm { background: var(--accent); color: white; }


/* ============================================================
   12. SETTINGS PANEL
   ============================================================ */

.settings-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.4);
    z-index: 800;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
}
.settings-overlay.open { opacity: 1; pointer-events: all; }

.settings-panel {
    position: fixed;
    top: 0; right: 0; bottom: 0;
    width: min(320px, 85vw);
    background: white;
    z-index: 801;
    transform: translateX(100%);
    transition: transform 0.3s cubic-bezier(0.4,0,0.2,1);
    display: flex;
    flex-direction: column;
    box-shadow: -4px 0 24px rgba(0,0,0,0.15);
}
.settings-panel.open { transform: translateX(0); }

.settings-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 20px 20px 16px;
    border-bottom: 1px solid #f0f0f0;
    background: #005EA5;
    color: white;
}
.settings-title { font-size: 17px; font-weight: 700; }
.settings-close {
    background: rgba(255,255,255,0.2);
    border: none;
    color: white;
    width: 32px; height: 32px;
    border-radius: 50%;
    font-size: 16px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
}

.settings-body { flex: 1; overflow-y: auto; padding: 8px 0; }

.settings-item {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 16px 20px;
    cursor: pointer;
    transition: background 0.15s;
    border-bottom: 1px solid #f8f8f8;
}
.settings-item:active { background: #f0f7ff; }

.settings-item-icon {
    width: 40px; height: 40px;
    background: #f0f7ff;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #005EA5;
    flex-shrink: 0;
}

.settings-item-text  { flex: 1; }
.settings-item-title { font-size: 15px; font-weight: 600; color: #1a1a2e; }
.settings-item-sub   { font-size: 12px; color: #9ca3af; margin-top: 2px; }
.settings-item-arrow { color: #d1d5db; font-size: 20px; }

.settings-divider { height: 8px; background: #f8f9fa; margin: 4px 0; }

.settings-footer {
    padding: 20px;
    text-align: center;
    font-size: 12px;
    color: #9ca3af;
    line-height: 1.8;
}

/* Help guide */
.help-section {
    display: flex;
    gap: 14px;
    padding: 12px 0;
    border-bottom: 1px solid #f3f4f6;
}
.help-section:last-of-type { border-bottom: none; }
.help-icon  { font-size: 24px; flex-shrink: 0; width: 32px; text-align: center; }
.help-title { font-size: 14px; font-weight: 700; color: #1a1a2e; margin-bottom: 4px; }
.help-text  { font-size: 13px; color: #6b7280; line-height: 1.5; }


/* ============================================================
   13. FAVOURITES
   ============================================================ */

.fav-group { margin-bottom: 12px; }

.fav-group-header {
    font-size: 11px;
    font-weight: 700;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 1px;
    padding: 0 4px;
    margin-bottom: 6px;
}

.fav-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 16px;
    background: var(--bg-card);
    border-radius: var(--r-md);
    margin-bottom: 6px;
    cursor: pointer;
    box-shadow: var(--shadow-xs);
    transition: all 0.15s;
    -webkit-tap-highlight-color: transparent;
}
.fav-item:active { transform: scale(0.98); }

.fav-item-name { font-size: 15px; font-weight: 500; color: var(--text-primary); }

.fav-add-badge {
    font-size: 11px;
    font-weight: 700;
    color: var(--accent);
    background: var(--accent-dim);
    padding: 4px 10px;
    border-radius: var(--r-full);
}

/* List tabs */
.list-tabs { display: flex; gap: 6px; width: 100%; }

.list-tab {
    flex: 1;
    padding: 7px 10px;
    border: 1.5px solid var(--ink-100);
    background: var(--bg-page);
    border-radius: var(--r-sm);
    font-size: 12px;
    font-weight: 600;
    color: var(--text-secondary);
    cursor: pointer;
    transition: all 0.15s;
    font-family: var(--font);
}

.list-tab.active { background: var(--accent); border-color: var(--accent); color: white; }


/* ============================================================
   14. MISC COMPONENTS
   ============================================================ */

/* --- 14a. Toast --- */
.toast {
    position: fixed;
    bottom: calc(var(--nav-h) + 12px);
    left: 50%;
    transform: translateX(-50%) translateY(12px);
    background: var(--ink-800);
    color: white;
    padding: 11px 20px;
    border-radius: var(--r-full);
    font-size: 13px;
    font-weight: 600;
    opacity: 0;
    transition: all 0.28s cubic-bezier(0.34,1.56,0.64,1);
    z-index: 600;
    white-space: nowrap;
    pointer-events: none;
    letter-spacing: 0.1px;
    border: 1px solid rgba(255,255,255,0.08);
    box-shadow: var(--shadow-md);
}

.toast.show       { opacity: 1; transform: translateX(-50%) translateY(0); }
.toast.toast-error { background: var(--red); }

/* --- 14b. Empty State --- */
.empty-state { text-align: center; padding: 48px 20px; color: var(--text-secondary); }
.empty-icon  { font-size: 44px; margin-bottom: 14px; line-height: 1; }
.empty-state p { font-size: 16px; font-weight: 600; color: var(--text-primary); }
.empty-sub   { font-size: 13px; color: var(--text-secondary); margin-top: 6px; font-weight: 400; line-height: 1.5; }

/* --- 14c. Product Library --- */
.product-lib-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 14px;
    background: var(--ink-50);
    border-radius: var(--r-md);
    margin-bottom: 6px;
    font-size: 14px;
    font-weight: 500;
    color: var(--text-primary);
}

/* --- 14d. Chip fav button --- */
.chip-fav-btn {
    background: none;
    border: none;
    font-size: 16px;
    cursor: pointer;
    opacity: 0.3;
    padding: 0 4px 0 0;
    flex-shrink: 0;
    transition: opacity 0.2s, transform 0.2s;
    -webkit-tap-highlight-color: transparent;
}
.chip-fav-btn.active  { opacity: 1; }
.chip-fav-btn:active  { transform: scale(1.3); }

/* --- 14e. Price Lookup Button --- */
.chip-price-btn {
    background: none;
    border: 1.5px solid var(--accent);
    color: var(--accent);
    font-size: 12px;
    font-weight: 800;
    font-family: var(--font);
    padding: 3px 8px;
    border-radius: var(--r-full);
    cursor: pointer;
    flex-shrink: 0;
    margin-left: 4px;
    transition: all 0.15s;
    -webkit-tap-highlight-color: transparent;
}
.chip-price-btn:active { background: var(--accent); color: white; transform: scale(0.95); }


/* ============================================================
   15. ANIMATIONS & KEYFRAMES
   ============================================================ */

@keyframes popIn {
    from { transform: scale(0.92); opacity: 0; }
    to   { transform: scale(1);    opacity: 1; }
}

@keyframes slideUp {
    from { transform: translateY(100%); opacity: 0; }
    to   { transform: translateY(0);    opacity: 1; }
}

@keyframes shake {
    0%,100% { transform: translateX(0); }
    20%,60%  { transform: translateX(-6px); }
    40%,80%  { transform: translateX(6px); }
}

@keyframes splashLogoIn {
    from { opacity: 0; transform: translateY(-20px); }
    to   { opacity: 1; transform: translateY(0); }
}

@keyframes splashStoreIn {
    from { opacity: 0; transform: translateY(16px) scale(0.8); }
    to   { opacity: 1; transform: translateY(0) scale(1); }
}

@keyframes loadBar {
    0%   { width: 0%; }
    100% { width: 100%; }
}

.shake { animation: shake 0.35s ease; }


/* ============================================================
   16. DRAG & DROP
   ============================================================ */

.aisle-card { cursor: grab; }

.aisle-drag-ghost {
    opacity: 0.4;
    border: 2px dashed var(--accent) !important;
    background: var(--accent-dim) !important;
}

.aisle-drag-chosen {
    box-shadow: 0 8px 24px rgba(0,0,0,0.15) !important;
    transform: scale(1.02);
    cursor: grabbing !important;
}


/* ============================================================
   17. SCROLLBARS
   ============================================================ */

::-webkit-scrollbar       { width: 3px; }
::-webkit-scrollbar-thumb { background: var(--ink-100); border-radius: 3px; }


/* ============================================================
   18. MOBILE RESPONSIVE
   ============================================================ */

@media (max-width: 700px) {
    body { height: auto; overflow: auto; }
    #homeScreen  { height: auto; min-height: 100vh; }
    #storeScreen { height: auto; }

    .main-layout { grid-template-columns: 1fr; overflow: visible; }

    .aisles-panel, .list-panel { height: auto; overflow: visible; }
    .aisles-panel { border-right: none; border-bottom: 1px solid var(--ink-100); }
    .aisles-container, .list-container { max-height: none; overflow: visible; padding-bottom: 16px; }

    .store-header { flex-wrap: wrap; height: auto; padding: 10px 14px; gap: 8px; }
    .modal { border-radius: var(--r-xl) var(--r-xl) 0 0; }
    .store-card-delete { opacity: 0.4; }
    .store-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
}

/* ===== PANEL ADD PRODUCT (bottom of aisle panel) ===== */
.panel-add-product {
    display: flex;
    gap: 8px;
    align-items: center;
    padding: 12px 0 4px;
    margin-top: 8px;
    border-top: 1.5px solid var(--ink-100);
    position: sticky;
    bottom: 0;
    background: var(--bg-page);
}

/* ===== CHIP DELETE BUTTON ===== */
.chip-delete-btn {
    flex-shrink: 0;
    width: 36px;
    height: 36px;
    background: var(--bg-card);
    border: 1px solid var(--ink-100);
    border-radius: var(--r-md);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    cursor: pointer;
    transition: background 0.15s;
    -webkit-tap-highlight-color: transparent;
}
.chip-delete-btn:active { background: var(--red-bg); }

/* ===== AISLE PANEL NAV ===== */
.nav-aisle-panel {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    position: relative;
    height: var(--nav-h);
}

.nav-btn-add-product {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    background: none;
    border: none;
    padding: 8px 16px;
    border-radius: var(--r-md);
    transition: background 0.15s;
    position: absolute;
    left: calc(50% + 44px);
    cursor: pointer;
}
.nav-btn-add-product:active { background: var(--ink-100); }
