/* ═══════════════════════════════════════════
   VARIABLES — DARK (default)
═══════════════════════════════════════════ */
:root {
  --bg:        #0b0f1a;
  --bg2:       #111827;
  --bg3:       #1a2236;
  --card:      #151d2e;
  --border:    rgba(255,255,255,0.07);
  --accent:    #3b82f6;
  --accent2:   #06b6d4;
  --green:     #10b981;
  --orange:    #f59e0b;
  --red:       #ef4444;
  --purple:    #a855f7;
  --text:      #f1f5f9;
  --text2:     #94a3b8;
  --text3:     #475569;
  --radius:    14px;
  --radius-sm: 8px;
  --shadow:    0 4px 24px rgba(0,0,0,0.4);
  --glow:      0 0 20px rgba(59,130,246,0.15);
  --header-height: 60px;
  --bottom-nav-height: 62px;
  --header-bg-raw: rgba(11,15,26,0.92);
  --nav-bg-raw:    rgba(11,15,26,0.95);
  --modal-bg:      #0f1117;
  --modal-footer:  #1a1d27;
}

/* ═══════════════════════════════════════════
   VARIABLES — LIGHT
═══════════════════════════════════════════ */
body.light {
  --bg:        #f0f4ff;
  --bg2:       #e8eef8;
  --bg3:       #dce5f5;
  --card:      #ffffff;
  --border:    rgba(0,0,0,0.08);
  --text:      #0f172a;
  --text2:     #475569;
  --text3:     #94a3b8;
  --shadow:    0 4px 24px rgba(59,130,246,0.08);
  --glow:      0 0 20px rgba(59,130,246,0.12);
  --header-bg-raw: rgba(240,244,255,0.92);
  --nav-bg-raw:    rgba(240,244,255,0.97);
  --modal-bg:      #ffffff;
  --modal-footer:  #f0f4ff;
}

/* ═══════════════════════════════════════════
   RESET
═══════════════════════════════════════════ */
*, *::before, *::after {
  box-sizing: border-box; margin: 0; padding: 0;
  -webkit-tap-highlight-color: transparent;
  user-select: none; -webkit-user-select: none;
}
html { font-size: 15px; }
body {
  font-family: 'Cairo', sans-serif;
  background: var(--bg);
  color: var(--text);
  direction: rtl;
  min-height: 100vh;
  overflow-x: hidden;
  transition: background .3s, color .3s;
}

/* ═══════════════════════════════════════════
   SCROLLBAR
═══════════════════════════════════════════ */
::-webkit-scrollbar { width: 5px; }
::-webkit-scrollbar-track { background: var(--bg2); }
::-webkit-scrollbar-thumb { background: var(--bg3); border-radius: 10px; }

/* ═══════════════════════════════════════════
   HEADER
═══════════════════════════════════════════ */
.header {
  position: fixed; top: 0; right: 0; left: 0; z-index: 100;
  height: var(--header-height);
  background: var(--header-bg-raw);
  backdrop-filter: blur(16px);
  border-bottom: 1px solid var(--border);
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 18px;
  transition: background .3s, border-color .3s;
}
.header-logo {
  display: flex; align-items: center; gap: 10px;
  font-weight: 900; font-size: 1.4rem; letter-spacing: 1px;
  background: linear-gradient(135deg, var(--accent), var(--accent2));
  -webkit-background-clip: text; -webkit-text-fill-color: transparent;
}
.header-logo img { height: 38px; width: auto; object-fit: contain; }
.header-right { display: flex; align-items: center; gap: 8px; }

.header-badge {
  background: var(--bg3); border: 1px solid var(--border);
  padding: 5px 12px; border-radius: 20px;
  font-size: 0.78rem; color: var(--text2);
  display: flex; align-items: center; gap: 6px;
  transition: background .3s;
}
.header-badge .dot {
  width: 7px; height: 7px; border-radius: 50%;
  background: var(--green); box-shadow: 0 0 8px var(--green);
  animation: pulse 2s infinite;
}
@keyframes pulse { 0%,100%{opacity:1}50%{opacity:.4} }

.menu-btn, .theme-btn {
  width: 36px; height: 36px; border-radius: 10px;
  background: var(--bg3); border: 1px solid var(--border);
  color: var(--text2); cursor: pointer; font-size: .9rem;
  display: flex; align-items: center; justify-content: center;
  transition: all .2s;
}
.menu-btn:hover, .menu-btn.active,
.theme-btn:hover { border-color: var(--accent); color: var(--accent); }

/* ═══════════════════════════════════════════
   MAIN CONTAINER
═══════════════════════════════════════════ */
.main-container {
  position: fixed;
  top: var(--header-height);
  bottom: var(--bottom-nav-height);
  right: 0; left: 0;
  padding: 18px 16px;
  overflow-y: auto; overflow-x: hidden;
}

/* ═══════════════════════════════════════════
   SECTIONS
═══════════════════════════════════════════ */
.section { display: none; animation: fadeIn .3s ease; }
.section.active { display: block; }
@keyframes fadeIn { from{opacity:0;transform:translateY(8px)} to{opacity:1;transform:translateY(0)} }

/* ═══════════════════════════════════════════
   HOME
═══════════════════════════════════════════ */
.home-header { margin-bottom: 20px; }
.home-greeting { font-size: 1.3rem; font-weight: 900; color: var(--text); }
.home-sub { font-size: 0.82rem; color: var(--text2); margin-top: 3px; }

