/* ============================================================
   style.css — Sistema de Diseño SVV_2
   Dark mode · Glassmorphism · Inter font · Mobile-first
   ============================================================ */

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

/* ── Variables ──────────────────────────────────────────── */
:root {
  --bg-base:        #0b0f1a;
  --bg-surface:     #111827;
  --bg-glass:       rgba(255,255,255,0.04);
  --bg-glass-hover: rgba(255,255,255,0.08);
  --border:         rgba(255,255,255,0.09);
  --border-hover:   rgba(255,255,255,0.18);

  --primary:        #6366f1;
  --primary-light:  #818cf8;
  --primary-dark:   #4f46e5;

  --accent-ok:      #10b981;
  --accent-ko:      #f43f5e;
  --accent-pending: #f59e0b;

  --text-primary:   #f1f5f9;
  --text-secondary: #94a3b8;
  --text-muted:     #475569;

  --radius-sm:  8px;
  --radius-md:  14px;
  --radius-lg:  20px;
  --radius-xl:  28px;

  --shadow-card: 0 4px 24px rgba(0,0,0,0.4), 0 1px 4px rgba(0,0,0,0.3);
  --shadow-btn:  0 4px 15px rgba(99,102,241,0.4);
  --transition:  0.22s cubic-bezier(.4,0,.2,1);

  /* Touch-friendly min tap target */
  --tap-min: 44px;
}

/* ── Reset ───────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }
body {
  font-family: 'Inter', system-ui, sans-serif;
  background: var(--bg-base);
  color: var(--text-primary);
  min-height: 100vh;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  /* Prevents horizontal overflow on mobile */
  overflow-x: hidden;
}

/* ── Background animated gradient ───────────────────────── */
body::before {
  content: '';
  position: fixed;
  inset: 0;
  background:
    radial-gradient(ellipse 80% 60% at 20% 10%, rgba(99,102,241,0.12) 0%, transparent 60%),
    radial-gradient(ellipse 60% 50% at 80% 90%, rgba(139,92,246,0.10) 0%, transparent 60%);
  pointer-events: none;
  z-index: 0;
}

/* ── Layout ──────────────────────────────────────────────── */
.page-wrapper { position: relative; z-index: 1; min-height: 100vh; }

/* ── Navbar ──────────────────────────────────────────────── */
.navbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 1rem;
  height: 60px;
  background: rgba(11,15,26,0.92);
  backdrop-filter: blur(16px);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 100;
  gap: .5rem;
}
.navbar-brand {
  display: flex;
  align-items: center;
  gap: .6rem;
  font-size: 1rem;
  font-weight: 700;
  color: var(--text-primary);
  text-decoration: none;
  flex-shrink: 0;
}
.navbar-brand .logo-icon {
  width: 32px; height: 32px;
  background: linear-gradient(135deg, var(--primary), var(--primary-light));
  border-radius: var(--radius-sm);
  display: flex; align-items: center; justify-content: center;
  font-size: .95rem;
  flex-shrink: 0;
}
.navbar-user {
  display: flex; align-items: center; gap: .6rem;
  min-width: 0; /* allow shrink */
}
.navbar-user .user-info {
  text-align: right;
  font-size: .78rem;
  min-width: 0;
  overflow: hidden;
}
.navbar-user .user-name {
  font-weight: 600;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.navbar-user .user-role {
  color: var(--primary-light);
  font-size: .68rem;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: .05em;
}
/* Compact role badge shown only on mobile (hidden on ≥640px) */
.navbar-role-badge {
  display: none;
  padding: .2rem .6rem;
  border-radius: 999px;
  font-size: .65rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .05em;
  background: rgba(99,102,241,0.15);
  color: var(--primary-light);
  border: 1px solid rgba(99,102,241,0.3);
  white-space: nowrap;
}
@media (max-width: 639px) {
  .navbar-role-badge { display: inline-flex; align-items: center; }
}
.btn-logout {
  padding: .4rem .8rem;
  background: rgba(244,63,94,0.12);
  border: 1px solid rgba(244,63,94,0.3);
  color: #f43f5e;
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-size: .78rem;
  font-weight: 600;
  transition: var(--transition);
  text-decoration: none;
  white-space: nowrap;
  min-height: var(--tap-min);
  display: inline-flex;
  align-items: center;
}
.btn-logout .logout-icon {
  display: none;
}
.btn-logout:hover {
  background: rgba(244,63,94,0.22);
  border-color: rgba(244,63,94,0.5);
}

/* ── Container ───────────────────────────────────────────── */
.container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 1.25rem 1rem;
}

