@import url('https://fonts.googleapis.com/css2?family=Google+Sans:ital,opsz,wght@0,17..18,400..700;1,17..18,400..700&family=Open+Sans:ital,wght@0,300..800;1,300..800&display=swap');

/* ==========================================================
   Tokens
   ========================================================== */
:root {
  --bg: #E9EDF0;
  --surface: #FFFFFF;
  --ink: #1C2530;
  --ink-soft: #5B6572;
  --line: #D5DBE0;
  --accent: #C08A3E;
  --accent-dark: #9C6D2C;
  --entrada: #2F7A56;
  --salida: #B8452F;
  --fuente-display: 'Google Sans', Georgia, serif;
  --fuente-body: 'Google Sans', system-ui, sans-serif;
  --fuente-mono: 'Google Sans', 'Courier New', monospace;
  --radio: 14px;
  --sombra: 0 8px 24px rgba(28, 37, 48, 0.10);
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--fuente-body);
  -webkit-font-smoothing: antialiased;
}

a {
  color: inherit;
}

button {
  font-family: inherit;
  font-size: inherit;
  cursor: pointer;
  background: none;
  border: none;
}

/*:focus-visible {
  outline: 3px solid var(--accent-dark);
  outline-offset: 2px;
}*/

@media (prefers-reduced-motion: reduce) {
  * {
    animation: none !important;
    transition: none !important;
  }
}

@media (max-width: 719.98px) {
  html {
    background: var(--surface);
    /* evita ver gris en el rebote de scroll (iOS/Android) */
  }
}

/* ==========================================================
   Elemento de firma: borde perforado tipo tarjeta de fichar
   ========================================================== */
.ficha-perforada {
  display: flex;
  justify-content: center;
  gap: 10px;
  margin-bottom: 18px;
}

.ficha-perforada span {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: var(--bg);
  box-shadow: inset 0 1px 2px rgba(28, 37, 48, 0.25);
}

/* ==========================================================
   Página de login
   ========================================================== */
.pagina-login {
  height: 100vh;
  height: 100dvh;
  /* tiene en cuenta la barra del navegador en móvil */
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: var(--surface);
  /* blanco puro en móvil, sin fondo gris */
}

.tarjeta-login {
  width: 100%;
  max-width: 380px;
  background: var(--surface);
  border-radius: 0;
  box-shadow: none;
  padding: 32px 28px 28px;
  text-align: center;
}

.marca {
  font-family: var(--fuente-display);
  font-weight: 700;
  font-size: 1.5rem;
  letter-spacing: 0.01em;
  color: #000;
  margin: 0 0 2px;
}

.subtitulo {
  margin: 0 0 22px;
  color: var(--ink-soft);
  font-size: 0.92rem;
}

.form-login {
  display: flex;
  flex-direction: column;
  gap: 6px;
  text-align: left;
}

.form-login label {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--ink-soft);
  margin-top: 10px;
}

.form-login input {
  padding: 12px 14px;
  border: 1.5px solid var(--line);
  border-radius: 10px;
  font-size: 1rem;
  font-family: var(--fuente-body);
  background: var(--bg);
  color: var(--ink);
}

.form-login input:focus {
  border-color: var(--accent);
  background: var(--surface);
}

.boton-primario {
  margin-top: 20px;
  padding: 13px;
  border: none;
  border-radius: 10px;
  background: var(--ink);
  color: #fff;
  font-size: 1rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  transition: transform 0.12s ease, background 0.15s ease;
}

.boton-primario:hover {
  background: var(--accent-dark);
}

.boton-primario:active {
  transform: scale(0.98);
}

.mensaje-error {
  background: #FBEAE5;
  color: var(--salida);
  border: 1px solid #F0C7BB;
  padding: 10px 12px;
  border-radius: 8px;
  font-size: 0.88rem;
  margin: 0 0 6px;
}

/* ==========================================================
   Cabecera de la app
   ========================================================== */
.cabecera {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 20px;
  background: var(--surface);
  justify-content: space-between;
  width: 100%;
}

.cabecera-marca {
  display: flex;
  flex-direction: column;
  width: 100%;
  /* O el ancho que necesites */
  font-family: var(--fuente-display);
  font-weight: 700;
  font-size: 1rem;
  letter-spacing: 0.01em;
  color: #000;
}

.cabecera-usuario {
  display: flex;
  justify-content: flex-end;
  /* Alinea todo al final (derecha) */
  gap: 5px;
  font-size: 1rem;
  width: 100%;
}

.nombre-empleado {
  color: var(--ink-soft);
}

.enlace-salir {
  text-decoration: none;
  font-weight: 600;
  color: var(--accent-dark);
  border: 1.5px solid var(--accent);
  padding: 6px 12px;
  border-radius: 20px;
}

.enlace-salir:hover {
  background: var(--accent);
  color: #fff;
}

/* ==========================================================
   Layout principal (mobile-first)

   En móvil los 3 bloques (cabecera, panel de fichar, historial)
   ocupan exactamente la pantalla, apilados y sin huecos entre
   ellos. La cabecera y el panel de fichar quedan fijos; solo el
   listado de fichajes de hoy hace scroll internamente.
   A partir del punto de corte de escritorio se vuelve al
   comportamiento normal de página (con scroll de toda la página).
   ========================================================== */
html,
body {
  height: 100%;
}

.pagina-app {
  height: 100vh;
  height: 100dvh;
  /* tiene en cuenta la barra del navegador en móvil */
  display: flex;
  flex-direction: column;
  overflow: hidden;
  /* la página no se mueve; solo el historial interno */
}

.cabecera {
  flex: 0 0 auto;
}

