/* ============================================================
   Sistema de Asistencia QR — Design System
   main.css
   ============================================================ */

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

/* ─── Variables CSS ─────────────────────────────────────────── */
:root {
  /* Colores corporativos */
  --primary: #1a2e5a;
  --primary-light: #243c75;
  --primary-dark: #0f1e3d;
  --accent: #f0b429;
  --accent-dark: #d4960f;

  /* Superficies */
  --bg: #f0f4f8;
  --surface: #ffffff;
  --surface-2: #f8fafc;
  --border: #e2e8f0;
  --border-dark: #cbd5e1;

  /* Texto */
  --text: #0f172a;
  --text-secondary: #475569;
  --text-muted: #94a3b8;

  /* Semáforo */
  --success: #10b981;
  --success-bg: #ecfdf5;
  --warning: #f59e0b;
  --warning-bg: #fffbeb;
  --danger: #ef4444;
  --danger-bg: #fef2f2;
  --info: #3b82f6;
  --info-bg: #eff6ff;

  /* Layout */
  --sidebar-w: 260px;
  --sidebar-collapsed: 72px;
  --header-h: 68px;
  --radius: 12px;
  --radius-lg: 18px;
  --radius-sm: 8px;

  /* Sombras */
  --shadow-sm: 0 1px 3px rgba(0, 0, 0, .08), 0 1px 2px rgba(0, 0, 0, .05);
  --shadow: 0 4px 16px rgba(0, 0, 0, .08), 0 1px 4px rgba(0, 0, 0, .06);
  --shadow-lg: 0 10px 40px rgba(0, 0, 0, .12), 0 4px 10px rgba(0, 0, 0, .08);
  --shadow-xl: 0 20px 60px rgba(0, 0, 0, .15);

  /* Transiciones */
  --transition: .2s ease;
  --transition-slow: .35s cubic-bezier(.4, 0, .2, 1);
}

/* Dark mode */
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0a0f1e;
    --surface: #111827;
    --surface-2: #1f2937;
    --border: #1e293b;
    --border-dark: #334155;
    --text: #f1f5f9;
    --text-secondary: #94a3b8;
    --text-muted: #475569;
  }
}

body.dark-mode {
  --bg: #0a0f1e;
  --surface: #111827;
  --surface-2: #1f2937;
  --border: #1e293b;
  --border-dark: #334155;
  --text: #f1f5f9;
  --text-secondary: #94a3b8;
  --text-muted: #475569;
}

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

html {
  scroll-behavior: smooth;
}

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  font-size: 14px;
  -webkit-font-smoothing: antialiased;
  transition: background var(--transition), color var(--transition);
}

a {
  color: inherit;
  text-decoration: none;
}

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

input,
textarea,
select,
button {
  font-family: inherit;
}

/* ─── Scrollbar custom ──────────────────────────────────────── */
::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}

::-webkit-scrollbar-track {
  background: transparent;
}

::-webkit-scrollbar-thumb {
  background: var(--border-dark);
  border-radius: 99px;
}

::-webkit-scrollbar-thumb:hover {
  background: var(--text-muted);
}

/* ═══════════════════════════════════════════════════════════════
   LOGIN PAGE
═══════════════════════════════════════════════════════════════ */
.login-page {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 1fr 1fr;
  background: var(--primary-dark);
}

