/* =====================================================================
   ubaru+ — نظام التصميم المشترك (نفس الهوية الزجاجية للمنصة السابقة)
   ===================================================================== */

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    -webkit-tap-highlight-color: transparent;
    font-family: 'IBM Plex Sans Arabic', system-ui, -apple-system, 'Segoe UI', Tahoma, sans-serif;
}

i, .fa, .fas, .far, .fal, .fab, .fa-solid, .fa-regular, .fa-brands {
    font-family: 'Font Awesome 6 Free', 'Font Awesome 5 Free', 'Font Awesome 6 Pro', sans-serif;
    font-style: normal;
    font-weight: 900;
    -webkit-font-smoothing: antialiased;
}

.far, .fa-regular { font-weight: 400; }
.fab, .fa-brands { font-family: 'Font Awesome 6 Brands', 'Font Awesome 5 Brands', sans-serif; }

:root {
    --primary: #FF3D00;
    --primary-light: #FF9E80;
    --primary-dark: #DD2C00;
    --primary-glass: rgba(255, 61, 0, 0.12);
    --bg-body: #F0F2F5;
    --glass-surface: rgba(255, 255, 255, 0.65);
    --card-surface: rgba(255, 255, 255, 0.82);
    --glass-border: rgba(255, 255, 255, 0.8);
    --glass-highlight: rgba(255, 255, 255, 0.9);
    --text-main: #1A1D23;
    --text-secondary: #586274;
    --text-muted: #949BA8;
    --line: rgba(0, 0, 0, 0.06);
    --success: #2ecc71;
    --success-dark: #27ae60;
    --whatsapp: #25D366;
    --danger: #e74c3c;
    --warning: #f39c12;
    --info: #3498db;
    --shadow-sm: 0 8px 24px rgba(149, 157, 165, 0.08);
    --shadow-md: 0 15px 35px rgba(149, 157, 165, 0.14);
    --shadow-lg: 0 25px 50px rgba(149, 157, 165, 0.2);
    --shadow-glass: 0 8px 32px 0 rgba(31, 38, 135, 0.06);
    --radius-xl: 28px;
    --radius-lg: 22px;
    --radius-md: 16px;
    --radius-sm: 12px;
    --transition: all 0.35s cubic-bezier(0.25, 0.8, 0.25, 1);
    --blur: blur(22px);
    --safe-top: env(safe-area-inset-top, 0px);
    --safe-bottom: env(safe-area-inset-bottom, 0px);
    --nav-h: 64px;
    --bar-h: 68px;
}

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

body {
    background-color: var(--bg-body);
    background-image: radial-gradient(at 0% 0%, rgba(255, 61, 0, 0.08) 0px, transparent 50%),
        radial-gradient(at 100% 0%, rgba(52, 152, 219, 0.08) 0px, transparent 50%),
        radial-gradient(at 100% 100%, rgba(255, 61, 0, 0.05) 0px, transparent 50%);
    background-attachment: fixed;
    color: var(--text-main);
    direction: rtl;
    overflow-x: hidden;
    min-height: 100vh;
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
    overscroll-behavior-y: none;
}

body.no-scroll { overflow: hidden; }

img { max-width: 100%; display: block; }
a { color: inherit; text-decoration: none; }
button { font: inherit; color: inherit; background: none; border: none; cursor: pointer; }
input, select, textarea { font: inherit; color: inherit; }
[hidden], .hidden { display: none !important; }

::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--primary-light); border-radius: 10px; }

.glass {
    background: var(--glass-surface);
    -webkit-backdrop-filter: var(--blur);
    backdrop-filter: var(--blur);
    border: 1px solid var(--glass-border);
    box-shadow: var(--shadow-glass);
}

/* ---------------- Splash / Loader ---------------- */
#loader {
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(240, 242, 245, 0.92);
    -webkit-backdrop-filter: blur(40px);
    backdrop-filter: blur(40px);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    z-index: 9999;
    transition: opacity .4s ease, visibility .4s ease;
}
#loader.hidden-soft { opacity: 0; visibility: hidden; }
.loader-logo {
    width: 110px; height: 110px;
    border-radius: 50%;
    margin-bottom: 28px;
    box-shadow: 0 20px 50px rgba(11, 19, 43, 0.35);
    animation: float 3s ease-in-out infinite;
}
.spinner {
    width: 44px; height: 44px;
    border: 3px solid rgba(255, 61, 0, 0.12);
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: spin 1s cubic-bezier(0.68, -0.55, 0.265, 1.55) infinite;
}
.spinner.sm { width: 22px; height: 22px; border-width: 2px; }
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes float { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-10px); } }
@keyframes fadeInUp { from { opacity: 0; transform: translateY(16px); } to { opacity: 1; transform: translateY(0); } }
@keyframes slideUp { from { transform: translateY(100%); } to { transform: translateY(0); } }
@keyframes pop { 0% { transform: scale(1); } 40% { transform: scale(1.25); } 100% { transform: scale(1); } }
@keyframes pulse { 0%, 100% { box-shadow: 0 0 0 0 rgba(255, 61, 0, .45); } 70% { box-shadow: 0 0 0 12px rgba(255, 61, 0, 0); } }
@keyframes shimmer { 100% { transform: translateX(-100%); } }

/* ---------------- Top navbar ---------------- */
.navbar {
    position: fixed;
    top: calc(10px + var(--safe-top));
    right: 12px;
    left: 12px;
    height: var(--nav-h);
    background: rgba(255, 255, 255, 0.78);
    -webkit-backdrop-filter: var(--blur);
    backdrop-filter: var(--blur);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-xl);
    z-index: 1000;
    padding: 0 14px;
    display: flex;
    align-items: center;
    gap: 10px;
    box-shadow: var(--shadow-glass);
    transition: var(--transition);
}
.logo {
    display: flex;
    align-items: center;
    gap: 10px;
    min-width: 0;
}
.logo img { width: 40px; height: 40px; border-radius: 50%; box-shadow: 0 4px 12px rgba(11, 19, 43, .3); flex: 0 0 auto; }
.logo-text { font-weight: 800; font-size: 1.25rem; letter-spacing: -0.5px; white-space: nowrap; }
.logo-text b { color: var(--primary); }
.nav-title { font-weight: 800; font-size: 1.05rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; flex: 1; min-width: 0; }
.nav-spacer { flex: 1; }
.nav-icons { display: flex; gap: 6px; align-items: center; }
.icon-btn {
    position: relative;
    width: 40px; height: 40px;
    border-radius: 50%;
    font-size: 1.1rem;
    color: var(--text-main);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition);
    flex: 0 0 auto;
}
.icon-btn:active { transform: scale(.92); background: var(--primary-glass); color: var(--primary); }
.icon-btn.solid { background: rgba(255, 255, 255, .9); box-shadow: var(--shadow-sm); }
.badge-dot {
    position: absolute;
    top: 2px; left: 2px;
    min-width: 18px; height: 18px;
    padding: 0 4px;
    background: var(--primary);
    color: #fff;
    font-size: .65rem;
    font-weight: 800;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 1.5px solid #fff;
    box-shadow: 0 2px 8px rgba(255, 61, 0, .4);
}
.badge-dot.bump { animation: pop .4s ease; }
.loc-chip {
    display: flex;
    align-items: center;
    gap: 6px;
    min-width: 0;
    flex: 1;
    padding: 6px 10px;
    border-radius: 14px;
    font-size: .8rem;
    color: var(--text-secondary);
    transition: var(--transition);
}
.loc-chip i { color: var(--primary); }
.loc-chip span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.loc-chip:active { background: var(--primary-glass); }

/* ---------------- Page layout ---------------- */
.page {
    padding: calc(var(--nav-h) + 22px + var(--safe-top)) 0 calc(var(--bar-h) + 40px + var(--safe-bottom));
    max-width: 1280px;
    margin: 0 auto;
    min-height: 100vh;
    animation: fadeInUp .35s ease;
}
.page.no-nav { padding-top: calc(12px + var(--safe-top)); }
.wrap { padding: 0 16px; }
.section { margin: 26px 0 8px; }
.section-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    padding: 0 16px;
    margin-bottom: 14px;
}
.section-title {
    font-size: 1.3rem;
    font-weight: 800;
    position: relative;
    padding-bottom: 6px;
}
.section-title::after {
    content: '';
    position: absolute;
    bottom: 0;
    right: 0;
    width: 36px;
    height: 4px;
    background: var(--primary);
    border-radius: 10px;
}
.section-link { color: var(--primary); font-weight: 700; font-size: .85rem; white-space: nowrap; }

