/* ============================================================
   Attendance System — Design System
   ============================================================ */

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

/* --- CSS Custom Properties --- */
:root {
  /* Brand */
  --primary: #4F46E5;
  --primary-hover: #4338CA;
  --primary-light: #EEF2FF;
  --accent: #10B981;
  --accent-hover: #059669;
  --accent-light: #ECFDF5;

  /* Neutrals */
  --gray-50: #F8FAFC;
  --gray-100: #F1F5F9;
  --gray-200: #E2E8F0;
  --gray-300: #CBD5E1;
  --gray-400: #94A3B8;
  --gray-500: #64748B;
  --gray-600: #475569;
  --gray-700: #334155;
  --gray-800: #1E293B;
  --gray-900: #0F172A;

  /* Semantic */
  --success: #10B981;
  --success-light: #ECFDF5;
  --danger: #EF4444;
  --danger-light: #FEF2F2;
  --warning: #F59E0B;
  --warning-light: #FFFBEB;
  --info: #3B82F6;
  --info-light: #EFF6FF;

  /* Purple accent */
  --purple: #8B5CF6;
  --purple-light: #F5F3FF;
  --orange: #F97316;
  --orange-light: #FFF7ED;

  /* Layout */
  --sidebar-w: 240px;
  --topbar-h: 64px;
  --radius-sm: 8px;
  --radius: 12px;
  --radius-lg: 16px;
  --radius-full: 9999px;

  /* Shadows */
  --shadow-xs: 0 1px 2px rgba(0,0,0,0.05);
  --shadow-sm: 0 1px 3px rgba(0,0,0,0.06), 0 1px 2px rgba(0,0,0,0.04);
  --shadow: 0 4px 6px -1px rgba(0,0,0,0.07), 0 2px 4px -2px rgba(0,0,0,0.05);
  --shadow-md: 0 10px 15px -3px rgba(0,0,0,0.08), 0 4px 6px -4px rgba(0,0,0,0.04);
  --shadow-lg: 0 20px 25px -5px rgba(0,0,0,0.08), 0 8px 10px -6px rgba(0,0,0,0.04);

  /* Transitions */
  --transition: 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

/* --- Reset & Base --- */
*, *::before, *::after { margin: 0; padding: 0; box-sizing: border-box; }

html { -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale; }

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background: var(--gray-100);
  color: var(--gray-800);
  line-height: 1.6;
  min-height: 100vh;
}

a { color: var(--primary); text-decoration: none; transition: color var(--transition); }
a:hover { color: var(--primary-hover); }

img { max-width: 100%; display: block; }

/* --- Typography --- */
h1 { font-size: 1.5rem; font-weight: 700; color: var(--gray-900); letter-spacing: -0.025em; }
h2 { font-size: 1.125rem; font-weight: 600; color: var(--gray-800); }
h3 { font-size: 0.9375rem; font-weight: 600; color: var(--gray-700); }

/* --- Cards --- */
.card {
  background: #fff;
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--gray-200);
  padding: 24px;
  transition: box-shadow var(--transition);
}

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

/* --- Buttons --- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 20px;
  border: none;
  border-radius: var(--radius-sm);
  font-family: inherit;
  font-size: 0.875rem;
  font-weight: 600;
  cursor: pointer;
  transition: all var(--transition);
  white-space: nowrap;
}

.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none !important;
}

.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:hover:not(:disabled) { background: var(--primary-hover); transform: translateY(-1px); box-shadow: var(--shadow-sm); }

.btn-accent { background: var(--accent); color: #fff; }
.btn-accent:hover:not(:disabled) { background: var(--accent-hover); transform: translateY(-1px); }

.btn-danger { background: var(--danger); color: #fff; }
.btn-danger:hover:not(:disabled) { background: #DC2626; }

.btn-ghost { background: transparent; color: var(--gray-600); border: 1px solid var(--gray-300); }
.btn-ghost:hover:not(:disabled) { background: var(--gray-50); border-color: var(--gray-400); }

.btn-sm { padding: 6px 14px; font-size: 0.8125rem; }
.btn-lg { padding: 14px 28px; font-size: 1rem; border-radius: var(--radius); }

/* --- Forms --- */
.form-group { display: flex; flex-direction: column; gap: 6px; margin-bottom: 16px; }

.form-group label {
  font-size: 0.8125rem;
  font-weight: 600;
  color: var(--gray-600);
  letter-spacing: 0.01em;
}

.form-group input,
.form-group select,
.form-group textarea {
  width: 100%;
  padding: 10px 14px;
  border: 1.5px solid var(--gray-200);
  border-radius: var(--radius-sm);
  font-family: inherit;
  font-size: 0.875rem;
  color: var(--gray-800);
  background: #fff;
  transition: all var(--transition);
}

.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(79, 70, 229, 0.1);
}

.form-group textarea { resize: vertical; min-height: 80px; }
.form-group .hint { font-size: 0.75rem; color: var(--gray-400); }

.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
@media (max-width: 640px) { .form-grid { grid-template-columns: 1fr; } }

/* --- Badges --- */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 10px;
  border-radius: var(--radius-full);
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.01em;
}

