/* ============================================================
   NR United HR Portal - Main Stylesheet
   Design: Professional Corporate with Kuwait Identity
   ============================================================ */

@import url('https://fonts.googleapis.com/css2?family=IBM+Plex+Sans:wght@300;400;500;600;700&family=IBM+Plex+Sans+Arabic:wght@300;400;500;600;700&display=swap');

:root {
  --primary: #0F2B5B;
  --primary-light: #1A3F7D;
  --primary-dark: #081D40;
  --accent: #C8960C;
  --accent-light: #F0B429;
  --accent-dark: #9A7209;
  --bg: #F4F6FA;
  --bg-card: #FFFFFF;
  --bg-sidebar: #0F2B5B;
  --text-primary: #0F2B5B;
  --text-secondary: #5A6A85;
  --text-light: #94A3B8;
  --border: #E2E8F0;
  --border-light: #F1F5F9;
  --success: #10B981;
  --warning: #F59E0B;
  --danger: #EF4444;
  --info: #3B82F6;
  --muted: #94A3B8;
  --sidebar-w: 260px;
  --header-h: 64px;
  --radius: 10px;
  --radius-lg: 16px;
  --shadow: 0 1px 3px rgba(15,43,91,0.08), 0 4px 16px rgba(15,43,91,0.06);
  --shadow-md: 0 4px 24px rgba(15,43,91,0.12);
  --transition: 0.2s ease;
}

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

body {
  font-family: 'IBM Plex Sans', sans-serif;
  background: var(--bg);
  color: var(--text-primary);
  font-size: 14px;
  line-height: 1.6;
}

/* ============================================================
   LAYOUT
   ============================================================ */
.app-wrapper {
  display: flex;
  min-height: 100vh;
}

/* Sidebar */
.sidebar {
  width: var(--sidebar-w);
  background: var(--bg-sidebar);
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0; left: 0; bottom: 0;
  z-index: 200;
  transition: transform 0.3s ease;
  overflow-y: auto;
  overflow-x: hidden;
}

.sidebar::-webkit-scrollbar { width: 4px; }
.sidebar::-webkit-scrollbar-track { background: transparent; }
.sidebar::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.2); border-radius: 2px; }

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

/* Close button inside sidebar — mobile only */
.sidebar-close {
  display: none;
  margin-left: auto;
  background: none;
  border: none;
  color: rgba(255,255,255,0.6);
  font-size: 22px;
  cursor: pointer;
  line-height: 1;
  padding: 4px;
}

.sidebar-logo {
  width: 40px; height: 40px;
  background: var(--accent);
  border-radius: 10px;
  display: flex; align-items: center; justify-content: center;
  font-size: 18px; font-weight: 700; color: white;
  flex-shrink: 0;
}

.sidebar-brand-text {
  display: flex; flex-direction: column;
}

.sidebar-brand-text strong {
  color: #fff;
  font-size: 13px;
  font-weight: 600;
  line-height: 1.2;
}

.sidebar-brand-text span {
  color: var(--accent-light);
  font-size: 11px;
  opacity: 0.8;
}

.sidebar-company {
  padding: 12px 20px;
  background: rgba(255,255,255,0.05);
  margin: 12px 12px 0;
  border-radius: 8px;
  color: rgba(255,255,255,0.7);
  font-size: 12px;
}
.sidebar-company strong { color: #fff; display: block; font-size: 13px; }

.sidebar-nav {
  flex: 1;
  padding: 16px 12px;
  overflow-y: auto;
  overflow-x: hidden;
}

/* Custom scrollbar for sidebar nav */
#sidebarNav::-webkit-scrollbar { width: 3px; }
#sidebarNav::-webkit-scrollbar-track { background: transparent; }
#sidebarNav::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.15); border-radius: 2px; }

.nav-section { margin-bottom: 4px; }

.nav-section-title {
  padding: 8px 8px 4px;
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: rgba(255,255,255,0.35);
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 12px;
  border-radius: 8px;
  color: rgba(255,255,255,0.65);
  text-decoration: none;
  font-size: 13.5px;
  font-weight: 400;
  transition: all var(--transition);
  margin-bottom: 1px;
  cursor: pointer;
}

.nav-item:hover {
  background: rgba(255,255,255,0.1);
  color: #fff;
}

.nav-item.active {
  background: var(--accent);
  color: #fff;
  font-weight: 500;
}

.nav-item .nav-icon {
  width: 18px; height: 18px;
  flex-shrink: 0;
  opacity: 0.8;
}

.nav-item.active .nav-icon { opacity: 1; }

.nav-badge {
  margin-left: auto;
  background: var(--danger);
  color: white;
  font-size: 10px;
  padding: 1px 6px;
  border-radius: 10px;
  font-weight: 600;
}

.sidebar-footer {
  padding: 16px 12px;
  border-top: 1px solid rgba(255,255,255,0.1);
}

/* Sidebar overlay — mobile */
.sidebar-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.5);
  z-index: 199;
  backdrop-filter: blur(2px);
}
.sidebar-overlay.active { display: block; }

