/*
  ISP-CRM shell theme
  Target: WHMCS + Chatwoot inspired layout from user reference
*/

:root{
  --page-bg: #020617;
  --page-bg-2: #0b1120;
  --surface: rgba(2, 6, 23, 0.84);
  --surface-2: rgba(15, 23, 42, 0.94);
  --surface-card: var(--surface-2);
  --surface-card: var(--surface-2);
  --surface-soft: rgba(3, 7, 18, 0.9);
  --sidebar-bg: rgba(2, 6, 23, 0.9);
  --sidebar-border: rgba(255, 255, 255, 0.08);
  --text-main: #f8fafc;
  --text-muted: #94a3b8;
  --stroke: rgba(255, 255, 255, 0.08);
  --brand: #3b82f6;
  --brand-strong: #60a5fa;
  --brand-soft: rgba(59, 130, 246, 0.2);
  --success: #00e676;
  --danger: #ff1744;
  --radius: 28px;
  /* 3D Depth Shadows */
  --shadow-soft:
    0 24px 48px -12px rgba(0, 0, 0, 0.6),
    inset 0 2px 4px rgba(255, 255, 255, 0.05),
    inset 0 -2px 6px rgba(0, 0, 0, 0.28);
  --shadow-card:
    0 16px 32px -8px rgba(0, 0, 0, 0.5),
    inset 0 1px 2px rgba(255, 255, 255, 0.04);
  --shadow-3d:
    0 15px 35px rgba(0,0,0,0.62),
    inset 0 -4px 4px rgba(0,0,0,0.32),
    inset 0 2px 4px rgba(255,255,255,0.04);
  --transition: all 0.35s cubic-bezier(0.25, 1, 0.35, 1);
  --shell-pad: 24px;
  --sidebar-w: 320px;
}

body[data-theme="light"]{
  --page-bg: #eaf2fb;
  --page-bg-2: #dfeaf8;
  --surface: rgba(255, 255, 255, 0.65);
  --surface-2: rgba(255, 255, 255, 0.85);
  --surface-card: var(--surface-2);
  --surface-soft: rgba(241, 246, 253, 0.75);
  --sidebar-bg: rgba(247, 251, 255, 0.65);
  --sidebar-border: rgba(255, 255, 255, 0.8);
  --text-main: #0B192C;
  --text-muted: #5e6f85;
  --stroke: rgba(255, 255, 255, 0.7);
  --brand: #0070FF;
  --brand-strong: #004FFF;
  --brand-soft: rgba(0, 112, 255, 0.15);
  --shadow-soft:
    0 24px 48px -12px rgba(0, 112, 255, 0.15),
    inset 0 2px 4px rgba(255, 255, 255, 0.9),
    inset 0 -2px 6px rgba(0, 112, 255, 0.05);
  --shadow-card:
    0 16px 32px -8px rgba(0, 112, 255, 0.1),
    inset 0 1px 2px rgba(255, 255, 255, 0.9);
  --shadow-3d:
    0 10px 20px rgba(0,0,0,0.1),
    0 6px 6px rgba(0,0,0,0.05),
    inset 0 -4px 4px rgba(0,0,0,0.05),
    inset 0 2px 4px rgba(255,255,255,0.8);
}

body[data-theme="dark"]{
  --page-bg: #020617;
  --page-bg-2: #0b1120;
  --surface: rgba(2, 6, 23, 0.84);
  --surface-2: rgba(15, 23, 42, 0.94);
  --surface-soft: rgba(3, 7, 18, 0.9);
  --sidebar-bg: rgba(2, 6, 23, 0.9);
  --sidebar-border: rgba(255, 255, 255, 0.08);
  --text-main: #f8fafc;
  --text-muted: #94a3b8;
  --stroke: rgba(255, 255, 255, 0.08);
  --brand: #3b82f6;
  --brand-strong: #60a5fa;
  --brand-soft: rgba(59, 130, 246, 0.2);
}

html,
body{
  height:100%;
  overflow-x:hidden;
}

*{
  box-sizing:border-box;
  -webkit-tap-highlight-color:transparent;
}

body{
  margin:0;
  font-family:Inter,system-ui,-apple-system,Segoe UI,Roboto,Arial,sans-serif;
  color:var(--text-main);
  background:
    radial-gradient(ellipse at 15% 50%, rgba(0, 112, 255, 0.15) 0%, transparent 50%),
    radial-gradient(ellipse at 85% 30%, rgba(0, 230, 118, 0.1) 0%, transparent 50%),
    linear-gradient(135deg, var(--page-bg) 0%, var(--page-bg-2) 100%);
  background-size: 200% 200%;
  animation: bgShift 25s ease infinite alternate;
  transition:var(--transition);
  perspective: 1500px;
}

