:root {
  --bg:        #0d1117;
  --surface:   #161b22;
  --surface2:  #21262d;
  --surface3:  #2d333b;
  --border:    #30363d;
  --border2:   #3d444d;

  --blue:      #58a6ff;
  --blue-dim:  rgba(88,166,255,0.1);
  --blue-glow: rgba(88,166,255,0.2);

  --green:     #3fb950;
  --green-dim: rgba(63,185,80,0.1);

  --red:       #f85149;
  --red-dim:   rgba(248,81,73,0.1);

  --amber:     #d29922;
  --amber-dim: rgba(210,153,34,0.1);

  --purple:    #60a5fa;
  --purple-dim:rgba(96,165,250,0.1);

  --text:      #e6edf3;
  --text2:     #c9d1d9;
  --text3:     #ffffff;

  --sidebar:   220px;
  --sidebar-sm:68px;
  --restaurant-panel-top: 112px;
  --radius:    14px;
  --radius-sm: 9px;
  --radius-xs: 6px;
  /* Aliases used by client detail modal */
  --bg1:       #0d1117;
  --bg2:       #161b22;
  --bg3:       #21262d;
  --accent:    #58a6ff;
  --hover:     rgba(88,166,255,0.08);
  --text1:     #e6edf3;
}

*,*::before,*::after { margin:0; padding:0; box-sizing:border-box; }

html { font-size:15px; }

body {
  font-family:'DM Sans',sans-serif;
  background:var(--bg);
  color:var(--text);
  min-height:100vh;
  overflow-x:hidden;
}

body::before {
  content:'';
  position:fixed;
  inset:0;
  background:
    radial-gradient(ellipse 70% 50% at 0% 0%,    rgba(59,130,246,0.07) 0%,transparent 60%),
    radial-gradient(ellipse 50% 40% at 100% 100%, rgba(96,165,250,0.05) 0%,transparent 60%);
  pointer-events:none;
  z-index:0;
}

