/* =====================================================================
   Estructura general: encabezado, menú lateral, pantalla de acceso
   ===================================================================== */

#app { height: 100dvh; display: flex; flex-direction: column; min-height: 0; }

/* ---------- Encabezado ---------- */
.top {
  flex: none; height: 56px; display: flex; align-items: center; gap: 12px; padding: 0 14px 0 10px;
  background: var(--superficie); border-bottom: 1px solid var(--linea-fuerte);
}
.top-menu { width: 40px; height: 40px; display: inline-flex; align-items: center; justify-content: center; border: 0; border-radius: var(--r); background: transparent; color: var(--tinta); }
.top-menu:hover { background: var(--superficie-3); }
.top-menu svg { width: 22px; height: 22px; }
.top-titulo { font-family: var(--f-cond); font-weight: 700; font-size: 21px; letter-spacing: .1em; color: var(--tinta); white-space: nowrap; }
.top-der { margin-left: auto; display: flex; align-items: center; gap: 12px; min-width: 0; }
.pill-caja {
  display: inline-flex; align-items: center; gap: 8px; padding: 5px 12px; border: 1px solid var(--linea-fuerte); border-radius: 999px;
  font-family: var(--f-cond); font-weight: 600; font-size: 13px; letter-spacing: .05em; text-transform: uppercase; color: var(--tinta-media);
  text-decoration: none; background: var(--superficie); white-space: nowrap;
}
.pill-caja::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: #9aa1a9; }
.pill-caja.abierta::before { background: var(--ok); }
.pill-caja.cerrada::before { background: var(--peligro); }
.usuario { display: flex; flex-direction: column; line-height: 1.15; text-align: right; }
.usuario b { font-weight: 600; font-size: 14px; }
.usuario span { font-family: var(--f-cond); font-weight: 600; font-size: 11px; letter-spacing: .1em; text-transform: uppercase; color: var(--tinta-media); }

/* ---------- Cuerpo: menú lateral + contenido ---------- */
.cuerpo-shell { flex: 1; min-height: 0; display: flex; position: relative; }
.lateral {
  flex: none; width: 228px; display: flex; flex-direction: column; gap: 2px; padding: 12px 10px; overflow: auto;
  background: var(--superficie); border-right: 1px solid var(--linea-fuerte);
}
.cuerpo-shell[data-lateral="cerrado"] .lateral { display: none; }
.lateral a {
  display: flex; align-items: center; gap: 12px; min-height: 46px; padding: 0 12px; border-radius: var(--r);
  color: var(--tinta-media); text-decoration: none; font-weight: 500; font-size: 15.5px; position: relative;
}
.lateral a svg { width: 21px; height: 21px; flex: none; }
.lateral a:hover { background: var(--superficie-3); color: var(--tinta); }
.lateral a.activo { background: var(--brasa-clara); color: var(--tinta); font-weight: 600; }
.lateral a.activo::before { content: ""; position: absolute; left: 0; top: 8px; bottom: 8px; width: 3px; border-radius: 0 3px 3px 0; background: var(--brasa); }
.lateral .contador { margin-left: auto; min-width: 22px; padding: 1px 7px; border-radius: 999px; background: var(--brasa); color: #fff; font-size: 12px; font-weight: 600; text-align: center; }
.lateral .contador.peligro { background: var(--peligro); }
.lateral-sep { height: 1px; background: var(--linea); margin: 8px 6px; }
.lateral-pie { margin-top: auto; padding: 10px 6px 0; font-size: 12px; color: var(--tinta-media); }
.velo-lateral { display: none; }

#contenido { flex: 1; min-width: 0; min-height: 0; position: relative; overflow: hidden; display: flex; flex-direction: column; background: var(--papel); }
.vista { flex: 1; min-height: 0; overflow: auto; padding: 20px; }
.vista.sin-pad { padding: 0; }
.vista-cab { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; margin-bottom: 16px; }
.vista-cab .espacio { flex: 1; }
.contenedor { max-width: 1280px; margin: 0 auto; }

/* ---------- Pantalla de acceso ---------- */
.acceso { flex: 1; overflow: auto; display: flex; align-items: center; justify-content: center; padding: 20px; background: var(--papel); }
.acceso-caja { width: min(440px, 100%); display: flex; flex-direction: column; gap: 18px; }
.acceso-marca { text-align: center; font-family: var(--f-cond); font-weight: 700; font-size: 30px; letter-spacing: .14em; color: var(--tinta); }
.acceso-panel { background: var(--superficie); border: 1px solid var(--linea-fuerte); border-radius: var(--r); }
.acceso-panel .panel-cab { background: var(--superficie-2); }
.acceso-panel .panel-cuerpo { display: flex; flex-direction: column; gap: 14px; }
.acceso-pie { text-align: center; font-size: 12.5px; color: var(--tinta-media); }

.usuarios-lista { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.usuarios-lista .btn { min-height: 64px; flex-direction: column; gap: 2px; align-items: flex-start; padding: 10px 14px; justify-content: center; }
.usuarios-lista .btn b { font-size: 17px; }
.usuarios-lista .btn small { font-family: var(--f-cond); font-weight: 600; font-size: 11px; letter-spacing: .1em; text-transform: uppercase; color: var(--tinta-media); }

.pin-puntos { display: flex; gap: 12px; justify-content: center; padding: 8px 0; }
.pin-puntos i { width: 16px; height: 16px; border: 2px solid var(--brasa); border-radius: 50%; background: transparent; }
.pin-puntos i.lleno { background: var(--brasa); }
.teclado { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.teclado .btn { min-height: 60px; font-size: 24px; font-family: var(--f-texto); font-weight: 500; }
.teclado .btn.accion { font-family: var(--f-cond); font-size: 16px; }
.pin-error { color: var(--peligro); text-align: center; min-height: 20px; font-weight: 500; }

/* ---------- Responsive ---------- */
@media (max-width: 960px) {
  .vista { padding: 14px; }
  .rejilla-2 { grid-template-columns: 1fr; }
  .rejilla-3 { grid-template-columns: 1fr; }
  .lateral { position: absolute; left: 0; top: 0; bottom: 0; z-index: 30; width: min(260px, 82vw); box-shadow: 8px 0 24px rgba(0,0,0,.18); }
  .cuerpo-shell[data-lateral="abierto"] .velo-lateral { display: block; position: absolute; inset: 0; z-index: 29; background: rgba(17,20,24,.35); }
  .usuario { display: none; }
}
@media (max-width: 520px) {
  .pill-caja { font-size: 0; padding: 9px; gap: 0; }
  .pill-caja::before { width: 10px; height: 10px; }
  .top { gap: 8px; padding-right: 10px; }
  .top-titulo { font-size: 18px; letter-spacing: .08em; }
  .top-der { gap: 8px; }
  .top .btn { padding: 0 10px; }
  .usuarios-lista { grid-template-columns: 1fr; }
  .modal { max-height: calc(100dvh - 12px); }
  .velo { padding: 6px; align-items: flex-end; }
  .t-vista { font-size: 21px; }
}
