/* =====================================================================
   Jarvis · Bosque Real — «Mark HUD»
   Estructura y aire holográfico del diseño A (telemetría, marcos con esquinas,
   tipografía técnica) con la paleta del traje: rojo del casco y oro sobre negro
   grafito. El cian es la luz del reactor y la energía; nada más.
   ===================================================================== */

:root {
  --fondo: #07080a;
  --fondo-2: #0c0d10;
  --sup: rgba(18, 20, 24, 0.74);
  --sup-solida: #111317;
  --sup-alta: #181b20;
  --vidrio: linear-gradient(180deg, rgba(255, 255, 255, 0.05), rgba(255, 255, 255, 0.01));
  --borde: rgba(255, 255, 255, 0.075);
  --borde-2: rgba(255, 255, 255, 0.13);
  --brillo-sup: inset 0 1px 0 rgba(255, 255, 255, 0.055);
  --sombra: 0 18px 40px -26px rgba(0, 0, 0, 0.9);

  --texto: #eef0f3;
  --texto-2: #a9b0b9;
  --texto-3: #7e858e;
  --titanio: #c4c9d0;
  --titanio-2: #8a9099;

  --rojo: #d6262f;
  --rojo-2: #8e1219;
  --rojo-claro: #ff6a5c;
  --rojo-suave: rgba(214, 38, 47, 0.15);
  --oro: #e8b04a;
  --oro-2: #a5782a;
  --oro-claro: #f6d48b;
  --oro-suave: rgba(232, 176, 74, 0.13);
  --oro-linea: rgba(232, 176, 74, 0.34);
  --lampara: #ffcf80;
  --cian: #6fdfff;
  --cian-claro: #cdf6ff;
  --cian-suave: rgba(111, 223, 255, 0.12);
  --ok: #6fe2b5;
  --aviso: #f2b544;
  --alerta: #ff3b3b;
  --alerta-2: #b0121b;

  --nucleo-1: #ffffff;
  --nucleo-2: rgba(140, 230, 255, 0.9);
  --nucleo-3: rgba(111, 223, 255, 0);

  --glow: 1;
  --r: 14px;
  --r-s: 12px;
  --f-texto: 'Chakra Petch', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  --f-marca: 'Orbitron', 'Chakra Petch', system-ui, sans-serif;
  --f-mono: 'Share Tech Mono', ui-monospace, 'SFMono-Regular', Menlo, monospace;
  --seg-top: env(safe-area-inset-top, 0px);
  --seg-bot: env(safe-area-inset-bottom, 0px);
  --nav-alto: 70px;
  --ease: cubic-bezier(0.2, 0.8, 0.2, 1);
  --d: min(250px, 64vw);
  color-scheme: dark;
}

/* Modo noche: más tenue y cálido; el reactor pasa a ámbar suave */
html[data-noche="1"] {
  --fondo: #0a0706;
  --fondo-2: #110c09;
  --sup: rgba(28, 21, 16, 0.76);
  --sup-solida: #17110c;
  --sup-alta: #1e1610;
  --vidrio: linear-gradient(180deg, rgba(255, 214, 170, 0.045), rgba(255, 214, 170, 0.01));
  --borde: rgba(255, 214, 170, 0.075);
  --borde-2: rgba(255, 214, 170, 0.13);
  --brillo-sup: inset 0 1px 0 rgba(255, 214, 170, 0.045);
  --texto: #e3d1b6;
  --texto-2: #b8a68c;
  --texto-3: #918069;
  --titanio: #cdb89b;
  --titanio-2: #8c7a63;
  --rojo: #c4513a;
  --rojo-2: #74261a;
  --rojo-claro: #e48a6a;
  --rojo-suave: rgba(196, 81, 58, 0.15);
  --oro: #d29a4c;
  --oro-2: #8f6427;
  --oro-claro: #ebc183;
  --oro-suave: rgba(210, 154, 76, 0.14);
  --oro-linea: rgba(210, 154, 76, 0.3);
  --lampara: #f3a85a;
  --cian: #ffc68a;
  --cian-claro: #ffe2c0;
  --cian-suave: rgba(255, 198, 138, 0.1);
  --ok: #a8d49a;
  --nucleo-1: #f7dfbd;
  --nucleo-2: rgba(255, 180, 110, 0.8);
  --nucleo-3: rgba(255, 180, 110, 0);
  --glow: 0.42;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; background: var(--fondo); overflow-x: clip; }
body {
  margin: 0;
  min-height: 100vh;
  min-height: 100dvh;
  font-family: var(--f-texto);
  font-size: 15px;
  line-height: 1.45;
  font-weight: 500;
  color: var(--texto);
  background: var(--fondo);
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
  overflow-x: hidden;
  transition: color 0.6s;
}
/* Fondo: brillo rojo del casco arriba, oro a la izquierda y una rejilla HUD que se desvanece */
body::before {
  content: '';
  position: fixed;
  inset: 0;
  z-index: -2;
  pointer-events: none;
  background:
    radial-gradient(820px 520px at 96% -14%, rgba(214, 38, 47, calc(0.17 * var(--glow))), transparent 62%),
    radial-gradient(700px 520px at -20% 30%, rgba(232, 176, 74, calc(0.065 * var(--glow))), transparent 60%),
    radial-gradient(900px 600px at 50% 120%, rgba(111, 223, 255, calc(0.04 * var(--glow))), transparent 60%),
    linear-gradient(180deg, var(--fondo-2), var(--fondo) 62%);
}
body::after {
  content: '';
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  opacity: 0.9;
  background-image:
    linear-gradient(rgba(255, 255, 255, 0.022) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.022) 1px, transparent 1px);
  background-size: 44px 44px;
  -webkit-mask-image: radial-gradient(120% 70% at 50% 0%, #000 10%, transparent 70%);
  mask-image: radial-gradient(120% 70% at 50% 0%, #000 10%, transparent 70%);
}

button, input, select { font: inherit; color: inherit; }
button { cursor: pointer; background: none; border: 0; padding: 0; touch-action: manipulation; }
button:disabled { cursor: default; }
a { color: inherit; text-decoration: none; }
h1, h2, h3, p { margin: 0; }
[hidden] { display: none !important; }
:focus-visible { outline: 2px solid var(--oro); outline-offset: 3px; border-radius: 10px; }
::selection { background: rgba(232, 176, 74, 0.35); }

.ic { width: 22px; height: 22px; flex: none; fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }

/* ---------- Esquinas HUD (visor): marcan lo importante sin ensuciar ---------- */
.maestro::before, .persianas-casa::before, .foco-escena::before, .clima-casa::before, .entrada-tarjeta::before,
.cab-estancia::before, .modos-casa .modo-casa.activo::before, .riego::before, .jarvis-escena::before, .holograma::before {
  content: '';
  position: absolute;
  inset: 6px;
  pointer-events: none;
  z-index: 1;
  --c: var(--oro-linea);
  --l: 11px;
  --g: 1.5px;
  background:
    linear-gradient(var(--c), var(--c)) top left / var(--l) var(--g) no-repeat,
    linear-gradient(var(--c), var(--c)) top left / var(--g) var(--l) no-repeat,
    linear-gradient(var(--c), var(--c)) top right / var(--l) var(--g) no-repeat,
    linear-gradient(var(--c), var(--c)) top right / var(--g) var(--l) no-repeat,
    linear-gradient(var(--c), var(--c)) bottom left / var(--l) var(--g) no-repeat,
    linear-gradient(var(--c), var(--c)) bottom left / var(--g) var(--l) no-repeat,
    linear-gradient(var(--c), var(--c)) bottom right / var(--l) var(--g) no-repeat,
    linear-gradient(var(--c), var(--c)) bottom right / var(--g) var(--l) no-repeat;
}

/* ---------- Tipografía de apoyo ---------- */
.eyebrow {
  font-family: var(--f-mono);
  font-size: 12px;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--oro);
}
.titulo {
  display: flex;
  align-items: center;
  gap: 10px;
  flex: 1;
  min-width: 0;
  font-family: var(--f-mono);
  font-size: 12.5px;
  font-weight: 400;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--texto-2);
  white-space: nowrap;
}
.titulo::before { content: ''; width: 6px; height: 6px; background: var(--oro); transform: rotate(45deg); box-shadow: 0 0 8px rgba(232, 176, 74, calc(0.7 * var(--glow))); flex: none; }
.titulo::after { content: ''; flex: 1; min-width: 12px; height: 1px; background: linear-gradient(90deg, var(--borde-2), transparent); }
.marca-texto { font-family: var(--f-marca); font-weight: 600; font-size: 14px; letter-spacing: 0.36em; color: var(--texto); }
.parrafo { color: var(--texto-2); font-size: 14.5px; line-height: 1.55; }
.parrafo b { color: var(--texto); }
.nota { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; color: var(--texto-2); white-space: nowrap; }
.nota .cuenta { font-weight: 700; font-size: 14px; color: var(--oro-claro); }
.enlace-nota { min-height: 44px; padding: 0 2px; color: var(--oro-claro); font-weight: 600; }
.nota .ic { width: 15px; height: 15px; }
.insignia {
  display: inline-flex; align-items: center; height: 26px; padding: 0 10px; border-radius: 6px;
  font-family: var(--f-mono); font-size: 12px; letter-spacing: 0.1em; text-transform: uppercase;
  color: var(--oro-claro); background: var(--oro-suave); border: 1px solid var(--oro-linea); white-space: nowrap;
}
.insignia-gris { color: var(--texto-2); background: rgba(255, 255, 255, 0.04); border-color: var(--borde-2); }
.vacio { display: flex; align-items: center; gap: 10px; padding: 18px; color: var(--texto-2); font-size: 14px; border: 1px dashed var(--borde-2); border-radius: var(--r-s); }
.vacio .ic { color: var(--texto-3); }
.led { width: 8px; height: 8px; border-radius: 50%; flex: none; background: var(--texto-3); }
.led.ok { background: var(--ok); box-shadow: 0 0 10px rgba(111, 226, 181, calc(0.7 * var(--glow))); }
.led.mal { background: var(--aviso); box-shadow: 0 0 10px rgba(242, 181, 68, 0.6); }

