/* ==========================================================================
   Go-Kirana Staff Console — shared design system
   Used by app/index.html (shell) and every view in app/views/*.html
   ========================================================================== */

:root {
    --primary: #10b981;
    --primary-dark: #059669;
    --primary-light: #ecfdf5;
    --bg: #f8fafc;
    --card-bg: #ffffff;
    --text-main: #0f172a;
    --text-muted: #64748b;
    --border: #e2e8f0;
    --accent-blue: #3b82f6;
    --accent-purple: #8b5cf6;
    --accent-orange: #f97316;
    --accent-red: #ef4444;
    --shadow-sm: 0 1px 3px rgba(0,0,0,0.05);
    --shadow-md: 0 4px 12px -2px rgba(0,0,0,0.08);
    --radius-lg: 16px;
    --radius-md: 12px;
    --radius-sm: 8px;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html, body {
    height: 100%;
}

body {
    font-family: 'Plus Jakarta Sans', sans-serif;
    background-color: var(--bg);
    color: var(--text-main);
    padding-bottom: 40px;
    -webkit-tap-highlight-color: transparent;
    -webkit-font-smoothing: antialiased;
    text-rendering: optimizeLegibility;
}

a { color: inherit; }

/* ---------- Login overlay (shared, shell-level) ---------- */
#login-overlay {
    position: fixed;
    top: 0; left: 0; width: 100vw; height: 100vh;
    background: linear-gradient(135deg, #064e3b 0%, #0f172a 100%);
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.login-card {
    background: var(--card-bg);
    border-radius: var(--radius-lg);
    padding: 36px 32px;
    width: 100%;
    max-width: 400px;
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.3);
    text-align: center;
}

.login-card h2 { font-size: 1.4rem; font-weight: 800; color: var(--text-main); margin-bottom: 6px; }
.login-card p { font-size: 0.85rem; color: var(--text-muted); margin-bottom: 24px; }

.login-field { text-align: left; margin-bottom: 16px; }
.login-field label { display: block; font-size: 0.8rem; font-weight: 700; margin-bottom: 6px; color: var(--text-main); }
.login-field input {
    width: 100%;
    padding: 12px 16px;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border);
    font-size: 0.95rem;
    outline: none;
    transition: border-color 0.2s;
}
.login-field input:focus { border-color: var(--primary); }

.login-btn {
    width: 100%;
    background: var(--primary);
    color: white;
    border: none;
    padding: 14px;
    border-radius: 30px;
    font-size: 1rem;
    font-weight: 800;
    cursor: pointer;
    margin-top: 10px;
    box-shadow: 0 4px 12px rgba(16,185,129,0.3);
}
.login-btn:hover { background: var(--primary-dark); }
.login-btn:disabled { opacity: 0.7; cursor: not-allowed; }

#login-error-msg {
    color: var(--accent-red);
    font-size: 0.8rem;
    font-weight: 700;
    margin-top: 12px;
    display: none;
}

/* ---------- App shell header (top-level, always visible once logged in) ---------- */
.app-shell-header {
    background: linear-gradient(135deg, #064e3b 0%, #047857 100%);
    color: white;
    padding: 16px 20px;
    position: sticky;
    top: 0;
    z-index: 100;
    box-shadow: 0 4px 20px rgba(0,0,0,0.12);
}

.header-container {
    max-width: 1300px;
    margin: 0 auto;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 12px;
}

.brand { display: flex; align-items: center; gap: 12px; cursor: pointer; }

.brand-icon {
    font-size: 1.8rem;
    background: rgba(255,255,255,0.15);
    width: 44px;
    height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--radius-md);
    backdrop-filter: blur(4px);
    flex-shrink: 0;
}

.brand-text h1 { font-size: 1.25rem; font-weight: 800; letter-spacing: -0.02em; }
.brand-text p { font-size: 0.75rem; opacity: 0.8; font-weight: 500; }

.header-actions { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }

/* App switcher: Agent Hub / Admin / Record Order */
.app-switcher { display: flex; gap: 6px; background: rgba(255,255,255,0.12); padding: 4px; border-radius: 30px; }

