/* ---- Base & layout (mobile-first) ---- */
:root {
    /* MzansiMart brand palette */
    --green:      #1F7A4D;
    --green-dark: #102018;
    --green-tint: rgba(31,122,77,.10);
    --amber:      #F4B23B;
    --teal:       #2AA3B8;
    --bg:         #F3FAF7;
    --card:       #ffffff;
    --text:       #1c1c1e;
    --muted:      #8e8e93;
    --line:       rgba(16,32,24,.12);
    --fill:       rgba(16,32,24,.07);
    --fill-active:rgba(16,32,24,.13);
    --danger:     #E34D3C;
    --radius:     16px;
    --header-h:   56px;
    --nav-h:      60px;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

html, body {
    margin: 0;
    padding: 0;
    background: var(--bg);
    color: var(--text);
    font-family: -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
    font-size: 16px;
    line-height: 1.45;
    /* Lock body scroll — only #app scrolls, preventing header/footer shake */
    height: 100%;
    overflow: hidden;
}

/* Full-screen flex column: header + scrollable content + nav, all strictly in place */
#appShell {
    display: flex;
    flex-direction: column;
    height: 100dvh;   /* dynamic viewport height — adapts to browser chrome */
    height: 100%;     /* fallback for browsers without dvh */
    overflow: hidden;
}

#app {
    flex: 1;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;  /* iOS momentum scrolling */
    overscroll-behavior-y: contain;     /* prevents pull-to-refresh leaking */
    padding: 12px 14px 20px;
    max-width: 760px;
    margin: 0 auto;
    width: 100%;
}

/* ---- Header (in-flow flex item — never position:fixed to avoid scroll shake) ---- */
#mainHeader {
    flex-shrink: 0;
    height: var(--header-h);
    background: var(--green);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 16px;
    box-shadow: 0 1px 0 rgba(16,32,24,.18);
    z-index: 10;
}
#mainHeader .brand {
    font-weight: 800;
    font-size: 19px;
    color: #fff;
    text-decoration: none;
    display: flex;
    align-items: center;
    gap: 8px;
    letter-spacing: -0.03em;
}
.brand-icon {
    width: 28px; height: 28px;
    object-fit: contain;
    border-radius: 6px;
    background: rgba(255,255,255,.15);
    padding: 2px;
}
.brand-mart { color: var(--amber); }
#mainHeader .header-actions { display: flex; align-items: center; gap: 14px; }
#mainHeader a, #mainHeader button { color: #fff; }

/* ---- Bottom nav (in-flow flex item — never position:fixed to avoid scroll shake) ---- */
#bottomNav {
    flex-shrink: 0;
    height: var(--nav-h);
    background: rgba(255,255,255,.88);
    backdrop-filter: saturate(180%) blur(20px);
    -webkit-backdrop-filter: saturate(180%) blur(20px);
    border-top: 0.5px solid rgba(60,60,67,.22);
    display: flex;
    z-index: 10;
}
#bottomNav a {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 3px;
    font-size: 10px;
    font-weight: 500;
    color: var(--muted);
    text-decoration: none;
    padding: 6px 0;
    letter-spacing: .01em;
    transition: color .15s;
}
#bottomNav a.active { color: var(--green); font-weight: 700; }
#bottomNav .nav-icon { line-height: 1; }

