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

:root {
  --sidebar-width: 268px;
  --topbar-height: 64px;

  --navy-900: #0b1120;
  --navy-800: #111827;
  --navy-700: #1e293b;
  --navy-600: #334155;
  --navy-500: #475569;
  --navy-400: #64748b;
  --navy-300: #94a3b8;
  --navy-200: #cbd5e1;
  --navy-100: #e2e8f0;
  --navy-50: #f1f5f9;

  --blue-600: #2563eb;
  --blue-500: #3b82f6;
  --blue-400: #60a5fa;
  --blue-100: #dbeafe;

  --cyan-500: #06b6d4;
  --cyan-400: #22d3ee;
  --cyan-100: #cffafe;

  --green-500: #10b981;
  --green-400: #34d399;
  --green-100: #d1fae5;

  --red-500: #ef4444;
  --red-400: #f87171;
  --red-100: #fee2e2;

  --amber-500: #f59e0b;
  --amber-400: #fbbf24;
  --amber-100: #fef3c7;

  --indigo-500: #6366f1;
  --indigo-100: #e0e7ff;

  --purple-500: #8b5cf6;
  --purple-100: #ede9fe;

  --orange-500: #f97316;
  --orange-100: #ffedd5;

  --teal-500: #14b8a6;
  --teal-100: #ccfbf1;

  --body-bg: #f3f6fb;
  --card-bg: #ffffff;
  --border-color: #e5e7eb;
  --text-primary: #0f172a;
  --text-secondary: #64748b;
  --text-muted: #94a3b8;

  --font-family: 'Inter', 'Segoe UI', system-ui, -apple-system, sans-serif;
  --shadow-sm: 0 1px 2px rgba(0,0,0,0.04);
  --shadow-md: 0 4px 6px -1px rgba(0,0,0,0.06), 0 2px 4px -2px rgba(0,0,0,0.05);
  --shadow-lg: 0 10px 15px -3px rgba(0,0,0,0.08), 0 4px 6px -4px rgba(0,0,0,0.04);
  --shadow-xl: 0 20px 25px -5px rgba(0,0,0,0.08), 0 8px 10px -6px rgba(0,0,0,0.04);
  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 14px;
  --radius-xl: 18px;
}

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

body {
  font-family: var(--font-family);
  background: var(--body-bg);
  color: var(--text-primary);
  font-size: 1.1rem;
  line-height: 1.6;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

a { color: var(--blue-600); text-decoration: none; }
a:hover { color: var(--blue-500); }
code { background: var(--navy-50); padding: 2px 6px; border-radius: 4px; font-size: 0.8rem; color: #d63384; }
hr { border-color: var(--border-color); opacity: 0.6; }

::-webkit-scrollbar { width: 5px; height: 5px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--navy-300); border-radius: 10px; }
::-webkit-scrollbar-thumb:hover { background: var(--navy-400); }

/* ===== Flex Layout ===== */
.app-wrapper {
  display: flex;
  min-height: 100vh;
  width: 100%;
}

/* ===== Sidebar ===== */
.sidebar {
  width: var(--sidebar-width);
  flex: 0 0 var(--sidebar-width);
  height: 100vh;
  position: sticky;
  top: 0;
  z-index: 1040;
  background: var(--navy-900);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  border-right: 1px solid rgba(255,255,255,0.04);
  transition: width 180ms ease, flex 180ms ease;
}

.sidebar-inner {
  display: flex;
  flex-direction: column;
  height: 100%;
  overflow-y: auto;
  overflow-x: hidden;
}

.sidebar-inner::-webkit-scrollbar { width: 3px; }
.sidebar-inner::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.15); border-radius: 10px; }

.sidebar-brand {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 18px 20px 16px;
  border-bottom: 1px solid rgba(255,255,255,0.06);
  flex-shrink: 0;
}

.sidebar-brand-icon {
  width: 40px;
  height: 40px;
  background: linear-gradient(135deg, var(--blue-500), var(--cyan-500));
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-size: 1.2rem;
  flex-shrink: 0;
}

.sidebar-brand-text .brand-line1 {
  display: block;
  font-size: 1.1rem;
  font-weight: 700;
  color: #fff;
  letter-spacing: 0.5px;
  line-height: 1.3;
}
.sidebar-brand-text .brand-line2 {
  display: block;
  font-size: 0.8rem;
  font-weight: 500;
  color: rgba(255,255,255,0.4);
  letter-spacing: 0.8px;
  text-transform: uppercase;
}

.sidebar-user {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 14px 20px;
  border-bottom: 1px solid rgba(255,255,255,0.06);
  flex-shrink: 0;
}

.sidebar-user-avatar {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--blue-500), var(--cyan-500));
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-weight: 700;
  font-size: 1rem;
  flex-shrink: 0;
}

.sidebar-user-info .user-name {
  color: #fff;
  font-size: 1rem;
  font-weight: 600;
  line-height: 1.3;
}
.sidebar-user-info .user-role {
  font-size: 0.8rem;
  font-weight: 500;
  padding: 1px 8px;
  border-radius: 20px;
  display: inline-block;
}