.login-brand {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 3rem;
  background: linear-gradient(135deg, var(--primary-dark) 0%, var(--primary) 60%, #2d4fa8 100%);
  position: relative;
  overflow: hidden;
}

.login-brand::before {
  content: '';
  position: absolute;
  width: 500px;
  height: 500px;
  background: radial-gradient(circle, rgba(240, 180, 41, .15) 0%, transparent 70%);
  top: -100px;
  right: -100px;
  border-radius: 50%;
}

.login-brand::after {
  content: '';
  position: absolute;
  width: 300px;
  height: 300px;
  background: radial-gradient(circle, rgba(255, 255, 255, .05) 0%, transparent 70%);
  bottom: -50px;
  left: -50px;
  border-radius: 50%;
}

.login-brand-logo {
  width: 100px;
  height: 100px;
  background: var(--accent);
  border-radius: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 2.5rem;
  font-weight: 800;
  color: var(--primary);
  margin-bottom: 2rem;
  box-shadow: 0 8px 32px rgba(240, 180, 41, .4);
  animation: float 3s ease-in-out infinite;
}

@keyframes float {

  0%,
  100% {
    transform: translateY(0);
  }

  50% {
    transform: translateY(-10px);
  }
}

.login-brand-title {
  font-size: 2rem;
  font-weight: 800;
  color: white;
  text-align: center;
  line-height: 1.2;
  margin-bottom: 1rem;
}

.login-brand-sub {
  font-size: .95rem;
  color: rgba(255, 255, 255, .65);
  text-align: center;
  max-width: 320px;
}

.login-features {
  margin-top: 3rem;
  display: flex;
  flex-direction: column;
  gap: .75rem;
}

.login-feature {
  display: flex;
  align-items: center;
  gap: .75rem;
  color: rgba(255, 255, 255, .8);
  font-size: .875rem;
}

.login-feature-icon {
  width: 36px;
  height: 36px;
  background: rgba(255, 255, 255, .1);
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1rem;
  flex-shrink: 0;
}

.login-form-panel {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 3rem;
  background: var(--surface);
}

.login-form-card {
  width: 100%;
  max-width: 420px;
}

.login-form-title {
  font-size: 1.75rem;
  font-weight: 700;
  color: var(--text);
  margin-bottom: .5rem;
}

.login-form-subtitle {
  color: var(--text-secondary);
  margin-bottom: 2rem;
  font-size: .9rem;
}

/* ═══════════════════════════════════════════════════════════════
   FORM CONTROLS
═══════════════════════════════════════════════════════════════ */
.form-group {
  margin-bottom: 1.25rem;
}

.form-label {
  display: block;
  font-size: .8rem;
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: .4rem;
  text-transform: uppercase;
  letter-spacing: .05em;
}

.form-control {
  width: 100%;
  padding: .75rem 1rem;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface-2);
  color: var(--text);
  font-size: .9rem;
  transition: border-color var(--transition), box-shadow var(--transition);
  outline: none;
}

.form-control:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(26, 46, 90, .12);
}

.form-control::placeholder {
  color: var(--text-muted);
}

.input-wrapper {
  position: relative;
}

.input-icon {
  position: absolute;
  left: .9rem;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-muted);
  font-size: 1rem;
  pointer-events: none;
}

.input-wrapper .form-control {
  padding-left: 2.75rem;
}

.input-action {
  position: absolute;
  right: .75rem;
  top: 50%;
  transform: translateY(-50%);
  background: none;
  border: none;
  cursor: pointer;
  color: var(--text-muted);
  font-size: 1rem;
  padding: .25rem;
  transition: color var(--transition);
}

.input-action:hover {
  color: var(--primary);
}

/* ═══════════════════════════════════════════════════════════════
   BUTTONS
═══════════════════════════════════════════════════════════════ */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: .5rem;
  padding: .7rem 1.5rem;
  border-radius: var(--radius-sm);
  font-size: .875rem;
  font-weight: 600;
  border: none;
  cursor: pointer;
  transition: all var(--transition);
  white-space: nowrap;
  text-decoration: none;
}

.btn:disabled {
  opacity: .6;
  cursor: not-allowed;
}

.btn-primary {
  background: linear-gradient(135deg, var(--primary), var(--primary-light));
  color: white;
  box-shadow: 0 4px 14px rgba(26, 46, 90, .3);
}

.btn-primary:hover:not(:disabled) {
  transform: translateY(-1px);
  box-shadow: 0 6px 20px rgba(26, 46, 90, .4);
}

.btn-accent {
  background: linear-gradient(135deg, var(--accent), var(--accent-dark));
  color: var(--primary);
  box-shadow: 0 4px 14px rgba(240, 180, 41, .3);
}

.btn-accent:hover:not(:disabled) {
  transform: translateY(-1px);
  box-shadow: 0 6px 20px rgba(240, 180, 41, .4);
}

.btn-ghost {
  background: transparent;
  color: var(--text-secondary);
  border: 1.5px solid var(--border);
}

.btn-ghost:hover:not(:disabled) {
  background: var(--surface-2);
  border-color: var(--border-dark);
}

