:root {
  /* ==================== JOINVENTA CORPORATE DESIGN SYSTEM ==================== */
  --bg-main: #f4f6fa;           /* Fondo grisaceo claro premium de JoinVenta */
  --bg-card: #ffffff;           /* Tarjetas blancas limpias */
  --bg-sidebar: #3c605c;        /* Verde salvia oscuro profundo de JoinVenta */
  --bg-sidebar-hover: rgba(255, 255, 255, 0.08);
  --border-color: #e2e8f0;      /* Bordes suaves */

  --text-primary: #1e293b;      /* Texto oscuro principal (Slate 900) */
  --text-secondary: #475569;    /* Texto secundario gris pizarra (Slate 600) */
  --text-muted: #94a3b8;        /* Texto silenciado */

  --primary: #3c605c;           /* Verde salvia oscuro de JoinVenta */
  --primary-hover: #2d4845;
  --primary-glow: rgba(60, 96, 92, 0.22);

  --secondary: #559fac;         /* Azul verde salvia de JoinVenta */
  --secondary-hover: #458893;
  --secondary-glow: rgba(85, 159, 172, 0.22);

  --color-accent: #cd8f50;      /* Cobre / oro calido de JoinVenta */
  --color-accent-hover: #b87e43;
  --color-accent-glow: rgba(205, 143, 80, 0.25);

  --accent-emerald: #10b981;    /* Verde exito / puntual */
  --accent-emerald-glow: rgba(16, 185, 129, 0.2);
  --accent-rose: #ef4444;       /* Rojo alertas / ausencias */
  --accent-rose-glow: rgba(239, 68, 68, 0.2);
  --color-warning: #f59e0b;     /* Naranja advertencia / retardo */

  --bg-color: var(--bg-main);
  --panel-bg: #ffffff;
  --panel-border: #e2e8f0;

  --font-sans: 'Outfit', 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --font-display: 'Outfit', sans-serif;
  --transition-smooth: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
  --border-radius-sm: 8px;
  --border-radius-md: 12px;
  --border-radius-lg: 16px;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  scrollbar-width: thin;
  scrollbar-color: rgba(85, 159, 172, 0.5) rgba(0, 0, 0, 0.04);
}

/* ==================== UNIVERSAL CUSTOM SCROLLBARS ==================== */
::-webkit-scrollbar {
  width: 9px;
  height: 9px; /* Para barras de scroll horizontal */
}

::-webkit-scrollbar-track {
  background: rgba(0, 0, 0, 0.04);
  border-radius: 6px;
}

::-webkit-scrollbar-thumb {
  background: rgba(60, 96, 92, 0.4);
  border-radius: 6px;
  border: 2px solid transparent;
  background-clip: padding-box;
  transition: background 0.2s ease;
}

::-webkit-scrollbar-thumb:hover {
  background: var(--primary, #3c605c);
}

::-webkit-scrollbar-corner {
  background: transparent;
}

html, body {
  max-width: 100%;
  overflow-x: auto;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}

body {
  font-family: var(--font-sans);
  background-color: var(--bg-main);
  color: var(--text-primary);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  background-image: 
    radial-gradient(circle at 10% 15%, rgba(60, 96, 92, 0.04) 0%, transparent 40%),
    radial-gradient(circle at 90% 85%, rgba(85, 159, 172, 0.04) 0%, transparent 40%);
  background-attachment: fixed;
  -webkit-font-smoothing: antialiased;
}

/* Glassmorphism & Card Utility Classes - JoinVenta Clean Style */
.glass {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--border-radius-lg);
  box-shadow: 0 4px 20px rgba(15, 23, 42, 0.04), 0 1px 3px rgba(15, 23, 42, 0.02);
}

.glass-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--border-radius-md);
  box-shadow: 0 2px 8px rgba(15, 23, 42, 0.03);
  transition: var(--transition-smooth);
}

.glass-card:hover {
  border-color: var(--secondary);
  background: #ffffff;
  transform: translateY(-2px);
  box-shadow: 0 8px 24px rgba(15, 23, 42, 0.06);
}

/* ==================== BUTTONS ==================== */
.btn {
  font-family: var(--font-sans);
  font-weight: 600;
  font-size: 0.92rem;
  padding: 10px 20px;
  border-radius: var(--border-radius-sm);
  border: none;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  transition: var(--transition-smooth);
}

.btn-primary {
  background-color: var(--primary);
  color: #ffffff;
  box-shadow: 0 2px 8px var(--primary-glow);
}

.btn-primary:hover {
  background-color: var(--primary-hover);
  transform: translateY(-1px);
  box-shadow: 0 4px 14px rgba(60, 96, 92, 0.35);
  filter: none;
}

.btn-secondary {
  background-color: var(--secondary);
  color: #ffffff;
  box-shadow: 0 2px 8px var(--secondary-glow);
}

.btn-secondary:hover {
  background-color: var(--secondary-hover);
  transform: translateY(-1px);
  box-shadow: 0 4px 14px rgba(85, 159, 172, 0.35);
}

.btn-accent {
  background-color: var(--color-accent);
  color: #ffffff;
  box-shadow: 0 2px 8px var(--color-accent-glow);
}

.btn-accent:hover {
  background-color: var(--color-accent-hover);
  transform: translateY(-1px);
  box-shadow: 0 4px 14px rgba(205, 143, 80, 0.35);
}

.btn-danger {
  background-color: var(--accent-rose);
  color: #ffffff;
  box-shadow: 0 2px 8px var(--accent-rose-glow);
}

.btn-danger:hover {
  background-color: #dc2626;
  transform: translateY(-1px);
  box-shadow: 0 4px 14px rgba(239, 68, 68, 0.35);
}

.btn-outline {
  background-color: #ffffff;
  border: 1px solid #cbd5e1;
  color: var(--text-primary);
}

.btn-outline:hover {
  background-color: #f1f5f9;
  border-color: #94a3b8;
  color: var(--text-primary);
}

.btn-outline.btn-danger {
  background-color: #ffffff;
  border-color: rgba(239, 68, 68, 0.35);
  color: #dc2626;
  box-shadow: none;
}