@keyframes bgShift {
  0% { background-position: 0% 50%; }
  100% { background-position: 100% 50%; }
}

html[dir="rtl"] body{
  font-family:Cairo,Assistant,Inter,system-ui,-apple-system,Segoe UI,Roboto,Arial,sans-serif;
}

::selection{background:rgba(24,144,243,.24);}

.app-shell{
  min-height:100vh;
  padding:var(--shell-pad);
}

.sidebar{
  position:fixed;
  inset-block:var(--shell-pad);
  width:var(--sidebar-w);
  z-index:120;
}

html[dir="ltr"] .sidebar{left:var(--shell-pad);right:auto;}
html[dir="rtl"] .sidebar{right:var(--shell-pad);left:auto;}

#sidebarRoot > .glass{
  height:100%;
  border-radius:32px;
  border:1px solid var(--sidebar-border);
  background:var(--sidebar-bg);
  box-shadow:var(--shadow-soft);
  color:var(--text-main);
  backdrop-filter:blur(24px);
  -webkit-backdrop-filter:blur(24px);
  transform-style: preserve-3d;
  transition: var(--transition);
}

#sidebarRoot > .glass:hover {
  box-shadow: 
    8px 24px 48px -12px rgba(0, 112, 255, 0.2),
    inset 0 2px 4px rgba(255, 255, 255, 0.9),
    inset 0 -2px 6px rgba(0, 112, 255, 0.05);
}

.main-content{
  margin-inline-start:calc(var(--sidebar-w) + (var(--shell-pad) * 2));
  margin-inline-end:var(--shell-pad);
  min-height:calc(100vh - (var(--shell-pad) * 2));
  padding:0 !important;
}

html[dir="ltr"] .main-content{
  margin-left:calc(var(--sidebar-w) + (var(--shell-pad) * 2));
  margin-right:var(--shell-pad);
}

html[dir="rtl"] .main-content{
  margin-right:calc(var(--sidebar-w) + (var(--shell-pad) * 2));
  margin-left:var(--shell-pad);
}

.topbar{
  position:sticky;
  top:0;
  z-index:55;
  margin-bottom:16px !important;
}

.topbar > .glass{
  border-radius:24px;
  border:1px solid var(--stroke);
  background:rgba(255,255,255,.65);
  box-shadow:var(--shadow-card);
  backdrop-filter:blur(20px);
  -webkit-backdrop-filter:blur(20px);
  transform: translateZ(20px);
}

body[data-theme="dark"] .topbar > .glass{
  background:rgba(15,23,42,.65);
}

.glass,
.isp-glass,
.glass2,
.isp-glass2{
  background:var(--surface);
  border:1px solid var(--stroke);
  backdrop-filter:blur(20px);
  -webkit-backdrop-filter:blur(20px);
  border-radius:var(--radius);
  box-shadow:var(--shadow-card);
  transition:var(--transition);
  transform-style: preserve-3d;
}

.glass:hover, .glass2:hover {
  transform: translateY(-4px) translateZ(10px) rotateX(1deg);
  box-shadow: var(--shadow-soft);
}

.main-content > *{
  animation:fadeInUp .42s ease both;
}

.main-content > *:nth-child(2){animation-delay:.05s;}
.main-content > *:nth-child(3){animation-delay:.10s;}
.main-content > *:nth-child(4){animation-delay:.15s;}

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

.btn,
.btn-soft,
.isp-btn-soft,
.btn-primary,
.isp-btn-primary{
  border-radius:14px !important;
  transition:var(--transition);
  position: relative;
  overflow: hidden;
  font-weight: 600;
  transform-style: preserve-3d;
  will-change: transform;
}

.btn-soft,
.isp-btn-soft{
  background:var(--surface-2);
  border:1px solid var(--stroke);
  color:var(--text-main);
  box-shadow:
    0 4px 10px rgba(0,0,0,0.04),
    inset 0 2px 2px rgba(255,255,255,0.8);
}

.btn-soft:hover,
.isp-btn-soft:hover{
  transform:translateY(-2px) translateZ(5px);
  border-color:var(--brand);
  box-shadow:
    0 8px 20px rgba(0, 112, 255, 0.15),
    inset 0 2px 2px rgba(255,255,255,0.8);
  color: var(--brand);
}

