/* ═══════════════════════════════════════════════════════════════════
   residente.css — Portal de residentes "Mi casa"

   Extraído TAL CUAL (solo se quitó la sangría de la etiqueta <style>):
     - AppsScript/R2Styles.html, líneas 2-304: tokens y componentes.
     - El <style> propio de cada fragmento, en el mismo orden en que
       Residente2.html los incluía, para conservar la cascada:
         R2Anuncios.html    5-26
         R2Visitas.html     3-6
         R2Programar.html   4-19
         R2Cuenta.html      4-28
         R2Mas.html         3-39
         R2Emergencia.html  3-56

   Las variables NO se llevaron a tokens.css y este portal no lo enlaza:
   el bloque de R2Styles no coincide con el de tokens.css. Aquí hay
   --accent-line, --on-red y color-scheme, que allá no existen; allá hay
   --radius-*, --amber-dim/-border, --blue*, --wa*, --card-oro*,
   --card-plata* y --shadow-sm, que aquí no se usan. Las que comparten
   nombre tienen el mismo valor. Detalle en docs/extraccion-residente.md §1.
   ═══════════════════════════════════════════════════════════════════ */

/* ── Portal de residentes "Mi casa" · tokens y componentes ─────────────
   Los fragmentos R2*.html solo usan estas clases; no definen colores propios.

   EL PORTAL ES DE VIDRIO (noviembre de 2026; maquetas en la rama tarjeta-casa,
   docs/maquetas-vidrio-2026-11/). Las superficies son translúcidas y dejan ver
   unas luces quietas que van detrás de todo (.app::before):
     · tema oscuro, «noche»: vidrio ahumado, casi negro, con un FILO de luz en
       lo principal (la tarjeta de la casa, el botón principal, el logo, el «+»
       de la barra y las hojas). Lo demás va sin filo, para que no compita.
     · tema claro: vidrio blanco. Todo sigue claro, también lo principal.
   Lo que pidió Rick al aprobarlo y cuida tests/residente-vidrio.test.mjs:
   una sola letra, botones lisos (sin degradados) y que todo sea vidrio.
   EL COLOR SE GANA (noviembre de 2026): los bloques [data-theme] de más abajo son los de una casa SIN NIVEL (gris, sin
   resplandor). `<html data-nivel="PLATA|ORO|VIOLETA">` (lo pone residente/core.js según la racha de cuotas a tiempo) redefine
   solo lo suyo: el filo de luz, las luces de detrás y el acento (lo que se toca). Los valores del tema oscuro son los de
   la maqueta aprobada; los del claro están medidos (tests/residente-vidrio.test.mjs: letra de 4,5 a 1 o más).
   El desenfoque (`backdrop-filter`, siempre con su prefijo) va en lo que flota
   sobre contenido y en las piezas chicas que se tocan; las filas comunes son
   translúcidas sin desenfoque. */
:root {
  --font: 'DM Sans', system-ui, sans-serif;
  /* Una sola letra: lo que antes iba en la de máquina (pastillas, rótulos, códigos) usa la misma. */
  --mono: var(--font);
  --transition: 0.22s cubic-bezier(0.4, 0, 0.2, 1);
  /* La paleta del boleto que se comparte (styles/pase.css): sólida y siempre oscura. Es la del portal de antes del
     vidrio. html2canvas dibuja el boleto solo, fuera de pantalla y sobre un fondo fijo: con superficies translúcidas
     saldría otro boleto. */
  --boleto-fondo: #0a0a0f;
  --boleto-fondo-2: #111118;
  --boleto-superficie: #16161f;
  --boleto-superficie-2: #1e1e2a;
  --boleto-superficie-3: #252534;
  --boleto-borde: rgba(255, 255, 255, 0.07);
  --boleto-borde-2: rgba(255, 255, 255, 0.12);
  --boleto-acento: #7c6fff;
  --boleto-acento-dim: rgba(124, 111, 255, 0.15);
  --boleto-acento-glow: rgba(124, 111, 255, 0.25);
  --boleto-acento-line: rgba(124, 111, 255, 0.35);
  /* El pase de vidrio (noviembre de 2026): el vidrio de detrás viene horneado en una imagen (e2e/hornear_pase.py); lo que
     se dibuja encima con CSS (textos, pastillas, marco del QR y fichas del código) usa estos tonos, que son los de la maqueta
     aprobada (docs/maquetas-vidrio-2026-11). Valen en los dos temas: la imagen es siempre oscura. */
  --boleto-texto: #f0efff;
  --boleto-texto-2: #b9b8d4;
  --boleto-texto-pastilla: #d5d3ee;
  --boleto-pastilla: rgba(255, 255, 255, 0.07);
  --boleto-pastilla-borde: rgba(255, 255, 255, 0.16);
  --boleto-cristal: rgba(255, 255, 255, 0.08);
  --boleto-cristal-borde: rgba(255, 255, 255, 0.18);
  --boleto-ficha: rgba(0, 0, 0, 0.36);
}
/* El ángulo del filo que recorre la tarjeta de la casa: registrado para que se pueda animar. */
@property --giro { syntax: '<angle>'; inherits: false; initial-value: 0deg; }

[data-theme="dark"] {
  color-scheme: dark;
  --bg: #040308;
  --bg-2: #07060c;
  --surface: rgba(9, 7, 19, 0.58);
  --surface-2: rgba(17, 14, 32, 0.64);
  --surface-3: rgba(52, 44, 92, 0.60);
  --border: rgba(255, 255, 255, 0.07);
  --border-2: rgba(255, 255, 255, 0.12);
  --text: #f0efff;
  --text-2: #9998b8;
  --text-3: #5c5b7a;
  /* SIN NIVEL: lo que se toca es gris claro. El color se gana (bloques [data-nivel] más abajo). */
  --accent: #cfd2e6;
  --accent-t: #cfd2e6;
  --accent-dim: rgba(255, 255, 255, 0.08);
  --accent-glow: rgba(255, 255, 255, 0.10);
  --accent-line: rgba(255, 255, 255, 0.28);
  /* Lo que va escrito SOBRE el acento: aquí el acento es claro, así que la letra es oscura. */
  --sobre-acento: #0a0a0f;
  --green: #34d399;
  --green-dim: rgba(52, 211, 153, 0.12);
  --green-border: rgba(52, 211, 153, 0.25);
  --red: #f87171;
  --red-dim: rgba(248, 113, 113, 0.10);
  --red-border: rgba(248, 113, 113, 0.25);
  --amber: #fbbf24;
  --on-red: #0a0a0f;
  --shadow: 0 24px 64px rgba(0, 0, 0, 0.55);
  /* El vidrio: el de las piezas que flotan, su reflejo de arriba, su canto, el hueco de un código y el velo tras una hoja. */
  --vidrio: rgba(8, 6, 18, 0.66);
  --vidrio-luz: rgba(255, 255, 255, 0.09);
  --vidrio-canto: rgba(255, 255, 255, 0.11);
  --vidrio-flota: rgba(6, 5, 13, 0.80);
  --vidrio-hueco: rgba(0, 0, 0, 0.42);
  --vidrio-sombra: 0 18px 40px -30px rgba(0, 0, 0, 0.9);
  /* Lo que lleva toda superficie común (una fila, una tarjeta): el reflejo de arriba y una sombra corta. */
  --superficie-sombra: inset 0 1px 0 var(--vidrio-luz), var(--vidrio-sombra);
  --velo: rgba(2, 2, 6, 0.58);
  /* El filo de luz de lo principal, y su resplandor: sin nivel es una línea blanca tenue, sin resplandor. */
  --filo: rgba(255, 255, 255, 0.22);
  --filo-tenue: rgba(255, 255, 255, 0.08);
  --filo-brillo: rgba(255, 255, 255, 0.60);
  --resplandor: rgba(255, 255, 255, 0);
  /* Las tres luces de detrás y cuánto se ven. */
  --luz-a: #66769a;
  --luz-b: #3d4c70;
  --luz-c: #54598a;
  --luces: 0.40;
  /* Lo principal (el botón, el logo, el «+»): vidrio ahumado con filo. */
  --tinte: var(--vidrio);
  --tinte-canto: var(--filo);
  --tinte-texto: #f0efff;
  --tinte-sombra: inset 0 1px 0 rgba(255, 255, 255, 0.10), 0 0 0 1px var(--filo-tenue), 0 0 26px -6px var(--resplandor);
  --tinte-desenfoque: blur(18px) saturate(170%);
  /* La tarjeta de la casa. */
  --tarjeta-canto: var(--filo-tenue);
  --tarjeta-sombra: inset 0 1px 0 rgba(255, 255, 255, 0.10), 0 0 34px -4px var(--resplandor);
  /* Lo que flota sobre el contenido: la barra de abajo y las hojas. */
  --flota-canto: var(--filo-tenue);
  --flota-luz: rgba(255, 255, 255, 0.05);
  --hoja-canto: var(--filo);
  --hoja-sombra: inset 0 1px 0 rgba(255, 255, 255, 0.08), 0 -12px 40px -18px var(--resplandor);
  /* SOS: el mismo vidrio, con el filo en rojo. */
  --sos-fondo: var(--vidrio);
  --sos-canto: rgba(248, 113, 113, 0.62);
  --sos-texto: #f87171;
  --sos-sombra: inset 0 1px 0 rgba(255, 255, 255, 0.08), 0 0 18px -6px rgba(248, 113, 113, 0.55);
}

