/* ARU Fichaje · el terminal de las tablets.
   Los colores son los del ERP (colores.css, tokens --fc-*) y las fuentes las mismas que usa (Inter y
   Geist, en /arc/fuentes). Pensado para pantallas de 10 a 13 pulgadas, en horizontal y en vertical:
   el reloj a un lado y el panel de fichar al otro; en vertical, uno encima del otro. */

@font-face { font-family: "Inter Arc"; src: url("/arc/fuentes/inter-variable.woff2") format("woff2"); font-weight: 100 900; font-display: swap; unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: "Inter Arc"; src: url("/arc/fuentes/inter-variable-ext.woff2") format("woff2"); font-weight: 100 900; font-display: swap; unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+1E00-1E9F, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF; }
@font-face { font-family: "Geist Arc"; src: url("/arc/fuentes/geist-variable.woff2") format("woff2"); font-weight: 100 900; font-display: swap; }

:root {
  --fx-fuente: "Inter Arc", system-ui, -apple-system, "Segoe UI", sans-serif;
  --fx-display: "Geist Arc", "Inter Arc", system-ui, sans-serif;
  --fx-radio: 22px;
  --fx-sombra: 0 1px 2px oklch(0% 0 0 / .04), 0 12px 32px -12px oklch(0% 0 0 / .12);
  --fx-hueco: clamp(16px, 2.4vw, 32px);
}

* { box-sizing: border-box; }
html, body { height: 100%; margin: 0; }
body {
  background: var(--fc-background);
  background-image: var(--fc-ambient);
  background-attachment: fixed;
  color: var(--fc-ink);
  font-family: var(--fx-fuente);
  font-size: 17px;
  line-height: 1.45;
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
  -webkit-user-select: none;
  user-select: none;
  -webkit-touch-callout: none;
  overscroll-behavior: none;
  touch-action: manipulation;
}
input, select { -webkit-user-select: text; user-select: text; }
button { font: inherit; color: inherit; cursor: pointer; }
button:disabled { cursor: default; }
:focus-visible { outline: 3px solid color-mix(in oklch, var(--fc-ink) 55%, transparent); outline-offset: 3px; }
[hidden] { display: none !important; }

.fx {
  min-height: 100dvh;
  display: grid;
  grid-template-rows: auto 1fr;
  padding: calc(env(safe-area-inset-top) + var(--fx-hueco)) calc(env(safe-area-inset-right) + var(--fx-hueco)) calc(env(safe-area-inset-bottom) + var(--fx-hueco)) calc(env(safe-area-inset-left) + var(--fx-hueco));
  gap: var(--fx-hueco);
}

/* ---- Cabecera ---- */
.fx-cab { display: flex; align-items: center; justify-content: space-between; gap: 16px; }
.fx-marca { display: flex; align-items: center; gap: 16px; min-width: 0; }
.fx-logo { height: 46px; width: auto; max-width: 160px; object-fit: contain; }
.fx-titulo { display: flex; align-items: baseline; gap: 14px; min-width: 0; }
.fx-titulo h1 {
  margin: 0;
  font-family: var(--fx-display);
  font-size: clamp(28px, 3.2vw, 38px);
  font-weight: 600;
  letter-spacing: .14em;
  text-transform: uppercase;
  line-height: 1;
}
.fx-seccion {
  display: inline-flex; align-items: center;
  padding: 6px 14px;
  border-radius: 999px;
  background: var(--fc-primary);
  color: var(--fc-on-primary);
  font-size: 14px; font-weight: 600; letter-spacing: .06em; text-transform: uppercase;
}
.fx-cab-der { display: flex; align-items: center; gap: 12px; }
.fx-conexion {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 7px 14px 7px 12px;
  border-radius: 999px;
  background: var(--fc-card);
  border: 1px solid var(--fc-border);
  font-size: 14px; color: var(--fc-muted);
}
.fx-conexion i { width: 9px; height: 9px; border-radius: 50%; background: var(--fc-muted); }
.fx-conexion[data-estado="bien"] i { background: var(--fc-success); box-shadow: 0 0 0 4px color-mix(in oklch, var(--fc-success) 18%, transparent); }
.fx-conexion[data-estado="mal"] { color: var(--fc-error); border-color: color-mix(in oklch, var(--fc-error) 35%, var(--fc-border)); }
.fx-conexion[data-estado="mal"] i { background: var(--fc-error); }
/* La X del técnico: discreta, pero con sitio para el dedo */
.fx-x {
  width: 44px; height: 44px;
  display: grid; place-items: center;
  border: 0; border-radius: 50%;
  background: transparent;
  color: color-mix(in oklch, var(--fc-muted) 70%, transparent);
}
.fx-x:active { background: var(--fc-secondary); }