.btn-soft:active {
  transform:translateY(1px) translateZ(0);
  box-shadow: inset 0 3px 6px rgba(0,0,0,0.1);
}

.btn-primary,
.isp-btn-primary{
  color:#fff;
  border:none;
  background:linear-gradient(135deg, var(--brand), var(--brand-strong));
  box-shadow:
    0 10px 24px rgba(0, 112, 255, 0.35),
    inset 0 2px 2px rgba(255,255,255,0.4),
    inset 0 -2px 4px rgba(0,0,0,0.2);
}

.btn-primary:after {
  content: '';
  position: absolute;
  top: 0; left: -100%;
  width: 50%; height: 100%;
  background: linear-gradient(to right, transparent, rgba(255,255,255,0.3), transparent);
  transform: skewX(-20deg);
  transition: var(--transition);
}

.btn-primary:hover {
  transform: translateY(-3px) translateZ(10px);
  box-shadow:
    0 16px 32px rgba(0, 112, 255, 0.45),
    inset 0 2px 2px rgba(255,255,255,0.5),
    inset 0 -2px 4px rgba(0,0,0,0.2);
}

.btn-primary:hover:after {
  left: 200%;
  transition: 0.7s;
}

.btn-primary:active {
  transform: translateY(2px) translateZ(0);
  box-shadow: inset 0 4px 8px rgba(0,0,0,0.3);
}

.badge-soft,
.isp-badge-soft{
  background:var(--surface-soft);
  border:1px solid var(--stroke);
  color:inherit;
}

#sidebarRoot .btn-soft,
#sidebarRoot .form-control,
#sidebarRoot .search{
  background:var(--surface-2);
  border-color:var(--stroke);
  color:var(--text-main);
}

#sidebarRoot .search::placeholder,
#sidebarRoot .muted,
#sidebarRoot .small{
  color:var(--text-muted);
}

