/* ==========================================================================
   RIALTA // FUTURISTIC CYBER-INDUSTRIAL DESIGN SYSTEM
   Fichajes, Control Horario & Bóveda Oculta de Horas
   Soporte completo: Modo Oscuro (Dark Titanium) & Modo Claro (Platinum Luxury)
   ========================================================================== */

@import url('https://fonts.googleapis.com/css2?family=Outfit:wght@300;400;500;600;700;800;900&family=JetBrains+Mono:wght@400;600;700&display=swap');

:root {
  /* Modo Oscuro (Default) */
  --bg-main: #06090e;
  --bg-surface: #0b1118;
  --bg-card: rgba(16, 24, 36, 0.75);
  --bg-card-hover: rgba(22, 33, 49, 0.85);
  --bg-glass: rgba(11, 17, 24, 0.8);
  
  --border-subtle: rgba(255, 255, 255, 0.08);
  --border-glow: rgba(0, 243, 255, 0.35);
  --border-active: #00f3ff;
  
  --text-primary: #f1f5f9;
  --text-secondary: #94a3b8;
  --text-muted: #64748b;
  
  --neon-cyan: #00f3ff;
  --neon-cyan-glow: 0 0 20px rgba(0, 243, 255, 0.45);
  --neon-emerald: #10b981;
  --neon-emerald-glow: 0 0 20px rgba(16, 185, 129, 0.45);
  --neon-amber: #f59e0b;
  --neon-amber-glow: 0 0 20px rgba(245, 158, 11, 0.45);
  --neon-rose: #f43f5e;
  --neon-rose-glow: 0 0 20px rgba(244, 63, 94, 0.45);
  --neon-purple: #a855f7;
  
  --hud-radar: radial-gradient(circle, rgba(0, 243, 255, 0.15) 0%, rgba(0, 0, 0, 0) 70%);
  --shadow-hud: 0 10px 40px -10px rgba(0, 0, 0, 0.6), 0 0 0 1px rgba(255, 255, 255, 0.05);
  --radius-sm: 8px;
  --radius-md: 14px;
  --radius-lg: 20px;
  --radius-full: 9999px;
  
  --font-sans: 'Outfit', -apple-system, BlinkMacSystemFont, sans-serif;
  --font-mono: 'JetBrains Mono', monospace;
}

[data-theme="light"] {
  --bg-main: #cbd5e1; /* Gris acero mate equilibrado */
  --bg-surface: #e2e8f0;
  --bg-card: rgba(226, 232, 240, 0.92);
  --bg-card-hover: rgba(241, 245, 249, 0.95);
  --bg-glass: rgba(226, 232, 240, 0.92);
  
  --border-subtle: rgba(51, 65, 85, 0.18);
  --border-glow: rgba(2, 132, 199, 0.45);
  --border-active: #0284c7;
  
  --text-primary: #0f172a;
  --text-secondary: #334155;
  --text-muted: #64748b;
  
  --neon-cyan: #0284c7;
  --neon-cyan-glow: 0 0 15px rgba(2, 132, 199, 0.35);
  --neon-emerald: #059669;
  --neon-emerald-glow: 0 0 15px rgba(5, 150, 105, 0.35);
  --neon-amber: #d97706;
  --neon-amber-glow: 0 0 15px rgba(217, 119, 6, 0.35);
  --neon-rose: #e11d48;
  --neon-rose-glow: 0 0 15px rgba(225, 29, 72, 0.35);
  --neon-purple: #7c3aed;
  
  --hud-radar: radial-gradient(circle, rgba(2, 132, 199, 0.12) 0%, rgba(203, 213, 225, 0) 70%);
  --shadow-hud: 0 10px 30px -5px rgba(15, 23, 42, 0.12), 0 0 0 1px rgba(15, 23, 42, 0.08);
}

/* Base Reset & Grid */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
}

body {
  font-family: var(--font-sans);
  background-color: var(--bg-main);
  color: var(--text-primary);
  min-height: 100vh;
  width: 100%;
  max-width: 100vw;
  display: flex;
  flex-direction: column;
  transition: background-color 0.3s ease, color 0.3s ease;
  overflow-x: hidden;
  touch-action: manipulation;
  -webkit-text-size-adjust: 100%;
  background-image: 
    radial-gradient(circle at 10% 20%, rgba(0, 243, 255, 0.04) 0%, transparent 40%),
    radial-gradient(circle at 90% 80%, rgba(16, 185, 129, 0.04) 0%, transparent 40%);
}