/* ---------- Botones ---------- */
.btn {
  position: relative;
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 48px; padding: 0 18px; border-radius: 12px;
  font-weight: 600; font-size: 15px; letter-spacing: 0.02em;
  background: var(--vidrio), var(--sup); border: 1px solid var(--borde-2); box-shadow: var(--brillo-sup);
  transition: transform 0.15s var(--ease), background 0.2s, border-color 0.2s, opacity 0.2s;
  overflow: hidden;
}
.btn:active:not(:disabled) { transform: scale(0.97); }
.btn:disabled { opacity: 0.45; }
.btn .ic { width: 19px; height: 19px; }
.btn-ancho { width: 100%; }
.btn.mini { min-height: 44px; padding: 0 14px; font-size: 14px; border-radius: 10px; }
.btn-primario {
  color: #1d1406; border-color: rgba(255, 222, 160, 0.55);
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.3), rgba(255, 255, 255, 0) 55%), linear-gradient(135deg, var(--oro-claro), var(--oro) 55%, var(--oro-2));
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.45), 0 12px 30px -14px rgba(232, 176, 74, calc(0.8 * var(--glow)));
  font-weight: 700; letter-spacing: 0.04em;
}
.btn-alerta {
  color: #fff; border-color: rgba(255, 160, 150, 0.6);
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.18), rgba(255, 255, 255, 0) 55%), linear-gradient(135deg, var(--alerta), var(--alerta-2));
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.3), 0 10px 30px -10px rgba(255, 59, 59, 0.8);
}
.btn-fantasma-claro { background: rgba(255, 255, 255, 0.08); border-color: rgba(255, 255, 255, 0.35); color: #fff; box-shadow: none; }
.btn-suave { background: var(--vidrio), var(--sup); }
.btn-fantasma { background: transparent; border-color: var(--borde-2); box-shadow: none; color: var(--texto-2); }
.btn.ejecutando::after {
  content: ''; position: absolute; inset: 0;
  background: linear-gradient(100deg, transparent 20%, rgba(255, 255, 255, 0.16) 50%, transparent 80%);
  transform: translateX(-100%); animation: barrido 1.1s linear infinite;
}
@keyframes barrido { to { transform: translateX(100%); } }

.btn-icono {
  display: inline-grid; place-items: center; width: 44px; height: 44px; border-radius: 12px; flex: none;
  color: var(--texto-2); transition: background 0.2s, color 0.2s, transform 0.15s;
}
.btn-icono:hover { background: rgba(255, 255, 255, 0.05); color: var(--texto); }
.btn-icono:active { transform: scale(0.94); }
.btn-icono.mini { width: 44px; height: 44px; }
.btn-icono.mini .ic { width: 18px; height: 18px; }
.btn-icono.apagado { color: var(--texto-3); }

.btn-redondo {
  display: inline-grid; place-items: center; width: 50px; height: 50px; border-radius: 50%;
  background: var(--vidrio), var(--sup-alta); border: 1px solid var(--borde-2); box-shadow: var(--brillo-sup), 0 6px 16px -8px rgba(0, 0, 0, 0.8);
  color: var(--texto); transition: transform 0.15s var(--ease), border-color 0.2s, background 0.2s;
}
.btn-redondo:active { transform: scale(0.92); background: rgba(255, 255, 255, 0.1); }
.btn-redondo.parar { color: var(--rojo-claro); }
.btn-redondo .ic { width: 20px; height: 20px; }

/* ---------- Campos ---------- */
.campo { display: grid; gap: 7px; }
.campo > span:first-child { font-family: var(--f-mono); font-size: 12px; letter-spacing: 0.18em; text-transform: uppercase; color: var(--texto-3); }
.campo input, .fila-nombre input, .jarvis-form input, select {
  width: 100%; height: 50px; padding: 0 14px; border-radius: 12px;
  background: rgba(255, 255, 255, 0.035); border: 1px solid var(--borde-2); color: var(--texto); font-size: 16px; font-weight: 500;
  transition: border-color 0.2s, box-shadow 0.2s, background 0.2s; outline: none;
}
.campo input:focus, .fila-nombre input:focus, .jarvis-form input:focus, select:focus {
  border-color: rgba(232, 176, 74, 0.6); background: rgba(255, 255, 255, 0.05); box-shadow: 0 0 0 4px rgba(232, 176, 74, 0.12);
}
.campo-clave { position: relative; display: block; }
.campo-clave input { padding-right: 52px; }
.campo-clave .btn-icono { position: absolute; right: 3px; top: 3px; }
select { appearance: none; -webkit-appearance: none; padding-right: 36px; background-image: linear-gradient(45deg, transparent 50%, var(--texto-2) 50%), linear-gradient(135deg, var(--texto-2) 50%, transparent 50%); background-position: calc(100% - 20px) 22px, calc(100% - 15px) 22px; background-size: 5px 5px; background-repeat: no-repeat; }

/* =====================================================================
   El reactor (marca, arranque, barra, Jarvis)
   ===================================================================== */
.reactor { display: block; width: 100%; height: 100%; overflow: visible; }
.reactor * { transform-box: view-box; transform-origin: 100px 100px; }
.reactor .r-borde { fill: none; stroke: rgba(255, 255, 255, 0.14); stroke-width: 1.2; }
.reactor .r-ticks circle { fill: none; stroke: var(--titanio-2); stroke-width: 6; stroke-dasharray: 0.3 0.7; opacity: 0.55; }
.reactor .r-arcos path { fill: none; stroke: var(--oro); stroke-width: 3.2; stroke-linecap: round; opacity: 0.9; }
.reactor .r-anillo { fill: none; stroke: var(--titanio-2); stroke-width: 1.4; opacity: 0.8; }
.reactor .r-seg path { fill: var(--cian-suave); stroke: var(--cian); stroke-width: 2.2; stroke-linejoin: round; }
.reactor .r-halo { opacity: calc(0.38 * var(--glow)); transform: scale(1.3); }
.reactor .r-nucleo { opacity: 0.95; }
.reactor .r-aro { fill: none; stroke: var(--cian-claro); stroke-width: 2.4; opacity: 0.9; }
.reactor .r-centro { fill: #fff; opacity: 0.95; }
.reactor.mini .r-ticks, .reactor.mini .r-arcos, .reactor.nav .r-ticks { display: none; }
.reactor.mini .r-seg path { stroke-width: 4; }
.reactor.apagado .r-nucleo, .reactor.apagado .r-halo { opacity: 0.1; }
.reactor.apagado .r-centro { opacity: 0.25; }
.reactor.apagado .r-seg path { stroke: var(--titanio-2); fill: none; }
.reactor.apagado .r-aro { stroke: var(--titanio-2); }

.reactor.activo .r-ticks { animation: girar 18s linear infinite; }
.reactor.activo .r-arcos { animation: girar 30s linear infinite reverse; }
.reactor.activo .r-seg { animation: girar 60s linear infinite; }
.reactor.activo .r-halo { animation: latir 2.8s ease-in-out infinite; }
.reactor.pulso .r-nucleo, .reactor.pulso .r-halo { animation: pulso 0.5s var(--ease); }
@keyframes girar { to { transform: rotate(360deg); } }
@keyframes latir { 0%, 100% { opacity: calc(0.3 * var(--glow)); transform: scale(1.25); } 50% { opacity: calc(0.6 * var(--glow)); transform: scale(1.42); } }
@keyframes pulso { 0% { transform: scale(1); } 40% { transform: scale(1.22); } 100% { transform: scale(1); } }

/* =====================================================================
   Indicador de carga (giro): dos arcos que giran en sentidos opuestos
   ===================================================================== */
.giro { position: absolute; inset: -5px; display: none; pointer-events: none; }
.giro svg { position: absolute; inset: 0; width: 100%; height: 100%; overflow: visible; will-change: transform; }
.giro circle { fill: none; stroke-linecap: round; }
.giro-a circle { stroke: var(--oro-claro); stroke-width: 2.6; stroke-dasharray: 28 72; filter: drop-shadow(0 0 3px rgba(246, 212, 139, 0.6)); }
.giro-b circle { stroke: var(--cian); stroke-width: 2; stroke-dasharray: 16 84; opacity: 0.9; }
.giro-a { animation: girar 0.9s linear infinite; }
.giro-b { animation: girar 1.5s linear infinite reverse; }
.giro.en-linea { position: relative; inset: auto; display: inline-block; width: 22px; height: 22px; flex: none; }
.ejecutando > .giro, .ejecutando > * > .giro, [data-fase="enviando"] .giro, [data-fase="enviada"] .giro { display: block; }
[data-fase="enviada"] .giro-a { animation-duration: 1.8s; }
[data-fase="enviada"] .giro-a circle { stroke-dasharray: 6 4; }
.ejecutando > .ic, .ejecutando > * > .ic { opacity: 0.35; }

/* Estados de una orden: enviando → enviada → confirmada (o sin respuesta) */
[data-fase="fallo"] { border-color: rgba(255, 59, 59, 0.75) !important; box-shadow: 0 0 0 1px rgba(255, 59, 59, 0.45), 0 0 26px -8px rgba(255, 59, 59, 0.7) !important; }
[data-fase="fallo"] .luz-estado, [data-fase="fallo"] .p-estado, [data-fase="fallo"] .chip-estado { color: #ff9b94 !important; font-weight: 700; }
[data-fase="dudoso"] { border-style: dashed !important; border-color: rgba(242, 181, 68, 0.6) !important; }
[data-fase="dudoso"] .luz-estado, [data-fase="dudoso"] .p-estado, [data-fase="dudoso"] .chip-estado { color: var(--aviso) !important; }
[data-fase="confirmada"] .luz-estado, [data-fase="confirmada"] .p-estado, [data-fase="confirmada"] .chip-estado { color: var(--ok) !important; }
[data-fase="enviando"] .luz-estado, [data-fase="enviada"] .luz-estado, [data-fase="enviando"] .chip-estado, [data-fase="enviada"] .chip-estado { color: var(--oro-claro) !important; }
.hecho { animation: hecho 0.9s var(--ease); }
@keyframes hecho { 0% { box-shadow: 0 0 0 0 rgba(111, 226, 181, 0.7); } 100% { box-shadow: 0 0 0 14px rgba(111, 226, 181, 0); } }
.confirmado { animation: confirmado 0.8s var(--ease); }
@keyframes confirmado { 0% { box-shadow: 0 0 0 0 rgba(111, 226, 181, 0.55), var(--brillo-sup); } 100% { box-shadow: 0 0 0 14px rgba(111, 226, 181, 0), var(--brillo-sup); } }

/* =====================================================================
   Arranque
   ===================================================================== */
.arranque {
  position: fixed; inset: 0; z-index: 100;
  display: grid; place-items: center; padding: 24px;
  background:
    radial-gradient(520px 420px at 50% 34%, rgba(111, 223, 255, calc(0.09 * var(--glow))), transparent 70%),
    radial-gradient(700px 500px at 50% 110%, rgba(214, 38, 47, calc(0.14 * var(--glow))), transparent 70%),
    #050607;
  transition: opacity 0.6s var(--ease), transform 0.6s var(--ease), filter 0.4s;
}
.arranque.fuera { opacity: 0; transform: scale(1.04); pointer-events: none; }
.arranque.corto { transition-duration: 0.35s; }
.arranque.detras { filter: blur(6px) brightness(0.45); }
.arranque-centro { width: min(340px, 100%); display: grid; justify-items: center; text-align: center; }
.arranque-reactor { width: 172px; height: 172px; margin-bottom: 28px; }
.arranque.vivo .arranque-reactor .reactor > * { animation: encender-pieza 0.9s var(--ease) backwards; }
.arranque.vivo .reactor .r-ticks { animation: encender-pieza 0.9s var(--ease) 0.1s backwards, girar 18s linear 1s infinite; }
.arranque.vivo .reactor .r-arcos { animation: encender-pieza 1s var(--ease) 0.2s backwards, girar 30s linear 1.2s infinite reverse; }
.arranque.vivo .reactor .r-seg { animation: encender-pieza 1s var(--ease) 0.3s backwards, girar 60s linear 1.3s infinite; }
.arranque.vivo .reactor .r-anillo { animation-delay: 0.4s; }
.arranque.vivo .reactor .r-nucleo, .arranque.vivo .reactor .r-aro, .arranque.vivo .reactor .r-centro { animation-delay: 0.55s; }
.arranque.vivo .reactor .r-halo { animation: encender-halo 1.4s var(--ease) 0.6s backwards, latir 2.8s ease-in-out 2s infinite; }
.arranque.corto .arranque-reactor .reactor > * { animation-duration: 0.35s !important; animation-delay: 0s !important; }
.arranque.corto .arranque-log, .arranque.corto .arranque-barra, .arranque.corto .arranque-sub, .arranque.corto .arranque-saltar { display: none; }
@keyframes encender-pieza { from { opacity: 0; transform: scale(0.82) rotate(-40deg); } }
@keyframes encender-halo { from { opacity: 0; transform: scale(0.6); } }
.arranque-marca { display: flex; gap: 0.04em; font-family: var(--f-marca); font-weight: 600; font-size: 25px; letter-spacing: 0.1em; color: var(--texto); }
.arranque-marca span { animation: letra 0.7s var(--ease) backwards; }
.arranque-marca span:nth-child(even) { color: var(--rojo); }
.arranque-marca span:nth-child(1) { animation-delay: 0.30s; } .arranque-marca span:nth-child(3) { animation-delay: 0.38s; }
.arranque-marca span:nth-child(5) { animation-delay: 0.46s; } .arranque-marca span:nth-child(7) { animation-delay: 0.54s; }
.arranque-marca span:nth-child(9) { animation-delay: 0.62s; } .arranque-marca span:nth-child(11) { animation-delay: 0.70s; }
.arranque-marca span:nth-child(even) { animation-delay: 0.8s; }
.arranque.corto .arranque-marca span { animation: none; }
@keyframes letra { from { opacity: 0; transform: translateY(8px); filter: blur(4px); } }
.arranque-sub { margin-top: 12px; font-family: var(--f-mono); font-size: clamp(11px, 3vw, 12.5px); letter-spacing: clamp(0.12em, 1.2vw, 0.24em); text-transform: uppercase; white-space: nowrap; color: var(--oro); animation: aparecer 0.8s 0.9s backwards; }
.arranque-log { list-style: none; margin: 26px 0 0; padding: 0; width: 100%; min-height: 150px; font-family: var(--f-mono); font-size: 13px; color: var(--texto-2); text-align: left; }
.arranque-log li { display: flex; align-items: baseline; gap: 8px; padding: 3px 0; animation: linea 0.35s var(--ease) backwards; }
.arranque-log .al-txt { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.arranque-log li::after { content: ''; order: 1; flex: 1; border-bottom: 1px dotted rgba(255, 255, 255, 0.14); transform: translateY(-3px); }
.arranque-log .al-ok { order: 2; color: var(--ok); letter-spacing: 0.08em; }
.arranque-log .al-ok.mal { color: var(--aviso); }
.arranque-log .al-ok:empty { display: none; }
.arranque-log li.quip { color: var(--oro); }
.arranque-log li.quip::after, .arranque-log li.final::after { display: none; }
.arranque-log li.final { color: var(--texto); margin-top: 6px; letter-spacing: 0.06em; }
@keyframes linea { from { opacity: 0; transform: translateX(-6px); } }
@keyframes aparecer { from { opacity: 0; } }
.arranque-barra { width: 100%; height: 2px; margin-top: 18px; background: rgba(255, 255, 255, 0.06); border-radius: 2px; overflow: hidden; }
.arranque-barra i { display: block; height: 100%; background: linear-gradient(90deg, var(--rojo), var(--oro)); transform-origin: left; transform: scaleX(0.04); transition: transform 0.35s var(--ease); box-shadow: 0 0 12px var(--rojo); }
.arranque-cargando { display: flex; align-items: center; gap: 10px; margin-top: 18px; font-family: var(--f-mono); font-size: 13px; letter-spacing: 0.08em; color: var(--oro-claro); opacity: 0; transition: opacity 0.3s; }
.arranque-cargando .giro { display: inline-block; }
.arranque.corto .arranque-cargando, .arranque-cargando.visible { opacity: 1; transition-delay: 0.4s; }
.arranque-saltar { position: absolute; right: 16px; bottom: calc(16px + var(--seg-bot)); min-height: 44px; padding: 0 16px; border-radius: 10px; font-family: var(--f-mono); letter-spacing: 0.14em; text-transform: uppercase; color: var(--texto-2); font-size: 13px; }

/* =====================================================================
   Entrada
   ===================================================================== */
.entrada {
  position: fixed; inset: 0; z-index: 110; display: grid; place-items: center; padding: 20px;
  background: radial-gradient(520px 380px at 50% 20%, rgba(214, 38, 47, calc(0.1 * var(--glow))), transparent 70%), rgba(5, 6, 7, 0.62);
  opacity: 0; transition: opacity 0.35s var(--ease);
  overflow-y: auto;
}
.entrada.visible { opacity: 1; }
.entrada-tarjeta {
  position: relative;
  width: min(380px, 100%); display: grid; gap: 16px; padding: 32px 24px 22px; border-radius: 18px;
  background: var(--vidrio), rgba(15, 17, 21, 0.88); border: 1px solid var(--borde-2);
  box-shadow: var(--brillo-sup), 0 40px 80px -30px rgba(0, 0, 0, 0.9);
  -webkit-backdrop-filter: blur(22px) saturate(140%); backdrop-filter: blur(22px) saturate(140%);
  transform: translateY(10px); transition: transform 0.45s var(--ease);
}
.entrada.visible .entrada-tarjeta { transform: none; }
.entrada-reactor { width: 76px; height: 76px; margin: 0 auto 2px; }
.entrada-tarjeta .eyebrow { text-align: center; }
.entrada-titulo { text-align: center; font-weight: 600; font-size: 30px; letter-spacing: 0.01em; margin-top: -8px; }
.entrada-texto { text-align: center; color: var(--texto-2); font-size: 14.5px; margin-top: -6px; }
.entrada-error { min-height: 20px; color: #ff9b94; font-size: 14px; text-align: center; margin: -4px 0 -6px; }
.entrada-pie { text-align: center; color: var(--texto-3); font-size: 13px; }
.entrada-tarjeta .btn-primario { min-height: 54px; font-size: 16px; }
#entrada-boton .giro { position: relative; inset: auto; width: 24px; height: 24px; margin-right: 4px; }
#entrada-boton .giro-a circle { stroke: #3a2808; filter: none; }
#entrada-boton .giro-b circle { stroke: #6b4d16; }
#entrada-boton.ejecutando { pointer-events: none; }
.sacudir { animation: sacudir 0.42s; }
@keyframes sacudir { 15%, 55% { transform: translateX(-9px); } 35%, 75% { transform: translateX(8px); } 90% { transform: translateX(-3px); } }
.sacudir-suave { animation: sacudir-suave 0.35s; }
@keyframes sacudir-suave { 25% { transform: translateX(-5px); } 60% { transform: translateX(4px); } }

/* =====================================================================
   Estructura
   ===================================================================== */
.app { min-height: 100vh; min-height: 100dvh; }
.riel { display: none; }
.columna { min-width: 0; }
.barra {
  position: sticky; top: 0; z-index: 30;
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  padding: calc(6px + var(--seg-top)) 8px 6px 16px; min-height: calc(58px + var(--seg-top));
  background: linear-gradient(180deg, rgba(7, 8, 10, 0.92), rgba(7, 8, 10, 0.7));
  -webkit-backdrop-filter: blur(18px) saturate(140%); backdrop-filter: blur(18px) saturate(140%);
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}
.barra::after { content: ''; position: absolute; left: 16px; bottom: -1px; width: 64px; height: 1px; background: linear-gradient(90deg, var(--oro), transparent); opacity: 0.7; }
html[data-noche="1"] .barra { background: linear-gradient(180deg, rgba(10, 8, 7, 0.94), rgba(10, 8, 7, 0.72)); }
.barra-marca { display: flex; align-items: center; gap: 11px; min-height: 44px; }
.barra-reactor { width: 32px; height: 32px; }
.casco { display: block; width: 100%; height: 100%; overflow: visible; }
.casco.marca { filter: drop-shadow(0 0 8px rgba(214, 38, 47, calc(0.45 * var(--glow)))); }
.barra-derecha { display: flex; align-items: center; gap: 2px; }
.chip-enlace {
  display: inline-flex; align-items: center; gap: 8px; height: 40px; padding: 0 12px; border-radius: 8px;
  font-family: var(--f-mono); font-size: 12.5px; letter-spacing: 0.14em; text-transform: uppercase;
  color: var(--texto-2); background: rgba(255, 255, 255, 0.03); border: 1px solid var(--borde);
}
.chip-enlace i { width: 7px; height: 7px; border-radius: 50%; background: var(--texto-3); }
.chip-enlace[data-estado="ok"] i { background: var(--ok); box-shadow: 0 0 10px rgba(111, 226, 181, calc(0.8 * var(--glow))); }
.chip-enlace[data-estado="reconectando"] i { background: var(--oro); animation: parpadeo 1.2s ease-in-out infinite; }
.chip-enlace[data-estado="caido"] i, .chip-enlace[data-estado="sin-casa"] i { background: var(--aviso); box-shadow: 0 0 10px rgba(242, 181, 68, 0.7); }
.chip-enlace[data-estado="caido"], .chip-enlace[data-estado="sin-casa"] { color: #ffd59a; border-color: rgba(242, 181, 68, 0.4); }
@keyframes parpadeo { 50% { opacity: 0.3; } }

.aviso-enlace {
  position: sticky; top: calc(58px + var(--seg-top)); z-index: 25;
  display: flex; align-items: center; gap: 10px; padding: 6px 10px 6px 16px;
  font-size: 13.5px; color: #ffe2b8;
  background: linear-gradient(90deg, rgba(120, 78, 20, 0.72), rgba(70, 46, 14, 0.64));
  border-bottom: 1px solid rgba(242, 181, 68, 0.4);
  -webkit-backdrop-filter: blur(12px); backdrop-filter: blur(12px);
}
.aviso-enlace > span:nth-child(2) { flex: 1; }
.aviso-enlace .ae-ic { display: grid; place-items: center; }
.aviso-enlace .ae-ic .ic { width: 18px; height: 18px; color: #ffd59a; }
.aviso-enlace .btn { position: relative; color: #ffe9cc; border-color: rgba(255, 210, 150, 0.35); }
.aviso-enlace .btn .giro { inset: 6px auto auto 6px; width: 30px; height: 30px; }
html[data-enlace="caido"] .pantalla, html[data-enlace="sin-casa"] .pantalla { filter: saturate(0.6); }
html[data-viejo="1"] .pantalla::before { content: 'Último estado conocido'; display: block; margin-bottom: -14px; font-family: var(--f-mono); font-size: 12px; letter-spacing: 0.18em; text-transform: uppercase; color: var(--aviso); }

/* Banda de alarma: en todas las pantallas mientras haya agua */
.banda-alerta {
  position: sticky; top: calc(58px + var(--seg-top)); z-index: 26;
  display: flex; align-items: center; gap: 12px; padding: 8px 12px 8px 16px; color: #fff; font-size: 14px;
  background: repeating-linear-gradient(135deg, rgba(255, 59, 59, 0.95) 0 14px, rgba(176, 18, 27, 0.95) 14px 28px);
  box-shadow: 0 8px 26px -6px rgba(255, 59, 59, 0.7);
}
.banda-alerta > span:nth-child(2) { flex: 1; text-shadow: 0 1px 2px rgba(0, 0, 0, 0.5); }
.banda-alerta .ba-ic .ic { width: 22px; height: 22px; }
.banda-alerta .btn { background: rgba(0, 0, 0, 0.35); border-color: rgba(255, 255, 255, 0.5); }

.vista { padding: 20px 16px calc(var(--nav-alto) + 40px + var(--seg-bot)); outline: none; }
html[data-vista="estancia"] .vista { padding-bottom: calc(var(--nav-alto) + 136px + var(--seg-bot)); }
.pantalla { display: grid; grid-template-columns: minmax(0, 1fr); gap: 28px; max-width: 1000px; margin: 0 auto; }
.pantalla.entrar { animation: entrar 0.45s var(--ease); }
.pantalla.entrar-lado { animation: entrar-lado 0.42s var(--ease); }
@keyframes entrar { from { opacity: 0; transform: translateY(10px); } }
@keyframes entrar-lado { from { opacity: 0; transform: translateX(22px); } }

.bloque { display: grid; grid-template-columns: minmax(0, 1fr); gap: 12px; }
.bloque[id], .pantalla [id] { scroll-margin-top: calc(84px + var(--seg-top)); }
#aviso-alarma:empty { display: none; }
.bloque-cab { display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: 26px; }

/* ---------- Pestañas inferiores ---------- */
.pestanas {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 40;
  display: grid; grid-template-columns: repeat(5, 1fr); align-items: end;
  height: calc(var(--nav-alto) + var(--seg-bot)); padding: 0 6px var(--seg-bot);
  background: linear-gradient(180deg, rgba(12, 13, 16, 0.9), rgba(7, 8, 10, 0.98));
  -webkit-backdrop-filter: blur(24px) saturate(150%); backdrop-filter: blur(24px) saturate(150%);
  border-top: 1px solid rgba(255, 255, 255, 0.07);
  box-shadow: 0 -20px 40px -10px rgba(0, 0, 0, 0.7);
}
.pestanas:empty { display: none; }
html[data-noche="1"] .pestanas { background: linear-gradient(180deg, rgba(18, 14, 12, 0.92), rgba(10, 8, 7, 0.98)); }
.pestana {
  position: relative; display: grid; justify-items: center; gap: 5px; padding: 11px 0 9px; height: var(--nav-alto);
  color: var(--texto-3); font-family: var(--f-mono); font-size: 11.5px; letter-spacing: 0.12em; text-transform: uppercase; transition: color 0.2s;
}
.pestana .ic { width: 23px; height: 23px; transition: transform 0.25s var(--ease); }
.pestana.activa { color: var(--texto); }
.pestana.activa .ic { color: var(--oro-claro); }
.pestana.activa::before {
  content: ''; position: absolute; top: -1px; left: 50%; width: 30px; height: 2px; transform: translateX(-50%);
  background: var(--oro); box-shadow: 0 0 12px rgba(232, 176, 74, calc(0.9 * var(--glow)));
}
.pestana:active .ic { transform: scale(0.9); }
.insignia-num { position: absolute; top: 6px; left: calc(50% + 6px); min-width: 18px; height: 18px; padding: 0 5px; border-radius: 99px; font-family: var(--f-texto); font-style: normal; font-size: 12px; line-height: 18px; font-weight: 700; letter-spacing: 0; color: #1d1406; background: var(--oro-claro); box-shadow: 0 0 10px rgba(246, 212, 139, 0.5); }
.pestana-jarvis { align-self: start; }
.pj-reactor {
  position: relative; display: grid; place-items: center; width: 60px; height: 60px; margin-top: -32px; border-radius: 50%; padding: 6px;
  background: radial-gradient(circle at 50% 42%, #14181d, #08090b 72%);
  border: 1px solid var(--oro-linea);
  box-shadow: 0 0 0 5px rgba(7, 8, 10, 0.92), 0 10px 26px -8px rgba(0, 0, 0, 0.9), 0 0 28px rgba(111, 223, 255, calc(0.22 * var(--glow)));
  transition: transform 0.2s var(--ease);
}
.pestana-jarvis:active .pj-reactor { transform: scale(0.93); }
.pestana-jarvis.activando .pj-reactor { animation: chispa 0.7s var(--ease); }
@keyframes chispa { 0% { box-shadow: 0 0 0 5px rgba(7, 8, 10, 0.92), 0 0 0 0 rgba(111, 223, 255, 0.9); } 100% { box-shadow: 0 0 0 5px rgba(7, 8, 10, 0.92), 0 0 0 26px rgba(111, 223, 255, 0); } }
.pestana-jarvis .pestana-txt { color: var(--texto-2); margin-top: -2px; }

/* =====================================================================
   Inicio
   ===================================================================== */
.saludo { position: relative; display: grid; grid-template-columns: minmax(0, 1fr); gap: 10px; padding-top: 2px; }
.saludo-kicker { display: flex; flex-wrap: wrap; align-items: center; gap: 0 9px; }
.saludo-kicker .sep { color: var(--texto-3); }
.saludo-kicker #reloj { color: var(--oro-claro); }
.saludo-kicker .kicker-casa { color: var(--texto-3); }
@media (max-width: 599px) { .saludo-titulo em { display: block; } }
@media (max-width: 420px) { .saludo-kicker .sep-casa, .saludo-kicker .kicker-casa { display: none; } }
.saludo-titulo { font-weight: 600; font-size: 31px; line-height: 1.1; letter-spacing: 0.005em; }
.saludo-titulo em {
  font-style: normal; font-weight: 700; white-space: nowrap;
  background: linear-gradient(100deg, var(--oro-claro), var(--oro) 55%, #c78d3a);
  -webkit-background-clip: text; background-clip: text; color: transparent;
}
.saludo-jarvis { display: flex; align-items: flex-start; gap: 10px; min-height: 3em; color: var(--texto-2); font-size: 15px; line-height: 1.5; max-width: 560px; }
.firma {
  flex: none; display: inline-grid; place-items: center; width: 22px; height: 22px; margin-top: 1px; border-radius: 5px;
  font-family: var(--f-marca); font-weight: 700; font-size: 11px; color: #fff;
  background: linear-gradient(135deg, var(--rojo), var(--rojo-2)); box-shadow: 0 0 14px rgba(214, 38, 47, calc(0.45 * var(--glow)));
}
.saludo-fila { display: flex; align-items: center; justify-content: space-between; gap: 10px; min-height: 44px; margin-top: -14px; }
.saludo-fila .ticker { flex: 1; min-width: 0; }
.btn-informe {
  position: relative; display: inline-flex; align-items: center; gap: 8px; min-height: 44px; padding: 0 14px 0 12px; border-radius: 10px;
  font-family: var(--f-mono); font-size: 13px; letter-spacing: 0.14em; text-transform: uppercase;
  color: var(--oro-claro); border: 1px solid var(--oro-linea); background: var(--oro-suave);
}
.btn-informe .ic { width: 18px; height: 18px; }
.btn-informe .giro { inset: 7px auto auto 7px; width: 30px; height: 30px; }
.ticker { display: flex; align-items: center; gap: 8px; min-height: 44px; font-size: 13.5px; color: var(--texto-3); white-space: nowrap; overflow: hidden; }
.ticker time { font-family: var(--f-mono); font-size: 12.5px; color: var(--texto-3); }
.ticker span { overflow: hidden; text-overflow: ellipsis; }
.ticker b { color: var(--texto-2); font-weight: 600; }
.ticker-led { flex: none; width: 6px; height: 6px; border-radius: 50%; background: var(--ok); box-shadow: 0 0 8px rgba(111, 226, 181, calc(0.8 * var(--glow))); }
html[data-enlace="caido"] .ticker-led, html[data-enlace="sin-casa"] .ticker-led { background: var(--aviso); box-shadow: none; }

.alarma-banner {
  display: flex; align-items: center; gap: 12px; padding: 14px 14px 14px 16px; border-radius: var(--r); color: #fff;
  background: repeating-linear-gradient(135deg, rgba(255, 59, 59, 0.22) 0 12px, rgba(255, 59, 59, 0.08) 12px 24px), linear-gradient(135deg, rgba(200, 24, 32, 0.75), rgba(110, 10, 16, 0.85));
  border: 1px solid rgba(255, 120, 110, 0.7); box-shadow: 0 0 40px -10px rgba(255, 59, 59, 0.8);
}
.alarma-banner > div { flex: 1; display: grid; }
.alarma-banner small { color: #ffd6d2; font-size: 13px; }
.alarma-banner .alarma-ic { color: #fff; background: var(--alerta); border-color: transparent; }

/* ---------- El núcleo: el reactor que resume la casa (y que se toca para hablar) ---------- */
.nucleo-bloque { position: relative; display: grid; grid-template: minmax(0, 1fr) / minmax(0, 1fr); place-items: center; min-height: calc(var(--d) + 86px); margin: -6px 0 -4px; }
.nucleo-bloque > * { grid-area: 1 / 1; }
.nucleo { position: relative; width: var(--d); height: var(--d); border-radius: 50%; -webkit-tap-highlight-color: transparent; touch-action: manipulation; }
.nucleo::before { content: ''; position: absolute; inset: 14%; border-radius: 50%; pointer-events: none; background: radial-gradient(circle, rgba(111, 223, 255, calc(0.22 * var(--glow))), transparent 68%); animation: respira 3.6s ease-in-out infinite; }
@keyframes respira { 0%, 100% { opacity: 0.55; transform: scale(0.94); } 50% { opacity: 1; transform: scale(1.06); } }
.nucleo > svg, .nucleo-capa, .nucleo-capa > svg { position: absolute; inset: 0; width: 100%; height: 100%; overflow: visible; }
.nucleo-marco { animation: girar 140s linear infinite; will-change: transform; }
.nucleo-marco .nm-ticks { fill: none; stroke: var(--titanio-2); stroke-width: 1.1; opacity: 0.55; }
.nucleo-marco .nm-borde { fill: none; stroke: rgba(255, 255, 255, 0.1); stroke-width: 1; }
.nucleo-marco .nm-cuña { stroke: var(--oro); stroke-width: 2.2; opacity: 0.85; }
.nucleo-datos .nl { fill: none; stroke: rgba(255, 255, 255, 0.085); stroke-width: 10; transition: stroke 0.5s; }
.nucleo-datos .nl.on { stroke: var(--lampara); }
.nucleo-datos .nl-brillo path { fill: none; stroke: rgba(255, 207, 128, calc(0.3 * var(--glow))); stroke-width: 19; }
.nucleo-datos .nm-txt { font-family: var(--f-mono); font-size: 7px; letter-spacing: 0.04em; fill: var(--texto-3); }
.nucleo-datos .np-pista { fill: none; stroke: rgba(255, 255, 255, 0.045); stroke-width: 5; }
.nucleo-datos .np { fill: none; stroke: var(--cian); stroke-width: 5; transition: opacity 0.6s; }
.nucleo-lema { font-family: var(--f-mono); font-size: 7.2px; letter-spacing: 0.2em; fill: var(--titanio); opacity: 0.85; }
.nucleo-lema-b { fill: var(--oro-claro); opacity: 0.8; font-size: 6.6px; letter-spacing: 0.16em; }
.nucleo-centro * { transform-box: view-box; transform-origin: 120px 120px; }
.nucleo-centro .nc-halo { opacity: calc(0.42 * var(--glow)); transform: scale(1.05); transition: opacity 0.9s linear, transform 0.9s var(--ease); }
.nucleo-centro .nc-arcos path { fill: none; stroke: var(--oro); stroke-width: 2.4; stroke-linecap: round; opacity: 0.85; }
.nucleo-centro .nc-anillo { fill: none; stroke: var(--titanio-2); stroke-width: 1.1; opacity: 0.7; }
.nucleo-centro .nc-bobinas path { fill: var(--cian-suave); stroke: var(--cian); stroke-width: 1.5; stroke-linejoin: round; transition: fill 0.4s; }
.nucleo-centro .nc-nucleo { transition: transform 0.9s var(--ease); }
.nucleo-centro .nc-aro { fill: none; stroke: var(--cian-claro); stroke-width: 2; opacity: 0.95; }
.nucleo-centro .nc-punto { fill: #fff; }
.nucleo:active .nucleo-centro { transform: scale(0.97); }
.nucleo-centro { transition: transform 0.2s var(--ease); }
.nucleo-onda { position: absolute; inset: 26%; border-radius: 50%; border: 2px solid var(--cian); opacity: 0; pointer-events: none; }
.nucleo[data-estado="sin-casa"] { --nucleo-1: #fff3dc; --nucleo-2: rgba(242, 181, 68, 0.85); --nucleo-3: rgba(242, 181, 68, 0); --cian: #f2b544; --cian-claro: #ffe3b0; --cian-suave: rgba(242, 181, 68, 0.12); }
.nucleo[data-estado="sin-casa"] .nucleo-lema, .nucleo[data-estado="caido"] .nucleo-lema { fill: var(--aviso); }
.nucleo[data-estado="caido"] { filter: saturate(0.2); opacity: 0.8; }
.nucleo[data-estado="alarma"] { --nucleo-1: #fff; --nucleo-2: rgba(255, 59, 59, 0.9); --nucleo-3: rgba(255, 59, 59, 0); --cian: #ff6a5c; --cian-claro: #ffc2bb; --cian-suave: rgba(255, 59, 59, 0.14); }
.nucleo[data-estado="alarma"] .nucleo-lema { fill: #ff8f88; }
.nucleo[data-estado="alarma"] .nc-halo { animation: latir-alarma 1s ease-in-out infinite; }
@keyframes latir-alarma { 50% { opacity: 0.9; transform: scale(1.22); } }
/* Tocarlo: se carga, gira y descarga dos ondas (el traje responde) */
.nucleo.activando .nc-bobinas { animation: girar 0.75s var(--ease); }
.nucleo.activando .nc-bobinas path { fill: rgba(111, 223, 255, 0.45); }
.nucleo.activando .nc-arcos { animation: girar 0.9s var(--ease) reverse; }
.nucleo.activando .nc-halo { opacity: 1; transform: scale(1.55); transition-duration: 0.25s; }
.nucleo.activando .nc-nucleo { animation: pulso 0.6s var(--ease); }
.nucleo.activando .nucleo-onda { animation: onda-nucleo 0.8s var(--ease); }
.nucleo.activando .nucleo-onda.o2 { animation: onda-nucleo 0.9s var(--ease) 0.14s backwards; }
.nucleo.activando .nucleo-marco { animation-duration: 3s; }
@keyframes onda-nucleo { from { opacity: 0.95; transform: scale(0.7); } to { opacity: 0; transform: scale(2.1); } }
html.activacion body::before { animation: destello-fondo 0.9s var(--ease); }
@keyframes destello-fondo { 30% { filter: brightness(1.6) saturate(1.2); } }
/* Mientras mantienes «Apagar luces», el reactor se carga… */
html.cargando-maestro .nucleo-marco { animation-duration: 1.6s; }
html.cargando-maestro .nucleo-centro .nc-halo { opacity: 0.95; transform: scale(1.4); }
html.cargando-maestro .nucleo-centro .nc-nucleo { transform: scale(1.12); }
/* …y al confirmar, descarga una onda. */
html.descarga .nucleo-onda { animation: onda-nucleo 0.85s var(--ease); }

/* Telemetría en las cuatro esquinas del reactor */
.nucleo-lado { position: relative; z-index: 2; align-self: stretch; justify-self: stretch; display: flex; flex-direction: column; justify-content: space-between; pointer-events: none; }
.nucleo-lado.izq { align-items: flex-start; }
.nucleo-lado.der { align-items: flex-end; text-align: right; }
.ndato { pointer-events: auto; position: relative; display: grid; gap: 1px; min-width: 0; max-width: 46%; min-height: 44px; padding: 6px 2px 2px; border-radius: 10px; }
.ndato::before { content: ''; width: 24px; height: 1.5px; margin-bottom: 6px; background: var(--oro); opacity: 0.75; }
.nucleo-lado.der .ndato::before { justify-self: end; }
.nucleo-lado .ndato:last-child { padding: 2px 2px 6px; }
.nucleo-lado .ndato:last-child::before { order: 9; margin: 6px 0 0; }
.ndato:active { background: rgba(255, 255, 255, 0.04); }
.ndato-etq { display: inline-flex; align-items: center; gap: 6px; font-family: var(--f-mono); font-size: 12px; letter-spacing: 0.18em; text-transform: uppercase; color: var(--texto-3); }
.nucleo-lado.der .ndato-etq { justify-content: flex-end; }
.ndato-led { width: 6px; height: 6px; transform: rotate(45deg); }
.ndato-led.luz { background: var(--lampara); box-shadow: 0 0 8px rgba(255, 207, 128, 0.6); }
.ndato-led.pers { background: var(--cian); box-shadow: 0 0 8px rgba(111, 223, 255, 0.5); }
.ndato-valor { font-weight: 600; font-size: 30px; line-height: 1.1; letter-spacing: 0.01em; font-variant-numeric: tabular-nums; white-space: nowrap; }
.ndato-valor small { font-family: var(--f-texto); font-size: 13px; font-weight: 600; color: var(--texto-3); margin-left: 3px; letter-spacing: 0; }
.ndato-sub { font-size: 13px; color: var(--texto-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ndato.activo .ndato-valor b { color: var(--oro-claro); text-shadow: 0 0 18px rgba(232, 176, 74, calc(0.45 * var(--glow))); }

/* ---------- Apagar luces: la acción de cada día (mantener) ---------- */
.bloque-protocolos { gap: 10px; }
.maestro {
  position: relative; overflow: hidden; display: flex; align-items: center; gap: 14px; width: 100%;
  min-height: 86px; padding: 14px 16px 14px 14px; border-radius: var(--r); text-align: left;
  background: radial-gradient(120% 160% at 0% 50%, rgba(214, 38, 47, calc(0.3 * var(--glow))), transparent 55%), linear-gradient(135deg, rgba(58, 13, 17, 0.94), rgba(20, 11, 12, 0.95));
  border: 1px solid rgba(214, 38, 47, 0.45);
  box-shadow: inset 0 1px 0 rgba(255, 180, 170, 0.12), 0 22px 44px -26px rgba(214, 38, 47, calc(0.9 * var(--glow)));
  touch-action: manipulation; -webkit-user-select: none; user-select: none; -webkit-touch-callout: none;
  transition: transform 0.2s var(--ease);
}
.maestro::before { --c: rgba(255, 190, 150, 0.4); }
.maestro:active { transform: scale(0.985); }
.maestro-ic { position: relative; display: grid; place-items: center; width: 56px; height: 56px; border-radius: 50%; color: #fff; background: radial-gradient(circle at 50% 35%, #ff5b52, var(--rojo) 55%, var(--rojo-2)); box-shadow: 0 0 24px rgba(214, 38, 47, calc(0.65 * var(--glow))), inset 0 1px 0 rgba(255, 255, 255, 0.3); flex: none; }
.maestro-ic .ic { width: 25px; height: 25px; position: relative; stroke-width: 1.9; }
.maestro-progreso { position: absolute; inset: -5px; width: calc(100% + 10px); height: calc(100% + 10px); transform: rotate(-90deg); overflow: visible; }
.maestro-progreso circle { fill: none; stroke: #ffe1b0; stroke-width: 3.2; stroke-linecap: round; stroke-dasharray: 0 100; filter: drop-shadow(0 0 4px rgba(255, 210, 150, 0.9)); transition: stroke-dasharray 0.25s var(--ease); }
.maestro.cargando .maestro-progreso circle { stroke-dasharray: 100 0; transition: stroke-dasharray 0.95s linear; }
.maestro .giro { inset: -7px; }
.maestro-txt { position: relative; flex: 1; min-width: 0; display: grid; gap: 3px; }
.maestro-txt b { font-size: 19px; font-weight: 700; letter-spacing: 0.06em; text-transform: uppercase; }
.maestro-txt small { font-size: 13.5px; color: #f2cfc9; }
.maestro-pista { position: relative; display: inline-flex; align-items: center; gap: 7px; height: 32px; padding: 0 11px; border-radius: 8px; font-family: var(--f-mono); font-size: 12px; letter-spacing: 0.16em; text-transform: uppercase; color: #ffd5d0; border: 1px solid rgba(255, 160, 150, 0.35); flex: none; }
.maestro-pista i { width: 6px; height: 6px; border-radius: 50%; background: var(--rojo-claro); box-shadow: 0 0 8px var(--rojo-claro); }
.maestro.cargando .maestro-pista { color: #fff; border-color: rgba(255, 225, 176, 0.7); }
.maestro.cargando .maestro-pista i { background: #ffe1b0; box-shadow: 0 0 10px #ffe1b0; }
.relleno {
  position: absolute; inset: 0; pointer-events: none; transform-origin: left center; transform: scaleX(0);
  background: linear-gradient(90deg, rgba(214, 38, 47, 0.6), rgba(255, 140, 100, 0.45));
  transition: transform 0.28s var(--ease);
}
.mantener.cargando .relleno { transform: scaleX(1); transition: transform 0.95s linear; }
.maestro.cargando { box-shadow: inset 0 1px 0 rgba(255, 180, 170, 0.2), 0 0 0 2px rgba(255, 140, 110, 0.55), 0 0 40px -6px rgba(214, 38, 47, 0.9); }
.mantener.confirmado { animation: confirmar-mantener 0.7s var(--ease); }
@keyframes confirmar-mantener { 0% { box-shadow: 0 0 0 0 rgba(255, 210, 150, 0.9); } 100% { box-shadow: 0 0 0 20px rgba(255, 210, 150, 0); } }
.maestro.ejecutando, .escena.ejecutando, .pc-btn.ejecutando { pointer-events: none; }
.maestro.ejecutando::after, .escena.ejecutando::after, .pc-btn.ejecutando::after {
  content: ''; position: absolute; inset: 0; pointer-events: none;
  background: linear-gradient(100deg, transparent 20%, rgba(255, 255, 255, 0.12) 50%, transparent 80%);
  transform: translateX(-100%); animation: barrido 1.1s linear infinite;
}

/* ---------- Persianas de toda la casa: su propio mando ---------- */
.persianas-casa { position: relative; display: grid; gap: 10px; padding: 14px 12px 12px; border-radius: var(--r); background: radial-gradient(120% 120% at 100% 0%, rgba(111, 223, 255, calc(0.06 * var(--glow))), transparent 60%), var(--vidrio), var(--sup); border: 1px solid var(--borde); box-shadow: var(--brillo-sup), var(--sombra); }
.persianas-casa::before { --c: rgba(111, 223, 255, 0.28); }
.pc-cab { display: flex; align-items: center; gap: 10px; padding: 0 4px; min-height: 28px; }
.pc-cab b { flex: 1; min-width: 0; font-size: 15.5px; font-weight: 600; }
.pc-ic { display: grid; place-items: center; color: var(--cian); }
.pc-ic .ic { width: 20px; height: 20px; }
.pc-botones { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 8px; }
.pc-btn {
  position: relative; overflow: hidden; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px; min-height: 64px; padding: 8px 6px; border-radius: 11px;
  font-weight: 600; font-size: 14.5px; color: var(--texto); background: rgba(255, 255, 255, 0.04); border: 1px solid var(--borde-2);
  -webkit-user-select: none; user-select: none; -webkit-touch-callout: none; transition: transform 0.15s var(--ease), background 0.2s, border-color 0.2s;
}
.pc-btn:active { transform: scale(0.96); background: rgba(255, 255, 255, 0.08); }
.pc-btn > .ic { position: relative; width: 20px; height: 20px; color: var(--cian); }
.pc-btn > span:last-child { position: relative; display: flex; align-items: baseline; gap: 6px; line-height: 1.15; }
.pc-btn small { font-family: var(--f-mono); font-size: 11px; letter-spacing: 0.14em; text-transform: uppercase; color: #f0b9b2; font-weight: 400; }
.pc-btn .giro { inset: 10px auto auto 50%; width: 30px; height: 30px; margin: 0 0 0 -15px; }
.pc-btn.ejecutando > span:last-child { opacity: 0.4; }
.pc-parar > .ic { color: var(--rojo-claro); }
.pc-btn.mantener { border-color: rgba(214, 38, 47, 0.35); }
.pc-btn.mantener .relleno { background: linear-gradient(90deg, rgba(214, 38, 47, 0.42), rgba(214, 38, 47, 0.2)); }

/* ---------- Escenas ---------- */
.escenas { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.escena {
  position: relative; overflow: hidden; display: flex; flex-direction: column; align-items: flex-start; gap: 10px; min-height: 68px;
  padding: 12px 14px 13px; border-radius: var(--r-s); text-align: left;
  background: var(--vidrio), var(--sup); border: 1px solid var(--borde); box-shadow: var(--brillo-sup), var(--sombra);
  -webkit-user-select: none; user-select: none; -webkit-touch-callout: none;
  transition: transform 0.15s var(--ease), border-color 0.2s;
}
.escena:active { transform: scale(0.975); }
.escena-ic { position: relative; display: grid; place-items: center; width: 40px; height: 40px; border-radius: 10px; background: rgba(255, 255, 255, 0.05); color: var(--titanio); border: 1px solid var(--borde); flex: none; }
.escena-ic .ic { width: 20px; height: 20px; }
.escena-txt { position: relative; display: grid; gap: 1px; min-width: 0; }
.escena-txt b { font-size: 14.5px; font-weight: 600; line-height: 1.2; }
.escena-txt small { font-size: 12.5px; color: var(--texto-2); line-height: 1.3; }
.escena-txt small em { font-style: normal; font-family: var(--f-mono); font-size: 11.5px; letter-spacing: 0.12em; text-transform: uppercase; color: #f0b9b2; }
.escena.dorada { border-color: var(--oro-linea); background: radial-gradient(120% 120% at 100% 0%, rgba(232, 176, 74, calc(0.16 * var(--glow))), transparent 55%), var(--vidrio), var(--sup); }
.escena.dorada .escena-ic { color: #1d1406; background: linear-gradient(135deg, var(--oro-claro), var(--oro)); border-color: transparent; box-shadow: 0 0 20px rgba(232, 176, 74, calc(0.4 * var(--glow))); }
.escena.mantener { border-color: rgba(214, 38, 47, 0.28); }
.escena.mantener .escena-ic { color: var(--rojo-claro); }
.escena.mantener .relleno { background: linear-gradient(90deg, rgba(214, 38, 47, 0.42), rgba(214, 38, 47, 0.2)); }

/* ---------- Tus luces ---------- */
.chips { display: flex; gap: 8px; overflow-x: auto; margin: 0 -16px; padding: 2px 16px 6px; scroll-snap-type: x proximity; scrollbar-width: none; -webkit-mask-image: linear-gradient(90deg, #000 90%, transparent); mask-image: linear-gradient(90deg, #000 90%, transparent); }
.chips::-webkit-scrollbar { display: none; }
.chip-luz { flex: none; scroll-snap-align: start; border-radius: 12px; transition: opacity 0.25s, border-color 0.3s; border: 1px solid var(--borde); background: var(--vidrio), var(--sup); }
.chip-luz > button { position: relative; display: inline-flex; align-items: center; gap: 11px; min-height: 58px; padding: 8px 16px 8px 12px; text-align: left; -webkit-user-select: none; user-select: none; -webkit-touch-callout: none; }
.chip-luz > button:active { transform: scale(0.97); }
.chip-luz[data-on="1"] { border-color: var(--oro-linea); background: radial-gradient(140% 140% at 0% 0%, rgba(255, 196, 110, calc(0.18 * var(--glow))), transparent 60%), var(--vidrio), var(--sup); }
.chip-punto { position: relative; display: grid; place-items: center; width: 30px; height: 30px; border-radius: 50%; border: 1px solid var(--borde-2); flex: none; }
.chip-punto i { width: 10px; height: 10px; border-radius: 50%; background: rgba(255, 255, 255, 0.18); transition: background 0.3s, box-shadow 0.3s; }
.chip-luz[data-on="1"] .chip-punto { border-color: rgba(255, 207, 128, 0.5); }
.chip-luz[data-on="1"] .chip-punto i { background: var(--lampara); box-shadow: 0 0 10px var(--lampara), 0 0 20px rgba(255, 207, 128, calc(0.5 * var(--glow))); }
.chip-punto .giro { inset: -3px; }
.chip-txt { display: grid; line-height: 1.25; }
.chip-txt b { font-size: 14.5px; font-weight: 600; white-space: nowrap; }
.chip-txt small { font-size: 12.5px; color: var(--texto-2); white-space: nowrap; }

/* ---------- Plantas y estancias ---------- */
.segmentos { display: grid; grid-template-columns: repeat(4, 1fr); gap: 4px; padding: 4px; border-radius: 12px; background: rgba(255, 255, 255, 0.025); border: 1px solid var(--borde); }
.segmentos-2 { grid-template-columns: repeat(2, 1fr); }
.segmentos-3 { grid-template-columns: repeat(3, 1fr); }
.segmento { position: relative; display: grid; justify-items: center; align-content: center; gap: 1px; min-height: 52px; padding: 6px 4px; border-radius: 9px; color: var(--texto-2); transition: background 0.25s, color 0.25s; overflow: hidden; }
.segmento b { font-family: var(--f-marca); font-weight: 600; font-size: 12.5px; letter-spacing: 0.1em; }
.segmento span { font-size: 12px; max-width: 100%; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; color: var(--texto-3); }
.segmentos-2 .segmento b, .segmentos-3 .segmento b, .segmentos-clima .segmento b { font-family: var(--f-texto); font-weight: 600; font-size: 14.5px; letter-spacing: 0.01em; }
.segmento.activo { color: var(--texto); background: linear-gradient(180deg, rgba(255, 255, 255, 0.09), rgba(255, 255, 255, 0.03)); box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.09), 0 4px 14px -6px rgba(0, 0, 0, 0.8); }
.segmento.activo span { color: var(--texto-2); }
.segmento.activo::after { content: ''; position: absolute; bottom: 4px; left: 50%; width: 18px; height: 2px; transform: translateX(-50%); background: var(--oro); box-shadow: 0 0 8px rgba(232, 176, 74, calc(0.8 * var(--glow))); }
.segmento .giro { inset: 50% auto auto 50%; width: 34px; height: 34px; margin: -17px 0 0 -17px; }
.segmento.ejecutando b { opacity: 0.4; }
.seg-luz { position: absolute; top: 7px; right: 9px; width: 6px; height: 6px; border-radius: 50%; background: var(--lampara); box-shadow: 0 0 8px var(--lampara); }

.estancias { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.estancias.cambio { animation: entrar 0.35s var(--ease); }
.estancia {
  position: relative; border-radius: var(--r);
  background: var(--vidrio), var(--sup); border: 1px solid var(--borde); box-shadow: var(--brillo-sup), var(--sombra);
  transition: border-color 0.4s, background 0.4s, transform 0.15s var(--ease);
  overflow: hidden;
}
.estancia:active { transform: scale(0.98); }
.estancia::before {
  content: ''; position: absolute; inset: 0; pointer-events: none; opacity: 0; transition: opacity 0.5s;
  background: radial-gradient(130% 100% at 0% 0%, rgba(255, 196, 110, calc(0.26 * var(--glow) * var(--brillo, 0.5))), transparent 62%);
}
.estancia.con-luz { border-color: var(--oro-linea); }
.estancia.con-luz::before { opacity: 1; }
.estancia.con-alarma { border-color: rgba(255, 59, 59, 0.8); box-shadow: 0 0 30px -8px rgba(255, 59, 59, 0.8); }
.estancia-enlace { position: relative; display: grid; gap: 4px; min-height: 128px; padding: 15px 14px 13px; align-content: start; }
.estancia-ic { display: grid; place-items: center; width: 40px; height: 40px; margin-bottom: 12px; border-radius: 10px; color: var(--titanio); background: rgba(255, 255, 255, 0.04); border: 1px solid var(--borde); transition: color 0.4s, box-shadow 0.4s, background 0.4s; }
.estancia.con-luz .estancia-ic { color: var(--lampara); background: rgba(255, 200, 120, 0.1); border-color: rgba(255, 200, 120, 0.25); box-shadow: 0 0 22px rgba(255, 196, 110, calc(0.28 * var(--glow))); }
.estancia-nombre { font-size: 16px; font-weight: 600; letter-spacing: 0.005em; line-height: 1.2; }
.estancia-datos { font-size: 13px; color: var(--texto-3); }
.estancia-datos .on { color: var(--oro-claro); font-weight: 600; }
.estancia-extra { display: flex; flex-wrap: wrap; gap: 4px 12px; margin-top: 4px; font-size: 13px; color: var(--texto-2); font-variant-numeric: tabular-nums; }
.estancia-extra > span { display: inline-flex; align-items: center; gap: 4px; }
.estancia-extra .ic { width: 14px; height: 14px; color: var(--texto-3); }
.estancia-extra .on-alarma { color: #ffb1ab; }
.estancia-extra .on-alarma .ic { color: var(--alerta); }
.mini-persiana { display: inline-flex; align-items: center; gap: 5px; }
.mini-persiana i { position: relative; width: 10px; height: 13px; border-radius: 2px; border: 1px solid var(--titanio-2); overflow: hidden; background: linear-gradient(180deg, rgba(166, 200, 230, 0.35), rgba(255, 210, 150, 0.2)); }
.mini-persiana i::after { content: ''; position: absolute; left: 0; right: 0; top: 0; height: calc(var(--p) * 1%); background: repeating-linear-gradient(180deg, var(--titanio) 0 2px, var(--titanio-2) 2px 3px); }
.estancia-apagar {
  position: absolute; top: 10px; right: 10px; display: grid; place-items: center; width: 44px; height: 44px; border-radius: 50%;
  color: var(--oro-claro); background: rgba(0, 0, 0, 0.25); border: 1px solid var(--oro-linea);
  transition: transform 0.15s var(--ease), background 0.2s;
}
.estancia-apagar .ic { width: 19px; height: 19px; position: relative; }
.estancia-apagar .giro { inset: -4px; }
.estancia-apagar:active { transform: scale(0.9); background: rgba(232, 176, 74, 0.2); }

/* ---------- Clima de la casa (inicio) ---------- */
.clima-casa { position: relative; display: grid; gap: 12px; padding: 16px 14px 14px; border-radius: var(--r); background: var(--vidrio), var(--sup); border: 1px solid var(--borde); }
.clima-casa.cargando { display: flex; align-items: center; gap: 12px; color: var(--texto-2); font-size: 14px; }
.clima-casa.cargando::before { display: none; }
.clima-casa .giro.en-linea, .holograma .giro.en-linea, .protocolos .giro.en-linea { display: inline-block; }
.clima-actual { position: relative; display: flex; align-items: flex-start; gap: 12px; }
.clima-actual > span:last-child { display: grid; gap: 1px; }
.clima-actual b { font-size: 17px; font-weight: 600; color: var(--oro-claro); }
.clima-actual b em { font-style: normal; font-family: var(--f-mono); font-size: 12px; letter-spacing: 0.18em; text-transform: uppercase; color: var(--texto-3); margin-right: 4px; }
.clima-actual small { font-size: 13px; color: var(--texto-2); line-height: 1.4; }
.clima-led { width: 9px; height: 9px; margin-top: 7px; transform: rotate(45deg); background: var(--oro); box-shadow: 0 0 12px rgba(232, 176, 74, 0.7); flex: none; }
.clima-led.mixto { background: var(--titanio-2); box-shadow: none; }
.segmentos-clima { position: relative; grid-template-columns: repeat(4, 1fr); }

/* ---------- Jarvis vigila / jardín ---------- */
.vigia, .detectados {
  display: flex; align-items: center; gap: 14px; padding: 16px; border-radius: var(--r);
  background: linear-gradient(135deg, rgba(111, 223, 255, 0.05), rgba(255, 255, 255, 0.01)), var(--sup);
  border: 1px solid rgba(111, 223, 255, 0.18);
}
.detectados { background: linear-gradient(135deg, rgba(232, 176, 74, 0.07), rgba(255, 255, 255, 0.012)), var(--sup); border: 1px dashed var(--oro-linea); }
.vigia-ic, .detectados-ic { display: grid; place-items: center; width: 44px; height: 44px; border-radius: 50%; color: var(--cian); border: 1px solid rgba(111, 223, 255, 0.3); flex: none; }
.detectados-ic { color: var(--oro); border-color: var(--oro-linea); }
.vigia-txt, .detectados-txt { flex: 1; min-width: 0; display: grid; gap: 3px; }
.vigia-txt b, .detectados-txt b { font-size: 15.5px; font-weight: 600; }
.vigia-txt small, .detectados-txt small { font-size: 13px; color: var(--texto-2); line-height: 1.45; }
.vigia-ultimo { display: block; margin-top: 4px; padding-left: 10px; border-left: 2px solid var(--titanio-2); font-size: 13px; color: var(--texto-2); line-height: 1.4; }
.vigia-ultimo time { font-family: var(--f-mono); font-size: 12.5px; color: var(--texto-3); }
.vigia-ultimo.nivel-aviso { border-color: var(--aviso); }
.vigia-ultimo.nivel-urgente { border-color: var(--alerta); }
.detectados-flecha { color: var(--texto-3); flex: none; }

/* =====================================================================
   Estancia
   ===================================================================== */
.cab-estancia { position: relative; display: flex; align-items: flex-start; gap: 8px; padding: 14px 14px 16px 6px; border-radius: var(--r); background: linear-gradient(180deg, rgba(255, 255, 255, 0.03), transparent); border: 1px solid var(--borde); overflow: hidden; }
.cab-estancia .atras { margin-top: 2px; color: var(--texto); position: relative; z-index: 2; }
.cab-titulo { position: relative; z-index: 2; flex: 1; min-width: 0; display: grid; gap: 4px; }
.cab-titulo h1 { font-weight: 600; font-size: 30px; line-height: 1.12; letter-spacing: 0.005em; }
.cab-titulo h1 > span { overflow-wrap: anywhere; }
.cab-titulo h1 .btn-icono { vertical-align: middle; margin-left: -2px; margin-top: -6px; color: var(--texto-3); }
.antes { font-size: 13px; color: var(--texto-3); }
.resumen-estancia { display: flex; flex-wrap: wrap; gap: 6px 14px; margin-top: 2px; font-size: 13.5px; color: var(--texto-2); }
.resumen-estancia > span { display: inline-flex; align-items: center; gap: 6px; }
.resumen-estancia .ic { width: 16px; height: 16px; color: var(--texto-3); }
.resumen-estancia .on { color: var(--oro-claro); font-weight: 600; }
.resumen-estancia .on .ic { color: var(--lampara); }
.cab-temp { position: relative; z-index: 2; display: grid; justify-items: end; padding-top: 6px; }
.cab-temp b { font-weight: 600; font-size: 32px; line-height: 1; font-variant-numeric: tabular-nums; }
.cab-temp small { font-family: var(--f-mono); font-size: 12px; letter-spacing: 0.16em; text-transform: uppercase; color: var(--texto-3); margin-top: 4px; }
.cab-fondo { position: absolute; right: -14px; bottom: -30px; z-index: 0; color: rgba(255, 255, 255, 0.028); pointer-events: none; }
.cab-fondo .ic { width: 150px; height: 150px; stroke-width: 0.6; }

/* Mando de grupo: fijo abajo, al alcance del pulgar */
.mando {
  position: fixed; left: 10px; right: 10px; bottom: calc(var(--nav-alto) + 10px + var(--seg-bot)); z-index: 35;
  display: flex; align-items: stretch; justify-content: center; gap: 6px; padding: 8px 8px 7px; border-radius: 16px;
  background: linear-gradient(180deg, rgba(28, 31, 37, 0.93), rgba(14, 16, 19, 0.97)); border: 1px solid var(--borde-2);
  box-shadow: var(--brillo-sup), 0 18px 40px -12px rgba(0, 0, 0, 0.95), 0 0 0 1px rgba(0, 0, 0, 0.4);
  -webkit-backdrop-filter: blur(22px) saturate(150%); backdrop-filter: blur(22px) saturate(150%);
  animation: subir-mando 0.4s var(--ease);
}
.mando::after { content: ''; position: absolute; top: -1px; left: 50%; width: 46px; height: 2px; transform: translateX(-50%); background: var(--oro); opacity: 0.7; }
html[data-noche="1"] .mando { background: linear-gradient(180deg, rgba(36, 27, 20, 0.94), rgba(20, 15, 11, 0.97)); }
@keyframes subir-mando { from { transform: translateY(16px); opacity: 0; } }
.mando-grupo { display: grid; gap: 4px; justify-items: center; }
.mando-etq { font-family: var(--f-mono); font-size: 11.5px; letter-spacing: 0.18em; text-transform: uppercase; color: var(--texto-3); }
.mando-fila { display: flex; gap: 4px; }
.mando-sep { width: 1px; margin: 4px 4px; background: var(--borde-2); }
.mando-btn { position: relative; display: grid; justify-items: center; gap: 3px; min-width: 60px; min-height: 58px; padding: 6px 4px 5px; border-radius: 11px; color: var(--texto); transition: background 0.2s, transform 0.12s; }
.mando-btn:active { transform: scale(0.94); background: rgba(255, 255, 255, 0.08); }
.mando-ic { position: relative; display: grid; place-items: center; width: 32px; height: 32px; border-radius: 50%; background: rgba(255, 255, 255, 0.05); border: 1px solid var(--borde); }
.mando-ic .ic { width: 18px; height: 18px; }
.mando-txt { font-size: 13px; font-weight: 600; color: var(--texto-2); }
.mando-btn .giro { inset: 1px auto auto 50%; width: 42px; height: 42px; margin-left: -21px; }
.mando-btn[data-orden="luces-encender"] .mando-ic { color: var(--lampara); }
.mando-btn[data-orden^="persianas"] .mando-ic { color: var(--cian); }
.mando-btn.parar .mando-ic { color: var(--rojo-claro); }
.mando-btn.tenue .mando-ic { opacity: 0.5; }
.mando-btn.tenue .mando-txt { color: var(--texto-3); }
.mando-btn.ejecutando .mando-txt { color: var(--oro-claro); }

/* Luces */
.luces { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.luz {
  position: relative; overflow: hidden; display: grid; grid-template-columns: minmax(0, 1fr); border-radius: var(--r);
  background: var(--vidrio), var(--sup); border: 1px solid var(--borde); box-shadow: var(--brillo-sup), var(--sombra);
  transition: border-color 0.35s, background 0.35s, box-shadow 0.35s;
}
.luz-boton {
  position: relative; display: grid; gap: 12px; align-content: start; justify-items: start; min-height: 124px; padding: 14px; text-align: left;
  -webkit-user-select: none; user-select: none; -webkit-touch-callout: none; transition: transform 0.15s var(--ease);
}
.luz-boton:active { transform: scale(0.97); }
.luz-halo { position: absolute; inset: -30% -10% auto -30%; height: 140%; pointer-events: none; opacity: 0; transition: opacity 0.45s; background: radial-gradient(closest-side, rgba(255, 205, 130, calc(0.3 * var(--glow))), transparent); }
.luz-ic { position: relative; display: grid; place-items: center; width: 44px; height: 44px; border-radius: 50%; color: var(--titanio-2); background: rgba(255, 255, 255, 0.04); border: 1px solid var(--borde); transition: color 0.35s, background 0.35s, box-shadow 0.35s, border-color 0.35s; flex: none; }
.luz-ic .giro { inset: -6px; }
.luz-txt { position: relative; display: grid; gap: 2px; min-width: 0; }
.luz-nombre { position: relative; font-size: 15.5px; font-weight: 600; line-height: 1.25; }
.luz-estado { position: relative; font-size: 13px; color: var(--texto-3); transition: color 0.3s; }
.luz[data-on="1"] { border-color: rgba(232, 176, 74, 0.45); background: linear-gradient(180deg, rgba(255, 210, 140, 0.075), rgba(255, 210, 140, 0.015)), var(--sup); }
.luz[data-on="1"] .luz-halo { opacity: var(--intensidad, 1); }
.luz[data-on="1"] .luz-ic { color: #2a1c06; background: radial-gradient(circle at 50% 35%, #fff2d4, var(--lampara) 60%, #e6a85a); border-color: transparent; box-shadow: 0 0 24px rgba(255, 200, 120, calc(0.55 * var(--glow) * var(--intensidad, 1))), 0 0 60px rgba(255, 190, 100, calc(0.25 * var(--glow) * var(--intensidad, 1))); }
.luz[data-on="1"] .luz-estado { color: var(--oro-claro); }
.luz[data-on="?"] .luz-estado { color: var(--texto-3); font-style: italic; }

/* Luz regulable: a lo ancho, con su barrita táctil */
.luz.regulable { grid-column: 1 / -1; }
.luz.regulable .luz-boton { display: flex; align-items: center; gap: 14px; min-height: 72px; padding: 14px 14px 10px; width: 100%; }
.barrita {
  --nivel: 0; --obj: 0;
  position: relative; height: 54px; margin: 0 12px 12px; border-radius: 12px; overflow: hidden;
  cursor: ew-resize; touch-action: pan-y; -webkit-user-select: none; user-select: none; -webkit-touch-callout: none; outline-offset: 2px;
}
.b-pista { position: absolute; inset: 0; border-radius: 12px; overflow: hidden; background: rgba(0, 0, 0, 0.28); border: 1px solid var(--borde-2); box-shadow: inset 0 2px 8px rgba(0, 0, 0, 0.45); }
.b-relleno {
  position: absolute; inset: 0; will-change: transform;
  transform: translateX(calc((var(--nivel) - 1) * 100%));
  background: linear-gradient(90deg, rgba(232, 176, 74, 0.1), rgba(232, 176, 74, 0.34) 60%, rgba(255, 214, 150, 0.62));
  box-shadow: inset -2px 0 0 #fff1d2, 10px 0 26px -4px rgba(255, 207, 128, calc(0.65 * var(--glow)));
}
.b-marcas { position: absolute; inset: 0; background: repeating-linear-gradient(90deg, transparent 0 calc(10% - 1px), rgba(255, 255, 255, 0.1) calc(10% - 1px) 10%); -webkit-mask-image: linear-gradient(180deg, transparent 22%, #000 22% 34%, transparent 34% 66%, #000 66% 78%, transparent 78%); mask-image: linear-gradient(180deg, transparent 22%, #000 22% 34%, transparent 34% 66%, #000 66% 78%, transparent 78%); }
.b-flechas {
  position: absolute; inset: 0; opacity: 0; transition: opacity 0.2s;
  background: repeating-linear-gradient(105deg, transparent 0 9px, rgba(140, 230, 255, 0.5) 9px 11px, transparent 11px 16px);
  background-size: 16px 100%;
  clip-path: inset(0 calc((1 - max(var(--nivel), var(--obj))) * 100%) 0 calc(min(var(--nivel), var(--obj)) * 100%));
}
.barrita[data-dir] .b-flechas { opacity: 1; }
.barrita[data-dir="sube"] .b-flechas { animation: flechas 0.45s linear infinite; }
.barrita[data-dir="baja"] .b-flechas { animation: flechas 0.45s linear infinite reverse; background-image: repeating-linear-gradient(75deg, transparent 0 9px, rgba(140, 230, 255, 0.5) 9px 11px, transparent 11px 16px); }
@keyframes flechas { from { background-position: 0 0; } to { background-position: 16px 0; } }
.b-objetivo { position: absolute; inset: 0; pointer-events: none; transform: translateX(calc(var(--obj) * 100%)); opacity: 0; transition: opacity 0.2s; }
.b-objetivo::before { content: ''; position: absolute; left: -1px; top: 7px; bottom: 7px; border-left: 2px dashed var(--cian-claro); filter: drop-shadow(0 0 4px rgba(111, 223, 255, 0.8)); }
.barrita.regulando .b-objetivo { opacity: 1; }
.barrita[data-cero] .b-relleno { box-shadow: none; }
.b-etq { position: absolute; left: 14px; top: 0; bottom: 0; display: flex; align-items: center; gap: 8px; pointer-events: none; font-family: var(--f-mono); font-size: 12.5px; letter-spacing: 0.16em; text-transform: uppercase; color: var(--texto); text-shadow: 0 1px 3px rgba(0, 0, 0, 0.7); }
.b-etq .ic { width: 17px; height: 17px; color: var(--oro-claro); }
.barrita.regulando .b-etq { color: #fff; }
.b-valor { position: absolute; right: 14px; top: 0; bottom: 0; display: flex; align-items: center; pointer-events: none; font-weight: 700; font-size: 16px; letter-spacing: 0.02em; color: var(--texto); text-shadow: 0 1px 3px rgba(0, 0, 0, 0.7); font-variant-numeric: tabular-nums; }
.luz[data-on="0"] .b-valor, .luz[data-on="?"] .b-valor { color: var(--texto-3); font-family: var(--f-mono); font-weight: 400; letter-spacing: 0.14em; text-transform: uppercase; font-size: 12.5px; }
.barrita.regulando .b-pista { border-color: rgba(246, 212, 139, 0.55); box-shadow: inset 0 2px 8px rgba(0, 0, 0, 0.45), 0 0 0 3px rgba(232, 176, 74, 0.14); }
.barrita:focus-visible { outline: 2px solid var(--oro); }

/* Persianas: ventana con cielo, lona y lamas */
.ventana {
  position: relative; border-radius: 10px; overflow: hidden; cursor: ns-resize; touch-action: none;
  background: #0d1218; border: 1px solid var(--borde-2); box-shadow: inset 0 0 0 3px rgba(0, 0, 0, 0.35), 0 10px 22px -14px rgba(0, 0, 0, 0.9);
}
.cielo { position: absolute; inset: 0; background: linear-gradient(180deg, #2f4459 0%, #67809a 52%, #c7a77a 86%, #8a6a45 100%); }
.cielo::after { content: ''; position: absolute; left: 0; right: 0; bottom: 0; height: 26%; background: linear-gradient(180deg, transparent, rgba(30, 40, 30, 0.75)); clip-path: polygon(0 60%, 18% 40%, 36% 55%, 55% 30%, 74% 50%, 100% 35%, 100% 100%, 0 100%); }
html[data-noche="1"] .cielo { background: radial-gradient(circle at 72% 22%, rgba(255, 236, 200, 0.9) 0 4px, rgba(255, 236, 200, 0.15) 5px, transparent 14px), linear-gradient(180deg, #0b1220 0%, #182235 60%, #2a2a33 100%); }
.lona { position: absolute; inset: 0; transform: translateY(calc((var(--p) - 100) * 1%)); transition: transform 0.42s linear; will-change: transform; }
.lona-lamas {
  position: absolute; inset: 0;
  background:
    repeating-linear-gradient(180deg, transparent 0 6px, rgba(0, 0, 0, calc(0.15 + (100 - var(--l)) * 0.004)) 6px 8px),
    linear-gradient(90deg, #474c53, #767c84 30%, #90959c 50%, #737980 72%, #44494f);
}
html[data-noche="1"] .lona-lamas { filter: brightness(0.75) sepia(0.2); }
.lona-borde { position: absolute; left: 0; right: 0; bottom: 0; height: 5px; background: linear-gradient(180deg, var(--oro-claro), var(--oro-2)); box-shadow: 0 4px 10px rgba(0, 0, 0, 0.55); }
.marco { position: absolute; inset: 0; pointer-events: none; border-radius: 10px; background: linear-gradient(125deg, rgba(255, 255, 255, 0.14) 0%, rgba(255, 255, 255, 0) 32%); box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.08); }
.guia { position: absolute; left: 0; right: 0; top: calc(var(--obj, 0) * 1%); height: 0; opacity: 0; transition: opacity 0.2s; pointer-events: none; z-index: 2; }
.guia i { position: absolute; left: 6px; right: 6px; top: -1px; border-top: 2px dashed var(--cian-claro); filter: drop-shadow(0 0 4px rgba(0, 0, 0, 0.8)); }
.guia b { position: absolute; left: 50%; top: 0; transform: translate(-50%, -130%); padding: 2px 8px; border-radius: 6px; font-family: var(--f-mono); font-size: 12.5px; font-weight: 400; letter-spacing: 0.06em; color: #04121a; background: var(--cian-claro); white-space: nowrap; }
[data-arrastrando] .guia, [data-objetivo] .guia { opacity: 1; }
[data-objetivo]:not([data-arrastrando]) .guia b { display: none; }

.lamas { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 6px; margin-top: 2px; max-width: 210px; }
.lamas-etq { grid-column: 1 / -1; font-family: var(--f-mono); font-size: 12px; letter-spacing: 0.18em; text-transform: uppercase; color: var(--texto-3); }
.lama { display: grid; justify-items: center; gap: 3px; min-height: 50px; padding: 6px 0 4px; border-radius: 10px; border: 1px solid var(--borde); background: rgba(255, 255, 255, 0.03); color: var(--texto-2); transition: border-color 0.2s, background 0.2s, color 0.2s; }
.lama small { font-size: 12px; font-weight: 600; }
.lama-dib { display: grid; align-content: center; gap: calc(4px - var(--k) * 3px); width: 20px; height: 18px; padding: 1px; border-radius: 3px; box-shadow: inset 0 0 0 1px currentColor; }
.lama-dib i { display: block; height: calc(1.5px + var(--k) * 2.6px); border-radius: 1px; background: currentColor; opacity: 0.9; }
.lama.activa { color: var(--oro-claro); border-color: rgba(232, 176, 74, 0.5); background: var(--oro-suave); }

/* Persianas de la estancia: ventanitas que se tocan */
.tarjetas-p { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.tarjetas-p.una { grid-template-columns: 1fr; }
.tarjeta-p {
  position: relative; display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: end; gap: 10px 6px; padding: 10px 10px 12px 12px; border-radius: var(--r); text-align: left;
  background: var(--vidrio), var(--sup); border: 1px solid var(--borde); box-shadow: var(--brillo-sup), var(--sombra);
  -webkit-user-select: none; user-select: none; -webkit-touch-callout: none; transition: transform 0.15s var(--ease), border-color 0.3s;
}
.tarjeta-p:active { transform: scale(0.97); }
.tp-ventana { grid-column: 1 / -1; position: relative; height: 92px; border-radius: 9px; overflow: hidden; background: #0d1218; box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.1); }
.tarjetas-p.una .tp-ventana { height: 120px; }
.tp-ventana .giro { inset: 50% auto auto 50%; width: 38px; height: 38px; margin: -19px 0 0 -19px; }
.tp-ventana .marco { border-radius: 9px; }
.tp-txt { display: grid; min-width: 0; line-height: 1.3; }
.tp-txt b { font-size: 15px; font-weight: 600; line-height: 1.2; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; overflow-wrap: anywhere; }
.tp-txt small { font-size: 13px; color: var(--texto-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tp-flecha { width: 18px; height: 18px; color: var(--texto-3); margin-bottom: 2px; }
.tarjeta-p[data-mov] { border-color: rgba(111, 223, 255, 0.4); }
.tarjeta-p[data-mov] .p-estado, .tarjeta-p[data-fase="enviada"] .p-estado { color: var(--cian); }
.tarjeta-p[data-mov] .tp-ventana::after { content: ''; position: absolute; left: 0; right: 0; height: 2px; top: calc(var(--p) * 1%); background: var(--cian); box-shadow: 0 0 10px var(--cian); transition: top 0.42s linear; }

/* La persiana en foco: a pantalla completa (en escritorio, una ventana flotante) */
.foco { position: fixed; inset: 0; z-index: 88; }
.foco-fondo { position: absolute; inset: 0; background: rgba(3, 4, 5, 0.6); -webkit-backdrop-filter: blur(8px); backdrop-filter: blur(8px); opacity: 0; transition: opacity 0.3s; }
.foco.abierto .foco-fondo { opacity: 1; }
.foco-panel {
  --obj: 0;
  position: absolute; inset: 0; overflow-y: auto; outline: none; overscroll-behavior: contain;
  padding: calc(10px + var(--seg-top)) 18px calc(18px + var(--seg-bot));
  background:
    radial-gradient(420px 360px at 50% 32%, rgba(111, 223, 255, calc(0.09 * var(--glow))), transparent 70%),
    radial-gradient(500px 400px at 50% 112%, rgba(232, 176, 74, calc(0.08 * var(--glow))), transparent 70%),
    var(--fondo);
}
.foco-panel::before { content: ''; position: absolute; inset: 0; pointer-events: none; background-image: linear-gradient(rgba(111, 223, 255, 0.03) 1px, transparent 1px), linear-gradient(90deg, rgba(111, 223, 255, 0.03) 1px, transparent 1px); background-size: 32px 32px; -webkit-mask-image: radial-gradient(70% 45% at 50% 34%, #000, transparent 75%); mask-image: radial-gradient(70% 45% at 50% 34%, #000, transparent 75%); }
.foco-contenido { position: relative; display: grid; gap: 16px; max-width: 460px; margin: 0 auto; opacity: 0; transform: translateY(8px); transition: opacity 0.25s, transform 0.35s var(--ease); }
.foco.abierto .foco-contenido { opacity: 1; transform: none; transition-delay: 0.16s; }
.foco-cab { display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; }
.foco-titulo { display: grid; gap: 4px; min-width: 0; padding-top: 4px; }
.foco-titulo h2 { font-size: 26px; font-weight: 600; line-height: 1.15; }
.foco-cerrar { width: 48px; height: 48px; border: 1px solid var(--borde-2); background: rgba(255, 255, 255, 0.03); color: var(--texto); }
.foco-escena { position: relative; display: grid; grid-template-columns: minmax(0, 1fr) 64px; gap: 14px; align-items: stretch; height: min(340px, 40vh); min-height: 230px; }
.foco-ventana { height: 100%; border-radius: 14px; border: 1px solid rgba(111, 223, 255, 0.25); box-shadow: inset 0 0 0 4px rgba(0, 0, 0, 0.35), 0 0 0 1px rgba(0, 0, 0, 0.5), 0 30px 60px -30px rgba(0, 0, 0, 0.9), 0 0 50px -20px rgba(111, 223, 255, calc(0.4 * var(--glow))); }
.foco-ventana .marco { border-radius: 14px; }
.foco-ventana .lona-lamas { background: repeating-linear-gradient(180deg, transparent 0 9px, rgba(0, 0, 0, calc(0.18 + (100 - var(--l)) * 0.005)) 9px 12px), linear-gradient(90deg, #42474e, #737980 28%, #8f949b 50%, #70767d 72%, #3f444a); }
.foco-ventana .lona-borde { height: 7px; }
.foco-ventana .guia b { font-size: 14px; padding: 3px 10px; }
.foco-barrido { position: absolute; left: 0; right: 0; top: 0; height: 30%; pointer-events: none; background: linear-gradient(180deg, transparent, rgba(111, 223, 255, 0.12), transparent); animation: barrer 4.5s ease-in-out infinite; }
@keyframes barrer { 0% { transform: translateY(-100%); } 60%, 100% { transform: translateY(340%); } }
.foco-escena::before { inset: -10px -8px; --c: rgba(111, 223, 255, 0.4); --l: 14px; }
.foco-regla { position: relative; cursor: ns-resize; touch-action: none; }
.fr-pista { position: absolute; left: 18px; width: 16px; top: 0; bottom: 0; border-radius: 8px; overflow: hidden; background: rgba(255, 255, 255, 0.05); border: 1px solid var(--borde-2); }
.fr-relleno { position: absolute; left: 0; right: 0; top: 0; height: 100%; transform-origin: top; transform: scaleY(calc(var(--p) / 100)); background: repeating-linear-gradient(180deg, #8f949b 0 3px, #5d636a 3px 5px); transition: transform 0.42s linear; }
.fr-pulgar { position: absolute; left: 6px; width: 40px; height: 4px; top: calc(var(--p) * 1% - 2px); border-radius: 2px; background: var(--oro-claro); box-shadow: 0 0 12px rgba(246, 212, 139, 0.8); transition: top 0.42s linear; }
.persiana[data-arrastrando] .fr-pulgar, .persiana[data-objetivo] .fr-pulgar { top: calc(var(--obj) * 1% - 2px); background: var(--cian-claro); box-shadow: 0 0 12px rgba(111, 223, 255, 0.9); transition: none; }
.fr-marcas i { position: absolute; left: 38px; right: 0; top: calc(var(--m) * 1%); height: 0; border-top: 1px solid var(--borde-2); }
.fr-marcas b { position: absolute; left: 6px; top: -7px; font-family: var(--f-mono); font-weight: 400; font-size: 11px; color: var(--texto-3); }
.foco-lectura { display: flex; align-items: baseline; justify-content: center; gap: 12px; min-height: 44px; }
.foco-lectura .p-pos { font-size: 38px; font-weight: 600; line-height: 1; font-variant-numeric: tabular-nums; }
.foco-lectura .p-estado { font-size: 14px; color: var(--texto-2); }
.foco-panel[data-mov] .p-estado, .foco-panel[data-fase="enviada"] .p-estado { color: var(--cian); }
.foco-botones { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.foco-btn { position: relative; display: grid; justify-items: center; gap: 4px; min-height: 70px; padding: 10px 6px 8px; border-radius: 14px; font-weight: 600; font-size: 15px; color: var(--texto); background: var(--vidrio), var(--sup-alta); border: 1px solid var(--borde-2); box-shadow: var(--brillo-sup); transition: transform 0.15s var(--ease), border-color 0.2s, box-shadow 0.2s; }
.foco-btn .ic { width: 24px; height: 24px; color: var(--cian); }
.foco-btn.parar .ic { color: var(--rojo-claro); }
.foco-btn:active { transform: scale(0.95); }
.persiana[data-enviado="subir"] [data-orden="subir"], .persiana[data-enviado="bajar"] [data-orden="bajar"], .persiana[data-enviado="parar"] [data-orden="parar"] { border-color: rgba(232, 176, 74, 0.7); box-shadow: 0 0 18px rgba(232, 176, 74, 0.35); }
.foco-presets { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
.foco-preset { display: grid; justify-items: center; gap: 6px; min-height: 64px; padding: 8px 4px; border-radius: 12px; font-size: 13px; font-weight: 600; color: var(--texto-2); border: 1px solid var(--borde); background: rgba(255, 255, 255, 0.03); }
.foco-preset i { position: relative; width: 22px; height: 26px; border-radius: 3px; overflow: hidden; background: linear-gradient(180deg, #2f4459, #67809a 60%, #c7a77a); box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.2); }
.foco-preset i::after { content: ''; position: absolute; left: 0; right: 0; top: 0; height: calc(var(--v) * 1%); background: repeating-linear-gradient(180deg, #8f949b 0 2px, #5d636a 2px 3px); }
.foco-preset:active { background: rgba(255, 255, 255, 0.08); color: var(--texto); }
.foco-lamas { max-width: none; grid-template-columns: repeat(3, minmax(0, 1fr)); }
.foco-lamas .lama { min-height: 56px; }
.foco-pista { display: flex; align-items: center; justify-content: center; gap: 8px; font-size: 13px; color: var(--texto-3); text-align: center; }
.foco-pista .ic { width: 16px; height: 16px; flex: none; }
html.con-foco body { overflow: hidden; }

/* Termostato */
.termos { display: grid; gap: 10px; }
.termo {
  display: grid; grid-template-columns: 132px 1fr; gap: 14px; align-items: center; padding: 14px; border-radius: var(--r);
  background: var(--vidrio), var(--sup); border: 1px solid var(--borde); box-shadow: var(--brillo-sup), var(--sombra);
}
.termo-estancia { grid-column: 1 / -1; display: flex; align-items: center; justify-content: space-between; gap: 10px; min-height: 44px; padding-bottom: 2px; }
.termo-estancia b { font-size: 16px; font-weight: 600; }
.termo-estancia small { font-family: var(--f-mono); font-size: 12px; letter-spacing: 0.14em; text-transform: uppercase; color: var(--texto-3); }
.dial { position: relative; width: 132px; height: 132px; }
.dial svg { width: 100%; height: 100%; overflow: visible; }
.dial svg * { transform-box: view-box; transform-origin: 60px 60px; }
.dial .giro.giro-dial { inset: 22px; }
.dial-pista, .dial-valor { fill: none; stroke-width: 6; stroke-linecap: round; transform: rotate(135deg); }
.dial-pista { stroke: rgba(255, 255, 255, 0.08); stroke-dasharray: 75 100; }
.dial-valor { stroke: var(--oro); stroke-dasharray: 0 100; transition: stroke-dasharray 0.4s var(--ease); filter: drop-shadow(0 0 6px rgba(232, 176, 74, calc(0.45 * var(--glow)))); }
.termo.calentando .dial-valor { stroke: #ff7a4f; filter: drop-shadow(0 0 6px rgba(255, 122, 79, calc(0.6 * var(--glow)))); }
.dial-aguja { transform: rotate(calc(var(--c) * 270deg - 135deg)); transition: transform 0.4s var(--ease); }
.dial-aguja circle { fill: #fff; stroke: var(--sup-solida); stroke-width: 2; }
.dial-actual { transform: rotate(calc(var(--a) * 270deg - 135deg)); transition: transform 0.6s var(--ease); }
.dial-actual path { stroke: var(--cian); stroke-width: 2; stroke-linecap: round; opacity: 0.9; }
.dial-centro { position: absolute; inset: 0; display: grid; place-content: center; justify-items: center; }
.t-actual { font-weight: 600; font-size: 31px; line-height: 1; letter-spacing: 0; font-variant-numeric: tabular-nums; }
.t-actual sup { font-size: 13px; font-weight: 400; vertical-align: top; margin-left: 1px; }
.t-etq { font-family: var(--f-mono); font-size: 11.5px; letter-spacing: 0.18em; text-transform: uppercase; color: var(--texto-3); margin-top: 5px; }
.termo-control { display: grid; gap: 12px; min-width: 0; }
.consigna { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.consigna-valor { display: grid; justify-items: center; }
.consigna-valor b { font-size: 22px; font-weight: 700; font-variant-numeric: tabular-nums; transition: color 0.2s; }
.consigna-valor small { font-family: var(--f-mono); font-size: 11.5px; letter-spacing: 0.16em; text-transform: uppercase; color: var(--texto-3); }
.termo.ajustando .consigna-valor b { color: var(--oro-claro); }
.modos { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; }
.modo { min-height: 44px; padding: 0 6px; border-radius: 9px; font-size: 13.5px; font-weight: 600; color: var(--texto-2); border: 1px solid var(--borde); background: rgba(255, 255, 255, 0.025); transition: all 0.2s; }
.modo.activo { color: var(--texto); border-color: rgba(232, 176, 74, 0.5); background: var(--oro-suave); }
.t-calor { display: flex; align-items: center; gap: 6px; font-size: 13px; color: var(--texto-3); }
.t-calor .ic { width: 16px; height: 16px; }
.termo.calentando .t-calor { color: #ffbfa6; }
.termo.calentando .t-calor .ic { color: #ff7a4f; filter: drop-shadow(0 0 6px rgba(255, 122, 79, 0.7)); }

/* Alarma */
.alarma { display: flex; align-items: center; gap: 12px; padding: 14px; border-radius: var(--r); background: var(--vidrio), var(--sup); border: 1px solid var(--borde); }
.alarma-ic { position: relative; display: grid; place-items: center; width: 46px; height: 46px; border-radius: 50%; color: var(--cian-claro); background: var(--cian-suave); border: 1px solid rgba(111, 223, 255, 0.25); flex: none; }
.alarma-txt { flex: 1; display: grid; gap: 2px; }
.alarma-txt small { color: var(--texto-2); font-size: 13px; }
.alarma .btn { position: relative; }
.alarma.activa { background: repeating-linear-gradient(135deg, rgba(255, 59, 59, 0.16) 0 12px, transparent 12px 24px), linear-gradient(135deg, rgba(200, 24, 32, 0.6), rgba(90, 10, 16, 0.7)); border-color: rgba(255, 120, 110, 0.7); }
.alarma.activa .alarma-ic { color: #fff; background: var(--alerta); border-color: transparent; }
.alarma.activa .alarma-ic::after { content: ''; position: absolute; inset: -6px; border-radius: 50%; border: 2px solid var(--alerta); animation: onda 1.4s ease-out infinite; }
@keyframes onda { from { transform: scale(0.85); opacity: 1; } to { transform: scale(1.5); opacity: 0; } }
.alarma.activa small { color: #ffd6d2; }

.pista-larga { display: flex; align-items: center; gap: 8px; font-size: 13px; color: var(--texto-3); }
.pista-larga .ic { width: 16px; height: 16px; flex: none; }

/* =====================================================================
   Secciones: Clima, Protocolos, Registro, Más, Casa 3D
   ===================================================================== */
.cab-seccion { display: grid; gap: 8px; }
.cab-seccion h1 { font-weight: 600; font-size: 32px; letter-spacing: 0.005em; line-height: 1.1; }
.cab-seccion .sub { color: var(--texto-2); font-size: 14.5px; }

/* Modos de clima de toda la casa */
.modos-casa { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.modo-casa { position: relative; display: grid; gap: 10px; align-content: start; min-height: 136px; padding: 14px; border-radius: var(--r-s); text-align: left; background: var(--vidrio), var(--sup); border: 1px solid var(--borde); box-shadow: var(--brillo-sup), var(--sombra); transition: border-color 0.3s, transform 0.15s var(--ease); }
.modo-casa:active { transform: scale(0.98); }
.mc-ic { position: relative; display: grid; place-items: center; width: 42px; height: 42px; border-radius: 10px; color: var(--titanio); background: rgba(255, 255, 255, 0.05); border: 1px solid var(--borde); }
.mc-ic .ic { width: 21px; height: 21px; }
.mc-txt { display: grid; gap: 3px; }
.mc-txt b { font-size: 16px; font-weight: 600; }
.mc-txt small { font-size: 13px; color: var(--texto-2); line-height: 1.4; }
.mc-actual { position: absolute; top: 12px; right: 12px; padding: 3px 9px; border-radius: 6px; font-family: var(--f-mono); font-size: 11.5px; letter-spacing: 0.14em; text-transform: uppercase; color: #1d1406; background: linear-gradient(135deg, var(--oro-claro), var(--oro)); }
.modo-casa.activo { border-color: rgba(232, 176, 74, 0.6); background: radial-gradient(120% 120% at 0% 0%, rgba(232, 176, 74, calc(0.16 * var(--glow))), transparent 60%), var(--vidrio), var(--sup); box-shadow: 0 0 0 1px rgba(232, 176, 74, 0.3), var(--sombra); }
.modo-casa.activo .mc-ic { color: #1d1406; background: linear-gradient(135deg, var(--oro-claro), var(--oro)); border-color: transparent; }
.nota-clima { font-size: 13px; }

.exterior { display: flex; flex-wrap: wrap; align-items: center; gap: 12px 22px; padding: 14px 16px; border-radius: var(--r); background: var(--vidrio), var(--sup); border: 1px solid var(--borde); }
.ext-dato { display: flex; align-items: center; gap: 10px; color: var(--oro); }
.ext-dato span { display: grid; line-height: 1.25; }
.ext-dato b { font-weight: 700; font-size: 17px; color: var(--texto); font-variant-numeric: tabular-nums; }
.ext-dato small { font-size: 12.5px; color: var(--texto-2); }

/* Riego (solo lectura): una línea de tiempo del ciclo */
.riego { position: relative; display: grid; gap: 12px; margin-top: 10px; padding: 16px; border-radius: var(--r); background: radial-gradient(120% 100% at 100% 0%, rgba(111, 223, 255, 0.07), transparent 60%), var(--vidrio), var(--sup); border: 1px solid var(--borde); }
.riego::before { --c: rgba(111, 223, 255, 0.28); }
.riego-cab { display: flex; align-items: flex-start; gap: 12px; }
.riego-cab > span:nth-child(2) { flex: 1; display: grid; gap: 2px; }
.riego-cab b { font-size: 16px; font-weight: 600; }
.riego-cab small { font-size: 13.5px; color: var(--texto-2); line-height: 1.4; }
.riego-cab small b { font-size: inherit; color: var(--cian-claro); }
.riego-ic { display: grid; place-items: center; width: 42px; height: 42px; border-radius: 10px; color: var(--cian); background: var(--cian-suave); border: 1px solid rgba(111, 223, 255, 0.25); flex: none; }
.zonas-riego { position: relative; list-style: none; margin: 0; padding: 0 0 0 4px; display: grid; grid-template-columns: 1fr; gap: 4px; }
.zonas-riego::before { content: ''; position: absolute; left: 18px; top: 18px; bottom: 18px; width: 1px; background: linear-gradient(180deg, rgba(111, 223, 255, 0.35), rgba(111, 223, 255, 0.08)); }
.zona-r { position: relative; display: flex; align-items: center; gap: 12px; min-height: 48px; padding: 6px 12px 6px 0; border-radius: 10px; }
.zr-n { position: relative; display: grid; place-items: center; width: 30px; height: 30px; border-radius: 50%; font-family: var(--f-mono); font-size: 13px; color: var(--texto-2); background: var(--sup-solida); border: 1px solid var(--borde-2); flex: none; }
.zr-txt { flex: 1; min-width: 0; display: grid; line-height: 1.3; }
.zr-txt b { font-size: 14.5px; font-weight: 600; }
.zr-txt small { font-size: 12.5px; color: var(--texto-2); font-variant-numeric: tabular-nums; }
.zr-led { width: 8px; height: 8px; border-radius: 50%; background: rgba(255, 255, 255, 0.14); flex: none; }
.zona-r.activa { background: var(--cian-suave); }
.zona-r.activa .zr-n { color: #04121a; background: var(--cian-claro); border-color: transparent; box-shadow: 0 0 14px rgba(111, 223, 255, 0.6); }
.zona-r.activa .zr-led { background: var(--cian); box-shadow: 0 0 10px var(--cian); animation: parpadeo 1.4s ease-in-out infinite; }
.riego-consejo { display: flex; gap: 10px; align-items: flex-start; font-size: 13.5px; color: var(--texto-2); line-height: 1.5; padding-top: 10px; border-top: 1px solid var(--borde); }

/* Protocolos */
.sol-linea { display: flex; align-items: center; gap: 10px; margin-top: -12px; font-size: 14px; color: var(--texto-2); }
.sol-linea .ic { color: var(--oro); }
.explica-modos { display: grid; gap: 6px; padding: 14px 16px; border-radius: var(--r); background: rgba(255, 255, 255, 0.025); border: 1px solid var(--borde); font-size: 13.5px; color: var(--texto-2); line-height: 1.45; }
.explica-modos p { display: grid; grid-template-columns: 82px 1fr; gap: 8px; }
.explica-modos b { font-family: var(--f-mono); font-weight: 400; font-size: 12.5px; letter-spacing: 0.14em; text-transform: uppercase; padding-top: 1px; }
.m-activo { color: var(--oro-claro); } .m-ensayo { color: var(--cian); } .m-apagado { color: var(--texto-3); }
.protocolos { display: grid; gap: 10px; }
.protocolo { position: relative; display: grid; gap: 12px; padding: 16px; border-radius: var(--r); background: var(--vidrio), var(--sup); border: 1px solid var(--borde); box-shadow: var(--brillo-sup), var(--sombra); transition: border-color 0.3s; }
.protocolo.modo-activo { border-color: var(--oro-linea); }
.protocolo.modo-ensayo { border-color: rgba(111, 223, 255, 0.35); border-style: dashed; }
.protocolo.modo-apagado { opacity: 0.82; }
.protocolo-cab { display: flex; align-items: center; gap: 12px; }
.protocolo-ic { display: grid; place-items: center; width: 46px; height: 46px; border-radius: 12px; color: var(--titanio); background: rgba(255, 255, 255, 0.05); border: 1px solid var(--borde); flex: none; }
.protocolo.modo-activo .protocolo-ic { color: #1d1406; background: linear-gradient(135deg, var(--oro-claro), var(--oro)); border-color: transparent; box-shadow: 0 0 22px rgba(232, 176, 74, calc(0.35 * var(--glow))); }
.protocolo.modo-ensayo .protocolo-ic { color: var(--cian); border-color: rgba(111, 223, 255, 0.4); }
.protocolo h3 { font-size: 17.5px; font-weight: 700; letter-spacing: 0.02em; }
.protocolo-lema { font-family: var(--f-mono); font-size: 12px; letter-spacing: 0.16em; text-transform: uppercase; color: var(--oro); margin-top: 2px; }
.protocolo.modo-ensayo .protocolo-lema { color: var(--cian); }
.protocolo-desc { font-size: 14px; color: var(--texto-2); line-height: 1.5; }
.protocolo-nota { font-size: 13px; color: var(--cian); }
.segmento.seg-activo.activo b { color: var(--oro-claro); }
.segmento.seg-ensayo.activo b { color: var(--cian); }
.segmento.seg-activo.activo::after { background: var(--oro); }
.segmento.seg-ensayo.activo::after { background: var(--cian); box-shadow: 0 0 8px var(--cian); }

.lista-avisos { display: grid; gap: 8px; }
.aviso-p { display: flex; gap: 12px; padding: 12px 14px; border-radius: var(--r-s); background: var(--vidrio), var(--sup); border: 1px solid var(--borde); border-left-width: 3px; }
.aviso-p.nivel-info { border-left-color: var(--titanio-2); }
.aviso-p.nivel-aviso { border-left-color: var(--aviso); }
.aviso-p.nivel-urgente { border-left-color: var(--alerta); background: linear-gradient(90deg, rgba(255, 59, 59, 0.12), transparent 60%), var(--sup); }
.aviso-p.nuevo { box-shadow: 0 0 0 1px rgba(232, 176, 74, 0.3); }
.aviso-p-ic { display: grid; place-items: center; width: 34px; height: 34px; border-radius: 9px; color: var(--titanio); background: rgba(255, 255, 255, 0.05); flex: none; }
.aviso-p.nivel-urgente .aviso-p-ic { color: #fff; background: var(--alerta); }
.aviso-p.nivel-aviso .aviso-p-ic { color: var(--aviso); }
.aviso-p-txt { flex: 1; min-width: 0; display: grid; gap: 3px; font-size: 14px; line-height: 1.45; color: var(--texto-2); }
.aviso-p-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 10px; color: var(--texto); }
.aviso-p-meta b { font-size: 14.5px; font-weight: 600; }
.aviso-p-meta time { font-family: var(--f-mono); font-size: 12.5px; color: var(--texto-3); }
.tag-ensayo, .tag-urgente { padding: 1px 8px; border-radius: 5px; font-family: var(--f-mono); font-size: 11.5px; letter-spacing: 0.12em; text-transform: uppercase; }
.tag-ensayo { color: var(--cian); border: 1px dashed rgba(111, 223, 255, 0.5); }
.tag-urgente { color: #fff; background: var(--alerta-2); box-shadow: inset 0 0 0 1px rgba(255, 90, 90, 0.6); }

/* Registro */
.filtros { display: flex; gap: 6px; overflow-x: auto; margin: 0 -16px; padding: 0 16px 2px; scrollbar-width: none; }
.filtros::-webkit-scrollbar { display: none; }
.filtro { flex: none; min-height: 44px; padding: 0 16px; border-radius: 10px; font-size: 14px; font-weight: 600; color: var(--texto-2); border: 1px solid var(--borde-2); background: rgba(255, 255, 255, 0.02); }
.filtro.activo { color: #1d1406; background: linear-gradient(135deg, var(--oro-claro), var(--oro)); border-color: transparent; }
.linea-tiempo { position: relative; display: grid; gap: 2px; }
.dia { position: sticky; top: calc(64px + var(--seg-top)); z-index: 2; margin: 14px 0 6px; font-family: var(--f-mono); font-weight: 400; font-size: 12.5px; letter-spacing: 0.2em; text-transform: uppercase; color: var(--oro); }
.dia:first-child { margin-top: 0; }
.lista-avisos .dia { position: static; margin: 8px 0 0; }
.suceso { position: relative; display: grid; grid-template-columns: 46px 34px 1fr auto; align-items: center; gap: 8px; min-height: 58px; padding: 6px 4px; border-bottom: 1px solid rgba(255, 255, 255, 0.045); }
.suceso time { font-family: var(--f-mono); font-size: 13px; color: var(--texto-3); }
.suceso-ic { display: grid; place-items: center; width: 32px; height: 32px; border-radius: 9px; background: rgba(255, 255, 255, 0.04); color: var(--titanio-2); }
.suceso-ic .ic { width: 17px; height: 17px; }
.suceso-txt { display: grid; min-width: 0; line-height: 1.3; }
.suceso-txt b { font-size: 14.5px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.suceso-txt small { font-size: 13px; color: var(--texto-2); }
.suceso-quien { font-size: 12px; font-weight: 600; color: var(--texto-2); padding: 3px 9px; border-radius: 6px; border: 1px solid var(--borde); white-space: nowrap; max-width: 110px; overflow: hidden; text-overflow: ellipsis; }
.suceso-escena .suceso-ic { color: var(--oro); background: var(--oro-suave); }
.suceso-casa .suceso-ic { color: var(--cian); background: var(--cian-suave); }
.suceso.nuevo { animation: nuevo 1.2s var(--ease); }
@keyframes nuevo { from { background: rgba(232, 176, 74, 0.16); transform: translateY(-4px); opacity: 0; } 30% { opacity: 1; transform: none; } }

/* Más */
.mas-accesos { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.acceso { position: relative; display: grid; gap: 10px; align-content: start; min-height: 116px; padding: 14px; border-radius: var(--r-s); background: var(--vidrio), var(--sup); border: 1px solid var(--borde); box-shadow: var(--brillo-sup), var(--sombra); }
.acceso > span:nth-child(2) { display: grid; gap: 2px; }
.acceso b { font-size: 15.5px; font-weight: 600; }
.acceso small { font-size: 13px; color: var(--texto-2); }
.acceso-ic { display: grid; place-items: center; width: 42px; height: 42px; border-radius: 10px; color: var(--titanio); background: rgba(255, 255, 255, 0.05); border: 1px solid var(--borde); }
.acceso-3d { border-color: rgba(111, 223, 255, 0.3); background: radial-gradient(120% 120% at 100% 0%, rgba(111, 223, 255, 0.1), transparent 60%), var(--vidrio), var(--sup); }
.acceso-3d .acceso-ic { color: var(--cian); border-color: rgba(111, 223, 255, 0.35); }
.pronto { position: absolute; top: 12px; right: 12px; padding: 2px 8px; border-radius: 5px; font-style: normal; font-family: var(--f-mono); font-size: 11.5px; letter-spacing: 0.12em; text-transform: uppercase; color: var(--cian); border: 1px solid rgba(111, 223, 255, 0.45); }

.grupo { display: grid; border-radius: var(--r); overflow: hidden; background: var(--vidrio), var(--sup); border: 1px solid var(--borde); }
.grupo + .grupo { margin-top: 4px; }
.grupo-titulo { padding: 14px 16px 6px; font-family: var(--f-mono); font-size: 12px; letter-spacing: 0.2em; text-transform: uppercase; color: var(--oro); }
.grupo > .parrafo { padding: 12px 16px; }
.fila { display: flex; align-items: center; gap: 12px; width: 100%; min-height: 60px; padding: 10px 16px; text-align: left; border-top: 1px solid rgba(255, 255, 255, 0.045); transition: background 0.2s; }
.grupo-titulo + .fila, .grupo > .fila:first-child { border-top: 0; }
button.fila:active { background: rgba(255, 255, 255, 0.04); }
.fila-ic { position: relative; display: grid; place-items: center; width: 36px; height: 36px; border-radius: 10px; background: rgba(255, 255, 255, 0.04); color: var(--titanio); flex: none; }
.fila-ic .ic { width: 19px; height: 19px; }
.fila-txt { flex: 1; min-width: 0; display: grid; line-height: 1.3; }
.fila-txt b { font-size: 15px; font-weight: 600; }
.fila-txt small { font-size: 13px; color: var(--texto-2); overflow-wrap: anywhere; text-wrap: pretty; }
.fila-interruptor .fila-txt small { white-space: normal; }
.fila-flecha { color: var(--texto-3); width: 18px; height: 18px; }
.fila-botones { display: flex; align-items: center; gap: 2px; }
.fila-select select { width: auto; max-width: 48%; height: 44px; font-size: 14px; }
.fila-identificar { flex-wrap: wrap; row-gap: 6px; }
.fila-identificar .fila-botones { width: 100%; padding-left: 48px; gap: 6px; }
.fila-identificar .fila-botones .btn { flex: 1; }
.fila-identificar .btn .giro { inset: 6px auto auto 8px; width: 30px; height: 30px; }
.fila-identificar[data-on="1"] .luz-mini { color: #2a1c06; background: var(--lampara); box-shadow: 0 0 16px rgba(255, 200, 120, 0.5); }
.interruptor { position: relative; width: 52px; height: 32px; border-radius: 99px; background: rgba(255, 255, 255, 0.1); border: 1px solid var(--borde-2); transition: background 0.25s; flex: none; }
.interruptor i { position: absolute; top: 3px; left: 3px; width: 24px; height: 24px; border-radius: 50%; background: var(--titanio); box-shadow: 0 2px 6px rgba(0, 0, 0, 0.5); transition: transform 0.25s var(--ease), background 0.25s; }
.interruptor.on { background: linear-gradient(135deg, var(--oro-claro), var(--oro-2)); border-color: transparent; }
.interruptor.on i { transform: translateX(20px); background: #fff; }

.firma-pie { display: grid; justify-items: center; gap: 6px; padding: 20px 0 8px; text-align: center; }
.firma-pie p { font-family: var(--f-marca); font-weight: 600; font-size: 12px; letter-spacing: 0.24em; color: var(--texto-2); }
.firma-pie small { font-size: 12.5px; color: var(--texto-3); }
.pie-reactor { width: 64px; height: 64px; border-radius: 50%; }
.instalar { margin-top: 8px; }
.instalar .parrafo { display: flex; align-items: flex-start; gap: 8px; font-size: 13.5px; }

.personas { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.persona { position: relative; display: flex; align-items: center; gap: 12px; min-height: 68px; padding: 10px 12px; border-radius: var(--r-s); text-align: left; background: var(--vidrio), var(--sup); border: 1px solid var(--borde); transition: border-color 0.2s, transform 0.15s var(--ease); }
.persona:active { transform: scale(0.97); }
.persona-inicial { display: grid; place-items: center; width: 40px; height: 40px; border-radius: 50%; flex: none; font-family: var(--f-marca); font-weight: 700; font-size: 16px; color: var(--oro-claro); border: 1px solid var(--oro-linea); background: var(--oro-suave); }
.persona-txt { flex: 1; min-width: 0; display: grid; line-height: 1.25; }
.persona-txt b { font-size: 15.5px; font-weight: 600; }
.persona-txt small { font-size: 13px; color: var(--texto-2); }
.persona.activa { border-color: rgba(232, 176, 74, 0.6); background: radial-gradient(120% 120% at 0% 0%, rgba(232, 176, 74, calc(0.14 * var(--glow))), transparent 60%), var(--vidrio), var(--sup); }
.persona.activa .persona-inicial { color: #1d1406; background: linear-gradient(135deg, var(--oro-claro), var(--oro)); border-color: transparent; }
.persona-nadie { grid-column: 1 / -1; min-height: 56px; }
.persona-nadie .persona-inicial { color: var(--texto-3); border-color: var(--borde-2); background: transparent; }
.persona-inicial .ic { width: 18px; height: 18px; }
.persona-ficha { grid-column: auto; cursor: default; -webkit-user-select: none; user-select: none; -webkit-touch-callout: none; }
.hoja-persona { display: grid; gap: 14px; }
.personas.grande { grid-template-columns: 1fr; }
.personas.grande .persona { min-height: 76px; padding: 12px 14px; }
.personas.grande .persona-inicial { width: 48px; height: 48px; font-size: 19px; }
.personas.grande .persona-txt b { font-size: 17px; }

/* Casa 3D: el esqueleto holográfico */
.holograma { position: relative; display: grid; place-items: center; min-height: 300px; padding: 20px; border-radius: var(--r); overflow: hidden; color: var(--texto-2);
  background: radial-gradient(80% 70% at 50% 60%, rgba(111, 223, 255, 0.12), transparent 70%), repeating-linear-gradient(0deg, rgba(111, 223, 255, 0.05) 0 1px, transparent 1px 24px), repeating-linear-gradient(90deg, rgba(111, 223, 255, 0.05) 0 1px, transparent 1px 24px), #05080b;
  border: 1px solid rgba(111, 223, 255, 0.22); }
.holograma::before { --c: rgba(111, 223, 255, 0.45); }
.holo-svg { width: 100%; max-height: 360px; overflow: visible; filter: drop-shadow(0 0 6px rgba(111, 223, 255, 0.5)); }
.holo-svg path { fill: none; stroke-linejoin: round; vector-effect: non-scaling-stroke; }
.holo-svg .h-alto { stroke: var(--cian); stroke-width: 1.4; fill: rgba(111, 223, 255, 0.06); }
.holo-svg .h-suelo { stroke: var(--cian); stroke-width: 1.2; fill: rgba(111, 223, 255, 0.03); }
.holo-svg .h-bajo { stroke: rgba(111, 223, 255, 0.45); stroke-width: 1; stroke-dasharray: 4 3; }
.holo-svg .h-arista { stroke: rgba(111, 223, 255, 0.7); stroke-width: 1; }
.holo-barrido { position: absolute; left: 0; right: 0; top: 0; height: 40%; background: linear-gradient(180deg, transparent, rgba(111, 223, 255, 0.1), transparent); pointer-events: none; }
.pronto-grande { position: absolute; bottom: 14px; right: 16px; font-family: var(--f-mono); font-size: 12.5px; letter-spacing: 0.2em; text-transform: uppercase; color: var(--cian); }

/* =====================================================================
   Jarvis (conversación): se abre desde el reactor que tocas
   ===================================================================== */
.jarvis {
  --jx: 50%; --jy: calc(100% - 40px);
  position: fixed; inset: 0; z-index: 60;
  display: flex; flex-direction: column;
  padding: calc(8px + var(--seg-top)) 16px calc(12px + var(--seg-bot));
  background:
    radial-gradient(520px 420px at 50% 20%, rgba(111, 223, 255, calc(0.11 * var(--glow))), transparent 70%),
    radial-gradient(600px 500px at 50% 112%, rgba(214, 38, 47, calc(0.13 * var(--glow))), transparent 70%),
    #050607;
  visibility: hidden;
  clip-path: circle(0 at var(--jx) var(--jy));
  transition: clip-path 0.55s var(--ease), visibility 0s 0.55s;
}
.jarvis::after { content: ''; position: absolute; inset: 0; z-index: -1; pointer-events: none; background-image: linear-gradient(rgba(111, 223, 255, 0.03) 1px, transparent 1px), linear-gradient(90deg, rgba(111, 223, 255, 0.03) 1px, transparent 1px); background-size: 36px 36px; -webkit-mask-image: radial-gradient(80% 50% at 50% 22%, #000, transparent 75%); mask-image: radial-gradient(80% 50% at 50% 22%, #000, transparent 75%); }
html[data-noche="1"] .jarvis { background: radial-gradient(560px 420px at 50% 18%, rgba(255, 190, 120, 0.07), transparent 70%), #090706; }
.jarvis.abierto { visibility: visible; clip-path: circle(150vmax at var(--jx) var(--jy)); transition: clip-path 0.6s var(--ease), visibility 0s; }
.jarvis-cab { display: flex; align-items: center; justify-content: space-between; gap: 10px; min-height: 44px; }
.jarvis-cab .eyebrow { flex: 1; color: var(--texto-3); }
.jarvis-enlace { display: inline-flex; align-items: center; gap: 8px; padding: 6px 12px; border-radius: 8px; font-size: 13px; font-weight: 600; color: #ffd59a; border: 1px solid rgba(242, 181, 68, 0.45); background: rgba(242, 181, 68, 0.1); }
.jarvis-enlace:empty { display: none; }
.jarvis-enlace i { width: 8px; height: 8px; border-radius: 50%; background: var(--aviso); animation: parpadeo 1.2s ease-in-out infinite; }
.jarvis-escena { position: relative; display: grid; justify-items: center; gap: 8px; padding: 6px 0 12px; transition: padding 0.3s; }
.jarvis-escena::before { inset: 0 8% 4px; --c: rgba(111, 223, 255, 0.25); }
.jarvis-reactor { position: relative; width: 184px; height: 184px; margin: 20px 0 6px; border-radius: 50%; transition: width 0.35s var(--ease), height 0.35s var(--ease), filter 0.3s; }
.jarvis-reactor:active .reactor { transform: scale(0.97); }
.anillo-texto { position: absolute; inset: -15%; width: 130%; height: 130%; pointer-events: none; overflow: visible; transition: transform 0.6s var(--ease); }
.anillo-texto text { font-family: var(--f-mono); font-size: 7.8px; letter-spacing: 0.24em; fill: var(--titanio-2); opacity: 0.8; }
.jarvis.escuchando .anillo-texto { animation: girar 14s linear infinite; }
.jarvis.escuchando .anillo-texto text { fill: var(--cian); }
.jarvis.pensando .anillo-texto { animation: girar 5s linear infinite reverse; }
.jarvis.con-charla .jarvis-reactor { width: 112px; height: 112px; margin: 14px 0 4px; }
.jarvis-estado { font-family: var(--f-mono); font-size: 12.5px; letter-spacing: 0.22em; text-transform: uppercase; color: var(--titanio); text-align: center; min-height: 18px; }
.jarvis-parcial { min-height: 22px; font-size: 16px; color: var(--texto); text-align: center; font-weight: 500; }
/* Onda de voz: se mueve al escuchar y al hablar */
.jarvis-ondas { display: flex; align-items: center; gap: 4px; height: 18px; opacity: 0.25; transition: opacity 0.3s; }
.jarvis-ondas i { width: 3px; height: 4px; border-radius: 2px; background: var(--cian); transform-origin: center; }
.jarvis.escuchando .jarvis-ondas, .jarvis.hablando .jarvis-ondas { opacity: 1; }
.jarvis.escuchando .jarvis-ondas i, .jarvis.hablando .jarvis-ondas i { animation: onda-voz 0.9s ease-in-out infinite; }
.jarvis.hablando .jarvis-ondas i { background: var(--oro-claro); animation-duration: 0.6s; }
.jarvis-ondas i:nth-child(2) { animation-delay: 0.1s !important; } .jarvis-ondas i:nth-child(3) { animation-delay: 0.25s !important; }
.jarvis-ondas i:nth-child(4) { animation-delay: 0.05s !important; } .jarvis-ondas i:nth-child(5) { animation-delay: 0.3s !important; }
.jarvis-ondas i:nth-child(6) { animation-delay: 0.15s !important; } .jarvis-ondas i:nth-child(7) { animation-delay: 0.35s !important; }
.jarvis-ondas i:nth-child(8) { animation-delay: 0.2s !important; } .jarvis-ondas i:nth-child(9) { animation-delay: 0.08s !important; }
@keyframes onda-voz { 0%, 100% { transform: scaleY(1); } 50% { transform: scaleY(4.2); } }
.jarvis.escuchando .reactor .r-ticks { animation: girar 4s linear infinite; }
.jarvis.escuchando .reactor .r-arcos { animation: girar 2.4s linear infinite reverse; }
.jarvis.escuchando .reactor .r-halo { animation: escucha 1s ease-in-out infinite; }
.jarvis.escuchando .jarvis-estado { color: var(--cian); }
.jarvis.pensando .reactor .r-seg { animation: girar 1.6s linear infinite; }
.jarvis.pensando .reactor .r-ticks { animation: girar 6s linear infinite reverse; }
.jarvis.pensando .jarvis-estado { color: var(--oro-claro); }
.jarvis.hablando .reactor .r-halo { animation: escucha 0.7s ease-in-out infinite; }
.jarvis.hablando .reactor .r-nucleo { animation: pulso 0.7s ease-in-out infinite; }
@keyframes escucha { 0%, 100% { opacity: calc(0.35 * var(--glow)); transform: scale(1.3); } 50% { opacity: calc(0.85 * var(--glow)); transform: scale(1.6); } }
/* Encendido: el reactor del panel se monta pieza a pieza */
.jarvis.encendiendo .jarvis-reactor .reactor > * { animation: encender-pieza 0.75s var(--ease) backwards; }
.jarvis.encendiendo .jarvis-reactor .reactor .r-ticks { animation-delay: 0.05s; }
.jarvis.encendiendo .jarvis-reactor .reactor .r-arcos { animation-delay: 0.12s; }
.jarvis.encendiendo .jarvis-reactor .reactor .r-seg { animation-delay: 0.2s; }
.jarvis.encendiendo .jarvis-reactor .reactor .r-nucleo, .jarvis.encendiendo .jarvis-reactor .reactor .r-aro, .jarvis.encendiendo .jarvis-reactor .reactor .r-centro { animation-delay: 0.3s; }
.jarvis.encendiendo .jarvis-reactor .reactor .r-halo { animation: encender-halo 1s var(--ease) 0.3s backwards; }
.jarvis.encendiendo .jarvis-reactor::after { content: ''; position: absolute; inset: 10%; border-radius: 50%; border: 2px solid var(--cian); pointer-events: none; animation: onda-nucleo 1s var(--ease) 0.25s backwards; }
.jarvis.encendiendo .anillo-texto { animation: encender-anillo 1.1s var(--ease) backwards; }
@keyframes encender-anillo { from { opacity: 0; transform: rotate(-120deg) scale(0.85); } }
.conversacion { flex: 1; min-height: 0; overflow-y: auto; display: flex; flex-direction: column; gap: 10px; padding: 6px 2px 10px; scroll-behavior: smooth; -webkit-mask-image: linear-gradient(180deg, transparent, #000 16px); mask-image: linear-gradient(180deg, transparent, #000 16px); }
.burbuja { position: relative; max-width: 88%; padding: 11px 14px 9px; border-radius: 12px; font-size: 15px; line-height: 1.45; }
.burbuja p { margin: 0; }
.burbuja time { display: block; margin-top: 3px; font-family: var(--f-mono); font-size: 12px; color: var(--texto-3); }
.burbuja.de-yo { align-self: flex-end; background: linear-gradient(135deg, rgba(232, 176, 74, 0.15), rgba(255, 255, 255, 0.03)); border: 1px solid var(--oro-linea); border-bottom-right-radius: 4px; }
.burbuja.de-yo time { text-align: right; }
.burbuja.de-jarvis { align-self: flex-start; padding-left: 44px; background: linear-gradient(90deg, rgba(111, 223, 255, 0.06), transparent 60%), var(--sup); border: 1px solid var(--borde); border-left: 2px solid var(--cian); border-bottom-left-radius: 4px; }
.burbuja.de-jarvis.error { border-color: rgba(242, 181, 68, 0.45); border-left-color: var(--aviso); }
.burbuja-firma { position: absolute; left: 11px; top: 11px; display: grid; place-items: center; width: 24px; height: 24px; border-radius: 6px; font-family: var(--f-marca); font-weight: 700; font-size: 11px; color: #fff; background: linear-gradient(135deg, var(--rojo), var(--rojo-2)); }
.burbuja.nueva { animation: burbuja 0.35s var(--ease); }
@keyframes burbuja { from { opacity: 0; transform: translateY(8px) scale(0.98); } }
.pensando-b { display: flex; align-items: center; gap: 10px; min-height: 46px; }
.pensando-b .giro { display: inline-block; }
.puntos { display: flex; gap: 5px; }
.puntos i { width: 6px; height: 6px; border-radius: 50%; background: var(--oro-claro); animation: punto 1s ease-in-out infinite; }
.puntos i:nth-child(2) { animation-delay: 0.15s; } .puntos i:nth-child(3) { animation-delay: 0.3s; }
@keyframes punto { 0%, 100% { opacity: 0.25; transform: translateY(0); } 50% { opacity: 1; transform: translateY(-3px); } }
.burbuja-acciones { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; }
.burbuja-acciones .escena.mini { flex-direction: row; align-items: center; min-height: 48px; padding: 6px 14px 6px 8px; gap: 8px; border-color: rgba(214, 38, 47, 0.5); }
.burbuja-acciones .escena.mini .escena-ic { width: 34px; height: 34px; color: var(--rojo-claro); }
.burbuja-acciones .escena.mini b { font-size: 14px; }
.burbuja.resuelta .burbuja-acciones { opacity: 0.35; pointer-events: none; }
/* Ideas de Jarvis: dentro de la charla, como propuestas suyas */
.burbuja.ideas { max-width: 92%; }
.ideas-lista { display: grid; gap: 8px; margin-top: 10px; }
.idea { display: flex; align-items: flex-start; gap: 10px; min-height: 48px; padding: 11px 14px 11px 12px; border-radius: 12px; text-align: left; font-size: 15px; line-height: 1.35; color: var(--texto); background: linear-gradient(90deg, rgba(232, 176, 74, 0.1), rgba(255, 255, 255, 0.02)); border: 1px solid var(--oro-linea); animation: idea-entra 0.45s var(--ease) backwards; animation-delay: calc(0.12s + var(--k) * 0.12s); transition: transform 0.15s var(--ease), border-color 0.2s, background 0.2s; }
.idea .ic { width: 17px; height: 17px; margin-top: 1px; color: var(--oro-claro); flex: none; }
.idea:active { transform: scale(0.98); background: rgba(232, 176, 74, 0.18); }
.idea.elegida { border-color: var(--oro); background: rgba(232, 176, 74, 0.2); }
.burbuja.ideas.resuelta .idea:not(.elegida) { opacity: 0.4; }
.burbuja.ideas.resuelta .idea { pointer-events: none; }
.burbuja.ideas.apagada { opacity: 0.55; }
@keyframes idea-entra { from { opacity: 0; transform: translateY(8px) scale(0.98); } }
.jarvis-form { display: flex; align-items: center; gap: 6px; padding: 6px; border-radius: 14px; background: var(--vidrio), var(--sup-solida); border: 1px solid var(--borde-2); }
.jarvis-form input { flex: 1; min-width: 0; height: 44px; border: 0; background: transparent; padding: 0 8px; }
.jarvis-form input:focus { box-shadow: none; background: transparent; }
/* Escribir es la segunda opción: un icono de teclado discreto junto a la pista */
.jarvis-pie { display: flex; align-items: center; justify-content: flex-end; gap: 8px; min-height: 52px; padding: 6px 2px 0; }
.jarvis-pista { flex: 1; min-width: 0; font-family: var(--f-mono); font-size: 12px; letter-spacing: 0.16em; text-transform: uppercase; color: var(--texto-3); }
.jarvis-teclado, .jarvis-ideas { width: 48px; height: 48px; border: 1px solid var(--borde-2); background: rgba(255, 255, 255, 0.03); color: var(--texto-2); }
.jarvis-ideas { color: var(--oro-claro); border-color: var(--oro-linea); background: var(--oro-suave); }
.jarvis-ideas .ic { animation: chispea 3.2s ease-in-out infinite; }
@keyframes chispea { 0%, 80%, 100% { transform: none; opacity: 1; } 88% { transform: scale(1.18) rotate(12deg); opacity: 0.8; } }
.jarvis-teclado .ic, .jarvis-ideas .ic { width: 20px; height: 20px; }
.jarvis.con-teclado .jarvis-pie { display: none; }
.jarvis-form:not([hidden]) { animation: entrar 0.25s var(--ease); }
.jarvis-enviar { color: #1d1406; background: linear-gradient(135deg, var(--oro-claro), var(--oro)); }
.jarvis-enviar:hover { background: linear-gradient(135deg, var(--oro-claro), var(--oro)); color: #1d1406; }
.directo { display: none; }

/* =====================================================================
   Pulsar para hablar: el HUD de escucha encima de cualquier pantalla
   ===================================================================== */
[data-hablar] { -webkit-user-select: none; user-select: none; -webkit-touch-callout: none; }
.pestana-jarvis[data-hablar], .jarvis-reactor[data-hablar], .riel-jarvis[data-hablar] { touch-action: none; }
.nucleo.hablando .nc-halo { opacity: 1; transform: scale(1.5); transition-duration: 0.25s; }
.nucleo.hablando .nc-bobinas { animation: girar 2.2s linear infinite; }
.nucleo.hablando .nc-bobinas path { fill: rgba(111, 223, 255, 0.35); }
.nucleo.hablando .nucleo-marco { animation-duration: 6s; }
.pestana-jarvis.hablando .pj-reactor { border-color: var(--cian); box-shadow: 0 0 0 5px rgba(7, 8, 10, 0.92), 0 0 34px rgba(111, 223, 255, 0.7); transform: scale(1.06); }
.riel-jarvis.hablando { background: var(--cian-suave); }

.escucha { position: fixed; inset: 0; z-index: 85; display: grid; place-items: center; pointer-events: none; --hx: 50%; --hy: 50%; }
.escucha-velo {
  position: absolute; inset: 0;
  background: radial-gradient(420px 420px at 50% 42%, rgba(111, 223, 255, calc(0.13 * var(--glow))), transparent 70%), rgba(3, 4, 6, 0.8);
  -webkit-backdrop-filter: blur(10px) saturate(120%); backdrop-filter: blur(10px) saturate(120%);
  clip-path: circle(0 at var(--hx) var(--hy)); transition: clip-path 0.38s var(--ease);
}
.escucha.visible .escucha-velo { clip-path: circle(150vmax at var(--hx) var(--hy)); }
.escucha-centro { position: relative; display: grid; justify-items: center; gap: 10px; width: min(380px, calc(100% - 32px)); padding: 20px 10px; text-align: center; opacity: 0; transform: scale(0.88); transition: opacity 0.22s, transform 0.38s var(--ease); }
.escucha.visible .escucha-centro { opacity: 1; transform: none; }
.escucha.toque .escucha-velo, .escucha.toque .escucha-centro { pointer-events: auto; cursor: pointer; }
.escucha-reactor { width: 200px; height: 200px; margin-bottom: 6px; }
.escucha .reactor .r-ticks { animation: girar 4s linear infinite; }
.escucha .reactor .r-arcos { animation: girar 2.4s linear infinite reverse; }
.escucha .reactor .r-seg { animation: girar 9s linear infinite; }
.escucha .reactor .r-halo { animation: escucha 1s ease-in-out infinite; }
.escucha.oido .reactor .r-halo { animation: pulso 0.4s var(--ease); opacity: 1; }
.escucha.oido .reactor .r-seg path { fill: rgba(111, 223, 255, 0.5); }
.escucha.nada .reactor { filter: saturate(0.3); opacity: 0.7; }
.escucha.nada .reactor * { animation: none !important; }
.escucha-ondas { opacity: 1; height: 26px; }
.escucha-ondas i { width: 3px; animation: onda-voz 0.9s ease-in-out infinite; }
.escucha.oido .escucha-ondas i, .escucha.nada .escucha-ondas i { animation: none; opacity: 0.35; }
.escucha-estado { font-family: var(--f-mono); font-size: 13px; letter-spacing: 0.24em; text-transform: uppercase; color: var(--cian); }
.escucha.oido .escucha-estado { color: var(--ok); }
.escucha.nada .escucha-estado { color: var(--aviso); }
.escucha-texto { min-height: 2.7em; font-size: 22px; font-weight: 600; line-height: 1.3; color: var(--texto); text-wrap: balance; }
.escucha-texto.vacio::before { content: '· · ·'; color: var(--texto-3); letter-spacing: 0.3em; }
.escucha-pista { font-family: var(--f-mono); font-size: 12.5px; letter-spacing: 0.18em; text-transform: uppercase; color: var(--texto-3); min-height: 18px; }
.escucha-cancelar { position: absolute; top: calc(10px + var(--seg-top)); right: 12px; width: 48px; height: 48px; border: 1px solid var(--borde-2); background: rgba(255, 255, 255, 0.04); color: var(--texto); pointer-events: auto; opacity: 0; transition: opacity 0.2s; }
.escucha.visible .escucha-cancelar { opacity: 1; }
html.con-escucha body { overflow: hidden; }

/* =====================================================================
   «Identificando…»: Jarvis te reconoce (anticipo del escaneo facial)
   ===================================================================== */
.identidad { position: fixed; inset: 0; z-index: 115; display: grid; place-items: center; padding: 24px; background: radial-gradient(420px 380px at 50% 40%, rgba(111, 223, 255, calc(0.12 * var(--glow))), transparent 70%), radial-gradient(600px 500px at 50% 115%, rgba(214, 38, 47, calc(0.12 * var(--glow))), transparent 70%), #040506; opacity: 0; transition: opacity 0.35s var(--ease); }
.identidad.visible { opacity: 1; }
.id-rejilla { position: absolute; inset: 0; pointer-events: none; background-image: linear-gradient(rgba(111, 223, 255, 0.05) 1px, transparent 1px), linear-gradient(90deg, rgba(111, 223, 255, 0.05) 1px, transparent 1px); background-size: 28px 28px; -webkit-mask-image: radial-gradient(60% 45% at 50% 40%, #000, transparent 75%); mask-image: radial-gradient(60% 45% at 50% 40%, #000, transparent 75%); }
.id-centro { position: relative; display: grid; justify-items: center; gap: 16px; width: min(340px, 100%); text-align: center; }
.id-titulo { position: relative; justify-self: stretch; height: 18px; white-space: nowrap; font-family: var(--f-mono); font-size: 13px; letter-spacing: 0.3em; text-transform: uppercase; }
.id-titulo span { display: block; transition: opacity 0.3s, transform 0.3s var(--ease); }
.id-escaneando { color: var(--cian); }
.id-escaneando::after { content: '…'; animation: parpadeo 0.8s steps(2) infinite; }
.id-ok { position: absolute; inset: 0; color: var(--ok); opacity: 0; transform: translateY(6px); }
.identidad.confirmada .id-escaneando { opacity: 0; transform: translateY(-6px); }
.identidad.confirmada .id-ok { opacity: 1; transform: none; }
.id-visor { position: relative; width: 200px; height: 200px; display: grid; place-items: center; }
.id-anillo { position: absolute; inset: 0; border-radius: 50%; border: 2px dashed rgba(111, 223, 255, 0.45); animation: girar 6s linear infinite; transition: border-color 0.4s; }
.id-anillo.b { inset: 14px; border: 1px solid rgba(111, 223, 255, 0.25); border-top-color: var(--cian); animation: girar 1.6s linear infinite reverse; }
.id-esquinas { position: absolute; inset: -12px; --c: rgba(111, 223, 255, 0.6); --l: 16px; --g: 2px; background: linear-gradient(var(--c), var(--c)) top left / var(--l) var(--g) no-repeat, linear-gradient(var(--c), var(--c)) top left / var(--g) var(--l) no-repeat, linear-gradient(var(--c), var(--c)) top right / var(--l) var(--g) no-repeat, linear-gradient(var(--c), var(--c)) top right / var(--g) var(--l) no-repeat, linear-gradient(var(--c), var(--c)) bottom left / var(--l) var(--g) no-repeat, linear-gradient(var(--c), var(--c)) bottom left / var(--g) var(--l) no-repeat, linear-gradient(var(--c), var(--c)) bottom right / var(--l) var(--g) no-repeat, linear-gradient(var(--c), var(--c)) bottom right / var(--g) var(--l) no-repeat; transition: inset 0.4s var(--ease); }
.id-casco { width: 118px; height: 118px; filter: drop-shadow(0 0 14px rgba(111, 223, 255, 0.35)) saturate(0.55) brightness(0.85); transition: filter 0.45s, transform 0.45s var(--ease); }
.id-barrido { position: absolute; left: 12%; right: 12%; top: 10%; height: 3px; border-radius: 2px; background: linear-gradient(90deg, transparent, var(--cian-claro), transparent); box-shadow: 0 0 16px 4px rgba(111, 223, 255, 0.55); animation: id-barre 0.9s ease-in-out infinite alternate; }
@keyframes id-barre { from { transform: translateY(0); } to { transform: translateY(150px); } }
.identidad.confirmada .id-barrido { opacity: 0; transition: opacity 0.2s; }
.identidad.confirmada .id-anillo { border-color: rgba(232, 176, 74, 0.7); animation-duration: 18s; }
.identidad.confirmada .id-anillo.b { border-top-color: var(--oro); border-color: rgba(232, 176, 74, 0.35); }
.identidad.confirmada .id-esquinas { --c: var(--oro); inset: -4px; }
.identidad.confirmada .id-casco { filter: drop-shadow(0 0 22px rgba(232, 176, 74, 0.6)) drop-shadow(0 0 40px rgba(214, 38, 47, 0.45)); transform: scale(1.08); }
.id-lecturas { list-style: none; margin: 0; padding: 0; width: 100%; display: grid; gap: 6px; font-family: var(--f-mono); font-size: 12.5px; letter-spacing: 0.12em; text-transform: uppercase; }
.id-lecturas li { display: grid; grid-template-columns: auto 1fr auto; align-items: baseline; gap: 8px; color: var(--texto-3); animation: linea 0.3s var(--ease) backwards; animation-delay: calc(0.12s + var(--i) * 0.22s); }
.id-lecturas i { border-bottom: 1px dotted rgba(255, 255, 255, 0.15); transform: translateY(-3px); }
.id-lecturas b { font-weight: 400; color: var(--cian); white-space: nowrap; }
.id-lecturas li.ok b { color: var(--texto); }
.id-barra { width: 100%; height: 2px; background: rgba(255, 255, 255, 0.07); overflow: hidden; }
.id-barra i { display: block; height: 100%; background: linear-gradient(90deg, var(--cian), var(--oro)); transform-origin: left; animation: id-carga 1.35s linear forwards; }
@keyframes id-carga { from { transform: scaleX(0); } to { transform: scaleX(1); } }
.id-nombre { font-family: var(--f-marca); font-weight: 600; font-size: 25px; letter-spacing: 0.08em; text-transform: uppercase; background: linear-gradient(100deg, var(--oro-claro), var(--oro) 60%, #c78d3a); -webkit-background-clip: text; background-clip: text; color: transparent; opacity: 0; transform: translateY(8px) scale(0.96); transition: opacity 0.4s var(--ease), transform 0.5s var(--ease); }
.identidad.confirmada .id-nombre { opacity: 1; transform: none; }

/* =====================================================================
   Hoja, avisos, alertas, flotantes
   ===================================================================== */
.hoja { position: fixed; inset: 0; z-index: 90; }
.hoja-fondo { position: absolute; inset: 0; background: rgba(0, 0, 0, 0.58); -webkit-backdrop-filter: blur(4px); backdrop-filter: blur(4px); opacity: 0; transition: opacity 0.28s; }
.hoja-panel {
  position: absolute; left: 0; right: 0; bottom: 0; max-height: 88vh; max-height: 88dvh; overflow-y: auto; outline: none;
  padding: 8px 16px calc(18px + var(--seg-bot)); border-radius: 20px 20px 0 0;
  background: var(--vidrio), var(--sup-solida); border-top: 1px solid var(--borde-2); box-shadow: 0 -30px 60px -20px rgba(0, 0, 0, 0.9);
  transform: translateY(102%); transition: transform 0.32s var(--ease);
}
.hoja-panel::before { content: ''; position: absolute; top: -1px; left: 50%; width: 60px; height: 2px; transform: translateX(-50%); background: var(--oro); opacity: 0.7; }
.hoja.abierta .hoja-fondo { opacity: 1; }
.hoja.abierta .hoja-panel { transform: none; }
.hoja-asa { width: 40px; height: 4px; margin: 4px auto 8px; border-radius: 4px; background: rgba(255, 255, 255, 0.18); }
.hoja-cab { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 10px; }
.hoja-cab h2 { font-size: 19px; font-weight: 600; }
.hoja-cuerpo { display: grid; gap: 14px; }
.hoja-acciones { position: sticky; bottom: calc(-18px - var(--seg-bot)); display: flex; gap: 10px; justify-content: flex-end; padding: 12px 0 calc(4px + var(--seg-bot)); background: linear-gradient(180deg, transparent, var(--sup-solida) 30%); }
.hoja-acciones .btn { flex: 1; }
.form-nombres, .form-renombrar, .opciones { display: grid; gap: 12px; }
.form-renombrar { grid-template-columns: 1fr; }
.form-renombrar .btn .giro, .hoja-acciones .btn .giro { inset: 50% auto auto 50%; width: 34px; height: 34px; margin: -17px 0 0 -17px; }
.form-renombrar .btn.ejecutando span, .hoja-acciones .btn.ejecutando span { opacity: 0.3; }
.btn-primario .giro-a circle { stroke: #3a2808; filter: none; }
.btn-primario .giro-b circle { stroke: #6b4d16; }
.fila-nombre { display: flex; align-items: center; gap: 8px; }
.fila-nombre input { height: 48px; font-size: 15.5px; }
.fila-nombre.oculto input { opacity: 0.45; text-decoration: line-through; }
.form-nombres .grupo-titulo { padding: 6px 0 0; }
.opciones-lista { display: grid; border-radius: var(--r-s); overflow: hidden; border: 1px solid var(--borde); }
.opciones-lista .fila:first-child { border-top: 0; }

.avisos { position: fixed; left: 50%; bottom: calc(var(--nav-alto) + 16px + var(--seg-bot)); z-index: 95; width: min(440px, calc(100% - 24px)); transform: translateX(-50%); display: grid; gap: 8px; pointer-events: none; }
html[data-vista="estancia"] .avisos { bottom: calc(var(--nav-alto) + 110px + var(--seg-bot)); }
@media (max-width: 1199px) { html.con-jarvis .avisos { bottom: auto; top: calc(64px + var(--seg-top)); } }
.aviso {
  position: relative; display: flex; align-items: flex-start; gap: 10px; padding: 12px 14px; border-radius: 12px;
  background: linear-gradient(180deg, rgba(32, 35, 41, 0.96), rgba(17, 19, 23, 0.97)); border: 1px solid var(--borde-2);
  box-shadow: 0 20px 40px -16px rgba(0, 0, 0, 0.9); font-size: 14.5px; line-height: 1.4;
  -webkit-backdrop-filter: blur(16px); backdrop-filter: blur(16px);
  opacity: 0; transform: translateY(10px) scale(0.98); transition: opacity 0.3s var(--ease), transform 0.3s var(--ease);
}
.aviso::before { content: ''; position: absolute; left: -1px; top: 12px; bottom: 12px; width: 2px; background: var(--oro); }
.aviso.visible { opacity: 1; transform: none; }
.aviso-ic { display: grid; place-items: center; width: 28px; height: 28px; border-radius: 7px; flex: none; color: var(--oro-claro); background: var(--oro-suave); }
.aviso-ic .ic { width: 16px; height: 16px; }
.aviso-error { border-color: rgba(255, 90, 80, 0.5); }
.aviso-error::before { background: var(--alerta); }
.aviso-error .aviso-ic { color: #ffb1ab; background: rgba(255, 59, 59, 0.15); }
.aviso-ok::before { background: var(--ok); }
.aviso-ok .aviso-ic { color: var(--ok); background: rgba(111, 226, 181, 0.1); }
.aviso-txt { flex: 1; padding-top: 3px; }
.aviso-accion { pointer-events: auto; align-self: center; min-height: 44px; padding: 0 14px; border-radius: 10px; font-size: 14px; font-weight: 700; color: #1d1406; background: linear-gradient(135deg, var(--oro-claro), var(--oro)); }

/* Alerta urgente: pantalla completa, rayas de peligro, sirena y voz */
.alerta { position: fixed; inset: 0; z-index: 120; display: grid; place-items: center; padding: 24px; text-align: center; color: #fff;
  background: radial-gradient(600px 500px at 50% 35%, rgba(255, 59, 59, 0.45), transparent 70%), rgba(40, 4, 8, 0.95);
  -webkit-backdrop-filter: blur(10px); backdrop-filter: blur(10px);
  opacity: 0; transition: opacity 0.25s; }
.alerta.visible { opacity: 1; }
.alerta-rayas { position: absolute; left: 0; right: 0; top: 0; height: calc(18px + var(--seg-top)); background: repeating-linear-gradient(135deg, var(--alerta) 0 18px, #1a0204 18px 36px); }
.alerta-rayas::after { content: ''; position: fixed; left: 0; right: 0; bottom: 0; height: calc(18px + var(--seg-bot)); background: repeating-linear-gradient(135deg, var(--alerta) 0 18px, #1a0204 18px 36px); }
.alerta-centro { width: min(420px, 100%); display: grid; justify-items: center; gap: 12px; }
.alerta-icono { position: relative; display: grid; place-items: center; width: 108px; height: 108px; margin-bottom: 8px; border-radius: 50%; background: var(--alerta); box-shadow: 0 0 60px rgba(255, 59, 59, 0.9); }
.alerta-icono .ic { width: 50px; height: 50px; stroke-width: 1.8; }
.alerta-icono i { position: absolute; inset: -10px; border-radius: 50%; border: 3px solid var(--alerta); animation: onda 1.3s ease-out infinite; }
.alerta-icono i + i { animation-delay: 0.65s; }
.alerta-origen { margin-top: 10px; font-family: var(--f-mono); font-size: 12.5px; line-height: 1.5; letter-spacing: 0.2em; text-transform: uppercase; color: #ffb6b0; text-wrap: balance; }
.alerta-hora { display: block; margin-top: 2px; font-family: var(--f-mono); font-size: 13px; letter-spacing: 0.08em; color: #ffd9d5; }
.alerta h1 { font-size: 32px; font-weight: 700; line-height: 1.1; letter-spacing: 0.01em; }
.alerta-texto { font-size: 16px; line-height: 1.5; color: #ffe2df; }
.alerta-botones { display: grid; gap: 10px; width: 100%; margin-top: 10px; }
.alerta-botones .btn { min-height: 54px; font-size: 16px; }
.alerta-botones .btn-alerta { background: #fff; color: #9b0f16; border-color: #fff; }
html.con-alerta body { overflow: hidden; }

.parar-flotante { position: fixed; left: 50%; bottom: calc(var(--nav-alto) + 30px + var(--seg-bot)); z-index: 45; transform: translateX(-50%); animation: entrar 0.3s var(--ease); }
html[data-vista="estancia"] .parar-flotante { bottom: calc(var(--nav-alto) + 104px + var(--seg-bot)); }
.parar-btn { position: relative; display: flex; align-items: center; gap: 10px; min-height: 52px; padding: 6px 18px 6px 8px; border-radius: 14px; color: #fff; background: linear-gradient(135deg, #343940, #1a1d22); border: 1px solid rgba(255, 255, 255, 0.25); box-shadow: 0 12px 30px -8px rgba(0, 0, 0, 0.9), inset 0 1px 0 rgba(255, 255, 255, 0.2); }
.parar-btn > .ic { width: 36px; height: 36px; padding: 9px; border-radius: 50%; color: #fff; background: var(--rojo); box-shadow: 0 0 14px rgba(214, 38, 47, 0.7); }
.parar-btn .giro { inset: 4px auto auto 4px; width: 44px; height: 44px; }
.parar-btn span { display: grid; text-align: left; line-height: 1.2; }
.parar-btn small { font-size: 12.5px; opacity: 0.85; }
html.con-parar .avisos { bottom: calc(var(--nav-alto) + 96px + var(--seg-bot)); }
html.con-parar[data-vista="estancia"] .avisos { bottom: calc(var(--nav-alto) + 172px + var(--seg-bot)); }

.sin-conexion { position: fixed; inset: 0; z-index: 105; display: grid; place-items: center; padding: 24px; text-align: center; background: radial-gradient(500px 360px at 50% 30%, rgba(242, 181, 68, 0.1), transparent 70%), #060708; }
.sc-centro { width: min(380px, 100%); display: grid; justify-items: center; gap: 12px; }
.sc-reactor { position: relative; width: 120px; height: 120px; margin-bottom: 10px; opacity: 0.9; }
.sc-radar { position: absolute; inset: -10px; border-radius: 50%; background: conic-gradient(from 0deg, rgba(242, 181, 68, 0.4), transparent 25%); animation: girar 2.4s linear infinite; -webkit-mask: radial-gradient(circle, transparent 58%, #000 60%); mask: radial-gradient(circle, transparent 58%, #000 60%); }
.sc-centro h1 { font-weight: 600; font-size: 26px; }
.sc-centro p:not(.eyebrow) { color: var(--texto-2); font-size: 15px; }
.sc-centro .btn { margin-top: 10px; }
.sc-centro .btn .giro { inset: 6px auto auto 6px; width: 34px; height: 34px; }

/* Huevo de pascua: barrido de diagnóstico */
html.diagnostico body::after { opacity: 1; background: linear-gradient(180deg, transparent 0, rgba(111, 223, 255, 0) 45%, rgba(111, 223, 255, 0.35) 50%, transparent 52%); background-size: 100% 200%; -webkit-mask-image: none; mask-image: none; animation: escaner 2.4s var(--ease); z-index: 200; }
@keyframes escaner { from { background-position: 0 100%; } to { background-position: 0 -100%; } }

/* ---------- Móvil ---------- */
@media (max-width: 599px) {
  .maestro { min-height: 82px; padding: 12px 14px 12px 12px; gap: 12px; }
  .maestro-txt small { font-size: 13px; }
  .maestro-pista { padding: 0 9px; }
  .escena-txt small { font-size: 12px; }
}
@media (max-width: 370px) {
  :root { --d: min(230px, 62vw); }
  .ndato-valor { font-size: 21px; }
  .maestro-pista { display: none; }
  .mando-btn { min-width: 52px; }
  .pc-btn { font-size: 13.5px; padding: 6px 6px; gap: 6px; }
  .saludo-titulo { font-size: 27px; }
}

/* =====================================================================
   Pantallas grandes
   ===================================================================== */
@media (min-width: 600px) {
  :root { --d: 280px; }
  .estancias { grid-template-columns: repeat(3, 1fr); }
  .luces { grid-template-columns: repeat(3, 1fr); }
  .modos-casa { grid-template-columns: repeat(4, 1fr); }
  .zonas-riego { grid-template-columns: 1fr 1fr; }
  .zonas-riego::before { display: none; }
  .chips { flex-wrap: wrap; overflow: visible; margin: 0; padding: 0; -webkit-mask-image: none; mask-image: none; }
  .saludo-titulo { font-size: 38px; }
  .ndato-valor { font-size: 30px; }
  .ndato { max-width: 40%; }
  .hoja-panel { left: 50%; right: auto; bottom: 50%; width: min(540px, calc(100% - 40px)); border-radius: 18px; border: 1px solid var(--borde-2); transform: translate(-50%, 54%) scale(0.98); opacity: 0; transition: transform 0.3s var(--ease), opacity 0.25s; }
  .hoja.abierta .hoja-panel { transform: translate(-50%, 50%); opacity: 1; }
  .hoja-asa { display: none; }
  .mando { left: 50%; right: auto; transform: translateX(-50%); animation: none; }
  .tarjetas-p { grid-template-columns: repeat(3, 1fr); }
  .foco-panel { inset: auto; left: 50%; top: 50%; width: min(520px, calc(100% - 40px)); max-height: calc(100% - 40px); margin: 0; translate: -50% -50%; border-radius: 18px; border: 1px solid var(--borde-2); box-shadow: 0 40px 100px -30px rgba(0, 0, 0, 0.95); padding: 20px 22px 22px; }
}

@media (min-width: 900px) {
  :root { --nav-alto: 0px; --d: 300px; }
  .app { display: grid; grid-template-columns: 236px minmax(0, 1fr); }
  .pestanas, .barra { display: none; }
  .aviso-enlace, .banda-alerta { top: 0; }
  .riel {
    position: sticky; top: 0; height: 100vh; height: 100dvh; display: flex; flex-direction: column; gap: 22px;
    padding: 22px 14px 18px; border-right: 1px solid rgba(255, 255, 255, 0.06);
    background: linear-gradient(180deg, rgba(13, 15, 18, 0.72), rgba(7, 8, 10, 0.4));
  }
  .riel-marca { display: flex; align-items: center; gap: 12px; padding: 4px 10px 6px; min-height: 44px; }
  .riel-reactor { width: 38px; height: 38px; }
  .riel-nav { display: grid; gap: 4px; }
  .riel-item { position: relative; display: flex; align-items: center; gap: 12px; min-height: 46px; padding: 0 12px; border-radius: 10px; color: var(--texto-2); font-weight: 600; font-size: 15px; transition: background 0.2s, color 0.2s; }
  .riel-item:hover { background: rgba(255, 255, 255, 0.04); color: var(--texto); }
  .riel-item.activa { color: var(--texto); background: linear-gradient(90deg, rgba(232, 176, 74, 0.1), rgba(255, 255, 255, 0.015)); box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.05); }
  .riel-item.activa .ic { color: var(--oro-claro); }
  .riel-item.activa::before { content: ''; position: absolute; left: -14px; top: 12px; bottom: 12px; width: 3px; background: var(--oro); box-shadow: 0 0 12px var(--oro); }
  .riel-item .pronto { position: static; margin-left: auto; padding: 1px 7px; }
  .riel-item .insignia-num { position: static; margin-left: auto; }
  .riel-pie { margin-top: auto; display: grid; gap: 8px; }
  .riel-estado { display: flex; align-items: center; gap: 10px; padding: 12px; border-radius: 12px; background: rgba(255, 255, 255, 0.03); border: 1px solid var(--borde); }
  .riel-estado span { display: grid; line-height: 1.3; }
  .riel-estado b { font-size: 13.5px; font-weight: 600; }
  .riel-estado small { font-size: 12px; color: var(--texto-3); }
  .riel-boton { display: flex; align-items: center; gap: 10px; min-height: 44px; padding: 0 12px; border-radius: 10px; font-size: 14px; color: var(--texto-2); }
  .riel-boton:hover { background: rgba(255, 255, 255, 0.04); }
  .riel-jarvis { margin-top: 10px; color: var(--cian); border: 1px solid rgba(111, 223, 255, 0.3); }
  .vista { padding: 30px 40px 60px; }
  .avisos { bottom: 24px; }
  .parar-flotante { bottom: 24px; }
  /* En escritorio el mando de la estancia va arriba, pegado bajo el título, y acompaña al desplazarse. */
  .pantalla-estancia .cab-estancia { order: -2; }
  .mando { order: -1; position: sticky; top: 14px; left: auto; right: auto; bottom: auto; transform: none; justify-self: start; animation: none; }
  html[data-vista="estancia"] .vista { padding-bottom: 60px; }
  html[data-vista="estancia"] .avisos { bottom: 24px; }
  html[data-vista="estancia"] .parar-flotante { bottom: 24px; }
  .chips { gap: 10px; }
  .dia { top: 0; }
  .termos-lista { grid-template-columns: repeat(auto-fill, minmax(330px, 1fr)); }
  .jarvis { --jx: 50%; --jy: 50%; }
}

@media (min-width: 1200px) {
  .app { grid-template-columns: 236px minmax(0, 1fr) 380px; }
  .jarvis {
    position: sticky; top: 0; height: 100vh; height: 100dvh; inset: auto; z-index: 5;
    visibility: visible; clip-path: none; transition: none;
    padding: 22px 20px 18px; border-left: 1px solid rgba(255, 255, 255, 0.06);
    background: radial-gradient(420px 320px at 50% 14%, rgba(111, 223, 255, calc(0.08 * var(--glow))), transparent 70%), linear-gradient(180deg, rgba(13, 15, 18, 0.78), rgba(7, 8, 10, 0.56));
  }
  .jarvis-cerrar { display: none; }
  .jarvis-reactor { width: 148px; height: 148px; }
  .jarvis.con-charla .jarvis-reactor { width: 108px; height: 108px; }
    .directo { display: grid; gap: 8px; margin-top: 14px; padding-top: 14px; border-top: 1px solid rgba(255, 255, 255, 0.06); }
  .directo .eyebrow { color: var(--texto-3); }
  .directo-lista { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
  .directo-fila { display: grid; grid-template-columns: 44px 1fr; gap: 8px; font-size: 13px; color: var(--texto-2); line-height: 1.35; }
  .directo-fila time { font-family: var(--f-mono); font-size: 12.5px; color: var(--texto-3); }
  .directo-fila b { color: var(--texto); font-weight: 600; }
  .directo-fila.vacio { display: block; color: var(--texto-3); }
  .vista { padding: 30px 36px 60px; }
}
@media (min-width: 1200px) and (max-height: 760px) { .directo { display: none; } }

/* ---------- Batería: con la app escondida, nada se mueve ---------- */
html.dormida *, html.dormida *::before, html.dormida *::after { animation-play-state: paused !important; }

/* ---------- Movimiento reducido ---------- */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.001ms !important; animation-iteration-count: 1 !important; transition-duration: 0.12s !important; scroll-behavior: auto !important; }
  .lona { transition: none !important; }
  .mantener.cargando .relleno { transition: transform 0.95s linear !important; }
  .maestro.cargando .maestro-progreso circle { transition: stroke-dasharray 0.95s linear !important; }
  .giro-a, .giro-b { animation: none !important; }
  .giro-a circle { stroke-dasharray: 70 30; }
  .jarvis { transition: visibility 0s 0.12s !important; }
  .jarvis.abierto { transition: visibility 0s !important; }
}
