/* =========================================================
   Control de Asistencia — identidad "reloj checador"
   Grafito + latón, ficha de cartulina, sello de tinta.
   ========================================================= */

:root {
  --grafito: #1c2129;
  --grafito-2: #262c36;
  --latón: #b8873b;
  --latón-claro: #d9ab5c;
  --papel: #f1efe6;
  --papel-2: #e6e1d2;
  --tinta: #23262b;
  --verde: #2f6f4f;
  --ambar: #a9752c;
  --azul: #35607a;
  --rojo: #a3272c;
  --sombra: 0 18px 40px -18px rgba(15, 15, 10, 0.55);
  --radio: 14px;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  min-height: 100vh;
  background: radial-gradient(circle at 50% -10%, #2b3240 0%, var(--grafito) 55%);
  font-family: -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  color: var(--tinta);
  display: flex;
  justify-content: center;
  padding: 24px 16px 48px;
}

.app { width: 100%; max-width: 460px; }

.oculto { display: none !important; }

/* ---------- Encabezado ---------- */
.app-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  color: var(--papel);
  padding: 4px 6px 20px;
}

.app-header__marca {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.12em;
  color: var(--latón-claro);
}

.app-header__engranaje { font-size: 16px; }

.app-header__reloj {
  font-family: "Courier New", ui-monospace, monospace;
  font-variant-numeric: tabular-nums;
  font-size: 22px;
  font-weight: 700;
  letter-spacing: 0.06em;
  color: var(--latón-claro);
  text-shadow: 0 0 12px rgba(217, 171, 92, 0.35);
}

/* ---------- Tarjeta principal ---------- */
.tarjeta {
  background: var(--papel);
  border-radius: var(--radio);
  box-shadow: var(--sombra);
  padding: 22px 22px 26px;
  position: relative;
  border: 1px solid var(--papel-2);
}

.tarjeta::before {
  /* borde perforado superior, como una ficha de tarjetero */
  content: "";
  position: absolute;
  top: -9px;
  left: 24px;
  right: 24px;
  height: 18px;
  background-image: radial-gradient(circle, var(--grafito) 4px, transparent 4.5px);
  background-size: 20px 18px;
  background-repeat: repeat-x;
  background-position: center;
}

/* ---------- Cámara ---------- */
.camara-box {
  position: relative;
  width: 100%;
  aspect-ratio: 4 / 3;
  background: var(--grafito);
  border-radius: 10px;
  overflow: hidden;
  margin-bottom: 18px;
  border: 3px solid var(--grafito-2);
}

.camara-box video {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transform: scaleX(-1); /* efecto espejo, más natural */
}

.camara-estado {
  position: absolute;
  inset: 0;
  margin: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 12px;
  color: var(--papel);
  font-size: 13px;
  background: rgba(28, 33, 41, 0.85);
}

/* ---------- Paso: cédula ---------- */
.paso label {
  display: block;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--grafito-2);
  margin-bottom: 6px;
}

.fila-cedula { display: flex; gap: 8px; }

.fila-cedula input {
  flex: 1;
  padding: 13px 14px;
  border: 2px solid var(--papel-2);
  border-radius: 10px;
  font-size: 17px;
  background: #fff;
  color: var(--tinta);
}

.fila-cedula input:focus {
  outline: none;
  border-color: var(--latón);
}

.fila-cedula button,
.btn-nueva {
  padding: 13px 18px;
  border: none;
  border-radius: 10px;
  background: var(--grafito);
  color: var(--papel);
  font-weight: 700;
  letter-spacing: 0.04em;
  cursor: pointer;
}

.fila-cedula button:hover,
.btn-nueva:hover { background: var(--grafito-2); }
.fila-cedula button:disabled { opacity: 0.6; cursor: default; }

.mensaje { min-height: 18px; font-size: 13px; margin: 8px 2px 0; color: var(--azul); }
.mensaje--error { color: var(--rojo); font-weight: 600; }

