/* Relevamiento de personal — modo claro y oscuro (botón del encabezado; la primera vez sigue al sistema). Mobile first. */
:root {
  color-scheme: light;
  --brand: #1db7d0;
  --page: #eef3f5;
  --surface: #ffffff;
  --surface-2: #f3f7f9;
  --ink: #0b1a20;
  --ink-2: #3c4b52;
  --muted: #5d6a70;
  --border: rgba(11, 40, 52, 0.12);
  --border-strong: rgba(11, 40, 52, 0.24);
  --accent: #0e7f93;
  --accent-hover: #0b6f81;
  --on-accent: #ffffff;
  --accent-ink: #0b6f81;
  --accent-wash: rgba(29, 183, 208, 0.12);
  --critical: #b42828;
  --critical-wash: rgba(208, 59, 59, 0.08);
  --good: #006300;
  --good-wash: rgba(12, 163, 12, 0.10);
  --warn-wash: rgba(250, 178, 25, 0.18);
  --warn-border: #c98a00;
  --shadow: 0 1px 2px rgba(11, 40, 52, 0.05), 0 10px 30px -14px rgba(11, 40, 52, 0.22);
  --r: 12px;
  --font: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --page: #0a1114;
  --surface: #131b20;
  --surface-2: #1a242a;
  --ink: #f2f7f9;
  --ink-2: #c2ced3;
  --muted: #93a3ab;
  --border: rgba(255, 255, 255, 0.10);
  --border-strong: rgba(255, 255, 255, 0.22);
  --accent: #1db7d0;
  --accent-hover: #3cc6dc;
  --on-accent: #06181c;
  --accent-ink: #5fd3e6;
  --accent-wash: rgba(29, 183, 208, 0.14);
  --critical: #ff8a8a;
  --critical-wash: rgba(255, 110, 110, 0.10);
  --good: #7ddc7d;
  --good-wash: rgba(125, 220, 125, 0.10);
  --warn-wash: rgba(250, 178, 25, 0.16);
  --warn-border: #e0a526;
  --shadow: 0 1px 2px rgba(0, 0, 0, 0.3), 0 10px 30px -14px rgba(0, 0, 0, 0.6);
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--page); color: var(--ink); font: 16px/1.5 var(--font); }
a { color: var(--accent-ink); }
h1 { font-size: 1.6rem; line-height: 1.2; margin: 0 0 .4rem; letter-spacing: -0.01em; }
h2 { font-size: 1.05rem; margin: 0 0 1rem; color: var(--accent-ink); }
.sub, .intro p { color: var(--muted); margin: 0; }

.barra { background: var(--surface); border-bottom: 1px solid var(--border); }
.barra-in { max-width: 760px; margin: 0 auto; padding: 10px 16px; display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: 58px; }
.tema-boton {
  display: inline-grid; place-items: center; width: 40px; height: 40px; flex: none; padding: 0; cursor: pointer;
  border: 1px solid var(--border-strong); border-radius: 999px; background: var(--surface); color: var(--ink-2);
}
.tema-boton:hover { background: var(--surface-2); color: var(--ink); }
.tema-boton:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.tema-boton svg { width: 20px; height: 20px; }
.tema-boton .luna { display: none; }
:root[data-theme="dark"] .tema-boton .sol { display: none; }
:root[data-theme="dark"] .tema-boton .luna { display: block; }
.ancho .barra-in { max-width: 1280px; }
.logo { height: 26px; width: auto; display: block; }

.contenedor { max-width: 1280px; margin: 0 auto; padding: 24px 16px 64px; }
.contenedor.angosto { max-width: 760px; }
.intro { margin-bottom: 20px; }