.btn-outline.btn-danger:hover {
  background-color: #fef2f2;
  border-color: #ef4444;
  color: #b91c1c;
}

/* ==================== CLOCK PAGE STYLES (KIOSK / TABLET) ==================== */
.kiosk-container {
  max-width: 1200px;
  width: 100%;
  margin: auto;
  padding: 40px 20px;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 40px;
  align-items: center;
  flex: 1;
}

@media (max-width: 900px) {
  .kiosk-container {
    grid-template-columns: 1fr;
    padding: 20px 10px;
    gap: 30px;
  }
}

.clock-panel {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 40px;
  text-align: center;
}

.digital-clock {
  font-family: var(--font-display);
  font-size: 5rem;
  font-weight: 800;
  letter-spacing: -2px;
  color: var(--primary);
  line-height: 1;
  margin-bottom: 8px;
}

.digital-date {
  font-size: 1.15rem;
  font-weight: 600;
  color: var(--text-secondary);
  letter-spacing: 0.5px;
  text-transform: uppercase;
  margin-bottom: 30px;
}

/* Camera Scanner UI */
.scanner-wrapper {
  position: relative;
  width: 220px;
  height: 220px;
  border-radius: 50%;
  padding: 6px;
  background: linear-gradient(135deg, var(--primary) 0%, var(--secondary) 100%);
  box-shadow: 0 8px 25px var(--primary-glow);
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  margin-bottom: 20px;
}

.scanner-wrapper.scanning::after {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 4px;
  background: linear-gradient(to right, transparent, #ffffff, transparent);
  box-shadow: 0 0 15px #ffffff;
  animation: scan 3s ease-in-out infinite;
  z-index: 10;
}

.scanner-video {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 50%;
  transform: scaleX(-1);
}

@keyframes scan {
  0%, 100% { top: 5%; }
  50% { top: 95%; }
}

.scanner-overlay-canvas {
  position: absolute;
  top: 8px;
  left: 8px;
  width: calc(100% - 16px);
  height: calc(100% - 16px);
  border-radius: 50%;
  z-index: 5;
  pointer-events: none;
  transform: scaleX(-1);
}

.status-indicator {
  font-size: 1rem;
  font-weight: 600;
  padding: 8px 20px;
  border-radius: 50px;
  margin-top: 10px;
  transition: var(--transition-smooth);
  animation: pulse 2s infinite;
}

.status-indicator.ready {
  background: rgba(85, 159, 172, 0.12);
  color: var(--primary);
  border: 1px solid rgba(85, 159, 172, 0.3);
}

.status-indicator.success {
  background: rgba(16, 185, 129, 0.12);
  color: #059669;
  border: 1px solid rgba(16, 185, 129, 0.3);
  animation: success-bounce 0.5s ease-out;
}

.status-indicator.error {
  background: rgba(239, 68, 68, 0.12);
  color: #dc2626;
  border: 1px solid rgba(239, 68, 68, 0.3);
  animation: shake 0.4s ease;
}

@keyframes pulse {
  0%, 100% { opacity: 0.9; }
  50% { opacity: 1; transform: scale(1.02); }
}

@keyframes success-bounce {
  0% { transform: scale(0.8); }
  50% { transform: scale(1.08); }
  100% { transform: scale(1); }
}

@keyframes shake {
  0%, 100% { transform: translateX(0); }
  20%, 60% { transform: translateX(-6px); }
  40%, 80% { transform: translateX(6px); }
}

/* PIN Pad Panel */
.pin-panel {
  padding: 40px;
  display: flex;
  flex-direction: column;
  align-items: center;
}

/* PIN Input for Phone & Tablet Keyboards */
.kiosk-pin-field-wrapper {
  position: relative;
  width: 100%;
  max-width: 320px;
  display: flex;
  align-items: center;
}

.kiosk-input-icon {
  position: absolute;
  left: 16px;
  color: var(--text-secondary);
  font-size: 1.15rem;
  pointer-events: none;
}

.kiosk-text-input {
  width: 100%;
  height: 56px;
  padding: 0 44px 0 46px;
  font-size: 1.35rem;
  font-weight: 700;
  letter-spacing: 2px;
  text-align: center;
  text-transform: uppercase;
  background: #ffffff;
  color: var(--text-primary);
  border: 2px solid var(--border-color);
  border-radius: var(--border-radius-md);
  box-shadow: 0 2px 8px rgba(15, 23, 42, 0.04);
  transition: all 0.25s ease;
  box-sizing: border-box;
}

.kiosk-text-input:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 4px var(--primary-glow), 0 4px 15px rgba(15, 23, 42, 0.08);
}

.kiosk-text-input.error {
  border-color: #ef4444 !important;
  box-shadow: 0 0 0 4px rgba(239, 68, 68, 0.2) !important;
  animation: shake 0.4s ease;
}

.kiosk-clear-input-btn {
  position: absolute;
  right: 10px;
  background: transparent;
  border: none;
  color: var(--text-secondary);
  font-size: 1.25rem;
  cursor: pointer;
  padding: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: color 0.2s;
}

.kiosk-clear-input-btn:hover {
  color: #ef4444;
}

.kiosk-check-btn {
  width: 100%;
  max-width: 320px;
  height: 52px;
  font-size: 1.05rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  border-radius: var(--border-radius-md);
  box-shadow: 0 4px 14px var(--primary-glow);
  cursor: pointer;
  margin-top: 4px;
}

.pin-display {
  width: 100%;
  max-width: 280px;
  height: 56px;
  border-radius: var(--border-radius-md);
  background: #f8fafc;
  border: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 15px;
  margin-bottom: 25px;
}

.pin-dot {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  border: 2px solid #cbd5e1;
  transition: var(--transition-smooth);
}

.pin-dot.filled {
  background: var(--primary);
  border-color: var(--primary);
  box-shadow: 0 0 8px var(--primary-glow);
}

.pin-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 15px;
  width: 100%;
  max-width: 280px;
  margin-bottom: 25px;
}