/* Main Content */
.main-content {
  margin-left: var(--sidebar-w);
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

/* Header */
.topbar {
  height: var(--header-h);
  background: #fff;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  padding: 0 24px;
  gap: 16px;
  position: sticky;
  top: 0;
  z-index: 90;
  box-shadow: 0 1px 4px rgba(0,0,0,0.04);
}

/* Hamburger — shown on mobile */
.topbar-hamburger {
  display: none;
  width: 40px; height: 40px;
  align-items: center; justify-content: center;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: none;
  cursor: pointer;
  color: var(--text-primary);
  flex-shrink: 0;
}

.topbar-title {
  font-size: 16px;
  font-weight: 600;
  color: var(--text-primary);
  flex: 1;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.topbar-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.topbar-btn {
  position: relative;
  width: 36px; height: 36px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: transparent;
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  color: var(--text-secondary);
  transition: all var(--transition);
}
.topbar-btn:hover { background: var(--bg); border-color: var(--primary); color: var(--primary); }

.notif-dot {
  position: absolute;
  top: 6px; right: 6px;
  width: 8px; height: 8px;
  background: var(--danger);
  border-radius: 50%;
  border: 2px solid #fff;
}

.user-menu {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 6px 12px;
  border-radius: 8px;
  border: 1px solid var(--border);
  cursor: pointer;
  transition: all var(--transition);
}
.user-menu:hover { border-color: var(--primary); background: var(--bg); }

.user-avatar {
  width: 32px; height: 32px;
  border-radius: 50%;
  background: var(--primary);
  color: #fff;
  display: flex; align-items: center; justify-content: center;
  font-size: 13px;
  font-weight: 600;
  flex-shrink: 0;
}

.user-info {
  display: flex;
  flex-direction: column;
  line-height: 1.2;
}

.user-name { font-size: 13px; font-weight: 600; color: var(--text-primary); }
.user-role { font-size: 11px; color: var(--text-secondary); }

/* Page Content */
.page-content {
  flex: 1;
  padding: 24px;
  overflow-x: hidden;
}

.page-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 24px;
  flex-wrap: wrap;
  gap: 12px;
}

.page-header h1 {
  font-size: 22px;
  font-weight: 700;
  color: var(--text-primary);
}

.page-header p {
  font-size: 13px;
  color: var(--text-secondary);
  margin-top: 2px;
}

/* ============================================================
   CARDS
   ============================================================ */
.card {
  background: var(--bg-card);
  border-radius: var(--radius-lg);
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
  overflow: hidden;
}

.card-header {
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.card-title {
  font-size: 15px;
  font-weight: 600;
  color: var(--text-primary);
}

.card-body { padding: 20px; }

/* ============================================================
   STATS GRID
   ============================================================ */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
  margin-bottom: 24px;
}

.stat-card {
  background: var(--bg-card);
  border-radius: var(--radius-lg);
  border: 1px solid var(--border);
  padding: 20px;
  display: flex;
  align-items: flex-start;
  gap: 16px;
  box-shadow: var(--shadow);
}

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

.stat-info { flex: 1; min-width: 0; }
.stat-label { font-size: 12px; color: var(--text-secondary); font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.stat-value { font-size: 26px; font-weight: 700; color: var(--text-primary); line-height: 1.1; }
.stat-sub   { font-size: 12px; color: var(--text-secondary); margin-top: 2px; }

/* ============================================================
   TABLE
   ============================================================ */
.table-wrapper { overflow-x: auto; -webkit-overflow-scrolling: touch; }

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13.5px;
}

table th {
  padding: 10px 16px;
  text-align: left;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-secondary);
  background: var(--bg);
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}