.app-switcher-btn {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    background: transparent;
    color: rgba(255,255,255,0.85);
    border: none;
    padding: 9px 16px;
    border-radius: 24px;
    font-weight: 700;
    font-size: 0.82rem;
    cursor: pointer;
    transition: all 0.2s ease;
    white-space: nowrap;
}
.app-switcher-btn:hover { background: rgba(255,255,255,0.15); color: white; }
.app-switcher-btn.active { background: white; color: var(--primary-dark); box-shadow: 0 2px 8px rgba(0,0,0,0.15); }
.app-switcher-btn svg, .bottom-tab-btn svg { width: 18px; height: 18px; flex-shrink: 0; }

@media (max-width: 860px) {
    .header-container { flex-direction: column; align-items: stretch; }
    .app-switcher { width: 100%; overflow-x: auto; scrollbar-width: none; }
    .app-switcher::-webkit-scrollbar { display: none; }
    .header-actions { width: 100%; justify-content: space-between; padding-top: 8px; border-top: 1px solid rgba(255,255,255,0.15); }
}

/* ---------- Bottom tab bar (mobile only) ---------- */
.bottom-tab-bar { display: none; }

@media (max-width: 640px) {
    /* Primary route navigation moves to a thumb-reach bottom bar; the top
       switcher would otherwise duplicate it and eat vertical space agents
       need for content on a phone. */
    .app-switcher { display: none; }

    .bottom-tab-bar {
        display: flex;
        position: fixed;
        left: 0; right: 0; bottom: 0;
        z-index: 150;
        background: var(--card-bg);
        border-top: 1px solid var(--border);
        box-shadow: 0 -4px 16px rgba(0,0,0,0.06);
        padding: 6px 4px calc(6px + env(safe-area-inset-bottom, 0px));
        transition: transform 0.25s ease;
    }
    /* Slid away while actively scrolling down a long list (see app/index.html) so
       it never sits over the last card; reappears on scroll-up or near the top. */
    .bottom-tab-bar.bottom-tab-bar--hidden { transform: translateY(100%); }
    .bottom-tab-btn {
        flex: 1;
        display: flex;
        flex-direction: column;
        align-items: center;
        justify-content: center;
        gap: 3px;
        background: transparent;
        border: none;
        padding: 6px 4px;
        border-radius: var(--radius-sm);
        color: var(--text-muted);
        font-size: 0.68rem;
        font-weight: 700;
        cursor: pointer;
        transition: color 0.15s ease;
    }
    .bottom-tab-btn.active { color: var(--primary-dark); }
    .bottom-tab-btn:active { background: var(--bg); }

    body { padding-bottom: calc(72px + env(safe-area-inset-bottom, 0px)); }
}

.sync-btn {
    background: rgba(255,255,255,0.2);
    color: white;
    border: 1px solid rgba(255,255,255,0.3);
    padding: 8px 14px;
    border-radius: 20px;
    font-weight: 600;
    font-size: 0.8rem;
    cursor: pointer;
    transition: all 0.2s ease;
    white-space: nowrap;
}
.sync-btn:hover { background: white; color: var(--primary-dark); }

.logout-btn {
    background: rgba(239, 68, 68, 0.25);
    color: white;
    border: 1px solid rgba(255,255,255,0.3);
    padding: 8px 14px;
    border-radius: 20px;
    font-weight: 600;
    font-size: 0.8rem;
    cursor: pointer;
    white-space: nowrap;
}
.logout-btn:hover { background: var(--accent-red); }

/* ---------- View routing container ---------- */
#view-root { min-height: 60vh; }

.view-loading {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    padding: 80px 20px;
    color: var(--text-muted);
    font-weight: 700;
}