/* ── Page header ─────────────────────────────────────────── */
.page-header { margin-bottom: 1.5rem; }
.page-header h1 {
  font-size: 1.5rem;
  font-weight: 800;
  background: linear-gradient(135deg, var(--text-primary), var(--primary-light));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  line-height: 1.2;
}
.page-header p { color: var(--text-secondary); font-size: .88rem; margin-top: .3rem; }

/* ── Cards ───────────────────────────────────────────────── */
.card {
  background: var(--bg-glass);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 1.25rem;
  backdrop-filter: blur(12px);
  box-shadow: var(--shadow-card);
  transition: var(--transition);
}
.card:hover { border-color: var(--border-hover); }

/* ── Buttons ─────────────────────────────────────────────── */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: .5rem;
  padding: .65rem 1.25rem;
  border-radius: var(--radius-sm);
  font-family: inherit; font-size: .88rem; font-weight: 600;
  cursor: pointer; border: none;
  transition: var(--transition);
  text-decoration: none;
  white-space: nowrap;
  min-height: var(--tap-min);
}
.btn-primary {
  background: linear-gradient(135deg, var(--primary), var(--primary-dark));
  color: #fff;
  box-shadow: var(--shadow-btn);
}
.btn-primary:hover { transform: translateY(-1px); box-shadow: 0 6px 22px rgba(99,102,241,0.5); }
.btn-primary:active { transform: translateY(0); }