/* ---- Loader ---- */
#loader {
    display: none;
    position: fixed; inset: 0;
    background: rgba(255,255,255,.6);
    align-items: center;
    justify-content: center;
    z-index: 100;
}
.spinner {
    width: 40px; height: 40px;
    border: 4px solid var(--line);
    border-top-color: var(--green);
    border-radius: 50%;
    animation: spin .8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ---- Typography helpers ---- */
/* ---- Icons (monochrome, inherit text color) ---- */
.icon { vertical-align: -0.18em; }
.brand .icon { vertical-align: -0.22em; }
.stars { display: inline-flex; gap: 1px; vertical-align: middle; }
.btn .icon { vertical-align: -0.18em; }

h1 { font-size: 24px; font-weight: 700; margin: 0 0 10px; letter-spacing: -.3px; }
h2 { font-size: 18px; font-weight: 700; margin: 20px 0 10px; letter-spacing: -.2px; }
h3 { font-size: 13px; font-weight: 700; margin: 16px 0 8px; color: var(--muted); text-transform: uppercase; letter-spacing: .05em; }
p { margin: 0 0 10px; }
.muted { color: var(--muted); }
.center { text-align: center; }
.small { font-size: 13px; }
a { color: var(--green-dark); }

/* ---- Base form controls (no .field wrapper) ---- */
input:not([type=checkbox]):not([type=radio]):not([type=range]):not([type=submit]):not([type=button]),
select,
textarea {
    padding: 13px 14px;
    border: 1.5px solid transparent;
    border-radius: 12px;
    font-size: 16px;
    background: var(--fill);
    font-family: inherit;
    color: var(--text);
    outline: none;
    width: 100%;
    transition: background .15s, border-color .15s, box-shadow .15s;
}
input:focus, select:focus, textarea:focus {
    background: var(--card);
    border-color: var(--green);
    box-shadow: 0 0 0 3px var(--green-tint);
}
textarea { min-height: 90px; resize: vertical; }

/* ---- Category checkbox list ---- */
.cat-check-list { display: flex; flex-direction: column; gap: 2px; max-height: 220px; overflow-y: auto; padding: 6px 2px; }
.cat-check-item { display: flex; align-items: center; gap: 8px; padding: 7px 10px; border-radius: 10px; font-size: 14px; cursor: pointer; transition: background .12s; }
.cat-check-item:hover { background: var(--fill); }
.cat-check-item input[type=checkbox] { width: 16px; height: 16px; accent-color: var(--green); flex-shrink: 0; }

/* ---- Disabled states ---- */
.btn:disabled, button:disabled { opacity: 0.5; cursor: not-allowed; pointer-events: none; }

/* ---- Smooth content transitions ---- */
#app { transition: opacity .12s ease; }
#app.fading { opacity: 0; }

/* ---- Safe-area insets ---- */
/* dvh already excludes the home-bar / system-nav area on both iOS and Android,
   so no extra height or padding is needed here. Adding env() causes Samsung/
   Android browsers to report a phantom gap below the nav. */

/* ---- Onboarding ---- */
.ob-hero { text-align: center; padding: 28px 0 20px; }
.ob-check {
    width: 56px; height: 56px; border-radius: 50%;
    background: var(--green); color: #fff;
    display: flex; align-items: center; justify-content: center;
    margin: 0 auto 16px;
}
.ob-title { font-size: 22px; font-weight: 800; margin: 0 0 8px; letter-spacing: -.3px; }
.ob-sub { color: var(--muted); font-size: 15px; margin: 0 0 4px; line-height: 1.55; }
.ob-steps { display: flex; flex-direction: column; gap: 16px; margin: 0 0 22px; }
.ob-step { display: flex; align-items: flex-start; gap: 14px; }
.ob-step-num {
    width: 30px; height: 30px; border-radius: 50%;
    background: var(--green); color: #fff;
    display: flex; align-items: center; justify-content: center;
    font-size: 13px; font-weight: 800; flex-shrink: 0; margin-top: 2px;
}
.ob-step-body strong { display: block; font-size: 14px; font-weight: 700; margin-bottom: 2px; }
.ob-step-body span { font-size: 13px; color: var(--muted); line-height: 1.4; }
.ob-pitch-inner { display: flex; align-items: flex-start; gap: 12px; }
.ob-pitch-icon {
    width: 44px; height: 44px; border-radius: 12px;
    background: var(--green-tint); color: var(--green);
    display: flex; align-items: center; justify-content: center; flex-shrink: 0;
}

/* ---- Home screen ---- */
.home-hero { margin-bottom: 16px; }
.home-greeting {
    font-size: 28px;
    font-weight: 800;
    margin: 0 0 4px;
    letter-spacing: -.5px;
    color: var(--text);
}
.home-tagline { color: var(--muted); font-size: 15px; margin: 0; }

/* Native search bar (standalone, not in a card) */
.home-search-form { margin-bottom: 14px; }
.home-search-row {
    display: flex;
    align-items: center;
    gap: 10px;
    background: var(--fill);
    border-radius: 14px;
    padding: 0 14px;
    margin-bottom: 10px;
    border: 1.5px solid transparent;
    transition: background .15s, border-color .15s, box-shadow .15s;
}
.home-search-row:focus-within {
    background: var(--card);
    border-color: var(--green);
    box-shadow: 0 0 0 3px var(--green-tint);
}
.home-search-icon { color: var(--muted); display: flex; align-items: center; flex-shrink: 0; }
.home-search-input {
    flex: 1;
    background: none !important;
    border: none !important;
    box-shadow: none !important;
    padding: 14px 0;
    font-size: 16px;
    color: var(--text);
    min-width: 0;
}
.home-search-input::placeholder { color: var(--muted); }

.home-actions { margin-bottom: 18px; }
.home-section-label {
    font-size: 11px;
    font-weight: 700;
    letter-spacing: .08em;
    color: var(--green);
    margin: 0 0 10px;
}
.home-cat-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 10px;
    margin-bottom: 22px;
}
.home-cat-pill {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 8px;
    background: var(--card);
    border: 1px solid rgba(16,32,24,.08);
    border-radius: 20px;
    padding: 16px 8px 10px;
    text-decoration: none;
    color: var(--text);
    font-size: 12px;
    font-weight: 600;
    text-align: center;
    box-shadow: 0 4px 12px rgba(16,32,24,.06);
    transition: opacity .1s, transform .1s;
}
.home-cat-pill::after {
    content: '';
    display: block;
    width: 22px; height: 3px;
    background: var(--amber);
    border-radius: 2px;
    margin-top: 4px;
}
.home-cat-pill:active { opacity: 0.7; transform: scale(0.96); }
.home-cat-icon { color: var(--green-dark); }
.home-footer-links {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
    padding: 14px 0 6px;
    font-size: 13px;
}
.home-footer-links a { color: var(--muted); text-decoration: none; }
.home-footer-links a:active { color: var(--green-dark); }
.home-footer-links span { color: var(--line); }

