/* ===== Design Tokens ===== */
:root {
  --primary: #6571ff;
  --primary-rgb: 101, 113, 255;
  --primary-light: rgba(101, 113, 255, 0.1);
  --primary-dark: #5660d9;
  --success: #0ac074;
  --success-rgb: 10, 192, 116;
  --success-light: rgba(10, 192, 116, 0.1);
  --danger: #f62947;
  --danger-rgb: 246, 41, 71;
  --danger-light: rgba(246, 41, 71, 0.1);
  --warning: #ffb821;
  --warning-rgb: 255, 184, 33;
  --warning-light: rgba(255, 184, 33, 0.1);
  --info: #0099fb;
  --info-rgb: 0, 153, 251;
  --info-light: rgba(0, 153, 251, 0.1);
  --bg: #eff4fb;
  --bg-surface: #ffffff;
  --bg-muted: #f8f9fa;
  --text-primary: #1e293b;
  --text-secondary: #475569;
  --text-muted: #64748b;
  --border-color: #e2e8f0;
  --header-bg: #0A145A;
  --sidebar-bg: #08102E;
  --font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --font-size-xs: 12px;
  --font-size: 14px;
  --font-size-sm: 13px;
  --font-size-lg: 16px;
  --font-size-xl: 20px;
  --font-size-2xl: 24px;
  --line-height: 1.5;
  --line-height-sm: 1.2;
  --spacing-xs: 4px;
  --spacing-sm: 8px;
  --spacing: 16px;
  --spacing-md: 20px;
  --spacing-lg: 24px;
  --spacing-xl: 32px;
  --spacing-2xl: 40px;
  --border-radius: 6px;
  --border-radius-md: 10px;
  --border-radius-lg: 16px;
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.05);
  --shadow: 0 4px 6px rgba(0, 0, 0, 0.07);
  --shadow-md: 0 10px 15px rgba(0, 0, 0, 0.1);
  --shadow-lg: 0 20px 25px rgba(0, 0, 0, 0.1);
  --shadow-xl: 0 25px 50px rgba(0, 0, 0, 0.15);
  --transition: 0.2s ease;
  --sidebar-width: 220px;
  --header-height: 64px;
}

/* ===== Base ===== */
body {
  font-family: var(--font-family);
  font-size: var(--font-size);
  color: var(--text-primary);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  line-height: var(--line-height);
}

h1, h2, h3, h4, h5, h6 {
  font-weight: 600;
  letter-spacing: -0.01em;
}
h1 { font-size: 1.5rem; }
h2 { font-size: 1.25rem; }
h3 { font-size: 1.125rem; }
h4 { font-size: 1rem; }
h5 { font-size: 0.938rem; }
h6 { font-size: 0.875rem; }

a { color: var(--primary); transition: color var(--transition); }
a:hover { color: var(--primary-dark); }

/* ===== Header (Dark Navy) ===== */
.header {
  background: var(--header-bg) !important;
  height: var(--header-height) !important;
  border-bottom: none !important;
  display: flex;
  align-items: center;
  padding: 0 24px;
  z-index: 1044;
}

.header-left .logo {
  display: flex;
  align-items: center;
  padding: 8px 0;
  float: none !important;
  line-height: normal !important;
}
.header-left .logo img {
  height: 48px !important;
  width: auto !important;
  padding: 0 !important;
  border-radius: 4px;
}
.header-left {
  float: none !important;
  display: flex;
  align-items: center;
  justify-content: center;
  width: var(--sidebar-width) !important;
  height: var(--header-height) !important;
  background: transparent !important;
  text-align: center !important;
  padding: 0 12px !important;
}

.page-title-box h3 {
  font-size: 16px;
  font-weight: 600;
  color: rgba(255,255,255,0.85);
  margin: 0;
}

#toggle_btn .bar-icon span { background: rgba(255,255,255,0.85); }
#toggle_btn:hover .bar-icon span { background: #fff; }

.nav.user-menu { display: flex; align-items: center; gap: 8px; margin-left: auto; }
.nav.user-menu .nav-item { position: relative; }
.nav.user-menu .nav-link { padding: 6px 10px; border-radius: var(--border-radius); color: rgba(255,255,255,0.85); transition: background var(--transition); }
.nav.user-menu .nav-link:hover { background: rgba(255,255,255,0.1); }