.pin-btn {
  aspect-ratio: 1;
  border-radius: 50%;
  background: #ffffff;
  border: 1px solid var(--border-color);
  font-family: var(--font-display);
  font-size: 1.65rem;
  font-weight: 700;
  color: var(--text-primary);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: var(--transition-smooth);
  box-shadow: 0 2px 6px rgba(15, 23, 42, 0.03);
}

.pin-btn:hover {
  background: var(--primary);
  border-color: var(--primary);
  color: #ffffff;
  transform: scale(1.05);
  box-shadow: 0 4px 12px var(--primary-glow);
}

.pin-btn:active {
  background: var(--primary-hover);
  transform: scale(0.95);
}

.pin-btn.action-btn {
  font-size: 1rem;
  font-weight: 600;
  text-transform: uppercase;
  color: var(--text-secondary);
}

.pin-btn.action-btn:hover {
  color: #ffffff;
  background: var(--secondary);
  border-color: var(--secondary);
}

.action-selector {
  display: flex;
  gap: 15px;
  width: 100%;
  max-width: 280px;
}

.action-selector button {
  flex: 1;
}

/* ==================== MODALS & OVERLAYS ==================== */
.overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(15, 23, 42, 0.45);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s ease;
  overflow-y: auto;
  overflow-x: auto;
  padding: 24px 12px;
  box-sizing: border-box;
  -webkit-overflow-scrolling: touch;
}

.overlay.active {
  opacity: 1;
  pointer-events: auto;
}

.modal-content {
  width: 92%;
  max-width: 540px;
  max-height: 90vh;
  overflow-y: auto;
  overflow-x: auto;
  box-sizing: border-box;
  -webkit-overflow-scrolling: touch;
  padding: 32px 28px;
  text-align: center;
  background: #ffffff;
  border: 1px solid var(--border-color);
  color: var(--text-primary);
  box-shadow: 0 20px 45px rgba(15, 23, 42, 0.14), 0 1px 3px rgba(15, 23, 42, 0.05);
  border-radius: var(--border-radius-lg);
  transform: translateY(20px) scale(0.96);
  transition: transform 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.overlay.active .modal-content {
  transform: translateY(0) scale(1);
}

.check-type-dialog h2 {
  font-family: var(--font-display);
  font-size: 2rem;
  font-weight: 800;
  margin-bottom: 8px;
  color: var(--primary);
}

.check-type-dialog p {
  color: var(--text-secondary);
  margin-bottom: 25px;
}

.check-type-buttons {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
}

.check-type-buttons button {
  flex: 1;
  height: 120px;
  border-radius: var(--border-radius-md);
  font-size: 1.15rem;
  flex-direction: column;
  gap: 10px;
}

.check-type-buttons button span.icon {
  font-size: 2.2rem;
}

/* ==================== ADMIN PAGE STYLES ==================== */
.app-container {
  display: flex;
  min-height: 100vh;
  width: 100%;
  max-width: 100%;
  position: relative;
  box-sizing: border-box;
}

/* Sidebar Navigation - JoinVenta Signature Deep Sage Style */
.sidebar {
  width: 260px;
  min-width: 260px;
  background-color: var(--bg-sidebar);
  border-right: none;
  display: flex;
  flex-direction: column;
  padding: 24px 16px;
  position: fixed;
  top: 0;
  left: 0;
  bottom: 0;
  height: 100vh;
  max-height: 100vh;
  overflow-y: auto;
  overflow-x: hidden;
  z-index: 100;
  box-shadow: 2px 0 15px rgba(15, 23, 42, 0.06);
  transition: width 0.3s cubic-bezier(0.4, 0, 0.2, 1), padding 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  box-sizing: border-box;
}

.sidebar::-webkit-scrollbar {
  width: 5px;
}
.sidebar::-webkit-scrollbar-track {
  background: rgba(0, 0, 0, 0.1);
}
.sidebar::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.25);
  border-radius: 4px;
}
.sidebar::-webkit-scrollbar-thumb:hover {
  background: rgba(255, 255, 255, 0.45);
}

.logo-area {
  display: flex;
  align-items: center;
  gap: 12px;
  padding-bottom: 20px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.12);
  transition: padding 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.toggle-sidebar-btn {
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid rgba(255, 255, 255, 0.2);
  color: #ffffff;
  border-radius: var(--border-radius-sm);
  width: 30px;
  height: 30px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: background 0.2s ease, transform 0.3s ease;
  flex-shrink: 0;
  margin-left: auto;
}

.toggle-sidebar-btn:hover {
  background: rgba(255, 255, 255, 0.25);
  color: #ffffff;
}

.logo-text {
  font-family: var(--font-display);
  font-size: 1.35rem;
  font-weight: 800;
  letter-spacing: 0.5px;
  color: #ffffff;
}

.logo-text span {
  color: var(--color-accent);
  font-weight: 600;
}

.nav-menu {
  margin-top: 24px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  flex-grow: 1;
}

.sidebar .tab-btn {
  background: transparent;
  border: none;
  outline: none;
  color: #c4deda;
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 12px 16px;
  border-radius: var(--border-radius-sm);
  cursor: pointer;
  font-family: var(--font-sans);
  font-size: 0.95rem;
  font-weight: 600;
  text-align: left;
  transition: var(--transition-smooth);
  width: 100%;
}

.sidebar .tab-btn:hover {
  color: #ffffff;
  background-color: rgba(255, 255, 255, 0.08);
}

.sidebar .tab-btn.active {
  color: var(--bg-sidebar);
  background-color: var(--bg-main);
  font-weight: 800;
  box-shadow: -2px 2px 8px rgba(0, 0, 0, 0.05);
}

.sidebar .tab-btn.active .nav-icon {
  color: var(--bg-sidebar);
}

.nav-icon {
  width: 20px;
  height: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.1rem;
}

.sidebar-footer {
  padding-top: 16px;
  border-top: 1px solid rgba(255, 255, 255, 0.12);
}

.sidebar-footer .status-indicator {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 0.85rem;
  color: #c4deda;
  padding: 0;
  margin: 0;
  animation: none;
}

.pulse-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  position: relative;
}