.btn-danger {
  background: var(--danger);
  color: white;
  box-shadow: 0 4px 14px rgba(239, 68, 68, .25);
}

.btn-danger:hover:not(:disabled) {
  background: #dc2626;
  transform: translateY(-1px);
}

.btn-success {
  background: var(--success);
  color: white;
  box-shadow: 0 4px 14px rgba(16, 185, 129, .25);
}

.btn-sm {
  padding: .45rem 1rem;
  font-size: .8rem;
}

.btn-lg {
  padding: .9rem 2rem;
  font-size: 1rem;
}

.btn-full {
  width: 100%;
}

.btn-icon {
  padding: .6rem;
  border-radius: var(--radius-sm);
}

/* ═══════════════════════════════════════════════════════════════
   APP LAYOUT — Sidebar + Main
═══════════════════════════════════════════════════════════════ */
.app-layout {
  display: flex;
  min-height: 100vh;
  background: var(--bg);
}

/* ─── Sidebar ───────────────────────────────────────────────── */
.sidebar {
  width: var(--sidebar-w);
  background: linear-gradient(180deg, var(--primary-dark) 0%, var(--primary) 100%);
  height: 100vh;
  position: fixed;
  top: 0;
  left: 0;
  z-index: 100;
  display: flex;
  flex-direction: column;
  transition: width var(--transition-slow);
  overflow: hidden;
}

.sidebar.collapsed {
  width: var(--sidebar-collapsed);
}

.sidebar-header {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 1.25rem 1.25rem;
  border-bottom: 1px solid rgba(255, 255, 255, .08);
  min-height: var(--header-h);
  flex-shrink: 0;
}

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

.sidebar-title {
  font-size: .9rem;
  font-weight: 700;
  color: white;
  line-height: 1.2;
  white-space: nowrap;
  overflow: hidden;
  transition: opacity var(--transition);
}

.sidebar-subtitle {
  font-size: .7rem;
  color: rgba(255, 255, 255, .5);
  white-space: nowrap;
}

.sidebar.collapsed .sidebar-title,
.sidebar.collapsed .sidebar-subtitle {
  opacity: 0;
}

.sidebar-nav {
  flex: 1;
  overflow-y: auto;
  padding: 1rem 0;
}

.sidebar-section-title {
  font-size: .65rem;
  font-weight: 700;
  color: rgba(255, 255, 255, .35);
  letter-spacing: .1em;
  text-transform: uppercase;
  padding: .5rem 1.25rem;
  white-space: nowrap;
  transition: opacity var(--transition);
}

.sidebar.collapsed .sidebar-section-title {
  opacity: 0;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: .875rem;
  padding: .7rem 1.25rem;
  color: rgba(255, 255, 255, .7);
  cursor: pointer;
  transition: all var(--transition);
  position: relative;
  white-space: nowrap;
  text-decoration: none;
  border-radius: 0;
  margin: 1px 0;
}

.nav-item:hover {
  color: white;
  background: rgba(255, 255, 255, .08);
}

.nav-item.active {
  color: white;
  background: rgba(255, 255, 255, .12);
}

.nav-item.active::before {
  content: '';
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 3px;
  background: var(--accent);
  border-radius: 0 2px 2px 0;
}

.nav-icon {
  width: 22px;
  height: 22px;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1rem;
}

.nav-label {
  font-size: .875rem;
  font-weight: 500;
  transition: opacity var(--transition);
}

.sidebar.collapsed .nav-label {
  opacity: 0;
  pointer-events: none;
}

.sidebar-footer {
  padding: 1rem 1.25rem;
  border-top: 1px solid rgba(255, 255, 255, .08);
  flex-shrink: 0;
}

.user-info {
  display: flex;
  align-items: center;
  gap: .75rem;
}

.user-avatar {
  width: 36px;
  height: 36px;
  flex-shrink: 0;
  border-radius: 50%;
  background: var(--accent);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: .875rem;
  font-weight: 700;
  color: var(--primary);
}

.user-name {
  font-size: .8rem;
  font-weight: 600;
  color: white;
  white-space: nowrap;
  transition: opacity var(--transition);
}

