/* ================================================================
   SwiftDrop Admin — Design System v5 (v228)
   ================================================================ */

/* ── Design Tokens ── */
:root {
  /* Brand */
  --brand:        #3b82f6;
  --brand-d:      #1d4ed8;
  --brand-dd:     #1e3a8a;
  --brand-light:  #eff6ff;
  --brand-mid:    #93c5fd;

  /* Semantic Colors */
  --green:    #10b981; --green-bg:  #ecfdf5; --green-b:  #6ee7b7; --green-d: #059669;
  --amber:    #f59e0b; --amber-bg:  #fffbeb; --amber-b:  #fcd34d; --amber-d: #d97706;
  --red:      #ef4444; --red-bg:    #fef2f2; --red-b:    #fca5a5; --red-d:   #dc2626;
  --blue:     #3b82f6; --blue-bg:   #eff6ff; --blue-b:   #93c5fd; --blue-d:  #2563eb;
  --purple:   #38bdf8; --purple-bg: #f0f9ff; --purple-b: #7dd3fc;
  --cyan:     #06b6d4; --cyan-bg:   #ecfeff; --cyan-b:   #a5f3fc;

  /* Grays */
  --g0:   #ffffff; --g25:  #fafafa; --g50:  #f8fafc;
  --g100: #f1f5f9; --g150: #eaeff5;
  --g200: #e2e8f0; --g300: #cbd5e1; --g400: #94a3b8;
  --g500: #64748b; --g600: #475569; --g700: #334155;
  --g800: #1e293b; --g850: #162032; --g900: #0f172a; --g950: #080e1a;

  /* Typography */
  --ff: 'Segoe UI', system-ui, -apple-system, 'Helvetica Neue', sans-serif;
  --fs-xs:  11px; --fs-sm:  12px; --fs-base: 13px;
  --fs-md:  14px; --fs-lg:  16px; --fs-xl:   18px;
  --fs-2xl: 22px; --fs-3xl: 28px;
  --fw-normal: 400; --fw-med: 500; --fw-semi: 600; --fw-bold: 700; --fw-black: 800;

  /* Spacing */
  --sp1: 4px;  --sp2: 8px;   --sp3: 12px;  --sp4: 16px;
  --sp5: 20px; --sp6: 24px;  --sp8: 32px;  --sp10: 40px;

  /* Radii */
  --r-xs: 4px; --r-sm: 6px; --r: 8px; --r-md: 10px;
  --r-lg: 14px; --r-xl: 18px; --r-2xl: 24px; --r-full: 9999px;

  /* Shadows */
  --sh-xs: 0 1px 2px rgb(0 0 0/.06);
  --sh-sm: 0 1px 4px rgb(0 0 0/.08), 0 1px 2px rgb(0 0 0/.05);
  --sh:    0 4px 16px rgb(0 0 0/.09), 0 1px 4px rgb(0 0 0/.05);
  --sh-md: 0 6px 20px rgb(0 0 0/.10), 0 2px 6px rgb(0 0 0/.06);
  --sh-lg: 0 12px 36px rgb(0 0 0/.13), 0 4px 12px rgb(0 0 0/.07);
  --sh-xl: 0 20px 60px rgb(0 0 0/.16), 0 8px 20px rgb(0 0 0/.09);
  --sh-brand: 0 4px 16px rgba(59,130,246,.35);
  --sh-green: 0 4px 16px rgba(16,185,129,.3);

  /* Layout */
  --topbar-h: 100px;
  --sidebar-w: 0px;

  /* Transitions */
  --t-fast: 100ms; --t: 180ms; --t-slow: 320ms;
  --ease: cubic-bezier(.4,0,.2,1);
  --ease-out: cubic-bezier(0,0,.2,1);
  --ease-in: cubic-bezier(.4,0,1,1);
  --spring: cubic-bezier(.34,1.56,.64,1);
}

/* ── Reset ── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html {
  font-family: var(--ff);
  font-size: var(--fs-base);
  color: var(--g800);
  background: #e8eef7;
  -webkit-font-smoothing: antialiased;
}
body { min-height: 100vh; }
button { font-family: inherit; cursor: pointer; }
input, select, textarea { font-family: inherit; font-size: var(--fs-base); }
a { color: var(--brand); text-decoration: none; }
a:hover { text-decoration: underline; }
.muted  { color: var(--g400); font-size: var(--fs-sm); }
.hidden { display: none !important; }

/* ── View switching ── */
.view { display: none; }
.view.active { display: block; }

