/* ==========================================================================
   Judah Code Technologies - Corporate Attendance Management Design System
   Corporate, professional, high-clarity typography, and accessible status badges
   ========================================================================== */

:root {
  /* Brand & Corporate Palette */
  --primary: #2563eb;
  --primary-hover: #1d4ed8;
  --primary-subtle: #eff6ff;
  --primary-border: #bfdbfe;

  --slate-900: #0f172a;
  --slate-800: #1e293b;
  --slate-700: #334155;
  --slate-600: #475569;
  --slate-500: #64748b;
  --slate-400: #94a3b8;
  --slate-300: #cbd5e1;
  --slate-200: #e2e8f0;
  --slate-100: #f1f5f9;
  --slate-50:  #f8fafc;
  --white:     #ffffff;

  /* Status Tokens (Consistent text + icon + background) */
  /* ON TIME */
  --status-on-time-bg: #ecfdf5;
  --status-on-time-text: #065f46;
  --status-on-time-border: #a7f3d0;
  --status-on-time-dot: #10b981;

  /* GRACE PERIOD */
  --status-grace-bg: #fffbeb;
  --status-grace-text: #92400e;
  --status-grace-border: #fde68a;
  --status-grace-dot: #f59e0b;

  /* HR VERIFICATION REQUIRED / LATE */
  --status-late-bg: #fff7ed;
  --status-late-text: #9a3412;
  --status-late-border: #fed7aa;
  --status-late-dot: #f97316;

  /* APPROVED */
  --status-approved-bg: #f0fdf4;
  --status-approved-text: #166534;
  --status-approved-border: #bbf7d0;
  --status-approved-dot: #22c55e;

  /* REJECTED */
  --status-rejected-bg: #fef2f2;
  --status-rejected-text: #991b1b;
  --status-rejected-border: #fecaca;
  --status-rejected-dot: #ef4444;

  /* ABSENT */
  --status-absent-bg: #f8fafc;
  --status-absent-text: #334155;
  --status-absent-border: #cbd5e1;
  --status-absent-dot: #64748b;

  /* LEAVE */
  --status-leave-bg: #f0f9ff;
  --status-leave-text: #0369a1;
  --status-leave-border: #bae6fd;
  --status-leave-dot: #0284c7;

  /* WEEK OFF / HOLIDAY */
  --status-off-bg: #f1f5f9;
  --status-off-text: #475569;
  --status-off-border: #e2e8f0;
  --status-off-dot: #94a3b8;

  /* Typography & Layout */
  --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
  --radius-sm: 4px;
  --radius-md: 8px;
  --radius-lg: 12px;
  --radius-xl: 16px;
  --radius-full: 9999px;

  --shadow-sm: 0 1px 2px 0 rgba(15, 23, 42, 0.05);
  --shadow-md: 0 4px 6px -1px rgba(15, 23, 42, 0.08), 0 2px 4px -2px rgba(15, 23, 42, 0.05);
  --shadow-lg: 0 10px 15px -3px rgba(15, 23, 42, 0.08), 0 4px 6px -4px rgba(15, 23, 42, 0.03);

  --sidebar-width: 260px;
  --header-height: 64px;
  --bottom-nav-height: 68px;
}

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

html {
  width: 100%;
  max-width: 100vw;
  overflow-x: hidden;
}

body {
  font-family: var(--font-sans);
  background-color: #f8fafc;
  color: var(--slate-800);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
  width: 100%;
  max-width: 100vw;
  overflow-x: hidden;
  position: relative;
  display: flex;
  flex-direction: column;
}

/* Top App Bar */
.top-header {
  height: var(--header-height);
  background-color: var(--white);
  border-bottom: 1px solid var(--slate-200);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 24px;
  position: sticky;
  top: 0;
  z-index: 40;
}

.brand-section {
  display: flex;
  align-items: center;
  gap: 12px;
}

.brand-logo-icon {
  width: 36px;
  height: 36px;
  background: linear-gradient(135deg, var(--primary) 0%, #1e40af 100%);
  color: var(--white);
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-md);
  font-weight: 700;
  font-size: 18px;
  letter-spacing: -0.5px;
}

.brand-title {
  font-size: 16px;
  font-weight: 700;
  color: var(--slate-900);
  letter-spacing: -0.2px;
}

.brand-title-full {
  display: inline;
}

.brand-title-short {
  display: none;
}

.brand-subtitle {
  font-size: 11px;
  font-weight: 500;
  color: var(--slate-500);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 16px;
}

.header-clock-pill {
  display: flex;
  align-items: center;
  gap: 8px;
  background-color: var(--slate-100);
  padding: 6px 14px;
  border-radius: var(--radius-full);
  font-size: 12px;
  font-weight: 600;
  color: var(--slate-700);
  border: 1px solid var(--slate-200);
}

.live-dot {
  width: 8px;
  height: 8px;
  background-color: #10b981;
  border-radius: 50%;
  box-shadow: 0 0 0 2px rgba(16, 185, 129, 0.2);
  animation: pulse 2s infinite;
}

@keyframes pulse {
  0% { transform: scale(0.95); opacity: 0.8; }
  50% { transform: scale(1.15); opacity: 1; }
  100% { transform: scale(0.95); opacity: 0.8; }
}

.header-user-btn {
  display: flex;
  align-items: center;
  gap: 10px;
  background: transparent;
  border: none;
  cursor: pointer;
  padding: 4px 8px;
  border-radius: var(--radius-md);
  transition: background 0.15s ease;
}

.header-user-btn:hover {
  background-color: var(--slate-100);
}