.user-role {
  font-size: .65rem;
  color: rgba(255, 255, 255, .5);
  text-transform: uppercase;
  letter-spacing: .05em;
}

.sidebar.collapsed .user-name,
.sidebar.collapsed .user-role {
  opacity: 0;
}

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

.sidebar.collapsed~.main-content {
  margin-left: var(--sidebar-collapsed);
}

/* ─── Top Header ────────────────────────────────────────────── */
.top-header {
  height: var(--header-h);
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  padding: 0 2rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: 0;
  z-index: 50;
  box-shadow: var(--shadow-sm);
}

.top-header-left {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.sidebar-toggle {
  background: none;
  border: none;
  cursor: pointer;
  color: var(--text-secondary);
  font-size: 1.25rem;
  padding: .5rem;
  border-radius: var(--radius-sm);
  transition: all var(--transition);
}

.sidebar-toggle:hover {
  background: var(--surface-2);
  color: var(--primary);
}

.page-title {
  font-size: 1.2rem;
  font-weight: 700;
  color: var(--text);
}

.page-subtitle {
  font-size: .8rem;
  color: var(--text-secondary);
}

.top-header-right {
  display: flex;
  align-items: center;
  gap: .75rem;
}

.header-btn {
  background: none;
  border: none;
  cursor: pointer;
  width: 38px;
  height: 38px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-sm);
  color: var(--text-secondary);
  font-size: 1.1rem;
  transition: all var(--transition);
}

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

.header-badge {
  position: relative;
}

.header-badge::after {
  content: '';
  position: absolute;
  top: 6px;
  right: 6px;
  width: 8px;
  height: 8px;
  background: var(--danger);
  border-radius: 50%;
  border: 2px solid var(--surface);
}

/* ─── Page Content ──────────────────────────────────────────── */
.page-content {
  flex: 1;
  padding: 2rem;
}

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

.card-header {
  padding: 1.25rem 1.5rem;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.card-title {
  font-size: 1rem;
  font-weight: 700;
  color: var(--text);
}

.card-subtitle {
  font-size: .8rem;
  color: var(--text-secondary);
  margin-top: .1rem;
}

.card-body {
  padding: 1.5rem;
}

/* ─── Stat Cards ────────────────────────────────────────────── */
.stat-card {
  background: var(--surface);
  border-radius: var(--radius-lg);
  border: 1px solid var(--border);
  padding: 1.5rem;
  display: flex;
  align-items: center;
  gap: 1.25rem;
  box-shadow: var(--shadow-sm);
  transition: transform var(--transition), box-shadow var(--transition);
  position: relative;
  overflow: hidden;
}

.stat-card::before {
  content: '';
  position: absolute;
  right: -20px;
  top: -20px;
  width: 100px;
  height: 100px;
  border-radius: 50%;
  opacity: .06;
}

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

.stat-icon {
  width: 56px;
  height: 56px;
  flex-shrink: 0;
  border-radius: var(--radius);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.5rem;
}

.stat-info {
  flex: 1;
}

.stat-value {
  font-size: 2rem;
  font-weight: 800;
  line-height: 1;
  color: var(--text);
}

.stat-label {
  font-size: .8rem;
  color: var(--text-secondary);
  font-weight: 500;
  margin-top: .25rem;
}

.stat-trend {
  font-size: .75rem;
  font-weight: 600;
  margin-top: .5rem;
  display: flex;
  align-items: center;
  gap: .25rem;
}

.trend-up {
  color: var(--success);
}

.trend-down {
  color: var(--danger);
}

/* Variantes de colores stat */
.stat-primary .stat-icon {
  background: rgba(26, 46, 90, .1);
  color: var(--primary);
}

.stat-primary::before {
  background: var(--primary);
}

.stat-success .stat-icon {
  background: var(--success-bg);
  color: var(--success);
}

.stat-success::before {
  background: var(--success);
}

.stat-danger .stat-icon {
  background: var(--danger-bg);
  color: var(--danger);
}

.stat-danger::before {
  background: var(--danger);
}

.stat-accent .stat-icon {
  background: rgba(240, 180, 41, .12);
  color: var(--accent-dark);
}

.stat-accent::before {
  background: var(--accent);
}

/* ═══════════════════════════════════════════════════════════════
   GRID LAYOUTS
═══════════════════════════════════════════════════════════════ */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 1.25rem;
  margin-bottom: 1.5rem;
}

