/* DVR Admin Portal — Design System */
/* Primary: #2B3E8C (Blue), #8DC63F (Green) */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&display=swap');

:root {
  --primary: #2B3E8C;
  --primary-light: #3a50a8;
  --primary-dark: #1e2d66;
  --accent: #8DC63F;
  --accent-light: #a3d45e;
  --accent-dark: #6fa32e;
  --bg: #f0f2f5;
  --sidebar-bg: #1a1f3d;
  --sidebar-text: #a0a5c0;
  --sidebar-active: #8DC63F;
  --card: #ffffff;
  --text: #1a1a2e;
  --text-secondary: #6b7280;
  --border: #e5e7eb;
  --success: #10b981;
  --warning: #f59e0b;
  --danger: #ef4444;
  --info: #3b82f6;
  --radius: 12px;
  --shadow: 0 1px 3px rgba(0,0,0,.08), 0 1px 2px rgba(0,0,0,.06);
  --shadow-lg: 0 10px 25px rgba(0,0,0,.1);
  --transition: .2s ease;
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

body {
  font-family: 'Inter', -apple-system, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  min-height: 100vh;
}

a { color: var(--primary); text-decoration: none; }
a:hover { color: var(--primary-light); }

/* ── Layout ── */
.app-wrapper { 
  display: flex; 
  min-height: 100vh; 
  width: 100%;
  overflow-x: hidden; /* Prevent horizontal scroll during transitions */
}

.sidebar {
  width: 260px;
  background: var(--sidebar-bg);
  color: var(--sidebar-text);
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0; left: 0; bottom: 0;
  z-index: 100;
  transition: width var(--transition), transform var(--transition);
}

.sidebar-brand {
  border-bottom: 1px solid rgba(255,255,255,.08);
  display: flex;
  align-items: center;
  justify-content: center;
}
.sidebar-logo-img {
  width: 100%;
  height: auto;
  max-height: 63px;
  object-fit: contain;
  background: #fff;
  padding: 10px;
  box-shadow: 0 4px 12px rgba(0,0,0,.15);
}

.sidebar-logo-img.logo-icon { display: none; }
.login-logo-img {
  width: 220px;
  height: auto;
  max-height: 140px;
  object-fit: contain;
  background: #fff;
  border-radius: 16px;
  padding: 20px;
  margin: 0 auto 40px;
  display: block;
  box-shadow: 0 8px 24px rgba(0,0,0,.12);
}


.sidebar-nav { 
  flex: 1; 
  padding: 12px 0; 
  overflow-y: auto; 
  scrollbar-width: none; 
  -ms-overflow-style: none;
}
.sidebar-nav::-webkit-scrollbar { display: none; }

.nav-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 11px 20px;
  color: var(--sidebar-text);
  font-size: 14px;
  font-weight: 400;
  transition: all var(--transition);
  border-left: 3px solid transparent;
  cursor: pointer;
}

.nav-item:hover {
  background: rgba(255,255,255,.06);
  color: #fff;
}

.nav-item.active {
  background: rgba(141,198,63,.1);
  color: var(--sidebar-active);
  border-left-color: var(--sidebar-active);
  font-weight: 500;
}

.nav-item .icon {
  width: 20px;
  text-align: center;
  font-size: 16px;
  flex-shrink: 0;
}

.nav-section {
  padding: 16px 20px 6px;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: rgba(255,255,255,.3);
  font-weight: 600;
  white-space: nowrap;
}

/* ── Submenus ── */
.nav-item-wrapper {
  display: flex;
  flex-direction: column;
}

.nav-item.has-submenu .arrow {
  font-size: 9px;
  margin-left: auto;
  transition: transform var(--transition);
  opacity: 0.5;
}

.nav-item-wrapper.open .nav-item.has-submenu .arrow {
  transform: rotate(180deg);
}

.nav-submenu {
  display: none;
  background: rgba(0,0,0,0.15);
  padding: 4px 0;
}

.nav-item-wrapper.open .nav-submenu {
  display: block;
}