.tarjeta { background: var(--surface); border: 1px solid var(--border); border-radius: var(--r); box-shadow: var(--shadow); }
.formulario { padding: 4px 0; }
.seccion { padding: 20px 20px 22px; border-top: 1px solid var(--border); }
.seccion:first-of-type { border-top: 0; }
.seccion.destacada { background: var(--accent-wash); border-radius: var(--r) var(--r) 0 0; margin-top: -4px; }
.grilla { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 16px 14px; }
.campo { grid-column: span 4; min-width: 0; margin: 0; padding: 0; border: 0; }
@media (min-width: 600px) {
  .ancho-1 { grid-column: span 1; }
  .ancho-2 { grid-column: span 2; }
  .ancho-3 { grid-column: span 3; }
}
@media (max-width: 599px) {
  .ancho-1 { grid-column: span 2; }
}

label, legend { display: block; font-weight: 600; font-size: .92rem; margin-bottom: 6px; padding: 0; }
.opcional { font-weight: 400; color: var(--muted); }
input, select, textarea {
  width: 100%; font: inherit; color: var(--ink); background: var(--surface);
  border: 1px solid var(--border-strong); border-radius: 8px; padding: 10px 12px; min-height: 44px;
}
textarea { resize: vertical; margin-top: 10px; }
input.mayus { text-transform: uppercase; }
input::placeholder, textarea::placeholder { text-transform: none; color: var(--muted); }
input:focus-visible, select:focus-visible, textarea:focus-visible, .boton:focus-visible, .chip input:focus-visible + span {
  outline: 2px solid var(--accent); outline-offset: 2px;
}
.ayuda { margin: 5px 0 0; font-size: .82rem; color: var(--muted); }
.ayuda:empty { display: none; }
.error { margin: 5px 0 0; font-size: .85rem; color: var(--critical); font-weight: 600; }
.con-error input, .con-error select, .con-error textarea { border-color: var(--critical); background: var(--critical-wash); }

.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip { margin: 0; font-weight: 500; cursor: pointer; }
.chip input { position: absolute; opacity: 0; width: 1px; height: 1px; min-height: 0; }
.chip span {
  display: inline-flex; align-items: center; min-height: 44px; padding: 0 16px; border-radius: 999px;
  border: 1px solid var(--border-strong); background: var(--surface);
}
.chip input:checked + span { background: var(--accent); border-color: var(--accent); color: var(--on-accent); }
.filtros .chip span { min-height: 38px; padding: 0 12px; font-size: .9rem; }

.casilla { display: flex; gap: 12px; align-items: flex-start; font-weight: 400; font-size: .92rem; color: var(--ink-2); }
.casilla input { width: 22px; height: 22px; min-height: 0; margin-top: 2px; flex: none; accent-color: var(--accent); }
.casilla + .error { margin-bottom: 0; }
.seccion > .boton { margin-top: 18px; width: 100%; }
@media (min-width: 600px) { .seccion > .boton { width: auto; } }

.boton {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 44px; padding: 0 20px;
  background: var(--accent); color: var(--on-accent); border: 1px solid var(--accent); border-radius: 8px;
  font: 600 1rem var(--font); text-decoration: none; cursor: pointer; white-space: nowrap;
}
.boton:hover { background: var(--accent-hover); }
.boton.secundario { background: var(--surface); color: var(--accent-ink); border-color: var(--border-strong); }
.boton.secundario:hover { background: var(--accent-wash); }
.boton.fantasma { background: transparent; color: var(--ink-2); border-color: transparent; }
.boton.fantasma:hover { background: var(--surface-2); }
.boton.peligro { background: transparent; color: var(--critical); border-color: var(--critical); }
.boton.peligro:hover { background: var(--critical-wash); }
.boton.chico { min-height: 34px; padding: 0 12px; font-size: .88rem; }

.alerta { padding: 12px 16px; border-radius: 10px; background: var(--critical-wash); color: var(--critical); font-weight: 600; margin-bottom: 16px; border: 1px solid currentColor; }
.alerta.exito { background: var(--good-wash); color: var(--good); }
.trampa { position: absolute; left: -10000px; width: 1px; height: 1px; overflow: hidden; }