.brand-badge{
  width:42px;
  height:42px;
  border-radius:14px;
  display:grid;
  place-items:center;
  background:linear-gradient(135deg, #27a2ff, #0e76de);
  border:1px solid rgba(13,109,216,.38);
  color:#fff;
}

.navgroup,
.navlink{
  color:var(--text-main);
  border-radius:12px;
  transition:var(--transition);
}

.navgroup{
  display:flex;
  align-items:center;
  justify-content:space-between;
  width:100%;
  border:none;
  background:transparent;
  padding:10px 12px;
}

.navgroup:hover{
  background:var(--surface-soft);
}

.navgroup .chev,
.sidebar-chevron{
  color:var(--text-muted);
  transition:var(--transition);
}

.navlink{
  display:flex;
  align-items:center;
  gap:12px;
  text-decoration:none;
  padding:12px 14px;
  border:1px solid transparent;
  transform-style: preserve-3d;
  position: relative;
  overflow: hidden;
}

.navlink:hover{
  background:var(--surface-soft);
  transform:translateX(5px) translateZ(10px);
  box-shadow: -4px 4px 12px rgba(0, 112, 255, 0.08);
  border-left: 3px solid var(--brand);
}

html[dir="rtl"] .navlink:hover{transform:translateX(-5px) translateZ(10px); border-right: 3px solid var(--brand); border-left: none;}

.navlink.active,
.navlink.is-active{
  background: linear-gradient(135deg, var(--brand-soft) 0%, rgba(0, 112, 255, 0.05) 100%);
  border-color:rgba(0, 112, 255, 0.3);
  color:var(--brand-strong) !important;
  font-weight:700;
  box-shadow: var(--shadow-3d);
  transform: scale(1.02) translateZ(5px);
}

.sidebar-block .sidebar-group-items{display:block;}
.sidebar-block.is-collapsed .sidebar-group-items{display:none;}
.sidebar-block.is-collapsed .sidebar-chevron{transform:rotate(-90deg);}
html[dir="rtl"] .sidebar-block.is-collapsed .sidebar-chevron{transform:rotate(90deg);}

.isp-hidden{display:none !important;}

#sidebarRoot.isp-collapsed{width:96px !important;}
#sidebarRoot.isp-collapsed .sidebar-label,
#sidebarRoot.isp-collapsed .sidebar-group,
#sidebarRoot.isp-collapsed .sidebar-group-btn,
#sidebarRoot.isp-collapsed .sidebar-more{display:none !important;}
#sidebarRoot.isp-collapsed .navlink{justify-content:center;}
#sidebarRoot.isp-collapsed .sidebar-search-wrap{display:none !important;}

.search,
.form-control.search,
.form-control,
.form-select{
  background:var(--surface-2);
  border:1px solid var(--stroke);
  color:var(--text-main);
  border-radius:16px;
  padding: 12px 16px;
  box-shadow: inset 0 2px 4px rgba(0,0,0,0.02);
  transition: var(--transition);
  font-weight: 500;
  transform-style: preserve-3d;
}

.search:hover,
.form-control:hover,
.form-select:hover {
  background: var(--surface);
  transform: translateZ(2px);
}

.search:focus,
.form-control:focus,
.form-select:focus{
  background: var(--surface-2);
  border-color:var(--brand);
  box-shadow: 
    0 0 0 4px rgba(0, 112, 255, 0.15),
    inset 0 2px 4px rgba(0,0,0,0.02);
  transform: translateY(-2px) translateZ(5px);
}

.input-group-text{
  border:1px solid var(--stroke);
  border-inline-end:0;
  background:var(--surface-2);
  color:var(--text-muted);
  border-radius: 16px 0 0 16px;
  padding: 12px 16px;
}

.dropdown-menu{
  border-radius:14px;
  border:1px solid var(--stroke);
  background:var(--surface-2);
  color:var(--text-main);
  backdrop-filter:blur(12px);
  box-shadow:var(--shadow-card);
}

.dropdown-item{color:var(--text-main);}
.dropdown-item:hover{background:var(--surface-soft);}

.main-content .bg-white,
.main-content .bg-black,
.main-content .bg-slate-50,
.main-content .bg-slate-100,
.main-content .bg-slate-900,
.main-content .bg-slate-950,
.main-content .bg-slate-950\/50{
  background:var(--surface-card, var(--surface-2));
  color:var(--text-main);
  border-color:var(--stroke);
}

.main-content .bg-black\/40,
.main-content .bg-black\/60{
  background:rgba(15,23,42,.42) !important;
}

.main-content .text-white,
.main-content .text-slate-100,
.main-content .text-slate-200,
.main-content .text-slate-700,
.main-content .text-slate-800,
.main-content .text-slate-900{
  color:var(--text-main) !important;
}

.main-content .text-slate-400,
.main-content .text-slate-500,
.main-content .text-slate-600{
  color:var(--text-muted) !important;
}

.main-content input,
.main-content select,
.main-content textarea,
.main-content button.border,
.main-content .form-control,
.main-content .form-select,
.main-content .search{
  background:var(--surface-card, var(--surface-2));
  color:var(--text-main);
  border-color:var(--stroke);
}

.main-content input::placeholder,
.main-content textarea::placeholder,
.main-content .search::placeholder{
  color:var(--text-muted) !important;
}

.main-content .shadow-sm,
.main-content .shadow,
.main-content .shadow-md,
.main-content .shadow-lg {
  box-shadow: var(--shadow-card) !important;
}

.main-content .shadow-soft{box-shadow:var(--shadow-card) !important;}

.table{
  color:var(--text-main);
  border-collapse: separate;
  border-spacing: 0 8px;
  background: transparent !important;
}

.table thead th{
  background:var(--surface-soft);
  border:none;
  font-weight: 700;
  text-transform: uppercase;
  font-size: 11px;
  letter-spacing: 0.05em;
  color: var(--text-muted);
  padding: 16px;
}

.table thead th:first-child { border-radius: 12px 0 0 12px; }
.table thead th:last-child { border-radius: 0 12px 12px 0; }
html[dir="rtl"] .table thead th:first-child { border-radius: 0 12px 12px 0; }
html[dir="rtl"] .table thead th:last-child { border-radius: 12px 0 0 12px; }

.table tbody tr {
  background: var(--surface-2);
  box-shadow: 0 2px 8px rgba(0, 112, 255, 0.04), inset 0 1px 1px rgba(255, 255, 255, 0.8);
  transition: var(--transition);
  transform-style: preserve-3d;
}

.table tbody tr:hover {
  transform: translateY(-2px) translateZ(8px) scale(1.005);
  box-shadow: 0 8px 16px rgba(0, 112, 255, 0.08), inset 0 1px 1px rgba(255, 255, 255, 0.8);
  background: var(--surface-soft);
}

.table td{
  border:none !important;
  padding: 16px;
  vertical-align: middle;
}

.table tbody td:first-child { border-radius: 16px 0 0 16px; }
.table tbody td:last-child { border-radius: 0 16px 16px 0; }
html[dir="rtl"] .table tbody td:first-child { border-radius: 0 16px 16px 0; }
html[dir="rtl"] .table tbody td:last-child { border-radius: 16px 0 0 16px; }

.main-content table.min-w-full thead th,
.main-content table.min-w-full tbody td{
  text-align:center !important;
  vertical-align:middle;
}

.main-content table.min-w-full tbody td:last-child .flex{justify-content:center !important;}

#modal{backdrop-filter:blur(7px);}

.backdrop{
  display:none;
  position:fixed;
  inset:0;
  background:rgba(5,16,30,.48);
  backdrop-filter:blur(4px);
  z-index:95;
}

.backdrop.show{display:block;}

/* Dashboard page */
.dashboard-shell{
  display:flex;
  flex-direction:column;
  gap:18px;
}

.dashboard-header{
  display:flex;
  justify-content:space-between;
  align-items:flex-start;
  gap:12px;
}

.dashboard-title{
  margin:0;
  font-size:48px;
  line-height:1;
  font-weight:800;
  letter-spacing:-.03em;
  color:var(--text-main);
}

.dashboard-subtitle{
  margin-top:7px;
  font-size:14px;
  color:var(--text-muted);
}

.dashboard-meta-line{
  display:flex;
  flex-wrap:wrap;
  gap:8px;
  margin-top:12px;
}

.dashboard-role-pill,
.dashboard-mini-pill{
  display:inline-flex;
  align-items:center;
  justify-content:center;
  min-height:32px;
  padding:0 12px;
  border-radius:999px;
  border:1px solid var(--stroke);
  background:var(--surface-2);
  color:var(--text-main);
  font-size:12px;
  font-weight:700;
  box-shadow:var(--shadow-card);
}

.dashboard-role-pill{
  border-color:rgba(24,144,243,.25);
  background:rgba(24,144,243,.08);
}

.dashboard-actions{
  display:flex;
  flex-wrap:wrap;
  gap:9px;
}

.dashboard-group{
  display:flex;
  flex-direction:column;
  gap:16px;
}

.dashboard-group-head{
  display:flex;
  align-items:flex-start;
  justify-content:space-between;
  gap:12px;
}

.dashboard-group-title{
  margin:0;
  font-size:28px;
  line-height:1.15;
  font-weight:800;
  color:var(--text-main);
}

.dashboard-group-subtitle{
  margin-top:6px;
  font-size:12px;
  color:var(--text-muted);
}

.dashboard-kpis{
  display:grid;
  grid-template-columns:repeat(auto-fit, minmax(230px, 1fr));
  gap:18px;
}

.dashboard-kpi{
  display:block;
  text-decoration:none;
  color:var(--text-main);
  background:var(--surface-2);
  border:1px solid var(--stroke);
  border-radius:28px;
  padding:28px;
  min-height:140px;
  box-shadow:var(--shadow-card);
  transition:var(--transition);
  transform-style: preserve-3d;
  position: relative;
  overflow: hidden;
  backdrop-filter: blur(20px);
}

.dashboard-kpi::before {
  content: '';
  position: absolute;
  top: -50%; left: -50%;
  width: 200%; height: 200%;
  background: radial-gradient(circle, rgba(255,255,255,0.4) 0%, transparent 60%);
  opacity: 0;
  transition: opacity 0.4s ease;
  pointer-events: none;
  transform: translateZ(1px);
}
body[data-theme="dark"] .dashboard-kpi::before {
  background: radial-gradient(circle, rgba(59,130,246,0.15) 0%, transparent 60%);
}

.dashboard-kpi:hover{
  transform:translateY(-8px) translateZ(30px) rotateX(4deg) rotateY(-2deg);
  border-color:var(--brand);
  box-shadow: var(--shadow-3d), 0 25px 50px -12px rgba(0, 112, 255, 0.25);
}

.dashboard-kpi:hover::before {
  opacity: 1;
}

.dashboard-kpi-label{
  font-size:13px;
  color:var(--text-muted);
  font-weight:600;
  margin-bottom:18px;
}

.dashboard-kpi-row{
  display:flex;
  align-items:flex-end;
  justify-content:space-between;
  gap:10px;
}

.dashboard-kpi-value{
  font-size:42px;
  line-height:1;
  font-weight:800;
  color:var(--text-main);
}

.dashboard-kpi-pill{
  font-size:11px;
  min-width:28px;
  height:24px;
  padding:0 8px;
  border-radius:999px;
  border:1px solid rgba(24,144,243,.26);
  background:#e8f4ff;
  color:#1379de;
  font-weight:700;
  display:inline-flex;
  align-items:center;
  justify-content:center;
}

.dashboard-panels{
  display:grid;
  grid-template-columns:repeat(3, minmax(0, 1fr));
  gap:18px;
}

.dashboard-panel-wrap.dashboard-span-2{grid-column:span 2;}
.dashboard-panel-wrap.dashboard-span-1{grid-column:span 1;}

.dashboard-panel{
  background:var(--surface-2);
  border:1px solid var(--stroke);
  border-radius:32px;
  padding:28px;
  box-shadow:var(--shadow-card);
  min-height:100%;
  transform-style: preserve-3d;
  transition: var(--transition);
  backdrop-filter: blur(20px);
}

.dashboard-panel:hover {
  transform: translateZ(15px);
  box-shadow: var(--shadow-soft);
}

.dashboard-panel-head{
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:10px;
}

.dashboard-panel-title{
  margin:0;
  font-size:33px;
  font-weight:800;
  letter-spacing:-.02em;
  color:var(--text-main);
}

.dashboard-panel-hint,
.dashboard-system-version,
.dashboard-module-hint{
  font-size:12px;
  color:var(--text-muted);
}

.dashboard-chart{
  margin-top:14px;
  min-height:280px;
  border-radius:24px;
  border:1px solid rgba(148,163,184,.30);
  background:
    linear-gradient(to right, rgba(0, 112, 255, 0.08) 1px, transparent 1px),
    linear-gradient(to bottom, rgba(0, 112, 255, 0.08) 1px, transparent 1px),
    linear-gradient(135deg, rgba(255,255,255,.70), rgba(255,255,255,.40));
  background-size:50px 50px,50px 50px,100% 100%;
  display:flex;
  align-items:center;
  justify-content:center;
  text-align:center;
  padding:14px;
  color:#8c9db2;
  font-size:14px;
  font-weight: 600;
  box-shadow: inset 0 4px 12px rgba(0,0,0,0.03);
  transform-style: preserve-3d;
}

.dashboard-chart:hover {
  transform: translateZ(5px);
}

body[data-theme="dark"] .dashboard-chart{
  background:
    linear-gradient(to right, rgba(59,130,246,.1) 1px, transparent 1px),
    linear-gradient(to bottom, rgba(59,130,246,.1) 1px, transparent 1px),
    linear-gradient(135deg, rgba(15,23,42,.65), rgba(15,23,42,.35));
  box-shadow: inset 0 4px 12px rgba(0,0,0,0.3);
}

.dashboard-system-list,
.dashboard-module-links{
  margin-top:14px;
  display:flex;
  flex-direction:column;
  gap:10px;
}

.dashboard-system-item,
.dashboard-module-link{
  border:1px solid rgba(148,163,184,.32);
  background:var(--surface-soft);
  border-radius:14px;
  padding:12px 14px;
}

.dashboard-system-item-label{
  font-size:12px;
  color:var(--text-muted);
}

.dashboard-system-item-value{
  margin-top:4px;
  font-size:14px;
  font-weight:700;
}

.dashboard-module-link{
  display:flex;
  align-items:center;
  min-height:42px;
  text-decoration:none;
  color:var(--text-main);
  font-size:14px;
  font-weight:600;
  transition:var(--transition);
}

.dashboard-module-link:hover{
  border-color:rgba(24,144,243,.36);
  color:var(--brand-strong);
}

.dashboard-edit-hint{
  margin-top:8px;
  font-size:12px;
  color:var(--text-muted);
}

.dashboard-edit-hint a{
  color:var(--brand-strong);
}

.lang-popup{
  position:fixed;
  inset:0;
  display:none;
  align-items:center;
  justify-content:center;
  padding:16px;
  background:rgba(5,16,30,.56);
  backdrop-filter:blur(6px);
  z-index:130;
}

.lang-popup.active{display:flex;}

.lang-popup-card{
  width:min(360px,100%);
  padding:22px;
  border-radius:24px;
  background:var(--surface-2);
  border:1px solid var(--stroke);
}

.lang-popup-title{
  font-size:20px;
  font-weight:800;
  letter-spacing:-.02em;
  margin-bottom:2px;
}

.lang-popup-sub{
  font-size:13px;
  color:var(--text-muted);
  margin-bottom:14px;
}

.lang-popup-actions{display:flex;flex-direction:column;gap:10px;}

.lang-popup-btn{
  text-decoration:none;
  color:var(--text-main);
  border:1px solid var(--stroke);
  background:var(--surface-2);
  border-radius:12px;
  padding:11px 14px;
  font-weight:600;
  transition:var(--transition);
}

.lang-popup-btn:hover{
  transform:translateY(-1px);
  border-color:rgba(24,144,243,.38);
}

@media (max-width: 1360px){
  :root{--sidebar-w:300px;}
  .dashboard-title{font-size:42px;}
}

@media (max-width: 1180px){
  .dashboard-panels{grid-template-columns:repeat(2,minmax(0,1fr));}
  .dashboard-panel-wrap.dashboard-span-2{grid-column:span 2;}
}

@media (max-width: 991px){
  .app-shell{padding:0 !important;}

  .main-content{
    margin:0 !important;
    min-height:100vh;
    padding:10px !important;
  }

  .sidebar{
    inset:0 auto 0 0;
    width:min(92vw,330px);
    transform:translateX(-110%);
    transition:var(--transition);
  }

  html[dir="rtl"] .sidebar{
    inset:0 0 0 auto;
    transform:translateX(110%);
  }

  #sidebarRoot.open{
    transform:translateX(0) !important;
    z-index:125;
  }

  #sidebarRoot.isp-collapsed{width:min(92vw,330px) !important;}
  #sidebarRoot.isp-collapsed .sidebar-label{display:inline !important;}
  #sidebarRoot.isp-collapsed .sidebar-group{display:inline !important;}
  #sidebarRoot.isp-collapsed .sidebar-group-btn{display:flex !important;}
  #sidebarRoot.isp-collapsed .sidebar-more{display:block !important;}

  .dashboard-header{flex-direction:column;align-items:stretch;}
  .dashboard-title{font-size:34px;}
  .dashboard-panels{grid-template-columns:1fr;}
  .dashboard-panel-wrap.dashboard-span-2,
  .dashboard-panel-wrap.dashboard-span-1{grid-column:span 1;}
}