.pulse-dot.green {
  background-color: var(--accent-emerald);
  box-shadow: 0 0 8px var(--accent-emerald-glow);
}

.pulse-dot.green::after {
  content: '';
  position: absolute;
  width: 100%;
  height: 100%;
  top: 0;
  left: 0;
  background-color: var(--accent-emerald);
  border-radius: 50%;
  animation: pulse-ring 1.8s infinite;
}

@keyframes pulse-ring {
  0% { transform: scale(1); opacity: 0.8; }
  100% { transform: scale(2.5); opacity: 0; }
}

/* ==================== ESTADO CONTRAÍDO (SIDEBAR COLLAPSED) ==================== */
.app-container.sidebar-collapsed .sidebar {
  width: 76px !important;
  min-width: 76px !important;
  padding: 24px 10px !important;
}

.app-container.sidebar-collapsed .main-content {
  margin-left: 76px !important;
  width: calc(100% - 76px) !important;
  max-width: calc(100% - 76px) !important;
}

.app-container.sidebar-collapsed .logo-area {
  padding-bottom: 16px !important;
  justify-content: center !important;
  flex-direction: column !important;
  gap: 10px !important;
}

.app-container.sidebar-collapsed .logo-text {
  display: none !important;
}

.app-container.sidebar-collapsed .toggle-sidebar-btn {
  margin-left: 0 !important;
  transform: rotate(180deg);
}

.app-container.sidebar-collapsed .sidebar-company-info {
  display: none !important;
}

.app-container.sidebar-collapsed .sidebar .tab-btn {
  padding: 12px 0 !important;
  justify-content: center !important;
  gap: 0 !important;
}

.app-container.sidebar-collapsed .tab-label {
  display: none !important;
}

.app-container.sidebar-collapsed .sidebar-logout-btn {
  padding: 12px 0 !important;
  justify-content: center !important;
}

.app-container.sidebar-collapsed .sidebar-logout-btn .tab-label {
  display: none !important;
}

.app-container.sidebar-collapsed .status-text {
  display: none !important;
}

.app-container.sidebar-collapsed .status-indicator {
  justify-content: center !important;
}

/* Tooltips emergentes flotantes estilo JoinVenta */
.app-container.sidebar-collapsed .sidebar .tab-btn,
.app-container.sidebar-collapsed .sidebar-logout-btn {
  position: relative;
}

.app-container.sidebar-collapsed .sidebar .tab-btn::after,
.app-container.sidebar-collapsed .sidebar-logout-btn::after {
  content: attr(data-tooltip);
  position: absolute;
  left: 100%;
  top: 50%;
  transform: translateY(-50%);
  margin-left: 14px;
  background: #0f172a;
  color: #ffffff;
  padding: 6px 12px;
  border-radius: 6px;
  font-size: 0.82rem;
  font-weight: 600;
  white-space: nowrap;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease, transform 0.2s ease;
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.4);
  border: 1px solid rgba(255, 255, 255, 0.15);
  z-index: 9999;
}

.app-container.sidebar-collapsed .sidebar .tab-btn:hover::after,
.app-container.sidebar-collapsed .sidebar-logout-btn:hover::after {
  opacity: 1;
  transform: translateY(-50%) translateX(4px);
}

/* Main Content Area */
.main-content {
  flex: 1 1 0%;
  min-width: 0;
  width: calc(100% - 260px);
  max-width: calc(100% - 260px);
  margin-left: 260px;
  padding: clamp(16px, 2.5vw, 36px);
  min-height: 100vh;
  background-color: var(--bg-main);
  box-sizing: border-box;
  overflow-x: auto;
  overflow-y: visible;
  transition: margin-left 0.3s cubic-bezier(0.4, 0, 0.2, 1), width 0.3s cubic-bezier(0.4, 0, 0.2, 1), max-width 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

@media (max-width: 992px) {
  .app-container {
    flex-direction: column;
  }
  .sidebar {
    position: relative !important;
    width: 100% !important;
    min-width: 100% !important;
    height: auto !important;
    max-height: none !important;
    border-right: none !important;
    border-bottom: 1px solid rgba(255, 255, 255, 0.12) !important;
    padding: 14px 16px !important;
    box-shadow: 0 4px 12px rgba(15, 23, 42, 0.08);
  }
  .sidebar .logo-area {
    padding-bottom: 12px;
  }
  .toggle-sidebar-btn {
    display: none !important;
  }
  .sidebar .nav-menu {
    margin-top: 12px;
    flex-direction: row;
    flex-wrap: nowrap;
    overflow-x: auto;
    gap: 8px;
    padding-bottom: 6px;
    -webkit-overflow-scrolling: touch;
  }
  .sidebar .tab-btn {
    width: auto;
    white-space: nowrap;
    flex-shrink: 0;
    padding: 8px 14px;
    font-size: 0.9rem;
  }
  .sidebar-company-info {
    margin-top: 10px !important;
    margin-bottom: 6px !important;
    flex-direction: row !important;
    align-items: center !important;
    justify-content: space-between !important;
  }
  .sidebar-footer {
    display: none !important;
  }
  .sidebar-logout-btn {
    margin-top: 0 !important;
    width: auto !important;
    flex-shrink: 0;
    padding: 8px 14px !important;
  }
  .main-content {
    margin-left: 0 !important;
    width: 100% !important;
    max-width: 100% !important;
    padding: 20px 14px !important;
  }
}

/* Dashboard Stats Cards */
.dashboard-stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 20px;
  margin-bottom: 35px;
}

.stat-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--border-radius-md);
  padding: 24px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  box-shadow: 0 2px 8px rgba(15, 23, 42, 0.02);
}

.stat-card h3 {
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  margin-bottom: 8px;
}

.stat-value {
  font-family: var(--font-display);
  font-size: 2.5rem;
  font-weight: 800;
  line-height: 1;
  color: var(--primary);
  margin-bottom: 10px;
}

.stat-card .desc {
  font-size: 0.82rem;
  color: var(--text-muted);
}

.qr-link-container {
  display: flex;
  align-items: center;
  gap: 20px;
}