body { background: radial-gradient(circle at 85% 0%, rgba(79,70,229,.08), transparent 34%), #e8eef7; }
.ops-flow-illustration { margin: 12px 16px 4px; padding: 14px 18px; display: flex; align-items: center; justify-content: center; gap: 12px; border: 1px solid var(--g200); border-radius: var(--r-lg); background: var(--g0); box-shadow: var(--sh-sm); overflow: hidden; }
.flow-step { min-width: 150px; display: flex; align-items: center; gap: 10px; }
.flow-step div { display: grid; gap: 2px; }
.flow-step strong { color: var(--g800); font-size: var(--fs-md); }
.flow-step small { color: var(--g500); white-space: nowrap; }
.flow-art { width: 42px; height: 42px; flex: 0 0 42px; display: grid; place-items: center; border-radius: 14px; font-size: 20px; box-shadow: inset 0 0 0 1px rgba(255,255,255,.7), var(--sh-xs); }
.flow-order { background: var(--blue-bg); }
.flow-ai { background: var(--blue-bg); color: var(--blue-d); font-size: 13px; font-weight: 900; }
.flow-courier { background: var(--amber-bg); }
.flow-done { background: var(--green-bg); color: var(--green-d); font-weight: 900; }
.flow-line { width: 54px; height: 2px; position: relative; background: linear-gradient(90deg, var(--brand-mid), var(--brand)); opacity: .7; }
.flow-line::after { content: ''; position: absolute; left: -1px; top: -3px; border: 4px solid transparent; border-right-color: var(--brand); }
.map-stage { position: relative; flex: 1; min-width: 0; min-height: 520px; border-radius: var(--r-lg); overflow: hidden; background: repeating-linear-gradient(45deg, var(--g100), var(--g100) 14px, var(--g50) 14px, var(--g50) 28px); }
.map-stage .main-map-el { height: 100%; min-height: 520px; }
.map-network-status { position: absolute; z-index: 900; inset-inline: 16px; bottom: 16px; display: grid; grid-template-columns: auto 1fr auto; column-gap: 10px; align-items: center; padding: 12px 14px; border: 1px solid var(--amber-b); border-radius: var(--r-md); background: rgba(255,251,235,.96); color: var(--g800); box-shadow: var(--sh-md); backdrop-filter: blur(10px); }

/* Live performance HUD floating on top of the map canvas */
.map-perf-hud {
  position: absolute;
  z-index: 800;
  top: 12px;
  right: 12px;
  display: flex;
  flex-direction: column;
  gap: 5px;
  padding: 10px 14px;
  border-radius: var(--r-md);
  background: rgba(15, 23, 42, .78);
  color: #fff;
  font-size: var(--fs-xs);
  box-shadow: var(--sh-md);
  backdrop-filter: blur(6px);
  pointer-events: none;
  min-width: 150px;
}
.map-perf-hud-row { display: flex; align-items: center; justify-content: space-between; gap: var(--sp3); white-space: nowrap; }
.map-perf-hud-row span:first-child { color: #cbd5e1; }
.map-perf-hud-row strong { font-size: var(--fs-sm); color: #fff; }
.map-perf-hud-row strong.warn { color: #fca5a5; }
.map-perf-hud-time { color: #94a3b8; font-size: 10px; text-align: center; margin-top: 2px; }
@media (max-width: 640px) { .map-perf-hud { display: none; } }
.map-network-status[hidden] { display: none; }
.map-network-status strong, .map-network-status > span:not(.map-network-icon) { grid-column: 2; }
.map-network-icon { grid-row: 1 / span 2; font-size: 24px; }
.map-network-status button { grid-column: 3; grid-row: 1 / span 2; border: 0; border-radius: var(--r-sm); padding: 8px 12px; color: white; background: var(--brand); font-weight: 700; }
@media (max-width: 1000px) { .ops-flow-illustration { justify-content: flex-start; overflow-x: auto; } .flow-line { min-width: 30px; } }
@media (max-width: 700px) { .map-network-status { grid-template-columns: auto 1fr; } .map-network-status button { grid-column: 1 / -1; grid-row: auto; margin-top: 8px; } }

/* ================================================================
   LOGIN
   ================================================================ */
.login-shell {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background:
    radial-gradient(circle at 12% 8%, rgba(59,130,246,.07), transparent 40%),
    radial-gradient(circle at 90% 92%, rgba(59,130,246,.05), transparent 38%),
    #faf6f0;
  position: relative;
  overflow: hidden;
}

.login-card {
  background: #fffdfa;
  border: 1px solid #ece4d8;
  border-radius: 20px;
  padding: 44px 40px;
  width: 400px;
  box-shadow: 0 24px 60px rgba(20,15,5,.09), 0 4px 14px rgba(20,15,5,.05);
  text-align: center;
  position: relative;
  z-index: 1;
}

.login-brand {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
  margin-bottom: 6px;
}
.login-brand-icon { flex-shrink: 0; opacity: .85; }
.login-logo {
  font-family: 'Georgia', 'Iowan Old Style', 'Palatino Linotype', serif;
  font-style: italic;
  font-size: 30px;
  font-weight: 600;
  color: #1c1712;
  letter-spacing: -.5px;
}

.login-sub {
  color: #8a7d6c;
  font-size: var(--fs-md);
  margin-bottom: var(--sp8);
  position: relative;
  padding-bottom: 18px;
}
.login-sub::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 40px;
  height: 1px;
  background: #d8cbb8;
}

.login-form { text-align: right; }
.login-form .field-group { margin-bottom: var(--sp5); }
.login-form label {
  display: block;
  font-size: var(--fs-xs);
  font-weight: var(--fw-semi);
  color: #9a8d7a;
  margin-bottom: 6px;
}
.login-form input {
  width: 100%;
  padding: 9px 2px;
  background: transparent;
  border: none;
  border-bottom: 1.5px solid #e4d9c8;
  border-radius: 0;
  color: #1c1712;
  font-size: var(--fs-md);
  outline: none;
  transition: border-color var(--t), background var(--t);
}
.login-form input::placeholder { color: #c2b6a3; }
.login-form input:focus {
  border-color: #1c1712;
  box-shadow: none;
}

.btn-login {
  width: 100%;
  padding: 13px;
  margin-top: var(--sp6);
  background: #1c1712;
  color: #fff;
  border: none;
  border-radius: 999px;
  font-size: var(--fs-md);
  font-weight: var(--fw-bold);
  transition: background var(--t) var(--ease), transform var(--t-fast) var(--ease);
  letter-spacing: .2px;
}
.btn-login:hover { background: #35291c; }
.btn-login:active { background: #35291c; transform: scale(.98); }

.btn-forgot {
  display: block;
  width: 100%;
  margin-top: var(--sp4);
  background: none;
  border: none;
  color: #9a8d7a;
  font-size: var(--fs-sm);
  cursor: pointer;
  text-align: center;
  text-decoration: underline;
}
.btn-forgot:hover { color: #1c1712; }

.login-status {
  margin-top: var(--sp3);
  font-size: var(--fs-sm);
  min-height: 18px;
  text-align: center;
  display: none;
}
.login-status.show      { display: block; }
.login-status.is-error   { color: var(--red-d); }
.login-status.is-success { color: var(--green-d); }
.login-status.is-info    { color: var(--g500); }

/* ================================================================
   DASHBOARD SHELL
   ================================================================ */
#dashboardView {
  flex-direction: column;
  min-height: 100vh;
  background: #f0f4f8;
}
#dashboardView.active {
  display: flex;
}

/* ── TOPBAR ── */
.topbar {
  background: linear-gradient(180deg, #16181d 0%, #0a0b0d 100%);
  display: flex;
  flex-direction: column;
  position: sticky;
  top: 0;
  z-index: 1000;
  box-shadow: 0 4px 24px rgba(0,0,0,.45);
}

/* Row 1 */
.topbar-row1 {
  display: flex;
  align-items: center;
  gap: var(--sp2);
  padding: 8px var(--sp5);
  border-bottom: 1px solid rgba(255,255,255,.08);
}

/* Row 2: tabs + alerts */
.topbar-row2 {
  display: flex;
  align-items: center;
  gap: var(--sp3);
  padding: 6px var(--sp5);
  background: rgba(0,0,0,.15);
}

.topbar-brand {
  display: flex;
  align-items: center;
  gap: var(--sp2);
  font-size: var(--fs-lg);
  font-weight: var(--fw-black);
  letter-spacing: -0.5px;
  white-space: nowrap;
  flex-shrink: 0;
}
.topbar-brand-icon {
  width: 32px;
  height: 32px;
  background: linear-gradient(135deg, #38bdf8, #3b82f6);
  border-radius: var(--r);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  flex-shrink: 0;
  box-shadow: 0 2px 10px rgba(59,130,246,.5);
}
.topbar-brand-text {
  background: linear-gradient(135deg, #dbeafe, #93c5fd);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.topbar-search-wrap {
  position: relative;
  flex: 1 1 160px;
  min-width: 0;
  max-width: 340px;
}

.global-search {
  width: 100%;
  padding: 7px var(--sp3) 7px 32px;
  background: rgba(255,255,255,.08);
  border: 1px solid rgba(255,255,255,.12);
  border-radius: var(--r-full);
  color: #fff;
  font-size: var(--fs-sm);
  outline: none;
  transition: all var(--t) var(--ease);
}
.global-search::placeholder { color: rgba(255,255,255,.35); }
.global-search:focus {
  background: rgba(255,255,255,.14);
  border-color: rgba(165,180,252,.5);
  box-shadow: 0 0 0 3px rgba(59,130,246,.2);
}
.topbar-search-wrap::before {
  content: '🔍';
  position: absolute;
  right: 10px;
  top: 50%;
  transform: translateY(-50%);
  font-size: 11px;
  opacity: .4;
  pointer-events: none;
}

/* Status badges in row 1 */
.topbar-status {
  display: flex;
  align-items: center;
  gap: var(--sp1);
  flex-shrink: 0;
}

.search-dropdown {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  left: 0;
  background: var(--g0);
  border: 1px solid var(--g200);
  border-radius: var(--r-lg);
  box-shadow: var(--sh-xl);
  z-index: 2000;
  overflow: hidden;
  max-height: 340px;
  overflow-y: auto;
}
.search-result-item {
  display: flex;
  align-items: center;
  gap: var(--sp2);
  padding: 10px var(--sp3);
  cursor: pointer;
  border-bottom: 1px solid var(--g100);
  transition: background var(--t-fast);
}
.search-result-item:last-child { border-bottom: none; }
.search-result-item:hover { background: var(--g50); }
.search-result-type {
  font-size: var(--fs-xs);
  padding: 2px 8px;
  border-radius: var(--r-full);
  font-weight: var(--fw-bold);
  flex-shrink: 0;
}
.srt-order   { background: var(--blue-bg);   color: var(--blue-d); }
.srt-courier { background: var(--green-bg);  color: var(--green-d); }
.srt-rest    { background: var(--amber-bg);  color: var(--amber-d); }
.search-result-name { font-size: var(--fs-sm); color: var(--g700); font-weight: var(--fw-med); }
.search-result-sub  { font-size: var(--fs-xs); color: var(--g400); margin-right: auto; }
.search-empty { padding: var(--sp5); text-align: center; color: var(--g400); font-size: var(--fs-sm); }

/* Topbar tabs (row 2) */
.topbar-tabs {
  display: flex;
  align-items: center;
  gap: var(--sp1);
  flex-shrink: 0;
  flex-wrap: wrap;
}

/* Topbar alerts (row 2) */
.topbar-alerts {
  display: flex;
  align-items: center;
  gap: var(--sp2);
  flex: 1;
  min-width: 0;
  overflow: hidden;
}
.topbar-alerts-icon {
  font-size: 14px;
  flex-shrink: 0;
}
.topbar-alerts-box {
  display: flex;
  flex-wrap: nowrap;
  gap: var(--sp2);
  flex: 1;
  min-width: 0;
  overflow: hidden;
}
.topbar-alert-empty {
  font-size: var(--fs-xs);
  color: rgba(255,255,255,.3);
}
.topbar-alerts-clear {
  background: none;
  border: none;
  color: rgba(255,255,255,.4);
  font-size: var(--fs-sm);
  cursor: pointer;
  flex-shrink: 0;
  padding: 2px 4px;
  border-radius: var(--r-sm);
  transition: color var(--t-fast);
}
.topbar-alerts-clear:hover { color: rgba(255,255,255,.8); }

/* .topbar-mid kept for JS compatibility */
.topbar-mid { display: none; }

.tbadge {
  font-size: 10px;
  padding: 3px 9px;
  border-radius: var(--r-full);
  background: rgba(255,255,255,.07);
  color: rgba(255,255,255,.5);
  border: 1px solid rgba(255,255,255,.1);
  white-space: nowrap;
  font-weight: var(--fw-semi);
  letter-spacing: .2px;
}
.tbadge.online { background: rgba(16,185,129,.15); color: #34d399; border-color: rgba(16,185,129,.25); }
.tbadge.warn   { background: rgba(245,158,11,.15);  color: #fbbf24; border-color: rgba(245,158,11,.25); }

.topbar-actions {
  display: flex;
  align-items: center;
  gap: var(--sp1);
  flex-shrink: 0;
  flex-wrap: wrap;
}

.btn-topbar {
  padding: 6px 12px;
  font-size: var(--fs-xs);
  font-weight: var(--fw-semi);
  border-radius: var(--r-full);
  border: 1px solid rgba(255,255,255,.15);
  background: rgba(255,255,255,.07);
  color: rgba(255,255,255,.75);
  transition: background var(--t-fast) var(--ease), color var(--t-fast) var(--ease),
    border-color var(--t-fast) var(--ease), transform var(--t-fast) var(--ease),
    box-shadow var(--t-fast) var(--ease);
  white-space: nowrap;
  letter-spacing: .1px;
}
.btn-topbar:hover { background: rgba(255,255,255,.15); color: #fff; border-color: rgba(255,255,255,.25); transform: translateY(-1px); }
.btn-topbar:active { transform: translateY(0) scale(.96); transition-duration: 60ms; }

/* التوزيع / التطبيق: أزرار إيقاف مؤقت — لون كهرماني عند التمرير، أحمر عند التفعيل (متوقف فعلياً) */
#pauseDispatchBtn:hover, #pauseAppBtn:hover {
  background: rgba(245,158,11,.16); color: #fcd34d; border-color: rgba(245,158,11,.4);
  box-shadow: 0 2px 10px rgba(245,158,11,.18);
}
#pauseDispatchBtn.is-paused, #pauseAppBtn.is-paused {
  background: rgba(239,68,68,.16); color: #fca5a5; border-color: rgba(239,68,68,.4);
}
#pauseDispatchBtn.is-paused:hover, #pauseAppBtn.is-paused:hover {
  background: rgba(239,68,68,.24); color: #f87171; border-color: rgba(239,68,68,.55);
}

/* أدوات: تمييز أزرق هادئ عند التمرير/الفتح */
.tools-menu > summary.btn-topbar:hover { background: rgba(59,130,246,.16); color: #93c5fd; border-color: rgba(59,130,246,.4); }
.tools-menu[open] > summary.btn-topbar { background: rgba(59,130,246,.2); color: #93c5fd; border-color: rgba(59,130,246,.45); }

.btn-topbar-logout { border-color: rgba(239,68,68,.3); color: #fca5a5; }
.btn-topbar-logout:hover { background: rgba(239,68,68,.18); color: #f87171; border-color: rgba(239,68,68,.45); box-shadow: 0 2px 10px rgba(239,68,68,.2); }
.btn-topbar-logout:active { transform: translateY(0) scale(.95); }

.tools-menu { position: relative; }
.tools-menu summary { list-style: none; }
.tools-menu summary::-webkit-details-marker { display: none; }
.tools-dropdown {
  position: absolute;
  top: calc(100% + 10px);
  left: 0;
  background: var(--g0);
  border: 1px solid var(--g200);
  border-radius: var(--r-lg);
  box-shadow: var(--sh-xl);
  z-index: 2000;
  min-width: 210px;
  overflow: hidden;
}
.tools-dropdown button {
  display: block;
  width: 100%;
  text-align: right;
  padding: 11px var(--sp4);
  font-size: var(--fs-sm);
  background: none;
  border: none;
  color: var(--g700);
  border-bottom: 1px solid var(--g100);
  transition: background var(--t-fast), color var(--t-fast);
  font-weight: var(--fw-med);
}
.tools-dropdown button:last-child { border-bottom: none; }
.tools-dropdown button:hover { background: var(--brand-light); color: var(--brand); }

/* Notification dropdown — a real form, not a button list, so it gets its
   own positioning instead of extending .tools-dropdown's button reset. */
.notif-dropdown {
  position: absolute;
  top: calc(100% + 10px);
  left: 0;
  background: var(--g0);
  border: 1px solid var(--g200);
  border-radius: var(--r-lg);
  box-shadow: var(--sh-xl);
  z-index: 2000;
  min-width: 300px;
  max-width: 320px;
  padding: 14px;
}
.notif-dropdown .field-group:last-of-type { margin-bottom: 0; }

/* ── STATS STRIP ── */
.stats-strip {
  display: flex;
  align-items: stretch;
  background: linear-gradient(135deg, #172554 0%, #1e3a8a 100%);
  border-bottom: 1px solid rgba(165,180,252,.15);
  overflow-x: auto;
  flex-shrink: 0;
  padding: var(--sp2) var(--sp4);
  gap: var(--sp2);
}
.stats-strip::-webkit-scrollbar { height: 3px; }
.stats-strip::-webkit-scrollbar-thumb { background: rgba(255,255,255,.2); }

.sc {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: var(--sp2) var(--sp4);
  gap: 2px;
  min-width: 90px;
  flex-shrink: 0;
  border-radius: var(--r);
  background: rgba(255,255,255,.07);
  border: 1px solid rgba(255,255,255,.1);
  transition: all var(--t-fast);
  cursor: default;
}
.sc:hover { background: rgba(255,255,255,.12); transform: translateY(-1px); }

.sc-icon {
  font-size: 18px;
  gap: 1px;
}

.sc strong {
  font-size: 24px;
  font-weight: var(--fw-black);
  color: #fff;
  line-height: 1;
  letter-spacing: -0.5px;
}
.sc span {
  font-size: 13px;
  color: rgba(255,255,255,.55);
  text-align: center;
  font-weight: var(--fw-semi);
  letter-spacing: .2px;
  white-space: nowrap;
}

.sc.sc-blue   { background: rgba(59,130,246,.2);  border-color: rgba(59,130,246,.3);  }
.sc.sc-amber  { background: rgba(245,158,11,.2);  border-color: rgba(245,158,11,.3);  }
.sc.sc-green  { background: rgba(16,185,129,.2);  border-color: rgba(16,185,129,.3);  }
.sc.sc-red    { background: rgba(239,68,68,.2);   border-color: rgba(239,68,68,.3);   }
.sc.sc-purple { background: rgba(56,189,248,.2);  border-color: rgba(56,189,248,.3);  }

/* ── MAIN MAP (always visible) ── */
.dashboard-map-section {
  background: var(--g0);
  border-bottom: 1px solid var(--g200);
  box-shadow: var(--sh-xs);
}

.map-top-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--sp2) var(--sp4);
  border-bottom: 1px solid var(--g100);
  background: var(--g50);
}
.map-section-title {
  font-size: var(--fs-sm);
  font-weight: var(--fw-bold);
  color: var(--g600);
  display: flex;
  align-items: center;
  gap: var(--sp2);
}
.map-top-actions { display: flex; gap: var(--sp2); }

.map-body {
  display: flex;
  height: 400px;
}

.main-map-el {
  flex: 1;
  min-width: 0;
  z-index: 1;
  touch-action: none; /* stop trackpad pinch / browser page-zoom from hijacking the map's own zoom */
}

.map-stores-sidebar {
  width: 240px;
  flex-shrink: 0;
  border-right: 1px solid var(--g200);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  background: var(--g0);
}

.stores-sidebar-head {
  padding: var(--sp2) var(--sp3);
  font-size: var(--fs-xs);
  font-weight: var(--fw-bold);
  color: var(--g500);
  background: var(--g50);
  border-bottom: 1px solid var(--g200);
  text-transform: uppercase;
  letter-spacing: .6px;
}
.map-couriers-head { margin-top: var(--sp3); border-top: 1px solid var(--g200); }

/* Map tab: rich detail panel shown when a courier or customer marker is clicked */
.map-detail-panel {
  padding: var(--sp3);
  background: var(--brand-light);
  border-bottom: 2px solid var(--brand);
}
.map-detail-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: var(--sp2);
}
.map-detail-title { font-size: var(--fs-md); font-weight: var(--fw-bold); color: var(--g900); }
.map-detail-close {
  border: none;
  background: rgba(0,0,0,.06);
  color: var(--g600);
  width: 22px;
  height: 22px;
  border-radius: 50%;
  font-size: 11px;
  line-height: 1;
  flex-shrink: 0;
}
.map-detail-close:hover { background: rgba(0,0,0,.12); color: var(--g900); }
.map-detail-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--sp2);
  padding: 4px 0;
  font-size: var(--fs-sm);
  border-bottom: 1px dashed rgba(59,130,246,.18);
}
.map-detail-row:last-child { border-bottom: none; }
.map-detail-row span { color: var(--g600); }
.map-detail-row strong { color: var(--g900); text-align: end; }

.stores-list {
  flex: 1;
  overflow-y: auto;
}
.stores-list::-webkit-scrollbar { width: 4px; }
.stores-list::-webkit-scrollbar-thumb { background: var(--g200); border-radius: 2px; }

.restaurant-details-bar {
  padding: var(--sp4);
  background: var(--g50);
  min-height: 36px;
  font-size: var(--fs-sm);
  overflow-y: auto;
  height: 100%;
}

/* ── Restaurants Tab Layout ── */
#restaurantsTab { padding: 0 !important; }
.restaurants-layout {
  display: flex;
  height: calc(100vh - var(--topbar-h) - 56px);
  overflow: hidden;
}
.restaurants-list-panel {
  width: 280px;
  min-width: 220px;
  max-width: 520px;
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  border-left: 1px solid var(--g200);
  background: var(--g0);
  overflow-y: auto;
  overflow-x: hidden;
}
.restaurants-resizer {
  align-self: stretch;
  width: 6px;
  flex-shrink: 0;
  border-radius: var(--r-full, 999px);
  background: var(--g200, #e5e7eb);
  cursor: col-resize;
}
.restaurants-resizer:hover, .restaurants-resizer.is-dragging { background: var(--g300, #cbd5e1); }
.restaurants-list-head {
  padding: var(--sp3) var(--sp4);
  font-size: var(--fs-sm);
  font-weight: var(--fw-bold);
  color: var(--g700);
  border-bottom: 1px solid var(--g200);
  background: var(--g50);
  flex-shrink: 0;
}
.restaurants-card-list {
  flex-shrink: 0;
  height: 340px;
  overflow-y: auto;
  overflow-x: hidden;
}
.restaurants-card-list thead th {
  position: sticky;
  top: 0;
  z-index: 1;
}
.restaurants-card-list tbody tr { cursor: pointer; }
.rest-row-selected td { background: var(--brand-light) !important; }
.rest-row-name-cell { display: flex; align-items: center; gap: var(--sp2); min-width: 0; }
.rest-row-thumb { width: 32px; height: 32px; border-radius: var(--r-sm); object-fit: cover; background: var(--g100); flex-shrink: 0; }
.rest-row-name-cell span { font-weight: var(--fw-semi); color: var(--g800); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.rest-has-loc { color: var(--green-d); font-weight: var(--fw-semi); white-space: nowrap; }
.rest-no-loc  { color: var(--amber-d); font-weight: var(--fw-semi); white-space: nowrap; }

.restaurant-edit-panel {
  flex: 1;
  overflow-y: auto;
  background: var(--g50);
}
.map-restaurant-bar {
  padding: var(--sp2) var(--sp4);
  background: var(--g50);
  border-top: 1px solid var(--g200);
  font-size: var(--fs-sm);
  flex-shrink: 0;
}

/* ── TABS NAV (old — hidden, tabs now in topbar) ── */
.tabs-nav { display: none; }

/* Tab buttons inside topbar */
.tab-btn {
  padding: 5px 14px;
  font-size: var(--fs-sm);
  font-weight: var(--fw-semi);
  color: rgba(255,255,255,.6);
  background: rgba(255,255,255,.07);
  border: 1px solid rgba(255,255,255,.12);
  border-radius: var(--r-full);
  transition: all var(--t) var(--ease);
  cursor: pointer;
  white-space: nowrap;
}
.tab-btn:hover {
  background: rgba(255,255,255,.15);
  color: rgba(255,255,255,.9);
  border-color: rgba(255,255,255,.25);
}
.tab-btn.active {
  background: linear-gradient(135deg, #38bdf8, #3b82f6);
  color: #fff;
  border-color: #3b82f6;
  font-weight: var(--fw-bold);
  box-shadow: 0 2px 12px rgba(59,130,246,.5);
}
.reg-actions-cell { white-space: nowrap; display: flex; gap: 6px; }
.reg-password-mask { font-family: monospace; letter-spacing: 1px; }
.tab-count-badge {
  display: inline-block;
  min-width: 16px;
  padding: 0 5px;
  margin-inline-start: 4px;
  border-radius: var(--r-full);
  background: var(--red, #ef4444);
  color: #fff;
  font-size: 10px;
  font-weight: var(--fw-bold);
  line-height: 16px;
  text-align: center;
}

/* ── ALERTS (now in topbar row 2) ── */
.alerts-bar { display: none; } /* hidden — alerts moved to topbar */
.alerts-bar-title { display: none; }
.alerts-inline { display: none; }

/* Alert items inside topbar */
.alert-item {
  font-size: var(--fs-xs);
  color: #fff;
  background: rgba(245,158,11,.3);
  border: 1px solid rgba(245,158,11,.4);
  border-radius: var(--r-full);
  padding: 2px 10px;
  white-space: nowrap;
  flex-shrink: 0;
}

/* ── MAP TAB ── */
.tab-panel-map { padding: 0 !important; background: var(--g50) !important; }

.map-tab-inner {
  display: flex;
  flex-direction: column;
  height: calc(100vh - var(--topbar-h) - 80px);
}
.map-tab-toolbar {
  display: flex;
  align-items: center;
  gap: var(--sp3);
  padding: var(--sp2) var(--sp4);
  background: var(--g0);
  border-bottom: 1px solid var(--g200);
  flex-shrink: 0;
}
.map-mode-banner {
  flex: 1;
  background: #fef9c3;
  border: 1px solid #fde047;
  color: #713f12;
  font-size: var(--fs-sm);
  font-weight: var(--fw-semi);
  padding: 4px 10px;
  border-radius: var(--r-sm);
  text-align: center;
  animation: pulse-banner 1.2s ease-in-out infinite;
}
@keyframes pulse-banner {
  0%, 100% { opacity: 1; }
  50%       { opacity: .65; }
}

/* Full-width unmissable banner for critical events (road hazard, SLA breach) */
.critical-alert-banner {
  position: fixed;
  top: 0;
  inset-inline: 0;
  z-index: 5000;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--sp3);
  padding: 10px var(--sp4);
  background: #dc2626;
  color: #fff;
  font-size: var(--fs-md);
  font-weight: var(--fw-bold);
  text-align: center;
  box-shadow: 0 2px 14px rgba(220,38,38,.5);
  animation: pulse-banner 1s ease-in-out infinite;
}
.critical-alert-banner[hidden] { display: none; }
.critical-alert-banner button {
  flex-shrink: 0;
  border: 1px solid rgba(255,255,255,.6);
  background: rgba(255,255,255,.15);
  color: #fff;
  border-radius: var(--r-sm);
  padding: 3px 10px;
  font-size: var(--fs-sm);
  cursor: pointer;
}
.critical-alert-banner button:hover { background: rgba(255,255,255,.28); }
.btn-set-location {
  margin-top: 6px;
  font-size: var(--fs-xs);
  background: var(--brand-light);
  color: var(--brand-d);
  border: 1px solid var(--brand-mid);
  border-radius: var(--r-full);
  padding: 2px 8px;
  cursor: pointer;
  transition: background var(--t);
}
.btn-set-location:hover { background: var(--brand-mid); color: var(--g0); }
.store-has-pos {
  display: inline-block;
  margin-top: 4px;
  font-size: var(--fs-xs);
  color: var(--green-d);
}
.map-tab-title {
  font-size: var(--fs-sm);
  font-weight: var(--fw-bold);
  color: var(--g700);
}
.map-tab-body {
  display: flex;
  flex: 1;
  min-height: 0;
}
.map-tab-body .main-map-el { flex: 1; min-width: 0; }
.map-tab-body .map-stores-sidebar {
  width: 240px;
  flex-shrink: 0;
  border-right: 1px solid var(--g200);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  background: var(--g0);
}
.map-sidebar-search {
  margin: var(--sp2) var(--sp3);
  padding: 6px var(--sp2);
  border: 1.5px solid var(--g200);
  border-radius: var(--r-sm);
  font-size: var(--fs-sm);
  outline: none;
  background: var(--g50);
  flex-shrink: 0;
}
.map-sidebar-search:focus { border-color: var(--brand); background: var(--g0); }

/* ── TAB PANELS ── */
.tab-panel { display: none; padding: var(--sp4) var(--sp5); background: #e8eef7; }
.tab-panel.active { display: block; }
.tab-panel-hidden { display: none !important; }

/* ── BUTTONS (global) ── */
.btn-primary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--sp1);
  padding: 9px var(--sp5);
  background: linear-gradient(135deg, var(--brand), var(--brand-d));
  color: #fff;
  border: none;
  border-radius: var(--r);
  font-size: var(--fs-sm);
  font-weight: var(--fw-bold);
  cursor: pointer;
  transition: all var(--t) var(--ease);
  box-shadow: var(--sh-brand);
  letter-spacing: .2px;
}
.btn-primary:hover { transform: translateY(-1px); box-shadow: 0 6px 20px rgba(59,130,246,.45); filter: brightness(1.05); }
.btn-primary:active { transform: none; box-shadow: var(--sh-brand); }
.btn-primary:disabled { opacity: .5; cursor: not-allowed; transform: none; box-shadow: none; filter: none; }
.btn-full { width: 100%; }

.btn-secondary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--sp1);
  padding: 9px var(--sp4);
  background: var(--g0);
  color: var(--g700);
  border: 1.5px solid var(--g200);
  border-radius: var(--r);
  font-size: var(--fs-sm);
  font-weight: var(--fw-semi);
  cursor: pointer;
  transition: all var(--t) var(--ease);
}
.btn-secondary:hover { background: var(--g50); border-color: var(--g300); color: var(--g800); }

.btn-sm {
  padding: 6px 12px;
  font-size: var(--fs-xs);
  font-weight: var(--fw-semi);
  border: 1.5px solid var(--g200);
  border-radius: var(--r);
  background: var(--g0);
  color: var(--g700);
  cursor: pointer;
  transition: all var(--t-fast) var(--ease);
  white-space: nowrap;
}
.btn-sm:hover { background: var(--g50); border-color: var(--g300); transform: translateY(-1px); }
.btn-sm-accent {
  background: var(--brand-light);
  border-color: var(--brand-mid);
  color: var(--brand-d);
}
.btn-sm-accent:hover { background: #dbeafe; border-color: var(--brand); }

.btn-danger {
  display: inline-flex;
  align-items: center;
  gap: var(--sp1);
  padding: 9px var(--sp4);
  background: var(--red-bg);
  color: var(--red-d);
  border: 1.5px solid var(--red-b);
  border-radius: var(--r);
  font-size: var(--fs-sm);
  font-weight: var(--fw-bold);
  cursor: pointer;
  transition: all var(--t) var(--ease);
}
.btn-danger:hover { background: #fee2e2; border-color: var(--red-d); transform: translateY(-1px); }

.btn-warn {
  display: inline-flex;
  align-items: center;
  gap: var(--sp1);
  padding: 9px var(--sp4);
  background: var(--amber-bg);
  color: var(--amber-d);
  border: 1.5px solid var(--amber-b);
  border-radius: var(--r);
  font-size: var(--fs-sm);
  font-weight: var(--fw-bold);
  cursor: pointer;
  transition: all var(--t) var(--ease);
}
.btn-warn:hover { background: #fef3c7; border-color: var(--amber-d); transform: translateY(-1px); }

.btn-sm-inline {
  padding: 6px 12px;
  font-size: var(--fs-xs);
}

.courier-suspended-banner {
  margin-top: var(--sp2);
  padding: var(--sp2) var(--sp3);
  background: linear-gradient(135deg, var(--amber-bg), #fff7e0);
  border: 1px solid var(--amber-b);
  border-radius: var(--r);
  color: var(--amber-d);
  font-size: var(--fs-sm);
  font-weight: var(--fw-semi);
  display: flex;
  align-items: center;
  gap: var(--sp2);
}

.btn-danger-sm {
  padding: 4px 10px;
  font-size: var(--fs-xs);
  font-weight: var(--fw-semi);
  border: 1.5px solid var(--red-b);
  border-radius: var(--r-sm);
  background: var(--red-bg);
  color: var(--red-d);
  cursor: pointer;
  transition: all var(--t-fast) var(--ease);
  white-space: nowrap;
}
.btn-danger-sm:hover { background: #fee2e2; border-color: var(--red-d); }
.btn-danger-sm:disabled { opacity: .45; cursor: not-allowed; }
.hazard-actions-row { display: flex; gap: 6px; margin-top: 6px; }
.hazard-actions-row .btn-sm { flex: 1; }

.btn-secondary-sm {
  padding: 4px 10px;
  font-size: var(--fs-xs);
  font-weight: var(--fw-semi);
  border: 1.5px solid var(--g300);
  border-radius: var(--r-sm);
  background: var(--g50);
  color: var(--g700);
  cursor: pointer;
  transition: all var(--t-fast) var(--ease);
  white-space: nowrap;
}
.btn-secondary-sm:hover { background: var(--g100); border-color: var(--g400); }

.shop-name-edit-input {
  border: 1.5px solid var(--brand);
  border-radius: var(--r-sm);
  padding: 2px 8px;
  font-size: var(--fs-sm);
  font-family: var(--ff);
  background: var(--g0);
  color: var(--g800);
  width: 140px;
}

/* ── FORMS ── */
.field-group { display: flex; flex-direction: column; gap: 5px; }
.field-group label {
  font-size: var(--fs-xs);
  font-weight: var(--fw-semi);
  color: var(--g600);
  letter-spacing: .2px;
}
.field-group input,
.field-group select,
.field-group textarea {
  padding: 8px var(--sp3);
  border: 1.5px solid var(--g200);
  border-radius: var(--r);
  font-size: var(--fs-sm);
  color: var(--g800);
  background: var(--g0);
  outline: none;
  transition: all var(--t) var(--ease);
}
.field-group input:focus,
.field-group select:focus,
.field-group textarea:focus {
  border-color: var(--brand);
  box-shadow: 0 0 0 3px rgba(59,130,246,.12);
}
.field-group input[readonly] { background: var(--g50); color: var(--g500); cursor: default; }
.field-hint { font-size: var(--fs-xs); color: var(--g400); margin: var(--sp1) 0 var(--sp3); }

.form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--sp3);
  margin-bottom: var(--sp3);
}
.field-wide { grid-column: 1 / -1; }
.form-actions { display: flex; gap: var(--sp2); align-items: center; justify-content: flex-end; }

.select-full { width: 100%; }

/* ── TABLES ── */
.table-wrap { overflow-x: auto; border-radius: var(--r-md); }
table { width: 100%; border-collapse: collapse; font-size: var(--fs-sm); }
thead { background: var(--g50); }
th {
  padding: var(--sp2) var(--sp3);
  text-align: right;
  font-size: var(--fs-xs);
  font-weight: var(--fw-bold);
  color: var(--g500);
  border-bottom: 2px solid var(--g200);
  white-space: nowrap;
  text-transform: uppercase;
  letter-spacing: .5px;
}
td {
  padding: var(--sp2) var(--sp3);
  border-bottom: 1px solid var(--g100);
  color: var(--g700);
  vertical-align: middle;
}
tr:hover td { background: var(--g50); }
tbody tr:last-child td { border-bottom: none; }

/* ── CARD SECTION ── */
.card-section {
  background: var(--g0);
  border: 1px solid var(--g200);
  border-radius: var(--r-lg);
  overflow: hidden;
  margin-bottom: var(--sp4);
  box-shadow: var(--sh-sm);
  transition: box-shadow var(--t);
  border-top: 3px solid var(--brand);
}
.card-section:hover { box-shadow: var(--sh); }
.card-section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--sp3) var(--sp4);
  font-size: var(--fs-sm);
  font-weight: var(--fw-bold);
  color: var(--g800);
  background: linear-gradient(135deg, var(--g50), var(--g0));
  border-bottom: 1px solid var(--g200);
}
.head-select {
  font-size: var(--fs-xs);
  padding: 4px 8px;
  border: 1px solid var(--g200);
  border-radius: var(--r-sm);
  background: var(--g0);
  color: var(--g600);
}

/* Operations monitor */
.ops-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: var(--sp4);
  align-items: start;
}
.ops-card { min-height: 360px; }
.ops-wide { grid-column: 1 / -1; }
.ops-source-tag {
  font-size: 11px;
  font-weight: var(--fw-bold);
  color: var(--g500);
  background: var(--g100);
  border: 1px solid var(--g200);
  border-radius: var(--r-full);
  padding: 3px 9px;
}
.ops-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: var(--sp3);
  max-height: 420px;
  overflow: auto;
}
.ops-empty { padding: var(--sp3); text-align: center; }
.ops-row {
  display: flex;
  justify-content: space-between;
  gap: var(--sp3);
  padding: 10px 12px;
  border: 1px solid var(--g200);
  border-radius: var(--r-sm);
  background: var(--g0);
  border-right: 4px solid var(--brand);
}
.ops-row.is-unread { border-right-color: var(--green); background: #f3fff9; }
.ops-row.is-read,
.ops-row.is-muted { opacity: .76; }
.ops-row.is-active { border-right-color: var(--green); }
.ops-row-main {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.ops-row-main strong { color: var(--g800); font-size: var(--fs-sm); }
.ops-row-main span {
  color: var(--g600);
  font-size: var(--fs-xs);
  overflow-wrap: anywhere;
}
.ops-row-meta {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  flex-wrap: wrap;
  gap: 6px;
  color: var(--g500);
  font-size: 11px;
  text-align: left;
}
.ops-row-meta span {
  background: var(--g50);
  border: 1px solid var(--g200);
  border-radius: var(--r-full);
  padding: 2px 7px;
  white-space: nowrap;
}
.ops-offer-form {
  display: grid;
  grid-template-columns: 1.2fr 1.5fr .7fr .9fr auto auto;
  gap: 8px;
  padding: var(--sp3);
  border-bottom: 1px solid var(--g200);
  background: var(--g50);
}
.ops-offer-form input,
.ops-offer-form select {
  min-width: 0;
  padding: 8px 10px;
  border: 1px solid var(--g200);
  border-radius: var(--r-sm);
  background: var(--g0);
  color: var(--g700);
}
.ops-check {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  white-space: nowrap;
  color: var(--g700);
  font-size: var(--fs-xs);
}
.ops-pill {
  display: inline-flex;
  align-items: center;
  border-radius: var(--r-full);
  padding: 3px 8px;
  font-size: 11px;
  font-weight: var(--fw-bold);
}
.ops-pill.ok { color: var(--green-d); background: var(--green-bg); }
.ops-pill.off { color: var(--red-d); background: var(--red-bg); }

/* ── MAP HELPERS ── */
.map-empty {
  padding: var(--sp5);
  text-align: center;
  color: var(--g400);
  font-size: var(--fs-sm);
}

/* ================================================================
   ORDERS TAB
   ================================================================ */
.section-toolbar {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: var(--sp3);
  padding: var(--sp3) var(--sp4);
  background: var(--g0);
  border: 1px solid var(--g200);
  border-radius: var(--r-lg);
  margin-bottom: var(--sp3);
  box-shadow: var(--sh-sm);
}
.toolbar-group { display: flex; align-items: center; gap: var(--sp2); }
.toolbar-label { font-size: var(--fs-xs); font-weight: var(--fw-semi); color: var(--g600); display: flex; align-items: center; gap: var(--sp2); }
.toolbar-select {
  padding: 5px 8px;
  font-size: var(--fs-xs);
  border: 1.5px solid var(--g200);
  border-radius: var(--r-sm);
  background: var(--g0);
  color: var(--g700);
  outline: none;
  transition: border-color var(--t);
}
.toolbar-select:focus { border-color: var(--brand); }
.toolbar-check { font-size: var(--fs-xs); color: var(--g600); display: flex; align-items: center; gap: 6px; }

/* Add order panel */
.add-order-panel {
  background: var(--g0);
  border: 1px solid var(--g200);
  border-radius: var(--r-lg);
  margin-bottom: var(--sp3);
  box-shadow: var(--sh-sm);
  overflow: hidden;
  transition: box-shadow var(--t);
}
.add-order-panel:hover { box-shadow: var(--sh); }
.add-order-summary {
  padding: var(--sp3) var(--sp4);
  font-size: var(--fs-sm);
  font-weight: var(--fw-bold);
  color: var(--brand-d);
  cursor: pointer;
  user-select: none;
  list-style: none;
  background: linear-gradient(135deg, var(--brand-light), #e8ecff);
  border-bottom: 1px solid var(--brand-mid);
  transition: background var(--t-fast);
  display: flex;
  align-items: center;
  gap: var(--sp2);
}
.add-order-summary:hover { background: linear-gradient(135deg, #dde4ff, var(--brand-light)); }
.add-order-summary::-webkit-details-marker { display: none; }
.add-order-body { padding: var(--sp4); }

.new-order-map {
  height: 200px;
  border-radius: var(--r);
  border: 1.5px solid var(--g200);
  margin-top: var(--sp2);
  z-index: 0;
}
.map-loc-actions {
  display: flex;
  align-items: center;
  gap: var(--sp2);
  margin-top: var(--sp2);
}

/* Orders filters */
.orders-filters-bar {
  display: flex;
  align-items: center;
  gap: var(--sp3);
  flex-wrap: wrap;
  margin-bottom: var(--sp3);
}
.filter-input {
  flex: 1;
  min-width: 200px;
  padding: 8px var(--sp3);
  border: 1.5px solid var(--g200);
  border-radius: var(--r);
  font-size: var(--fs-sm);
  outline: none;
  transition: all var(--t) var(--ease);
  background: var(--g0);
}
.filter-input:focus { border-color: var(--brand); box-shadow: 0 0 0 3px rgba(59,130,246,.1); }
.filter-select {
  padding: 8px var(--sp3);
  border: 1.5px solid var(--g200);
  border-radius: var(--r);
  font-size: var(--fs-sm);
  background: var(--g0);
  outline: none;
  transition: border-color var(--t);
}
.filter-select:focus { border-color: var(--brand); }
.filter-check { font-size: var(--fs-sm); color: var(--g600); display: flex; align-items: center; gap: 6px; }

/* Orders board */
.orders-source-board {
  display: grid;
  grid-template-columns: repeat(4, minmax(280px, 1fr));
  gap: var(--sp4);
  margin-bottom: var(--sp3);
  overflow-x: auto;
  padding-bottom: var(--sp2);
}

.orders-source-section {
  min-width: 0;
  background: var(--g0);
  border: 1px solid var(--g200);
  border-radius: var(--r-lg);
  box-shadow: var(--sh-sm);
  overflow: hidden;
  transition: box-shadow var(--t);
}
.orders-source-section:hover { box-shadow: var(--sh); }

.orders-source-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: var(--sp3);
  padding: var(--sp4);
  border-bottom: 1px solid var(--g200);
  background: var(--g50);
}

.orders-source-head h3 { margin: 0 0 4px; font-size: var(--fs-md); font-weight: var(--fw-bold); color: var(--g800); }
.orders-source-head p { margin: 0; color: var(--g500); font-size: var(--fs-xs); line-height: 1.6; }

.orders-source-count {
  min-width: 34px;
  height: 34px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--r-full);
  font-weight: var(--fw-black);
  font-size: var(--fs-md);
  background: var(--g100);
  color: var(--g700);
  flex-shrink: 0;
}
.orders-source-restaurants .orders-source-count { background: #fef3c7; color: #92400e; }
.orders-source-admin .orders-source-count       { background: #dbeafe; color: #1d4ed8; }
.orders-source-customers .orders-source-count   { background: #d1fae5; color: #065f46; }
.orders-source-whatsapp .orders-source-count    { background: #dcfce7; color: #15803d; }
.orders-source-whatsapp .orders-source-head     { background: #f0fdf4; border-bottom-color: #bbf7d0; }
.orders-source-whatsapp                         { border-color: #bbf7d0; }

.pause-incoming-btn {
  display: block;
  width: calc(100% - var(--sp4) * 2);
  margin: var(--sp3) var(--sp4) 0;
  padding: 8px 12px;
  border-radius: var(--r-md);
  border: 1px solid #fcd34d;
  background: #fffbeb;
  color: #92400e;
  font-weight: var(--fw-bold);
  font-size: var(--fs-xs);
  cursor: pointer;
  transition: background var(--t), border-color var(--t), color var(--t);
}
.pause-incoming-btn:hover { background: #fef3c7; }
.pause-incoming-btn.is-auto-on {
  border-color: #86efac;
  background: #f0fdf4;
  color: #15803d;
}
.pause-incoming-btn.is-auto-on:hover { background: #dcfce7; }

.orders-cards-list {
  display: flex;
  flex-direction: column;
  gap: var(--sp2);
  padding: var(--sp3);
}

.orders-source-admin .add-order-panel { margin: var(--sp3); }
.empty-source-orders { padding: var(--sp2); margin: 0; }

/* Order cards */
.order-editor-card {
  background: var(--g0);
  border: 1px solid var(--g200);
  border-radius: var(--r-md);
  box-shadow: var(--sh-xs);
  overflow: hidden;
  transition: all var(--t) var(--ease);
}
.order-editor-card:hover { box-shadow: var(--sh-sm); border-color: var(--g300); }

.order-card-summary {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: var(--sp2) var(--sp3);
  padding: var(--sp3) var(--sp4);
  cursor: pointer;
  user-select: none;
  border-bottom: 1px solid transparent;
  transition: background var(--t-fast);
}
.order-editor-card.collapsed .order-card-summary { border-bottom-color: transparent; }
.order-editor-card:not(.collapsed) .order-card-summary {
  background: var(--g50);
  border-bottom-color: var(--g200);
}
.order-card-summary:hover { background: var(--g50); }

.order-summary-main { display: flex; align-items: center; gap: var(--sp2); flex-shrink: 0; }
.order-summary-id { font-weight: var(--fw-black); font-size: var(--fs-md); color: var(--g800); font-variant-numeric: tabular-nums; }
.order-source-badge {
  font-size: var(--fs-xs);
  font-weight: var(--fw-black);
  padding: 2px 8px;
  border-radius: var(--r-full);
}
.order-source-badge.source-restaurant { background: #fef3c7; color: #92400e; }
.order-source-badge.source-admin      { background: #dbeafe; color: #1d4ed8; }
.order-source-badge.source-customer   { background: #d1fae5; color: #065f46; }
.order-source-badge.source-whatsapp   { background: #dcfce7; color: #15803d; font-weight: bold; }

.order-summary-info {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 4px var(--sp3);
  flex: 1;
  font-size: var(--fs-xs);
  color: var(--g500);
}
.order-summary-field strong { color: var(--g700); }
.order-toggle-arrow {
  font-size: var(--fs-sm);
  color: var(--g400);
  margin-right: auto;
  flex-shrink: 0;
  transition: transform var(--t) var(--spring);
}
.order-editor-card:not(.collapsed) .order-toggle-arrow { transform: rotate(180deg); }
.order-editor-card.collapsed .order-card-body { display: none; }
.order-card-body { padding: var(--sp4); }

.order-items-section {
  margin-top: var(--sp3);
  border-top: 1px solid var(--g100);
  padding-top: var(--sp3);
}
.order-items-title {
  font-size: var(--fs-xs);
  font-weight: var(--fw-bold);
  color: var(--g500);
  text-transform: uppercase;
  letter-spacing: .5px;
  margin-bottom: var(--sp2);
}

.order-toggle-advanced {
  display: block;
  width: 100%;
  margin-top: var(--sp3);
  text-align: center;
  background: var(--g50);
  color: var(--g500);
  border: 1px dashed var(--g200);
}
.order-toggle-advanced:hover { background: var(--brand-light); color: var(--brand-d); }
.order-card-advanced { margin-top: var(--sp3); }

/* Dispatch state badges */
.dispatch-state {
  font-size: var(--fs-xs);
  font-weight: var(--fw-bold);
  padding: 2px 8px;
  border-radius: var(--r-full);
}
.dispatch-state.pending    { background: #fef3c7; color: #92400e; }
.dispatch-state.accepted   { background: #d1fae5; color: #065f46; }
.dispatch-state.rejected   { background: var(--red-bg); color: var(--red-d); animation: dispatchRejectedBlink 1.2s ease-in-out 3; }
.dispatch-state.rerouted   { background: var(--blue-bg); color: var(--blue-d); }
.dispatch-state.no-courier { background: #fdf2f8; color: #9d174d; border: 1px solid #fbcfe8; }
.dispatch-state.none       { background: var(--g100); color: var(--g500); }

@keyframes dispatchRejectedBlink {
  0%, 100% { opacity: 1; }
  50%       { opacity: .4; }
}

/* Orders table panel */
.orders-table-panel {
  background: var(--g0);
  border: 1px solid var(--g200);
  border-radius: var(--r-lg);
  box-shadow: var(--sh-sm);
  overflow: hidden;
}
.orders-table-panel summary {
  padding: var(--sp3) var(--sp4);
  font-size: var(--fs-sm);
  font-weight: var(--fw-bold);
  color: var(--g600);
  cursor: pointer;
  background: var(--g50);
  border-bottom: 1px solid var(--g200);
  list-style: none;
  transition: background var(--t-fast);
}
.orders-table-panel summary::-webkit-details-marker { display: none; }
.orders-table-panel summary:hover { background: var(--g100); }
.orders-table-panel[open] summary { border-bottom-color: var(--g200); }

/* ================================================================
   ORDER EDITOR FIELDS
   ================================================================ */
.order-section-title {
  font-size: var(--fs-xs);
  font-weight: var(--fw-bold);
  color: var(--g500);
  text-transform: uppercase;
  letter-spacing: .5px;
  margin: var(--sp3) 0 var(--sp2);
  padding-bottom: var(--sp1);
  border-bottom: 1px solid var(--g100);
}
.order-section-title:first-child { margin-top: 0; }

.order-editor-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: var(--sp3);
  margin-bottom: var(--sp3);
}
.order-editor-field { display: flex; flex-direction: column; gap: 4px; }
.order-editor-field label { font-size: var(--fs-xs); font-weight: var(--fw-semi); color: var(--g500); }
.order-editor-field input,
.order-editor-field select,
.order-editor-field textarea {
  padding: 7px var(--sp2);
  border: 1.5px solid var(--g200);
  border-radius: var(--r-sm);
  font-size: var(--fs-sm);
  outline: none;
  background: var(--g0);
  transition: all var(--t) var(--ease);
}
.order-editor-field input:focus,
.order-editor-field select:focus,
.order-editor-field textarea:focus {
  border-color: var(--brand);
  box-shadow: 0 0 0 3px rgba(59,130,246,.1);
}

.order-editor-actions {
  display: flex;
  flex-wrap: wrap;
  gap: var(--sp2);
  padding-top: var(--sp3);
  border-top: 1px solid var(--g100);
  margin-top: var(--sp3);
}
.order-editor-actions button {
  padding: 7px 14px;
  font-size: var(--fs-xs);
  font-weight: var(--fw-bold);
  border-radius: var(--r-sm);
  border: 1.5px solid var(--g200);
  background: var(--g0);
  color: var(--g700);
  cursor: pointer;
  transition: all var(--t-fast) var(--ease);
}
.order-editor-actions button:hover { background: var(--g50); border-color: var(--g300); }
.order-editor-actions .btn-primary {
  background: linear-gradient(135deg, var(--brand), var(--brand-d));
  color: #fff;
  border-color: var(--brand-d);
  box-shadow: var(--sh-brand);
}
.order-editor-actions .btn-primary:hover { filter: brightness(1.08); transform: translateY(-1px); }
.order-field-wide { grid-column: 1 / -1; }

/* ================================================================
   COURIERS TAB
   ================================================================ */
.couriers-layout {
  display: grid;
  grid-template-columns: 270px 6px 1fr;
  gap: var(--sp4);
  align-items: start;
}

.couriers-resizer {
  align-self: stretch;
  min-height: 200px;
  width: 6px;
  border-radius: var(--r-full, 999px);
  background: var(--g200, #e5e7eb);
  cursor: col-resize;
}
.couriers-resizer:hover, .couriers-resizer.is-dragging { background: var(--g300, #cbd5e1); }

.couriers-sidebar { display: flex; flex-direction: column; gap: var(--sp3); }

.sidebar-card {
  background: var(--g0);
  border: 1px solid var(--g200);
  border-radius: var(--r-lg);
  padding: var(--sp4);
  box-shadow: var(--sh-sm);
  transition: box-shadow var(--t);
  border-top: 3px solid var(--brand);
}
.sidebar-card:hover { box-shadow: var(--sh); }
.sidebar-card-head {
  font-size: var(--fs-sm);
  font-weight: var(--fw-bold);
  color: var(--brand-d);
  margin-bottom: var(--sp3);
  padding-bottom: var(--sp2);
  border-bottom: 2px solid var(--brand-light);
  display: flex;
  align-items: center;
  gap: var(--sp2);
}

.couriers-list-compact {
  display: flex;
  flex-direction: column;
  gap: 2px;
  max-height: 320px;
  overflow-y: auto;
}
.couriers-list-compact::-webkit-scrollbar { width: 4px; }
.couriers-list-compact::-webkit-scrollbar-thumb { background: var(--g200); border-radius: 2px; }

.courier-side-item {
  display: flex;
  align-items: center;
  gap: var(--sp2);
  padding: 7px var(--sp2);
  border-radius: var(--r);
  cursor: pointer;
  transition: all var(--t-fast) var(--ease);
  font-size: var(--fs-sm);
  font-weight: var(--fw-med);
}
.courier-side-item:hover { background: var(--g50); padding-right: 10px; }
.courier-side-item.selected {
  background: var(--brand-light);
  color: var(--brand-d);
  border: 1px solid var(--brand-mid);
}
.courier-dot {
  width: 9px; height: 9px;
  border-radius: 50%;
  flex-shrink: 0;
  box-shadow: 0 0 0 2px rgba(0,0,0,.08);
}
.courier-dot.online  { background: var(--green); box-shadow: 0 0 0 3px rgba(16,185,129,.2); }
.courier-dot.offline { background: var(--g300); }
.courier-dot.busy    { background: var(--amber); box-shadow: 0 0 0 3px rgba(245,158,11,.2); }

.couriers-main-area { display: flex; flex-direction: column; gap: var(--sp4); }

/* Courier editor */
.courier-editor-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: var(--sp3);
  padding: var(--sp4);
}
.courier-editor-field { display: flex; flex-direction: column; gap: 4px; }
.courier-editor-field label { font-size: var(--fs-xs); font-weight: var(--fw-semi); color: var(--g500); }
.courier-editor-field input,
.courier-editor-field select,
.courier-editor-field textarea {
  padding: 7px var(--sp2);
  border: 1.5px solid var(--g200);
  border-radius: var(--r-sm);
  font-size: var(--fs-sm);
  outline: none;
  background: var(--g0);
  transition: all var(--t) var(--ease);
}
.courier-editor-field input:focus,
.courier-editor-field select:focus {
  border-color: var(--brand);
  box-shadow: 0 0 0 3px rgba(59,130,246,.1);
}
.courier-editor-actions {
  display: flex;
  flex-wrap: wrap;
  gap: var(--sp2);
  padding: var(--sp3) var(--sp4);
  border-top: 1px solid var(--g100);
  background: var(--g50);
}
.courier-editor-actions button {
  padding: 7px 14px;
  font-size: var(--fs-xs);
  font-weight: var(--fw-bold);
  border-radius: var(--r-sm);
  border: 1.5px solid var(--g200);
  background: var(--g0);
  color: var(--g700);
  cursor: pointer;
  transition: all var(--t-fast) var(--ease);
}
.courier-editor-actions button:hover { background: var(--g100); border-color: var(--g300); }
.courier-editor-actions .btn-primary {
  background: linear-gradient(135deg, var(--brand), var(--brand-d));
  color: #fff;
  border-color: var(--brand-d);
  box-shadow: var(--sh-brand);
}
.courier-editor-actions .btn-primary:hover { filter: brightness(1.08); transform: translateY(-1px); }

/* ================================================================
   COURIER PROFILE CARD (inside courier details panel)
   ================================================================ */
.courier-profile-card {
  display: flex;
  gap: var(--sp4);
  padding: var(--sp4);
  align-items: flex-start;
}

.courier-profile-left {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--sp2);
  flex-shrink: 0;
  width: 120px;
}

.courier-avatar-wrap {
  position: relative;
}

.courier-avatar-ring {
  --ring-color: #10b981;
  width: 100px;
  height: 100px;
  border-radius: 50%;
  border: 3px solid var(--ring-color);
  box-shadow: 0 0 0 4px color-mix(in srgb, var(--ring-color) 20%, transparent);
  position: relative;
  overflow: hidden;
  background: var(--g100);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: border-color var(--t), box-shadow var(--t);
}

.courier-avatar-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.courier-avatar-placeholder {
  font-size: 40px;
  line-height: 1;
  color: var(--g300);
}

.courier-avatar-upload {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  cursor: pointer;
  border-radius: 50%;
  transition: background var(--t);
  opacity: 0;
}
.courier-avatar-ring:hover .courier-avatar-upload {
  opacity: 1;
  background: rgba(0, 0, 0, 0.45);
}

.courier-avatar-status {
  position: absolute;
  bottom: 4px;
  left: 4px;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  border: 2.5px solid #fff;
  box-shadow: var(--sh-xs);
}

.courier-profile-name {
  font-size: var(--fs-md);
  font-weight: var(--fw-bold);
  color: var(--g800);
  text-align: center;
  line-height: 1.3;
}

.courier-profile-id {
  font-size: var(--fs-xs);
  color: var(--g400);
  font-family: monospace;
  text-align: center;
}

.courier-profile-task {
  font-size: var(--fs-xs);
  color: var(--g500);
  text-align: center;
  background: var(--g100);
  padding: 3px 8px;
  border-radius: var(--r-full);
}

.courier-profile-right {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: var(--sp3);
}

@media (max-width: 640px) {
  .courier-profile-card { flex-direction: column; align-items: stretch; }
  .courier-profile-left { width: 100%; flex-direction: row; align-items: center; gap: var(--sp3); }
  .courier-avatar-ring  { width: 72px; height: 72px; flex-shrink: 0; }
}

/* ================================================================
   COURIER AUTH STATUS
   ================================================================ */
.menu-images-preview {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 4px;
}
.menu-images-preview img {
  width: 56px;
  height: 56px;
  object-fit: cover;
  border-radius: var(--r);
  border: 1px solid var(--g200);
  flex-shrink: 0;
}

.courier-password-change-box {
  background: var(--g50);
  border: 1px solid var(--g200);
  border-radius: var(--r-md);
  padding: var(--sp3);
  display: flex;
  flex-direction: column;
  gap: var(--sp2);
}
.courier-password-change-title {
  font-size: var(--fs-sm);
  font-weight: var(--fw-semi);
  color: var(--g700);
}
.courier-password-change-fields {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--sp3);
}
@media (max-width: 540px) {
  .courier-password-change-fields { grid-template-columns: 1fr; }
}
.courier-password-hint {
  font-size: var(--fs-xs);
  color: var(--g400);
}

.courier-auth-status {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--sp2);
  padding: var(--sp2) var(--sp3);
  background: var(--g50);
  border-radius: var(--r-md);
  border: 1px solid var(--g200);
  font-size: var(--fs-xs);
}
.auth-ok {
  color: var(--green-d);
  font-weight: var(--fw-semi);
}
.auth-missing {
  color: var(--amber-d);
  font-weight: var(--fw-semi);
}
.auth-uid {
  font-family: monospace;
  color: var(--g400);
  font-size: 11px;
}

/* ================================================================
   RESTAURANTS TAB
   ================================================================ */
.restaurant-preview {
  display: flex;
  align-items: center;
  gap: var(--sp3);
  padding: var(--sp2) var(--sp3);
}
[data-rest-preview-image] {
  width: 72px;
  height: 72px;
  object-fit: cover;
  border-radius: var(--r-md);
  border: 2px solid var(--g200);
  flex-shrink: 0;
  background: var(--g100);
}
.restaurant-thumb {
  width: 46px; height: 46px;
  border-radius: var(--r);
  object-fit: cover;
  background: var(--g100);
  flex-shrink: 0;
  border: 1px solid var(--g200);
}
.restaurant-info { flex: 1; min-width: 0; }
.restaurant-name { font-weight: var(--fw-bold); font-size: var(--fs-sm); color: var(--g800); }
.restaurant-meta { font-size: var(--fs-xs); color: var(--g400); }

/* ================================================================
   MAP MARKERS (Leaflet)
   ================================================================ */
.custom-marker { background: none !important; border: none !important; }

.map-pin {
  width: 24px; height: 24px;
  border-radius: 50%;
  border: 2.5px solid #fff;
  box-shadow: 0 2px 8px rgb(0 0 0/.3);
}
.map-pin-restaurant      { background: var(--amber); }
.map-pin-restaurant-busy { background: var(--red); }
.map-pin-courier         { background: var(--green); }
.map-pin-courier-offline { background: var(--g400); }
.map-pin-courier-busy    { background: var(--blue); }
.map-pin-customer        { background: var(--brand); }

.hazard-marker-wrapper {
  background: none !important;
  border: none !important;
}

/* ── بلاغات الطريق (Hazard) — أيقونة مميزة لكل نوع ── */
.hazard-marker {
  position: relative;
  width: 36px;
  height: 36px;
  border-radius: 50% 50% 50% 6px;
  transform: rotate(-45deg);
  background: var(--hm-bg, #dc2626);
  border: 3px solid #fff;
  box-shadow: 0 3px 14px rgb(0 0 0/.4);
  display: flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
}
.hazard-marker::before {
  content: "";
  position: absolute;
  inset: -6px;
  border: 2.5px solid var(--hm-ring, rgb(220 38 38/.4));
  border-radius: inherit;
  animation: hazard-pulse 1.6s ease-out infinite;
}
.hazard-marker > span {
  transform: rotate(45deg);
  font-size: 18px;
  line-height: 1;
  display: block;
}
@keyframes hazard-pulse {
  0%   { transform: scale(.8);  opacity: .85; }
  100% { transform: scale(1.45); opacity: 0; }
}

/* ── تنبيهات SLA (طلبات متأخرة / بدون مندوب) ── */
.sla-marker-wrapper { background: none !important; border: none !important; }

.sla-marker {
  position: relative;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: var(--sla-bg, #dc2626);
  border: 3px solid #fff;
  box-shadow: 0 3px 14px rgb(0 0 0/.38);
  display: flex;
  align-items: center;
  justify-content: center;
}
.sla-marker::before {
  content: "";
  position: absolute;
  inset: -6px;
  border: 2.5px solid var(--sla-ring, rgb(220 38 38/.4));
  border-radius: 50%;
  animation: sla-pulse 1.4s ease-out infinite;
}
.sla-marker > span {
  font-size: 17px;
  line-height: 1;
  display: block;
}
.sla-critical::before { animation-duration: 1s; }
.sla-warning::before  { animation-duration: 1.8s; }
.sla-late::before     { animation-duration: 2.2s; }

@keyframes sla-pulse {
  0%   { transform: scale(.85); opacity: .9; }
  100% { transform: scale(1.5); opacity: 0; }
}

/* Tooltip لبلاغات الطريق وتنبيهات SLA */
.hazard-tooltip, .sla-tooltip {
  background: rgba(30,30,30,.88) !important;
  color: #fff !important;
  border: none !important;
  border-radius: 6px !important;
  font-size: 12px !important;
  padding: 4px 8px !important;
  direction: rtl;
}

.restaurant-square-marker {
  width: 26px; height: 26px;
  border-radius: var(--r-sm);
  border: 2px solid #fff;
  background: var(--marker-border, var(--amber));
  box-shadow: 0 2px 8px rgb(0 0 0/.25);
  overflow: hidden;
}
.restaurant-square-marker img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.courier-status-marker {
  width: 28px; height: 28px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  border: 2.5px solid #fff;
  box-shadow: 0 2px 8px rgb(0 0 0/.3);
}

/* Courier pulse markers */
.courier-pulse-wrapper { background: none !important; border: none !important; }

.courier-pulse-wrap {
  position: relative;
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.cp-ring {
  position: absolute;
  inset: 0;
  border-radius: 50%;
  border: 2.5px solid currentColor;
  opacity: 0;
  pointer-events: none;
}

.cp-core {
  position: relative;
  z-index: 1;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  border: 2.5px solid #fff;
  box-shadow: 0 2px 10px rgb(0 0 0/.35);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
}

.cp-delay {
  font-size: 9px;
  font-weight: var(--fw-black);
  color: #fff;
  line-height: 1;
}

.cp-offline   { color: #64748b; }
.cp-offline   .cp-core { background: #64748b; }
.cp-offline   .cp-ring { animation: cp-pulse 2s ease-out infinite; }

.cp-available { color: var(--green); }
.cp-available .cp-core { background: var(--green); }
.cp-available .cp-ring { animation: cp-pulse 1.3s ease-out infinite; }

.cp-busy      { color: var(--amber); }
.cp-busy      .cp-core { background: var(--amber); }
.cp-busy      .cp-ring { animation: cp-pulse 1s ease-out infinite; }

.cp-late      { color: var(--red); }
.cp-late      .cp-core { background: var(--red); }
.cp-late      .cp-ring { animation: cp-pulse 2.8s ease-out infinite; }

@keyframes cp-pulse {
  0%   { transform: scale(.6); opacity: .8; }
  100% { transform: scale(2.2); opacity: 0; }
}

/* Store list items (map sidebar) */
.store-item {
  padding: var(--sp2) var(--sp3);
  border-bottom: 1px solid var(--g100);
  cursor: pointer;
  transition: background var(--t-fast);
}
.store-item:hover { background: var(--g50); }
.store-item.selected { background: var(--brand-light); }
.store-item-name { font-size: var(--fs-sm); font-weight: var(--fw-semi); color: var(--g800); }
.store-item-meta { font-size: var(--fs-xs); color: var(--g400); margin-top: 2px; }
.store-orders-row { display: flex; flex-wrap: wrap; gap: 3px; margin-top: 4px; }
.store-order-chip {
  font-size: 10px;
  padding: 1px 7px;
  border-radius: var(--r-full);
  background: var(--g100);
  color: var(--g600);
  border: 1px solid var(--g200);
}
.store-order-chip.chip-on-way   { background: var(--blue-bg);   color: var(--blue-d);  border-color: var(--blue-b); }
.store-order-chip.chip-pending  { background: var(--amber-bg);  color: var(--amber-d); border-color: var(--amber-b); }
.store-order-chip.chip-accepted { background: var(--green-bg);  color: var(--green-d); border-color: var(--green-b); }

/* Status badges */
.status { font-size: var(--fs-xs); font-weight: var(--fw-semi); padding: 2px 8px; border-radius: var(--r-full); }
.status.online  { background: var(--green-bg); color: var(--green-d); }
.status.offline { background: var(--g100);     color: var(--g500); }

/* Small courier working/offline indicator dot */
.courier-status-dot { display:inline-block; width:9px; height:9px; border-radius:50%; margin-left:6px; vertical-align:middle; }
.courier-status-dot.online  { background:#16a34a; box-shadow:0 0 0 3px rgba(22,163,74,.18); }
.courier-status-dot.offline { background:#dc2626; box-shadow:0 0 0 3px rgba(220,38,38,.14); }

/* Small icon-only row action buttons (courier table) */
.btn-row-icon { border:1px solid var(--g200,#e5e7eb); background:#fff; border-radius:8px; padding:2px 6px; font-size:13px; cursor:pointer; margin-inline-start:4px; line-height:1.4; }
.btn-row-icon:hover { background:var(--g100,#f3f4f6); }

.task-badge { font-size: var(--fs-xs); font-weight: var(--fw-semi); padding: 2px 8px; border-radius: var(--r-full); }
.task-badge.available { background: var(--green-bg); color: var(--green-d); }
.task-badge.busy      { background: var(--amber-bg); color: var(--amber-d); }
.task-badge.suspended { background: var(--red-bg);   color: var(--red-d); }

/* Restaurant editor */
.restaurant-details { padding: var(--sp3); }
.restaurant-details h3 {
  font-size: var(--fs-xl);
  font-weight: var(--fw-bold);
  color: var(--g900);
  margin: 0 0 var(--sp3);
  padding-bottom: var(--sp3);
  border-bottom: 1px solid var(--g150);
}
.restaurant-details h4 {
  font-size: var(--fs-md);
  font-weight: var(--fw-bold);
  color: var(--g800);
  margin: 0 0 var(--sp3);
}

/* Read-only stat grid (status / rating / orders / ids ...) */
.details-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: var(--sp2);
  margin-bottom: var(--sp4);
}
.detail-item {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: var(--sp2) var(--sp3);
  background: var(--g50);
  border: 1px solid var(--g150);
  border-radius: var(--r-md);
  min-width: 0;
}
.detail-item strong {
  font-size: var(--fs-xs);
  font-weight: var(--fw-semi);
  color: var(--g500);
  text-transform: uppercase;
  letter-spacing: .4px;
}
.detail-item span {
  font-size: var(--fs-md);
  font-weight: var(--fw-bold);
  color: var(--g900);
  word-break: break-word;
  line-height: 1.3;
}

/* Active orders / route list */
.route-orders-wrap { margin-bottom: var(--sp4); }
.route-order {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: var(--sp2) var(--sp3);
  border: 1px solid var(--g150);
  border-radius: var(--r-md);
  margin-bottom: var(--sp2);
  font-size: var(--fs-sm);
  color: var(--g700);
}
.route-order.selected { border-color: var(--brand); background: var(--brand-light); }
.route-order .route-btn { align-self: flex-start; margin-top: 4px; }

/* Restaurant edit form + menu section */
.restaurant-editor {
  display: flex;
  flex-direction: column;
  gap: var(--sp3);
  padding-top: var(--sp3);
  border-top: 1px solid var(--g150);
}
.restaurant-editor-section { font-size: var(--fs-xs); color: var(--g500); font-weight: var(--fw-bold); text-transform: uppercase; letter-spacing: .5px; }
.restaurant-editor-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: var(--sp3);
}
.restaurant-editor-field { display: flex; flex-direction: column; gap: 4px; }
.restaurant-editor-field label { font-size: var(--fs-xs); font-weight: var(--fw-semi); color: var(--g500); }
.restaurant-editor-field input,
.restaurant-editor-field select,
.restaurant-editor-field textarea {
  padding: 6px var(--sp2);
  border: 1.5px solid var(--g200);
  border-radius: var(--r-sm);
  font-size: var(--fs-sm);
  outline: none;
  background: var(--g0);
  transition: all var(--t) var(--ease);
}
.restaurant-editor-field input:focus { border-color: var(--brand); box-shadow: 0 0 0 3px rgba(59,130,246,.1); }
.restaurant-editor-actions {
  display: flex;
  flex-wrap: wrap;
  gap: var(--sp2);
}
.restaurant-editor-actions button {
  padding: 7px 14px;
  font-size: var(--fs-xs);
  font-weight: var(--fw-bold);
  border-radius: var(--r-sm);
  border: 1.5px solid var(--g200);
  background: var(--g0);
  color: var(--g700);
  cursor: pointer;
  transition: all var(--t-fast) var(--ease);
}
.restaurant-editor-actions button:hover { background: var(--g50); border-color: var(--g300); }
.restaurant-editor-actions .btn-primary {
  background: linear-gradient(135deg, var(--brand), var(--brand-d));
  color: #fff;
  border-color: var(--brand-d);
}
.restaurant-editor-actions .btn-primary:hover { filter: brightness(1.08); }

/* Menu / dishes list editor */
.menu-items-wrap {
  padding-top: var(--sp3);
  border-top: 1px solid var(--g150);
}
.menu-columns-head {
  display: grid;
  grid-template-columns: 1.4fr .8fr .8fr 1.4fr 90px;
  gap: var(--sp2);
  padding: 0 var(--sp2) 4px;
  font-size: var(--fs-xs);
  font-weight: var(--fw-semi);
  color: var(--g500);
  text-transform: uppercase;
  letter-spacing: .3px;
}
.menu-item-row {
  display: grid;
  grid-template-columns: 1.4fr .8fr .8fr 1.4fr 90px;
  gap: var(--sp2);
  align-items: center;
  padding: var(--sp2);
  border: 1px solid var(--g150);
  border-radius: var(--r-md);
  margin-bottom: var(--sp2);
  background: var(--g0);
}
.menu-item-row input {
  padding: 6px var(--sp2);
  border: 1.5px solid var(--g200);
  border-radius: var(--r-sm);
  font-size: var(--fs-sm);
  outline: none;
  background: var(--g0);
  width: 100%;
  min-width: 0;
}
.menu-item-row input:focus { border-color: var(--brand); box-shadow: 0 0 0 3px rgba(59,130,246,.1); }
.menu-item-row input[type="file"] { border: none; padding: 0; font-size: var(--fs-xs); }
@media (max-width: 760px) {
  .menu-columns-head { display: none; }
  .menu-item-row { grid-template-columns: 1fr; }
}
.menu-actions {
  display: flex;
  flex-wrap: wrap;
  gap: var(--sp2);
  margin-top: var(--sp3);
  padding-top: var(--sp3);
  border-top: 1px solid var(--g150);
}

/* ══════════════════════════════════════════════
   فاتورة الخدمة الشهرية للمطعم
══════════════════════════════════════════════ */
.billing-panel {
  border: 1px solid var(--g200);
  border-radius: var(--r-lg);
  overflow: hidden;
  margin-top: var(--sp4);
}
.billing-panel-head {
  background: linear-gradient(135deg, #0f766e 0%, #0d9488 100%);
  color: #fff;
  padding: 12px 16px;
  font-size: var(--fs-sm);
  font-weight: var(--fw-bold);
  cursor: pointer;
  list-style: none;
  display: flex;
  align-items: center;
  gap: 8px;
}
.billing-panel-head::marker,
.billing-panel-head::-webkit-details-marker { display: none; }
.billing-panel-head::after { content: "▲"; margin-right: auto; font-size: 10px; opacity: .7; transition: transform .2s; }
details.billing-panel:not([open]) .billing-panel-head::after { transform: rotate(180deg); }

.billing-panel-body { padding: var(--sp4); display: flex; flex-direction: column; gap: var(--sp4); }

.billing-filters {
  display: flex;
  align-items: flex-end;
  gap: var(--sp3);
  flex-wrap: wrap;
}
.billing-filter-label {
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: var(--fs-xs);
  font-weight: var(--fw-semi);
  color: var(--g600);
}
.billing-select {
  padding: 6px 10px;
  border: 1px solid var(--g200);
  border-radius: var(--r-md);
  background: var(--g50);
  font-size: var(--fs-sm);
  min-width: 110px;
}
.billing-print-btn {
  margin-top: auto;
  padding: 8px 16px;
  font-size: var(--fs-sm);
  border-radius: var(--r-md);
}

/* جدول الفاتورة */
.bill-table-wrap { overflow-x: auto; border-radius: var(--r-md); border: 1px solid var(--g200); }
.bill-table {
  width: 100%;
  border-collapse: collapse;
  font-size: var(--fs-xs);
}
.bill-table th {
  background: #0f766e;
  color: #fff;
  padding: 9px 10px;
  font-weight: var(--fw-bold);
  white-space: nowrap;
  text-align: right;
}
.bill-table td {
  padding: 8px 10px;
  border-bottom: 1px solid var(--g100);
  vertical-align: middle;
}
.bill-table tr:last-child td { border-bottom: none; }
.bill-table tbody tr:nth-child(even) td { background: var(--g50); }
.bill-row-cancelled td { color: var(--g400); }
.bill-num { text-align: center; font-variant-numeric: tabular-nums; }
.bill-fee { color: #0f766e; font-weight: var(--fw-bold); }
.bill-time { color: var(--g400); font-size: 11px; display: block; }

/* ملخص الفاتورة */
.bill-summary {
  background: var(--g50);
  border: 1px solid var(--g200);
  border-radius: var(--r-md);
  overflow: hidden;
}
.bill-summary-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 9px 14px;
  border-bottom: 1px solid var(--g100);
  font-size: var(--fs-sm);
}
.bill-summary-row:last-child { border-bottom: none; }
.bill-ok     { color: #15803d; }
.bill-cancel { color: var(--g400); }
.bill-total-row {
  background: #f0fdf4;
  border-top: 2px solid #0f766e !important;
  padding: 12px 14px;
}
.bill-due {
  font-size: var(--fs-md);
  color: #0f766e;
}

@media (prefers-color-scheme: dark) {
  .billing-panel { border-color: var(--g700); }
  .billing-select { background: var(--g800); color: var(--g100); border-color: var(--g600); }
  .bill-table th { background: #134e4a; }
  .bill-table td { border-bottom-color: var(--g700); }
  .bill-table tbody tr:nth-child(even) td { background: var(--g800); }
  .bill-summary { background: var(--g800); border-color: var(--g700); }
  .bill-summary-row { border-bottom-color: var(--g700); }
  .bill-total-row { background: #134e4a22; }
}

.menu-item-row {
  display: grid;
  grid-template-columns: 1fr 1fr 80px 80px auto;
  gap: var(--sp2);
  align-items: center;
  padding: var(--sp2) 0;
  border-bottom: 1px solid var(--g100);
}
.menu-item-row input {
  padding: 5px 8px;
  border: 1.5px solid var(--g200);
  border-radius: var(--r-sm);
  font-size: var(--fs-xs);
  outline: none;
  transition: border-color var(--t);
}
.menu-item-row input:focus { border-color: var(--brand); }
.remove-menu-item {
  background: var(--red-bg);
  border: 1px solid var(--red-b);
  color: var(--red-d);
  border-radius: var(--r-sm);
  padding: 4px 8px;
  font-size: var(--fs-xs);
  cursor: pointer;
  transition: all var(--t-fast);
}
.remove-menu-item:hover { background: #fee2e2; border-color: var(--red-d); }

/* Broadcast section */
.broadcast-section {
  display: flex;
  gap: var(--sp4);
  padding: var(--sp4);
  background: linear-gradient(135deg, var(--g850) 0%, var(--g900) 100%);
  margin-top: auto;
  border-top: 1px solid rgba(255,255,255,.06);
}
.broadcast-card {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: var(--sp2);
}
.broadcast-label {
  font-size: var(--fs-xs);
  font-weight: var(--fw-bold);
  color: rgba(255,255,255,.5);
  text-transform: uppercase;
  letter-spacing: .5px;
}
.broadcast-card textarea {
  padding: var(--sp2) var(--sp3);
  border: 1px solid rgba(255,255,255,.12);
  border-radius: var(--r);
  background: rgba(255,255,255,.07);
  color: #fff;
  font-size: var(--fs-sm);
  resize: none;
  outline: none;
  transition: all var(--t) var(--ease);
}
.broadcast-card textarea::placeholder { color: rgba(255,255,255,.3); }
.broadcast-card textarea:focus { border-color: rgba(59,130,246,.6); background: rgba(59,130,246,.1); }

/* Search highlight */
@keyframes flash-highlight {
  0%   { box-shadow: 0 0 0 3px var(--brand); outline: 2px solid var(--brand); }
  50%  { box-shadow: 0 0 0 8px rgba(59,130,246,.2); }
  100% { box-shadow: none; outline: none; }
}
.search-highlight { animation: flash-highlight 1.6s ease forwards; }

/* ================================================================
   DISPATCH CENTER TAB
   ================================================================ */

.tab-btn-controls { color: var(--brand) !important; }
.tab-btn-controls.active { border-bottom-color: var(--brand) !important; }

.btn-xs {
  padding: 2px 8px;
  font-size: var(--fs-xs);
  border: 1px solid var(--g200);
  border-radius: var(--r-sm);
  background: var(--g0);
  color: var(--g500);
  cursor: pointer;
  transition: all var(--t-fast);
}
.btn-xs:hover { background: var(--g100); color: var(--g700); }

/* Activity Feed */
.activity-feed {
  flex: 1;
  min-height: 80px;
  max-height: 200px;
  overflow-y: auto;
  padding: var(--sp2);
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.activity-feed::-webkit-scrollbar { width: 3px; }
.activity-feed::-webkit-scrollbar-thumb { background: var(--g200); border-radius: 2px; }
.activity-empty {
  color: var(--g400);
  font-size: var(--fs-xs);
  text-align: center;
  padding: var(--sp5);
}
.activity-item {
  display: flex;
  align-items: flex-start;
  gap: var(--sp2);
  padding: 5px var(--sp2);
  border-radius: var(--r-sm);
  font-size: var(--fs-xs);
  line-height: 1.4;
  border-right: 3px solid transparent;
  background: var(--g50);
}
.activity-item.ai-info    { border-right-color: var(--blue-d);  background: var(--blue-bg); }
.activity-item.ai-success { border-right-color: var(--green-d); background: var(--green-bg); }
.activity-item.ai-warn    { border-right-color: var(--amber-d); background: var(--amber-bg); }
.activity-item.ai-error   { border-right-color: var(--red-d);   background: var(--red-bg); }
.ai-time { color: var(--g400); white-space: nowrap; flex-shrink: 0; font-size: 10px; margin-top: 1px; }
.ai-msg  { color: var(--g700); flex: 1; }

/* ══════════════════════════════════════════
   DISPATCH CENTER — 3-column grid
   ══════════════════════════════════════════ */

.dc-grid {
  display: grid;
  grid-template-columns: 1fr 290px 1fr;
  gap: var(--sp4);
  padding: var(--sp4);
  align-items: start;
}

.dc-col {
  background: var(--g0);
  border: 1px solid var(--g200);
  border-radius: var(--r-lg);
  box-shadow: var(--sh-sm);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  max-height: calc(100vh - var(--topbar-h) - 160px);
  min-height: 440px;
  transition: box-shadow var(--t);
}
.dc-col:hover { box-shadow: var(--sh); }

.dc-col-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 11px var(--sp4);
  background: linear-gradient(135deg, var(--g50) 0%, var(--g0) 100%);
  border-bottom: 1px solid var(--g200);
  flex-shrink: 0;
}
.dc-col-title {
  font-size: var(--fs-sm);
  font-weight: var(--fw-bold);
  color: var(--g700);
  display: flex;
  align-items: center;
  gap: var(--sp2);
}
.dc-col-badge {
  font-size: var(--fs-xs);
  font-weight: var(--fw-black);
  background: linear-gradient(135deg, var(--brand), var(--brand-d));
  color: #fff;
  border-radius: var(--r-full);
  padding: 2px 9px;
  min-width: 24px;
  text-align: center;
  box-shadow: var(--sh-brand);
}

.dc-auto-toggle {
  display: flex;
  align-items: center;
  gap: 6px;
  cursor: pointer;
}
.dc-auto-toggle input { width: 14px; height: 14px; cursor: pointer; accent-color: var(--green); }
.dc-auto-label { font-size: var(--fs-xs); color: var(--g600); font-weight: var(--fw-semi); }

.dc-empty {
  color: var(--g400);
  font-size: var(--fs-xs);
  text-align: center;
  padding: var(--sp8);
  line-height: 1.7;
}

/* Orders Column */
.dc-orders-list {
  flex: 1;
  overflow-y: auto;
  padding: var(--sp2);
  display: flex;
  flex-direction: column;
  gap: var(--sp2);
}
.dc-orders-list::-webkit-scrollbar { width: 4px; }
.dc-orders-list::-webkit-scrollbar-thumb { background: var(--g200); border-radius: 2px; }

.dc-order-card {
  padding: 6px 10px;
  border: 1px solid var(--g200);
  border-radius: var(--r);
  background: var(--g0);
  display: flex;
  flex-direction: column;
  gap: 3px;
  transition: all var(--t-fast) var(--ease);
  cursor: default;
}
.dc-order-card:hover { border-color: var(--brand); background: var(--brand-light); transform: translateY(-1px); box-shadow: var(--sh-sm); }
.dc-order-card.unassigned { border-right: 3px solid var(--amber); }
.dc-order-card.assigned   { border-right: 3px solid var(--blue-d); }
.dc-order-card.picked-up  { border-right: 3px solid var(--green-d); }

.dc-order-top {
  display: flex;
  align-items: center;
  gap: var(--sp2);
  cursor: pointer;
  border-radius: var(--r-sm);
  margin: -2px -4px;
  padding: 2px 4px;
  transition: background var(--t-fast);
}
.dc-order-top:hover { background: rgba(59,130,246,.08); }
.dc-order-id     { font-size: var(--fs-xs); font-weight: var(--fw-bold); color: var(--g700); font-family: monospace; flex-shrink: 0; }
.dc-order-rest-inline { font-size: var(--fs-xs); color: var(--g500); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; flex: 1; min-width: 0; }
.dc-order-total-inline { font-size: var(--fs-xs); font-weight: var(--fw-bold); color: var(--g700); flex-shrink: 0; }
.dc-order-toggle-caret {
  font-size: 10px; color: var(--g400); flex-shrink: 0;
  transition: transform var(--t-fast) var(--ease);
}
.dc-order-toggle-caret.is-open { transform: rotate(180deg); }
.dc-order-details {
  display: flex;
  flex-direction: column;
  gap: 3px;
  padding-top: 3px;
  margin-top: 2px;
  border-top: 1px dashed var(--g200);
}
.dc-order-rest   { font-size: var(--fs-xs); color: var(--g500); }
.dc-order-courier { font-size: var(--fs-xs); color: var(--g500); }
.dc-order-courier span { color: var(--brand); font-weight: var(--fw-semi); }
.dc-no-courier   { color: var(--amber-d); font-style: italic; }

.dc-order-customer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-top: 4px;
  padding: 6px 8px;
  border-radius: 8px;
  background: var(--g50);
  font-size: 10px;
  color: var(--g600);
}
.dc-order-customer strong { color: var(--brand); text-align: end; }
.dc-progress {
  display: grid;
  grid-template-columns: auto minmax(30px, 1fr) auto minmax(30px, 1fr) auto minmax(30px, 1fr) auto;
  align-items: start;
  gap: 3px;
  margin: 5px 0 3px;
  direction: rtl;
}
.dc-progress-step { display: grid; justify-items: center; gap: 2px; min-width: 42px; color: var(--g400); }
.dc-progress-step b {
  display: grid;
  place-items: center;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: var(--g100);
  border: 1px solid var(--g200);
  font-size: 9px;
}
.dc-progress-step span { font-size: 8px; white-space: nowrap; }
.dc-progress-step.is-done { color: var(--green-d); }
.dc-progress-step.is-done b { color: #fff; background: var(--green); border-color: var(--green); }
.dc-progress-step.is-current { color: var(--brand); font-weight: var(--fw-bold); }
.dc-progress-step.is-current b { color: #fff; background: var(--brand); border-color: var(--brand); box-shadow: 0 0 0 3px var(--brand-light); }
.dc-progress-link { position: relative; min-width: 28px; padding-top: 6px; }
.dc-progress-link i { display: block; height: 2px; margin-top: 3px; background: var(--g200); }
.dc-progress-link em { display: block; min-height: 12px; color: var(--g500); font-size: 8px; font-style: normal; text-align: center; white-space: nowrap; }
.dc-progress-link.is-done i { background: var(--green); }
.dc-progress-link.is-current i { background: linear-gradient(90deg, var(--g200), var(--brand)); }

.map-field-heading { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 6px; }
.map-provider-select {
  max-width: 220px;
  min-height: 32px;
  padding: 5px 9px;
  border: 1px solid var(--g200);
  border-radius: 8px;
  background: var(--g0);
  color: var(--g700);
  font: inherit;
  font-size: 11px;
  cursor: pointer;
}
.map-provider-select:focus { outline: 2px solid var(--brand-light); border-color: var(--brand); }

@media (max-width: 700px) {
  .map-field-heading { align-items: stretch; flex-direction: column; }
  .map-provider-select { width: 100%; max-width: none; }
  .dc-progress { grid-template-columns: auto 1fr auto 1fr auto 1fr auto; }
  .dc-progress-step span, .dc-progress-link em { font-size: 7px; }
}

.dc-order-price {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 10px;
  font-size: 10px;
  color: var(--g600);
  margin-top: 2px;
}
.dc-order-price strong { color: var(--g800); }
.dc-payment {
  background: var(--green-bg);
  color: var(--green-d);
  padding: 1px 6px;
  border-radius: var(--r-full);
  font-weight: var(--fw-semi);
  border: 1px solid var(--green-b);
}
.dc-order-items-count {
  font-size: 10px;
  color: var(--g400);
  margin-top: 2px;
}

.dc-order-status {
  font-size: 10px;
  font-weight: var(--fw-bold);
  padding: 2px 7px;
  border-radius: var(--r-full);
  white-space: nowrap;
}
.dc-st-pending  { background: var(--amber-bg); color: var(--amber-d); border: 1px solid var(--amber-b); }
.dc-st-accepted { background: var(--blue-bg);  color: var(--blue-d);  border: 1px solid var(--blue-b); }
.dc-st-picked   { background: var(--green-bg); color: var(--green-d); border: 1px solid var(--green-b); }
.dc-st-done     { background: var(--g100);     color: var(--g500);    border: 1px solid var(--g200); }

/* Engine (Center) Column */
.dc-col-engine { overflow-y: auto; }
.dc-col-engine::-webkit-scrollbar { width: 4px; }
.dc-col-engine::-webkit-scrollbar-thumb { background: var(--g200); border-radius: 2px; }

.engine-brain-wrap {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--sp2);
  padding: var(--sp5) var(--sp3) var(--sp3);
  flex-shrink: 0;
  background: linear-gradient(180deg, var(--brand-light) 0%, transparent 100%);
}

.engine-brain {
  position: relative;
  width: 110px;
  height: 110px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.brain-rings {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}
.brain-ring {
  position: absolute;
  border-radius: 50%;
  border: 2px solid var(--brand);
  opacity: 0;
  transform: scale(0.3);
}
.brain-ring.r1 { width: 100%; height: 100%; }
.brain-ring.r2 { width: 76%;  height: 76%;  }
.brain-ring.r3 { width: 52%;  height: 52%;  }

.engine-brain.active .brain-ring.r1 { animation: pulse-ring 2s ease-out infinite 0s;   }
.engine-brain.active .brain-ring.r2 { animation: pulse-ring 2s ease-out infinite .5s;  }
.engine-brain.active .brain-ring.r3 { animation: pulse-ring 2s ease-out infinite 1s;   }

@keyframes pulse-ring {
  0%   { opacity: .8; transform: scale(.4);  }
  100% { opacity: 0;  transform: scale(1.1); }
}

.brain-core {
  width: 64px;
  height: 64px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--brand), var(--brand-d));
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 0 0 4px var(--brand-light), var(--sh-brand);
  z-index: 1;
  transition: all var(--t-slow) var(--ease);
}
.engine-brain.active .brain-core { background: linear-gradient(135deg, #38bdf8, var(--brand)); box-shadow: 0 0 24px rgba(59,130,246,.5), 0 0 0 4px var(--brand-light); }
.engine-brain.done   .brain-core { background: linear-gradient(135deg, var(--green), var(--green-d)); box-shadow: 0 0 0 4px var(--green-bg), var(--sh-green); }
.engine-brain.error  .brain-core { background: linear-gradient(135deg, #f87171, var(--red-d)); box-shadow: 0 0 0 4px var(--red-bg); }

.brain-icon-text {
  font-size: 20px;
  font-weight: var(--fw-black);
  color: #fff;
  letter-spacing: -.5px;
  user-select: none;
  text-shadow: 0 1px 4px rgba(0,0,0,.2);
}

.brain-label {
  font-size: var(--fs-xs);
  font-weight: var(--fw-semi);
  color: var(--g500);
  text-align: center;
}

/* Action row */
.engine-action-row {
  display: flex;
  gap: var(--sp2);
  padding: 0 var(--sp3) var(--sp3);
  flex-shrink: 0;
}
.btn-engine-run {
  flex: 1;
  padding: 9px var(--sp3);
  background: linear-gradient(135deg, var(--brand), var(--brand-d));
  color: #fff;
  border: none;
  border-radius: var(--r);
  font-size: var(--fs-xs);
  font-weight: var(--fw-bold);
  cursor: pointer;
  transition: all var(--t) var(--ease);
  box-shadow: var(--sh-brand);
  letter-spacing: 0;
}
.btn-engine-run:hover { filter: brightness(1.1); transform: translateY(-1px); box-shadow: 0 6px 20px rgba(59,130,246,.45); }
.btn-engine-run:disabled { opacity: .5; cursor: not-allowed; transform: none; box-shadow: none; filter: none; }
.btn-engine-run.is-running {
  background: linear-gradient(135deg, #dc2626, #991b1b);
  box-shadow: 0 0 0 3px rgba(248,113,113,.25), 0 8px 22px rgba(153,27,27,.34);
  animation: engine-run-button-pulse 1.2s ease-in-out infinite alternate;
}
.btn-engine-run.is-running::before {
  content: "";
  display: inline-block;
  width: 9px;
  height: 9px;
  margin-left: 8px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 0 0 4px rgba(255,255,255,.2);
  vertical-align: middle;
}
.btn-engine-run.is-running:hover {
  box-shadow: 0 0 0 4px rgba(248,113,113,.3), 0 10px 25px rgba(153,27,27,.42);
}
@keyframes engine-run-button-pulse {
  from { filter: brightness(.96); }
  to { filter: brightness(1.12); }
}

.btn-engine-sec {
  padding: 9px var(--sp3);
  background: var(--g0);
  color: var(--g600);
  border: 1.5px solid var(--g200);
  border-radius: var(--r);
  font-size: var(--fs-xs);
  font-weight: var(--fw-semi);
  cursor: pointer;
  transition: all var(--t) var(--ease);
  white-space: nowrap;
}
.btn-engine-sec:hover { background: var(--g50); border-color: var(--g300); color: var(--g800); }
.btn-engine-sec:disabled { opacity: .5; cursor: not-allowed; }

/* Steps log */
.engine-steps-wrap {
  padding: 0 var(--sp3) var(--sp2);
  flex-shrink: 0;
}
.engine-steps-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: var(--fs-xs);
  font-weight: var(--fw-bold);
  color: var(--g600);
  margin-bottom: var(--sp1);
  padding-bottom: var(--sp1);
  border-bottom: 1px solid var(--g100);
  text-transform: uppercase;
  letter-spacing: .4px;
}

.engine-steps {
  max-height: 180px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 3px;
}
.engine-steps::-webkit-scrollbar { width: 3px; }
.engine-steps::-webkit-scrollbar-thumb { background: var(--g200); border-radius: 2px; }

.engine-step {
  display: flex;
  align-items: flex-start;
  gap: 6px;
  padding: 5px 6px;
  border-radius: var(--r-sm);
  font-size: var(--fs-xs);
  line-height: 1.4;
  border-right: 2px solid transparent;
}
.engine-step-icon { flex-shrink: 0; font-size: 11px; margin-top: 1px; }
.engine-step-text { flex: 1; color: var(--g700); }

.engine-step.es-check  { background: var(--g50); }
.engine-step.es-ok     { background: var(--green-bg);  border-right-color: var(--green-d); }
.engine-step.es-skip   { background: var(--g50); opacity: .55; }
.engine-step.es-assign { background: var(--blue-bg);   border-right-color: var(--blue-d); }
.engine-step.es-fail   { background: var(--red-bg);    border-right-color: var(--red-d); }
.engine-step.es-done   { background: var(--green-bg);  border-right-color: var(--green-d); }
.engine-step.es-active { background: var(--brand-light); border-right-color: var(--brand); animation: step-pulse .7s ease infinite alternate; }

@keyframes step-pulse { from { opacity: .65; } to { opacity: 1; } }

/* Result banner */
.engine-result {
  margin: 0 var(--sp3) var(--sp2);
  padding: var(--sp2) var(--sp3);
  border-radius: var(--r);
  font-size: var(--fs-xs);
  font-weight: var(--fw-semi);
  flex-shrink: 0;
  display: flex;
  align-items: center;
  gap: var(--sp2);
}
.engine-result.res-ok    { background: var(--green-bg); color: var(--green-d); border: 1px solid var(--green-b); }
.engine-result.res-none  { background: var(--amber-bg); color: var(--amber-d); border: 1px solid var(--amber-b); }
.engine-result.res-error { background: var(--red-bg);   color: var(--red-d);   border: 1px solid var(--red-b); }

/* Activity log */
.engine-log-wrap {
  padding: 0 var(--sp3) var(--sp3);
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  min-height: 0;
}

/* Couriers Column */
.dc-couriers-list {
  flex: 1;
  overflow-y: auto;
  padding: var(--sp2);
  display: flex;
  flex-direction: column;
  gap: var(--sp2);
}
.dc-couriers-list::-webkit-scrollbar { width: 4px; }
.dc-couriers-list::-webkit-scrollbar-thumb { background: var(--g200); border-radius: 2px; }

/* ── Courier card in dispatch center ── */
.dc-courier-card {
  padding: 7px 10px;
  border-radius: var(--r);
  background: var(--g0);
  display: flex;
  flex-direction: column;
  gap: 3px;
  border: 2px solid transparent;
  transition: all var(--t-fast) var(--ease);
}
.dc-courier-card:hover { transform: translateY(-1px); box-shadow: var(--sh-xs); }

.dc-courier-card.dc-c-ready     { border-color: var(--green-b); background: #f0fdf4; }
.dc-courier-card.dc-c-not-ready { border-color: var(--g200); background: var(--g50); opacity: .82; }

.dc-courier-top {
  display: flex;
  align-items: center;
  gap: var(--sp2);
  cursor: pointer;
  border-radius: var(--r-sm);
  margin: -2px -4px;
  padding: 2px 4px;
  transition: background var(--t-fast);
}
.dc-courier-top:hover { background: rgba(59,130,246,.08); }
.dc-courier-name {
  font-size: var(--fs-sm);
  font-weight: var(--fw-bold);
  color: var(--g800);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  flex: 1;
  min-width: 0;
}
.dc-courier-details {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding-top: 4px;
  margin-top: 2px;
  border-top: 1px dashed var(--g200);
}

/* الجاهزية — البادج الرئيسي */
.dc-ready-badge {
  font-size: 11px;
  font-weight: var(--fw-bold);
  padding: 3px 10px;
  border-radius: var(--r-full);
  white-space: nowrap;
  flex-shrink: 0;
}
.dc-ready-yes       { background: var(--green-bg); color: var(--green-d); border: 1.5px solid var(--green-b); }
.dc-ready-no        { background: var(--g100);     color: var(--g500);    border: 1.5px solid var(--g200); }
.dc-ready-suspended { background: #fff7ed;          color: #c2410c;        border: 1.5px solid #fed7aa; }
.dc-ready-busy      { background: #eff6ff;          color: #1d4ed8;        border: 1.5px solid #bfdbfe; }

/* سبب عدم الجاهزية */
.dc-not-ready-reason {
  font-size: 11px;
  color: var(--g500);
  background: var(--g100);
  border-radius: var(--r-sm);
  padding: 3px 8px;
}
.dc-reason-sub { font-size: 10px; color: var(--g400); margin-top: 2px; }

.dc-courier-phone { font-size: 11px; }
.dc-phone-link { color: var(--brand); text-decoration: none; }
.dc-phone-link:hover { text-decoration: underline; }

.dc-courier-last-seen { font-size: 10px; color: var(--g400); }

/* تحذير عدم الربط بالتطبيق */
.dc-not-linked-warn {
  font-size: 10px;
  color: #92400e;
  background: #fef3c7;
  border: 1px solid #fcd34d;
  border-radius: var(--r-sm);
  padding: 2px 7px;
  margin-top: 2px;
}
.dc-assign-btn-warn {
  background: #fef3c7 !important;
  color: #92400e !important;
  border-color: #f59e0b !important;
}

/* Quick action buttons row */
.dc-courier-quick-actions {
  display: flex;
  gap: 4px;
  flex-wrap: wrap;
  margin-top: 2px;
}
.dc-force-off-btn {
  flex: 1;
  padding: 4px 8px;
  font-size: 10px;
  font-weight: var(--fw-semi);
  border: 1px solid var(--g300);
  border-radius: var(--r-sm);
  background: var(--g100);
  color: var(--g600);
  cursor: pointer;
  transition: all var(--t-fast) var(--ease);
}
.dc-force-off-btn:hover { background: var(--red-bg); border-color: var(--red-b); color: var(--red-d); }
.dc-force-off-btn:disabled { opacity: .5; cursor: not-allowed; }
.dc-force-on-btn {
  flex: 1;
  padding: 4px 8px;
  font-size: 10px;
  font-weight: var(--fw-semi);
  border: 1px solid var(--green-b);
  border-radius: var(--r-sm);
  background: var(--green-bg);
  color: var(--green-d);
  cursor: pointer;
  transition: all var(--t-fast) var(--ease);
}
.dc-force-on-btn:hover { filter: brightness(1.05); }
.dc-force-on-btn:disabled { opacity: .5; cursor: not-allowed; }

/* Manual assignment */
.dc-order-card.dc-selected {
  border: 2px solid var(--brand) !important;
  background: var(--brand-light) !important;
  box-shadow: 0 0 0 3px rgba(59,130,246,.15);
}
.dc-no-courier { color: var(--amber-d) !important; font-style: italic; }

.dc-select-btn {
  flex: 1;
  padding: 4px 8px;
  font-size: var(--fs-xs);
  font-weight: var(--fw-semi);
  border-radius: var(--r-sm);
  border: 1.5px solid var(--brand-mid);
  background: var(--brand-light);
  color: var(--brand-d);
  cursor: pointer;
  transition: all var(--t-fast) var(--ease);
}
.dc-select-btn:hover { background: var(--brand); color: #fff; border-color: var(--brand); }
.dc-select-btn-active { background: var(--brand); color: #fff !important; border-color: var(--brand-d) !important; }
.dc-select-btn-active:hover { background: var(--brand-d); }

.dc-courier-card.dc-assignable { border-color: var(--green-b); cursor: pointer; background: #f0fdf4; }
.dc-courier-card.dc-assignable:hover { background: var(--green-bg); border-color: var(--green-d); transform: translateY(-1px); box-shadow: var(--sh-green); }

.dc-assign-btn {
  margin-top: 5px;
  width: 100%;
  padding: 6px 8px;
  font-size: var(--fs-xs);
  font-weight: var(--fw-bold);
  border-radius: var(--r-sm);
  border: none;
  background: linear-gradient(135deg, var(--green), var(--green-d));
  color: #fff;
  cursor: pointer;
  transition: all var(--t) var(--ease);
  box-shadow: var(--sh-green);
  animation: dc-assign-pulse .9s ease infinite alternate;
}
.dc-assign-btn:hover { filter: brightness(1.1); transform: translateY(-1px); }
.dc-assign-btn:disabled { opacity: .6; cursor: not-allowed; animation: none; transform: none; box-shadow: none; filter: none; }

.dc-assign-btn-busy { background: linear-gradient(135deg, var(--amber), var(--amber-d)); box-shadow: none; animation: none; }
.dc-assign-btn-busy:hover { filter: brightness(1.1); }

.dc-order-btns {
  display: flex;
  gap: var(--sp1);
  margin-top: var(--sp2);
  flex-wrap: wrap;
}
.dc-order-btns-primary {
  margin: 7px 0 9px;
  padding-bottom: 9px;
  border-bottom: 1px solid var(--border);
  flex-wrap: nowrap;
}
.dc-order-btns-primary > button {
  min-height: 38px;
  padding: 8px 10px;
  font-size: 12px;
}

.dc-cancel-order-btn {
  flex: 1;
  padding: 5px 8px;
  font-size: var(--fs-xs);
  font-weight: var(--fw-bold);
  border: 1.5px solid var(--red-b);
  border-radius: var(--r-sm);
  background: var(--red-bg);
  color: var(--red-d);
  cursor: pointer;
  transition: all var(--t) var(--ease);
  white-space: nowrap;
}
.dc-cancel-order-btn:hover { background: var(--red-d); color: #fff; transform: translateY(-1px); }
.dc-cancel-order-btn:disabled { opacity: .5; cursor: not-allowed; transform: none; }

.dc-order-map-row { margin-top: var(--sp1); }
.dc-map-link {
  display: inline-block;
  font-size: var(--fs-xs);
  padding: 3px 8px;
  border-radius: var(--r-sm);
  background: #eff6ff;
  color: #1d4ed8;
  border: 1px solid #bfdbfe;
  text-decoration: none;
  transition: background var(--t);
}
.dc-map-link:hover { background: #dbeafe; }
.dc-map-link-none { color: var(--text-muted); font-size: var(--fs-xs); background: none; border: none; padding: 0; }

@keyframes dc-assign-pulse {
  from { opacity: .88; }
  to   { opacity: 1; box-shadow: 0 0 12px rgba(16,185,129,.5); }
}

/* Active Offer Cards */
.dc-offers-wrap {
  padding: 0 var(--sp3) var(--sp2);
  flex-shrink: 0;
}

.dc-offer-count {
  font-size: var(--fs-xs);
  font-weight: var(--fw-black);
  background: linear-gradient(135deg, var(--amber), var(--amber-d));
  color: #fff;
  border-radius: var(--r-full);
  padding: 1px 7px;
  min-width: 18px;
  text-align: center;
  box-shadow: 0 2px 8px rgba(245,158,11,.4);
}

.dc-active-offers {
  display: flex;
  flex-direction: column;
  gap: var(--sp2);
  max-height: 220px;
  overflow-y: auto;
}
.dc-active-offers::-webkit-scrollbar { width: 3px; }
.dc-active-offers::-webkit-scrollbar-thumb { background: var(--g200); border-radius: 2px; }

.dc-offer-card {
  border: 1px solid var(--blue-b);
  border-right: 3px solid var(--brand);
  border-radius: var(--r);
  padding: var(--sp2) var(--sp3);
  background: var(--blue-bg);
  display: flex;
  flex-direction: column;
  gap: 4px;
  transition: all var(--t) var(--ease);
}
.dc-offer-card.offer-urgent {
  border-color: var(--red-b);
  border-right-color: var(--red-d);
  background: var(--red-bg);
  animation: offer-flash .5s ease infinite alternate;
}
@keyframes offer-flash { from { opacity: .8; } to { opacity: 1; } }

.dc-offer-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.dc-offer-id     { font-size: var(--fs-xs); font-weight: var(--fw-bold); font-family: monospace; color: var(--g700); }
.dc-offer-courier { font-size: var(--fs-xs); color: var(--g600); }

.dc-offer-timer {
  font-size: var(--fs-sm);
  font-weight: var(--fw-black);
  color: var(--brand);
  min-width: 28px;
  text-align: center;
  font-variant-numeric: tabular-nums;
}
.dc-offer-timer.timer-urgent { color: var(--red-d); }

.dc-offer-progress {
  height: 4px;
  background: var(--g200);
  border-radius: 2px;
  overflow: hidden;
}
.dc-offer-bar {
  height: 100%;
  border-radius: 2px;
  transition: width 1s linear, background .3s;
}

.dc-offer-cancel {
  padding: 5px 8px;
  font-size: var(--fs-xs);
  font-weight: var(--fw-semi);
  border: 1px solid var(--red-b);
  border-radius: var(--r-sm);
  background: var(--g0);
  color: var(--red-d);
  cursor: pointer;
  width: 100%;
  transition: all var(--t-fast) var(--ease);
}
.dc-offer-cancel:hover { background: var(--red-d); color: #fff; }
.dc-offer-cancel:disabled { opacity: .5; cursor: not-allowed; }

/* ── Dispatch Center responsive ── */
@media (max-width: 1100px) {
  .dc-grid { grid-template-columns: 1fr 260px 1fr; }
}
@media (max-width: 900px) {
  .dc-grid { grid-template-columns: 1fr; gap: var(--sp3); }
  .ops-grid { grid-template-columns: 1fr; }
  .ops-offer-form { grid-template-columns: 1fr; }
  .ops-row { flex-direction: column; }
  .ops-row-meta { justify-content: flex-start; text-align: right; }
}

/* ── Leaflet overrides ── */
.leaflet-container { font-family: var(--ff); }
.leaflet-tile.google-roadmap-tiles {
  filter: saturate(1.32) contrast(1.08) brightness(1.04);
}
.leaflet-popup-content-wrapper {
  border-radius: var(--r-lg) !important;
  box-shadow: var(--sh-xl) !important;
  font-size: var(--fs-sm);
  border: 1px solid var(--g200) !important;
}
.leaflet-popup-tip { display: none !important; }
.leaflet-tooltip {
  border-radius: var(--r-sm) !important;
  font-size: var(--fs-xs);
  font-family: var(--ff);
  border: 1px solid var(--g200) !important;
  box-shadow: var(--sh) !important;
  padding: 4px 8px !important;
}

/* ── General responsive ── */
@media (max-width: 1100px) {
  .couriers-layout       { grid-template-columns: 220px 6px 1fr; }
  .orders-source-board   { grid-template-columns: repeat(4, minmax(260px, 1fr)); }
}
@media (max-width: 900px) {
  .couriers-layout       { grid-template-columns: 1fr; }
  .couriers-resizer      { display: none; }
  .map-body              { height: 320px; flex-direction: column; }
  .map-stores-sidebar    { width: 100%; height: 160px; border-right: none; border-top: 1px solid var(--g200); flex-direction: row; overflow-x: auto; }
  .stores-list           { display: flex; flex-direction: row; overflow-x: auto; }
  .restaurants-layout    { flex-direction: column; height: auto; overflow: visible; }
  .restaurants-list-panel{ width: 100%; max-width: none; max-height: 45vh; border-left: none; border-bottom: 1px solid var(--g200); }
  .restaurants-resizer   { display: none; }
  .restaurant-edit-panel { max-height: none; }
  .restaurants-card-list { height: 220px; }
}
@media (max-width: 900px) {
  .topbar-row2          { flex-wrap: wrap; gap: var(--sp2); }
  .topbar-alerts        { order: 10; flex-basis: 100%; }
}
@media (max-width: 768px) {
  .topbar-row1          { padding: 6px var(--sp3); gap: var(--sp1); }
  .topbar-row2          { padding: 4px var(--sp3); }
  .topbar-search-wrap   { max-width: 180px; }
  .topbar-status        { display: none; }
  .form-grid            { grid-template-columns: 1fr; }
  .tab-btn              { padding: 4px 10px; font-size: var(--fs-xs); }
}
@media (max-width: 540px) {
  .topbar-search-wrap   { display: none; }
  .topbar-alerts        { display: none; }
  .stats-strip          { flex-wrap: wrap; }
  .sc                   { min-width: 60px; padding: var(--sp2) var(--sp2); }
  .broadcast-section    { flex-direction: column; }
  .tab-panel            { padding: var(--sp3); }
  .orders-source-board  { grid-template-columns: 1fr; gap: var(--sp3); }
}

/* ── Scrollbar global style ── */
* { scrollbar-width: thin; scrollbar-color: var(--g200) transparent; }
*::-webkit-scrollbar { width: 5px; height: 5px; }
*::-webkit-scrollbar-track { background: transparent; }
*::-webkit-scrollbar-thumb { background: var(--g200); border-radius: 3px; }
*::-webkit-scrollbar-thumb:hover { background: var(--g300); }

/* ── Custom checkbox & radio ── */
input[type="checkbox"] { accent-color: var(--brand); }
input[type="radio"]    { accent-color: var(--brand); }

/* ── Focus visible ── */
:focus-visible {
  outline: 2px solid var(--brand);
  outline-offset: 2px;
}
button:focus-visible, a:focus-visible { border-radius: var(--r-sm); }

/* ── Order Log Tab ── */

/* ── Order Log Tab ── */
.log-tab-inner { display:flex; flex-direction:column; height:100%; padding:var(--sp3); gap:var(--sp2); }
.log-tab-toolbar { display:flex; align-items:center; flex-wrap:wrap; gap:var(--sp2); }
.log-tab-title { font-size:var(--fs-lg); font-weight:var(--fw-bold); color:var(--g800); }
.log-filters { display:flex; gap:var(--sp2); flex:1; flex-wrap:wrap; }
.log-search { flex:1; min-width:180px; padding:6px 10px; border:1.5px solid var(--g200); border-radius:var(--r-sm); font-size:var(--fs-sm); background:var(--g0); }
.log-search:focus { border-color:var(--brand); outline:none; }
.log-status-filter { padding:6px 8px; border:1.5px solid var(--g200); border-radius:var(--r-sm); font-size:var(--fs-sm); background:var(--g0); }

.log-feed { flex:1; overflow-y:auto; display:flex; flex-direction:column; gap:6px; }
.log-empty { color:var(--text-muted); text-align:center; padding:var(--sp4); font-size:var(--fs-sm); }

.log-entry { background:var(--g0); border:1px solid var(--g200); border-radius:var(--r-md); padding:10px 14px; transition:box-shadow var(--t); }
.log-entry:hover { box-shadow:0 2px 8px rgba(0,0,0,.07); }
.log-entry-current { border-right:3px solid var(--brand); background:var(--brand-light); }

.log-entry-meta { display:flex; align-items:center; gap:var(--sp2); flex-wrap:wrap; margin-bottom:5px; }
.log-order-id { font-weight:var(--fw-bold); color:var(--brand); font-size:var(--fs-sm); font-family:monospace; }
.log-customer { color:var(--g600); font-size:var(--fs-sm); }
.log-time { color:var(--g400); font-size:var(--fs-xs); margin-right:auto; }

.log-entry-content { font-size:var(--fs-sm); display:flex; align-items:center; flex-wrap:wrap; gap:6px; }

.log-tag { display:inline-block; padding:1px 7px; border-radius:20px; font-size:11px; font-weight:600; }
.log-tag-current { background:var(--brand-light); color:var(--brand); border:1px solid var(--brand-mid); }
.log-tag-status  { background:#fef9c3; color:#854d0e; border:1px solid #fde047; }
.log-tag-courier { background:#f0fdf4; color:#166534; border:1px solid #86efac; }

.log-status { display:inline-block; padding:1px 8px; border-radius:20px; font-size:11px; font-weight:600; }
.log-st-done   { background:#dcfce7; color:#166534; }
.log-st-cancel { background:#fee2e2; color:#991b1b; }
.log-st-active { background:#dbeafe; color:#1e40af; }
.log-st-new    { background:#f1f5f9; color:#475569; }

/* ── Notification Drawer ── */
.notif-drawer {
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(15,23,42,.55);
  z-index: 1200;
  display: flex;
  align-items: flex-start;
  justify-content: flex-end;
  padding: var(--sp3);
}
.notif-drawer[hidden] { display: none !important; }
.notif-drawer-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--sp2) var(--sp3);
  border-bottom: 1px solid var(--g200);
  gap: var(--sp2);
}
.notif-drawer-title { font-weight: var(--fw-bold); font-size: var(--fs-base); }
.notif-drawer-actions { display: flex; gap: var(--sp1); }
.notif-drawer-body {
  flex: 1;
  overflow-y: auto;
  padding: var(--sp2) var(--sp3);
  display: flex;
  flex-direction: column;
  gap: 6px;
  max-height: calc(100vh - 120px);
}
.notif-drawer > div:not(.notif-drawer-header):not(.notif-drawer-body) { display: none; }
/* The drawer itself acts as backdrop, inner panel: */
.notif-drawer::before { display: none; }
.notif-drawer > * { background: var(--g0); border-radius: var(--r-lg); box-shadow: 0 8px 32px rgba(0,0,0,.18); width: 420px; max-width: 96vw; display: flex; flex-direction: column; max-height: 90vh; }
.notif-row { display: flex; flex-direction: column; gap: 2px; padding: 7px 0; border-bottom: 1px solid var(--g100); }
.notif-row:last-child { border-bottom: none; }
.notif-row-time { font-size: 11px; color: var(--g400); }
.notif-row-msg  { font-size: var(--fs-sm); color: var(--g700); }
.notif-empty { color: var(--text-muted); text-align: center; padding: var(--sp4); font-size: var(--fs-sm); }

/* ── Robot Status Banner ── */
.robot-banner {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 14px;
  border-radius: var(--r-md);
  font-size: var(--fs-sm);
  margin-bottom: var(--sp2);
  border: 1.5px solid;
}
.robot-banner-on {
  background: linear-gradient(135deg, #052e16, #16a34a);
  border-color: #22c55e;
  color: #fff;
  box-shadow: 0 0 0 3px rgba(34,197,94,.22), 0 10px 24px rgba(22,101,52,.28);
  animation: robot-work-glow 1.1s ease-in-out infinite alternate;
}
.robot-banner-off {
  background: var(--g100);
  border-color: var(--g200);
  color: var(--g500);
  font-size: var(--fs-xs);
}
.robot-live-dot {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 15px;
  height: 15px;
  border-radius: 50%;
  background: radial-gradient(circle, #fff 34%, #fef08a 36%, rgba(254,240,138,0) 72%);
  flex-shrink: 0;
  position: relative;
}
.robot-live-dot::before {
  content: '';
  position: absolute;
  inset: -6px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(254,240,138,.45), rgba(254,240,138,0) 70%);
  animation: robot-pulse-ring 1.4s ease-out infinite;
}
@keyframes robot-pulse-ring {
  0%   { transform: scale(.45); opacity: .9; }
  100% { transform: scale(1.5); opacity: 0; }
}
.robot-banner-stats {
  color: #dcfce7;
  font-size: var(--fs-xs);
  margin-right: auto;
}

.dc-no-courier-warn { color: var(--red-d) !important; font-weight: var(--fw-bold); animation: robot-pulse 2s infinite; }

/* ── Robot banner — sequential mode ── */
.robot-banner { flex-wrap: wrap; row-gap: 4px; }
.robot-current-order { font-weight: 900; color: #fff; font-family: monospace; background: rgba(255,255,255,.18); padding: 2px 8px; border-radius: var(--r-sm); }
.robot-arrow { color: #bbf7d0; margin: 0 2px; font-weight: 900; }
.robot-courier-name { color: #fff; font-weight: 800; }
.robot-countdown { font-family: monospace; font-weight: 900; font-size: 14px; background: #fff; padding: 2px 8px; border-radius: 6px; }
.robot-searching { color: #dcfce7; font-style: normal; font-weight: 800; font-size: var(--fs-sm); }
.robot-speed-control { display: grid; gap: 6px; margin: 10px 0; padding: 10px; border: 1px solid var(--g200); border-radius: var(--r-sm); background: var(--g50); color: var(--g800); font-weight: 700; }
.robot-speed-control select { width: 100%; padding: 8px; border: 1px solid var(--g300); border-radius: var(--r-sm); background: var(--g0); color: var(--g800); }
.robot-speed-control small { color: var(--g500); font-weight: 500; line-height: 1.5; }
.dc-order-card.dc-robot-active {
  border: 2px solid #16a34a !important;
  box-shadow: 0 0 0 4px rgba(34,197,94,.22), 0 8px 20px rgba(22,101,52,.22);
  background: #f0fdf4 !important;
  animation: robot-card-work 1s ease-in-out infinite alternate;
}
.dc-order-card.dc-robot-active .dc-order-id::after { content: " [BOT]"; }

@keyframes robot-work-glow {
  from { filter: brightness(1); }
  to { filter: brightness(1.12); }
}

@keyframes robot-card-work {
  from { transform: translateY(0); }
  to { transform: translateY(-2px); }
}

/* ── Finance section in create-order form ── */
.finance-section-title {
  font-size: var(--fs-sm);
  font-weight: var(--fw-bold);
  color: var(--g700);
  margin-bottom: var(--sp2);
  padding-bottom: 6px;
  border-bottom: 1.5px solid var(--g200);
}
.finance-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: var(--sp2);
}
@media (max-width: 700px) { .finance-grid { grid-template-columns: 1fr; } }
.finance-field { display: flex; flex-direction: column; gap: 4px; }
.finance-label { font-size: var(--fs-xs); font-weight: 700; }
.finance-label-pay     { color: #dc2626; }
.finance-label-collect { color: #0369a1; }
.finance-label-earn    { color: #059669; }
.finance-hint { font-size: 10px; color: var(--g400); min-height: 14px; line-height: 1.3; }
.finance-input { padding: 7px 10px; border: 1.5px solid var(--g200); border-radius: var(--r-sm); font-size: var(--fs-sm); background: var(--g0); width: 100%; }
.finance-input:focus { outline: none; }
.finance-input-pay:focus     { border-color: #ef4444; }
.finance-input-collect:focus { border-color: #3b82f6; }
.finance-input-earn:focus    { border-color: #10b981; }
.finance-auto-hint { font-size: 11px; color: var(--green-d); font-family: monospace; }

/* ── Offer inline display in dispatch card ── */
.dc-offer-inline {
  margin: 6px 0 4px;
  padding: 7px 10px;
  background: #eff6ff;
  border: 1.5px solid #bfdbfe;
  border-radius: var(--r-sm);
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}
.dc-offer-inline-label { font-size: var(--fs-xs); color: #1d4ed8; font-weight: 600; flex: 1; }
.dc-offer-inline-timer { font-family: monospace; font-weight: 800; font-size: 15px; min-width: 32px; text-align: center; }
.dc-offer-inline-bar-wrap { width: 100%; height: 4px; background: #dbeafe; border-radius: 2px; }
.dc-offer-inline-bar { height: 100%; border-radius: 2px; transition: width .9s linear; }
.dc-offer-badge { font-size: 10px; background: #eff6ff; color: #1d4ed8; border: 1px solid #bfdbfe; border-radius: 10px; padding: 1px 6px; vertical-align: middle; margin-right: 4px; }

/* ════════════════════════════════════════════════════
   Robot Assignment Visualizer
   ════════════════════════════════════════════════════ */

/* Panel */
.robot-viz-panel {
  background: var(--g50);
  border: 1px solid var(--g200);
  border-radius: var(--radius-lg);
  margin-bottom: var(--sp4);
  overflow: hidden;
  box-shadow: 0 1px 4px rgba(0,0,0,.06);
}

/* Header */
.robot-viz-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px var(--sp4);
  cursor: pointer;
  user-select: none;
  background: linear-gradient(135deg, #1e293b 0%, #2d3748 100%);
  color: #fff;
  transition: background .2s;
}
.robot-viz-header:hover { background: linear-gradient(135deg, #334155 0%, #3d4f62 100%); }

.robot-viz-title-row {
  display: flex;
  align-items: center;
  gap: 10px;
}
.robot-viz-title-text {
  font-weight: 600;
  font-size: var(--fs-sm);
  color: #f1f5f9;
}
.robot-viz-icon {
  font-size: 20px;
  display: inline-block;
  line-height: 1;
}
.robot-viz-chevron {
  font-size: 14px;
  color: #94a3b8;
  transition: transform .2s;
}

/* Status badge */
.robot-viz-badge {
  font-size: 11px;
  font-weight: 700;
  border-radius: 20px;
  padding: 2px 9px;
  border: 1px solid transparent;
  letter-spacing: .03em;
}
.robot-viz-badge.off {
  background: rgba(100,116,139,.25);
  color: #94a3b8;
  border-color: rgba(100,116,139,.3);
}
.robot-viz-badge.on {
  background: rgba(16,185,129,.2);
  color: #34d399;
  border-color: rgba(16,185,129,.35);
}
.robot-viz-badge.assigning {
  background: rgba(59,130,246,.25);
  color: #93c5fd;
  border-color: rgba(59,130,246,.4);
  animation: rvizBadgePulse 1.1s ease-in-out infinite;
}

/* Body */
.robot-viz-body {
  display: flex;
  gap: 0;
  height: 290px;
}

/* Mini map */
.robot-viz-map {
  flex: 1;
  min-width: 0;
  height: 100%;
  background: #e8f0f7;
  border-left: 1px solid var(--g200);
}

/* Sidebar */
.robot-viz-sidebar {
  width: 210px;
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  gap: 0;
  border-right: 1px solid var(--g200);
  background: #fff;
  overflow: hidden;
}

/* Step indicator */
.robot-viz-step-row {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 12px;
  border-bottom: 1px solid var(--g100);
  background: #f8fafc;
}
.rviz-step-icon {
  font-size: 18px;
  flex-shrink: 0;
}
.rviz-step-text {
  font-size: var(--fs-xs);
  color: var(--g700);
  font-weight: 500;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* Queue */
.robot-viz-queue-section {
  flex: 1;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}
.robot-viz-section-label {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .07em;
  color: var(--g400);
  padding: 8px 12px 4px;
  border-bottom: 1px solid var(--g100);
}
.robot-viz-queue-list {
  flex: 1;
  overflow-y: auto;
  padding: 4px 0;
}
.rviz-queue-empty {
  font-size: var(--fs-xs);
  color: var(--g400);
  text-align: center;
  padding: 16px 8px;
}
.rviz-queue-item {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 5px 12px;
  font-size: var(--fs-xs);
  border-bottom: 1px solid var(--g50);
  transition: background .15s;
}
.rviz-queue-item.current {
  background: #eff6ff;
  border-right: 3px solid var(--blue);
}
.rviz-queue-item:hover { background: var(--g50); }
.rviz-q-num {
  width: 18px;
  height: 18px;
  font-size: 10px;
  font-weight: 700;
  color: var(--g400);
  flex-shrink: 0;
  text-align: center;
  line-height: 18px;
}
.rviz-q-id {
  font-family: monospace;
  font-weight: 700;
  font-size: 12px;
  color: var(--g700);
  flex-shrink: 0;
}
.rviz-q-rest {
  color: var(--g500);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 11px;
}
.rviz-queue-more {
  font-size: 11px;
  color: var(--g400);
  text-align: center;
  padding: 6px;
  font-style: italic;
}

/* ── Map Markers ── */
.rviz-marker {
  width: 34px;
  height: 34px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  border-radius: 50%;
  border: 2px solid transparent;
  background: #fff;
  box-shadow: 0 2px 6px rgba(0,0,0,.25);
  transition: transform .2s, border-color .2s;
}
.rviz-rest {
  border-color: var(--amber);
  font-size: 16px;
}
.rviz-rest.rviz-active {
  border-color: var(--blue);
  background: #eff6ff;
  animation: rvizActiveMarker 1s ease-in-out infinite;
}
.rviz-place-marker {
  position: relative;
  width: 38px;
  height: 38px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  background: #090909;
  border: 3px solid #fff;
  border-radius: 50% 50% 50% 10px;
  box-shadow: 0 3px 10px rgba(0,0,0,.38);
  transform: rotate(-45deg);
}
.rviz-place-marker svg {
  width: 20px;
  height: 20px;
  fill: currentColor;
  transform: rotate(45deg);
}
.rviz-place-marker.rviz-active {
  background: #000;
  border-color: #fff;
  animation: rvizPlaceActiveMarker 1s ease-in-out infinite;
}
.rviz-customer { background: #222; }
.rviz-trip-time {
  min-width: 88px;
  padding: 5px 8px;
  color: #fff;
  background: #050505;
  border: 2px solid #fff;
  border-radius: 9px;
  box-shadow: 0 3px 10px rgba(0,0,0,.32);
  text-align: center;
  white-space: nowrap;
  line-height: 1.05;
}
.rviz-trip-time::after {
  content: "";
  position: absolute;
  left: 50%;
  bottom: -5px;
  width: 8px;
  height: 8px;
  background: #050505;
  border-right: 2px solid #fff;
  border-bottom: 2px solid #fff;
  transform: translateX(-50%) rotate(45deg);
}
.rviz-trip-time span { display: block; margin-bottom: 3px; color: #d1d5db; font-size: 9px; }
.rviz-trip-time strong { font-size: 13px; font-variant-numeric: tabular-nums; letter-spacing: .4px; }
.rviz-live-route { animation: rvizBeamMarch .75s linear infinite; }
@keyframes rvizPlaceActiveMarker {
  0%, 100% { box-shadow: 0 3px 10px rgba(0,0,0,.38), 0 0 0 0 rgba(0,0,0,.35); transform: rotate(-45deg) scale(1); }
  50% { box-shadow: 0 3px 10px rgba(0,0,0,.38), 0 0 0 8px rgba(0,0,0,0); transform: rotate(-45deg) scale(1.1); }
}
.rviz-courier {
  width: 28px;
  height: 28px;
  font-size: 14px;
}
.rviz-courier.rviz-avail {
  border-color: var(--green);
  background: #f0fdf4;
}
.rviz-courier.rviz-busy {
  border-color: var(--g300);
  background: var(--g50);
  opacity: .65;
}

/* ── Leaflet overlay animations ── */
.rviz-radar-ring {
  animation: rvizRadarFade 1.6s ease-out forwards;
}
.rviz-beam {
  animation: rvizBeamMarch .45s linear infinite;
  stroke-dasharray: 10, 6;
}
.rviz-target-pulse {
  animation: rvizTargetPulse 1s ease-in-out infinite;
}

/* ── Order card animations ── */
.order-editor-card.robot-processing {
  border-color: var(--blue-b) !important;
  animation: rvizCardProcess 1.4s ease-in-out infinite;
}
.order-editor-card.robot-assign-flash {
  animation: rvizCardFlash 2.6s ease forwards;
}

/* ── Keyframes ── */
@keyframes rvizSpin {
  0%   { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}
.rviz-spin { animation: rvizSpin 1.2s linear infinite; display: inline-block; }

@keyframes rvizBadgePulse {
  0%, 100% { opacity: 1; }
  50%       { opacity: .55; }
}

@keyframes rvizActiveMarker {
  0%, 100% { box-shadow: 0 0 0 0 rgba(59,130,246,.5); transform: scale(1); }
  50%       { box-shadow: 0 0 0 8px rgba(59,130,246,0); transform: scale(1.12); }
}

@keyframes rvizRadarFade {
  0%   { stroke-opacity: .7; }
  100% { stroke-opacity: 0; }
}

@keyframes rvizBeamMarch {
  0%   { stroke-dashoffset: 0; }
  100% { stroke-dashoffset: -16; }
}

@keyframes rvizTargetPulse {
  0%, 100% { fill-opacity: .25; stroke-opacity: 1; r: 110; }
  50%       { fill-opacity: .05; stroke-opacity: .4; r: 170; }
}

@keyframes rvizCardProcess {
  0%, 100% { box-shadow: 0 0 0 0 rgba(59,130,246,.3); }
  50%       { box-shadow: 0 0 0 6px rgba(59,130,246,.1); }
}

@keyframes rvizCardFlash {
  0%   { box-shadow: 0 0 0 0 rgba(16,185,129,.6); border-color: #6ee7b7 !important; }
  20%  { box-shadow: 0 0 0 10px rgba(16,185,129,.15); }
  60%  { box-shadow: 0 0 0 4px rgba(16,185,129,.05); border-color: #6ee7b7 !important; }
  100% { box-shadow: 0 0 0 0 rgba(16,185,129,0); }
}

@keyframes rvizQPulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50%       { opacity: .4; transform: scale(1.5); }
}
.rviz-q-pulse {
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--blue);
  animation: rvizQPulse .8s ease-in-out infinite;
  flex-shrink: 0;
}

/* ════════════════════════════════════════════════════
   Enhanced Order Log
   ════════════════════════════════════════════════════ */

.log-rest-name {
  font-size: 11px;
  color: var(--amber-d);
  font-weight: 500;
  max-width: 120px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* Order card view */
.log-order-card {
  background: #fff;
  border: 1px solid var(--g200);
  border-radius: var(--radius-md);
  margin-bottom: 10px;
  overflow: hidden;
  box-shadow: 0 1px 3px rgba(0,0,0,.05);
}
.log-order-card-header {
  padding: 10px 14px;
  border-bottom: 1px solid var(--g100);
  background: var(--g50);
}
.loc-main {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 4px;
  flex-wrap: wrap;
}
.loc-id {
  font-family: monospace;
  font-weight: 700;
  font-size: 13px;
  color: var(--g800);
}
.loc-status { font-size: 11px; font-weight: 600; padding: 2px 7px; border-radius: 10px; }
.loc-rest {
  font-size: 12px;
  color: var(--amber-d);
  font-weight: 500;
}
.loc-sub {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 11px;
  color: var(--g500);
  flex-wrap: wrap;
}
.loc-sep { color: var(--g300); }
.loc-attempts-badge {
  background: var(--blue-bg);
  color: var(--blue-d);
  border: 1px solid var(--blue-b);
  border-radius: 10px;
  padding: 1px 7px;
  font-size: 10px;
  font-weight: 600;
}

/* Attempts body */
.log-attempts-body { padding: 8px 14px; }
.log-attempt-row {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 5px 8px;
  border-radius: 6px;
  margin-bottom: 4px;
  font-size: 12px;
  border: 1px solid transparent;
}
.la-accepted   { background: #f0fdf4; border-color: #bbf7d0; }
.la-rejected   { background: #fef2f2; border-color: #fecaca; }
.la-reassigned { background: #fff7ed; border-color: #fed7aa; }
.la-removed    { background: var(--g50);  border-color: var(--g200); }
.la-cancelled  { background: #f0f9ff; border-color: #bae6fd; }
.la-pending    { background: #eff6ff; border-color: #bfdbfe; }

.la-num {
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: var(--g200);
  color: var(--g600);
  font-size: 10px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.la-courier { font-weight: 600; color: var(--g800); flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.la-time    { font-size: 10px; color: var(--g400); white-space: nowrap; }
.la-result-badge { font-size: 11px; font-weight: 600; white-space: nowrap; }
.la-duration {
  font-size: 10px;
  color: var(--g500);
  background: var(--g100);
  border-radius: 8px;
  padding: 1px 6px;
  white-space: nowrap;
}
.la-none { font-size: 11px; color: var(--g400); text-align: center; padding: 8px; font-style: italic; }

/* ════════════════════════════════════════════════════
   Courier Notification System
   ════════════════════════════════════════════════════ */

.notif-sender-card {}

.notif-channel-tabs {
  display: flex;
  gap: 6px;
  margin-bottom: var(--sp3);
  padding: 3px;
  background: var(--g100);
  border-radius: var(--r-md);
}
.notif-channel-tab {
  flex: 1;
  padding: 7px 6px;
  border: none;
  border-radius: var(--r-sm);
  background: transparent;
  color: var(--g500);
  font-size: var(--fs-sm);
  font-weight: var(--fw-semi);
  transition: background var(--t-fast) var(--ease), color var(--t-fast) var(--ease), box-shadow var(--t-fast) var(--ease);
}
.notif-channel-tab:hover { color: var(--g800); }
.notif-channel-tab.is-active { background: var(--g0); color: var(--brand-d); box-shadow: var(--sh-xs); }

.notif-audience-select {
  width: 100%;
  padding: 6px 8px;
  border: 1px solid var(--g200);
  border-radius: var(--radius-sm);
  font-size: var(--fs-sm);
  background: var(--g0);
}

.notif-actions {
  display: flex;
  gap: 8px;
  margin-top: 8px;
}
.notif-send-btn { flex: 1; }

/* Preview bubble */
.notif-preview-bubble {
  margin-top: 10px;
  background: #1c1c1e;
  color: #fff;
  border-radius: 14px;
  padding: 12px 14px;
  font-size: 13px;
  box-shadow: 0 4px 14px rgba(0,0,0,.35);
}
.npb-header {
  display: flex;
  justify-content: space-between;
  font-size: 11px;
  color: #a1a1a6;
  margin-bottom: 4px;
}
.npb-app { font-weight: 600; color: #e5e5e7; }
.npb-title { font-weight: 700; font-size: 14px; margin-bottom: 3px; }
.npb-body  { color: #c7c7cc; font-size: 12px; }

/* Notification sent log */
.notif-sent-log {
  max-height: 280px;
  overflow-y: auto;
  padding: 4px 0;
}
.notif-log-entry {
  padding: 10px 14px;
  border-bottom: 1px solid var(--g100);
}
.notif-log-entry:last-child { border-bottom: none; }
.nle-header {
  display: flex;
  justify-content: space-between;
  margin-bottom: 4px;
}
.nle-audience { font-size: 11px; font-weight: 600; color: var(--blue-d); }
.nle-time     { font-size: 10px; color: var(--g400); }
.nle-title    { font-weight: 600; font-size: 13px; color: var(--g800); }
.nle-body     { font-size: 12px; color: var(--g500); margin-top: 2px; }

/* ════════════════════════════════════════════════════
   Sound Toggle Button
   ════════════════════════════════════════════════════ */

.sound-toggle-btn {
  background: none;
  border: 1px solid rgba(255,255,255,.15);
  border-radius: 6px;
  cursor: pointer;
  font-size: 16px;
  padding: 3px 7px;
  line-height: 1;
  color: inherit;
  transition: background .15s, border-color .15s;
}
.sound-toggle-btn:hover { background: rgba(255,255,255,.1); }
.sound-toggle-btn.sound-off {
  opacity: .5;
  border-color: rgba(255,255,255,.08);
}

/* ══════════════════════════════════════════════════════════════
   STATS / DASHBOARD TAB
══════════════════════════════════════════════════════════════ */
.stats-dashboard {
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}
.stats-db-header {
  display: flex;
  align-items: center;
  gap: 12px;
}
.stats-db-title {
  font-size: var(--fs-lg);
  font-weight: var(--fw-bold);
  color: var(--g900);
}
.stats-db-updated {
  font-size: var(--fs-xs);
  color: var(--g400);
  margin-inline-start: auto;
}

/* KPI cards */
.kpi-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 12px;
}
.kpi-card {
  background: #fff;
  border: 1px solid var(--g200);
  border-radius: var(--r-lg);
  padding: 16px 14px;
  text-align: start;
  box-shadow: 0 1px 4px rgba(0,0,0,.06);
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.kpi-icon {
  font-size: 18px;
  width: 38px;
  height: 38px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--g100);
}
.kpi-value { font-size: 1.6rem; font-weight: 700; color: var(--g900); line-height: 1.1; }
.kpi-label { font-size: var(--fs-xs); color: var(--g500); }
.kpi-card.kpi-blue   .kpi-icon { background: #dbeafe; }
.kpi-card.kpi-green  .kpi-icon { background: #dcfce7; }
.kpi-card.kpi-red    .kpi-icon { background: #fee2e2; }
.kpi-card.kpi-amber  .kpi-icon { background: #fef3c7; }
.kpi-card.kpi-purple .kpi-icon { background: #e0f2fe; }
.kpi-card.kpi-red .kpi-value  { color: #dc2626; }
.kpi-card.kpi-green .kpi-value{ color: #16a34a; }

/* Stats panels */
.stats-charts-row {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 14px;
}
.stats-panel {
  background: #fff;
  border: 1px solid var(--g200);
  border-radius: var(--r-lg);
  overflow: hidden;
  box-shadow: 0 1px 4px rgba(0,0,0,.06);
}
.stats-panel.stats-full {
  grid-column: 1 / -1;
}
.stats-panel-head {
  padding: 10px 14px;
  font-weight: var(--fw-bold);
  font-size: var(--fs-sm);
  background: var(--g50);
  border-bottom: 1px solid var(--g200);
  color: var(--g700);
}

/* Bar charts */
.stats-bar-list { padding: 10px 12px; display: flex; flex-direction: column; gap: 6px; }
.stats-bar-row  { display: flex; align-items: center; gap: 8px; }
.stats-bar-label { font-size: var(--fs-xs); color: var(--g700); min-width: 80px; max-width: 120px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.stats-bar-track { flex: 1; background: var(--g100); border-radius: 99px; height: 8px; overflow: hidden; }
.stats-bar-fill  { height: 100%; background: var(--brand); border-radius: 99px; min-width: 4px; transition: width .4s ease; }
.stats-bar-count { font-size: var(--fs-xs); color: var(--g500); min-width: 24px; text-align: start; }

/* Order status pipeline */
.order-pipeline {
  display: flex;
  align-items: center;
  padding: 18px 16px;
  overflow-x: auto;
  gap: 0;
}
.pipeline-step {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  min-width: 84px;
  flex-shrink: 0;
}
.pipeline-icon {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: var(--brand-light, var(--g100));
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
}
.pipeline-count { font-size: var(--fs-lg); font-weight: var(--fw-bold); color: var(--g900); }
.pipeline-label  { font-size: var(--fs-xs); color: var(--g500); white-space: nowrap; }
.pipeline-connector {
  flex: 1;
  min-width: 24px;
  height: 2px;
  margin: 0 4px 22px;
  background-image: linear-gradient(to right, var(--g300) 50%, transparent 0%);
  background-size: 10px 2px;
  background-repeat: repeat-x;
}

/* Mini list panels (recent alerts / recent orders) */
.stats-mini-list { padding: 6px 10px; display: flex; flex-direction: column; }
.mini-row {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 7px 4px;
  border-bottom: 1px solid var(--g100);
  font-size: var(--fs-sm);
}
.mini-row:last-child { border-bottom: none; }
.mini-row-time  { font-size: var(--fs-xs); color: var(--g400); min-width: 42px; }
.mini-row-text  { flex: 1; color: var(--g700); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mini-row-status{ font-size: var(--fs-xs); color: var(--g500); }
.mini-row-badge {
  font-size: var(--fs-xs);
  font-weight: 600;
  padding: 2px 6px;
  border-radius: 6px;
  background: var(--g100);
  color: var(--g600);
}
.mini-badge-active { background: var(--blue-bg, #dbeafe); color: #3b82f6; }
.mini-badge-done   { background: var(--green-bg, #dcfce7); color: #16a34a; }
.mini-row.ai-warn  .mini-row-text { color: #b45309; }
.mini-row.ai-error .mini-row-text { color: #dc2626; }
.mini-row.ai-success .mini-row-text { color: #16a34a; }

/* Today donut chart */
.stats-donut-wrap {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 14px;
}
.stats-donut {
  width: 96px;
  height: 96px;
  border-radius: 50%;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}
.stats-donut-hole {
  width: 66px;
  height: 66px;
  border-radius: 50%;
  background: var(--surface-solid, #fff);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}
.stats-donut-total { font-size: var(--fs-lg); font-weight: var(--fw-bold); color: var(--g900); line-height: 1.1; }
.stats-donut-caption { font-size: 10px; color: var(--g400); }
.stats-donut-legend { display: flex; flex-direction: column; gap: 6px; font-size: var(--fs-xs); color: var(--g600); }
.donut-legend-row { display: flex; align-items: center; gap: 6px; }
.donut-dot { width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0; }

.stats-charts-row-3 { grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); }

/* SLA watch list */
.stats-sla-list  { padding: 10px 12px; display: flex; flex-direction: column; gap: 6px; }
.sla-row         { display: flex; align-items: center; gap: 8px; padding: 6px 10px; border-radius: var(--r-md); font-size: var(--fs-sm); }
.sla-row-crit    { background: #fef2f2; border: 1px solid #fca5a5; }
.sla-row-warn    { background: #fffbeb; border: 1px solid #fcd34d; }
.sla-row-late    { background: #fff7ed; border: 1px solid #fdba74; }
.sla-lbl  { font-weight: 600; min-width: 68px; }
.sla-id   { font-family: monospace; font-size: 12px; color: var(--g600); }
.sla-ago  { margin-inline-start: auto; font-size: var(--fs-xs); color: var(--g500); }

/* ══════════════════════════════════════════════════════════════
   SLA BADGES ON ORDER CARDS
══════════════════════════════════════════════════════════════ */
.sla-badge {
  display: inline-flex;
  align-items: center;
  font-size: 10px;
  font-weight: 700;
  padding: 2px 6px;
  border-radius: var(--r-full);
  line-height: 1.3;
  animation: slaBadgePulse 1.4s ease-in-out infinite;
}
.sla-badge-crit { background: #fef2f2; color: #b91c1c; border: 1px solid #fca5a5; }
.sla-badge-warn { background: #fffbeb; color: #b45309; border: 1px solid #fde68a; }
.sla-badge-late { background: #fff7ed; color: #c2410c; border: 1px solid #fed7aa; }

.order-sla-critical .order-card-summary { border-right: 4px solid #ef4444; }
.order-sla-warning  .order-card-summary { border-right: 4px solid #f59e0b; }
.order-sla-late     .order-card-summary { border-right: 4px solid #f97316; }

@keyframes slaBadgePulse {
  0%, 100% { opacity: 1; }
  50%       { opacity: .6; }
}

/* ══════════════════════════════════════════════════════════════
   MANUAL ASSIGN MODAL
══════════════════════════════════════════════════════════════ */
.ma-modal {
  position: fixed;
  inset: 0;
  z-index: 9000;
  display: flex;
  align-items: center;
  justify-content: center;
}
.ma-modal[hidden] { display: none; }
.ma-overlay {
  position: absolute;
  inset: 0;
  background: rgba(0,0,0,.4);
  backdrop-filter: blur(2px);
}
.ma-dialog {
  position: relative;
  background: #fff;
  border-radius: var(--r-xl);
  width: min(480px, 96vw);
  max-height: 80vh;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  box-shadow: 0 20px 60px rgba(0,0,0,.25);
}
.ma-header {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 14px 16px;
  background: linear-gradient(135deg, #1e293b 0%, #334155 100%);
  color: #fff;
}
.ma-title    { font-weight: 700; font-size: var(--fs-base); }
.ma-order-id { font-family: monospace; font-size: 13px; background: rgba(255,255,255,.15); padding: 2px 8px; border-radius: 6px; }
.ma-close    { margin-inline-start: auto; background: none; border: none; color: rgba(255,255,255,.7); font-size: 16px; cursor: pointer; padding: 4px 8px; border-radius: 6px; }
.ma-close:hover { background: rgba(255,255,255,.15); color: #fff; }
.ma-order-info {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  padding: 10px 16px;
  background: var(--g50);
  border-bottom: 1px solid var(--g200);
  font-size: var(--fs-sm);
  color: var(--g700);
}
.ma-list-head {
  padding: 8px 16px;
  font-size: var(--fs-xs);
  color: var(--g500);
  font-weight: 600;
  border-bottom: 1px solid var(--g100);
}
.ma-courier-list {
  overflow-y: auto;
  flex: 1;
}
.ma-courier-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 11px 16px;
  border-bottom: 1px solid var(--g100);
  cursor: pointer;
  transition: background .15s;
}
.ma-courier-row:hover { background: var(--g50); }
.ma-courier-row.ma-avail:hover { background: #f0fdf4; }
.ma-courier-info { display: flex; flex-direction: column; gap: 2px; flex: 1; }
.ma-courier-name { font-weight: 600; font-size: var(--fs-sm); color: var(--g900); }
.ma-courier-dist { font-size: var(--fs-xs); color: var(--g500); }
.ma-status-badge { font-size: 11px; font-weight: 600; padding: 3px 8px; border-radius: var(--r-full); }
.ma-status-badge.avail { background: #dcfce7; color: #166534; }
.ma-status-badge.busy  { background: #fef3c7; color: #92400e; }

/* ══════════════════════════════════════════════════════════════
   MANUAL ASSIGN BUTTON + ADMIN NOTES
══════════════════════════════════════════════════════════════ */
.btn-manual-assign {
  background: linear-gradient(135deg, #2563eb 0%, #1e40af 100%);
  color: #fff;
  border: none;
  border-radius: var(--r-md);
  padding: 6px 14px;
  font-size: var(--fs-sm);
  font-weight: 600;
  cursor: pointer;
  transition: opacity .15s;
}
.btn-manual-assign:hover { opacity: .88; }

/* ── Order Dispatch Panel ───────────────────────────────────────────────── */
.order-dispatch-panel {
  margin-top: 10px;
  padding: 12px 14px;
  background: #f0f9ff;
  border: 1px solid #bae6fd;
  border-radius: var(--r-md);
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.odp-mode-row {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

.odp-mode-btn {
  padding: 6px 14px;
  font-size: var(--fs-sm);
  font-weight: var(--fw-semi);
  border: 1.5px solid var(--g300);
  border-radius: var(--r-sm);
  background: var(--g0);
  color: var(--g600);
  cursor: pointer;
  transition: all var(--t-fast) var(--ease);
}
.odp-mode-btn:hover { background: var(--g100); }
.odp-mode-btn.odp-mode-active {
  background: #0ea5e9;
  border-color: #0284c7;
  color: #fff;
  font-weight: var(--fw-bold);
}

.odp-specific-row {
  display: flex;
  gap: 8px;
  align-items: center;
}
.odp-courier-select {
  flex: 1;
  padding: 6px 10px;
  border: 1.5px solid var(--g300);
  border-radius: var(--r-sm);
  font-size: var(--fs-sm);
  font-family: var(--ff);
  background: var(--g0);
  color: var(--g800);
}

.odp-actions-row {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  align-items: center;
}

.btn-dispatch-send {
  padding: 7px 18px;
  font-size: var(--fs-sm);
  font-weight: var(--fw-bold);
  border: none;
  border-radius: var(--r-sm);
  background: linear-gradient(135deg, #0ea5e9, #0284c7);
  color: #fff;
  cursor: pointer;
  transition: all var(--t-fast) var(--ease);
  box-shadow: 0 2px 6px rgba(14,165,233,.35);
}
.btn-dispatch-send:hover { filter: brightness(1.1); transform: translateY(-1px); }
.btn-dispatch-send:disabled { opacity: .5; cursor: not-allowed; transform: none; }
.odp-btn-undo-reject {
  background: linear-gradient(135deg, #f59e0b, #d97706) !important;
  box-shadow: 0 2px 6px rgba(245,158,11,.35) !important;
}

.odp-btn-sm {
  padding: 5px 11px;
  font-size: var(--fs-xs);
}
/* ─────────────────────────────────────────────────────────────────────────── */

.order-admin-notes-section {
  margin-top: 10px;
  padding: 10px 12px;
  background: #fffbf0;
  border: 1px solid #fde68a;
  border-radius: var(--r-md);
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.admin-notes-label {
  font-size: var(--fs-xs);
  font-weight: 600;
  color: #92400e;
}
.admin-notes-textarea {
  width: 100%;
  min-height: 60px;
  border: 1px solid #fcd34d;
  border-radius: var(--r-sm);
  padding: 6px 8px;
  font-size: var(--fs-sm);
  font-family: inherit;
  resize: vertical;
  background: #fff;
  color: var(--g800);
  box-sizing: border-box;
}
.admin-notes-save {
  align-self: flex-end;
  background: #f59e0b;
  color: #fff;
  border: none;
  border-radius: var(--r-sm);
  padding: 4px 12px;
  font-size: var(--fs-xs);
  font-weight: 600;
  cursor: pointer;
}
.admin-notes-save:hover { background: #d97706; }

/* ══════════════════════════════════════════════════════════════
   ORDER DATE FILTER
══════════════════════════════════════════════════════════════ */
.filter-date {
  width: 140px;
  padding: 5px 8px;
  font-size: var(--fs-sm);
}

/* ══════════════════════════════════════════════════════════════
   SHOPS — مدمج داخل تبويب المطاعم
══════════════════════════════════════════════════════════════ */
.shops-inline-section {
  border-top: 2px solid var(--g200);
  margin-top: 12px;
  padding-top: 12px;
}

.shops-inline-head {
  font-size: var(--fs-xs);
  font-weight: 700;
  color: var(--g500);
  text-transform: uppercase;
  letter-spacing: .05em;
  padding: 0 12px 8px;
}

.shops-inline-form {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 0 12px;
}

.shops-inline-form input {
  padding: 7px 10px;
  border: 1px solid var(--g300);
  border-radius: var(--r-sm);
  font-size: var(--fs-sm);
  color: var(--g800);
  background: var(--g50);
}
.shops-inline-form input:focus {
  outline: none;
  border-color: var(--brand);
  background: var(--g0);
}

.btn-add-shop-inline {
  padding: 7px 14px;
  background: var(--brand);
  color: #fff;
  border: none;
  border-radius: var(--r-sm);
  font-size: var(--fs-sm);
  font-weight: 600;
  cursor: pointer;
}
.btn-add-shop-inline:hover { background: var(--brand-d); }

.shops-form-status {
  padding: 4px 12px;
  font-size: var(--fs-xs);
  min-height: 16px;
}

.shops-inline-header {
  padding: 8px 12px 4px;
  font-size: var(--fs-xs);
  font-weight: 700;
  color: var(--g600);
}

.shops-list-body { display: flex; flex-direction: column; max-height: 260px; overflow-y: auto; }

.shop-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 12px;
  border-bottom: 1px solid var(--g100);
  gap: 8px;
}
.shop-row:last-child { border-bottom: none; }
.shop-row:hover { background: var(--g50); }

.shop-row-info {
  display: flex;
  flex-direction: column;
  gap: 1px;
  flex: 1;
  min-width: 0;
}

.shop-row-name {
  font-size: var(--fs-sm);
  font-weight: 700;
  color: var(--g800);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.shop-row-id {
  font-size: 10px;
  color: var(--g400);
  font-family: monospace;
  direction: ltr;
  text-align: right;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.shop-row-duplicate { background: var(--amber-bg); }
.shop-row-duplicate:hover { background: var(--amber-bg); filter: brightness(.97); }
.shop-duplicate-badge {
  align-self: flex-start;
  font-size: 10px;
  font-weight: var(--fw-semi);
  color: var(--amber-d);
  background: var(--g0);
  border: 1px solid var(--amber-b, var(--amber));
  border-radius: var(--r-full);
  padding: 1px 6px;
  cursor: help;
}

.shop-row-actions {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
}

.shop-toggle {
  display: flex;
  align-items: center;
  gap: 4px;
  cursor: pointer;
  font-size: 11px;
  color: var(--g500);
}

.shop-toggle input[type="checkbox"] {
  width: 14px;
  height: 14px;
  accent-color: var(--green);
  cursor: pointer;
}
/* ================================================================
   SwiftDrop Admin — Product UI refinement v6
   Visual-only layer. Inspired by mature operations dashboards:
   restrained depth, clear hierarchy, dense but readable data.
   ================================================================ */

:root {
  --brand: #3b82f6;
  --brand-d: #1d4ed8;
  --brand-dd: #1e3a8a;
  --brand-light: #eff6ff;
  --brand-mid: #93c5fd;
  --canvas: #f5f7fb;
  --surface: rgba(255, 255, 255, .94);
  --surface-solid: #ffffff;
  --line: #e6e9f0;
  --line-strong: #d8dde8;
  --ink: #172033;
  --ink-soft: #5c667a;
  --sh-xs: 0 1px 2px rgba(18, 26, 43, .04);
  --sh-sm: 0 2px 8px rgba(18, 26, 43, .055);
  --sh: 0 8px 24px rgba(18, 26, 43, .07);
  --sh-md: 0 14px 36px rgba(18, 26, 43, .09);
  --r: 10px;
  --r-md: 12px;
  --r-lg: 16px;
  --r-xl: 20px;
}

html { background: var(--canvas); }
body {
  color: var(--ink);
  background:
    radial-gradient(circle at 88% -10%, rgba(59, 130, 246, .075), transparent 30rem),
    var(--canvas);
}
#dashboardView { background: transparent; }

/* App chrome: compact, stable and easier to scan. */
.topbar {
  background: rgba(10, 11, 13, .97);
  box-shadow: 0 1px 0 rgba(255,255,255,.06), 0 8px 24px rgba(0, 0, 0, .35);
  backdrop-filter: blur(18px) saturate(130%);
  -webkit-backdrop-filter: blur(18px) saturate(130%);
}
.topbar-row1 {
  min-height: 54px;
  padding: 8px clamp(14px, 2vw, 28px);
  gap: 10px;
}
.topbar-row2 {
  min-height: 46px;
  padding: 6px clamp(14px, 2vw, 28px);
  background: rgba(0, 0, 0, .22);
  border-top: 1px solid rgba(255,255,255,.04);
}
.topbar-brand-icon {
  width: 34px;
  height: 34px;
  border-radius: 11px;
  background: linear-gradient(145deg, #7dd3fc, #3b82f6);
  box-shadow: 0 6px 18px rgba(59,130,246,.35), inset 0 1px rgba(255,255,255,.25);
}
.topbar-brand-text { font-size: 17px; letter-spacing: -.35px; }
.global-search {
  min-height: 36px;
  padding-inline: 36px 14px;
  border-color: rgba(255,255,255,.13);
  background: rgba(255,255,255,.07);
}
.global-search:focus {
  background: rgba(255,255,255,.12);
  border-color: rgba(96,165,250,.65);
  box-shadow: 0 0 0 3px rgba(96,165,250,.14);
}
.tbadge, .btn-topbar {
  min-height: 30px;
  display: inline-flex;
  align-items: center;
  border-color: rgba(255,255,255,.13);
  background: rgba(255,255,255,.065);
}
.btn-topbar:hover { transform: translateY(-1px); }
.topbar-tabs { gap: 5px; }
.tab-btn {
  min-height: 32px;
  padding: 6px 12px;
  border: 1px solid transparent;
  border-radius: 9px;
  color: rgba(255,255,255,.62);
  font-weight: 650;
  transition: background .16s ease, color .16s ease, border-color .16s ease, transform .16s ease;
}
.tab-btn:hover {
  color: #fff;
  background: rgba(255,255,255,.08);
  border-color: rgba(255,255,255,.08);
  transform: none;
}
.tab-btn.active {
  color: #fff;
  background: linear-gradient(135deg, #3b82f6, #1d4ed8);
  border-color: rgba(255,255,255,.15);
  box-shadow: 0 5px 14px rgba(0,0,0,.3), inset 0 1px rgba(255,255,255,.16);
}

/* KPI strip: white information cards instead of a second heavy banner. */
.stats-strip {
  gap: 8px;
  padding: 10px clamp(14px, 2vw, 28px);
  background: rgba(255,255,255,.78);
  border-bottom: 1px solid var(--line);
  box-shadow: none;
  scrollbar-color: var(--g300) transparent;
}
.sc, .sc.sc-blue, .sc.sc-amber, .sc.sc-green, .sc.sc-red, .sc.sc-purple {
  min-width: 118px;
  min-height: 68px;
  padding: 9px 11px 8px;
  color: var(--ink-soft);
  background: var(--surface-solid);
  border: 1px solid var(--line);
  border-radius: 12px;
  box-shadow: var(--sh-xs);
  position: relative;
}
.sc:hover {
  background: #fff;
  border-color: var(--line-strong);
  box-shadow: var(--sh-sm);
  transform: translateY(-1px);
}
.sc strong { color: var(--ink); font-size: 24px; letter-spacing: -.3px; }
.sc span { color: var(--ink-soft); font-size: 13px; }

/* Load gauge: a horizontal bar reflecting how "loaded" the metric is,
   stacked as its own row below the label (never over the text). */
.sc-gauge {
  display: block;
  width: 100%;
  height: 3px;
  margin-top: 6px;
  border-radius: 2px;
  background: var(--g150, rgba(0,0,0,.06));
  overflow: hidden;
  flex-shrink: 0;
}
.sc-gauge-fill {
  display: block;
  height: 100%;
  width: 0%;
  border-radius: 2px;
  background: var(--blue);
  transition: width 420ms var(--ease), background-color 420ms var(--ease);
}
.sc.sc-blue .sc-gauge-fill   { background: var(--blue); }
.sc.sc-amber .sc-gauge-fill  { background: var(--amber); }
.sc.sc-green .sc-gauge-fill  { background: var(--green); }
.sc.sc-red .sc-gauge-fill    { background: var(--red); }
.sc.sc-purple .sc-gauge-fill { background: var(--purple); }
.sc-gauge-fill.load-mid  { background: var(--amber) !important; }
.sc-gauge-fill.load-high { background: var(--red) !important; }
/* Cards with no color variant (مطاعم / سعاة / متوسط ETA) keep a neutral fallback */
.sc:not(.sc-blue):not(.sc-amber):not(.sc-green):not(.sc-red):not(.sc-purple) .sc-gauge-fill { background: var(--g400); }

/* Main content hierarchy. */
.tab-panel { padding: clamp(14px, 2vw, 24px); background: transparent; }
.ops-flow-illustration {
  margin: 14px clamp(14px, 2vw, 28px) 2px;
  padding: 13px 18px;
  border-color: var(--line);
  background: var(--surface);
  box-shadow: var(--sh-xs);
  backdrop-filter: blur(10px);
}
.flow-art { border-radius: 12px; box-shadow: inset 0 0 0 1px rgba(255,255,255,.75); }
.flow-line { opacity: .55; }

/* A shared surface language across operational modules. */
.stats-panel,
.orders-source-section,
.orders-table-panel,
.dc-col,
.map-tab-inner,
.billing-panel,
.robot-viz-panel,
.shops-list-panel {
  border-color: var(--line);
  border-radius: var(--r-lg);
  background: var(--surface-solid);
  box-shadow: var(--sh-sm);
}
.stats-panel:hover,
.orders-source-section:hover,
.dc-col:hover { box-shadow: var(--sh); border-color: var(--line-strong); }

.stats-db-header,
.stats-panel-head,
.orders-source-head,
.dc-col-head {
  border-color: var(--line);
  background: linear-gradient(180deg, #fff, #fbfcfe);
}
.stats-db-title,
.stats-panel-head,
.dc-col-title { color: var(--ink); letter-spacing: -.1px; }

/* Controls follow one consistent interaction model. */
button, input, select, textarea { transition: border-color .16s ease, box-shadow .16s ease, background .16s ease, transform .16s ease; }
input:not([type="checkbox"]):not([type="radio"]), select, textarea {
  border-color: var(--line-strong);
  border-radius: 9px;
}
input:not([type="checkbox"]):not([type="radio"]):focus, select:focus, textarea:focus {
  border-color: var(--brand);
  outline: none;
  box-shadow: 0 0 0 3px rgba(59,130,246,.12);
}
.btn-sm {
  min-height: 34px;
  border-color: var(--line-strong);
  border-radius: 9px;
  background: #fff;
  color: var(--ink-soft);
  font-weight: 650;
}
.btn-sm:hover { color: var(--ink); border-color: #c9cfda; box-shadow: var(--sh-xs); }
.btn-sm-accent {
  color: var(--brand-d);
  border-color: rgba(59,130,246,.28);
  background: var(--brand-light);
}

/* Data tables: clearer reading and stable headers for long lists. */
.table-wrap {
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fff;
}
table { border-collapse: separate; border-spacing: 0; }

/* Keeps long, growing tables (e.g. the couriers list) from pushing the rest
   of the page down as more rows are added — scrolls internally instead. */
.table-wrap-bounded { max-height: 420px; overflow-y: auto; }
.table-wrap-bounded thead th { position: sticky; top: 0; z-index: 1; }
thead { background: #f8f9fc; }
thead th {
  position: sticky;
  top: 0;
  z-index: 2;
  color: var(--ink-soft);
  background: #f8f9fc;
  border-bottom: 1px solid var(--line-strong);
  font-size: 10px;
  letter-spacing: .15px;
}
tbody tr { transition: background .12s ease; }
tbody tr:hover { background: #f8f9ff; }
tbody td { border-bottom-color: #eef0f4; }

/* Distribution center: emphasize live state without visual noise. */
.dc-grid { gap: 16px; }
.dc-col { overflow: hidden; }
.dc-order-card, .dc-courier-card {
  border-color: var(--line);
  border-radius: 12px;
  box-shadow: none;
}
.dc-order-card:hover, .dc-courier-card:hover {
  border-color: rgba(59,130,246,.32);
  background: #fff;
  box-shadow: 0 8px 20px rgba(18,26,43,.065);
}
.dc-order-customer { background: #f7f8fc; border: 1px solid #eceef4; }
.dc-progress-step b { box-shadow: 0 0 0 2px #fff; }
.dc-progress-step.is-current b { box-shadow: 0 0 0 3px rgba(59,130,246,.13); }
.dc-ready-badge { font-weight: 700; }

/* Maps stay visually contained and readable over every tile provider. */
.map-tab-toolbar {
  min-height: 56px;
  border-bottom-color: var(--line);
  background: rgba(255,255,255,.94);
  backdrop-filter: blur(12px);
}
.map-stage { border-radius: 14px; box-shadow: inset 0 0 0 1px rgba(23,32,51,.08); }
.map-provider-select { min-height: 34px; border-color: var(--line-strong); background: #fff; }
.leaflet-control-zoom { border: 0 !important; box-shadow: 0 6px 18px rgba(18,26,43,.14) !important; }
.leaflet-control-zoom a { border-color: var(--line) !important; color: var(--ink) !important; }

/* Accessibility and responsive density. */
:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; }
@media (max-width: 900px) {
  .topbar-row2 { flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; }
  .topbar-row2::-webkit-scrollbar { display: none; }
  .topbar-tabs { flex-wrap: nowrap; }
  .tab-btn { white-space: nowrap; }
  .stats-strip { padding-block: 8px; }
  .sc, .sc.sc-blue, .sc.sc-amber, .sc.sc-green, .sc.sc-red, .sc.sc-purple { min-width: 108px; }
}
@media (max-width: 640px) {
  .topbar-row1 { min-height: 50px; }
  .topbar-brand-text { display: none; }
  .topbar-actions { margin-inline-start: auto; }
  .btn-topbar { padding-inline: 9px; }
  .ops-flow-illustration { margin-inline: 10px; }
  .tab-panel { padding: 10px; }
  .dc-grid { gap: 10px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
}

/* v7 — dispatch command-center refinement */
#controlsTab { padding-top: 14px; }
#controlsTab .robot-viz-panel { margin: 0 0 14px; }
#controlsTab .robot-viz-header {
  min-height: 44px;
  padding: 8px 14px;
  background: linear-gradient(110deg, #20243f, #292d55);
}
#controlsTab .robot-viz-header:hover { background: linear-gradient(110deg, #272c4b, #323766); }
#controlsTab .robot-viz-body { height: clamp(210px, 27vh, 260px); }
#controlsTab .robot-viz-sidebar { width: min(230px, 24vw); }
#controlsTab .dc-grid { padding: 0; grid-template-columns: minmax(310px, 1fr) minmax(250px, 300px) minmax(310px, 1fr); }
#controlsTab .dc-col {
  min-height: 390px;
  max-height: calc(100vh - 180px);
  border-radius: 14px;
}
#controlsTab .dc-col-head {
  position: sticky;
  top: 0;
  z-index: 5;
  min-height: 46px;
  padding: 10px 14px;
  box-shadow: 0 1px 0 var(--line);
}

.dc-courier-card { padding: 11px; gap: 7px; }
.dc-courier-top { gap: 8px; }
.dc-courier-name { color: var(--ink); font-size: 13px; font-weight: 750; }
.dc-courier-mission {
  padding: 9px 10px 8px;
  border: 1px solid #e4e6fb;
  border-radius: 10px;
  background: linear-gradient(145deg, #fbfbff, #f4f4ff);
}
.dc-mission-head { display: flex; justify-content: space-between; align-items: center; gap: 8px; margin-bottom: 8px; }
.dc-mission-head span { color: var(--brand-d); font-size: 10px; font-weight: 750; }
.dc-mission-head strong { color: var(--ink-soft); font-size: 9px; white-space: nowrap; }
.dc-mission-track { display: flex; align-items: flex-start; width: 100%; direction: rtl; }
.dc-mission-step { display: grid; justify-items: center; gap: 3px; min-width: 38px; color: var(--g400); }
.dc-mission-step i {
  display: grid;
  place-items: center;
  width: 20px;
  height: 20px;
  border: 1px solid var(--line-strong);
  border-radius: 50%;
  background: #fff;
  font-size: 9px;
  font-style: normal;
  font-weight: 800;
}
.dc-mission-step small { font-size: 8px; }
.dc-mission-step.is-done { color: var(--green-d); }
.dc-mission-step.is-done i { color: #fff; border-color: var(--green); background: var(--green); }
.dc-mission-step.is-current { color: var(--brand-d); font-weight: 750; }
.dc-mission-step.is-current i { color: #fff; border-color: var(--brand); background: var(--brand); box-shadow: 0 0 0 3px rgba(59,130,246,.12); }
.dc-mission-line { flex: 1; min-width: 8px; height: 2px; margin-top: 9px; background: var(--line-strong); }
.dc-mission-step.is-done + .dc-mission-line { background: var(--green); }
.dc-mission-order { margin-top: 6px; padding-top: 6px; border-top: 1px solid #e7e8f7; color: var(--g500); font-size: 9px; }
.dc-mission-empty {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 7px 9px;
  border: 1px dashed var(--line-strong);
  border-radius: 9px;
  color: var(--g400);
  background: rgba(248,250,252,.72);
  font-size: 10px;
}
.dc-mission-empty span { color: var(--g300); font-size: 14px; }

@media (max-width: 1100px) {
  #controlsTab .dc-grid { grid-template-columns: 1fr 250px 1fr; }
}
@media (max-width: 900px) {
  #controlsTab .robot-viz-body { height: 220px; }
  #controlsTab .robot-viz-sidebar { width: 190px; }
  #controlsTab .dc-grid { grid-template-columns: 1fr; }
  #controlsTab .dc-col { min-height: 320px; max-height: 560px; }
}
@media (max-width: 600px) {
  #controlsTab .robot-viz-body { height: auto; flex-direction: column; }
  #controlsTab .robot-viz-map { width: 100%; height: 200px; flex: none; }
  #controlsTab .robot-viz-sidebar { width: 100%; max-height: 150px; border: 0; border-top: 1px solid var(--line); }
  .dc-mission-head { align-items: flex-start; flex-direction: column; gap: 2px; }
}

/* v8 — user-controlled appearance */
html[data-density="compact"] { --fs-xs:10px; --fs-sm:11px; --fs-base:12px; --fs-md:13px; --sp2:6px; --sp3:9px; --sp4:12px; }
html[data-density="compact"] .topbar-row1 { min-height:46px; padding-block:5px; }
html[data-density="compact"] .topbar-row2 { min-height:38px; padding-block:3px; }
html[data-density="compact"] .stats-strip { padding-block:6px; }
html[data-density="compact"] .sc { min-height:50px !important; padding-block:5px !important; }
html[data-density="compact"] .ops-flow-illustration { padding-block:8px; }
html[data-density="compact"] .flow-art { width:36px; height:36px; flex-basis:36px; }
html[data-density="compact"] #controlsTab .robot-viz-body { height:200px; }
html[data-density="compact"] #controlsTab .dc-col { min-height:330px; }
html[data-density="compact"] .dc-order-card,
html[data-density="compact"] .dc-courier-card { padding:7px 9px; }
html[data-density="compact"] td,
html[data-density="compact"] th { padding-block:7px; }

html[data-theme="dark"] {
  color-scheme:dark;
  --canvas:#0d1220; --surface:rgba(20,27,43,.94); --surface-solid:#151c2c;
  --line:#273149; --line-strong:#35405a; --ink:#edf1f8; --ink-soft:#a7b0c2;
  --g0:#151c2c; --g25:#121929; --g50:#182133; --g100:#202a3d; --g150:#263147;
  --g200:#303c54; --g300:#44516a; --g400:#7e8ba3; --g500:#a3adc0;
  --g600:#bac2d0; --g700:#d0d6e1; --g800:#e2e7ef; --g850:#e9edf4; --g900:#f2f5f9;
  --brand-light:#1a2b4a; --green-bg:#102d29; --amber-bg:#352710; --red-bg:#391c25;
  --blue-bg:#172b48; --purple-bg:#1c3a5e; --cyan-bg:#11313a;
  --sh-xs:0 1px 2px rgba(0,0,0,.18); --sh-sm:0 3px 10px rgba(0,0,0,.22);
  --sh:0 10px 28px rgba(0,0,0,.28); --sh-md:0 16px 42px rgba(0,0,0,.34);
}
html[data-theme="dark"] body { background:radial-gradient(circle at 88% -10%,rgba(59,130,246,.12),transparent 32rem),var(--canvas); }
html[data-theme="dark"] #dashboardView { background:transparent; }
html[data-theme="dark"] .topbar { background:rgba(8,9,10,.97); }
html[data-theme="dark"] .stats-strip { background:rgba(16,22,35,.88); }
html[data-theme="dark"] .sc,
html[data-theme="dark"] .stats-panel,
html[data-theme="dark"] .orders-source-section,
html[data-theme="dark"] .orders-table-panel,
html[data-theme="dark"] .dc-col,
html[data-theme="dark"] .map-tab-inner,
html[data-theme="dark"] .billing-panel,
html[data-theme="dark"] .robot-viz-panel,
html[data-theme="dark"] .shops-list-panel,
html[data-theme="dark"] .kpi-card { background:var(--surface-solid) !important; border-color:var(--line) !important; }
html[data-theme="dark"] .kpi-card.kpi-blue   .kpi-icon { background: var(--blue-bg); }
html[data-theme="dark"] .kpi-card.kpi-green  .kpi-icon { background: var(--green-bg); }
html[data-theme="dark"] .kpi-card.kpi-red    .kpi-icon { background: var(--red-bg); }
html[data-theme="dark"] .kpi-card.kpi-amber  .kpi-icon { background: var(--amber-bg); }
html[data-theme="dark"] .kpi-card.kpi-purple .kpi-icon { background: var(--purple-bg); }
html[data-theme="dark"] .mini-row { border-color: var(--line); }
html[data-theme="dark"] .ops-flow-illustration { background:var(--surface); border-color:var(--line); }
html[data-theme="dark"] .stats-db-header,
html[data-theme="dark"] .stats-panel-head,
html[data-theme="dark"] .orders-source-head,
html[data-theme="dark"] .dc-col-head,
html[data-theme="dark"] .map-tab-toolbar { background:linear-gradient(180deg,#182133,#151c2c); border-color:var(--line); }
html[data-theme="dark"] input:not([type="checkbox"]):not([type="radio"]),
html[data-theme="dark"] select,
html[data-theme="dark"] textarea,
html[data-theme="dark"] .btn-sm { color:var(--ink); background:#111827; border-color:var(--line-strong); }
html[data-theme="dark"] .table-wrap,
html[data-theme="dark"] table { background:var(--surface-solid); border-color:var(--line); }
html[data-theme="dark"] thead,
html[data-theme="dark"] thead th { color:var(--ink-soft); background:#1b2436; border-color:var(--line-strong); }
html[data-theme="dark"] tbody tr:hover { background:#1c2639; }
html[data-theme="dark"] tbody td { border-bottom-color:var(--line); }
html[data-theme="dark"] .dc-order-card,
html[data-theme="dark"] .dc-courier-card { background:#182133; border-color:var(--line); }
html[data-theme="dark"] .dc-order-card:hover,
html[data-theme="dark"] .dc-courier-card:hover { background:#1c2639; border-color:#5557a5; }
html[data-theme="dark"] .dc-order-customer,
html[data-theme="dark"] .dc-courier-mission { background:#1b2340; border-color:#30365d; }
html[data-theme="dark"] .dc-mission-step i { background:#151c2c; border-color:var(--line-strong); }
html[data-theme="dark"] .dc-mission-order { border-color:#30365d; }
html[data-theme="dark"] .dc-mission-empty { background:#141c2b; border-color:var(--line-strong); }
html[data-theme="dark"] .dc-courier-card.dc-c-not-ready { background:#141b2a; }
html[data-theme="dark"] .dc-courier-card.dc-c-ready { background:#102822; }
html[data-theme="dark"] .search-dropdown,
html[data-theme="dark"] .tools-dropdown { color:var(--ink); background:#182133; border-color:var(--line); }
html[data-theme="dark"] .search-result-item { border-color:var(--line); }
html[data-theme="dark"] .search-result-item:hover,
html[data-theme="dark"] .tools-dropdown button:hover { background:#222c41; }
html[data-theme="dark"] .leaflet-control-zoom a { color:var(--ink) !important; background:#182133 !important; border-color:var(--line) !important; }

/* v9 — clean map controls; no decorative robot sticker */
.robot-viz-title-row::before {
  content:"";
  width:10px;
  height:10px;
  flex:0 0 10px;
  border:2px solid #60a5fa;
  border-radius:3px;
  background:rgba(139,140,248,.18);
  box-shadow:0 0 0 3px rgba(139,140,248,.08);
}
.robot-viz-header-actions { display:flex; align-items:center; gap:10px; }
.robot-viz-map-provider {
  min-height:30px;
  padding:4px 10px;
  border:1px solid rgba(255,255,255,.16);
  border-radius:8px;
  color:#dbeafe;
  background:rgba(255,255,255,.08);
  font-size:10px;
  font-weight:650;
  cursor:pointer;
}
.robot-viz-map-provider:hover,
.robot-viz-map-provider:focus { border-color:rgba(96,165,250,.6); background:#30355f; }
.robot-viz-map-provider option { color:var(--ink); background:var(--surface-solid); }
.robot-status-dot {
  display:inline-block;
  width:8px;
  height:8px;
  margin-inline-end:5px;
  border-radius:50%;
  background:var(--g400);
  vertical-align:middle;
}
.robot-status-dot.is-live { background:#86efac; box-shadow:0 0 0 4px rgba(134,239,172,.17); }
@media (max-width:600px) {
  .robot-viz-title-text { max-width:155px; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
  .robot-viz-map-provider { max-width:120px; }
}

/* v10 — contextual command-center layout */
html[data-active-tab="controlsTab"] .ops-flow-illustration { display:none; }
html[data-active-tab="controlsTab"] .stats-strip {
  gap:6px;
  padding-block:7px;
  background:#fff;
}
html[data-active-tab="controlsTab"] .sc {
  min-height:48px !important;
  min-width:104px;
  padding:5px 9px !important;
  display:grid;
  grid-template-columns:auto auto;
  grid-template-rows:auto auto;
  justify-content:center;
  column-gap:7px;
}
html[data-active-tab="controlsTab"] .sc strong { font-size:16px; align-self:end; }
html[data-active-tab="controlsTab"] .sc span { grid-column:1 / -1; font-size:9px; }
html[data-active-tab="controlsTab"] #controlsTab { padding:12px clamp(12px,1.6vw,22px) 20px; }

#controlsTab .robot-viz-panel { border-color:var(--line-strong); box-shadow:0 5px 18px rgba(18,26,43,.06); }
#controlsTab .robot-viz-header,
#controlsTab .robot-viz-header:hover {
  color:var(--ink);
  background:linear-gradient(180deg,#fff,#f8f9fc);
  border-bottom:1px solid var(--line);
}
#controlsTab .robot-viz-title-text { color:var(--ink); font-weight:750; }
#controlsTab .robot-viz-title-row::before { border-color:var(--brand); background:var(--brand-light); box-shadow:0 0 0 3px rgba(59,130,246,.08); }
#controlsTab .robot-viz-map-provider {
  color:var(--ink-soft);
  background:#fff;
  border-color:var(--line-strong);
}
#controlsTab .robot-viz-map-provider:hover,
#controlsTab .robot-viz-map-provider:focus { color:var(--ink); background:var(--brand-light); border-color:var(--brand-mid); }
#controlsTab .robot-viz-chevron { color:var(--g500); }

#controlsTab .dc-col-orders { border-top:2px solid var(--blue); }
#controlsTab .dc-col-engine { border-top:2px solid var(--brand); }
#controlsTab .dc-col-couriers { border-top:2px solid var(--green); }
#controlsTab .dc-col-title { font-size:13px; font-weight:760; }
#controlsTab .dc-col-badge { min-width:24px; height:24px; display:grid; place-items:center; border-radius:8px; }
#controlsTab .dc-orders-list > .dc-empty,
#controlsTab .dc-couriers-list > .dc-empty { min-height:110px; display:grid; place-items:center; align-content:center; gap:7px; }
#controlsTab .dc-orders-list > .dc-empty::before,
#controlsTab .dc-couriers-list > .dc-empty::before { content:""; width:28px; height:3px; border-radius:5px; background:var(--g200); box-shadow:0 7px 0 var(--g150),0 -7px 0 var(--g100); }
#controlsTab .dc-order-card,
#controlsTab .dc-courier-card { position:relative; }
#controlsTab .dc-order-card::after,
#controlsTab .dc-courier-card::after {
  content:"";
  position:absolute;
  inset:0 auto 0 0;
  width:2px;
  opacity:0;
  background:var(--brand);
  transition:opacity .16s ease;
}
#controlsTab .dc-order-card:hover::after,
#controlsTab .dc-courier-card:hover::after { opacity:1; }

html[data-theme="dark"][data-active-tab="controlsTab"] .stats-strip { background:#111827; }
html[data-theme="dark"] #controlsTab .robot-viz-header,
html[data-theme="dark"] #controlsTab .robot-viz-header:hover { color:var(--ink); background:linear-gradient(180deg,#1b2436,#151c2c); border-color:var(--line); }
html[data-theme="dark"] #controlsTab .robot-viz-map-provider { color:var(--ink-soft); background:#111827; border-color:var(--line-strong); }

@media (max-width:700px) {
  html[data-active-tab="controlsTab"] .stats-strip { display:none; }
  html[data-active-tab="controlsTab"] #controlsTab { padding-top:9px; }
}

/* v11 — optional focus mode for the four order interfaces */
.orders-source-expand-btn {
  align-self:center;
  min-width:58px;
  min-height:30px;
  padding:4px 9px;
  border:1px solid var(--line-strong);
  border-radius:8px;
  color:var(--ink-soft);
  background:var(--surface-solid);
  font-size:10px;
  font-weight:700;
  white-space:nowrap;
}
.orders-source-expand-btn::before { content:"↗"; margin-inline-end:5px; }
.orders-source-expand-btn:hover { color:var(--brand-d); border-color:var(--brand-mid); background:var(--brand-light); }
.orders-source-board.has-expanded-source { display:block; overflow:visible; }
.orders-source-board.has-expanded-source > .orders-source-section:not(.is-expanded-source) { display:none; }
.orders-source-section.is-expanded-source {
  width:100%;
  min-height:calc(100vh - 220px);
  border-color:rgba(59,130,246,.3);
  box-shadow:var(--sh);
  animation:sourceExpandIn .18s ease-out;
}
.orders-source-section.is-expanded-source .orders-source-expand-btn::before { content:"↙"; }
.orders-source-section.is-expanded-source .orders-source-head { position:sticky; top:var(--topbar-h); z-index:20; }
.orders-source-section.is-expanded-source.orders-source-admin .form-grid { grid-template-columns:repeat(4,minmax(180px,1fr)); }
.orders-source-section.is-expanded-source.orders-source-admin .new-order-map { min-height:360px; }
.orders-source-section.is-expanded-source .orders-cards-list { display:grid; grid-template-columns:repeat(auto-fit,minmax(340px,1fr)); align-items:start; }
@keyframes sourceExpandIn { from { opacity:.65; transform:scale(.992); } to { opacity:1; transform:scale(1); } }
html[data-theme="dark"] .orders-source-expand-btn { color:var(--ink-soft); background:#111827; border-color:var(--line-strong); }
@media (max-width:900px) {
  .orders-source-section.is-expanded-source.orders-source-admin .form-grid { grid-template-columns:repeat(2,minmax(160px,1fr)); }
}
@media (max-width:600px) {
  .orders-source-expand-btn { min-width:34px; width:34px; padding:4px; font-size:0; }
  .orders-source-expand-btn::before { margin:0; font-size:13px; }
  .orders-source-section.is-expanded-source { min-height:70vh; }
  .orders-source-section.is-expanded-source.orders-source-admin .form-grid,
  .orders-source-section.is-expanded-source .orders-cards-list { grid-template-columns:1fr; }
}