@media (max-width: 768px){
  .topbar .glass{padding:12px !important;}
  #themeToggleBtn span,
  button[onclick="ISPCRM.openLangPopup()"] span{display:none !important;}
  .btn,
  .btn-soft,
  .btn-primary{min-height:42px;}
  .dashboard-kpi-value{font-size:34px;}
  .dashboard-panel-title{font-size:28px;}
}

@media (max-width: 575px){
  .topbar .glass{flex-wrap:wrap;gap:10px !important;}
  .topbar .glass > .d-flex:first-child,
  .topbar .glass > .d-flex:last-child{width:100%;}
  .topbar .glass > .d-flex:last-child{justify-content:space-between;}
}

/* Keep legacy teal utility classes used around pages */
.bg-teal-700{background-color:var(--brand) !important;}
.bg-teal-800{background-color:var(--brand-strong) !important;}
.hover\:bg-teal-800:hover{background-color:var(--brand-strong) !important;}
.bg-teal-50{background-color:rgba(24,144,243,.10) !important;}
.text-teal-700{color:var(--brand-strong) !important;}

/* Dashboard quick edit */
.dashboard-quickbar{
  position:sticky;
  top:10px;
  z-index:20;
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:12px;
  padding:12px 16px;
  background:rgba(255,255,255,.86);
  border:1px solid rgba(148,163,184,.25);
  border-radius:22px;
  box-shadow:var(--shadow-card);
  backdrop-filter:blur(12px);
}