.qr-code {
  width: 80px;
  height: 80px;
  background: #fff;
  border-radius: var(--border-radius-sm);
  padding: 5px;
  border: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: center;
}

.qr-code img {
  width: 100%;
  height: 100%;
}

.admin-section {
  display: none;
  animation: fadeIn 0.3s ease-out forwards;
}

.admin-section.active {
  display: block;
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

/* ==================== FORMS & TABLES ==================== */
.section-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 25px;
}

.section-header h2 {
  font-family: var(--font-display);
  font-size: 1.75rem;
  font-weight: 800;
  color: var(--text-primary);
}

.data-table-container {
  width: 100%;
  max-width: 100%;
  overflow-x: auto !important;
  overflow-y: auto !important;
  -webkit-overflow-scrolling: touch !important;
  border-radius: var(--border-radius-md);
  border: 1px solid var(--border-color);
  background: var(--bg-card);
  box-shadow: 0 2px 8px rgba(15, 23, 42, 0.02);
  position: relative;
}

/* Prominent custom scrollbar for data tables */
.data-table-container::-webkit-scrollbar,
.matrix-table-container::-webkit-scrollbar {
  width: 10px;
  height: 10px;
}

.data-table-container::-webkit-scrollbar-track,
.matrix-table-container::-webkit-scrollbar-track {
  background: #f1f5f9;
  border-radius: 6px;
}

.data-table-container::-webkit-scrollbar-thumb,
.matrix-table-container::-webkit-scrollbar-thumb {
  background: var(--secondary, #559fac);
  border-radius: 6px;
  border: 2px solid #f1f5f9;
}

.data-table-container::-webkit-scrollbar-thumb:hover,
.matrix-table-container::-webkit-scrollbar-thumb:hover {
  background: var(--primary, #3c605c);
}

.data-table {
  width: 100%;
  min-width: 780px;
  border-collapse: collapse;
  text-align: left;
}

.data-table th {
  background: #f8fafc;
  padding: 14px 18px;
  font-size: 0.8rem;
  font-weight: 700;
  text-transform: uppercase;
  color: var(--text-secondary);
  border-bottom: 1px solid var(--border-color);
  letter-spacing: 0.03em;
}

.data-table td {
  padding: 14px 18px;
  font-size: 0.92rem;
  border-bottom: 1px solid #f1f5f9;
  color: var(--text-primary);
  vertical-align: middle;
}

.data-table tr:last-child td {
  border-bottom: none;
}

.data-table tr:hover td {
  background: #f8fafc;
}

/* ==================== BADGES ==================== */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 4px 10px;
  border-radius: 50px;
  font-size: 0.75rem;
  font-weight: 700;
}

.badge-in {
  background: rgba(16, 185, 129, 0.12);
  color: #059669;
  border: 1px solid rgba(16, 185, 129, 0.25);
}

.badge-out {
  background: rgba(239, 68, 68, 0.12);
  color: #dc2626;
  border: 1px solid rgba(239, 68, 68, 0.25);
}

.profile-avatar {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  object-fit: cover;
  border: 2px solid var(--border-color);
}

.photo-preview-thumbnail {
  width: 48px;
  height: 48px;
  border-radius: var(--border-radius-sm);
  object-fit: cover;
  cursor: pointer;
  border: 1.5px solid var(--border-color);
  filter: blur(4px);
  transition: var(--transition-smooth);
}

.photo-preview-thumbnail:hover {
  transform: scale(1.08);
  border-color: var(--secondary);
  filter: blur(0);
}

/* Form Controls */
.form-group {
  margin-bottom: 20px;
  text-align: left;
}

.form-group label {
  display: block;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: 6px;
}

.form-control {
  width: 100%;
  padding: 10px 14px;
  background: #ffffff;
  border: 1px solid #cbd5e1;
  border-radius: var(--border-radius-sm);
  color: var(--text-primary);
  font-family: var(--font-sans);
  font-size: 0.92rem;
  transition: var(--transition-smooth);
}

.form-control:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(60, 96, 92, 0.15);
  background: #ffffff;
}

/* Employee photo capture flow */
.capture-box {
  width: 100%;
  height: 240px;
  border-radius: var(--border-radius-md);
  background: #f8fafc;
  border: 2px dashed #cbd5e1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  position: relative;
  margin-bottom: 15px;
}

.capture-box video, .capture-box canvas, .capture-box img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.capture-box video {
  transform: scaleX(-1);
}

.capture-instructions {
  color: var(--text-secondary);
  font-size: 0.9rem;
  text-align: center;
  padding: 20px;
}

.capture-controls {
  display: flex;
  gap: 10px;
  justify-content: center;
}

/* Filters bar */
.filters-bar {
  display: flex;
  gap: 15px;
  flex-wrap: wrap;
  margin-bottom: 25px;
}

.filters-bar .form-group {
  margin-bottom: 0;
  flex: 1;
  min-width: 150px;
}

/* Lightbox photo viewer */
.lightbox {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(15, 23, 42, 0.85);
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s ease;
}

.lightbox.active {
  opacity: 1;
  pointer-events: auto;
}

.lightbox-img {
  max-width: 90%;
  max-height: 80%;
  border-radius: var(--border-radius-md);
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.4);
  transform: scale(0.95);
  transition: transform 0.3s ease;
}

.lightbox.active .lightbox-img {
  transform: scale(1);
}

/* Settings Layout - JoinVenta Style */
.settings-layout {
  display: flex;
  gap: 24px;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--border-radius-lg);
  padding: 24px;
  min-height: 60vh;
  box-shadow: 0 2px 8px rgba(15, 23, 42, 0.02);
  width: 100% !important;
  max-width: 100% !important;
  min-width: 0 !important;
  box-sizing: border-box !important;
}

.settings-sidebar {
  width: 210px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  border-right: 1px solid var(--border-color);
  padding-right: 16px;
  flex-shrink: 0;
  box-sizing: border-box !important;
}

.settings-nav-group-title {
  font-size: 0.72rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: #94a3b8;
  padding: 12px 8px 4px 8px;
  display: flex;
  align-items: center;
  gap: 6px;
}