/* ── KPI GRID ── */
.kpi-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-bottom: 14px;
}
.kpi-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  position: relative; overflow: hidden;
  cursor: pointer;
  transition: transform .2s, border-color .2s, box-shadow .2s, background .3s;
}
.kpi-card:active { transform: scale(.97); }
.kpi-card:hover  { border-color: rgba(59,130,246,.25); box-shadow: var(--glow); }
.kpi-card::before {
  content: ''; position: absolute; top: -30px; left: -30px;
  width: 90px; height: 90px; border-radius: 50%;
  opacity: .12; filter: blur(20px);
}
.kpi-card.blue::before   { background: var(--accent); }
.kpi-card.purple::before   { background: var(--purple); }
.kpi-card.green::before  { background: var(--green); }
.kpi-card.red::before    { background: var(--red); }
.kpi-card.orange::before { background: var(--orange); }

.kpi-top { display: flex; justify-content: space-between; align-items: flex-start; margin-bottom: 12px; }
.kpi-icon {
  width: 38px; height: 38px; border-radius: 10px;
  display: flex; align-items: center; justify-content: center; font-size: 1rem;
}
.kpi-card.blue   .kpi-icon { background: rgba(59,130,246,.15);  color: var(--accent); }
.kpi-card.purple   .kpi-icon { background: rgba(168,85,247,.15);   color: var(--purple); }
.kpi-card.green  .kpi-icon { background: rgba(16,185,129,.15);  color: var(--green); }
.kpi-card.red    .kpi-icon { background: rgba(239,68,68,.15);   color: var(--red); }
.kpi-card.orange .kpi-icon { background: rgba(245,158,11,.15);  color: var(--orange); }

.kpi-badge { font-size: 0.68rem; padding: 2px 8px; border-radius: 20px; font-weight: 700; }
.kpi-card.blue   .kpi-badge { background: rgba(59,130,246,.15);  color: var(--accent); }
.kpi-card.purple   .kpi-badge { background: rgba(168,85,247,.15);   color: var(--purple); }
.kpi-card.green  .kpi-badge { background: rgba(16,185,129,.15);  color: var(--green); }
.kpi-card.red    .kpi-badge { background: rgba(239,68,68,.15);   color: var(--red); }
.kpi-card.orange .kpi-badge { background: rgba(245,158,11,.15);  color: var(--orange); }

.kpi-count { font-size: 2rem; font-weight: 900; line-height: 1; }
.kpi-label { font-size: 0.78rem; color: var(--text2); margin-top: 4px; }
.kpi-card.wide { grid-column: 1 / -1; }

.mini-bars { display: flex; align-items: flex-end; gap: 3px; height: 28px; margin-top: 10px; }
.mini-bar  { flex: 1; border-radius: 3px 3px 0 0; opacity: .6; }
.mini-bar:last-child { opacity: 1; }
.kpi-card.blue   .mini-bar { background: var(--accent); }
.kpi-card.purple   .mini-bar { background: var(--purple); }
.kpi-card.green  .mini-bar { background: var(--green); }
.kpi-card.red    .mini-bar { background: var(--red); }
.kpi-card.orange .mini-bar { background: var(--orange); }

/* ── SECTION HEADING ── */
.section-heading {
  font-size: 0.9rem; font-weight: 700; color: var(--text2);
  text-transform: uppercase; letter-spacing: .5px;
  margin-bottom: 12px; display: flex; align-items: center; gap: 8px;
}
.section-heading::after { content: ''; flex: 1; height: 1px; background: var(--border); }

/* ── ACTIVITY ── */
.activity-list { display: flex; flex-direction: column; gap: 8px; }
.activity-item {
  background: var(--card); border: 1px solid var(--border);
  border-radius: var(--radius-sm); padding: 12px 14px;
  display: flex; align-items: center; gap: 12px;
  transition: background .2s;
}
.activity-item:hover { background: var(--bg3); }
.activity-avatar {
  width: 36px; height: 36px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: .85rem; font-weight: 700; flex-shrink: 0;
}
.activity-info { flex: 1; min-width: 0; }
.activity-name   { font-size: .88rem; font-weight: 700; color: var(--text); }
.activity-detail { font-size: .75rem; color: var(--text2); margin-top: 2px; }
.activity-meta   { text-align: left; }
.activity-amount { font-size: .9rem; font-weight: 700; color: var(--accent); }
.activity-time   { font-size: .7rem; color: var(--text3); margin-top: 2px; }

/* ── STATUS PILL ── */
.pill {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 3px 9px; border-radius: 20px; font-size: .72rem; font-weight: 700;
}
.pill-pending   { background: rgba(245,158,11,.12); color: var(--orange); }
.pill-confirmed { background: rgba(168,85,247,.12);  color: var(--purple); }
.pill-shipped   { background: rgba(59,130,246,.12);   color: var(--accent); }
.pill-delivered { background: rgba(16,185,129,.12);  color: var(--green); }
.pill-canceled  { background: rgba(239,68,68,.12);   color: var(--red); }

/* ═══════════════════════════════════════════
   ORDERS
═══════════════════════════════════════════ */
.orders-toolbar { display: flex; gap: 8px; margin-bottom: 14px; align-items: center; }
.search-wrap { position: relative; flex: 1; }
.search-wrap i { position: absolute; right: 11px; top: 50%; transform: translateY(-50%); color: var(--text3); font-size: .85rem; }
.search-box {
  width: 100%; background: var(--card); border: 1px solid var(--border);
  border-radius: var(--radius-sm); padding: 9px 36px 9px 12px;
  color: var(--text); font-family: 'Cairo',sans-serif; font-size: .85rem;
  outline: none; direction: rtl; transition: border-color .2s, background .3s;
}
.search-box:focus { border-color: var(--accent); }

.filter-chips {
  display: flex; gap: 6px; overflow-x: auto; margin-bottom: 14px;
  padding-bottom: 4px; scrollbar-width: none;
}
.filter-chips::-webkit-scrollbar { display: none; }
.chip {
  flex-shrink: 0; padding: 5px 14px; border-radius: 20px;
  font-size: .78rem; font-weight: 700; cursor: pointer;
  border: 1px solid var(--border); background: var(--card); color: var(--text2);
  transition: all .2s; white-space: nowrap;
}
.chip.active, .chip:hover { border-color: var(--accent); color: var(--accent); background: rgba(59,130,246,.1); }

