:root {
  /* Paleta SENA (alineada con guardian-amazonia) */
  --sena-green: hsl(145, 60%, 38%);       /* #1F9151 */
  --sena-dark: hsl(155, 65%, 28%);        /* verde SENA profundo */
  --sena-light: hsl(145, 45%, 90%);       /* tinte muy claro */
  --sena-primary-light: hsl(145, 55%, 46%);
  --sena-accent: hsl(30, 100%, 50%);      /* naranja SENA */

  /* Sidebar */
  --sidebar-bg: hsl(145, 35%, 93%);
  --sidebar-fg: hsl(145, 50%, 22%);
  --sidebar-accent: hsl(145, 50%, 87%);
  --sidebar-accent-fg: hsl(145, 55%, 18%);
  --sidebar-border: hsl(145, 30%, 78%);

  /* Superficies genéricas */
  --page-bg: #f1f3f6;
  --surface: #fff;
  --surface-alt: #fafafa;
  --text-strong: #1a202c;
  --text-muted: #64748b;
  --border-soft: #e2e8f0;

  --sidebar-width: 240px;
  --header-height: 56px;
}

:root[data-theme="dark"] {
  --sena-green: hsl(145, 55%, 55%);
  --sena-dark: hsl(155, 50%, 24%);
  --sena-light: hsl(145, 15%, 25%);
  --sena-primary-light: hsl(145, 55%, 55%);
  --sena-accent: hsl(30, 80%, 60%);

  --sidebar-bg: hsl(145, 12%, 10%);
  --sidebar-fg: hsl(145, 15%, 80%);
  --sidebar-accent: hsl(145, 15%, 20%);
  --sidebar-accent-fg: hsl(145, 20%, 90%);
  --sidebar-border: hsl(145, 10%, 22%);

  --page-bg: #1a211d;
  --surface: #1e2621;
  --surface-alt: #2a332e;
  --text-strong: #e8edea;
  --text-muted: #90a89c;
  --border-soft: #3d4a43;
}

* { box-sizing: border-box; }
body { margin: 0; font-family: 'Segoe UI', system-ui, sans-serif; background: var(--page-bg); color: var(--text-strong); overflow-x: hidden; transition: background-color .2s, color .2s; }

/* ---- Modo oscuro: ajustes de componentes Bootstrap ---- */
:root[data-theme="dark"] .modal-content { background: var(--surface); color: var(--text-strong); }
:root[data-theme="dark"] .modal-header,
:root[data-theme="dark"] .modal-footer { border-color: var(--border-soft); }
:root[data-theme="dark"] .btn-close { filter: invert(1) grayscale(100%) brightness(200%); }
:root[data-theme="dark"] .form-control,
:root[data-theme="dark"] .form-select {
  background-color: var(--surface); color: var(--text-strong); border-color: var(--border-soft);
}
:root[data-theme="dark"] .form-control:focus,
:root[data-theme="dark"] .form-select:focus { background-color: var(--surface); color: var(--text-strong); }
:root[data-theme="dark"] .form-control::placeholder { color: var(--text-muted); }
:root[data-theme="dark"] .form-control:disabled,
:root[data-theme="dark"] .form-select:disabled { background-color: var(--surface-alt); }
:root[data-theme="dark"] .input-group-text { background-color: var(--surface-alt); color: var(--text-muted); border-color: var(--border-soft); }
:root[data-theme="dark"] .dropdown-menu { background-color: var(--surface); color: var(--text-strong); border-color: var(--border-soft); }
:root[data-theme="dark"] .dropdown-item { color: var(--text-strong); }
:root[data-theme="dark"] .dropdown-item:hover,
:root[data-theme="dark"] .dropdown-item:focus { background-color: var(--surface-alt); color: var(--text-strong); }
:root[data-theme="dark"] .text-muted { color: var(--text-muted) !important; }
:root[data-theme="dark"] .table { color: var(--text-strong); }
:root[data-theme="dark"] .table > :not(caption) > * > * { background-color: var(--surface); color: var(--text-strong); border-bottom-color: var(--border-soft); }
:root[data-theme="dark"] .card { background-color: var(--surface); color: var(--text-strong); }
:root[data-theme="dark"] hr { border-color: var(--border-soft); }

/* ---- LOGIN ---- */
#login-screen {
  min-height: 100vh;
  background: linear-gradient(135deg, var(--sena-dark) 0%, #2e7d32 50%, #1b5e20 100%);
  display: flex; align-items: center; justify-content: center; padding: 20px;
}
.login-card {
  background: var(--surface); border-radius: 16px; padding: 40px 36px; width: 100%; max-width: 380px;
  box-shadow: 0 20px 60px rgba(0,0,0,.4);
}
.login-logo { text-align: center; margin-bottom: 28px; }
.login-sena-logo { width: 200px; height: auto; display: block; margin: 0 auto; }
.login-centa-brand { font-size: 34px; font-weight: 900; color: var(--sena-dark); letter-spacing: 4px; line-height: 1; }
.login-centa-mod { font-size: 12px; color: #888; letter-spacing: 2px; text-transform: uppercase; margin: 5px 0 0; }

/* ---- APP LAYOUT ---- */
#app-screen { display: flex; min-height: 100vh; }

/* Sidebar */
#sidebar {
  width: var(--sidebar-width); height: 100vh; background: var(--sidebar-bg);
  display: flex; flex-direction: column; position: fixed; top: 0; left: 0; z-index: 100;
  transition: transform .25s ease, background-color .2s;
  /* Sin border-right: cruzaría toda la altura, incluida la franja oscura del
     logo, y crearía una línea visible justo donde debe empalmar con el topbar. */
}
#sidebar.collapsed { transform: translateX(calc(-1 * var(--sidebar-width))); }
/* Franja oscura del logo — se mantiene oscura a propósito para que el logo
   blanco de CENTA (sin cambiar de archivo ni de lugar) siga siendo legible
   aunque el resto del sidebar pase a un verde claro. */
