/* ============================================================
   VisualMarket storefront styles
   Light/dark theming via [data-theme] on <html> + CSS variables.
   ============================================================ */

:root,
[data-theme="light"] {
    --bg: #ffffff;
    --surface: #ffffff;
    --surface-2: #f0f1f4;
    --text: #1b1f24;
    --text-muted: #4b5563;
    --border: #d4d8e0;
    --primary: #1d4ed8;
    --primary-contrast: #ffffff;
    --sale: #15803d;
    --shadow: 0 1px 3px rgba(16, 24, 40, .08), 0 8px 24px rgba(16, 24, 40, .06);
    --shadow-hover: 0 6px 16px rgba(16, 24, 40, .12), 0 16px 40px rgba(16, 24, 40, .12);
}

[data-theme="dark"] {
    --bg: #0e1116;
    --surface: #171b22;
    --surface-2: #1f242d;
    --text: #e6e9ef;
    --text-muted: #9aa4b2;
    --border: #2a313b;
    --primary: #2563eb;
    --primary-contrast: #ffffff;
    --sale: #22c55e;
    --shadow: 0 1px 3px rgba(0, 0, 0, .4), 0 8px 24px rgba(0, 0, 0, .35);
    --shadow-hover: 0 6px 16px rgba(0, 0, 0, .5), 0 16px 40px rgba(0, 0, 0, .5);
}

/* ------------------------------------------------------------
   Themed color palettes (mirrors the VisualAI desktop app).
   Each is a light-based theme: tinted page, white cards, the
   accent colour drives --primary. Muted text + shadows are
   derived so every palette stays readable.
   ------------------------------------------------------------ */
[data-theme="red"] {
    --bg: #e8d2d2;
    --surface: #ffffff;
    --surface-2: #dfc0c0;
    --text: #2f1a1a;
    --text-muted: color-mix(in srgb, var(--text) 55%, var(--bg));
    --border: #cf9d9d;
    --primary: #b91c1c;
    --primary-contrast: #ffffff;
    --sale: #16a34a;
    --shadow: 0 1px 3px rgba(16, 24, 40, .08), 0 8px 24px rgba(16, 24, 40, .06);
    --shadow-hover: 0 6px 16px rgba(16, 24, 40, .12), 0 16px 40px rgba(16, 24, 40, .12);
}

[data-theme="green"] {
    --bg: #f3f8f4;
    --surface: #ffffff;
    --surface-2: #eef5f0;
    --text: #2f4f3a;
    --text-muted: color-mix(in srgb, var(--text) 55%, var(--bg));
    --border: #cfe6d6;
    --primary: #2e7d32;
    --primary-contrast: #ffffff;
    --sale: #16a34a;
    --shadow: 0 1px 3px rgba(16, 24, 40, .08), 0 8px 24px rgba(16, 24, 40, .06);
    --shadow-hover: 0 6px 16px rgba(16, 24, 40, .12), 0 16px 40px rgba(16, 24, 40, .12);
}

[data-theme="blue"] {
    --bg: #f2f6fb;
    --surface: #ffffff;
    --surface-2: #e3ecf7;
    --text: #1e3a5f;
    --text-muted: color-mix(in srgb, var(--text) 55%, var(--bg));
    --border: #bcd9f0;
    --primary: #1565c0;
    --primary-contrast: #ffffff;
    --sale: #16a34a;
    --shadow: 0 1px 3px rgba(16, 24, 40, .08), 0 8px 24px rgba(16, 24, 40, .06);
    --shadow-hover: 0 6px 16px rgba(16, 24, 40, .12), 0 16px 40px rgba(16, 24, 40, .12);
}

[data-theme="gray"] {
    --bg: #f4f4f4;
    --surface: #ffffff;
    --surface-2: #eaeaea;
    --text: #333333;
    --text-muted: color-mix(in srgb, var(--text) 55%, var(--bg));
    --border: #cccccc;
    --primary: #616161;
    --primary-contrast: #ffffff;
    --sale: #16a34a;
    --shadow: 0 1px 3px rgba(16, 24, 40, .08), 0 8px 24px rgba(16, 24, 40, .06);
    --shadow-hover: 0 6px 16px rgba(16, 24, 40, .12), 0 16px 40px rgba(16, 24, 40, .12);
}

[data-theme="mint"] {
    --bg: #f0f9f7;
    --surface: #ffffff;
    --surface-2: #e1f3ee;
    --text: #1b3d3a;
    --text-muted: color-mix(in srgb, var(--text) 55%, var(--bg));
    --border: #bce8dc;
    --primary: #00796b;
    --primary-contrast: #ffffff;
    --sale: #16a34a;
    --shadow: 0 1px 3px rgba(16, 24, 40, .08), 0 8px 24px rgba(16, 24, 40, .06);
    --shadow-hover: 0 6px 16px rgba(16, 24, 40, .12), 0 16px 40px rgba(16, 24, 40, .12);
}

[data-theme="orange"] {
    --bg: #fff5e0;
    --surface: #ffffff;
    --surface-2: #fff3e0;
    --text: #5d4037;
    --text-muted: color-mix(in srgb, var(--text) 55%, var(--bg));
    --border: #f6d79a;
    --primary: #ef6c00;
    --primary-contrast: #ffffff;
    --sale: #16a34a;
    --shadow: 0 1px 3px rgba(16, 24, 40, .08), 0 8px 24px rgba(16, 24, 40, .06);
    --shadow-hover: 0 6px 16px rgba(16, 24, 40, .12), 0 16px 40px rgba(16, 24, 40, .12);
}

[data-theme="pink"] {
    --bg: #fff0f5;
    --surface: #ffffff;
    --surface-2: #ffe6ee;
    --text: #4a2c3b;
    --text-muted: color-mix(in srgb, var(--text) 55%, var(--bg));
    --border: #f3bdd8;
    --primary: #c2185b;
    --primary-contrast: #ffffff;
    --sale: #16a34a;
    --shadow: 0 1px 3px rgba(16, 24, 40, .08), 0 8px 24px rgba(16, 24, 40, .06);
    --shadow-hover: 0 6px 16px rgba(16, 24, 40, .12), 0 16px 40px rgba(16, 24, 40, .12);
}

[data-theme="yellow"] {
    --bg: #fffde7;
    --surface: #ffffff;
    --surface-2: #fff9c4;
    --text: #5d4037;
    --text-muted: color-mix(in srgb, var(--text) 55%, var(--bg));
    --border: #f6e27a;
    --primary: #f9a825;
    --primary-contrast: #3d2b16;
    --sale: #16a34a;
    --shadow: 0 1px 3px rgba(16, 24, 40, .08), 0 8px 24px rgba(16, 24, 40, .06);
    --shadow-hover: 0 6px 16px rgba(16, 24, 40, .12), 0 16px 40px rgba(16, 24, 40, .12);
}

[data-theme="purple"] {
    --bg: #f3e5f5;
    --surface: #ffffff;
    --surface-2: #e1bee7;
    --text: #4a148c;
    --text-muted: color-mix(in srgb, var(--text) 55%, var(--bg));
    --border: #c6b3e0;
    --primary: #7b1fa2;
    --primary-contrast: #ffffff;
    --sale: #16a34a;
    --shadow: 0 1px 3px rgba(16, 24, 40, .08), 0 8px 24px rgba(16, 24, 40, .06);
    --shadow-hover: 0 6px 16px rgba(16, 24, 40, .12), 0 16px 40px rgba(16, 24, 40, .12);
}

/* ------------------------------------------------------------
   Global overrides (apply on top of every palette above):
   - page background is always white (dark theme keeps its own),
   - header banner uses a fixed neutral colour in every theme.
   ------------------------------------------------------------ */