/* ---- Home CTA bar (guest only — in-flow flex item above bottom nav) ---- */
.home-cta-bar {
    flex-shrink: 0;
    background: rgba(255,255,255,.92);
    backdrop-filter: saturate(180%) blur(16px);
    -webkit-backdrop-filter: saturate(180%) blur(16px);
    border-top: 0.5px solid rgba(60,60,67,.22);
    box-shadow: 0 -2px 14px rgba(0,0,0,.06);
    padding: 10px 16px;
}
.home-cta-inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    max-width: 760px;
    margin: 0 auto;
}
.home-cta-text { font-size: 14px; flex: 1; min-width: 0; color: var(--text); }
.home-cta-sub { color: var(--muted); }
.home-cta-join { color: var(--amber); font-weight: 700; }
.home-cta-btn { white-space: nowrap; flex-shrink: 0; }
.home-cta-avatar {
    width: 38px; height: 38px; border-radius: 50%;
    background: var(--fill); color: var(--green);
    display: flex; align-items: center; justify-content: center;
    flex-shrink: 0;
}

/* ---- Featured section on home ---- */
.home-section-header {
    display: flex; align-items: center; justify-content: space-between;
    margin: 20px 0 10px;
}
.home-section-header h2 { margin: 0; font-size: 17px; font-weight: 800; }
.home-see-all {
    color: var(--green); font-size: 13px; font-weight: 700;
    text-decoration: none; display: flex; align-items: center; gap: 3px;
}
.home-stores-scroll {
    display: flex; gap: 10px; overflow-x: auto;
    padding-bottom: 4px; margin-bottom: 4px;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
}
.home-stores-scroll::-webkit-scrollbar { display: none; }
.home-store-chip {
    flex-shrink: 0;
    display: flex; flex-direction: column; align-items: center;
    text-decoration: none; color: var(--text);
    width: 80px;
}
.home-store-chip-logo {
    width: 56px; height: 56px; border-radius: 50%;
    background: var(--fill); border: 2px solid var(--line);
    display: flex; align-items: center; justify-content: center;
    overflow: hidden; margin-bottom: 5px;
    color: var(--green);
}
.home-store-chip-logo img { width: 100%; height: 100%; object-fit: cover; }
.home-store-chip-name {
    font-size: 11px; font-weight: 600; text-align: center;
    display: -webkit-box; -webkit-line-clamp: 2;
    -webkit-box-orient: vertical; overflow: hidden;
    line-height: 1.3;
}

/* ---- Static info pages ---- */
.page-content h2 { font-size: 16px; font-weight: 700; margin: 18px 0 6px; }
.page-content p, .page-content li { font-size: 15px; line-height: 1.65; color: var(--text); }
.page-content ul, .page-content ol { padding-left: 20px; margin-bottom: 10px; }
.page-content a { color: var(--green-dark); }