.settings-tab-btn {
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  color: var(--text-secondary);
  padding: 9px 12px;
  border-radius: var(--border-radius-sm);
  cursor: pointer;
  font-size: 0.86rem;
  font-weight: 600;
  text-align: left;
  display: flex;
  align-items: center;
  gap: 10px;
  transition: all 0.2s ease;
  width: 100%;
  box-sizing: border-box;
}

.settings-tab-btn i {
  font-size: 0.92rem;
  width: 18px;
  text-align: center;
  flex-shrink: 0;
}

.settings-tab-btn:hover {
  color: var(--primary);
  background-color: #ffffff;
  border-color: #cbd5e1;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.06);
  transform: translateX(2px);
}

.settings-tab-btn.active {
  color: #ffffff !important;
  background-color: var(--primary) !important;
  border-color: var(--primary) !important;
  font-weight: 700;
  box-shadow: 0 2px 8px rgba(60, 96, 92, 0.28);
}

.settings-tab-btn.active i {
  color: #ffffff !important;
}

.settings-content {
  flex: 1 1 0% !important;
  min-width: 0 !important;
  max-width: 100% !important;
  width: 100% !important;
  padding: 4px 8px;
  box-sizing: border-box !important;
  overflow-x: hidden;
}

.settings-panel {
  display: none;
  flex-direction: column;
  gap: 20px;
  width: 100% !important;
  max-width: 100% !important;
  min-width: 0 !important;
  box-sizing: border-box !important;
}

.settings-panel.active {
  display: flex;
}

.settings-panel > div {
  width: 100% !important;
  max-width: 100% !important;
  min-width: 0 !important;
  box-sizing: border-box !important;
}

.settings-panel .glass {
  width: 100% !important;
  max-width: 100% !important;
  min-width: 0 !important;
  box-sizing: border-box !important;
}

.settings-panel h3 {
  font-family: var(--font-display);
  font-size: 1.35rem;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 5px;
}

.settings-section-divider {
  border: 1px solid var(--border-color);
  border-radius: var(--border-radius-md);
  padding: 18px;
  background-color: #f8fafc;
  margin-bottom: 20px;
}

.collapsible-settings-group {
  display: flex;
  flex-direction: column;
  gap: 16px;
  margin-top: 16px;
  padding-top: 16px;
  border-top: 1px solid var(--border-color);
}

.collapsible-settings-group.disabled-group {
  opacity: 0.35;
  pointer-events: none;
}

/* Switch toggle styles */
.switch {
  position: relative;
  display: inline-block;
  width: 44px;
  height: 24px;
}

.switch input { 
  opacity: 0;
  width: 0;
  height: 0;
}

.slider {
  position: absolute;
  cursor: pointer;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: #cbd5e1;
  border: 1px solid #cbd5e1;
  transition: .3s;
}

.slider:before {
  position: absolute;
  content: '';
  height: 16px;
  width: 16px;
  left: 3px;
  bottom: 3px;
  background-color: #ffffff;
  transition: .3s;
  box-shadow: 0 1px 3px rgba(0,0,0,0.2);
}

input:checked + .slider {
  background-color: var(--primary);
  border-color: var(--primary);
}

input:checked + .slider:before {
  transform: translateX(20px);
  background-color: #ffffff;
}

.slider.round {
  border-radius: 34px;
}

.slider.round:before {
  border-radius: 50%;
}

/* Kiosk Device Options Button & Branch Badge */
.device-options-btn {
  position: fixed;
  top: 18px;
  right: 20px;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  color: var(--text-secondary);
  padding: 8px 18px;
  border-radius: 999px;
  font-size: 0.88rem;
  font-weight: 600;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 8px;
  transition: all 0.25s ease;
  z-index: 50;
  box-shadow: 0 2px 10px rgba(15, 23, 42, 0.05);
}

.device-options-btn:hover {
  color: var(--primary);
  border-color: var(--primary);
  background: #ffffff;
  box-shadow: 0 4px 14px rgba(60, 96, 92, 0.15);
  transform: translateY(-1px);
}

.kiosk-branch-badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: rgba(85, 159, 172, 0.12);
  border: 1px solid rgba(85, 159, 172, 0.3);
  color: var(--primary);
  padding: 6px 14px;
  border-radius: 20px;
  font-size: 0.85rem;
  font-weight: 700;
  margin-top: 10px;
  margin-bottom: 5px;
}

/* Description Text */
.description-text {
  color: var(--text-secondary);
  font-size: 0.9rem;
  line-height: 1.5;
}

