:root {
  --sidebar-width: 280px;
  --topbar-height: 72px;
  --primary: #1E4DFF;
  --primary-hover: #1957ff;
  --primary-light: #4CA2FF;
  --secondary: #E6E8ED;
  --dark: #0B132B;
  --dark-2: #111827;
  --surface: #FFFFFF;
  --surface-alt: #F5F6F8;
  --border: #E5E7EB;
  --success: #22C55E;
  --warning: #F59E0B;
  --danger: #EF4444;
  --text: #111827;
  --text-light: #6B7280;
}
body { background: var(--surface-alt); font-family: 'Poppins', system-ui, sans-serif; color: var(--text); }

/* Login */
.login-page {
  min-height: 100vh;
  display: flex;
  background: linear-gradient(135deg, #0B132B 0%, #111827 100%);
}
.login-hero {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: flex-start;
  padding-left: 6%;
  background: linear-gradient(135deg, #0B132B 0%, #111827 100%);
  background-size: 200% 200%;
  overflow: hidden;
  position: relative;
  animation: heroShimmer 30s ease-in-out infinite alternate;
}
@keyframes heroShimmer {
  0% { background-position: 0% 0%; }
  50% { background-position: 100% 80%; }
  100% { background-position: 20% 100%; }
}
.hero-bg {
  position: absolute;
  inset: 0;
  overflow: hidden;
}
.hero-orbe {
  position: absolute;
  border-radius: 50%;
  filter: blur(120px);
  opacity: .35;
}
.hero-orbe-1 {
  width: 600px;
  height: 600px;
  background: radial-gradient(circle, #1E4DFF 0%, transparent 70%);
  top: -200px;
  right: -100px;
  animation: orbeDrift 25s ease-in-out infinite;
}
.hero-orbe-2 {
  width: 500px;
  height: 500px;
  background: radial-gradient(circle, #4CA2FF 0%, transparent 70%);
  bottom: -200px;
  left: -100px;
  animation: orbeDrift 30s ease-in-out infinite reverse;
}
.hero-orbe-3 {
  width: 350px;
  height: 350px;
  background: radial-gradient(circle, #1E4DFF 0%, transparent 70%);
  top: 30%;
  left: 50%;
  animation: orbeDrift 20s ease-in-out infinite 5s;
  opacity: .2;
}
.hero-orbe-4 {
  width: 200px;
  height: 200px;
  background: radial-gradient(circle, #4CA2FF 0%, transparent 70%);
  top: 60%;
  left: 20%;
  animation: orbeDrift 22s ease-in-out infinite 3s;
  opacity: .25;
}
@keyframes orbeDrift {
  0%, 100% { transform: translate(0, 0) scale(1); }
  20% { transform: translate(30px, -40px) scale(1.08); }
  40% { transform: translate(-20px, 20px) scale(.95); }
  60% { transform: translate(50px, 10px) scale(1.04); }
  80% { transform: translate(-35px, -30px) scale(.97); }
}
.hero-lines {
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(rgba(255,255,255,.025) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255,255,255,.025) 1px, transparent 1px);
  background-size: 60px 60px;
}
.hero-streak {
  position: absolute;
  height: 1px;
  border-radius: 2px;
  background: linear-gradient(90deg, transparent, rgba(76,162,255,.35), transparent);
  animation: streak linear infinite;
}
.hero-streak:nth-child(6) { top: 15%; width: 120px; animation-duration: 2.5s; animation-delay: 0s; }
.hero-streak:nth-child(7) { top: 30%; width: 80px; animation-duration: 1.8s; animation-delay: .8s; }
.hero-streak:nth-child(8) { top: 50%; width: 150px; animation-duration: 3.2s; animation-delay: .3s; }
.hero-streak:nth-child(9) { top: 68%; width: 60px; animation-duration: 1.4s; animation-delay: 1.5s; }
.hero-streak:nth-child(10) { top: 82%; width: 100px; animation-duration: 2.8s; animation-delay: .6s; }
@keyframes streak {
  0% { transform: translateX(-200px); opacity: 0; }
  15% { opacity: 1; }
  85% { opacity: 1; }
  100% { transform: translateX(calc(100vw + 200px)); opacity: 0; }
}
.hero-main {
  position: relative;
  z-index: 1;
  padding: 60px 60px 60px 0;
  max-width: 820px;
}
.hero-badge {
  display: inline-flex;
  align-items: center;
  padding: 7px 18px;
  background: rgba(30,77,255,.12);
  border: 1px solid rgba(30,77,255,.25);
  border-radius: 100px;
  color: #4CA2FF;
  font-size: .82rem;
  font-weight: 500;
  margin-bottom: 24px;
  letter-spacing: .01em;
}
.hero-title {
  font-size: 5rem;
  font-weight: 800;
  line-height: 1.05;
  color: #fff;
  margin-bottom: 24px;
  min-height: 5.2rem;
}
.hero-title #typed { color: #fff; }
.hero-title .typed-cursor {
  color: #4CA2FF;
  font-weight: 300;
  animation: blink 1s infinite;
}
@keyframes blink {
  0%, 50% { opacity: 1; }
  51%, 100% { opacity: 0; }
}
.hero-desc {
  font-size: 1.45rem;
  color: rgba(255,255,255,.5);
  line-height: 1.7;
  margin-bottom: 52px;
  max-width: 580px;
}
.hero-stats {
  display: flex;
  gap: 72px;
  padding-top: 8px;
}
.hero-stat {
  display: flex;
  flex-direction: column;
}
.hero-stat-val {
  font-size: 4rem;
  font-weight: 700;
  color: #4CA2FF;
  line-height: 1;
  margin-bottom: 8px;
}
.hero-stat-val::after {
  content: '+';
  color: #4CA2FF;
  font-weight: 600;
}
.hero-stat:nth-child(2) .hero-stat-val::after {
  content: '%';
}
.hero-stat:nth-child(3) .hero-stat-val::after {
  content: '%';
}
.hero-stat-label {
  font-size: 1rem;
  color: rgba(255,255,255,.4);
  font-weight: 400;
}
.login-form-wrap {
  width: 640px;
  min-width: 640px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 48px;
  background: rgba(11,19,43,.85);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  position: relative;
  overflow: hidden;
  border-left: 1px solid rgba(30,77,255,.15);
}
.login-form-wrap::before {
  content: '';
  position: absolute;
  left: 0;
  top: 0;
  height: 100%;
  width: 2px;
  background: linear-gradient(to bottom, transparent, rgba(30,77,255,.25), transparent);
  z-index: 1;
}
.login-form-wrap::after {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 1px;
  background: linear-gradient(to right, transparent, rgba(30,77,255,.2), transparent);
}
.login-form-glow {
  position: absolute;
  border-radius: 50%;
  filter: blur(100px);
  pointer-events: none;
  opacity: .25;
}
.login-form-glow-1 {
  width: 350px;
  height: 350px;
  background: #1E4DFF;
  top: -120px;
  right: -80px;
}
.login-form-glow-2 {
  width: 250px;
  height: 250px;
  background: #4CA2FF;
  bottom: -80px;
  left: -50px;
}
.login-card {
  width: 100%;
  max-width: 460px;
}
.login-card .logo { text-align: center; margin-bottom: 16px; }
.login-card .logo img { height: 44px; }
.login-card .subtitle { color: #4CA2FF; font-size: 1rem; font-weight: 500; margin-bottom: 32px; text-align: center; letter-spacing: .01em; }
.login-card .form-label { color: rgba(255,255,255,.8); font-weight: 500; font-size: .85rem; margin-bottom: 6px; }
.login-card .form-control {
  background: rgba(255,255,255,.08);
  border: 1px solid rgba(76,162,255,.15);
  border-radius: 12px;
  padding: 12px 16px;
  color: #fff;
  font-size: .95rem;
  transition: all .15s ease;
}
.login-card .form-control:focus {
  background: rgba(255,255,255,.12);
  border-color: #4CA2FF;
  box-shadow: 0 0 0 3px rgba(30,77,255,.15);
  color: #fff;
}
.login-card .form-control::placeholder { color: rgba(255,255,255,.25); }
.login-card .btn-primary {
  background: linear-gradient(135deg, #1E4DFF, #4CA2FF);
  border: none;
  border-radius: 12px;
  padding: 14px;
  font-weight: 600;
  font-size: .95rem;
  transition: all .4s ease;
  box-shadow: 0 4px 20px rgba(30,77,255,.35);
}
.login-card .btn-primary:hover {
  box-shadow: 0 4px 28px rgba(30,77,255,.45);
}
.login-card .btn-primary:active {
  transform: translateY(0);
}
.login-card .btn-primary:disabled { opacity: .5; transform: none; box-shadow: none; }
.login-card a.text-muted { color: rgba(255,255,255,.4) !important; transition: color .2s; }
.login-card a.text-muted:hover { color: rgba(76,162,255,.8) !important; }
.login-card .text-danger { color: #f87171 !important; font-size: .85rem; }

.login-legal { margin-top: 40px; text-align: center; }
.login-legal a { color: rgba(255,255,255,.35); font-size: .8rem; text-decoration: none; transition: color .2s; }
.login-legal a:hover { color: rgba(76,162,255,.8); }
.login-legal-sep { color: rgba(255,255,255,.15); margin: 0 8px; font-size: .8rem; }

@media (max-width: 900px) {
  .login-page { flex-direction: column; background: #0a1628; }
  .login-hero { display: none; }
  .login-form-wrap { width: 100%; min-width: unset; padding: 40px 24px; min-height: 100vh; }
  .login-form-wrap::after { display: none; }
  .login-card { max-width: 400px; }
}


/* Sidebar */
.sidebar {
  position: fixed;
  top: 0;
  left: 0;
  bottom: 0;
  width: var(--sidebar-width);
  background: var(--dark);
  color: #9BA1A9;
  z-index: 1000;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
}
.sidebar .brand {
  padding: 20px 24px;
  border-bottom: 1px solid rgba(255,255,255,.06);
  display: flex;
  align-items: center;
}
.sidebar .brand img { height: 32px; }
.sidebar nav { padding: 12px 0; flex: 1; }
.sidebar .nav-link {
  color: #9BA1A9;
  padding: 10px 24px;
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: .88rem;
  font-weight: 500;
  transition: all .25s ease;
  text-decoration: none;
  border-left: 3px solid transparent;
}
.sidebar .nav-link:hover {
  color: #fff;
  background: rgba(255,255,255,.04);
}
.sidebar .nav-link.active {
  color: #fff;
  background: rgba(30,77,255,.15);
  border-left-color: var(--primary);
}
.sidebar .nav-link i { width: 20px; text-align: center; font-size: 1.15rem; }
.sidebar .nav-link:hover i { color: var(--primary); }
.sidebar .nav-link.active i { color: #fff; }
.sidebar .nav-divider { height: 1px; background: rgba(255,255,255,.06); margin: 8px 16px; }
.sidebar .nav-section-label {
  padding: 8px 24px 4px;
  font-size: .65rem;
  font-weight: 700;
  color: rgba(255,255,255,.3);
  text-transform: uppercase;
  letter-spacing: .08em;
}

/* Content */
.content-wrapper {
  margin-left: var(--sidebar-width);
  min-height: 100vh;
}
.topbar {
  position: sticky;
  top: 0;
  z-index: 999;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  padding: 0 32px;
  height: var(--topbar-height);
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.topbar h5 { font-weight: 600; font-size: 1rem; color: var(--text); margin: 0; display: flex; align-items: center; gap: 10px; }
.topbar .user-info { display: flex; align-items: center; gap: 12px; }
.topbar .user-avatar {
  width: 36px; height: 36px;
  border-radius: 50%;
  background: var(--primary);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: .85rem;
  font-weight: 600;
}
.page-content { padding: 32px; }

/* Cards */
.card {
  border: 1px solid var(--border);
  border-radius: 18px;
  box-shadow: 0 10px 30px rgba(17,24,39,.05);
  background: var(--surface);
  transition: all .25s ease;
}
.card:hover { box-shadow: 0 12px 40px rgba(17,24,39,.08); }
.stat-card { transition: all .25s ease; }
.stat-card:hover { transform: translateY(-2px); box-shadow: 0 12px 40px rgba(17,24,39,.08); }
.stat-card .stat-icon {
  width: 48px; height: 48px;
  border-radius: 12px;
  display: flex; align-items: center; justify-content: center;
  font-size: 1.25rem;
}

/* Buttons */
.btn {
  border-radius: 12px;
  padding: 12px 20px;
  font-weight: 500;
  transition: all .25s ease;
}
.btn:hover { transform: translateY(-1px); }
.btn-primary { background: var(--primary); border-color: var(--primary); }
.btn-primary:hover { background: var(--primary-hover); border-color: var(--primary-hover); }
.btn-sm { padding: 6px 14px; font-size: .82rem; }
.btn-lg { padding: 14px 28px; }

/* Inputs */
.form-control {
  border-radius: 12px;
  border: 1px solid var(--border);
  padding: 10px 16px;
  font-size: .9rem;
  transition: all .25s ease;
}
.form-control:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(30,77,255,.15);
}
.form-select {
  border-radius: 12px;
  border: 1px solid var(--border);
  padding: 10px 16px;
}

/* Tables */
.table th { font-weight: 600; font-size: .8rem; color: var(--text-light); border-bottom-width: 1px; text-transform: uppercase; letter-spacing: .04em; }
.table td { vertical-align: middle; font-size: .88rem; }
.table-hover tbody tr:hover { background: rgba(30,77,255,.03); }

/* Badges */
.badge { font-weight: 500; border-radius: 6px; padding: 4px 10px; font-size: .75rem; }

.sidebar .nav-link.active i { color: #fff; }

/* Module Selector Page */
.module-page { display: flex; align-items: center; justify-content: center; min-height: calc(100vh - var(--topbar-height) - 64px); }
.module-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 24px; width: 100%; max-width: 1100px; }
.module-card { border: 1px solid var(--border); border-radius: 18px; cursor: pointer; transition: all .25s ease; background: var(--surface); overflow: hidden; }
.module-card:hover { transform: translateY(-4px); box-shadow: 0 20px 50px rgba(17,24,39,.1); }
.module-card .card-bg { height: 120px; display: flex; align-items: center; justify-content: center; font-size: 3rem; }
.module-card .card-body { padding: 24px; }
.module-card .card-body h5 { font-weight: 700; font-size: 1.1rem; margin-bottom: 6px; }
.module-card .card-body p { font-size: .85rem; color: var(--text-light); margin-bottom: 16px; line-height: 1.5; }
.module-card .module-badge { font-size: .72rem; padding: 3px 12px; border-radius: 20px; font-weight: 600; }
.module-card .module-stats { display: flex; gap: 16px; margin-top: 12px; padding-top: 12px; border-top: 1px solid var(--border); }
.module-card .module-stats span { font-size: .78rem; color: var(--text-light); display: flex; align-items: center; gap: 4px; }
.module-card .module-stats strong { color: var(--text); font-size: .85rem; }

/* Module Panel */
.module-panel-header { margin-bottom: 24px; }
.module-panel-header h4 { font-weight: 700; font-size: 1.25rem; }
.module-panel-header p { color: var(--text-light); font-size: .88rem; margin: 0; }
.sub-nav { display: flex; gap: 4px; margin-bottom: 24px; border-bottom: 1px solid var(--border); padding-bottom: 0; }
.sub-nav .btn { border: none; border-radius: 8px 8px 0 0; padding: 10px 20px; font-size: .85rem; font-weight: 500; color: var(--text-light); background: transparent; }
.sub-nav .btn:hover { color: var(--text); background: var(--surface-alt); }
.sub-nav .btn.active { color: var(--primary); background: rgba(30,77,255,.08); }
.mod-panel { display: none; }
.mod-panel.active { display: block; }
.stat-mini-card { border-radius: 14px; border: 1px solid var(--border); padding: 20px 24px; transition: all .25s ease; }
.stat-mini-card:hover { transform: translateY(-2px); box-shadow: 0 8px 24px rgba(17,24,39,.08); }
.stat-mini-card .mini-icon { width: 44px; height: 44px; border-radius: 10px; display: flex; align-items: center; justify-content: center; font-size: 1.2rem; }
.stat-mini-card .mini-value { font-size: 1.6rem; font-weight: 700; line-height: 1.2; color: var(--text); }
.stat-mini-card .mini-label { font-size: .8rem; color: var(--text-light); font-weight: 500; }
.module-card-link { text-decoration: none; color: inherit; }
.module-card-link:hover { color: inherit; }

/* Tabs */
.nav-tabs { border-bottom: 1px solid var(--border); }
.nav-tabs .nav-link { border: none; border-radius: 0; color: var(--text-light); font-weight: 500; padding: 12px 20px; transition: all .25s ease; }
.nav-tabs .nav-link:hover { color: var(--text); background: var(--surface-alt); }
.nav-tabs .nav-link.active { color: var(--primary); border-bottom: 2px solid var(--primary); background: transparent; }

/* Modals */
.modal-content { border: 1px solid var(--border); border-radius: 18px; box-shadow: 0 20px 60px rgba(17,24,39,.12); }
.modal-header { border-bottom: 1px solid var(--border); padding: 20px 24px; }
.modal-body { padding: 24px; }
.modal-footer { border-top: 1px solid var(--border); padding: 16px 24px; }

/* Alerts */
.alert { border-radius: 12px; border: none; }

/* Progress */
.progress { border-radius: 100px; background: var(--surface-alt); }

/* Quick Actions */
.quick-actions { display: flex; gap: 10px; flex-wrap: wrap; }
.quick-actions .btn { border-radius: 10px; padding: 8px 16px; font-size: .82rem; font-weight: 500; display: flex; align-items: center; gap: 6px; }

/* Sub-nav secondary */
.sub-nav-secondary { display: flex; gap: 4px; margin-bottom: 20px; padding: 8px 12px; background: var(--surface-alt); border-radius: 12px; flex-wrap: wrap; }
.sub-nav-secondary .btn { border: none; border-radius: 8px; padding: 6px 14px; font-size: .8rem; font-weight: 500; color: var(--text-light); background: transparent; }
.sub-nav-secondary .btn:hover { color: var(--text); background: var(--border); }
.sub-nav-secondary .btn.active { color: #fff; background: var(--primary); }

/* Responsive */
@media (max-width: 768px) {
  .sidebar { transform: translateX(-100%); transition: transform .3s ease; }
  .sidebar.open { transform: translateX(0); }
  .content-wrapper { margin-left: 0; }
  .module-grid { grid-template-columns: 1fr; }
  .module-page { padding: 16px; }
  .topbar { padding: 0 16px; }
  .page-content { padding: 16px; }
}

/* Sidebar submenu */
.sidebar .nav-sub-toggle { cursor: pointer; }
.sidebar .nav-sub .nav-sub-toggle { cursor: pointer; display: flex; align-items: center; }
.sidebar .nav-sub-toggle .arrow { margin-left: auto; font-size: .7rem; transition: transform .2s; }
.sidebar .nav-sub-toggle.open .arrow { transform: rotate(90deg); }
.sidebar .nav-sub .nav-sub-toggle .arrow { margin-left: auto; font-size: .6rem; transition: transform .2s; }
.sidebar .nav-sub .nav-sub-toggle.open .arrow { transform: rotate(90deg); }
.sidebar .nav-sub { display: none; list-style: none; margin: 0; padding: 0; }
.sidebar .nav-sub.open { display: block; }
.sidebar .nav-sub a {
  display: flex; align-items: center; gap: 12px;
  padding: 8px 24px 8px 52px; font-size: .82rem; font-weight: 400;
  color: #78828E; text-decoration: none; transition: all .2s;
  border-left: 3px solid transparent;
}
.sidebar .nav-sub a i { transition: color .2s; }
.sidebar .nav-sub a:hover i { color: var(--primary); }
.sidebar .nav-sub a:hover { color: #fff; background: rgba(255,255,255,.03); }
.sidebar .nav-sub a.active { color: #fff; background: rgba(30,77,255,.12); position: relative; }
.sidebar .nav-sub a.active::before { content: ''; position: absolute; left: 0; top: 50%; transform: translateY(-50%); width: 3px; height: 60%; border-radius: 0 2px 2px 0; background: var(--primary); }
.sidebar .nav-sub a i { width: 16px; font-size: .9rem; text-align: center; }

/* Multi-level submenu nesting */
.sidebar .nav-sub .nav-sub a { padding-left: 68px; font-size: .78rem; }
.sidebar .nav-sub .nav-sub .nav-sub a { padding-left: 84px; font-size: .75rem; }
.sidebar .nav-sub .nav-sub .nav-sub .nav-sub a { padding-left: 100px; font-size: .72rem; }
.sidebar .nav-sub .nav-sub .nav-sub .nav-sub .nav-sub a { padding-left: 116px; font-size: .72rem; }

.sidebar .lock-badge { font-size: .55rem; color: #9ca3af; margin-left: auto; opacity: .5; flex-shrink: 0; display: inline-flex; align-items: center; }

/* ── Loading States ── */
@keyframes shimmer { 0% { background-position: -400px 0; } 100% { background-position: 400px 0; } }
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes spin { to { transform: rotate(360deg); } }

.skel {
  background: linear-gradient(90deg, #e5e7eb 25%, #f3f4f6 50%, #e5e7eb 75%);
  background-size: 800px 100%;
  animation: shimmer 1.5s infinite linear;
  border-radius: 6px;
}
.skel-text { height: 12px; width: 100%; margin-bottom: 6px; }
.skel-text.short { width: 60%; }
.skel-text.medium { width: 80%; }
.skel-block { height: 48px; width: 100%; }
.skel-card { height: 100px; width: 100%; border-radius: 10px; }
.skel-kpi { height: 36px; width: 60%; margin-bottom: 6px; }
.skel-kpi + .skel-text { height: 10px; width: 40%; }

.loading-overlay {
  display: flex; align-items: center; justify-content: center;
  min-height: 150px; border-radius: 10px;
}
.loading-spinner {
  width: 32px; height: 32px; border: 3px solid #e5e7eb;
  border-top-color: var(--primary); border-radius: 50%;
  animation: spin .7s infinite linear;
}

.panel-placeholder { animation: fadeIn .3s ease; }
.panel-content { display: none; }
.panel-loaded .panel-placeholder { display: none; }
.panel-loaded .panel-content { display: block; }