:root { --header-bg: #eef0f3; }
[data-theme="dark"] { --header-bg: #12151b; }

/* White page background for every light-based palette. :root is intentionally excluded
   here because it also matches the dark theme (which must keep its dark background). */
[data-theme="light"], [data-theme="red"],  [data-theme="green"], [data-theme="blue"],
[data-theme="gray"],  [data-theme="mint"], [data-theme="orange"], [data-theme="pink"],
[data-theme="yellow"], [data-theme="purple"] {
    --bg: #ffffff;
}

* { box-sizing: border-box; }

html, body { margin: 0; padding: 0; }

body {
    background: var(--bg);
    color: var(--text);
    font-family: "Cairo", "Inter", "Segoe UI", Tahoma, sans-serif;
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
    transition: background-color .2s ease, color .2s ease;
    overflow-x: clip;        /* contain the off-canvas drawer without breaking sticky header */
}

a { color: inherit; text-decoration: none; }

.vm-container {
    width: 100%;
    /* Follow the screen width (capped on ultra-wide displays to keep line lengths sane). */
    max-width: 1800px;
    margin: 0 auto;
    padding: 0 24px;
}

/* Give wide screens more breathing room on the sides. */
@media (min-width: 1600px) {
    .vm-container { padding: 0 40px; }
}

/* ---------- Header ---------- */
.vm-header {
    position: sticky;
    top: 0;
    z-index: 20;
    background: var(--header-bg);
    border-bottom: 1px solid var(--border);
}

.vm-header-inner {
    display: flex;
    align-items: center;
    gap: 16px;
    height: 64px;
}

.vm-brand { display: flex; align-items: center; gap: 10px; font-weight: 700; }

.vm-brand-mark {
    display: inline-grid;
    place-items: center;
    width: 34px; height: 34px;
    border-radius: 9px;
    background: var(--primary);
    color: var(--primary-contrast);
    font-size: 14px; letter-spacing: .5px;
}

.vm-brand-text { font-size: 18px; }

.vm-brand-logo {
    height: 36px;
    width: auto;
    max-width: 150px;
    object-fit: contain;
    border-radius: 8px;
    display: block;
}

.vm-search {
    flex: 1;
    display: flex;
    max-width: 520px;
    margin: 0 auto;
}

.vm-search input {
    flex: 1;
    min-width: 0;
    padding: 10px 14px;
    border: 1px solid var(--border);
    border-radius: 10px 0 0 10px;
    background: var(--surface-2);
    color: var(--text);
    font: inherit;
    outline: none;
}

[dir="rtl"] .vm-search input { border-radius: 0 10px 10px 0; }

.vm-search input:focus { border-color: var(--primary); }

.vm-search button {
    padding: 10px 18px;
    border: 1px solid var(--primary);
    background: var(--primary);
    color: var(--primary-contrast);
    border-radius: 0 10px 10px 0;
    cursor: pointer;
    font: inherit;
}

[dir="rtl"] .vm-search button { border-radius: 10px 0 0 10px; }

.vm-nav { display: flex; align-items: center; gap: 10px; margin-inline-start: auto; }

.vm-cart {
    position: relative;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 12px;
    border-radius: 10px;
    border: 1px solid var(--border);
    background: var(--surface-2);
    font-size: 14px;
}

.vm-cart-badge {
    position: absolute;
    top: -7px;
    inset-inline-end: -7px;
    min-width: 20px;
    height: 20px;
    padding: 0 5px;
    border-radius: 999px;
    background: var(--sale);
    color: #fff;
    font-size: 12px;
    font-weight: 700;
    display: grid;
    place-items: center;
}

.vm-lang {
    min-width: 40px;
    height: 40px;
    display: grid;
    place-items: center;
    border-radius: 10px;
    border: 1px solid var(--border);
    background: var(--surface-2);
    font-weight: 700;
    font-size: 14px;
}

.vm-lang:hover { border-color: var(--primary); }

/* Language toggle with a visible label (used on the portal root, where it must stay reachable
   on mobile too since there's no slide-out drawer). Overrides the icon-only square above. */
.vm-lang-text {
    width: auto;
    display: inline-flex;
    align-items: center;
    gap: 7px;
    padding: 0 14px;
}
.vm-lang-text i { font-size: 15px; opacity: .9; }

.vm-theme-toggle {
    width: 40px; height: 40px;
    display: grid; place-items: center;
    border-radius: 10px;
    border: 1px solid var(--border);
    background: var(--surface-2);
    cursor: pointer;
    font-size: 18px;
    line-height: 1;
}

.vm-theme-toggle .vm-icon-moon { display: none; }
[data-theme="dark"] .vm-theme-toggle .vm-icon-sun { display: none; }
[data-theme="dark"] .vm-theme-toggle .vm-icon-moon { display: inline; }

/* ---------- Theme palette picker ---------- */
.vm-theme-picker { position: relative; }

.vm-theme-menu {
    position: absolute;
    inset-inline-end: 0;
    top: calc(100% + 8px);
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 12px;
    box-shadow: var(--shadow-hover);
    padding: 12px;
    z-index: 30;
}

.vm-theme-menu[hidden] { display: none; }

.vm-theme-menu-title {
    font-size: 12px;
    font-weight: 700;
    color: var(--text-muted);
    margin-bottom: 8px;
}

.vm-swatches {
    display: grid;
    grid-template-columns: repeat(4, 34px);
    gap: 8px;
}

.vm-swatch {
    width: 34px;
    height: 34px;
    border-radius: 9px;
    border: 1px solid var(--border);
    background: var(--sw, #ccc);
    cursor: pointer;
    padding: 0;
    transition: transform .1s ease;
}

.vm-swatch:hover { transform: scale(1.08); }

.vm-swatch[aria-pressed="true"] {
    outline: 2px solid var(--primary);
    outline-offset: 2px;
}

/* In-drawer swatches sit inline, no popover. */
.vm-drawer .vm-swatches { padding: 6px 12px 4px; grid-template-columns: repeat(6, 34px); }

/* ---------- Catalog ---------- */
.vm-main { padding-top: 28px; padding-bottom: 48px; }

.vm-catalog-head {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 20px;
}

.vm-catalog-head h1 { font-size: 24px; margin: 0; }
.vm-count { color: var(--text-muted); font-size: 14px; }

.vm-clear-filter { color: var(--primary); margin-inline-start: 8px; white-space: nowrap; }
.vm-clear-filter:hover { text-decoration: underline; }

/* ---------- Shop layout: category sidebar + content ---------- */
.vm-shop {
    display: grid;
    grid-template-columns: 260px minmax(0, 1fr);
    gap: 24px;
    align-items: start;
}

.vm-shop-main { min-width: 0; }

.vm-cat-panel {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 14px;
    box-shadow: var(--shadow);
    overflow: hidden;
    position: sticky;
    top: 84px;
}

.vm-cat-panel-head {
    cursor: pointer;
    list-style: none;
    padding: 14px 16px;
    font-weight: 700;
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.vm-cat-panel-head::-webkit-details-marker { display: none; }
.vm-cat-panel-head::after { content: "▾"; color: var(--text-muted); transition: transform .2s ease; }
.vm-cat-panel[open] .vm-cat-panel-head::after { transform: rotate(180deg); }

.vm-cat-scroll { max-height: 70vh; overflow: auto; padding: 8px; }

/* ---------- Sidebar filter ---------- */
.vm-filter-panel { margin-bottom: 16px; }
.vm-filter { padding: 14px 16px; display: flex; flex-direction: column; gap: 8px; }

.vm-filter-label {
    font-weight: 600;
    font-size: 13px;
    color: var(--text-muted);
    margin-top: 6px;
}

.vm-filter-price { display: flex; align-items: center; gap: 8px; }
.vm-filter-dash { color: var(--text-muted); }

.vm-filter-price input,
.vm-filter-select {
    width: 100%;
    min-width: 0;
    padding: 9px 10px;
    border: 1px solid var(--border);
    border-radius: 10px;
    background: var(--surface-2);
    color: var(--text);
    font: inherit;
}

.vm-filter-price input:focus,
.vm-filter-select:focus { outline: none; border-color: var(--primary); }

.vm-filter-actions { display: flex; gap: 8px; margin-top: 12px; }
.vm-filter-actions .vm-btn-primary { flex: 1; justify-content: center; }
.vm-filter-actions .vm-btn-secondary { justify-content: center; }

.vm-cat-list { list-style: none; margin: 0; padding: 0; }
.vm-cat-list .vm-cat-list { margin-inline-start: 12px; border-inline-start: 1px solid var(--border); }

.vm-cat-list summary {
    list-style: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 7px 8px;
    border-radius: 8px;
    font-size: 14px;
}

.vm-cat-list summary::-webkit-details-marker { display: none; }
.vm-cat-list summary::before {
    content: "▸";
    color: var(--text-muted);
    font-size: 11px;
    transition: transform .15s ease;
}
.vm-cat-list details[open] > summary::before { transform: rotate(90deg); }
[dir="rtl"] .vm-cat-list summary::before { content: "◂"; }
[dir="rtl"] .vm-cat-list details[open] > summary::before { transform: rotate(-90deg); }

.vm-cat-list summary:hover,
.vm-cat-leaf:hover { background: var(--surface-2); }

.vm-cat-list summary > a { flex: 1; }

.vm-cat-leaf {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 7px 8px 7px 22px;
    border-radius: 8px;
    font-size: 14px;
    color: var(--text);
}

[dir="rtl"] .vm-cat-leaf { padding: 7px 22px 7px 8px; }

.vm-cat-leaf > span:first-child { flex: 1; }

.vm-cat-count {
    color: var(--text-muted);
    font-size: 12px;
    background: var(--surface-2);
    border-radius: 999px;
    padding: 1px 8px;
    min-width: 22px;
    text-align: center;
}

.vm-cat-active,
.vm-cat-active > a { color: var(--primary); font-weight: 700; }
.vm-cat-active { background: color-mix(in srgb, var(--primary) 12%, transparent); }

/* Main categories (IsCat=0) read as headers; sub categories (IsCat=1) hold items. */
.vm-cat-main { font-weight: 600; }
.vm-cat-sub { font-weight: 400; }
.vm-cat-ico { font-size: 12px; opacity: .85; margin-inline-end: 2px; }

.vm-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 18px;
}

/* Portal: heading above each group of similar stores (by business type). */
.vm-group-title {
    font-size: 18px;
    font-weight: 700;
    margin: 26px 0 12px;
    padding-bottom: 6px;
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: baseline;
    gap: 10px;
}
.vm-group-title:first-of-type { margin-top: 4px; }
.vm-group-title a { color: inherit; text-decoration: none; }
.vm-group-title a:hover { text-decoration: underline; }
.vm-group-title i { opacity: .8; margin-inline-end: 4px; }

/* Portal: country/city filter bar. */
.vm-portal-filter {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 10px;
    margin-bottom: 22px;
}
.vm-portal-filter .vm-filter-select,
.vm-portal-filter .vm-input { width: auto; min-width: 180px; }
/* Portal: the "from price — to price" pair sits together as one unit. */
.vm-portal-price {
    display: flex;
    align-items: center;
    gap: 8px;
}
.vm-portal-price .vm-input { min-width: 110px; }
.vm-portal-price .vm-filter-dash { color: var(--text-muted); }
@media (max-width: 560px) {
    .vm-portal-filter .vm-filter-select,
    .vm-portal-filter .vm-input { flex: 1 1 100%; min-width: 0; }
    .vm-portal-price { flex: 1 1 100%; }
    .vm-portal-price .vm-input { flex: 1 1 0; min-width: 0; }
}

/* ============================================================
   Portal hero + activity chips + store cards + search skeletons
   ============================================================ */

/* Gradient banner at the top of the portal, hosting the big cross-store search. */
.vm-hero {
    position: relative;
    overflow: hidden;
    border-radius: 20px;
    margin-bottom: 22px;
    padding: 40px 28px 30px;
    color: var(--primary-contrast);
    background:
        radial-gradient(120% 140% at 100% 0%, color-mix(in srgb, var(--primary) 78%, #000) 0%, transparent 55%),
        linear-gradient(135deg, var(--primary), color-mix(in srgb, var(--primary) 62%, #7c3aed));
    box-shadow: var(--shadow);
}
/* Subtle decorative glow on the trailing side. */
.vm-hero::after {
    content: "";
    position: absolute;
    inset-inline-end: -60px;
    top: -60px;
    width: 240px;
    height: 240px;
    border-radius: 50%;
    background: color-mix(in srgb, #ffffff 22%, transparent);
    filter: blur(8px);
    pointer-events: none;
}
.vm-hero-inner { position: relative; z-index: 1; max-width: 760px; margin: 0 auto; text-align: center; }
.vm-hero-title { margin: 0 0 8px; font-size: 30px; font-weight: 800; line-height: 1.2; }
.vm-hero-sub { margin: 0 0 22px; font-size: 16px; opacity: .92; }

.vm-portal-form { display: block; }

/* The prominent search box (pill) inside the hero. */
.vm-hero-search {
    display: flex;
    align-items: center;
    gap: 6px;
    background: var(--surface);
    border-radius: 999px;
    padding: 6px 6px 6px 16px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, .18);
    max-width: 640px;
    margin: 0 auto;
}
.vm-hero-search-ico { color: var(--text-muted); font-size: 16px; flex: 0 0 auto; }
.vm-hero-input {
    flex: 1;
    min-width: 0;
    border: 0;
    background: transparent;
    color: var(--text);
    font: inherit;
    font-size: 16px;
    padding: 10px 6px;
}
.vm-hero-input:focus { outline: none; }
.vm-hero-btn {
    flex: 0 0 auto;
    border: 0;
    border-radius: 999px;
    background: var(--primary);
    color: var(--primary-contrast);
    font: inherit;
    font-weight: 700;
    padding: 11px 24px;
    cursor: pointer;
    transition: filter .15s ease, transform .15s ease;
}
.vm-hero-btn:hover { filter: brightness(1.08); transform: translateY(-1px); }

/* Filter row inside the hero: translucent surface so it reads against the gradient. */
.vm-hero .vm-portal-filter {
    justify-content: center;
    margin: 16px auto 0;
    max-width: 640px;
}
.vm-hero .vm-filter-select,
.vm-hero .vm-input {
    background: color-mix(in srgb, var(--surface) 88%, transparent);
    border-color: transparent;
}
.vm-hero .vm-btn-secondary {
    background: color-mix(in srgb, #ffffff 16%, transparent);
    color: var(--primary-contrast);
    border-color: color-mix(in srgb, #ffffff 30%, transparent);
}

/* Live marketplace stats under the search. */
.vm-hero-stats {
    display: flex;
    align-items: center;
    justify-content: center;
    flex-wrap: wrap;
    gap: 10px 14px;
    margin-top: 18px;
    font-size: 14px;
    opacity: .95;
}
.vm-hero-stats .vm-stat b { font-size: 18px; font-weight: 800; }
.vm-stat-sep { width: 5px; height: 5px; border-radius: 50%; background: currentColor; opacity: .5; }

@media (max-width: 560px) {
    .vm-hero { padding: 28px 16px 22px; border-radius: 16px; }
    .vm-hero-title { font-size: 23px; }
    .vm-hero-sub { font-size: 14px; }
    .vm-hero-btn { padding: 11px 18px; }
}

/* ---------- Activity quick-filter chips ---------- */
.vm-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 9px;
    margin-bottom: 22px;
}
.vm-chip {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    padding: 8px 14px;
    border: 1px solid var(--border);
    border-radius: 999px;
    background: var(--surface);
    color: var(--text);
    font-size: 14px;
    font-weight: 600;
    text-decoration: none;
    box-shadow: var(--shadow);
    transition: transform .15s ease, border-color .15s ease, background .15s ease, color .15s ease;
}
.vm-chip:hover {
    transform: translateY(-2px);
    border-color: color-mix(in srgb, var(--primary) 50%, var(--border));
}
.vm-chip i { font-size: 13px; opacity: .85; }
.vm-chip-on {
    background: var(--primary);
    color: var(--primary-contrast);
    border-color: var(--primary);
}
.vm-chip-on i { opacity: 1; }

/* ---------- Enhanced group heading (icon disc + name + count) ---------- */
.vm-group-title { align-items: center; }
.vm-group-ico {
    display: inline-grid;
    place-items: center;
    width: 34px;
    height: 34px;
    border-radius: 50%;
    background: color-mix(in srgb, var(--primary) 14%, transparent);
    color: var(--primary);
    font-size: 15px;
    flex: 0 0 auto;
}
.vm-group-name { flex: 1; }

/* ---------- Store cards: activity badge + location line ---------- */
.vm-store-card .vm-card-media { position: relative; }
.vm-card-badge {
    position: absolute;
    top: 10px;
    inset-inline-start: 10px;
    z-index: 1;
    display: inline-flex;
    align-items: center;
    gap: 5px;
    max-width: calc(100% - 20px);
    padding: 4px 10px;
    border-radius: 999px;
    font-size: 11px;
    font-weight: 700;
    color: var(--primary-contrast);
    background: color-mix(in srgb, var(--primary) 88%, transparent);
    backdrop-filter: blur(2px);
    box-shadow: 0 2px 6px rgba(0, 0, 0, .18);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.vm-card-badge i { font-size: 10px; }
/* Coloured top accent that intensifies on hover. */
.vm-store-card { position: relative; }
.vm-store-card::before {
    content: "";
    position: absolute;
    top: 0;
    inset-inline: 0;
    height: 3px;
    background: var(--primary);
    opacity: 0;
    transition: opacity .15s ease;
    z-index: 2;
}
.vm-store-card:hover::before { opacity: 1; }
.vm-store-card:hover .vm-card-media img { transform: scale(1.04); }
.vm-store-card .vm-card-media img { transition: transform .25s ease; }
.vm-card-place {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    color: var(--text-muted);
    font-size: 12px;
}
.vm-card-place i { opacity: .8; }

/* ---------- Cross-store search skeletons (shimmer placeholders) ---------- */
.vm-search-progress { flex-direction: column; align-items: stretch; }
.vm-search-progress-line { display: flex; align-items: center; gap: 10px; }
.vm-skel-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 18px;
    margin-top: 16px;
}
.vm-skel-card {
    border: 1px solid var(--border);
    border-radius: 14px;
    overflow: hidden;
    background: var(--surface);
    box-shadow: var(--shadow);
    padding-bottom: 14px;
}
.vm-skel {
    background: linear-gradient(90deg,
        var(--surface-2) 25%,
        color-mix(in srgb, var(--surface-2) 60%, var(--border)) 37%,
        var(--surface-2) 63%);
    background-size: 400% 100%;
    animation: vm-shimmer 1.4s ease infinite;
    border-radius: 6px;
}
.vm-skel-media { aspect-ratio: 1 / 1; border-radius: 0; }
.vm-skel-line { height: 12px; margin: 12px 14px 0; }
.vm-skel-short { width: 55%; }
@keyframes vm-shimmer {
    from { background-position: 100% 0; }
    to { background-position: 0 0; }
}
@media (prefers-reduced-motion: reduce) {
    .vm-skel { animation: none; }
}

/* Spinner shared by the cross-store search progress line and the global loading overlay. */
.vm-spinner {
    display: inline-block;
    width: 18px;
    height: 18px;
    border: 2px solid var(--border);
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: vm-spin .7s linear infinite;
    vertical-align: middle;
    flex: 0 0 auto;
}
@keyframes vm-spin { to { transform: rotate(360deg); } }

/* Portal: "searching stores, please wait..." line shown while results stream in. */
.vm-search-progress {
    display: flex;
    align-items: center;
    gap: 10px;
    color: var(--text-muted);
    font-size: 15px;
    padding: 14px 0 18px;
}

/* Global "please wait" overlay shown while a page (data read) is loading. */
.vm-loading-overlay {
    position: fixed;
    inset: 0;
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(0, 0, 0, .28);
}
.vm-loading-overlay[hidden] { display: none; }
.vm-loading-box {
    display: flex;
    align-items: center;
    gap: 12px;
    background: var(--surface);
    color: var(--text);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 16px 22px;
    font-size: 16px;
    font-weight: 600;
    box-shadow: 0 10px 30px rgba(0, 0, 0, .25);
}
.vm-loading-box .vm-spinner { width: 22px; height: 22px; border-width: 3px; }

/* Portal: store name shown on a cross-store product search result card. */
.vm-card-store {
    display: block;
    font-size: 13px;
    color: var(--text-muted);
    margin: 2px 0 8px;
}
.vm-card-store i { margin-inline-end: 4px; opacity: .8; }

.vm-card {
    display: flex;
    flex-direction: column;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 14px;
    overflow: hidden;
    box-shadow: var(--shadow);
    transition: transform .15s ease, box-shadow .15s ease, border-color .15s ease;
}

.vm-card:hover {
    transform: translateY(-3px);
    box-shadow: var(--shadow-hover);
    border-color: color-mix(in srgb, var(--primary) 40%, var(--border));
}

.vm-card-media {
    aspect-ratio: 1 / 1;
    background: var(--surface-2);
    display: grid;
    place-items: center;
    overflow: hidden;
}

.vm-card-media img { width: 100%; height: 100%; object-fit: cover; }

.vm-noimg {
    color: var(--text-muted);
    font-size: 13px;
}

.vm-noimg-lg { width: 100%; height: 100%; display: grid; place-items: center; min-height: 320px; }

.vm-card-body { padding: 12px 14px 14px; display: flex; flex-direction: column; gap: 4px; }

.vm-card-title {
    font-size: 15px;
    margin: 0;
    font-weight: 600;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    min-height: 2.6em;
}

.vm-card-link { display: flex; flex-direction: column; flex: 1; color: inherit; text-decoration: none; }

.vm-card-code { color: var(--text-muted); font-size: 12px; }
.vm-card-price { font-weight: 700; color: var(--sale); font-size: 17px; }

.vm-card-actions { padding: 0 14px 14px; }
.vm-card-actions form { margin: 0; }

.vm-add-btn {
    width: 100%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 10px 14px;
    border: 1px solid transparent;
    border-radius: 10px;
    background: var(--primary);
    color: var(--primary-contrast);
    font: inherit;
    font-weight: 600;
    cursor: pointer;
    transition: filter .15s ease;
}

.vm-add-btn:hover { filter: brightness(1.06); }

.vm-add-btn:disabled {
    background: var(--surface-2);
    color: var(--text-muted);
    border-color: var(--border);
    cursor: not-allowed;
    filter: none;
}

.vm-card-foot {
    margin-top: 6px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
}

.vm-stock-tag {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 3px 9px;
    border-radius: 999px;
    font-size: 12px;
    font-weight: 600;
    white-space: nowrap;
}

.vm-stock-tag.vm-stock-in { color: #0f7a3d; background: rgba(22, 163, 74, .12); }
.vm-stock-tag.vm-stock-out { color: #b42318; background: rgba(220, 38, 38, .12); }

[data-theme="dark"] .vm-stock-tag.vm-stock-in { color: #4ade80; }
[data-theme="dark"] .vm-stock-tag.vm-stock-out { color: #f87171; }

/* ---------- Pager ---------- */
.vm-pager { display: flex; justify-content: center; align-items: center; gap: 14px; margin-top: 32px; }

.vm-page-btn {
    padding: 9px 16px;
    border: 1px solid var(--border);
    border-radius: 10px;
    background: var(--surface);
}

.vm-page-btn:hover { border-color: var(--primary); }
.vm-page-info { color: var(--text-muted); font-size: 14px; }

/* ---------- Detail ---------- */
.vm-detail {
    display: grid;
    grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr);
    gap: 32px;
    align-items: start;
}

.vm-detail-media {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 16px;
    overflow: hidden;
    box-shadow: var(--shadow);
}

.vm-detail-media img { width: 100%; display: block; object-fit: contain; }

.vm-back { color: var(--text-muted); font-size: 14px; display: inline-block; margin-bottom: 10px; }
.vm-back:hover { color: var(--primary); }

.vm-detail-info h1 { font-size: 26px; margin: 4px 0 12px; }

.vm-detail-sub { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 18px; }

.vm-chip {
    padding: 4px 10px;
    border-radius: 999px;
    background: var(--surface-2);
    border: 1px solid var(--border);
    font-size: 13px;
    color: var(--text-muted);
}

.vm-price-hero { font-size: 30px; font-weight: 800; color: var(--sale); margin-bottom: 18px; }

.vm-price-table { width: 100%; border-collapse: collapse; margin-bottom: 22px; }

.vm-price-table td {
    padding: 10px 12px;
    border-bottom: 1px solid var(--border);
    font-size: 14px;
}

.vm-price-table td:last-child { text-align: end; font-weight: 600; }
.vm-row-sale td { color: var(--sale); font-weight: 700; }

.vm-detail-section { margin-bottom: 20px; }
.vm-detail-section h2 {
    font-size: 16px;
    font-weight: 700;
    margin: 0 0 8px;
}
.vm-detail-text {
    margin: 0;
    color: var(--text-muted);
    font-size: 14px;
    line-height: 1.7;
    white-space: pre-line;        /* preserve line breaks stored in the field */
}

.vm-btn-primary {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 12px 22px;
    border: none;
    border-radius: 12px;
    background: var(--primary);
    color: var(--primary-contrast);
    font: inherit;
    font-weight: 600;
    cursor: pointer;
}

.vm-btn-primary:disabled { opacity: .55; cursor: not-allowed; }

.vm-btn-secondary {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 12px 22px;
    border: 1px solid var(--border);
    border-radius: 12px;
    background: var(--surface-2);
    color: var(--text);
    font: inherit;
    font-weight: 600;
    text-decoration: none;
    cursor: pointer;
}

.vm-btn-secondary:hover { border-color: var(--primary); color: var(--primary); }

/* ---------- Stock / availability badge ---------- */
.vm-stock {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    margin: 4px 0 8px;
    padding: 7px 14px;
    border-radius: 999px;
    font-weight: 600;
    font-size: 14px;
}

.vm-stock-in {
    color: #0f7a3d;
    background: rgba(22, 163, 74, .12);
}

.vm-stock-out {
    color: #b42318;
    background: rgba(220, 38, 38, .12);
}

.vm-stock-qty { font-weight: 400; opacity: .85; }

[data-theme="dark"] .vm-stock-in { color: #4ade80; }
[data-theme="dark"] .vm-stock-out { color: #f87171; }

/* ---------- Inline notice (e.g. stock limit on cart) ---------- */
.vm-notice {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 18px;
    padding: 12px 16px;
    border-radius: 12px;
    border: 1px solid rgba(217, 119, 6, .35);
    background: rgba(245, 158, 11, .12);
    color: #92400e;
    font-weight: 600;
}

[data-theme="dark"] .vm-notice { color: #fbbf24; }

/* ---------- Toast (AJAX add-to-cart feedback) ---------- */
.vm-toast {
    position: fixed;
    z-index: 1200;
    inset-block-end: 24px;
    inset-inline-end: 24px;
    max-width: min(360px, calc(100vw - 32px));
    padding: 13px 18px;
    border-radius: 12px;
    background: #16a34a;
    color: #fff;
    font-weight: 600;
    box-shadow: 0 10px 30px rgba(0, 0, 0, .22);
    opacity: 0;
    transform: translateY(12px);
    transition: opacity .2s ease, transform .2s ease;
    pointer-events: none;
}

.vm-toast.vm-toast-warn { background: #d97706; }
.vm-toast.vm-toast-show { opacity: 1; transform: translateY(0); }

/* ---------- Error pages (404 / 500) ---------- */
.vm-error {
    text-align: center;
    padding: 72px 20px;
    max-width: 560px;
    margin: 0 auto;
}

.vm-error-code {
    font-size: clamp(72px, 18vw, 140px);
    font-weight: 800;
    line-height: 1;
    letter-spacing: 2px;
    background: linear-gradient(135deg, var(--primary), color-mix(in srgb, var(--primary) 55%, var(--sale)));
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    margin-bottom: 8px;
}

.vm-error h1 { margin: 0 0 10px; color: var(--text); }
.vm-error p { color: var(--text-muted); margin: 0 0 24px; }

.vm-error-actions {
    display: flex;
    gap: 12px;
    justify-content: center;
    flex-wrap: wrap;
}

/* ---------- Empty / Footer ---------- */
.vm-empty {
    text-align: center;
    padding: 64px 20px;
    color: var(--text-muted);
}

.vm-empty h1 { color: var(--text); }

.vm-footer {
    border-top: 1px solid var(--border);
    padding: 24px 0;
    color: var(--text-muted);
    font-size: 14px;
    text-align: center;
}

/* ---------- Add-to-cart / quantity ---------- */
.vm-add-form { display: flex; align-items: flex-end; gap: 14px; flex-wrap: wrap; }

.vm-qty { display: flex; flex-direction: column; gap: 4px; }
.vm-qty label { font-size: 13px; color: var(--text-muted); }

.vm-qty input {
    width: 84px;
    padding: 10px 12px;
    border: 1px solid var(--border);
    border-radius: 10px;
    background: var(--surface-2);
    color: var(--text);
    font: inherit;
}

/* ---------- Cart page ---------- */
.vm-cart-layout {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 300px;
    gap: 24px;
    align-items: start;
}

.vm-cart-lines { display: flex; flex-direction: column; gap: 12px; }

.vm-cart-line {
    display: grid;
    grid-template-columns: 88px minmax(0, 1fr) auto;
    gap: 14px;
    align-items: center;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 14px;
    padding: 12px;
    box-shadow: var(--shadow);
}

.vm-cart-thumb {
    width: 88px; height: 88px;
    border-radius: 10px;
    overflow: hidden;
    background: var(--surface-2);
    display: grid; place-items: center;
}

.vm-cart-thumb img { width: 100%; height: 100%; object-fit: cover; }

.vm-cart-line-info { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.vm-cart-line-title { font-weight: 600; }
.vm-cart-line-title:hover { color: var(--primary); }
.vm-cart-unit { color: var(--text-muted); font-size: 14px; }

.vm-cart-line-actions { display: flex; align-items: center; gap: 14px; }
.vm-cart-line-total { font-weight: 700; min-width: 90px; text-align: end; }

.vm-link-danger {
    border: none;
    background: none;
    color: #dc2626;
    cursor: pointer;
    font: inherit;
    padding: 0;
}

.vm-link-danger:hover { text-decoration: underline; }

.vm-cart-summary {
    position: sticky;
    top: 84px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 14px;
    padding: 18px;
    box-shadow: var(--shadow);
}

.vm-cart-summary h2 { margin: 0 0 14px; font-size: 18px; }

.vm-summary-row {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    padding: 12px 0;
    border-top: 1px solid var(--border);
    font-size: 18px;
}

.vm-cart-summary .vm-btn-primary,
.vm-cart-summary .vm-btn-secondary { width: 100%; justify-content: center; margin-top: 8px; box-sizing: border-box; }
.vm-clear { display: block; margin: 14px auto 0; }

/* ---------- Mobile menu (hamburger + drawer) ---------- */
.vm-burger {
    display: none;            /* shown only on mobile via media query */
    width: 40px; height: 40px;
    border-radius: 10px;
    border: 1px solid var(--border);
    background: var(--surface-2);
    cursor: pointer;
    padding: 0;
    place-items: center;
    gap: 4px;
}

.vm-burger span {
    display: block;
    width: 18px; height: 2px;
    background: var(--text);
    border-radius: 2px;
}

.vm-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, .45);
    opacity: 0;
    transition: opacity .25s ease;
    z-index: 39;
}

.vm-backdrop.open { opacity: 1; }

.vm-drawer {
    position: fixed;
    top: 0; bottom: 0;
    inset-inline-end: 0;
    width: min(82vw, 320px);
    background: var(--surface);
    border-inline-start: 1px solid var(--border);
    box-shadow: var(--shadow-hover);
    transform: translateX(100%);
    transition: transform .25s ease;
    z-index: 40;
    display: flex;
    flex-direction: column;
    padding: 16px;
    gap: 4px;
}

[dir="rtl"] .vm-drawer { transform: translateX(-100%); }
.vm-drawer.open { transform: none; }

/* The drawer + backdrop are mobile-only; keep them out of desktop entirely. */
@media (min-width: 721px) {
    .vm-drawer, .vm-backdrop { display: none !important; }
}

.vm-drawer-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 8px;
}

.vm-drawer-title { font-weight: 700; font-size: 16px; }

.vm-drawer-close {
    width: 36px; height: 36px;
    border: 1px solid var(--border);
    border-radius: 9px;
    background: var(--surface-2);
    color: var(--text);
    cursor: pointer;
    font-size: 16px;
}

.vm-drawer-link {
    display: flex;
    align-items: center;
    gap: 12px;
    width: 100%;
    padding: 14px 12px;
    border: none;
    background: none;
    border-radius: 10px;
    color: var(--text);
    font: inherit;
    text-align: start;
    cursor: pointer;
}

.vm-drawer-link:hover { background: var(--surface-2); }

.vm-drawer-count {
    margin-inline-start: auto;
    min-width: 22px;
    height: 22px;
    padding: 0 6px;
    border-radius: 999px;
    background: var(--sale);
    color: #fff;
    font-size: 12px;
    font-weight: 700;
    display: grid;
    place-items: center;
}

.vm-drawer-sep { border: none; border-top: 1px solid var(--border); margin: 8px 4px; }

.vm-no-scroll { overflow: hidden; }

/* ============================================================
   Responsive / mobile
   ============================================================ */

/* Tablets and below: stack detail + cart, reflow the header. */
@media (max-width: 860px) {
    .vm-detail { grid-template-columns: 1fr; }
    .vm-cart-layout { grid-template-columns: 1fr; }
    .vm-cart-summary { position: static; }

    /* Category sidebar moves above the grid and stops sticking. */
    .vm-shop { grid-template-columns: 1fr; gap: 16px; }
    .vm-cat-panel { position: static; }
    .vm-cat-scroll { max-height: 50vh; }
}

@media (max-width: 720px) {
    /* Header wraps: brand + actions on top, full-width search below. */
    .vm-header-inner {
        height: auto;
        flex-wrap: wrap;
        gap: 10px;
        padding: 10px 0;
    }
    .vm-brand { order: 1; }
    .vm-nav { order: 2; margin-inline-start: auto; gap: 8px; }
    .vm-search {
        order: 3;
        flex-basis: 100%;
        max-width: none;
        margin: 0;
    }

    .vm-cart span { display: none; }            /* keep only the cart icon + badge */
    .vm-cart { padding: 8px 10px; }

    .vm-burger { display: grid; }               /* show hamburger */
    .vm-hide-mobile { display: none; }          /* lang + theme move into the drawer */

    .vm-main { padding-top: 18px; }
    .vm-detail-info h1 { font-size: 22px; }
    .vm-price-hero { font-size: 26px; }
}

/* Phones: two product columns, tighter spacing, bigger tap targets. */
@media (max-width: 560px) {
    .vm-container { padding: 0 14px; }

    .vm-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 12px;
    }
    .vm-card-body { padding: 10px; }
    .vm-card-title { font-size: 14px; min-height: 2.6em; }
    .vm-card-price { font-size: 15px; }

    .vm-catalog-head h1 { font-size: 20px; }

    .vm-cart-line { grid-template-columns: 64px minmax(0, 1fr); }
    .vm-cart-line-actions { grid-column: 1 / -1; justify-content: space-between; }
    .vm-cart-thumb { width: 64px; height: 64px; }

    .vm-add-form { gap: 10px; }
    .vm-add-form .vm-btn-primary { flex: 1; justify-content: center; }

    /* Comfortable 44px tap targets on touch screens. */
    .vm-search input, .vm-search button { padding-top: 12px; padding-bottom: 12px; }
}

/* Very small phones: single column. */
@media (max-width: 360px) {
    .vm-grid { grid-template-columns: 1fr; }
}

/* ---------- Checkout ---------- */
.vm-checkout-layout {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 320px;
    gap: 24px;
    align-items: start;
}

/* The customer-details card must not stick like the order summary. */
.vm-checkout-card { position: static; top: auto; }

.vm-field { margin-bottom: 14px; }
.vm-field label {
    display: block;
    margin-bottom: 6px;
    font-size: 14px;
    font-weight: 600;
}
.vm-req { color: var(--sale); }

.vm-input {
    width: 100%;
    box-sizing: border-box;
    padding: 10px 12px;
    border: 1px solid var(--border);
    border-radius: 10px;
    background: var(--surface-2);
    color: var(--text);
    font: inherit;
}
.vm-input:focus { outline: 2px solid var(--sale); outline-offset: 1px; }
textarea.vm-input { resize: vertical; min-height: 64px; }

.vm-field-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 14px;
}

.vm-field-error,
.field-validation-error {
    display: block;
    margin-top: 4px;
    color: #dc2626;
    font-size: 12.5px;
}
.input-validation-error { border-color: #dc2626; }

.vm-checkout-items {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-bottom: 6px;
}
.vm-checkout-item {
    display: flex;
    justify-content: space-between;
    gap: 10px;
    font-size: 14px;
}
.vm-checkout-item-qty { color: var(--text-muted); font-size: 12px; }
.vm-checkout-item-total { font-weight: 600; white-space: nowrap; }

.vm-pay-note {
    margin: 10px 0 0;
    font-size: 12.5px;
    color: var(--text-muted);
    line-height: 1.6;
}

/* ---------- Payment + confirmation ---------- */
.vm-pay-wrap { max-width: 560px; margin: 0 auto; }
.vm-pay-total { font-size: 20px; border-top: none; margin-bottom: 14px; }

.vm-confirm { max-width: 620px; margin: 0 auto; text-align: center; }
.vm-confirm-icon { font-size: 56px; color: #16a34a; margin-bottom: 8px; }
.vm-confirm-icon-fail { color: #dc2626; }
.vm-confirm h1 { font-size: 24px; margin: 0 0 10px; }
.vm-confirm-ref { font-size: 16px; color: var(--text-muted); }
.vm-confirm-status { margin: 12px 0; font-weight: 600; }
.vm-confirm-paid { color: #16a34a; }
.vm-confirm-pending { color: var(--text-muted); }
.vm-confirm-fail { color: #dc2626; }
.vm-confirm-card { text-align: start; margin: 18px 0; position: static; }
.vm-confirm-card p { margin: 4px 0; }
.vm-confirm-actions { display: flex; gap: 10px; justify-content: center; flex-wrap: wrap; }

/* Account lookup row. */
.vm-lookup { display: flex; flex-wrap: wrap; gap: 8px; align-items: stretch; }
.vm-lookup .vm-input { flex: 1 1 180px; min-width: 160px; }
.vm-lookup .vm-btn-secondary { white-space: nowrap; flex: 0 0 auto; }

/* Payment / delivery choice cards. */
.vm-choice-group { display: flex; flex-direction: column; gap: 8px; margin-bottom: 12px; }
.vm-choice {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 14px;
    border: 1px solid var(--border);
    border-radius: 10px;
    cursor: pointer;
    background: var(--surface-2);
}
.vm-choice input { accent-color: var(--sale); width: 18px; height: 18px; flex-shrink: 0; }
.vm-choice span { display: flex; align-items: center; gap: 8px; font-size: 14px; }
.vm-pay-hint { color: var(--text-muted); font-size: 12px; }
.vm-notice-ok {
    color: #16a34a;
    border-color: rgba(22, 163, 74, .35);
    background: rgba(34, 197, 94, .12);
}
[data-theme="dark"] .vm-notice-ok { color: #4ade80; }

.vm-price-tax-note {
    font-size: 13px;
    font-weight: 600;
    color: var(--muted);
    margin-inline-start: 8px;
}

.vm-confirm-meta { margin: 10px 0; }
.vm-bank-info {
    text-align: start;
    white-space: pre-line;
    background: var(--surface-2);
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 12px 14px;
    margin: 10px auto;
    max-width: 420px;
    font-size: 14px;
    line-height: 1.7;
}

@media (max-width: 860px) {
    .vm-checkout-layout { grid-template-columns: 1fr; }
}
@media (max-width: 560px) {
    .vm-field-row { grid-template-columns: 1fr; gap: 0; }
    .vm-lookup { flex-direction: column; }
}

/* ---------- Store location: map button + distance-from-me ---------- */
/* Portal: each store is a cell holding the card plus a footer row (distance + map button). */
.vm-store-cell { display: flex; flex-direction: column; }
.vm-store-cell > .vm-store-card { flex: 1 1 auto; }

.vm-store-foot {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    margin-top: 6px;
    min-height: 24px;
}

.vm-store-dist,
.vm-loc-dist {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    font-weight: 600;
    color: var(--text-muted);
}
.vm-store-dist { font-size: 12px; }
.vm-loc-dist { font-size: 13px; }

.vm-store-map,
.vm-loc-map {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 5px 10px;
    font-size: 12px;
    font-weight: 600;
    border: 1px solid var(--border);
    border-radius: 999px;
    color: var(--primary);
    background: var(--surface);
    text-decoration: none;
    white-space: nowrap;
    transition: background .15s ease, border-color .15s ease;
}
.vm-store-map:hover,
.vm-loc-map:hover {
    background: var(--surface-2);
    border-color: var(--primary);
}

/* Store page: location row under the catalog heading. */
.vm-store-location {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
    margin: 2px 0 18px;
}
.vm-loc-map { padding: 8px 14px; font-size: 14px; }

/* Portal: tools bar (instant filter + "nearest to me" toggle) + nearby-store highlight. */
.vm-portal-tools {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    flex-wrap: wrap;
    margin: 0 0 12px;
}

/* Instant store filter input. */
.vm-store-filter {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    flex: 1 1 240px;
    max-width: 360px;
    padding: 0 12px;
    border: 1px solid var(--border);
    border-radius: 999px;
    background: var(--surface);
    color: var(--text-muted);
}
.vm-store-filter:focus-within { border-color: var(--primary); }
.vm-store-filter input {
    flex: 1;
    border: 0;
    outline: 0;
    background: transparent;
    color: var(--text);
    padding: 9px 0;
    font-size: 14px;
}
.vm-sort-near {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    padding: 7px 14px;
    font-size: 13px;
    font-weight: 600;
    border: 1px solid var(--border);
    border-radius: 999px;
    background: var(--surface);
    color: var(--text);
    cursor: pointer;
    transition: background .15s ease, border-color .15s ease, color .15s ease;
}
.vm-sort-near:hover { border-color: var(--primary); }
.vm-sort-near.vm-on {
    background: var(--primary);
    color: var(--primary-contrast);
    border-color: var(--primary);
}

/* A store within NEAR_KM of the visitor: green distance + a subtle accent on the card. */
.vm-store-dist.vm-near { color: var(--sale); }
.vm-near-cell > .vm-store-card {
    border-color: color-mix(in srgb, var(--sale) 45%, var(--border));
}

/* ---------- Store ratings / reviews ---------- */
.vm-stars { display: inline-flex; gap: 2px; color: #f5a623; font-size: 14px; line-height: 1; }
.vm-stars .fa-regular { color: var(--border); }

/* Rating summary line under the store heading (links to the reviews section). */
.vm-rating-summary {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    margin: 0 0 16px;
    font-size: 14px;
    color: var(--text);
    text-decoration: none;
}
.vm-rating-summary:hover { color: var(--primary); }
.vm-rating-count { color: var(--text-muted); font-size: 13px; }

/* Rating shown on a portal store card. */
.vm-card-rating {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    margin-top: 6px;
    font-size: 12px;
    color: var(--text-muted);
}
.vm-card-rating .vm-stars { font-size: 12px; }

/* Reviews section (store page). */
.vm-reviews { margin-top: 34px; border-top: 1px solid var(--border); padding-top: 22px; }
.vm-reviews h2 { font-size: 20px; margin: 0 0 14px; }
.vm-reviews-overall {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 16px;
    font-size: 18px;
}
.vm-reviews-overall .vm-stars { font-size: 20px; }

.vm-review-form {
    display: grid;
    gap: 10px;
    max-width: 560px;
    margin-bottom: 24px;
    padding: 16px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 14px;
}
.vm-review-label { font-weight: 600; }
.vm-review-text-input { resize: vertical; font-family: inherit; min-height: 70px; }
.vm-review-hint {
    display: flex;
    align-items: center;
    gap: 7px;
    margin: 0;
    color: var(--text-muted);
    font-size: 13px;
}
.vm-review-codes { display: flex; gap: 10px; flex-wrap: wrap; }
.vm-review-codes .vm-input { flex: 1 1 140px; }

.vm-review-done {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    margin: 0 0 22px;
    padding: 10px 14px;
    border-radius: 12px;
    border: 1px solid var(--border);
    background: var(--surface-2);
    color: var(--sale);
    font-weight: 600;
}

.vm-stars-input { display: inline-flex; gap: 4px; }
.vm-star-btn {
    background: none;
    border: 0;
    padding: 0;
    cursor: pointer;
    font-size: 28px;
    line-height: 1;
    color: #f5a623;
    transition: transform .1s ease;
}
.vm-star-btn .fa-regular { color: var(--border); }
.vm-star-btn:hover { transform: scale(1.12); }
.vm-stars-shake { animation: vm-shake .4s; }
@keyframes vm-shake {
    0%, 100% { transform: translateX(0); }
    25% { transform: translateX(-5px); }
    75% { transform: translateX(5px); }
}

.vm-review-list { display: grid; gap: 4px; }
.vm-review { padding: 12px 0; border-bottom: 1px solid var(--border); }
.vm-review-head { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.vm-review-name { font-weight: 600; }
.vm-review-date { color: var(--text-muted); font-size: 12px; }
.vm-review-text { margin: 6px 0 0; color: var(--text); line-height: 1.6; white-space: pre-line; }
.vm-muted { color: var(--text-muted); }

/* ---- Account statement (كشف الحساب) ---- */
.vm-table-wrap { width: 100%; }
.vm-ledger-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 14px;
}
.vm-ledger-table th,
.vm-ledger-table td {
    padding: 9px 10px;
    border-bottom: 1px solid var(--border);
    text-align: start;
    white-space: nowrap;
}
.vm-ledger-table thead th {
    font-weight: 700;
    color: var(--text-muted);
    border-bottom: 2px solid var(--border);
}
.vm-ledger-table td.vm-num,
.vm-ledger-table th.vm-num { text-align: end; font-variant-numeric: tabular-nums; }
.vm-ledger-table tbody tr:hover { background: var(--surface-2); }
.vm-ledger-table tfoot .vm-ledger-total td {
    font-weight: 700;
    border-top: 2px solid var(--border);
    border-bottom: none;
}

/* Opening-balance + monthly-subtotal + unposted-header rows stand out from transactions. */
.vm-ledger-table .vm-ledger-opening td { background: color-mix(in srgb, var(--primary) 9%, var(--surface)); font-weight: 600; }
.vm-ledger-table .vm-ledger-month td { background: color-mix(in srgb, var(--text-muted) 12%, var(--surface)); font-weight: 600; }
.vm-ledger-table .vm-ledger-unposted-head td {
    background: color-mix(in srgb, var(--sale) 14%, var(--surface));
    font-weight: 700;
    text-align: start;
}
/* Unposted transaction rows are tinted so they're clearly not yet posted. */
.vm-ledger-table .vm-ledger-unposted td { background: color-mix(in srgb, var(--sale) 7%, var(--surface)); }
.vm-ledger-table .vm-ledger-unposted:hover td { background: color-mix(in srgb, var(--sale) 12%, var(--surface)); }

/* Order status pills on the "my orders" page. */
.vm-order-status {
    display: inline-block;
    padding: 3px 12px;
    border-radius: 999px;
    font-size: .82rem;
    font-weight: 600;
    white-space: nowrap;
}
.vm-order-processing {
    background: color-mix(in srgb, var(--text-muted) 16%, var(--surface));
    color: var(--text);
}
.vm-order-ready {
    background: color-mix(in srgb, var(--primary) 16%, var(--surface));
    color: var(--primary);
}
.vm-order-blocked {
    background: color-mix(in srgb, #f59e0b 20%, var(--surface));
    color: #92600a;
}
.vm-order-stopped {
    background: color-mix(in srgb, var(--sale, #dc2626) 16%, var(--surface));
    color: #b91c1c;
}
.vm-order-finished {
    background: color-mix(in srgb, #16a34a 18%, var(--surface));
    color: #15803d;
}

/* Display-option checkboxes on the statement form. */
.vm-check-group { display: flex; flex-wrap: wrap; gap: 10px 18px; }
.vm-check { display: inline-flex; align-items: center; gap: 6px; font-weight: 500; cursor: pointer; }
.vm-check input { width: 16px; height: 16px; }

/* Invoice row picker (radio beside the invoice number) for "print selected invoice". */
.vm-inv-pick { display: inline-flex; align-items: center; gap: 6px; cursor: pointer; }
.vm-inv-pick input { width: 15px; height: 15px; cursor: pointer; }
button:disabled { opacity: .5; cursor: not-allowed; }

/* Per-row print-invoice icon button. */
.vm-row-print {
    display: inline-grid;
    place-items: center;
    width: 28px;
    height: 28px;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: var(--surface-2);
    color: var(--primary);
    text-decoration: none;
}
.vm-row-print:hover { border-color: var(--primary); background: var(--primary); color: var(--primary-contrast); }

/* Toolbar above the statement table holding the "print selected invoice" button. */
.vm-invoice-toolbar {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
    margin: 10px 0 14px;
    padding: 10px 12px;
    border: 1px dashed var(--border);
    border-radius: 10px;
    background: var(--surface-2);
}

/* ---- Printable invoice ---- */
.vm-invoice-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 16px; flex-wrap: wrap; }
.vm-invoice-meta { display: flex; flex-direction: column; gap: 4px; margin-top: 8px; font-size: 14px; }
.vm-invoice-meta > div { display: flex; gap: 8px; }
.vm-invoice-meta span { color: var(--text-muted); min-width: 90px; }
.vm-invoice-qr { padding: 6px; border: 1px solid var(--border); border-radius: 8px; background: #fff; }
.vm-invoice-qr img, .vm-invoice-qr canvas { display: block; }
.vm-invoice-parties { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; margin: 16px 0; }
.vm-invoice-parties h3 { margin: 0 0 6px; font-size: 15px; }
.vm-invoice-parties > div { padding: 12px; border: 1px solid var(--border); border-radius: 10px; font-size: 14px; line-height: 1.7; }
.vm-invoice-parties span { color: var(--text-muted); }
.vm-invoice-totals { margin-top: 14px; margin-inline-start: auto; max-width: 360px; }
.vm-invoice-grand { font-weight: 700; font-size: 16px; border-top: 2px solid var(--border); padding-top: 8px; margin-top: 6px; }
.vm-invoice-currency { margin-top: 16px; text-align: center; color: var(--text-muted); font-size: 13px; }
.vm-invoice-currency strong { color: var(--text); }

/* Print: drop the site chrome + the form, keep only the statement table. */
@media print {
    .vm-header, .vm-footer, .vm-drawer, .vm-backdrop, .vm-print-hide { display: none !important; }
    .vm-main, .vm-container { max-width: none; margin: 0; padding: 0; }
    .vm-print-area { box-shadow: none; border: none; }
    .vm-ledger-table .vm-ledger-unposted td,
    .vm-ledger-table .vm-ledger-unposted-head td,
    .vm-ledger-table .vm-ledger-opening td,
    .vm-ledger-table .vm-ledger-month td { background: #f0f0f0 !important; -webkit-print-color-adjust: exact; print-color-adjust: exact; }
}

/* "My orders": per-row edit/delete actions for a signed-in customer. */
.vm-order-actions { white-space: nowrap; }
.vm-order-edit, .vm-order-del {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 5px 10px;
    margin: 2px;
    border-radius: 8px;
    border: 1px solid var(--border);
    background: var(--surface);
    color: var(--text);
    font-size: .82rem;
    font-weight: 600;
    cursor: pointer;
}
.vm-order-edit:hover { border-color: var(--primary); color: var(--primary); }
.vm-order-del { color: #b91c1c; }
.vm-order-del:hover { border-color: #b91c1c; background: color-mix(in srgb, #dc2626 8%, var(--surface)); }
.vm-order-edit:disabled, .vm-order-del:disabled { opacity: .55; cursor: not-allowed; }

/* Edit-order modal. */
.vm-modal[hidden] { display: none; }
.vm-modal {
    position: fixed;
    inset: 0;
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 16px;
}
.vm-modal-backdrop { position: absolute; inset: 0; background: rgba(16, 24, 40, .5); }
.vm-modal-card {
    position: relative;
    width: 100%;
    max-width: 640px;
    max-height: 90vh;
    display: flex;
    flex-direction: column;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 14px;
    box-shadow: var(--shadow-hover);
    overflow: hidden;
}
.vm-modal-head, .vm-modal-foot {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 14px 18px;
    border-bottom: 1px solid var(--border);
}
.vm-modal-foot { border-bottom: 0; border-top: 1px solid var(--border); }
.vm-modal-head h3 { margin: 0; font-size: 1.05rem; flex: 1; }
.vm-modal-x {
    border: 0;
    background: transparent;
    color: var(--text-muted);
    font-size: 1.1rem;
    cursor: pointer;
    padding: 4px 8px;
    border-radius: 8px;
}
.vm-modal-x:hover { background: var(--surface-2); color: var(--text); }
.vm-modal-body { padding: 16px 18px; overflow-y: auto; }
.vm-edit-table .vm-edit-qty { width: 72px; text-align: center; padding: 4px 6px; }
.vm-edit-table td { vertical-align: middle; }
.vm-edit-add { margin-top: 16px; }
.vm-edit-add > label { display: block; font-weight: 600; margin-bottom: 6px; }
.vm-edit-search-wrap { position: relative; }
.vm-edit-results {
    position: absolute;
    inset-inline: 0;
    top: calc(100% + 4px);
    z-index: 5;
    margin: 0;
    padding: 4px;
    list-style: none;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 10px;
    box-shadow: var(--shadow);
    max-height: 240px;
    overflow-y: auto;
}
.vm-edit-results[hidden] { display: none; }
.vm-edit-result {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 10px;
    border-radius: 8px;
    cursor: pointer;
}
.vm-edit-result:hover { background: var(--surface-2); }
.vm-edit-thumb {
    flex: 0 0 auto;
    width: 40px;
    height: 40px;
    border-radius: 8px;
    border: 1px solid var(--border);
    object-fit: cover;
    background: var(--surface-2);
}
.vm-edit-noimg {
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: .6rem;
    color: var(--text-muted);
    text-align: center;
    line-height: 1.1;
    padding: 2px;
}
.vm-edit-result-info { flex: 1 1 auto; min-width: 0; display: flex; flex-direction: column; }
.vm-edit-result-name { font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.vm-edit-result-code { font-size: .78rem; color: var(--text-muted); }
.vm-edit-result-meta { flex: 0 0 auto; display: flex; flex-direction: column; align-items: flex-end; gap: 2px; }
.vm-edit-stock-in { font-size: .76rem; color: #15803d; white-space: nowrap; }
.vm-edit-stock { font-size: .72rem; color: var(--text-muted); margin-top: 2px; }
.vm-modal-foot .vm-btn-primary, .vm-modal-foot .vm-btn-secondary { width: auto; margin: 0; }