/* Header & Navbar */
.app-header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: var(--bg-glass);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-bottom: 1px solid var(--border-subtle);
  padding: 0.65rem 1.25rem;
  padding-top: max(0.65rem, env(safe-area-inset-top));
  display: flex;
  align-items: center;
  justify-content: space-between;
  box-shadow: 0 4px 20px rgba(0,0,0,0.1);
  width: 100%;
  max-width: 100vw;
  box-sizing: border-box;
}

.header-user-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  font-size: 0.82rem;
  color: var(--text-secondary);
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-full);
  padding: 0.3rem 0.65rem;
  max-width: 170px;
}

.header-user-badge .user-avatar-tiny {
  font-size: 0.8rem;
}

.header-user-badge .user-name-text {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--text-primary);
  font-size: 0.8rem;
}

.brand-wrapper {
  display: flex;
  align-items: center;
  gap: 0.9rem;
  cursor: pointer;
  user-select: none;
}

.brand-logo-hex {
  width: 44px;
  height: 44px;
  background: linear-gradient(135deg, var(--neon-cyan), var(--neon-emerald));
  clip-path: polygon(50% 0%, 100% 25%, 100% 75%, 50% 100%, 0% 75%, 0% 25%);
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: var(--neon-cyan-glow);
  position: relative;
  transition: transform 0.2s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.brand-wrapper:active .brand-logo-hex {
  transform: scale(0.92);
}

.brand-logo-hex span {
  font-family: var(--font-mono);
  font-weight: 900;
  font-size: 1.15rem;
  color: #06090e;
}

.brand-info h1 {
  font-size: 1.1rem;
  font-weight: 800;
  letter-spacing: -0.02em;
  background: linear-gradient(90deg, var(--text-primary), var(--neon-cyan));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.brand-info .tagline {
  font-size: 0.72rem;
  color: var(--text-secondary);
  font-weight: 500;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

/* Botones Futuristas */
.btn-icon-hud {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  color: var(--text-primary);
  width: 42px;
  height: 42px;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.25s ease;
  font-size: 1.1rem;
}

.btn-icon-hud:hover {
  border-color: var(--border-glow);
  box-shadow: var(--neon-cyan-glow);
  transform: translateY(-2px);
}

/* Layout Principal */
.app-container {
  max-width: 1200px;
  width: 100%;
  margin: 0 auto;
  padding: 1.75rem 1.25rem;
  display: grid;
  grid-template-columns: 1fr 380px;
  gap: 1.75rem;
  flex: 1;
}

@media (max-width: 960px) {
  .app-container {
    grid-template-columns: 1fr;
    padding: 1rem 0.75rem;
  }
}

/* HUD Banner & Reloj */
.hud-clock-card {
  background: var(--bg-card);
  backdrop-filter: blur(12px);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 1.5rem 1.75rem;
  box-shadow: var(--shadow-hud);
  margin-bottom: 1.5rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: relative;
  overflow: hidden;
}

.hud-clock-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 2px;
  background: linear-gradient(90deg, transparent, var(--neon-cyan), transparent);
}

.clock-display {
  display: flex;
  flex-direction: column;
}

.clock-time {
  font-family: var(--font-mono);
  font-size: 2.75rem;
  font-weight: 700;
  letter-spacing: -0.04em;
  color: var(--text-primary);
  line-height: 1.1;
  text-shadow: 0 0 25px rgba(0, 243, 255, 0.2);
}

.clock-date {
  font-size: 0.9rem;
  color: var(--text-secondary);
  font-weight: 500;
  margin-top: 0.35rem;
}

.hud-gps-radar-pill {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  background: rgba(0, 0, 0, 0.25);
  border: 1px solid var(--border-subtle);
  padding: 0.55rem 1rem;
  border-radius: var(--radius-full);
}

.radar-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background-color: var(--neon-emerald);
  box-shadow: var(--neon-emerald-glow);
  position: relative;
}

.radar-dot::after {
  content: '';
  position: absolute;
  inset: -4px;
  border-radius: 50%;
  border: 1px solid var(--neon-emerald);
  animation: pulse-radar 2s infinite ease-out;
}

@keyframes pulse-radar {
  0% { transform: scale(1); opacity: 1; }
  100% { transform: scale(2.8); opacity: 0; }
}

.radar-info {
  display: flex;
  flex-direction: column;
}

.radar-title {
  font-size: 0.72rem;
  text-transform: uppercase;
  font-weight: 700;
  letter-spacing: 0.05em;
  color: var(--neon-emerald);
}

.radar-desc {
  font-family: var(--font-mono);
  font-size: 0.8rem;
  color: var(--text-primary);
  font-weight: 600;
}

/* Selector de Métodos (NFC / PIN / QR) */
.method-tabs-hud {
  display: flex;
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 0.35rem;
  gap: 0.35rem;
  margin-bottom: 1.5rem;
}

.tab-btn {
  flex: 1;
  background: transparent;
  border: none;
  color: var(--text-secondary);
  font-family: var(--font-sans);
  font-weight: 600;
  font-size: 0.95rem;
  padding: 0.8rem 1rem;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  cursor: pointer;
  transition: all 0.2s ease;
}

.tab-btn:hover:not(.active) {
  color: var(--text-primary);
  background: rgba(255, 255, 255, 0.03);
}

.tab-btn.active {
  background: var(--bg-card-hover);
  color: var(--neon-cyan);
  border: 1px solid var(--border-glow);
  box-shadow: var(--neon-cyan-glow);
}

.tab-badge {
  font-size: 0.68rem;
  padding: 0.15rem 0.45rem;
  border-radius: var(--radius-full);
  background: rgba(0, 243, 255, 0.15);
  color: var(--neon-cyan);
  font-family: var(--font-mono);
}

/* Área de Fichaje Dinámica */
.fichaje-panel {
  background: var(--bg-card);
  backdrop-filter: blur(14px);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 2rem;
  box-shadow: var(--shadow-hud);
  position: relative;
  min-height: 480px;
  display: flex;
  flex-direction: column;
}

.hidden {
  display: none !important;
}

.method-view-section {
  display: flex;
  flex-direction: column;
  animation: fadeInMethod 0.2s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

.method-view-section.hidden {
  display: none !important;
}

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

.section-tag {
  font-family: var(--font-sans);
  font-size: 0.76rem;
  font-weight: 600;
  color: var(--neon-cyan);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.25rem 0.75rem;
  background: rgba(0, 243, 255, 0.08);
  border: 1px solid rgba(0, 243, 255, 0.2);
  border-radius: var(--radius-full);
  margin-bottom: 0.65rem;
  width: fit-content;
}

[data-theme="light"] .section-tag {
  color: #0284c7;
  background: rgba(2, 132, 199, 0.1);
  border-color: rgba(2, 132, 199, 0.25);
}

.panel-title {
  font-size: 1.5rem;
  font-weight: 800;
  letter-spacing: -0.02em;
  margin-bottom: 0.5rem;
}

.panel-subtitle {
  color: var(--text-secondary);
  font-size: 0.9rem;
  margin-bottom: 1.75rem;
}

/* --- TECLADO PIN FUTURISTA --- */
.pin-terminal-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  max-width: 340px;
  margin: 0 auto;
  width: 100%;
}

.pin-display-screen {
  width: 100%;
  background: rgba(0, 0, 0, 0.35);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 1.1rem;
  display: flex;
  justify-content: center;
  gap: 0.85rem;
  margin-bottom: 1.5rem;
  box-shadow: inset 0 2px 8px rgba(0,0,0,0.5);
}

.pin-bullet {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  border: 2px solid var(--border-subtle);
  background: transparent;
  transition: all 0.2s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.pin-bullet.filled {
  border-color: var(--neon-cyan);
  background-color: var(--neon-cyan);
  box-shadow: var(--neon-cyan-glow);
  transform: scale(1.15);
}

.numpad-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.75rem;
  width: 100%;
}

.num-key {
  height: 64px;
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  color: var(--text-primary);
  font-family: var(--font-mono);
  font-size: 1.4rem;
  font-weight: 700;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.15s ease;
  user-select: none;
}

.num-key:hover {
  background: var(--bg-card-hover);
  border-color: var(--border-glow);
  transform: translateY(-2px);
}

.num-key:active {
  transform: scale(0.95);
  background: var(--neon-cyan);
  color: #06090e;
  border-color: var(--neon-cyan);
  box-shadow: var(--neon-cyan-glow);
}

.num-key.action-clear {
  color: var(--neon-rose);
  font-size: 1rem;
}

.num-key.action-enter {
  color: var(--neon-emerald);
  font-size: 1rem;
}

/* --- NFC CONTACTLESS VIEW --- */
.nfc-scan-area {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 2.5rem 1rem;
  text-align: center;
  flex: 1;
}

.nfc-target-orb {
  width: 170px;
  height: 170px;
  border-radius: 50%;
  border: 2px dashed var(--neon-cyan);
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 2rem;
  position: relative;
  background: radial-gradient(circle, rgba(0, 243, 255, 0.08) 0%, transparent 70%);
  animation: orb-spin 14s linear infinite;
}

@keyframes orb-spin {
  100% { transform: rotate(360deg); }
}

.nfc-target-orb svg {
  width: 72px;
  height: 72px;
  color: var(--neon-cyan);
  filter: drop-shadow(0 0 12px var(--neon-cyan));
  animation: orb-counter-spin 14s linear infinite;
}

@keyframes orb-counter-spin {
  100% { transform: rotate(-360deg); }
}

.nfc-btn-trigger {
  background: linear-gradient(135deg, var(--neon-cyan), #0284c7);
  color: #06090e;
  font-family: var(--font-sans);
  font-weight: 800;
  font-size: 1.05rem;
  padding: 1rem 2rem;
  border-radius: var(--radius-md);
  border: none;
  cursor: pointer;
  box-shadow: var(--neon-cyan-glow);
  transition: all 0.25s ease;
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.nfc-btn-trigger:hover {
  transform: translateY(-2px);
  filter: brightness(1.15);
}

/* Emulador de Tarjetas de Operario */
.nfc-emulator-shelf {
  margin-top: 2rem;
  width: 100%;
  border-top: 1px solid var(--border-subtle);
  padding-top: 1.25rem;
}

.nfc-cards-list {
  display: flex;
  gap: 0.65rem;
  overflow-x: auto;
  padding-bottom: 0.5rem;
}

.nfc-card-badge {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  padding: 0.65rem 0.9rem;
  cursor: pointer;
  white-space: nowrap;
  font-size: 0.8rem;
  transition: all 0.2s ease;
  display: flex;
  flex-direction: column;
}

.nfc-card-badge:hover {
  border-color: var(--neon-cyan);
  transform: translateY(-2px);
}

/* --- QR SCANNER VIEW --- */
.qr-scanner-hud {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  flex: 1;
}

.qr-viewfinder {
  width: 280px;
  height: 280px;
  border: 2px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  position: relative;
  background: #000;
  overflow: hidden;
  margin-bottom: 1.5rem;
  box-shadow: var(--shadow-hud);
}

.qr-laser-line {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: var(--neon-rose);
  box-shadow: var(--neon-rose-glow);
  animation: laser-sweep 2.5s ease-in-out infinite alternate;
}

@keyframes laser-sweep {
  0% { top: 5%; }
  100% { top: 95%; }
}

.qr-corner {
  position: absolute;
  width: 24px;
  height: 24px;
  border-color: var(--neon-cyan);
  border-style: solid;
}
.qr-corner.tl { top: 12px; left: 12px; border-width: 3px 0 0 3px; }
.qr-corner.tr { top: 12px; right: 12px; border-width: 3px 3px 0 0; }
.qr-corner.bl { bottom: 12px; left: 12px; border-width: 0 0 3px 3px; }
.qr-corner.br { bottom: 12px; right: 12px; border-width: 0 3px 3px 0; }

/* Barra Lateral: Historial Oficial & Verificación Antifraude */
.sidebar-history {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

.history-card {
  background: var(--bg-card);
  backdrop-filter: blur(12px);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 1.5rem;
  box-shadow: var(--shadow-hud);
  flex: 1;
  display: flex;
  flex-direction: column;
}

.history-list {
  list-style: none;
  overflow-y: auto;
  max-height: 480px;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  margin-top: 1rem;
}

.history-item {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 0.85rem 1rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  transition: all 0.2s ease;
}

.history-item:hover {
  border-color: var(--border-glow);
}

.history-item-left {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
}

.emp-name {
  font-weight: 700;
  font-size: 0.95rem;
}

.fichaje-meta {
  font-size: 0.75rem;
  color: var(--text-muted);
  display: flex;
  gap: 0.5rem;
  align-items: center;
}

.badge-tipo {
  padding: 0.25rem 0.65rem;
  border-radius: var(--radius-full);
  font-size: 0.75rem;
  font-weight: 700;
  font-family: var(--font-mono);
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
}

.badge-tipo.entrada {
  background: rgba(16, 185, 129, 0.15);
  color: var(--neon-emerald);
  border: 1px solid rgba(16, 185, 129, 0.3);
}

.badge-tipo.salida {
  background: rgba(244, 63, 94, 0.15);
  color: var(--neon-rose);
  border: 1px solid rgba(244, 63, 94, 0.3);
}

/* Modal Genérico / Bóveda / Ajustes */
.modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 999;
  background: rgba(4, 7, 12, 0.85);
  backdrop-filter: blur(20px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.25rem;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

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

.modal-glass-window {
  background: var(--bg-surface);
  border: 1px solid var(--border-glow);
  box-shadow: 0 25px 60px -15px rgba(0, 0, 0, 0.7), var(--neon-cyan-glow);
  border-radius: var(--radius-lg);
  max-width: 900px;
  width: 100%;
  max-height: 90vh;
  overflow-y: auto;
  padding: 2rem;
  position: relative;
  transform: scale(0.95) translateY(10px);
  transition: transform 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

.modal-overlay.active .modal-glass-window {
  transform: scale(1) translateY(0);
}

.modal-close-btn {
  position: absolute;
  top: 1.5rem;
  right: 1.5rem;
  background: transparent;
  border: none;
  color: var(--text-muted);
  font-size: 1.5rem;
  cursor: pointer;
  line-height: 1;
  transition: color 0.2s ease;
}

.modal-close-btn:hover {
  color: var(--neon-rose);
}

/* KPIs de la Bóveda */
.kpi-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 1rem;
  margin: 1.5rem 0;
}

.kpi-card {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 1.25rem;
  position: relative;
  overflow: hidden;
}

.kpi-card::before {
  content: '';
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 3px;
  background: var(--neon-cyan);
}

.kpi-label {
  font-size: 0.75rem;
  color: var(--text-secondary);
  text-transform: uppercase;
  font-weight: 600;
  letter-spacing: 0.05em;
}

.kpi-val {
  font-family: var(--font-mono);
  font-size: 1.85rem;
  font-weight: 800;
  color: var(--text-primary);
  margin-top: 0.25rem;
}

.kpi-val.highlight-extra {
  color: var(--neon-amber);
  text-shadow: 0 0 15px rgba(245, 158, 11, 0.3);
}

/* Tabla Confidencial Bóveda */
.vault-modal-large {
  max-width: 96vw !important;
  width: 1500px !important;
  max-height: 94vh !important;
  padding: 2.25rem 2.5rem !important;
}

.vault-table-container {
  overflow-x: auto;
  max-height: 480px;
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  margin-top: 1.5rem;
  background: var(--bg-card);
}

.vault-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.88rem;
  margin-top: 0;
}

.vault-table th {
  text-align: left;
  padding: 0.85rem 1rem;
  border-bottom: 2px solid var(--border-subtle);
  color: var(--text-secondary);
  font-weight: 700;
  text-transform: uppercase;
  font-size: 0.72rem;
  letter-spacing: 0.05em;
}

.vault-table td {
  padding: 0.85rem 1rem;
  border-bottom: 1px solid var(--border-subtle);
}

.vault-table tr:hover td {
  background: rgba(255, 255, 255, 0.02);
}

/* Toast Notifications */
#toast-container {
  position: fixed;
  bottom: 2rem;
  right: 2rem;
  z-index: 10000;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  pointer-events: none;
}

.toast {
  pointer-events: auto;
  background: var(--bg-surface);
  border: 1px solid var(--border-glow);
  box-shadow: 0 10px 30px rgba(0,0,0,0.5), var(--neon-cyan-glow);
  color: var(--text-primary);
  padding: 1rem 1.4rem;
  border-radius: var(--radius-md);
  font-weight: 600;
  font-size: 0.92rem;
  display: flex;
  align-items: center;
  gap: 0.75rem;
  animation: slide-toast 0.3s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

.toast.error {
  border-color: var(--neon-rose);
  box-shadow: 0 10px 30px rgba(0,0,0,0.5), var(--neon-rose-glow);
}

@keyframes slide-toast {
  from { transform: translateY(20px); opacity: 0; }
  to { transform: translateY(0); opacity: 1; }
}

/* ==============================================================================
   NATIVE MOBILE & PWA RESPONSIVE ENHANCEMENTS (< 768px & < 500px)
   ============================================================================== */

@media (max-width: 768px) {
  .app-header {
    padding: 0.5rem 0.65rem;
    padding-top: max(0.5rem, env(safe-area-inset-top));
  }

  .brand-logo-hex {
    width: 36px;
    height: 36px;
  }

  .brand-logo-hex span {
    font-size: 0.95rem;
  }

  .brand-wrapper {
    gap: 0.45rem;
  }

  .brand-info h1 {
    font-size: 0.92rem;
    line-height: 1.1;
  }

  .brand-info .tagline {
    font-size: 0.62rem;
  }

  .header-actions {
    gap: 0.3rem;
  }

  .header-user-badge {
    max-width: 85px;
    padding: 0.25rem 0.45rem;
  }

  .header-user-badge .user-avatar-tiny {
    font-size: 0.72rem;
  }

  .header-user-badge .user-name-text {
    font-size: 0.72rem;
  }

  .header-btn-action {
    padding: 0.35rem 0.55rem !important;
    font-size: 0.75rem !important;
    gap: 0.2rem !important;
  }

  .header-btn-action .btn-label-responsive {
    display: none; /* Icon-only in mobile header to guarantee no overflow */
  }

  .btn-icon-hud {
    width: 34px;
    height: 34px;
    font-size: 0.95rem;
  }

  .app-container {
    padding: 0.75rem 0.5rem;
    width: 100%;
    max-width: 100vw;
    box-sizing: border-box;
    overflow-x: hidden;
  }

  .fichaje-panel {
    padding: 1.25rem 0.85rem;
    min-height: auto;
    border-radius: var(--radius-md);
  }

  .hud-clock-card {
    padding: 1rem 0.85rem;
    flex-direction: column;
    align-items: flex-start;
    gap: 0.65rem;
  }

  .clock-time {
    font-size: 2.15rem;
  }

  .clock-date {
    font-size: 0.82rem;
  }

  .hud-gps-radar-pill {
    width: 100%;
    box-sizing: border-box;
    justify-content: center;
    padding: 0.45rem 0.75rem;
  }

  .operator-profile-bar {
    padding: 0.85rem !important;
    flex-direction: column !important;
    align-items: flex-start !important;
    gap: 0.75rem !important;
  }

  .method-tabs-hud {
    gap: 0.25rem;
    padding: 0.25rem;
  }

  .method-tabs-hud .tab-btn {
    padding: 0.65rem 0.5rem;
    font-size: 0.8rem;
  }

  .pin-terminal-container {
    max-width: 100%;
    padding: 0.5rem 0;
  }

  .pin-keypad-grid {
    gap: 0.45rem;
  }

  .num-key {
    height: 56px;
    font-size: 1.35rem;
  }

  /* Bóveda Secreta Modal en Mobile */
  .modal-overlay {
    padding: 0.25rem;
  }

  .modal-glass-window {
    padding: 1.25rem 0.85rem !important;
    max-height: 96vh !important;
    border-radius: var(--radius-md) !important;
    width: 100% !important;
    max-width: 100% !important;
    box-sizing: border-box;
  }

  .vault-modal-large {
    max-width: 100% !important;
    width: 100% !important;
    padding: 1.25rem 0.75rem !important;
  }

  .kpi-grid {
    grid-template-columns: repeat(2, 1fr) !important;
    gap: 0.5rem !important;
  }

  .kpi-card {
    padding: 0.75rem 0.65rem !important;
  }

  .kpi-val {
    font-size: 1.35rem !important;
  }

  .vault-table-container {
    width: 100%;
    max-width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    border-radius: var(--radius-sm);
  }

  .vault-table {
    min-width: 580px;
  }

  .vault-table th, .vault-table td {
    padding: 0.65rem 0.65rem;
    font-size: 0.78rem;
  }

  #toast-container {
    bottom: 1rem;
    right: 1rem;
    left: 1rem;
  }

  .toast {
    padding: 0.75rem 1rem;
    font-size: 0.85rem;
  }
}

/* Barra de Pestañas de Gerencia con Ajuste Fluido y sin recortes */
.gerencia-tabs-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem;
  padding-bottom: 0.75rem;
  border-bottom: 1px solid var(--border-subtle);
  width: 100%;
  box-sizing: border-box;
}

.gerencia-tab-btn {
  flex: 0 0 auto;
  white-space: nowrap;
  padding: 0.55rem 0.85rem;
  font-size: 0.84rem;
  border-radius: var(--radius-sm);
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
}

.gerencia-tab-btn.active {
  background: var(--bg-card-hover);
  color: var(--neon-cyan);
  border: 1px solid var(--border-glow);
  box-shadow: var(--neon-cyan-glow);
}

@media (max-width: 768px) {
  .gerencia-actions-bar {
    display: grid !important;
    grid-template-columns: repeat(2, 1fr) !important;
    gap: 0.45rem !important;
    width: 100% !important;
  }

  .gerencia-actions-bar a {
    justify-content: center !important;
    padding: 0.6rem 0.45rem !important;
    font-size: 0.78rem !important;
    text-align: center !important;
  }
}

.login-card-responsive {
  padding: 2.75rem 2.25rem;
}

@media (max-width: 640px) {
  .login-card-responsive {
    padding: 1.5rem 1rem !important;
  }
}

/* ============================================================
   CENTRO DE ALERTAS Y NOTIFICACIONES DE GERENCIA (CAMPANA)
   ============================================================ */
.notifications-wrapper {
  position: relative;
  display: inline-flex;
}

.notif-bell-btn {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  color: var(--text-primary);
  border-radius: var(--radius-sm);
  padding: 0.45rem 0.85rem;
  font-weight: 700;
  font-size: 0.82rem;
  cursor: pointer;
  transition: all 0.2s ease;
}

.notif-bell-btn:hover {
  border-color: var(--neon-cyan);
  box-shadow: var(--neon-cyan-glow);
  transform: translateY(-1px);
}

.notif-bell-btn .bell-icon {
  font-size: 1.05rem;
  display: inline-block;
  transition: transform 0.3s ease;
}

.notif-bell-btn.has-critical .bell-icon {
  animation: bell-shake 1.8s infinite ease-in-out;
}

@keyframes bell-shake {
  0%, 100% { transform: rotate(0); }
  5%, 15% { transform: rotate(14deg); }
  10%, 20% { transform: rotate(-14deg); }
  25% { transform: rotate(0); }
}

.notif-badge {
  position: absolute;
  top: -5px;
  right: -5px;
  background: var(--neon-crimson, #ff0055);
  color: #ffffff;
  font-size: 0.68rem;
  font-weight: 800;
  font-family: var(--font-mono, monospace);
  border-radius: 9999px;
  min-width: 19px;
  height: 19px;
  line-height: 19px;
  text-align: center;
  padding: 0 4px;
  box-shadow: 0 0 10px rgba(255, 0, 85, 0.7);
  z-index: 10;
  border: 2px solid var(--bg-base, #06090e);
}

.notif-badge.hidden {
  display: none !important;
}

/* Popover Panel Flotante */
.notif-popover {
  position: absolute;
  top: calc(100% + 10px);
  right: 0;
  width: 390px;
  max-width: calc(100vw - 24px);
  background: rgba(14, 20, 32, 0.96);
  backdrop-filter: blur(24px);
  -webkit-backdrop-filter: blur(24px);
  border: 1px solid var(--border-glow, rgba(0, 243, 255, 0.25));
  border-radius: var(--radius-md, 12px);
  box-shadow: 0 16px 45px rgba(0, 0, 0, 0.65), 0 0 20px rgba(0, 243, 255, 0.1);
  z-index: 1000;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  animation: popover-in 0.22s cubic-bezier(0.16, 1, 0.3, 1);
}

.notif-popover.hidden {
  display: none !important;
}

@keyframes popover-in {
  from { opacity: 0; transform: translateY(-8px) scale(0.97); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

.notif-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.85rem 1rem;
  background: rgba(0, 0, 0, 0.35);
  border-bottom: 1px solid var(--border-subtle);
}

.notif-header-title {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.88rem;
  font-weight: 700;
  color: var(--text-primary);
  letter-spacing: -0.01em;
}

.notif-pulse-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--neon-cyan);
  box-shadow: var(--neon-cyan-glow);
  display: inline-block;
}

.notif-header-actions {
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

.notif-action-btn {
  background: transparent;
  border: 1px solid var(--border-subtle);
  color: var(--text-secondary);
  font-size: 0.74rem;
  font-weight: 600;
  padding: 0.25rem 0.55rem;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all 0.2s ease;
}

.notif-action-btn:hover {
  background: var(--bg-surface);
  color: var(--neon-cyan);
  border-color: var(--neon-cyan);
}

.notif-tabs {
  display: flex;
  background: rgba(0, 0, 0, 0.2);
  padding: 0.4rem 0.65rem;
  gap: 0.35rem;
  border-bottom: 1px solid var(--border-subtle);
}

.notif-tab {
  flex: 1;
  background: transparent;
  border: 1px solid transparent;
  color: var(--text-secondary);
  font-size: 0.74rem;
  font-weight: 700;
  padding: 0.35rem 0.4rem;
  border-radius: var(--radius-sm);
  cursor: pointer;
  text-align: center;
  white-space: nowrap;
  transition: all 0.2s ease;
}

.notif-tab:hover {
  color: var(--text-primary);
  background: rgba(255, 255, 255, 0.04);
}

.notif-tab.active {
  background: var(--bg-surface);
  color: var(--neon-cyan);
  border-color: var(--border-glow);
  box-shadow: var(--neon-cyan-glow);
}

.notif-list-container {
  max-height: 420px;
  min-height: 120px;
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: 0.5rem;
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
}

.notif-empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 2.5rem 1rem;
  color: var(--text-secondary);
  text-align: center;
  gap: 0.5rem;
  font-size: 0.85rem;
}

.notif-card {
  padding: 0.75rem 0.85rem;
  border-radius: var(--radius-sm);
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid var(--border-subtle);
  border-left-width: 4px;
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  cursor: pointer;
  transition: all 0.2s ease;
  position: relative;
}

.notif-card:hover {
  background: rgba(255, 255, 255, 0.05);
  transform: translateX(2px);
}

.notif-card.unread {
  background: rgba(0, 243, 255, 0.04);
}

.notif-card.nivel-critico {
  border-left-color: var(--neon-crimson, #ff0055);
}

.notif-card.nivel-advertencia {
  border-left-color: var(--neon-amber, #ffaa00);
}

.notif-card.nivel-info {
  border-left-color: var(--neon-emerald, #00ff88);
}

.notif-card-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
}

.notif-card-title {
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--text-primary);
  display: flex;
  align-items: center;
  gap: 0.35rem;
}

.notif-card-time {
  font-size: 0.68rem;
  color: var(--text-secondary);
  font-family: var(--font-mono);
  white-space: nowrap;
}

.notif-card-body {
  font-size: 0.76rem;
  color: var(--text-secondary);
  line-height: 1.35;
}

.notif-card-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 0.25rem;
  font-size: 0.7rem;
}

.notif-distancia-tag {
  background: rgba(255, 0, 85, 0.15);
  color: #ff3377;
  border: 1px solid rgba(255, 0, 85, 0.4);
  padding: 0.1rem 0.45rem;
  border-radius: var(--radius-full);
  font-weight: 700;
  font-family: var(--font-mono);
}

@media (max-width: 640px) {
  .notif-popover {
    position: fixed;
    top: 65px;
    left: 10px;
    right: 10px;
    width: auto;
    max-width: calc(100vw - 20px);
  }
}


