/* Marcadas — estilos del marcador y del panel. Sin dependencias. */

:root {
  --fondo: #f4f6f8;
  --superficie: #ffffff;
  --superficie-2: #eef2f5;
  --borde: #d5dde4;
  --texto: #14202b;
  --texto-suave: #5b6b79;
  --primario: #0f766e;
  --primario-texto: #ffffff;
  --primario-suave: #ccfbf1;
  --entrada: #15803d;
  --salida: #1d4ed8;
  --malo: #b91c1c;
  --malo-suave: #fee2e2;
  --atento: #b45309;
  --atento-suave: #fef3c7;
  --bien-suave: #dcfce7;
  --sombra: 0 1px 2px rgb(0 0 0 / 0.06), 0 4px 16px rgb(0 0 0 / 0.06);
  --radio: 12px;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root {
    --fondo: #0b1220;
    --superficie: #131c2b;
    --superficie-2: #1b2638;
    --borde: #2a3a50;
    --texto: #e6edf3;
    --texto-suave: #9aabbc;
    --primario: #14b8a6;
    --primario-texto: #04201d;
    --primario-suave: #123a37;
    --entrada: #22c55e;
    --salida: #60a5fa;
    --malo: #f87171;
    --malo-suave: #3b1717;
    --atento: #fbbf24;
    --atento-suave: #3a2a0c;
    --bien-suave: #12321f;
    --sombra: 0 1px 2px rgb(0 0 0 / 0.4);
    color-scheme: dark;
  }
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  background: var(--fondo);
  color: var(--texto);
  font: 16px/1.45 system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  -webkit-text-size-adjust: 100%;
}
h1, h2, h3 { line-height: 1.2; margin: 0 0 0.5rem; }
a { color: var(--primario); }
.cargando-inicial { padding: 2rem; text-align: center; color: var(--texto-suave); }
.sutil { color: var(--texto-suave); font-size: 0.92em; }
.num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.fuerte { font-weight: 700; }

