:root {
  --azul: #1a2742; --azul2: #2a4a8f; --verde: #1e8e46; --verde-osc: #137a3a; --rojo: #a82033; --ambar: #b36b00;
  --fondo: #eef1f6; --texto: #1c2430; --suave: #4a5568; --borde: #cfd6e2;
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; min-height: 100%; background: var(--fondo); color: var(--texto); font-family: system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif; font-size: 17px; }
body { padding: env(safe-area-inset-top) env(safe-area-inset-right) 0 env(safe-area-inset-left); overscroll-behavior-y: contain; }
[hidden] { display: none !important; }
#app { max-width: 560px; margin: 0 auto; min-height: 100vh; }
.vista { min-height: 100vh; padding-bottom: 96px; }

/* --- entrar --- */
#v-login { padding: 28px 22px 24px; }
.login-cab { text-align: center; margin-bottom: 18px; }
.login-cab img { border-radius: 22px; box-shadow: 0 2px 10px rgba(0,0,0,.18); }
.login-cab h1 { font-size: 1.35rem; margin: 12px 0 0; color: var(--azul); }
label { display: block; font-weight: 700; margin: 16px 0 6px; color: var(--azul); }
.ayuda { font-weight: 400; color: var(--suave); }
input[type=text], input[type=password] { width: 100%; font-size: 1.6rem; padding: 12px 14px; border: 2px solid var(--borde); border-radius: 12px; background: #fff; color: var(--texto); letter-spacing: .3em; text-align: center; }
input:focus { outline: none; border-color: var(--azul2); }
.msg-error { color: var(--rojo); font-weight: 700; min-height: 1.4em; margin: 10px 0 4px; }
.pie { color: var(--suave); font-size: .9rem; text-align: center; margin: 14px 12px; }
.copyright { font-size: .74rem; margin-top: 6px; opacity: .85; }
.privacidad { font-size: .8rem; text-align: left; background: #fff; border-radius: 12px; padding: 10px 12px; color: #3d4757; }
.aviso { background: #fff3cd; color: #5c4400; padding: 10px 12px; border-radius: 10px; font-weight: 600; margin: 0 0 6px; }

/* --- botones --- */
.btn { border: 0; border-radius: 14px; font-weight: 700; font-family: inherit; cursor: pointer; }
.btn-grande { width: 100%; font-size: 1.2rem; padding: 16px; margin-top: 8px; }
.btn-azul { background: var(--azul); color: #fff; } .btn-azul:active { background: var(--azul2); }
.btn-claro { background: #fff; color: var(--azul); }
.btn-icono { background: rgba(255,255,255,.14); color: #fff; border: 0; border-radius: 12px; width: 44px; height: 44px; font-size: 1.5rem; line-height: 1; cursor: pointer; display: inline-flex; align-items: center; justify-content: center; }
.btn-icono svg { display: block; }
.btn-pequeno { background: var(--azul); color: #fff; border: 0; border-radius: 10px; padding: 8px 12px; font-size: .9rem; font-weight: 700; cursor: pointer; }
.btn-pequeno[disabled] { opacity: .5; }

/* --- cabecera y menú --- */
.cab { display: flex; align-items: center; justify-content: space-between; gap: 10px; background: var(--azul); color: #fff; padding: 14px 18px; padding-top: calc(14px + env(safe-area-inset-top)); margin: calc(-1 * env(safe-area-inset-top)) calc(-1 * env(safe-area-inset-right)) 0 calc(-1 * env(safe-area-inset-left)); }
.cab h2 { margin: 0; font-size: 1.2rem; }
.cab-txt { flex: 1; min-width: 0; }
.apps { display: flex; flex-direction: column; gap: 14px; padding: 6px 0; }
.app-btn { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 12px; width: 100%; min-height: 170px; background: var(--azul); border: 0; border-radius: 22px; padding: 30px 20px; color: #fff; font-size: 1.45rem; font-weight: 800; cursor: pointer; box-shadow: 0 6px 18px rgba(26,39,66,.30); }
.app-btn:active { transform: scale(.98); }
.app-ico { font-size: 3.2rem; line-height: 1; }
.app-nombre { text-align: center; }
.app-flecha { display: none; }
.cab-saludo { font-size: .85rem; opacity: .8; } .cab-nombre { font-size: 1.15rem; font-weight: 700; }
.menu { position: absolute; right: 12px; top: 64px; z-index: 20; background: #fff; border-radius: 12px; box-shadow: 0 6px 24px rgba(0,0,0,.28); overflow: hidden; min-width: 200px; }
.menu button { display: block; width: 100%; text-align: left; background: #fff; border: 0; padding: 14px 16px; font-size: 1rem; color: var(--texto); border-bottom: 1px solid #e6e9f0; cursor: pointer; }
.menu button:last-child { border-bottom: 0; }

/* --- mensajes/avisos de la empresa --- */
.mensajes:empty { display: none; }
.msg-card { display: flex; align-items: flex-start; gap: 10px; background: #fff8e1; border: 1px solid #f0d68a; border-left: 5px solid var(--ambar); border-radius: 12px; padding: 12px 14px; margin: 0 0 10px; box-shadow: 0 1px 4px rgba(26,39,66,.10); }
.msg-texto { flex: 1; min-width: 0; color: #4a3a00; font-size: .98rem; line-height: 1.5; white-space: pre-wrap; word-wrap: break-word; }
.msg-x { background: none; border: 0; color: #9a7b2a; font-size: 1.05rem; line-height: 1; padding: 4px; cursor: pointer; flex: none; }

/* --- banner de instalación --- */
.banner-instalar { display: flex; align-items: center; gap: 12px; background: #fff; border: 1px solid var(--borde); border-radius: 14px; padding: 12px 14px; margin: 14px 0 6px; box-shadow: 0 2px 8px rgba(26,39,66,.12); }
.banner-ico { width: 44px; height: 44px; border-radius: 10px; flex: none; }
.banner-emoji { font-size: 1.7rem; line-height: 1; flex: none; }
.banner-txt { flex: 1; min-width: 0; }
.banner-tit { font-weight: 800; color: var(--azul); font-size: 1rem; }
.banner-sub { font-size: .85rem; color: var(--suave); }
.banner-cerrar { background: none; border: 0; color: var(--suave); font-size: 1.1rem; line-height: 1; padding: 6px; cursor: pointer; flex: none; }

/* --- tarjetas --- */
.pestana { padding: 14px 16px; }
.tarjeta { background: #fff; border-radius: 16px; padding: 16px; margin-bottom: 12px; box-shadow: 0 1px 4px rgba(26,39,66,.10); }
#v-pin .tarjeta { margin: 16px; }
.estado { text-align: center; }
.estado-etiqueta { font-size: 1.5rem; font-weight: 800; color: var(--suave); }
.estado.dentro .estado-etiqueta { color: var(--verde-osc); }
.estado-sub { margin-top: 4px; color: var(--suave); font-size: .95rem; }
.ubic { display: flex; align-items: center; gap: 12px; }
.ubic-icono { font-size: 1.8rem; }
.ubic-cuerpo { flex: 1; min-width: 0; }
.ubic-txt { font-weight: 700; } .ubic-sub { font-size: .85rem; color: var(--suave); }
.ubic.ok .ubic-txt { color: var(--verde-osc); } .ubic.mal .ubic-txt { color: var(--rojo); } .ubic.aviso2 .ubic-txt { color: var(--ambar); }

/* --- botón de fichar --- */
.btn-fichar { display: block; width: 100%; height: 190px; border: 0; border-radius: 28px; font-size: 2rem; font-weight: 900; letter-spacing: .04em; color: #fff; background: var(--verde); box-shadow: 0 6px 18px rgba(30,142,70,.35); cursor: pointer; margin-top: 6px; }
.btn-fichar.salida { background: var(--azul2); box-shadow: 0 6px 18px rgba(42,74,143,.35); }
.btn-fichar:active { transform: scale(.98); }
.btn-fichar[disabled] { background: #9aa5b8; box-shadow: none; cursor: default; }

/* --- historial y horas --- */
.selector { display: flex; align-items: center; justify-content: space-between; margin-bottom: 10px; }
.selector .btn-icono { background: var(--azul); }
.selector-txt { font-size: 1.15rem; font-weight: 800; color: var(--azul); text-transform: capitalize; }
.resumen { background: var(--azul); color: #fff; border-radius: 16px; padding: 14px 16px; margin-bottom: 12px; display: flex; justify-content: space-between; gap: 10px; }
.resumen b { display: block; font-size: 1.4rem; }
.resumen span { font-size: .8rem; opacity: .85; }
.fila { background: #fff; border-radius: 14px; padding: 12px 14px; margin-bottom: 8px; display: flex; align-items: center; gap: 12px; box-shadow: 0 1px 3px rgba(26,39,66,.08); }
.fila .dia { background: var(--azul); color: #fff; border-radius: 10px; min-width: 46px; text-align: center; padding: 6px 4px; font-weight: 800; line-height: 1.1; }
.fila .dia small { display: block; font-weight: 400; font-size: .68rem; opacity: .85; text-transform: uppercase; }
.fila .cuerpo { flex: 1; min-width: 0; } .fila .horas { font-weight: 700; } .fila .dur { color: var(--suave); font-size: .9rem; }
.badge { font-size: .72rem; font-weight: 800; padding: 3px 9px; border-radius: 99px; white-space: nowrap; }
.badge.pend { background: #ffe9c2; color: #6b3d00; } .badge.pag { background: #d4efdc; color: #0f5a29; } .badge.curso { background: #d5e5ff; color: #12408c; }
.vacio { text-align: center; color: var(--suave); padding: 28px 10px; }
.barra { height: 12px; background: #dfe5ef; border-radius: 99px; overflow: hidden; margin-top: 6px; }
.barra i { display: block; height: 100%; background: var(--azul2); border-radius: 99px; }
.mes-fila { background: #fff; border-radius: 14px; padding: 10px 14px; margin-bottom: 8px; box-shadow: 0 1px 3px rgba(26,39,66,.08); }
.mes-fila .t { display: flex; justify-content: space-between; font-weight: 700; } .mes-fila .t span:last-child { font-variant-numeric: tabular-nums; }
.mes-fila.cero { padding: 8px 14px; color: #3d4757; background: #f6f8fb; }
.mes-fila.cero .barra { display: none; }

/* --- pestañas inferiores --- */
.tabs { position: fixed; left: 0; right: 0; bottom: 0; display: flex; background: #fff; border-top: 1px solid var(--borde); padding-bottom: env(safe-area-inset-bottom); z-index: 10; max-width: 560px; margin: 0 auto; }
.tabs button { flex: 1; border: 0; background: #fff; padding: 9px 4px 10px; font-size: .78rem; font-weight: 700; color: var(--suave); cursor: pointer; }
.tabs button .ico { display: block; font-size: 1.35rem; }
.tabs button.activa { color: var(--azul2); box-shadow: inset 0 3px 0 var(--azul2); }

/* --- resultado a pantalla completa --- */
.resultado { position: fixed; top: 0; right: 0; bottom: 0; left: 0; z-index: 100; display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; padding: 28px; gap: 14px; color: #fff; }
.resultado.entrada { background: var(--verde-osc); } .resultado.salida { background: var(--azul2); } .resultado.error { background: var(--rojo); } .resultado.aviso { background: var(--ambar); }
.resultado .r1 { font-size: 2.6rem; font-weight: 900; line-height: 1.1; } .resultado .r2 { font-size: 1.9rem; font-weight: 800; line-height: 1.15; } .resultado .r3 { font-size: 1.15rem; font-weight: 600; max-width: 24em; }
.resultado .btn { max-width: 320px; margin-top: 18px; }
.instalar { background: #fff; border-radius: 14px; padding: 12px 14px; margin: 18px 0 0; font-size: .92rem; color: var(--texto); box-shadow: 0 1px 4px rgba(26,39,66,.10); }
.instalar button { margin-top: 8px; width: 100%; }
@media (display-mode: standalone) { .instalar { display: none; } }

.olvido { background: #fff8e1; border: 1px solid #ffe082; }
.olvido-txt { font-size: .92rem; color: #5d4037; margin-bottom: 8px; }
.olvido-inp { width: 100%; padding: 10px; font-size: 1rem; border: 1px solid #ccc; border-radius: 8px; margin-bottom: 8px; }
.olvido-err { color: #b00020; font-size: .85rem; margin-top: 6px; }

.login-cab img.logo-riosa { width: 100%; max-width: 380px; height: auto; border-radius: 0; box-shadow: none; }
.enlace-inp { font-size: .95rem !important; letter-spacing: normal !important; text-align: left !important; }
.activar-tit { font-weight: 700; color: var(--azul); margin: 0 0 4px; }
.privacidad-card { font-size: .82rem; color: #3d4757; background: var(--fondo); border-radius: 10px; padding: 10px 12px; margin: 12px 0 0; }
.consent { display: flex; align-items: flex-start; gap: 10px; margin: 10px 0 2px; font-size: .92rem; color: var(--texto); cursor: pointer; }
.consent input { width: 22px; height: 22px; margin: 1px 0 0; flex: 0 0 auto; }
.consent.falta { color: var(--rojo); font-weight: 700; }
.consent.falta input { outline: 2px solid var(--rojo); outline-offset: 1px; }
#c-pinfichar label { margin-top: 0; }
#c-pinfichar .btn-claro { border: 2px solid var(--borde); }