/* ── SCROLLBAR ── */
::-webkit-scrollbar { width:5px; height:5px; }
::-webkit-scrollbar-track { background:transparent; }
::-webkit-scrollbar-thumb { background:var(--border2); border-radius:10px; }
::-webkit-scrollbar-thumb:hover { background:#334155; }

/* ── SIDEBAR ── */
.sidebar {
  position:fixed;
  inset:0 auto 0 0;
  width:var(--sidebar);
  background:var(--surface);
  border-right:1px solid var(--border);
  display:flex;
  flex-direction:column;
  z-index:200;
  transition:width .22s cubic-bezier(.4,0,.2,1);
}

.logo {
  padding:22px 18px;
  border-bottom:1px solid var(--border);
  display:flex;
  align-items:center;
  gap:11px;
  min-height:70px;
}

.logo-mark {
  width:36px; height:36px;
  background:linear-gradient(135deg,#3b82f6,#6366f1);
  border-radius:10px;
  display:flex; align-items:center; justify-content:center;
  font-size:17px;
  flex-shrink:0;
  box-shadow:0 0 24px rgba(99,102,241,.35);
}

.logo-text {
  font-weight:800;
  font-size:19px;
  letter-spacing:-.4px;
  white-space:nowrap;
  overflow:hidden;
}

.logo-text em { font-style:normal; color:var(--blue); }

.sidebar-toggle {
  margin-left:auto;
  flex-shrink:0;
  width:28px; height:28px;
  border:1px solid var(--border2);
  border-radius:var(--radius-xs);
  background:transparent;
  color:var(--text3);
  cursor:pointer;
  display:flex; align-items:center; justify-content:center;
  font-size:14px;
  transition:all .15s;
}
.sidebar-toggle:hover { background:var(--surface3); color:var(--text); border-color:#334155; }

.nav {
  flex:1;
  padding:14px 10px;
  display:flex;
  flex-direction:column;
  gap:2px;
  overflow-y:auto;
  overflow-x:hidden;
}

.nav-section {
  font-family:'JetBrains Mono',monospace;
  font-size:10px;
  color:var(--text3);
  letter-spacing:1.8px;
  text-transform:uppercase;
  padding:14px 10px 6px;
  white-space:nowrap;
  overflow:hidden;
}

.nav-btn {
  display:flex;
  align-items:center;
  gap:11px;
  width:100%;
  padding:10px 12px;
  background:transparent;
  border:1px solid transparent;
  border-radius:var(--radius-sm);
  color:var(--text2);
  cursor:pointer;
  font-family:'DM Sans',sans-serif;
  font-size:14px;
  font-weight:500;
  transition:all .16s;
  text-align:left;
  white-space:nowrap;
  overflow:hidden;
}

.nav-btn:hover { background:var(--surface2); color:var(--text); }

.nav-btn.active {
  background:var(--blue-dim);
  color:#93c5fd;
  border-color:rgba(59,130,246,.2);
}

.nav-icon {
  width:18px; height:18px;
  flex-shrink:0;
  opacity:.65;
}

.nav-btn.active .nav-icon { opacity:1; }

.nav-label { white-space:nowrap; overflow:hidden; }

.nav-badge {
  margin-left:auto;
  background:var(--blue-dim);
  color:var(--blue);
  border:1px solid rgba(59,130,246,.2);
  border-radius:20px;
  font-family:'JetBrains Mono',monospace;
  font-size:10px;
  padding:1px 7px;
  flex-shrink:0;
}

.sidebar-footer {
  padding:14px 10px;
  border-top:1px solid var(--border);
  display:flex;
  flex-direction:column;
  gap:8px;
}

.system-status {
  display:flex;
  align-items:center;
  gap:9px;
  padding:9px 12px;
  background:var(--green-dim);
  border:1px solid rgba(34,197,94,.18);
  border-radius:var(--radius-sm);
  font-size:12px;
  font-weight:500;
  color:var(--green);
  white-space:nowrap;
  overflow:hidden;
}

.pulse-dot {
  width:7px; height:7px;
  background:var(--green);
  border-radius:50%;
  flex-shrink:0;
  box-shadow:0 0 8px var(--green);
  animation:pulseAnim 2s infinite;
}

@keyframes pulseAnim { 0%,100%{opacity:1;transform:scale(1)} 50%{opacity:.5;transform:scale(.85)} }

.logout-btn {
  display:flex;
  align-items:center;
  gap:9px;
  width:100%;
  padding:9px 12px;
  background:transparent;
  border:1px solid var(--border);
  border-radius:var(--radius-sm);
  color:var(--text3);
  cursor:pointer;
  font-family:'DM Sans',sans-serif;
  font-size:13px;
  font-weight:500;
  transition:all .15s;
  white-space:nowrap;
  overflow:hidden;
}

.logout-btn:hover { border-color:var(--red); color:var(--red); background:var(--red-dim); }

.profile-btn {
  display:flex;
  align-items:center;
  gap:9px;
  width:100%;
  padding:9px 12px;
  background:transparent;
  border:1px solid var(--border);
  border-radius:var(--radius-sm);
  color:var(--text2);
  cursor:pointer;
  font-family:'DM Sans',sans-serif;
  font-size:13px;
  font-weight:500;
  transition:all .15s;
  white-space:nowrap;
  overflow:hidden;
}

.profile-btn:hover { border-color:var(--blue); color:#93c5fd; background:var(--blue-dim); }

/* ── COLLAPSED ── */
body.collapsed .sidebar { width:var(--sidebar-sm); }
body.collapsed .main    { margin-left:var(--sidebar-sm); }
body.collapsed .logo    { justify-content:center; padding:18px 0; }
body.collapsed .logo-text,
body.collapsed .nav-section,
body.collapsed .nav-label,
body.collapsed .nav-badge,
body.collapsed .system-status span,
body.collapsed .logout-btn span,
body.collapsed .profile-btn span { display:none; }
body.collapsed .sidebar-toggle { margin-left:0; }
body.collapsed .nav-btn  { justify-content:center; padding:10px 0; gap:0; }
body.collapsed .nav-section { padding:10px 0; }
body.collapsed .system-status { justify-content:center; padding:9px 0; }
body.collapsed .logout-btn { justify-content:center; padding:9px 0; gap:0; }
body.collapsed .profile-btn { justify-content:center; padding:9px 0; gap:0; }
body.collapsed .logout-btn span { display:none; }

/* ── RTL LAYOUT ── */
html[dir="rtl"] .sidebar {
  inset:0 0 0 auto;
  border-right:none;
  border-left:1px solid var(--border);
}

html[dir="rtl"] .main {
  margin-left:0;
  margin-right:var(--sidebar);
}

html[dir="rtl"] body.collapsed .main {
  margin-left:0;
  margin-right:var(--sidebar-sm);
}

html[dir="rtl"] .sidebar-toggle {
  margin-left:0;
  margin-right:auto;
}

html[dir="rtl"] body.collapsed .sidebar-toggle {
  margin-right:0;
}

html[dir="rtl"] .nav-btn,
html[dir="rtl"] .r-item,
html[dir="rtl"] .tbl th,
html[dir="rtl"] .tbl td {
  text-align:right;
}

html[dir="rtl"] .nav-badge,
html[dir="rtl"] .card-actions {
  margin-left:0;
  margin-right:auto;
}

html[dir="rtl"] #toast {
  right:auto;
  left:22px;
}

html[dir="rtl"] #toast.ok {
  border-left:none;
  border-right:3px solid var(--green);
}

html[dir="rtl"] #toast.err {
  border-left:none;
  border-right:3px solid var(--red);
}

/* lang-switch is now inside topbar-right, no fixed positioning needed */

html[dir="rtl"] .stat-emoji {
  right:auto;
  left:18px;
}

/* ── MAIN ── */
.main {
  margin-left:var(--sidebar);
  padding:32px 36px;
  min-height:100vh;
  position:relative;
  z-index:1;
  transition:margin-left .22s cubic-bezier(.4,0,.2,1),margin-right .22s cubic-bezier(.4,0,.2,1);
  max-width:1400px;
}

/* ── PAGES ── */
.page { display:none; }
.page.active { display:block; animation:fadeUp .25s ease; }

body.restoring-route .page.active { animation: none; }
body.restoring-route #agentsDetailBackdrop.show { transition: none; }

@keyframes fadeUp {
  from { opacity:0; transform:translateY(10px); }
  to   { opacity:1; transform:translateY(0); }
}

/* ── PAGE HEADER ── */
.page-head { margin-bottom:28px; }

.page-title {
  font-size:24px;
  font-weight:800;
  letter-spacing:-.4px;
}

.page-sub {
  color:var(--text2);
  font-size:13.5px;
  margin-top:4px;
}

/* ── STATS GRID ── */
.stats-grid {
  display:grid;
  grid-template-columns:repeat(auto-fit,minmax(190px,1fr));
  gap:14px;
  margin-bottom:24px;
}

.stat-card {
  background:var(--surface);
  border:1px solid var(--border);
  border-radius:var(--radius);
  padding:20px 22px;
  position:relative;
  overflow:hidden;
  cursor:default;
  transition:all .2s;
}

.stat-card:hover {
  border-color:var(--blue);
  transform:translateY(-2px);
  box-shadow:0 10px 32px rgba(59,130,246,.1);
}

.stat-card::before {
  content:'';
  position:absolute;
  inset:0 0 auto 0;
  height:2px;
  background:linear-gradient(90deg,var(--blue),transparent);
}

.stat-label {
  font-family:'JetBrains Mono',monospace;
  font-size:10.5px;
  color:var(--text3);
  text-transform:uppercase;
  letter-spacing:1.2px;
  margin-bottom:12px;
}

.stat-value {
  font-size:30px;
  font-weight:800;
  letter-spacing:-.5px;
  line-height:1;
}

.stat-emoji {
  position:absolute;
  right:18px; top:16px;
  font-size:22px;
  opacity:.18;
}

/* ── CARD ── */
.card {
  background:var(--surface);
  border:1px solid var(--border);
  border-radius:var(--radius);
  padding:24px;
  margin-bottom:18px;
  transition:border-color .2s;
}

.card:hover { border-color:var(--border2); }

.card-head {
  display:flex;
  align-items:center;
  gap:10px;
  margin-bottom:18px;
}

.card-title {
  font-size:15px;
  font-weight:700;
  letter-spacing:-.2px;
}

.card-icon {
  width:32px; height:32px;
  background:var(--blue-dim);
  border:1px solid rgba(59,130,246,.18);
  border-radius:var(--radius-xs);
  display:flex; align-items:center; justify-content:center;
  font-size:15px;
  flex-shrink:0;
}

.card-actions { margin-left:auto; display:flex; gap:8px; }

/* ── SPLIT LAYOUT ── */
.split {
  display:grid;
  grid-template-columns:250px 1fr;
  gap:18px;
  align-items:start;
}