.btn-success {
  background: linear-gradient(135deg, #10b981, #059669);
  color: #fff;
  box-shadow: 0 4px 15px rgba(16,185,129,0.35);
}
.btn-success:hover { transform: translateY(-1px); box-shadow: 0 6px 22px rgba(16,185,129,0.5); }

.btn-danger {
  background: linear-gradient(135deg, #f43f5e, #e11d48);
  color: #fff;
  box-shadow: 0 4px 15px rgba(244,63,94,0.35);
}
.btn-danger:hover { transform: translateY(-1px); box-shadow: 0 6px 22px rgba(244,63,94,0.5); }

.btn-ghost {
  background: var(--bg-glass);
  border: 1px solid var(--border);
  color: var(--text-secondary);
}
.btn-ghost:hover { background: var(--bg-glass-hover); color: var(--text-primary); border-color: var(--border-hover); }

.btn-sm { padding: .4rem .85rem; font-size: .8rem; min-height: 36px; }
.btn-full { width: 100%; }
.btn-text-mobile { display: none; }

/* ── Form elements ───────────────────────────────────────── */
.form-group { margin-bottom: 1.25rem; }
.form-label {
  display: block;
  font-size: .82rem;
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: .45rem;
  text-transform: uppercase;
  letter-spacing: .06em;
}
.form-control {
  width: 100%;
  background: rgba(255,255,255,0.04);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: .75rem 1rem;
  color: var(--text-primary);
  font-family: inherit;
  font-size: 1rem; /* 16px prevents iOS zoom-in */
  transition: var(--transition);
  outline: none;
  min-height: var(--tap-min);
  -webkit-appearance: none;
}
.form-control:focus {
  border-color: var(--primary);
  background: rgba(99,102,241,0.06);
  box-shadow: 0 0 0 3px rgba(99,102,241,0.15);
}
.form-control::placeholder { color: var(--text-muted); }
textarea.form-control { resize: vertical; min-height: 90px; }
select.form-control { cursor: pointer; }

/* File input custom ─────────────────────────────────────── */
.file-input-wrapper { position: relative; }
.file-input-wrapper input[type="file"] {
  position: absolute; inset: 0; opacity: 0; cursor: pointer; z-index: 2;
  width: 100%; height: 100%;
}
.file-drop-zone {
  border: 2px dashed var(--border);
  border-radius: var(--radius-md);
  padding: 2rem 1rem;
  text-align: center;
  color: var(--text-secondary);
  transition: var(--transition);
  cursor: pointer;
}
.file-drop-zone:hover, .file-drop-zone.drag-over {
  border-color: var(--primary);
  background: rgba(99,102,241,0.06);
  color: var(--primary-light);
}
.file-drop-zone .drop-icon { font-size: 2rem; margin-bottom: .5rem; }
.file-drop-zone .drop-text { font-size: .9rem; font-weight: 500; }
.file-drop-zone .drop-hint { font-size: .78rem; margin-top: .25rem; opacity: .7; }
#preview-img {
  max-width: 100%; border-radius: var(--radius-md);
  margin-top: 1rem; display: none;
  border: 1px solid var(--border);
}

/* ── Search bar ──────────────────────────────────────────── */
.search-bar { position: relative; margin-bottom: 1.5rem; }
.search-bar .search-icon {
  position: absolute; left: 1rem; top: 50%; transform: translateY(-50%);
  color: var(--text-muted); font-size: 1rem; pointer-events: none;
}
.search-bar input { padding-left: 2.8rem; }

/* ── Staff grid ──────────────────────────────────────────── */
.staff-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 1rem;
}
.staff-card {
  background: var(--bg-glass);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 1.1rem;
  display: flex; flex-direction: column; gap: .75rem;
  cursor: pointer;
  transition: var(--transition);
  position: relative;
  overflow: hidden;
}
.staff-card::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0; height: 3px;
  background: var(--card-accent, var(--primary));
  opacity: 0;
  transition: var(--transition);
}
.staff-card:hover {
  border-color: var(--border-hover);
  background: var(--bg-glass-hover);
  transform: translateY(-2px);
  box-shadow: 0 8px 32px rgba(0,0,0,0.3);
}
.staff-card:hover::before { opacity: 1; }
.staff-card-header { display: flex; align-items: center; gap: 1rem; }
.staff-avatar {
  width: 50px; height: 50px;
  border-radius: var(--radius-sm);
  object-fit: cover;
  flex-shrink: 0;
  border: 2px solid var(--border);
}
.staff-avatar-large {
  width: 72px; height: 72px;
  border-radius: var(--radius-md);
  object-fit: cover;
  border: 2px solid var(--border);
  flex-shrink: 0;
}
.staff-name { font-weight: 700; font-size: .95rem; color: var(--text-primary); line-height: 1.3; }
.staff-id   { font-size: .75rem; color: var(--text-muted); font-weight: 500; margin-top: .15rem; }
.staff-detail { font-size: .8rem; color: var(--text-secondary); display: flex; flex-direction: column; gap: .3rem; }
.staff-detail span { display: flex; align-items: center; gap: .4rem; }
.staff-detail span::before { content: ''; width: 4px; height: 4px; border-radius: 50%; background: var(--primary-light); flex-shrink: 0; }
.staff-card .btn-sm { margin-top: auto; }
.staff-avatar-initials {
  display: flex; align-items: center; justify-content: center;
  font-family: 'Inter', sans-serif;
  font-size: 1.1rem; font-weight: 700;
  color: rgba(255,255,255,0.95);
  user-select: none; letter-spacing: .03em;
}

/* ── Records table ───────────────────────────────────────── */
.records-table { width: 100%; border-collapse: collapse; font-size: .88rem; }
.records-table th {
  text-align: left; padding: .65rem .85rem;
  font-size: .72rem; font-weight: 700;
  text-transform: uppercase; letter-spacing: .07em;
  color: var(--text-muted);
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}
.records-table td {
  padding: .8rem .85rem;
  border-bottom: 1px solid rgba(255,255,255,0.04);
  color: var(--text-secondary); vertical-align: middle;
}
.records-table tr:hover td { background: var(--bg-glass-hover); color: var(--text-primary); }
.records-table tr:last-child td { border-bottom: none; }
.records-table .td-name { color: var(--text-primary); font-weight: 600; }