/* ---------- Paso: empleado ---------- */
.empleado {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
  padding-bottom: 14px;
  margin-bottom: 14px;
  border-bottom: 1px dashed var(--papel-2);
}

.empleado__nombre { margin: 0; font-size: 18px; font-weight: 800; color: var(--tinta); }
.empleado__cedula { margin: 2px 0 0; font-size: 13px; color: #6b6455; }
.empleado__sugerencia { margin: 6px 0 0; font-size: 12px; color: var(--azul); }

.enlace {
  border: none;
  background: none;
  color: var(--rojo);
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  white-space: nowrap;
}

.instruccion { font-size: 13px; color: #6b6455; margin: 0 0 12px; }

.botones-marcacion {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.btn-marca {
  border: none;
  border-radius: 12px;
  padding: 18px 8px;
  color: #fff;
  font-weight: 800;
  font-size: 14px;
  line-height: 1.3;
  letter-spacing: 0.02em;
  cursor: pointer;
  box-shadow: 0 8px 16px -8px rgba(0,0,0,0.35);
  transition: transform 0.12s ease;
}
.btn-marca:active { transform: scale(0.97); }
.btn-marca:disabled { opacity: 0.55; cursor: default; }

.btn-marca--entrada_trabajo  { background: var(--verde); }
.btn-marca--salida_almuerzo  { background: var(--ambar); }
.btn-marca--entrada_almuerzo { background: var(--azul); }
.btn-marca--salida_trabajo   { background: var(--rojo); }

/* ---------- Paso: confirmación (ticket sellado) ---------- */
.ticket {
  position: relative;
  background: #fffdf7;
  border: 1px solid var(--papel-2);
  border-radius: 10px;
  padding: 18px;
  text-align: center;
  overflow: hidden;
}

.ticket__foto {
  width: 120px;
  height: 120px;
  object-fit: cover;
  border-radius: 8px;
  border: 4px solid #fff;
  box-shadow: 0 6px 14px -6px rgba(0,0,0,0.4);
  transform: rotate(-3deg);
  margin-bottom: 10px;
}

.sello {
  display: inline-block;
  margin: 6px auto 12px;
  padding: 6px 16px;
  border: 3px solid var(--rojo);
  border-radius: 6px;
  color: var(--rojo);
  font-weight: 900;
  letter-spacing: 0.12em;
  font-size: 13px;
  transform: rotate(-6deg);
  opacity: 0.9;
}

.ticket__titulo { margin: 0; font-size: 16px; font-weight: 800; color: var(--tinta); }
.ticket__detalle { margin: 4px 0 0; font-size: 13px; color: #6b6455; }

.btn-nueva { width: 100%; margin-top: 16px; padding: 14px; }

/* ---------- Pie ---------- */
.app-footer { text-align: center; margin-top: 18px; }
.app-footer a { color: var(--latón-claro); font-size: 12px; text-decoration: none; letter-spacing: 0.04em; }
.app-footer a:hover { text-decoration: underline; }
.app-footer__copy { margin: 6px 0 0; font-size: 11px; color: #8a8168; letter-spacing: 0.02em; }

/* =========================================================
   Portal institucional (bienvenida + login de empleados)
   ========================================================= */
:root {
  --inst-azul: #16305c;
  --inst-azul-2: #1f4e79;
  --inst-azul-claro: #2f6fa8;
  --inst-texto: #1c2a3a;
}

.portal { min-height: 100vh; display: flex; flex-direction: column; background: #eef1f5; }

.portal-header {
  background: var(--inst-azul);
  color: #fff;
  padding: 14px 24px;
  font-weight: 700;
  font-size: 15px;
  letter-spacing: 0.02em;
}

.portal-footer {
  text-align: center;
  padding: 14px 16px;
  font-size: 11px;
  color: #7c8697;
  letter-spacing: 0.02em;
}

.portal-footer p { margin: 0; }

.portal-fondo {
  position: relative;
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 32px 16px;
  background: #eef1f5;
  overflow: hidden;
}

.portal-fondo::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-image: url(../img/logo_mosaico.png);
  background-repeat: repeat;
  background-position: center;
  background-size: 190px 190px;
  opacity: 0.16;
  pointer-events: none;
}

.portal-card {
  position: relative;
  z-index: 1;
  width: 100%;
  max-width: 460px;
  background: #fff;
  border-radius: 14px;
  box-shadow: 0 20px 45px -20px rgba(15, 25, 45, 0.35);
  padding: 34px 30px;
  text-align: center;
}

.portal-logo { width: 130px; margin: 0 auto 16px; display: block; }

.portal-card h1 { font-size: 21px; color: var(--inst-azul); margin: 0 0 12px; }
.portal-card p { font-size: 14px; color: #5a6472; line-height: 1.5; margin: 0 0 24px; }

.portal-botones { display: flex; flex-direction: column; gap: 12px; }

.btn-portal {
  display: block;
  width: 100%;
  padding: 13px 16px;
  border-radius: 9px;
  font-weight: 700;
  font-size: 15px;
  text-decoration: none;
  cursor: pointer;
  border: 2px solid var(--inst-azul);
  box-sizing: border-box;
}

.btn-portal--primario { background: var(--inst-azul); color: #fff; }
.btn-portal--primario:hover { background: var(--inst-azul-2); }
.btn-portal--secundario { background: #fff; color: var(--inst-azul); }
.btn-portal--secundario:hover { background: #f0f4f9; }

/* ---------- Modales ---------- */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(15, 20, 30, 0.55);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  z-index: 100;
}

.modal-card {
  position: relative;
  width: 100%;
  max-width: 400px;
  background: #fff;
  border-radius: 14px;
  padding: 30px 26px 26px;
  box-shadow: 0 20px 45px -20px rgba(15, 25, 45, 0.45);
  text-align: center;
  max-height: 90vh;
  overflow-y: auto;
}

.modal-card--pequena { max-width: 340px; padding: 34px 26px; }

.modal-cerrar {
  position: absolute;
  top: 10px;
  right: 12px;
  border: none;
  background: none;
  font-size: 22px;
  line-height: 1;
  color: #8a93a1;
  cursor: pointer;
}
.modal-cerrar:hover { color: var(--inst-texto); }

.modal-logo { width: 90px; margin: 0 auto 10px; display: block; }

.modal-card h2 { font-size: 19px; color: var(--inst-azul); margin: 0 0 14px; }

.modal-instruccion { font-size: 13px; color: #5a6472; text-align: left; line-height: 1.4; margin: 0 0 14px; }

.modal-card label {
  display: block;
  text-align: left;
  font-size: 12px;
  font-weight: 700;
  color: var(--inst-texto);
  margin: 10px 0 5px;
}

.modal-card input[type="text"],
.modal-card input[type="password"] {
  width: 100%;
  padding: 11px 12px;
  border: 2px solid #dde3ea;
  border-radius: 8px;
  font-size: 15px;
  box-sizing: border-box;
  background: #fff;
}
.modal-card input:focus { outline: none; border-color: var(--inst-azul-claro); }

.input-password { position: relative; }
.input-password input { padding-right: 42px; }
.btn-ojo {
  position: absolute;
  right: 4px;
  top: 50%;
  transform: translateY(-50%);
  display: flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  border: none;
  background: none;
  border-radius: 6px;
  cursor: pointer;
  padding: 0;
  line-height: 1;
  color: var(--gris, #6b6455);
  opacity: 0.75;
  transition: opacity 0.15s ease, background-color 0.15s ease, color 0.15s ease;
}
.btn-ojo svg { width: 19px; height: 19px; display: block; pointer-events: none; }
.btn-ojo:hover { opacity: 1; background: rgba(0, 0, 0, 0.05); }
.btn-ojo:focus-visible { outline: 2px solid currentColor; outline-offset: 1px; opacity: 1; }
.btn-ojo.activo { opacity: 1; color: var(--tinta, #23262b); }

.requisitos-password {
  list-style: none;
  margin: 4px 0 2px;
  padding: 10px 12px 10px 10px;
  background: #f4f6f9;
  border: 1px solid #dde3ea;
  border-radius: 8px;
  font-size: 12px;
  line-height: 1.65;
  text-align: left;
}
.requisitos-password li {
  position: relative;
  padding-left: 20px;
  color: #5a6472;
  transition: color 0.15s ease;
}
.requisitos-password li::before {
  content: "•";
  position: absolute;
  left: 4px;
  color: #9aa5b1;
  font-weight: 700;
}
.requisitos-password li.cumple { color: var(--verde); }
.requisitos-password li.cumple::before { content: "✓"; color: var(--verde); }
.requisitos-password li.incumple { color: var(--rojo); }
.requisitos-password li.incumple::before { content: "✗"; color: var(--rojo); }

.modal-mensaje { min-height: 16px; font-size: 13px; color: var(--rojo); text-align: left; margin: 8px 0 0; font-weight: 600; }

.campo-politica { margin: 14px 0 4px; font-size: 12px; line-height: 1.4; color: var(--inst-texto); text-align: left; }
.campo-politica a { color: var(--inst-azul-claro); }

.btn-modal {
  width: 100%;
  margin-top: 18px;
  padding: 12px;
  border: none;
  border-radius: 8px;
  background: var(--inst-azul);
  color: #fff;
  font-weight: 700;
  font-size: 15px;
  cursor: pointer;
}
.btn-modal:hover { background: var(--inst-azul-2); }
.btn-modal--oscuro { background: #1c2129; margin-top: 22px; }
.btn-modal--oscuro:hover { background: #262c36; }
.btn-modal:disabled { opacity: 0.6; cursor: default; }

.modal-link {
  display: block;
  width: 100%;
  margin-top: 14px;
  border: none;
  background: none;
  color: var(--inst-azul-claro);
  font-size: 13px;
  text-decoration: underline;
  cursor: pointer;
}
.modal-link:hover { color: var(--inst-azul); }

.modal-texto-olvido { font-size: 14px; color: var(--inst-texto); line-height: 1.5; margin: 0 0 8px; }

/* ---------- Botón Salir (pantalla de éxito) ---------- */
.btn-salir {
  width: 100%;
  margin-top: 16px;
  padding: 13px;
  border: 2px solid var(--rojo);
  border-radius: 10px;
  background: #fff;
  color: var(--rojo);
  font-weight: 700;
  letter-spacing: 0.02em;
  cursor: pointer;
}
.btn-salir:hover { background: var(--rojo); color: #fff; }

/* ---------- Responsive ---------- */
@media (max-width: 380px) {
  .btn-marca { font-size: 13px; padding: 15px 6px; }
  .portal-card { padding: 26px 20px; }
}

/* Fondo institucional: mosaico completo de bienvenida (2026-09-15). */
body { isolation: isolate; }
.portal { background: transparent; }
.portal::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  background-color: #fff;
  background-image: linear-gradient(rgba(255,255,255,.80), rgba(255,255,255,.80)), url("../img/logo_fondo.png");
  background-repeat: repeat;
  background-position: center top;
  background-size: auto, 360px auto;
}
.portal-fondo { background: transparent; }
.portal-fondo::before { content: none; }
.portal-footer { color: #526174; }
@media (max-width: 600px) {
  .portal { width: 100%; min-width: 0; }
  .portal::before { background-size: auto, 260px auto; }
  .portal-header { padding: 14px 16px; }
}
/* Logotipo horizontal original en la bienvenida. */
.portal-logo { width: 100%; max-width: 360px; height: auto; margin: 0 auto 20px; }
