/* =====================================================================
   Al-Reef Distribution Platform — Design System
   Brand: deep green (#11473a) + wheat gold (#b4964f) from the AL-REEF logo
   Fonts: Almarai (Arabic) · Heebo (Hebrew) — both RTL
   ===================================================================== */
:root {
    --brand: #11473a;
    --brand-600: #0d3a2f;
    --brand-700: #0a2e25;
    --brand-50: #e8f0ed;
    --brand-100: #d2e2dc;
    --gold: #b4964f;
    --gold-50: #f7f1e3;
    --navy: #0f2a3a;
    --bg: #f3f5f4;
    --card: #ffffff;
    --text: #1f2a27;
    --muted: #6b7672;
    --border: #e3e8e6;
    --radius: 14px;
    --radius-sm: 10px;
    --shadow-sm: 0 1px 2px rgba(16, 42, 35, .05), 0 1px 3px rgba(16, 42, 35, .05);
    --shadow: 0 6px 20px rgba(16, 42, 35, .07);
    --font: 'Almarai', 'Heebo', system-ui, -apple-system, 'Segoe UI', Tahoma, sans-serif;

    --bs-primary: #11473a;
    --bs-primary-rgb: 17, 71, 58;
    --bs-link-color: #11473a;
    --bs-link-color-rgb: 17, 71, 58;
    --bs-link-hover-color: #0a2e25;
    --bs-body-font-family: var(--font);
    --bs-body-color: var(--text);
    --bs-body-bg: var(--bg);
    --bs-border-color: var(--border);
    --bs-border-radius: var(--radius-sm);
}
html[data-locale="he"] { --font: 'Heebo', 'Almarai', system-ui, -apple-system, 'Segoe UI', sans-serif; }