/* Table scroll wrapper (use on the .card wrapping a table) */
.table-scroll { overflow-x: auto; -webkit-overflow-scrolling: touch; }

/* ── Badges ──────────────────────────────────────────────── */
.badge {
  display: inline-flex; align-items: center; gap: .3rem;
  padding: .25rem .75rem; border-radius: 999px;
  font-size: .75rem; font-weight: 700;
}
.badge-ok      { background: rgba(16,185,129,0.15); color: #34d399; border: 1px solid rgba(16,185,129,0.25); }
.badge-ko      { background: rgba(244,63,94,0.15);  color: #fb7185; border: 1px solid rgba(244,63,94,0.25); }
.badge-pending { background: rgba(245,158,11,0.15); color: #fbbf24; border: 1px solid rgba(245,158,11,0.25); }

/* ── Tabs ────────────────────────────────────────────────── */
.tabs {
  display: flex;
  gap: .25rem;
  margin-bottom: 1.5rem;
  background: var(--bg-glass);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: .3rem;
  overflow-x: auto;
  scrollbar-width: none; /* Hide scrollbar Firefox */
  -webkit-overflow-scrolling: touch;
}
.tabs::-webkit-scrollbar {
  display: none; /* Hide scrollbar Chrome/Safari/Webkit */
}
.tab-btn {
  padding: .55rem 1rem; border-radius: 6px; border: none;
  background: transparent; color: var(--text-secondary);
  font-family: inherit; font-size: .85rem; font-weight: 600;
  cursor: pointer; transition: var(--transition);
  flex: 1 0 auto; /* Allow grow but prevent shrinking below content size */
  min-height: var(--tap-min);
  text-align: center;
  white-space: nowrap;
}
.tab-btn.active { background: var(--primary); color: #fff; box-shadow: 0 2px 8px rgba(99,102,241,0.4); }
.tab-btn:hover:not(.active) { color: var(--text-primary); background: var(--bg-glass-hover); }

/* ── Comparison view ─────────────────────────────────────── */
.compare-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 1.25rem; margin-bottom: 1.5rem; }
.compare-panel {
  background: var(--bg-glass); border: 1px solid var(--border);
  border-radius: var(--radius-md); padding: 1.25rem;
  text-align: center; display: flex; flex-direction: column; align-items: center; gap: 1rem;
}
.compare-panel h3 { font-size: .8rem; font-weight: 700; text-transform: uppercase; letter-spacing: .08em; color: var(--text-muted); }
.compare-photo { width: 100%; max-width: 260px; aspect-ratio: 1; object-fit: cover; border-radius: var(--radius-md); border: 2px solid var(--border); }
.compare-label-oficial { border-top: 3px solid var(--primary); }
.compare-label-subida  { border-top: 3px solid var(--accent-pending); }

/* ── Login page ──────────────────────────────────────────── */
.login-wrapper { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 1.5rem 1rem; }
.login-card {
  width: 100%; max-width: 420px;
  background: var(--bg-glass);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  padding: 2rem 1.5rem;
  backdrop-filter: blur(20px);
  box-shadow: 0 24px 64px rgba(0,0,0,0.5), 0 0 0 1px rgba(255,255,255,0.04);
}
.login-logo { text-align: center; margin-bottom: 2rem; }
.login-logo .logo-circle {
  width: 68px; height: 68px;
  background: linear-gradient(135deg, var(--primary), var(--primary-light));
  border-radius: var(--radius-md);
  display: inline-flex; align-items: center; justify-content: center;
  font-size: 2rem;
  box-shadow: 0 8px 32px rgba(99,102,241,0.4);
  margin-bottom: 1rem;
}
.login-logo h1 { font-size: 1.5rem; font-weight: 800; }
.login-logo p  { color: var(--text-secondary); font-size: .88rem; margin-top: .25rem; }
.alert-error {
  background: rgba(244,63,94,0.12);
  border: 1px solid rgba(244,63,94,0.3);
  color: #fb7185;
  border-radius: var(--radius-sm);
  padding: .75rem 1rem;
  font-size: .85rem;
  margin-bottom: 1.25rem;
}

/* ── Employee info panel ─────────────────────────────────── */
.emp-info-panel {
  display: flex; align-items: flex-start; gap: 1rem;
  background: var(--bg-glass); border: 1px solid var(--border);
  border-radius: var(--radius-md); padding: 1.1rem; margin-bottom: 1.25rem;
}
.emp-info-panel .emp-data { flex: 1; min-width: 0; }
.emp-info-panel .emp-data h2 { font-size: 1rem; font-weight: 700; }
.emp-info-panel .emp-meta { display: grid; grid-template-columns: 1fr 1fr; gap: .4rem .75rem; margin-top: .6rem; }
.emp-info-panel .meta-item { font-size: .8rem; }
.emp-info-panel .meta-item .meta-label { color: var(--text-muted); font-weight: 600; font-size: .7rem; text-transform: uppercase; }
.emp-info-panel .meta-item .meta-val   { color: var(--text-primary); font-weight: 500; word-break: break-all; }

/* ── Stats cards ─────────────────────────────────────────── */
.stats-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(130px, 1fr));
  gap: .75rem; margin-bottom: 1.5rem;
}
.stat-card {
  background: var(--bg-glass); border: 1px solid var(--border);
  border-radius: var(--radius-md); padding: 1rem 1.1rem;
  display: flex; flex-direction: column; gap: .25rem;
}
.stat-card .stat-value { font-size: 1.8rem; font-weight: 800; color: var(--text-primary); }
.stat-card .stat-label { font-size: .72rem; color: var(--text-muted); font-weight: 600; text-transform: uppercase; letter-spacing: .05em; }
.stat-card.ok   .stat-value { color: var(--accent-ok); }
.stat-card.ko   .stat-value { color: var(--accent-ko); }
.stat-card.pend .stat-value { color: var(--accent-pending); }

/* ── Modal ───────────────────────────────────────────────── */
.modal-overlay {
  position: fixed; inset: 0;
  background: rgba(0,0,0,0.65);
  backdrop-filter: blur(6px);
  z-index: 200;
  display: flex; align-items: flex-end; justify-content: center;
  padding: 0;
  opacity: 0; visibility: hidden;
  transition: opacity .3s ease, visibility .3s ease;
}
.modal-overlay.open { opacity: 1; visibility: visible; }
.modal {
  width: 100%; max-width: 560px;
  background: #141929;
  border: 1px solid var(--border);
  border-radius: var(--radius-xl) var(--radius-xl) 0 0;
  padding: 1.5rem 1.25rem;
  padding-bottom: calc(1.5rem + env(safe-area-inset-bottom));
  box-shadow: 0 -8px 40px rgba(0,0,0,0.6);
  max-height: 92dvh;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  transform: translateY(100%);
  transition: transform .3s cubic-bezier(.4,0,.2,1);
}
.modal-overlay.open .modal { transform: translateY(0); }
/* Drag handle */
.modal::before {
  content: '';
  display: block;
  width: 40px; height: 4px;
  background: rgba(255,255,255,0.15);
  border-radius: 2px;
  margin: 0 auto 1.25rem;
}
.modal-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 1.25rem; }
.modal-header h2 { font-size: 1.05rem; font-weight: 700; }
.modal-close {
  width: 36px; height: 36px; border-radius: 50%; border: none;
  background: var(--bg-glass); color: var(--text-secondary);
  cursor: pointer; font-size: 1rem;
  display: flex; align-items: center; justify-content: center;
  transition: var(--transition);
  flex-shrink: 0;
}
.modal-close:hover { background: var(--bg-glass-hover); color: var(--text-primary); }