.sidebar-nav {
  list-style: none;
  padding: 6px 0;
  margin: 0;
  flex: 1;
}

.nav-section {
  padding: 14px 20px 4px;
  font-size: 0.8rem;
  font-weight: 600;
  color: rgba(255,255,255,0.28);
  letter-spacing: 1.2px;
  text-transform: uppercase;
}

.sidebar-nav .nav-item {
  margin: 1px 10px;
  border-radius: 8px;
  transition: all 0.15s;
}

.sidebar-nav .nav-item:hover { background: rgba(255,255,255,0.06); }
.sidebar-nav .nav-item.active { background: rgba(59, 130, 246, 0.15); }

.sidebar-nav .nav-link {
  display: flex;
  align-items: center;
  padding: 9px 12px;
  color: rgba(255,255,255,0.65);
  text-decoration: none;
  font-size: 1rem;
  font-weight: 500;
  border-radius: 8px;
  transition: all 0.15s;
  gap: 10px;
}

.sidebar-nav .nav-link i {
  width: 20px;
  font-size: 1.05rem;
  text-align: center;
  color: rgba(255,255,255,0.35);
  transition: all 0.15s;
  flex-shrink: 0;
}

.sidebar-nav .nav-item.active .nav-link { color: #fff; }
.sidebar-nav .nav-item.active .nav-link i { color: var(--blue-400); }
.sidebar-nav .nav-item:hover .nav-link { color: rgba(255,255,255,0.85); }
.sidebar-nav .nav-item:hover .nav-link i { color: rgba(255,255,255,0.55); }

.sidebar-footer {
  padding: 12px 20px 16px;
  border-top: 1px solid rgba(255,255,255,0.06);
  flex-shrink: 0;
}

.sidebar-footer .btn-logout {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  padding: 9px 16px;
  border: 1px solid rgba(239, 68, 68, 0.25);
  background: rgba(239, 68, 68, 0.08);
  color: #fca5a5;
  border-radius: 8px;
  font-size: 1rem;
  font-weight: 500;
  transition: all 0.2s;
  text-decoration: none;
  cursor: pointer;
}

.sidebar-footer .btn-logout:hover {
  background: rgba(239, 68, 68, 0.18);
  color: #fecaca;
  border-color: rgba(239, 68, 68, 0.4);
}

/* ===== Sidebar Collapsed ===== */
body.sidebar-collapsed .sidebar {
  width: 76px;
  flex: 0 0 76px;
}

body.sidebar-collapsed .sidebar-text,
body.sidebar-collapsed .menu-text,
body.sidebar-collapsed .sidebar-user-info,
body.sidebar-collapsed .menu-section-title,
body.sidebar-collapsed .sidebar-footer .menu-text {
  display: none;
}

body.sidebar-collapsed .sidebar-brand {
  justify-content: center;
  padding-left: 10px;
  padding-right: 10px;
}

body.sidebar-collapsed .sidebar-nav .nav-link {
  justify-content: center;
  padding-left: 0;
  padding-right: 0;
}

body.sidebar-collapsed .sidebar-nav .nav-link i {
  margin-right: 0;
}

body.sidebar-collapsed .sidebar-footer .btn-logout {
  justify-content: center;
  padding-left: 0;
  padding-right: 0;
}

/* ===== Main Content ===== */
.main-wrapper {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  background: var(--body-bg);
}

/* ===== Topbar ===== */
.topbar {
  position: sticky;
  top: 0;
  z-index: 1030;
  height: var(--topbar-height);
  background: rgba(255,255,255,0.95);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  padding: 0 28px;
  gap: 16px;
  flex-shrink: 0;
}

.topbar-left {
  display: flex;
  align-items: center;
  gap: 14px;
}

.btn-toggle-sidebar {
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--border-color);
  border-radius: 8px;
  background: transparent;
  color: var(--navy-500);
  cursor: pointer;
  transition: all 0.2s;
  font-size: 1.15rem;
}

.btn-toggle-sidebar:hover {
  background: var(--navy-50);
  color: var(--navy-700);
}

.topbar-title {
  font-size: 1.2rem;
  font-weight: 600;
  color: var(--text-primary);
  white-space: nowrap;
}

.topbar-right {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-left: auto;
}

.topbar-btn {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 7px 14px;
  border: 1px solid var(--border-color);
  border-radius: 8px;
  background: transparent;
  color: var(--navy-600);
  font-size: 0.95rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s;
  text-decoration: none;
}

.topbar-btn:hover {
  background: var(--navy-50);
  border-color: var(--navy-200);
}

.user-dropdown-toggle {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 5px 10px 5px 5px;
  border: 1px solid var(--border-color);
  border-radius: 8px;
  background: transparent;
  cursor: pointer;
  transition: all 0.2s;
  color: var(--text-primary);
}

.user-dropdown-toggle:hover {
  background: var(--navy-50);
  border-color: var(--navy-200);
}

