/* Human Cabs — app de la persona. Usa las variables de /shared/human.css. Mobile-first. */

:root { --h-off: #B4ADC2; --nav-h: 68px; --ease: cubic-bezier(.2, .8, .2, 1); }

body { min-height: 100vh; min-height: 100dvh; }
body.con-nav { padding-bottom: calc(var(--nav-h) + env(safe-area-inset-bottom) + 16px); }
body.sin-scroll { overflow: hidden; }
[hidden] { display: none !important; }

.saltar { position: absolute; left: -9999px; top: 8px; z-index: 50; background: #fff; padding: 8px 14px; border-radius: 10px; color: var(--h-purple-deep); }
.saltar:focus { left: 8px; }
.oculto { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

:focus-visible { outline: 3px solid var(--h-purple); outline-offset: 2px; }
h1:focus, h2:focus, main:focus { outline: none; }

/* ---------- barra superior ---------- */
.barra { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 16px 20px 6px; max-width: 560px; margin: 0 auto; }
.h-logo { font-size: 18px; }
.h-logo img { width: 26px; height: 26px; }
.barra-org { font-size: 12.5px; color: var(--h-purple-deep); background: var(--h-lavender); padding: 5px 11px; border-radius: 999px; max-width: 55%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

main { max-width: 560px; margin: 0 auto; padding: 8px 20px 24px; }
.vista { animation: subir .35s var(--ease); }
@keyframes subir { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }

.h-title { font-size: 28px; line-height: 1.15; margin-top: 14px; }
.sub { color: var(--h-ink-2); margin: 8px 0 20px; font-size: 15.5px; line-height: 1.45; }

.cargando, .adios { display: grid; justify-items: center; gap: 18px; text-align: center; padding: 18vh 0 0; color: var(--h-ink-2); }
.adios .sub { max-width: 34ch; }

/* ---------- botones ---------- */
.h-btn { min-height: 48px; height: auto; padding: 12px 20px; font-size: 16px; }
.h-btn[disabled] { opacity: .55; cursor: not-allowed; transform: none; }
.h-btn[aria-busy="true"] { cursor: progress; }
.h-btn.grande { width: 100%; min-height: 56px; font-size: 17px; border-radius: 16px; }
.h-btn.ancho { width: 100%; margin: 4px 0 16px; }
.h-btn svg { width: 22px; height: 22px; stroke: currentColor; fill: none; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.h-btn.rojo { background: #C7353B; }
.h-btn.rojo:hover { background: #A82B30; }
.h-btn.rojo-suave { background: #FCEBEC; color: #A82B30; }
.h-btn.rojo-suave:hover { background: #F8D9DB; }
.fila-botones { display: flex; gap: 10px; margin-top: 6px; }
.fila-botones .h-btn { flex: 1; padding-inline: 12px; line-height: 1.2; text-align: center; }
.h-btn.ghost:hover { background: #E4D9F8; }
.entrar[disabled] { box-shadow: none; }
.enlace { color: var(--h-purple-deep); font-weight: 500; text-decoration: underline; text-underline-offset: 3px; white-space: nowrap; }

/* ---------- entrada ---------- */
.entrada-cab { padding-top: 10px; }
.union { display: flex; gap: 12px; align-items: center; padding: 14px 16px; margin-bottom: 18px; border: 1px solid var(--h-border); }
.union p { margin: 0; color: var(--h-ink); line-height: 1.4; }
.union strong { color: var(--h-purple-deep); }
.union-ico { flex: none; width: 40px; height: 40px; border-radius: 50%; display: grid; place-items: center; background: #fff; color: var(--h-purple); }
.union-ico svg { width: 22px; height: 22px; stroke: currentColor; fill: none; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }
.union.inactiva { background: #FFF6E5; border-color: #F3DDAE; }
.union-aviso { display: block; font-size: 13.5px; color: #8A5A00; margin-top: 4px; }

.pestanas { display: grid; grid-template-columns: 1fr 1fr; gap: 4px; padding: 4px; background: var(--h-lavender); border-radius: 14px; margin-bottom: 14px; }
.pestanas button { border: 0; background: transparent; min-height: 44px; border-radius: 11px; font: 500 15px var(--h-font); color: var(--h-purple-deep); cursor: pointer; }
.pestanas button:hover { background: rgba(255, 255, 255, .55); }
.pestanas button[aria-selected="true"] { background: #fff; color: var(--h-ink); box-shadow: 0 2px 8px rgba(91, 51, 166, .12); }

.formulario { padding: 20px; display: grid; gap: 16px; }
.campo { display: grid; gap: 6px; }
.campo label { font-weight: 500; font-size: 14.5px; }
.campo small { color: var(--h-ink-2); font-size: 13px; }
.campo input {
  width: 100%; min-height: 50px; padding: 12px 14px; border: 1.5px solid #DAD2E8; border-radius: 12px;
  font: 400 16px var(--h-font); color: var(--h-ink); background: #fff;
}
.campo input:focus { border-color: var(--h-purple); outline: none; box-shadow: 0 0 0 4px rgba(123, 79, 208, .16); }
#r-codigo { text-transform: uppercase; letter-spacing: .12em; }

.consentimiento { display: grid; grid-template-columns: 24px 1fr; gap: 12px; align-items: start; padding: 14px; background: var(--h-lavender-2); border-radius: 12px; }
.consentimiento input { width: 22px; height: 22px; margin: 2px 0 0; accent-color: var(--h-purple); cursor: pointer; }
.consentimiento label { font-size: 13.5px; line-height: 1.5; color: var(--h-ink-2); cursor: pointer; }
.consentimiento label strong { color: var(--h-ink); font-weight: 600; }

.error { margin: 0; padding: 10px 12px; border-radius: 10px; background: #FDECEC; color: #9B2328; font-size: 14px; line-height: 1.4; list-style: none; }

/* ---------- inicio + Human Key ---------- */
.saludo { font-size: 30px; }
.hkey {
  position: relative; width: 100%; aspect-ratio: 1.586; border-radius: 20px; overflow: hidden;
  background:
    radial-gradient(120% 90% at 0% 0%, rgba(255, 255, 255, .75), rgba(255, 255, 255, 0) 55%),
    linear-gradient(125deg, #F1EAFC 0%, #D6C2F3 30%, #EED3F0 56%, #CFE1F7 80%, #E2D3F7 100%);
  box-shadow: 0 22px 40px -18px rgba(91, 51, 166, .55), inset 0 1px 0 rgba(255, 255, 255, .8), inset 0 0 0 1px rgba(255, 255, 255, .45);
  color: #6E5A9A;
}
.hkey::after {
  content: ""; position: absolute; inset: -50%;
  background: linear-gradient(115deg, rgba(255, 255, 255, 0) 40%, rgba(255, 255, 255, .55) 49%, rgba(198, 233, 255, .25) 53%, rgba(255, 255, 255, 0) 60%);
  animation: brillo 7s ease-in-out infinite; pointer-events: none;
}
@keyframes brillo { 0%, 55% { transform: translateX(-45%); } 100% { transform: translateX(45%); } }
.hkey .k-word { position: absolute; top: 18px; left: 20px; font-size: 18px; line-height: .95; font-weight: 500; letter-spacing: -.02em; color: #7D6AA6; }
.hkey .k-icons { position: absolute; top: 18px; right: 18px; display: flex; gap: 6px; align-items: center; color: #7D6AA6; }
.hkey .k-icons .ic { width: 18px; height: 18px; stroke: currentColor; fill: none; stroke-width: 1.6; stroke-linecap: round; }
.hkey .k-icons img { width: 24px; height: 24px; opacity: .85; }
.hkey .chip-c {
  position: absolute; left: 20px; top: 31%; width: 42px; height: 31px; border-radius: 7px;
  background: linear-gradient(135deg, #FBF8FF, #DCCFF0); box-shadow: inset 0 0 0 1px rgba(139, 120, 179, .35); overflow: hidden;
}
.hkey .chip-c::before, .hkey .chip-c::after { content: ""; position: absolute; background: rgba(139, 120, 179, .35); }
.hkey .chip-c::before { left: 0; right: 0; top: 50%; height: 1px; }
.hkey .chip-c::after { top: 0; bottom: 0; left: 50%; width: 1px; box-shadow: -9px 0 0 rgba(139, 120, 179, .25), 9px 0 0 rgba(139, 120, 179, .25); }
.hkey .k-codigo {
  position: absolute; left: 20px; right: 20px; top: 62%; transform: translateY(-50%);
  font: 600 clamp(24px, 8.4vw, 36px)/1 ui-monospace, 'SF Mono', 'Cascadia Mono', Consolas, monospace;
  letter-spacing: .14em; color: #3B2E5E; white-space: nowrap;
}
.hkey .k-name { position: absolute; right: 20px; bottom: 16px; left: 20px; text-align: right; font-size: 14px; font-weight: 500; color: #4E3F73; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.hkey .k-name small { display: block; font-size: 9px; font-weight: 500; color: #7D6AA6; letter-spacing: .12em; }
.nota-key { font-size: 13px; color: var(--h-ink-2); text-align: center; margin: 10px 0 22px; }

.entrar { box-shadow: 0 14px 30px -12px rgba(123, 79, 208, .7); }
.resumen-cabinas { display: flex; align-items: center; gap: 12px; padding: 14px 16px; margin-top: 18px; border-radius: var(--h-r); }
.resumen-cabinas p { margin: 0; flex: 1; font-size: 14.5px; line-height: 1.35; }
.aviso-org { margin: 14px 0 0; padding: 12px 14px; border-radius: 12px; background: #FFF6E5; color: #6E4700; font-size: 14px; line-height: 1.4; }

.h-dot.off { background: var(--h-off); }
.h-dot { flex: none; }

/* ---------- cabinas ---------- */
.leyenda { display: flex; flex-wrap: wrap; gap: 8px 16px; list-style: none; margin: 0 0 16px; padding: 0; font-size: 13px; color: var(--h-ink-2); }
.leyenda li { display: inline-flex; align-items: center; gap: 6px; }
.lista-cabinas, .lista-historial { list-style: none; margin: 0; padding: 0; display: grid; gap: 12px; }
.cabina { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 16px; border-radius: var(--h-r); border-left: 5px solid var(--h-off); }
.cabina.est-free { border-left-color: var(--h-free); }
.cabina.est-busy { border-left-color: var(--h-busy); }
.cabina.est-soon { border-left-color: var(--h-soon); }
.cabina-info { min-width: 0; }
.cabina-nombre { margin: 0; font-weight: 600; font-size: 16px; overflow-wrap: anywhere; }
.cabina-ubic { margin: 3px 0 0; font-size: 13.5px; color: var(--h-ink-2); overflow-wrap: anywhere; }
.cabina-estado { display: grid; justify-items: end; gap: 4px; text-align: right; flex: none; }
.cabina-estado small { font-size: 12.5px; color: var(--h-ink-2); }
.estado-chip { display: inline-flex; align-items: center; gap: 6px; white-space: nowrap; padding: 5px 11px; border-radius: 999px; font-size: 13px; font-weight: 500; }
.estado-chip.free { background: #E4F7EB; color: #17693A; }
.estado-chip.busy { background: #FDE8E9; color: #A3262B; }
.estado-chip.soon { background: #FDF3DC; color: #7A5300; }
.estado-chip.off { background: #EFEDF2; color: #5E5870; }
.actualizado { font-size: 12.5px; color: var(--h-ink-2); text-align: center; margin: 16px 0 0; }

/* ---------- estados vacíos ---------- */
.vacio { padding: 26px 22px; text-align: center; color: var(--h-ink-2); display: grid; justify-items: center; gap: 4px; }
.vacio p { margin: 0; line-height: 1.5; max-width: 36ch; }
.vacio .vacio-t { font-weight: 600; color: var(--h-ink); font-size: 17px; margin-bottom: 4px; }
.vacio .h-pulse { width: 48px; height: 48px; margin-bottom: 14px; }
.cargando-linea { color: var(--h-ink-2); font-size: 14px; padding: 12px 0; list-style: none; }

/* ---------- historial ---------- */
.sesion { padding: 16px; border-radius: var(--h-r); display: grid; gap: 12px; }
.sesion-cab { display: flex; justify-content: space-between; gap: 10px; flex-wrap: wrap; font-size: 13.5px; }
.sesion-fecha { font-weight: 600; color: var(--h-ink); text-transform: capitalize; }
.sesion-meta { color: var(--h-ink-2); }
.flujo { display: grid; grid-template-columns: 1fr auto 1fr; align-items: stretch; gap: 8px; }
.flecha { align-self: center; color: var(--h-purple-soft); font-size: 20px; }
.emo { padding: 10px 12px; border-radius: 12px; display: grid; gap: 2px; min-width: 0; }
.emo small { font-size: 11.5px; text-transform: uppercase; letter-spacing: .06em; color: var(--h-ink-2); }
.emo strong { font-size: 16px; font-weight: 600; overflow-wrap: anywhere; }
.emo .emo-det { font-size: 12px; line-height: 1.3; color: var(--h-ink-2); }
.emo.neg { background: var(--h-lavender-2); }
.emo.neg strong { color: var(--h-purple-deep); }
.emo.pos { background: #EAF8EF; }
.emo.pos strong { color: #17693A; }
.emo.pendiente { background: #F4F2F7; }
.sesion-pie { display: flex; justify-content: space-between; gap: 10px; flex-wrap: wrap; font-size: 13.5px; color: var(--h-ink-2); }
.cambio { font-weight: 600; }
.cambio.sube { color: #17693A; }
.cambio.baja { color: #A3262B; }

/* ---------- memoria ---------- */
.kpis { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.kpi { padding: 14px 10px; border-radius: var(--h-r); text-align: center; display: grid; gap: 2px; }
.kpi strong { font-size: 26px; font-weight: 600; color: var(--h-purple-deep); font-variant-numeric: tabular-nums; }
.kpi span { font-size: 12.5px; color: var(--h-ink-2); line-height: 1.25; }
.kpi.sube strong { color: #17693A; }
.kpi.baja strong { color: #A3262B; }
.nota { font-size: 13px; color: var(--h-ink-2); margin: 10px 2px 16px; line-height: 1.45; }
.barras-caja { padding: 18px 16px; }
.barras-caja h2, .bloque h2 { font-size: 17px; font-weight: 600; margin: 0 0 14px; }
.barras { list-style: none; margin: 0; padding: 0; display: grid; gap: 12px; }
.barra-fila { display: grid; grid-template-columns: 112px minmax(0, 1fr) 46px; align-items: center; gap: 10px; font-size: 14px; }
.barra-nombre { min-width: 0; overflow-wrap: anywhere; line-height: 1.2; }
.barra-fila.cero { color: #756E88; }
.barra-pista { height: 12px; border-radius: 999px; background: #F1EDF7; overflow: hidden; }
.barra-relleno { display: block; height: 100%; border-radius: 999px; transition: width .6s var(--ease); }
.barra-relleno.neg { background: linear-gradient(90deg, #B9A3EA, var(--h-purple)); }
.barra-relleno.pos { background: linear-gradient(90deg, #8BDDA6, var(--h-free)); }
.barra-pct { text-align: right; font-variant-numeric: tabular-nums; color: var(--h-ink-2); }

/* ---------- cuenta ---------- */
.datos { margin: 18px 0 14px; padding: 6px 18px; }
.datos div { display: flex; justify-content: space-between; gap: 14px; padding: 12px 0; border-bottom: 1px solid var(--h-border); }
.datos div:last-child { border-bottom: 0; }
.datos dt { color: var(--h-ink-2); font-size: 14px; }
.datos dd { margin: 0; font-weight: 500; text-align: right; overflow-wrap: anywhere; }
.mono { font-family: ui-monospace, 'Cascadia Mono', Consolas, monospace; letter-spacing: .1em; }
.bloque { padding: 18px; margin-bottom: 14px; display: grid; gap: 12px; }
.bloque h2 { margin: 0; }
.bloque p { margin: 0; color: var(--h-ink-2); font-size: 14.5px; line-height: 1.45; }
.bloque form { display: grid; gap: 14px; }
.peligro { border-color: #F5D5D7; }

/* ---------- hoja de vincular ---------- */
.velo { position: fixed; inset: 0; z-index: 30; background: rgba(18, 15, 28, .45); display: flex; align-items: flex-end; justify-content: center; animation: aparecer .2s ease; }
@keyframes aparecer { from { opacity: 0; } to { opacity: 1; } }
.hoja { width: 100%; max-width: 560px; background: #fff; border-radius: 24px 24px 0 0; padding: 26px 22px calc(24px + env(safe-area-inset-bottom)); box-shadow: var(--h-shadow-lg); animation: subirHoja .3s var(--ease); text-align: center; }
@keyframes subirHoja { from { transform: translateY(40px); } to { transform: none; } }
.hoja h2 { font-size: 22px; font-weight: 600; margin: 0 0 6px; line-height: 1.25; text-wrap: balance; overflow-wrap: anywhere; }
.hoja p { color: var(--h-ink-2); margin: 0 0 18px; line-height: 1.45; }
.hoja form { display: grid; gap: 14px; }
.codigo4 {
  width: 100%; max-width: 260px; margin: 0 auto; min-height: 72px; text-align: center;
  font: 600 40px/1 ui-monospace, 'Cascadia Mono', Consolas, monospace; letter-spacing: .4em; padding-left: .4em;
  border: 2px solid #DAD2E8; border-radius: 16px; color: var(--h-ink); background: var(--h-lavender-2);
}
.codigo4:focus { outline: none; border-color: var(--h-purple); box-shadow: 0 0 0 4px rgba(123, 79, 208, .18); }
#vincular-paso-2 { display: grid; justify-items: center; gap: 6px; }
#vincular-paso-2 .h-pulse { margin: 6px 0 18px; }
@media (min-width: 600px) {
  .velo { align-items: center; }
  .hoja { border-radius: 24px; }
}

/* ---------- navegación inferior ---------- */
.nav {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 20;
  display: grid; grid-template-columns: repeat(5, 1fr);
  height: calc(var(--nav-h) + env(safe-area-inset-bottom)); padding-bottom: env(safe-area-inset-bottom);
  background: rgba(255, 255, 255, .94); backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px);
  border-top: 1px solid var(--h-border);
}
.nav a { display: grid; justify-items: center; align-content: center; gap: 4px; color: var(--h-ink-2); text-decoration: none; font-size: 11.5px; font-weight: 500; }
.nav a svg { width: 24px; height: 24px; stroke: currentColor; fill: none; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.nav a[aria-current="page"] { color: var(--h-purple); }
.nav a[aria-current="page"] svg { stroke-width: 2.1; }
@media (min-width: 600px) { .nav { left: 50%; right: auto; width: 560px; transform: translateX(-50%); border: 1px solid var(--h-border); border-bottom: 0; border-radius: 20px 20px 0 0; } }

@media (max-width: 360px) {
  .barra-fila { grid-template-columns: 96px minmax(0, 1fr) 40px; gap: 8px; font-size: 13.5px; }
  .kpi strong { font-size: 22px; }
}

@media (prefers-reduced-motion: reduce) {
  .vista, .hoja, .velo { animation: none; }
  .hkey::after { animation: none; }
  .barra-relleno { transition: none; }
}