.listo { padding: 40px 24px; text-align: center; }
.listo p { color: var(--ink-2); max-width: 46ch; margin: 0 auto 24px; }
.check { width: 64px; height: 64px; border-radius: 50%; margin: 0 auto 16px; display: grid; place-items: center; font-size: 2rem; background: var(--good-wash); color: var(--good); }

.login { padding: 28px 24px; max-width: 420px; margin: 40px auto 0; }
.login .campo { margin: 18px 0; }
.login .boton { width: 100%; }

/* Panel del gestor */
.cabecera-panel { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: flex-end; gap: 16px; margin-bottom: 18px; }
.acciones { display: flex; flex-wrap: wrap; gap: 8px; }
.filtros { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; margin-bottom: 14px; }
.filtros input[type="search"] { flex: 1 1 260px; max-width: 420px; }
.vacio { padding: 32px 20px; text-align: center; color: var(--ink-2); overflow-wrap: anywhere; }
.tabla-wrap { overflow: hidden; }
.tabla-scroll { overflow-x: auto; }
.tabla { width: 100%; border-collapse: collapse; font-size: .92rem; }
.tabla th { text-align: left; font-size: .78rem; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); font-weight: 600; padding: 12px 10px; background: var(--surface-2); border-bottom: 1px solid var(--border); white-space: nowrap; }
.tabla td { padding: 8px 10px; border-bottom: 1px solid var(--border); vertical-align: middle; }
.tabla tr:last-child td { border-bottom: 0; }
.tabla tbody tr:hover { background: var(--surface-2); }
.tabla .num { font-variant-numeric: tabular-nums; white-space: nowrap; }
.tabla .nombre { font-weight: 600; color: var(--ink); text-decoration: none; display: block; white-space: nowrap; }
.tabla .nombre:hover { color: var(--accent-ink); text-decoration: underline; }
.tabla .mail { display: block; font-size: .8rem; color: var(--muted); }
.tabla .fecha { white-space: nowrap; color: var(--ink-2); }
.tabla .fecha span { color: var(--muted); }
.tabla select, .tabla input:not([type="checkbox"]) { min-height: 36px; padding: 6px 8px; font-size: .9rem; }
.tabla select { width: 96px; }
.tabla input.asignar { width: 170px; }
.tabla select.pendiente { background: var(--warn-wash); border-color: var(--warn-border); }
.tabla .guardado { border-color: var(--good) !important; box-shadow: 0 0 0 2px var(--good-wash); }
.col-check { width: 40px; }
.col-check input { width: 18px; height: 18px; min-height: 0; accent-color: var(--accent); }
.masivo { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; padding: 10px 14px; background: var(--accent-wash); border-bottom: 1px solid var(--border); font-weight: 600; font-size: .92rem; }
.masivo[hidden] { display: none; }
.masivo select { width: auto; min-height: 34px; padding: 4px 8px; }
.masivo .boton.todo { background: var(--ink); border-color: var(--ink); color: var(--page); }
.masivo .boton.todo:hover { opacity: .88; }
.masivo .separador { width: 1px; align-self: stretch; background: var(--border-strong); margin: 0 4px; }

.volver { text-decoration: none; font-weight: 600; }
.fila-volver { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 10px; }
.anexo-links { display: inline-flex; flex-wrap: wrap; align-items: center; gap: 8px; font-weight: 600; color: var(--ink-2); font-size: .92rem; }
.fila-botones { display: flex; gap: 10px; flex-wrap: wrap; }
.eliminar { margin-top: 28px; text-align: right; }