table td {
  padding: 14px 16px;
  border-bottom: 1px solid var(--border-light);
  vertical-align: middle;
}

table tbody tr:hover { background: var(--bg); }
table tbody tr:last-child td { border-bottom: none; }

/* Mobile card view for tables */
.mobile-card {
  display: none;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px 16px;
  margin-bottom: 10px;
  box-shadow: var(--shadow);
}

.mobile-card-row {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  padding: 5px 0;
  font-size: 13px;
  border-bottom: 1px solid var(--border-light);
}
.mobile-card-row:last-child { border-bottom: none; }
.mobile-card-label { color: var(--text-secondary); font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.04em; flex-shrink: 0; margin-right: 8px; }
.mobile-card-value { text-align: right; font-weight: 500; }

/* ============================================================
   FORMS
   ============================================================ */
.form-group { margin-bottom: 16px; }
.form-group label {
  display: block;
  font-size: 12.5px;
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: 6px;
}

.form-group input,
.form-group select,
.form-group textarea {
  width: 100%;
  padding: 10px 14px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  font-size: 14px;
  font-family: inherit;
  color: var(--text-primary);
  background: var(--bg-card);
  transition: border-color var(--transition);
  -webkit-appearance: none;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(15,43,91,0.08);
}

.form-row { display: grid; gap: 16px; }
.form-row.cols-2 { grid-template-columns: 1fr 1fr; }
.form-row.cols-3 { grid-template-columns: 1fr 1fr 1fr; }
.form-row.cols-4 { grid-template-columns: 1fr 1fr 1fr 1fr; }

/* ============================================================
   BUTTONS
   ============================================================ */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 9px 18px;
  border-radius: var(--radius);
  font-size: 13.5px;
  font-weight: 500;
  cursor: pointer;
  border: 1.5px solid var(--border);
  background: var(--bg-card);
  color: var(--text-primary);
  transition: all var(--transition);
  white-space: nowrap;
  text-decoration: none;
  font-family: inherit;
}
.btn:hover { background: var(--bg); border-color: var(--text-secondary); }

.btn-primary, .btn-accent {
  background: var(--primary);
  color: #fff;
  border-color: var(--primary);
}
.btn-primary:hover, .btn-accent:hover { background: var(--primary-light); border-color: var(--primary-light); }