/* ── Toast ───────────────────────────────────────────────── */
.toast-container {
  position: fixed; bottom: 1rem; right: 1rem; left: 1rem;
  z-index: 999; display: flex; flex-direction: column; gap: .6rem;
  pointer-events: none;
}
.toast {
  padding: .85rem 1.1rem; border-radius: var(--radius-md);
  font-size: .88rem; font-weight: 600;
  display: flex; align-items: center; gap: .6rem;
  animation: toastIn .3s ease forwards;
  backdrop-filter: blur(12px);
  pointer-events: auto;
  max-width: 100%;
}
.toast-success { background: rgba(16,185,129,0.18); border: 1px solid rgba(16,185,129,.3); color: #34d399; }
.toast-error   { background: rgba(244,63,94,0.18);  border: 1px solid rgba(244,63,94,.3);  color: #fb7185; }
.toast-info    { background: rgba(99,102,241,0.18); border: 1px solid rgba(99,102,241,.3); color: #a5b4fc; }
@keyframes toastIn { from { opacity: 0; transform: translateY(20px); } to { opacity: 1; transform: translateY(0); } }

/* ── Empty state ─────────────────────────────────────────── */
.empty-state { text-align: center; padding: 2.5rem 1rem; color: var(--text-muted); }
.empty-state .empty-icon { font-size: 2.5rem; margin-bottom: .75rem; opacity: .5; }
.empty-state p { font-size: .9rem; }

/* ── Filter chips ────────────────────────────────────────── */
.chips { display: flex; gap: .4rem; flex-wrap: wrap; margin-bottom: 1.25rem; }
.chip {
  padding: .4rem .9rem; border-radius: 999px;
  font-size: .78rem; font-weight: 600;
  cursor: pointer; border: 1px solid var(--border);
  background: var(--bg-glass); color: var(--text-secondary);
  transition: var(--transition); text-decoration: none; display: inline-block;
  min-height: var(--tap-min); display: inline-flex; align-items: center;
}
.chip:hover, .chip.active { background: var(--primary); color: #fff; border-color: var(--primary); }
.chip.active-ok   { background: rgba(16,185,129,.2); color: #34d399; border-color: rgba(16,185,129,.3); }
.chip.active-ko   { background: rgba(244,63,94,.2);  color: #fb7185; border-color: rgba(244,63,94,.3);  }
.chip.active-pend { background: rgba(245,158,11,.2); color: #fbbf24; border-color: rgba(245,158,11,.3); }

/* ── Utility ─────────────────────────────────────────────── */
.flex    { display: flex; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.gap-1 { gap: .5rem; }
.gap-2 { gap: 1rem; }
.mt-1 { margin-top: .5rem; }
.mt-2 { margin-top: 1rem; }
.mt-3 { margin-top: 1.5rem; }
.text-sm { font-size: .85rem; }
.text-muted { color: var(--text-muted); }
.fw-600 { font-weight: 600; }
.hidden { display: none !important; }
.flex-wrap { flex-wrap: wrap; }

/* ─────────────────────────────────────────────────────────
   RESPONSIVE — Tablet (≥640 px)
   ───────────────────────────────────────────────────────── */
@media (min-width: 640px) {
  .navbar { padding: 0 1.5rem; height: 64px; }
  .container { padding: 1.75rem 1.5rem; }
  .modal {
    align-self: center;
    border-radius: var(--radius-xl);
    max-width: 520px;
    padding: 2rem;
    transform: translateY(16px) scale(.97);
  }
  .modal::before { display: none; }
  .modal-overlay { align-items: center; padding: 1.5rem; }
  .modal-overlay.open .modal { transform: translateY(0) scale(1); }
  .toast-container { bottom: 1.5rem; right: 1.5rem; left: auto; max-width: 340px; }
  .page-header h1 { font-size: 1.7rem; }
  .staff-grid { grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); }
}

/* ─────────────────────────────────────────────────────────
   RESPONSIVE — Desktop (≥1024 px)
   ───────────────────────────────────────────────────────── */
@media (min-width: 1024px) {
  .navbar { padding: 0 2rem; }
  .container { padding: 2rem 1.5rem; }
}

/* ─────────────────────────────────────────────────────────
   RESPONSIVE — Mobile-only overrides (≤639 px)
   ───────────────────────────────────────────────────────── */
@media (max-width: 639px) {

  /* ── Navbar: hide user-info text, keep badge + logout ── */
  .navbar-user .user-info { display: none; }
  .btn-logout .logout-text { display: none; }
  .btn-logout .logout-icon { display: inline-flex; font-size: 1.1rem; }
  .btn-logout { width: 40px; height: 40px; min-height: 40px; padding: 0; justify-content: center; border-radius: 50%; }
  .btn-text-desktop { display: none; }
  .btn-text-mobile { display: inline; }

  /* ── Page header: stack on narrow screens ─────────────── */
  .page-header.flex { flex-direction: column; align-items: flex-start; gap: .75rem; }

  /* ── Container padding ────────────────────────────────── */
  .container { padding: 1rem .85rem; }

  /* ── Staff grid: single column (better readability) ───── */
  .staff-grid { grid-template-columns: 1fr; gap: .75rem; }
  .staff-card { padding: 1rem; flex-direction: column; gap: 0.75rem; }
  .staff-card-header { width: 100%; }
  .staff-name { font-size: 0.95rem; }
  .staff-detail { width: 100%; }
  .staff-card .btn-sm { width: 100%; justify-content: center; margin-top: 0.25rem; }

  /* ── Comparison: side-by-side on mobile for face review ─ */
  .compare-grid { grid-template-columns: 1fr 1fr; gap: 0.5rem; }
  .compare-panel { padding: 0.75rem; gap: 0.5rem; }
  .compare-photo { max-width: 100%; aspect-ratio: 1; object-fit: cover; border-radius: var(--radius-sm); }
  .compare-panel h3 { font-size: 0.75rem; line-height: 1.2; }
  .compare-panel p { font-size: 0.7rem; }

  /* ── Employee info panel: compact row on mobile ───────── */
  .emp-info-panel { flex-direction: row; align-items: center; text-align: left; padding: 0.75rem; gap: 0.75rem; }
  .emp-info-panel .emp-data h2 { font-size: 0.95rem; }
  .emp-info-panel .emp-meta { display: grid; grid-template-columns: 1fr 1fr; gap: 0.2rem 0.5rem; margin-top: 0.35rem; }
  .emp-info-panel .meta-item { font-size: 0.75rem; }
  .staff-avatar-large { width: 56px; height: 56px; }
  @media (max-width: 479px) {
    .emp-info-panel .emp-meta { grid-template-columns: 1fr 1fr; gap: 0.15rem 0.4rem; }
    .emp-info-panel .meta-item { font-size: 0.72rem; }
  }

  /* ── Stat cards: 2 per row, with 5th card spanning 2 cols ─ */
  .stats-row { grid-template-columns: repeat(2, 1fr); gap: .6rem; }
  .stat-card { padding: .85rem; }
  .stat-card .stat-value { font-size: 1.6rem; }
  .stats-row .stat-card:nth-child(5):last-child { grid-column: span 2; }

  /* ── Tabs: mobile compact sizes ────────────────────────── */
  .tabs { width: 100%; }
  .tab-btn { font-size: .78rem; padding: .55rem .6rem; }

  /* ── Modal & drop zone optimizations ── */
  .modal { padding: 1.25rem 1rem; }
  .modal::before { margin: 0 auto 0.75rem; }
  .file-drop-zone { padding: 1rem; }
  .file-drop-zone .drop-icon { font-size: 1.5rem; margin-bottom: 0.25rem; }
  .file-drop-zone .drop-text { font-size: 0.8rem; }
  .file-drop-zone .drop-hint { font-size: 0.7rem; }

  /* ── Modal form buttons: side-by-side and compact ────── */
  .modal-form-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 0.5rem; width: 100%; }
  .modal-form-actions .btn { width: 100%; justify-content: center; padding: 0.5rem 0.75rem; font-size: 0.8rem; min-height: 38px; }

  /* ── Admin users panel: remove fixed grid ─────────────── */
  .admin-users-grid { grid-template-columns: 1fr !important; }

  /* ── Validador comparison header ──────────────────────── */
  .compare-header { flex-direction: column; align-items: flex-start; gap: .75rem; }
  .compare-header .btn { align-self: stretch; justify-content: center; }

  /* ── Form 2-col grids collapse ────────────────────────── */
  .form-grid-2 { grid-template-columns: 1fr !important; }

  /* ── Accordion header text ────────────────────────────── */
  .accordion-juris-info { flex-direction: column; gap: .2rem; }

  /* ── Validator decision buttons ────────────────────────── */
  #form-validar .flex { display: grid; grid-template-columns: 1fr 1fr; gap: 0.75rem; width: 100%; }
  #form-validar .btn { width: 100%; justify-content: center; }

  /* ══════════════════════════════════════════════════════
     TABLE TO CARD CONVERSION FOR MOBILE OPERATION
     ══════════════════════════════════════════════════════ */
  .records-table,
  .records-table tbody,
  .records-table tr,
  .records-table td {
    display: block;
    width: 100%;
  }
  .records-table thead {
    display: none !important;
  }
  .records-table tr {
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: 1rem;
    margin-bottom: 0.75rem;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    box-shadow: var(--shadow-card);
    transition: var(--transition);
  }
  .records-table tr:hover {
    border-color: var(--border-hover);
    background: rgba(255, 255, 255, 0.04);
  }
  .records-table td {
    padding: 0.35rem 0 !important;
    border-bottom: none !important;
    display: flex;
    justify-content: space-between;
    align-items: center;
    text-align: right;
    font-size: 0.85rem;
    color: var(--text-primary);
  }
  .records-table td::before {
    content: attr(data-label);
    font-weight: 600;
    color: var(--text-secondary);
    font-size: 0.72rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    text-align: left;
    margin-right: 1rem;
    flex-shrink: 0;
  }
  /* First cell of card: treat as card header */
  .records-table td:first-child::before {
    display: none !important;
  }
  .records-table td:first-child {
    border-bottom: 1px solid var(--border) !important;
    padding-bottom: 0.6rem !important;
    margin-bottom: 0.25rem;
    display: block;
    text-align: left;
  }
  .records-table td:first-child .flex {
    justify-content: flex-start;
    text-align: left;
  }
  .records-table td:first-child .td-name {
    font-size: 0.95rem;
    font-weight: 700;
  }

  /* Actions footer wrapper */
  .tbl-op-list td:last-child,
  .tbl-val-list td:last-child,
  .tbl-admin-reg td:last-child,
  .tbl-admin-usr td:last-child {
    border-top: 1px solid var(--border) !important;
    padding-top: 0.6rem !important;
    margin-top: 0.25rem;
    display: block;
  }
  .tbl-op-list td:last-child::before,
  .tbl-val-list td:last-child::before,
  .tbl-admin-reg td:last-child::before,
  .tbl-admin-usr td:last-child::before {
    display: none !important;
  }
  .tbl-op-list td:last-child .btn,
  .tbl-val-list td:last-child .btn,
  .tbl-admin-reg td:last-child .btn,
  .tbl-admin-usr td:last-child .btn,
  .tbl-op-list td:last-child form,
  .tbl-val-list td:last-child form,
  .tbl-admin-reg td:last-child form,
  .tbl-admin-usr td:last-child form {
    width: 100%;
  }
  .tbl-op-list td:last-child .btn,
  .tbl-val-list td:last-child .btn,
  .tbl-admin-reg td:last-child .btn,
  .tbl-admin-usr td:last-child .btn {
    justify-content: center;
  }
  .tbl-admin-usr td:last-child .flex {
    flex-direction: column;
    gap: 0.35rem;
  }
}