.spinner {
    width: 20px; height: 20px;
    border: 3px solid var(--border);
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: spin 0.7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- Skeleton loader (shown while a view's HTML/JS is fetched) ---------- */
.skeleton-block { padding: 20px 16px; max-width: 1200px; margin: 0 auto; }
.skeleton-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 20px;
    margin-top: 20px;
}
.skeleton {
    background: linear-gradient(100deg, var(--border) 30%, #eef2f7 50%, var(--border) 70%);
    background-size: 200% 100%;
    animation: shimmer 1.4s ease-in-out infinite;
    border-radius: var(--radius-md);
}
.skeleton-line { border-radius: var(--radius-sm); }
.skeleton-card { height: 180px; border-radius: var(--radius-lg); }
@keyframes shimmer { from { background-position: 150% 0; } to { background-position: -50% 0; } }

@keyframes fadeIn { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: translateY(0); } }
.view-fade-in { animation: fadeIn 0.25s ease; }

.container {
    max-width: 1200px;
    margin: 20px auto;
    padding: 0 16px;
}

/* ---------- Status Toast ---------- */
#status-banner {
    padding: 12px 18px;
    margin-bottom: 20px;
    border-radius: var(--radius-md);
    font-weight: 600;
    font-size: 0.875rem;
    display: flex;
    align-items: center;
    gap: 10px;
    box-shadow: var(--shadow-sm);
}
.status-loading { background: #eff6ff; color: #1e40af; border: 1px solid #bfdbfe; }
.status-success { background: #f0fdf4; color: #166534; border: 1px solid #bbf7d0; }
.status-error { background: #fef2f2; color: #991b1b; border: 1px solid #fecaca; }

/* ---------- Navigation Pills (in-view sub tabs) ---------- */
.nav-pills {
    display: flex;
    gap: 10px;
    margin-bottom: 24px;
    overflow-x: auto;
    padding-bottom: 4px;
    scrollbar-width: none;
}
.nav-pills::-webkit-scrollbar { display: none; }

.pill-btn {
    padding: 10px 20px;
    border: 1px solid var(--border);
    background: var(--card-bg);
    font-size: 0.9rem;
    font-weight: 700;
    color: var(--text-muted);
    cursor: pointer;
    border-radius: 30px;
    white-space: nowrap;
    transition: all 0.2s ease;
    box-shadow: var(--shadow-sm);
}
.pill-btn.active {
    background: var(--primary);
    color: white;
    border-color: var(--primary);
    box-shadow: 0 4px 12px rgba(16, 185, 129, 0.3);
}

.tab-content { display: none; }
.tab-content.active { display: block; }

/* ---------- Home grid (4 primary cards) ---------- */
.home-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 20px;
    max-width: 800px;
    margin: 20px auto 40px auto;
}
@media (max-width: 600px) { .home-grid { grid-template-columns: 1fr; } }

.home-card {
    background: var(--card-bg);
    border: 2px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 32px 24px;
    text-align: center;
    cursor: pointer;
    transition: all 0.25s ease;
    box-shadow: var(--shadow-sm);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    position: relative;
    overflow: hidden;
}
.home-card:hover {
    transform: translateY(-6px);
    border-color: var(--primary);
    box-shadow: 0 12px 24px -4px rgba(16, 185, 129, 0.15);
}
.home-card-icon {
    font-size: 3rem;
    margin-bottom: 12px;
    background: var(--primary-light);
    width: 80px;
    height: 80px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
}
.home-card h3 { font-size: 1.25rem; font-weight: 800; color: var(--text-main); margin-bottom: 6px; }
.home-card p { font-size: 0.85rem; color: var(--text-muted); font-weight: 500; }

/* ---------- KPI Dashboard Grid ---------- */
.kpi-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 16px;
    margin-bottom: 24px;
}
.kpi-card {
    background: var(--card-bg);
    padding: 20px;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--border);
    position: relative;
    overflow: hidden;
}
.kpi-card::before { content: ''; position: absolute; top: 0; left: 0; width: 100%; height: 4px; background: var(--primary); }
.kpi-card.blue::before { background: var(--accent-blue); }
.kpi-card.orange::before { background: var(--accent-orange); }
.kpi-card.purple::before { background: var(--accent-purple); }
.kpi-label { font-size: 0.8rem; font-weight: 700; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.05em; }
.kpi-num { font-size: 1.8rem; font-weight: 800; margin-top: 8px; color: var(--text-main); }

/* ---------- Customer Cards Grid ---------- */
.cards-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 20px;
}

.customer-card {
    background: var(--card-bg);
    border-radius: var(--radius-lg);
    border: 1px solid var(--border);
    padding: 20px;
    box-shadow: var(--shadow-sm);
    transition: all 0.25s ease;
    cursor: pointer;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    position: relative;
}
.customer-card:hover { transform: translateY(-4px); box-shadow: var(--shadow-md); border-color: var(--primary); }

