/* Interfaz provisional. Sin recursos externos: tipografía del sistema e íconos SVG en línea. */
:root {
  --fondo: #f5f6f8;
  --superficie: #ffffff;
  --tinta: #14181f;
  --tinta-suave: #5b6472;
  --linea: #dde1e7;
  --marca: #1d4ed8;
  --sobre-marca: #ffffff;
  --marca-fuerte: #0f172a;
  --sobre-marca-fuerte: #ffffff;
  --entrada: #15803d;
  --pausa: #b45309;
  --alerta: #b42318;
  --radio: 8px;
  --radio-grande: 14px;
}
* { box-sizing: border-box; }
html { font-size: 17px; -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--fondo);
  color: var(--tinta);
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  line-height: 1.45;
  min-height: 100vh;
}
h1, h2, h3 { line-height: 1.2; margin: 0 0 .5rem; }
h1 { font-size: 1.5rem; }
h2 { font-size: 1.2rem; }
a { color: var(--marca); }
:focus-visible { outline: 3px solid var(--marca); outline-offset: 2px; }
/* El contenedor principal recibe el foco por código (para lectores de pantalla), sin marco visible. */
[tabindex="-1"]:focus, [tabindex="-1"]:focus-visible { outline: none; }
.solo-lector { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
[hidden] { display: none !important; }

/* Estructura */
.barra { background: var(--marca); color: var(--sobre-marca); display: flex; align-items: center; gap: .75rem; padding: .6rem 1rem; min-height: 52px; }
.barra img { height: 32px; width: auto; max-width: 120px; object-fit: contain; border-radius: 4px; background: #fff; }
.barra .nombre { font-weight: 600; flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.etiqueta-demo { font-size: .72rem; letter-spacing: .02em; border: 1px solid currentColor; border-radius: 99px; padding: .05rem .5rem; opacity: .85; }
.armazon { display: block; }
.contenido { padding: 1rem; max-width: 760px; margin: 0 auto; padding-bottom: 5.5rem; }
.contenido.ancho { max-width: 1180px; }
.contenido.angosto { max-width: 26rem; }
.nav-inferior { position: fixed; left: 0; right: 0; bottom: 0; background: var(--superficie); border-top: 1px solid var(--linea); display: flex; z-index: 5; }
.nav-inferior a { flex: 1; text-align: center; padding: .7rem .25rem; min-height: 56px; color: var(--tinta-suave); text-decoration: none; font-size: .88rem; display: flex; flex-direction: column; align-items: center; gap: 2px; justify-content: center; }
.nav-inferior a[aria-current="page"] { color: var(--marca); font-weight: 600; }
.nav-lateral { display: none; }
.nav-lateral a, .nav-inferior a { -webkit-tap-highlight-color: transparent; }
svg.icono { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; flex: none; }

@media (min-width: 900px) {
  .armazon.con-lateral { display: grid; grid-template-columns: 240px 1fr; align-items: start; }
  .con-lateral .nav-lateral { display: block; position: sticky; top: 0; padding: 1rem .75rem; min-height: calc(100vh - 52px); background: var(--superficie); border-right: 1px solid var(--linea); }
  .con-lateral .nav-lateral a { display: flex; align-items: center; gap: .6rem; padding: .6rem .75rem; min-height: 44px; border-radius: var(--radio); color: var(--tinta); text-decoration: none; }
  .con-lateral .nav-lateral a[aria-current="page"] { background: var(--fondo); color: var(--marca); font-weight: 600; }
  .con-lateral .nav-lateral .cerrar-sesion { width: 100%; justify-content: flex-start; padding: .6rem .75rem; color: var(--tinta); }
  .con-lateral .nav-lateral h3 { font-size: .75rem; color: var(--tinta-suave); text-transform: none; margin: 1rem .75rem .25rem; }
  .nav-inferior.solo-celular { display: none; }
  .con-lateral .nav-lateral.movil { display: none; }
  .contenido { padding-bottom: 2rem; }
}
@media (max-width: 899px) {
  .nav-lateral.movil { display: block; background: var(--superficie); border-bottom: 1px solid var(--linea); padding: .25rem .5rem; overflow-x: auto; white-space: nowrap; }
  .nav-lateral.movil .cerrar-sesion { display: inline-flex; color: var(--tinta); }
  .nav-lateral.movil a { display: inline-block; padding: .65rem .8rem; min-height: 44px; color: var(--tinta); text-decoration: none; }
  .nav-lateral.movil a[aria-current="page"] { color: var(--marca); font-weight: 600; border-bottom: 3px solid var(--marca); }
  .nav-lateral.movil h3 { display: none; }
}

/* Piezas */
.tarjeta { background: var(--superficie); border: 1px solid var(--linea); border-radius: var(--radio); padding: 1rem; margin-bottom: 1rem; }
.tarjeta.sin-borde { border: 0; padding: 0; background: none; }
.suave { color: var(--tinta-suave); }
.fila { display: flex; gap: .75rem; align-items: center; flex-wrap: wrap; }
.fila.entre { justify-content: space-between; }
.rejilla { display: grid; gap: .75rem; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); }
.contador { background: var(--superficie); border: 1px solid var(--linea); border-radius: var(--radio); padding: .75rem 1rem; }
.contador .numero { font-size: 1.9rem; font-weight: 600; font-variant-numeric: tabular-nums; }
.contador .nombre { color: var(--tinta-suave); font-size: .88rem; }

button, .boton { font: inherit; cursor: pointer; border-radius: var(--radio); border: 1px solid var(--linea); background: var(--superficie); color: var(--tinta); padding: .6rem 1rem; min-height: 44px; display: inline-flex; align-items: center; justify-content: center; gap: .5rem; text-decoration: none; }
button:disabled { opacity: .55; cursor: not-allowed; }
.boton-principal { background: var(--marca); color: var(--sobre-marca); border-color: transparent; }
.boton-entrada { background: var(--entrada); color: #fff; border-color: transparent; }
.boton-pausa { background: var(--pausa); color: #fff; border-color: transparent; }
.boton-salida { background: var(--marca-fuerte); color: var(--sobre-marca-fuerte); border-color: transparent; }
.boton-peligro { background: var(--alerta); color: #fff; border-color: transparent; }
.boton-grande { width: 100%; min-height: 64px; font-size: 1.25rem; font-weight: 600; border-radius: var(--radio-grande); }
.boton-secundario { width: 100%; min-height: 52px; font-weight: 600; background: transparent; border-width: 2px; }
.boton-contorno-pausa { color: var(--pausa); border-color: var(--pausa); }
.boton-contorno-salida { color: var(--marca-fuerte); border-color: var(--marca-fuerte); }
.boton-contorno-entrada { color: var(--entrada); border-color: var(--entrada); }
.boton-texto { background: none; border-color: transparent; color: var(--marca); }

label { display: block; font-weight: 600; margin-bottom: .25rem; }
.campo { margin-bottom: 1rem; }
.campo .ayuda { color: var(--tinta-suave); font-size: .88rem; margin-top: .25rem; }
.campo .error { color: var(--alerta); font-size: .9rem; margin-top: .25rem; }
input, select, textarea { font: inherit; width: 100%; min-height: 44px; padding: .55rem .7rem; border: 1px solid #aab1bd; border-radius: var(--radio); background: #fff; color: var(--tinta); }
input[type="checkbox"], input[type="radio"] { width: auto; min-height: 0; }
input[aria-invalid="true"] { border-color: var(--alerta); }
input.pin { font-size: 1.6rem; letter-spacing: .4em; text-align: center; font-variant-numeric: tabular-nums; }

.aviso { border-radius: var(--radio); padding: .75rem 1rem; margin-bottom: 1rem; border: 1px solid var(--linea); background: var(--superficie); }
.aviso.alerta { border-color: var(--alerta); color: var(--alerta); background: #fff5f4; }
.aviso.exito { border-color: var(--entrada); color: #14532d; background: #f0fdf4; }
.aviso.info { border-color: var(--linea); }

/* El reloj y el talón */
.reloj { font-variant-numeric: tabular-nums; font-weight: 600; font-size: clamp(3.5rem, 18vw, 5.5rem); text-align: center; line-height: 1; margin: 1rem 0 .25rem; letter-spacing: -.02em; }
.estado { text-align: center; font-size: 1.1rem; margin-bottom: 1.25rem; }
.estado .marca { display: inline-block; padding: .1rem .7rem; border-radius: 99px; border: 1px solid currentColor; font-weight: 600; }
.estado .abierta { color: var(--entrada); }
.estado .pausa { color: var(--pausa); }
.acciones { display: grid; gap: .6rem; margin-bottom: 1.25rem; }
.totales { display: grid; grid-template-columns: 1fr auto; gap: .25rem 1rem; margin-bottom: 1rem; font-variant-numeric: tabular-nums; }
.totales dt { color: var(--tinta-suave); }
.totales dd { margin: 0; text-align: right; font-weight: 600; }
.talon { background: var(--superficie); border: 1px solid var(--linea); border-top: 2px dashed var(--tinta-suave); border-radius: 0 0 var(--radio) var(--radio); padding: .9rem 1rem; margin-bottom: 1rem; position: relative; }
.talon::before { content: ""; position: absolute; left: 0; right: 0; top: -8px; height: 6px; background: radial-gradient(circle at 6px 0, var(--fondo) 3px, transparent 3.5px) 0 0 / 14px 6px repeat-x; }
.talon h3 { font-size: .8rem; color: var(--tinta-suave); font-weight: 600; margin: 0 0 .35rem; }
.talon .linea { display: flex; justify-content: space-between; gap: 1rem; font-variant-numeric: tabular-nums; }
.talon .tipo { font-weight: 600; }
.talon .hash { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; }
.talon.nuevo { animation: aparece .2s ease-out; }
@keyframes aparece { from { transform: translateY(-8px); opacity: 0; } to { transform: none; opacity: 1; } }
@media (prefers-reduced-motion: reduce) { .talon.nuevo { animation: none; } }

.linea-tiempo { list-style: none; margin: 0; padding: 0 0 0 1rem; border-left: 2px solid var(--linea); }
.linea-tiempo li { position: relative; padding: 0 0 1rem 1rem; }
.linea-tiempo li::before { content: ""; position: absolute; left: -1.45rem; top: .35rem; width: 12px; height: 12px; border-radius: 50%; background: var(--tinta-suave); border: 2px solid var(--fondo); }
.linea-tiempo li.entrada::before { background: var(--entrada); }
.linea-tiempo li.pausa::before { background: var(--pausa); }
.linea-tiempo li.salida::before { background: var(--marca-fuerte); }
.linea-tiempo .hora { font-weight: 600; font-variant-numeric: tabular-nums; }
.linea-tiempo button.hash { all: unset; cursor: pointer; font-family: ui-monospace, monospace; color: var(--marca); text-decoration: underline; font-size: .9rem; }
.lista-pausas { list-style: none; margin: 0 0 .75rem; padding: 0; font-variant-numeric: tabular-nums; }
details.jornada { border-top: 1px solid var(--linea); padding: .5rem 0; }
details.jornada > summary { cursor: pointer; min-height: 44px; align-items: center; }
details.jornada h3 { font-size: .85rem; color: var(--tinta-suave); margin: .75rem 0 .25rem; }
.sin-salida { color: var(--alerta); font-weight: 600; }

/* Tablas: en celular cada fila es una tarjeta */
.envoltura-tabla { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; background: var(--superficie); }
th, td { text-align: left; padding: .6rem .7rem; border-bottom: 1px solid var(--linea); vertical-align: top; }
thead th { position: sticky; top: 0; background: var(--superficie); z-index: 1; font-size: .85rem; color: var(--tinta-suave); border-bottom: 2px solid var(--linea); }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; }
.etiqueta { display: inline-block; font-size: .8rem; padding: .05rem .55rem; border-radius: 99px; border: 1px solid currentColor; white-space: nowrap; }
.etiqueta.verde { color: var(--entrada); }
.etiqueta.ambar { color: var(--pausa); }
.etiqueta.roja { color: var(--alerta); }
.etiqueta.gris { color: var(--tinta-suave); }
@media (max-width: 700px) {
  table.tarjetas, table.tarjetas tbody, table.tarjetas tr, table.tarjetas td { display: block; width: 100%; }
  table.tarjetas thead { position: absolute; left: -9999px; }
  table.tarjetas tr { background: var(--superficie); border: 1px solid var(--linea); border-radius: var(--radio); margin-bottom: .75rem; padding: .35rem .25rem; }
  table.tarjetas td { border: 0; padding: .3rem .7rem; display: flex; justify-content: space-between; gap: 1rem; text-align: right; }
  table.tarjetas td::before { content: attr(data-etiqueta); color: var(--tinta-suave); text-align: left; flex: none; }
}

.panel-formulario { border: 1px solid var(--linea); border-radius: var(--radio); background: var(--superficie); padding: 1rem; margin-bottom: 1rem; }
.pin-temporal { font-size: 2rem; font-weight: 600; letter-spacing: .3em; font-variant-numeric: tabular-nums; text-align: center; padding: .5rem; border: 2px dashed var(--alerta); border-radius: var(--radio); margin: .5rem 0; }
.hoja-impresion { display: none; }

@page { size: letter; margin: 1.5cm; }

@media print {
  body > .armazon, .barra, .nav-inferior { display: none !important; }
  .hoja-impresion { display: block !important; text-align: center; padding: 2rem; }
  .hoja-impresion img { width: 14cm; height: 14cm; }
  .hoja-impresion h1 { font-size: 2rem; margin: 0 0 .25rem; }
  .hoja-impresion h2 { font-size: 1.4rem; font-weight: 400; margin: 0 0 1rem; }
  .hoja-impresion .codigo-corto { font-family: ui-monospace, monospace; font-size: 1.2rem; }
  .hoja-impresion p { font-size: 1.4rem; }
}
