:root {
  --fondo: #11151c; --fondo-2: #171c26; --papel: #1d2330; --borde: rgba(255,255,255,.08);
  --texto: #eef1f6; --texto-2: #8b93a7; --acento: #5b7cfa; --acento-2: #7c9bff;
  --riesgo: #fbbf24; --ok: #34d399; --rojo: #f87171;
  --fuente: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { margin: 0; height: 100%; }
body { font-family: var(--fuente); color: var(--texto); background: radial-gradient(60rem 40rem at 20% -10%, #202a42, transparent 60%), var(--fondo); -webkit-font-smoothing: antialiased; }
a { color: inherit; text-decoration: none; }
button { font: inherit; }

.glass { background: rgba(23,28,38,.72); -webkit-backdrop-filter: blur(20px) saturate(1.4); backdrop-filter: blur(20px) saturate(1.4); }

.topbar { position: sticky; top: 0; z-index: 10; max-width: 480px; margin: 0 auto; padding: 18px 20px 12px; background: rgba(17,21,28,.7); -webkit-backdrop-filter: blur(16px); backdrop-filter: blur(16px); display: flex; align-items: center; gap: 10px; }
.topbar h1 { margin: 0; font-size: 22px; font-weight: 800; flex: 1; }
.topbar .volver { width: 34px; height: 34px; display: flex; align-items: center; justify-content: center; border-radius: 50%; background: rgba(255,255,255,.07); font-size: 15px; }
.topbar .toggle-estado { font-size: 13px; font-weight: 700; color: var(--acento-2); }

.pantalla { max-width: 480px; margin: 0 auto; padding: 8px 18px calc(96px + env(safe-area-inset-bottom)); min-height: calc(100vh - 70px); }

.tabbar { position: fixed; left: 0; right: 0; bottom: 0; z-index: 20; max-width: 480px; margin: 0 auto; display: flex; padding: 8px 10px calc(10px + env(safe-area-inset-bottom)); border-top: 1px solid var(--borde); }
.tab { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 3px; font-size: 11px; font-weight: 600; color: var(--texto-2); padding: 4px 0; border-radius: 12px; }
.tab i { font-size: 19px; }
.tab.on { color: var(--acento-2); }

/* Springboard de iconos, como la pantalla de inicio del iPhone */
.grid-apps { display: grid; grid-template-columns: repeat(3, 1fr); gap: 22px 14px; margin-top: 18px; }
.app-icono { display: flex; flex-direction: column; align-items: center; gap: 6px; }
.app-icono .caja { position: relative; width: 62px; height: 62px; border-radius: 18px; display: flex; align-items: center; justify-content: center; font-size: 26px;
  background: linear-gradient(160deg, var(--acento), #3a53c9); color: #fff; box-shadow: 0 8px 20px rgba(91,124,250,.35); }
.app-icono .etiqueta { font-size: 12px; font-weight: 600; color: var(--texto-2); text-align: center; }
.app-icono.proximamente .caja { background: rgba(255,255,255,.06); color: rgba(255,255,255,.35); box-shadow: none; }
.app-icono .badge { position: absolute; top: -6px; right: -6px; min-width: 22px; height: 22px; border-radius: 999px; background: var(--rojo); color: #fff; font-size: 12px; font-weight: 800; display: flex; align-items: center; justify-content: center; padding: 0 5px; border: 2px solid var(--fondo); }

.aviso-caido { margin: 14px 0; padding: 10px 14px; border-radius: 12px; background: rgba(251,191,36,.12); border: 1px solid rgba(251,191,36,.3); color: var(--riesgo); font-size: 13px; display: flex; gap: 8px; align-items: center; }

.vacio { text-align: center; padding: 60px 20px; color: var(--texto-2); }
.vacio i { font-size: 40px; color: var(--ok); display: block; margin-bottom: 10px; }

.lista-mensajes { list-style: none; margin: 10px 0 0; padding: 0; display: flex; flex-direction: column; gap: 10px; }
.fila-mensaje { display: flex; gap: 12px; align-items: flex-start; background: var(--papel); border: 1px solid var(--borde); border-radius: 16px; padding: 12px 14px; }
.av-sistema { width: 38px; height: 38px; border-radius: 50%; flex-shrink: 0; display: flex; align-items: center; justify-content: center; color: #fff; font-size: 15px; }
.av-sistema.produccion { background: linear-gradient(160deg, #4c9336, #23502b); }
.av-sistema.asistencia { background: linear-gradient(160deg, #5a7a57, #233828); }
.cuerpo-mensaje { flex: 1; min-width: 0; }
.cab-mensaje { display: flex; align-items: baseline; gap: 8px; flex-wrap: wrap; }
.cab-mensaje b { font-size: 14.5px; }
.chip-sistema { font-size: 11px; color: var(--texto-2); }
.cuerpo-mensaje p { margin: 3px 0 4px; font-size: 14px; line-height: 1.4; color: #dde1ea; }
.hora-mensaje { font-size: 11.5px; color: var(--texto-2); }
.fila-mensaje form button { width: 34px; height: 34px; border-radius: 50%; border: 0; background: rgba(52,211,153,.14); color: var(--ok); cursor: pointer; }

/* Ajustes */
.grupo { margin-top: 18px; }
.grupo h2 { font-size: 13px; text-transform: uppercase; letter-spacing: .04em; color: var(--texto-2); margin: 0 0 8px; }
.lista-simple { list-style: none; margin: 0; padding: 0; background: var(--papel); border: 1px solid var(--borde); border-radius: 14px; overflow: hidden; }
.lista-simple li { padding: 12px 14px; font-size: 14px; border-bottom: 1px solid var(--borde); display: flex; gap: 10px; align-items: center; }
.lista-simple li:last-child { border-bottom: 0; }
.lista-simple i { color: var(--acento-2); }
.pie-grupo { font-size: 12px; color: var(--texto-2); margin: 6px 2px 0; }
.form-ajustes { background: var(--papel); border: 1px solid var(--borde); border-radius: 14px; padding: 14px; display: flex; flex-direction: column; gap: 10px; }
.form-ajustes label { font-size: 13px; font-weight: 600; color: var(--texto-2); display: flex; flex-direction: column; gap: 5px; }
.form-ajustes input { font: inherit; font-size: 15px; padding: 10px 12px; border-radius: 10px; border: 1px solid var(--borde); background: var(--fondo-2); color: var(--texto); }
.form-ajustes button, .login-caja button { background: var(--acento); color: #fff; border: 0; border-radius: 12px; padding: 12px; font-weight: 700; font-size: 15px; cursor: pointer; }
.aviso-ok { color: var(--ok); font-weight: 700; font-size: 13.5px; }
.salir { display: block; text-align: center; margin: 22px 0 6px; color: var(--rojo); font-weight: 700; font-size: 14px; }

/* Login */
.login-env { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 20px; }
.login-caja { width: 100%; max-width: 340px; background: var(--papel); border: 1px solid var(--borde); border-radius: 22px; padding: 28px 24px; }
.login-caja .marca { display: flex; flex-direction: column; align-items: center; gap: 10px; margin-bottom: 20px; }
.logo-ico { width: 56px; height: 56px; border-radius: 16px; background: linear-gradient(160deg, var(--acento), #3a53c9); display: flex; align-items: center; justify-content: center; font-size: 24px; color: #fff; }
.login-caja b { font-size: 17px; }
.login-caja form { display: flex; flex-direction: column; gap: 12px; }
.login-caja label { font-size: 13px; font-weight: 600; color: var(--texto-2); display: flex; flex-direction: column; gap: 5px; }
.login-caja input { font: inherit; font-size: 15px; padding: 11px 13px; border-radius: 11px; border: 1px solid var(--borde); background: var(--fondo-2); color: var(--texto); }
.login-error { color: var(--rojo); font-size: 13.5px; font-weight: 600; margin: 0 0 10px; }