.orders-list { display: flex; flex-direction: column; gap: 10px; }
.order-card {
  background: var(--card); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 14px;
  cursor: pointer; transition: all .2s; position: relative; overflow: hidden;
}
.order-card:hover { border-color: rgba(59,130,246,.2); transform: translateX(-2px); }
.order-card::before {
  content: ''; position: absolute; right: 0; top: 0; bottom: 0;
  width: 3px; border-radius: 0 var(--radius) var(--radius) 0;
}
.order-card.pending::before   { background: var(--orange); }
.order-card.confirmed::before { background: var(--purple); }
.order-card.shipped::before   { background: var(--accent); }
.order-card.delivered::before { background: var(--green); }
.order-card.canceled::before  { background: var(--red); }

.order-row1 { display: flex; justify-content: space-between; align-items: flex-start; margin-bottom: 8px; }
.order-name { font-size: .92rem; font-weight: 700; }
.order-id   { font-size: .72rem; color: var(--text3); margin-top: 2px; }
.order-row2 { display: flex; justify-content: space-between; align-items: center; }
.order-info-tags { display: flex; gap: 8px; flex-wrap: wrap; }
.order-tag { font-size: .75rem; color: var(--text2); display: flex; align-items: center; gap: 4px; }
.order-amount { font-size: .95rem; font-weight: 900; color: var(--text); white-space: nowrap; }

/* ═══════════════════════════════════════════
   WILAYAT
═══════════════════════════════════════════ */
.wilaya-toolbar { display: flex; gap: 8px; margin-bottom: 14px; align-items: center; }
.wilaya-search-wrap { position: relative; flex: 1; }
.wilaya-search-wrap i { position: absolute; right: 11px; top: 50%; transform: translateY(-50%); color: var(--text3); font-size: .85rem; }
.wilaya-search {
  width: 100%; background: var(--card); border: 1px solid var(--border);
  border-radius: var(--radius-sm); padding: 9px 34px 9px 12px;
  color: var(--text); font-family: 'Cairo',sans-serif; font-size: .85rem;
  outline: none; transition: border-color .2s, background .3s;
}
.wilaya-search:focus { border-color: var(--accent); }
.wilaya-sort-btn {
  background: var(--card); border: 1px solid var(--border);
  border-radius: var(--radius-sm); padding: 8px 12px;
  color: var(--text2); cursor: pointer; font-size: .78rem;
  display: flex; align-items: center; gap: 5px; white-space: nowrap;
  transition: all .2s; font-family: 'Cairo',sans-serif;
}
.wilaya-sort-btn:hover { border-color: var(--accent); color: var(--accent); }

.wilaya-summary {
  display: grid; grid-template-columns: repeat(3,1fr);
  gap: 8px; margin-bottom: 14px;
}
.w-sum-card {
  background: var(--card); border: 1px solid var(--border);
  border-radius: var(--radius-sm); padding: 12px; text-align: center;
  transition: background .3s;
}
.w-sum-val { font-size: 1.3rem; font-weight: 900; }
.w-sum-lbl { font-size: .7rem; color: var(--text2); margin-top: 2px; }