[data-theme="light"] {
  color-scheme: light;
  --bg: #eceef8;
  --bg-2: #e2e5f2;
  --surface: rgba(255, 255, 255, 0.68);
  --surface-2: rgba(255, 255, 255, 0.82);
  --surface-3: rgba(255, 255, 255, 0.96);
  --border: rgba(40, 40, 90, 0.08);
  --border-2: rgba(40, 40, 90, 0.13);
  --text: #0d0d1a;
  --text-2: #5a5a7a;
  --text-3: #9898b8;
  /* SIN NIVEL: pizarra. El color se gana (bloques [data-nivel] más abajo). */
  --accent: #4a5068;
  --accent-t: #4a5068;
  --accent-dim: rgba(74, 80, 104, 0.10);
  --accent-glow: rgba(74, 80, 104, 0.20);
  --accent-line: rgba(74, 80, 104, 0.35);
  --sobre-acento: #ffffff;
  /* El verde y el rojo van un tono más hondos que antes (#059669 y #dc2626): sobre el vidrio claro, que deja pasar
     algo de las luces, los de antes no llegaban a 4,5 a 1 como letra. */
  --green: #047857;
  --green-dim: rgba(5, 150, 105, 0.08);
  --green-border: rgba(5, 150, 105, 0.25);
  --red: #c81e1e;
  --red-dim: rgba(220, 38, 38, 0.07);
  --red-border: rgba(220, 38, 38, 0.22);
  --amber: #d97706;
  --on-red: #ffffff;
  --shadow: 0 8px 32px rgba(0, 0, 0, 0.10);
  --vidrio: rgba(255, 255, 255, 0.52);
  --vidrio-luz: rgba(255, 255, 255, 0.85);
  --vidrio-canto: rgba(255, 255, 255, 0.92);
  --vidrio-flota: rgba(255, 255, 255, 0.70);
  --vidrio-hueco: rgba(255, 255, 255, 0.60);
  --vidrio-sombra: 0 14px 30px -20px rgba(50, 50, 120, 0.34);
  --superficie-sombra: inset 0 1px 0 var(--vidrio-luz), var(--vidrio-sombra);
  --velo: rgba(30, 30, 70, 0.26);
  --filo: #8a90a8;
  --filo-tenue: rgba(138, 144, 168, 0.34);
  --filo-brillo: #d9dce8;
  --resplandor: rgba(138, 144, 168, 0.40);
  --luz-a: #c3ccdf;
  --luz-b: #b7c6e4;
  --luz-c: #cfd2e8;
  --luces: 0.56;
  /* Lo principal sigue claro: del color de acento, con letra blanca (nada de piezas negras en el tema claro). */
  --tinte: var(--accent);
  --tinte-canto: rgba(255, 255, 255, 0.55);
  --tinte-texto: #ffffff;
  --tinte-sombra: inset 0 1px 0 rgba(255, 255, 255, 0.22), 0 14px 30px -16px var(--accent-glow);
  --tinte-desenfoque: none;
  --tarjeta-canto: rgba(255, 255, 255, 0.90);
  --tarjeta-sombra: inset 0 1px 0 var(--vidrio-luz), 0 22px 44px -28px var(--resplandor);
  --flota-canto: var(--vidrio-canto);
  --flota-luz: var(--vidrio-luz);
  --hoja-canto: var(--vidrio-canto);
  --hoja-sombra: inset 0 1px 0 var(--vidrio-luz);
  --sos-fondo: rgba(255, 240, 240, 0.62);
  --sos-canto: rgba(220, 38, 38, 0.22);
  --sos-texto: #b91c1c;
  --sos-sombra: inset 0 1px 0 var(--vidrio-luz);
}

/* ── Los niveles de la casa: el color se gana con la racha ────────────────
   Cada nivel redefine las MISMAS variables, en los dos temas (lo cuida tests/residente-vidrio.test.mjs):
   el filo de luz y su resplandor, las luces de detrás y el acento. Todo lo demás (--tinte, --tarjeta-*, --hoja-*)
   se deriva de ellas y se ajusta solo. El color de un residencial (core/marca.js) llega después y, en una casa
   con nivel, el nivel manda: queda pendiente decidir cómo conviven. */