.grid-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.25rem;
}

.grid-3 {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1.25rem;
}

/* ═══════════════════════════════════════════════════════════════
   TABLES
═══════════════════════════════════════════════════════════════ */
.table-wrapper {
  overflow-x: auto;
  border-radius: var(--radius);
}

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

thead th {
  padding: .75rem 1rem;
  text-align: left;
  font-size: .72rem;
  font-weight: 700;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: .06em;
  background: var(--surface-2);
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}

tbody td {
  padding: .85rem 1rem;
  border-bottom: 1px solid var(--border);
  color: var(--text);
  vertical-align: middle;
}

tbody tr:last-child td {
  border-bottom: none;
}

tbody tr:hover {
  background: var(--surface-2);
}

/* ═══════════════════════════════════════════════════════════════
   BADGES & TAGS
═══════════════════════════════════════════════════════════════ */
.badge {
  display: inline-flex;
  align-items: center;
  gap: .35rem;
  padding: .25rem .65rem;
  border-radius: 99px;
  font-size: .72rem;
  font-weight: 600;
  letter-spacing: .03em;
}

.badge-success {
  background: var(--success-bg);
  color: var(--success);
}

.badge-danger {
  background: var(--danger-bg);
  color: var(--danger);
}

.badge-warning {
  background: var(--warning-bg);
  color: var(--warning);
}

.badge-info {
  background: var(--info-bg);
  color: var(--info);
}

.badge-primary {
  background: rgba(26, 46, 90, .1);
  color: var(--primary);
}

.badge-neutral {
  background: var(--surface-2);
  color: var(--text-secondary);
  border: 1px solid var(--border);
}

.badge::before {
  content: '●';
  font-size: .5rem;
}

/* ═══════════════════════════════════════════════════════════════
   MODAL
═══════════════════════════════════════════════════════════════ */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, .55);
  backdrop-filter: blur(4px);
  z-index: 500;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  opacity: 0;
  pointer-events: none;
  transition: opacity var(--transition);
}

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

.modal {
  background: var(--surface);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-xl);
  width: 100%;
  max-width: 560px;
  max-height: 90vh;
  overflow-y: auto;
  transform: scale(.95) translateY(20px);
  transition: transform var(--transition-slow);
}

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

.modal-header {
  padding: 1.5rem;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: 0;
  background: var(--surface);
  z-index: 1;
}

.modal-title {
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--text);
}

.modal-close {
  background: none;
  border: none;
  cursor: pointer;
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-sm);
  color: var(--text-muted);
  font-size: 1.1rem;
  transition: all var(--transition);
}

.modal-close:hover {
  background: var(--danger-bg);
  color: var(--danger);
}

.modal-body {
  padding: 1.5rem;
}

.modal-footer {
  padding: 1rem 1.5rem;
  border-top: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: .75rem;
}

/* ═══════════════════════════════════════════════════════════════
   ALERTS / TOASTS
═══════════════════════════════════════════════════════════════ */
.alert {
  padding: 1rem 1.25rem;
  border-radius: var(--radius-sm);
  font-size: .875rem;
  display: flex;
  align-items: flex-start;
  gap: .75rem;
  margin-bottom: 1rem;
  border-left: 4px solid;
}

.alert-success {
  background: var(--success-bg);
  color: #065f46;
  border-color: var(--success);
}

.alert-danger {
  background: var(--danger-bg);
  color: #7f1d1d;
  border-color: var(--danger);
}

.alert-warning {
  background: var(--warning-bg);
  color: #78350f;
  border-color: var(--warning);
}

.alert-info {
  background: var(--info-bg);
  color: #1e3a8a;
  border-color: var(--info);
}

/* Toast */
.toast-container {
  position: fixed;
  top: 1.5rem;
  right: 1.5rem;
  z-index: 1000;
  display: flex;
  flex-direction: column;
  gap: .75rem;
}

.toast {
  min-width: 300px;
  max-width: 420px;
  background: var(--surface);
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
  padding: 1rem 1.25rem;
  display: flex;
  align-items: center;
  gap: .875rem;
  border-left: 4px solid;
  animation: slideInRight .3s ease, fadeOut .3s ease 3.7s forwards;
}