/* ---- Cuerpo: reloj y panel ---- */
.fx-cuerpo {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(420px, 520px);
  align-items: center;
  gap: clamp(24px, 5vw, 72px);
  min-height: 0;
}
.fx-reloj { padding-left: clamp(0px, 2vw, 24px); }
.fx-hora {
  margin: 0;
  font-family: var(--fx-display);
  font-size: clamp(96px, 13vw, 176px);
  font-weight: 300;
  letter-spacing: -.055em;
  line-height: .9;
  font-variant-numeric: tabular-nums;
}
.fx-fecha { margin: 18px 0 0; font-size: clamp(20px, 2.2vw, 28px); color: var(--fc-ink); letter-spacing: -.01em; }
.fx-dispositivo { margin: 8px 0 0; font-size: 15px; color: var(--fc-muted); }

.fx-panel {
  background: var(--fc-card);
  border: 1px solid var(--fc-border);
  border-radius: var(--fx-radio);
  box-shadow: var(--fx-sombra);
  padding: clamp(24px, 3vw, 36px);
  min-height: 560px;
  display: grid;
  align-content: center;
}
.fx-vista { display: grid; justify-items: center; text-align: center; gap: 10px; }
.fx-vista h2 { margin: 0; font-family: var(--fx-display); font-size: 30px; font-weight: 600; letter-spacing: -.03em; line-height: 1.1; }
.fx-tenue { margin: 0; color: var(--fc-muted); }
.fx-error { min-height: 24px; margin: 4px 0 0; color: var(--fc-error); font-weight: 500; }

/* ---- Botones ---- */
.fx-btn {
  min-height: 56px;
  padding: 0 28px;
  border-radius: 999px;
  border: 1px solid transparent;
  font-size: 17px; font-weight: 600;
  transition: transform .12s ease, background-color .12s ease;
}
.fx-btn:active:not(:disabled) { transform: scale(.98); }
.fx-btn:disabled { opacity: .45; }
.fx-btn-pri { background: var(--fc-primary); color: var(--fc-on-primary); }
.fx-btn-sec { background: var(--fc-card); border-color: var(--fc-input); }
.fx-btn-sec:active { background: var(--fc-secondary); }
.fx-btn-peligro { background: var(--fc-card); border-color: color-mix(in oklch, var(--fc-error) 45%, var(--fc-input)); color: var(--fc-error); }

/* ---- DNI y PIN ---- */
.fx-paso { display: grid; justify-items: center; gap: 6px; width: 100%; }
.fx-paso-num { margin: 0; font-size: 14px; color: var(--fc-muted); font-weight: 500; }
.fx-casillas { display: flex; justify-content: center; gap: 8px; margin: 14px 0 0; }
.fx-casilla {
  width: 42px; height: 56px;
  display: grid; place-items: center;
  border-radius: 12px;
  border: 1.5px solid var(--fc-input);
  background: var(--fc-background);
  font-family: var(--fx-display);
  font-size: 28px; font-weight: 500;
  font-variant-numeric: tabular-nums;
  transition: border-color .12s ease, background-color .12s ease;
}
.fx-casilla.actual { border-color: var(--fc-ink); }
.fx-casillas-dni .fx-casilla.llena { background: var(--fc-card); }
/* El PIN: puntos, nunca los números */
.fx-casillas-pin { gap: 18px; }
.fx-casillas-pin .fx-casilla { width: 58px; height: 58px; border-radius: 50%; }
.fx-casillas-pin .fx-casilla.llena { background: var(--fc-primary); border-color: var(--fc-primary); }
.fx-casillas-pin .fx-casilla.llena::after { content: ""; }