/* ---------------- Hero slider ---------------- */
.hero {
    margin: 0 16px;
    height: 210px;
    border-radius: var(--radius-xl);
    position: relative;
    overflow: hidden;
    box-shadow: var(--shadow-lg);
    background: linear-gradient(135deg, var(--primary), #ff7a45);
}
.hero-slide {
    position: absolute;
    top: 0; left: 0; right: 0; bottom: 0;
    opacity: 0;
    transition: opacity .7s ease;
}
.hero-slide.active { opacity: 1; }
.hero-slide img { width: 100%; height: 100%; object-fit: cover; transform: scale(1.04); transition: transform 6s ease; }
.hero-slide.active img { transform: scale(1); }
.hero-content {
    position: absolute;
    bottom: 0; right: 0; left: 0;
    padding: 26px 22px 34px;
    background: linear-gradient(to top, rgba(0, 0, 0, .78) 0%, rgba(0, 0, 0, .35) 60%, transparent 100%);
    color: #fff;
}
.hero-title { font-size: 1.45rem; font-weight: 800; line-height: 1.3; text-shadow: 0 4px 15px rgba(0, 0, 0, .3); }
.hero-sub { font-size: .92rem; opacity: .92; margin-top: 4px; }
.hero-dots { position: absolute; bottom: 12px; left: 0; right: 0; display: flex; justify-content: center; gap: 6px; }
.hero-dots span { width: 7px; height: 7px; border-radius: 10px; background: rgba(255, 255, 255, .5); transition: var(--transition); }
.hero-dots span.active { width: 22px; background: #fff; }

/* ---------------- Search ---------------- */
.search-box {
    margin: 16px;
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 0 16px;
    height: 52px;
    border-radius: 18px;
    background: var(--card-surface);
    border: 1px solid var(--glass-border);
    box-shadow: var(--shadow-sm);
    color: var(--text-muted);
}
.search-box i { color: var(--primary); }
.search-box input { flex: 1; min-width: 0; border: none; outline: none; background: transparent; font-size: 16px; color: var(--text-main); }

/* ---------------- Categories ---------------- */
.cat-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 12px 8px;
    padding: 0 12px;
}
.cat-tile {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 7px;
    text-align: center;
    transition: var(--transition);
}
.cat-tile:active { transform: scale(.94); }
.cat-icon {
    width: 62px; height: 62px;
    border-radius: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    color: #fff;
    box-shadow: 0 10px 22px rgba(0, 0, 0, .12);
    position: relative;
    overflow: hidden;
}
.cat-icon img { width: 100%; height: 100%; object-fit: cover; }
.cat-icon::after {
    content: '';
    position: absolute;
    top: 0; left: 0; right: 0;
    height: 50%;
    background: linear-gradient(to bottom, rgba(255, 255, 255, .28), transparent);
}
.cat-name { font-size: .76rem; font-weight: 700; line-height: 1.25; color: var(--text-main); }

.chips {
    display: flex;
    overflow-x: auto;
    gap: 10px;
    padding: 4px 16px 10px;
    scrollbar-width: none;
    -webkit-overflow-scrolling: touch;
}
.chips::-webkit-scrollbar { display: none; }
.chip {
    flex: 0 0 auto;
    display: inline-flex;
    align-items: center;
    gap: 7px;
    padding: 8px 15px;
    border-radius: 50px;
    background: var(--card-surface);
    border: 1px solid var(--glass-border);
    box-shadow: var(--shadow-sm);
    font-weight: 700;
    font-size: .85rem;
    white-space: nowrap;
    transition: var(--transition);
}
.chip i { color: var(--primary); }
.chip.active { background: var(--primary); color: #fff; border-color: transparent; box-shadow: 0 8px 18px rgba(255, 61, 0, .3); }
.chip.active i { color: #fff; }
.chip .count { font-size: .7rem; background: rgba(0, 0, 0, .08); border-radius: 10px; padding: 0 7px; }
.chip.active .count { background: rgba(255, 255, 255, .25); }
.sticky-chips {
    position: -webkit-sticky;
    position: sticky;
    top: calc(var(--nav-h) + 14px + var(--safe-top));
    z-index: 50;
    padding-top: 8px;
    background: linear-gradient(to bottom, var(--bg-body) 70%, transparent);
}

/* ---------------- Store cards ---------------- */
.h-scroll {
    display: flex;
    overflow-x: auto;
    gap: 14px;
    padding: 4px 16px 16px;
    scroll-snap-type: x mandatory;
    scrollbar-width: none;
    -webkit-overflow-scrolling: touch;
}
.h-scroll::-webkit-scrollbar { display: none; }
.h-scroll > * { scroll-snap-align: start; flex: 0 0 78%; max-width: 330px; }
.store-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 16px;
    padding: 0 16px;
}
.store-card {
    background: var(--card-surface);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-lg);
    overflow: hidden;
    box-shadow: var(--shadow-sm);
    transition: var(--transition);
    position: relative;
    display: block;
}
.store-card:active { transform: scale(.98); }
.store-cover {
    height: 130px;
    position: relative;
    background: linear-gradient(135deg, #ffd6c9, #ffe9e1);
    overflow: hidden;
}
.store-cover img { width: 100%; height: 100%; object-fit: cover; }
.store-cover .cover-icon {
    position: absolute;
    top: 50%; left: 50%;
    transform: translate(-50%, -50%);
    font-size: 2.6rem;
    color: rgba(255, 255, 255, .85);
}
.store-closed {
    position: absolute;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(26, 29, 35, .55);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 800;
    gap: 6px;
}
.store-tags { position: absolute; top: 10px; right: 10px; display: flex; gap: 6px; flex-wrap: wrap; }
.tag {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 3px 10px;
    border-radius: 20px;
    font-size: .72rem;
    font-weight: 700;
    background: rgba(255, 255, 255, .92);
    color: var(--text-main);
    box-shadow: 0 2px 8px rgba(0, 0, 0, .08);
}
.tag.primary { background: var(--primary); color: #fff; }
.tag.green { background: rgba(46, 204, 113, .14); color: var(--success-dark); }
.tag.red { background: rgba(231, 76, 60, .12); color: var(--danger); }
.tag.gray { background: rgba(0, 0, 0, .06); color: var(--text-secondary); }
.tag.orange { background: rgba(243, 156, 18, .15); color: #c67c00; }
.store-body { padding: 12px 14px 14px; display: flex; gap: 12px; align-items: flex-start; }
.store-logo {
    width: 54px; height: 54px;
    border-radius: 16px;
    object-fit: cover;
    background: #fff;
    border: 3px solid #fff;
    box-shadow: var(--shadow-sm);
    margin-top: -34px;
    flex: 0 0 auto;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.3rem;
    color: #fff;
    position: relative;
    overflow: hidden;
}
.store-logo img { width: 100%; height: 100%; object-fit: cover; }
.store-info { flex: 1; min-width: 0; }
.store-name { font-weight: 800; font-size: 1.02rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.store-meta { display: flex; flex-wrap: wrap; gap: 4px 12px; color: var(--text-secondary); font-size: .78rem; margin-top: 3px; }
.store-meta i { color: var(--text-muted); margin-left: 3px; }
.store-meta .star { color: #f5a623; }

/* ---------------- Store page ---------------- */
.store-hero {
    margin: 0 16px;
    border-radius: var(--radius-xl);
    overflow: hidden;
    position: relative;
    height: 200px;
    box-shadow: var(--shadow-lg);
    background: linear-gradient(135deg, var(--primary), #ff8a65);
}
.store-hero img.cover { width: 100%; height: 100%; object-fit: cover; }
.store-hero .hero-content { padding-bottom: 18px; }
.store-head {
    margin: -38px 26px 0;
    position: relative;
    z-index: 2;
    display: flex;
    align-items: flex-end;
    gap: 12px;
}
.store-head { align-items: flex-start; }
.store-head > .grow { margin-top: 44px; }
.store-head .store-logo { width: 78px; height: 78px; border-radius: 22px; margin: 0; font-size: 2rem; }
.store-title { font-size: 1.4rem; font-weight: 800; line-height: 1.3; }
.store-desc { color: var(--text-secondary); font-size: .92rem; margin-top: 8px; }
.actions-row { display: flex; gap: 10px; overflow-x: auto; padding: 14px 16px 6px; scrollbar-width: none; }
.actions-row::-webkit-scrollbar { display: none; }
.action-btn {
    flex: 1 0 auto;
    min-width: 68px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    padding: 10px 8px;
    border-radius: 18px;
    background: var(--card-surface);
    border: 1px solid var(--glass-border);
    box-shadow: var(--shadow-sm);
    font-size: .74rem;
    font-weight: 700;
    transition: var(--transition);
}
.action-btn i { font-size: 1.25rem; color: var(--primary); }
.action-btn.wa i { color: var(--whatsapp); }
.action-btn.fav.active i { color: var(--danger); }
.action-btn:active { transform: scale(.94); }
.info-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; padding: 8px 16px; }
.info-cell {
    background: var(--card-surface);
    border: 1px solid var(--glass-border);
    border-radius: 16px;
    padding: 10px 12px;
    font-size: .8rem;
    color: var(--text-secondary);
}
.info-cell b { display: block; color: var(--text-main); font-size: .92rem; }

/* ---------------- Products ---------------- */
.products-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
    padding: 0 16px;
}
.product-card {
    background: var(--card-surface);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-lg);
    overflow: hidden;
    box-shadow: var(--shadow-sm);
    display: flex;
    flex-direction: column;
    position: relative;
    transition: var(--transition);
}
.product-img {
    width: 100%;
    height: 132px;
    object-fit: cover;
    background: linear-gradient(135deg, #f6f6f6, #ececec);
    cursor: zoom-in;
}
.product-img.placeholder { display: flex; align-items: center; justify-content: center; font-size: 2rem; color: #d0d4da; cursor: default; }
.product-content { padding: 10px 12px 12px; display: flex; flex-direction: column; flex: 1; }
.product-name { font-size: .92rem; font-weight: 800; line-height: 1.35; }
.product-desc { color: var(--text-secondary); font-size: .76rem; line-height: 1.45; margin-top: 3px; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.product-footer { display: flex; justify-content: space-between; align-items: center; margin-top: auto; padding-top: 10px; gap: 6px; }
.price { font-size: 1.05rem; font-weight: 800; color: var(--primary); white-space: nowrap; }
.price small { font-size: .7rem; color: var(--text-muted); font-weight: 600; margin-right: 2px; }
.price-old { font-size: .74rem; color: var(--text-muted); text-decoration: line-through; display: block; line-height: 1; }
.product-card .ribbon { position: absolute; top: 8px; right: 8px; }
.product-card.unavailable { opacity: .55; }
.add-btn {
    width: 36px; height: 36px;
    border-radius: 12px;
    background: var(--primary);
    color: #fff;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 6px 14px rgba(255, 61, 0, .3);
    transition: var(--transition);
    flex: 0 0 auto;
}
.add-btn:active { transform: scale(.88); }
.stepper {
    display: inline-flex;
    align-items: center;
    background: var(--primary-glass);
    border-radius: 12px;
    padding: 3px;
    gap: 2px;
}
.stepper button {
    width: 30px; height: 30px;
    border-radius: 9px;
    background: #fff;
    color: var(--primary);
    font-weight: 800;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 2px 6px rgba(0, 0, 0, .06);
}
.stepper button:active { transform: scale(.88); }
.stepper span { min-width: 24px; text-align: center; font-weight: 800; color: var(--primary-dark); }

/* ---------------- Bottom navigation (app bar) ---------------- */
.bottom-bar {
    position: fixed;
    bottom: calc(12px + var(--safe-bottom));
    right: 12px;
    left: 12px;
    height: var(--bar-h);
    background: rgba(255, 255, 255, 0.82);
    -webkit-backdrop-filter: var(--blur);
    backdrop-filter: var(--blur);
    border: 1px solid var(--glass-border);
    display: flex;
    justify-content: space-around;
    align-items: center;
    padding: 0 6px;
    z-index: 1001;
    box-shadow: 0 10px 40px rgba(31, 38, 135, .12);
    border-radius: 26px;
}
/* طلب قيد التنفيذ: الزبون في صفحة التتبع فقط حتى يستلمه — لا شريط تنقل ولا سلة */
body.order-locked .bottom-bar, body.order-locked [data-open-cart], body.order-locked #cart-peek { display: none !important; }
body.order-locked .page { padding-bottom: calc(24px + var(--safe-bottom)); }
.bar-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    color: var(--text-muted);
    transition: var(--transition);
    flex: 1;
    height: calc(100% - 12px);
    border-radius: 20px;
    position: relative;
    min-width: 0;
}
.bar-item i { font-size: 1.2rem; margin-bottom: 3px; transition: var(--transition); }
.bar-item span { font-size: .66rem; font-weight: 700; white-space: nowrap; }
.bar-item.active { color: var(--primary); background: var(--primary-glass); }
.bar-item.active i { transform: translateY(-2px); }
.bar-item:active i { transform: scale(.85); }
.bar-item .badge-dot { top: 4px; left: 50%; margin-left: -22px; }
.bar-fab {
    flex: 0 0 auto;
    width: 58px; height: 58px;
    margin-top: -30px;
    border-radius: 20px;
    background: linear-gradient(135deg, var(--primary), #ff6e40);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.35rem;
    box-shadow: 0 12px 26px rgba(255, 61, 0, .42);
    border: 4px solid rgba(255, 255, 255, .95);
    position: relative;
    transition: var(--transition);
}
.bar-fab:active { transform: scale(.9); }
.bar-fab .badge-dot { top: -8px; left: -8px; }

/* ---------------- Drawer (cart) ---------------- */
.drawer {
    position: fixed;
    top: 0; bottom: 0;
    right: 0;
    width: 100%;
    background: rgba(255, 255, 255, 0.94);
    -webkit-backdrop-filter: blur(30px);
    backdrop-filter: blur(30px);
    box-shadow: var(--shadow-lg);
    z-index: 1100;
    transform: translateX(105%);
    transition: transform .38s cubic-bezier(0.25, 0.8, 0.25, 1);
    display: flex;
    flex-direction: column;
    padding-top: var(--safe-top);
}
.drawer.open { transform: translateX(0); }
.drawer-head {
    padding: 18px 18px 14px;
    display: flex;
    align-items: center;
    gap: 10px;
    border-bottom: 1px solid var(--line);
}
.drawer-title { font-size: 1.25rem; font-weight: 800; flex: 1; }
.drawer-body { flex: 1; overflow-y: auto; padding: 16px; -webkit-overflow-scrolling: touch; }
.drawer-foot { padding: 16px 18px calc(16px + var(--safe-bottom)); border-top: 1px solid var(--line); background: #fff; }
.overlay {
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0, 0, 0, .25);
    -webkit-backdrop-filter: blur(6px);
    backdrop-filter: blur(6px);
    z-index: 1050;
    opacity: 0;
    visibility: hidden;
    transition: var(--transition);
}
.overlay.show { opacity: 1; visibility: visible; }

.line-item {
    display: flex;
    gap: 12px;
    align-items: center;
    padding: 12px;
    background: rgba(255, 255, 255, .75);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-md);
    margin-bottom: 10px;
    box-shadow: var(--shadow-sm);
}
.line-item img, .line-item .ph {
    width: 58px; height: 58px;
    border-radius: 14px;
    object-fit: cover;
    flex: 0 0 auto;
    background: #f1f1f1;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #cfd3d8;
}
.line-item .grow { flex: 1; min-width: 0; }
.line-item .name { font-weight: 700; font-size: .92rem; }
.totals { display: flex; flex-direction: column; gap: 6px; font-size: .92rem; }
.totals .row { display: flex; justify-content: space-between; color: var(--text-secondary); }
.totals .row.total { color: var(--text-main); font-weight: 800; font-size: 1.15rem; padding-top: 8px; border-top: 1px dashed rgba(0, 0, 0, .12); }

/* ---------------- Modal / bottom sheet ---------------- */
.modal {
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(26, 29, 35, .28);
    -webkit-backdrop-filter: blur(10px);
    backdrop-filter: blur(10px);
    z-index: 2000;
    display: flex;
    align-items: flex-end;
    justify-content: center;
    opacity: 0;
    transition: opacity .25s ease;
}
.modal.show { opacity: 1; }
.modal-box {
    background: rgba(255, 255, 255, 0.97);
    width: 100%;
    max-height: 92vh;
    max-height: 92dvh;
    border-radius: 28px 28px 0 0;
    box-shadow: 0 -20px 60px rgba(0, 0, 0, .15);
    display: flex;
    flex-direction: column;
    transform: translateY(100%);
    transition: transform .32s cubic-bezier(0.25, 0.8, 0.25, 1);
    padding-bottom: var(--safe-bottom);
}
.modal.show .modal-box { transform: translateY(0); }
.modal-box::before {
    content: '';
    display: block;
    width: 42px; height: 5px;
    border-radius: 5px;
    background: rgba(0, 0, 0, .12);
    margin: 10px auto 0;
    flex: 0 0 auto;
}
.modal-head { padding: 12px 20px 8px; display: flex; align-items: center; gap: 10px; }
.modal-title { font-size: 1.2rem; font-weight: 800; flex: 1; }
.modal-body { padding: 8px 20px 12px; overflow-y: auto; -webkit-overflow-scrolling: touch; flex: 1; }
.modal-foot { padding: 12px 20px 16px; display: flex; gap: 10px; border-top: 1px solid var(--line); }
.modal-foot > * { flex: 1; }
.modal.center .modal-box { text-align: center; }
.alert-icon { font-size: 2.8rem; margin: 6px 0 10px; }

/* ---------------- Forms ---------------- */
.form-group { margin-bottom: 14px; }
.form-label { display: block; font-weight: 700; font-size: .85rem; margin-bottom: 6px; color: var(--text-secondary); }
.form-label .req { color: var(--danger); }
.form-hint { font-size: .75rem; color: var(--text-muted); margin-top: 5px; }
.form-input {
    width: 100%;
    padding: 13px 16px;
    border: 1px solid rgba(0, 0, 0, 0.1);
    border-radius: var(--radius-md);
    outline: none;
    background: rgba(255, 255, 255, 0.85);
    transition: var(--transition);
    font-size: 16px; /* يمنع التكبير التلقائي في iOS */
    -webkit-appearance: none;
    appearance: none;
}
.form-input:focus { border-color: var(--primary); box-shadow: 0 0 0 4px rgba(255, 61, 0, 0.1); background: #fff; }
textarea.form-input { resize: vertical; min-height: 80px; }
select.form-input {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8'%3E%3Cpath d='M1 1l5 5 5-5' stroke='%23949BA8' stroke-width='2' fill='none'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: left 16px center;
    padding-left: 38px;
}
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.input-icon { position: relative; }
.input-icon i { position: absolute; right: 16px; top: 50%; transform: translateY(-50%); color: var(--text-muted); pointer-events: none; }
.input-icon .form-input { padding-right: 44px; }

.seg {
    display: flex;
    background: rgba(0, 0, 0, .05);
    border-radius: 16px;
    padding: 4px;
    gap: 4px;
}
.seg button {
    flex: 1;
    padding: 11px 6px;
    border-radius: 12px;
    font-weight: 700;
    font-size: .88rem;
    color: var(--text-secondary);
    transition: var(--transition);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
}
.seg button.active { background: #fff; color: var(--primary); box-shadow: 0 4px 12px rgba(0, 0, 0, .08); }
.seg button:disabled { opacity: .4; cursor: not-allowed; }
.seg.big button { flex-direction: column; padding: 14px 6px; gap: 4px; }
.seg.big button i { font-size: 1.35rem; }

.switch { position: relative; display: inline-block; width: 50px; height: 30px; flex: 0 0 auto; }
.switch input { opacity: 0; width: 0; height: 0; }
.switch span {
    position: absolute;
    top: 0; left: 0; right: 0; bottom: 0;
    background: #d5d9df;
    border-radius: 30px;
    transition: var(--transition);
}
.switch span::before {
    content: '';
    position: absolute;
    width: 24px; height: 24px;
    right: 3px; top: 3px;
    background: #fff;
    border-radius: 50%;
    box-shadow: 0 2px 6px rgba(0, 0, 0, .2);
    transition: var(--transition);
}
.switch input:checked + span { background: var(--success); }
.switch input:checked + span::before { transform: translateX(-20px); }
.toggle-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px 0; border-bottom: 1px solid var(--line); }
.toggle-row:last-child { border-bottom: none; }
.toggle-row .t { font-weight: 700; font-size: .92rem; }
.toggle-row .d { font-size: .76rem; color: var(--text-muted); }

.file-pick {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px;
    border: 1.5px dashed rgba(0, 0, 0, .15);
    border-radius: var(--radius-md);
    cursor: pointer;
    background: rgba(255, 255, 255, .6);
}
.file-pick .preview {
    width: 64px; height: 64px;
    border-radius: 14px;
    background: #f1f1f1 center/cover no-repeat;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #c5c9cf;
    font-size: 1.4rem;
    flex: 0 0 auto;
}
.file-pick input { display: none; }
.file-pick .t { font-weight: 700; font-size: .88rem; }
.file-pick .d { font-size: .74rem; color: var(--text-muted); }

/* ---------------- Buttons ---------------- */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 13px 20px;
    border-radius: 60px;
    font-weight: 700;
    font-size: .95rem;
    transition: var(--transition);
    white-space: nowrap;
    border: 1px solid transparent;
    min-height: 46px;
}
.btn:active { transform: scale(.97); }
.btn:disabled { opacity: .55; cursor: not-allowed; transform: none; }
.btn-primary { background: var(--primary); color: #fff; box-shadow: 0 8px 20px rgba(255, 61, 0, 0.3); }
.btn-ghost { background: rgba(255, 255, 255, .7); color: var(--text-secondary); border-color: rgba(0, 0, 0, .1); }
.btn-soft { background: var(--primary-glass); color: var(--primary-dark); }
.btn-success { background: var(--success); color: #fff; box-shadow: 0 8px 20px rgba(46, 204, 113, .3); }
.btn-wa { background: var(--whatsapp); color: #fff; box-shadow: 0 8px 20px rgba(37, 211, 102, .3); }
.btn-danger { background: rgba(231, 76, 60, .1); color: var(--danger); }
.btn-dark { background: var(--text-main); color: #fff; }
.btn-block { width: 100%; }
.btn-lg { padding: 16px 22px; font-size: 1.05rem; min-height: 54px; }
.btn-sm { padding: 7px 14px; font-size: .8rem; min-height: 34px; }
.btn-row { display: flex; gap: 8px; flex-wrap: wrap; }
.btn-row > .btn { flex: 1 1 auto; }
@media (hover: hover) {
    .btn-primary:hover { background: var(--primary-dark); transform: translateY(-2px); }
    .store-card:hover, .product-card:hover { transform: translateY(-4px); box-shadow: var(--shadow-md); }
    .icon-btn:hover { background: var(--primary-glass); color: var(--primary); }
    .chip:hover { border-color: var(--primary-light); }
}

/* ---------------- Toast ---------------- */
.toast-wrap {
    position: fixed;
    top: calc(84px + var(--safe-top));
    left: 50%;
    transform: translateX(-50%);
    z-index: 10000;
    display: flex;
    flex-direction: column;
    gap: 8px;
    pointer-events: none;
    width: calc(100% - 32px);
    max-width: 420px;
    align-items: center;
}
.toast {
    background: rgba(26, 29, 35, .92);
    color: #fff;
    padding: 12px 20px;
    border-radius: 50px;
    font-size: .9rem;
    font-weight: 600;
    box-shadow: 0 10px 30px rgba(0, 0, 0, .2);
    opacity: 0;
    transform: translateY(-16px);
    transition: all .3s cubic-bezier(0.68, -0.55, 0.265, 1.55);
    display: flex;
    align-items: center;
    gap: 10px;
    pointer-events: auto;
}
.toast.show { opacity: 1; transform: translateY(0); }
.toast.success { background: linear-gradient(135deg, var(--success), var(--success-dark)); }
.toast.error { background: linear-gradient(135deg, var(--danger), #c0392b); }
.toast.info { background: linear-gradient(135deg, var(--primary), var(--primary-dark)); }
.toast button { color: #fff; font-weight: 800; text-decoration: underline; margin-right: 6px; }

/* ---------------- Cards, lists, misc ---------------- */
.card {
    background: var(--card-surface);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
    padding: 16px;
}
.card + .card { margin-top: 12px; }
.card-title { font-weight: 800; font-size: 1rem; margin-bottom: 10px; display: flex; align-items: center; gap: 8px; }
.card-title i { color: var(--primary); }
.list { background: var(--card-surface); border: 1px solid var(--glass-border); border-radius: var(--radius-lg); overflow: hidden; box-shadow: var(--shadow-sm); }
.list-item {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 15px 16px;
    border-bottom: 1px solid var(--line);
    transition: var(--transition);
    width: 100%;
    text-align: right;
}
.list-item:last-child { border-bottom: none; }
.list-item:active { background: var(--primary-glass); }
.list-item .li-icon {
    width: 38px; height: 38px;
    border-radius: 12px;
    background: var(--primary-glass);
    color: var(--primary);
    display: flex;
    align-items: center;
    justify-content: center;
    flex: 0 0 auto;
}
.list-item .grow { flex: 1; min-width: 0; font-weight: 700; }
.list-item .grow small { display: block; font-weight: 500; color: var(--text-muted); font-size: .76rem; }
.list-item .fa-chevron-left { color: var(--text-muted); font-size: .8rem; }

.empty { text-align: center; padding: 50px 24px; color: var(--text-muted); }
.empty > i { font-size: 3.2rem; color: rgba(0, 0, 0, .1); margin-bottom: 14px; display: block; }
.empty h4 { color: var(--text-main); font-size: 1.05rem; margin-bottom: 4px; }
.empty .btn { margin-top: 16px; }

.skeleton { position: relative; overflow: hidden; background: #e8eaee; border-radius: 16px; }
.skeleton::after {
    content: '';
    position: absolute;
    top: 0; left: 0; right: 0; bottom: 0;
    transform: translateX(100%);
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, .6), transparent);
    animation: shimmer 1.3s infinite;
}

.muted { color: var(--text-muted); }
.text-sm { font-size: .82rem; }
.text-xs { font-size: .72rem; }
.bold { font-weight: 800; }
.center { text-align: center; }
.row { display: flex; align-items: center; gap: 10px; }
.row.between { justify-content: space-between; }
.row.wrap { flex-wrap: wrap; }
.grow { flex: 1; min-width: 0; }
.mt-1 { margin-top: 6px; } .mt-2 { margin-top: 12px; } .mt-3 { margin-top: 20px; }
.mb-1 { margin-bottom: 6px; } .mb-2 { margin-bottom: 12px; } .mb-3 { margin-bottom: 20px; }
.ellipsis { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.divider { height: 1px; background: var(--line); margin: 14px 0; }
.ltr { direction: ltr; unicode-bidi: embed; display: inline-block; }

.tabs { display: flex; gap: 6px; background: rgba(0, 0, 0, .05); border-radius: 16px; padding: 4px; margin: 0 16px 14px; }
.tabs button { flex: 1; padding: 10px; border-radius: 12px; font-weight: 700; font-size: .88rem; color: var(--text-secondary); position: relative; }
.tabs button.active { background: #fff; color: var(--primary); box-shadow: 0 4px 12px rgba(0, 0, 0, .08); }
.tabs .badge-dot { position: static; display: inline-flex; margin-right: 6px; border: none; }

.status-pill {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 4px 12px;
    border-radius: 20px;
    font-size: .75rem;
    font-weight: 800;
    white-space: nowrap;
}

/* ---------------- Orders ---------------- */
.order-card { padding: 14px; }
.order-card .top { display: flex; align-items: center; gap: 12px; }
.order-card .logo-sm {
    width: 46px; height: 46px;
    border-radius: 14px;
    object-fit: cover;
    background: var(--primary-glass);
    color: var(--primary);
    display: flex;
    align-items: center;
    justify-content: center;
    flex: 0 0 auto;
    overflow: hidden;
}
.order-card .logo-sm img { width: 100%; height: 100%; object-fit: cover; }
.order-card .items-line { font-size: .8rem; color: var(--text-secondary); margin-top: 10px; line-height: 1.5; }
.order-card .bottom { display: flex; justify-content: space-between; align-items: center; margin-top: 12px; padding-top: 10px; border-top: 1px dashed rgba(0, 0, 0, .1); gap: 8px; flex-wrap: wrap; }
.order-card.new { border: 2px solid var(--primary); animation: pulse 1.6s infinite; }

.steps { display: flex; justify-content: space-between; position: relative; margin: 18px 4px 6px; }
.steps::before { content: ''; position: absolute; top: 17px; right: 18px; left: 18px; height: 4px; background: #e5e7eb; border-radius: 4px; }
.steps .bar { position: absolute; top: 17px; right: 18px; height: 4px; background: var(--primary); border-radius: 4px; transition: width .6s ease; }
.step { position: relative; z-index: 1; display: flex; flex-direction: column; align-items: center; gap: 6px; width: 20%; text-align: center; }
.step .dot {
    width: 38px; height: 38px;
    border-radius: 50%;
    background: #fff;
    border: 3px solid #e5e7eb;
    color: var(--text-muted);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: .9rem;
    transition: var(--transition);
}
.step.done .dot { background: var(--primary); border-color: var(--primary); color: #fff; }
.step.current .dot { animation: pulse 1.6s infinite; }
.step span { font-size: .66rem; font-weight: 700; color: var(--text-muted); line-height: 1.25; }
.step.done span { color: var(--text-main); }

.stars { display: flex; gap: 8px; justify-content: center; direction: ltr; }
.stars button { font-size: 2rem; color: #dfe3e8; transition: var(--transition); }
.stars button.on { color: #f5a623; transform: scale(1.08); }

/* ---------------- Maps ---------------- */
.map-picker { position: relative; height: 290px; border-radius: var(--radius-lg); overflow: hidden; border: 1px solid rgba(0, 0, 0, .08); background: #e9eef2; }
.map-picker .map-canvas { position: absolute; top: 0; left: 0; right: 0; bottom: 0; z-index: 1; }
.map-center-pin {
    position: absolute;
    top: 50%; left: 50%;
    transform: translate(-50%, -100%);
    z-index: 500;
    font-size: 2.4rem;
    color: var(--primary);
    pointer-events: none;
    filter: drop-shadow(0 6px 6px rgba(0, 0, 0, .3));
    transition: transform .2s ease;
}
.map-picker.dragging .map-center-pin { transform: translate(-50%, -120%); }
.map-center-pin::after {
    content: '';
    position: absolute;
    bottom: -5px; left: 50%;
    width: 12px; height: 5px;
    margin-left: -6px;
    background: rgba(0, 0, 0, .25);
    border-radius: 50%;
}
.map-tools { position: absolute; bottom: 12px; left: 12px; z-index: 600; display: flex; flex-direction: column; gap: 8px; }
.map-tools button {
    width: 44px; height: 44px;
    border-radius: 14px;
    background: #fff;
    color: var(--primary);
    box-shadow: 0 6px 16px rgba(0, 0, 0, .15);
    font-size: 1.1rem;
}
.map-hint {
    position: absolute;
    top: 10px; right: 10px; left: 10px;
    z-index: 600;
    background: rgba(26, 29, 35, .78);
    color: #fff;
    font-size: .76rem;
    padding: 7px 12px;
    border-radius: 12px;
    text-align: center;
    pointer-events: none;
    transition: opacity .3s;
}
.map-picker.has-value .map-hint { opacity: 0; }
.map-status { font-size: .8rem; margin-top: 8px; display: flex; gap: 6px; align-items: flex-start; color: var(--text-secondary); }
.map-status.ok { color: var(--success-dark); }
.map-status.err { color: var(--danger); }
.map-view { height: 230px; border-radius: var(--radius-lg); overflow: hidden; border: 1px solid rgba(0, 0, 0, .08); position: relative; z-index: 1; }
.ub-marker {
    width: 38px; height: 38px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    border: 3px solid #fff;
    box-shadow: 0 6px 14px rgba(0, 0, 0, .3);
}
.ub-marker i { transform: none; font-size: 1rem; }
.leaflet-container { font-family: inherit !important; }

/* ---------------- Stats (dashboards) ---------------- */
.stats { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; padding: 0 16px; }
.stat {
    background: var(--card-surface);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-lg);
    padding: 14px;
    box-shadow: var(--shadow-sm);
    position: relative;
    overflow: hidden;
}
.stat .ic {
    width: 38px; height: 38px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--primary-glass);
    color: var(--primary);
    margin-bottom: 8px;
}
.stat .v { font-size: 1.35rem; font-weight: 800; line-height: 1.2; }
.stat .l { font-size: .76rem; color: var(--text-muted); font-weight: 600; }
.bars { display: flex; align-items: flex-end; gap: 4px; height: 120px; padding-top: 10px; }
.bars div { flex: 1; background: linear-gradient(to top, var(--primary), var(--primary-light)); border-radius: 6px 6px 2px 2px; min-height: 3px; position: relative; }
.bars-labels { display: flex; gap: 4px; margin-top: 6px; }
.bars-labels span { flex: 1; text-align: center; font-size: .6rem; color: var(--text-muted); }

.banner-note {
    margin: 0 16px 14px;
    padding: 12px 14px;
    border-radius: var(--radius-md);
    display: flex;
    gap: 10px;
    align-items: flex-start;
    font-size: .85rem;
    font-weight: 600;
}
.banner-note.warn { background: rgba(243, 156, 18, .12); color: #9a6000; }
.banner-note.err { background: rgba(231, 76, 60, .1); color: #b03a2e; }
.banner-note.ok { background: rgba(46, 204, 113, .12); color: #1e8449; }
.banner-note.info { background: rgba(52, 152, 219, .1); color: #1f6fa8; }
.banner-note i { margin-top: 3px; }

/* ---------------- مركز الإشعارات: خطوات التشغيل في الخلفية ---------------- */
.notif-guides details { border: 1px solid var(--line); border-radius: var(--radius-md); padding: 8px 12px; margin-bottom: 8px; background: var(--card-surface); }
.notif-guides summary { cursor: pointer; font-weight: 700; font-size: .9rem; }
.notif-guides ol { margin: 8px 0 2px; padding-right: 20px; padding-left: 0; font-size: .84rem; line-height: 1.9; color: var(--text-secondary); }
.notif-guides li { margin-bottom: 4px; }
.notif-broadcast { border: 1px solid var(--line); border-radius: var(--radius-md); padding: 10px 12px; background: var(--primary-glass); }

/* ---------------- مؤقت التجهيز والتغليف ---------------- */
.order-timer { display: flex; align-items: center; gap: 10px; margin: 10px 0 0; padding: 10px 12px; border-radius: var(--radius-md); background: rgba(255, 152, 0, .1); color: #8a5300; font-size: .84rem; font-weight: 600; text-align: right; }
.order-timer > i { font-size: 1.35rem; color: #FF9800; }
.order-timer [data-left] { font-size: 1.05rem; font-weight: 800; font-variant-numeric: tabular-nums; color: #e67e00; flex: 0 0 auto; margin-right: 8px; }
.timer-bar { height: 6px; border-radius: 6px; background: rgba(255, 152, 0, .18); overflow: hidden; margin-top: 6px; }
.timer-bar span { display: block; height: 100%; background: #FF9800; border-radius: inherit; transition: width 1s linear; }

/* ---------------- إيصال الطلب: يُطبع من الصفحة نفسها (باسم التطبيق والمحل المستفيد) ---------------- */
#print-area { display: none; }
.receipt { width: 72mm; margin: 0 auto; font-family: Tahoma, Arial, sans-serif; font-size: 12px; line-height: 1.5; color: #000; direction: rtl; }
.receipt h2 { text-align: center; margin: 2px 0; font-size: 18px; }
.receipt .c { text-align: center; }
.receipt hr { border: 0; border-top: 1px dashed #000; margin: 6px 0; }
.receipt .box { border: 1px solid #000; border-radius: 4px; padding: 4px 6px; margin: 4px 0 6px; text-align: center; }
.receipt .big { font-size: 15px; font-weight: bold; }
.receipt table { width: 100%; border-collapse: collapse; }
.receipt td { padding: 3px 0; border-bottom: 1px dashed #999; vertical-align: top; }
.receipt td.n { text-align: left; white-space: nowrap; padding-right: 6px; }
.receipt .t td { font-weight: bold; border: 0; }
.page-break { page-break-after: always; break-after: page; }
@media print {
    @page { margin: 3mm; }
    body.printing { background: #fff !important; padding: 0 !important; margin: 0 !important; }
    body.printing > *:not(#print-area) { display: none !important; }
    body.printing #print-area { display: block; }
}

/* ---------------- Install banner ---------------- */
.install-banner {
    position: fixed;
    right: 12px; left: 12px;
    bottom: calc(var(--bar-h) + 24px + var(--safe-bottom));
    z-index: 1500;
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 14px;
    border-radius: 22px;
    background: rgba(26, 29, 35, .94);
    color: #fff;
    box-shadow: 0 16px 40px rgba(0, 0, 0, .25);
    transform: translateY(160%);
    transition: transform .45s cubic-bezier(0.25, 0.8, 0.25, 1);
}
.install-banner.show { transform: translateY(0); }
.install-banner img { width: 44px; height: 44px; border-radius: 12px; }
.install-banner .t { font-weight: 800; font-size: .92rem; }
.install-banner .d { font-size: .74rem; opacity: .75; }
.install-banner .x { color: rgba(255, 255, 255, .6); width: 30px; height: 30px; }
body.no-bar .install-banner { bottom: calc(20px + var(--safe-bottom)); }
.ios-steps { text-align: right; display: flex; flex-direction: column; gap: 12px; margin: 10px 0; }
.ios-steps div { display: flex; gap: 12px; align-items: center; background: rgba(0, 0, 0, .04); padding: 12px; border-radius: 14px; font-weight: 600; font-size: .9rem; }
.ios-steps i { width: 34px; height: 34px; border-radius: 10px; background: #fff; color: #007AFF; display: flex; align-items: center; justify-content: center; flex: 0 0 auto; }

/* ---------------- Image viewer ---------------- */
.img-viewer {
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0, 0, 0, .88);
    z-index: 3000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}
.img-viewer img { max-width: 100%; max-height: 85vh; border-radius: 20px; }

/* ---------------- Offline indicator ---------------- */
.offline-bar {
    position: fixed;
    top: 0; left: 0; right: 0;
    z-index: 9000;
    background: var(--text-main);
    color: #fff;
    text-align: center;
    font-size: .78rem;
    font-weight: 700;
    padding: calc(4px + var(--safe-top)) 10px 4px;
    transform: translateY(-110%);
    transition: transform .3s ease;
}
.offline-bar.show { transform: translateY(0); }

/* ---------------- Fallbacks for older phones ---------------- */
@supports not ((backdrop-filter: blur(1px)) or (-webkit-backdrop-filter: blur(1px))) {
    .navbar, .bottom-bar { background: rgba(255, 255, 255, .97); }
    .modal { background: rgba(26, 29, 35, .5); }
    .drawer { background: #fff; }
}
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; }
}

/* ---------------- Larger screens ---------------- */
@media (min-width: 600px) {
    .cat-grid { grid-template-columns: repeat(6, 1fr); }
    .store-grid { grid-template-columns: repeat(2, 1fr); }
    .products-grid { grid-template-columns: repeat(3, 1fr); }
    .stats { grid-template-columns: repeat(4, 1fr); }
    .h-scroll > * { flex-basis: 300px; }
    .hero, .store-hero { height: 280px; }
    .hero-title { font-size: 2rem; }
    .modal { align-items: center; }
    .modal-box { width: 92%; max-width: 520px; border-radius: 28px; transform: translateY(30px) scale(.97); }
    .modal-box::before { display: none; }
    .modal.show .modal-box { transform: none; }
    .drawer { width: 420px; }
    .install-banner { max-width: 440px; right: auto; left: 50%; transform: translate(-50%, 160%); }
    .install-banner.show { transform: translate(-50%, 0); }
}
@media (min-width: 1024px) {
    .cat-grid { grid-template-columns: repeat(8, 1fr); }
    .store-grid { grid-template-columns: repeat(3, 1fr); }
    .products-grid { grid-template-columns: repeat(4, 1fr); }
    .bottom-bar { max-width: 560px; left: 0; right: 0; margin: 0 auto; }
    .navbar { max-width: 1280px; margin: 0 auto; }
    .hero, .store-hero { height: 340px; }
}

/* ---------------- Dashboard layout (merchant / driver / admin) ---------------- */
.dash-side { display: none; }
@media (min-width: 1024px) {
    body.dash .bottom-bar { display: none; }
    body.dash .page { padding-right: 270px; padding-bottom: 40px; max-width: none; }
    body.dash .navbar { right: 270px; max-width: none; }
    .dash-side {
        display: flex;
        flex-direction: column;
        position: fixed;
        top: 10px; bottom: 10px; right: 10px;
        width: 248px;
        z-index: 1002;
        padding: 18px 12px;
        border-radius: var(--radius-xl);
        background: rgba(255, 255, 255, .82);
        -webkit-backdrop-filter: var(--blur);
        backdrop-filter: var(--blur);
        border: 1px solid var(--glass-border);
        box-shadow: var(--shadow-glass);
        gap: 4px;
        overflow-y: auto;
    }
    .dash-side .logo { padding: 0 8px 16px; }
    .dash-side a {
        display: flex;
        align-items: center;
        gap: 12px;
        padding: 12px 14px;
        border-radius: 16px;
        font-weight: 700;
        color: var(--text-secondary);
        transition: var(--transition);
        position: relative;
    }
    .dash-side a i { width: 20px; text-align: center; }
    .dash-side a.active { background: var(--primary); color: #fff; box-shadow: 0 8px 18px rgba(255, 61, 0, .3); }
    .dash-side a:not(.active):hover { background: var(--primary-glass); color: var(--primary); }
    .dash-side a .badge-dot { position: static; margin-right: auto; border: none; }
}

/* ---------------- Customer extras ---------------- */
.cart-peek {
    position: fixed;
    right: 16px; left: 16px;
    bottom: calc(var(--bar-h) + 26px + var(--safe-bottom));
    z-index: 990;
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    border-radius: 20px;
    background: linear-gradient(135deg, var(--primary), #ff6e40);
    color: #fff;
    box-shadow: 0 14px 30px rgba(255, 61, 0, .38);
    font-weight: 800;
    animation: fadeInUp .3s ease;
}
.cart-peek .cnt { background: rgba(255, 255, 255, .25); border-radius: 10px; padding: 2px 10px; }
.cart-peek:active { transform: scale(.98); }
.join-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; padding: 0 16px; }
.join-card {
    border-radius: var(--radius-lg);
    padding: 16px;
    color: #fff;
    position: relative;
    overflow: hidden;
    box-shadow: var(--shadow-md);
    min-height: 130px;
    display: flex;
    flex-direction: column;
    justify-content: flex-end;
    transition: var(--transition);
}
.join-card:active { transform: scale(.97); }
.join-card.store { background: linear-gradient(135deg, #0B132B, #1C2541); }
.join-card.driver { background: linear-gradient(135deg, var(--primary), #ff8a50); }
.join-card i.bg { position: absolute; top: 10px; left: 12px; font-size: 3.2rem; opacity: .18; }
.join-card .t { font-weight: 800; font-size: 1.02rem; }
.join-card .d { font-size: .75rem; opacity: .85; }
.profile-card { display: flex; align-items: center; gap: 14px; }
.avatar {
    width: 58px; height: 58px;
    border-radius: 50%;
    background: linear-gradient(135deg, #0B132B, #1C2541);
    color: #F2C94C;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 800;
    font-size: 1.3rem;
    flex: 0 0 auto;
}
.notif-item { display: flex; gap: 12px; padding: 14px 16px; border-bottom: 1px solid var(--line); }
.notif-item.unread { background: var(--primary-glass); }
.notif-item .ic { width: 38px; height: 38px; border-radius: 12px; background: #fff; color: var(--primary); display: flex; align-items: center; justify-content: center; flex: 0 0 auto; box-shadow: var(--shadow-sm); }
.result-row { display: flex; align-items: center; gap: 12px; padding: 10px 16px; }
.result-row img, .result-row .ph { width: 52px; height: 52px; border-radius: 14px; object-fit: cover; background: #eee; flex: 0 0 auto; display: flex; align-items: center; justify-content: center; color: #bbb; }
.brand-gradient { background: linear-gradient(135deg, #F2C94C, #26D0CE); -webkit-background-clip: text; background-clip: text; color: transparent; }

/* ================= المصحات: الأطباء وحجز المواعيد ================= */
.doc-card { display: flex; align-items: center; gap: 12px; padding: 12px 14px; }
.doc-card.off { opacity: .55; }
.doc-card .grow { flex: 1; min-width: 0; }
.doc-photo { border-radius: 50%; object-fit: cover; flex: 0 0 auto; background: #eef3f8; box-shadow: 0 0 0 3px #fff, var(--shadow-sm); }
.doc-photo.ph { display: flex; align-items: center; justify-content: center; color: #0288D1; background: linear-gradient(135deg, #e1f1fb, #f4f9fd); font-size: 1.4rem; }
.result-row .doc-photo, .result-row .doc-photo.ph { border-radius: 50%; }
.doc-name { font-weight: 800; font-size: .98rem; }
.doc-spec { font-size: .8rem; color: #0277BD; font-weight: 700; margin-top: 1px; }
.doc-meta { display: flex; flex-wrap: wrap; gap: 4px 12px; margin-top: 6px; font-size: .74rem; color: var(--text-secondary); }
.doc-meta i { color: var(--text-muted); margin-left: 4px; }
.col-actions { display: flex; flex-direction: column; align-items: center; gap: 6px; }
.day-strip { display: flex; gap: 8px; overflow-x: auto; padding: 2px 0 8px; scrollbar-width: none; }
.day-strip::-webkit-scrollbar { display: none; }
.day-btn { flex: 0 0 auto; min-width: 62px; padding: 8px 6px; border-radius: 16px; background: rgba(0, 0, 0, .04); border: 2px solid transparent; display: flex; flex-direction: column; align-items: center; gap: 2px; font-size: .72rem; color: var(--text-secondary); font-weight: 700; transition: var(--transition); }
.day-btn b { font-size: 1.15rem; color: var(--text-main); }
.day-btn.active { background: var(--primary-glass); border-color: var(--primary); color: var(--primary); }
.day-btn.active b { color: var(--primary); }
.slot-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(84px, 1fr)); gap: 8px; }
.slot-btn { padding: 10px 4px; border-radius: 12px; background: #fff; border: 1.5px solid rgba(0, 0, 0, .08); font-weight: 800; font-size: .85rem; direction: rtl; transition: var(--transition); }
.slot-btn:disabled { background: rgba(0, 0, 0, .04); color: var(--text-muted); text-decoration: line-through; border-color: transparent; cursor: not-allowed; }
.slot-btn.active { background: var(--primary); border-color: var(--primary); color: #fff; box-shadow: 0 8px 18px rgba(255, 61, 0, .3); }
.appt-when { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 14px; margin: 10px 0 6px; padding: 8px 12px; border-radius: 12px; background: rgba(2, 136, 209, .08); color: #01579B; font-weight: 800; font-size: .88rem; }
.appt-when i { margin-left: 6px; }
.appt-card .top { display: flex; align-items: center; gap: 12px; }
.appt-time { width: 58px; height: 52px; border-radius: 14px; background: rgba(2, 136, 209, .1); color: #0277BD; display: flex; align-items: center; justify-content: center; flex: 0 0 auto; font-size: .82rem; text-align: center; line-height: 1.2; }
.day-head { display: flex; align-items: center; gap: 8px; font-weight: 800; margin: 16px 2px 8px; color: var(--text-secondary); }
.day-head i { color: var(--primary); }
.sched { display: flex; flex-direction: column; gap: 6px; }
.sched-day { display: flex; align-items: flex-start; gap: 10px; padding: 8px 10px; border-radius: 14px; background: rgba(0, 0, 0, .03); }
.sched-day.on { background: rgba(2, 136, 209, .07); }
.sched-day .switch { margin-top: 6px; }
.sched-name { width: 62px; flex: 0 0 auto; padding-top: 9px; font-size: .88rem; }
.sched-ranges { flex: 1; display: flex; flex-direction: column; gap: 6px; min-width: 0; padding-top: 2px; }
.sched-ranges > .muted { padding-top: 8px; }
.sched-range { display: flex; align-items: center; gap: 6px; }
.sched-range .form-input { padding: 8px 6px; min-width: 0; flex: 1; text-align: center; }
.sched-range span { font-size: .75rem; color: var(--text-muted); }
.sched-add { align-self: flex-start; font-size: .75rem; font-weight: 700; color: var(--primary); padding: 2px 4px; }

/* ================= الاشتراك والدفع ================= */
.sub-card { display: flex; align-items: center; gap: 14px; color: #fff; border: none; }
.sub-card.ok { background: linear-gradient(135deg, #1e8449, #27ae60); }
.sub-card.off { background: linear-gradient(135deg, #b03a2e, #e74c3c); }
.sub-card .grow { flex: 1; }
.sub-card b { font-size: 1.15rem; }
.sub-ic { width: 54px; height: 54px; border-radius: 50%; background: rgba(255, 255, 255, .2); display: flex; align-items: center; justify-content: center; font-size: 1.6rem; flex: 0 0 auto; }
.sub-bar { height: 6px; border-radius: 6px; background: rgba(255, 255, 255, .25); margin: 8px 0 4px; overflow: hidden; }
.sub-bar div { height: 100%; background: #fff; border-radius: 6px; }
.plan-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; margin-bottom: 8px; }
.plan { padding: 12px 4px; border-radius: 14px; border: 2px solid rgba(0, 0, 0, .07); background: #fff; display: flex; flex-direction: column; align-items: center; gap: 2px; transition: var(--transition); }
.plan b { font-size: .92rem; }
.plan span { font-size: .75rem; color: var(--text-secondary); font-weight: 700; }
.plan.active { border-color: var(--primary); background: var(--primary-glass); }
.plan.active b, .plan.active span { color: var(--primary); }
.pay-methods { display: flex; flex-wrap: wrap; justify-content: center; gap: 6px; margin-top: 12px; }
.pay-methods span { font-size: .7rem; font-weight: 700; padding: 4px 10px; border-radius: 20px; background: rgba(0, 0, 0, .05); color: var(--text-secondary); }
@media (max-width: 380px) { .plan-grid { grid-template-columns: repeat(2, 1fr); } }

/* ================= شريط رنين الطلبات ================= */
.ring-bar {
    position: fixed;
    top: calc(10px + var(--safe-top));
    right: 12px; left: 12px;
    z-index: 9000;
    display: flex; align-items: center; gap: 12px;
    padding: 12px 14px;
    border-radius: 18px;
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    color: #fff;
    font-weight: 800;
    box-shadow: 0 18px 40px rgba(221, 44, 0, .45);
    transform: translateY(-160%);
    transition: transform .35s cubic-bezier(.2, .9, .3, 1.2);
    cursor: pointer;
}
.ring-bar.show { transform: translateY(0); }
.ring-bar > i { font-size: 1.4rem; animation: ring-shake 1s infinite; transform-origin: 50% 0; }
.ring-bar .grow { flex: 1; font-size: .92rem; }
.ring-bar button { background: rgba(255, 255, 255, .95); color: var(--primary-dark); font-weight: 800; font-size: .78rem; padding: 8px 12px; border-radius: 12px; flex: 0 0 auto; }
@keyframes ring-shake { 0%, 50%, 100% { transform: rotate(0); } 10%, 30% { transform: rotate(-18deg); } 20%, 40% { transform: rotate(18deg); } }
@media (min-width: 900px) { .ring-bar { right: auto; left: 50%; width: 460px; margin-left: -230px; } }

/* ================= شاشة تحديد الموقع (إلزامية) ================= */
.loc-gate { max-width: 460px; margin: 6vh auto 0; padding: 28px 22px; text-align: center; background: var(--card-surface); border: 1px solid var(--glass-border); border-radius: var(--radius-xl); box-shadow: var(--shadow-md); }
.loc-gate-ic { width: 96px; height: 96px; margin: 0 auto 16px; border-radius: 50%; display: flex; align-items: center; justify-content: center; font-size: 2.6rem; color: #fff;
    background: linear-gradient(135deg, var(--primary), var(--primary-dark)); box-shadow: 0 18px 36px rgba(255, 61, 0, .35); animation: loc-bounce 2.2s ease-in-out infinite; }
.loc-gate h2 { margin: 0 0 8px; font-size: 1.3rem; }
.loc-gate p { color: var(--text-secondary); margin: 0 0 18px; line-height: 1.8; }
.loc-gate-err { margin-top: 12px; padding: 10px 12px; border-radius: 12px; background: rgba(231, 76, 60, .1); color: #b03a2e; font-size: .85rem; line-height: 1.7; }
@keyframes loc-bounce { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-8px); } }

/* ================= مستندات المندوب ================= */
.doc-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; }
.doc-tile { position: relative; display: flex; flex-direction: column; gap: 6px; padding: 8px; border-radius: 16px; border: 2px dashed rgba(0, 0, 0, .12); background: rgba(255, 255, 255, .7); cursor: pointer; transition: var(--transition); }
.doc-tile input { position: absolute; width: 1px; height: 1px; opacity: 0; }
.doc-tile .preview { height: 96px; border-radius: 12px; background: rgba(0, 0, 0, .04) center/cover no-repeat; display: flex; align-items: center; justify-content: center; font-size: 1.6rem; color: var(--text-muted); }
.doc-tile .t { font-size: .76rem; font-weight: 700; text-align: center; line-height: 1.4; }
.doc-tile .ok { display: none; position: absolute; top: 12px; left: 12px; color: #fff; background: var(--success-dark); border-radius: 50%; width: 24px; height: 24px; align-items: center; justify-content: center; font-size: .8rem; box-shadow: 0 4px 10px rgba(0, 0, 0, .2); }
.doc-tile.done { border-style: solid; border-color: rgba(46, 204, 113, .6); }
.doc-tile.done .ok { display: flex; }
.doc-view { display: grid; grid-template-columns: repeat(auto-fill, minmax(92px, 1fr)); gap: 8px; margin-top: 10px; }
.doc-view a, .doc-view span { display: flex; flex-direction: column; gap: 4px; font-size: .66rem; font-weight: 700; text-align: center; color: var(--text-secondary); text-decoration: none; }
.doc-view img, .doc-view .none { width: 100%; height: 72px; border-radius: 10px; object-fit: cover; background: rgba(0, 0, 0, .05); cursor: zoom-in; }
.doc-view .none { display: flex; align-items: center; justify-content: center; color: var(--danger); background: rgba(231, 76, 60, .08); cursor: default; font-size: 1.1rem; }
@media (min-width: 600px) { .doc-grid { grid-template-columns: repeat(3, 1fr); } }