.toast-success {
  border-color: var(--success);
}

.toast-danger {
  border-color: var(--danger);
}

.toast-warning {
  border-color: var(--warning);
}

.toast-info {
  border-color: var(--info);
}

.toast-icon {
  font-size: 1.25rem;
  flex-shrink: 0;
}

.toast-success .toast-icon {
  color: var(--success);
}

.toast-danger .toast-icon {
  color: var(--danger);
}

.toast-warning .toast-icon {
  color: var(--warning);
}

.toast-text {
  flex: 1;
  font-size: .875rem;
  font-weight: 500;
  color: var(--text);
}

@keyframes slideInRight {
  from {
    transform: translateX(100%);
    opacity: 0;
  }

  to {
    transform: translateX(0);
    opacity: 1;
  }
}

@keyframes fadeOut {
  to {
    opacity: 0;
    transform: translateX(100%);
  }
}

/* ═══════════════════════════════════════════════════════════════
   SCANNER PAGE
═══════════════════════════════════════════════════════════════ */
.scanner-layout {
  display: grid;
  grid-template-columns: 1fr 380px;
  gap: 1.5rem;
  height: calc(100vh - var(--header-h) - 4rem);
}

.scanner-card {
  background: var(--surface);
  border-radius: var(--radius-lg);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.scanner-viewport {
  position: relative;
  background: #000;
  flex: 1;
  min-height: 300px;
}

#scanner-video {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.scanner-overlay {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}

.scanner-frame {
  width: 240px;
  height: 240px;
  position: relative;
}

.scanner-frame::before,
.scanner-frame::after,
.scanner-corner-bl,
.scanner-corner-br {
  content: '';
  position: absolute;
  width: 40px;
  height: 40px;
  border-color: var(--accent);
  border-style: solid;
}

.scanner-frame::before {
  top: 0;
  left: 0;
  border-width: 3px 0 0 3px;
  border-radius: 4px 0 0 0;
}

.scanner-frame::after {
  top: 0;
  right: 0;
  border-width: 3px 3px 0 0;
  border-radius: 0 4px 0 0;
}

.scanner-corner-bl {
  bottom: 0;
  left: 0;
  border-width: 0 0 3px 3px;
  border-radius: 0 0 0 4px;
}

.scanner-corner-br {
  bottom: 0;
  right: 0;
  border-width: 0 3px 3px 0;
  border-radius: 0 0 4px 0;
}

.scan-line {
  position: absolute;
  left: 0;
  right: 0;
  height: 2px;
  background: linear-gradient(90deg, transparent, var(--accent), transparent);
  animation: scan 2s linear infinite;
  top: 0;
}

@keyframes scan {
  0% {
    top: 0
  }

  100% {
    top: 100%
  }
}

.scanner-hint {
  position: absolute;
  bottom: 1rem;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(0, 0, 0, .6);
  backdrop-filter: blur(8px);
  color: white;
  font-size: .8rem;
  padding: .5rem 1rem;
  border-radius: 99px;
  white-space: nowrap;
}

.scanner-status {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 1rem;
  background: rgba(0, 0, 0, .85);
  color: white;
}

.scanner-status.success {
  background: rgba(16, 185, 129, .9);
}

.scanner-status.duplicate {
  background: rgba(245, 158, 11, .9);
}

.scanner-status.error {
  background: rgba(239, 68, 68, .9);
}

.status-icon {
  font-size: 4rem;
}

.status-name {
  font-size: 1.5rem;
  font-weight: 700;
}

.status-detail {
  font-size: .9rem;
  opacity: .85;
}

.scanner-controls {
  padding: 1rem 1.5rem;
  display: flex;
  gap: 1rem;
  border-top: 1px solid var(--border);
}

/* Sidebar scanner */
.scanner-sidebar {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.recent-scan-item {
  display: flex;
  align-items: center;
  gap: .875rem;
  padding: .875rem 1rem;
  border-radius: var(--radius-sm);
  background: var(--surface-2);
  transition: background var(--transition);
}

.recent-scan-item:hover {
  background: var(--border);
}

.scan-type-badge {
  width: 40px;
  height: 40px;
  flex-shrink: 0;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.1rem;
}

.scan-type-badge.entrada {
  background: var(--success-bg);
  color: var(--success);
}

.scan-type-badge.salida {
  background: var(--info-bg);
  color: var(--info);
}

/* ═══════════════════════════════════════════════════════════════
   FOTOCHECK
═══════════════════════════════════════════════════════════════ */
.fotocheck {
  width: 300px;
  background: white;
  border-radius: 16px;
  border: 2px solid #e2e8f0;
  overflow: hidden;
  box-shadow: 0 10px 40px rgba(0, 0, 0, .15);
  font-family: 'Inter', sans-serif;
}

.fotocheck-header {
  background: linear-gradient(135deg, #1a2e5a, #243c75);
  padding: 1rem;
  display: flex;
  align-items: center;
  gap: .75rem;
}

.fotocheck-company {
  color: white;
}

.fotocheck-company-name {
  font-size: .9rem;
  font-weight: 700;
}

.fotocheck-company-ruc {
  font-size: .65rem;
  opacity: .7;
}

.fotocheck-body {
  position: relative;
  padding: 1rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: .75rem;
  background: radial-gradient(circle at 50% 30%, #eef2fb 0%, #cedaf0 100%);
  overflow: hidden;
}

.fotocheck-body::before {
  content: '';
  position: absolute;
  top: 45%;
  left: 50%;
  width: 260px;
  height: 260px;
  background: url('/static/logo.jpg') center/cover no-repeat;
  border-radius: 50%;
  transform: translate(-50%, -50%);
  opacity: .13;
  pointer-events: none;
}

.fotocheck-body>* {
  position: relative;
}

.fotocheck-photo {
  width: 90px;
  height: 90px;
  border-radius: 50%;
  background: #f0f4f8;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 2.5rem;
  border: 3px solid #1a2e5a;
  overflow: hidden;
}

.fotocheck-photo img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 50%;
  display: block;
}


.fotocheck-name {
  font-size: .95rem;
  font-weight: 700;
  color: #0f172a;
  text-align: center;
}

.fotocheck-cargo {
  font-size: .95rem;
  font-weight: 700;
  color: #1a2e5a;
  text-align: center;
}

.fotocheck-area {
  font-size: .8rem;
  font-weight: 700;
  color: #64748b;
  text-align: center;
}

.fotocheck-qr {
  padding: .5rem;
  background: white;
  border-radius: 8px;
  border: 1px solid #e2e8f0;
}

.fotocheck-qr img {
  width: 100px;
  height: 100px;
}

.fotocheck-footer {
  background: #f0b429;
  padding: .5rem;
  text-align: center;
  font-size: .7rem;
  font-weight: 700;
  color: #1a2e5a;
  letter-spacing: .08em;
}

.fotocheck-code {
  font-size: .85rem;
  font-weight: 700;
  color: #1a2e5a;
  font-family: monospace;
  text-align: center;
  letter-spacing: .03em;
}

/* ═══════════════════════════════════════════════════════════════
   FILTERS BAR
═══════════════════════════════════════════════════════════════ */
.filters-bar {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: .75rem;
  padding: 1.25rem 1.5rem;
  border-bottom: 1px solid var(--border);
  background: var(--surface-2);
}

.filter-item {
  display: flex;
  flex-direction: column;
  gap: .25rem;
}

.filter-label {
  font-size: .7rem;
  font-weight: 600;
  color: var(--text-secondary);
  text-transform: uppercase;
}

.filters-bar .form-control {
  padding: .5rem .85rem;
  font-size: .85rem;
}

/* ═══════════════════════════════════════════════════════════════
   SEARCH
═══════════════════════════════════════════════════════════════ */
.search-wrapper {
  position: relative;
}

.search-icon {
  position: absolute;
  left: .875rem;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-muted);
  font-size: .9rem;
  pointer-events: none;
}

.search-input {
  padding-left: 2.5rem !important;
  min-width: 240px;
}

/* ═══════════════════════════════════════════════════════════════
   LOADING SPINNER
═══════════════════════════════════════════════════════════════ */
.spinner {
  width: 20px;
  height: 20px;
  border: 2.5px solid rgba(255, 255, 255, .3);
  border-top-color: white;
  border-radius: 50%;
  animation: spin .7s linear infinite;
  display: inline-block;
}

.spinner-dark {
  border-color: var(--border-dark);
  border-top-color: var(--primary);
}

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

/* ═══════════════════════════════════════════════════════════════
   EMPTY STATE
═══════════════════════════════════════════════════════════════ */
.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 4rem 2rem;
  text-align: center;
  color: var(--text-muted);
}

.empty-icon {
  font-size: 3.5rem;
  margin-bottom: 1rem;
  opacity: .5;
}

.empty-title {
  font-size: 1rem;
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: .5rem;
}

.empty-text {
  font-size: .875rem;
}

/* ═══════════════════════════════════════════════════════════════
   CHART CONTAINERS
═══════════════════════════════════════════════════════════════ */
.chart-container {
  position: relative;
  height: 280px;
}

/* ═══════════════════════════════════════════════════════════════
   PAGINATION
═══════════════════════════════════════════════════════════════ */
.pagination {
  display: flex;
  align-items: center;
  gap: .5rem;
  padding: 1rem 1.5rem;
  border-top: 1px solid var(--border);
}

.page-btn {
  width: 34px;
  height: 34px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--surface);
  cursor: pointer;
  font-size: .875rem;
  color: var(--text);
  transition: all var(--transition);
}

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

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