/* ── Store public page ────────────────────────────────────────────── */
.spub-cover {
    height: 200px; border-radius: 20px;
    position: relative; overflow: hidden; margin-bottom: 0;
}
.spub-cover-img { background-size: cover; background-position: center; }
.spub-cover-gradient {
    background: linear-gradient(135deg, #102018 0%, #1F7A4D 55%, #2e8052 100%);
}
.spub-cover-deco {
    position: absolute; right: -8px; bottom: -12px;
    width: 160px; height: 180px; opacity: .14; color: #fff; pointer-events: none;
}
.spub-cover-fade {
    position: absolute; inset: 0;
    background: linear-gradient(to top, rgba(10,25,15,.65) 0%, transparent 55%);
}
.spub-cover-body {
    position: absolute; bottom: 0; left: 0; right: 0; padding: 14px 16px;
}
.spub-logo {
    width: 54px; height: 54px; border-radius: 50%;
    background: rgba(255,255,255,.18); border: 2.5px solid rgba(255,255,255,.5);
    display: flex; align-items: center; justify-content: center;
    overflow: hidden; margin-bottom: 8px; color: #fff;
}
.spub-logo img { width: 100%; height: 100%; object-fit: cover; border-radius: 50%; }
.spub-store-name {
    color: #fff; font-size: 22px; font-weight: 800;
    letter-spacing: -.3px; margin: 0 0 6px;
}
.spub-cat-badge {
    display: inline-flex; align-items: center; gap: 5px;
    background: rgba(255,255,255,.18); color: #fff;
    padding: 4px 12px; border-radius: 999px;
    font-size: 12px; font-weight: 700; margin-bottom: 6px;
}
.spub-place { color: rgba(255,255,255,.75); font-size: 13px; display: flex; align-items: center; gap: 5px; margin-bottom: 3px; }
.spub-rating { color: rgba(255,255,255,.65); font-size: 12px; }
.spub-desc-row {
    display: flex; align-items: flex-start; gap: 10px;
    padding: 14px 0; border-bottom: 1px solid var(--line);
    margin-bottom: 14px; color: var(--muted); font-size: 14px;
}
.spub-desc-icon { color: var(--green); flex-shrink: 0; margin-top: 1px; }
.spub-section-header {
    display: flex; align-items: center; justify-content: space-between;
    margin: 20px 0 10px;
}
.spub-section-header h2 { margin: 0; font-size: 18px; }
.spub-see-all {
    color: var(--green); font-size: 13px; font-weight: 700;
    text-decoration: none; display: flex; align-items: center; gap: 4px;
}
.spub-promote-bar {
    background: linear-gradient(90deg, #F4B23B 0%, #f0a020 100%);
    border-radius: 14px; padding: 12px 16px; margin: 14px 0;
    display: flex; align-items: center; justify-content: space-between; gap: 10px;
}
.spub-promote-text { font-weight: 700; color: #102018; font-size: 14px; }
.spub-promote-sub { font-size: 12px; color: rgba(16,32,24,.6); margin-top: 2px; }
.spub-promote-btn {
    background: #102018; color: #fff; border: none;
    border-radius: 10px; padding: 8px 14px; font-size: 13px;
    font-weight: 700; cursor: pointer; white-space: nowrap; flex-shrink: 0;
}

/* ── Listing row card (horizontal, used in store page) ───────────── */
.listing-row {
    display: flex; gap: 12px;
    background: var(--card); border: 1px solid rgba(16,32,24,.08);
    border-radius: 20px; padding: 12px;
    box-shadow: 0 4px 12px rgba(16,32,24,.06);
    text-decoration: none; color: var(--text);
    margin-bottom: 10px;
    transition: opacity .1s, transform .1s;
}
.listing-row:active { opacity: 0.78; transform: scale(0.98); }
.lr-img {
    width: 100px; height: 100px;
    border-radius: 14px; object-fit: cover;
    flex-shrink: 0; background: var(--fill);
}
.lr-noimg {
    display: flex; align-items: center; justify-content: center; color: var(--muted);
}
.lr-body { flex: 1; min-width: 0; display: flex; flex-direction: column; justify-content: center; }
.lr-title {
    font-weight: 700; font-size: 15px; margin-bottom: 4px;
    display: -webkit-box; -webkit-line-clamp: 2;
    -webkit-box-orient: vertical; overflow: hidden;
}
.lr-price { color: var(--green); font-weight: 900; font-size: 17px; margin-bottom: 6px; }
.lr-chips { display: flex; flex-wrap: wrap; gap: 5px; }
.lr-chip {
    display: inline-flex; align-items: center; gap: 3px;
    background: var(--fill); color: var(--muted);
    padding: 3px 9px; border-radius: 8px;
    font-size: 11px; font-weight: 600;
}
.lr-place { color: var(--muted); font-size: 12px; margin-top: 6px; display: flex; align-items: center; gap: 4px; }

/* ── Listing detail ───────────────────────────────────────────────── */
.ld-gallery {
    position: relative; border-radius: 20px;
    overflow: hidden; margin-bottom: 14px;
}
.ld-gallery-scroll {
    display: flex; overflow-x: auto; gap: 0;
    -webkit-overflow-scrolling: touch; scrollbar-width: none;
}
.ld-gallery-scroll::-webkit-scrollbar { display: none; }
.ld-gallery-scroll img {
    width: 100%; height: 250px; object-fit: cover;
    flex-shrink: 0; display: block;
}
.ld-gallery-empty {
    height: 200px; background: var(--fill); border-radius: 20px;
    display: flex; align-items: center; justify-content: center;
    color: var(--muted); margin-bottom: 14px;
}
.ld-counter {
    position: absolute; bottom: 10px; right: 10px;
    background: rgba(16,32,24,.62); color: #fff;
    padding: 4px 10px; border-radius: 999px;
    font-size: 12px; font-weight: 600;
    display: flex; align-items: center; gap: 5px;
}
.ld-badges { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 8px; }
.ld-badge {
    display: inline-flex; align-items: center; gap: 5px;
    border: 1.5px solid var(--line);
    border-radius: 999px; padding: 5px 12px;
    font-size: 12px; font-weight: 700; color: var(--text);
}
.ld-badge-avail { border-color: var(--green); color: var(--green); }
.ld-avail-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--green); }
.ld-title { font-size: 24px; font-weight: 900; margin: 0 0 4px; letter-spacing: -.4px; }
.ld-price { color: var(--green); font-size: 28px; font-weight: 900; letter-spacing: -.5px; margin: 0 0 10px; }
.ld-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin-bottom: 10px; }
.ld-chip {
    display: inline-flex; align-items: center; gap: 4px;
    background: var(--fill); color: var(--text);
    padding: 5px 11px; border-radius: 10px;
    font-size: 13px; font-weight: 500;
}
.ld-sep { color: var(--muted); font-size: 18px; line-height: 1; }
.ld-location { display: flex; align-items: center; gap: 5px; color: var(--muted); font-size: 14px; margin-bottom: 14px; }
.ld-divider { border: none; border-top: 1px solid var(--line); margin: 14px 0; }
.ld-description { font-size: 15px; line-height: 1.6; color: var(--text); margin-bottom: 16px; }
.ld-store-card {
    display: flex; align-items: center; gap: 12px;
    background: var(--card); border: 1px solid rgba(16,32,24,.08);
    border-radius: 18px; padding: 14px;
    box-shadow: 0 2px 8px rgba(16,32,24,.05);
    text-decoration: none; color: var(--text);
    margin-bottom: 16px;
    transition: opacity .1s;
}
.ld-store-card:active { opacity: 0.75; }
.ld-store-logo {
    width: 48px; height: 48px; border-radius: 14px;
    background: var(--fill); display: flex;
    align-items: center; justify-content: center;
    flex-shrink: 0; overflow: hidden; color: var(--green);
}
.ld-store-logo img { width: 100%; height: 100%; object-fit: cover; }
.ld-store-info { flex: 1; min-width: 0; }
.ld-store-name { font-weight: 700; font-size: 15px; margin-bottom: 2px; }
.ld-store-sub { font-size: 12px; color: var(--muted); }
.ld-store-chevron { color: var(--muted); font-size: 20px; font-weight: 300; }