.user-dropdown-avatar {
  width: 30px;
  height: 30px;
  border-radius: 6px;
  background: linear-gradient(135deg, var(--blue-500), var(--cyan-500));
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-weight: 700;
  font-size: 0.7rem;
}

.user-dropdown-name {
  font-size: 1rem;
  font-weight: 600;
}

.dropdown-menu {
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-lg);
  padding: 6px;
  margin-top: 6px !important;
}

.dropdown-item {
  border-radius: 6px;
  padding: 8px 12px;
  font-size: 1rem;
  transition: all 0.15s;
}

.dropdown-item:hover { background: var(--navy-50); }
.dropdown-item i { width: 18px; text-align: center; margin-right: 8px; color: var(--navy-400); }

/* ===== Content ===== */
.content-wrapper {
  padding: 24px;
  width: 100%;
  max-width: none;
}

/* ===== Cards ===== */
.card {
  background: var(--card-bg);
  border: none;
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  transition: box-shadow 0.2s;
}

.card:hover { box-shadow: var(--shadow-md); }

.card-header {
  background: transparent;
  border-bottom: 1px solid var(--border-color);
  padding: 16px 20px;
  border-radius: var(--radius-lg) var(--radius-lg) 0 0 !important;
}

.card-header h6, .card-header .h6 {
  font-size: 1.05rem;
  font-weight: 600;
  margin: 0;
  color: var(--text-primary);
}

.card-body { padding: 20px; }
.card-body.p-0 { padding: 0; }

/* Dashboard Page Header */
.dashboard-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 24px;
  gap: 16px;
  flex-wrap: wrap;
}

.dashboard-header-left h1 {
  font-size: 1.8rem;
  font-weight: 700;
  color: var(--text-primary);
  margin: 0 0 4px;
  letter-spacing: -0.3px;
}

.dashboard-header-left p {
  font-size: 1.05rem;
  color: var(--text-secondary);
  margin: 0;
}

.dashboard-header-right {
  display: flex;
  align-items: center;
  gap: 12px;
}

.dashboard-header-right .current-date {
  font-size: 0.9rem;
  color: var(--text-secondary);
  background: var(--navy-50);
  padding: 8px 14px;
  border-radius: 8px;
  white-space: nowrap;
}

/* ===== Stat Cards (Dashboard KPI) ===== */
.dashboard-kpi-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 20px;
  width: 100%;
  margin-bottom: 24px;
}

.stat-card {
  background: #fff;
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-sm);
  transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
  overflow: hidden;
  position: relative;
  border: 1px solid var(--border-color);
}

.stat-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-lg);
}