.rank-badge {
    position: absolute;
    top: 16px; right: 16px;
    background: linear-gradient(135deg, #10b981, #059669);
    color: white;
    font-size: 0.75rem;
    font-weight: 800;
    padding: 4px 10px;
    border-radius: 20px;
    box-shadow: 0 2px 8px rgba(16, 185, 129, 0.3);
}

.card-header-user { display: flex; align-items: center; gap: 14px; margin-bottom: 16px; padding-right: 60px; }

.avatar {
    width: 48px; height: 48px;
    border-radius: 50%;
    background: var(--primary-light);
    color: var(--primary-dark);
    font-weight: 800;
    font-size: 1.1rem;
    display: flex;
    align-items: center;
    justify-content: center;
}

.user-info h3 { font-size: 1.05rem; font-weight: 800; color: var(--text-main); }
.user-info p { font-size: 0.8rem; color: var(--text-muted); font-weight: 600; }

.score-pill-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: #f1f5f9;
    padding: 10px 14px;
    border-radius: var(--radius-md);
    margin-bottom: 14px;
}
.score-val { font-size: 1.1rem; font-weight: 800; color: var(--primary-dark); }

.stats-badge-row { display: flex; gap: 8px; margin-bottom: 16px; flex-wrap: wrap; }

.badge {
    background: #f1f5f9;
    color: var(--text-main);
    padding: 6px 12px;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 700;
    display: inline-flex;
    align-items: center;
    gap: 4px;
}
.badge.green { background: #dcfce7; color: #15803d; }
.badge.orange { background: #ffedd5; color: #c2410c; }
.badge.red { background: #fee2e2; color: #b91c1c; }

.card-metrics {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
    background: var(--bg);
    padding: 12px;
    border-radius: var(--radius-md);
    margin-bottom: 16px;
}
.metric-item span { display: block; font-size: 0.7rem; color: var(--text-muted); font-weight: 600; text-transform: uppercase; }
.metric-item strong { font-size: 0.95rem; font-weight: 800; color: var(--text-main); }

.card-footer-action {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.85rem;
    font-weight: 700;
    color: var(--primary-dark);
    border-top: 1px solid var(--border);
    padding-top: 12px;
    gap: 8px;
}

.btn-order {
    background: var(--primary);
    color: white;
    border: none;
    padding: 10px 16px;
    border-radius: 20px;
    font-weight: 700;
    font-size: 0.85rem;
    cursor: pointer;
    transition: all 0.2s ease;
    box-shadow: 0 2px 6px rgba(16,185,129,0.3);
}
.btn-order:hover { background: var(--primary-dark); }

.btn-analytics {
    background: #e0e7ff;
    color: #3730a3;
    border: none;
    padding: 10px 14px;
    border-radius: 20px;
    font-weight: 700;
    font-size: 0.85rem;
    cursor: pointer;
}

/* ---------- Modal Overlay & Containers ---------- */
.modal-overlay {
    position: fixed;
    top: 0; left: 0; width: 100%; height: 100%;
    background: rgba(15, 23, 42, 0.6);
    backdrop-filter: blur(4px);
    z-index: 200;
    display: none;
    justify-content: center;
    align-items: flex-end;
}
@media (min-width: 640px) { .modal-overlay { align-items: center; padding: 20px; } }
.modal-overlay.active { display: flex; }

.modal-container {
    background: var(--card-bg);
    width: 100%;
    max-width: 680px;
    max-height: 90vh;
    border-radius: 24px 24px 0 0;
    overflow-y: auto;
    animation: slideUp 0.3s cubic-bezier(0.16, 1, 0.3, 1);
    padding: 24px;
}
@media (min-width: 640px) { .modal-container { border-radius: var(--radius-lg); } }
@keyframes slideUp { from { transform: translateY(100%); } to { transform: translateY(0); } }

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid var(--border);
    padding-bottom: 16px;
    margin-bottom: 20px;
}
.modal-title h2 { font-size: 1.2rem; font-weight: 800; }
.modal-title p { font-size: 0.8rem; color: var(--text-muted); }

.close-btn {
    background: #f1f5f9;
    border: none;
    width: 36px; height: 36px;
    border-radius: 50%;
    font-weight: bold;
    cursor: pointer;
    font-size: 1.1rem;
}

/* ---------- Recommendation Box ---------- */
.recommendation-box {
    background: linear-gradient(135deg, #ecfdf5 0%, #f0fdf4 100%);
    border: 1px solid #a7f3d0;
    border-radius: var(--radius-md);
    padding: 16px;
    margin-bottom: 20px;
}
.rec-title { font-size: 0.85rem; font-weight: 800; color: var(--primary-dark); margin-bottom: 10px; display: flex; align-items: center; justify-content: space-between; }
.rec-chips { display: flex; gap: 8px; flex-wrap: wrap; }
.rec-chip {
    background: white;
    border: 1px solid #10b981;
    color: var(--text-main);
    padding: 6px 12px;
    border-radius: 20px;
    font-size: 0.8rem;
    font-weight: 700;
    box-shadow: var(--shadow-sm);
    display: flex;
    align-items: center;
    gap: 6px;
}
.prob-badge { font-size: 0.7rem; background: #dcfce7; color: #15803d; padding: 2px 6px; border-radius: 10px; font-weight: 800; }

/* ---------- Order Cards ---------- */
.month-divider {
    font-size: 0.78rem;
    font-weight: 800;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    padding: 10px 2px 8px;
    margin-top: 4px;
    border-bottom: 2px solid var(--border);
    margin-bottom: 12px;
}
.month-divider:first-child { margin-top: 0; }

.order-card { background: var(--bg); border: 1px solid var(--border); border-radius: var(--radius-md); padding: 16px; margin-bottom: 14px; }
.order-card-header { display: flex; justify-content: space-between; align-items: center; cursor: pointer; }
.order-id { font-family: monospace; font-weight: 800; font-size: 0.9rem; color: var(--primary-dark); }
.order-date { font-size: 0.75rem; color: var(--text-muted); }

.profit-badge { font-size: 0.75rem; font-weight: 800; padding: 4px 8px; border-radius: 6px; display: inline-block; margin-top: 4px; }
.profit-pos { background: #dcfce7; color: #15803d; }
.profit-neg { background: #fee2e2; color: #b91c1c; }

.order-items-list { margin-top: 14px; padding-top: 14px; border-top: 1px dashed var(--border); display: none; }
.order-items-list.open { display: block; }

.item-row { display: flex; justify-content: space-between; align-items: center; padding: 8px 0; font-size: 0.85rem; }
.item-name { font-weight: 700; color: var(--text-main); }
.item-meta { font-size: 0.75rem; color: var(--text-muted); }

.search-box { position: relative; margin-bottom: 20px; }
.search-box input {
    width: 100%;
    padding: 12px 16px 12px 42px;
    border-radius: 30px;
    border: 1px solid var(--border);
    background: var(--card-bg);
    font-size: 0.9rem;
    font-family: inherit;
    outline: none;
    box-shadow: var(--shadow-sm);
}
.search-box::before { content: '🔍'; position: absolute; left: 16px; top: 50%; transform: translateY(-50%); font-size: 0.9rem; opacity: 0.5; }

.section-title { font-size: 1.1rem; font-weight: 800; margin-bottom: 16px; display: flex; align-items: center; justify-content: space-between; }

/* ---------- Form Elements & Order Builder ---------- */
.form-group { margin-bottom: 18px; }
.form-group label { display: block; font-size: 0.85rem; font-weight: 700; margin-bottom: 8px; color: var(--text-main); }

.input-text-standard, .input-standard {
    width: 100%;
    padding: 12px 16px;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border);
    font-size: 0.9rem;
    font-family: inherit;
    outline: none;
    background: white;
    transition: border-color 0.2s ease;
}
.input-text-standard:focus, .input-standard:focus { border-color: var(--primary); }

.item-input-builder {
    display: flex;
    flex-direction: column;
    gap: 10px;
    background: var(--bg);
    padding: 14px;
    border-radius: var(--radius-md);
    border: 1px solid var(--border);
    margin-bottom: 16px;
}

.input-row-inputs { display: flex; gap: 10px; width: 100%; align-items: center; }

.builder-qty-control {
    display: flex;
    align-items: center;
    background: white;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 2px 4px;
    min-width: 110px;
    justify-content: space-between;
}
.builder-qty-btn {
    border: none;
    background: #e2e8f0;
    color: var(--text-main);
    width: 30px; height: 32px;
    border-radius: 6px;
    font-weight: 800;
    font-size: 1rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}
.builder-qty-input {
    width: 36px;
    text-align: center;
    border: none;
    background: transparent;
    font-size: 0.95rem;
    font-weight: 800;
    outline: none;
    color: var(--text-main);
}

@media (max-width: 480px) {
    .input-row-inputs { flex-direction: column; align-items: stretch; }
    .builder-qty-control { justify-content: center; gap: 12px; padding: 6px; }
}

.add-item-btn {
    background: var(--primary-dark);
    color: white;
    border: none;
    padding: 12px;
    border-radius: var(--radius-sm);
    font-weight: 800;
    font-size: 0.95rem;
    cursor: pointer;
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    box-shadow: 0 2px 8px rgba(5, 150, 105, 0.25);
    transition: background 0.2s ease;
}
.add-item-btn:hover { background: #047857; }

.whatsapp-send-btn {
    background: #25d366;
    color: white;
    border: none;
    width: 100%;
    padding: 14px;
    border-radius: 30px;
    font-size: 1rem;
    font-weight: 800;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    box-shadow: 0 4px 12px rgba(37, 211, 102, 0.3);
    margin-top: 20px;
}
.whatsapp-send-btn:hover { background: #128c7e; }

/* ---------- Price List ---------- */
.price-cards-list { display: flex; flex-direction: column; gap: 10px; max-height: 70vh; overflow-y: auto; padding-right: 4px; }

@media (max-width: 640px) {
    /* This list scrolls internally (max-height above), so the page-level
       scroll-hide on .bottom-tab-bar never engages here — give the list its
       own trailing space instead so the last card can clear the fixed bar. */
    .price-cards-list { padding-bottom: calc(72px + env(safe-area-inset-bottom, 0px)); }
}

.price-card {
    background: var(--card-bg);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: 14px 16px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-shadow: var(--shadow-sm);
    transition: transform 0.15s ease, border-color 0.15s ease;
    gap: 10px;
    flex-wrap: wrap;
}
.price-card:hover { border-color: var(--primary); transform: translateY(-2px); }

.price-card-info { flex: 1; min-width: 160px; }
.price-card-name { font-size: 0.95rem; font-weight: 700; color: var(--text-main); line-height: 1.3; }
.price-card-val {
    font-size: 1.05rem;
    font-weight: 800;
    color: var(--primary-dark);
    background: var(--primary-light);
    padding: 6px 12px;
    border-radius: 20px;
    white-space: nowrap;
}
.price-card-actions { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }

@media (max-width: 480px) {
    .price-card { flex-direction: column; align-items: flex-start; }
    .price-card-actions { width: 100%; justify-content: space-between; margin-top: 6px; }
}

/* ---------- Manage Inventory: table on wide screens, cards on phone ----------
   A 9-column table needs horizontal scrolling on a phone, which is hard to
   read — .inv-card-view carries the same data as one card per item instead.
   Both are rendered together; CSS alone decides which is visible, so there's
   no resize-triggered re-render. */
.inv-card-view { display: none; }
@media (max-width: 640px) {
    .inv-table-view { display: none; }
    .inv-card-view { display: flex; flex-direction: column; gap: 10px; }
}

.inv-item-card {
    background: var(--card-bg);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: 14px 16px;
    box-shadow: var(--shadow-sm);
}
.inv-item-card-header { display: flex; justify-content: space-between; align-items: flex-start; gap: 10px; margin-bottom: 10px; }
.inv-item-card-name { font-size: 0.95rem; font-weight: 700; color: var(--text-main); line-height: 1.3; }
.inv-item-card-sku { font-size: 0.7rem; color: var(--text-muted); font-family: monospace; margin-top: 2px; }
.inv-item-card-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px 12px; margin-bottom: 12px; }
.inv-item-card-grid > div { display: flex; flex-direction: column; gap: 2px; }
.inv-item-card-grid span { font-size: 0.68rem; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.03em; }
.inv-item-card-grid strong { font-size: 0.88rem; font-weight: 700; color: var(--text-main); }
.inv-item-card-actions { display: flex; gap: 8px; justify-content: flex-end; padding-top: 10px; border-top: 1px solid var(--border); }

.qty-controls {
    display: flex;
    align-items: center;
    gap: 4px;
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: 20px;
    padding: 3px 6px;
}
.qty-btn {
    border: none;
    background: var(--border);
    color: var(--text-main);
    width: 26px; height: 26px;
    border-radius: 50%;
    font-weight: 800;
    font-size: 0.9rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.15s ease;
    flex-shrink: 0;
}
.qty-btn:hover { background: #cbd5e1; }
.qty-input {
    width: 32px;
    text-align: center;
    border: none;
    background: transparent;
    font-size: 0.9rem;
    font-weight: 800;
    outline: none;
    color: var(--text-main);
}

.add-to-cart-btn {
    background: var(--primary);
    color: white;
    border: none;
    padding: 8px 14px;
    border-radius: 16px;
    font-weight: 700;
    font-size: 0.8rem;
    cursor: pointer;
    transition: background 0.2s ease;
    white-space: nowrap;
}
.add-to-cart-btn:hover { background: var(--primary-dark); }

/* ---------- Custom Auto-suggest Dropdown ---------- */
.custom-suggest-container { position: relative; width: 100%; }
.custom-suggest-dropdown {
    position: absolute;
    top: 100%; left: 0; right: 0;
    background: white;
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-md);
    max-height: 220px;
    overflow-y: auto;
    z-index: 500;
    display: none;
    margin-top: 4px;
}
.custom-suggest-item {
    padding: 10px 14px;
    cursor: pointer;
    font-size: 0.85rem;
    font-weight: 600;
    border-bottom: 1px solid #f1f5f9;
    display: flex;
    justify-content: space-between;
    align-items: center;
}
.custom-suggest-item:hover { background: var(--primary-light); color: var(--primary-dark); }

.analytics-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px; margin-bottom: 20px; }
.analytics-card { background: var(--bg); border: 1px solid var(--border); padding: 14px; border-radius: var(--radius-md); }
.analytics-card span { font-size: 0.75rem; color: var(--text-muted); font-weight: 700; display: block; }
.analytics-card strong { font-size: 1.1rem; font-weight: 800; color: var(--text-main); }

/* ---------- Record Order (desktop workspace) view ---------- */
.workspace-card {
    background: var(--card-bg);
    border: 1px solid var(--border);
    padding: 32px;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
    max-width: 1200px;
    margin: 0 auto;
}

.section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 2px solid var(--bg);
    padding-bottom: 16px;
    margin-bottom: 24px;
    flex-wrap: wrap;
    gap: 12px;
}

.order-id-badge {
    background: var(--primary-light);
    border: 1px solid #a7f3d0;
    padding: 10px 20px;
    border-radius: var(--radius-md);
    text-align: right;
}

.form-row-3 {
    display: grid;
    grid-template-columns: 2fr 1fr 1fr;
    gap: 20px;
    margin-bottom: 24px;
    background: var(--bg);
    padding: 20px;
    border-radius: var(--radius-md);
    border: 1px solid var(--border);
}
@media (max-width: 720px) { .form-row-3 { grid-template-columns: 1fr; } }

.product-search-box {
    background: var(--bg);
    padding: 20px;
    border-radius: var(--radius-md);
    border: 1px solid var(--border);
    margin-bottom: 24px;
}

.items-table {
    width: 100%;
    border-collapse: collapse;
    background: white;
    border-radius: var(--radius-md);
    overflow: hidden;
    border: 1px solid var(--border);
    box-shadow: var(--shadow-sm);
    margin-bottom: 24px;
}
.items-table th {
    background: #f1f5f9;
    padding: 12px 14px;
    text-align: left;
    font-size: 0.8rem;
    font-weight: 800;
    color: var(--text-muted);
    text-transform: uppercase;
    border-bottom: 2px solid var(--border);
}
.items-table td { padding: 12px 14px; border-bottom: 1px solid var(--border); font-size: 0.85rem; }

.summary-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 24px; align-items: start; margin-bottom: 24px; }
@media (max-width: 720px) { .summary-grid { grid-template-columns: 1fr; } }

.summary-card {
    background: linear-gradient(135deg, #f8fafc 0%, #ecfdf5 100%);
    border: 1px solid #a7f3d0;
    padding: 20px;
    border-radius: var(--radius-lg);
}
.summary-row { display: flex; justify-content: space-between; padding: 6px 0; font-size: 0.9rem; }

.btn-submit {
    background: var(--primary);
    color: white;
    border: none;
    width: 100%;
    padding: 18px;
    border-radius: 30px;
    font-size: 1.1rem;
    font-weight: 800;
    cursor: pointer;
    box-shadow: 0 4px 14px rgba(16,185,129,0.35);
    transition: background 0.2s ease;
}
.btn-submit:hover { background: var(--primary-dark); }
.btn-submit:disabled { opacity: 0.6; cursor: not-allowed; }