.theme-toggle { border: none; background: none; padding: 6px 10px; border-radius: var(--border-radius); color: rgba(255,255,255,0.85); cursor: pointer; font-size: 16px; transition: background var(--transition); }
.theme-toggle:hover { background: rgba(255,255,255,0.1); color: #fff; }

.nav-item.main-drop .nav-link { display: flex; align-items: center; gap: 8px; padding: 6px 12px; border-radius: var(--border-radius); }
.nav-item.main-drop .nav-link .user-img { width: 32px; height: 32px; border-radius: 50%; overflow: hidden; border: 2px solid rgba(255,255,255,0.15); }
.nav-item.main-drop .nav-link .user-img img { width: 100%; height: 100%; object-fit: cover; }
.nav-item.main-drop .nav-link span { font-size: 13px; font-weight: 500; color: rgba(255,255,255,0.85); }
.nav-item.main-drop .dropdown-menu { margin-top: 8px; border: none; box-shadow: var(--shadow-lg); border-radius: var(--border-radius); min-width: 180px; }

/* ===== Sidebar ===== */
.sidebar {
  width: var(--sidebar-width) !important;
  background: var(--sidebar-bg) !important;
  border-right: none !important;
  z-index: 1001;
  position: fixed;
  top: var(--header-height);
  bottom: 0;
  overflow-y: auto;
  overflow-x: hidden;
  scrollbar-width: none;
}
.sidebar::-webkit-scrollbar { display: none; }
.sidebar .sidebar-inner { padding-top: 8px; }
.sidebar .sidebar-menu ul { font-size: 14px; }
.sidebar .sidebar-menu ul li.menu-title { color: rgba(255,255,255,0.3) !important; font-size: 10px !important; font-weight: 700; text-transform: uppercase; letter-spacing: 0.1em; padding: 24px 20px 6px !important; }
.sidebar .sidebar-menu ul li a { color: rgba(255,255,255,0.55) !important; font-size: 13px !important; padding: 8px 16px !important; margin: 1px 10px; border-radius: 6px; transition: all var(--transition); display: flex; align-items: center; gap: 12px; }
.sidebar .sidebar-menu ul li a:hover { color: #fff !important; background: rgba(255,255,255,0.07); }
.sidebar .sidebar-menu ul li a i,
.sidebar .sidebar-menu ul li a .la { font-size: 16px; width: 20px; text-align: center; color: rgba(255,255,255,0.35); transition: color var(--transition); }
.sidebar .sidebar-menu ul li a:hover i,
.sidebar .sidebar-menu ul li a:hover .la { color: #fff; }
.sidebar .sidebar-menu ul li.active > a { color: #fff !important; background: var(--primary) !important; }
.sidebar .sidebar-menu ul li.active > a i,
.sidebar .sidebar-menu ul li.active > a .la { color: #fff !important; }
.sidebar .sidebar-menu ul li .submenu a { padding-left: 48px !important; font-size: 12.5px !important; }
.sidebar .sidebar-menu ul li .submenu a span { margin-left: 0; }
.sidebar .sidebar-menu ul li a .menu-arrow { font-family: 'FontAwesome' !important; right: 16px; color: rgba(255,255,255,0.25); }
.sidebar .sidebar-menu ul li a .menu-arrow::before { content: "\f105"; }
.sidebar .sidebar-menu ul li.submenu ul { background: rgba(0,0,0,0.2); border-radius: 6px; margin: 2px 10px; padding: 4px 0; }

.mini-sidebar .sidebar { width: 60px !important; }
.mini-sidebar .sidebar .menu-title,
.mini-sidebar .sidebar a span,
.mini-sidebar .sidebar .menu-arrow { display: none !important; }
.mini-sidebar .sidebar a { justify-content: center; padding: 12px !important; }
.mini-sidebar .sidebar a i,
.mini-sidebar .sidebar a .la { margin: 0; font-size: 18px; }
.mini-sidebar .page-wrapper { margin-left: 60px !important; }
.mini-sidebar .main-footer { margin-left: 60px !important; }

/* Override style.css [data-layout-position=scrollable] .main-wrapper .sidebar { position: absolute } */
/* Higher specificity (0,3,1) beats style.css (0,3,0), and theme-modern.css loads last */
html[data-layout-position=scrollable] .main-wrapper .sidebar {
  position: fixed;
}

/* ===== Page Wrapper ===== */
.page-wrapper {
  margin-left: var(--sidebar-width) !important;
  padding-top: var(--header-height) !important;
  min-height: calc(100vh - var(--header-height));
  display: flex;
  flex-direction: column;
  box-sizing: border-box;
}
.page-wrapper .content { flex: 1; padding: 16px; }
.page-wrapper .content:last-child { padding-bottom: 16px; }

.content-header { min-height: auto !important; padding: 0 0 4px !important; }
.content-header h1 { font-size: var(--font-size-2xl); font-weight: 700; color: var(--text-primary); margin: 0; letter-spacing: -0.02em; }

/* ===== Cards ===== */
.card {
  border: none;
  border-radius: var(--border-radius-md);
  box-shadow: var(--shadow-sm);
  transition: box-shadow var(--transition);
}
.card:hover { box-shadow: var(--shadow); }

.card-header {
  background: var(--bg-surface);
  border-bottom: 1px solid var(--border-color);
  padding: var(--spacing) var(--spacing-md);
  border-radius: var(--border-radius-md) var(--border-radius-md) 0 0 !important;
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  justify-content: space-between;
}
.card-header .card-title { font-size: 15px; font-weight: 600; color: var(--text-primary); margin: 0; }
.card-body { padding: var(--spacing-md); }

.card-footer {
  background: var(--bg-surface);
  border-top: 1px solid var(--border-color);
  padding: var(--spacing) var(--spacing-md);
  border-radius: 0 0 var(--border-radius-md) var(--border-radius-md) !important;
}

/* ===== Dashboard Widgets ===== */
.dash-widget {
  border-radius: var(--border-radius-md);
  border: none;
  overflow: hidden;
  position: relative;
}


.dash-widget .card-body { display: flex; align-items: flex-start; gap: var(--spacing); padding: var(--spacing-md); }
.dash-widget-icon {
  width: 48px; height: 48px; border-radius: var(--border-radius);
  display: flex; align-items: center; justify-content: center;
  font-size: 20px; color: #fff; background: var(--primary); flex-shrink: 0;
}
.dash-widget:nth-child(2) .dash-widget-icon { background: var(--success); }
.dash-widget:nth-child(3) .dash-widget-icon { background: var(--warning); }
.dash-widget:nth-child(4) .dash-widget-icon { background: var(--danger); }
.dash-widget:nth-child(5) .dash-widget-icon { background: var(--info); }
.dash-widget:nth-child(6) .dash-widget-icon { background: var(--success); }
.dash-widget:nth-child(7) .dash-widget-icon { background: var(--warning); }
.dash-widget:nth-child(8) .dash-widget-icon { background: #8B5CF6; }

.dash-widget-info { flex: 1; min-width: 0; }
.dash-widget-info h4 { font-size: var(--font-size-xs); font-weight: 500; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.04em; margin: 0 0 4px; }
.dash-widget-info .dash-value { font-size: 1.75rem; font-weight: 700; color: var(--text-primary); line-height: 1.2; display: block; }
.dash-widget-info .dash-trend { font-size: var(--font-size-xs); font-weight: 500; margin-top: 4px; display: inline-flex; align-items: center; gap: 4px; }
.dash-widget-info .dash-trend.up { color: var(--success); }
.dash-widget-info .dash-trend.down { color: var(--danger); }
.dash-widget-info a { text-decoration: none; }

/* ===== Stat Card (hospital-master style) ===== */
.stat-card {
  background: var(--bg-surface);
  border-radius: var(--border-radius-md);
  padding: var(--spacing-md);
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  gap: var(--spacing);
}
.stat-card-icon { width: 44px; height: 44px; border-radius: var(--border-radius); display: flex; align-items: center; justify-content: center; font-size: 20px; flex-shrink: 0; }
.stat-card-value { font-size: var(--font-size-xl); font-weight: 700; color: var(--text-primary); line-height: 1; }
.stat-card-label { font-size: var(--font-size-xs); text-transform: uppercase; letter-spacing: 0.03em; color: var(--text-muted); margin: 4px 0 0; }

/* ===== Empty States ===== */
.empty-state { text-align: center; padding: 48px 20px; color: var(--text-muted); }
.empty-state i { font-size: 48px; color: var(--border-color); margin-bottom: var(--spacing); display: block; }
.empty-state h5 { font-size: var(--font-size-lg); font-weight: 600; color: var(--text-muted); margin: 0 0 4px; }
.empty-state p { font-size: var(--font-size-sm); margin: 0; }

/* ===== Tables ===== */
.table {
  margin-bottom: 0;
  --bs-table-bg: transparent;
  --bs-table-accent-bg: transparent;
  --bs-table-striped-color: var(--text-secondary);
  --bs-table-striped-bg: var(--bg-muted);
  --bs-table-hover-color: var(--text-secondary);
  --bs-table-hover-bg: rgba(101, 113, 255, 0.03);
  color: var(--text-secondary);
  border-color: var(--border-color);
}
.table > :not(caption) > * > * {
  padding: 0.625rem 0.25rem 0.625rem 1.25rem;
  border-bottom-width: 1px;
  background: var(--bg-surface);
}
.table thead th {
  background: var(--bg-muted) !important;
  font-size: var(--font-size-xs);
  font-weight: 600;
  color: var(--text-primary) !important;
  border-top: none;
  border-bottom: 1px solid var(--border-color);
  padding: 0.75rem 0.25rem 0.75rem 1.25rem;
  white-space: nowrap;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}
.table thead th:first-child {
  border-top-left-radius: var(--border-radius-md);
}
.table thead th:last-child {
  border-top-right-radius: var(--border-radius-md);
  padding-left: 0;
}
.table tbody td {
  padding: 0.75rem 0.25rem 0.75rem 1.25rem;
  vertical-align: middle;
  font-size: var(--font-size-sm);
  color: var(--text-primary);
  border-bottom: 1px solid var(--border-color);
  border-top: none;
}
.table tbody tr:last-child td:first-child {
  border-bottom-left-radius: var(--border-radius-md);
}
.table tbody tr:last-child td:last-child {
  border-bottom-right-radius: var(--border-radius-md);
}
.table tbody tr:hover { background: var(--bs-table-hover-bg); }
.table > :not(:first-child) { border-top: none !important; }

/* Table striped with subtle shadow + rounded corners */
.table-striped {
  box-shadow: 0 0 20px rgba(173, 181, 189, 0.1);
  border-collapse: separate;
  border-spacing: 0;
}
.table-striped > tbody > tr:nth-of-type(odd) > * {
  background: var(--bg-muted);
}
.table-striped > tbody {
  background: var(--bg-surface);
}

/* Action column icon buttons (black icons, btn-primary hover) */
.table td .btn:not(.dropdown-toggle):not(.btn-outline-secondary) {
  background: transparent !important;
  border: none !important;
  box-shadow: none !important;
  padding: 0.25rem 0.5rem !important;
  transition: transform 0.2s ease, opacity 0.2s ease;
}
.table td .btn i,
.table td .btn .fa {
  font-size: 1.05rem;
  line-height: 1;
}
.table td a .fa,
.table td a i {
  color: #212529 !important;
  transition: transform 0.2s ease, opacity 0.2s ease;
}
.table td a:hover .fa,
.table td a:hover i {
  transform: scale(1.2);
  opacity: 0.7;
}
.table td .d-flex.justify-content-center {
  gap: 0.25rem;
}

/* Force narrow action columns */
.table td:last-child,
.table th:last-child {
  white-space: nowrap;
  width: 1%;
  padding-left: 0.5rem;
  padding-right: 0.5rem;
}

/* Truncate long text in table cells */
.table td {
  max-width: 300px;
  overflow: hidden;
  text-overflow: ellipsis;
}
.table td.text-wrap {
  max-width: none;
  white-space: normal;
}

/* Table wrap - use on table-responsive for bordered card style */
.table-wrap {
  overflow-x: auto;
  border: 1px solid var(--border-color);
  border-radius: var(--border-radius-md);
  background: var(--bg-surface);
}

/* DataTables */
.dataTables_wrapper .dataTables_filter input { height: 36px; border: 1px solid var(--border-color); border-radius: var(--border-radius); padding: 0 12px; font-size: var(--font-size-sm); outline: none; }
.dataTables_wrapper .dataTables_filter input:focus { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(101, 113, 255, 0.1); }
.dataTables_wrapper .dataTables_paginate .paginate_button { padding: 6px 12px; border-radius: var(--border-radius); border: 1px solid var(--border-color); margin: 0 2px; font-size: var(--font-size-sm); }
.dataTables_wrapper .dataTables_paginate .paginate_button.current { background: var(--primary) !important; border-color: var(--primary) !important; color: #fff !important; }

/* ===== Buttons ===== */
.btn {
  font-size: var(--font-size-sm);
  font-weight: 500;
  padding: 0.563rem 1.25rem;
  border-radius: 5px;
  transition: all var(--transition);
  line-height: 1.5;
}
.btn-sm { padding: 0.25rem 0.75rem; font-size: var(--font-size-xs); }
.btn-lg { padding: 0.5rem 1.5rem; font-size: var(--font-size-lg); }
.btn-xs { padding: 0.15rem 0.5rem; font-size: 10px; line-height: 1.4; }
.btn-primary { background: var(--primary); border-color: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-dark); border-color: var(--primary-dark); color: #fff; }
.btn-primary:focus { box-shadow: 0 0 0 0.2rem rgba(101, 113, 255, 0.25); }
.btn-success { background: var(--success); border-color: var(--success); color: #fff; }
.btn-success:hover { background: #09a865; border-color: #09a865; color: #fff; }
.btn-info { background: var(--info); border-color: var(--info); color: #fff; }
.btn-info:hover { background: #0082d5; border-color: #0082d5; color: #fff; }
.btn-warning { background: var(--warning); border-color: var(--warning); color: #1e293b; }
.btn-danger { background: var(--danger); border-color: var(--danger); color: #fff; }
.btn-danger:hover { background: #d9223e; border-color: #d9223e; color: #fff; }
.btn-secondary { background: #adb5bd; border-color: #adb5bd; color: #060917; }
.btn-secondary:hover { background: #b9c0c7; border-color: #b9c0c7; }
.btn-outline-primary { color: var(--primary); border-color: var(--primary); }
.btn-outline-primary:hover { background: var(--primary); border-color: var(--primary); color: #fff; }
.btn-outline-secondary { color: var(--text-secondary); border-color: var(--border-color); }
.btn-outline-secondary:hover { background: var(--bg-muted); border-color: var(--border-color); color: var(--text-primary); }

/* ===== Badges ===== */
.badge {
  display: inline-flex;
  align-items: center;
  padding: 2px 10px;
  font-size: var(--font-size-xs);
  font-weight: 600;
  line-height: 1.4;
  border-radius: 100px;
  white-space: nowrap;
  letter-spacing: 0.02em;
}
.badge.bg-primary { background: var(--primary-light) !important; color: var(--primary); }
.badge.bg-success { background: var(--success-light) !important; color: var(--success); }
.badge.bg-danger { background: var(--danger-light) !important; color: var(--danger); }
.badge.bg-warning { background: var(--warning-light) !important; color: #92400e; }
.badge.bg-info { background: var(--info-light) !important; color: var(--info); }
.badge.bg-secondary { background: var(--bg-muted) !important; color: var(--text-secondary); }
.badge.bg-light { background: var(--bg-muted) !important; color: var(--text-primary); }

/* ===== Forms ===== */
.form-label {
  font-size: var(--font-size-sm);
  font-weight: 500;
  color: var(--text-primary);
  margin-bottom: 6px;
}
.col-form-label {
  font-size: var(--font-size-sm);
  font-weight: 500;
  color: var(--text-primary);
}

.form-control {
  display: block;
  width: 100%;
  padding: 0.688rem 0.938rem;
  font-size: var(--font-size-sm);
  font-weight: 400;
  line-height: 1.5;
  color: var(--text-primary);
  background: var(--bg-surface);
  background-clip: padding-box;
  border: 1px solid #ced4da;
  border-radius: 5px;
  transition: border-color 0.15s ease-in-out, box-shadow 0.15s ease-in-out;
  appearance: none;
}
.form-control:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(101, 113, 255, 0.1);
  color: var(--text-primary);
  background: var(--bg-surface);
  outline: 0;
}
.form-control::placeholder { color: #adb5bd; }
textarea.form-control { min-height: 100px; }
select.form-control { padding-right: 2.25rem; }

.form-select {
  display: block;
  width: 100%;
  padding: 0.688rem 2.25rem 0.688rem 0.938rem;
  font-size: var(--font-size-sm);
  font-weight: 400;
  line-height: 1.5;
  color: var(--text-primary);
  background: var(--bg-surface);
  border: 1px solid #ced4da;
  border-radius: 5px;
  appearance: auto;
}
.form-select:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(101, 113, 255, 0.1);
  outline: 0;
}

.form-group { margin-bottom: var(--spacing); }
.row.mb-3 .form-control,
.row.mb-3 .form-select { margin-bottom: 0; }

/* Required field indicator */
.required:after {
  content: "*";
  color: var(--danger);
  font-weight: 700;
  margin-left: 2px;
}

/* Validation */
.is-valid { border-color: var(--success) !important; }
.is-invalid { border-color: var(--danger) !important; }
.valid-feedback { color: var(--success); font-size: 0.875em; margin-top: 0.25rem; }
.invalid-feedback { color: var(--danger); font-size: 0.875em; margin-top: 0.25rem; }

/* Input group */
.input-group-text {
  padding: 0.688rem 0.938rem;
  background: #e9ecef;
  border: 1px solid #ced4da;
  border-radius: 5px;
  color: var(--text-secondary);
}

/* Form switch */
.form-switch .form-check-input:checked {
  background-color: var(--primary) !important;
  border-color: var(--primary) !important;
}

/* ===== Select2 ===== */
.select2-container--default .select2-selection--single {
  height: 40px;
  border: 1px solid #ced4da !important;
  border-radius: 5px;
}
.select2-container--default .select2-selection--single .select2-selection__rendered {
  line-height: 40px;
  padding-left: 12px;
  font-size: var(--font-size-sm);
  color: var(--text-primary);
}
.select2-container--default .select2-selection--single .select2-selection__arrow { height: 38px; }
.select2-container--default .select2-selection--multiple {
  border: 1px solid #ced4da !important;
  border-radius: 5px;
}
.select2-container--default.select2-container--focus .select2-selection--multiple,
.select2-container--default.select2-container--focus .select2-selection--single { border-color: var(--primary) !important; }

/* ===== Footer ===== */
.main-footer {
  background: var(--bg-surface);
  border-top: 1px solid var(--border-color);
  padding: var(--spacing) 24px;
  font-size: var(--font-size-sm);
  color: var(--text-muted);
  margin-left: var(--sidebar-width) !important;
}

/* ===== Alerts ===== */
.alert {
  border: none;
  border-radius: var(--border-radius-md);
  padding: var(--spacing) var(--spacing-md);
  font-size: var(--font-size-sm);
  display: flex;
  align-items: flex-start;
  gap: var(--spacing-sm);
}
.alert-success { background: var(--success-light); color: var(--success); border: 1px solid #a7f3d0; }
.alert-danger { background: var(--danger-light); color: var(--danger); border: 1px solid #fecaca; }
.alert-warning { background: var(--warning-light); color: #92400e; border: 1px solid #fde68a; }
.alert-info { background: var(--info-light); color: var(--info); border: 1px solid #bfdbfe; }
.alert-primary { background: var(--primary-light); color: var(--primary); border: 1px solid #c7d2fe; }

/* ===== Modals ===== */
.modal-content {
  border: none;
  border-radius: var(--border-radius-md);
  box-shadow: var(--shadow-lg);
}
.modal-header { border-bottom: 1px solid var(--border-color); padding: 1.875rem; border-radius: var(--border-radius-md) var(--border-radius-md) 0 0; }
.modal-body { padding: 1.875rem; max-height: calc(100vh - 200px); overflow-y: auto; }
.modal-footer { border-top: 1px solid var(--border-color); padding: 1.625rem; }
.modal-title { font-weight: 600; }
.modal-header .btn-close { font-size: 14px; }

/* ===== Pagination ===== */
.pagination { display: flex; list-style: none; padding-left: 0; }
.page-link { background: #eff3f7; border: 0 solid #dee2e6; color: var(--text-secondary); display: block; padding: 0.375rem 0.75rem; text-decoration: none; transition: all var(--transition); }
.page-link:hover { background: #e9ecef; color: var(--primary); }
.page-item.active .page-link { background: var(--primary); border-color: var(--primary); color: #fff; z-index: 3; }
.page-item.disabled .page-link { background: #eff3f7; color: #6c757d; pointer-events: none; }
.page-item:first-child .page-link { border-radius: 5px 0 0 5px; }
.page-item:last-child .page-link { border-radius: 0 5px 5px 0; }

/* ===== Nav Tabs ===== */
.nav-tabs { border-bottom: 1px solid var(--border-color); }
.nav-tabs .nav-link { color: var(--text-secondary); font-size: var(--font-size-sm); font-weight: 500; padding: 0.625rem 1rem; border: none; border-bottom: 2px solid transparent; transition: all var(--transition); }
.nav-tabs .nav-link:hover { color: var(--text-primary); border-bottom-color: var(--border-color); }
.nav-tabs .nav-link.active { color: var(--primary); border-bottom-color: var(--primary); background: none; }

/* ===== Dropdown ===== */
.dropdown-menu {
  border: 1px solid var(--border-color);
  border-radius: var(--border-radius);
  box-shadow: var(--shadow-md);
  padding: 6px;
  font-size: var(--font-size-sm);
  margin-top: 4px;
}
.dropdown-item { padding: 8px 12px; border-radius: 6px; color: var(--text-primary); display: flex; align-items: center; gap: 8px; }
.dropdown-item:hover { background: var(--bg-muted); color: var(--text-primary); }
.dropdown-item i { width: 18px; text-align: center; color: var(--text-muted); }
.dropdown-item:hover i { color: var(--text-primary); }
.dropdown-item.text-danger i { color: var(--danger); }
.dropdown-divider { border-color: var(--border-color); margin: 4px 0; }

/* ===== Utility Classes ===== */
/* Text */
.text-primary { color: var(--primary) !important; }
.text-success { color: var(--success) !important; }
.text-danger { color: var(--danger) !important; }
.text-warning { color: var(--warning) !important; }
.text-info { color: var(--info) !important; }
.text-muted { color: var(--text-muted) !important; }
.text-body { color: var(--text-primary) !important; }
.text-secondary { color: var(--text-secondary) !important; }
.fw-bold { font-weight: 700 !important; }
.fw-semibold { font-weight: 600 !important; }
.fw-medium { font-weight: 500 !important; }
.fw-normal { font-weight: 400 !important; }
.fs-small { font-size: var(--font-size-xs) !important; }
.text-nowrap { white-space: nowrap !important; }

/* Background */
.bg-primary { background: var(--primary) !important; }
.bg-success { background: var(--success) !important; }
.bg-danger { background: var(--danger) !important; }
.bg-warning { background: var(--warning) !important; }
.bg-info { background: var(--info) !important; }
.bg-light { background: var(--bg-muted) !important; }
.bg-white { background: var(--bg-surface) !important; }
.bg-transparent { background: transparent !important; }

/* Shadows */
.shadow-sm { box-shadow: var(--shadow-sm) !important; }
.shadow { box-shadow: var(--shadow) !important; }
.shadow-md { box-shadow: var(--shadow-md) !important; }
.shadow-lg { box-shadow: var(--shadow-lg) !important; }

/* Borders */
.border { border: 1px solid var(--border-color) !important; }
.border-0 { border: none !important; }
.border-bottom { border-bottom: 1px solid var(--border-color) !important; }
.rounded { border-radius: var(--border-radius) !important; }
.rounded-10 { border-radius: var(--border-radius-md) !important; }
.rounded-pill { border-radius: 100px !important; }

/* Display & Flex */
.d-flex { display: flex !important; }
.d-inline-flex { display: inline-flex !important; }
.flex-column { flex-direction: column !important; }
.flex-wrap { flex-wrap: wrap !important; }
.flex-grow-1 { flex-grow: 1 !important; }
.justify-content-start { justify-content: flex-start !important; }
.justify-content-end { justify-content: flex-end !important; }
.justify-content-center { justify-content: center !important; }
.justify-content-between { justify-content: space-between !important; }
.align-items-start { align-items: flex-start !important; }
.align-items-center { align-items: center !important; }
.align-items-end { align-items: flex-end !important; }

/* Gap */
.gap-1 { gap: 4px !important; }
.gap-2 { gap: 8px !important; }
.gap-3 { gap: 12px !important; }
.gap-4 { gap: 16px !important; }
.gap-5 { gap: 24px !important; }

/* Sizing */
.w-100 { width: 100% !important; }
.h-100 { height: 100% !important; }
.min-w-0 { min-width: 0 !important; }

/* Position */
.position-relative { position: relative !important; }
.position-absolute { position: absolute !important; }

/* Misc */
.cursor-pointer { cursor: pointer !important; }
.text-decoration-none { text-decoration: none !important; }
.list-unstyled { list-style: none; padding-left: 0; }
.clearfix::after { content: ''; display: table; clear: both; }
.overflow-hidden { overflow: hidden !important; }
.overflow-auto { overflow: auto !important; }

/* ===== Dark Mode ===== */
body.dark-mode {
  --bg: #0F172A;
  --bg-surface: #1E293B;
  --bg-muted: #334155;
  --text-primary: #E2E8F0;
  --text-secondary: #CBD5E1;
  --text-muted: #94A3B8;
  --border-color: #334155;
  --sidebar-bg: #060D1A;
  --header-bg: #060D1A;
  --shadow-sm: 0 1px 2px rgba(0,0,0,0.3);
  --shadow: 0 4px 6px rgba(0,0,0,0.3);
}
body.dark-mode .card,
body.dark-mode .modal-content { background: var(--bg-surface); }
body.dark-mode .table { --bs-table-bg: transparent; }
body.dark-mode .table thead th { background: var(--bg-muted) !important; color: var(--text-primary) !important; border-color: var(--border-color); }
body.dark-mode .table tbody td { color: var(--text-primary); border-color: var(--border-color); }
body.dark-mode .table tbody tr:hover { background: rgba(255,255,255,0.02); }
body.dark-mode .table-striped > tbody > tr:nth-of-type(odd) > * { background: rgba(255,255,255,0.03); }
body.dark-mode .table-striped { box-shadow: 0 0 20px rgba(0,0,0,0.2); }
body.dark-mode .table tbody tr:last-child td:first-child,
body.dark-mode .table tbody tr:last-child td:last-child { border-radius: 0; }
body.dark-mode .table-wrap { border-color: var(--border-color); }
body.dark-mode .form-control,
body.dark-mode .form-select,
body.dark-mode .select2-container--default .select2-selection--single,
body.dark-mode .select2-container--default .select2-selection--multiple {
  background: var(--bg);
  color: var(--text-primary);
  border-color: var(--border-color);
}
body.dark-mode .form-control:focus { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(101, 113, 255, 0.15); }
body.dark-mode .form-label,
body.dark-mode .col-form-label { color: var(--text-primary); }
body.dark-mode .main-footer { background: var(--bg-surface); border-color: var(--border-color); }
body.dark-mode .content-header h1 { color: var(--text-primary); }
body.dark-mode .sidebar .sidebar-menu ul li a { color: rgba(255,255,255,0.45) !important; }
body.dark-mode .sidebar .sidebar-menu ul li a:hover { background: rgba(255,255,255,0.05); }
body.dark-mode .btn-close { filter: invert(1); }
body.dark-mode .nav-tabs .nav-link { color: var(--text-muted); }
body.dark-mode .nav-tabs .nav-link:hover,
body.dark-mode .nav-tabs .nav-link.active { color: var(--primary); }
body.dark-mode .dropdown-menu { background: var(--bg-surface); border-color: var(--border-color); }
body.dark-mode .dropdown-item { color: var(--text-primary); }
body.dark-mode .dropdown-item:hover { background: var(--bg-muted); }
body.dark-mode .page-link { background: var(--bg-muted); color: var(--text-muted); }
body.dark-mode .page-link:hover { color: var(--primary); }
body.dark-mode .page-item.active .page-link { background: var(--primary); color: #fff; }
body.dark-mode .alert-success { background: rgba(10, 192, 116, 0.15); border-color: rgba(10, 192, 116, 0.3); color: #6ee7b7; }
body.dark-mode .alert-danger { background: rgba(246, 41, 71, 0.15); border-color: rgba(246, 41, 71, 0.3); color: #fca5a5; }
body.dark-mode .alert-warning { background: rgba(255, 184, 33, 0.15); border-color: rgba(255, 184, 33, 0.3); color: #fde68a; }
body.dark-mode .alert-info { background: rgba(0, 153, 251, 0.15); border-color: rgba(0, 153, 251, 0.3); color: #93c5fd; }
body.dark-mode .badge.bg-primary { background: rgba(101, 113, 255, 0.2) !important; color: #a5b4fc; }
body.dark-mode .badge.bg-success { background: rgba(10, 192, 116, 0.2) !important; color: #6ee7b7; }
body.dark-mode .badge.bg-danger { background: rgba(246, 41, 71, 0.2) !important; color: #fca5a5; }
body.dark-mode .badge.bg-warning { background: rgba(255, 184, 33, 0.2) !important; color: #fde68a; }
body.dark-mode .badge.bg-info { background: rgba(0, 153, 251, 0.2) !important; color: #93c5fd; }
body.dark-mode .stat-card { border-color: var(--border-color); }
body.dark-mode .table-wrap { border-color: var(--border-color); }

/* ===== Auth Pages ===== */
body.login-page { font-family: var(--font-family); background: var(--bg); }
.login-card {
  background: var(--bg-surface);
  border-radius: var(--border-radius-md);
  box-shadow: var(--shadow-lg);
  padding: 2.5rem;
  width: 100%;
  max-width: 420px;
}
.login-card .form-label { font-weight: 500; font-size: 0.875rem; color: var(--text-primary); margin-bottom: 0.375rem; }
.login-card .input-group-text { background: var(--bg-muted); border: 1px solid #ced4da; color: var(--text-muted); }
.login-card .form-control:focus { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(101, 113, 255, 0.15); }
body.dark-mode .login-card { background: var(--bg-surface); border: 1px solid var(--border-color); }
body.dark-mode .login-card .form-control { background: var(--bg); border-color: var(--border-color); color: var(--text-primary); }
body.dark-mode .login-card .input-group-text { background: var(--bg); border-color: var(--border-color); color: var(--text-muted); }

/* ===== Responsive ===== */
@media (max-width: 991px) {
  .sidebar { margin-left: calc(var(--sidebar-width) * -1); }
  .page-wrapper { margin-left: 0 !important; }
  .main-footer { margin-left: 0 !important; }
}
@media (max-width: 575px) {
  .page-wrapper .content { padding: 12px; }
  .card-body { padding: var(--spacing); }
}