.stat-card-body {
  padding: 20px 22px;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.stat-info { flex: 1; min-width: 0; }

.stat-info .stat-label {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.4px;
  margin-bottom: 4px;
}

.stat-info .stat-value {
  font-size: 2.4rem;
  font-weight: 800;
  line-height: 1.2;
  letter-spacing: -0.5px;
}

.stat-info .stat-desc {
  font-size: 0.78rem;
  color: var(--text-muted);
  margin-top: 4px;
  display: flex;
  align-items: center;
  gap: 4px;
}

.stat-icon-box {
  width: 48px;
  height: 48px;
  border-radius: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.3rem;
  flex-shrink: 0;
}

.stat-card-blue .stat-value { color: var(--blue-600); }
.stat-card-blue .stat-icon-box { background: var(--blue-100); color: var(--blue-600); }

.stat-card-cyan .stat-value { color: #0e7490; }
.stat-card-cyan .stat-icon-box { background: var(--cyan-100); color: #0891b2; }

.stat-card-green .stat-value { color: #059669; }
.stat-card-green .stat-icon-box { background: var(--green-100); color: #059669; }

.stat-card-red .stat-value { color: #dc2626; }
.stat-card-red .stat-icon-box { background: var(--red-100); color: #dc2626; }

.stat-card-amber .stat-value { color: #d97706; }
.stat-card-amber .stat-icon-box { background: var(--amber-100); color: #d97706; }

.stat-card-indigo .stat-value { color: #4f46e5; }
.stat-card-indigo .stat-icon-box { background: var(--indigo-100); color: #4f46e5; }

.stat-card-teal .stat-value { color: #0d9488; }
.stat-card-teal .stat-icon-box { background: var(--teal-100); color: #0d9488; }

.stat-card-purple .stat-value { color: #7c3aed; }
.stat-card-purple .stat-icon-box { background: var(--purple-100); color: #7c3aed; }

.stat-card-gray .stat-value { color: var(--navy-600); }
.stat-card-gray .stat-icon-box { background: var(--navy-100); color: var(--navy-600); }

/* ===== Dashboard Section Grid ===== */
.dashboard-section-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
  margin-bottom: 20px;
}

.dashboard-section-grid .full-width-section {
  grid-column: 1 / -1;
}

/* ===== Tables ===== */
.table {
  margin: 0;
  font-size: 1rem;
  color: var(--text-primary);
}

.table thead th {
  background: var(--navy-50);
  font-weight: 600;
  font-size: 0.9rem;
  text-transform: uppercase;
  letter-spacing: 0.4px;
  color: var(--text-secondary);
  padding: 10px 14px;
  border-bottom: 1px solid var(--border-color);
  white-space: nowrap;
}

.table tbody td {
  padding: 10px 14px;
  vertical-align: middle;
  border-bottom: 1px solid var(--border-color);
}

.table tbody tr:hover { background: rgba(59, 130, 246, 0.03); }
.table tbody tr:last-child td { border-bottom: none; }

.table-bordered {
  border: 1px solid var(--border-color);
}
.table-bordered th, .table-bordered td {
  border: 1px solid var(--border-color);
}

/* DataTables */
.dataTables_wrapper .dt-buttons { margin-bottom: 12px; }
.dataTables_wrapper .dt-buttons .btn {
  border-radius: 6px;
  margin-right: 4px;
  font-size: 0.75rem;
  padding: 5px 12px;
  border: 1px solid var(--border-color);
  background: #fff;
  color: var(--text-secondary);
}
.dataTables_wrapper .dt-buttons .btn:hover {
  background: var(--navy-50);
  border-color: var(--navy-200);
}

table.dataTable { font-size: 1rem; }
table.dataTable thead th { background: var(--navy-50) !important; }
table.dataTable tbody td { padding: 10px 14px; }
table.dataTable tbody tr:hover { background: rgba(59, 130, 246, 0.03) !important; }

.dataTables_filter input {
  border: 1.5px solid var(--border-color);
  border-radius: 8px;
  padding: 6px 12px;
  font-size: 0.92rem;
  outline: none;
  transition: border-color 0.2s;
}
.dataTables_filter input:focus {
  border-color: var(--blue-500);
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

.dataTables_length select {
  border: 1.5px solid var(--border-color);
  border-radius: 6px;
  padding: 4px 8px;
  font-size: 0.92rem;
  outline: none;
}

.dataTables_info, .dataTables_paginate {
  font-size: 0.92rem;
  color: var(--text-secondary);
  padding-top: 12px !important;
}

.paginate_button.page-item.active .page-link {
  background: var(--blue-600);
  border-color: var(--blue-600);
}
.paginate_button .page-link {
  border-radius: 6px !important;
  margin: 0 2px;
  color: var(--text-secondary);
  border: 1px solid var(--border-color);
  padding: 6px 12px;
  font-size: 0.8rem;
}
.paginate_button .page-link:hover {
  background: var(--navy-50);
  border-color: var(--navy-200);
}

/* ===== Badges ===== */
.badge {
  font-weight: 500;
  font-size: 0.85rem;
  padding: 3px 10px;
  border-radius: 20px;
  letter-spacing: 0.2px;
}

.bg-success { background: #059669 !important; }
.bg-danger { background: #dc2626 !important; }
.bg-warning { background: #d97706 !important; }
.bg-info { background: #0891b2 !important; }
.bg-secondary { background: var(--navy-400) !important; }
.bg-primary { background: var(--blue-600) !important; }
.bg-orange { background: var(--orange-500) !important; color: #fff; }

/* ===== Buttons ===== */
.btn {
  border-radius: 8px;
  font-weight: 500;
  font-size: 1rem;
  padding: 8px 18px;
  transition: all 0.2s;
  border: 1px solid transparent;
}

.btn:active { transform: scale(0.97); }

.btn-sm {
  border-radius: 6px;
  padding: 5px 12px;
  font-size: 0.75rem;
}

.btn-xs {
  border-radius: 4px;
  padding: 3px 8px;
  font-size: 0.7rem;
}

.btn-primary {
  background: var(--blue-600);
  border-color: var(--blue-600);
  color: #fff;
}
.btn-primary:hover { background: #1d4ed8; border-color: #1d4ed8; }

.btn-outline-primary {
  border: 1.5px solid var(--blue-500);
  color: var(--blue-600);
  background: transparent;
}
.btn-outline-primary:hover { background: var(--blue-600); color: #fff; border-color: var(--blue-600); }

.btn-success { background: #059669; border-color: #059669; color: #fff; }
.btn-success:hover { background: #047857; border-color: #047857; }

.btn-outline-success { border: 1.5px solid #10b981; color: #059669; }
.btn-outline-success:hover { background: #059669; color: #fff; border-color: #059669; }

.btn-danger { background: #dc2626; border-color: #dc2626; color: #fff; }
.btn-danger:hover { background: #b91c1c; border-color: #b91c1c; }

.btn-outline-danger { border: 1.5px solid #ef4444; color: #dc2626; }
.btn-outline-danger:hover { background: #dc2626; color: #fff; border-color: #dc2626; }

.btn-outline-secondary { border: 1.5px solid var(--border-color); color: var(--text-secondary); }
.btn-outline-secondary:hover { background: var(--navy-50); color: var(--text-primary); border-color: var(--navy-200); }

.btn-outline-info { border: 1.5px solid #06b6d4; color: #0891b2; }
.btn-outline-info:hover { background: #0891b2; color: #fff; border-color: #0891b2; }

.btn-outline-warning { border: 1.5px solid #f59e0b; color: #d97706; }
.btn-outline-warning:hover { background: #d97706; color: #fff; border-color: #d97706; }

.btn-outline-primary i, .btn-outline-danger i, .btn-outline-info i,
.btn-outline-success i, .btn-outline-warning i, .btn-outline-secondary i {
  margin-right: 2px;
}

/* ===== Forms ===== */
.form-label {
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 4px;
}

.form-control, .form-select {
  border: 1.5px solid var(--border-color);
  border-radius: 8px;
  padding: 9px 14px;
  font-size: 1.05rem;
  color: var(--text-primary);
  transition: all 0.2s;
  background: #fff;
}

.form-control:focus, .form-select:focus {
  border-color: var(--blue-500);
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
  outline: none;
}

.form-control::placeholder { color: var(--navy-300); }

textarea.form-control { resize: vertical; min-height: 80px; }

.form-switch .form-check-input {
  width: 40px;
  height: 20px;
  border-radius: 20px;
  border: 1.5px solid var(--border-color);
  cursor: pointer;
}
.form-switch .form-check-input:checked {
  background-color: var(--blue-600);
  border-color: var(--blue-600);
}

.input-group-text {
  border: 1.5px solid var(--border-color);
  border-radius: 8px 0 0 8px;
  background: var(--navy-50);
  color: var(--navy-500);
  font-size: 0.95rem;
}

/* ===== Alerts / Flash ===== */
.alert {
  border-radius: var(--radius-md);
  font-size: 1.05rem;
  padding: 14px 18px;
  border: none;
  box-shadow: var(--shadow-sm);
}

.alert-success { background: #ecfdf5; color: #065f46; border-left: 4px solid #10b981; }
.alert-danger { background: #fef2f2; color: #991b1b; border-left: 4px solid #ef4444; }
.alert-warning { background: #fffbeb; color: #92400e; border-left: 4px solid #f59e0b; }
.alert-info { background: #ecfeff; color: #155e75; border-left: 4px solid #06b6d4; }

.alert-dismissible .btn-close { padding: 16px; }

/* ===== Modal ===== */
.modal.fade .modal-dialog {
  transform: translateY(10px);
  transition: transform 180ms ease-out, opacity 180ms ease-out;
}
.modal.show .modal-dialog {
  transform: translateY(0);
}

.modal-dialog {
  max-height: calc(100vh - 32px);
  margin-top: 16px;
  margin-bottom: 16px;
}

.modal-content {
  max-height: calc(100vh - 32px);
  display: flex;
  flex-direction: column;
  border: none;
  border-radius: var(--radius-lg);
  box-shadow: 0 4px 24px rgba(0,0,0,0.12);
}

/* Support form wrapping header/body/footer inside modal-content */
.modal-content > form {
  display: flex;
  flex-direction: column;
  flex: 1 1 auto;
  min-height: 0;
  overflow: hidden;
}

.modal-header {
  flex: 0 0 auto;
  border-radius: var(--radius-lg) var(--radius-lg) 0 0;
  padding: 16px 20px;
  border-bottom: 1px solid var(--border-color);
}

.modal-header .modal-title {
  font-size: 1.2rem;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 8px;
}

.modal-body {
  flex: 1 1 auto;
  overflow-y: auto;
  padding: 18px 20px;
}

.modal-footer {
  flex: 0 0 auto;
  border-radius: 0 0 var(--radius-lg) var(--radius-lg);
  padding: 12px 20px;
  border-top: 1px solid var(--border-color);
  gap: 8px;
}

.modal-backdrop {
  background: rgba(15, 23, 42, 0.4);
  transition: opacity 160ms ease-out;
}

/* Note timeline styles */
.note-timeline { position: relative; padding-left: 28px; }
.note-timeline::before { content: ''; position: absolute; left: 10px; top: 4px; bottom: 4px; width: 1px; background: var(--border-color); }
.note-item { position: relative; margin-bottom: 16px; }
.note-item:last-child { margin-bottom: 0; }
.note-item::before { content: ''; position: absolute; left: -22px; top: 6px; width: 8px; height: 8px; border-radius: 50%; background: var(--primary-color); border: 2px solid #fff; box-shadow: 0 0 0 1px var(--primary-color); }
.note-content { background: var(--bg-light); border-radius: var(--radius-sm); padding: 10px 14px; border: 1px solid var(--border-color); }
.note-text { font-size: 1rem; margin-bottom: 4px; white-space: pre-wrap; }
.note-meta { font-size: 0.85rem; color: var(--text-muted); display: flex; align-items: center; gap: 12px; }
.note-meta i { font-size: 0.65rem; }

/* Issue type dropdown with Khac */
.issue-type-other-group { display: none; }
.issue-type-other-group.show { display: block; }

.confirm-delete-icon {
  width: 64px;
  height: 64px;
  border-radius: 50%;
  background: var(--red-100);
  color: var(--red-500);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.8rem;
  margin: 0 auto 12px;
}

/* ===== Pagination ===== */
.pagination { margin-top: 8px; gap: 2px; }
.page-link {
  border-radius: 6px !important;
  border: 1px solid var(--border-color);
  padding: 6px 12px;
  font-size: 0.8rem;
  color: var(--text-secondary);
  transition: all 0.15s;
}
.page-link:hover { background: var(--navy-50); color: var(--text-primary); }
.page-item.active .page-link { background: var(--blue-600); border-color: var(--blue-600); color: #fff; }
.page-item.disabled .page-link { opacity: 0.5; pointer-events: none; }

/* ===== Utility ===== */
.text-muted { color: var(--text-muted) !important; }
.bg-white { background: #fff !important; }
.shadow-sm { box-shadow: var(--shadow-sm) !important; }
.shadow-md { box-shadow: var(--shadow-md) !important; }
.shadow-lg { box-shadow: var(--shadow-lg) !important; }
.rounded-lg { border-radius: var(--radius-lg) !important; }
.rounded-md { border-radius: var(--radius-md) !important; }
.fw-semibold { font-weight: 600 !important; }
.gap-2 { gap: 8px !important; }
.gap-3 { gap: 12px !important; }

/* ===== Login Page ===== */
.login-page {
  background: #f3f6fb;
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-family);
  background: linear-gradient(135deg, #0f172a 0%, #1e3a5f 40%, #0f766e 100%);
  padding: 20px;
}

.login-container {
  display: flex;
  max-width: 920px;
  width: 100%;
  min-height: 580px;
  background: #fff;
  border-radius: 24px;
  box-shadow: 0 25px 80px rgba(0,0,0,0.35);
  overflow: hidden;
}

.login-side {
  width: 380px;
  flex: 0 0 380px;
  background: linear-gradient(160deg, #0f172a 0%, #1e293b 50%, #1e3a5f 100%);
  padding: 48px 32px;
  display: flex;
  flex-direction: column;
  position: relative;
  overflow: hidden;
}

.login-side::before {
  content: '';
  position: absolute;
  top: -50%;
  right: -50%;
  width: 100%;
  height: 100%;
  background: radial-gradient(circle, rgba(59,130,246,0.08) 0%, transparent 70%);
  pointer-events: none;
}

.login-side::after {
  content: '';
  position: absolute;
  bottom: -30%;
  left: -30%;
  width: 80%;
  height: 80%;
  background: radial-gradient(circle, rgba(6,182,212,0.06) 0%, transparent 70%);
  pointer-events: none;
}

.login-side-inner {
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  height: 100%;
}

.login-side-icon {
  width: 60px;
  height: 60px;
  background: linear-gradient(135deg, var(--blue-500), var(--cyan-500));
  border-radius: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.8rem;
  color: #fff;
  margin-bottom: 24px;
}

.login-side-title {
  font-size: 1.5rem;
  font-weight: 700;
  color: #fff;
  margin: 0 0 4px;
  letter-spacing: -0.3px;
}

.login-side-sub {
  font-size: 0.75rem;
  color: rgba(255,255,255,0.4);
  text-transform: uppercase;
  letter-spacing: 1.5px;
  font-weight: 500;
  margin: 0 0 32px;
}

.login-side-features {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.login-feature-item {
  display: flex;
  align-items: center;
  gap: 12px;
  color: rgba(255,255,255,0.6);
  font-size: 0.85rem;
  font-weight: 400;
}

.login-feature-item i {
  width: 24px;
  font-size: 1rem;
  color: rgba(59, 130, 246, 0.6);
  text-align: center;
}

.login-side-footer {
  font-size: 0.75rem;
  color: rgba(255,255,255,0.3);
  margin-top: 24px;
  display: flex;
  align-items: center;
  gap: 6px;
}

.login-form-wrap {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 40px;
}

.login-form-inner {
  width: 100%;
  max-width: 340px;
}

.login-form-header {
  margin-bottom: 28px;
}

.login-form-header h4 {
  font-size: 1.3rem;
  font-weight: 700;
  color: var(--text-primary);
  margin: 0 0 4px;
}

.login-form-header p {
  font-size: 0.8rem;
  color: var(--text-secondary);
  margin: 0;
}

.alert-custom {
  border-radius: 12px;
  padding: 12px 16px;
  font-size: 0.82rem;
  border: none;
  margin-bottom: 20px;
}

.alert-danger-custom {
  background: #fef2f2;
  color: #991b1b;
  border-left: 4px solid #ef4444;
}

.alert-success-custom {
  background: #ecfdf5;
  color: #065f46;
  border-left: 4px solid #10b981;
}

.alert-warning-custom {
  background: #fffbeb;
  color: #92400e;
  border-left: 4px solid #f59e0b;
}

.alert-info-custom {
  background: #ecfeff;
  color: #155e75;
  border-left: 4px solid #06b6d4;
}

.login-field {
  margin-bottom: 20px;
}

.login-label {
  display: block;
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 6px;
}

.login-input-group {
  display: flex;
  align-items: center;
  border: 2px solid var(--border-color);
  border-radius: 12px;
  transition: all 0.25s;
  background: var(--navy-50);
}

.login-input-group:focus-within {
  border-color: var(--blue-500);
  background: #fff;
  box-shadow: 0 0 0 4px rgba(59, 130, 246, 0.08);
}

.login-input-group i {
  padding: 0 0 0 14px;
  color: var(--navy-400);
  font-size: 1rem;
}

.login-input {
  flex: 1;
  border: none;
  background: transparent;
  padding: 12px 14px;
  font-size: 1rem;
  color: var(--text-primary);
  outline: none;
  font-family: var(--font-family);
}

.login-input::placeholder {
  color: var(--navy-300);
}

.login-btn {
  width: 100%;
  padding: 13px;
  border: none;
  border-radius: 12px;
  background: linear-gradient(135deg, var(--blue-600), var(--cyan-500));
  color: #fff;
  font-weight: 600;
  font-size: 1rem;
  cursor: pointer;
  transition: all 0.3s;
  font-family: var(--font-family);
  letter-spacing: 0.5px;
}

.login-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 25px rgba(37, 99, 235, 0.35);
}

.login-btn:active {
  transform: translateY(0);
}

/* ===== Responsive ===== */
@media (max-width: 991.98px) {
  .sidebar {
    position: fixed;
    left: 0;
    top: 0;
    width: var(--sidebar-width);
    flex: 0 0 var(--sidebar-width);
    height: 100vh;
    z-index: 1050;
    transform: translateX(-100%);
    transition: transform 200ms ease;
  }

  body.sidebar-open .sidebar {
    transform: translateX(0);
  }

  .sidebar-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, 0.55);
    z-index: 1040;
  }

  body.sidebar-open .sidebar-overlay {
    display: block;
  }

  .main-wrapper {
    width: 100%;
  }

  .content-wrapper { padding: 20px; }

  .dashboard-kpi-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .dashboard-section-grid {
    grid-template-columns: 1fr;
  }

  .login-side { display: none; }
  .login-form-wrap { padding: 32px 24px; }
}

@media (max-width: 767.98px) {
  .content-wrapper { padding: 16px; }
  .topbar { padding: 0 16px; }
  .topbar-title { font-size: 0.9rem; }
  .stat-card-body { padding: 16px 18px; }
  .stat-info .stat-value { font-size: 1.5rem; }
  .user-dropdown-name { display: none; }

  .dashboard-kpi-grid {
    grid-template-columns: 1fr;
  }

  .dashboard-section-grid {
    grid-template-columns: 1fr;
  }

  .dashboard-header {
    flex-direction: column;
    align-items: flex-start;
  }

  .login-container {
    flex-direction: column;
    max-width: 420px;
  }
  .login-side {
    width: 100%;
    flex: none;
    padding: 32px 24px;
    display: block;
  }
  .login-side-features { display: none; }
  .login-form-wrap { padding: 24px; }
  .login-form-inner { max-width: none; }
}

@media (max-width: 1199.98px) {
  .dashboard-kpi-grid {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }
}

/* Select2 overrides */
.select2-container--bootstrap-5 .select2-selection {
  border: 1.5px solid var(--border-color) !important;
  border-radius: 8px !important;
  min-height: 40px;
}
.select2-container--bootstrap-5 .select2-selection--single .select2-selection__rendered {
  padding: 6px 14px !important;
  font-size: 0.85rem;
}
.select2-container--bootstrap-5 .select2-selection--multiple .select2-selection__rendered {
  padding: 4px 8px !important;
}

.empty-state {
  text-align: center;
  padding: 40px 20px;
  color: var(--text-muted);
}
.empty-state i { font-size: 2.5rem; margin-bottom: 12px; opacity: 0.5; }
.empty-state p { font-size: 1rem; margin: 0; }

.status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  display: inline-block;
  margin-right: 6px;
}
.status-dot.active { background: #10b981; }
.status-dot.inactive { background: var(--navy-300); }
.status-dot.processing { background: #f59e0b; }
.status-dot.critical { background: #ef4444; }

/* ===== Toast Container ===== */
.toast-container {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 999999;
    display: flex;
    flex-direction: column;
    gap: 8px;
    max-width: 400px;
    width: 100%;
    pointer-events: none;
}
.toast-container > * {
    pointer-events: auto;
}

/* ===== Toast Animations ===== */
@keyframes slideInRight {
    from { transform: translateX(120%); opacity: 0; }
    to { transform: translateX(0); opacity: 1; }
}
@keyframes fadeOutRight {
    from { transform: translateX(0); opacity: 1; }
    to { transform: translateX(120%); opacity: 0; }
}
@keyframes toastProgress {
    from { width: 100%; }
    to { width: 0%; }
}

/* ===== Row Highlight & Fade ===== */
@keyframes highlightCreated {
    0% { background-color: rgba(16, 185, 129, 0.15); }
    100% { background-color: transparent; }
}
@keyframes highlightUpdated {
    0% { background-color: rgba(6, 182, 212, 0.15); }
    100% { background-color: transparent; }
}
@keyframes fadeOutRow {
    0% { opacity: 1; transform: translateY(0); }
    100% { opacity: 0; transform: translateY(-10px); }
}
.row-highlight-created {
    animation: highlightCreated 2.5s ease-out;
}
.row-highlight-updated {
    animation: highlightUpdated 2.5s ease-out;
}
.row-fade-out {
    animation: fadeOutRow 0.4s ease forwards;
}

/* ===== Stat Card Entrance ===== */
@keyframes fadeUp {
    from { opacity: 0; transform: translateY(20px); }
    to { opacity: 1; transform: translateY(0); }
}

/* ===== Reduced Motion ===== */
@media (prefers-reduced-motion: reduce) {
    .toast-custom,
    .row-highlight-created,
    .row-highlight-updated,
    .row-fade-out,
    .stat-card {
        animation: none !important;
        transition: none !important;
    }
    .toast-progress {
        animation: none !important;
        width: 0 !important;
    }
}

/* ===== Notification Bell ===== */
.notif-badge {
  position: absolute;
  top: -4px;
  right: -4px;
  min-width: 18px;
  height: 18px;
  line-height: 18px;
  font-size: 0.6rem;
  font-weight: 700;
  text-align: center;
  background: #dc2626;
  color: #fff;
  border-radius: 10px;
  padding: 0 5px;
  box-shadow: 0 2px 6px rgba(220,38,38,0.3);
  animation: notifPop 0.3s ease-out;
}
@keyframes notifPop {
  0% { transform: scale(0); }
  50% { transform: scale(1.2); }
  100% { transform: scale(1); }
}
.notif-menu {
  width: 360px;
  max-height: 420px;
  padding: 0;
  border: none;
  border-radius: 12px;
  box-shadow: 0 8px 32px rgba(0,0,0,0.12);
  overflow: hidden;
}
.notif-header {
  padding: 12px 16px;
  font-weight: 600;
  font-size: 0.95rem;
  background: var(--navy-50);
  border-bottom: 1px solid var(--border-color);
  color: var(--navy-700);
}
.notif-body {
  max-height: 360px;
  overflow-y: auto;
}
.notif-empty {
  padding: 24px 16px;
  text-align: center;
  font-size: 0.9rem;
}
.notif-item {
  display: flex;
  gap: 10px;
  padding: 10px 16px;
  border-bottom: 1px solid var(--border-color);
  transition: background 0.15s;
  cursor: default;
}
.notif-item:hover {
  background: var(--navy-50);
}
.notif-item-icon {
  flex-shrink: 0;
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 8px;
  background: #fee2e2;
  color: #dc2626;
  font-size: 1rem;
}
.notif-item-body {
  flex: 1;
  min-width: 0;
}
.notif-item-title {
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--navy-800);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.notif-item-text {
  font-size: 0.85rem;
  color: var(--navy-500);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.notif-item-time {
  font-size: 0.75rem;
  color: var(--navy-400);
  margin-top: 2px;
}
.notif-item-unread {
  background: #f0f7ff;
  cursor: pointer;
}
.notif-item-unread:hover {
  background: #e0f0fe;
}
.notif-item-action {
  flex-shrink: 0;
  display: flex;
  align-items: center;
}
.notif-footer {
  padding: 8px 16px;
  border-top: 1px solid var(--border-color);
  background: var(--navy-50);
}
.notif-popup {
  position: fixed;
  top: 16px;
  right: 16px;
  z-index: 9999;
  animation: slideInRight 0.3s ease-out;
  max-width: 380px;
}
.notif-popup-inner {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 14px 16px;
  background: #fff;
  border-radius: 12px;
  box-shadow: 0 8px 32px rgba(0,0,0,0.15);
  border-left: 4px solid var(--primary, #2563eb);
}
.notif-popup-icon {
  flex-shrink: 0;
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  background: #dbeafe;
  color: var(--primary, #2563eb);
  font-size: 1rem;
}
.notif-popup-content {
  flex: 1;
  min-width: 0;
}
.notif-popup-title {
  font-size: 0.95rem;
  font-weight: 600;
  color: #1e293b;
  margin-bottom: 2px;
}
.notif-popup-text {
  font-size: 0.85rem;
  color: #64748b;
  line-height: 1.4;
}
.notif-popup-close {
  flex-shrink: 0;
  background: none;
  border: none;
  font-size: 1.2rem;
  color: #94a3b8;
  cursor: pointer;
  padding: 0;
  line-height: 1;
}
.notif-popup-close:hover {
  color: #475569;
}

@keyframes slideInRight {
  from { transform: translateX(100%); opacity: 0; }
  to { transform: translateX(0); opacity: 1; }
}