.submenu-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 20px 8px 32px;
  color: var(--sidebar-text);
  font-size: 13px;
  transition: all var(--transition);
  text-decoration: none;
}

.sub-icon {
  width: 18px;
  text-align: center;
  font-size: 13px;
  opacity: 0.6;
  flex-shrink: 0;
}

.submenu-item:hover .sub-icon,
.submenu-item.active .sub-icon {
  opacity: 1;
}

.submenu-item:hover {
  color: #fff;
  background: rgba(255,255,255,.05);
}

.submenu-item.active {
  color: var(--sidebar-active);
  font-weight: 500;
  background: rgba(141,198,63,.05);
}

.sidebar-collapsed .nav-item .arrow,
.sidebar-collapsed .nav-submenu {
  display: none !important;
}

/* ── Sidebar Collapsed State ── */
.sidebar-collapsed .sidebar {
  width: 70px;
}

.sidebar-collapsed .sidebar-brand {
  padding: 11.5px 10px;
}

.sidebar-collapsed .logo-full {
  display: none;
}

.sidebar-collapsed .logo-icon {
  display: block;
  width: 40px;
  height: 40px;
  padding: 0px;
  margin: 0 auto;
}

.sidebar-collapsed .sidebar-logo-img {
  max-height: 40px;
}

.sidebar-collapsed .nav-item span:not(.icon),
.sidebar-collapsed .nav-section {
  display: none;
}

.sidebar-collapsed .nav-item {
  justify-content: center;
  padding: 11px 0;
  border-left-width: 4px;
}

.sidebar-collapsed .nav-item .icon {
  margin: 0;
  font-size: 18px;
}

.sidebar-collapsed .main-content {
  margin-left: 70px;
}

.main-content {
  flex: 1;
  min-width: 0; /* Critical for chart responsiveness in flexbox */
  margin-left: 260px;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  transition: margin-left var(--transition);
  max-width: 100%;
  padding-top: 64px; /* Space for fixed topbar */
}

/* ── Top Bar ── */
.topbar {
  background: var(--card);
  padding: 0 32px;
  height: 64px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--border);
  position: fixed;
  top: 0;
  right: 0;
  left: 260px;
  z-index: 1000;
  transition: left var(--transition);
}

.sidebar-collapsed .topbar {
  left: 70px;
}

.topbar-title {
  font-size: 20px;
  font-weight: 600;
  color: var(--text);
}

.topbar-right {
  display: flex;
  align-items: center;
  gap: 16px;
}

.topbar-user {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 6px 12px;
  border-radius: 8px;
  cursor: pointer;
  transition: background var(--transition);
}

.topbar-user:hover { background: var(--bg); }

.topbar-avatar {
  width: 36px; height: 36px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--primary), var(--accent));
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-weight: 600;
  font-size: 14px;
}

.topbar-user-info { line-height: 1.3; }
.topbar-user-name { font-size: 13px; font-weight: 600; }
.topbar-user-role { font-size: 11px; color: var(--text-secondary); }

/* ── Page Content ── */
.page-content { padding: 28px 32px; flex: 1; }

.page-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 24px;
  flex-wrap: wrap;
  gap: 12px;
}

.page-header h1 {
  font-size: 24px;
  font-weight: 700;
  color: var(--text);
}

.breadcrumb {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  color: var(--text-secondary);
  margin-bottom: 4px;
}

/* ── Cards ── */
.card {
  background: var(--card);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  border: 1px solid var(--border);
}

.card-header {
  padding: 18px 24px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.card-header h3 { font-size: 16px; font-weight: 600; }
.card-body { padding: 24px; }
.card-footer { padding: 16px 24px; border-top: 1px solid var(--border); }

/* ── KPI Cards ── */
.kpi-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 20px;
  margin-bottom: 28px;
}

.kpi-card {
  background: var(--card);
  border-radius: var(--radius);
  padding: 24px;
  box-shadow: var(--shadow);
  border: 1px solid var(--border);
  position: relative;
  overflow: hidden;
  transition: transform var(--transition), box-shadow var(--transition);
}