/* ==================== MOBILE RESPONSIVE ENHANCEMENTS (< 768px) ==================== */
@media (max-width: 768px) {
  /* Modals and Overlays */
  .overlay {
    padding: 8px !important;
    align-items: flex-start !important;
    overflow-y: auto !important;
    -webkit-overflow-scrolling: touch !important;
  }

  .modal-content {
    width: 100% !important;
    max-width: 100% !important;
    margin: 8px auto !important;
    padding: 16px 14px !important;
    max-height: 94vh !important;
    overflow-y: auto !important;
    box-sizing: border-box !important;
    border-radius: 12px !important;
  }

  /* Force all multi-column modal grids to single column on mobile */
  .modal-two-col-grid,
  .modal-content [style*="grid-template-columns"],
  .modal-content div[style*="display: grid"],
  [style*="grid-template-columns: 1fr 1fr"],
  [style*="grid-template-columns: 1.1fr 1fr"],
  [style*="grid-template-columns: 1fr 1.5fr"],
  [style*="grid-template-columns: 1fr 1fr 1.2fr"],
  [style*="grid-template-columns: 1fr 1fr 1fr"],
  [style*="grid-template-columns: 1fr 2fr"],
  [style*="grid-template-columns: 1fr 1fr 0.5fr 0.5fr"] {
    grid-template-columns: 1fr !important;
    gap: 12px !important;
  }

  /* Face capture container and webcam responsiveness */
  .capture-box {
    width: 100% !important;
    max-width: 100% !important;
    height: 200px !important;
    box-sizing: border-box !important;
  }

  .capture-box video,
  .capture-box canvas,
  .capture-box img {
    max-width: 100% !important;
    height: 100% !important;
    object-fit: contain !important;
  }

  .capture-controls {
    display: flex !important;
    flex-wrap: wrap !important;
    gap: 8px !important;
  }

  .capture-controls .btn {
    flex: 1 1 calc(50% - 8px) !important;
    font-size: 0.85rem !important;
    padding: 8px 10px !important;
    justify-content: center !important;
  }

  /* Form inputs fit mobile screen */
  .form-group {
    margin-bottom: 12px !important;
    width: 100% !important;
    box-sizing: border-box !important;
  }

  .form-control,
  input[type="text"],
  input[type="password"],
  input[type="date"],
  input[type="time"],
  input[type="number"],
  select,
  textarea {
    width: 100% !important;
    max-width: 100% !important;
    box-sizing: border-box !important;
    font-size: 16px !important; /* Prevents auto-zoom on mobile */
  }

  /* Modal action buttons stacked */
  .modal-content form > div[style*="justify-content: flex-end"],
  .modal-content > div[style*="justify-content: flex-end"] {
    flex-direction: column-reverse !important;
    gap: 10px !important;
    padding-top: 15px !important;
    margin-top: 15px !important;
  }

  .modal-content form > div[style*="justify-content: flex-end"] .btn,
  .modal-content > div[style*="justify-content: flex-end"] .btn {
    width: 100% !important;
    justify-content: center !important;
  }

  /* Tables inside modal and dashboard scroll smoothly horizontally */
  .data-table-container,
  .table-responsive {
    width: 100% !important;
    overflow-x: auto !important;
    -webkit-overflow-scrolling: touch !important;
  }

  /* Compact camera scanner on mobile */
  .scanner-wrapper {
    width: 175px !important;
    height: 175px !important;
    margin-bottom: 14px !important;
  }

  .digital-clock {
    font-size: 3.2rem !important;
    margin-bottom: 4px !important;
  }

  .digital-date {
    font-size: 0.95rem !important;
    margin-bottom: 18px !important;
  }

  .clock-panel {
    padding: 20px 10px !important;
  }

  .pin-panel {
    padding: 24px 14px !important;
  }
}

/* Sortable table headers */
th.sortable-th {
  cursor: pointer;
  user-select: none;
  white-space: nowrap;
  transition: background-color 0.15s ease;
}

th.sortable-th:hover {
  background-color: var(--primary-bg, #f0f4ff);
}

.sort-icon {
  display: inline-block;
  margin-left: 4px;
  font-size: 0.75rem;
  opacity: 0.35;
  transition: opacity 0.15s ease, transform 0.15s ease;
}

th.sortable-th:hover .sort-icon {
  opacity: 0.8;
}

th.sortable-th.active-sort .sort-icon {
  opacity: 1;
  color: var(--primary, #4f46e5);
  font-weight: bold;
}

/* Daily Matrix Report styles */
.matrix-day-cell {
  text-align: center;
  padding: 6px 8px !important;
  font-size: 0.82rem;
  line-height: 1.25;
}

.matrix-day-hours {
  font-weight: 600;
  color: var(--text-primary);
}

.matrix-day-ot {
  font-size: 0.72rem;
  color: #d97706;
  font-weight: 500;
}

.matrix-day-zero {
  color: var(--text-muted, #94a3b8);
  font-size: 0.75rem;
}

.matrix-day-punches {
  font-size: 0.72rem;
  margin-top: 4px;
  line-height: 1.25;
  font-family: var(--font-mono, monospace);
  background: rgba(15, 23, 42, 0.04);
  border-radius: 4px;
  padding: 2px 4px;
  border: 1px solid rgba(15, 23, 42, 0.06);
}

.matrix-day-rest {
  background-color: rgba(148, 163, 184, 0.08);
}

/* ==================== WIDE DATA TABLES & MATRIX HORIZONTAL SCROLL ==================== */
.matrix-table-container {
  width: 100%;
  max-width: 100%;
  overflow-x: auto !important;
  overflow-y: auto !important;
  -webkit-overflow-scrolling: touch !important;
  border-radius: var(--border-radius-md);
  border: 1px solid var(--border-color);
  background: var(--bg-card);
  position: relative;
  box-shadow: 0 2px 8px rgba(15, 23, 42, 0.02);
}

#matrix-table,
.matrix-table {
  min-width: 1550px !important;
  width: 100%;
  border-collapse: collapse;
}

/* Freeze first column (Trabajador) on horizontal scroll */
.matrix-table-container th:first-child,
.matrix-table-container td:first-child {
  position: sticky !important;
  left: 0 !important;
  background: #ffffff !important;
  z-index: 5 !important;
  box-shadow: 3px 0 8px rgba(15, 23, 42, 0.08) !important;
  min-width: 220px !important;
  max-width: 280px !important;
}

.matrix-table-container th:first-child {
  background: #f8fafc !important;
  z-index: 6 !important;
}

.matrix-table-container tfoot td:first-child {
  background: #f8fafc !important;
  z-index: 5 !important;
}

/* Sticky header row for matrix report when scrolling vertically */
.matrix-table-container thead th {
  position: sticky;
  top: 0;
  z-index: 4;
  background: #f8fafc;
}

/* Specific minimum widths for tables to prevent cell collapse on any resolution */
#employees-table {
  min-width: 1050px !important;
}

#attendance-table {
  min-width: 980px !important;
}

#hours-table {
  min-width: 900px !important;
}

#sucursales-table {
  min-width: 980px !important;
}

#kiosks-table {
  min-width: 880px !important;
}

#zkteco-devices-table,
#zkteco-log-table {
  min-width: 720px !important;
}

/* Sticky Actions Column on horizontal scroll */
#employees-table th:last-child,
#employees-table td:last-child,
#attendance-table th:last-child,
#attendance-table td:last-child,
#sucursales-table th:last-child,
#sucursales-table td:last-child,
#kiosks-table th:last-child,
#kiosks-table td:last-child,
#zkteco-devices-table th:last-child,
#zkteco-devices-table td:last-child,
#zkteco-log-table th:last-child,
#zkteco-log-table td:last-child,
.table-sticky-actions th:last-child,
.table-sticky-actions td:last-child {
  position: sticky !important;
  right: 0 !important;
  background-color: #ffffff !important;
  z-index: 2;
  box-shadow: -4px 0 10px rgba(15, 23, 42, 0.08);
}