.badge-success { background: var(--success-light); color: #065F46; }
.badge-danger { background: var(--danger-light); color: #991B1B; }
.badge-warning { background: var(--warning-light); color: #92400E; }
.badge-info { background: var(--info-light); color: #1E40AF; }
.badge-purple { background: var(--purple-light); color: #5B21B6; }
.badge-orange { background: var(--orange-light); color: #9A3412; }
.badge-neutral { background: var(--gray-100); color: var(--gray-600); }

/* --- Tables --- */
.table-wrap { overflow-x: auto; border-radius: var(--radius); border: 1px solid var(--gray-200); }

table { width: 100%; border-collapse: collapse; font-size: 0.8125rem; }

th {
  background: var(--gray-50);
  color: var(--gray-500);
  font-weight: 600;
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  text-align: left;
  padding: 12px 16px;
  border-bottom: 1px solid var(--gray-200);
}

td {
  padding: 12px 16px;
  border-bottom: 1px solid var(--gray-100);
  color: var(--gray-700);
}

tr:last-child td { border-bottom: none; }
tr:hover td { background: var(--gray-50); }

/* --- Spinner --- */
.spinner {
  display: inline-block;
  width: 18px;
  height: 18px;
  border: 2.5px solid var(--gray-200);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
  vertical-align: middle;
}

.spinner-sm { width: 14px; height: 14px; border-width: 2px; }
.spinner-white { border-color: rgba(255,255,255,0.3); border-top-color: #fff; }

@keyframes spin { to { transform: rotate(360deg); } }

/* --- Loading skeleton --- */
.skeleton {
  background: linear-gradient(90deg, var(--gray-100) 25%, var(--gray-200) 50%, var(--gray-100) 75%);
  background-size: 200% 100%;
  animation: shimmer 1.5s infinite;
  border-radius: var(--radius-sm);
}

@keyframes shimmer { 0% { background-position: 200% 0; } 100% { background-position: -200% 0; } }

/* --- Flash messages --- */
.flash {
  padding: 12px 16px;
  border-radius: var(--radius-sm);
  font-size: 0.875rem;
  margin-bottom: 20px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.flash-success { background: var(--success-light); color: #065F46; border: 1px solid #A7F3D0; }
.flash-error { background: var(--danger-light); color: #991B1B; border: 1px solid #FECACA; }

/* --- Empty state --- */
.empty-msg {
  color: var(--gray-400);
  text-align: center;
  padding: 40px 20px;
  font-size: 0.875rem;
}

/* --- Action links --- */
.action-links { display: flex; gap: 6px; flex-wrap: wrap; }
.action-links a {
  text-decoration: none;
  font-size: 0.75rem;
  font-weight: 600;
  padding: 5px 12px;
  border-radius: 6px;
  transition: all var(--transition);
}

.link-edit { background: var(--info-light); color: #1E40AF; }
.link-edit:hover { background: #DBEAFE; }
.link-reset { background: var(--orange-light); color: #9A3412; }
.link-reset:hover { background: #FED7AA; }
.link-delete { background: var(--danger-light); color: #991B1B; }
.link-delete:hover { background: #FECACA; }

/* ============================================================
   LOGIN PAGES
   ============================================================ */
.login-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: linear-gradient(135deg, #4F46E5 0%, #7C3AED 50%, #A855F7 100%);
  position: relative;
  overflow: hidden;
}

.login-page::before {
  content: '';
  position: absolute;
  width: 600px;
  height: 600px;
  background: rgba(255,255,255,0.05);
  border-radius: 50%;
  top: -200px;
  right: -200px;
}

.login-page::after {
  content: '';
  position: absolute;
  width: 400px;
  height: 400px;
  background: rgba(255,255,255,0.03);
  border-radius: 50%;
  bottom: -100px;
  left: -100px;
}

.login-card {
  background: #fff;
  padding: 40px;
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  width: 100%;
  max-width: 420px;
  position: relative;
  z-index: 1;
}

.login-brand {
  text-align: center;
  margin-bottom: 32px;
}

.login-brand .brand-icon {
  width: 56px;
  height: 56px;
  border-radius: 14px;
  background: linear-gradient(135deg, var(--primary), #7C3AED);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 16px;
}

.login-brand .brand-icon svg { width: 28px; height: 28px; fill: #fff; }

.login-brand h1 {
  font-size: 1.375rem;
  font-weight: 700;
  color: var(--gray-900);
  margin-bottom: 4px;
}

.login-brand .subtitle {
  color: var(--gray-400);
  font-size: 0.875rem;
}

.login-card .form-group input {
  padding: 12px 14px;
  border-radius: 10px;
}

.login-card .btn {
  width: 100%;
  padding: 12px;
  border-radius: 10px;
  font-size: 0.9375rem;
  margin-top: 8px;
}

.login-footer {
  text-align: center;
  margin-top: 20px;
  font-size: 0.8125rem;
  color: var(--gray-400);
}

.login-footer a { font-weight: 600; }

.login-error {
  background: var(--danger-light);
  color: #991B1B;
  padding: 10px 14px;
  border-radius: var(--radius-sm);
  margin-bottom: 16px;
  font-size: 0.8125rem;
  text-align: center;
  border: 1px solid #FECACA;
}

/* ============================================================
   ADMIN SIDEBAR
   ============================================================ */
.admin-layout {
  display: flex;
  min-height: 100vh;
}

.sidebar {
  width: var(--sidebar-w);
  background: var(--gray-900);
  color: #fff;
  position: fixed;
  top: 0;
  left: 0;
  height: 100vh;
  z-index: 100;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  transition: transform 0.3s ease;
}

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

.sidebar-brand .brand-dot {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  background: linear-gradient(135deg, var(--primary), #7C3AED);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.sidebar-brand .brand-dot svg { width: 20px; height: 20px; fill: #fff; }

.sidebar-brand span {
  font-size: 0.9375rem;
  font-weight: 700;
  letter-spacing: -0.02em;
}

.sidebar-nav {
  flex: 1;
  padding: 16px 12px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  overflow-y: auto;
  min-height: 0;
}

.sidebar-nav a {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 14px;
  border-radius: var(--radius-sm);
  color: var(--gray-400);
  font-size: 0.875rem;
  font-weight: 500;
  transition: all var(--transition);
}

.sidebar-nav a:hover {
  color: #fff;
  background: rgba(255,255,255,0.08);
}

.sidebar-nav a.active {
  color: #fff;
  background: var(--primary);
}

.sidebar-nav a svg { width: 20px; height: 20px; flex-shrink: 0; opacity: 0.7; }
.sidebar-nav a.active svg, .sidebar-nav a:hover svg { opacity: 1; }

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

.sidebar-footer a {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 14px;
  border-radius: var(--radius-sm);
  color: var(--gray-400);
  font-size: 0.875rem;
  font-weight: 500;
  transition: all var(--transition);
}

.sidebar-footer a:hover { color: #fff; background: rgba(255,255,255,0.08); }
.sidebar-footer a svg { width: 20px; height: 20px; }

.admin-main {
  flex: 1;
  margin-left: var(--sidebar-w);
  min-height: 100vh;
}

.admin-topbar {
  height: var(--topbar-h);
  background: #fff;
  border-bottom: 1px solid var(--gray-200);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 32px;
  position: sticky;
  top: 0;
  z-index: 50;
}

.admin-topbar h1 { font-size: 1.125rem; flex-shrink: 0; }

.admin-topbar-right {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-shrink: 0;
}

.topbar-logout {
  color: var(--gray-400);
  display: flex;
  align-items: center;
  padding: 6px;
  border-radius: 8px;
  transition: color 0.15s, background 0.15s;
}
.topbar-logout:hover { color: var(--danger); background: rgba(239,68,68,0.08); }
.topbar-logout svg { width: 18px; height: 18px; }

/* Notification bell */
.notif-bell { position: relative; }

.notif-bell-btn {
  position: relative;
  background: none;
  border: none;
  padding: 6px;
  cursor: pointer;
  color: var(--gray-500);
  border-radius: 8px;
  transition: color 0.15s, background 0.15s;
  display: flex;
  align-items: center;
}
.notif-bell-btn:hover { color: var(--gray-800); background: var(--gray-100); }
.notif-bell-btn svg { width: 20px; height: 20px; }

.notif-badge {
  position: absolute;
  top: 0;
  right: 0;
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  border-radius: 9px;
  background: #EF4444;
  color: #fff;
  font-size: 0.6875rem;
  font-weight: 700;
  line-height: 18px;
  text-align: center;
  display: none;
  pointer-events: none;
}

.sidebar-notif-badge {
  position: absolute;
  top: 2px;
  right: 4px;
  min-width: 16px;
  height: 16px;
  padding: 0 4px;
  border-radius: 8px;
  background: #EF4444;
  color: #fff;
  font-size: 0.625rem;
  font-weight: 700;
  line-height: 16px;
  text-align: center;
  display: none;
  pointer-events: none;
}

.notif-dropdown {
  display: none;
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  width: 320px;
  max-height: 400px;
  background: #fff;
  border-radius: 12px;
  box-shadow: 0 8px 30px rgba(0,0,0,0.12), 0 2px 8px rgba(0,0,0,0.06);
  z-index: 1000;
  overflow: hidden;
  border: 1px solid var(--gray-200);
}
.notif-dropdown.open { display: flex; flex-direction: column; }

.notif-dropdown-header {
  padding: 14px 16px 10px;
  font-size: 0.875rem;
  font-weight: 700;
  color: var(--gray-800);
  border-bottom: 1px solid var(--gray-100);
}

.notif-dropdown-body {
  overflow-y: auto;
  flex: 1;
}

.notif-empty {
  padding: 24px 16px;
  text-align: center;
  color: var(--gray-400);
  font-size: 0.8125rem;
}

.notif-item {
  display: block;
  padding: 12px 16px;
  border-bottom: 1px solid var(--gray-50);
  text-decoration: none;
  color: inherit;
  transition: background 0.12s;
}
.notif-item:hover { background: var(--gray-50); }
.notif-item:last-child { border-bottom: none; }

.notif-item-name {
  font-size: 0.8125rem;
  font-weight: 600;
  color: var(--gray-800);
  margin-bottom: 2px;
}

.notif-item-detail {
  font-size: 0.75rem;
  color: var(--gray-400);
}

.notif-dropdown-footer {
  display: block;
  padding: 10px 16px;
  text-align: center;
  font-size: 0.8125rem;
  font-weight: 600;
  color: var(--primary);
  background: var(--gray-50);
  border-top: 1px solid var(--gray-100);
  text-decoration: none;
  transition: background 0.12s;
}
.notif-dropdown-footer:hover { background: var(--gray-100); }

.admin-content {
  padding: 32px;
  max-width: 1280px;
}

/* Sidebar mobile toggle */
.sidebar-toggle {
  display: none;
  background: none;
  border: none;
  padding: 8px;
  cursor: pointer;
  color: var(--gray-600);
}

.sidebar-toggle svg { width: 24px; height: 24px; }

.sidebar-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.5);
  z-index: 90;
}

@media (max-width: 768px) {
  .sidebar { transform: translateX(-100%); }
  .sidebar.open { transform: translateX(0); }
  .sidebar-overlay.open { display: block; }
  .admin-main { margin-left: 0; }
  .sidebar-toggle { display: flex; }
  .admin-content { padding: 20px 16px; }
  .admin-topbar { padding: 0 16px; }
}

/* ============================================================
   DASHBOARD SUMMARY CARDS
   ============================================================ */
.summary-cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 16px;
  margin-bottom: 28px;
}

.summary-card {
  background: #fff;
  border-radius: var(--radius);
  padding: 20px;
  box-shadow: var(--shadow-xs);
  border: 1px solid var(--gray-200);
  display: flex;
  align-items: flex-start;
  gap: 16px;
  transition: all var(--transition);
}

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

.summary-card .card-icon {
  width: 48px;
  height: 48px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.summary-card .card-icon svg { width: 24px; height: 24px; }

.card-present .card-icon { background: var(--success-light); }
.card-present .card-icon svg { fill: var(--success); }
.card-present .card-number { color: var(--success); }

.card-absent .card-icon { background: var(--danger-light); }
.card-absent .card-icon svg { fill: var(--danger); }
.card-absent .card-number { color: var(--danger); }

.card-leave .card-icon { background: var(--warning-light); }
.card-leave .card-icon svg { fill: var(--warning); }
.card-leave .card-number { color: var(--warning); }

.card-late .card-icon { background: var(--orange-light); }
.card-late .card-icon svg { fill: var(--orange); }
.card-late .card-number { color: var(--orange); }

.card-total .card-icon { background: var(--primary-light); }
.card-total .card-icon svg { fill: var(--primary); }
.card-total .card-number { color: var(--primary); }

.card-info .card-icon { background: var(--info-light); }
.card-info .card-icon svg { fill: var(--info); }
.card-info .card-number { color: var(--info); }

.card-content { flex: 1; }
.card-number { font-size: 1.75rem; font-weight: 800; line-height: 1.2; letter-spacing: -0.03em; }
.card-label { font-size: 0.75rem; color: var(--gray-400); font-weight: 500; text-transform: uppercase; letter-spacing: 0.05em; margin-top: 2px; }

/* ============================================================
   CHART CARDS
   ============================================================ */
.charts-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
  margin-bottom: 28px;
}

.chart-card {
  background: #fff;
  border-radius: var(--radius);
  box-shadow: var(--shadow-xs);
  border: 1px solid var(--gray-200);
  padding: 24px;
}

.chart-card h3 {
  font-size: 0.9375rem;
  font-weight: 600;
  color: var(--gray-800);
  margin-bottom: 20px;
}

.chart-wrap { position: relative; height: 280px; }

@media (max-width: 768px) { .charts-row { grid-template-columns: 1fr; } }

/* ============================================================
   FILTER BAR
   ============================================================ */
.filters {
  background: #fff;
  border-radius: var(--radius);
  box-shadow: var(--shadow-xs);
  border: 1px solid var(--gray-200);
  padding: 16px 20px;
  margin-bottom: 24px;
  display: flex;
  gap: 12px;
  align-items: flex-end;
  flex-wrap: wrap;
}

.filter-group {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.filter-group label {
  font-size: 0.6875rem;
  color: var(--gray-400);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.filter-group input,
.filter-group select {
  padding: 8px 12px;
  border: 1.5px solid var(--gray-200);
  border-radius: var(--radius-sm);
  font-family: inherit;
  font-size: 0.8125rem;
  color: var(--gray-700);
  background: #fff;
  transition: all var(--transition);
}

.filter-group input:focus,
.filter-group select:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.1);
}

@media (max-width: 768px) {
  .filters { flex-direction: column; }
  .filter-group { width: 100%; }
  .filter-group input, .filter-group select { width: 100%; }
}

/* ============================================================
   LEAVE TABS
   ============================================================ */
.tabs {
  display: flex;
  gap: 6px;
  margin-bottom: 20px;
  flex-wrap: wrap;
}

.tab {
  padding: 8px 18px;
  border-radius: var(--radius-full);
  text-decoration: none;
  font-size: 0.8125rem;
  font-weight: 600;
  background: var(--gray-100);
  color: var(--gray-500);
  transition: all var(--transition);
  border: 1.5px solid transparent;
}

.tab.active {
  background: var(--primary);
  color: #fff;
  border-color: var(--primary);
}

.tab:hover:not(.active) { background: var(--gray-200); color: var(--gray-700); }

.tab .count {
  background: rgba(255,255,255,0.25);
  padding: 1px 7px;
  border-radius: 10px;
  font-size: 0.6875rem;
  margin-left: 4px;
}

.tab:not(.active) .count { background: var(--gray-200); color: var(--gray-500); }

/* ============================================================
   LEAVE CARDS
   ============================================================ */
.leave-card {
  border: 1px solid var(--gray-200);
  border-radius: var(--radius);
  padding: 16px;
  margin-bottom: 12px;
  transition: all var(--transition);
}

.leave-card:hover { border-color: var(--gray-300); box-shadow: var(--shadow-xs); }

.leave-card-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 8px;
}

.emp-name { font-weight: 600; color: var(--gray-800); font-size: 0.9375rem; }
.emp-dept { color: var(--gray-400); font-size: 0.75rem; }
.leave-dates { color: var(--gray-600); font-size: 0.875rem; margin-bottom: 4px; }
.leave-type { color: var(--purple); font-size: 0.8125rem; font-weight: 600; }

.leave-reason {
  color: var(--gray-500);
  font-size: 0.8125rem;
  margin: 8px 0;
  padding: 10px 14px;
  background: var(--gray-50);
  border-radius: var(--radius-sm);
  border-left: 3px solid var(--gray-200);
}

.leave-actions { display: flex; gap: 8px; margin-top: 12px; }
.btn-approve { padding: 7px 18px; background: var(--success); color: #fff; border: none; border-radius: var(--radius-sm); font-size: 0.8125rem; font-weight: 600; cursor: pointer; transition: all var(--transition); }
.btn-approve:hover { background: var(--accent-hover); }
.btn-reject { padding: 7px 18px; background: var(--danger); color: #fff; border: none; border-radius: var(--radius-sm); font-size: 0.8125rem; font-weight: 600; cursor: pointer; transition: all var(--transition); }
.btn-reject:hover { background: #DC2626; }

/* ============================================================
   EMPLOYEE PUNCH PAGE (Mobile-first)
   ============================================================ */
.punch-page {
  min-height: 100vh;
  padding: 16px;
  max-width: 480px;
  margin: 0 auto;
}

.punch-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 20px;
  padding: 0 4px;
}

.punch-header h1 { font-size: 1.25rem; }

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

.punch-header-right a {
  color: var(--gray-400);
  font-size: 0.8125rem;
  font-weight: 500;
}

.punch-header-right a:hover { color: var(--primary); }

/* Status badge */
.punch-status-badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 20px;
  border-radius: var(--radius-full);
  font-size: 0.875rem;
  font-weight: 700;
  margin-bottom: 24px;
}

.punch-status-badge .status-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  animation: pulse-dot 2s infinite;
}

@keyframes pulse-dot {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.4; }
}

.badge-punch-in { background: var(--success-light); color: #065F46; border: 1.5px solid #A7F3D0; }
.badge-punch-in .status-dot { background: var(--success); }

.badge-not-punched { background: var(--danger-light); color: #991B1B; border: 1.5px solid #FECACA; }
.badge-not-punched .status-dot { background: var(--danger); }

.badge-present { background: var(--success-light); color: #065F46; border: 1.5px solid #A7F3D0; }
.badge-present .status-dot { background: var(--success); animation: none; }

/* Status indicators */
.status-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 16px;
  border-radius: var(--radius);
  margin-bottom: 12px;
  font-size: 0.8125rem;
  font-weight: 500;
  border: 1.5px solid;
  transition: all var(--transition);
}

.status-row svg { width: 18px; height: 18px; flex-shrink: 0; }

.status-loading {
  background: var(--info-light);
  color: #1E40AF;
  border-color: #BFDBFE;
}

.status-ok {
  background: var(--success-light);
  color: #065F46;
  border-color: #A7F3D0;
}

.status-fail {
  background: var(--danger-light);
  color: #991B1B;
  border-color: #FECACA;
}

.distance-info {
  font-size: 0.75rem;
  color: var(--gray-400);
  margin-top: 2px;
  font-weight: 400;
}

/* Punch button */
.punch-btn-wrap { margin-bottom: 16px; }

.punch-btn {
  width: 100%;
  padding: 18px;
  border: none;
  border-radius: var(--radius);
  font-family: inherit;
  font-size: 1.0625rem;
  font-weight: 700;
  cursor: pointer;
  transition: all var(--transition);
  letter-spacing: -0.01em;
}

.punch-btn:disabled {
  background: var(--gray-200);
  color: var(--gray-400);
  cursor: not-allowed;
}

.punch-in-btn { background: var(--success); color: #fff; }
.punch-in-btn:hover:not(:disabled) { background: var(--accent-hover); transform: translateY(-1px); box-shadow: 0 4px 12px rgba(16,185,129,0.3); }

.punch-out-btn { background: var(--orange); color: #fff; }
.punch-out-btn:hover:not(:disabled) { background: #EA580C; transform: translateY(-1px); box-shadow: 0 4px 12px rgba(249,115,22,0.3); }

/* Result */
.punch-result {
  padding: 12px 16px;
  border-radius: var(--radius-sm);
  font-size: 0.8125rem;
  font-weight: 500;
  display: none;
  margin-bottom: 16px;
  border: 1.5px solid;
}

.result-success { background: var(--success-light); color: #065F46; border-color: #A7F3D0; }
.result-error { background: var(--danger-light); color: #991B1B; border-color: #FECACA; }

/* Today log */
.today-log { text-align: left; }
.today-log h3 { font-size: 0.875rem; color: var(--gray-500); margin-bottom: 12px; font-weight: 600; }

.log-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 0;
  border-bottom: 1px solid var(--gray-100);
  font-size: 0.875rem;
}

.log-row:last-child { border-bottom: none; }
.log-label { color: var(--gray-400); font-weight: 500; }
.log-value { color: var(--gray-800); font-weight: 600; }

/* Warning banner */
.warn-banner {
  background: var(--warning-light);
  color: #92400E;
  padding: 12px 16px;
  border-radius: var(--radius);
  font-size: 0.8125rem;
  margin-bottom: 16px;
  border: 1.5px solid #FDE68A;
  line-height: 1.5;
}

.warn-banner a { color: #B45309; font-weight: 700; }

/* Verify toggle */
.verify-toggle {
  display: flex;
  gap: 0;
  margin-bottom: 16px;
  border-radius: var(--radius);
  overflow: hidden;
  border: 2px solid var(--gray-200);
  background: var(--gray-50);
}

.verify-toggle button {
  flex: 1;
  padding: 12px;
  border: none;
  font-family: inherit;
  font-size: 0.875rem;
  font-weight: 600;
  cursor: pointer;
  transition: all var(--transition);
  background: transparent;
  color: var(--gray-400);
}

.verify-toggle button.active {
  background: var(--primary);
  color: #fff;
}

.verify-toggle button:disabled { opacity: 0.5; cursor: not-allowed; }

.verify-method-label {
  font-size: 0.75rem;
  color: var(--gray-400);
  margin-bottom: 6px;
  text-align: left;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

/* Employee avatar on punch page */
.emp-avatar {
  width: 96px;
  height: 96px;
  border-radius: 50%;
  margin: 0 auto 16px;
  display: block;
  object-fit: cover;
  object-position: center;
}
.emp-avatar-photo {
  border: 3px solid var(--primary-light);
}
.emp-avatar-placeholder {
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.75rem;
  font-weight: 700;
  color: #fff;
  background: var(--primary);
}

/* Employee notification bell — punch page header */
.punch-header-right .notif-bell { position: relative; }
.punch-header-right .notif-bell-btn {
  position: relative;
  background: none;
  border: none;
  padding: 4px;
  cursor: pointer;
  color: var(--gray-400);
  border-radius: 6px;
  transition: color 0.15s, background 0.15s;
  display: flex;
  align-items: center;
}
.punch-header-right .notif-bell-btn:hover { color: var(--primary); background: var(--gray-100); }
.punch-header-right .notif-bell-btn svg { width: 18px; height: 18px; }
.punch-header-right .notif-bell .notif-dropdown {
  width: 300px;
  right: -8px;
}
.punch-header-right .notif-bell .notif-badge {
  top: -2px;
  right: -2px;
}

/* Face modal */
.face-modal-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.6);
  backdrop-filter: blur(4px);
  z-index: 1000;
  justify-content: center;
  align-items: center;
}

.face-modal {
  background: #fff;
  border-radius: var(--radius-lg);
  padding: 32px;
  width: 90%;
  max-width: 400px;
  text-align: center;
  box-shadow: var(--shadow-lg);
}

.face-modal h2 { font-size: 1.125rem; color: var(--gray-800); margin-bottom: 4px; }
.face-modal p { font-size: 0.8125rem; color: var(--gray-400); margin-bottom: 20px; }

/* Crop modal */
.crop-modal-overlay {
  display: none !important;
  position: fixed !important;
  top: 0 !important;
  left: 0 !important;
  width: 100vw !important;
  height: 100vh !important;
  background: rgba(0,0,0,0.6);
  backdrop-filter: blur(4px);
  z-index: 9999 !important;
  justify-content: center;
  align-items: center;
  margin: 0 !important;
  padding: 0 !important;
}
.crop-modal-overlay.open { display: flex !important; }

.crop-modal {
  background: #fff;
  border-radius: var(--radius-lg);
  padding: 24px;
  width: 92%;
  max-width: 480px;
  max-height: 85vh;
  display: flex;
  flex-direction: column;
  box-shadow: var(--shadow-lg);
  position: relative;
  z-index: 10000;
}

.crop-modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 16px;
}
.crop-modal-header h2 { font-size: 1rem; font-weight: 700; color: var(--gray-800); margin: 0; }
.crop-modal-close {
  background: none;
  border: none;
  cursor: pointer;
  color: var(--gray-400);
  padding: 4px;
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
}
.crop-modal-close:hover { color: var(--gray-700); background: var(--gray-100); }

.crop-container {
  flex: 1;
  min-height: 0;
  max-height: 55vh;
  margin-bottom: 16px;
  border-radius: var(--radius);
  overflow: hidden;
  background: var(--gray-900);
}
.crop-container img {
  display: block;
  max-width: 100%;
}

.crop-modal-actions {
  display: flex;
  gap: 10px;
  justify-content: flex-end;
}

/* Cropper.js overrides for dark theme container */
.crop-container .cropper-view-box,
.crop-container .cropper-face {
  border-radius: 0;
}

.video-wrap {
  position: relative;
  width: 100%;
  max-width: 320px;
  margin: 0 auto 20px;
  border-radius: var(--radius);
  overflow: hidden;
  background: var(--gray-900);
}

.video-wrap video { width: 100%; display: block; transform: scaleX(-1); }
.video-wrap canvas { position: absolute; top: 0; left: 0; width: 100%; height: 100%; transform: scaleX(-1); }

.modal-status {
  padding: 10px 14px;
  border-radius: var(--radius-sm);
  font-size: 0.8125rem;
  font-weight: 500;
  margin-bottom: 16px;
}

.modal-btn {
  padding: 10px 24px;
  border: none;
  border-radius: var(--radius-sm);
  font-family: inherit;
  font-size: 0.875rem;
  font-weight: 600;
  cursor: pointer;
  transition: all var(--transition);
}

.modal-btn-cancel { background: var(--gray-100); color: var(--gray-600); }
.modal-btn-cancel:hover { background: var(--gray-200); }

/* Retry buttons */
.btn-retry {
  display: none;
  margin-top: 10px;
  padding: 8px 18px;
  background: var(--orange);
  color: #fff;
  border: none;
  border-radius: var(--radius-sm);
  font-family: inherit;
  font-size: 0.8125rem;
  font-weight: 600;
  cursor: pointer;
  transition: all var(--transition);
}

.btn-retry:hover { background: #EA580C; }

.btn-retry-geo {
  display: none;
  margin-top: 10px;
  padding: 8px 18px;
  background: var(--primary);
  color: #fff;
  border: none;
  border-radius: var(--radius-sm);
  font-family: inherit;
  font-size: 0.8125rem;
  font-weight: 600;
  cursor: pointer;
  transition: all var(--transition);
}

.btn-retry-geo:hover { background: var(--primary-hover); }

/* Geo instructions */
.geo-instructions {
  font-size: 0.8125rem;
  color: var(--gray-500);
  margin-top: 8px;
  line-height: 1.6;
  text-align: left;
  background: var(--gray-50);
  padding: 14px 16px;
  border-radius: var(--radius-sm);
  display: none;
  border: 1px solid var(--gray-200);
}

.geo-instructions strong { color: var(--gray-700); }
.geo-instructions ol { margin: 6px 0 0 18px; }

/* ============================================================
   EMPLOYEE SETUP PAGES (Register Face, Register Device)
   ============================================================ */
.setup-page {
  min-height: 100vh;
  padding: 16px;
  max-width: 500px;
  margin: 0 auto;
}

.setup-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 20px;
  padding: 0 4px;
}

.setup-header h1 { font-size: 1.25rem; }
.setup-header a { color: var(--gray-400); font-size: 0.875rem; font-weight: 500; }

.setup-card {
  background: #fff;
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--gray-200);
  padding: 28px 24px;
  text-align: center;
}

.setup-card .greeting { font-size: 1.125rem; color: var(--gray-800); margin-bottom: 4px; font-weight: 600; }
.setup-card .subtitle { color: var(--gray-400); font-size: 0.8125rem; margin-bottom: 24px; }

.status-msg {
  padding: 12px 16px;
  border-radius: var(--radius-sm);
  font-size: 0.8125rem;
  font-weight: 500;
  margin-bottom: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border: 1.5px solid;
}

.msg-loading { background: var(--info-light); color: #1E40AF; border-color: #BFDBFE; }
.msg-ready { background: var(--success-light); color: #065F46; border-color: #A7F3D0; }
.msg-error { background: var(--danger-light); color: #991B1B; border-color: #FECACA; }
.msg-success { background: var(--success-light); color: #065F46; border-color: #A7F3D0; }

.setup-btn {
  width: 100%;
  padding: 14px;
  border: none;
  border-radius: var(--radius);
  font-family: inherit;
  font-size: 1rem;
  font-weight: 700;
  cursor: pointer;
  transition: all var(--transition);
}

.setup-btn:disabled { background: var(--gray-200); color: var(--gray-400); cursor: not-allowed; }
.setup-btn-primary { background: var(--primary); color: #fff; }
.setup-btn-primary:hover:not(:disabled) { background: var(--primary-hover); transform: translateY(-1px); }
.setup-btn-success { background: var(--success); color: #fff; }
.setup-btn-success:hover:not(:disabled) { background: var(--accent-hover); }
.setup-btn-gray { background: var(--gray-200); color: var(--gray-600); }
.setup-btn-gray:hover { background: var(--gray-300); }

.nav-link {
  display: block;
  text-align: center;
  color: var(--primary);
  text-decoration: none;
  font-size: 0.8125rem;
  font-weight: 600;
  margin-top: 16px;
  padding: 8px;
}

/* Device icon */
.icon-wrap {
  margin: 0 auto 20px;
  width: 100px;
  height: 100px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--primary), #7C3AED);
  display: flex;
  align-items: center;
  justify-content: center;
}

.icon-wrap svg { width: 48px; height: 48px; fill: #fff; }

/* Info text */
.info-text {
  font-size: 0.8125rem;
  color: var(--gray-500);
  line-height: 1.6;
  margin-bottom: 20px;
}

/* Device list */
.device-list { text-align: left; margin-top: 24px; }
.device-list h3 { font-size: 0.875rem; color: var(--gray-600); margin-bottom: 10px; }

.device-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 0;
  border-bottom: 1px solid var(--gray-100);
  font-size: 0.8125rem;
}

.device-item:last-child { border-bottom: none; }
.device-name { color: var(--gray-700); font-weight: 600; }
.device-date { color: var(--gray-400); font-size: 0.75rem; font-family: monospace; }

/* Face preview */
.face-preview { display: none; margin-bottom: 20px; }
.face-preview img { width: 100px; height: 100px; border-radius: 50%; border: 3px solid var(--success); object-fit: cover; margin: 0 auto; }
.face-preview p { color: var(--gray-400); font-size: 0.8125rem; margin-top: 8px; }

/* ============================================================
   EMPLOYEE APPLY LEAVE
   ============================================================ */
.leave-form-card { margin-bottom: 20px; }
.leave-form-card h2 { font-size: 1rem; margin-bottom: 20px; }

.leave-form-row { display: flex; gap: 16px; }
.leave-form-row .form-group { flex: 1; }

@media (max-width: 640px) { .leave-form-row { flex-direction: column; } }

.leave-history h3 { font-size: 0.875rem; color: var(--gray-500); margin-bottom: 12px; }

.leave-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 0;
  border-bottom: 1px solid var(--gray-100);
  font-size: 0.8125rem;
}

.leave-row:last-child { border-bottom: none; }
.leave-dates { color: var(--gray-800); font-weight: 600; }
.leave-meta { color: var(--gray-400); font-size: 0.75rem; margin-top: 2px; }

/* ============================================================
   DASHBOARD V2 — REDESIGNED
   ============================================================ */

/* Safety net: prevent unconstrained SVGs from exploding in size */
.admin-layout svg:not([width]):not([height]) {
  width: 20px;
  height: 20px;
}

/* Topbar search */
.topbar-search {
  position: relative;
  flex: 0 1 280px;
  min-width: 0;
}
.topbar-search input {
  width: 100%;
  padding: 8px 12px 8px 36px;
  border: 1.5px solid var(--gray-200);
  border-radius: var(--radius-sm);
  font-family: inherit;
  font-size: 0.8125rem;
  color: var(--gray-700);
  background: var(--gray-50);
  transition: all var(--transition);
}
.topbar-search input:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(79,70,229,0.1);
  background: #fff;
}
.topbar-search svg {
  position: absolute;
  left: 10px;
  top: 50%;
  transform: translateY(-50%);
  width: 16px;
  height: 16px;
  color: var(--gray-400);
}

/* Admin avatar */
.admin-avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--primary), #7C3AED);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-size: 0.8125rem;
  font-weight: 700;
  flex-shrink: 0;
  text-transform: uppercase;
}

/* Summary KPI row */
.summary-cards-v2 {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
  margin-bottom: 24px;
}

.summary-card-v2 {
  background: #fff;
  border-radius: var(--radius);
  box-shadow: var(--shadow-xs);
  border: 1px solid var(--gray-200);
  padding: 18px 20px;
  transition: all var(--transition);
  position: relative;
  overflow: hidden;
}
.summary-card-v2:hover {
  box-shadow: var(--shadow);
  transform: translateY(-2px);
}

.scard-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 10px;
}
.scard-icon {
  width: 40px;
  height: 40px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
}
.scard-icon svg { width: 20px; height: 20px; }

.scard-badge {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  padding: 3px 8px;
  border-radius: var(--radius-full);
  font-size: 0.6875rem;
  font-weight: 600;
}
.scard-badge svg { width: 12px; height: 12px; }
.scard-badge-up { background: var(--success-light); color: #065F46; }
.scard-badge-down { background: var(--danger-light); color: #991B1B; }
.scard-badge-neutral { background: var(--gray-100); color: var(--gray-500); }

.scard-value {
  font-size: 1.75rem;
  font-weight: 800;
  color: var(--gray-900);
  line-height: 1.1;
  letter-spacing: -0.03em;
}
.scard-label {
  font-size: 0.75rem;
  color: var(--gray-400);
  font-weight: 500;
  margin-top: 2px;
}
.scard-sparkline {
  margin-top: 10px;
  height: 32px;
}
.scard-sparkline canvas {
  width: 100% !important;
  height: 32px !important;
}

/* Filter bar */
.filter-bar {
  background: #fff;
  border-radius: var(--radius);
  box-shadow: var(--shadow-xs);
  border: 1px solid var(--gray-200);
  padding: 14px 20px;
  margin-bottom: 24px;
  display: flex;
  gap: 12px;
  align-items: flex-end;
  flex-wrap: wrap;
}
.filter-bar .filter-group {
  flex: 1 1 160px;
  min-width: 0;
}
.filter-bar .filter-chips {
  display: flex;
  gap: 8px;
  flex-shrink: 0;
}
.filter-chip {
  padding: 7px 16px;
  border-radius: var(--radius-full);
  border: 1.5px solid var(--gray-200);
  background: #fff;
  color: var(--gray-600);
  font-family: inherit;
  font-size: 0.8125rem;
  font-weight: 500;
  cursor: pointer;
  transition: all var(--transition);
  appearance: none;
  -webkit-appearance: none;
  white-space: nowrap;
}
.filter-chip:hover { border-color: var(--primary); color: var(--primary); }
.filter-chip.active {
  background: var(--primary);
  color: #fff;
  border-color: var(--primary);
}

/* Charts row */
.charts-row-v2 {
  display: grid;
  grid-template-columns: 1.6fr 1fr;
  gap: 20px;
  margin-bottom: 24px;
}
.charts-row-v2 .chart-card { min-height: 340px; }

.chart-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 20px;
}
.chart-card-header h3 {
  font-size: 0.9375rem;
  font-weight: 600;
  color: var(--gray-800);
  margin-bottom: 0;
}
.chart-legend {
  display: flex;
  gap: 16px;
  font-size: 0.75rem;
  color: var(--gray-500);
}
.chart-legend span {
  display: flex;
  align-items: center;
  gap: 5px;
}
.chart-legend-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
}

/* Bottom panels */
.bottom-panels {
  display: grid;
  grid-template-columns: 1.6fr 1fr;
  gap: 20px;
  margin-bottom: 24px;
}
.panel-card {
  background: #fff;
  border-radius: var(--radius);
  box-shadow: var(--shadow-xs);
  border: 1px solid var(--gray-200);
  padding: 20px;
}
.panel-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
}
.panel-card-header h3 {
  font-size: 0.9375rem;
  font-weight: 600;
  color: var(--gray-800);
  margin-bottom: 0;
}
.panel-card-header a {
  font-size: 0.8125rem;
  font-weight: 600;
  color: var(--primary);
}
.panel-card-header a:hover { text-decoration: underline; }

/* Late request item */
.late-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 0;
  border-bottom: 1px solid var(--gray-100);
}
.late-item:last-child { border-bottom: none; }
.late-avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--primary-light);
  color: var(--primary);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.75rem;
  font-weight: 700;
  flex-shrink: 0;
  text-transform: uppercase;
}
.late-info { flex: 1; min-width: 0; }
.late-info-name {
  font-size: 0.8125rem;
  font-weight: 600;
  color: var(--gray-800);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.late-info-meta {
  font-size: 0.75rem;
  color: var(--gray-400);
  margin-top: 1px;
}
.late-duration {
  padding: 4px 10px;
  border-radius: var(--radius-full);
  background: var(--orange-light);
  color: #9A3412;
  font-size: 0.75rem;
  font-weight: 600;
  white-space: nowrap;
}

/* Upcoming leave item */
.leave-item {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 12px 0;
  border-bottom: 1px solid var(--gray-100);
}
.leave-item:last-child { border-bottom: none; }
.leave-icon-wrap {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.leave-icon-wrap svg { width: 18px; height: 18px; }
.leave-icon-annual { background: var(--info-light); color: var(--info); }
.leave-icon-sick { background: var(--danger-light); color: var(--danger); }
.leave-icon-other { background: var(--purple-light); color: var(--purple); }

.leave-info { flex: 1; }
.leave-info-name {
  font-size: 0.8125rem;
  font-weight: 600;
  color: var(--gray-800);
}
.leave-info-dates {
  font-size: 0.75rem;
  color: var(--gray-400);
  margin-top: 1px;
}
.leave-type-tag {
  padding: 3px 10px;
  border-radius: var(--radius-full);
  font-size: 0.6875rem;
  font-weight: 600;
  white-space: nowrap;
}
.leave-tag-annual { background: var(--info-light); color: #1E40AF; }
.leave-tag-sick { background: var(--danger-light); color: #991B1B; }
.leave-tag-other { background: var(--purple-light); color: #5B21B6; }

/* Sidebar promo card */
.sidebar-promo {
  margin: 12px;
  padding: 16px;
  border-radius: var(--radius);
  background: linear-gradient(135deg, #4F46E5 0%, #7C3AED 100%);
  color: #fff;
  position: relative;
  z-index: 1;
  flex-shrink: 0;
}
.sidebar-promo p {
  font-size: 0.75rem;
  opacity: 0.85;
  line-height: 1.5;
  margin-bottom: 10px;
}
.sidebar-promo strong {
  display: block;
  font-size: 0.8125rem;
  margin-bottom: 4px;
  opacity: 1;
}
.sidebar-promo a {
  display: inline-block;
  font-size: 0.75rem;
  font-weight: 600;
  color: #fff;
  background: rgba(255,255,255,0.2);
  padding: 5px 12px;
  border-radius: 6px;
  transition: background 0.15s;
}
.sidebar-promo a:hover {
  background: rgba(255,255,255,0.3);
  color: #fff;
}

/* Sidebar section dividers */
.sidebar-section-label {
  padding: 14px 14px 6px;
  font-size: 0.6875rem;
  font-weight: 600;
  color: var(--gray-500);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin-top: 2px;
}

/* Empty panel state */
.panel-empty {
  text-align: center;
  padding: 32px 16px;
  color: var(--gray-400);
  font-size: 0.8125rem;
}
.panel-empty svg { width: 32px; height: 32px; margin: 0 auto 8px; opacity: 0.3; }

/* Donut chart container */
.donut-wrap {
  position: relative;
  height: 200px;
  margin-bottom: 16px;
}

/* Donut chart center text */
.donut-center {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  text-align: center;
  pointer-events: none;
}
.donut-center .donut-pct {
  font-size: 1.5rem;
  font-weight: 800;
  color: var(--gray-900);
  line-height: 1;
  letter-spacing: -0.03em;
}
.donut-center .donut-label {
  font-size: 0.6875rem;
  color: var(--gray-400);
  margin-top: 2px;
}

/* Donut legend */
.donut-legend {
  margin-top: 16px;
}
.donut-legend-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 6px 0;
  font-size: 0.8125rem;
}
.donut-legend-left {
  display: flex;
  align-items: center;
  gap: 8px;
}
.donut-legend-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
}
.donut-legend-label { color: var(--gray-600); font-weight: 500; }
.donut-legend-val { color: var(--gray-800); font-weight: 700; }

/* Responsive */
@media (max-width: 1024px) {
  .summary-cards-v2 { grid-template-columns: repeat(2, 1fr); }
  .charts-row-v2 { grid-template-columns: 1fr; }
  .bottom-panels { grid-template-columns: 1fr; }
}

@media (max-width: 640px) {
  .summary-cards-v2 { grid-template-columns: 1fr 1fr; gap: 10px; }
  .scard-value { font-size: 1.375rem; }
  .filter-bar { flex-direction: column; align-items: stretch; }
  .filter-bar .filter-group { flex: 1 1 100%; }
  .filter-bar .filter-chips { justify-content: center; }
}

/* ============================================================
   LATE MANAGEMENT V2 — Admin Review
   ============================================================ */
.lm-summary-cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 14px;
  margin-bottom: 24px;
}
.lm-stat-card {
  background: #fff;
  border-radius: var(--radius);
  border: 1px solid var(--gray-200);
  box-shadow: var(--shadow-xs);
  padding: 16px;
  text-align: center;
}
.lm-stat-card .stat-num {
  font-size: 1.5rem;
  font-weight: 800;
  letter-spacing: -0.03em;
  line-height: 1.1;
}
.lm-stat-card .stat-label {
  font-size: 0.6875rem;
  color: var(--gray-400);
  text-transform: uppercase;
  font-weight: 600;
  letter-spacing: 0.04em;
  margin-top: 4px;
}
.lm-stat-pending .stat-num { color: var(--warning); }
.lm-stat-approved .stat-num { color: var(--success); }
.lm-stat-rejected .stat-num { color: var(--danger); }
.lm-stat-payable .stat-num { color: var(--info); }
.lm-stat-nonpay .stat-num { color: var(--gray-500); }
.lm-stat-total .stat-num { color: var(--primary); }

/* Late request review cards */
.lm-request-card {
  background: #fff;
  border-radius: var(--radius);
  border: 1px solid var(--gray-200);
  box-shadow: var(--shadow-xs);
  padding: 18px 20px;
  margin-bottom: 12px;
  transition: all var(--transition);
}
.lm-request-card:hover { box-shadow: var(--shadow-sm); }

.lm-req-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 10px;
}
.lm-req-emp {
  display: flex;
  align-items: center;
  gap: 10px;
}
.lm-req-avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--primary-light);
  color: var(--primary);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.75rem;
  font-weight: 700;
  flex-shrink: 0;
}
.lm-req-name {
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--gray-800);
}
.lm-req-dept {
  font-size: 0.75rem;
  color: var(--gray-400);
  margin-top: 1px;
}
.lm-req-body {
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
  font-size: 0.8125rem;
  color: var(--gray-600);
  margin-bottom: 12px;
}
.lm-req-field {
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.lm-req-field-label {
  font-size: 0.6875rem;
  color: var(--gray-400);
  text-transform: uppercase;
  font-weight: 600;
  letter-spacing: 0.04em;
}
.lm-req-reason {
  padding: 10px 14px;
  background: var(--gray-50);
  border-radius: var(--radius-sm);
  font-size: 0.8125rem;
  color: var(--gray-600);
  margin-bottom: 12px;
  border-left: 3px solid var(--gray-200);
}
.lm-req-actions {
  display: flex;
  gap: 8px;
  align-items: center;
  flex-wrap: wrap;
}
.lm-req-actions select {
  padding: 7px 12px;
  border: 1.5px solid var(--gray-200);
  border-radius: var(--radius-sm);
  font-family: inherit;
  font-size: 0.8125rem;
  color: var(--gray-700);
  background: #fff;
}
.lm-req-actions select:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(79,70,229,0.1);
}

/* ============================================================
   EMPLOYEE TYPES — Settings
   ============================================================ */
.et-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 16px;
  margin-top: 20px;
}
.et-card {
  background: #fff;
  border-radius: var(--radius);
  border: 1px solid var(--gray-200);
  box-shadow: var(--shadow-xs);
  padding: 20px;
  transition: all var(--transition);
}
.et-card:hover { box-shadow: var(--shadow-sm); }
.et-card-top {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 12px;
}
.et-card-name {
  font-size: 0.9375rem;
  font-weight: 700;
  color: var(--gray-800);
}
.et-card-desc {
  font-size: 0.8125rem;
  color: var(--gray-400);
  margin-bottom: 12px;
}
.et-card-details {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  font-size: 0.8125rem;
  margin-bottom: 14px;
}
.et-detail {
  display: flex;
  align-items: center;
  gap: 5px;
  color: var(--gray-600);
}
.et-detail svg { width: 14px; height: 14px; color: var(--gray-400); }
.et-card-actions {
  display: flex;
  gap: 6px;
  padding-top: 12px;
  border-top: 1px solid var(--gray-100);
}

/* ============================================================
   SETTINGS PAGE — Rebuilt
   ============================================================ */

.page-content {
  padding: 24px 32px;
}

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

.page-header h1 {
  font-size: 1.75rem;
  font-weight: 700;
  margin: 0 0 4px 0;
  color: var(--gray-900);
}

.page-subtitle {
  color: var(--gray-500);
  margin: 0;
  font-size: 0.875rem;
}

.page-header-actions {
  display: flex;
  gap: 12px;
  flex-shrink: 0;
}

.settings-layout {
  display: grid;
  grid-template-columns: 240px 1fr;
  gap: 20px;
  align-items: start;
}

.settings-tabs {
  background: #fff;
  border-radius: 16px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.08);
  border: 1px solid var(--gray-200);
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  position: sticky;
  top: calc(var(--topbar-h) + 16px);
}

.settings-tab {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 10px 14px;
  border: none;
  background: transparent;
  border-radius: 10px;
  text-align: left;
  font-family: inherit;
  font-size: 0.9375rem;
  font-weight: 500;
  color: var(--gray-600);
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
}

.settings-tab .tab-icon {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  opacity: 0.6;
}

.settings-tab:hover {
  background: var(--gray-100);
}

.settings-tab:hover .tab-icon { opacity: 0.8; }

.settings-tab.active {
  background: var(--primary-light);
  color: var(--primary);
  font-weight: 600;
}

.settings-tab.active .tab-icon {
  opacity: 1;
  color: var(--primary);
}

.settings-panel {
  background: #fff;
  border-radius: 16px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.08);
  border: 1px solid var(--gray-200);
  padding: 28px;
  min-height: 400px;
}

.settings-tab-content {
  display: none;
}

.settings-tab-content.active {
  display: block;
}

.settings-tab-content h2 {
  font-size: 1.25rem;
  font-weight: 700;
  margin: 0 0 4px 0;
  color: var(--gray-900);
}

.settings-tab-content > p {
  color: var(--gray-500);
  margin: 0 0 20px 0;
  font-size: 0.875rem;
}

.settings-group-title {
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--gray-700);
  margin: 0 0 16px;
}

.settings-divider {
  border-top: 1px solid var(--gray-100);
  margin: 28px 0;
}

/* Profile row */
.settings-profile-row {
  display: flex;
  align-items: center;
  gap: 20px;
  margin-bottom: 8px;
}

.settings-avatar {
  width: 72px;
  height: 72px;
  border-radius: 50%;
  overflow: hidden;
  flex-shrink: 0;
}

.settings-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center;
  display: block;
}

.settings-avatar-placeholder {
  width: 100%;
  height: 100%;
  background: linear-gradient(135deg, var(--primary), #7C3AED);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-size: 1.5rem;
  font-weight: 700;
}

.settings-profile-info {
  flex: 1;
}

/* Toggle switch */
.settings-toggle-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 0;
  border-bottom: 1px solid var(--gray-100);
  gap: 16px;
}

.settings-toggle-row:last-child { border-bottom: none; }

.settings-toggle {
  position: relative;
  display: inline-block;
  width: 44px;
  height: 24px;
  flex-shrink: 0;
  cursor: pointer;
}

.settings-toggle input { opacity: 0; width: 0; height: 0; }

.settings-toggle-slider {
  position: absolute;
  top: 0; left: 0; right: 0; bottom: 0;
  background: var(--gray-300);
  border-radius: 12px;
  transition: all var(--transition);
}

.settings-toggle-slider::before {
  content: '';
  position: absolute;
  height: 18px;
  width: 18px;
  left: 3px;
  bottom: 3px;
  background: #fff;
  border-radius: 50%;
  transition: all var(--transition);
}

.settings-toggle input:checked + .settings-toggle-slider {
  background: var(--primary);
}

.settings-toggle input:checked + .settings-toggle-slider::before {
  transform: translateX(20px);
}

/* Admin stats */
.settings-admin-stats {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  margin-bottom: 28px;
}

.settings-stat-card {
  background: var(--gray-50);
  border-radius: var(--radius);
  padding: 20px;
  text-align: center;
}

.settings-stat-value {
  font-size: 1.75rem;
  font-weight: 800;
  color: var(--primary);
}

.settings-stat-label {
  font-size: 0.75rem;
  color: var(--gray-400);
  font-weight: 500;
  margin-top: 4px;
}

.form-group-hint {
  font-size: 0.75rem;
  color: var(--gray-400);
  margin-top: -2px;
}

/* Responsive */
@media (max-width: 900px) {
  .page-content { padding: 16px; }
  .settings-layout {
    grid-template-columns: 1fr;
  }
  .settings-tabs {
    position: static;
    flex-direction: row;
    overflow-x: auto;
    gap: 4px;
    padding: 6px;
  }
  .settings-tab {
    white-space: nowrap;
    font-size: 0.8125rem;
    padding: 8px 12px;
  }
  .settings-form-grid {
    grid-template-columns: 1fr;
  }
  .settings-admin-stats {
    grid-template-columns: 1fr;
  }
  .page-header {
    flex-direction: column;
  }
}

/* ============================================================
   MOBILE RESPONSIVE — Full pass
   ============================================================ */

/* --- Tablet (≤768px) --- */
@media (max-width: 768px) {
  /* Topbar */
  .admin-topbar {
    flex-wrap: wrap;
    height: auto;
    min-height: var(--topbar-h);
    padding: 10px 16px;
    gap: 8px;
  }
  .admin-topbar h1 {
    font-size: 1rem;
  }
  .topbar-search {
    flex: 1 1 100%;
    order: 3;
    min-width: 0;
  }
  .admin-topbar-right {
    gap: 8px;
  }

  /* Page header (settings, employees, etc.) */
  .page-header {
    flex-direction: column;
    gap: 12px;
  }
  .page-header-actions {
    width: 100%;
  }
  .page-header-actions .btn {
    flex: 1;
    min-height: 44px;
  }
  .page-content {
    padding: 16px;
  }

  /* Tables — scrollable with visual hint */
  .table-wrap {
    position: relative;
    -webkit-mask-image: linear-gradient(to right, #000 85%, transparent 100%);
    mask-image: linear-gradient(to right, #000 85%, transparent 100%);
  }

  /* Tabs — horizontal scroll */
  .tabs {
    overflow-x: auto;
    flex-wrap: nowrap;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    padding-bottom: 4px;
  }
  .tabs::-webkit-scrollbar { display: none; }
  .tab {
    flex-shrink: 0;
    white-space: nowrap;
  }

  /* Notification dropdown */
  .notif-dropdown {
    position: fixed;
    top: auto;
    bottom: 0;
    left: 0;
    right: 0;
    width: 100%;
    max-height: 70vh;
    border-radius: 16px 16px 0 0;
    z-index: 1001;
  }

  /* Charts */
  .chart-wrap {
    height: 220px;
  }
  .donut-wrap {
    height: 180px;
  }

  /* Filter bar v2 */
  .filter-bar {
    padding: 12px 14px;
    gap: 10px;
  }
  .filter-bar .filter-chips {
    width: 100%;
    justify-content: center;
  }
  .filter-chip {
    min-height: 40px;
    padding: 8px 14px;
  }

  /* Summary cards v2 */
  .summary-cards-v2 {
    gap: 10px;
  }
  .summary-card-v2 {
    padding: 14px 16px;
  }
  .scard-value {
    font-size: 1.375rem;
  }
  .scard-badge {
    font-size: 0.625rem;
    padding: 2px 6px;
  }

  /* Bottom panels */
  .bottom-panels {
    gap: 16px;
  }
  .panel-card {
    padding: 16px;
  }

  /* Late management */
  .lm-summary-cards {
    grid-template-columns: repeat(3, 1fr);
    gap: 8px;
  }
  .lm-stat-card {
    padding: 12px 8px;
  }
  .lm-stat-card .stat-num {
    font-size: 1.25rem;
  }
  .lm-req-body {
    gap: 12px;
  }
  .lm-req-actions {
    flex-direction: column;
    width: 100%;
  }
  .lm-req-actions select {
    width: 100%;
    min-height: 40px;
  }

  /* Leave actions */
  .leave-actions {
    flex-direction: column;
  }
  .leave-actions form {
    width: 100%;
  }
  .btn-approve, .btn-reject {
    width: 100%;
    min-height: 44px;
    justify-content: center;
  }

  /* Payability radio */
  .payability-select {
    flex-direction: column;
  }
  .payability-select label {
    width: 100%;
    justify-content: center;
  }

  /* Settings admin stats */
  .settings-admin-stats {
    grid-template-columns: 1fr;
  }

  /* Attendance pagination */
  .panel-card > div:last-child {
    flex-wrap: wrap;
    justify-content: center;
  }
}

/* --- Phone (≤480px) --- */
@media (max-width: 480px) {
  /* Topbar */
  .admin-topbar {
    padding: 8px 12px;
  }
  .admin-topbar h1 {
    font-size: 0.9375rem;
  }
  .admin-avatar {
    width: 32px;
    height: 32px;
    font-size: 0.75rem;
  }
  .topbar-logout svg,
  .notif-bell-btn svg {
    width: 18px;
    height: 18px;
  }

  /* Content area */
  .admin-content {
    padding: 12px;
  }

  /* Cards */
  .card {
    padding: 16px;
    border-radius: var(--radius-sm);
  }

  /* Tables */
  table {
    font-size: 0.75rem;
  }
  th {
    padding: 10px 10px;
    font-size: 0.6875rem;
  }
  td {
    padding: 10px 10px;
  }

  /* Filter bar */
  .filter-bar .filter-group input,
  .filter-bar .filter-group select {
    min-height: 44px;
    font-size: 0.875rem;
  }

  /* Summary cards */
  .summary-cards-v2 {
    grid-template-columns: 1fr 1fr;
    gap: 8px;
  }
  .summary-card-v2 {
    padding: 12px;
  }
  .scard-value {
    font-size: 1.25rem;
  }
  .scard-icon {
    width: 36px;
    height: 36px;
    border-radius: 8px;
  }
  .scard-icon svg {
    width: 18px;
    height: 18px;
  }

  /* Charts */
  .charts-row-v2 {
    gap: 12px;
  }
  .chart-card {
    padding: 16px;
  }
  .chart-wrap {
    height: 180px;
  }
  .donut-wrap {
    height: 160px;
  }

  /* Bottom panels */
  .bottom-panels {
    gap: 12px;
  }
  .panel-card {
    padding: 14px;
  }
  .panel-card-header h3 {
    font-size: 0.875rem;
  }

  /* Settings */
  .settings-panel {
    padding: 16px;
    border-radius: var(--radius);
  }
  .settings-tabs {
    border-radius: var(--radius);
  }
  .settings-tab {
    font-size: 0.75rem;
    padding: 8px 10px;
    gap: 6px;
  }
  .settings-tab .tab-icon {
    width: 16px;
    height: 16px;
  }
  .settings-profile-row {
    flex-direction: column;
    align-items: flex-start;
    gap: 12px;
  }
  .settings-avatar {
    width: 64px;
    height: 64px;
  }
  .settings-toggle-row {
    padding: 12px 0;
    gap: 12px;
  }

  /* Late management */
  .lm-summary-cards {
    grid-template-columns: repeat(2, 1fr);
  }
  .lm-stat-card .stat-num {
    font-size: 1.125rem;
  }
  .lm-stat-card .stat-label {
    font-size: 0.625rem;
  }
  .lm-req-header {
    flex-direction: column;
    gap: 8px;
  }
  .lm-req-header > div:last-child {
    text-align: left;
  }
  .late-detail-row {
    flex-direction: column;
    gap: 2px;
  }
  .late-detail-label {
    min-width: 0;
    font-size: 0.6875rem;
  }
  .late-detail-value {
    font-size: 0.8125rem;
  }

  /* Leave cards */
  .leave-card {
    padding: 14px;
  }
  .leave-card-header {
    flex-direction: column;
    gap: 6px;
  }

  /* Forms */
  .form-group input,
  .form-group select,
  .form-group textarea {
    min-height: 44px;
    font-size: 0.9375rem;
  }

  /* Buttons — touch targets */
  .btn {
    min-height: 44px;
    padding: 10px 16px;
  }
  .btn-sm {
    min-height: 38px;
    padding: 8px 12px;
  }

  /* Action links */
  .action-links {
    flex-direction: column;
    gap: 4px;
  }
  .action-links a {
    text-align: center;
    padding: 8px 12px;
  }

  /* Employee types grid */
  .et-grid {
    grid-template-columns: 1fr;
  }

  /* Face modal */
  .face-modal {
    width: 95%;
    padding: 20px;
  }
  .video-wrap {
    max-width: 280px;
  }

  /* Punch page */
  .punch-page {
    padding: 12px;
  }
  .punch-header {
    flex-wrap: wrap;
    gap: 8px;
  }
  .punch-header-right {
    gap: 10px;
  }
  .punch-header-right a {
    font-size: 0.75rem;
  }
  .punch-header-right .notif-bell .notif-dropdown {
    width: calc(100vw - 24px);
    right: -12px;
  }
  .emp-avatar {
    width: 72px;
    height: 72px;
    font-size: 1.25rem;
  }

  /* Setup pages */
  .setup-page {
    padding: 12px;
  }
  .setup-card {
    padding: 20px 16px;
  }

  /* Login */
  .login-card {
    padding: 28px 20px;
  }
  .login-brand h1 {
    font-size: 1.25rem;
  }

  /* Badge sizes */
  .badge {
    font-size: 0.6875rem;
    padding: 3px 8px;
  }
}
