:root {
  --navy: #16233f;
  --navy-soft: #223554;
  --navy-hover: #2c4468;
  --gold: #c3a568;
  --gold-hover: #cdb47e;
  --text: #1c2430;
  --text-muted: #6b7280;
  --text-inverse: #eef1f6;
  --text-inverse-muted: #9aa7bd;
  --bg: #f2f3f6;
  --surface: #ffffff;
  --border: #e3e6eb;
  --danger: #c0463a;
  --good: #2f7a4d;
  --radius: 10px;
  --font: 'Vazirmatn', 'Segoe UI', Tahoma, sans-serif;

  /* سطوح بزرگ برند (سایدبار، هدر، دکمه‌ها) — تم روز: سفید-طلایی به‌جای ناوی */
  --brand-fill: #f6e8bf;
  --brand-fill-2: #fdfaf0;
  --brand-fill-strong: #ecd48f;
  --brand-fill-text: var(--navy);
  --brand-fill-text-muted: #8a7442;
}

/* ---------- DARK THEME ---------- */
[data-theme="dark"] {
  --navy: #0e1728;
  --navy-soft: #16223a;
  --navy-hover: #1e2d4a;
  --gold: #c9ac74;
  --gold-hover: #d4bc8a;
  --text: #e2e6ee;
  --text-muted: #8b93a6;
  --text-inverse: #eef1f6;
  --text-inverse-muted: #7d8aa3;
  --bg: #080b12;
  --surface: #0d111a;
  --border: #1e2330;
  --danger: #d4685e;
  --good: #479f6e;

  /* تم شب دست‌نخورده می‌ماند: همون ناوی قبلی */
  --brand-fill: var(--navy);
  --brand-fill-2: #0f1930;
  --brand-fill-strong: var(--navy-soft);
  --brand-fill-text: var(--text-inverse);
  --brand-fill-text-muted: var(--text-inverse-muted);
}
[data-theme="dark"] .auth-screen { background: linear-gradient(180deg, #070a10 0%, #04060a 100%); }

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; background: var(--bg); color: var(--text); font-family: var(--font); font-size: 14.5px; overflow: hidden; }
#app { height: 100vh; }
body.scrollable-page, body.scrollable-page html { overflow: auto; height: auto; }
body.scrollable-page #app { height: auto; min-height: 100vh; overflow: visible; }

.guest-home { min-height: 100vh; display: flex; flex-direction: column; position: relative; }
.guest-hero {
  display: flex; flex-direction: column; align-items: center; gap: 6px; text-align: center;
  padding: 50px 20px 30px; background: linear-gradient(180deg, var(--brand-fill) 0%, var(--brand-fill-2) 100%); color: var(--brand-fill-text);
}
.guest-hero h1 { margin: 4px 0 0; font-size: 26px; }
.guest-hero p { margin: 0; color: var(--brand-fill-text-muted); font-size: 13px; }
.guest-products { padding: 30px 24px; max-width: 1100px; margin: 0 auto; width: 100%; box-sizing: border-box; }
.guest-products h2 { font-size: 16px; margin: 0 0 16px; }

/* دکمه‌ی ورود بالا-چپ صفحه‌ی مهمان — پایین صفحه فقط محصولات می‌ماند */
.guest-login-btn {
  position: fixed; top: 14px; left: 14px; z-index: 20;
  background: var(--surface); color: var(--brand-fill-text, #14203a); border: 1px solid var(--border);
  border-radius: 999px; padding: 9px 18px; font-size: 13px; font-weight: 700; cursor: pointer;
  box-shadow: 0 4px 14px rgba(0,0,0,.18);
}

/* دکمه‌ی همبرگری بالا-راست که پنل کشویی (دسته‌بندی‌ها) را باز می‌کند — شبیه دیجی‌کالا */
.guest-topright-actions { position: fixed; top: 14px; right: 14px; z-index: 20; display: flex; gap: 8px; }
.guest-drawer-btn, .guest-cart-btn {
  position: static;
  background: var(--surface); color: var(--brand-fill-text, #14203a); border: 1px solid var(--border);
  border-radius: 999px; width: 40px; height: 40px; font-size: 16px; cursor: pointer;
  box-shadow: 0 4px 14px rgba(0,0,0,.18);
}
.guest-cart-btn { position: relative; }
.guest-cart-btn .badge { position: absolute; top: -4px; left: -4px; }

/* ردیف‌های سبد خرید مهمان (قبل از ورود) — نسخه‌ی ساده‌ی همون سبدخرید داشبورد */
.guest-cart-rows { display: flex; flex-direction: column; gap: 10px; margin-bottom: 14px; }
.guest-cart-row { border: 1px solid var(--border); border-radius: 8px; padding: 10px; }
.guest-cart-row-name { font-size: 13.5px; font-weight: 600; margin-bottom: 6px; }
.guest-cart-row-actions { display: flex; align-items: center; gap: 8px; }
.guest-cart-row-sum { margin-top: 6px; font-size: 12.5px; color: var(--text-muted); }
.guest-cart-drawer .cart-total { margin: 10px 0 14px; }

/* ---------- پنل کشویی سمت راست (Right Sidebar) — هم تو صفحه‌ی مهمان هم منوی داشبورد موبایل ---------- */
.site-drawer-overlay { position: fixed; inset: 0; z-index: 60; background: rgba(10,14,20,.5); }
.site-drawer {
  position: fixed; top: 0; right: 0; height: 100vh; width: min(300px, 84vw); z-index: 61;
  background: var(--surface); box-shadow: -4px 0 24px rgba(0,0,0,.22); overflow-y: auto;
  display: flex; flex-direction: column; padding: 16px; box-sizing: border-box;
  transform: translateX(100%); transition: transform .22s ease;
}
.site-drawer.open { transform: translateX(0); }
.drawer-head { display: flex; align-items: center; gap: 10px; padding-bottom: 14px; border-bottom: 1px solid var(--border); margin-bottom: 14px; }
.drawer-head .icon-btn { margin-right: auto; }
.drawer-section { margin-bottom: 18px; }
.drawer-section-title { font-size: 12px; color: var(--text-muted); font-weight: 700; margin-bottom: 8px; }
.drawer-login-btn {
  display: block; width: 100%; text-align: center; padding: 11px; margin-bottom: 8px; border-radius: var(--radius);
  border: 1px solid var(--gold); background: var(--gold); color: #14203a; font-weight: 700; font-size: 13.5px; cursor: pointer;
}
.drawer-login-btn.secondary { background: var(--surface); color: var(--navy, #14203a); border-color: var(--border); font-weight: 600; }
.drawer-categories { display: flex; flex-wrap: wrap; gap: 6px; }

/* پرسش اول مودال ورود: کاربر عادی یا کارمند/کسب‌وکار — بعد از این انتخاب دیگه هیچ‌جا دوباره پرسیده نمی‌شه */
.audience-chooser .auth-sub { margin-bottom: 18px; }
.audience-cards { display: flex; flex-direction: column; gap: 12px; width: 100%; max-width: 300px; }
.audience-card {
  display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 18px 14px;
  border-radius: var(--radius); border: 1px solid rgba(255,255,255,.35); background: rgba(255,255,255,.12);
  color: var(--brand-fill-text); cursor: pointer; text-align: center;
}
.audience-card:hover { background: rgba(255,255,255,.2); }
.audience-icon { font-size: 26px; }
.audience-title { font-weight: 700; font-size: 14.5px; }
.audience-desc { font-size: 12px; opacity: .85; }
.audience-back { font-size: 11px; padding: 0; margin-right: 6px; text-decoration: underline; color: inherit; }

/* پنجره‌ی شناور فرم ورود که با زدن دکمه‌ی بالا-چپ باز می‌شود */
.login-modal-overlay {
  position: fixed; inset: 0; z-index: 70; background: rgba(10,14,20,.55);
  display: flex; align-items: center; justify-content: center; padding: 16px;
}
.login-modal-box { position: relative; width: 100%; max-width: 380px; max-height: 92vh; overflow-y: auto; border-radius: var(--radius); background: linear-gradient(180deg, var(--brand-fill) 0%, var(--brand-fill-2) 100%); }
.login-modal-close {
  position: absolute; top: 10px; left: 10px; z-index: 5; width: 30px; height: 30px; border-radius: 50%;
  border: none; background: rgba(255,255,255,.18); color: #fff; font-size: 15px; cursor: pointer;
}
.login-modal-box .auth-screen { height: auto; min-height: 0; padding: 34px 26px 26px; }
.auth-audience-note { background: rgba(0,0,0,.06); color: var(--brand-fill-text); border-radius: 8px; padding: 6px 12px; font-size: 12px; margin: 4px 0 2px; text-align: center; }
.google-btn-top { margin-bottom: 4px; }
button, input, select, textarea { font-family: var(--font); color: inherit; }

/* ---------- AUTH SCREEN ---------- */
.auth-screen {
  height: 100%; display: flex; flex-direction: column; align-items: center; justify-content: center;
  background: linear-gradient(180deg, var(--brand-fill) 0%, var(--brand-fill-2) 100%);
  gap: 6px; padding: 40px; position: relative;
}
.theme-toggle { position: absolute; top: 20px; left: 20px; background: var(--surface); border: 1px solid var(--border); box-shadow: 0 2px 6px rgba(0,0,0,.08); }
.auth-divider { display: flex; align-items: center; gap: 10px; margin: 10px 0; color: var(--text-muted); font-size: 12px; }
.auth-divider::before, .auth-divider::after { content: ''; flex: 1; height: 1px; background: var(--border); }
.google-btn-wrap { display: flex; justify-content: center; }
.auth-logo { width: 74px; height: 74px; object-fit: contain; background: #fff; border-radius: 16px; padding: 8px; margin-bottom: 10px; }
.auth-logo.small { width: 56px; height: 56px; }
.auth-title { color: var(--brand-fill-text); font-size: 26px; font-weight: 800; margin: 0; letter-spacing: .5px; }
.auth-sub { color: var(--brand-fill-text-muted); font-size: 13px; margin: 4px 0 26px; text-align: center; }
.auth-tabs { display: flex; width: 320px; margin-bottom: 14px; background: var(--surface); border-radius: 999px; padding: 4px; box-shadow: 0 8px 24px rgba(0,0,0,.18); }
.auth-tab { flex: 1; border: none; background: none; padding: 10px 0; border-radius: 999px; font-size: 14px; font-weight: 700; color: var(--text-muted); cursor: pointer; }
.auth-tab.active { background: var(--navy); color: #fff; }
.auth-card { width: 320px; background: var(--surface); border-radius: var(--radius); padding: 22px; box-shadow: 0 8px 24px rgba(0,0,0,.18); }
.auth-card label { display: block; font-size: 12.5px; color: var(--text-muted); margin-bottom: 6px; }
.auth-error { color: var(--danger); font-size: 12.5px; margin-top: 10px; }
.dev-hint { margin-top: 10px; font-size: 12px; background: #fdf3e3; color: #8a6417; border: 1px solid #f0dcae; border-radius: 6px; padding: 8px 10px; }
.btn.full { width: 100%; margin-top: 16px; }

/* ---------- ROLE GATE ---------- */
.gate { height: 100%; display: flex; flex-direction: column; background: var(--bg); overflow-y: auto; }
.gate-topbar { display: flex; justify-content: space-between; align-items: center; padding: 16px 30px; }
.gate-topbar-actions { display: flex; align-items: center; gap: 12px; }
.gate-phone { color: var(--text-muted); font-size: 12.5px; direction: ltr; }
.gate-hero { text-align: center; padding: 10px 20px 30px; display: flex; flex-direction: column; align-items: center; }
.brand-mark { display: block; font-size: 30px; font-weight: 800; color: var(--navy); margin-top: 4px; }
.brand-mark.small { font-size: 18px; }
.brand-sub { display: block; margin-top: 4px; color: var(--text-muted); font-size: 13.5px; }
.gate-tag { color: var(--text-muted); margin-top: 16px; font-size: 13px; }
.role-grid { display: grid; grid-template-columns: repeat(3, 210px); gap: 16px; justify-content: center; padding-bottom: 30px; }
.role-card {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 22px 16px; display: flex; flex-direction: column; gap: 6px; cursor: pointer;
  transition: box-shadow .15s ease, transform .15s ease; border-top: 3px solid transparent; text-align: right;
}
.role-card:hover { box-shadow: 0 4px 10px rgba(22,35,63,.06); transform: translateY(-2px); border-top-color: var(--gold); }
.corner-badge {
  position: fixed; bottom: 14px; right: 14px; z-index: 50;
  background: var(--surface); border: 1px solid var(--gold); color: var(--gold);
  font-size: 11px; font-weight: 600; padding: 6px 12px; border-radius: 20px;
  box-shadow: 0 2px 8px rgba(0,0,0,.08); cursor: default;
}
.role-title { font-weight: 700; font-size: 14.5px; color: var(--navy); }
.role-desc { color: var(--text-muted); font-size: 12px; }

/* ---------- SHELL ---------- */
.shell { display: flex; height: 100vh; }
.sidebar { width: 246px; background: var(--brand-fill); color: var(--brand-fill-text); display: flex; flex-direction: column; padding: 16px 12px; flex-shrink: 0; box-shadow: 2px 0 10px rgba(0,0,0,.04); }
.side-brand { display: flex; align-items: center; gap: 10px; padding: 4px 8px 16px; border-bottom: 1px solid var(--border); margin-bottom: 14px; }
.side-logo { width: 30px; height: 30px; object-fit: contain; background: #fff; border-radius: 6px; padding: 3px; }
.side-role { padding: 0 8px 14px; }
.side-role-title { font-weight: 700; font-size: 13.5px; }
.side-role-desc { color: var(--brand-fill-text-muted); font-size: 11px; direction: ltr; text-align: right; }
.side-nav { display: flex; flex-direction: column; gap: 2px; overflow-y: auto; flex: 1; }
.nav-item {
  display: block; width: 100%; background: transparent; border: none; color: var(--brand-fill-text-muted);
  text-align: right; padding: 9px 12px; border-radius: 8px; cursor: pointer; font-size: 13px; border-right: 3px solid transparent;
}
.nav-item:hover { background: var(--brand-fill-strong); color: var(--brand-fill-text); }
.nav-item.active { background: var(--brand-fill-strong); color: var(--brand-fill-text); border-right-color: var(--gold); font-weight: 600; }
.nav-item.logout { margin-top: 4px; color: var(--danger); }

/* دکمه‌ی همبرگری تاپ‌بار برای باز کردن سایدبار در حالت موبایل — تو دسکتاپ همیشه مخفیه چون سایدبار خودش دائم دیده می‌شه */
.dash-drawer-toggle { display: none; }
.dash-drawer-close { display: none; margin-right: auto; }

.main { flex: 1; display: flex; flex-direction: column; min-width: 0; background: var(--bg); }
.topbar { height: 56px; background: var(--surface); border-bottom: 1px solid var(--border); display: flex; align-items: center; justify-content: space-between; padding: 0 22px; flex-shrink: 0; }
.topbar-title { font-weight: 700; font-size: 15.5px; color: var(--navy); }
.icon-btn { position: relative; background: var(--bg); border: 1px solid var(--border); border-radius: 8px; width: 34px; height: 34px; cursor: pointer; font-size: 14px; }
.badge { position: absolute; top: -6px; left: -6px; background: var(--danger); color: #fff; font-size: 10px; border-radius: 50%; width: 17px; height: 17px; display: flex; align-items: center; justify-content: center; }

.notif-panel { position: absolute; left: 22px; top: 60px; width: 300px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 10px; z-index: 20; max-height: 320px; overflow-y: auto; box-shadow: 0 6px 16px rgba(0,0,0,.08); }
.notif-panel.hidden { display: none; }
.notif-head { display: flex; justify-content: space-between; align-items: center; padding: 4px 6px 10px; border-bottom: 1px solid var(--border); margin-bottom: 6px; }
.notif-item { padding: 8px 6px; font-size: 12.5px; border-bottom: 1px solid var(--border); display: flex; justify-content: space-between; gap: 8px; color: var(--text-muted); }
.notif-item.unread { color: var(--text); }
.notif-time { font-size: 10px; white-space: nowrap; color: var(--text-muted); }

.content { flex: 1; overflow-y: auto; padding: 22px; }
.loading { color: var(--text-muted); font-size: 13px; padding: 30px 0; text-align: center; display: flex; align-items: center; justify-content: center; gap: 10px; }
.spinner { width: 14px; height: 14px; border: 2px solid var(--border); border-top-color: var(--gold); border-radius: 50%; display: inline-block; animation: spin .7s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- COMPONENTS ---------- */
.stat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 14px; margin-bottom: 20px; }
.stat-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 16px; border-top: 3px solid var(--gold); }
.stat-label { color: var(--text-muted); font-size: 12.5px; margin-bottom: 8px; }
.stat-value { font-size: 22px; font-weight: 800; color: var(--navy); }
.stat-value.good { color: var(--good); }
.stat-value.warn { color: #b8860b; }

/* ---------- داشبورد و پروفایل کاربر عادی ---------- */
.dash-welcome { font-size: 15px; font-weight: 700; color: var(--navy); margin-bottom: 16px; }
.dash-quick-actions { display: flex; flex-wrap: wrap; gap: 10px; }
.profile-card { display: flex; align-items: center; gap: 14px; padding-bottom: 16px; margin-bottom: 16px; border-bottom: 1px solid var(--border); }
.profile-avatar { width: 56px; height: 56px; border-radius: 50%; background: var(--brand-fill); color: var(--brand-fill-text); display: flex; align-items: center; justify-content: center; font-size: 22px; font-weight: 800; flex-shrink: 0; }
.profile-name { font-size: 16px; font-weight: 700; color: var(--navy); }
.profile-role { font-size: 12.5px; color: var(--text-muted); margin-top: 2px; }
.profile-fields { display: flex; flex-direction: column; gap: 10px; }
.profile-field { display: flex; justify-content: space-between; align-items: center; padding: 10px 14px; background: var(--bg); border: 1px solid var(--border); border-radius: 8px; font-size: 13px; }
.profile-field label { color: var(--text-muted); font-weight: 600; }
.profile-edit-btn { margin-right: auto; align-self: flex-start; }
.profile-edit-form { display: flex; flex-direction: column; gap: 8px; max-width: 320px; margin-bottom: 18px; padding: 14px; background: var(--bg); border: 1px solid var(--border); border-radius: var(--radius); }
.profile-edit-actions { display: flex; gap: 8px; margin-top: 4px; }

.panel { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 18px; margin-bottom: 18px; }
.panel-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 14px; }
.panel-head h3 { margin: 0; font-size: 15px; color: var(--navy); }

.data-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.data-table th { text-align: right; color: var(--text-muted); font-weight: 600; padding: 8px 10px; border-bottom: 1px solid var(--border); font-size: 12px; }
.data-table td { padding: 10px; border-bottom: 1px solid var(--border); }
.data-table tr:last-child td { border-bottom: none; }

.empty-mini { color: var(--text-muted); font-size: 13px; padding: 20px 0; text-align: center; }
.muted { color: var(--text-muted); }

.btn { background: var(--brand-fill); color: var(--brand-fill-text); border: 1px solid var(--gold); padding: 9px 16px; border-radius: 8px; cursor: pointer; font-size: 13px; font-weight: 600; }
.btn:hover { background: var(--navy-hover); }
.btn:disabled { opacity: .6; cursor: default; }
.btn.small { padding: 6px 12px; font-size: 12px; }
.btn.lg { padding: 12px 20px; font-size: 14px; margin-top: 6px; }
.btn.ghost { background: transparent; border: 1px solid var(--border); color: var(--text-muted); }
.btn.ghost:hover { color: var(--text); border-color: var(--text-muted); }
.btn.primary { background: var(--gold); color: #2b2109; }
.btn.primary:hover { background: var(--gold-hover); }

.link-btn { background: none; border: none; color: var(--navy); text-decoration: underline; cursor: pointer; font-size: 12.5px; padding: 6px 0; }
.link-btn.danger { color: var(--danger); }

.input { width: 100%; background: var(--bg); border: 1px solid var(--border); border-radius: 8px; padding: 9px 10px; font-size: 13px; outline: none; }
.input:focus { border-color: var(--gold); background: var(--surface); }
.filter-block { margin-bottom: 12px; }
.filter-block label { display: block; font-size: 12px; color: var(--text-muted); margin-bottom: 5px; }
.addr-search-results { margin-top: 6px; display: flex; flex-direction: column; gap: 4px; }
.addr-map { width: 100%; height: 260px; border-radius: 10px; border: 1px solid var(--border); background: var(--bg); }
.addr-map-error { display: flex; align-items: center; justify-content: center; height: 100%; font-size: 12px; color: var(--text-muted); text-align: center; padding: 10px; }
.addr-map-status { display: inline-block; margin-right: 8px; font-size: 12px; color: var(--text-muted); vertical-align: middle; }
.addr-search-item {
  display: flex; flex-direction: column; align-items: flex-start; text-align: right;
  background: var(--surface); border: 1px solid var(--border); border-radius: 8px;
  padding: 8px 10px; cursor: pointer; font-family: inherit;
}
.addr-search-item:hover { border-color: var(--gold); }
.addr-search-item b { font-size: 12.5px; }
.addr-search-item span { font-size: 11px; color: var(--text-muted); }
.addr-search-empty { font-size: 12px; color: var(--text-muted); padding: 6px 2px; }

/* ---------- STORE ---------- */
.store-layout { display: flex; gap: 18px; align-items: flex-start; }
.store-filters { width: 220px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 16px; flex-shrink: 0; }
.store-main { flex: 1; min-width: 0; }
.cat-strip { display: flex; gap: 8px; overflow-x: auto; padding-bottom: 12px; margin-bottom: 14px; border-bottom: 1px solid var(--border); }
.cat-strip.wrap { flex-wrap: wrap; overflow: visible; }
.cat-chip { background: var(--surface); border: 1px solid var(--border); color: var(--text-muted); padding: 7px 12px; border-radius: 20px; font-size: 12.5px; white-space: nowrap; cursor: pointer; }
.cat-chip.active { border-color: var(--gold); color: var(--navy); background: #fbf3e3; }

.product-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 14px; }
.product-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 14px; display: flex; flex-direction: column; gap: 6px; }
.product-tile { width: 40px; height: 40px; border-radius: 8px; background: var(--brand-fill); color: var(--brand-fill-text); font-weight: 800; font-size: 16px; display: flex; align-items: center; justify-content: center; }
.product-tile.img { width: 100%; height: 140px; object-fit: cover; }
.myproduct-photo { width: 100%; max-width: 220px; height: 140px; object-fit: cover; border-radius: 8px; border: 1px solid var(--border); display: block; margin: 6px 0; }
.product-name { font-weight: 700; font-size: 13.5px; color: var(--text); }
.product-spec { color: var(--text-muted); font-size: 11.5px; min-height: 30px; }
.product-meta { display: flex; justify-content: space-between; font-size: 11px; color: var(--text-muted); }
.product-foot { display: flex; justify-content: space-between; align-items: center; margin-top: 6px; }
.product-price { font-weight: 800; color: var(--navy); font-size: 13.5px; }
.product-stock { font-size: 10.5px; color: var(--text-muted); }

/* ---------- CART / ORDERS ---------- */
.cart-total { text-align: left; margin-top: 14px; font-size: 15px; color: var(--navy); }
.qty-btn { background: var(--bg); border: 1px solid var(--border); color: var(--text); width: 24px; height: 24px; border-radius: 6px; cursor: pointer; }

.order-card { background: var(--bg); border: 1px solid var(--border); border-radius: var(--radius); padding: 14px; margin-bottom: 12px; }
.order-head { display: flex; gap: 14px; align-items: center; margin-bottom: 12px; font-size: 13px; }
.order-total { margin-right: auto; color: var(--navy); font-weight: 700; }
.order-items { color: var(--text-muted); font-size: 12px; margin-top: 10px; }
.order-address { color: var(--text-muted); font-size: 12px; margin-top: 4px; }
.btn[disabled] { opacity: .5; cursor: not-allowed; }

/* ---------- MOBILE (تست روی گوشی/کروم) ---------- */
@media (max-width: 760px) {
  .shell { flex-direction: column; height: 100vh; }
  /* سایدبار داشبورد تو موبایل به‌جای نوار افقی، پنل کشویی از راست می‌شه (دقیقاً مثل .site-drawer صفحه‌ی مهمان) */
  .sidebar {
    position: fixed; top: 0; right: 0; height: 100vh; width: min(270px, 84vw); z-index: 61;
    flex-direction: column; align-items: stretch; padding: 16px; overflow-x: visible; overflow-y: auto;
    transform: translateX(100%); transition: transform .22s ease; box-shadow: -4px 0 24px rgba(0,0,0,.25);
  }
  .sidebar.open { transform: translateX(0); }
  .side-brand { flex-shrink: 0; }
  .side-role { display: block; }
  .side-nav { flex-direction: column; overflow-x: visible; gap: 2px; }
  .side-nav .nav-item { white-space: normal; flex-shrink: 1; }
  .sidebar .nav-item.logout, .sidebar > .nav-item:not(.side-nav .nav-item) { flex-shrink: 0; white-space: normal; }
  .dash-drawer-toggle { display: inline-flex; align-items: center; justify-content: center; }
  .dash-drawer-close { display: inline-flex; align-items: center; justify-content: center; }
  .main { min-height: 0; }
  .content { padding: 12px; }
  .store-layout { flex-direction: column; }
  .store-filters { width: 100%; }
  .product-grid { grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); }
  .role-grid { grid-template-columns: 1fr; padding: 0 16px 30px; }
  .stat-grid { grid-template-columns: 1fr 1fr; }
  .data-table { display: block; overflow-x: auto; white-space: nowrap; }
  .auth-screen { padding: 24px 16px; }
  .gate-topbar { padding: 12px 16px; flex-wrap: wrap; gap: 8px; }
}

/* ---------- PIPELINE ---------- */
.pipeline { display: flex; align-items: flex-start; gap: 0; overflow-x: auto; padding: 6px 0 10px; }
.pipe-step { flex: 1; min-width: 90px; display: flex; flex-direction: column; align-items: center; position: relative; text-align: center; }
.pipe-step::before { content: ''; position: absolute; top: 13px; right: 50%; width: 100%; height: 3px; background: repeating-linear-gradient(90deg, var(--border) 0 6px, transparent 6px 10px); z-index: 0; }
.pipe-step:first-child::before { display: none; }
.pipe-step.done::before { background: var(--gold); }
.pipe-dot { width: 26px; height: 26px; border-radius: 6px; background: var(--surface); border: 2px solid var(--border); display: flex; align-items: center; justify-content: center; font-size: 11px; font-weight: 700; color: var(--text-muted); z-index: 1; }
.pipe-step.done .pipe-dot { background: var(--gold); border-color: var(--gold); color: #fff; }
.pipe-step.active .pipe-dot { border-color: var(--navy); color: var(--navy); }
.pipe-label { font-size: 10px; color: var(--text-muted); margin-top: 6px; max-width: 80px; }
.pipe-step.done .pipe-label, .pipe-step.active .pipe-label { color: var(--text); font-weight: 600; }

/* ---------- CHAT ---------- */
.chat-layout { display: flex; gap: 14px; height: calc(100vh - 150px); }
.chat-contacts { width: 220px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 8px; flex-shrink: 0; }
.chat-contact { display: block; width: 100%; text-align: right; background: none; border: none; color: var(--text-muted); padding: 10px; border-radius: 8px; cursor: pointer; font-size: 12.5px; margin-bottom: 2px; }
.chat-contact:hover { background: var(--bg); }
.chat-contact.active { background: var(--bg); color: var(--navy); font-weight: 600; }
.chat-thread { flex: 1; display: flex; flex-direction: column; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; }
.chat-messages { flex: 1; overflow-y: auto; padding: 16px; display: flex; flex-direction: column; gap: 8px; }
.msg { align-self: flex-start; background: var(--bg); padding: 8px 12px; border-radius: 10px; font-size: 12.5px; max-width: 60%; display: flex; gap: 8px; align-items: baseline; }
.msg.me { align-self: flex-end; background: var(--navy); color: #fff; }
.msg time { font-size: 9.5px; color: var(--text-muted); white-space: nowrap; }
.msg.me time { color: rgba(255,255,255,.7); }
.chat-input-row { display: flex; gap: 8px; padding: 12px; border-top: 1px solid var(--border); }

/* ---------- TOAST ---------- */
.toast { position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%) translateY(20px); background: var(--navy); color: #fff; padding: 12px 20px; border-radius: 8px; font-size: 13px; opacity: 0; transition: opacity .25s ease, transform .25s ease; z-index: 100; box-shadow: 0 4px 14px rgba(0,0,0,.15); }
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-thumb { background: #cfd4db; border-radius: 4px; }
::-webkit-scrollbar-track { background: transparent; }