.dashboard-quickbar-main{
  display:flex;
  align-items:center;
  gap:10px;
  flex-wrap:wrap;
}

.dashboard-quickbar-status{
  font-size:12px;
  color:var(--text-muted);
  font-weight:700;
}

.dashboard-quickbar-status.is-ok{color:#0f9f62;}
.dashboard-quickbar-status.is-error{color:#d7263d;}
.dashboard-quickbar-status.is-busy{color:var(--brand-strong);}

.dashboard-section-tools{
  display:none;
  align-items:center;
  gap:8px;
}

.dashboard-edit-mode .dashboard-section-tools{display:flex;}

.dashboard-tool-btn,
.dashboard-card-drag{
  width:34px;
  height:34px;
  border-radius:12px;
  border:1px solid rgba(148,163,184,.28);
  background:var(--surface-2);
  color:var(--text-muted);
  display:inline-flex;
  align-items:center;
  justify-content:center;
  font-weight:800;
  cursor:grab;
  transition:var(--transition);
}

.dashboard-tool-btn:hover,
.dashboard-card-drag:hover{
  border-color:rgba(24,144,243,.34);
  color:var(--brand-strong);
}

.dashboard-card-drag{
  position:absolute;
  top:12px;
  inset-inline-end:12px;
  display:none;
}

.dashboard-edit-mode .dashboard-card-drag{display:inline-flex;}

.dashboard-kpi,
.dashboard-panel-wrap,
.dashboard-group{
  position:relative;
}

.dashboard-edit-mode .dashboard-kpi,
.dashboard-edit-mode .dashboard-panel-wrap,
.dashboard-edit-mode .dashboard-group{
  outline:1px dashed transparent;
}

.dashboard-edit-mode .dashboard-kpi,
.dashboard-edit-mode .dashboard-panel-wrap{
  cursor:grab;
}

.dashboard-edit-mode .dashboard-kpis,
.dashboard-edit-mode .dashboard-panels{
  grid-template-columns:1fr;
  gap:12px;
}

.dashboard-edit-mode .dashboard-kpi:hover,
.dashboard-edit-mode .dashboard-panel-wrap:hover,
.dashboard-edit-mode .dashboard-group:hover{
  outline-color:rgba(24,144,243,.28);
}

.dashboard-edit-mode [data-widget-id].dragging,
.dashboard-edit-mode [data-dashboard-section].dragging{
  opacity:.45;
  cursor:grabbing;
}

.dashboard-lane-empty{
  display:none;
  min-height:82px;
  border:1px dashed rgba(148,163,184,.42);
  border-radius:18px;
  background:rgba(148,163,184,.06);
  color:var(--text-muted);
  font-size:13px;
  font-weight:700;
  align-items:center;
  justify-content:center;
  text-align:center;
  padding:18px;
}

.dashboard-edit-mode .is-empty > .dashboard-lane-empty{display:flex;}
.dashboard-edit-mode .dashboard-panels.is-empty{grid-template-columns:1fr;}

@media (max-width: 991px){
  .dashboard-quickbar{flex-direction:column; align-items:stretch;}
  .dashboard-quickbar-main{width:100%;}
}


/* Theme-safe content normalization for legacy Tailwind-like utility classes */
.main-content .border,
.main-content .border-slate-700,
.main-content .border-slate-200,
.main-content .border-slate-100,
.main-content [class*="border-slate-"],
.main-content [class*="border-white/"]{border-color:var(--stroke) !important;}
.main-content .hover\:bg-slate-50:hover,
.main-content .hover\:bg-white:hover,
.main-content .hover\:bg-slate-100:hover,
.main-content .hover\:bg-slate-900:hover{background-color:var(--surface-soft);}
.main-content .text-slate-500,.main-content .bg-white .text-slate-500,.main-content .bg-slate-50 .text-slate-500,.main-content .bg-slate-100 .text-slate-500{color:var(--text-muted);}
.main-content .glass,
.main-content .glass2,
.main-content .isp-glass,
.main-content .isp-glass2,
.topbar > .glass,
#sidebarRoot > .glass{
  color:var(--text-main);
}
.topbar > .glass,
#sidebarRoot > .glass,
.main-content .glass,
.main-content .glass2,
.main-content .isp-glass,
.main-content .isp-glass2{
  background:var(--surface);
  border-color:var(--stroke);
}
.main-content table thead,
.main-content table thead tr,
.main-content table thead th{
  background:var(--surface-soft);
  color:var(--text-muted);
}
.main-content table tbody tr:hover{background:rgba(148,163,184,.06);} 
.main-content .shadow-soft,
.main-content .shadow-sm,
.main-content .shadow-xl,
.main-content .shadow-2xl{box-shadow:var(--shadow-card) !important;}
.main-content .rounded-2xl.border,
.main-content .rounded-3xl.border{border-color:var(--stroke) !important;}
.main-content .bg-gradient-to-r.from-indigo-50,
.main-content .bg-gradient-to-r.from-sky-50,
.main-content .bg-gradient-to-r.from-emerald-50{background-image:none !important;background-color:var(--surface-soft) !important;}


/* Theme sidebar guard: the active theme owns the sidebar partial.
   Shell-mode widgets must not leak into unrelated themes. */
body:not([data-active-theme="sb_admin_like"]) #sidebarRoot .sba-switch-row,
body:not([data-active-theme="sb_admin_like"]) #sidebarRoot .sba-shell-pill,
body:not([data-active-theme="sb_admin_like"]) #sidebarRoot .sba-badge-row,
body:not([data-active-theme="sb_admin_like"]) #sidebarRoot .sba-mini-badge{
  display:none !important;
}
#sidebarRoot.theme-sidebar{
  flex:0 0 auto;
}