.page-info {
  font-size: .8rem;
  color: var(--text-secondary);
  margin-left: auto;
}

/* ═══════════════════════════════════════════════════════════════
   ANIMATIONS
═══════════════════════════════════════════════════════════════ */
@keyframes fadeInUp {
  from {
    opacity: 0;
    transform: translateY(20px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes fadeIn {
  from {
    opacity: 0;
  }

  to {
    opacity: 1;
  }
}

@keyframes pulse {

  0%,
  100% {
    opacity: 1;
  }

  50% {
    opacity: .5;
  }
}

.animate-fade-in {
  animation: fadeIn .4s ease;
}

.animate-fade-up {
  animation: fadeInUp .4s ease;
}

.animate-fade-up:nth-child(1) {
  animation-delay: .05s;
}

.animate-fade-up:nth-child(2) {
  animation-delay: .1s;
}

.animate-fade-up:nth-child(3) {
  animation-delay: .15s;
}

.animate-fade-up:nth-child(4) {
  animation-delay: .2s;
}

/* ═══════════════════════════════════════════════════════════════
   PRINT STYLES
═══════════════════════════════════════════════════════════════ */
@media print {

  .sidebar,
  .top-header,
  .no-print {
    display: none !important;
  }

  .main-content {
    margin-left: 0 !important;
  }

  .page-content {
    padding: 0 !important;
  }

  .fotocheck {
    box-shadow: none;
  }
}

/* ═══════════════════════════════════════════════════════════════
   RESPONSIVE
═══════════════════════════════════════════════════════════════ */
@media (max-width: 1200px) {
  .stats-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  .scanner-layout {
    grid-template-columns: 1fr;
  }

  .scanner-sidebar {
    display: none;
  }
}

@media (max-width: 900px) {
  :root {
    --sidebar-w: 0px;
  }

  .sidebar {
    width: var(--sidebar-w);
    transform: translateX(-260px);
  }

  .sidebar.mobile-open {
    width: 260px;
    transform: translateX(0);
  }

  .main-content {
    margin-left: 0 !important;
  }

  .login-page {
    grid-template-columns: 1fr;
  }

  .login-brand {
    display: none;
  }

  .login-form-panel {
    padding: 2rem 1.5rem;
  }

  .grid-2,
  .grid-3 {
    grid-template-columns: 1fr;
  }

  .page-content {
    padding: 1.25rem;
  }

  .top-header {
    padding: 0 1.25rem;
  }
}

@media (max-width: 600px) {
  .stats-grid {
    grid-template-columns: 1fr;
  }

  .filters-bar {
    flex-direction: column;
    align-items: stretch;
  }

  .search-input {
    min-width: unset;
  }
}

/* Overlay sidebar mobile */
.sidebar-backdrop {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, .5);
  z-index: 99;
}

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