[data-theme="dark"][data-nivel="PLATA"] {
  --accent: #d6dee8; --accent-t: #d6dee8; --accent-dim: rgba(206, 216, 228, 0.12); --accent-glow: rgba(206, 216, 228, 0.24); --accent-line: rgba(206, 216, 228, 0.50);
  --sobre-acento: #0a0a0f;
  --filo: #cfd8e4; --filo-tenue: rgba(206, 216, 228, 0.24); --filo-brillo: #ffffff; --resplandor: rgba(206, 216, 228, 0.40);
  --luz-a: #d6dee8; --luz-b: #7f93b3; --luz-c: #8fa6c6; --luces: 0.30;
}
[data-theme="dark"][data-nivel="ORO"] {
  --accent: #e8c66c; --accent-t: #e8c66c; --accent-dim: rgba(212, 175, 55, 0.13); --accent-glow: rgba(212, 175, 55, 0.30); --accent-line: rgba(212, 175, 55, 0.55);
  --sobre-acento: #0a0a0f;
  --filo: #e0b64f; --filo-tenue: rgba(212, 175, 55, 0.28); --filo-brillo: #fff1c2; --resplandor: rgba(212, 175, 55, 0.52);
  --luz-a: #e8c66c; --luz-b: #a9742a; --luz-c: #c9892f; --luces: 0.44;
}
[data-theme="dark"][data-nivel="VIOLETA"] {
  --accent: #b9a2ff; --accent-t: #b9a2ff; --accent-dim: rgba(139, 92, 255, 0.16); --accent-glow: rgba(139, 92, 255, 0.55); --accent-line: rgba(170, 140, 255, 0.55);
  --sobre-acento: #0a0a0f;
  --filo: #9d7bff; --filo-tenue: rgba(157, 123, 255, 0.30); --filo-brillo: #ffffff; --resplandor: rgba(139, 92, 255, 0.70);
  --luz-a: #8b5cff; --luz-b: #4b3bff; --luz-c: #d15cff; --luces: 0.58;
}
[data-theme="light"][data-nivel="PLATA"] {
  --accent: #56657a; --accent-t: #56657a; --accent-dim: rgba(86, 101, 122, 0.10); --accent-glow: rgba(86, 101, 122, 0.20); --accent-line: rgba(86, 101, 122, 0.35);
  --sobre-acento: #ffffff;
  --filo: #8fa0b8; --filo-tenue: rgba(143, 160, 184, 0.34); --filo-brillo: #dfe7f2; --resplandor: rgba(143, 160, 184, 0.45);
  --luz-a: #cfd8e6; --luz-b: #c9d3e6; --luz-c: #c3cfe0; --luces: 0.56;
}
[data-theme="light"][data-nivel="ORO"] {
  --accent: #8a6410; --accent-t: #8a6410; --accent-dim: rgba(138, 100, 16, 0.10); --accent-glow: rgba(138, 100, 16, 0.20); --accent-line: rgba(138, 100, 16, 0.35);
  --sobre-acento: #ffffff;
  --filo: #c9952e; --filo-tenue: rgba(201, 149, 46, 0.34); --filo-brillo: #f6dfa0; --resplandor: rgba(201, 149, 46, 0.45);
  --luz-a: #f0d58a; --luz-b: #f3dfae; --luz-c: #f1c98f; --luces: 0.56;
}
[data-theme="light"][data-nivel="VIOLETA"] {
  --accent: #5b4ef7; --accent-t: #5b4ef7; --accent-dim: rgba(91, 78, 247, 0.10); --accent-glow: rgba(91, 78, 247, 0.20); --accent-line: rgba(91, 78, 247, 0.35);
  --sobre-acento: #ffffff;
  --filo: #7c5cff; --filo-tenue: rgba(124, 92, 255, 0.34); --filo-brillo: #c9b6ff; --resplandor: rgba(124, 92, 255, 0.45);
  --luz-a: #b3a9ff; --luz-b: #a8b8ff; --luz-c: #dcb8ff; --luces: 0.56;
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; height: 100%; }
body {
  height: 100%; font-family: var(--font); font-size: 15px; line-height: 1.4;
  background: var(--bg); color: var(--text); overflow: hidden;
  -webkit-font-smoothing: antialiased; -webkit-tap-highlight-color: transparent;
  transition: background var(--transition), color var(--transition);
}
button, a, input, select, textarea { touch-action: manipulation; font-family: inherit; }
button { cursor: pointer; }
a { color: var(--accent); text-decoration: none; }
[hidden] { display: none !important; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
svg.ic { width: 1em; height: 1em; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; flex-shrink: 0; }

/* ── Estructura ─────────────────────────────────────────────────────── */
/* El alto no depende de porcentajes heredados: en iPhone el marco de Apps Script crece después de
   la primera composición y esos porcentajes se quedaban con el alto inicial (la barra inferior
   quedaba flotando). --r2-alto lo fija R2Core en píxeles y lo vuelve a medir. */
.app { position: fixed; top: 0; left: 0; right: 0; height: var(--r2-alto, 100%); max-width: 480px; margin: 0 auto; display: flex; flex-direction: column; isolation: isolate; overflow: hidden; }
/* Las luces: una sola capa quieta detrás de todo. Es lo que el vidrio deja ver; sin ellas no se nota que es translúcido. */
.app::before {
  content: ''; position: absolute; inset: -40px; z-index: -1; pointer-events: none; opacity: var(--luces); filter: blur(46px);
  background:
    radial-gradient(46% 24% at 84% 10%, var(--luz-a), transparent 70%),
    radial-gradient(38% 20% at 2% 44%, var(--luz-b), transparent 70%),
    radial-gradient(48% 20% at 30% 92%, var(--luz-c), transparent 70%);
}
.views { flex: 1; min-height: 0; position: relative; }
.view { position: absolute; inset: 0; display: flex; flex-direction: column; overflow-y: auto; overflow-x: hidden; -webkit-overflow-scrolling: touch; padding: calc(env(safe-area-inset-top, 0px) + 20px) 20px 24px; }
/* Con barra inferior: la barra es de vidrio y flota sobre el contenido, que pasa por debajo. Cada vista deja al final el
   alto de la barra (60 px más el borde seguro del teléfono) y un respiro, para que lo último se pueda subir a la vista. */
.views.con-tabbar > .view { padding-bottom: calc(124px + max(env(safe-area-inset-bottom, 0px), 10px)); }
.view.centro { align-items: center; text-align: center; padding-left: 24px; padding-right: 24px; }
.view > * { flex-shrink: 0; }
.empuja { margin-top: auto; }

.mono { font-family: var(--mono); }
.eyebrow { font-family: var(--mono); font-size: 11px; letter-spacing: 0.08em; color: var(--text-2); text-transform: uppercase; }
.h1 { font-size: 28px; font-weight: 600; letter-spacing: -0.5px; line-height: 1.25; }
.h2 { font-size: 22px; font-weight: 600; letter-spacing: -0.4px; line-height: 1.25; }
.sub { font-size: 14px; color: var(--text-2); }
.nota { font-size: 13px; color: var(--text-2); }

.topbar { display: flex; align-items: center; gap: 12px; margin-bottom: 16px; }
.topbar h1 { font-size: 20px; font-weight: 600; letter-spacing: -0.3px; }
.topbar .paso { margin-left: auto; font-family: var(--mono); font-size: 12px; color: var(--text-2); }
.round-btn { width: 44px; height: 44px; border-radius: 50%; border: 1px solid var(--vidrio-canto); background: var(--surface-2); -webkit-backdrop-filter: blur(18px) saturate(170%); backdrop-filter: blur(18px) saturate(170%); box-shadow: inset 0 1px 0 var(--vidrio-luz); color: var(--text); display: flex; align-items: center; justify-content: center; font-size: 20px; flex-shrink: 0; }
.steps { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 6px; margin-bottom: 20px; }
.steps span { height: 4px; border-radius: 4px; background: var(--surface-3); }
.steps span.on { background: var(--accent); }

.sect { display: flex; align-items: center; justify-content: space-between; min-height: 44px; margin-top: 12px; }
.sect h2 { font-family: var(--mono); font-size: 11px; font-weight: 500; letter-spacing: 0.09em; text-transform: uppercase; color: var(--text-2); }
.sect a, .sect button { font-size: 13px; font-weight: 500; color: var(--accent); padding: 12px 0; background: none; border: none; }

/* ── Botones ────────────────────────────────────────────────────────── */
/* El botón principal: liso, sin degradado. En «noche» es vidrio ahumado con filo de luz; en claro, del color de acento. */
.btn { display: flex; align-items: center; justify-content: center; gap: 8px; width: 100%; min-height: 54px; padding: 0 16px; border-radius: 14px; border: 1px solid var(--tinte-canto); background: var(--tinte); -webkit-backdrop-filter: var(--tinte-desenfoque); backdrop-filter: var(--tinte-desenfoque); color: var(--tinte-texto); font-size: 16px; font-weight: 600; line-height: 1; box-shadow: var(--tinte-sombra); transition: opacity var(--transition), transform 0.1s; }
.btn:active { transform: scale(0.985); }
.btn[disabled], .btn.cargando { opacity: 0.55; pointer-events: none; }
.btn-ghost { display: flex; align-items: center; justify-content: center; gap: 8px; min-height: 44px; padding: 0 16px; border-radius: 12px; border: 1px solid var(--vidrio-canto); background: var(--surface-2); -webkit-backdrop-filter: blur(18px) saturate(170%); backdrop-filter: blur(18px) saturate(170%); box-shadow: inset 0 1px 0 var(--vidrio-luz); color: var(--text); font-size: 14px; font-weight: 600; line-height: 1; white-space: nowrap; }
.btn-ghost[disabled] { opacity: 0.55; pointer-events: none; }
.btn-sm { min-height: 44px; border-radius: 12px; font-size: 14px; }
.btn-full { width: 100%; }
.link { background: none; border: none; color: var(--accent); font-size: 14px; font-weight: 500; padding: 12px; }
.link.rojo { color: var(--red); }
.spinner { width: 18px; height: 18px; border-radius: 50%; border: 2px solid rgba(255, 255, 255, 0.35); border-top-color: #fff; animation: r2-giro 0.7s linear infinite; }
.spinner.tenue { border-color: var(--border-2); border-top-color: var(--accent); }
@keyframes r2-giro { to { transform: rotate(360deg); } }

/* ── Formularios ────────────────────────────────────────────────────── */
.field { margin-bottom: 16px; }
.field label, .label { display: block; font-size: 13px; font-weight: 500; color: var(--text-2); margin-bottom: 8px; }
.opt { font-weight: 400; }
.input { width: 100%; height: 52px; border-radius: 12px; border: 1px solid var(--vidrio-canto); background: var(--surface-2); color: var(--text); font-size: 16px; padding: 0 14px; -webkit-appearance: none; appearance: none; transition: border-color var(--transition); }
/* El texto de ejemplo con --text-2 (5,9:1 en los dos temas): con --text-3 medía 2,5:1. */
.input::placeholder { color: var(--text-2); }
.input:focus { outline: none; border-color: var(--accent); }
.input.error { border-color: var(--red); }
/* 16 px, como todo campo: con menos, Safari del iPhone amplía la página al tocarlo (la descripción del reporte, la nota de Emergencia). */
textarea.input { height: auto; min-height: 72px; padding: 12px 14px; resize: none; font-size: 16px; line-height: 1.4; display: block; }
.input.pin { font-size: 22px; letter-spacing: 0.5em; }
.row2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.ayuda { margin: -8px 0 16px; font-size: 13px; color: var(--text-2); }
/* La ayuda del PIN en la entrada, con «¿Olvidaste tu PIN?» a su derecha (residente/pin.js). El enlace mide 44 px de alto para el dedo. */
.ayuda-pin { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-top: -12px; margin-bottom: 8px; }
.enlace-pin { flex: none; min-height: 44px; padding: 0 2px; background: none; border: none; color: var(--accent-t); font: inherit; font-size: 13px; font-weight: 500; }
.enlace-pin:hover { text-decoration: underline; }
/* Las hojas del PIN: los campos, uno debajo del otro, con el mismo alto. */
.hoja .pin-campos .field { margin-bottom: 14px; }
.hoja .pin-nota { font-size: 13px; margin-bottom: 14px; }
.ayuda-fila { display: flex; justify-content: space-between; gap: 10px; margin: -10px 0 16px; font-size: 12.5px; color: var(--text-2); }
.msg-error { display: none; margin: 0 0 14px; padding: 10px 14px; border-radius: 12px; background: var(--red-dim); border: 1px solid var(--red-border); color: var(--text); font-size: 13.5px; }
.msg-error.on { display: block; }

.seg { display: grid; gap: 8px; margin-bottom: 16px; }
.seg.c2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.seg.c3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.seg.c4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.seg button { min-height: 44px; border-radius: 10px; border: 1px solid var(--vidrio-canto); background: var(--surface-2); box-shadow: inset 0 1px 0 var(--vidrio-luz); color: var(--text-2); font-size: 13.5px; font-weight: 500; padding: 0 6px; }
/* Lo elegido se marca con el filo. */
.seg button[aria-pressed="true"] { border-color: var(--filo); background: var(--accent-dim); color: var(--text); font-weight: 600; }
.seg-tabs { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 4px; padding: 4px; margin-bottom: 16px; border-radius: 14px; background: var(--surface); border: 1px solid var(--vidrio-canto); box-shadow: var(--superficie-sombra); }
.seg-tabs button { min-height: 44px; border-radius: 10px; border: none; background: none; color: var(--text-2); font-size: 14px; font-weight: 500; }
.seg-tabs button[aria-pressed="true"] { background: var(--surface-3); color: var(--text); font-weight: 600; }

.switch { width: 52px; height: 44px; border: none; background: none; display: flex; align-items: center; flex-shrink: 0; }
.switch span { width: 52px; height: 30px; border-radius: 999px; background: var(--surface-3); display: flex; align-items: center; padding: 3px; transition: background var(--transition); }
.switch span::after { content: ''; width: 24px; height: 24px; border-radius: 50%; background: #fff; box-shadow: 0 1px 3px rgba(0, 0, 0, 0.3); transition: transform var(--transition); }
.switch[aria-checked="true"] span { background: var(--accent); }
.switch[aria-checked="true"] span::after { transform: translateX(22px); }

/* ── Mosaicos, filas y tarjetas ─────────────────────────────────────── */
.tiles { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.tile { display: flex; flex-direction: column; justify-content: center; min-height: 104px; padding: 12px 14px; border-radius: 16px; background: var(--surface); border: 1px solid var(--vidrio-canto); box-shadow: var(--superficie-sombra); color: var(--text); text-align: left; }
.tile svg { font-size: 24px; color: var(--accent); margin-bottom: 8px; }
.tile b { font-size: 15px; font-weight: 600; }
.tile small { font-size: 12px; color: var(--text-2); }
.tile[aria-pressed="true"] { border-color: var(--filo); background: var(--accent-dim); }

.row { display: flex; align-items: center; gap: 12px; min-height: 64px; padding: 8px 14px; margin-bottom: 8px; background: var(--surface); border: 1px solid var(--vidrio-canto); box-shadow: var(--superficie-sombra); border-radius: 14px; color: var(--text); width: 100%; text-align: left; }
.row-main { min-width: 0; flex: 1; }
.row-title { font-size: 15px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.row-sub { font-size: 12.5px; color: var(--text-2); }
.row-sub.aviso { color: var(--amber); }
.code-chip { font-family: var(--mono); font-size: 14px; font-weight: 500; letter-spacing: 0.14em; padding: 7px 10px; border-radius: 9px; background: var(--vidrio-hueco); border: 1px solid var(--accent-line); color: var(--accent); flex-shrink: 0; }
.icon-box { width: 40px; height: 40px; border-radius: 11px; display: flex; align-items: center; justify-content: center; font-size: 18px; background: var(--accent-dim); color: var(--accent); flex-shrink: 0; }
.icon-box.redondo { border-radius: 50%; color: var(--text); font-size: 14px; font-weight: 600; }
.icon-box.rojo { background: var(--red-dim); color: var(--red); }

.pill { display: inline-flex; align-items: center; gap: 6px; height: 26px; padding: 0 10px; border-radius: 999px; font-family: var(--mono); font-size: 12px; font-weight: 500; white-space: nowrap; flex-shrink: 0; background: var(--green-dim); border: 1px solid var(--green-border); color: var(--green); }
.pill::before { content: ''; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.pill.mora { background: var(--red-dim); border-color: var(--red-border); color: var(--red); }
.pill.gris { background: var(--surface-2); border-color: var(--border-2); color: var(--text-2); }

.card { padding: 16px; border-radius: 20px; background: var(--surface); border: 1px solid var(--vidrio-canto); box-shadow: var(--superficie-sombra); margin-bottom: 12px; }
.card-top { display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; }
.card-top h2 { font-size: 16px; font-weight: 600; }
.card-top p { margin-top: 1px; font-size: 13px; color: var(--text-2); }
.card-acciones { margin-top: 12px; display: flex; gap: 8px; }
.card-acciones .btn { flex: 1; width: auto; }
.code-big { margin-top: 22px; padding: 20px 0; border-radius: 20px; background: var(--surface); border: 1px solid var(--accent-line); box-shadow: var(--superficie-sombra); text-align: center; }
.code-big b { display: block; font-family: var(--mono); font-size: 44px; font-weight: 500; letter-spacing: 0.2em; padding-left: 0.2em; line-height: 1.35; color: var(--accent); }
.code-big small { font-family: var(--mono); font-size: 12px; color: var(--text-2); }

.group { border-radius: 16px; background: var(--surface); border: 1px solid var(--vidrio-canto); box-shadow: var(--superficie-sombra); padding: 0 14px; }
.group-row { display: flex; align-items: center; gap: 12px; width: 100%; min-height: 60px; padding: 8px 0; border: none; border-bottom: 1px solid var(--border); background: none; color: var(--text); text-align: left; font-size: 15px; }
.group-row:last-child { border-bottom: none; }
.group-row .row-title.rojo { color: var(--red); }
.group-row .chev { margin-left: auto; color: var(--text-2); font-size: 16px; display: flex; }
.group-row .der { margin-left: auto; }

.aviso-linea { display: flex; align-items: center; gap: 10px; min-height: 52px; padding: 4px 14px; margin-top: 12px; border-radius: 14px; background: var(--red-dim); border: 1px solid var(--red-border); font-size: 13.5px; }
.aviso-linea a, .aviso-linea button { margin-left: auto; color: var(--red); font-weight: 600; white-space: nowrap; padding: 12px 0; background: none; border: none; font-size: 13.5px; }
.caja { padding: 14px; border-radius: 16px; background: var(--surface); border: 1px solid var(--vidrio-canto); box-shadow: var(--superficie-sombra); display: flex; align-items: center; gap: 12px; }
.empty { padding: 24px 20px; border-radius: 16px; border: 1px dashed var(--border-2); display: flex; flex-direction: column; align-items: center; text-align: center; }
.empty .icon-box { width: 48px; height: 48px; border-radius: 50%; font-size: 22px; }
.empty b { margin-top: 12px; font-size: 15px; font-weight: 600; }
.empty span { margin-top: 2px; font-size: 13px; color: var(--text-2); }
.skel { border-radius: 14px; background: var(--surface); border: 1px solid var(--border); min-height: 64px; margin-bottom: 8px; animation: r2-pulso 1.2s ease-in-out infinite; }
@keyframes r2-pulso { 50% { opacity: 0.45; } }

/* ── Marca, encabezado y tarjeta del residente ──────────────────────── */
.logo { width: 52px; height: 52px; border-radius: 15px; border: 1px solid var(--tinte-canto); background: var(--tinte); -webkit-backdrop-filter: var(--tinte-desenfoque); backdrop-filter: var(--tinte-desenfoque); color: var(--tinte-texto); display: flex; align-items: center; justify-content: center; font-size: 26px; box-shadow: var(--tinte-sombra); flex-shrink: 0; }
.logo.chico { width: 40px; height: 40px; border-radius: 12px; font-size: 20px; }
.cabecera { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 14px; }
.marca { display: flex; align-items: center; gap: 10px; min-width: 0; }
.marca b { display: block; font-size: 16px; font-weight: 600; letter-spacing: -0.2px; line-height: 1.25; }
.marca small { font-family: var(--mono); font-size: 11px; color: var(--text-2); }
.cabecera-der { display: flex; align-items: center; gap: 8px; flex-shrink: 0; }
.sos { height: 44px; padding: 0 14px; border-radius: 999px; background: var(--sos-fondo); -webkit-backdrop-filter: blur(18px) saturate(170%); backdrop-filter: blur(18px) saturate(170%); border: 1px solid var(--sos-canto); box-shadow: var(--sos-sombra); color: var(--sos-texto); font-size: 14px; font-weight: 600; line-height: 1; display: flex; align-items: center; gap: 7px; }
/* La sirena tiene los rayos arriba y su masa queda baja: se sube para alinearla ópticamente con el texto. */
.sirena { position: relative; top: -0.11em; display: flex; }
.sos .sirena { font-size: 18px; }

/* La tarjeta de la casa: vidrio, con un filo de luz que le da la vuelta despacio. El canto de base es tenue; lo que se
   ve moverse es un arco de luz (::after: un degradado cónico recortado al borde con una máscara, girado con --giro).
   Sin `@property` el arco queda quieto en su sitio; con «reducir movimiento», también. */
.casa-card { position: relative; padding: 20px; border-radius: 22px; background: var(--vidrio); -webkit-backdrop-filter: blur(22px) saturate(170%); backdrop-filter: blur(22px) saturate(170%); border: 1px solid var(--tarjeta-canto); box-shadow: var(--tarjeta-sombra); }
.casa-card::after {
  content: ''; position: absolute; inset: -1px; border-radius: inherit; padding: 1.5px; pointer-events: none;
  background: conic-gradient(from var(--giro, 0deg), transparent 0 52%, var(--filo) 76%, var(--filo-brillo) 88%, var(--filo) 94%, transparent 100%);
  -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0); -webkit-mask-composite: xor;
  mask: linear-gradient(#000 0 0) content-box exclude, linear-gradient(#000 0 0);
  animation: casa-filo 7s linear infinite;
}
@keyframes casa-filo { to { --giro: 360deg; } }
@media (prefers-reduced-motion: reduce) {
  .casa-card::after { animation: none; }
}
.casa-card > * { position: relative; }
/* LAS DOS CARAS: en la misma celda de una rejilla. La caja de la tarjeta es la de la más alta de las dos y no cambia al
   girar; la cara que no se ve queda oculta (`visibility`, así tampoco recibe toques ni la lee un lector de pantalla). */
.casa-card { display: grid; grid-template-columns: minmax(0, 1fr); }
.casa-cara { grid-area: 1 / 1; min-width: 0; }
.casa-card:not(.vuelta) .casa-reverso, .casa-card.vuelta .casa-frente { visibility: hidden; }
/* El botón que la da vuelta cubre toda la tarjeta; la pastilla del estado queda por encima de él. */
.casa-card > .casa-girar { position: absolute; inset: 0; z-index: 1; width: 100%; height: 100%; border: none; border-radius: inherit; background: none; color: inherit; }
.casa-girar:focus-visible { outline: 2px solid var(--accent); outline-offset: -3px; }
#ini-estado { z-index: 2; }
.casa-card > .casa-aviso { position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0; overflow: hidden; clip: rect(0 0 0 0); clip-path: inset(50%); white-space: nowrap; border: 0; }
/* Por detrás: el nivel, la racha, una pista de 12 tramos y cuántas casas hay en cada nivel. Todo a 12 px o más. */
.casa-reverso { display: flex; flex-direction: column; justify-content: space-between; gap: 6px; }
.rev-fila { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; font-size: 12px; color: var(--text-2); }
.rev-etq { font-weight: 600; letter-spacing: 0.09em; text-transform: uppercase; color: var(--accent-t); }
.rev-racha { display: flex; align-items: baseline; gap: 10px; min-width: 0; }
.rev-racha b { font-size: 32px; font-weight: 600; letter-spacing: -0.5px; line-height: 1; }
.rev-racha span { font-size: 14px; color: var(--text); opacity: 0.86; overflow-wrap: anywhere; }
.rev-pista { display: grid; grid-template-columns: repeat(12, minmax(0, 1fr)); gap: 4px; }
.rev-pista i { height: 6px; border-radius: 3px; background: var(--accent-dim); border: 1px solid var(--accent-line); }
.rev-pista i.on { background: var(--filo); border-color: var(--filo); }
/* La línea del residencial guarda el lugar de dos renglones aunque todavía no llegue (o falle): al cargar no se mueve nada. */
.rev-linea { display: flex; align-items: flex-end; min-height: calc(2 * 1.35em); font-size: 12px; line-height: 1.35; color: var(--text-2); overflow-wrap: anywhere; }
.casa-top { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.casa-top h1 { min-width: 0; font-size: 24px; font-weight: 600; letter-spacing: -0.4px; line-height: 1.2; overflow-wrap: anywhere; }
/* La pastilla del estado es un botón (lleva a Cuenta): su flecha, y 44 px para el dedo sin crecer a la vista. */
#ini-estado { position: relative; }
#ini-estado::after { content: ''; position: absolute; inset: -9px -6px; }
#ini-estado .ic { font-size: 11px; margin-left: -1px; }
/* La frase viva (tarjeta.js): debajo del saludo, a todo el ancho. */
.casa-frase { margin-top: 3px; color: var(--text); opacity: 0.86; overflow-wrap: anywhere; }
.casa-datos { margin-top: 22px; display: flex; align-items: flex-end; gap: 32px; }
.casa-datos small { display: block; font-family: var(--mono); font-size: 12px; letter-spacing: 0.09em; color: var(--text-2); }
.casa-datos b { display: block; margin-top: 2px; font-family: var(--mono); font-size: 28px; font-weight: 500; line-height: 1.15; }
/* En un teléfono de 320 px de ancho, con 32 px entre columnas «Residente» se salía de la tarjeta. */
@media (max-width: 359px) { .casa-datos { gap: 14px; } }
.casa-datos .rol { margin-left: auto; text-align: right; }
.casa-datos .rol b { font-family: var(--font); font-size: 16px; font-weight: 600; line-height: 2; }

.placa { width: 72px; height: 72px; border-radius: 20px; background: var(--surface); border: 1px solid var(--accent-line); display: flex; flex-direction: column; align-items: center; justify-content: center; line-height: 1; flex-shrink: 0; }
.placa small { font-family: var(--mono); font-size: 11px; font-weight: 500; letter-spacing: 0.08em; color: var(--accent); text-transform: uppercase; }
.placa b { margin-top: 4px; font-size: 26px; font-weight: 600; }

/* ── PIN ────────────────────────────────────────────────────────────── */
.pin-dots { display: flex; gap: 14px; margin: 14px 0 30px; }
.pin-dots span { width: 14px; height: 14px; border-radius: 50%; border: 1.5px solid var(--border-2); transition: all 0.15s; }
.pin-dots span.on { background: var(--accent); border-color: var(--accent); box-shadow: 0 0 10px var(--accent-glow); }
.pin-dots.mal { animation: r2-sacude 0.35s; }
@keyframes r2-sacude { 25% { transform: translateX(-7px); } 75% { transform: translateX(7px); } }
.keys { display: grid; grid-template-columns: repeat(3, 72px); gap: 16px 28px; justify-content: center; }
.keys button { width: 72px; height: 72px; border-radius: 50%; border: 1px solid var(--border); background: var(--surface); color: var(--text); font-size: 26px; font-weight: 500; display: flex; align-items: center; justify-content: center; }
.keys button:active { background: var(--surface-3); }
.keys button.borrar { border: none; background: none; color: var(--text-2); }

/* ── Ingreso y PIN según el alto disponible ─────────────────────────────
   En teléfonos bajos el teclado del PIN debe caber sin desplazarse: se compactan tamaños y
   márgenes por tramos de alto (el alto es el del marco, no el de la pantalla). */
.ing-marca { display: flex; flex-direction: column; align-items: center; text-align: center; padding-top: 36px; }
.des-placa { margin-top: 40px; }
.des-saludo { font-size: 26px; margin-top: 18px; }
.des-msg { margin-top: 26px; }
.des-cambiar { margin-top: 20px; }
@media (max-height: 760px) {
  .ing-marca { padding-top: 8px; }
  .des-placa { margin-top: 8px; width: 64px; height: 64px; border-radius: 18px; }
  .des-placa b { font-size: 22px; }
  .des-saludo { font-size: 24px; margin-top: 12px; }
  .des-msg { margin-top: 14px; }
  .des-cambiar { margin-top: 10px; }
  .pin-dots { margin: 12px 0 20px; }
  .keys { grid-template-columns: repeat(3, 60px); gap: 12px 26px; }
  .keys button { width: 60px; height: 60px; font-size: 23px; }
}
@media (max-height: 600px) {
  .des-placa { width: 52px; height: 52px; border-radius: 15px; }
  .des-placa small { font-size: 10px; }
  .des-placa b { font-size: 18px; margin-top: 2px; }
  .des-saludo { font-size: 21px; margin-top: 8px; }
  .des-msg { margin-top: 8px; }
  .des-cambiar { margin-top: 2px; }
  .pin-dots { margin: 10px 0 14px; }
  .keys { grid-template-columns: repeat(3, 52px); gap: 8px 24px; }
  .keys button { width: 52px; height: 52px; font-size: 21px; }
}

/* ── Barra inferior ─────────────────────────────────────────────────── */
.tabbar { position: absolute; left: 0; right: 0; bottom: 0; z-index: 3; display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); align-items: center; padding: 8px 12px max(env(safe-area-inset-bottom, 0px), 10px); background: var(--vidrio-flota); -webkit-backdrop-filter: blur(24px) saturate(180%); backdrop-filter: blur(24px) saturate(180%); border-top: 1px solid var(--flota-canto); box-shadow: inset 0 1px 0 var(--flota-luz); }
.tab { display: flex; flex-direction: column; align-items: center; justify-content: flex-end; gap: 4px; height: 52px; padding: 0 0 3px; border: none; background: none; color: var(--text-2); font-size: 11px; font-weight: 500; }
.tab svg { font-size: 22px; }
.tab.on { color: var(--accent); }
.tab.mas { color: var(--text); }
.tab.mas i { width: 48px; height: 48px; border-radius: 50%; border: 1px solid var(--tinte-canto); background: var(--tinte); -webkit-backdrop-filter: var(--tinte-desenfoque); backdrop-filter: var(--tinte-desenfoque); color: var(--tinte-texto); display: flex; align-items: center; justify-content: center; box-shadow: var(--tinte-sombra); flex-shrink: 0; }
.tab.mas[disabled] { color: var(--text-2); }
.tab.mas[disabled] i { border-color: var(--vidrio-canto); background: var(--surface-3); color: var(--text-2); box-shadow: none; }

/* ── Aviso flotante y hoja inferior ─────────────────────────────────── */
.toast { position: fixed; left: 50%; bottom: calc(110px + env(safe-area-inset-bottom, 0px)); transform: translate(-50%, 20px); width: max-content; max-width: min(92vw, 420px); padding: 12px 16px; border-radius: 14px; background: var(--vidrio-flota); -webkit-backdrop-filter: blur(24px) saturate(180%); backdrop-filter: blur(24px) saturate(180%); border: 1px solid var(--vidrio-canto); color: var(--text); font-size: 14px; box-shadow: var(--shadow); opacity: 0; pointer-events: none; transition: all var(--transition); z-index: 60; text-align: center; }
.toast.on { opacity: 1; transform: translate(-50%, 0); }
.toast.error { border-color: var(--red-border); }
.toast.ok { border-color: var(--green-border); }
.hoja-fondo { position: fixed; inset: 0; background: var(--velo); z-index: 50; display: flex; align-items: flex-end; justify-content: center; }
/* La hoja es de vidrio: deja lo de atrás difuso. */
.hoja { width: 100%; max-width: 480px; max-height: 88%; overflow-y: auto; background: var(--vidrio-flota); -webkit-backdrop-filter: blur(30px) saturate(180%); backdrop-filter: blur(30px) saturate(180%); border-radius: 26px 26px 0 0; border-top: 1px solid var(--hoja-canto); box-shadow: var(--hoja-sombra); padding: 10px 20px max(env(safe-area-inset-bottom, 0px), 24px); }
.hoja::before { content: ''; display: block; width: 38px; height: 4px; border-radius: 4px; background: var(--border-2); margin: 0 auto 16px; }
.hoja h2 { font-size: 20px; font-weight: 600; letter-spacing: -0.3px; margin-bottom: 6px; }
.hoja p { font-size: 14px; color: var(--text-2); margin-bottom: 18px; }
.hoja .acciones { display: flex; flex-direction: column; gap: 10px; }

/* ── El aviso de instalar y la hoja para compartir el pase (styles/instalar.css, styles/compartir.css) ──
   Son hojas que también usan otros portales y traen colores fijos y la letra de máquina escrita a mano. Aquí va solo lo
   que cambia en ESTE portal: vidrio, botones lisos y la letra única. La hoja de compartir es siempre oscura (enseña el
   boleto, que es oscuro): su caja lleva data-theme="dark" en la página y por eso toma las variables de «noche». */
[data-portal="residente"] .pwa-overlay { background: var(--velo); }
[data-portal="residente"] .pwa-box { background: var(--vidrio-flota); -webkit-backdrop-filter: blur(30px) saturate(180%); backdrop-filter: blur(30px) saturate(180%); border: none; border-top: 1px solid var(--hoja-canto); box-shadow: var(--hoja-sombra); }
[data-portal="residente"] .pwa-handle { background: var(--border-2); }
[data-portal="residente"] :is(.pwa-icon-ring, .pwa-feat-icon) { background: var(--accent-dim); }
[data-portal="residente"] .pwa-title, [data-portal="residente"] .pwa-step strong { color: var(--text); }
[data-portal="residente"] :is(.pwa-desc, .pwa-feat, .pwa-step, .pwa-btn-ghost) { color: var(--text-2); }
[data-portal="residente"] :is(.pwa-features, .pwa-steps) { background: var(--surface); border-color: var(--vidrio-canto); box-shadow: inset 0 1px 0 var(--vidrio-luz); }
[data-portal="residente"] .pwa-step-label { font-family: var(--font); font-size: 12px; letter-spacing: 0.09em; color: var(--text-2); }
[data-portal="residente"] .pwa-step-num { background: var(--accent); color: var(--sobre-acento); font-size: 12px; }
[data-portal="residente"] .pwa-step .pwa-puntos { color: var(--accent); }
[data-portal="residente"] .pwa-btn-primary { border: 1px solid var(--tinte-canto); background: var(--tinte); color: var(--tinte-texto); box-shadow: var(--tinte-sombra); }

[data-portal="residente"] .share-overlay { background: var(--velo); -webkit-backdrop-filter: blur(24px) saturate(160%); backdrop-filter: blur(24px) saturate(160%); color: var(--text); }
[data-portal="residente"] .share-code-row { background: var(--surface); border-color: var(--vidrio-canto); }
[data-portal="residente"] .share-code { font-family: var(--font); color: var(--text); }
[data-portal="residente"] .btn-share-native, [data-portal="residente"] .btn-share-native:hover { border: 1px solid var(--tinte-canto); background: var(--tinte); color: var(--tinte-texto); box-shadow: var(--tinte-sombra); }
[data-portal="residente"] :is(.btn-share-download, .btn-share-copy), [data-portal="residente"] :is(.btn-share-download, .btn-share-copy):hover { border: 1px solid var(--vidrio-canto); background: var(--surface-2); color: var(--text); }
[data-portal="residente"] .btn-share-close, [data-portal="residente"] .btn-share-close:hover { color: var(--text-2); }

/* ═══════════════════════════════════════════════════════════════════
   R2Anuncios.html, líneas 5-26 (su <style>, tal cual)
   ═══════════════════════════════════════════════════════════════════ */
/* Filas compactas y uniformes, sin importar el formato con que se publicó el anuncio.
   El color del anuncio solo aparece como una línea pequeña de acento en la fila. */
.an-lista .row { margin: 8px 0 0; }
.an-lista .row:first-child { margin-top: 12px; }
.an-fila .row-title, .an-fila .row-sub { display: block; }
.an-fila .row-sub { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.an-acento { width: 3px; height: 30px; border-radius: 3px; background: var(--accent); flex-shrink: 0; }
.an-chev { display: flex; font-size: 16px; color: var(--text-2); flex-shrink: 0; }
.row.an-mas { min-height: 44px; justify-content: center; font-size: 13px; font-weight: 500; color: var(--accent); }

/* Hoja del anuncio */
.an-msg { white-space: pre-line; overflow-wrap: anywhere; }
.an-carrusel { margin: 12px 0 18px; }
.an-pista { display: flex; gap: 8px; overflow-x: auto; scroll-snap-type: x mandatory; -webkit-overflow-scrolling: touch; border-radius: 12px; scrollbar-width: none; }
.an-pista::-webkit-scrollbar { display: none; }
/* 'start' es estable con gap; 'center' hacía que el snap se anclara en la segunda imagen al cargar. */
.an-lamina { flex: 0 0 100%; scroll-snap-align: start; }
.an-lamina img { display: block; width: auto; max-width: 100%; height: auto; max-height: 52vh; margin: 0 auto; border-radius: 12px; }
.an-puntos { display: flex; justify-content: center; gap: 5px; margin-top: 8px; }
.an-puntos span { width: 6px; height: 6px; border-radius: 50%; background: var(--border-2); transition: background var(--transition); }
.an-puntos span.on { background: var(--text-2); }
.an-acciones { margin-top: 18px; }

/* ═══════════════════════════════════════════════════════════════════
   R2Visitas.html, líneas 3-6 (su <style>, tal cual)
   ═══════════════════════════════════════════════════════════════════ */
.vis-titulo { margin-bottom: 16px; }

/* ═══════════════════════════════════════════════════════════════════
   R2Programar.html, líneas 4-19 (su <style>, tal cual)
   ═══════════════════════════════════════════════════════════════════ */
/* Lo que R2Styles no trae para esta sección. Solo variables de color existentes. */
.prog-nota { margin: 0 0 16px; padding: 12px 14px; border-radius: 12px; background: var(--accent-dim); border: 1px solid var(--accent-glow); font-size: 13.5px; }

/* Fila de una visita frecuente: el nombre es un botón (editar) y a la derecha va "Generar código". */
.prog-frec { flex: 1; min-width: 0; min-height: 46px; display: flex; align-items: center; gap: 12px; padding: 0; border: none; background: none; color: inherit; font-size: 15px; line-height: 1.4; text-align: left; }
.prog-frec .row-title, .prog-frec .row-sub { display: block; }
/* Un nombre largo pasa a otra línea en vez de cortarse con puntos suspensivos (noviembre de 2026: ya no hay un botón que le quite el ancho). */
.prog-frec .row-title { white-space: normal; overflow: visible; text-overflow: clip; overflow-wrap: anywhere; line-height: 1.3; }
.prog-frec[disabled] { opacity: 0.55; }
/* La hoja de un contacto frecuente: quién es, la vigencia del código y sus dos botones. */
.frec-quien { display: flex; align-items: center; gap: 12px; margin-bottom: 18px; }
.frec-datos { min-width: 0; }
.frec-quien h2 { margin-bottom: 2px; overflow-wrap: anywhere; }
.frec-quien p { margin-bottom: 0; }
.frec-vigencia { margin-bottom: 18px; }

.prog-mora { margin-top: 12px; }
.prog-mora-fila { display: flex; justify-content: space-between; gap: 12px; padding: 8px 0; border-bottom: 1px solid var(--border); font-size: 14px; }
.prog-mora-total { border-bottom: none; font-weight: 600; }

.prog-cerrar { display: flex; justify-content: flex-end; }
.prog-ok { display: flex; flex-direction: column; align-items: center; text-align: center; margin-top: 4px; }
.prog-check { width: 56px; height: 56px; border-radius: 50%; background: var(--green); color: var(--bg); display: flex; align-items: center; justify-content: center; font-size: 28px; }

/* ═══════════════════════════════════════════════════════════════════
   R2Cuenta.html, líneas 4-28 (su <style>, tal cual)
   ═══════════════════════════════════════════════════════════════════ */
/* Lo que R2Styles no trae para esta sección. Solo variables de color existentes. */
.cta-saldo { margin-bottom: 0; }
.cta-monto { margin-top: 8px; font-size: 32px; font-weight: 600; letter-spacing: -0.6px; line-height: 1.2; }

.cta-meses { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 6px; }
.cta-meses span { height: 44px; border-radius: 10px; border: 1px solid var(--border); color: var(--text-2); display: flex; align-items: center; justify-content: center; font-family: var(--mono); font-size: 11px; font-weight: 500; }
.cta-meses .cta-pag { background: var(--green-dim); border-color: var(--green-border); color: var(--green); }
.cta-meses .cta-pen { background: var(--red-dim); border-color: var(--red-border); color: var(--red); }
.cta-meses .cta-prox { background: var(--surface-2); border-color: var(--border-2); color: var(--text); }
/* Vencido y todavía sin mora (meses de tolerancia): se debe, pero no es una alarma. */
.cta-meses .cta-plz { background: var(--surface-2); border-color: var(--border-2); color: var(--amber); }

.cta-pend .group-row { min-height: 48px; }
.cta-pend b { font-weight: 600; }
.cta-en-plazo { margin-left: 6px; font-size: 12.5px; color: var(--text-2); }
.cta-reglas { list-style: none; display: grid; gap: 8px; padding: 14px; border-radius: 16px; background: var(--red-dim); border: 1px solid var(--red-border); font-size: 13.5px; }
.cta-reglas li { display: flex; gap: 10px; }
.cta-reglas li::before { content: ''; width: 6px; height: 6px; margin-top: 7px; border-radius: 50%; background: var(--red); flex-shrink: 0; }

.cta-recibos .link { padding: 12px 4px; white-space: nowrap; flex-shrink: 0; }

.cta-skel-saldo { min-height: 126px; border-radius: 20px; margin-bottom: 0; }
.cta-skel-meses { min-height: 94px; }

/* Recibo dentro de la hoja inferior: de borde a borde, como el modal del portal anterior. */
.cta-recibo { position: relative; height: 54vh; margin: 0 -20px 14px; background: var(--bg-2); border-top: 1px solid var(--border); border-bottom: 1px solid var(--border); }
.cta-recibo iframe { display: block; width: 100%; height: 100%; border: 0; }
.cta-recibo-estado { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 10px; padding: 20px; text-align: center; font-size: 14px; color: var(--text-2); }

/* ═══════════════════════════════════════════════════════════════════
   R2Mas.html, líneas 3-39 (su <style>, tal cual)
   ═══════════════════════════════════════════════════════════════════ */
/* Solo lo que R2Styles no cubre. Sin colores propios: todo sale de sus variables. */
.mas-titulo { margin-bottom: 16px; }
.mas-row .row-title, .mas-row .row-sub { display: block; }
.mas-nota { margin: 8px 4px 0; }
.mas-ocupado { opacity: 0.55; pointer-events: none; }
.mas-pregunta { margin-bottom: 14px; }
.mas-sub { margin: -6px 0 16px; }

/* Reportar, paso 2 */
.mas-fecha { min-width: 0; }
.mas-fecha::-webkit-date-and-time-value { text-align: left; }
textarea.mas-desc { min-height: 132px; max-height: 60vh; overflow-y: auto; }
.mas-poco { color: var(--amber); }
.mas-lleno { color: var(--red); }
.mas-adjuntar { display: flex; align-items: center; justify-content: center; gap: 12px; width: 100%; min-height: 64px; padding: 8px 14px; margin-bottom: 8px; border-radius: 14px; border: 1px dashed var(--border-2); background: none; color: var(--text); text-align: left; }
.mas-adjuntar .ic { font-size: 20px; color: var(--accent); }
.mas-adjuntar b { display: block; font-size: 14.5px; font-weight: 600; }
.mas-adjuntar small { display: block; font-size: 12.5px; color: var(--text-2); }
.mas-adjuntos { margin-bottom: 10px; }
.mas-adjunto { display: flex; align-items: center; gap: 10px; min-height: 48px; padding: 0 2px 0 12px; margin-bottom: 8px; border-radius: 12px; background: var(--surface-2); border: 1px solid var(--border); font-size: 13.5px; }
.mas-adjunto > .ic { font-size: 16px; color: var(--text-2); }
.mas-adjunto b { flex: 1; min-width: 0; font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.mas-adjunto small { font-family: var(--mono); font-size: 11.5px; color: var(--text-2); white-space: nowrap; }
.mas-adjunto button { width: 44px; height: 44px; border: none; background: none; color: var(--text-2); font-size: 16px; display: flex; align-items: center; justify-content: center; flex-shrink: 0; }

/* Lista de morosos */
.mas-buscar { position: relative; margin-bottom: 12px; }
.mas-buscar .ic { position: absolute; left: 14px; top: 16px; font-size: 20px; color: var(--text-2); pointer-events: none; }
.mas-buscar .input { padding-left: 44px; }
/* Casa arriba y etiqueta debajo, en una columna; el monto a la derecha, centrado y sin partirse. */
.mas-casa { display: flex; flex-direction: column; align-items: flex-start; gap: 3px; }
.mas-casa .row-title { max-width: 100%; }
.mas-tag { padding: 2px 7px; border-radius: 6px; border: 1px solid var(--border-2); color: var(--text-2); font-size: 11px; font-weight: 500; white-space: nowrap; }
.mas-deuda { color: var(--red); font-size: 14px; font-weight: 500; white-space: nowrap; flex-shrink: 0; }
.mas-leyenda { margin: 12px 4px 0; }
.mas-pie { padding-top: 16px; }
.mas-pie .row-title { white-space: normal; }

/* ═══════════════════════════════════════════════════════════════════
   R2Emergencia.html, líneas 3-56 (su <style>, tal cual)
   ═══════════════════════════════════════════════════════════════════ */
/* Estilos propios de Emergencia (prefijo em-). Solo usan las variables de R2Styles. */
.em-pane { flex: 1 0 auto; display: flex; flex-direction: column; }
.em-aviso { margin-bottom: 20px; }

.em-tipos { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; margin-bottom: 18px; }
.em-tipo { display: flex; align-items: center; gap: 10px; min-height: 56px; padding: 8px 12px; border-radius: 14px; border: 1px solid var(--border-2); background: var(--surface-2); color: var(--text); font-size: 14.5px; font-weight: 500; line-height: 1.25; text-align: left; transition: border-color var(--transition), background var(--transition); }
.em-tipo svg { font-size: 20px; color: var(--text-2); }
.em-tipo.em-ancho { grid-column: 1 / -1; }
.em-tipo[aria-pressed="true"] { border-color: var(--red); background: var(--red-dim); font-weight: 600; }
.em-tipo[aria-pressed="true"] svg { color: var(--red); }

.em-protocolo { align-items: flex-start; margin-bottom: 18px; }
.em-protocolo b { color: var(--text); font-weight: 600; }

.em-origen { min-height: 52px; padding: 6px 14px; border-radius: 14px; margin-bottom: 18px; }
.em-origen svg { font-size: 18px; color: var(--accent); }
.em-origen b { margin-left: auto; font-size: 14px; font-weight: 600; text-align: right; }

/* La nota crece con el texto hasta un tope; el mensaje de disturbio arranca más alto. */
.em-nota { max-height: 60vh; overflow-y: auto; }
.em-nota.em-amplia { min-height: 150px; }
.em-cuenta { font-family: var(--mono); white-space: nowrap; flex-shrink: 0; font-variant-numeric: tabular-nums; }
.em-cuenta.em-poco { color: var(--amber); }
.em-cuenta.em-lleno { color: var(--red); }

/* Botón de mantener presionado: el avance se llena en 2 s (igual que HOLD_MS) y se retira al soltar.
   Sin selección de texto ni menú al mantener presionado; touch-action: none evita que un leve
   movimiento del dedo se tome como desplazamiento y corte el envío. */
.em-pie { padding-top: 8px; -webkit-user-select: none; user-select: none; -webkit-touch-callout: none; }
.em-hold { position: relative; overflow: hidden; display: flex; align-items: center; justify-content: center; gap: 10px; width: 100%; min-height: 64px; padding: 0 16px; border: none; border-radius: 16px; background: var(--red); color: var(--on-red); font-size: 17px; font-weight: 600; line-height: 1; touch-action: none; -webkit-user-select: none; user-select: none; -webkit-touch-callout: none; transition: transform 0.1s; }
.em-hold > span { position: relative; }
.em-hold .sirena { font-size: 22px; }
.em-hold .spinner { border-color: currentColor; border-top-color: transparent; }
.em-hold-avance { position: absolute; inset: 0; background: var(--on-red); opacity: 0.24; transform: scaleX(0); transform-origin: left center; transition: transform 0.2s ease-out; pointer-events: none; }
/* En tema claro --on-red es blanco: se usa el tono oscuro del tema para que el avance oscurezca igual. */
[data-theme="light"] .em-hold-avance { background: var(--text); }
.em-hold.em-presionado { transform: scale(0.985); }
.em-hold.em-presionado .em-hold-avance { transform: scaleX(1); transition: transform 2s linear; }
.em-hold.em-cargando { pointer-events: none; }
.em-hold.em-cargando .em-hold-avance { transform: scaleX(1); transition: none; }
.em-pie-nota { margin-top: 12px; text-align: center; }
.em-pie-nota.em-atencion { animation: em-atencion 2.4s ease-out; }
@keyframes em-atencion { 0%, 60% { color: var(--text); } }

/* Estado de éxito y respuesta en vivo de la caseta */
.em-exito { align-items: center; text-align: center; padding-top: 24px; }
.em-exito .h2 { outline: none; }
.em-exito .sub { margin-top: 8px; }
.em-anillo { width: 64px; height: 64px; border-radius: 50%; border: 1px solid var(--red-border); font-size: 28px; margin-bottom: 16px; }
.em-estado { display: inline-flex; align-items: center; gap: 9px; margin: 20px 0 24px; padding: 10px 16px; border-radius: 14px; background: var(--surface-2); border: 1px solid var(--border-2); color: var(--text-2); font-size: 13.5px; font-weight: 600; text-align: left; }
.em-estado-punto { width: 8px; height: 8px; border-radius: 50%; background: var(--amber); flex-shrink: 0; animation: r2-pulso 1.2s ease-in-out infinite; }
.em-estado.em-atendida { background: var(--green-dim); border-color: var(--green-border); color: var(--green); }
.em-estado.em-atendida .em-estado-punto { background: var(--green); animation: none; }
.em-volver { min-height: 54px; border-radius: 14px; font-size: 16px; }