#toast {
  position: fixed; left: 50%; bottom: 20px; transform: translateX(-50%) translateY(20px); opacity: 0;
  background: var(--ink); color: var(--page); padding: 10px 18px; border-radius: 999px; font-weight: 600; font-size: .92rem;
  transition: opacity .2s, transform .2s; pointer-events: none; max-width: calc(100% - 32px);
}
#toast.visible { opacity: 1; transform: translateX(-50%) translateY(0); }
#toast.error { background: var(--critical); color: #fff; }
@media (prefers-reduced-motion: reduce) { #toast { transition: none; } }

/* Adjuntos (fotos del DNI y PDF de la capacitación) */
.adjunto .etiqueta { display: block; font-weight: 600; font-size: .92rem; margin-bottom: 6px; }
.adjunto-caja { border: 1px dashed var(--border-strong); border-radius: 10px; padding: 12px; background: var(--surface-2); display: flex; flex-direction: column; gap: 10px; }
.con-error .adjunto-caja { border-color: var(--critical); background: var(--critical-wash); }
.adjunto-vista { min-height: 64px; display: grid; place-items: center; text-align: center; font-size: .9rem; color: var(--muted); }
.adjunto-vista img { width: 100%; max-height: 220px; object-fit: contain; border-radius: 6px; background: #fff; }
.adjunto-ok { color: var(--good); font-weight: 600; }
.adjunto-pdf { display: inline-flex; align-items: center; gap: 10px; color: var(--ink); font-weight: 600; overflow-wrap: anywhere; text-align: left; }
.adjunto-pdf small { color: var(--muted); font-weight: 400; }
.icono-pdf { flex: none; display: inline-grid; place-items: center; width: 38px; height: 46px; border-radius: 4px; background: var(--critical); color: #fff; font-size: .72rem; font-weight: 700; }
.adjunto-botones { display: flex; flex-wrap: wrap; gap: 8px; }
.adjunto-botones .boton { flex: 1 1 140px; position: relative; overflow: hidden; }
.archivo-oculto { position: absolute; inset: 0; opacity: 0; width: 100%; height: 100%; min-height: 0; padding: 0; border: 0; cursor: pointer; }
.adjunto-botones label.boton:focus-within { outline: 2px solid var(--accent); outline-offset: 2px; }
.enviando { margin: 10px 0 0; color: var(--muted); font-weight: 600; }
.seccion > .boton:disabled { opacity: .7; cursor: progress; }

/* Cámara */
dialog.camara { width: min(720px, calc(100% - 24px)); max-height: calc(100% - 24px); padding: 16px; border: 0; border-radius: var(--r); background: var(--surface); color: var(--ink); box-shadow: var(--shadow); }
dialog.camara::backdrop { background: rgba(0, 0, 0, .7); }
.camara-titulo { margin: 0 0 10px; font-weight: 600; text-align: center; }
.camara-visor { position: relative; border-radius: 8px; overflow: hidden; background: #000; }
.camara-visor video { display: block; width: 100%; max-height: 65vh; object-fit: contain; }
.camara-guia { position: absolute; inset: 0; margin: auto; width: 86%; aspect-ratio: 85.6 / 54; max-height: 86%; border: 3px solid rgba(255, 255, 255, .9); border-radius: 12px; box-shadow: 0 0 0 9999px rgba(0, 0, 0, .35); pointer-events: none; }
.camara-error { color: var(--critical); font-weight: 600; }
.camara-botones { display: flex; gap: 10px; justify-content: flex-end; margin-top: 12px; }
.camara-botones .boton { flex: 1 1 0; }
@media (min-width: 600px) { .camara-botones .boton { flex: 0 0 auto; } }

/* Panel: documentos e ingreso */
.tabla input[type="date"].asignar { width: 150px; }
.tabla .docs { display: flex; gap: 6px; flex-wrap: nowrap; }
.tabla .docs .boton[aria-disabled="true"] { opacity: .45; pointer-events: none; }
.ficha-docs { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 14px; }
.ficha-doc { border: 1px solid var(--border); border-radius: 10px; padding: 12px; background: var(--surface-2); display: flex; flex-direction: column; gap: 8px; }
.ficha-doc strong { font-size: .92rem; }
.ficha-doc img { width: 100%; max-height: 160px; object-fit: contain; background: #fff; border-radius: 6px; }
.ficha-doc .falta { color: var(--critical); font-weight: 600; font-size: .9rem; }
.ficha-doc input[type="file"] { font-size: .85rem; min-height: 0; padding: 6px; }