.user-avatar-sm {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  object-fit: cover;
  border: 1px solid var(--slate-300);
}

.header-user-meta {
  text-align: left;
}

.user-name-label {
  font-size: 13px;
  font-weight: 600;
  color: var(--slate-800);
  display: block;
}

.user-role-label {
  font-size: 11px;
  color: var(--slate-500);
  display: block;
}

/* Quick Role Switcher Bar */
.demo-switcher-bar {
  background-color: #f1f5f9;
  border-bottom: 1px solid var(--slate-200);
  padding: 8px 24px;
  font-size: 12px;
  color: var(--slate-600);
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 8px;
}

.demo-switcher-btns {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.btn-demo-switch {
  padding: 4px 10px;
  font-size: 11px;
  font-weight: 600;
  border-radius: var(--radius-sm);
  background: var(--white);
  border: 1px solid var(--slate-300);
  color: var(--slate-700);
  cursor: pointer;
  transition: all 0.15s ease;
}

.btn-demo-switch:hover {
  background-color: var(--primary-subtle);
  border-color: var(--primary);
  color: var(--primary);
}

/* Main Container Layout */
.app-container {
  display: flex;
  flex: 1;
  position: relative;
  width: 100%;
  max-width: 100vw;
  min-width: 0;
  overflow-x: hidden;
}

/* Sidebar (HR Admin) */
.hr-sidebar {
  width: var(--sidebar-width);
  background-color: var(--white);
  border-right: 1px solid var(--slate-200);
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
  min-height: calc(100vh - var(--header-height));
  position: sticky;
  top: var(--header-height);
  height: calc(100vh - var(--header-height));
  overflow-y: auto;
}

.sidebar-nav {
  padding: 16px 12px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.nav-category {
  font-size: 11px;
  font-weight: 700;
  color: var(--slate-400);
  text-transform: uppercase;
  letter-spacing: 0.6px;
  padding: 12px 12px 6px;
}

.nav-link {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 14px;
  border-radius: var(--radius-md);
  font-size: 13px;
  font-weight: 500;
  color: var(--slate-600);
  text-decoration: none;
  cursor: pointer;
  transition: all 0.15s ease;
  position: relative;
}

.nav-link:hover {
  background-color: var(--slate-100);
  color: var(--slate-900);
}

.nav-link.active {
  background-color: var(--primary-subtle);
  color: var(--primary);
  font-weight: 600;
}

.nav-link.active::before {
  content: '';
  position: absolute;
  left: 0;
  top: 6px;
  bottom: 6px;
  width: 3px;
  background-color: var(--primary);
  border-radius: 0 4px 4px 0;
}

.nav-badge {
  margin-left: auto;
  font-size: 11px;
  font-weight: 700;
  padding: 2px 7px;
  border-radius: var(--radius-full);
  background-color: #fee2e2;
  color: #b91c1c;
}

.nav-badge.orange {
  background-color: #ffedd5;
  color: #c2410c;
}

/* Main Content Area */
.main-content {
  flex: 1;
  padding: 28px;
  max-width: 1400px;
  margin: 0 auto;
  width: 100%;
  min-width: 0;
  box-sizing: border-box;
}

/* Mobile-First Employee View Container */
.employee-layout-wrapper {
  max-width: 580px;
  margin: 0 auto;
  padding: 20px 16px 90px;
  width: 100%;
}

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

.page-title {
  font-size: 22px;
  font-weight: 700;
  color: var(--slate-900);
  letter-spacing: -0.3px;
}

.page-subtitle {
  font-size: 13px;
  color: var(--slate-500);
  margin-top: 4px;
}

.page-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

/* Cards */
.card {
  background-color: var(--white);
  border: 1px solid var(--slate-200);
  border-radius: var(--radius-lg);
  padding: 24px;
  box-shadow: var(--shadow-sm);
  margin-bottom: 24px;
}

.card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 18px;
  padding-bottom: 14px;
  border-bottom: 1px solid var(--slate-100);
}

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

/* Status Badges */
.status-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  border-radius: var(--radius-full);
  font-size: 12px;
  font-weight: 600;
  line-height: 1;
  border: 1px solid transparent;
}

.status-badge.on-time, .status-badge.present, .status-badge.approved {
  background-color: var(--status-on-time-bg);
  color: var(--status-on-time-text);
  border-color: var(--status-on-time-border);
}

.status-badge.grace-period, .status-badge.grace {
  background-color: var(--status-grace-bg);
  color: var(--status-grace-text);
  border-color: var(--status-grace-border);
}

.status-badge.hr-verification, .status-badge.late, .status-badge.pending {
  background-color: var(--status-late-bg);
  color: var(--status-late-text);
  border-color: var(--status-late-border);
}

.status-badge.rejected {
  background-color: var(--status-rejected-bg);
  color: var(--status-rejected-text);
  border-color: var(--status-rejected-border);
}

.status-badge.absent {
  background-color: var(--status-absent-bg);
  color: var(--status-absent-text);
  border-color: var(--status-absent-border);
}

.status-badge.leave {
  background-color: var(--status-leave-bg);
  color: var(--status-leave-text);
  border-color: var(--status-leave-border);
}

.status-badge.week-off, .status-badge.holiday {
  background-color: var(--status-off-bg);
  color: var(--status-off-text);
  border-color: var(--status-off-border);
}

.status-badge.incomplete {
  background-color: #fff1f2;
  color: #9f1239;
  border-color: #fecdd3;
}

/* Metric Stats Grid */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 16px;
  margin-bottom: 24px;
}

