/* ==========================================================================
   UMBRAL · estilos de la app del residente
   Usa los tokens de ../assets/css/site.css y añade la cáscara de aplicación.
   ========================================================================== */

body.app {
  background: var(--bg);
  padding-bottom: calc(74px + env(safe-area-inset-bottom, 0px));
}

/* ---------- barra superior ---------- */
.appbar {
  position: sticky; top: 0; z-index: 30;
  background: var(--ink); color: #eef2f7;
  padding: calc(.7rem + env(safe-area-inset-top, 0px)) 0 .7rem;
}
.appbar__inner { display: flex; align-items: center; gap: .7rem; }
.appbar img { width: 30px; height: 30px; border-radius: 8px; }
.appbar__title { font-weight: 800; letter-spacing: -.02em; font-size: 1.02rem; line-height: 1.1; }
.appbar__sub { font-size: .76rem; color: #9fb0c9; }
.appbar__estado { margin-left: auto; display: flex; align-items: center; gap: .4rem; font-size: .72rem; color: #9fb0c9; }
.dot { width: 8px; height: 8px; border-radius: 50%; background: var(--steel-2); }
.dot--off { background: var(--warn); }

/* ---------- pantallas ---------- */
.screen { display: none; padding: 1rem 0 2rem; }
.screen.is-active { display: block; }
.screen > .wrap { width: min(640px, 100% - 2rem); }

/* ---------- tarjetas de la app ---------- */
.panel {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 1rem; box-shadow: var(--shadow-sm); margin-bottom: .9rem;
}
.panel--hero {
  background: linear-gradient(150deg, #0a1d2e, #12304a); color: #eef2f7; border: 0;
}
.panel--hero .muted { color: #a8b8ce; }
.saldo { font-size: 2.1rem; font-weight: 800; letter-spacing: -.03em; line-height: 1.1; margin: .15rem 0 .2rem; }
.saldo small { font-size: .95rem; font-weight: 600; color: #a8b8ce; letter-spacing: 0; }

.lista { list-style: none; padding: 0; margin: 0; display: grid; gap: .1rem; }
.lista li {
  display: grid; grid-template-columns: 1fr auto; gap: .6rem; align-items: center;
  padding: .7rem 0; border-bottom: 1px solid var(--line);
}
.lista li:last-child { border-bottom: 0; }
.lista .t { font-weight: 600; font-size: .95rem; }
.lista .s { font-size: .8rem; color: var(--muted); }
.lista .m { font-weight: 700; font-variant-numeric: tabular-nums; }

.acciones { display: grid; grid-template-columns: repeat(4, 1fr); gap: .5rem; }
.accion {
  display: grid; justify-items: center; gap: .35rem; padding: .8rem .3rem;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-sm);
  text-decoration: none; color: var(--text); font-size: .74rem; font-weight: 650; text-align: center;
}
.accion .icon { width: 20px; height: 20px; color: var(--steel); }
.accion:active { background: #eef3f9; }

/* ---------- pase de visita ---------- */
.pase {
  display: grid; grid-template-columns: auto 1fr; gap: .9rem; align-items: center;
  padding: .9rem; border-radius: var(--radius); background: var(--info-soft); border: 1px solid #d5e2ec;
}
.pase--usado { background: #eef2f7; border-color: var(--line); }
.pase--vencido { background: #fff7ed; border-color: #fed7aa; }
.pase__qr { width: 92px; height: 92px; background: #fff; border-radius: 10px; padding: 5px; }
.pase__qr svg { width: 100%; height: 100%; display: block; }
.pase__nombre { font-weight: 700; }
.pase__meta { font-size: .8rem; color: var(--muted); }
.pase__token { font-family: var(--mono); font-size: .74rem; letter-spacing: .06em; }

/* ---------- formularios de la app ---------- */
.campo { margin-bottom: .8rem; }
.campo label { display: block; font-size: .82rem; font-weight: 650; margin-bottom: .25rem; }
.campo input, .campo select, .campo textarea {
  width: 100%; padding: .7rem .8rem; border: 1px solid var(--line-strong);
  border-radius: var(--radius-sm); font: inherit; background: #fff;
}
.campo textarea { min-height: 84px; resize: vertical; }

/* ---------- navegación inferior ---------- */
.tabbar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 40;
  background: rgba(255, 255, 255, .96); backdrop-filter: blur(10px);
  border-top: 1px solid var(--line);
  padding-bottom: env(safe-area-inset-bottom, 0px);
}
.tabbar__inner { display: grid; grid-template-columns: repeat(5, 1fr); width: min(640px, 100%); margin: 0 auto; }
.tab {
  display: grid; justify-items: center; gap: .15rem; padding: .55rem .2rem .5rem;
  background: none; border: 0; font: inherit; font-size: .68rem; font-weight: 650;
  color: var(--muted); cursor: pointer;
}
.tab .icon { width: 21px; height: 21px; }
.tab span:last-child { font-size: .68rem; }
.tab[aria-current="page"] { color: var(--steel); }
.tab[aria-current="page"] span:first-child { transform: translateY(-1px); }

/* ---------- varios ---------- */
.fila { display: flex; align-items: center; justify-content: space-between; gap: .6rem; }
.chip {
  display: inline-flex; align-items: center; gap: .3rem; padding: .2rem .55rem; border-radius: 999px;
  font-size: .74rem; font-weight: 700; background: #eef2f7; color: var(--muted);
}
.chip--ok { background: var(--ok-soft); color: var(--ok); }
.chip--warn { background: var(--warn-soft); color: var(--warn); }
.chip--danger { background: var(--danger-soft); color: var(--danger); }
.aviso-demo {
  background: var(--info-soft); border: 1px solid #d5e2ec; color: #075985;
  border-radius: var(--radius-sm); padding: .6rem .8rem; font-size: .82rem; margin-bottom: .9rem;
}
.toast {
  position: fixed; left: 50%; transform: translateX(-50%) translateY(120%);
  bottom: calc(84px + env(safe-area-inset-bottom, 0px)); z-index: 60;
  background: var(--ink); color: #fff; padding: .7rem 1rem; border-radius: 999px;
  font-size: .86rem; box-shadow: var(--shadow); transition: transform .25s ease; max-width: 90%;
}
.toast.is-visible { transform: translateX(-50%) translateY(0); }

@media (min-width: 720px) {
  .acciones { grid-template-columns: repeat(4, 1fr); }
}
@media (prefers-reduced-motion: reduce) {
  .toast { transition: none; }
}