/* ---------- Botones y formularios ---------- */
.boton {
  display: inline-flex; align-items: center; justify-content: center; gap: 0.4rem;
  min-height: 44px; padding: 0.55rem 1rem;
  border: 1px solid var(--borde); border-radius: 10px;
  background: var(--superficie); color: var(--texto);
  font: inherit; font-weight: 600; cursor: pointer; text-decoration: none;
}
.boton:hover { border-color: var(--primario); }
.boton:disabled { opacity: 0.55; cursor: default; }
.boton.primario { background: var(--primario); color: var(--primario-texto); border-color: var(--primario); }
.boton.peligro { color: var(--malo); border-color: var(--malo); }
.boton.chico { min-height: 34px; padding: 0.25rem 0.7rem; font-size: 0.9rem; }
.boton.grande { min-height: 56px; font-size: 1.1rem; padding: 0.7rem 1.4rem; }
.boton.enorme { width: 100%; min-height: 84px; font-size: 1.6rem; border: 0; color: #fff; border-radius: 16px; }
.boton.enorme.entrada { background: var(--entrada); }
.boton.enorme.salida { background: var(--salida); }
.enlace { background: none; border: 0; color: var(--primario); font: inherit; text-decoration: underline; cursor: pointer; padding: 0.4rem; min-height: 44px; }
.fila-botones { display: flex; flex-wrap: wrap; gap: 0.6rem; justify-content: center; margin-top: 0.8rem; }
.fila-botones.izquierda { justify-content: flex-start; }

.campo { display: flex; flex-direction: column; gap: 0.25rem; margin-bottom: 0.8rem; text-align: left; }
.campo > span { font-size: 0.88rem; font-weight: 600; color: var(--texto-suave); }
.campo small { color: var(--texto-suave); }
input, select, textarea {
  font: inherit; color: var(--texto); background: var(--superficie);
  border: 1px solid var(--borde); border-radius: 10px; padding: 0.55rem 0.7rem; min-height: 44px; width: 100%;
}
input:focus, select:focus, textarea:focus, .boton:focus-visible { outline: 2px solid var(--primario); outline-offset: 1px; }
input[type='checkbox'] { width: auto; min-height: auto; }
.entrada-grande { font-size: 2rem; text-align: center; font-variant-numeric: tabular-nums; }
.rejilla { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 0 1rem; }

.aviso { padding: 0.7rem 0.9rem; border-radius: 10px; margin: 0.6rem 0; }
.aviso.malo, .kiosko-error { background: var(--malo-suave); color: var(--malo); }
.aviso.bien { background: var(--bien-suave); }
.aviso.atento, .aviso-amarillo { background: var(--atento-suave); color: var(--atento); padding: 0.6rem 0.8rem; border-radius: 10px; }
.kiosko-error { padding: 0.6rem 0.8rem; border-radius: 10px; }

.etiqueta {
  display: inline-block; padding: 0.05rem 0.45rem; border-radius: 999px;
  background: var(--superficie-2); color: var(--texto-suave); font-size: 0.78rem; font-weight: 600; margin-left: 0.3rem;
  white-space: nowrap;
}
.etiqueta.entrada { background: var(--bien-suave); color: var(--entrada); }
.etiqueta.salida { background: color-mix(in srgb, var(--salida) 15%, transparent); color: var(--salida); }
.etiqueta.malo { background: var(--malo-suave); color: var(--malo); }
.etiqueta.atento { background: var(--atento-suave); color: var(--atento); }
.estado { font-weight: 700; text-transform: capitalize; }
.estado-pendiente { color: var(--atento); }
.estado-aprobado { color: var(--entrada); }
.estado-rechazado { color: var(--malo); }

/* ---------- Marcador (kiosko) ---------- */
body.kiosko { min-height: 100dvh; }
.kiosko-pantalla { display: flex; flex-direction: column; min-height: 100dvh; }
.kiosko-cabecera {
  display: flex; justify-content: space-between; align-items: center; gap: 1rem;
  padding: 0.8rem 1rem; background: var(--superficie); border-bottom: 1px solid var(--borde);
}
.kiosko-empresa { font-weight: 700; font-size: 1.15rem; }
.kiosko-aparato { color: var(--texto-suave); font-size: 0.85rem; }
.reloj { text-align: right; }
.reloj-hora { font-size: 1.8rem; font-weight: 700; font-variant-numeric: tabular-nums; }
.reloj-fecha { color: var(--texto-suave); font-size: 0.85rem; }
.reloj-fecha::first-letter { text-transform: uppercase; }
.kiosko-cuerpo { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 1rem; padding: 1rem; }
.kiosko-centro { max-width: 560px; margin: 0 auto; padding: 3rem 1rem; text-align: center; }
.kiosko-centro .pasos { text-align: left; display: inline-block; }

.camara { position: relative; width: min(92vw, 520px); aspect-ratio: 4 / 3; border-radius: 20px; overflow: hidden; background: #000; transition: width 0.25s; }
.camara.camara-chica { width: min(40vw, 180px); }
.camara video { width: 100%; height: 100%; object-fit: cover; transform: scaleX(-1); display: block; }
.guia {
  position: absolute; left: 50%; top: 50%; width: 46%; height: 72%; transform: translate(-50%, -50%);
  border: 4px dashed rgb(255 255 255 / 0.65); border-radius: 50%; pointer-events: none; transition: border-color 0.2s;
}
.guia-atento { border-color: #fbbf24; border-style: solid; }
.guia-malo { border-color: #f87171; border-style: solid; }
.camara-chica .guia { display: none; }
.kiosko-aviso { font-size: 1.5rem; font-weight: 700; text-align: center; margin: 0; min-height: 2.2em; }
.tono-atento { color: var(--atento); }
.tono-malo { color: var(--malo); font-size: 1.2rem; }

.tarjeta-grande {
  width: min(96vw, 560px); background: var(--superficie); border-radius: 20px; box-shadow: var(--sombra);
  padding: 1.4rem; text-align: center; border: 1px solid var(--borde);
}
.tarjeta-grande.exito.entrada { border-top: 8px solid var(--entrada); }
.tarjeta-grande.exito.salida { border-top: 8px solid var(--salida); }
.tarjeta-grande.malo { border-top: 8px solid var(--malo); }
.saludo { margin: 0; color: var(--texto-suave); font-size: 1.1rem; }
.nombre-persona { font-size: 2rem; margin: 0.2rem 0 0.4rem; }
.icono-grande { font-size: 3.5rem; line-height: 1; color: var(--entrada); }
.hora-grande { font-size: 2.6rem; font-weight: 800; margin: 0.2rem 0; font-variant-numeric: tabular-nums; }
.tabla-semana { width: 100%; border-collapse: collapse; margin: 0.6rem 0; text-align: left; font-size: 0.95rem; }
.tabla-semana td { padding: 0.35rem 0.3rem; border-bottom: 1px solid var(--borde); text-transform: none; }
.tabla-semana td:first-child::first-letter { text-transform: uppercase; }
.tabla-semana tr.apagado { color: var(--texto-suave); }
.resumen { display: grid; grid-template-columns: 1fr auto; gap: 0.3rem 1rem; text-align: left; margin: 0.8rem 0; }
.resumen dd { margin: 0; text-align: right; font-variant-numeric: tabular-nums; }
.lista-vales { list-style: none; padding: 0; margin: 0 0 1rem; text-align: left; }
.lista-vales li { display: flex; gap: 0.8rem; justify-content: space-between; padding: 0.35rem 0; border-bottom: 1px solid var(--borde); }

/* ---------- Panel ---------- */
.admin-marco {
  display: grid; grid-template-columns: 230px 1fr; min-height: 100dvh;
  /* El fondo de la columna del menú llega hasta abajo aunque la página sea larga. */
  background: linear-gradient(to right, var(--superficie) 229px, var(--borde) 229px 230px, transparent 230px);
}
.menu {
  background: var(--superficie); border-right: 1px solid var(--borde); padding: 1rem 0.6rem;
  position: sticky; top: 0; height: 100dvh; overflow: auto;
}
.menu-marca { font-weight: 800; font-size: 1.05rem; padding: 0 0.6rem 0.8rem; }
.menu-marca small { display: block; font-weight: 500; color: var(--texto-suave); }
.menu a {
  display: flex; justify-content: space-between; align-items: center; padding: 0.6rem 0.7rem; border-radius: 10px;
  color: var(--texto); text-decoration: none; font-weight: 600; min-height: 44px;
}
.menu a:hover { background: var(--superficie-2); }
.menu a.activo { background: var(--primario-suave); color: var(--primario); }
.menu .contador { background: var(--atento); color: #fff; border-radius: 999px; padding: 0 0.5rem; font-size: 0.8rem; }
.menu-pie { margin-top: 1rem; padding: 0.6rem; border-top: 1px solid var(--borde); font-size: 0.9rem; }
.contenido { padding: 1.2rem 1.4rem 4rem; max-width: 1200px; width: 100%; min-width: 0; }
.cabecera-pagina { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 0.6rem; margin-bottom: 1rem; }
.cabecera-pagina h1 { margin: 0; font-size: 1.5rem; }

@media (max-width: 820px) {
  .admin-marco { grid-template-columns: 1fr; background: none; }
  .menu {
    position: sticky; top: 0; z-index: 5; height: auto; display: flex; gap: 0.2rem; overflow-x: auto;
    padding: 0.4rem; border-right: 0; border-bottom: 1px solid var(--borde); white-space: nowrap;
  }
  .menu-marca, .menu-pie { display: none; }
  .menu a { padding: 0.45rem 0.7rem; }
  .contenido { padding: 1rem 1rem 4rem; }
}

.tarjeta { background: var(--superficie); border: 1px solid var(--borde); border-radius: var(--radio); padding: 1rem; box-shadow: var(--sombra); margin-bottom: 1rem; }
.tarjeta h2 { font-size: 1.1rem; }
.cifras { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 0.8rem; margin-bottom: 1rem; }
.cifra { background: var(--superficie); border: 1px solid var(--borde); border-radius: var(--radio); padding: 0.8rem 1rem; }
.cifra .valor { font-size: 1.7rem; font-weight: 800; font-variant-numeric: tabular-nums; }
.cifra .rotulo { color: var(--texto-suave); font-size: 0.88rem; }
.cifra.atento { border-color: var(--atento); }

.tabla-envoltura { overflow-x: auto; -webkit-overflow-scrolling: touch; }
table.tabla { width: 100%; border-collapse: collapse; font-size: 0.94rem; }
.tabla th, .tabla td { padding: 0.55rem 0.6rem; border-bottom: 1px solid var(--borde); text-align: left; vertical-align: middle; }
.tabla th { font-size: 0.8rem; text-transform: uppercase; letter-spacing: 0.03em; color: var(--texto-suave); background: var(--superficie-2); }
.tabla tr.anulada td { text-decoration: line-through; color: var(--texto-suave); }
.tabla tr.clic { cursor: pointer; }
.tabla tr.clic:hover td { background: var(--superficie-2); }
.tabla tfoot td { font-weight: 800; border-top: 2px solid var(--borde); }
/* En la planilla el nombre queda fijo a la izquierda al desplazar la tabla. */
.tabla-planilla { font-size: 0.9rem; }
.tabla-planilla > thead > tr > th:first-child,
.tabla-planilla > tbody > tr:not(.dia-detalle) > td:first-child,
.tabla-planilla > tfoot > tr > td:first-child { position: sticky; left: 0; z-index: 1; background: var(--superficie); min-width: 150px; }
.tabla-planilla > thead > tr > th:first-child { background: var(--superficie-2); }
.miniatura { width: 48px; height: 36px; object-fit: cover; border-radius: 6px; cursor: zoom-in; display: block; background: var(--superficie-2); }

.lista { list-style: none; margin: 0; padding: 0; }
.lista > li { display: flex; flex-wrap: wrap; gap: 0.4rem 1rem; justify-content: space-between; align-items: center; padding: 0.7rem 0; border-bottom: 1px solid var(--borde); }

.filtros { display: flex; flex-wrap: wrap; gap: 0.6rem; align-items: flex-end; margin-bottom: 1rem; }
.filtros .campo { margin: 0; min-width: 150px; }
.pestanas { display: flex; gap: 0.3rem; flex-wrap: wrap; margin-bottom: 1rem; }
.pestanas button { border-radius: 999px; }
.pestanas button.activa { background: var(--primario); color: var(--primario-texto); border-color: var(--primario); }

.velo { position: fixed; inset: 0; background: rgb(0 0 0 / 0.55); display: flex; align-items: center; justify-content: center; padding: 1rem; z-index: 50; }
.ventana { background: var(--superficie); border-radius: 16px; padding: 1.2rem; width: min(560px, 100%); max-height: 92dvh; overflow: auto; }
.ventana img.foto-grande { width: 100%; border-radius: 10px; }

.enrolar { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 1rem; align-items: start; }
@media (max-width: 720px) { .enrolar { grid-template-columns: 1fr; } }
.enrolar .camara { width: 100%; }
.muestras { display: flex; flex-wrap: wrap; gap: 0.5rem; }
.muestra { position: relative; }
.muestra img { width: 84px; height: 84px; object-fit: cover; border-radius: 10px; display: block; background: var(--superficie-2); }
.muestra button { position: absolute; top: 2px; right: 2px; min-height: 28px; padding: 0 0.4rem; }
.muestra-vacia { width: 84px; height: 84px; border-radius: 10px; background: var(--superficie-2); display: flex; align-items: center; justify-content: center; color: var(--texto-suave); font-size: 0.75rem; text-align: center; }

.dia-detalle { background: var(--superficie-2); }
.dia-detalle td { font-size: 0.88rem; }
.token-caja { font-family: ui-monospace, monospace; word-break: break-all; background: var(--superficie-2); padding: 0.6rem; border-radius: 8px; }

/* ---------- Boletas para imprimir ---------- */
.boletas { display: grid; gap: 1rem; }
.boleta { border: 1px solid #999; border-radius: 8px; padding: 1rem; break-inside: avoid; background: #fff; color: #000; }
.boleta h2 { font-size: 1.1rem; margin-bottom: 0.2rem; }
.boleta table { width: 100%; border-collapse: collapse; font-size: 0.9rem; }
.boleta td { padding: 0.15rem 0; }
.boleta .firma { margin-top: 2.2rem; display: flex; justify-content: space-between; gap: 2rem; }
.boleta .firma div { flex: 1; border-top: 1px solid #000; text-align: center; padding-top: 0.2rem; font-size: 0.85rem; }

@media print {
  .menu, .no-imprimir { display: none !important; }
  .admin-marco { display: block; background: none; }
  .contenido { padding: 0; max-width: none; }
  body { background: #fff; color: #000; }
  .boletas { grid-template-columns: 1fr 1fr; }
}

.mayuscula-inicial::first-letter { text-transform: uppercase; }