.stat-card {
  background-color: var(--white);
  border: 1px solid var(--slate-200);
  border-radius: var(--radius-md);
  padding: 16px;
  box-shadow: var(--shadow-sm);
  display: flex;
  flex-direction: column;
}

.stat-label {
  font-size: 11px;
  font-weight: 700;
  color: var(--slate-500);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 8px;
}

.stat-value {
  font-size: 26px;
  font-weight: 700;
  color: var(--slate-900);
  line-height: 1;
}

.stat-subtext {
  font-size: 11px;
  color: var(--slate-400);
  margin-top: 6px;
}

.stat-card.primary { border-top: 3px solid var(--primary); }
.stat-card.success { border-top: 3px solid #10b981; }
.stat-card.warning { border-top: 3px solid #f59e0b; }
.stat-card.attention { border-top: 3px solid #f97316; }
.stat-card.danger { border-top: 3px solid #ef4444; }
.stat-card.info { border-top: 3px solid #0284c7; }

/* Filter Bar */
.filter-bar {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  background-color: var(--white);
  border: 1px solid var(--slate-200);
  border-radius: var(--radius-md);
  padding: 14px 18px;
  margin-bottom: 20px;
}

.filter-group {
  display: flex;
  align-items: center;
  gap: 8px;
}

.filter-label {
  font-size: 12px;
  font-weight: 600;
  color: var(--slate-600);
}

.form-select, .form-input {
  height: 36px;
  padding: 0 12px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--slate-300);
  font-size: 13px;
  font-family: inherit;
  color: var(--slate-800);
  background-color: var(--white);
  outline: none;
  transition: border-color 0.15s ease;
}

.form-select:focus, .form-input:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 2px rgba(37, 99, 235, 0.15);
}

/* Tables */
.table-container {
  background-color: var(--white);
  border: 1px solid var(--slate-200);
  border-radius: var(--radius-md);
  overflow-x: auto;
  box-shadow: var(--shadow-sm);
}

.data-table {
  width: 100%;
  border-collapse: collapse;
  text-align: left;
  font-size: 13px;
}

.data-table th {
  background-color: var(--slate-50);
  color: var(--slate-600);
  font-weight: 600;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  padding: 12px 16px;
  border-bottom: 1px solid var(--slate-200);
  white-space: nowrap;
}

.data-table td {
  padding: 14px 16px;
  border-bottom: 1px solid var(--slate-100);
  color: var(--slate-700);
  vertical-align: middle;
}

.data-table tr:hover td {
  background-color: #f8fafc;
}

.data-table tr:last-child td {
  border-bottom: none;
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  height: 38px;
  padding: 0 16px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  border: 1px solid transparent;
  text-decoration: none;
  transition: all 0.15s ease;
  white-space: nowrap;
}

.btn-primary {
  background-color: var(--primary);
  color: var(--white);
}

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

.btn-success {
  background-color: #059669;
  color: var(--white);
}

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

.btn-danger {
  background-color: #dc2626;
  color: var(--white);
}

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

.btn-outline {
  background-color: var(--white);
  border-color: var(--slate-300);
  color: var(--slate-700);
}

.btn-outline:hover {
  background-color: var(--slate-50);
  border-color: var(--slate-400);
}

.btn-sm {
  height: 30px;
  padding: 0 10px;
  font-size: 12px;
}

.btn-lg {
  height: 48px;
  padding: 0 24px;
  font-size: 15px;
  border-radius: var(--radius-md);
}

.btn-block {
  width: 100%;
}

/* Employee Today Attendance Hero Card */
.employee-hero-card {
  background: var(--white);
  border: 1px solid var(--slate-200);
  border-radius: var(--radius-lg);
  padding: 24px;
  box-shadow: var(--shadow-sm);
  margin-bottom: 20px;
}

.greeting-line {
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--primary);
  margin-bottom: 4px;
}

.employee-hero-name {
  font-size: 24px;
  font-weight: 800;
  color: var(--slate-900);
  letter-spacing: -0.4px;
}

.today-date-line {
  font-size: 13px;
  color: var(--slate-500);
  margin-bottom: 20px;
}

.attendance-status-box {
  background-color: var(--slate-50);
  border: 1px solid var(--slate-200);
  border-radius: var(--radius-md);
  padding: 18px;
  margin-bottom: 20px;
}

.status-box-header {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.6px;
  color: var(--slate-500);
  margin-bottom: 12px;
}

.status-grid-2col {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

.status-item-label {
  font-size: 11px;
  color: var(--slate-500);
  margin-bottom: 4px;
}

.status-item-val {
  font-size: 15px;
  font-weight: 700;
  color: var(--slate-800);
}

/* Action Check In / Out Buttons */
.btn-check-in {
  background: linear-gradient(135deg, #2563eb 0%, #1d4ed8 100%);
  color: var(--white);
  box-shadow: 0 4px 12px rgba(37, 99, 235, 0.25);
  font-size: 16px;
  letter-spacing: 0.5px;
  text-transform: uppercase;
  font-weight: 700;
}

.btn-check-out {
  background: linear-gradient(135deg, #059669 0%, #047857 100%);
  color: var(--white);
  box-shadow: 0 4px 12px rgba(5, 150, 105, 0.25);
  font-size: 16px;
  letter-spacing: 0.5px;
  text-transform: uppercase;
  font-weight: 700;
}

.btn-completed {
  background-color: var(--slate-100);
  color: var(--slate-600);
  border: 1px solid var(--slate-200);
  font-size: 14px;
  font-weight: 600;
  cursor: default;
}

/* Bottom Navigation (Mobile View) */
.bottom-nav {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  height: var(--bottom-nav-height);
  background-color: var(--white);
  border-top: 1px solid var(--slate-200);
  display: flex;
  align-items: center;
  justify-content: space-around;
  z-index: 50;
  box-shadow: 0 -2px 10px rgba(0, 0, 0, 0.05);
}

.bottom-nav-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  flex: 1;
  height: 100%;
  color: var(--slate-400);
  text-decoration: none;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.2px;
  border: none;
  background: none;
  cursor: pointer;
  transition: color 0.15s ease;
}

.bottom-nav-item.active {
  color: var(--primary);
}

.bottom-nav-item svg {
  width: 22px;
  height: 22px;
}

/* Camera & Selfie Capture Modal Viewfinder */
.camera-view-container {
  position: relative;
  width: 100%;
  max-width: 380px;
  height: 380px;
  margin: 0 auto 16px;
  background-color: #0f172a;
  border-radius: var(--radius-lg);
  overflow: hidden;
  border: 2px solid var(--slate-300);
  display: flex;
  align-items: center;
  justify-content: center;
}

.camera-video-feed {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transform: scaleX(-1); /* Mirror front camera */
}

.camera-guide-overlay {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 220px;
  height: 280px;
  border: 2px dashed rgba(255, 255, 255, 0.6);
  border-radius: 110px / 140px;
  pointer-events: none;
  box-shadow: 0 0 0 9999px rgba(15, 23, 42, 0.4);
}

.camera-guide-text {
  position: absolute;
  bottom: 14px;
  left: 0;
  right: 0;
  text-align: center;
  font-size: 12px;
  font-weight: 600;
  color: var(--white);
  text-shadow: 0 1px 3px rgba(0, 0, 0, 0.8);
  pointer-events: none;
}

.captured-selfie-preview {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

/* GPS Diagnostic Panel inside modal */
.gps-diagnostic-panel {
  background-color: var(--slate-50);
  border: 1px solid var(--slate-200);
  border-radius: var(--radius-md);
  padding: 12px 16px;
  margin-bottom: 16px;
  font-size: 12px;
}

.gps-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 6px;
}

.gps-row:last-child {
  margin-bottom: 0;
}

.gps-label {
  color: var(--slate-500);
}

.gps-val {
  font-weight: 600;
  color: var(--slate-800);
}

/* Calendar Grid */
.calendar-container {
  background-color: var(--white);
  border: 1px solid var(--slate-200);
  border-radius: var(--radius-lg);
  padding: 20px;
  box-shadow: var(--shadow-sm);
}

.calendar-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
}

.calendar-month-title {
  font-size: 16px;
  font-weight: 700;
  color: var(--slate-900);
}

.calendar-weekdays-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  text-align: center;
  font-size: 11px;
  font-weight: 700;
  color: var(--slate-400);
  text-transform: uppercase;
  margin-bottom: 8px;
}

.calendar-days-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 6px;
}

.calendar-day-cell {
  aspect-ratio: 1;
  background-color: var(--slate-50);
  border: 1px solid var(--slate-200);
  border-radius: var(--radius-md);
  padding: 6px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  cursor: pointer;
  transition: all 0.15s ease;
  position: relative;
}

.calendar-day-cell:hover {
  border-color: var(--primary);
  background-color: var(--white);
  box-shadow: var(--shadow-sm);
}

.calendar-day-number {
  font-size: 12px;
  font-weight: 600;
  color: var(--slate-700);
}

.calendar-day-indicator {
  font-size: 12px;
  font-weight: 700;
  align-self: flex-end;
}

.calendar-day-cell.present { background-color: #ecfdf5; border-color: #a7f3d0; }
.calendar-day-cell.present .calendar-day-indicator { color: #059669; }

.calendar-day-cell.warning { background-color: #fffbeb; border-color: #fde68a; }
.calendar-day-cell.warning .calendar-day-indicator { color: #d97706; }

.calendar-day-cell.absent { background-color: #fef2f2; border-color: #fecaca; }
.calendar-day-cell.absent .calendar-day-indicator { color: #dc2626; }

.calendar-day-cell.leave { background-color: #f0f9ff; border-color: #bae6fd; }
.calendar-day-cell.leave .calendar-day-indicator { color: #0284c7; }

.calendar-day-cell.week-off { background-color: #f1f5f9; border-color: #e2e8f0; color: #94a3b8; }
.calendar-day-cell.holiday { background-color: #f5f3ff; border-color: #ddd6fe; }
.calendar-day-cell.holiday .calendar-day-indicator { color: #7c3aed; }

/* Modals */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: rgba(15, 23, 42, 0.6);
  backdrop-filter: blur(2px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
  padding: 16px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease;
}

.modal-overlay.open {
  opacity: 1;
  pointer-events: auto;
}

.modal-container {
  background-color: var(--white);
  border-radius: var(--radius-lg);
  max-width: 540px;
  width: 100%;
  max-height: 90vh;
  display: flex;
  flex-direction: column;
  box-shadow: var(--shadow-lg);
  overflow: hidden;
  animation: modalEnter 0.2s ease forwards;
}

@keyframes modalEnter {
  from { transform: scale(0.96) translateY(8px); }
  to { transform: scale(1) translateY(0); }
}

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

.modal-title {
  font-size: 16px;
  font-weight: 700;
  color: var(--slate-900);
}

.modal-close-btn {
  background: none;
  border: none;
  font-size: 20px;
  color: var(--slate-400);
  cursor: pointer;
  padding: 4px;
  line-height: 1;
}

.modal-close-btn:hover {
  color: var(--slate-700);
}

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

.modal-footer {
  padding: 14px 20px;
  border-top: 1px solid var(--slate-200);
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  background-color: var(--slate-50);
}

/* Toast Notifications */
.toast-container {
  position: fixed;
  bottom: 24px;
  right: 24px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  z-index: 999999;
  max-width: 380px;
  width: 100%;
}

.toast {
  background-color: var(--slate-900);
  color: var(--white);
  padding: 14px 18px;
  border-radius: var(--radius-md);
  font-size: 13px;
  box-shadow: var(--shadow-lg);
  display: flex;
  align-items: flex-start;
  gap: 12px;
  animation: toastIn 0.25s ease forwards;
}

@keyframes toastIn {
  from { transform: translateY(12px); opacity: 0; }
  to { transform: translateY(0); opacity: 1; }
}

.toast.success { background-color: #065f46; border-left: 4px solid #34d399; }
.toast.error { background-color: #991b1b; border-left: 4px solid #f87171; }
.toast.warning { background-color: #9a3412; border-left: 4px solid #fb923c; }

/* Work Mode Choice Segmented Control */
.work-mode-choice {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 10px 14px;
  font-size: 13px;
  font-weight: 600;
  border-radius: var(--radius-md);
  border: 1.5px solid var(--slate-200);
  background-color: var(--slate-50);
  color: var(--slate-600);
  cursor: pointer;
  transition: all 0.2s ease;
  user-select: none;
}

.work-mode-choice:hover {
  background-color: var(--slate-100);
  border-color: var(--slate-300);
}

.work-mode-choice.active {
  background-color: #eff6ff;
  border-color: #3b82f6;
  color: #1d4ed8;
  box-shadow: 0 1px 3px rgba(59, 130, 246, 0.2);
}

.status-badge.onsite {
  background-color: #eff6ff;
  color: #1e40af;
  border: 1px solid #bfdbfe;
}

.status-badge.wfh {
  background-color: #ecfdf5;
  color: #065f46;
  border: 1px solid #a7f3d0;
}

.status-badge.hybrid {
  background-color: #faf5ff;
  color: #6b21a8;
  border: 1px solid #e9d5ff;
}

/* Office Geofence Cards Grid */
.offices-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 16px;
  margin-top: 16px;
}

.office-card {
  background: var(--white);
  border: 1px solid var(--slate-200);
  border-radius: var(--radius-lg);
  padding: 20px;
  box-shadow: var(--shadow-sm);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  transition: all 0.2s ease;
}

.office-card:hover {
  border-color: var(--slate-300);
  box-shadow: var(--shadow-md);
}

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

.office-card-title {
  font-size: 16px;
  font-weight: 700;
  color: var(--slate-900);
}

.office-card-city {
  display: inline-block;
  font-size: 11px;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: 9999px;
  background-color: #eff6ff;
  color: #1d4ed8;
  margin-top: 4px;
}

.office-stat-row {
  display: flex;
  justify-content: space-between;
  padding: 8px 0;
  border-bottom: 1px solid var(--slate-100);
  font-size: 12px;
}

.office-stat-label {
  color: var(--slate-500);
}

.office-stat-val {
  font-weight: 600;
  color: var(--slate-800);
}

/* ==============================================================================
   Comprehensive Multi-Device Responsive Architecture
   Categories: Mobile, Tablet, Laptop, Desktop, Television / 4K / Large Displays
   ============================================================================== */

/* Base HTML & Touch Optimization */
html {
  font-size: 14px;
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
}

/* Mobile Sidebar Drawer & Backdrop */
.mobile-menu-toggle-btn {
  display: none;
  background: none;
  border: none;
  padding: 6px;
  border-radius: var(--radius-md);
  color: var(--slate-700);
  cursor: pointer;
  align-items: center;
  justify-content: center;
  transition: all 0.15s ease;
  line-height: 1;
}

.mobile-menu-toggle-btn:hover {
  background-color: var(--slate-100);
  color: var(--slate-900);
}

.sidebar-backdrop {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: rgba(15, 23, 42, 0.55);
  backdrop-filter: blur(3px);
  z-index: 89;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s ease;
}

.sidebar-backdrop.active {
  opacity: 1;
  pointer-events: auto;
}

.sidebar-mobile-header {
  display: none;
  padding: 14px 16px;
  border-bottom: 1px solid var(--slate-200);
  align-items: center;
  justify-content: space-between;
  background-color: var(--slate-50);
}

.sidebar-close-btn {
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 22px;
  line-height: 1;
  color: #1e293b;
  background: #e2e8f0;
  border-radius: 50%;
  border: none;
  cursor: pointer;
  padding: 0;
  transition: all 0.15s ease;
  flex-shrink: 0;
}

.sidebar-close-btn:hover {
  background: #cbd5e1;
  color: #0f172a;
}

/* Base Responsive Grids */
.dashboard-split-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
  width: 100%;
  box-sizing: border-box;
}

.verify-card-grid {
  display: grid;
  grid-template-columns: 140px 1fr auto;
  gap: 20px;
  align-items: center;
  width: 100%;
  box-sizing: border-box;
}

.verify-detail-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
  background: var(--slate-50);
  border: 1px solid var(--slate-200);
  border-radius: var(--radius-sm);
  padding: 10px 14px;
  font-size: 12px;
  width: 100%;
  box-sizing: border-box;
}

.correction-card-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  background: var(--slate-50);
  border: 1px solid var(--slate-200);
  border-radius: var(--radius-md);
  padding: 14px;
  margin-bottom: 14px;
  font-size: 13px;
  width: 100%;
  box-sizing: border-box;
}

.my-att-split-grid {
  display: grid;
  grid-template-columns: 360px 1fr;
  gap: 24px;
  align-items: start;
  width: 100%;
  box-sizing: border-box;
}

.btn-punch-text {
  display: inline;
}

/* High-Visibility Focus Outline for TV Remotes, D-Pads, and Keyboards */
:focus-visible {
  outline: 3px solid var(--primary) !important;
  outline-offset: 3px !important;
  box-shadow: 0 0 0 6px rgba(37, 99, 235, 0.25) !important;
}

/* ==============================================================================
   1. TELEVISION, 4K & ULTRA-WIDE SCREENS (min-width: 1921px, 2560px, 3840px+)
   Designed for viewing distance, large monitors, conference screens & Smart TVs
   ============================================================================== */
@media (min-width: 1921px) {
  html {
    font-size: 18px; /* Proportional scaling for 1440p / standard large displays */
  }

  body {
    padding-left: env(safe-area-inset-left, 0);
    padding-right: env(safe-area-inset-right, 0);
  }

  .app-container {
    max-width: 2400px;
    margin: 0 auto;
  }

  .main-content {
    max-width: 2100px;
    padding: 36px 48px;
  }

  .top-header {
    height: 80px;
    padding: 0 44px;
  }

  .brand-logo-icon {
    width: 48px;
    height: 48px;
    font-size: 22px;
  }

  .brand-title {
    font-size: 20px;
  }

  .brand-subtitle {
    font-size: 13px;
  }

  .header-clock-pill {
    padding: 8px 18px;
    font-size: 14px;
  }

  .user-avatar-sm {
    width: 42px;
    height: 42px;
  }

  .user-name-label {
    font-size: 15px;
  }

  .hr-sidebar {
    width: 320px;
  }

  .nav-link {
    font-size: 15px;
    padding: 12px 18px;
  }

  .page-title {
    font-size: 28px;
  }

  .page-subtitle {
    font-size: 16px;
  }

  .stats-grid {
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 24px;
  }

  .stat-card {
    padding: 24px;
  }

  .stat-value {
    font-size: 38px;
  }

  .btn {
    height: 46px;
    padding: 0 24px;
    font-size: 15px;
  }

  .btn-sm {
    height: 38px;
    padding: 0 16px;
    font-size: 13px;
  }

  .data-table th {
    padding: 16px 20px;
    font-size: 13px;
  }

  .data-table td {
    padding: 18px 20px;
    font-size: 15px;
  }

  .modal-container {
    max-width: 720px;
  }

  .camera-view-container {
    max-width: 440px;
    height: 440px;
  }

  .camera-guide-overlay {
    width: 260px;
    height: 330px;
  }
}

@media (min-width: 2560px) {
  html {
    font-size: 21px; /* 4K resolution scaling */
  }

  .app-container {
    max-width: 2800px;
  }

  .main-content {
    max-width: 2500px;
    padding: 44px 60px;
  }
}

@media (min-width: 3840px) {
  html {
    font-size: 26px; /* Ultra-large 4K & 8K displays */
  }

  .app-container {
    max-width: 3400px;
  }
}

/* ==============================================================================
   2. DESKTOP & FULL HD (1441px - 1920px)
   ============================================================================== */
@media (min-width: 1441px) and (max-width: 1920px) {
  html {
    font-size: 16px;
  }

  .main-content {
    max-width: 1500px;
  }
}

/* ==============================================================================
   3. LAPTOP & STANDARD DESKTOP (1025px - 1440px)
   ============================================================================== */
@media (min-width: 1025px) and (max-width: 1440px) {
  html {
    font-size: 15px;
  }

  .hr-sidebar {
    width: var(--sidebar-width);
    display: flex !important;
  }

  .main-content {
    padding: 24px;
    max-width: 1200px;
  }
}

/* ==============================================================================
   4. TABLETS & SMALL LAPTOPS (641px - 1024px)
   ============================================================================== */
@media (min-width: 641px) and (max-width: 1024px) {
  html {
    font-size: 15px;
  }

  .mobile-menu-toggle-btn {
    display: inline-flex;
  }

  .sidebar-mobile-header {
    display: flex;
  }

  .hr-sidebar {
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    width: min(320px, 80vw);
    height: 100vh;
    z-index: 95;
    transform: translateX(-100%);
    transition: transform 0.3s cubic-bezier(0.16, 1, 0.3, 1);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.25);
    background-color: var(--white);
    display: flex !important;
  }

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

  .main-content {
    padding: 20px 18px;
    max-width: 100%;
  }

  .stats-grid {
    grid-template-columns: repeat(3, 1fr);
    gap: 12px;
  }

  .offices-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  .filter-bar {
    padding: 12px 16px;
    gap: 10px;
  }

  .modal-container {
    max-width: 580px;
  }
}

/* ==============================================================================
   5. MOBILE DEVICES (Phones & Phablets: <= 640px)
   ============================================================================== */
@media (max-width: 640px) {
  html, body {
    width: 100% !important;
    max-width: 100vw !important;
    overflow-x: hidden !important;
    font-size: 13.5px;
  }

  .app-container {
    width: 100% !important;
    max-width: 100vw !important;
    overflow-x: hidden !important;
    flex-direction: column !important;
  }

  /* Header Compact Mode */
  .top-header {
    height: 54px !important;
    padding: 0 10px !important;
    width: 100% !important;
    max-width: 100vw !important;
    box-sizing: border-box !important;
    overflow-x: hidden !important;
    gap: 6px !important;
  }

  .brand-section {
    gap: 6px !important;
    flex-shrink: 1 !important;
    min-width: 0 !important;
  }

  .mobile-menu-toggle-btn {
    display: inline-flex !important;
    width: 34px !important;
    height: 34px !important;
    padding: 5px !important;
    flex-shrink: 0 !important;
  }

  .brand-logo-icon {
    width: 28px !important;
    height: 28px !important;
    font-size: 13px !important;
    flex-shrink: 0 !important;
  }

  .brand-title {
    font-size: 13px !important;
    font-weight: 700 !important;
    min-width: 0 !important;
    white-space: nowrap !important;
  }

  .brand-title-full {
    display: none !important;
  }

  .brand-title-short {
    display: inline !important;
    font-size: 13px !important;
    font-weight: 700 !important;
    color: var(--slate-900) !important;
    white-space: nowrap !important;
  }

  .brand-subtitle {
    display: none !important;
  }

  .header-actions {
    gap: 6px !important;
    flex-shrink: 0 !important;
  }

  /* Hide Clock Pill completely on mobile phones to free space */
  .header-clock-pill {
    display: none !important;
  }

  #btn-header-punch {
    height: 32px !important;
    padding: 4px 8px !important;
    font-size: 11px !important;
    gap: 4px !important;
    flex-shrink: 0 !important;
  }

  .btn-punch-text {
    display: none !important;
  }

  .user-role-label {
    display: none !important;
  }

  .user-name-label {
    display: none !important;
  }

  .header-user-meta {
    display: none !important;
  }

  .user-avatar-sm {
    width: 28px !important;
    height: 28px !important;
    flex-shrink: 0 !important;
  }

  /* Slide-in Mobile Drawer Sidebar */
  .hr-sidebar {
    position: fixed !important;
    top: 0 !important;
    left: 0 !important;
    bottom: 0 !important;
    width: 280px !important;
    max-width: 82vw !important;
    height: 100vh !important;
    height: 100dvh !important;
    z-index: 9999 !important;
    transform: translateX(-100%) !important;
    transition: transform 0.28s cubic-bezier(0.16, 1, 0.3, 1) !important;
    box-shadow: 4px 0 25px rgba(0, 0, 0, 0.3) !important;
    background-color: var(--white) !important;
    display: flex !important;
    flex-direction: column !important;
    overflow-y: auto !important;
    overflow-x: hidden !important;
    box-sizing: border-box !important;
  }

  .hr-sidebar.mobile-open {
    transform: translateX(0) !important;
  }

  .sidebar-mobile-header {
    display: flex !important;
    padding: 12px 14px !important;
    border-bottom: 1px solid var(--slate-200) !important;
    align-items: center !important;
    justify-content: space-between !important;
    background-color: var(--slate-50) !important;
    width: 100% !important;
    box-sizing: border-box !important;
  }

  .sidebar-close-btn {
    width: 32px !important;
    height: 32px !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    font-size: 22px !important;
    line-height: 1 !important;
    color: #0f172a !important;
    background: #e2e8f0 !important;
    border-radius: 50% !important;
    border: none !important;
    cursor: pointer !important;
    flex-shrink: 0 !important;
  }

  .sidebar-backdrop {
    position: fixed !important;
    top: 0 !important;
    left: 0 !important;
    right: 0 !important;
    bottom: 0 !important;
    background-color: rgba(15, 23, 42, 0.6) !important;
    backdrop-filter: blur(4px) !important;
    z-index: 9990 !important;
  }

  .sidebar-backdrop.active {
    display: block !important;
  }

  /* Main Container Padding */
  .main-content {
    padding: 12px 10px 24px !important;
    width: 100% !important;
    max-width: 100% !important;
    min-width: 0 !important;
    box-sizing: border-box !important;
  }

  .card {
    padding: 14px 12px !important;
    margin-bottom: 14px !important;
    border-radius: var(--radius-md) !important;
    width: 100% !important;
    max-width: 100% !important;
    min-width: 0 !important;
    box-sizing: border-box !important;
    overflow: hidden !important;
  }

  .card-header {
    flex-direction: column !important;
    align-items: stretch !important;
    gap: 8px !important;
  }

  /* Page Header & Actions */
  .page-header {
    margin-bottom: 14px !important;
    flex-direction: column !important;
    align-items: stretch !important;
    gap: 10px !important;
    width: 100% !important;
    box-sizing: border-box !important;
  }

  .page-title {
    font-size: 17px !important;
    line-height: 1.3 !important;
    word-break: break-word !important;
  }

  .page-subtitle {
    font-size: 11px !important;
    word-break: break-word !important;
  }

  .page-actions {
    width: 100% !important;
    flex-direction: column !important;
    align-items: stretch !important;
    gap: 8px !important;
  }

  .page-actions .btn {
    width: 100% !important;
    height: 38px !important;
  }

  /* KPI Stats Grid on Mobile - Exactly 2 columns, never overflowing */
  .stats-grid {
    display: grid !important;
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
    gap: 8px !important;
    width: 100% !important;
    box-sizing: border-box !important;
    margin-bottom: 14px !important;
  }

  .stat-card {
    padding: 10px 8px !important;
    min-width: 0 !important;
    overflow: hidden !important;
    box-sizing: border-box !important;
  }

  .stat-label {
    font-size: 9.5px !important;
    margin-bottom: 2px !important;
    white-space: nowrap !important;
    overflow: hidden !important;
    text-overflow: ellipsis !important;
  }

  .stat-value {
    font-size: 20px !important;
    line-height: 1.2 !important;
  }

  .stat-subtext {
    font-size: 9px !important;
    white-space: nowrap !important;
    overflow: hidden !important;
    text-overflow: ellipsis !important;
  }

  /* Responsive Grids on Mobile */
  .dashboard-split-grid {
    grid-template-columns: 1fr !important;
    gap: 14px !important;
  }

  .verify-card-grid {
    grid-template-columns: 1fr !important;
    gap: 12px !important;
  }

  .verify-detail-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
    gap: 8px !important;
    padding: 8px 10px !important;
  }

  .correction-card-grid {
    grid-template-columns: 1fr !important;
    gap: 12px !important;
    padding: 10px !important;
  }

  .my-att-split-grid {
    grid-template-columns: 1fr !important;
    gap: 14px !important;
  }

  /* Filter Bar Stacking */
  .filter-bar {
    padding: 12px 10px !important;
    flex-direction: column !important;
    align-items: stretch !important;
    gap: 8px !important;
    margin-bottom: 14px !important;
    width: 100% !important;
    box-sizing: border-box !important;
  }

  .filter-group {
    width: 100% !important;
    flex-direction: column !important;
    align-items: stretch !important;
    gap: 4px !important;
  }

  .filter-group .form-select,
  .filter-group .form-input,
  .filter-group .btn {
    width: 100% !important;
  }

  /* Data Tables Mobile Scrolling */
  .table-container {
    width: 100% !important;
    max-width: 100% !important;
    overflow-x: auto !important;
    -webkit-overflow-scrolling: touch !important;
    box-sizing: border-box !important;
    display: block !important;
    min-width: 0 !important;
    border-radius: var(--radius-sm);
  }

  .data-table {
    min-width: 580px;
    width: 100%;
  }

  .data-table th, .data-table td {
    padding: 9px 8px;
    font-size: 11.5px;
  }

  /* Modals: Mobile Bottom-Sheet Style */
  .modal-overlay {
    padding: 0 !important;
    align-items: flex-end !important;
  }

  .modal-container {
    max-width: 100% !important;
    width: 100% !important;
    max-height: 92vh !important;
    max-height: 92dvh !important;
    border-radius: 20px 20px 0 0 !important;
    margin: 0 !important;
  }

  .modal-header {
    padding: 12px 14px;
  }

  .modal-title {
    font-size: 14px;
  }

  .modal-body {
    padding: 14px 12px;
  }

  .modal-footer {
    padding: 12px 14px;
    flex-direction: column-reverse;
    gap: 8px;
  }

  .modal-footer .btn {
    width: 100%;
    height: 40px;
  }

  /* Camera & Selfie Capture Viewfinder */
  .camera-view-container {
    max-width: min(280px, 80vw);
    height: min(280px, 80vw);
    margin: 0 auto 12px;
  }

  .camera-guide-overlay {
    width: min(160px, 50vw);
    height: min(210px, 65vw);
    border-radius: 50%;
  }

  /* Calendar on Mobile */
  .calendar-container {
    padding: 10px 6px;
  }

  .calendar-days-grid {
    gap: 3px;
  }

  .calendar-day-cell {
    padding: 4px 2px;
    border-radius: 4px;
  }

  .calendar-day-number {
    font-size: 10px;
  }

  .calendar-day-indicator {
    font-size: 8.5px;
  }

  /* Employee Layout Wrapper */
  .employee-layout-wrapper {
    padding: 12px 10px calc(var(--bottom-nav-height) + env(safe-area-inset-bottom, 16px));
    width: 100%;
    box-sizing: border-box;
  }

  .employee-hero-name {
    font-size: 19px;
  }

  /* Bottom Navigation Safe Area */
  .bottom-nav {
    padding-bottom: env(safe-area-inset-bottom, 0);
    height: calc(var(--bottom-nav-height) + env(safe-area-inset-bottom, 0px));
  }

  .bottom-nav-item span {
    font-size: 9px;
  }

  .bottom-nav-item svg {
    width: 20px;
    height: 20px;
  }

  /* Offices Grid */
  .offices-grid {
    grid-template-columns: 1fr;
    gap: 12px;
  }

  /* Auth / Login View */
  #auth-view {
    padding: 14px 10px;
    width: 100%;
    box-sizing: border-box;
  }

  #auth-view .card {
    padding: 20px 14px;
    width: 100%;
    box-sizing: border-box;
  }
}

/* ==============================================================================
   6. EXTRA SMALL MOBILE (<= 360px: iPhone SE, Galaxy Fold, Small Devices)
   ============================================================================== */
@media (max-width: 360px) {
  .brand-title {
    max-width: 95px;
    font-size: 12px;
  }

  .header-clock-pill {
    display: none;
  }

  .header-user-meta {
    display: none;
  }

  .stats-grid {
    grid-template-columns: 1fr;
  }

  .camera-view-container {
    max-width: 250px;
    height: 250px;
  }
}

/* ==============================================================================
   7. PRINT STYLES FOR CORPORATE REPORTS & AUDITS
   ============================================================================== */
@media print {
  .top-header, .demo-switcher-bar, .hr-sidebar, .bottom-nav, .filter-bar, .btn, .page-actions, .mobile-menu-toggle-btn {
    display: none !important;
  }
  body, .main-content {
    background: #fff !important;
    padding: 0 !important;
    margin: 0 !important;
  }
  .card, .table-container {
    border: none !important;
    box-shadow: none !important;
  }
  .data-table th, .data-table td {
    border: 1px solid #cbd5e1 !important;
  }
}