.fx-teclado {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
  width: 100%;
  max-width: 400px;
  margin-top: 6px;
}
.fx-tecla {
  height: 78px;
  border-radius: 20px;
  border: 1px solid var(--fc-border);
  background: var(--fc-background);
  font-family: var(--fx-display);
  font-size: 34px; font-weight: 500;
  font-variant-numeric: tabular-nums;
  display: grid; place-items: center;
  transition: transform .08s ease, background-color .08s ease;
}
.fx-tecla.pulsada { transform: scale(.96); background: var(--fc-selected); }
.fx-tecla-atras { color: var(--fc-muted); }
.fx-tecla-ok { background: var(--fc-primary); color: var(--fc-on-primary); border-color: var(--fc-primary); font-family: var(--fx-fuente); font-size: 20px; font-weight: 600; }
.fx-tecla-ok:disabled { opacity: .3; }
body.fx-sin-conexion .fx-teclado { opacity: .5; }

/* ---- Identificado: lo que puede fichar ---- */
.fx-saludo { margin: 0; font-family: var(--fx-display); font-size: 34px; font-weight: 600; letter-spacing: -.03em; }
.fx-estado { margin: 0 0 14px; color: var(--fc-muted); font-size: 18px; }
.fx-acciones { display: grid; gap: 14px; width: 100%; }
.fx-accion {
  display: flex; align-items: center; gap: 18px;
  width: 100%; min-height: 96px;
  padding: 0 26px;
  border-radius: 20px;
  border: 1px solid var(--fc-input);
  background: var(--fc-card);
  text-align: left;
  transition: transform .1s ease, background-color .1s ease;
}
.fx-accion:active:not(:disabled) { transform: scale(.985); background: var(--fc-secondary); }
.fx-accion:disabled { opacity: .5; }
.fx-accion span { display: grid; }
.fx-accion b { font-family: var(--fx-display); font-size: 26px; font-weight: 600; letter-spacing: -.02em; }
.fx-accion small { color: var(--fc-muted); font-size: 15px; }
/* La que se espera (entrar si está fuera, salir si está dentro) va en tinta llena */
.fx-accion:first-child { background: var(--fc-primary); color: var(--fc-on-primary); border-color: var(--fc-primary); }
.fx-accion:first-child small { color: color-mix(in oklch, var(--fc-on-primary) 70%, transparent); }
.fx-vista[data-vista="acciones"] > .fx-btn-sec { margin-top: 10px; }
.fx-cuenta { width: 100%; height: 3px; border-radius: 3px; background: var(--fc-secondary); overflow: hidden; margin-top: 12px; }
.fx-cuenta i { display: block; height: 100%; background: var(--fc-muted); transform-origin: left; transition: transform .25s linear; }

/* ---- Hecho ---- */
.fx-ok {
  width: 96px; height: 96px; border-radius: 50%;
  display: grid; place-items: center;
  background: color-mix(in oklch, var(--fc-success) 14%, var(--fc-card));
  color: var(--fc-success);
  margin-bottom: 8px;
  animation: fx-aparece .35s cubic-bezier(.2, .9, .3, 1.3);
}
body[data-resultado="mal"] .fx-ok { background: color-mix(in oklch, var(--fc-error) 12%, var(--fc-card)); color: var(--fc-error); }
@keyframes fx-aparece { from { transform: scale(.6); opacity: 0; } to { transform: scale(1); opacity: 1; } }

/* ---- Sin autorizar ---- */
.fx-aviso-icono { width: 76px; height: 76px; border-radius: 50%; display: grid; place-items: center; background: var(--fc-secondary); color: var(--fc-muted); margin-bottom: 6px; }
.fx-vista[data-vista="sin-autorizar"] .fx-btn, .fx-vista[data-vista="fuera"] .fx-btn { margin-top: 18px; min-width: 240px; }
.fx-vista[data-vista="sin-autorizar"] .fx-tenue, .fx-vista[data-vista="fuera"] .fx-tenue { max-width: 30em; }

.fx-cargando { width: 34px; height: 34px; border-radius: 50%; border: 3px solid var(--fc-border); border-top-color: var(--fc-ink); animation: fx-gira 1s linear infinite; }
@keyframes fx-gira { to { transform: rotate(1turn); } }