.wilaya-list { display: flex; flex-direction: column; gap: 8px; }
.wilaya-row {
  background: var(--card); border: 1px solid var(--border);
  border-radius: var(--radius-sm); padding: 12px 14px;
  display: flex; align-items: center; gap: 12px; transition: background .2s;
}
.wilaya-row:hover { background: var(--bg3); }
.wilaya-rank {
  width: 28px; height: 28px; border-radius: 8px;
  display: flex; align-items: center; justify-content: center;
  font-size: .75rem; font-weight: 900; flex-shrink: 0;
}
.rank-1 { background: rgba(245,158,11,.2);  color: #fbbf24; }
.rank-2 { background: rgba(148,163,184,.15); color: #94a3b8; }
.rank-3 { background: rgba(180,83,9,.15);   color: #cd7c2f; }
.rank-n { background: var(--bg3);           color: var(--text3); }
.wilaya-name { flex: 1; font-size: .88rem; font-weight: 700; }
.wilaya-bar-wrap { flex: 2; }
.wilaya-bar-bg { height: 6px; background: var(--bg3); border-radius: 3px; overflow: hidden; }
.wilaya-bar-fill {
  height: 100%; border-radius: 3px;
  background: linear-gradient(90deg, var(--accent2), var(--accent));
  transition: width .5s cubic-bezier(.4,0,.2,1);
}
.wilaya-count { font-size: .85rem; font-weight: 700; min-width: 30px; text-align: left; color: var(--text); }
.wilaya-pct   { font-size: .7rem; color: var(--text3); min-width: 35px; text-align: left; }

/* ═══════════════════════════════════════════
   STATS — تصميم خاص
═══════════════════════════════════════════ */
.stats-container { padding: 0; }

/* شريط الملخص العلوي */
.stats-hero {
  display: grid; grid-template-columns: 1fr 1fr;
  gap: 10px; margin-bottom: 16px;
}
.stats-hero-card {
  border-radius: var(--radius); padding: 16px 18px;
  position: relative; overflow: hidden;
  border: 1px solid var(--border);
  transition: transform .2s, box-shadow .2s;
}
.stats-hero-card:hover { transform: translateY(-2px); box-shadow: var(--glow); }
.stats-hero-card.total {
  grid-column: 1/-1;
  background: linear-gradient(135deg, rgba(59,130,246,.18), rgba(6,182,212,.10));
  border-color: rgba(59,130,246,.25);
}
.stats-hero-card.total::after {
  content: ''; position: absolute; left: -20px; top: -20px;
  width: 100px; height: 100px; border-radius: 50%;
  background: radial-gradient(circle, rgba(59,130,246,.25), transparent);
}
.stats-hero-card.delivered-card {
  background: linear-gradient(135deg, rgba(16,185,129,.12), rgba(16,185,129,.05));
  border-color: rgba(16,185,129,.2);
}
.stats-hero-card.canceled-card {
  background: linear-gradient(135deg, rgba(239,68,68,.12), rgba(239,68,68,.05));
  border-color: rgba(239,68,68,.2);
}
.sh-label { font-size: .78rem; color: var(--text2); margin-bottom: 6px; font-weight: 600; }
.sh-val   { font-size: 2.2rem; font-weight: 900; line-height: 1; }
.sh-sub   { font-size: .72rem; color: var(--text2); margin-top: 4px; }
.stats-hero-card.total   .sh-val { color: var(--accent); }
.stats-hero-card.delivered-card .sh-val { color: var(--green); }
.stats-hero-card.canceled-card  .sh-val { color: var(--red); }

/* قائمة الحالات */
.stats-list { display: flex; flex-direction: column; gap: 10px; }

.stat-row {
  background: var(--card); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 14px 16px;
  display: flex; align-items: center; gap: 14px;
  position: relative; overflow: hidden;
  transition: background .2s, border-color .2s, transform .2s;
}
.stat-row:hover { transform: translateX(-3px); border-color: rgba(59,130,246,.15); }

/* خط ملوّن على اليمين */
.stat-row::after {
  content: ''; position: absolute; right: 0; top: 0; bottom: 0;
  width: 3px; border-radius: 0 var(--radius) var(--radius) 0;
}
.stat-row.pending::after   { background: var(--orange); }
.stat-row.confirmed::after { background: var(--purple); }
.stat-row.shipped::after   { background: var(--accent); }
.stat-row.delivered::after { background: var(--green); }
.stat-row.canceled::after  { background: var(--red); }

/* أيقونة */
.stat-row-icon {
  width: 42px; height: 42px; border-radius: 12px;
  display: flex; align-items: center; justify-content: center;
  font-size: 1.1rem; flex-shrink: 0;
}
.stat-row.pending   .stat-row-icon { background: rgba(245,158,11,.12); color: var(--orange); }
.stat-row.confirmed .stat-row-icon { background: rgba(168,85,247,.12);  color: var(--purple); }
.stat-row.shipped   .stat-row-icon { background: rgba(59,130,246,.12);   color: var(--accent); }
.stat-row.delivered .stat-row-icon { background: rgba(16,185,129,.12);  color: var(--green); }
.stat-row.canceled  .stat-row-icon { background: rgba(239,68,68,.12);   color: var(--red); }

/* نص */
.stat-row-info { flex: 1; min-width: 0; }
.stat-row-label { font-size: .88rem; font-weight: 700; color: var(--text); }
.stat-row-sub   { font-size: .72rem; color: var(--text2); margin-top: 2px; }

/* شريط التقدم */
.stat-row-right { display: flex; flex-direction: column; align-items: flex-end; gap: 6px; min-width: 80px; }
.stat-row-count {
  font-size: 1.5rem; font-weight: 900; line-height: 1;
}
.stat-row.pending   .stat-row-count { color: var(--orange); }
.stat-row.confirmed .stat-row-count { color: var(--purple); }
.stat-row.shipped   .stat-row-count { color: var(--accent); }
.stat-row.delivered .stat-row-count { color: var(--green); }
.stat-row.canceled  .stat-row-count { color: var(--red); }

.stat-row-pct { font-size: .72rem; color: var(--text3); }

.stat-bar-wrap {
  width: 80px; height: 8px; background: var(--bg3);
  border-radius: 99px; overflow: hidden;
}
.stat-bar {
  height: 100%; border-radius: 99px; width: 0%;
  animation: statBarFill .8s cubic-bezier(.4,0,.2,1) forwards;
}
.stat-row.pending   .stat-bar { background: var(--orange); }
.stat-row.confirmed .stat-bar { background: var(--purple); }
.stat-row.shipped   .stat-bar { background: var(--accent); }
.stat-row.delivered .stat-bar { background: var(--green); }
.stat-row.canceled  .stat-bar { background: var(--red); }

@keyframes statBarFill { from{width:0%} to{width:var(--w)} }

/* ═══════════════════════════════════════════
   PAYMENTS
═══════════════════════════════════════════ */
.payment-hero {
  background: linear-gradient(135deg, rgba(59,130,246,.15), rgba(6,182,212,.10));
  border: 1px solid rgba(59,130,246,.2);
  border-radius: var(--radius); padding: 20px;
  text-align: center; margin-bottom: 14px;
  position: relative; overflow: hidden;
}
.payment-hero::before {
  content: ''; position: absolute; top: -40px; right: -40px;
  width: 120px; height: 120px; border-radius: 50%;
  background: radial-gradient(circle, rgba(59,130,246,.2), transparent);
}
.payment-hero-label    { font-size: .8rem; color: var(--text2); margin-bottom: 6px; }
.payment-hero-amount   { font-size: 2.4rem; font-weight: 900; color: var(--text); line-height: 1; }
.payment-hero-sub      { font-size: .75rem; color: var(--text2); margin-top: 6px; }
.payment-hero-currency { color: var(--accent); font-size: 1.2rem; margin-right: 3px; }

.payment-breakdown { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-bottom: 14px; }
.pb-card {
  background: var(--card); border: 1px solid var(--border);
  border-radius: var(--radius-sm); padding: 14px;
  transition: background .3s;
}
.pb-icon { font-size: 1.1rem; margin-bottom: 8px; }
.pb-val  { font-size: 1.2rem; font-weight: 900; }
.pb-lbl  { font-size: .72rem; color: var(--text2); margin-top: 2px; }

/* ═══════════════════════════════════════════
   MENU
═══════════════════════════════════════════ */
.menu-options-list { display: flex; flex-direction: column; gap: 12px; }
.menu-option-item {
  background: var(--card); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 16px;
  display: flex; align-items: center; gap: 14px;
  cursor: pointer; transition: all .2s;
}
.menu-option-item:hover { border-color: rgba(59,130,246,.2); background: var(--bg3); }
.menu-option-item:active { transform: scale(.98); }
.menu-option-icon {
  width: 46px; height: 46px; border-radius: 12px;
  display: flex; align-items: center; justify-content: center;
  font-size: 18px; flex-shrink: 0;
}
.menu-icon--account { background: rgba(59,130,246,.15); color: var(--accent); }
.menu-icon--notif  { background: rgba(245,158,11,.15); color: var(--orange); }
.menu-icon--about  { background: rgba(139,92,246,.15); color: var(--purple); }
.menu-option-info  { flex: 1; }
.menu-option-title { font-size: 15px; font-weight: 700; color: var(--text); }
.menu-option-sub   { font-size: 12px; color: var(--text2); margin-top: 3px; }
.menu-option-arrow { color: var(--text3); font-size: 13px; }

/* زر منزلق (Toggle Switch) — لتفعيل الإشعارات */
.menu-option-item--toggle { cursor: default; }
.switch-toggle {
  position: relative; display: inline-block;
  width: 46px; height: 26px; flex-shrink: 0; cursor: pointer;
  direction: ltr; /* يثبّت اتجاه الحركة بغض النظر عن اتجاه الصفحة RTL */
}
.switch-toggle input {
  opacity: 0; width: 0; height: 0; position: absolute;
}
.switch-slider {
  position: absolute; inset: 0; cursor: pointer; box-sizing: border-box;
  background: var(--bg3); border: 1px solid var(--border);
  border-radius: 99px; overflow: hidden;
  transition: background .25s, border-color .25s;
}
.switch-slider::before {
  content: ''; position: absolute; height: 20px; width: 20px;
  left: 3px; top: 50%; border-radius: 50%;
  background: #fff; box-shadow: 0 1px 3px rgba(0,0,0,.3);
  transform: translateY(-50%);
  transition: transform .25s cubic-bezier(.25,.46,.45,.94);
}
.switch-toggle input:checked + .switch-slider {
  background: var(--accent); border-color: var(--accent);
}
.switch-toggle input:checked + .switch-slider::before {
  transform: translate(20px, -50%);
}

/* نموذج تغيير كلمة السر داخل معلومات الحساب */
.account-pass-form { margin-top: 10px; }
.account-pass-form .login-field { margin-bottom: 10px; }
.account-pass-form .login-btn { margin-top: 4px; }

/* ═══════════════════════════════════════════
   MODAL
═══════════════════════════════════════════ */
.modal-overlay {
  position: fixed; inset: 0; z-index: 200;
  background: rgba(0,0,0,.65); backdrop-filter: blur(4px);
  display: none; align-items: flex-end; justify-content: center;
}
.modal-overlay.open { display: flex; animation: overlayFadeIn .25s ease forwards; }
@keyframes overlayFadeIn { from{opacity:0} to{opacity:1} }

.modal {
  background: var(--modal-bg); border: 1px solid var(--border);
  border-radius: var(--radius) var(--radius) 0 0;
  width: 100%; max-width: 520px;
  max-height: 88vh; display: flex; flex-direction: column;
  animation: slideUp .35s cubic-bezier(.25,.46,.45,.94);
  will-change: transform; transition: background .3s;
}
@keyframes slideUp { from{transform:translateY(100%)} to{transform:translateY(0)} }

.modal-handle {
  width: 36px; height: 4px; border-radius: 2px;
  background: rgba(128,128,128,.3); margin: 12px auto 0;
}
.modal-header {
  padding: 14px 18px; border-bottom: 1px solid rgba(255,255,255,.07);
  display: flex; align-items: center; justify-content: space-between;
  background: linear-gradient(135deg, #0A1F63, #162d8a);
}
.modal-title { font-size: 1rem; font-weight: 700; color: #e8eeff; }
.modal-close {
  width: 32px; height: 32px; border-radius: 8px;
  background: rgba(255,255,255,.1); border: 1px solid rgba(255,255,255,.1);
  color: rgba(255,255,255,.7);
  display: flex; align-items: center; justify-content: center;
  cursor: pointer; font-size: .85rem; transition: all .2s;
}
.modal-close:hover { background: rgba(239,68,68,.2); color: #fff; }
.modal-body {
  padding: 16px 18px; overflow-y: auto; flex: 1;
  scrollbar-width: thin; scrollbar-color: rgba(123,159,249,.25) transparent;
}
.modal-body::-webkit-scrollbar { width: 4px; }
.modal-body::-webkit-scrollbar-thumb { background: rgba(123,159,249,.25); border-radius: 10px; }
.modal-footer {
  padding: 14px 18px; border-top: 1px solid var(--border);
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
  background: var(--modal-footer); transition: background .3s;
}
.status-label { font-size: .82rem; color: var(--text2); }
.status-select {
  flex: 1; background: var(--bg3); border: 1px solid var(--border);
  border-radius: var(--radius-sm); padding: 8px 12px;
  color: var(--text); font-family: 'Cairo',sans-serif; font-size: .85rem;
  outline: none; direction: rtl; transition: border-color .2s, background .3s;
}
.status-select:focus { border-color: var(--accent); }
.btn-save-status {
  background: #4f6ef7; border: none; border-radius: var(--radius-sm);
  padding: 8px 18px; color: #fff; font-family: 'Cairo',sans-serif;
  font-weight: 700; font-size: .85rem; cursor: pointer; transition: opacity .2s;
}
.btn-save-status:hover    { opacity: .9; }
.btn-save-status:disabled { opacity: .5; }

/* ═══════════════════════════════════════════
   نافذة التأكيد (بديل confirm() المتصفح)
═══════════════════════════════════════════ */
.confirm-overlay { align-items: center; padding: 20px; }
.confirm-modal {
  width: 100%; max-width: 340px;
  border-radius: var(--radius);
  padding: 26px 22px 20px;
  text-align: center;
  animation: confirmPop .3s cubic-bezier(.25,.46,.45,.94);
}
@keyframes confirmPop { from{ transform: scale(.85); opacity: 0; } to{ transform: scale(1); opacity: 1; } }
.confirm-icon {
  width: 56px; height: 56px; margin: 0 auto 16px; border-radius: 50%;
  background: rgba(239,68,68,.12); color: var(--red);
  display: flex; align-items: center; justify-content: center; font-size: 22px;
}
.confirm-title {
  font-size: 1.05rem; font-weight: 800; color: var(--text); margin-bottom: 8px;
}
.confirm-message {
  font-size: .86rem; color: var(--text2); line-height: 1.7;
  margin-bottom: 22px; white-space: pre-line;
}
.confirm-actions { display: flex; gap: 10px; }
.confirm-btn {
  flex: 1; padding: 12px; border: none; border-radius: var(--radius-sm);
  font-family: 'Cairo', sans-serif; font-weight: 700; font-size: .88rem;
  cursor: pointer; transition: opacity .2s, transform .12s;
}
.confirm-btn:active { transform: scale(.96); }
.confirm-cancel { background: var(--bg3); color: var(--text); border: 1px solid var(--border); }
.confirm-cancel:hover { opacity: .85; }
.confirm-ok { background: var(--red); color: #fff; }
.confirm-ok:hover { opacity: .9; }
.confirm-ok.confirm-ok--safe { background: var(--accent); }
.confirm-modal.confirm-modal--safe .confirm-icon { background: rgba(59,130,246,.12); color: var(--accent); }

/* detail rows */
.detail-row {
  display: flex; justify-content: space-between; align-items: center;
  padding: 10px 12px; border-radius: 10px; font-size: 14px;
  background: rgba(128,128,128,.04); border: 1px solid transparent;
  margin-bottom: 4px; transition: all .18s ease;
}
.detail-row:hover { background: rgba(123,159,249,.06); border-color: rgba(123,159,249,.12); }
.detail-label { color: var(--text3); font-size: 13px; }
.detail-value { color: var(--text); font-weight: 700; text-align: left; }
.detail-row--total { background: rgba(123,159,249,.08); border-color: rgba(123,159,249,.15); }
.detail-row--total .detail-value { color: #7b9ff9; font-size: 16px; }

.detail-products-label {
  margin: 12px 0 6px; font-weight: 700; font-size: 12px;
  color: var(--text3); letter-spacing: 1px; text-transform: uppercase;
}
.detail-products-list {
  background: rgba(128,128,128,.03);
  border: 1px solid var(--border); border-radius: 12px; margin-bottom: 4px;
}
.product-row {
  display: flex; justify-content: space-between; align-items: center;
  padding: 10px 14px; font-size: 13px; color: var(--text2);
  border-bottom: 1px solid var(--border);
}
.product-row:last-child { border-bottom: none; }
.product-row-price {
  color: #7b9ff9; font-weight: 700; font-size: 13px;
  background: rgba(123,159,249,.1); padding: 3px 8px;
  border-radius: 6px; border: 1px solid rgba(123,159,249,.15);
}

/* ═══════════════════════════════════════════
   SEARCH MODAL
═══════════════════════════════════════════ */
.search-input-wrap { position: relative; display: flex; align-items: center; }
.search-icon { position: absolute; right: 12px; color: var(--text3); font-size: 15px; }
.search-input {
  width: 100%; padding: 11px 38px 11px 14px;
  border: 1px solid var(--border); border-radius: 10px;
  font-size: 14px; direction: rtl; outline: none;
  background: var(--bg3); color: var(--text);
  font-family: 'Cairo',sans-serif; transition: border-color .2s, background .3s;
}
.search-input:focus { border-color: var(--accent); }
.search-results { display: flex; flex-direction: column; gap: 10px; margin-top: 12px; }

/* ═══════════════════════════════════════════
   BOTTOM NAV
═══════════════════════════════════════════ */
.bottom-nav {
  position: fixed; bottom: 0; left: 0; right: 0; z-index: 100;
  background: var(--nav-bg-raw);
  backdrop-filter: blur(16px);
  border-top: 1px solid var(--border);
  display: flex; align-items: center;
  height: var(--bottom-nav-height);
  padding: 0 4px;
  padding-bottom: env(safe-area-inset-bottom);
  transition: background .3s, border-color .3s;
}
.nav-btn {
  flex: 1; display: flex; flex-direction: column; align-items: center;
  justify-content: center; gap: 4px; padding: 6px 2px;
  background: none; border: none; color: var(--text3);
  cursor: pointer; font-family: 'Cairo',sans-serif;
  font-size: .62rem; font-weight: 700;
  border-radius: var(--radius-sm); transition: all .2s; position: relative;
}
.nav-btn i { font-size: 1.1rem; transition: transform .2s; }
.nav-btn.active { color: var(--accent); }
.nav-btn.active i { transform: translateY(-1px); }
.nav-btn.active::before {
  content: ''; position: absolute; top: 0;
  width: 20px; height: 2px; border-radius: 1px; background: var(--accent);
}
.nav-btn:hover { color: var(--text); }

/* ═══════════════════════════════════════════
   EMPTY + TOAST
═══════════════════════════════════════════ */
.empty-msg {
  text-align: center; padding: 40px 20px;
  color: var(--text2); font-size: .85rem;
}
.empty-msg i { font-size: 2.5rem; color: var(--text3); margin-bottom: 12px; display: block; }

#toast-msg {
  position: fixed; bottom: 80px; left: 50%; transform: translateX(-50%);
  background: var(--bg3); border: 1px solid var(--border);
  padding: 10px 18px; border-radius: 30px;
  font-size: .82rem; font-weight: 700; color: var(--text);
  z-index: 300; opacity: 1; transition: opacity .4s;
  white-space: nowrap; pointer-events: none;
}
#toast-msg.toast-hide { opacity: 0; }

/* ═══════════════════════════════════════════
   RESPONSIVE — TABLET & DESKTOP
═══════════════════════════════════════════ */
@media (min-width: 640px) {
  .main-container { padding: 24px 28px; }

  .kpi-grid { grid-template-columns: repeat(4,1fr); }
  .kpi-card.wide { grid-column: span 2; }

  .payment-breakdown { grid-template-columns: repeat(4,1fr); }
  .wilaya-summary    { grid-template-columns: repeat(4,1fr); }

  .stats-hero { grid-template-columns: 1fr 1fr 1fr; }
  .stats-hero-card.total { grid-column: span 1; }
}

@media (min-width: 1024px) {
  :root {
    --header-height: 68px;
    --bottom-nav-height: 0px;
  }

  /* شريط جانبي بدلاً من الشريط السفلي */
  .bottom-nav {
    top: var(--header-height); bottom: 0; left: 0; right: auto;
    width: 72px; height: auto; flex-direction: column;
    border-top: none; border-left: 1px solid var(--border);
    padding: 16px 0;
  }
  .nav-btn {
    width: 100%; padding: 14px 0; border-radius: 0;
    flex-direction: column;
  }
  .nav-btn span { display: none; }
  .nav-btn.active::before {
    top: auto; left: 0; width: 3px; height: 28px;
    border-radius: 0 3px 3px 0;
  }
  .main-container {
    top: var(--header-height); bottom: 0;
    right: 0; left: 72px;
    padding: 28px 32px;
  }

  /* شبكة الطلبات */
  .orders-list { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
  .kpi-grid { grid-template-columns: repeat(5,1fr); }
  .kpi-card.wide { grid-column: span 1; }

  /* stats على الشاشات الكبيرة */
  .stats-hero { grid-template-columns: repeat(3,1fr); }
  .stats-hero-card.total { grid-column: span 1; }
  .stats-list {
    display: grid; grid-template-columns: 1fr 1fr; gap: 12px;
  }

  .payment-breakdown { grid-template-columns: repeat(4,1fr); }
  .wilaya-summary    { grid-template-columns: repeat(4,1fr); }

  /* activity على عمودين */
  .activity-list { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }

  .home-greeting { font-size: 1.6rem; }
}

@media (min-width: 1280px) {
  .main-container { padding: 32px 40px; }
  .kpi-grid { gap: 16px; }
  .stats-list { grid-template-columns: repeat(3,1fr); }
}



/* ═══════════════════════════════════════════
   COPY / CASH SLIDER / PAYMENT CARDS
═══════════════════════════════════════════ */
.detail-copy { display: flex; align-items: center; gap: 8px; min-width: 0; }
.copy-btn {
  width: 28px; height: 28px; flex-shrink: 0; border-radius: 8px; cursor: pointer;
  border: 1px solid var(--border); background: var(--bg3); color: var(--text2);
  display: inline-flex; align-items: center; justify-content: center;
  font-size: .78rem; transition: all .2s;
}
.copy-btn:hover, .copy-btn:active { color: var(--accent); border-color: var(--accent); }

.cash-box {
  display: flex; flex-direction: column; gap: 12px;
  padding: 14px; margin: 12px 0 4px; border-radius: 12px;
  border: 1px solid var(--border); background: var(--bg3);
}
.cash-box.held { border-color: rgba(245,158,11,.35); background: rgba(245,158,11,.08); }
.cash-box.mine { border-color: rgba(16,185,129,.35); background: rgba(16,185,129,.08); }
.cash-info { display: flex; align-items: center; gap: 10px; }
.cash-info > i { font-size: 1.25rem; }
.cash-box.held .cash-info > i { color: var(--orange); }
.cash-box.mine .cash-info > i { color: var(--green); }
.cash-title { font-size: .88rem; font-weight: 700; color: var(--text); }
.cash-sub   { font-size: .72rem; color: var(--text2); margin-top: 2px; }

/* الزر المنزلق */
.slide-track {
  position: relative; height: 50px; border-radius: 25px; overflow: hidden;
  direction: ltr; user-select: none; -webkit-user-select: none;
  background: rgba(16,185,129,.12); border: 1px solid rgba(16,185,129,.4);
}
.slide-track.undo { background: rgba(148,163,184,.12); border-color: rgba(148,163,184,.35); }
.slide-fill {
  position: absolute; top: 0; bottom: 0; right: 0; width: 0;
  background: rgba(16,185,129,.35); pointer-events: none;
}
.slide-track.undo .slide-fill { background: rgba(148,163,184,.3); }
.slide-label {
  position: absolute; inset: 0; display: flex; align-items: center; justify-content: center;
  padding: 0 58px; direction: rtl; pointer-events: none;
  font-size: .85rem; font-weight: 700; color: var(--green);
}
.slide-track.undo .slide-label { color: var(--text2); }
.slide-thumb {
  position: absolute; top: 3px; right: 3px; width: 42px; height: 42px; border-radius: 50%;
  background: var(--green); color: #fff; cursor: grab;
  display: flex; align-items: center; justify-content: center;
  box-shadow: 0 2px 8px rgba(0,0,0,.3); touch-action: none;
}
.slide-track.undo .slide-thumb { background: #64748b; }
.slide-track.done .slide-thumb { cursor: default; }

/* بطاقات المدفوعات (تحت بعض) */
.payment-cards { display: flex; flex-direction: column; }
.payment-hero.orange { background: linear-gradient(135deg, rgba(245,158,11,.16), rgba(245,158,11,.05)); border-color: rgba(245,158,11,.28); }
.payment-hero.orange .payment-hero-currency { color: var(--orange); }
.payment-hero.purple   { background: linear-gradient(135deg, rgba(168,85,247,.16), rgba(168,85,247,.05)); border-color: rgba(168,85,247,.28); }
.payment-hero.purple   .payment-hero-currency { color: var(--purple); }
.payment-hero.green  { background: linear-gradient(135deg, rgba(16,185,129,.16), rgba(16,185,129,.05)); border-color: rgba(16,185,129,.28); }
.payment-hero.green  .payment-hero-currency { color: var(--green); }


/* ── تحسينات ── */
.truck-collected { color: var(--orange); }
#status-orders-list .order-card { margin-bottom: 10px; }
#status-orders-list .order-card:last-child { margin-bottom: 0; }

/* ═══════════════════════════════════════════
   LOGIN
═══════════════════════════════════════════ */
input, textarea { user-select: text; -webkit-user-select: text; }

.login-screen { display: none; }
body.locked .login-screen {
  position: fixed; inset: 0; z-index: 9999; display: flex;
  align-items: center; justify-content: center; padding: 20px;
  background: var(--bg); overflow-y: auto;
}
body.locked > header,
body.locked > main,
body.locked > nav,
body.locked > .modal-overlay { display: none !important; }

.login-card {
  width: 100%; max-width: 380px; padding: 28px 22px;
  background: var(--card); border: 1px solid var(--border);
  border-radius: 20px; box-shadow: var(--shadow); text-align: center;
}
.login-logo-img { height: 84px; width: auto; max-width: 100%; margin: 0 auto 6px; }
.login-sub { font-size: .82rem; color: var(--text2); margin: 4px 0 22px; }

.login-field {
  position: relative; display: flex; align-items: center; margin-bottom: 12px;
  background: var(--bg3); border: 1px solid var(--border); border-radius: 12px;
  transition: border-color .2s;
}
.login-field:focus-within { border-color: var(--accent); }
.login-field > i { position: absolute; right: 14px; color: var(--text3); font-size: .9rem; pointer-events: none; }
.login-field input {
  width: 100%; background: transparent; border: none; outline: none;
  padding: 13px 40px 13px 42px; color: var(--text); font-size: .92rem;
  font-family: 'Cairo', sans-serif;
}
.login-eye {
  position: absolute; left: 6px; width: 34px; height: 34px; border: none; background: transparent;
  color: var(--text3); cursor: pointer; font-size: .9rem;
}
.login-remember {
  display: flex; align-items: center; gap: 8px; margin: 4px 2px 12px;
  font-size: .82rem; color: var(--text2); cursor: pointer; text-align: right;
}
.login-remember input {
  appearance: none; -webkit-appearance: none;
  width: 18px; height: 18px; flex-shrink: 0;
  border-radius: 50%; border: 2px solid var(--border);
  background: var(--bg3); cursor: pointer; position: relative;
  transition: background .2s, border-color .2s;
}
.login-remember input:checked {
  background: var(--accent); border-color: var(--accent);
}
.login-remember input:checked::after {
  content: ''; position: absolute; top: 50%; left: 50%;
  width: 6px; height: 6px; border-radius: 50%;
  background: #fff; transform: translate(-50%, -50%);
}
.login-error { min-height: 20px; font-size: .8rem; color: var(--red); margin-bottom: 8px; }
.login-btn {
  width: 100%; padding: 13px; border: none; border-radius: 12px; cursor: pointer;
  background: var(--accent); color: #fff; font-family: 'Cairo', sans-serif;
  font-weight: 700; font-size: .95rem; transition: opacity .2s;
}
.login-btn:disabled { opacity: .6; }

/* أثناء التحقق من الجلسة المحفوظة: مؤشر تحميل بدل النموذج */
.login-spinner {
  display: none; width: 34px; height: 34px; margin: 18px auto 6px;
  border: 3px solid var(--bg3); border-top-color: var(--accent); border-radius: 50%;
  animation: loginSpin .8s linear infinite;
}
@keyframes loginSpin { to { transform: rotate(360deg); } }
body.loading .login-spinner { display: block; }
body.loading #login-form { display: none; }

.menu-icon--logout { background: rgba(239,68,68,.15); color: var(--red); }

/* الشعار: أبيض في الوضع الليلي، كحلي في النهاري */
.logo-for-light { display: none !important; }
body.light .logo-for-dark  { display: none !important; }
body.light .logo-for-light { display: block !important; }
.login-logo-img.logo-for-dark { display: block; }

/* أزرار تفاصيل الطلب: طباعة / حذف */
.icon-btn {
  width: 40px; height: 40px; flex-shrink: 0; cursor: pointer;
  display: inline-flex; align-items: center; justify-content: center;
  background: var(--bg3); border: 1px solid var(--border); border-radius: var(--radius-sm);
  color: var(--text2); font-size: .95rem; transition: all .2s;
}
.icon-btn:hover, .icon-btn:active { color: var(--accent); border-color: var(--accent); }
.icon-btn.danger { color: var(--red); background: rgba(239,68,68,.1); border-color: rgba(239,68,68,.3); }
.icon-btn.danger:hover, .icon-btn.danger:active { background: rgba(239,68,68,.2); border-color: var(--red); color: var(--red); }
.icon-btn:disabled { opacity: .5; }