.contenedor-app {
  flex: 1 1 auto;
  min-height: 0;
  /* imprescindible para que el hijo con scroll funcione dentro de flex */
  display: flex;
  flex-direction: column;
  max-width: 920px;
  width: 100%;
  margin: 0 auto;
  padding: 0;
  gap: 0;
}

.panel-fichar,
.panel-historial {
  background: var(--surface);
  border-radius: 0;
  box-shadow: none;
  padding: 14px 22px;
  border: none;
  border-top: 1px dotted silver;
}

.panel-fichar {
  flex: 0 0 auto;
  text-align: center;
}

.panel-historial {
  flex: 1 1 auto;
  min-height: 0;
  /* permite que el <ul> interno haga scroll en vez del panel entero */
  display: flex;
  flex-direction: column;
}

.panel-historial h2 {
  flex: 0 0 auto;
}

.lista-ticket {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}

.fecha-hoy {
  margin: 0 0 4px;
  color: var(--ink-soft);
  font-size: 1rem;
  text-transform: capitalize;
}

.reloj {
  font-family: var(--fuente-mono);
  font-size: clamp(2.4rem, 9vw, 3.2rem);
  font-weight: 600;
  letter-spacing: 0.02em;
  margin: 0 0 10px;
  font-variant-numeric: tabular-nums;
}

.estado-actual {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  font-size: 1rem;
  font-weight: 700;
  color: var(--salida);
  background: #FBEAE5;
  border: 1.5px solid #F0C7BB;
  padding: 10px 20px;
  border-radius: 999px;
  margin-bottom: 26px;
}

.estado-dentro .estado-actual {
  color: var(--entrada);
  background: #E7F2EC;
  border-color: #BFDECE;
}

.punto-estado {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--salida);
  box-shadow: 0 0 0 4px rgba(184, 69, 47, 0.15);
  flex-shrink: 0;
}

.estado-dentro .punto-estado {
  background: var(--entrada);
  box-shadow: 0 0 0 4px rgba(47, 122, 86, 0.15);
}

/* Botón "estampar" — el elemento interactivo principal.
   Rectangular, con un borde inferior grueso que simula la palanca
   de un reloj de fichar mecánico. */
.boton-estampar {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  min-height: 84px;
  padding: 18px 24px;
  border: none;
  border-radius: 16px;
  background: linear-gradient(180deg, var(--entrada), #245f43);
  background: var(--entrada);
  color: #fff;
  font-family: var(--fuente-display);
  font-weight: 500;
  font-size: 1.5rem;
  letter-spacing: 0.04em;
  transition: transform 0.08s ease, box-shadow 0.08s ease;
}

.estado-dentro .boton-estampar {
  background: linear-gradient(180deg, var(--salida), #7c2f1e);
  background: var(--salida);
}

.boton-estampar:active {
  transform: translateY(6px);
  box-shadow:
    0 1px 0 var(--accent-dark),
    0 4px 10px rgba(28, 37, 48, 0.2);
}

.boton-estampar:disabled {
  opacity: 0.6;
  cursor: wait;
}

.horas-hoy {
  margin: 22px 0 0;
  font-size: 1.3rem;
  color: var(--ink-soft);
}

.horas-hoy strong {
  font-family: var(--fuente-mono);
  color: var(--ink);
}

/* ==========================================================
   Panel historial (ticket perforado)
   ========================================================== */
.panel-historial h2 {
  font-family: var(--fuente-display);
  font-size: 1.05rem;
  margin: 6px 6px;
}

.lista-ticket {
  list-style: none;
  margin: 0;
  padding: 0;
}

.ticket-linea {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin: 6px 6px;
  padding: 25px 14px;
  border-radius: 10px;
  font-size: 1rem;
  background: rgb(238, 248, 243);
  /* fondo verde muy tenue para entradas */
}

.ticket-salida {
  background: rgb(250, 246, 244);
  /* fondo rojo muy tenue para salidas */
}

.ticket-linea:first-child {
  margin-top: 10px;
}

.ticket-linea:last-child {
  margin-bottom: 10px;
}

.ticket-datos {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.ticket-tipo {
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 500;
}

.ticket-direccion {
  font-size: 0.85rem;
  color: var(--ink-soft);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 220px;
}

.ticket-hora {
  font-size: 1.5rem;
  font-family: var(--fuente-mono);
  font-weight: 600;
  color: var(--ink-soft);
}

.ticket-vacio {
  color: var(--ink-soft);
  font-size: 0.9rem;
  text-align: center;
  padding: 18px 0;
}

/* ==========================================================
   Punto de corte: escritorio / pantallas anchas
   El layout pasa de una columna (mano/pulgar) a dos columnas.
   ========================================================== */
@media (min-width: 720px) {
  .pagina-login {
    height: auto;
    min-height: 100vh;
    background:
      radial-gradient(circle at 15% 10%, rgba(192, 138, 62, 0.10), transparent 45%),
      var(--bg);
  }

  .tarjeta-login {
    border-radius: var(--radio);
    box-shadow: var(--sombra);
    border: 1px solid silver;
  }

  .pagina-app {
    height: auto;
    overflow: visible;
    /* en escritorio vuelve a ser la página entera la que hace scroll */
  }

  .contenedor-app {
    display: grid;
    grid-template-columns: 1fr 1fr;
    align-items: start;
    gap: 20px;
    padding: 32px 24px;
  }

  .panel-fichar,
  .panel-historial {
    border-radius: var(--radio);
    box-shadow: var(--sombra);
    border: 1px solid silver;
  }

  .panel-fichar {
    padding: 34px 30px;
  }

  .panel-historial {
    display: block;
    /* deja de ser columna flex con scroll interno */
  }

  .lista-ticket {
    overflow-y: visible;
  }
}

@media (min-width: 1000px) {
  .contenedor-app {
    max-width: 1040px;
    gap: 26px;
  }
}