/* ---- El técnico ---- */
.fx-capa {
  position: fixed; inset: 0; z-index: 10;
  display: grid; place-items: center;
  padding: 24px;
  background: color-mix(in oklch, var(--fc-ink) 28%, transparent);
  -webkit-backdrop-filter: blur(6px);
  backdrop-filter: blur(6px);
}
.fx-hoja {
  position: relative;
  width: min(620px, 100%);
  max-height: calc(100dvh - 48px);
  overflow: auto;
  background: var(--fc-card);
  border-radius: var(--fx-radio);
  box-shadow: 0 24px 64px -16px oklch(0% 0 0 / .35);
  padding: 32px;
}
.fx-hoja-cerrar { position: absolute; top: 14px; right: 14px; width: 44px; height: 44px; border: 0; border-radius: 50%; background: var(--fc-secondary); display: grid; place-items: center; }
.fx-tec-vista { display: grid; gap: 10px; }
.fx-tec-vista h2 { margin: 0 48px 0 0; font-family: var(--fx-display); font-size: 26px; font-weight: 600; letter-spacing: -.02em; }
.fx-tec-vista label, .fx-modos legend, .fx-cfg-etiqueta { margin: 8px 0 0; font-size: 14px; font-weight: 600; color: var(--fc-muted); }
.fx-tec-vista input, .fx-tec-vista select {
  width: 100%; min-height: 54px;
  padding: 0 16px;
  border-radius: 14px;
  border: 1px solid var(--fc-input);
  background: var(--fc-background);
  color: var(--fc-ink);
  font: inherit; font-size: 18px;
}
.fx-tec-vista input:focus, .fx-tec-vista select:focus { outline: none; border-color: var(--fc-ink); }
.fx-tec-vista > .fx-btn { margin-top: 10px; }
.fx-modos { border: 0; padding: 0; margin: 0; display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.fx-modos legend { grid-column: 1 / -1; padding: 0; margin-bottom: 8px; }
.fx-modo {
  display: grid; justify-items: center; gap: 10px;
  padding: 22px 12px;
  border-radius: 18px;
  border: 1.5px solid var(--fc-input);
  background: var(--fc-background);
}
.fx-modo b { font-family: var(--fx-display); font-size: 20px; font-weight: 600; letter-spacing: .08em; text-transform: uppercase; }
.fx-modo-icono { color: var(--fc-muted); }
.fx-modo.elegido { border-color: var(--fc-primary); background: var(--fc-primary); color: var(--fc-on-primary); }
.fx-modo.elegido .fx-modo-icono { color: inherit; }
.fx-ficha { display: grid; grid-template-columns: max-content 1fr; gap: 8px 18px; margin: 8px 0 4px; padding: 16px 18px; border-radius: 16px; background: var(--fc-background); border: 1px solid var(--fc-border); }
.fx-ficha dt { color: var(--fc-muted); font-size: 15px; }
.fx-ficha dd { margin: 0; font-weight: 500; overflow-wrap: anywhere; }
.fx-cfg-botones { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 6px; }
.fx-cfg-historial { margin-top: 6px; font-size: 15px; }
.fx-cfg-historial summary { cursor: pointer; color: var(--fc-muted); font-weight: 600; padding: 8px 0; }
.fx-cfg-historial ol { margin: 0; padding-left: 20px; color: var(--fc-muted); display: grid; gap: 4px; }

/* ---- En vertical ---- */
@media (orientation: portrait), (max-width: 980px) {
  .fx-cuerpo { grid-template-columns: 1fr; align-content: start; gap: var(--fx-hueco); }
  .fx-reloj { padding: 0; text-align: center; }
  .fx-hora { font-size: clamp(84px, 16vw, 140px); }
  .fx-fecha { margin-top: 10px; }
  .fx-panel { width: min(560px, 100%); justify-self: center; min-height: 0; }
}
@media (max-width: 560px) {
  .fx-titulo { flex-direction: column; gap: 6px; align-items: flex-start; }
  .fx-conexion span { display: none; }
  .fx-casilla { width: 34px; height: 48px; font-size: 22px; }
  .fx-cfg-botones { grid-template-columns: 1fr; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}
