/* ============================================
   CRM — UI شیشه‌ای / مدرن (Glassmorphism)
   بدون تغییر منطق؛ فقط ظاهر
   ============================================ */
:root {
  --g-bg1: #0f0c29;
  --g-bg2: #302b63;
  --g-bg3: #24243e;
  --g-accent: #7c4dff;
  --g-accent2: #00e5ff;
  --g-success: #00c853;
  --g-warning: #ffab00;
  --g-danger: #ff5252;
  --g-glass: rgba(255, 255, 255, 0.08);
  --g-glass-strong: rgba(255, 255, 255, 0.14);
  --g-glass-border: rgba(255, 255, 255, 0.18);
  --g-text: #f5f7ff;
  --g-muted: rgba(245, 247, 255, 0.65);
  --g-radius: 18px;
  --g-shadow: 0 8px 32px rgba(0, 0, 0, 0.28);
  --g-blur: blur(18px);
  --sidebar-w: 260px;
  --font: "Vazirmatn", Tahoma, system-ui, sans-serif;
}

@import url("https://fonts.googleapis.com/css2?family=Vazirmatn:wght@300;400;500;600;700&display=swap");

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body.app-body {
  margin: 0;
  min-height: 100vh;
  font-family: var(--font);
  color: #1a1a2e;
  background: linear-gradient(135deg, #e8eaf6 0%, #f3e5f5 40%, #e0f7fa 100%);
  background-attachment: fixed;
  font-size: 0.95rem;
  line-height: 1.6;
}

/* --- Floating orbs (بالن‌های پس‌زمینه) --- */
body.app-body::before,
body.app-body::after {
  content: "";
  position: fixed;
  border-radius: 50%;
  filter: blur(60px);
  z-index: 0;
  pointer-events: none;
  opacity: 0.55;
}
body.app-body::before {
  width: 420px; height: 420px;
  background: radial-gradient(circle, #7c4dff 0%, transparent 70%);
  top: -80px; right: -60px;
  animation: floatOrb 18s ease-in-out infinite;
}
body.app-body::after {
  width: 360px; height: 360px;
  background: radial-gradient(circle, #00e5ff 0%, transparent 70%);
  bottom: -40px; left: -40px;
  animation: floatOrb 22s ease-in-out infinite reverse;
}
@keyframes floatOrb {
  0%, 100% { transform: translate(0, 0) scale(1); }
  50% { transform: translate(30px, -24px) scale(1.08); }
}

.app-shell {
  position: relative;
  z-index: 1;
  display: flex;
  min-height: 100vh;
}

/* --- Sidebar شیشه‌ای --- */
.app-sidebar {
  width: var(--sidebar-w);
  flex-shrink: 0;
  background: linear-gradient(165deg, rgba(15, 12, 41, 0.92), rgba(48, 43, 99, 0.88));
  backdrop-filter: var(--g-blur);
  -webkit-backdrop-filter: var(--g-blur);
  border-left: 1px solid var(--g-glass-border);
  color: var(--g-text);
  display: flex;
  flex-direction: column;
  box-shadow: var(--g-shadow);
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
}

.app-sidebar .brand {
  padding: 1.4rem 1.2rem;
  text-align: center;
  border-bottom: 1px solid var(--g-glass-border);
  background: rgba(255,255,255,0.04);
}
.app-sidebar .brand .logo-mark {
  width: 48px; height: 48px;
  margin: 0 auto 0.6rem;
  border-radius: 16px;
  background: linear-gradient(135deg, var(--g-accent), var(--g-accent2));
  display: flex; align-items: center; justify-content: center;
  font-size: 1.4rem;
  box-shadow: 0 8px 24px rgba(124, 77, 255, 0.45);
}
.app-sidebar .brand .title { font-weight: 700; font-size: 1.05rem; letter-spacing: 0.02em; }
.app-sidebar .brand small { color: var(--g-muted); font-size: 0.78rem; }

.app-sidebar nav { padding: 0.8rem 0.6rem 1.5rem; flex: 1; }
.app-sidebar nav a {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  padding: 0.65rem 0.9rem;
  margin-bottom: 0.25rem;
  color: var(--g-muted);
  text-decoration: none;
  border-radius: 12px;
  font-size: 0.9rem;
  font-weight: 500;
  transition: all 0.22s ease;
  border: 1px solid transparent;
}
.app-sidebar nav a i { font-size: 1.1rem; opacity: 0.9; width: 1.3rem; text-align: center; }
.app-sidebar nav a:hover {
  color: #fff;
  background: var(--g-glass);
  border-color: var(--g-glass-border);
  transform: translateX(-3px);
}
.app-sidebar nav a.active {
  color: #fff;
  background: linear-gradient(90deg, rgba(124, 77, 255, 0.45), rgba(0, 229, 255, 0.15));
  border-color: rgba(124, 77, 255, 0.35);
  box-shadow: 0 4px 16px rgba(124, 77, 255, 0.25);
}
.app-sidebar nav a .badge {
  margin-right: auto;
  font-size: 0.7rem;
  border-radius: 999px;
}

/* --- Content --- */
.app-content {
  flex: 1;
  padding: 1.4rem 1.6rem 2.5rem;
  max-width: 100%;
  overflow-x: hidden;
}

/* --- Glass cards --- */
.card, .glass-card {
  background: rgba(255, 255, 255, 0.72) !important;
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid rgba(255, 255, 255, 0.55) !important;
  border-radius: var(--g-radius) !important;
  box-shadow: 0 8px 28px rgba(30, 30, 60, 0.08) !important;
  overflow: hidden;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}
.card:hover {
  box-shadow: 0 12px 36px rgba(30, 30, 60, 0.12) !important;
}
.card-header {
  background: rgba(255, 255, 255, 0.45) !important;
  border-bottom: 1px solid rgba(0, 0, 0, 0.05) !important;
  font-weight: 600;
  padding: 0.85rem 1.15rem;
}
.card-body { padding: 1.15rem; }

/* Stat balloons */
.stat-balloon {
  background: rgba(255, 255, 255, 0.75);
  backdrop-filter: blur(12px);
  border: 1px solid rgba(255, 255, 255, 0.6);
  border-radius: 20px;
  padding: 1.15rem 1rem;
  text-align: center;
  box-shadow: 0 8px 24px rgba(30, 30, 60, 0.08);
  transition: transform 0.25s ease, box-shadow 0.25s ease;
  position: relative;
  overflow: hidden;
}
.stat-balloon::before {
  content: "";
  position: absolute;
  inset: auto -20% -40% auto;
  width: 80px; height: 80px;
  border-radius: 50%;
  background: rgba(124, 77, 255, 0.12);
  filter: blur(8px);
}
.stat-balloon:hover {
  transform: translateY(-4px);
  box-shadow: 0 14px 32px rgba(30, 30, 60, 0.14);
}
.stat-balloon .stat-value {
  font-size: 1.75rem;
  font-weight: 700;
  background: linear-gradient(135deg, #5e35b1, #00bcd4);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  line-height: 1.2;
}
.stat-balloon .stat-label {
  font-size: 0.8rem;
  color: #5c6370;
  margin-top: 0.25rem;
  font-weight: 500;
}
.stat-balloon.accent-success .stat-value {
  background: linear-gradient(135deg, #00c853, #69f0ae);
  -webkit-background-clip: text;
  background-clip: text;
}
.stat-balloon.accent-warning .stat-value {
  background: linear-gradient(135deg, #ff6d00, #ffab00);
  -webkit-background-clip: text;
  background-clip: text;
}
.stat-balloon.accent-info .stat-value {
  background: linear-gradient(135deg, #0091ea, #00e5ff);
  -webkit-background-clip: text;
  background-clip: text;
}
.stat-balloon.accent-danger .stat-value {
  background: linear-gradient(135deg, #ff1744, #ff8a80);
  -webkit-background-clip: text;
  background-clip: text;
}

/* Buttons */
.btn {
  border-radius: 12px !important;
  font-weight: 500;
  padding: 0.45rem 1rem;
  transition: all 0.2s ease;
}
.btn-primary {
  background: linear-gradient(135deg, #7c4dff, #651fff) !important;
  border: none !important;
  box-shadow: 0 4px 14px rgba(124, 77, 255, 0.35);
}
.btn-primary:hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 18px rgba(124, 77, 255, 0.45);
  background: linear-gradient(135deg, #8c5cff, #7c4dff) !important;
}
.btn-success {
  background: linear-gradient(135deg, #00c853, #00e676) !important;
  border: none !important;
  box-shadow: 0 4px 14px rgba(0, 200, 83, 0.3);
}
.btn-warning {
  background: linear-gradient(135deg, #ffab00, #ffc400) !important;
  border: none !important;
  color: #1a1a2e !important;
}
.btn-outline-primary, .btn-outline-secondary, .btn-outline-success, .btn-outline-danger, .btn-outline-info, .btn-outline-warning {
  border-radius: 12px !important;
  backdrop-filter: blur(4px);
}
.btn-lg { border-radius: 14px !important; padding: 0.65rem 1.4rem; }
.btn-sm { border-radius: 10px !important; }

/* Forms */
.form-control, .form-select {
  border-radius: 12px !important;
  border: 1px solid rgba(0, 0, 0, 0.08) !important;
  background: rgba(255, 255, 255, 0.85) !important;
  padding: 0.55rem 0.9rem;
  transition: border-color 0.2s, box-shadow 0.2s;
}
.form-control:focus, .form-select:focus {
  border-color: rgba(124, 77, 255, 0.5) !important;
  box-shadow: 0 0 0 3px rgba(124, 77, 255, 0.15) !important;
  background: #fff !important;
}
.form-control-lg { border-radius: 14px !important; }
.form-label { font-weight: 500; font-size: 0.88rem; color: #3d4450; }

/* Tables */
.table {
  --bs-table-bg: transparent;
}
.table thead th {
  font-weight: 600;
  font-size: 0.82rem;
  color: #5c6370;
  border-bottom-width: 1px;
  background: rgba(124, 77, 255, 0.04);
}
.table-hover tbody tr {
  transition: background 0.15s;
}
.table-hover tbody tr:hover {
  background: rgba(124, 77, 255, 0.06) !important;
}
.table-responsive {
  border-radius: 0 0 var(--g-radius) var(--g-radius);
}

/* Alerts glass */
.alert {
  border-radius: 14px !important;
  border: 1px solid transparent;
  backdrop-filter: blur(8px);
}
.alert-success { background: rgba(0, 200, 83, 0.12); border-color: rgba(0, 200, 83, 0.25); color: #1b5e20; }
.alert-danger { background: rgba(255, 82, 82, 0.12); border-color: rgba(255, 82, 82, 0.25); color: #b71c1c; }
.alert-warning { background: rgba(255, 171, 0, 0.15); border-color: rgba(255, 171, 0, 0.3); color: #e65100; }
.alert-info { background: rgba(0, 229, 255, 0.12); border-color: rgba(0, 188, 212, 0.25); color: #006064; }

/* Badges */
.badge {
  border-radius: 8px;
  font-weight: 500;
  padding: 0.35em 0.65em;
}

/* Page title */
.page-title {
  font-weight: 700;
  font-size: 1.35rem;
  color: #1a1a2e;
  margin-bottom: 1.1rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}
.page-title i {
  background: linear-gradient(135deg, #7c4dff, #00e5ff);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

/* List group soft */
.list-group-item {
  background: transparent !important;
  border-color: rgba(0, 0, 0, 0.05) !important;
}
.list-group-item-action:hover {
  background: rgba(124, 77, 255, 0.06) !important;
}

/* Modal glass */
.modal-content {
  background: rgba(255, 255, 255, 0.92) !important;
  backdrop-filter: blur(20px);
  border: 1px solid rgba(255, 255, 255, 0.6) !important;
  border-radius: 20px !important;
  box-shadow: 0 24px 64px rgba(0, 0, 0, 0.2);
}

/* Login page */
.login-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, #0f0c29, #302b63 50%, #24243e);
  position: relative;
  overflow: hidden;
  font-family: var(--font);
}
.login-page::before,
.login-page::after {
  content: "";
  position: absolute;
  border-radius: 50%;
  filter: blur(80px);
  opacity: 0.5;
}
.login-page::before {
  width: 500px; height: 500px;
  background: #7c4dff;
  top: -150px; right: -100px;
  animation: floatOrb 16s ease-in-out infinite;
}
.login-page::after {
  width: 400px; height: 400px;
  background: #00e5ff;
  bottom: -100px; left: -80px;
  animation: floatOrb 20s ease-in-out infinite reverse;
}
.login-card {
  position: relative;
  z-index: 2;
  width: 100%;
  max-width: 400px;
  background: rgba(255, 255, 255, 0.1);
  backdrop-filter: blur(24px);
  -webkit-backdrop-filter: blur(24px);
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 24px;
  padding: 2rem;
  box-shadow: 0 24px 64px rgba(0, 0, 0, 0.35);
  color: #fff;
}
.login-card h4 { font-weight: 700; }
.login-card .form-control {
  background: rgba(255, 255, 255, 0.12) !important;
  border: 1px solid rgba(255, 255, 255, 0.2) !important;
  color: #fff !important;
}
.login-card .form-control::placeholder { color: rgba(255,255,255,0.5); }
.login-card .form-control:focus {
  background: rgba(255, 255, 255, 0.18) !important;
  border-color: rgba(0, 229, 255, 0.5) !important;
  box-shadow: 0 0 0 3px rgba(0, 229, 255, 0.15) !important;
}
.login-card .form-label { color: rgba(255,255,255,0.85); }
.login-card .btn-login {
  background: linear-gradient(135deg, #7c4dff, #00e5ff);
  border: none;
  color: #fff;
  font-weight: 600;
  border-radius: 14px;
  padding: 0.7rem;
  width: 100%;
  box-shadow: 0 8px 24px rgba(124, 77, 255, 0.4);
}
.login-card .btn-login:hover {
  transform: translateY(-2px);
  box-shadow: 0 12px 28px rgba(124, 77, 255, 0.5);
  color: #fff;
}
.login-card code {
  background: rgba(255,255,255,0.15);
  color: #00e5ff;
  padding: 0.1em 0.4em;
  border-radius: 6px;
}

/* Mobile top bar */
.mobile-bar {
  display: none;
  position: sticky;
  top: 0;
  z-index: 100;
  background: rgba(15, 12, 41, 0.9);
  backdrop-filter: blur(12px);
  color: #fff;
  padding: 0.75rem 1rem;
  align-items: center;
  justify-content: space-between;
}
.mobile-bar .btn-menu {
  background: var(--g-glass);
  border: 1px solid var(--g-glass-border);
  color: #fff;
  border-radius: 10px;
}

@media (max-width: 991.98px) {
  .app-shell { flex-direction: column; }
  .app-sidebar {
    position: fixed;
    right: -100%;
    top: 0;
    height: 100%;
    z-index: 1050;
    transition: right 0.3s ease;
    width: min(280px, 85vw);
  }
  .app-sidebar.open { right: 0; }
  .mobile-bar { display: flex; }
  .app-content { padding: 1rem; }
  .sidebar-backdrop {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.45);
    z-index: 1040;
  }
  .sidebar-backdrop.show { display: block; }
}

/* Scrollbar soft */
.app-sidebar::-webkit-scrollbar { width: 5px; }
.app-sidebar::-webkit-scrollbar-thumb {
  background: rgba(255,255,255,0.2);
  border-radius: 10px;
}

/* Utility */
.text-gradient {
  background: linear-gradient(135deg, #7c4dff, #00e5ff);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

/* --- Footer credit --- */
.app-footer {
  position: relative;
  z-index: 1;
  border-top: 1px solid rgba(255,255,255,0.4);
  background: rgba(255,255,255,0.35);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border-radius: 16px 16px 0 0;
  margin-top: 2rem;
}
.app-footer .footer-mail {
  color: #5e35b1;
  text-decoration: none;
  font-weight: 500;
  border-bottom: 1px dashed rgba(94, 53, 177, 0.4);
  transition: color 0.2s, border-color 0.2s;
}
.app-footer .footer-mail:hover {
  color: #7c4dff;
  border-bottom-color: #7c4dff;
}
.login-credit {
  position: relative;
  z-index: 2;
  text-align: center;
  margin-top: 1.5rem;
  color: rgba(255,255,255,0.65);
  font-size: 0.85rem;
}
.login-credit a {
  color: #00e5ff;
  text-decoration: none;
  border-bottom: 1px dashed rgba(0,229,255,0.4);
}
.login-credit a:hover { color: #fff; border-bottom-color: #fff; }

/* --- Layout: content + footer column --- */
.app-main-col {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-width: 0;
  min-height: 100vh;
}
.app-content {
  flex: 1;
}
.app-footer {
  flex-shrink: 0;
  width: 100%;
  margin-top: auto;
  padding: 0.85rem 1rem;
  text-align: center;
  border-top: 1px solid rgba(124, 77, 255, 0.12);
  background: rgba(255, 255, 255, 0.55);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-radius: 0;
  position: relative;
  z-index: 2;
}
.app-footer .footer-inner {
  font-size: 0.82rem;
  color: #5c6370;
}
.app-footer .footer-sep {
  margin: 0 0.35rem;
  opacity: 0.5;
}
.app-footer .footer-mail {
  color: #5e35b1;
  text-decoration: none;
  font-weight: 600;
  border-bottom: 1px dashed rgba(94, 53, 177, 0.45);
}
.app-footer .footer-mail:hover {
  color: #7c4dff;
  border-bottom-style: solid;
}

/* ============================================
   Layout fix: full height + collapsible sidebar
   ============================================ */
html, body.app-body {
  height: 100%;
  margin: 0;
}
body.app-body {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  overflow-x: hidden;
}
.app-shell {
  display: flex;
  flex: 1;
  min-height: 100vh;
  width: 100%;
  align-items: stretch;
}
.app-sidebar {
  width: var(--sidebar-w);
  min-width: var(--sidebar-w);
  max-width: var(--sidebar-w);
  height: 100vh;
  position: sticky;
  top: 0;
  flex-shrink: 0;
  transition: width 0.28s ease, min-width 0.28s ease, max-width 0.28s ease;
}
.app-main-col {
  flex: 1 1 auto;
  display: flex;
  flex-direction: column;
  min-width: 0;
  width: 100%;
  min-height: 100vh;
}
.app-content {
  flex: 1 1 auto;
  width: 100%;
  padding: 1.25rem 1.5rem 1rem;
  min-height: 0;
}
/* Collapsed sidebar — icons only */
.app-shell.sidebar-collapsed .app-sidebar {
  width: 72px;
  min-width: 72px;
  max-width: 72px;
}
.app-shell.sidebar-collapsed .app-sidebar .brand-text,
.app-shell.sidebar-collapsed .app-sidebar nav a span,
.app-shell.sidebar-collapsed .app-sidebar nav a:not([href]) {
  display: none;
}
.app-shell.sidebar-collapsed .app-sidebar .brand {
  flex-direction: column;
  gap: 0.5rem;
  padding: 1rem 0.4rem;
}
.app-shell.sidebar-collapsed .app-sidebar nav a {
  justify-content: center;
  padding: 0.75rem 0.4rem;
  gap: 0;
}
.app-shell.sidebar-collapsed .app-sidebar nav a i {
  margin: 0;
  font-size: 1.25rem;
}
.app-shell.sidebar-collapsed .app-sidebar nav a .badge {
  position: absolute;
  top: 4px;
  left: 6px;
  margin: 0;
  font-size: 0.6rem;
  padding: 0.15em 0.35em;
}
.app-shell.sidebar-collapsed .app-sidebar nav a {
  position: relative;
}
.app-shell.sidebar-collapsed .app-sidebar .title,
.app-shell.sidebar-collapsed .app-sidebar small {
  display: none;
}

/* Brand row with collapse button */
.app-sidebar .brand {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  position: relative;
  padding: 1.1rem 0.75rem;
}
.app-sidebar .brand-text { text-align: center; flex: 1; min-width: 0; }
.btn-collapse-side {
  background: rgba(255,255,255,0.12);
  border: 1px solid rgba(255,255,255,0.2);
  color: #fff;
  border-radius: 10px;
  width: 36px;
  height: 36px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: background 0.2s, transform 0.2s;
  flex-shrink: 0;
}
.btn-collapse-side:hover {
  background: rgba(255,255,255,0.22);
  transform: scale(1.05);
}

/* Nav links need span for text when we want icon-only - wrap text not needed if we hide all but i */
.app-sidebar nav a {
  white-space: nowrap;
  overflow: hidden;
}

/* Footer glass colored bar */
.app-footer {
  flex-shrink: 0;
  width: 100%;
  margin: 0;
  padding: 0;
  border: none;
  background: transparent;
  position: relative;
  z-index: 5;
}
.app-footer .footer-inner {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 0.4rem 0.65rem;
  margin: 0 1rem 0.75rem;
  padding: 0.7rem 1.25rem;
  font-size: 0.82rem;
  color: #fff;
  background: linear-gradient(135deg, rgba(94, 53, 177, 0.85), rgba(0, 188, 212, 0.75));
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid rgba(255, 255, 255, 0.28);
  border-radius: 16px;
  box-shadow: 0 8px 28px rgba(94, 53, 177, 0.25);
}
.app-footer .footer-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border-radius: 8px;
  background: rgba(255,255,255,0.2);
  font-size: 0.9rem;
}
.app-footer .footer-sep { opacity: 0.55; }
.app-footer .footer-mail {
  color: #fff !important;
  text-decoration: none;
  font-weight: 600;
  border-bottom: 1px dashed rgba(255,255,255,0.55);
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
}
.app-footer .footer-mail:hover {
  border-bottom-style: solid;
  color: #e0f7fa !important;
}

@media (max-width: 991.98px) {
  .app-shell { min-height: calc(100vh - 52px); }
  .app-main-col { min-height: calc(100vh - 52px); }
  .app-sidebar {
    width: min(280px, 85vw) !important;
    min-width: unset !important;
    max-width: unset !important;
  }
  .app-shell.sidebar-collapsed .app-sidebar {
    width: min(280px, 85vw) !important;
    min-width: unset !important;
    max-width: unset !important;
  }
  .app-shell.sidebar-collapsed .app-sidebar .brand-text,
  .app-shell.sidebar-collapsed .app-sidebar .title,
  .app-shell.sidebar-collapsed .app-sidebar small {
    display: block;
  }
  .app-shell.sidebar-collapsed .app-sidebar nav a {
    justify-content: flex-start;
    padding: 0.65rem 0.9rem;
  }
  .btn-collapse-side { display: none; }
  .app-footer .footer-inner {
    margin: 0 0.5rem 0.5rem;
    font-size: 0.75rem;
    padding: 0.6rem 0.85rem;
  }
}

/* Icon-only collapsed: hide text nodes via font-size */
.app-shell.sidebar-collapsed .app-sidebar nav a {
  font-size: 0 !important;
  line-height: 0;
  justify-content: center;
  padding: 0.85rem 0.35rem !important;
}
.app-shell.sidebar-collapsed .app-sidebar nav a i {
  font-size: 1.3rem !important;
  line-height: 1;
  width: auto;
}
.app-shell.sidebar-collapsed .app-sidebar nav a .badge {
  font-size: 0.65rem !important;
  line-height: 1.2;
}
.app-shell.sidebar-collapsed .app-sidebar .brand-text {
  display: none !important;
}
.app-shell.sidebar-collapsed .app-sidebar .logo-mark {
  width: 40px;
  height: 40px;
  font-size: 1.1rem;
}
/* Tooltip-like title on hover when collapsed */
.app-shell.sidebar-collapsed .app-sidebar nav a {
  position: relative;
}

/* Alarm balloons */
.alarm-balloon {
  margin-bottom: 0.75rem;
  animation: alarmIn 0.35s ease;
}
.alarm-balloon-inner {
  background: linear-gradient(135deg, rgba(94,53,177,0.95), rgba(0,151,167,0.92));
  color: #fff;
  border-radius: 16px;
  padding: 0.9rem 1rem;
  box-shadow: 0 12px 36px rgba(94,53,177,0.35);
  border: 1px solid rgba(255,255,255,0.25);
  backdrop-filter: blur(12px);
}
@keyframes alarmIn {
  from { transform: translateY(20px) scale(0.95); opacity: 0; }
  to { transform: translateY(0) scale(1); opacity: 1; }
}

/* Modal above any overlay */
.modal { z-index: 1060 !important; }
.modal-backdrop { z-index: 1050 !important; pointer-events: auto; }
.modal-dialog { pointer-events: auto; z-index: 1061; }
body.modal-open { overflow: hidden; }
.top-toolbar { position: relative; z-index: 10; }

/* Persian date hint */
.jdate-hint { font-size: 0.75rem; color: #6c757d; }

/* Fix modal lock */
.modal-backdrop.show { opacity: 0.35; z-index: 1050 !important; }
.modal.show { z-index: 1060 !important; display: block !important; }
.modal-dialog { z-index: 1061 !important; position: relative; pointer-events: auto !important; }
.modal-content { pointer-events: auto !important; position: relative; z-index: 1062; }
body.modal-open { padding-right: 0 !important; }
/* prevent sidebar/orbs intercepting clicks */
.app-sidebar { z-index: 100; }
.app-content { z-index: 1; position: relative; }


/* ========== Mobile responsive fix ========== */
@media (max-width: 991.98px) {
  :root { --sidebar-w: 0px; }
  .app-shell { flex-direction: column; }
  .app-sidebar {
    position: fixed !important;
    top: 0; right: 0; bottom: 0;
    width: min(280px, 85vw) !important;
    min-width: 0 !important;
    max-width: min(280px, 85vw) !important;
    transform: translateX(105%);
    transition: transform .25s ease;
    z-index: 1100 !important;
    box-shadow: none;
  }
  .app-sidebar.open {
    transform: translateX(0) !important;
    box-shadow: -8px 0 30px rgba(0,0,0,.25);
  }
  .app-main, .app-content {
    width: 100% !important;
    max-width: 100% !important;
    margin: 0 !important;
    padding-top: 0 !important;
  }
  .mobile-bar {
    display: flex !important;
    position: sticky;
    top: 0;
    z-index: 1050;
    background: rgba(15,23,42,.92);
    backdrop-filter: blur(12px);
    color: #fff;
    padding: .55rem .75rem;
    align-items: center;
    gap: .5rem;
    border-bottom: 1px solid rgba(255,255,255,.08);
  }
  .mobile-bar .btn-menu {
    background: rgba(255,255,255,.12);
    border: 0;
    color: #fff;
    width: 40px; height: 40px;
    border-radius: 10px;
  }
  .sidebar-backdrop {
    display: none;
    position: fixed; inset: 0;
    background: rgba(0,0,0,.45);
    z-index: 1090;
  }
  .sidebar-backdrop.show { display: block !important; }
  .top-toolbar { flex-wrap: wrap; }
  .stat-balloon { margin-bottom: .5rem; }
  .table-responsive { font-size: 0.88rem; }
  .card-body { padding: 0.9rem; }
}

@media (min-width: 992px) {
  .mobile-bar { display: none !important; }
  .sidebar-backdrop { display: none !important; }
}

/* ========== Mobile responsive fix ========== */
.mobile-topbar {
  display: none;
  position: sticky;
  top: 0;
  z-index: 1040;
  background: linear-gradient(135deg, rgba(15,12,41,.95), rgba(48,43,99,.92));
  color: #fff;
  padding: 0.55rem 0.85rem;
  align-items: center;
  gap: 0.6rem;
  box-shadow: 0 4px 16px rgba(0,0,0,.2);
}
.mobile-topbar .btn-menu {
  background: rgba(255,255,255,.12);
  border: 1px solid rgba(255,255,255,.25);
  color: #fff;
  border-radius: 10px;
  width: 40px; height: 40px;
  display: inline-flex; align-items: center; justify-content: center;
}
.sidebar-overlay {
  display: none;
  position: fixed; inset: 0;
  background: rgba(0,0,0,.45);
  z-index: 1045;
}
.sidebar-overlay.show { display: block; }

@media (max-width: 991.98px) {
  .mobile-topbar { display: flex !important; }
  .app-shell { flex-direction: column; }
  .app-sidebar {
    position: fixed !important;
    top: 0; bottom: 0;
    right: 0;
    width: min(82vw, 280px) !important;
    height: 100vh !important;
    z-index: 1050;
    transform: translateX(110%);
    transition: transform .25s ease;
    box-shadow: -8px 0 32px rgba(0,0,0,.35);
  }
  .app-shell.mobile-nav-open .app-sidebar {
    transform: translateX(0);
  }
  .app-main-col, .app-content {
    width: 100% !important;
    margin: 0 !important;
    padding: 0.75rem !important;
    min-height: auto !important;
  }
  .app-shell.sidebar-collapsed .app-sidebar {
    width: min(82vw, 280px) !important;
    transform: translateX(110%);
  }
  .app-shell.mobile-nav-open.sidebar-collapsed .app-sidebar {
    transform: translateX(0);
  }
  .top-toolbar { flex-wrap: wrap; }
  .stat-balloon .stat-value { font-size: 1.25rem !important; }
  .table-responsive { font-size: 0.85rem; }
}

/* Messages contacts scroll */
.chat-contacts {
  max-height: 70vh;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}
@media (max-width: 767.98px) {
  .chat-contacts { max-height: 220px; }
  .chat-messages { max-height: 45vh !important; }
}


/* MOBILE FIX 2026 */
@media (max-width: 991.98px) {
  .app-shell {
    flex-direction: column !important;
    height: auto !important;
    min-height: 100vh !important;
  }
  .app-sidebar {
    position: fixed !important;
    top: 0 !important;
    right: 0 !important;
    left: auto !important;
    width: min(280px, 85vw) !important;
    min-width: 0 !important;
    max-width: 280px !important;
    height: 100vh !important;
    height: 100dvh !important;
    z-index: 2000 !important;
    transform: translateX(110%) !important;
    transition: transform 0.25s ease !important;
    overflow-y: auto !important;
    box-shadow: -8px 0 24px rgba(0,0,0,.25);
  }
  .app-shell.sidebar-open .app-sidebar,
  .app-sidebar.open {
    transform: translateX(0) !important;
  }
  .app-main, .app-content-wrap, .app-content {
    width: 100% !important;
    max-width: 100% !important;
    margin: 0 !important;
    padding-top: 0.5rem !important;
  }
  .sidebar-toggle, .btn-sidebar-toggle, #sidebarToggle {
    display: inline-flex !important;
    position: sticky;
    top: 0.5rem;
    z-index: 50;
  }
  .top-toolbar {
    flex-wrap: wrap;
    gap: 0.35rem;
  }
  .stat-balloon .stat-value { font-size: 1.25rem !important; }
  .table-responsive { font-size: 0.85rem; }
  .messages-layout, .chat-layout {
    flex-direction: column !important;
    height: auto !important;
    min-height: 70vh;
  }
  .messages-contacts, .chat-contacts {
    max-height: 220px !important;
    overflow-y: auto !important;
    width: 100% !important;
  }
  .messages-thread, .chat-thread {
    min-height: 320px;
    max-height: 55vh;
    overflow-y: auto;
  }
}

.messages-contacts-col .list-group,
.messages-contacts {
  max-height: 70vh;
  overflow-y: auto;
}
.messages-thread-col {
  max-height: 75vh;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

/* ========== Mobile & sticky footer fixes 2026 ========== */
html, body {
  height: 100%;
  margin: 0;
}
body {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}
.app-shell {
  min-height: 100vh;
  display: flex;
  flex: 1;
  width: 100%;
}
.app-main-col {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-width: 0;
  min-height: 100vh;
}
.app-content {
  flex: 1 0 auto;
  width: 100%;
  padding-bottom: 1rem;
}
.app-footer {
  flex-shrink: 0;
  margin-top: auto !important;
  position: sticky;
  bottom: 0;
  width: 100%;
  z-index: 10;
}

/* Mobile: sidebar off-canvas only — never stacks on top of content */
@media (max-width: 991.98px) {
  .app-shell {
    flex-direction: column !important;
  }
  .app-sidebar {
    position: fixed !important;
    top: 0;
    right: -110% !important;
    left: auto;
    width: min(280px, 86vw) !important;
    height: 100vh !important;
    height: 100dvh !important;
    z-index: 1100 !important;
    transition: right 0.28s ease !important;
    box-shadow: -4px 0 24px rgba(0,0,0,0.25);
  }
  .app-sidebar.open {
    right: 0 !important;
  }
  .mobile-bar {
    display: flex !important;
    position: sticky;
    top: 0;
    z-index: 1000;
    width: 100%;
    background: rgba(255,255,255,0.92);
    backdrop-filter: blur(10px);
    border-bottom: 1px solid rgba(0,0,0,0.06);
    padding: 0.55rem 0.85rem;
    align-items: center;
    gap: 0.5rem;
  }
  .app-content {
    padding: 0.75rem !important;
    width: 100% !important;
  }
  .sidebar-backdrop,
  .sidebar-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(15, 10, 40, 0.5);
    z-index: 1090;
  }
  .sidebar-backdrop.show,
  .sidebar-overlay.show {
    display: block !important;
  }
  /* never show sidebar inline above content */
  .app-sidebar:not(.open) {
    pointer-events: none;
  }
}

@media (min-width: 992px) {
  .mobile-bar { display: none !important; }
  .sidebar-backdrop, .sidebar-overlay { display: none !important; }
}

/* Chat / messages layout */
.msg-layout {
  display: flex;
  gap: 0;
  min-height: 420px;
  max-height: calc(100vh - 200px);
  border-radius: 14px;
  overflow: hidden;
  background: rgba(255,255,255,0.55);
  border: 1px solid rgba(124,77,255,0.12);
}
.msg-contacts {
  width: 260px;
  min-width: 200px;
  max-width: 40%;
  border-left: 1px solid rgba(0,0,0,0.06);
  overflow-y: auto;
  max-height: inherit;
  -webkit-overflow-scrolling: touch;
}
.msg-thread {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-width: 0;
  max-height: inherit;
}
.msg-thread-body {
  flex: 1;
  overflow-y: auto;
  padding: 1rem;
  -webkit-overflow-scrolling: touch;
}
.msg-compose {
  border-top: 1px solid rgba(0,0,0,0.06);
  padding: 0.75rem;
  background: rgba(255,255,255,0.7);
}
@media (max-width: 767.98px) {
  .msg-layout {
    flex-direction: column;
    max-height: none;
    min-height: 0;
  }
  .msg-contacts {
    width: 100% !important;
    max-width: 100%;
    max-height: 160px;
    border-left: none;
    border-bottom: 1px solid rgba(0,0,0,0.06);
  }
  .msg-thread {
    min-height: 360px;
    max-height: 60vh;
  }
}

/* Tables on mobile */
@media (max-width: 575.98px) {
  .table-responsive { font-size: 0.85rem; }
  .btn-group { flex-wrap: wrap; }
}

/* ===== Mobile menu hard fix ===== */
.mobile-bar {
  display: none;
}
@media (max-width: 991.98px) {
  .mobile-bar,
  .mobile-bar.d-lg-none {
    display: flex !important;
    align-items: center;
    gap: 0.5rem;
    position: sticky;
    top: 0;
    z-index: 1200;
    padding: 0.6rem 0.75rem;
    background: rgba(255,255,255,0.95);
    backdrop-filter: blur(12px);
    border-bottom: 1px solid rgba(0,0,0,0.08);
    width: 100%;
  }
  .app-sidebar {
    position: fixed !important;
    top: 0 !important;
    bottom: 0 !important;
    right: -100% !important;
    left: auto !important;
    width: min(300px, 88vw) !important;
    height: 100% !important;
    height: 100dvh !important;
    z-index: 1300 !important;
    transition: right 0.25s ease !important;
    overflow-y: auto !important;
    background: linear-gradient(165deg, #1a1440 0%, #2d1b69 50%, #1e3a5f 100%) !important;
    box-shadow: -8px 0 32px rgba(0,0,0,0.35);
    pointer-events: auto !important;
  }
  .app-sidebar.open {
    right: 0 !important;
  }
  .sidebar-backdrop {
    display: none;
    position: fixed !important;
    inset: 0 !important;
    background: rgba(10, 8, 30, 0.55) !important;
    z-index: 1250 !important;
  }
  .sidebar-backdrop.show {
    display: block !important;
  }
  body.nav-open {
    overflow: hidden;
  }
  .mobile-topbar { display: none !important; }
  .sidebar-overlay { display: none !important; }
  .app-shell { flex-direction: column; }
}

/* Submenu groups */
.nav-group-title {
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: rgba(255,255,255,0.45);
  padding: 0.85rem 1rem 0.25rem;
  margin-top: 0.35rem;
}
.nav-group-title:first-child { margin-top: 0; }
.app-sidebar nav details.nav-group {
  margin: 0.15rem 0.4rem;
}
.app-sidebar nav details.nav-group > summary {
  list-style: none;
  cursor: pointer;
  padding: 0.55rem 0.75rem;
  border-radius: 10px;
  color: rgba(255,255,255,0.9);
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.92rem;
}
.app-sidebar nav details.nav-group > summary::-webkit-details-marker { display: none; }
.app-sidebar nav details.nav-group > summary::after {
  content: "▾";
  margin-right: auto;
  opacity: 0.5;
  font-size: 0.75rem;
}
.app-sidebar nav details.nav-group[open] > summary::after { content: "▴"; }
.app-sidebar nav details.nav-group .nav-sub {
  padding: 0.15rem 0.35rem 0.35rem 0.5rem;
}
.app-sidebar nav details.nav-group .nav-sub a {
  font-size: 0.86rem;
  padding: 0.4rem 0.65rem;
}

/* SLA colors */
.sla-orange { background: rgba(255, 152, 0, 0.15) !important; }
.sla-red { background: rgba(244, 67, 54, 0.18) !important; }
.sla-taken { background: rgba(156, 39, 176, 0.12) !important; }

/* Pagination bar */
.pager-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  align-items: center;
  justify-content: space-between;
  padding: 0.75rem 1rem;
  border-top: 1px solid rgba(0,0,0,0.06);
}

/* Mobile sidebar fix 2026-09-20 */


/* ========== Mobile sidebar fix 2026-09 ========== */
@media (max-width: 991.98px) {
  .app-shell {
    flex-direction: column !important;
    display: block !important;
  }
  .app-sidebar {
    position: fixed !important;
    top: 0;
    right: -110% !important;
    left: auto !important;
    width: min(280px, 86vw) !important;
    height: 100vh !important;
    height: 100dvh !important;
    z-index: 1100 !important;
    transition: right 0.28s ease !important;
    box-shadow: -4px 0 24px rgba(0,0,0,0.3);
    overflow-y: auto;
  }
  .app-sidebar.open {
    right: 0 !important;
  }
  .app-sidebar:not(.open) {
    pointer-events: none;
  }
  .mobile-bar {
    display: flex !important;
    position: sticky;
    top: 0;
    z-index: 1000;
    width: 100%;
    background: rgba(255,255,255,0.95);
    backdrop-filter: blur(10px);
    border-bottom: 1px solid rgba(0,0,0,0.06);
    padding: 0.55rem 0.85rem;
    align-items: center;
    gap: 0.5rem;
  }
  .app-content {
    padding: 0.75rem !important;
    width: 100% !important;
    margin: 0 !important;
  }
  .app-main-col {
    width: 100% !important;
    min-height: calc(100vh - 50px);
  }
  .sidebar-backdrop,
  .sidebar-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(15, 10, 40, 0.5);
    z-index: 1090;
  }
  .sidebar-backdrop.show,
  .sidebar-overlay.show {
    display: block !important;
  }
}

@media (min-width: 992px) {
  .mobile-bar { display: none !important; }
  .sidebar-backdrop, .sidebar-overlay { display: none !important; }
}

/* Sticky footer */
html, body { height: 100%; margin: 0; }
body { min-height: 100vh; display: flex; flex-direction: column; }
.app-shell { flex: 1; display: flex; min-height: 100vh; width: 100%; }
.app-main-col {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-width: 0;
  min-height: 100vh;
}
.app-content { flex: 1 0 auto; width: 100%; padding-bottom: 1rem; }
.app-footer {
  flex-shrink: 0 !important;
  margin-top: auto !important;
  position: sticky;
  bottom: 0;
  width: 100%;
  z-index: 10;
}

/* Chat / messages responsive scroll */
.msg-layout {
  display: flex;
  gap: 0;
  min-height: 420px;
  max-height: calc(100vh - 200px);
  border-radius: 14px;
  overflow: hidden;
  background: rgba(255,255,255,0.55);
  border: 1px solid rgba(124,77,255,0.12);
}
.msg-contacts {
  width: 260px;
  min-width: 180px;
  max-width: 40%;
  border-left: 1px solid rgba(0,0,0,0.06);
  overflow-y: auto;
  max-height: inherit;
  -webkit-overflow-scrolling: touch;
}
.msg-thread {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-width: 0;
  max-height: inherit;
}
.msg-thread-body {
  flex: 1;
  overflow-y: auto;
  padding: 1rem;
  -webkit-overflow-scrolling: touch;
}
.msg-compose {
  border-top: 1px solid rgba(0,0,0,0.06);
  padding: 0.75rem;
  background: rgba(255,255,255,0.7);
}
@media (max-width: 767.98px) {
  .msg-layout {
    flex-direction: column;
    max-height: none;
    min-height: 0;
  }
  .msg-contacts {
    width: 100% !important;
    max-width: 100%;
    max-height: 180px;
    border-left: none;
    border-bottom: 1px solid rgba(0,0,0,0.06);
  }
  .msg-thread {
    min-height: 360px;
    max-height: 60vh;
  }
}

/* ========== Mobile sidebar fix FINAL ========== */
@media (max-width: 991.98px) {
  .app-shell { flex-direction: column !important; display: block !important; }
  .app-sidebar {
    position: fixed !important;
    top: 0 !important;
    right: -110% !important;
    width: min(280px, 86vw) !important;
    height: 100vh !important;
    height: 100dvh !important;
    z-index: 1100 !important;
    transition: right 0.28s ease !important;
  }
  .app-sidebar.open { right: 0 !important; pointer-events: auto !important; }
  .app-sidebar:not(.open) { pointer-events: none !important; }
  .mobile-bar {
    display: flex !important;
    position: sticky; top: 0; z-index: 1000; width: 100%;
    background: rgba(255,255,255,0.95);
    backdrop-filter: blur(10px);
    border-bottom: 1px solid rgba(0,0,0,0.06);
    padding: 0.55rem 0.85rem;
    align-items: center; gap: 0.5rem;
  }
  .app-content { padding: 0.75rem !important; width: 100% !important; margin: 0 !important; }
  .app-main-col { width: 100% !important; min-height: calc(100vh - 48px); }
  .sidebar-backdrop, .sidebar-overlay {
    display: none; position: fixed; inset: 0;
    background: rgba(15, 10, 40, 0.5); z-index: 1090;
  }
  .sidebar-backdrop.show, .sidebar-overlay.show { display: block !important; }
}
@media (min-width: 992px) {
  .mobile-bar { display: none !important; }
  .sidebar-backdrop, .sidebar-overlay { display: none !important; }
}
.app-footer {
  flex-shrink: 0 !important;
  margin-top: auto !important;
  position: sticky;
  bottom: 0;
  width: 100%;
  z-index: 10;
}
.msg-layout {
  display: flex; gap: 0; min-height: 420px;
  max-height: calc(100vh - 200px);
  border-radius: 14px; overflow: hidden;
  background: rgba(255,255,255,0.55);
  border: 1px solid rgba(124,77,255,0.12);
}
.msg-contacts {
  width: 260px; min-width: 180px; max-width: 40%;
  border-left: 1px solid rgba(0,0,0,0.06);
  overflow-y: auto; max-height: inherit;
  -webkit-overflow-scrolling: touch;
}
.msg-thread {
  flex: 1; display: flex; flex-direction: column;
  min-width: 0; max-height: inherit;
}
.msg-thread-body {
  flex: 1; overflow-y: auto; padding: 1rem;
  -webkit-overflow-scrolling: touch;
}
.msg-compose {
  border-top: 1px solid rgba(0,0,0,0.06);
  padding: 0.75rem; background: rgba(255,255,255,0.7);
}
@media (max-width: 767.98px) {
  .msg-layout { flex-direction: column; max-height: none; }
  .msg-contacts {
    width: 100% !important; max-width: 100%; max-height: 160px;
    border-left: none; border-bottom: 1px solid rgba(0,0,0,0.06);
  }
  .msg-thread { min-height: 360px; max-height: 60vh; }
}


/* ========== MOBILE MENU FIX 2026-09-21 ========== */
@media (max-width: 991.98px) {
  .mobile-bar {
    display: flex !important;
    position: sticky;
    top: 0;
    z-index: 1200 !important;
    width: 100%;
    background: #fff !important;
    border-bottom: 1px solid #e0e0e0;
    padding: 0.5rem 0.75rem;
    align-items: center;
    gap: 0.5rem;
  }
  .sidebar-backdrop,
  #sideBackdrop,
  .sidebar-overlay,
  #sidebarOverlay {
    position: fixed !important;
    inset: 0 !important;
    background: rgba(0,0,0,0.35) !important;
    z-index: 1100 !important;
    display: none !important;
    pointer-events: none !important;
  }
  .sidebar-backdrop.show,
  #sideBackdrop.show,
  .sidebar-overlay.show,
  #sidebarOverlay.show {
    display: block !important;
    pointer-events: auto !important;
  }
  .app-sidebar,
  #appSidebar {
    position: fixed !important;
    top: 0 !important;
    right: -100% !important;
    left: auto !important;
    width: min(300px, 88vw) !important;
    height: 100% !important;
    height: 100dvh !important;
    z-index: 1150 !important;
    transition: right 0.25s ease !important;
    pointer-events: auto !important;
    overflow-y: auto !important;
    background: linear-gradient(165deg, #1a1440 0%, #2d1b69 50%, #1e3a5f 100%) !important;
  }
  .app-sidebar.open,
  #appSidebar.open {
    right: 0 !important;
    pointer-events: auto !important;
  }
  body.nav-open {
    overflow: hidden;
  }
  body.nav-open .app-content,
  body.nav-open .app-main-col {
    pointer-events: none;
  }
  body.nav-open .app-sidebar,
  body.nav-open #appSidebar,
  body.nav-open .sidebar-backdrop,
  body.nav-open #sideBackdrop {
    pointer-events: auto !important;
  }
}

/* ===== Mobile nav FIX 2026-09-21 ===== */
body.nav-open { overflow: hidden; }
@media (max-width: 991.98px) {
  .app-shell { display: block !important; }
  .app-sidebar {
    position: fixed !important;
    top: 0 !important;
    right: -100% !important;
    left: auto !important;
    width: min(300px, 88vw) !important;
    height: 100vh !important;
    height: 100dvh !important;
    max-height: 100dvh !important;
    z-index: 1200 !important;
    overflow-y: auto !important;
    -webkit-overflow-scrolling: touch;
    transition: right 0.25s ease !important;
    pointer-events: auto !important;
  }
  .app-sidebar.open {
    right: 0 !important;
  }
  .sidebar-backdrop {
    display: none;
    position: fixed !important;
    inset: 0 !important;
    background: rgba(0,0,0,0.4) !important;
    z-index: 1190 !important;
    pointer-events: auto;
  }
  .sidebar-backdrop.show {
    display: block !important;
  }
  /* backdrop must NOT sit above sidebar */
  .mobile-bar {
    display: flex !important;
    position: sticky;
    top: 0;
    z-index: 1100;
    width: 100%;
    background: #fff;
    padding: 0.5rem 0.75rem;
    border-bottom: 1px solid #eee;
    align-items: center;
    gap: 0.5rem;
  }
  .app-main-col, .app-content {
    width: 100% !important;
    margin: 0 !important;
  }
}
@media (min-width: 992px) {
  .mobile-bar { display: none !important; }
  .sidebar-backdrop { display: none !important; }
  .app-sidebar {
    height: 100vh !important;
    height: 100dvh !important;
    overflow-y: auto !important;
    position: sticky !important;
    top: 0 !important;
  }
}

/* WordPress-like collapsible menu groups */
.app-sidebar nav {
  overflow-y: auto;
  max-height: calc(100vh - 70px);
  max-height: calc(100dvh - 70px);
  padding-bottom: 2rem;
}
.app-sidebar nav details.nav-group {
  margin: 0.15rem 0;
  border: none;
}
.app-sidebar nav details.nav-group > summary {
  list-style: none;
  cursor: pointer;
  padding: 0.55rem 0.85rem;
  color: rgba(255,255,255,0.75);
  font-size: 0.8rem;
  font-weight: 600;
  border-radius: 8px;
  user-select: none;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
}
.app-sidebar nav details.nav-group > summary::-webkit-details-marker { display: none; }
.app-sidebar nav details.nav-group > summary::after {
  content: "▾";
  opacity: 0.6;
  font-size: 0.75rem;
  transition: transform 0.2s;
}
.app-sidebar nav details.nav-group[open] > summary {
  color: #fff;
  background: rgba(255,255,255,0.08);
}
.app-sidebar nav details.nav-group[open] > summary::after {
  transform: rotate(180deg);
}
.app-sidebar nav details.nav-group a {
  padding: 0.4rem 0.85rem 0.4rem 1.5rem !important;
  font-size: 0.88rem !important;
  display: flex !important;
}
.sla-orange { background: #fff3e0 !important; }
.sla-red { background: #ffebee !important; }
.sla-reclaim { background: #f3e5f5 !important; }

/* ===== Fullscreen mobile menu + glass + sticky footer 2026-09-21b ===== */
.btn-menu-glass {
  background: rgba(255,255,255,0.35) !important;
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border: 1px solid rgba(255,255,255,0.55) !important;
  box-shadow: 0 8px 24px rgba(124,77,255,0.25);
  color: #5e35b1 !important;
  border-radius: 14px !important;
  width: 44px; height: 44px;
  display: inline-flex; align-items: center; justify-content: center;
  font-size: 1.35rem;
}
.btn-menu-glass:hover { background: rgba(255,255,255,0.55) !important; color: #7c4dff !important; }

@media (max-width: 991.98px) {
  .app-sidebar {
    position: fixed !important;
    top: 0 !important;
    right: -100% !important;
    width: 100% !important;
    max-width: 100% !important;
    height: 100vh !important;
    height: 100dvh !important;
    z-index: 1200 !important;
    border-radius: 0 !important;
    transition: right 0.28s ease !important;
  }
  .app-sidebar.open { right: 0 !important; }
  .app-sidebar .brand { padding: 1rem 1.25rem; }
  .mobile-bar {
    display: flex !important;
    position: sticky; top: 0; z-index: 1100;
    width: 100%;
    background: linear-gradient(135deg, rgba(124,77,255,0.12), rgba(0,229,255,0.1));
    backdrop-filter: blur(12px);
    padding: 0.6rem 0.9rem;
    align-items: center; gap: 0.75rem;
    border-bottom: 1px solid rgba(124,77,255,0.15);
  }
  .mobile-bar .mobile-title { font-weight: 700; color: #5e35b1; }
  .sidebar-close-btn {
    margin-right: auto;
    background: rgba(255,255,255,0.25);
    border: 1px solid rgba(255,255,255,0.4);
    border-radius: 12px;
    width: 40px; height: 40px;
    color: #fff;
  }
}

/* Sticky footer — content grows, footer always bottom */
html, body { height: 100%; min-height: 100%; }
body { display: flex; flex-direction: column; min-height: 100vh; min-height: 100dvh; }
.app-shell { flex: 1 0 auto; display: flex; min-height: 0; width: 100%; }
.app-main-col {
  flex: 1;
  display: flex !important;
  flex-direction: column !important;
  min-height: 100vh;
  min-height: 100dvh;
  min-width: 0;
}
.app-content {
  flex: 1 0 auto !important;
  width: 100%;
  padding-bottom: 1.5rem;
}
.app-footer {
  flex-shrink: 0 !important;
  margin-top: auto !important;
  position: relative !important;
  bottom: auto !important;
  width: 100%;
  z-index: 5;
}

/* Tabs for customer file */
.crm-tabs { display: flex; flex-wrap: wrap; gap: 0.35rem; margin-bottom: 1rem; }
.crm-tabs .tab-btn {
  border: 1px solid rgba(124,77,255,0.2);
  background: rgba(255,255,255,0.6);
  border-radius: 20px;
  padding: 0.4rem 0.9rem;
  font-size: 0.88rem;
  cursor: pointer;
  color: #444;
}
.crm-tabs .tab-btn.active {
  background: linear-gradient(135deg, #7c4dff, #5e35b1);
  color: #fff;
  border-color: transparent;
}
.crm-tab-pane { display: none; }
.crm-tab-pane.active { display: block; }

/* AJAX search results */
.ajax-suggest {
  position: absolute; z-index: 50; left: 0; right: 0;
  background: #fff; border: 1px solid #ddd; border-radius: 10px;
  max-height: 220px; overflow-y: auto; box-shadow: 0 8px 24px rgba(0,0,0,0.12);
}
.ajax-suggest .item {
  padding: 0.55rem 0.75rem; cursor: pointer; border-bottom: 1px solid #f0f0f0;
}
.ajax-suggest .item:hover { background: #f5f0ff; }

/* ===== Simple / Performance mode ===== */
body.simple-ui {
  background: #f0f2f5 !important;
  background-attachment: scroll !important;
}
body.simple-ui * {
  backdrop-filter: none !important;
  -webkit-backdrop-filter: none !important;
  box-shadow: none !important;
  text-shadow: none !important;
  transition: none !important;
  animation: none !important;
}
body.simple-ui .app-sidebar {
  background: #1e293b !important;
  border: none !important;
}
body.simple-ui .card,
body.simple-ui .app-content .card,
body.simple-ui .login-card {
  background: #fff !important;
  border: 1px solid #dee2e6 !important;
  border-radius: 6px !important;
}
body.simple-ui .app-footer {
  background: #fff !important;
  border-top: 1px solid #dee2e6 !important;
}
body.simple-ui .btn-menu-glass {
  background: #5e35b1 !important;
  color: #fff !important;
  border: none !important;
  border-radius: 8px !important;
}
body.simple-ui .mobile-bar {
  background: #fff !important;
  border-bottom: 1px solid #ddd !important;
}
body.simple-ui .app-sidebar nav a.active {
  background: #334155 !important;
}
body.simple-ui .crm-tabs .tab-btn.active {
  background: #5e35b1 !important;
}
body.simple-ui .sidebar-backdrop {
  background: rgba(0,0,0,0.35) !important;
}


/* ===== FINAL mobile menu 2026-09-22 — overrides all ===== */
@media (max-width: 991.98px) {
  #appSidebar.app-sidebar {
    position: fixed !important;
    top: 0 !important;
    bottom: 0 !important;
    right: 0 !important;
    left: auto !important;
    width: min(300px, 88vw) !important;
    max-width: 300px !important;
    height: 100vh !important;
    height: 100dvh !important;
    z-index: 10050 !important;
    transform: translateX(105%) !important;
    transition: transform 0.28s ease !important;
    overflow-y: auto !important;
    -webkit-overflow-scrolling: touch;
    pointer-events: auto !important;
    visibility: visible !important;
  }
  #appSidebar.app-sidebar.open {
    transform: translateX(0) !important;
    right: 0 !important;
  }
  #sideBackdrop.sidebar-backdrop {
    display: none;
    position: fixed !important;
    inset: 0 !important;
    z-index: 10040 !important;
    background: rgba(0,0,0,0.45) !important;
    pointer-events: auto !important;
  }
  #sideBackdrop.sidebar-backdrop.show {
    display: block !important;
  }
  .mobile-bar {
    display: flex !important;
    position: sticky;
    top: 0;
    z-index: 10030;
  }
  #btnOpenMenu {
    pointer-events: auto !important;
    z-index: 10031;
    position: relative;
    min-width: 44px;
    min-height: 44px;
  }
}


/* قیف فروش — ریسپانسیو */
.pipeline-board {
  display: grid !important;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 0.75rem;
  overflow-x: visible !important;
  width: 100%;
  max-width: 100%;
}
.pipeline-board > div,
.pipeline-board .pipeline-col {
  width: 100% !important;
  min-width: 0 !important;
  flex-shrink: 1 !important;
}
.pipeline-board .card-body {
  max-height: 50vh;
}
@media (max-width: 576px) {
  .pipeline-board {
    grid-template-columns: 1fr;
  }
  .pipeline-board .card-body {
    max-height: none;
  }
}
@media (min-width: 577px) and (max-width: 992px) {
  .pipeline-board {
    grid-template-columns: repeat(2, 1fr);
  }
}
@media (min-width: 993px) and (max-width: 1400px) {
  .pipeline-board {
    grid-template-columns: repeat(3, 1fr);
  }
}
@media (min-width: 1401px) {
  .pipeline-board {
    grid-template-columns: repeat(4, 1fr);
  }
}


/* اطمینان از کار جمع‌شدن سایدبار */
.app-shell.sidebar-collapsed .app-sidebar {
  width: 72px !important;
  min-width: 72px !important;
}
.app-shell.sidebar-collapsed .app-sidebar .brand-text,
.app-shell.sidebar-collapsed .app-sidebar nav a span,
.app-shell.sidebar-collapsed .app-sidebar nav summary span,
.app-shell.sidebar-collapsed .app-sidebar .nav-section-title {
  display: none !important;
}
.app-shell.sidebar-collapsed .app-main-col {
  margin-inline-start: 0 !important;
}
.btn-collapse-side {
  cursor: pointer;
  border: none;
  background: transparent;
  color: inherit;
  padding: 0.35rem 0.5rem;
  z-index: 5;
  position: relative;
}

.pipeline-progress .badge { font-weight:500;font-size:.75rem }
.pipeline-progress{line-height:1.8}