/* ── Promote badge ────────────────────────────────────────────────── */
.promoted-tag {
    display: inline-flex; align-items: center; gap: 4px;
    background: var(--amber); color: #102018;
    font-size: 10px; font-weight: 800; letter-spacing: .04em;
    padding: 2px 8px; border-radius: 6px; text-transform: uppercase;
}

/* ── Locked contact (guests) ──────────────────────────────────────── */
.locked-contact-card {
    display: flex; align-items: center; gap: 12px;
    background: var(--fill); border-radius: 16px;
    padding: 14px; margin-bottom: 14px; text-decoration: none; color: var(--text);
}
.locked-contact-icon {
    width: 42px; height: 42px; border-radius: 50%;
    background: rgba(31,122,77,.12); color: var(--green);
    display: flex; align-items: center; justify-content: center; flex-shrink: 0;
}
.locked-contact-text strong { display: block; font-size: 14px; margin-bottom: 2px; }
.locked-contact-text span { font-size: 12px; color: var(--muted); }

/* ── Chat inbox rows ──────────────────────────────────────────────── */
.chat-row {
    display: flex; align-items: center; gap: 12px;
    padding: 14px 0; border-bottom: 1px solid var(--line);
    text-decoration: none; color: var(--text);
}
.chat-row:last-child { border-bottom: none; }
.chat-avatar {
    width: 48px; height: 48px; border-radius: 50%;
    background: rgba(31,122,77,.12); color: var(--green);
    display: flex; align-items: center; justify-content: center;
    flex-shrink: 0; font-weight: 800; font-size: 18px; overflow: hidden;
}
.chat-avatar img { width: 100%; height: 100%; object-fit: cover; }
.chat-row-body { flex: 1; min-width: 0; }
.chat-row-head { display: flex; justify-content: space-between; align-items: baseline; margin-bottom: 3px; }
.chat-row-name { font-weight: 700; font-size: 15px; }
.chat-row-time { font-size: 11px; color: var(--muted); white-space: nowrap; }
.chat-row-preview { font-size: 13px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.chat-row-preview.unread { color: var(--text); font-weight: 600; }
.chat-unread-dot {
    width: 10px; height: 10px; border-radius: 50%;
    background: var(--green); flex-shrink: 0;
}

/* ── Chat thread view ─────────────────────────────────────────────── */
.chat-meta {
    background: var(--card); border-radius: 16px;
    padding: 12px 14px; margin-bottom: 12px;
    box-shadow: 0 2px 8px rgba(16,32,24,.06);
    border: 1px solid rgba(16,32,24,.07);
}
.chat-meta-title { font-weight: 700; font-size: 15px; margin-bottom: 2px; }
.chat-meta-sub { font-size: 12px; color: var(--muted); }
.chat-thread { display: flex; flex-direction: column; gap: 10px; padding-bottom: 8px; }
.chat-msg { display: flex; flex-direction: column; max-width: 78%; }
.chat-msg-in { align-self: flex-start; }
.chat-msg-out { align-self: flex-end; }
.chat-bubble {
    padding: 10px 14px; border-radius: 18px;
    font-size: 15px; line-height: 1.45; word-break: break-word;
}
.chat-msg-in .chat-bubble {
    background: var(--card); border: 1px solid var(--line);
    border-bottom-left-radius: 4px; color: var(--text);
}
.chat-msg-out .chat-bubble {
    background: var(--green); color: #fff;
    border-bottom-right-radius: 4px;
}
.chat-bubble-meta {
    font-size: 10px; color: var(--muted); margin-top: 4px; padding: 0 4px;
}
.chat-msg-out .chat-bubble-meta { text-align: right; }
.chat-day-label {
    text-align: center; font-size: 11px; font-weight: 600;
    color: var(--muted); margin: 8px 0;
}

/* ── Chat input bar (sticky at bottom of #app scroll area) ─────────── */
.chat-input-bar {
    position: sticky; bottom: 0;
    background: var(--bg); padding: 10px 0 6px;
    margin-top: 12px;
}
.chat-input-row {
    display: flex; align-items: flex-end; gap: 8px;
    background: var(--card); border: 1.5px solid var(--line);
    border-radius: 24px; padding: 8px 8px 8px 16px;
    box-shadow: 0 2px 8px rgba(16,32,24,.06);
    transition: border-color .15s;
}
.chat-input-row:focus-within { border-color: var(--green); }
.chat-input-row textarea {
    flex: 1; background: none; border: none !important;
    box-shadow: none !important; padding: 4px 0; font-size: 15px;
    min-height: 24px; max-height: 100px;
    resize: none; line-height: 1.4;
}
.chat-send-btn {
    width: 38px; height: 38px; border-radius: 50%;
    background: var(--green); color: #fff; border: none;
    display: flex; align-items: center; justify-content: center;
    cursor: pointer; flex-shrink: 0;
    transition: opacity .1s, transform .1s;
}
.chat-send-btn:active { opacity: .7; transform: scale(.93); }

/* ── Cordova app: hamburger button ─────────────────────────────────── */
.app-hamburger {
    display: flex; align-items: center; justify-content: center;
    width: 40px; height: 40px;
    background: rgba(255,255,255,.14);
    border: none; border-radius: 10px; color: #fff; cursor: pointer;
    flex-shrink: 0; transition: background .15s;
    -webkit-tap-highlight-color: transparent;
}
.app-hamburger:active { background: rgba(255,255,255,.25); }

/* ── Side nav backdrop ───────────────────────────────────────────────── */
.app-side-overlay {
    display: none;
    position: fixed; inset: 0;
    background: rgba(0,0,0,.52);
    z-index: 200;
}
.app-side-overlay.open { display: block; }

/* ── Side nav drawer ─────────────────────────────────────────────────── */
.app-side-nav {
    position: fixed;
    top: 0; left: 0;
    width: 300px; max-width: 82vw;
    height: 100%; height: 100dvh;
    background: #102018;
    z-index: 201;
    display: flex; flex-direction: column;
    transform: translateX(-100%);
    transition: transform .28s cubic-bezier(0.4,0,0.2,1);
    overflow: hidden;
    box-shadow: 6px 0 32px rgba(0,0,0,.32);
}
.app-side-nav.open { transform: translateX(0); }

.asn-head {
    flex-shrink: 0;
    display: flex; align-items: center; justify-content: space-between;
    height: var(--header-h); padding: 0 14px;
    background: rgba(255,255,255,.05);
    border-bottom: 1px solid rgba(255,255,255,.08);
}
.asn-brand { font-weight: 900; font-size: 18px; color: #fff; text-decoration: none; letter-spacing: -.02em; }
.asn-brand span { color: var(--amber); }
.asn-close {
    width: 36px; height: 36px;
    background: rgba(255,255,255,.1);
    border: none; border-radius: 8px; color: #fff; cursor: pointer;
    display: flex; align-items: center; justify-content: center;
    flex-shrink: 0; transition: background .12s;
    -webkit-tap-highlight-color: transparent;
}
.asn-close:active { background: rgba(255,255,255,.22); }

.asn-user {
    display: flex; align-items: center; gap: 12px;
    padding: 14px 16px;
    border-bottom: 1px solid rgba(255,255,255,.08);
    flex-shrink: 0;
}
.asn-avatar {
    width: 42px; height: 42px; border-radius: 50%;
    background: var(--green); color: #fff;
    display: flex; align-items: center; justify-content: center;
    font-weight: 800; font-size: 14px; flex-shrink: 0;
    border: 2px solid rgba(255,255,255,.15);
}
.asn-user-name  { font-weight: 700; font-size: 13px; color: #fff; line-height: 1.35; }
.asn-user-email { font-size: 11px; color: rgba(255,255,255,.48); margin-top: 2px; }

.asn-scroll { flex: 1; overflow-y: auto; -webkit-overflow-scrolling: touch; padding-bottom: 8px; }

.asn-section {
    font-size: 10px; font-weight: 700; letter-spacing: .1em;
    text-transform: uppercase; color: rgba(255,255,255,.33);
    padding: 14px 16px 4px;
}
.asn-link {
    display: flex; align-items: center; gap: 12px;
    padding: 10px 16px;
    color: rgba(255,255,255,.84); text-decoration: none;
    font-size: 14px; font-weight: 600;
    transition: background .1s;
    -webkit-tap-highlight-color: transparent;
}
.asn-link:active { background: rgba(255,255,255,.07); color: #fff; }
.asn-link-icon {
    width: 32px; height: 32px; border-radius: 8px;
    background: rgba(255,255,255,.1);
    display: flex; align-items: center; justify-content: center;
    flex-shrink: 0;
}

.asn-footer {
    flex-shrink: 0;
    display: flex; flex-direction: column; gap: 8px;
    padding: 12px 16px 24px;
    border-top: 1px solid rgba(255,255,255,.08);
}
.asn-footer-login {
    display: flex; align-items: center; justify-content: center;
    padding: 11px; border-radius: 12px;
    border: 1px solid rgba(255,255,255,.25); color: rgba(255,255,255,.88);
    font-size: 14px; font-weight: 700; text-decoration: none;
}
.asn-footer-login:active { background: rgba(255,255,255,.1); }
.asn-footer-register {
    display: flex; align-items: center; justify-content: center;
    padding: 11px; border-radius: 12px;
    background: var(--amber); color: #102018;
    font-size: 14px; font-weight: 800; text-decoration: none;
}
.asn-footer-register:active { opacity: .85; }
.asn-logout-btn {
    padding: 11px 16px; border-radius: 12px;
    background: rgba(227,77,60,.13);
    border: 1px solid rgba(227,77,60,.28);
    color: #ff7066; font-size: 14px; font-weight: 700; cursor: pointer;
    display: flex; align-items: center; justify-content: center; gap: 8px;
    transition: background .12s;
    -webkit-tap-highlight-color: transparent;
}
.asn-logout-btn:active { background: rgba(227,77,60,.26); }

/* ── Cart-only bottom nav (Cordova) ─────────────────────────────────── */
#bottomNav.nav-cart-only {
    height: 56px;
    background: var(--green);
    border-top: none;
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
}
#bottomNav.nav-cart-only > a {
    color: rgba(255,255,255,.92);
    font-size: 14px; font-weight: 800;
    flex-direction: row; gap: 8px;
    letter-spacing: .01em; padding: 0 24px;
}
#bottomNav.nav-cart-only > a.active,
#bottomNav.nav-cart-only > a:active { color: #fff; }
/* Badge overlay on cart icon in the tab bar */
.nav-icon-cart {
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    line-height: 1;
}
.nav-cart-badge {
    display: inline-flex; align-items: center; justify-content: center;
    min-width: 16px; height: 16px; padding: 0 4px;
    background: var(--green); color: #fff;
    font-size: 10px; font-weight: 800; border-radius: 10px;
    position: absolute; top: -4px; right: -7px;
}

/* ── Seller: share your store card ─────────────────────────────────── */
.sm-share-card { padding: 16px; margin-bottom: 14px; }
.sm-share-head { display: flex; align-items: flex-start; gap: 10px; margin-bottom: 12px; }
.sm-share-head svg { color: var(--green); flex-shrink: 0; margin-top: 2px; }
.sm-share-url-row { display: flex; gap: 8px; align-items: center; margin-bottom: 12px; }
.sm-share-url-input {
    flex: 1; padding: 9px 12px; border-radius: 10px;
    border: 1.5px solid var(--line); background: var(--fill);
    font-size: 12px; color: var(--text); font-family: monospace;
    overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
    min-width: 0;
}
.sm-share-social { display: flex; gap: 8px; flex-wrap: wrap; }
.sm-share-wa, .sm-share-fb, .sm-share-tw {
    display: inline-flex; align-items: center; gap: 5px;
    padding: 7px 12px; border-radius: 10px;
    font-size: 13px; font-weight: 700; text-decoration: none;
    transition: opacity .12s;
}
.sm-share-wa  { background: #25D366; color: #fff; }
.sm-share-fb  { background: #1877F2; color: #fff; }
.sm-share-tw  { background: #000;    color: #fff; }
.sm-share-wa:active, .sm-share-fb:active, .sm-share-tw:active { opacity: .8; }

/* ── Listing detail: add-to-cart row ────────────────────────────────── */
.ld-cart-row {
    display: flex; align-items: center; gap: 10px;
    margin: 14px 0 6px; padding: 0;
}
.ld-qty-row {
    display: flex; align-items: center; gap: 0;
    border: 1.5px solid var(--line); border-radius: 10px; overflow: hidden;
    flex-shrink: 0;
}
.ld-qty-btn {
    width: 36px; height: 40px; background: var(--fill);
    border: none; font-size: 18px; font-weight: 700;
    cursor: pointer; color: var(--text);
    display: flex; align-items: center; justify-content: center;
    -webkit-tap-highlight-color: transparent;
}
.ld-qty-btn:active { background: var(--fill-active); }
.ld-qty-val {
    min-width: 36px; text-align: center;
    font-size: 15px; font-weight: 700;
    padding: 0 4px; background: var(--card);
}
.ld-save-btn {
    width: 44px; height: 44px; border-radius: 12px;
    background: var(--fill); border: 1.5px solid var(--line);
    display: flex; align-items: center; justify-content: center;
    cursor: pointer; color: var(--danger); flex-shrink: 0;
    -webkit-tap-highlight-color: transparent;
}
.ld-save-btn.saved { background: rgba(227,77,60,.10); border-color: var(--danger); }
.ld-save-btn:active { opacity: .75; }
.ld-price-unit { font-size: 13px; font-weight: 400; color: var(--muted); }
.ld-delivery-info {
    font-size: 13px; color: var(--muted);
    display: flex; flex-wrap: wrap; gap: 6px;
    align-items: center; margin: 8px 0;
}
.pd-add-btn { min-height: 44px; }

/* ── Shop product card: name link ───────────────────────────────────── */
.shop-product-name-link {
    display: block; font-size: 13px; font-weight: 600;
    color: var(--text); text-decoration: none; margin-bottom: 2px;
    line-height: 1.3;
}
.shop-product-name-link:hover { color: var(--green); }
.shop-product-img-link { display: block; line-height: 0; }

/* ── Popular category section ────────────────────────────────────────── */
.home-popular-badge {
    display: inline-flex; align-items: center; gap: 3px;
    background: linear-gradient(90deg, var(--amber), #f5a623);
    color: #102018; border-radius: 20px;
    font-size: 10px; font-weight: 800;
    padding: 2px 7px; letter-spacing: .02em; vertical-align: middle;
}