.kpi-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-lg);
}

.kpi-card::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 4px;
}

.kpi-card.blue::before { background: linear-gradient(90deg, var(--primary), var(--primary-light)); }
.kpi-card.green::before { background: linear-gradient(90deg, var(--accent), var(--accent-light)); }
.kpi-card.orange::before { background: linear-gradient(90deg, #f59e0b, #fbbf24); }
.kpi-card.red::before { background: linear-gradient(90deg, #ef4444, #f87171); }

.kpi-icon {
  width: 48px; height: 48px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 22px;
  margin-bottom: 14px;
}

.kpi-card.blue .kpi-icon { background: rgba(43,62,140,.1); color: var(--primary); }
.kpi-card.green .kpi-icon { background: rgba(141,198,63,.1); color: var(--accent-dark); }
.kpi-card.orange .kpi-icon { background: rgba(245,158,11,.1); color: #d97706; }
.kpi-card.red .kpi-icon { background: rgba(239,68,68,.1); color: var(--danger); }

.kpi-value { font-size: 28px; font-weight: 700; line-height: 1.2; }
.kpi-label { font-size: 13px; color: var(--text-secondary); margin-top: 4px; }

/* ── Tables ── */
.table-wrapper { overflow-x: auto; }

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}

thead th {
  background: #f8f9fb;
  padding: 12px 16px;
  text-align: left;
  font-weight: 600;
  color: var(--text-secondary);
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: .5px;
  border-bottom: 2px solid var(--border);
  white-space: nowrap;
}

tbody td {
  padding: 14px 16px;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}

tbody tr { transition: background var(--transition); }
tbody tr:hover { background: #f8f9fb; }

/* ── Badges ── */
.badge {
  display: inline-flex;
  align-items: center;
  padding: 4px 10px;
  border-radius: 6px;
  font-size: 12px;
  font-weight: 500;
  white-space: nowrap;
}

.badge-success { background: rgba(16,185,129,.1); color: #059669; }
.badge-warning { background: rgba(245,158,11,.1); color: #d97706; }
.badge-danger { background: rgba(239,68,68,.1); color: #dc2626; }
.badge-info { background: rgba(59,130,246,.1); color: #2563eb; }
.badge-secondary { background: rgba(107,114,128,.1); color: #4b5563; }
.badge-primary { background: rgba(43,62,140,.1); color: var(--primary); }

/* ── Buttons ── */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 20px;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 500;
  border: none;
  cursor: pointer;
  transition: all var(--transition);
  font-family: inherit;
  line-height: 1.4;
  text-decoration: none;
}

.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-light); color: #fff; }
.btn-success { background: var(--accent); color: #fff; }
.btn-success:hover { background: var(--accent-dark); color: #fff; }
.btn-danger { background: var(--danger); color: #fff; }
.btn-danger:hover { background: #dc2626; color: #fff; }
.btn-outline {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text);
}
.btn-outline:hover { background: var(--bg); color: var(--text); }
.btn-sm { padding: 6px 12px; font-size: 13px; }
.btn-xs { padding: 4px 8px; font-size: 12px; border-radius: 6px; }
.btn-icon { padding: 8px; border-radius: 8px; }

/* ── Forms ── */
.form-group { margin-bottom: 18px; }

.form-label {
  display: block;
  font-size: 13px;
  font-weight: 500;
  color: var(--text);
  margin-bottom: 6px;
}

.form-control {
  width: 100%;
  height: 39px;
  padding: 8px 14px;
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 14px;
  font-family: inherit;
  transition: border-color var(--transition), box-shadow var(--transition);
  background: #fff;
  color: var(--text);
}

.form-control:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(43,62,140,.1);
}

select.form-control { 
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 24 24' stroke='%236B7280' stroke-width='2.5'%3E%3Cpath stroke-linecap='round' stroke-linejoin='round' d='M19.5 8.25l-7.5 7.5-7.5-7.5'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 14px center;
  background-size: 12px;
  padding-right: 40px;
}
textarea.form-control { resize: vertical; min-height: 100px; }

.form-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 16px;
}

.form-actions {
  display: flex;
  gap: 12px;
  margin-top: 24px;
  padding-top: 20px;
  border-top: 1px solid var(--border);
}

/* ── Filter Bar ── */
.filter-bar {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: nowrap;
  margin-bottom: 20px;
  overflow-x: auto;
  padding-bottom: 5px;
}

.filter-bar .form-control {
  width: auto;
  min-width: 110px;
}

.filter-bar .select2-container {
  width: 250px !important;
  min-width: 150px;
}

.search-box {
  position: relative;
  flex: 1;
  min-width: 250px;
  max-width: 400px;
}

.search-box input {
  padding-left: 40px;
}

.search-box::before {
  content: '🔍';
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  font-size: 14px;
}

/* ── List Controls (Header) ── */
.list-controls {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 24px;
  border-bottom: 1px solid var(--border);
  background: #fff;
  flex-wrap: wrap;
  gap: 16px;
}

.list-controls-left {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 13px;
  color: var(--text-secondary);
}

.list-controls-right {
  display: flex;
  align-items: center;
  gap: 12px;
  flex: 1;
  justify-content: flex-end;
  min-width: 250px;
}

/* ── Modals ── */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.5);
  z-index: 1000;
  display: none;
  align-items: center;
  justify-content: center;
  animation: fadeIn .2s ease;
}

.modal-backdrop.active { display: flex; }

.modal {
  background: var(--card);
  border-radius: var(--radius);
  width: 90%;
  max-width: 560px;
  max-height: 85vh;
  overflow-y: auto;
  box-shadow: var(--shadow-lg);
  animation: slideUp .3s ease;
}

.modal-header {
  padding: 20px 24px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.modal-header h3 { font-size: 18px; font-weight: 600; }
.modal-close { cursor: pointer; font-size: 20px; color: var(--text-secondary); background: none; border: none; }
.modal-body { padding: 24px; }
.modal-footer { padding: 16px 24px; border-top: 1px solid var(--border); display: flex; justify-content: flex-end; gap: 12px; }

/* ── Toast ── */
.toast-container {
  position: fixed;
  top: 24px;
  right: 24px;
  z-index: 2000;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.toast {
  padding: 14px 20px;
  border-radius: 10px;
  background: var(--card);
  box-shadow: var(--shadow-lg);
  font-size: 14px;
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 300px;
  animation: slideIn .3s ease;
  border-left: 4px solid var(--primary);
}

.toast.success { border-left-color: var(--success); }
.toast.error { border-left-color: var(--danger); }
.toast.warning { border-left-color: var(--warning); }

/* ── Staff Avatar ── */
.staff-avatar {
  width: 36px; height: 36px;
  border-radius: 50%;
  object-fit: cover;
  border: 2px solid var(--border);
}

.staff-avatar-placeholder {
  width: 36px; height: 36px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--primary), var(--accent));
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-weight: 600;
  font-size: 14px;
}

.staff-info { display: flex; align-items: center; gap: 12px; }
.staff-name { font-weight: 500; }
.staff-code { font-size: 12px; color: var(--text-secondary); }

/* ── Charts ── */
.chart-wrapper {
  position: relative;
  width: 100%;
  height: 300px; /* Consistent height for both charts */
}

.charts-grid {
  display: grid;
  grid-template-columns: 2fr 1fr;
  gap: 20px;
  margin-bottom: 28px;
}

.charts-grid > *, .grid-2 > * {
  min-width: 0; /* Prevents children from overflowing parent grid */
}

@media (max-width: 1200px) {
  .charts-grid {
    grid-template-columns: 1fr;
  }
}

/* ── Activity List ── */
.activity-list { list-style: none; }

.activity-item {
  display: flex;
  gap: 12px;
  padding: 12px 0;
  border-bottom: 1px solid var(--border);
}

.activity-item:last-child { border-bottom: none; }

.activity-dot {
  width: 8px; height: 8px;
  border-radius: 50%;
  background: var(--accent);
  margin-top: 6px;
  flex-shrink: 0;
}

.activity-text { font-size: 14px; }
.activity-time { font-size: 12px; color: var(--text-secondary); }

/* ── Pagination ── */
.pagination {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 4px 0;
  flex-wrap: wrap;
  gap: 16px;
}

.pagination-info { 
  font-size: 13px; 
  color: var(--text-secondary);
  font-weight: 500;
}

.pagination-links {
  display: flex;
  gap: 6px;
}

.pagination-links a, .pagination-links span {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 36px;
  height: 36px;
  padding: 0 8px;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 500;
  border: 1px solid var(--border);
  color: var(--text);
  background: #fff;
  transition: all var(--transition);
}

.pagination-links a:hover { 
  background: var(--bg); 
  border-color: var(--primary-light);
  color: var(--primary);
  transform: translateY(-1px);
}

.pagination-links .active-page { 
  background: var(--primary); 
  color: #fff !important; 
  border-color: var(--primary);
  box-shadow: 0 4px 10px rgba(43,62,140,0.2);
}

.pagination-links .disabled {
  opacity: 0.5;
  cursor: not-allowed;
  pointer-events: none;
}

/* ── Tabs ── */
.tabs-container {
  margin-bottom: 24px;
}

.tabs {
  display: flex;
  gap: 4px;
  border-bottom: 1px solid var(--border);
  padding-bottom: 0;
  overflow-x: auto;
  scrollbar-width: none;
  -ms-overflow-style: none;
}

.tabs::-webkit-scrollbar {
  display: none;
}

.tab-item {
  padding: 12px 20px;
  text-decoration: none;
  color: var(--text-secondary);
  border-bottom: 2px solid transparent;
  font-weight: 600;
  font-size: 14px;
  white-space: nowrap;
  display: flex;
  align-items: center;
  gap: 8px;
  transition: all var(--transition);
}

.tab-item:hover {
  color: var(--accent);
  background: rgba(141,198,63,.03);
}

.tab-item.active {
  color: var(--accent);
  border-bottom-color: var(--accent);
}

/* ── Empty State ── */
.empty-state {
  text-align: center;
  padding: 60px 20px;
  color: var(--text-secondary);
}

.empty-state .icon { font-size: 48px; margin-bottom: 16px; }
.empty-state h3 { font-size: 18px; color: var(--text); margin-bottom: 8px; }

/* ── Diff View ── */
.diff-row { display: flex; gap: 12px; padding: 8px 0; border-bottom: 1px solid var(--border); font-size: 14px; }
.diff-label { width: 140px; color: var(--text-secondary); font-weight: 500; flex-shrink: 0; }
.diff-old { color: var(--danger); text-decoration: line-through; }
.diff-new { color: var(--success); font-weight: 500; }

/* ── Login Page ── */
.login-wrapper {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, var(--primary-dark) 0%, var(--primary) 50%, #1a3a6c 100%);
  padding: 20px;
}

.login-card {
  background: var(--card);
  border-radius: 16px;
  padding: 48px 40px;
  width: 100%;
  max-width: 420px;
  box-shadow: 0 20px 60px rgba(0,0,0,.3);
}

.login-logo {
  text-align: center;
  margin-bottom: 32px;
}

.login-logo .logo-icon {
  width: 64px; height: 64px;
  margin: 0 auto 16px;
  background: linear-gradient(135deg, var(--primary), var(--accent));
  border-radius: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 28px;
  color: #fff;
  font-weight: 700;
}

.login-logo h1 { font-size: 22px; font-weight: 700; color: var(--text); }
.login-logo p { font-size: 14px; color: var(--text-secondary); margin-top: 4px; }

.login-error {
  background: rgba(239,68,68,.08);
  border: 1px solid rgba(239,68,68,.2);
  color: var(--danger);
  padding: 10px 14px;
  border-radius: 8px;
  font-size: 13px;
  margin-bottom: 18px;
}

.login-card .btn-primary {
  width: 100%;
  justify-content: center;
  padding: 12px;
  font-size: 15px;
  font-weight: 600;
}

/* ── Calendar ── */
.calendar-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 4px;
}

.calendar-header {
  padding: 8px;
  text-align: center;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-secondary);
}

.calendar-day {
  aspect-ratio: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 500;
  cursor: default;
}

.calendar-day.present { background: rgba(16,185,129,.15); color: #059669; }
.calendar-day.absent { background: rgba(239,68,68,.15); color: #dc2626; }
.calendar-day.late { background: rgba(245,158,11,.15); color: #d97706; }
.calendar-day.leave { background: rgba(59,130,246,.15); color: #2563eb; }
.calendar-day.half_day { background: rgba(139,92,246,.15); color: #7c3aed; }
.calendar-day.empty { background: transparent; }

/* ── Print ── */
@media print {
  .sidebar, .topbar, .filter-bar, .btn, .pagination { display: none !important; }
  .main-content { margin-left: 0 !important; }
  .page-content { padding: 0 !important; }
}

/* ── Animations ── */
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes slideUp { from { opacity: 0; transform: translateY(20px); } to { opacity: 1; transform: translateY(0); } }
@keyframes slideIn { from { opacity: 0; transform: translateX(40px); } to { opacity: 1; transform: translateX(0); } }

/* ── Utility ── */
.text-right { text-align: right; }
.text-center { text-align: center; }
.mt-2 { margin-top: 8px; }
.mt-4 { margin-top: 16px; }
.mb-4 { margin-bottom: 16px; }
.gap-2 { gap: 8px; }
.flex { display: flex; }
.flex-wrap { flex-wrap: wrap; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
.w-full { width: 100%; }
.truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 200px; }

/* ── Select2 Custom Styling ── */
.select2-container--default .select2-selection--single {
  height: 39px !important;
  border: 1px solid var(--border) !important;
  border-radius: 8px !important;
  background-color: #fff !important;
  display: flex !important;
  align-items: center !important;
  box-sizing: border-box !important;
  padding: 0 !important;
}

.select2-container--default .select2-selection--single .select2-selection__rendered {
  line-height: 39px !important;
  padding-left: 14px !important;
  padding-right: 35px !important;
  color: var(--text) !important;
  font-size: 14px !important;
}

.select2-container--default .select2-selection--single .select2-selection__placeholder {
  color: var(--text) !important; /* Match selected text color */
}

.select2-container--default .select2-selection--single .select2-selection__arrow {
  height: 39px !important;
  width: 34px !important;
  top: 0 !important;
  right: 0 !important;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 24 24' stroke='%236B7280' stroke-width='2.5'%3E%3Cpath stroke-linecap='round' stroke-linejoin='round' d='M19.5 8.25l-7.5 7.5-7.5-7.5'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: center;
  background-size: 12px;
}

.select2-container--default .select2-selection--single .select2-selection__arrow b {
  display: none !important;
}

.select2-container--default.select2-container--focus .select2-selection--single {
  border-color: var(--primary) !important;
  box-shadow: 0 0 0 3px rgba(43,62,140,.1) !important;
  outline: none !important;
}

.select2-container--default.select2-container--focus .select2-selection--single {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(43,62,140,.1);
}

.select2-dropdown {
  border: 1px solid var(--border);
  border-radius: 8px;
  box-shadow: var(--shadow-lg);
  overflow: hidden;
  z-index: 10001;
}

.select2-results__option {
  padding: 10px 14px;
  font-size: 14px;
}

.select2-container--default .select2-results__option--highlighted[aria-selected] {
  background-color: var(--primary);
}

.select2-search--dropdown .select2-search__field {
  border-radius: 6px;
  border: 1px solid var(--border);
  padding: 8px;
}

.select2-container--default .select2-selection--single .select2-selection__placeholder {
  color: var(--text-secondary);
}

/* ── Mobile Responsive ── */

.sidebar-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.5);
  z-index: 95;
  display: none;
  opacity: 0;
  transition: opacity var(--transition);
}

@media (max-width: 992px) {
  .sidebar {
    transform: translateX(-100%);
    box-shadow: 0 0 40px rgba(0,0,0,.3);
  }
  
  .main-content {
    margin-left: 0 !important;
  }
  
  .topbar {
    padding: 0 20px;
    left: 0 !important;
  }
  
  .page-content {
    padding: 20px;
  }
  
  .sidebar-mobile-open .sidebar {
    transform: translateX(0);
  }
  
  .sidebar-mobile-open .sidebar-backdrop {
    display: block;
    opacity: 1;
  }

  .topbar-user-info {
    display: none;
  }

  .grid-2 {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 768px) {
  .kpi-grid {
    grid-template-columns: 1fr;
  }
  
  .page-header {
    flex-direction: column;
    align-items: flex-start;
  }
  
  .page-header h1 {
    font-size: 20px;
  }
  
  .login-card {
    padding: 32px 24px;
  }

  .filter-bar {
    flex-direction: column;
    align-items: stretch;
  }

  .filter-bar .form-control, 
  .search-box {
    width: 100%;
    max-width: 100%;
  }

  .form-actions {
    flex-direction: column;
  }

  .form-actions .btn {
    width: 100%;
    justify-content: center;
  }
}

@media (max-width: 576px) {
  .topbar-title {
    font-size: 16px;
  }
  
  .card-body {
    padding: 16px;
  }

  .card-header {
    padding: 14px 16px;
  }
}

/* Select2 Custom Styling */
.select2-container--default .select2-selection--multiple {
  border: 1px solid var(--border);
  border-radius: 8px;
  min-height: 40px;
  padding: 4px 8px;
  transition: all var(--transition);
}
.select2-container--default.select2-container--focus .select2-selection--multiple {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(43,62,140,.1);
  outline: none;
}
.select2-container--default .select2-selection--multiple .select2-selection__choice {
  background-color: var(--primary);
  border: none;
  color: #fff;
  border-radius: 6px;
  padding: 2px 8px 2px 24px;
  font-size: 13px;
  margin-top: 4px;
}
.select2-container--default .select2-selection--multiple .select2-selection__choice__remove {
  color: rgba(255,255,255,.8);
  border-right: none;
  padding: 0 8px;
  left: 0;
}
.select2-container--default .select2-selection--multiple .select2-selection__choice__remove:hover {
  background: rgba(255,255,255,.2);
  color: #fff;
}
.select2-dropdown {
  border: 1px solid var(--border);
  border-radius: 12px;
  box-shadow: var(--shadow-lg);
  overflow: hidden;
}
.select2-container--default .select2-results__option--highlighted[aria-selected] {
  background-color: var(--primary);
}
.select2-container--default .select2-search--inline .select2-search__field {
    margin-top: 7px;
}


/* ── Print Styles ── */
@media print {
  .sidebar, .topbar, .list-controls, .card-footer, .no-print, .breadcrumb, .btn, th:last-child, td:last-child, th:first-child, td:first-child, .page-header, .card-header, .kpi-grid {
    display: none !important;
  }
  html, body, .app-wrapper {
    overflow: visible !important;
    height: auto !important;
  }
  .main-content {
    margin-left: 0 !important;
    padding: 0 !important;
    overflow: visible !important;
  }
  .table-wrapper {
    overflow: visible !important;
  }
  .card {
    border: none !important;
    box-shadow: none !important;
    overflow: visible !important;
  }
  .page-header {
    margin-bottom: 20px !important;
  }
  table {
    width: 100% !important;
    border-collapse: collapse !important;
  }
  th, td {
    border: 1px solid #ddd !important;
    padding: 8px !important;
    font-size: 12px !important;
  }
}