.sidebar-header {
  /* Fondo sólido (no degradado) — el logo blanco necesita contraste parejo
     en toda su superficie, un degradado lo apaga en la zona más clara. */
  background: var(--sena-dark);
  /* Altura EXACTA (no min-height) igual a #topbar — con padding vertical de
     16px + logo de 38px daba 70px real vs. los 56px del topbar, y por eso
     no coincidían en la esquina. Centrado vertical vía flex, sin padding-y. */
  height: var(--header-height);
  padding: 0 16px; display: flex; align-items: center; gap: 10px;
}
.sidebar-brand-wrap { display: flex; align-items: center; }
.sidebar-sena-logo  { height: 38px; width: auto; max-width: 160px; }
.sidebar-brand { font-size: 20px; font-weight: 900; color: var(--surface); letter-spacing: 3px; line-height: 1.1; }
.sidebar-sub { font-size: 10px; color: rgba(255,255,255,.55); margin-top: 1px; letter-spacing: 1px; }
.sidebar-user .user-name { color: var(--sidebar-fg); font-size: 13px; font-weight: 700; }
.sidebar-user .user-role { font-size: 11px; color: var(--sidebar-fg); opacity: .65; margin-top: 2px; }
.role-badge {
  display: inline-block; font-size: 10px; padding: 2px 8px; border-radius: 20px;
  font-weight: 700; text-transform: uppercase; letter-spacing: .5px;
}
.role-admin { background: #8e24aa; color: var(--surface); }
.role-coordinador { background: #1565c0; color: var(--surface); }
.role-apoyo { background: #0369a1; color: var(--surface); }
.role-instructor { background: #2e7d32; color: var(--surface); }
.role-aprendiz { background: #374151; color: var(--surface); }
.role-vigilante { background: #bf360c; color: var(--surface); }
.role-carnetizacion { background: #6d28d9; color: var(--surface); }

nav#sidebar-nav { flex: 1; padding: 10px 8px; overflow-y: auto; }
.nav-item {
  display: flex; align-items: center; gap: 12px; padding: 10px 12px; cursor: pointer;
  color: var(--sidebar-fg); font-size: 13.5px; font-weight: 500; border: none;
  background: none; width: 100%; text-align: left; transition: all .15s;
  border-radius: 10px; margin-bottom: 2px; opacity: .8;
}
.nav-item:hover { background: var(--sidebar-accent); color: var(--sidebar-accent-fg); opacity: 1; }
.nav-item.active {
  background: linear-gradient(135deg, var(--sena-primary-light) 0%, var(--sena-green) 45%, var(--sena-dark) 100%);
  color: #fff; font-weight: 700; opacity: 1;
  box-shadow: 0 2px 8px rgba(0,0,0,.15);
}
.nav-item i { font-size: 16px; width: 20px; text-align: center; }
.nav-divider { height: 1px; background: var(--sidebar-border); margin: 6px 8px; }

.sidebar-footer { padding: 14px 16px; border-top: 1px solid var(--sidebar-border); }

/* Main content */
#main-content {
  margin-left: var(--sidebar-width); flex: 1; display: flex; flex-direction: column;
  transition: margin-left .25s ease;
}
#main-content.expanded { margin-left: 0; }

/* Top bar — franja verde SENA, igual que el banner de guardian-amazonia */
#topbar {
  /* Mismo verde sólido que .sidebar-header — deben empalmar sin costura donde se tocan. */
  background: var(--sena-dark);
  height: var(--header-height); display: flex; align-items: center;
  padding: 0 20px; gap: 12px; position: sticky; top: 0; z-index: 99;
  box-shadow: 0 1px 6px rgba(0,0,0,.15);
}
#topbar h1 { font-size: 17px; font-weight: 700; color: #fff; margin: 0; flex: 1; }
.notif-btn { position: relative; background: none; border: none; cursor: pointer; color: rgba(255,255,255,.85); font-size: 20px; padding: 6px; border-radius: 8px; transition: background .15s; }
.notif-btn:hover { background: rgba(255,255,255,.12); color: #fff; }
.theme-toggle-btn {
  background: rgba(255,255,255,.12); border: 1px solid rgba(255,255,255,.25); color: #fff;
  width: 32px; height: 32px; border-radius: 50%; display: flex; align-items: center; justify-content: center;
  cursor: pointer; font-size: 15px; transition: background .15s;
}
.theme-toggle-btn:hover { background: rgba(255,255,255,.22); }
.notif-count {
  position: absolute; top: 2px; right: 2px; background: #e53e3e; color: var(--surface);
  font-size: 10px; font-weight: 700; width: 16px; height: 16px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
}

/* Content area */
#content-area { padding: 24px; flex: 1; }
.view { display: none; }
.view.active { display: block; }

/* ---- Saludo del dashboard ---- */
.dashboard-greeting {
  background: linear-gradient(135deg, var(--sena-primary-light) 0%, var(--sena-green) 45%, var(--sena-dark) 100%);
  color: #fff; border-radius: 16px; padding: 22px 26px; box-shadow: 0 4px 16px rgba(0,0,0,.12);
}
.dashboard-greeting-title { font-size: 24px; font-weight: 800; margin-bottom: 6px; }
.dashboard-greeting-sub { font-size: 14px; color: rgba(255,255,255,.85); }

/* ---- STAT CARDS ---- */
.stat-card {
  background: var(--surface); border-radius: 12px; padding: 20px 24px;
  border-left: 4px solid var(--sena-green);
  box-shadow: 0 1px 6px rgba(0,0,0,.07); transition: transform .15s, box-shadow .15s;
}
.stat-card:hover { transform: translateY(-2px); box-shadow: 0 4px 14px rgba(0,0,0,.1); }
.stat-card .stat-value { font-size: 32px; font-weight: 900; color: var(--text-strong); line-height: 1; }
.stat-card .stat-label { font-size: 12px; color: var(--text-muted); margin-top: 6px; font-weight: 600; text-transform: uppercase; letter-spacing: .5px; }
.stat-card .stat-icon { font-size: 28px; opacity: .25; }

/* ---- TABLES ---- */
.table-card { background: var(--surface); border-radius: 12px; box-shadow: 0 1px 6px rgba(0,0,0,.07); overflow: hidden; }
.table-card .table-header { padding: 16px 20px; border-bottom: 1px solid #f0f0f0; display: flex; align-items: center; gap: 12px; }
.table-card .table-header h5 { margin: 0; font-size: 15px; font-weight: 700; color: var(--text-strong); }
.table { margin: 0; }
.table th { font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: .5px; color: var(--text-muted); background: var(--surface-alt); border-top: none; }
.table td { vertical-align: middle; font-size: 13.5px; }

/* ---- SCANNER STATUS BAR ---- */
.scanner-status-bar {
  display: flex; align-items: center; gap: 10px;
  background: var(--surface); border-radius: 12px; padding: 12px 16px;
  box-shadow: 0 1px 6px rgba(0,0,0,.07); border: 1px solid var(--border-soft);
}
.scanner-dot {
  width: 14px; height: 14px; border-radius: 50%; flex-shrink: 0;
  background: var(--sena-green); transition: background .3s, box-shadow .3s;
}
@keyframes statusPulse {
  from { box-shadow: 0 0 0 0 currentColor; }
  to   { box-shadow: 0 0 0 6px transparent; }
}
.scanner-status-label { font-size: 14px; font-weight: 700; transition: color .3s; }
.scanner-hint { font-size: 11px; color: #94a3b8; }

/* ---- Indicadores de semáforo: conexión / cámara / lector ---- */
.k-status-dots { display: flex; align-items: center; gap: 14px; }
.k-status-item { display: flex; align-items: center; gap: 5px; font-size: 11px; font-weight: 600; color: #94a3b8; }
.k-status-dot { width: 9px; height: 9px; border-radius: 50%; background: #cbd5e1; flex-shrink: 0; transition: background .2s; }
.k-status-dot.ok  { background: #22c55e; box-shadow: 0 0 5px #22c55e; }
.k-status-dot.bad { background: #ef4444; }

/* ---- SCANNER INPUT ---- */
.scanner-input-wrap {
  background: var(--surface); border-radius: 12px; padding: 14px 16px;
  border: 2px solid var(--sena-green); box-shadow: 0 0 0 3px #39A90015;
}
.scanner-input-label { font-size: 13px; color: #374151; }
.scanner-input {
  font-family: 'Courier New', monospace; font-size: 14px; letter-spacing: 1px;
  border-color: var(--border-soft) !important;
}
.scanner-input:focus {
  border-color: var(--sena-green) !important;
  box-shadow: none !important;
}
.scanner-focus-hint {
  font-size: 11px; color: #94a3b8; margin-top: 6px; text-align: center;
  padding: 4px; border-radius: 6px; transition: background .15s;
}
.scanner-focus-hint:hover { background: #f0fdf4; color: var(--sena-dark); }

/* ---- GUARD VIEW ---- */
.scan-result-box {
  min-height: 200px; border-radius: 16px; padding: 30px; text-align: center;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 10px;
  transition: all .3s ease;
}
.scan-result-box.idle { background: #f8fafc; border: 2px dashed #cbd5e0; }
.scan-result-box.ok { background: #f0fdf4; border: 2px solid #16a34a; }
.scan-result-box.bloqueado { background: #fef2f2; border: 2px solid #dc2626; }
.scan-result-box.advertencia { background: #fffbeb; border: 2px solid #d97706; }
.scan-result-icon { font-size: 64px; line-height: 1; }
.scan-result-name { font-size: 26px; font-weight: 900; color: var(--text-strong); }
.scan-result-sub { font-size: 15px; color: #475569; }
.scan-type-badge { font-size: 13px; font-weight: 700; padding: 4px 14px; border-radius: 20px; display: inline-block; }
.badge-entrada { background: #dcfce7; color: #15803d; }
.badge-salida { background: #dbeafe; color: #1d4ed8; }
.badge-bloqueado { background: #fee2e2; color: #b91c1c; }

.scanner-box { background: #000; border-radius: 12px; overflow: hidden; min-height: 280px; position: relative; display: flex; align-items: center; justify-content: center; }
.scanner-box #reader { width: 100% !important; height: 100% !important; position: absolute !important; inset: 0; }
.scanner-box #reader video { width: 100% !important; height: 100% !important; object-fit: cover !important; border-radius: 0 !important; transform: scaleX(-1); }
.scanner-overlay { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; color: rgba(255,255,255,.7); pointer-events: none; gap: 8px; }

/* ---- REQUESTS — formulario (instructor) ---- */
.solicitud-form-card {
  background: var(--surface); border-radius: 14px;
  box-shadow: 0 2px 12px rgba(0,0,0,.07);
  overflow: hidden; height: 100%;
}
.solicitud-form-header {
  display: flex; align-items: center; gap: 14px;
  padding: 16px 20px; color: var(--surface);
}
.solicitud-form-header.green  { background: linear-gradient(135deg, #2e7d32, #39A900); }
.solicitud-form-header.amber  { background: linear-gradient(135deg, #b45309, #d97706); }
.solicitud-form-header-icon {
  font-size: 28px; flex-shrink: 0;
  background: rgba(255,255,255,.18); border-radius: 10px;
  width: 48px; height: 48px; display: flex; align-items: center; justify-content: center;
}
.solicitud-form-body { padding: 20px; }
.solicitud-label {
  display: block; font-size: 12px; font-weight: 600;
  color: #374151; margin-bottom: 6px; text-transform: uppercase; letter-spacing: .4px;
}
.solicitud-selected-name {
  font-size: 13px; font-weight: 600; color: var(--sena-green);
}
.solicitud-submit-btn {
  width: 100%; font-weight: 700; padding: 10px; border: none; color: var(--surface);
}
.solicitud-submit-btn.green { background: var(--sena-green); }
.solicitud-submit-btn.green:hover { background: #2e7d32; }
.solicitud-submit-btn.amber { background: #d97706; }
.solicitud-submit-btn.amber:hover { background: #b45309; }

/* Resultados de búsqueda de aprendiz */
.apprentice-results-list { margin-top: 4px; border-radius: 8px; overflow: hidden; border: 1px solid var(--border-soft); }
.apprentice-result-item {
  padding: 8px 12px; cursor: pointer; background: var(--surface);
  border-bottom: 1px solid #f1f5f9; transition: background .15s;
  display: flex; align-items: center;
}
.apprentice-result-item:last-child { border-bottom: none; }
.apprentice-result-item:hover { background: #f0fdf4; }

/* Historial header */
.solicitudes-historial-wrap { }
.solicitudes-historial-titulo {
  display: flex; align-items: center; gap: 8px;
  font-size: 14px; font-weight: 700; color: #374151;
  padding-bottom: 12px; border-bottom: 2px solid var(--border-soft);
}

/* ---- REQUESTS — tarjetas de historial ---- */
.req-card {
  display: flex; background: var(--surface); border-radius: 12px;
  box-shadow: 0 1px 6px rgba(0,0,0,.06); margin-bottom: 10px;
  overflow: hidden; transition: box-shadow .2s;
}
.req-card:hover { box-shadow: 0 3px 14px rgba(0,0,0,.1); }
.req-card-expirado { opacity: .65; }
.req-card-stripe { width: 5px; flex-shrink: 0; }
.req-card-stripe.green { background: var(--sena-green); }
.req-card-stripe.amber { background: #d97706; }
.req-card-body { flex: 1; padding: 14px 16px; }
.req-card-top { display: flex; align-items: flex-start; gap: 12px; margin-bottom: 10px; }
.req-card-icon {
  width: 38px; height: 38px; border-radius: 10px; flex-shrink: 0;
  display: flex; align-items: center; justify-content: center; font-size: 18px;
}
.req-card-icon.green { background: #d1fae5; color: #065f46; }
.req-card-icon.amber { background: #fef3c7; color: #b45309; }
.req-card-info { flex: 1; min-width: 0; }
.req-card-persona { font-weight: 700; font-size: 14px; color: #111827; }
.req-card-meta { font-size: 12px; color: var(--text-muted); display: flex; flex-wrap: wrap; gap: 0 4px; margin-top: 2px; }
.req-sep { color: #cbd5e0; }
.req-card-estado { text-align: right; flex-shrink: 0; }
.req-card-fecha { font-size: 11px; color: #94a3b8; margin-top: 4px; white-space: nowrap; }
.req-estado-pill {
  font-size: 11px; font-weight: 700; padding: 3px 10px; border-radius: 20px; white-space: nowrap;
}
.req-estado-pendiente { background: #fef3c7; color: #b45309; }
.req-estado-aprobado  { background: #d1fae5; color: #065f46; }
.req-estado-rechazado { background: #fee2e2; color: #991b1b; }
.req-estado-expirado  { background: #f1f5f9; color: #94a3b8; }
.req-estado-usado     { background: #ede9fe; color: #5b21b6; }
.req-card-motivo {
  font-size: 13px; color: #374151;
  background: #f8fafc; border-radius: 8px; padding: 8px 12px; margin-bottom: 8px;
}
.req-card-footer {
  display: flex; flex-wrap: wrap; gap: 6px 16px;
  font-size: 12px; color: var(--text-muted);
}
.req-card-actions { margin-top: 10px; }
.req-btn-gestionar {
  background: #10b981; color: var(--surface); font-weight: 700; border: none;
  padding: 6px 18px; border-radius: 8px;
}
.req-btn-gestionar:hover { background: #059669; color: var(--surface); }

/* legado — mantener para modal de revisión */
.estado-badge { font-size: 11px; font-weight: 700; padding: 3px 10px; border-radius: 20px; }
.estado-pendiente { background: #fef3c7; color: #b45309; }
.estado-aprobado  { background: #d1fae5; color: #065f46; }
.estado-rechazado { background: #fee2e2; color: #991b1b; }
.estado-expirado  { background: #f1f5f9; color: #94a3b8; }
.estado-usado     { background: #ede9fe; color: #5b21b6; }

/* ---- UPLOAD ---- */
.drop-zone {
  border: 2px dashed #94a3b8; border-radius: 12px; padding: 40px; text-align: center;
  cursor: pointer; transition: all .2s; background: var(--surface-alt);
}
.drop-zone.dragover { border-color: var(--sena-green); background: var(--sena-light); }
.drop-zone i { font-size: 40px; color: #94a3b8; margin-bottom: 10px; display: block; }

/* ---- TOAST ---- */
#toast-container { position: fixed; top: 70px; right: 16px; z-index: 9999; display: flex; flex-direction: column; gap: 8px; }
.toast-item {
  background: #1e293b; color: var(--surface); padding: 12px 16px; border-radius: 10px;
  font-size: 13px; max-width: 300px; animation: slideIn .3s ease;
  border-left: 4px solid var(--sena-green); box-shadow: 0 4px 12px rgba(0,0,0,.2);
}
.toast-item.error { border-left-color: #ef4444; }
.toast-item.warning { border-left-color: #f59e0b; }
@keyframes slideIn { from { transform: translateX(120%); opacity: 0; } to { transform: translateX(0); opacity: 1; } }

/* ---- MISC ---- */
.page-title { font-size: 22px; font-weight: 800; color: var(--text-strong); margin-bottom: 20px; }
.search-box { position: relative; }
.search-box input { padding-left: 36px; }
.search-box i { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); color: #94a3b8; }
.action-btn { border: none; background: none; cursor: pointer; padding: 4px 8px; border-radius: 6px; font-size: 15px; transition: background .15s; }
.action-btn:hover { background: #f1f5f9; }
.empty-state { text-align: center; padding: 40px; color: #94a3b8; }
.empty-state i { font-size: 40px; margin-bottom: 10px; display: block; }

/* Notification panel */
#notif-panel {
  position: fixed; top: var(--header-height); right: 0; width: 320px; max-height: 80vh;
  background: var(--surface); box-shadow: -4px 0 20px rgba(0,0,0,.15); border-radius: 12px 0 0 12px;
  overflow-y: auto; z-index: 200; transform: translateX(100%); transition: transform .25s ease;
}
#notif-panel.open { transform: translateX(0); }
.notif-item { padding: 12px 16px; border-bottom: 1px solid #f0f0f0; cursor: pointer; }
.notif-item:hover { background: #f8fafc; }
.notif-item.unread { background: #f0fdf4; }
.notif-item .notif-title { font-size: 13px; font-weight: 700; color: var(--text-strong); }
.notif-item .notif-body { font-size: 12px; color: var(--text-muted); margin-top: 3px; }
.notif-item .notif-time { font-size: 11px; color: #94a3b8; margin-top: 4px; }

/* ---- RESPONSIVE ---- */

/* Tablet landscape (1025px–1280px): sidebar más compacto */
@media (max-width: 1280px) and (min-width: 769px) {
  :root { --sidebar-width: 200px; }
}

/* Tablet portrait e inferiores (≤768px): sidebar off-canvas */
@media (max-width: 768px) {
  #sidebar { transform: translateX(calc(-1 * var(--sidebar-width))); }
  #sidebar.open { transform: translateX(0); }
  #main-content { margin-left: 0 !important; }
  #content-area { padding: 14px 12px; }
  .stat-card .stat-value { font-size: 24px; }
  .stat-card { padding: 14px 16px; }
  #topbar { padding: 0 12px; gap: 8px; }
  #topbar h1 { font-size: 15px; }
  /* En móvil mostrar solo el icono del badge de conexión */
  .conn-badge .conn-text { display: none; }
  /* Carné: ajustar para pantallas pequeñas */
  .carne-qr-img { width: 190px; height: 190px; }
  .carne-qr-placeholder { width: 190px; height: 190px; }
  .carne-mobile-card { border-radius: 14px; }
  .carne-photo { width: 80px; height: 98px; }
  .carne-photo-col { width: 100px; padding: 14px 0 14px 14px; }
}

/* Teléfonos muy pequeños (≤390px) */
@media (max-width: 390px) {
  #content-area { padding: 10px 8px; }
  .carne-qr-img { width: 170px; height: 170px; }
  .carne-qr-placeholder { width: 170px; height: 170px; }
  .carne-user-name { font-size: 13px; }
  .carne-photo { width: 72px; height: 88px; }
  .carne-photo-initials { font-size: 22px; }
  .table td, .table th { font-size: 12px; padding: 6px 8px; }
}

/* ---- MI CARNÉ (PWA Offline view) ---- */
.mi-carne-page {
  display: flex; justify-content: center; padding: 0 0 32px;
  min-height: calc(100vh - var(--header-height) - 48px);
}

/* ── Card wrapper ───────────────────────────────── */
.carne-mobile-card {
  background: var(--surface); border-radius: 20px; overflow: hidden;
  box-shadow: 0 8px 40px rgba(0,0,0,.18); width: 100%; max-width: 360px;
}

/* ── Header: SENA brand ─────────────────────────── */
.carne-mobile-header {
  padding: 12px 18px; color: var(--surface);
  display: flex; align-items: center; gap: 12px;
}
.carne-logo-img         { height: 36px; width: auto; flex-shrink: 0; }
.carne-mobile-brand     { font-size: 22px; font-weight: 900; letter-spacing: 4px; line-height: 1; }
.carne-mobile-brand-sub { font-size: 10px; opacity: .8; margin-top: 3px; letter-spacing: 1px; text-transform: uppercase; }
.carne-header-divider   { width: 1px; height: 34px; background: rgba(255,255,255,.3); flex-shrink: 0; }

/* ── Identity strip: photo + info side by side ──── */
.carne-identity {
  display: flex; align-items: stretch; gap: 0;
  border-bottom: 1px solid #f0f0f0;
}
.carne-photo-col {
  flex-shrink: 0; width: 110px;
  display: flex; align-items: center; justify-content: center;
  padding: 18px 0 18px 18px;
}
.carne-photo {
  width: 90px; height: 110px; border-radius: 10px;
  overflow: hidden; border: 3px solid var(--border-soft);
  display: flex; align-items: center; justify-content: center;
  background: #f1f5f9; flex-shrink: 0;
}
.carne-photo img { width: 100%; height: 100%; object-fit: cover; }
.carne-photo-initials {
  font-size: 26px; font-weight: 900; color: var(--text-muted);
  letter-spacing: -1px; text-transform: uppercase;
}
.carne-info-col {
  flex: 1; padding: 18px 18px 18px 14px;
  display: flex; flex-direction: column; justify-content: center; gap: 6px;
}
.carne-user-name {
  font-size: 15px; font-weight: 900; color: var(--text-strong); text-transform: uppercase;
  line-height: 1.25;
}
.carne-role-badge {
  display: inline-block; color: var(--surface); font-size: 10px; font-weight: 800;
  padding: 3px 12px; border-radius: 20px; letter-spacing: 1px; text-transform: uppercase;
  align-self: flex-start;
}
.carne-user-doc { font-size: 13px; color: #475569; }
.carne-doc-type { font-weight: 700; margin-right: 3px; }
.carne-doc-num  { font-family: 'Courier New', monospace; letter-spacing: .5px; }
.carne-ficha    { font-size: 12px; color: var(--text-muted); }

/* ── QR section ─────────────────────────────────── */
.carne-qr-wrapper {
  background: #f8fafb; padding: 22px 20px 16px;
  display: flex; justify-content: center;
}
.carne-qr-frame {
  background: var(--surface); padding: 10px; border-radius: 14px;
  box-shadow: 0 2px 16px rgba(0,0,0,.1); display: inline-block;
}
.carne-qr-img {
  display: block; width: 220px; height: 220px;
  image-rendering: pixelated;
}
.carne-qr-placeholder {
  width: 220px; height: 220px; display: flex; flex-direction: column;
  align-items: center; justify-content: center; border: 2px dashed #cbd5e0;
  border-radius: 12px; text-align: center;
}

/* ── Footer ─────────────────────────────────────── */
.carne-mobile-footer {
  display: flex; justify-content: space-between; align-items: center;
  padding: 10px 20px; border-top: 2px solid transparent; background: var(--surface-alt);
}

/* ── Actions below card ─────────────────────────── */
.carne-actions {
  display: flex; gap: 10px; flex-wrap: wrap; justify-content: center;
  padding: 20px 0 8px; width: 100%; max-width: 360px;
}
.carne-action-btn {
  flex: 1; min-width: 100px; background: var(--surface); border: 1.5px solid var(--border-soft);
  color: #374151; font-size: 13px; font-weight: 600; padding: 10px 12px;
  border-radius: 10px; transition: all .15s; cursor: pointer;
}
.carne-action-btn:hover { background: var(--sena-light); border-color: var(--sena-green); color: var(--sena-dark); }

/* ── Instructions ───────────────────────────────── */
.carne-instructions {
  width: 100%; max-width: 360px; background: #f0fdf4; border: 1px solid #bbf7d0;
  border-radius: 10px; padding: 12px 16px; font-size: 13px; color: #166534;
  text-align: center; line-height: 1.5;
}

/* ── Empty state ────────────────────────────────── */
.carne-empty {
  text-align: center; padding: 60px 24px;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  min-height: 300px;
}

/* PWA install highlight on nav */
.carne-nav-btn { border-top: 1px solid rgba(57,169,0,.2) !important; }

/* Connection badge in topbar */
.conn-badge {
  display: inline-flex; align-items: center; gap: 5px;
  font-size: 11px; font-weight: 700; padding: 3px 10px;
  border-radius: 20px; letter-spacing: .3px;
}
.conn-badge.online { background: #dcfce7; color: #15803d; }
.conn-badge.offline { background: #fef9c3; color: #a16207; }

.kiosco-btn {
  background: rgba(255,255,255,.12) !important; border: 1px solid rgba(255,255,255,.25) !important;
  color: #fff !important; border-radius: 8px;
}
.kiosco-btn:hover { background: rgba(255,255,255,.22) !important; }


/* ---- Print hide ---- */
@media print { #sidebar, #topbar, .no-print { display: none !important; } #main-content { margin: 0; } }

/* Scrollbar */
::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: rgba(0,0,0,.2); border-radius: 3px; }

/* ---- Visitas: tab bar ---- */
.vt-tab-bar {
  display: flex;
  gap: 8px;
  background: var(--surface);
  border: 1px solid var(--border-soft);
  border-radius: 12px;
  padding: 6px;
}
.vt-tab-btn {
  flex: 1;
  display: flex; align-items: center; justify-content: center; gap: 7px;
  padding: 9px 16px;
  border: none; border-radius: 8px;
  background: transparent;
  color: var(--text-muted);
  font-size: 13px; font-weight: 600;
  cursor: pointer;
  transition: background .15s, color .15s;
  white-space: nowrap;
}
.vt-tab-btn i { font-size: 15px; }
.vt-tab-btn:hover { background: #f8fafc; color: #334155; }
.vt-tab-btn.active {
  background: #8b5cf6;
  color: var(--surface);
  box-shadow: 0 2px 8px rgba(139,92,246,.3);
}
.vt-tab-badge {
  background: rgba(255,255,255,.3);
  color: var(--surface);
  border-radius: 20px;
  font-size: 11px; font-weight: 700;
  padding: 1px 7px;
  min-width: 22px; text-align: center;
}
.vt-tab-btn:not(.active) .vt-tab-badge {
  background: #8b5cf6;
  color: var(--surface);
}

/* ---- Attendance filters card ---- */
.att-filters-card {
  background: var(--surface);
  border: 1px solid var(--border-soft);
  border-radius: 12px;
  padding: 14px 16px;
}

/* ---- Ficha tag (inline badge) ---- */
.ficha-tag {
  display: inline-block;
  background: #eff6ff;
  color: #1d4ed8;
  border: 1px solid #bfdbfe;
  border-radius: 6px;
  font-size: 11px; font-weight: 700;
  padding: 1px 7px;
  font-family: monospace; letter-spacing: .5px;
}

/* ---- Auth mode tabs (guard view) ---- */
.auth-mode-tabs {
  display: flex; gap: 6px; flex-wrap: wrap;
}
.auth-mode-btn {
  flex: 1; min-width: 120px;
  padding: 8px 12px;
  border: 2px solid var(--border-soft);
  border-radius: 8px;
  background: var(--surface);
  color: var(--text-muted);
  font-size: 13px; font-weight: 600;
  cursor: pointer;
  transition: border-color .15s, background .15s, color .15s;
  display: flex; align-items: center; justify-content: center; gap: 6px;
}
.auth-mode-btn:hover {
  border-color: var(--sena-green);
  color: var(--sena-green);
}
.auth-mode-btn.active {
  border-color: var(--sena-green);
  background: var(--sena-light);
  color: var(--sena-green);
}
.auth-mode-btn[data-mode="documento"].active {
  border-color: #f59e0b;
  background: #fffbeb;
  color: #b45309;
}

/* ---- Auth mode: vehículo tab active color ---- */
.auth-mode-btn[data-mode="vehiculo"].active {
  border-color: #8b5cf6;
  background: #f5f3ff;
  color: #6d28d9;
}
/* ---- Vehicle owner card (guard view) ---- */
.vehiculo-owner-card {
  background: var(--surface);
  border: 1px solid var(--border-soft);
  border-radius: 12px;
  padding: 14px;
  margin-top: 10px;
}
.vehiculo-owner-card .owner-header {
  display: flex; align-items: center; gap: 12px; margin-bottom: 12px;
}
.vehiculo-owner-card .owner-avatar {
  width: 48px; height: 48px; border-radius: 50%;
  object-fit: cover; border: 2px solid var(--sena-green);
  flex-shrink: 0;
}
.vehiculo-owner-card .owner-avatar-placeholder {
  width: 48px; height: 48px; border-radius: 50%;
  background: var(--sena-light); border: 2px solid var(--sena-green);
  display: flex; align-items: center; justify-content: center;
  font-size: 20px; flex-shrink: 0;
}
.vehiculo-owner-card .owner-name {
  font-weight: 700; font-size: 15px; color: #1e293b; line-height: 1.2;
}
.vehiculo-owner-card .owner-doc {
  font-size: 12px; color: var(--text-muted); margin-top: 2px;
}
.vehiculo-owner-card .owner-plate-badge {
  display: inline-flex; align-items: center; gap: 5px;
  background: #f8fafc; border: 1px solid var(--border-soft);
  border-radius: 6px; padding: 3px 8px;
  font-size: 13px; font-weight: 700; color: #334155; font-family: monospace;
  letter-spacing: 1px;
}
.vehiculo-owner-card .owner-actions {
  display: flex; gap: 8px; margin-top: 12px;
}
.vehiculo-owner-card .owner-actions .btn {
  flex: 1; font-size: 13px;
}

/* ---- Vehicle not found (guard view) ---- */
.vehiculo-not-found {
  background: #fef2f2;
  border: 1px solid #fecaca;
  border-radius: 10px;
  padding: 14px 16px;
  margin-top: 10px;
  display: flex; align-items: center; gap: 10px;
  color: #991b1b; font-size: 13px; font-weight: 600;
}
.vehiculo-not-found .bi { font-size: 20px; flex-shrink: 0; }

/* ---- Quick vehicle register form (guard view) ---- */
.vehiculo-register-form {
  background: #f8fafc;
  border: 1.5px dashed #94a3b8;
  border-radius: 10px;
  padding: 12px 14px;
}

/* ---- Vehicle list in user modal ---- */
.vehiculo-item {
  display: flex; align-items: center; gap: 10px;
  padding: 8px 10px;
  background: #f8fafc;
  border: 1px solid var(--border-soft);
  border-radius: 8px;
  margin-bottom: 6px;
}
.vehiculo-item .vi-icon { font-size: 20px; flex-shrink: 0; }
.vehiculo-item .vi-placa {
  font-family: monospace; font-weight: 700; font-size: 14px;
  letter-spacing: 1px; color: #1e293b;
}
.vehiculo-item .vi-info {
  font-size: 11px; color: var(--text-muted); margin-top: 1px;
}
.vehiculo-item .vi-actions { margin-left: auto; flex-shrink: 0; }

/* ---- Add vehicle inline form (user modal) ---- */
.vehiculo-add-form {
  background: #f0fdf4;
  border: 1px dashed var(--sena-green);
  border-radius: 8px;
  padding: 12px;
  margin-top: 8px;
}
.vehiculo-add-form .form-label { font-size: 12px; font-weight: 600; color: #374151; }
.vehiculo-add-form .form-control,
.vehiculo-add-form .form-select {
  font-size: 13px;
}

/* ---- Visitante: panel guard ---- */
.visitante-activo-card {
  background: #fdf4ff;
  border: 1px solid #e9d5ff;
  border-radius: 10px;
  padding: 12px 14px;
}

/* ---- Visitante: tarjeta activa (vista visitas) ---- */
.visitante-card {
  display: flex; gap: 12px; align-items: flex-start;
  background: var(--surface);
  border: 1px solid var(--border-soft);
  border-left: 4px solid #8b5cf6;
  border-radius: 10px;
  padding: 12px 14px;
  margin-bottom: 8px;
  transition: box-shadow .15s;
}
.visitante-card:hover { box-shadow: 0 2px 8px rgba(0,0,0,.08); }
.vc-avatar {
  width: 40px; height: 40px; border-radius: 50%;
  background: #f5f3ff; border: 2px solid #8b5cf6;
  display: flex; align-items: center; justify-content: center;
  font-size: 18px; color: #8b5cf6; flex-shrink: 0;
}
.vc-info { flex: 1; min-width: 0; }
.vc-nombre { font-weight: 700; font-size: 14px; color: #1e293b; }
.vc-doc { font-size: 11px; color: var(--text-muted); margin-top: 1px; }
.vc-dep { display: flex; align-items: center; gap: 5px; font-size: 12px; color: #334155; margin-top: 4px; flex-wrap: wrap; }
.vc-motivo { font-size: 11px; color: #94a3b8; margin-top: 3px; }
.vc-meta { display: flex; flex-direction: column; align-items: flex-end; flex-shrink: 0; }
.vc-hora { font-weight: 700; font-size: 13px; color: #8b5cf6; }
.vc-duracion { font-size: 11px; color: #94a3b8; margin-top: 1px; }

/* ---- Dependencia: badge en historial ---- */
.dep-badge {
  display: inline-flex; align-items: center;
  border: 1px solid;
  border-radius: 6px;
  padding: 1px 7px;
  font-size: 11px; font-weight: 600;
  white-space: nowrap;
}

/* ---- Dependencias admin list ---- */
.dep-group-header {
  font-size: 12px; font-weight: 700; text-transform: uppercase;
  letter-spacing: .5px; color: var(--text-muted);
  padding: 6px 0 4px;
  border-bottom: 1px solid #f1f5f9;
  margin-bottom: 6px;
  display: flex; align-items: center;
}
.dep-item {
  display: flex; align-items: center; gap: 8px;
  padding: 8px 10px;
  background: #f8fafc;
  border: 1px solid var(--border-soft);
  border-radius: 8px;
  margin-bottom: 5px;
}
.dep-item.dep-inactiva { opacity: .5; }
.dep-nombre { font-size: 13px; font-weight: 600; color: #1e293b; }
.dep-actions { display: flex; gap: 4px; }

/* ---- Auth mode: visitante tab active ---- */
.auth-mode-btn[data-mode="visitante"].active {
  border-color: #8b5cf6;
  background: #faf5ff;
  color: #7c3aed;
}

/* ---- Dashboard Calendario ---- */
.cal-table { border-collapse: separate; border-spacing: 3px; }
.cal-th {
  text-align: center; font-size: 10px; font-weight: 700;
  color: #94a3b8; text-transform: uppercase; letter-spacing: .5px;
  padding: 4px 0;
}
.cal-td {
  text-align: center; vertical-align: top;
  width: 14.28%; padding: 3px 1px;
  border-radius: 6px;
  position: relative;
  min-height: 36px;
}
.cal-day {
  display: block;
  font-size: 12px; font-weight: 500; color: #334155;
  line-height: 1.2;
}
.cal-count {
  display: block;
  font-size: 9px; font-weight: 700;
  line-height: 1;
}
.cal-td.cal-low  { background: #dcfce7; }
.cal-td.cal-low  .cal-day  { color: #166534; }
.cal-td.cal-low  .cal-count { color: #16a34a; }
.cal-td.cal-mid  { background: #bbf7d0; }
.cal-td.cal-mid  .cal-day  { color: #14532d; }
.cal-td.cal-mid  .cal-count { color: #15803d; }
.cal-td.cal-high { background: #39A900; }
.cal-td.cal-high .cal-day  { color: var(--surface); font-weight: 700; }
.cal-td.cal-high .cal-count { color: #d1fae5; }
.cal-td.cal-hoy  { outline: 2px solid var(--sena-green); outline-offset: -1px; }
.cal-td.cal-fin  .cal-day  { color: #cbd5e0; }
.cal-td:hover:not(:empty) { opacity: .8; }
.cal-leyenda {
  display: flex; gap: 12px; justify-content: center;
  font-size: 10px; color: #94a3b8;
}
.cal-leyenda-item { display: flex; align-items: center; gap: 4px; }
.cal-dot {
  width: 10px; height: 10px; border-radius: 3px; display: inline-block;
}
.cal-dot.cal-low  { background: #dcfce7; border: 1px solid #86efac; }
.cal-dot.cal-mid  { background: #bbf7d0; border: 1px solid #4ade80; }
.cal-dot.cal-high { background: #39A900; }

/* ---- Equipo mode panel (vigilante) ---- */
.equipo-mode-panel {
  background: #eff6ff;
  border: 2px solid #3b82f6;
  border-radius: 12px;
  padding: 12px 14px;
}
.equipo-mode-header {
  display: flex; align-items: center; gap: 8px;
  font-size: 13px; font-weight: 600; color: #1e40af;
}
.equipo-mode-bar-wrap {
  flex: 1; max-width: 80px; height: 6px;
  background: #bfdbfe; border-radius: 3px; overflow: hidden;
}
.equipo-mode-bar {
  height: 100%; background: #3b82f6; border-radius: 3px; width: 100%;
}
.equipo-mode-ok {
  display: flex; align-items: center; gap: 10px;
  background: #f0fdf4; border: 1px solid #bbf7d0;
  border-radius: 8px; padding: 8px 10px;
}
.equipo-mode-alert {
  display: flex; align-items: center; gap: 10px;
  background: #fff7ed; border: 1px solid #fed7aa;
  border-radius: 8px; padding: 8px 10px;
}
.equipo-mode-info {
  font-size: 12px; color: #475569; padding: 4px 0;
}

/* ---- Equipo items en modal usuario ---- */
.equipo-item {
  display: flex; align-items: center; gap: 8px;
  padding: 8px 10px;
  background: #f8fafc;
  border: 1px solid var(--border-soft);
  border-radius: 8px;
  margin-bottom: 5px;
}
.equipo-inactivo { opacity: .45; }

/* ---- Sidebar avatar ---- */
.sidebar-user { display: flex; align-items: center; gap: 12px; padding: 14px 16px; border-bottom: 1px solid var(--sidebar-border); }
.sidebar-avatar-wrap { flex-shrink: 0; }
.sidebar-avatar { width: 42px; height: 42px; border-radius: 50%; object-fit: cover; border: 2px solid var(--sidebar-border); }
.sidebar-avatar-initial {
  width: 42px; height: 42px; border-radius: 50%; background: var(--sena-green);
  color: #fff; font-weight: 800; font-size: 18px;
  display: flex; align-items: center; justify-content: center; border: 2px solid var(--sidebar-border);
}
.sidebar-user:hover { background: var(--sidebar-accent); border-radius: 10px; }

/* ---- Modal perfil ---- */
.perfil-foto-wrap {
  display: flex; align-items: center; gap: 16px;
  background: var(--sena-dark); padding: 20px 24px;
}
.perfil-foto-container { position: relative; flex-shrink: 0; }
.perfil-foto { width: 72px; height: 72px; border-radius: 50%; object-fit: cover; border: 3px solid rgba(255,255,255,.3); }
.perfil-foto-initial {
  width: 72px; height: 72px; border-radius: 50%; background: rgba(255,255,255,.15);
  color: var(--surface); font-weight: 800; font-size: 28px;
  display: flex; align-items: center; justify-content: center; border: 3px solid rgba(255,255,255,.3);
}
.perfil-foto-edit {
  position: absolute; bottom: 0; right: 0;
  background: var(--sena-green); color: var(--surface); border-radius: 50%;
  width: 24px; height: 24px; display: flex; align-items: center; justify-content: center;
  font-size: 12px; cursor: pointer; border: 2px solid var(--surface);
}
.perfil-foto-delete {
  position: absolute; bottom: 0; left: 0;
  background: #dc2626; color: var(--surface); border-radius: 50%;
  width: 24px; height: 24px; display: flex; align-items: center; justify-content: center;
  font-size: 11px; cursor: pointer; border: 2px solid var(--surface); padding: 0;
}
.perfil-info { min-width: 0; }
.perfil-nombre { color: var(--surface); font-weight: 700; font-size: 16px; }
.perfil-doc { color: rgba(255,255,255,.6); font-size: 12px; margin-top: 2px; }
.perfil-section-title {
  font-size: 12px; font-weight: 700; text-transform: uppercase;
  letter-spacing: .5px; color: var(--text-muted); margin-bottom: 10px;
}

/* ---- Dashboard aprendiz ---- */
.apr-estado-hoy { border-radius: 8px; padding: 10px 14px; font-size: 13px; font-weight: 600; }
.apr-estado-presente { color: #065f46; background: #d1fae5; border-radius: 8px; padding: 10px 14px; }
.apr-estado-ausente  { color: #991b1b; background: #fee2e2; border-radius: 8px; padding: 10px 14px; }
.apr-mov-item {
  display: flex; align-items: center; gap: 10px; padding: 8px 0;
  border-bottom: 1px solid #f1f5f9; font-size: 13px;
}
.apr-mov-item:last-child { border-bottom: none; }
.apr-mov-icon { font-size: 18px; flex-shrink: 0; }
.apr-mov-icon.entrada { color: #10b981; }
.apr-mov-icon.salida  { color: #f59e0b; }
.apr-mov-tipo { font-weight: 600; min-width: 55px; }
.apr-mov-hora { color: var(--text-muted); font-size: 12px; margin-left: auto; }

/* ---- Mis Equipos y Vehículos (aprendiz) ---- */
.miscosas-header { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.miscosas-card {
  background: var(--surface); border-radius: 14px; overflow: hidden;
  box-shadow: 0 2px 12px rgba(0,0,0,.07); height: 100%;
}
.miscosas-card-header {
  display: flex; align-items: center; gap: 14px;
  padding: 16px 20px; color: var(--surface);
}
.miscosas-card-header.vehiculos { background: linear-gradient(135deg, #1e40af, #3b82f6); }
.miscosas-card-header.equipos   { background: linear-gradient(135deg, #065f46, #10b981); }
.miscosas-card-header-icon {
  font-size: 26px; flex-shrink: 0;
  background: rgba(255,255,255,.18); border-radius: 10px;
  width: 46px; height: 46px; display: flex; align-items: center; justify-content: center;
}
.miscosas-list { padding: 12px; min-height: 80px; }
.miscosas-empty {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 8px; padding: 28px 16px; color: #94a3b8; font-size: 13px;
}
.miscosas-empty i { font-size: 28px; }
.miscosas-item {
  display: flex; align-items: center; gap: 12px;
  padding: 10px 12px; border-radius: 10px;
  border: 1px solid var(--border-soft); background: #f8fafc;
  margin-bottom: 8px; transition: background .15s;
}
.miscosas-item:last-child { margin-bottom: 0; }
.miscosas-item:hover { background: #f0f9ff; }
.miscosas-item-icon {
  width: 36px; height: 36px; border-radius: 9px; flex-shrink: 0;
  display: flex; align-items: center; justify-content: center; font-size: 17px;
}
.miscosas-item-icon.vehiculos { background: #dbeafe; color: #1d4ed8; }
.miscosas-item-icon.equipos   { background: #d1fae5; color: #065f46; }
.miscosas-item-info { flex: 1; min-width: 0; }
.miscosas-item-principal { font-weight: 700; font-size: 14px; color: #111827; }
.miscosas-item-sub { font-size: 12px; color: var(--text-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.miscosas-badge {
  font-size: 11px; font-weight: 600; padding: 3px 9px; border-radius: 20px; white-space: nowrap;
  text-transform: capitalize;
}
.miscosas-badge.vehiculos { background: #dbeafe; color: #1e40af; }
.miscosas-badge.equipos   { background: #d1fae5; color: #065f46; }

/* ---- Visitante card alerta permanencia ---- */
.vc-alerta {
  border-left: 3px solid #ef4444 !important;
  background: #fff5f5;
}

/* ---- Restricciones badges ---- */
.rest-badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 20px;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .4px;
}
.rest-badge-vetado {
  background: #fef2f2;
  color: #dc2626;
  border: 1px solid #fecaca;
}
.rest-badge-suspendido {
  background: #fff7ed;
  color: #ea580c;
  border: 1px solid #fed7aa;
}

/* ---- Pre-registro cards ---- */
.prereg-card {
  background: var(--surface);
  border: 1px solid var(--border-soft);
  border-radius: 10px;
  padding: 14px 16px;
  margin-bottom: 10px;
  transition: box-shadow .15s;
}
.prereg-card:hover { box-shadow: 0 2px 8px rgba(0,0,0,.07); }
.prereg-avatar {
  width: 40px; height: 40px;
  border-radius: 50%;
  background: linear-gradient(135deg,var(--sena-green),#2e7d32);
  display: flex; align-items: center; justify-content: center;
  color: var(--surface); font-size: 18px;
  flex-shrink: 0;
}

/* ---- Ausentismo ---- */
.ausentismo-header {
  display: flex; gap: 12px; flex-wrap: wrap;
}
.aus-stat-card {
  flex: 1; min-width: 110px;
  background: var(--surface);
  border: 1px solid var(--border-soft);
  border-radius: 10px;
  padding: 14px 16px;
  text-align: center;
}
.aus-stat-num {
  font-size: 28px; font-weight: 800; color: #1e293b;
}
.aus-stat-label {
  font-size: 11px; color: var(--text-muted); text-transform: uppercase; letter-spacing: .4px; margin-top: 2px;
}
.aus-stat-present .aus-stat-num { color: #059669; }
.aus-stat-absent  .aus-stat-num { color: #dc2626; }

/* ---- Ocupación ---- */
.ocupacion-resumen {
  display: flex; gap: 12px; flex-wrap: wrap;
}
.ocup-stat-card {
  flex: 1; min-width: 120px;
  background: var(--surface); border: 1px solid var(--border-soft); border-radius: 10px;
  padding: 14px; text-align: center;
}
.ocup-num { font-size: 28px; font-weight: 800; color: #1e293b; margin: 4px 0 2px; }
.ocup-label { font-size: 11px; color: var(--text-muted); text-transform: uppercase; letter-spacing: .4px; }
.ocupacion-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(130px, 1fr));
  gap: 10px;
  padding: 12px;
}
.ocup-dep-card {
  background: #f8fafc; border: 1px solid var(--border-soft); border-radius: 10px;
  padding: 12px; text-align: center;
}
.ocup-dep-icon { font-size: 22px; color: #8b5cf6; margin-bottom: 6px; }
.ocup-dep-nombre { font-size: 12px; font-weight: 600; color: #334155; margin-bottom: 4px; }
.ocup-dep-count { font-size: 24px; font-weight: 800; color: #1e293b; }

/* ---- KIOSCO / PUESTO DE GUARDIA ---- */
#kiosco-overlay {
  position: fixed; inset: 0; z-index: 9999;
  background: #0d1b0d;
  display: flex; flex-direction: column;
  font-family: inherit; color: var(--surface); overflow: hidden;
}
.kiosco-topbar {
  display: flex; align-items: center; gap: 12px;
  padding: 10px 20px; flex-shrink: 0;
  background: rgba(0,0,0,.5);
  border-bottom: 1px solid rgba(255,255,255,.08);
}
.kiosco-brand { display: flex; align-items: baseline; gap: 10px; }
.kiosco-brand-name { font-size: 22px; font-weight: 900; letter-spacing: 4px; color: var(--sena-green); }
.kiosco-brand-sub { font-size: 11px; color: rgba(255,255,255,.4); text-transform: uppercase; letter-spacing: 1.5px; }
.kiosco-activos-pill {
  margin-left: auto; display: flex; align-items: center; gap: 6px;
  background: rgba(255,255,255,.07); border-radius: 20px; padding: 4px 14px;
  font-size: 13px; color: rgba(255,255,255,.55);
}
.kiosco-activos-pill i { color: rgba(255,255,255,.35); }
#kiosco-num-adentro { font-size: 16px; font-weight: 800; color: rgba(255,255,255,.9); }
.kiosco-exit-btn {
  background: rgba(255,255,255,.08); border: 1px solid rgba(255,255,255,.15);
  color: rgba(255,255,255,.5); border-radius: 8px; padding: 6px 10px;
  font-size: 14px; cursor: pointer; transition: all .15s;
}
.kiosco-exit-btn:hover { background: rgba(255,255,255,.15); color: var(--surface); }
/* Idle */
.kiosco-idle {
  flex: 1; display: flex; flex-direction: column;
  align-items: center; justify-content: center; gap: 14px;
}
.kiosco-idle-icon {
  font-size: 100px; color: var(--sena-green);
  animation: kiosco-pulse 2s ease-in-out infinite;
}
@keyframes kiosco-pulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50%       { opacity: .65; transform: scale(.94); }
}
.kiosco-idle-title { font-size: 28px; font-weight: 700; color: rgba(255,255,255,.85); }
.kiosco-idle-sub   { font-size: 15px; color: rgba(255,255,255,.4); }
.kiosco-input { position: absolute; opacity: 0; pointer-events: none; width: 1px; height: 1px; }
/* Result screen */
.kiosco-result-screen {
  flex: 1; display: flex; flex-direction: column; overflow: hidden;
}
.kiosco-result-screen.kiosco-entrada   { background: linear-gradient(155deg, #052e16 0%, #166534 100%); }
.kiosco-result-screen.kiosco-salida-ok { background: linear-gradient(155deg, #0c1f3d 0%, #1d4ed8 100%); }
.kiosco-result-screen.kiosco-bloqueado { background: linear-gradient(155deg, #3b0000 0%, #7f1d1d 100%); }
.kiosco-result-body {
  flex: 1; display: flex; align-items: center; justify-content: center;
  gap: 52px; padding: 32px 48px;
}
.kiosco-avatar-wrap { flex-shrink: 0; }
.kiosco-foto {
  width: 180px; height: 180px; border-radius: 50%;
  object-fit: cover; border: 5px solid rgba(255,255,255,.25);
}
.kiosco-iniciales {
  width: 180px; height: 180px; border-radius: 50%;
  background: rgba(255,255,255,.12); border: 5px solid rgba(255,255,255,.2);
  display: flex; align-items: center; justify-content: center;
  font-size: 64px; font-weight: 900; color: rgba(255,255,255,.8);
  text-transform: uppercase; letter-spacing: -2px;
}
.kiosco-result-info { display: flex; flex-direction: column; gap: 10px; }
.kiosco-tipo-label {
  font-size: 32px; font-weight: 900; letter-spacing: 3px;
  text-shadow: 0 2px 12px rgba(0,0,0,.4);
}
.kiosco-entrada   .kiosco-tipo-label { color: #86efac; }
.kiosco-salida-ok .kiosco-tipo-label { color: #93c5fd; }
.kiosco-bloqueado .kiosco-tipo-label { color: #fca5a5; }
.kiosco-result-nombre {
  font-size: 48px; font-weight: 900; line-height: 1.1;
  color: var(--surface); text-shadow: 0 2px 16px rgba(0,0,0,.4);
}
.kiosco-result-rol {
  display: inline-block; padding: 4px 16px; border-radius: 20px;
  font-size: 14px; font-weight: 700; letter-spacing: 1.5px; text-transform: uppercase;
  background: rgba(255,255,255,.15); color: rgba(255,255,255,.9); align-self: flex-start;
}
.kiosco-result-doc   { font-size: 20px; color: rgba(255,255,255,.6); font-family: monospace; }
.kiosco-result-extra { font-size: 15px; color: rgba(255,255,255,.8); }
/* Countdown bar */
.kiosco-countdown-wrap { flex-shrink: 0; height: 6px; background: rgba(255,255,255,.1); }
.kiosco-countdown-bar  { height: 100%; background: rgba(255,255,255,.45); width: 100%; }
/* Notification overlay */
.kiosco-notif-visitante {
  position: fixed; top: 72px; right: 24px;
  background: #7c3aed; color: var(--surface);
  border-radius: 14px; padding: 16px 20px;
  max-width: 300px; font-size: 14px;
  box-shadow: 0 8px 32px rgba(0,0,0,.4);
  animation: slide-in-right .3s ease;
}
/* Responsive kiosk */
@media (max-width: 768px) {
  .kiosco-result-body { flex-direction: column; gap: 24px; padding: 24px 20px; text-align: center; }
  .kiosco-result-info { align-items: center; }
  .kiosco-result-nombre { font-size: 32px; }
  .kiosco-tipo-label { font-size: 24px; }
  .kiosco-foto, .kiosco-iniciales { width: 120px; height: 120px; }
  .kiosco-iniciales { font-size: 44px; }
  .kiosco-result-rol { align-self: center; }
  .kiosco-idle-icon { font-size: 72px; }
  .kiosco-idle-title { font-size: 22px; }
}

/* ---- COORDINATOR VIEW ---- */
.coord-view-header {
  display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 16px;
  background: var(--surface); border-radius: 14px; padding: 20px 24px;
  box-shadow: 0 1px 6px rgba(0,0,0,.07); border: 1px solid #f0f0f0;
}
.coord-view-header-left { display: flex; align-items: center; gap: 16px; }
.coord-view-icon {
  width: 52px; height: 52px; border-radius: 14px; flex-shrink: 0;
  background: linear-gradient(135deg, var(--sena-green), #2d8600);
  color: var(--surface); display: flex; align-items: center; justify-content: center;
  font-size: 24px; box-shadow: 0 4px 12px rgba(57,169,0,.3);
}
.coord-view-title  { font-size: 18px; font-weight: 800; color: var(--text-strong); }
.coord-view-sub    { font-size: 12px; color: var(--text-muted); margin-top: 2px; }
.coord-view-stats  { display: flex; gap: 10px; flex-wrap: wrap; }
.coord-stat-pill {
  display: flex; align-items: center; gap: 6px;
  background: #f1f5f9; border-radius: 10px; padding: 8px 14px;
  font-size: 13px; color: var(--text-muted); font-weight: 600; border: 1px solid var(--border-soft);
  transition: background .2s, color .2s, border-color .2s;
}
.coord-stat-pill i { font-size: 15px; }
.coord-stat-pill-alert {
  background: #fef3c7; color: #b45309; border-color: #f59e0b;
}
.coord-stat-pill-alert i { color: #d97706; }

/* Custom tabs */
.coord-tabs-bar {
  display: flex; gap: 4px;
  background: var(--surface); border-radius: 12px; padding: 6px;
  box-shadow: 0 1px 4px rgba(0,0,0,.06); border: 1px solid #f0f0f0;
  width: fit-content;
}
.coord-tab-btn {
  display: flex; align-items: center; gap: 6px;
  padding: 8px 18px; border-radius: 8px; border: none; background: transparent;
  font-size: 13px; font-weight: 600; color: var(--text-muted); cursor: pointer;
  transition: all .18s; white-space: nowrap;
}
.coord-tab-btn:hover { background: #f1f5f9; color: var(--text-strong); }
.coord-tab-btn.active { background: var(--sena-green); color: var(--surface); box-shadow: 0 2px 8px rgba(57,169,0,.3); }
.coord-tab-badge {
  display: inline-flex; align-items: center; justify-content: center;
  min-width: 18px; height: 18px; border-radius: 9px;
  font-size: 10px; font-weight: 800; padding: 0 5px;
}
.coord-tab-badge-warn   { background: #f59e0b; color: var(--surface); }
.coord-tab-badge-danger { background: #ef4444; color: var(--surface); }

/* Filter bar */
.coord-filter-bar {
  display: flex; align-items: center; gap: 6px; flex-wrap: wrap;
}
.coord-filter-btn {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 6px 14px; border-radius: 8px; border: 1.5px solid var(--border-soft);
  background: #f8fafc; color: var(--text-muted); font-size: 12px; font-weight: 600;
  cursor: pointer; transition: all .15s; white-space: nowrap;
}
.coord-filter-btn:hover { background: #f1f5f9; border-color: #cbd5e0; color: #334155; }
.coord-filter-btn.active {
  background: #fef3c7; color: #b45309; border-color: #f59e0b;
}
.coord-filter-btn.success.active { background: #d1fae5; color: #065f46; border-color: #10b981; }
.coord-filter-btn.danger.active  { background: #fee2e2; color: #991b1b; border-color: #ef4444; }
.coord-filter-btn.neutral.active { background: #e0f2fe; color: #0369a1; border-color: #38bdf8; }
.coord-filter-count {
  background: #f59e0b; color: var(--surface); border-radius: 9px;
  font-size: 10px; font-weight: 800; padding: 1px 6px; min-width: 18px;
  display: inline-block; text-align: center;
}
.coord-refresh-btn {
  width: 34px; height: 34px; border-radius: 8px; border: 1.5px solid var(--border-soft);
  background: #f8fafc; color: var(--text-muted); font-size: 15px;
  display: flex; align-items: center; justify-content: center;
  cursor: pointer; transition: all .15s;
}
.coord-refresh-btn:hover { background: #f1f5f9; border-color: #94a3b8; color: #334155; rotate: 30deg; }

/* ---- JUSTIFICACIONES ---- */
.justif-nueva-card {
  background: var(--surface); border-radius: 12px; border: 1px solid var(--border-soft); overflow: hidden;
  box-shadow: 0 2px 8px rgba(0,0,0,.06);
}
.justif-nueva-header {
  background: linear-gradient(135deg, #f59e0b 0%, #d97706 100%);
  color: var(--surface); padding: 12px 16px;
  font-weight: 700; font-size: 14px;
  display: flex; align-items: center; gap: 8px;
}
.justif-nueva-body { padding: 16px; }
.justif-nueva-body label { font-size: 12px; font-weight: 600; color: var(--text-muted); text-transform: uppercase; letter-spacing: .4px; margin-bottom: 3px; }

.justif-modal-detalle { padding: 4px 0; }
.justif-modal-meta {
  display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 12px;
}
.justif-modal-meta-item {
  background: #f1f5f9; border-radius: 8px;
  padding: 6px 12px; font-size: 12px; color: #475569;
  display: flex; align-items: center; gap: 5px;
}
.justif-modal-meta-item i { color: #94a3b8; }
.justif-modal-icon {
  width: 40px; height: 40px; border-radius: 10px;
  background: #e0f2fe; color: #0369a1;
  display: flex; align-items: center; justify-content: center;
  font-size: 20px; flex-shrink: 0;
}
.justif-modal-motivo {
  background: #fffbeb; border: 1px solid #fde68a;
  border-radius: 8px; padding: 10px 14px;
  font-size: 13px; color: #92400e; margin-bottom: 12px;
}

/* Ausentismo — badge justificado */
.aus-badge-justif {
  display: inline-block; font-size: 10px; padding: 2px 7px;
  border-radius: 12px; font-weight: 700;
  background: #d1fae5; color: #065f46;
}
.aus-badge-ausente {
  display: inline-block; font-size: 10px; padding: 2px 7px;
  border-radius: 12px; font-weight: 700;
  background: #fee2e2; color: #991b1b;
}
.aus-badge-parcial {
  display: inline-block; font-size: 10px; padding: 2px 7px;
  border-radius: 12px; font-weight: 700;
  background: #fef3c7; color: #92400e;
}
.aus-dias-detail { font-size: 11px; color: var(--text-muted); margin-top: 2px; }
.aus-dias-justif { color: #059669; font-weight: 600; }

/* ── Tarjeta RFID genérica — oculto en el formulario de usuario.
   Para re-habilitar: borrar este bloque.                                    */
#rfid-field-section { display: none !important; }

/* ── Kiosco cámara ─────────────────────────────────────────────────────────── */
#kiosco-reader {
  width: 280px; height: 280px;
  border-radius: 16px; overflow: hidden;
  border: 3px solid rgba(57,169,0,.7);
  margin: 0 auto;
  background: #0f172a;
  box-shadow: 0 0 32px rgba(57,169,0,.25);
}
#kiosco-reader video { width: 100% !important; height: 100% !important; object-fit: cover; }
#kiosco-reader img  { display: none !important; }