.btn-outline { background: transparent; border-color: var(--primary); color: var(--primary); }
.btn-outline:hover { background: var(--primary); color: #fff; }

.btn-ghost { background: transparent; border-color: transparent; color: var(--text-secondary); }
.btn-ghost:hover { background: var(--bg); color: var(--text-primary); }

.btn-success { background: var(--success); color: #fff; border-color: var(--success); }
.btn-danger  { background: var(--danger);  color: #fff; border-color: var(--danger); }
.btn-warning { background: var(--warning); color: #fff; border-color: var(--warning); }

.btn-sm  { padding: 5px 10px; font-size: 12px; }
.btn-lg  { padding: 12px 24px; font-size: 15px; }
.btn-block { width: 100%; }

/* ============================================================
   BADGES
   ============================================================ */
.badge {
  display: inline-flex;
  align-items: center;
  padding: 3px 10px;
  border-radius: 20px;
  font-size: 11px;
  font-weight: 600;
  white-space: nowrap;
}
.badge-success  { background: #D1FAE5; color: #065F46; }
.badge-warning  { background: #FEF3C7; color: #92400E; }
.badge-danger   { background: #FEE2E2; color: #991B1B; }
.badge-info     { background: #DBEAFE; color: #1E40AF; }
.badge-purple   { background: #EDE9FE; color: #5B21B6; }
.badge-secondary{ background: #F1F5F9; color: #475569; }
.badge-light    { background: rgba(255,255,255,0.2); color: #fff; }

/* ============================================================
   ALERTS
   ============================================================ */
.alert {
  padding: 12px 16px;
  border-radius: var(--radius);
  font-size: 13.5px;
  margin-bottom: 16px;
  border: 1px solid;
}
.alert-success { background: #F0FDF4; border-color: #BBF7D0; color: #15803D; }
.alert-danger  { background: #FFF1F2; border-color: #FECDD3; color: #BE123C; }
.alert-warning { background: #FFFBEB; border-color: #FDE68A; color: #B45309; }
.alert-info    { background: #EFF6FF; border-color: #BFDBFE; color: #1E40AF; }
.alert-auto    { animation: fadeOut 0.4s ease 4s forwards; }

@keyframes fadeOut { to { opacity: 0; max-height: 0; padding: 0; margin: 0; overflow: hidden; } }

/* ============================================================
   MODAL
   ============================================================ */
.modal-backdrop {
  position: fixed; inset: 0;
  background: rgba(0,0,0,0.5);
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
}

.modal {
  background: #fff;
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-md);
  width: 100%;
  max-width: 560px;
  max-height: 90vh;
  overflow-y: auto;
}

.modal-lg { max-width: 860px; }
.modal-sm { max-width: 420px; }

/* ============================================================
   DATA TABLE (named class)
   ============================================================ */
.data-table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
.data-table th {
  padding: 10px 16px;
  text-align: left;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-secondary);
  background: var(--bg);
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}
.data-table td {
  padding: 12px 16px;
  border-bottom: 1px solid var(--border-light);
  vertical-align: middle;
}
.data-table tbody tr:hover { background: var(--bg); }
.data-table tbody tr:last-child td { border-bottom: none; }

/* ============================================================
   INPUT WITH ICON
   ============================================================ */
.input-icon-wrap { position: relative; }
.input-icon-wrap input { padding-left: 36px; }
.input-icon-wrap .icon {
  position: absolute;
  left: 10px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-secondary);
}

/* ============================================================
   EMPLOYEE CARD
   ============================================================ */
.emp-avatar {
  width: 36px; height: 36px;
  border-radius: 50%;
  background: var(--primary);
  color: white;
  display: flex; align-items: center; justify-content: center;
  font-size: 14px; font-weight: 600;
  flex-shrink: 0;
}

.emp-info { display: flex; align-items: center; gap: 10px; }
.emp-name { font-weight: 500; color: var(--text-primary); font-size: 13.5px; }
.emp-sub  { font-size: 12px; color: var(--text-secondary); }

/* ============================================================
   PAYSLIP
   ============================================================ */
.payslip {
  background: #fff;
  padding: 32px;
  max-width: 800px;
  margin: 0 auto;
}

.payslip-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 32px;
  padding-bottom: 20px;
  border-bottom: 2px solid var(--primary);
}

.payslip-company-name { font-size: 22px; font-weight: 700; color: var(--primary); }
.payslip-title { text-align: right; color: var(--text-secondary); }

.payslip-employee-info {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  background: var(--bg);
  padding: 16px;
  border-radius: 8px;
  margin-bottom: 24px;
}

.payslip-info-item { font-size: 13px; }
.payslip-info-item label { color: var(--text-secondary); }
.payslip-info-item span { font-weight: 600; color: var(--text-primary); }

.payslip-earnings, .payslip-deductions { margin-bottom: 20px; }

.payslip-section-title {
  font-size: 13px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--primary);
  margin-bottom: 10px;
  padding-bottom: 6px;
  border-bottom: 1px solid var(--border);
}

.payslip-line {
  display: flex;
  justify-content: space-between;
  padding: 6px 0;
  font-size: 13.5px;
  border-bottom: 1px dashed var(--border-light);
}

.payslip-total {
  background: var(--primary);
  color: white;
  padding: 14px 20px;
  border-radius: 8px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 16px;
  font-weight: 700;
}

/* ============================================================
   LOGIN PAGE
   ============================================================ */
.login-page {
  min-height: 100vh;
  display: flex;
  background: var(--primary);
}

.login-left {
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  padding: 48px;
  color: white;
  background: linear-gradient(135deg, var(--primary-dark) 0%, var(--primary-light) 100%);
  position: relative;
  overflow: hidden;
}

.login-left::before {
  content: '';
  position: absolute;
  top: -50%; right: -20%;
  width: 600px; height: 600px;
  background: var(--accent);
  border-radius: 50%;
  opacity: 0.05;
}

.login-right {
  width: 460px;
  background: #fff;
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: 48px;
}

.login-brand {
  display: flex;
  align-items: center;
  gap: 16px;
  margin-bottom: 40px;
}

.login-brand-logo {
  width: 60px; height: 60px;
  background: var(--accent);
  border-radius: 16px;
  display: flex; align-items: center; justify-content: center;
  font-size: 26px; font-weight: 700; color: white;
}

.login-brand-text h1 { font-size: 20px; font-weight: 700; color: var(--text-primary); }
.login-brand-text p  { font-size: 13px; color: var(--text-secondary); }

/* ============================================================
   UTILITIES
   ============================================================ */
.text-center { text-align: center; }
.text-right  { text-align: right; }
.text-muted  { color: var(--text-secondary); }
.text-danger { color: var(--danger); }
.text-success{ color: var(--success); }
.text-primary{ color: var(--primary); }

.d-flex      { display: flex; }
.d-grid      { display: grid; }
.align-center{ align-items: center; }
.justify-between { justify-content: space-between; }
.gap-8  { gap: 8px; }
.gap-12 { gap: 12px; }
.gap-16 { gap: 16px; }

.mt-4  { margin-top: 4px; }
.mt-8  { margin-top: 8px; }
.mt-16 { margin-top: 16px; }
.mt-24 { margin-top: 24px; }
.mb-4  { margin-bottom: 4px; }
.mb-8  { margin-bottom: 8px; }
.mb-16 { margin-bottom: 16px; }
.mb-24 { margin-bottom: 24px; }

.w-full { width: 100%; }
.hidden { display: none; }
.divider { height: 1px; background: var(--border); margin: 16px 0; }

/* Toast */
.toast-container {
  position: fixed;
  top: 20px; right: 20px;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-width: 380px;
}

.toast {
  background: var(--text-primary);
  color: white;
  padding: 12px 16px;
  border-radius: 8px;
  font-size: 13.5px;
  display: flex;
  align-items: center;
  gap: 10px;
  box-shadow: var(--shadow-md);
  animation: slideIn 0.3s ease;
}

.toast.success { background: var(--success); }
.toast.error   { background: var(--danger); }
.toast.warning { background: var(--warning); }

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

/* Progress */
.progress {
  height: 6px;
  background: var(--bg);
  border-radius: 3px;
  overflow: hidden;
}
.progress-bar {
  height: 100%;
  border-radius: 3px;
  background: var(--primary);
  transition: width 0.3s ease;
}
.progress-bar.success { background: var(--success); }
.progress-bar.warning { background: var(--warning); }
.progress-bar.danger  { background: var(--danger); }

/* Empty State */
.empty-state {
  text-align: center;
  padding: 48px 24px;
  color: var(--text-secondary);
}
.empty-state .empty-icon { font-size: 48px; opacity: 0.3; margin-bottom: 12px; }
.empty-state p { font-size: 15px; font-weight: 500; }
.empty-state span { font-size: 13px; display: block; margin-top: 4px; }

/* Dropdown */
.dropdown { position: relative; display: inline-flex; }
.dropdown-menu {
  position: absolute;
  top: calc(100% + 4px);
  right: 0;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 10px;
  box-shadow: var(--shadow-md);
  min-width: 200px;
  z-index: 500;
  overflow: hidden;
  display: none;
}
.dropdown-menu.open { display: block; }
.dropdown-item {
  padding: 9px 14px;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13.5px;
  color: var(--text-primary);
  transition: background var(--transition);
}
.dropdown-item:hover { background: var(--bg); }
.dropdown-item.danger { color: var(--danger); }
.dropdown-divider { height: 1px; background: var(--border); margin: 4px 0; }

/* Sidebar back button */
.nav-back-btn {
  background: rgba(201,162,39,0.10) !important;
  border: 1px solid rgba(201,162,39,0.25) !important;
  border-radius: 8px !important;
  color: #A87C1F !important;
  font-weight: 600 !important;
  margin: 6px 8px 2px !important;
}
.nav-back-btn:hover { background: rgba(201,162,39,0.18) !important; }

/* ============================================================
   RESPONSIVE — TABLET (1024px)
   ============================================================ */
@media (max-width: 1024px) {
  :root { --sidebar-w: 220px; }
  .stats-grid { grid-template-columns: repeat(2, 1fr); }
  .form-row.cols-4 { grid-template-columns: 1fr 1fr; }
  .form-row.cols-3 { grid-template-columns: 1fr 1fr; }
}

/* ============================================================
   RESPONSIVE — MOBILE (768px)
   ============================================================ */
@media (max-width: 768px) {

  /* Sidebar slides in from left */
  .sidebar {
    transform: translateX(-100%);
    width: 280px;
    z-index: 200;
    box-shadow: 4px 0 20px rgba(0,0,0,0.3);
  }
  .sidebar.open {
    transform: translateX(0);
  }
  .sidebar-close { display: flex; }

  /* Main content takes full width */
  .main-content { margin-left: 0; }

  /* Topbar hamburger visible */
  .topbar { padding: 0 16px; gap: 10px; }
  .topbar-hamburger { display: flex; }

  /* Hide user info text on mobile — show avatar only */
  .user-info { display: none; }
  .user-menu { padding: 6px; border: none; background: none; }
  .user-menu svg { display: none; }

  /* Page content padding */
  .page-content { padding: 16px; }

  /* Page header stacks */
  .page-header { flex-direction: column; align-items: flex-start; margin-bottom: 16px; }
  .page-header h1 { font-size: 18px; }
  .page-header > div { width: 100%; justify-content: flex-end; }

  /* Stats grid — 2 cols on mobile */
  .stats-grid { grid-template-columns: repeat(2, 1fr); gap: 10px; }
  .stat-card { padding: 14px; gap: 10px; }
  .stat-value { font-size: 20px; }
  .stat-icon { width: 38px; height: 38px; font-size: 18px; }

  /* Forms — single column */
  .form-row.cols-2,
  .form-row.cols-3,
  .form-row.cols-4 { grid-template-columns: 1fr; }

  /* Tables — hide on mobile, show cards */
  .table-responsive-hide { display: none; }
  .mobile-card { display: block; }

  /* Buttons — full width in page header */
  .page-header .btn { font-size: 13px; padding: 8px 14px; }

  /* Login — hide left panel */
  .login-left { display: none; }
  .login-right { width: 100%; padding: 32px 24px; }

  /* Cards — remove overflow hidden so tables scroll */
  .card { overflow: visible; }
  .table-wrapper { overflow-x: auto; -webkit-overflow-scrolling: touch; }

  /* Toast — full width on mobile */
  .toast-container { left: 12px; right: 12px; top: 12px; max-width: none; }

  /* Modals — full screen on mobile */
  .modal-backdrop { align-items: flex-end; padding: 0; }
  .modal {
    border-radius: var(--radius-lg) var(--radius-lg) 0 0;
    max-height: 92vh;
    max-width: 100%;
  }

  /* Dropdown menus — wider on mobile */
  .dropdown-menu { min-width: 160px; }
}

/* ============================================================
   RESPONSIVE — SMALL MOBILE (480px)
   ============================================================ */
@media (max-width: 480px) {
  .stats-grid { grid-template-columns: 1fr 1fr; gap: 8px; }
  .stat-card { padding: 12px 10px; }
  .stat-value { font-size: 18px; }
  .stat-label { font-size: 10px; }
  .page-content { padding: 12px; }
  .card-header { padding: 12px 14px; }
  .data-table th, .data-table td { padding: 10px 12px; }
}

/* ============================================================
   PRINT
   ============================================================ */
@media print {
  .sidebar, .topbar, .no-print,
  .sidebar-overlay, .topbar-hamburger { display: none !important; }
  .main-content { margin-left: 0; }
  .page-content { padding: 0; }
}