body { font-family: var(--font); background: var(--bg); color: var(--text); -webkit-font-smoothing: antialiased; }
a { color: var(--brand); text-decoration: none; }
a:hover { color: var(--brand-700); }
.lucide-icon { width: 18px; height: 18px; stroke-width: 2; vertical-align: -3px; flex-shrink: 0; }
.ltr { direction: ltr; unicode-bidi: embed; display: inline-block; }
.num { font-variant-numeric: tabular-nums; direction: ltr; unicode-bidi: isolate; }
.text-brand { color: var(--brand) !important; }
.text-gold { color: var(--gold) !important; }
.bg-brand { background: var(--brand) !important; color: #fff; }
.bg-gold { background: var(--gold) !important; color: #fff; }
.fw-800 { font-weight: 800; }

/* ---------- Buttons & forms ---------- */
.btn { border-radius: var(--radius-sm); font-weight: 700; display: inline-flex; align-items: center; justify-content: center; gap: .4rem; }
.btn-sm { border-radius: 8px; }
.btn-primary { --bs-btn-bg: var(--brand); --bs-btn-border-color: var(--brand); --bs-btn-hover-bg: var(--brand-600); --bs-btn-hover-border-color: var(--brand-600);
    --bs-btn-active-bg: var(--brand-700); --bs-btn-active-border-color: var(--brand-700); --bs-btn-disabled-bg: var(--brand); --bs-btn-disabled-border-color: var(--brand); }
.btn-outline-primary { --bs-btn-color: var(--brand); --bs-btn-border-color: var(--brand-100); --bs-btn-hover-bg: var(--brand); --bs-btn-hover-border-color: var(--brand);
    --bs-btn-active-bg: var(--brand-700); --bs-btn-active-border-color: var(--brand-700); }
.btn-gold { background: var(--gold); color: #fff; border-color: var(--gold); }
.btn-gold:hover { background: #9d8243; color: #fff; }
.btn-light { --bs-btn-bg: #fff; --bs-btn-border-color: var(--border); --bs-btn-hover-bg: var(--brand-50); --bs-btn-hover-border-color: var(--brand-100); }
.btn-icon { width: 40px; height: 40px; padding: 0; border: 0; background: transparent; border-radius: 10px; color: var(--text); }
.btn-icon:hover { background: var(--brand-50); color: var(--brand); }
.form-control, .form-select { border-radius: var(--radius-sm); border-color: var(--border); padding: .55rem .8rem; }
.form-control:focus, .form-select:focus { border-color: var(--brand); box-shadow: 0 0 0 .2rem rgba(17, 71, 58, .12); }
.form-label { font-weight: 700; font-size: .875rem; margin-bottom: .35rem; }
.form-text { font-size: .78rem; }
.form-check-input:checked { background-color: var(--brand); border-color: var(--brand); }
.form-switch .form-check-input { width: 2.5em; }
.input-group-text { background: var(--brand-50); border-color: var(--border); }
.required::after { content: ' *'; color: #dc3545; }

/* ---------- Cards ---------- */
.card { border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow-sm); background: var(--card); }
.card-header { background: transparent; border-bottom: 1px solid var(--border); padding: .9rem 1.1rem; font-weight: 700; display: flex; align-items: center; gap: .5rem; flex-wrap: wrap; }
.card-body { padding: 1.1rem; }

.stat-card { position: relative; padding: 1rem 1.1rem; display: flex; gap: .85rem; align-items: center; height: 100%; }
.stat-card .stat-icon { width: 46px; height: 46px; border-radius: 12px; display: grid; place-items: center; background: var(--brand-50); color: var(--brand); flex-shrink: 0; }
.stat-card .stat-icon.gold { background: var(--gold-50); color: var(--gold); }
.stat-card .stat-icon.red { background: #fdecec; color: #c0392b; }
.stat-card .stat-icon.blue { background: #e8f1fb; color: #1d6fb8; }
.stat-card .stat-label { color: var(--muted); font-size: .8rem; margin-bottom: .15rem; }
.stat-card .stat-value { font-size: 1.3rem; font-weight: 800; line-height: 1.2; }
.stat-card .stat-sub { font-size: .75rem; color: var(--muted); }

/* ---------- Tables ---------- */
.table { --bs-table-bg: transparent; margin-bottom: 0; vertical-align: middle; }
.table > thead th { font-size: .78rem; color: var(--muted); font-weight: 700; background: #f8faf9; border-bottom: 1px solid var(--border); white-space: nowrap; padding: .7rem .75rem; }
.table > tbody td { padding: .7rem .75rem; border-color: var(--border); }
.table-hover > tbody > tr:hover > * { --bs-table-bg-state: #f6faf8; }
.table-card { overflow: hidden; }
.table-responsive { border-radius: 0 0 var(--radius) var(--radius); }
.thumb { width: 44px; height: 44px; object-fit: cover; border-radius: 10px; background: var(--brand-50); border: 1px solid var(--border); }
.thumb-lg { width: 96px; height: 96px; object-fit: cover; border-radius: 14px; border: 1px solid var(--border); background: var(--brand-50); }

/* ---------- Badges ---------- */
.badge { font-weight: 700; padding: .4em .7em; border-radius: 999px; }
.badge-soft-primary { background: #e6eef9; color: #1f5fa8; }
.badge-soft-info { background: #e3f4f8; color: #137a91; }
.badge-soft-success { background: #e3f4ea; color: #1e7b45; }
.badge-soft-warning { background: #fdf3dc; color: #946200; }
.badge-soft-danger { background: #fde8e8; color: #b42318; }
.badge-soft-secondary { background: #eef0ef; color: #59625f; }
.badge-soft-dark { background: #e5e7e6; color: #2b3330; }
.badge-soft-purple { background: #efe8fb; color: #6b3fb8; }
.badge-soft-teal { background: #e0f3ef; color: #0f766e; }
.badge-soft-gold { background: var(--gold-50); color: #8a6d28; }

/* ---------- Admin bits (layout itself lives in mosaic.css) ---------- */
.avatar { width: 32px; height: 32px; border-radius: 50%; background: var(--brand); color: #fff; display: grid; place-items: center; font-weight: 800; font-size: .9rem; }

.notif-list { max-height: 360px; overflow-y: auto; }
.notif-item { display: flex; gap: .6rem; padding: .7rem 1rem; border-bottom: 1px solid var(--border); color: var(--text); font-size: .85rem; }
.notif-item:hover { background: var(--brand-50); }
.notif-item.unread { background: #fbf8ef; }
.notif-item .ni-icon { width: 32px; height: 32px; border-radius: 9px; display: grid; place-items: center; background: var(--brand-50); color: var(--brand); flex-shrink: 0; }

.page-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: .75rem; margin-bottom: 1.1rem; }
.page-head h2 { font-size: 1.25rem; font-weight: 800; margin: 0; }
.page-head .sub { color: var(--muted); font-size: .85rem; }
.toolbar { display: flex; flex-wrap: wrap; gap: .5rem; align-items: center; }
.filter-bar { display: flex; flex-wrap: wrap; gap: .5rem; padding: .85rem 1.1rem; border-bottom: 1px solid var(--border); background: #fcfdfd; }
.filter-bar .form-control, .filter-bar .form-select { min-width: 140px; flex: 1 1 160px; max-width: 260px; }

.flash-stack { margin-bottom: 1rem; }
.flash-stack .alert { border-radius: var(--radius-sm); border: 0; box-shadow: var(--shadow-sm); }
.alert-success { background: #e7f5ec; color: #17603a; }
.alert-danger { background: #fdecea; color: #8f1d14; }
.alert-warning { background: #fdf5e1; color: #7a5300; }
.alert-info { background: #e5f3f6; color: #0f5d70; }

.empty-state { text-align: center; padding: 3rem 1rem; }
.empty-state .empty-icon { width: 72px; height: 72px; border-radius: 20px; background: var(--brand-50); color: var(--brand); display: grid; place-items: center; margin: 0 auto 1rem; }
.empty-state .empty-icon .lucide-icon { width: 32px; height: 32px; }

.dl-grid { display: grid; grid-template-columns: max-content 1fr; gap: .45rem 1rem; font-size: .9rem; margin: 0; }
.dl-grid dt { color: var(--muted); font-weight: 400; }
.dl-grid dd { margin: 0; font-weight: 700; word-break: break-word; }

.timeline { list-style: none; padding: 0; margin: 0; }
.timeline li { position: relative; padding: 0 1.4rem .9rem 0; border-right: 2px solid var(--border); margin-right: .45rem; }
.timeline li::before { content: ''; position: absolute; right: -7px; top: 3px; width: 12px; height: 12px; border-radius: 50%; background: #fff; border: 3px solid var(--brand); }
.timeline li:last-child { border-color: transparent; }

.copy-box { display: flex; align-items: center; gap: .4rem; background: #f6f8f7; border: 1px dashed var(--brand-100); border-radius: 10px; padding: .35rem .5rem; }
.copy-box code { direction: ltr; color: var(--brand); font-size: .78rem; flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.rank-list { list-style: none; padding: 0; margin: 0; }
.rank-list li { display: flex; align-items: center; gap: .6rem; padding: .55rem 0; border-bottom: 1px dashed var(--border); font-size: .88rem; }
.rank-list li:last-child { border-bottom: 0; }
.rank-list .rank { width: 24px; height: 24px; border-radius: 7px; background: var(--brand-50); color: var(--brand); font-weight: 800; font-size: .75rem; display: grid; place-items: center; flex-shrink: 0; }

.perm-table td, .perm-table th { text-align: center; }
.perm-table td:first-child, .perm-table th:first-child { text-align: start; }
.nav-tabs .nav-link { font-weight: 700; color: var(--muted); border: 0; border-bottom: 2px solid transparent; }
.nav-tabs .nav-link.active { color: var(--brand); border-bottom-color: var(--brand); background: transparent; }
.nav-tabs { border-bottom: 1px solid var(--border); flex-wrap: nowrap; overflow-x: auto; overflow-y: hidden; }

.img-drop { border: 2px dashed var(--brand-100); border-radius: var(--radius); padding: 1rem; text-align: center; background: #fafcfb; cursor: pointer; position: relative; }
.img-drop img { max-width: 100%; max-height: 180px; border-radius: 10px; }
.img-drop input[type=file] { position: absolute; inset: 0; opacity: 0; cursor: pointer; }
.price-preview { background: var(--gold-50); border-radius: 10px; padding: .6rem .8rem; font-weight: 800; color: #6f5720; }

.step-bar { display: flex; gap: .5rem; margin-bottom: 1.25rem; flex-wrap: wrap; }
.step-bar .step { flex: 1; min-width: 120px; padding: .6rem .8rem; border-radius: 10px; background: #fff; border: 1px solid var(--border); font-size: .85rem; color: var(--muted); font-weight: 700; }
.step-bar .step.active { border-color: var(--brand); color: var(--brand); background: var(--brand-50); }
.step-bar .step.done { color: #1e7b45; }

.product-suggest { position: absolute; z-index: 1050; width: 100%; max-height: 320px; overflow-y: auto; background: #fff; border: 1px solid var(--border); border-radius: 12px; box-shadow: var(--shadow); margin-top: 4px; }
.product-suggest button { display: flex; width: 100%; gap: .6rem; align-items: center; padding: .55rem .75rem; border: 0; background: transparent; text-align: start; border-bottom: 1px solid var(--border); }
.product-suggest button:hover, .product-suggest button.focus { background: var(--brand-50); }

/* ---------- Auth ---------- */
.auth-body { min-height: 100vh; background: radial-gradient(1200px 600px at 100% 0%, var(--brand-50), transparent), radial-gradient(900px 500px at 0% 100%, var(--gold-50), transparent), var(--bg); }
.auth-wrap { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 1.5rem 1rem; }
.auth-card { width: 100%; max-width: 420px; background: #fff; border-radius: 20px; padding: 2rem 1.6rem; box-shadow: 0 20px 50px rgba(17, 71, 58, .1); border: 1px solid var(--border); }
.auth-logo { width: 120px; height: auto; }

/* ---------- Storefront ---------- */
.public-body { background: #f6f7f5; }
.store-header { position: sticky; top: 0; z-index: 1030; background: rgba(255, 255, 255, .96); backdrop-filter: blur(8px); border-bottom: 1px solid var(--border); }
.store-logo { width: 46px; height: 46px; object-fit: contain; }
.store-name { font-weight: 800; color: var(--brand); font-size: 1.1rem; }
.store-search { position: relative; max-width: 560px; }
.store-search .form-control { border-radius: 999px; padding-inline-start: 2.4rem; background: #f3f5f4; border-color: transparent; }
.store-search .form-control:focus { background: #fff; }
.store-search .search-icon { position: absolute; top: 50%; transform: translateY(-50%); inset-inline-start: .9rem; color: var(--muted); }
.cart-btn { position: relative; border-radius: 999px; padding: .5rem .9rem; }
.cart-count { background: var(--gold); color: #fff; border-radius: 999px; min-width: 22px; height: 22px; display: inline-grid; place-items: center; font-size: .75rem; padding: 0 6px; }
.lang-pill { display: inline-grid; place-items: center; width: 30px; height: 30px; border-radius: 50%; border: 1.5px solid var(--brand-100); font-weight: 800; font-size: .78rem; color: var(--brand); }
.lang-pill.light { border-color: rgba(255,255,255,.5); color: #fff; }

.section-title { display: flex; align-items: center; justify-content: space-between; margin: 2rem 0 1rem; }
.section-title h2 { font-size: 1.25rem; font-weight: 800; margin: 0; position: relative; padding-inline-start: .8rem; }
.section-title h2::before { content: ''; position: absolute; inset-inline-start: 0; top: 15%; bottom: 15%; width: 4px; border-radius: 4px; background: var(--gold); }



.chip-row { display: flex; gap: .5rem; overflow-x: auto; padding-bottom: .25rem; }
.chip { white-space: nowrap; border: 1px solid var(--border); background: #fff; color: var(--text); border-radius: 999px; padding: .4rem .9rem; font-size: .85rem; font-weight: 700; }
.chip.active, .chip:hover { background: var(--brand); color: #fff; border-color: var(--brand); }

.product-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .75rem; }
@media (min-width: 768px) { .product-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 1rem; } }
@media (min-width: 1200px) { .product-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); } }
.p-card { background: #fff; border: 1px solid var(--border); border-radius: 16px; overflow: hidden; display: flex; flex-direction: column; transition: box-shadow .15s, transform .15s; }
.p-card:hover { box-shadow: var(--shadow); }
.p-card .p-img { position: relative; aspect-ratio: 1/1; background: #f4f6f5; }
.p-card .p-img img { width: 100%; height: 100%; object-fit: cover; }
.p-card .p-badges { position: absolute; top: .5rem; inset-inline-start: .5rem; display: flex; flex-direction: column; gap: .25rem; align-items: flex-start; }
.p-card .p-body { padding: .7rem .75rem .8rem; display: flex; flex-direction: column; gap: .35rem; flex: 1; }

.p-card .p-name { font-weight: 800; font-size: .92rem; line-height: 1.35; min-height: 2.5em; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.p-card .p-meta { font-size: .72rem; color: var(--muted); direction: ltr; text-align: end; }
.p-card .p-price { font-weight: 800; color: var(--brand); font-size: 1.1rem; }
.p-card .p-price small { font-weight: 400; color: var(--muted); font-size: .7rem; }
.p-card .p-old { text-decoration: line-through; color: var(--muted); font-size: .78rem; }
.p-card .p-sub { font-size: .72rem; color: var(--muted); }
.p-card .p-actions { margin-top: auto; display: flex; gap: .4rem; align-items: center; }
.qty-stepper { display: inline-flex; align-items: center; border: 1px solid var(--border); border-radius: 10px; overflow: hidden; background: #fff; }
.qty-stepper button { width: 32px; height: 36px; border: 0; background: #f4f6f5; font-weight: 800; color: var(--brand); }
.qty-stepper input { width: 44px; height: 36px; border: 0; text-align: center; font-weight: 700; -moz-appearance: textfield; padding: 0; }
.qty-stepper input::-webkit-outer-spin-button, .qty-stepper input::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
.p-card .btn-add { flex: 1; padding: .45rem .5rem; font-size: .85rem; }
.p-card.out { opacity: .7; }
@media (max-width: 400px) { .p-card .p-actions { flex-direction: column; align-items: stretch; } .qty-stepper { justify-content: space-between; } .qty-stepper input { flex: 1; } }

.store-footer { background: var(--brand-700); color: #dfe9e5; margin-top: 3rem; }
.store-footer a { color: #fff; }

.cart-panel { --bs-offcanvas-width: 420px; }
.cart-line { display: flex; gap: .65rem; padding: .7rem 0; border-bottom: 1px solid var(--border); }
.cart-line img { width: 56px; height: 56px; border-radius: 10px; object-fit: cover; background: #f4f6f5; }
.cart-line .cl-name { font-weight: 700; font-size: .88rem; }
.cart-line .cl-price { font-size: .78rem; color: var(--muted); }
.cart-totals { background: #f8faf9; border-radius: 12px; padding: .75rem .9rem; font-size: .9rem; }
.cart-totals .row-t { display: flex; justify-content: space-between; padding: .2rem 0; }
.cart-totals .grand { font-weight: 800; font-size: 1.05rem; color: var(--brand); border-top: 1px dashed var(--border); margin-top: .35rem; padding-top: .5rem; }
.cart-warn { font-size: .75rem; color: #b42318; }

.customer-banner { background: linear-gradient(90deg, var(--brand) 0%, var(--brand-600) 100%); color: #fff; border-radius: 18px; padding: 1rem 1.2rem; margin-top: 1rem; display: flex; gap: 1rem; align-items: center; flex-wrap: wrap; }
.customer-banner .cb-icon { width: 48px; height: 48px; border-radius: 14px; background: rgba(255,255,255,.14); display: grid; place-items: center; }
.success-card { max-width: 560px; margin: 2rem auto; text-align: center; background: #fff; border-radius: 22px; padding: 2rem 1.5rem; border: 1px solid var(--border); box-shadow: var(--shadow); }
.success-card .ok-icon { width: 76px; height: 76px; border-radius: 50%; background: #e3f4ea; color: #1e7b45; display: grid; place-items: center; margin: 0 auto 1rem; }
.success-card .ok-icon .lucide-icon { width: 38px; height: 38px; }
.order-no { font-size: 1.6rem; font-weight: 800; color: var(--brand); letter-spacing: .03em; direction: ltr; }

/* ---------- Sales rep (mobile first) ---------- */
.sales-body { padding-bottom: 76px; background: var(--bg); }
.sales-header { background: var(--brand); position: sticky; top: 0; z-index: 1030; }
.sales-logo { width: 38px; height: 38px; background: #fff; border-radius: 10px; padding: 3px; object-fit: contain; }
.sales-admin-btn { display: inline-flex; align-items: center; gap: .4rem; height: 36px; padding: 0 .85rem; margin-inline-end: .25rem; border-radius: 10px;
  background: linear-gradient(135deg, #c4a65c, var(--gold)); color: #fff; font-size: .85rem; font-weight: 800; white-space: nowrap; text-decoration: none;
  box-shadow: 0 2px 8px rgb(0 0 0 / .18); transition: transform .15s ease, filter .15s ease; }
.sales-admin-btn:hover { color: #fff; transform: translateY(-1px); filter: brightness(1.06); }
.sales-admin-btn:focus-visible { outline: 2px solid #fff; outline-offset: 2px; }
.sales-admin-btn .lucide-icon { width: 17px; height: 17px; }
.sales-push-btn .push-on-ic { display: none; }
.sales-push-btn[data-state="on"] .push-on-ic { display: inline-block; color: #e9d29a; }
.sales-push-btn[data-state="on"] .push-off-ic { display: none; }
.sales-push-btn:disabled { opacity: .45; }
@media (max-width: 359.98px) { .sales-admin-btn span { display: none; } .sales-admin-btn { padding: 0 .6rem; } }
.sales-main { padding-top: 1rem; padding-bottom: 1rem; max-width: 1100px; }
.bottom-nav { position: fixed; bottom: 0; left: 0; right: 0; z-index: 1030; background: #fff; border-top: 1px solid var(--border); display: flex; padding-bottom: env(safe-area-inset-bottom); }
.bottom-nav a { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 2px; padding: .5rem 0 .45rem; font-size: .7rem; color: var(--muted); font-weight: 700; }
.bottom-nav a.active { color: var(--brand); }
.bottom-nav a.active .lucide-icon { color: var(--gold); }
.list-tile { display: flex; align-items: center; gap: .75rem; background: #fff; border: 1px solid var(--border); border-radius: 14px; padding: .8rem .9rem; margin-bottom: .6rem; color: var(--text); }
.list-tile:hover { border-color: var(--brand-100); color: var(--text); }
.list-tile .lt-icon { width: 42px; height: 42px; border-radius: 12px; background: var(--brand-50); color: var(--brand); display: grid; place-items: center; flex-shrink: 0; }
.sticky-cart-bar { position: fixed; bottom: 64px; left: .75rem; right: .75rem; z-index: 1029; background: var(--brand); color: #fff; border-radius: 14px; padding: .65rem .9rem; display: flex; align-items: center; gap: .75rem; box-shadow: 0 10px 30px rgba(10, 46, 37, .3); }
@media (min-width: 992px) { .sticky-cart-bar { left: auto; width: 380px; } }

/* ---------- Toasts / misc ---------- */
.toast-zone { position: fixed; bottom: 1rem; left: 50%; transform: translateX(-50%); z-index: 2000; display: flex; flex-direction: column; gap: .5rem; align-items: center; pointer-events: none; }
.app-toast { pointer-events: auto; background: var(--brand-700); color: #fff; padding: .6rem 1rem; border-radius: 12px; box-shadow: var(--shadow); font-size: .88rem; display: flex; align-items: center; gap: .5rem; animation: toastIn .2s ease-out; }
.app-toast.error { background: #b42318; }
@keyframes toastIn { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
.btn.is-loading { pointer-events: none; opacity: .75; }
.btn.is-loading::after { content: ''; width: 14px; height: 14px; border: 2px solid currentColor; border-right-color: transparent; border-radius: 50%; animation: spin .7s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

@keyframes sk { 0% { background-position: 100% 50%; } 100% { background-position: 0 50%; } }
.qr-box svg { width: 220px; height: 220px; }
.text-pre { white-space: pre-wrap; }

/* ---------- Print ---------- */
@media print {
    .ms-sidebar, .ms-header, .ms-footer, .ms-backdrop, .no-print, .bottom-nav, .store-header { display: none !important; }
    .ms-main { padding: 0; max-width: none; }

    body { background: #fff; }
    .card { box-shadow: none; border: 0; }
}

/* =====================================================================
   Product gallery — full-image tiles, name only; details open in a sheet.
   Designed mobile/tablet first.
   ===================================================================== */
.gallery-bar { display: flex; align-items: center; justify-content: space-between; gap: .75rem; margin-bottom: 1rem; }
.gallery-bar .chip-row { flex: 1; min-width: 0; padding-bottom: 2px; }

.layout-toggle { position: relative; flex-shrink: 0; display: inline-flex; border: 1px solid #1f2a27; border-radius: 6px; color: #1f2a27; overflow: hidden; background: #fff; }
.layout-toggle button { position: relative; z-index: 1; display: inline-flex; align-items: center; gap: .35rem; height: 38px; min-width: 42px; padding: 0 .8rem;
  border: 0; background: transparent; color: inherit; font-size: .8rem; font-weight: 700; transition: color .25s ease; justify-content: center; }
.layout-toggle button + button { border-inline-start: 1px solid currentColor; }
.layout-toggle button[aria-pressed="true"] { color: #fff; }
.layout-toggle button:not([aria-pressed="true"]):hover { background: rgb(15 23 42 / .08); }
.layout-toggle .lucide-icon { width: 16px; height: 16px; }
.layout-toggle .lt-indicator { position: absolute; z-index: 0; inset-block: 0; inset-inline-start: 0; width: 0; background: #111827;
  transition: transform .45s cubic-bezier(.22, 1.2, .36, 1), width .45s cubic-bezier(.22, 1.2, .36, 1); }
@media (max-width: 991.98px) { .layout-toggle button span { display: none; } }

/* grid sizes: large / medium / small */
.product-grid[data-gallery] { display: grid; gap: .75rem; }
.product-grid[data-layout="list"] { grid-template-columns: 1fr; }
.product-grid[data-layout="2col"] { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.product-grid[data-layout="4col"] { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: .5rem; }
@media (min-width: 576px) { .product-grid[data-layout="list"] { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (min-width: 768px) {
  .product-grid[data-gallery] { gap: 1rem; }
  .product-grid[data-layout="2col"] { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .product-grid[data-layout="4col"] { grid-template-columns: repeat(4, minmax(0, 1fr)); gap: .75rem; }
}
@media (min-width: 992px) { .product-grid[data-layout="list"] { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
@media (min-width: 1200px) {
  .product-grid[data-layout="2col"] { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .product-grid[data-layout="4col"] { grid-template-columns: repeat(6, minmax(0, 1fr)); }
}

/* tile */
.p-tile { position: relative; border-radius: 18px; overflow: hidden; background: #e9eeec; box-shadow: 0 1px 2px rgb(16 42 35 / .08), 0 4px 14px rgb(16 42 35 / .06);
  transition: transform .35s cubic-bezier(.22, 1.2, .36, 1), box-shadow .35s ease; will-change: transform; -webkit-tap-highlight-color: transparent; }
.p-tile-btn { all: unset; box-sizing: border-box; position: relative; display: block; width: 100%; aspect-ratio: 4 / 5; cursor: pointer; }
.p-tile-btn:focus-visible { outline: 3px solid var(--gold); outline-offset: -3px; border-radius: 18px; }
.p-tile img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; transition: transform .6s cubic-bezier(.22, 1, .36, 1); }
.p-tile-btn::after { content: ""; position: absolute; inset: 0; background: linear-gradient(to top, rgb(6 26 20 / .82) 0%, rgb(6 26 20 / .35) 26%, transparent 52%); pointer-events: none; }
.p-tile-name { position: absolute; z-index: 1; inset-inline: 0; bottom: 0; padding: .9rem .85rem .85rem; color: #fff; font-weight: 800; font-size: 1rem; line-height: 1.35;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; text-shadow: 0 1px 8px rgb(0 0 0 / .35); }
.p-tile-badges { position: absolute; z-index: 1; top: .6rem; inset-inline-start: .6rem; display: flex; flex-direction: column; gap: .3rem; align-items: flex-start; }
.p-tile-badges .badge { font-size: .7rem; padding: .35em .65em; box-shadow: 0 2px 6px rgb(0 0 0 / .15); }
.p-tile.out img { filter: grayscale(.85) brightness(.9); }
@media (hover: hover) {
  .p-tile:hover { transform: translateY(-3px); box-shadow: 0 12px 28px rgb(16 42 35 / .16); }
  .p-tile:hover img { transform: scale(1.06); }
}
.p-tile:active { transform: scale(.98); }
.product-grid[data-layout="list"] .p-tile-btn { aspect-ratio: 1 / 1; }
.product-grid[data-layout="list"] .p-tile-name { font-size: 1.15rem; padding: 1.1rem; }
.product-grid[data-layout="4col"] .p-tile { border-radius: 14px; }
.product-grid[data-layout="4col"] .p-tile-name { font-size: .82rem; padding: .6rem .6rem .55rem; }
.product-grid[data-layout="4col"] .p-tile-badges .badge { font-size: .62rem; }
@media (min-width: 768px) { .p-tile-name { font-size: 1.05rem; } }

/* details sheet */
.p-sheet { padding: 0; border: 0; background: transparent; max-width: none; max-height: none; width: 100%; height: 100%; margin: 0; inset: 0; overflow: hidden; }
.p-sheet::backdrop { background: rgb(6 26 20 / .55); backdrop-filter: blur(3px); }
.p-sheet[open] { display: flex; align-items: flex-end; justify-content: center; }
.p-sheet-inner { position: relative; width: 100%; max-height: 92vh; background: #fff; border-radius: 24px 24px 0 0; overflow-y: auto; overscroll-behavior: contain;
  box-shadow: 0 -10px 40px rgb(0 0 0 / .2); padding-bottom: env(safe-area-inset-bottom); animation: sheetUp .38s cubic-bezier(.22, 1.1, .36, 1); }
.p-sheet.closing .p-sheet-inner { animation: sheetDown .22s ease-in forwards; }
@keyframes sheetUp { from { transform: translateY(100%); } }
@keyframes sheetDown { to { transform: translateY(100%); } }
.p-sheet-grip { position: absolute; z-index: 3; top: 8px; left: 50%; translate: -50% 0; width: 44px; height: 5px; border-radius: 3px; background: rgb(255 255 255 / .85); box-shadow: 0 1px 3px rgb(0 0 0 / .2); }
.p-sheet-close { position: absolute; z-index: 3; top: 14px; inset-inline-end: 14px; width: 40px; height: 40px; border-radius: 50%; border: 0; background: rgb(255 255 255 / .92);
  display: grid; place-items: center; box-shadow: 0 2px 10px rgb(0 0 0 / .15); color: var(--text); }
.p-sheet-media { position: relative; aspect-ratio: 4 / 3; background: #e9eeec; }
.p-sheet-media img { width: 100%; height: 100%; object-fit: cover; display: block; }
.p-sheet-body { padding: 1.1rem 1.25rem 1.4rem; display: flex; flex-direction: column; gap: .55rem; }
.p-sheet-cat { color: var(--gold); font-weight: 800; font-size: .8rem; }
.p-sheet-name { font-size: 1.35rem; font-weight: 800; margin: 0; line-height: 1.35; }
.p-sheet-badges { display: flex; gap: .35rem; flex-wrap: wrap; }
.p-sheet-badges:empty { display: none; }
.p-sheet-price { display: flex; align-items: baseline; gap: .6rem; flex-wrap: wrap; }
.p-sheet-price span { font-size: 1.9rem; font-weight: 800; color: var(--brand); line-height: 1.1; }
.p-sheet-price s { color: var(--muted); font-size: 1rem; }
.p-sheet-tax { font-size: .82rem; color: var(--muted); font-weight: 700; margin-top: -.25rem; }
.p-sheet-tax:empty { display: none; }
.p-sheet-desc { color: #46524e; font-size: .92rem; line-height: 1.7; margin: .15rem 0 0; white-space: pre-line; }
.p-sheet-desc:empty { display: none; }
.p-sheet-facts { list-style: none; padding: 0; margin: .2rem 0 0; display: flex; flex-wrap: wrap; gap: .4rem; }
.p-sheet-facts:empty { display: none; }
.p-sheet-facts li { background: #f3f6f5; border-radius: 999px; padding: .35rem .75rem; font-size: .8rem; font-weight: 700; color: #3c4744; }
.p-sheet-facts li.offer { background: #fde8e8; color: #b42318; flex-basis: 100%; border-radius: 12px; }
.p-offer { color: #b42318; font-weight: 700; margin-top: .15rem; }
.p-sheet-facts li.warn { background: #fdecea; color: #b42318; }
.p-sheet-actions { display: flex; gap: .6rem; align-items: stretch; margin-top: .6rem; position: sticky; bottom: 0; background: #fff; padding: .6rem 0 .1rem; }
.qty-stepper.qty-lg button { width: 46px; height: 50px; font-size: 1.2rem; }
.qty-stepper.qty-lg input { width: 56px; height: 50px; font-size: 1.05rem; }
.p-sheet-actions .btn-lg { border-radius: 14px; font-size: 1rem; min-height: 50px; white-space: nowrap; }
@media (min-width: 768px) {
  .p-sheet[open] { align-items: center; padding: 2rem; }
  .p-sheet-inner { max-width: 560px; border-radius: 24px; animation: sheetPop .32s cubic-bezier(.22, 1.1, .36, 1); max-height: 88vh; }
  .p-sheet-media { aspect-ratio: 16 / 11; }
  .p-sheet-grip { display: none; }
  .p-sheet.closing .p-sheet-inner { animation: sheetFade .18s ease-in forwards; }
  @keyframes sheetPop { from { opacity: 0; transform: scale(.94) translateY(12px); } }
  @keyframes sheetFade { to { opacity: 0; transform: scale(.97); } }
}
@media (min-width: 992px) {
  .p-sheet-inner { max-width: 880px; display: grid; grid-template-columns: 1fr 1fr; max-height: 86vh; }
  .p-sheet.closing .p-sheet-inner { animation: sheetFade .18s ease-in forwards; }
  .p-sheet-grip { display: none; }
  .p-sheet-media { aspect-ratio: auto; min-height: 100%; }
  .p-sheet-body { padding: 2rem 1.75rem; justify-content: center; }
  .p-sheet-name { font-size: 1.6rem; }
  @keyframes sheetPop { from { opacity: 0; transform: scale(.94) translateY(12px); } }
  @keyframes sheetFade { to { opacity: 0; transform: scale(.97); } }
}

/* storefront header on phones: search on its own row */
@media (max-width: 575.98px) {
  .store-header .container { flex-wrap: wrap; row-gap: .5rem; }
  .store-header .store-search { order: 3; flex-basis: 100%; max-width: none; }
  .store-header .container > .d-flex:last-child { margin-inline-start: auto; }

  .section-title { margin: 1.4rem 0 .75rem; }
  .customer-banner { padding: .9rem; }
}
@media (min-width: 576px) and (max-width: 1199.98px) {   /* tablets */
  .store-search .form-control { height: 44px; }
}
@media (prefers-reduced-motion: reduce) {
  .p-tile, .p-tile img, .layout-toggle .lt-indicator, .p-sheet-inner { transition: none !important; animation: none !important; }
}

.chip-row, .cat-scroller { scrollbar-width: none; -webkit-overflow-scrolling: touch; }
.chip-row::-webkit-scrollbar, .cat-scroller::-webkit-scrollbar { display: none; }


/* ---------- Categories: small rounded squares that show the category photo ---------- */
.cat-scroller.cat-squares { display: flex; gap: .7rem; overflow-x: auto; padding: .3rem .15rem .5rem; scroll-snap-type: x proximity; }
.cat-squares .cat-card { flex: 0 0 auto; width: 76px; display: flex; flex-direction: column; align-items: center; gap: .4rem;
  color: var(--text); text-align: center; scroll-snap-align: start; -webkit-tap-highlight-color: transparent; }
.cat-squares .cat-card:hover { color: var(--text); }
.cat-squares .cat-img { position: relative; width: 76px; height: 76px; border-radius: 12px; overflow: hidden; display: grid; place-items: center;
  background: var(--brand-50); color: var(--brand); border: 1px solid var(--border); box-shadow: var(--shadow-sm);
  transition: transform .18s ease, box-shadow .18s ease, border-color .18s ease; }
.cat-squares .cat-img.has-photo { background: #fff; }
.cat-squares .cat-img img { width: 100%; height: 100%; object-fit: cover; display: block; }
.cat-squares .cat-img .lucide-icon { width: 28px; height: 28px; }
.cat-squares .cat-card:hover .cat-img { transform: translateY(-2px); box-shadow: var(--shadow); }
.cat-squares .cat-card:active .cat-img { transform: scale(.96); }
.cat-squares .cat-name { font-size: .8rem; font-weight: 700; line-height: 1.3; max-width: 100%;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.cat-squares .cat-card.active .cat-img { border-color: var(--brand); box-shadow: 0 0 0 2px var(--brand); }
.cat-squares .cat-card.active .cat-name { color: var(--brand); font-weight: 800; }
.cat-squares .cat-clear { position: absolute; top: 4px; inset-inline-end: 4px; width: 20px; height: 20px; border-radius: 50%;
  background: var(--brand); color: #fff; display: grid; place-items: center; box-shadow: 0 1px 3px rgb(0 0 0 / .25); }
.cat-squares .cat-clear .lucide-icon { width: 12px; height: 12px; stroke-width: 3; }
@media (min-width: 768px) {
  .cat-squares .cat-card { width: 92px; }
  .cat-squares .cat-img { width: 92px; height: 92px; }
  .cat-squares .cat-name { font-size: .86rem; }
}
@media (prefers-reduced-motion: reduce) { .cat-squares .cat-img { transition: none; } }
.public-body main > .container { padding-top: .25rem; }

/* customer page: share of purchases */
.share-row + .share-row { margin-top: .7rem; }
.share-bar { height: 8px; border-radius: 999px; background: var(--brand-50); overflow: hidden; }
.share-bar i { display: block; height: 100%; border-radius: inherit; background: linear-gradient(90deg, var(--brand), var(--gold)); }
.promo-customers { max-height: 320px; overflow-y: auto; }
.promo-customers label[hidden] { display: none !important; }