#employees-table th:last-child,
#attendance-table th:last-child,
#sucursales-table th:last-child,
#kiosks-table th:last-child,
#zkteco-devices-table th:last-child,
#zkteco-log-table th:last-child,
.table-sticky-actions th:last-child {
  background-color: #f8fafc !important;
  z-index: 3;
}

#employees-table tr:hover td:last-child,
#attendance-table tr:hover td:last-child,
#sucursales-table tr:hover td:last-child,
#kiosks-table tr:hover td:last-child,
#zkteco-devices-table tr:hover td:last-child,
#zkteco-log-table tr:hover td:last-child,
.table-sticky-actions tr:hover td:last-child {
  background-color: #f1f5f9 !important;
}

/* Visual scroll indicator shadow for matrix */
.matrix-table-container::after {
  content: '';
  position: absolute;
  top: 0;
  right: 0;
  bottom: 0;
  width: 24px;
  background: linear-gradient(to right, rgba(255, 255, 255, 0), rgba(15, 23, 42, 0.08));
  pointer-events: none;
  opacity: 0.8;
}

/* ==================== RESPONSIVE DESIGN FOR DIFFERENT RESOLUTIONS ==================== */

/* 0. Standard Laptops (<= 1400px e.g. 1360x768, 1366x768) */
@media (max-width: 1400px) {
  .main-content {
    padding: 20px 22px !important;
  }

  .settings-layout {
    gap: 16px !important;
    padding: 18px 16px !important;
  }

  .settings-sidebar {
    width: 185px !important;
    padding-right: 12px !important;
  }

  .settings-panel .glass {
    padding: 20px 16px !important;
  }

  /* Compact header buttons in settings sub-cards */
  .settings-panel .glass .section-header,
  .settings-panel .glass > div:first-child {
    gap: 12px !important;
  }
}

/* 1. Laptops & Medium Screens (<= 1280px) */
@media (max-width: 1280px) {
  .main-content {
    padding: 24px 28px;
  }

  .dashboard-stats {
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 16px;
  }

  .filters-bar {
    gap: 12px;
  }

  .filters-bar .form-group {
    min-width: 140px;
  }
}

/* 2. Compact Laptops & Tablets Landscape (<= 1024px) */
@media (max-width: 1024px) {
  .main-content {
    padding: 20px 18px;
  }

  .section-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 14px;
  }

  .section-header > div {
    width: 100%;
  }

  .filters-bar {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
  }

  .filters-bar .form-group {
    flex: 1 1 calc(50% - 10px);
    min-width: 140px;
  }
}

/* 3. Tablets Portrait & Mobile (< 992px) */
@media (max-width: 992px) {
  /* Settings Tab Responsive: Horizontal Pill Strip + Full Width Content */
  .settings-layout {
    flex-direction: column !important;
    gap: 20px !important;
    padding: 20px 14px !important;
  }

  .settings-sidebar {
    width: 100% !important;
    flex-direction: row !important;
    flex-wrap: wrap !important;
    overflow-x: visible !important;
    white-space: normal !important;
    border-right: none !important;
    border-bottom: 1px solid var(--border-color) !important;
    padding-right: 0 !important;
    padding-bottom: 14px !important;
    gap: 6px !important;
  }

  .settings-nav-group-title {
    width: 100% !important;
    margin-top: 8px !important;
    padding: 6px 2px 2px 2px !important;
    border-top: 1px dashed #e2e8f0;
  }
  .settings-nav-group-title:first-child {
    border-top: none;
    margin-top: 0 !important;
  }

  .settings-tab-btn {
    width: auto !important;
    flex: 0 1 auto !important;
    padding: 7px 12px !important;
    font-size: 0.82rem !important;
    border-radius: 8px !important;
    box-sizing: border-box !important;
  }

  .settings-tab-btn.active {
    background-color: var(--primary) !important;
    border-color: var(--primary) !important;
    color: #ffffff !important;
  }

  .settings-content {
    padding: 0 !important;
    width: 100% !important;
    max-width: 100% !important;
    overflow-x: auto !important;
  }

  /* History Sub-Tabs Responsive */
  #history-section > div[style*="border-bottom"] {
    overflow-x: auto !important;
    flex-wrap: nowrap !important;
    white-space: nowrap !important;
    -webkit-overflow-scrolling: touch !important;
    padding-bottom: 8px !important;
  }

  #history-section > div[style*="border-bottom"] .tab-btn {
    flex-shrink: 0 !important;
  }
}

/* 4. Mobile Devices (<= 768px) */
@media (max-width: 768px) {
  .section-header h2 {
    font-size: 1.35rem !important;
  }

  .filters-bar .form-group {
    flex: 1 1 100% !important;
    min-width: 100% !important;
  }

  .dashboard-stats {
    grid-template-columns: 1fr 1fr;
    gap: 12px;
  }

  .stat-card {
    padding: 16px 14px;
  }

  .stat-value {
    font-size: 2rem;
  }

  /* Buttons in action bar */
  .section-header .btn {
    padding: 8px 12px;
    font-size: 0.84rem;
  }

  /* Universal modal styling for mobile */
  .overlay {
    padding: 10px !important;
    align-items: flex-start !important;
  }

  .modal-content {
    width: 96% !important;
    max-width: 96% !important;
    margin: 8px auto !important;
    padding: 20px 14px !important;
    max-height: 92vh !important;
    border-radius: 12px !important;
  }
}

/* 5. Extra Small Screens (<= 480px) */
@media (max-width: 480px) {
  .dashboard-stats {
    grid-template-columns: 1fr;
  }

  .logo-text {
    font-size: 1.15rem;
  }

  .sidebar .tab-btn {
    padding: 6px 10px;
    font-size: 0.82rem;
  }

  .btn {
    font-size: 0.82rem;
    padding: 8px 12px;
  }
}

