/* Casa · tema oscuro con cristal y renders 3D, en la línea de Apple Casa y Google Home */
:root {
  --bg0: #07090d;
  --glass: rgba(24, 26, 32, .58);
  --glass2: rgba(40, 43, 52, .62);
  --glass3: rgba(58, 62, 74, .7);
  --edge: rgba(255, 255, 255, .07);
  --edge2: rgba(255, 255, 255, .14);
  --tx: #f3f4f6;
  --tx2: rgba(236, 239, 245, .66);
  --tx3: rgba(236, 239, 245, .42);
  --pri: #8ab4ff;
  --on-pri: #0a1a33;
  --warm: #ffb86b;
  --ok: #5fd68a;
  --warn: #ffd166;
  --err: #ff8a80;
  --tile-on: #f5f6f8;
  --tile-on-tx: #111318;
  --r: 24px;
  --blur: blur(26px) saturate(150%);
  --font: Inter, "SF Pro Display", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --shadow: 0 10px 30px rgba(0, 0, 0, .35);
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; color: var(--tx); font-family: var(--font); font-size: 15px; letter-spacing: -.005em; }
body { background: var(--bg0); min-height: 100vh; }
button, input, select { font: inherit; color: inherit; letter-spacing: inherit; }
button { cursor: pointer; border: 0; background: none; }
.ms { font-family: "Material Symbols Rounded"; font-weight: 400; font-style: normal; font-size: 24px; line-height: 1;
      letter-spacing: normal; text-transform: none; white-space: nowrap; direction: ltr; user-select: none;
      font-variation-settings: "FILL" 0, "wght" 400, "GRAD" 0, "opsz" 24; display: inline-block; }
.ms.fill { font-variation-settings: "FILL" 1, "wght" 400, "GRAD" 0, "opsz" 24; }

/* ---------- fondo ambiental: la foto de la casa o de la habitación, desenfocada ---------- */
.bg { position: fixed; inset: -60px; z-index: -2; background: #0b1320 center / cover no-repeat;
      filter: blur(48px) saturate(150%) brightness(.5); transform: scale(1.08); transition: background-image .8s ease; }
body::before { content: ""; position: fixed; inset: 0; z-index: -1; pointer-events: none;
  background: radial-gradient(1200px 600px at 70% -10%, rgba(138, 180, 255, .10), transparent 60%),
              linear-gradient(180deg, rgba(7, 9, 13, .35) 0%, rgba(7, 9, 13, .82) 55%, rgba(7, 9, 13, .94) 100%); }

/* ---------- navegación ---------- */
.rail { position: fixed; z-index: 20; display: flex; background: rgba(14, 16, 21, .62); backdrop-filter: var(--blur); -webkit-backdrop-filter: var(--blur); }
.nav-item { display: flex; flex-direction: column; align-items: center; gap: 4px; color: var(--tx3); font-size: 11.5px; font-weight: 600; padding: 10px 0 14px; flex: 1; transition: color .2s; }
.nav-pill { position: relative; width: 60px; height: 32px; border-radius: 16px; display: grid; place-items: center; transition: background .25s; }
.nav-item:hover { color: var(--tx2); }
.nav-item.on { color: var(--tx); }
.nav-item.on .nav-pill { background: rgba(138, 180, 255, .18); color: #cfe0ff; }
.nav-item.on .nav-pill .ms { font-variation-settings: "FILL" 1, "wght" 500, "GRAD" 0, "opsz" 24; }
.badge { position: absolute; top: -5px; right: 4px; min-width: 17px; height: 17px; border-radius: 9px; background: #ff6b5e; color: #fff;
         font-size: 10.5px; font-style: normal; font-weight: 700; display: none; place-items: center; padding: 0 4px; box-shadow: 0 0 0 2px #0e1015; }
.badge.show { display: grid; }
.rail-logo { display: none; }
@media (max-width: 899px) {
  .rail { left: 10px; right: 10px; bottom: 10px; border-radius: 26px; padding-bottom: env(safe-area-inset-bottom); border: 1px solid var(--edge); box-shadow: var(--shadow); }
  .app { padding-bottom: 110px; }
}
@media (min-width: 900px) {
  .rail { top: 0; bottom: 0; left: 0; width: 92px; flex-direction: column; padding-top: 18px; gap: 6px; border-right: 1px solid var(--edge); }
  .nav-item { flex: 0; padding: 8px 0; }
  .nav-pill { width: 56px; }
  .rail-logo { display: grid; place-items: center; width: 48px; height: 48px; margin: 0 auto 22px; border-radius: 16px;
               background: linear-gradient(140deg, #8ab4ff, #b693ff); color: #0a1430; box-shadow: 0 8px 24px rgba(138, 180, 255, .35); }
  .rail-logo .ms { font-size: 28px; }
  .app { margin-left: 92px; }
}

/* ---------- estructura ---------- */
.app { max-width: 1340px; padding: 0 18px; }
@media (min-width: 900px) { .app { padding: 0 44px; } }
.topbar { display: flex; justify-content: space-between; align-items: flex-end; padding: 34px 0 6px; }
body[data-pagina="home"] .topbar { display: none; }
.saludo { color: var(--tx2); font-size: 14px; }
h1 { margin: 4px 0 0; font-size: 38px; font-weight: 700; letter-spacing: -.03em; }
h2 { font-size: 21px; font-weight: 700; letter-spacing: -.02em; margin: 34px 0 14px; display: flex; align-items: center; gap: 12px; }
h2 .count { color: var(--tx3); font-size: 15px; font-weight: 600; }
.conn { width: 10px; height: 10px; border-radius: 50%; background: var(--tx3); display: inline-block; margin-bottom: 14px; }
.conn.ok { background: var(--ok); box-shadow: 0 0 0 4px rgba(95, 214, 138, .15); }
.offline-banner { display: none; background: rgba(92, 67, 0, .8); color: #ffdf99; border-radius: 14px; padding: 10px 14px; margin: 10px 0; font-size: 14px; backdrop-filter: var(--blur); }
.offline-banner.show { display: block; }
main { padding-top: 6px; }
body[data-pagina="home"] main { padding-top: 22px; }

/* ---------- portada ---------- */
.hero { position: relative; overflow: hidden; border-radius: 32px; min-height: 320px; padding: 30px 32px 22px; display: flex; flex-direction: column; justify-content: space-between;
        background: #0b1320 url("/static/img/room/hero.jpg") right center / cover no-repeat; border: 1px solid var(--edge); box-shadow: var(--shadow); }
.hero::before { content: ""; position: absolute; inset: 0; pointer-events: none;
  background: linear-gradient(90deg, rgba(8, 14, 26, .94) 0%, rgba(8, 14, 26, .78) 32%, rgba(8, 14, 26, .15) 70%, transparent 100%),
              linear-gradient(0deg, rgba(7, 9, 13, .75) 0%, transparent 45%); }
.hero > * { position: relative; }
.hero-hi { color: var(--tx2); font-size: 16px; font-weight: 500; }
.hero-time { font-size: 76px; font-weight: 250; letter-spacing: -.045em; line-height: 1; margin: 6px 0 6px; font-variant-numeric: tabular-nums; }
.hero-date { color: var(--tx2); font-size: 16px; }
.hero-date::first-letter, .saludo::first-letter { text-transform: uppercase; }
.hero-wx { display: inline-flex; align-items: center; gap: 8px; margin-top: 14px; font-size: 14.5px; color: var(--tx2); min-height: 22px; }
.hero-wx .ms { font-size: 22px; color: var(--warm); }
.hero-wx b { color: var(--tx); font-weight: 650; font-size: 16px; }
.hero-pills { display: flex; gap: 10px; overflow-x: auto; margin-top: 22px; scrollbar-width: none; padding-bottom: 2px; }
.hero-pills::-webkit-scrollbar { display: none; }
@media (max-width: 699px) {
  .hero { min-height: 300px; padding: 22px 20px 18px; border-radius: 28px; background-position: 70% center; }
  .hero { background-size: auto 78%; background-position: right -70px top 18px; }
  .hero::before { background: linear-gradient(90deg, rgba(8, 14, 26, .96) 0%, rgba(8, 14, 26, .8) 55%, rgba(8, 14, 26, .35) 100%),
                              linear-gradient(0deg, rgba(7, 9, 13, .85) 0%, transparent 50%); }
  .hero-time { font-size: 60px; }
}
.sum { flex: none; display: flex; align-items: center; gap: 11px; text-align: left; padding: 11px 16px 11px 12px; border-radius: 20px;
       background: rgba(20, 23, 30, .55); border: 1px solid var(--edge); backdrop-filter: var(--blur); -webkit-backdrop-filter: var(--blur); transition: background .2s, transform .15s; }
.sum:hover { background: rgba(40, 44, 54, .65); }
.sum:active { transform: scale(.97); }
.sum .ms { font-size: 22px; color: var(--pri); width: 36px; height: 36px; border-radius: 12px; display: grid; place-items: center; background: rgba(138, 180, 255, .14); }
.sum b { display: block; font-weight: 650; font-size: 14px; }
.sum small { color: var(--tx2); font-size: 12.5px; white-space: nowrap; }
.sum.warn .ms { color: var(--warn); background: rgba(255, 209, 102, .14); }

/* ---------- ahora mismo ---------- */
.live { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 12px; }
.live-card { display: flex; align-items: center; gap: 14px; text-align: left; padding: 14px; border-radius: var(--r); background: var(--glass);
             border: 1px solid var(--edge); backdrop-filter: var(--blur); -webkit-backdrop-filter: var(--blur); transition: transform .15s, background .2s; }
.live-card:hover { background: var(--glass2); }
.live-card .live-art, .live-card .live-cover { width: 64px; height: 64px; border-radius: 18px; flex: none; object-fit: cover; }
.live-card .live-art { display: grid; place-items: center; background: radial-gradient(circle at 50% 40%, rgba(138, 180, 255, .22), transparent 70%); }
.live-card .live-art .art { width: 58px; height: 58px; }
.live-card .t { min-width: 0; flex: 1; }
.live-card b { display: block; font-size: 15.5px; font-weight: 650; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.live-card small { display: block; color: var(--tx2); font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.eyebrow { text-transform: uppercase; letter-spacing: .08em; font-size: 10.5px !important; font-weight: 700; color: var(--tx3) !important; }
.prog { width: 100%; max-width: 380px; height: 6px; border-radius: 3px; background: rgba(255, 255, 255, .1); overflow: hidden; margin-top: 8px; }
.prog i { display: block; height: 100%; background: linear-gradient(90deg, #8ab4ff, #b693ff); border-radius: 3px; transition: width .6s; }

/* ---------- escenas ---------- */
.scenes, .rooms { display: flex; gap: 12px; overflow-x: auto; scrollbar-width: none; padding: 4px 2px 10px; margin: 0 -2px; scroll-snap-type: x proximity; }
.scenes::-webkit-scrollbar, .rooms::-webkit-scrollbar { display: none; }
.scene-card { position: relative; flex: none; width: 178px; height: 158px; border-radius: 26px; padding: 14px 16px; text-align: left; overflow: hidden;
              display: flex; flex-direction: column; justify-content: flex-end; scroll-snap-align: start; border: 1px solid var(--edge2);
              box-shadow: var(--shadow); transition: transform .2s cubic-bezier(.2, 0, 0, 1), box-shadow .2s; }
.scene-card:hover { transform: translateY(-3px); box-shadow: 0 16px 36px rgba(0, 0, 0, .45); }
.scene-card:active { transform: scale(.97); }
.scene-card .art { position: absolute; top: 6px; right: 4px; width: 92px; height: 92px; }
.scene-card .art img { filter: drop-shadow(0 10px 16px rgba(0, 0, 0, .45)); }
.scene-card .art .ms { font-size: 44px; color: rgba(255, 255, 255, .9); }
.scene-card b { font-size: 16.5px; font-weight: 700; letter-spacing: -.01em; }
.scene-card small { color: rgba(255, 255, 255, .72); font-size: 12px; margin-top: 3px; }
.sc-cine { background: linear-gradient(150deg, #6b1d2c, #c2512f 120%); }
.sc-noches { background: linear-gradient(150deg, #1d1b52, #6a46b8 120%); }
.sc-apagado { background: linear-gradient(150deg, #1b2029, #47566a 120%); }
.sc-llegar { background: linear-gradient(150deg, #0d3a33, #2f9a74 120%); }
.scene-card.fired { animation: disparo .7s ease; }
@keyframes disparo { 0% { box-shadow: 0 0 0 0 rgba(255, 255, 255, .55); } 100% { box-shadow: 0 0 0 22px rgba(255, 255, 255, 0); } }

/* ---------- habitaciones ---------- */
.room-card { position: relative; flex: none; width: 268px; height: 168px; border-radius: 26px; overflow: hidden; text-align: left; padding: 16px 18px;
             display: flex; flex-direction: column; justify-content: flex-end; scroll-snap-align: start; background: #141820 var(--img) center / cover no-repeat;
             border: 1px solid var(--edge2); box-shadow: var(--shadow); transition: transform .2s cubic-bezier(.2, 0, 0, 1); }
.room-card::before { content: ""; position: absolute; inset: 0; background: linear-gradient(0deg, rgba(5, 7, 10, .88) 0%, rgba(5, 7, 10, .25) 55%, rgba(5, 7, 10, .05) 100%); }
.room-card > * { position: relative; }
.room-card:hover { transform: translateY(-3px); }
.room-card b { font-size: 18px; font-weight: 700; letter-spacing: -.015em; }
.room-card small { color: rgba(255, 255, 255, .75); font-size: 12.5px; margin-top: 2px; }
.room-card.sel { outline: 2.5px solid var(--pri); outline-offset: 2px; }

/* ---------- chips ---------- */
.chips { display: flex; gap: 8px; overflow-x: auto; padding: 2px 0 6px; scrollbar-width: none; }
.chips::-webkit-scrollbar { display: none; }
.chip { flex: none; display: inline-flex; align-items: center; gap: 7px; height: 36px; padding: 0 15px 0 12px; border-radius: 18px;
        background: rgba(30, 33, 41, .55); border: 1px solid var(--edge); color: var(--tx2); font-size: 13.5px; font-weight: 600;
        white-space: nowrap; backdrop-filter: var(--blur); -webkit-backdrop-filter: var(--blur); transition: background .2s, color .2s; }
.chip:hover { color: var(--tx); background: rgba(50, 54, 66, .6); }
.chip .ms { font-size: 18px; }
.chip.on { background: var(--tile-on); color: var(--tile-on-tx); border-color: transparent; }
.chip.warn { color: var(--warn); }
h2 .chip { height: 30px; font-size: 12.5px; }
h2 .seg { font-size: 13px; letter-spacing: 0; }
.seg { display: inline-flex; border-radius: 18px; overflow: hidden; margin-left: auto; background: rgba(30, 33, 41, .55); border: 1px solid var(--edge); backdrop-filter: var(--blur); }
.seg button { padding: 7px 15px; font-size: 12.5px; color: var(--tx2); font-weight: 600; transition: background .2s; }
.seg button.on { background: var(--tile-on); color: var(--tile-on-tx); border-radius: 16px; }
.toolbar { display: flex; align-items: center; gap: 12px; margin: 6px 0 2px; }

/* ---------- baldosas ---------- */
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; }
@media (min-width: 600px) { .grid { grid-template-columns: repeat(auto-fill, minmax(214px, 1fr)); gap: 12px; } }
.tile { position: relative; overflow: hidden; display: flex; align-items: center; gap: 12px; min-height: 80px; padding: 12px 34px 12px 12px;
        background: var(--glass); border: 1px solid var(--edge); border-radius: var(--r); text-align: left; user-select: none; touch-action: pan-y;
        backdrop-filter: var(--blur); -webkit-backdrop-filter: var(--blur);
        transition: background .3s, color .3s, transform .12s, box-shadow .3s; }
.tile:hover { background: var(--glass2); }
.tile:active { transform: scale(.975); }
.tile .ico { flex: none; width: 52px; height: 52px; display: grid; place-items: center; position: relative; z-index: 1; }
.tile .txt { min-width: 0; position: relative; z-index: 1; }
.tile .nm { font-size: 15px; font-weight: 650; letter-spacing: -.01em; line-height: 1.25; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.tile .st { font-size: 12.5px; color: var(--tx2); margin-top: 2px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tile .more { position: absolute; right: 6px; top: 50%; transform: translateY(-50%); width: 30px; height: 30px; border-radius: 50%; display: grid; place-items: center; color: var(--tx3); z-index: 2; opacity: .7; }
.tile .more:hover { background: rgba(255, 255, 255, .1); opacity: 1; }
.tile .fillbar { position: absolute; left: 0; top: 0; bottom: 0; pointer-events: none; transition: width .15s;
                 background: linear-gradient(140deg, color-mix(in oklab, var(--glow, #ffcf70) 30%, #fff), #fafaf8 75%); }
.tile.off .fillbar { display: none; }
.tile.offline { opacity: .45; }
.tile.offline .art img { filter: grayscale(1); }
.tile.setup { background: rgba(20, 22, 28, .35); border: 1.5px dashed rgba(255, 255, 255, .18); }
.tile.setup .st { color: var(--pri); font-weight: 600; }
.tile.dragging, .tile.dragging .fillbar { transition: none; }
/* encendida: baldosa clara, como en Apple Casa */
.tile.on { background: var(--tile-on); color: var(--tile-on-tx); border-color: transparent; box-shadow: 0 8px 26px rgba(0, 0, 0, .28); }
.tile.on .st { color: rgba(17, 19, 24, .6); }
.tile.on .more { color: rgba(17, 19, 24, .5); }
.tile.on.k-light { background: linear-gradient(140deg, color-mix(in oklab, var(--glow, #ffcf70) 30%, #fff), #fafaf8 75%);
                   box-shadow: 0 10px 34px color-mix(in oklab, var(--glow, #ffcf70) 30%, transparent); }
.tile.on.dim { background: rgba(245, 246, 248, .42); }
.tile.on .art img { filter: drop-shadow(0 6px 14px rgba(0, 0, 0, .25)); }
.tile.on.k-light .art img { filter: drop-shadow(0 0 16px var(--glow, #ffcf70)); }
.tile.on.k-alarm.alarma { background: #ffdad6; color: #410002; animation: alarma 1s infinite alternate; }
@keyframes alarma { to { box-shadow: 0 0 0 6px rgba(255, 90, 80, .45); } }
.tile.busy::after { content: ""; position: absolute; top: 12px; right: 12px; width: 8px; height: 8px; border-radius: 50%; background: #3a7bff; animation: latido 1.4s infinite; }
@keyframes latido { 0% { box-shadow: 0 0 0 0 rgba(58, 123, 255, .5); } 50% { box-shadow: 0 0 0 6px rgba(58, 123, 255, 0); opacity: .5; } }
.empty { color: var(--tx3); padding: 36px 0; text-align: center; }

/* render 3D con icono de reserva debajo */
.art { position: relative; display: grid; place-items: center; width: 100%; height: 100%; }
.art img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: contain; transition: filter .3s, transform .3s; }
.art:has(img) > .ms { opacity: 0; }
.tile.off .art img { filter: saturate(.75) brightness(.85); }
.tile:hover .art img { transform: scale(1.06); }
.tile .art .ms { font-size: 26px; color: var(--tx2); }
.tile.on .art .ms { color: #c27a00; }

/* ---------- hoja inferior / diálogo ---------- */
.scrim { position: fixed; inset: 0; background: rgba(0, 0, 0, .55); backdrop-filter: blur(4px); opacity: 0; pointer-events: none; transition: opacity .25s; z-index: 30; }
.scrim.show { opacity: 1; pointer-events: auto; }
.sheet { position: fixed; z-index: 31; background: rgba(18, 20, 26, .88); color: var(--tx); overflow-y: auto; border: 1px solid var(--edge2);
         backdrop-filter: blur(34px) saturate(160%); -webkit-backdrop-filter: blur(34px) saturate(160%); box-shadow: 0 30px 80px rgba(0, 0, 0, .6);
         transition: transform .32s cubic-bezier(.2, 0, 0, 1), opacity .22s; }
.sheet-handle { width: 36px; height: 5px; border-radius: 3px; background: rgba(255, 255, 255, .25); margin: 10px auto 0; }
@media (max-width: 699px) {
  .sheet { left: 0; right: 0; bottom: 0; max-height: 93vh; border-radius: 30px 30px 0 0; transform: translateY(105%); padding-bottom: env(safe-area-inset-bottom); }
  .sheet.show { transform: none; }
}
@media (min-width: 700px) {
  .sheet { left: 50%; top: 50%; width: 540px; max-height: 90vh; border-radius: 32px; transform: translate(-50%, -46%) scale(.98); opacity: 0; pointer-events: none; }
  .sheet.show { transform: translate(-50%, -50%); opacity: 1; pointer-events: auto; }
  .sheet-handle { display: none; }
}
.sh-hero { position: relative; display: flex; flex-direction: column; align-items: center; text-align: center; padding: 22px 24px 6px; }
.sh-hero::before { content: ""; position: absolute; left: 50%; top: 18px; width: 240px; height: 200px; transform: translateX(-50%); border-radius: 50%;
                   background: radial-gradient(closest-side, rgba(138, 180, 255, .22), transparent); pointer-events: none; transition: background .4s; }
.sh-hero.on::before { background: radial-gradient(closest-side, color-mix(in oklab, var(--glow, #8ab4ff) 45%, transparent), transparent); }
.sh-art { width: 150px; height: 150px; position: relative; }
.sh-art .art img { filter: drop-shadow(0 16px 26px rgba(0, 0, 0, .5)); }
.sh-art .art .ms { font-size: 64px; color: var(--tx2); }
.sh-hero .t { position: relative; margin-top: 8px; }
.sh-hero .t b { display: block; font-size: 25px; font-weight: 700; letter-spacing: -.025em; margin: 2px 0; }
.sh-hero .t small { color: var(--tx2); font-size: 14px; }
.sh-hero .close { position: absolute; top: 14px; right: 14px; z-index: 2; background: rgba(255, 255, 255, .08); }
.sh-head { display: flex; align-items: center; gap: 14px; padding: 20px 22px 8px; }
.sh-head .ico { width: 56px; height: 56px; flex: none; }
.sh-head .t { flex: 1; min-width: 0; }
.sh-head .t b { display: block; font-size: 20px; font-weight: 700; letter-spacing: -.02em; }
.sh-head .t small { color: var(--tx2); }
.icon-btn { width: 40px; height: 40px; border-radius: 50%; display: grid; place-items: center; color: var(--tx2); flex: none; transition: background .2s; }
.icon-btn:hover { background: rgba(255, 255, 255, .1); color: var(--tx); }
.sh-sec { padding: 6px 22px 22px; }
.sh-sec h3 { font-size: 12px; text-transform: uppercase; letter-spacing: .08em; color: var(--tx3); font-weight: 700; margin: 20px 0 10px; }
.controls { display: flex; flex-direction: column; align-items: center; gap: 18px; padding: 14px 22px 22px; }
.controls h3 { font-size: 12px !important; text-transform: uppercase; letter-spacing: .08em; color: var(--tx3) !important; font-weight: 700 !important; }

.power { width: 84px; height: 84px; border-radius: 50%; background: var(--glass3); display: grid; place-items: center; color: var(--tx); border: 1px solid var(--edge2); transition: background .25s, color .25s, transform .12s; }
.power:active { transform: scale(.94); }
.power .ms { font-size: 36px; }
.power.on { background: var(--tile-on); color: var(--tile-on-tx); box-shadow: 0 10px 30px rgba(255, 255, 255, .15); }
.bigstat { font-size: 40px; font-weight: 300; letter-spacing: -.03em; }
.bigstat small { font-size: 16px; color: var(--tx2); letter-spacing: 0; }
.kv { display: grid; grid-template-columns: auto 1fr; font-size: 14px; background: rgba(255, 255, 255, .04); border: 1px solid var(--edge); border-radius: 18px; overflow: hidden; }
.kv span { padding: 11px 14px; border-bottom: 1px solid var(--edge); }
.kv span:nth-last-child(-n+2) { border-bottom: 0; }
.kv span:nth-child(odd) { color: var(--tx2); }
.kv span:nth-child(even) { text-align: right; overflow-wrap: anywhere; font-weight: 550; }

/* brillo: deslizador grande vertical */
.vslider { position: relative; width: 136px; height: 300px; border-radius: 42px; background: rgba(255, 255, 255, .08); border: 1px solid var(--edge2); overflow: hidden; touch-action: none; cursor: ns-resize; }
.vslider .f { position: absolute; left: 0; right: 0; bottom: 0; background: linear-gradient(0deg, #ffd27a, #fff3d6); transition: height .12s; }
.vslider .lbl { position: absolute; left: 0; right: 0; bottom: 22px; text-align: center; font-size: 22px; font-weight: 650; color: #2a1d00; }
.vslider.off .f { background: rgba(255, 255, 255, .18); }
.vslider.off .lbl { color: var(--tx); }

/* termostato */
.dial { position: relative; width: 250px; height: 250px; }
.dial svg { width: 100%; height: 100%; }
.dial .center { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; }
.dial .center .v { font-size: 58px; font-weight: 250; letter-spacing: -.04em; }
.dial .center small { color: var(--tx2); }
.steppers { display: flex; gap: 26px; }
.step { width: 64px; height: 64px; border-radius: 50%; background: var(--glass3); border: 1px solid var(--edge2); display: grid; place-items: center; }
.step:active { transform: scale(.94); }
.step .ms { font-size: 30px; }
.segbtns { display: flex; gap: 6px; padding: 4px; border-radius: 20px; background: rgba(255, 255, 255, .06); border: 1px solid var(--edge); }
.segbtns button { padding: 9px 16px; border-radius: 16px; color: var(--tx2); font-weight: 600; font-size: 13.5px; }
.segbtns button.on { background: var(--tile-on); color: var(--tile-on-tx); }

/* anillo de progreso de electrodomésticos */
.ring { position: relative; width: 210px; height: 210px; }
.ring svg { width: 100%; height: 100%; transform: rotate(-90deg); }
.ring circle { fill: none; stroke-width: 11; }
.ring .ring-bg { stroke: rgba(255, 255, 255, .08); }
.ring .ring-fg { stroke: #8ab4ff; stroke-linecap: round; transition: stroke-dashoffset .8s; filter: drop-shadow(0 0 8px rgba(138, 180, 255, .5)); }
.ring-c { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; }
.ring-c b { font-size: 54px; font-weight: 250; letter-spacing: -.04em; line-height: 1; }
.ring-c small { color: var(--tx2); margin-top: 4px; }

/* mando de la tele */
.remote { display: flex; flex-direction: column; align-items: center; gap: 18px; width: 100%; }
.dpad { position: relative; width: 216px; height: 216px; border-radius: 50%; background: rgba(255, 255, 255, .07); border: 1px solid var(--edge2); }
.dpad button { position: absolute; width: 64px; height: 64px; display: grid; place-items: center; color: var(--tx); border-radius: 50%; }
.dpad button:active { background: rgba(255, 255, 255, .12); }
.dpad .up { top: 4px; left: 76px; } .dpad .down { bottom: 4px; left: 76px; }
.dpad .left { left: 4px; top: 76px; } .dpad .right { right: 4px; top: 76px; }
.dpad .ok { left: 56px; top: 56px; width: 104px; height: 104px; background: var(--glass3); font-weight: 650; border: 1px solid var(--edge2); }
.row { display: flex; gap: 12px; align-items: center; justify-content: center; flex-wrap: wrap; }
.rbtn { width: 56px; height: 56px; border-radius: 50%; background: var(--glass3); border: 1px solid var(--edge); display: grid; place-items: center; transition: transform .12s; }
.rbtn:active { transform: scale(.93); }
.rbtn.on { background: var(--tile-on); color: var(--tile-on-tx); }
.volbar { display: flex; align-items: center; gap: 10px; width: 100%; max-width: 380px; color: var(--tx2); }
input[type=range] { flex: 1; accent-color: #f3f4f6; height: 28px; }
.apps { display: grid; grid-template-columns: repeat(auto-fill, minmax(96px, 1fr)); gap: 10px; width: 100%; }
.app-btn { display: flex; flex-direction: column; align-items: center; gap: 7px; padding: 12px 6px; border-radius: 18px; background: rgba(255, 255, 255, .05); border: 1px solid var(--edge); font-size: 12px; color: var(--tx2); }
.app-btn img, .app-btn .ab { width: 46px; height: 46px; border-radius: 13px; object-fit: cover; }
.app-btn .ab { display: grid; place-items: center; background: linear-gradient(140deg, #3a5bd9, #7b5be0); color: #fff; font-weight: 700; font-size: 18px; }
.app-btn.on { outline: 2px solid var(--pri); color: var(--tx); }
.app-btn span { max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* altavoces */
.np { display: flex; align-items: center; gap: 14px; width: 100%; max-width: 380px; background: rgba(255, 255, 255, .05); border: 1px solid var(--edge); border-radius: 22px; padding: 12px; }
.np img, .np .np-art { width: 68px; height: 68px; border-radius: 16px; object-fit: cover; flex: none; }
.np .np-art { display: grid; place-items: center; background: linear-gradient(140deg, #3b2a6b, #6a46b8); color: #e8def8; }
.np .t { min-width: 0; }
.np .t b { display: block; font-weight: 650; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.np .t small { color: var(--tx2); display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* color de las luces */
.swatch { width: 42px; height: 42px; border-radius: 50%; border: 2px solid rgba(255, 255, 255, .25); box-shadow: 0 4px 14px rgba(0, 0, 0, .35); transition: transform .12s; }
.swatch:active { transform: scale(.9); }
input.ct { accent-color: #ffd58a; background: linear-gradient(90deg, #ffb35c, #fff3e0, #cfe3ff); border-radius: 14px; height: 10px; }

/* formularios */
.field { display: flex; flex-direction: column; gap: 6px; margin-bottom: 14px; }
.field label { font-size: 12.5px; color: var(--tx2); font-weight: 600; }
.field input, .field select { background: rgba(255, 255, 255, .06); border: 1px solid var(--edge2); border-radius: 14px; padding: 12px 14px; outline: none; transition: border .2s, box-shadow .2s; }
.field input:focus, .field select:focus { border-color: var(--pri); box-shadow: 0 0 0 3px rgba(138, 180, 255, .2); }
.field select option { background: #1a1d24; }
.btn { display: inline-flex; align-items: center; gap: 8px; height: 42px; padding: 0 20px; border-radius: 21px; background: var(--tile-on); color: var(--tile-on-tx); font-weight: 650; font-size: 14px; transition: transform .12s, opacity .2s; }
.btn:active { transform: scale(.96); }
.btn.tonal { background: rgba(255, 255, 255, .1); color: var(--tx); border: 1px solid var(--edge2); }
.btn.text { background: transparent; color: var(--pri); padding: 0 12px; }
.btn[disabled] { opacity: .5; pointer-events: none; }
.btn .ms { font-size: 20px; }
.btns { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 6px; }
.help { margin: 0 0 14px; padding-left: 18px; color: var(--tx2); font-size: 13.5px; line-height: 1.55; }
.help li { margin-bottom: 4px; }
.result { margin-top: 14px; padding: 12px 14px; border-radius: 14px; background: rgba(255, 255, 255, .06); font-size: 14px; display: none; }
.result.show { display: block; }
.result.ok { background: rgba(32, 110, 60, .5); color: #c4eed0; }
.result.err { background: rgba(120, 25, 20, .55); color: #ffdad6; }
.qr { display: block; margin: 14px auto 4px; width: 240px; height: 240px; border-radius: 18px; background: #fff; padding: 8px; image-rendering: pixelated; }
.spin { width: 18px; height: 18px; border-radius: 50%; border: 2px solid currentColor; border-right-color: transparent; animation: girar .8s linear infinite; display: inline-block; vertical-align: -3px; margin-right: 8px; }
@keyframes girar { to { transform: rotate(360deg); } }
.switchrow { display: flex; align-items: center; justify-content: space-between; padding: 8px 0 12px; font-size: 14px; }
.switchrow .ms { font-size: 20px; vertical-align: -5px; margin-right: 6px; color: var(--tx2); }
.sw { width: 52px; height: 32px; border-radius: 16px; background: rgba(255, 255, 255, .14); position: relative; transition: .25s; flex: none; }
.sw::after { content: ""; position: absolute; width: 26px; height: 26px; border-radius: 50%; background: #fff; top: 3px; left: 3px; transition: .25s; box-shadow: 0 2px 6px rgba(0, 0, 0, .35); }
.sw.on { background: var(--ok); }
.sw.on::after { left: 23px; }

/* conexiones */
.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(330px, 1fr)); gap: 12px; align-items: start; }
.card { background: var(--glass); border: 1px solid var(--edge); border-radius: 26px; padding: 18px 20px; backdrop-filter: var(--blur); -webkit-backdrop-filter: var(--blur); }
.card-h { display: flex; align-items: center; gap: 14px; }
.card-h .ico { width: 56px; height: 56px; flex: none; border-radius: 18px; background: radial-gradient(circle at 50% 45%, rgba(138, 180, 255, .16), transparent 70%); }
.card-h .ico .ms, .sh-head .ico .ms { color: var(--pri); font-size: 28px; }
.card-h b { display: block; font-weight: 650; font-size: 16px; }
.card-h small { color: var(--tx2); font-size: 12.5px; }
.status { margin-left: auto; font-size: 11.5px; font-weight: 700; padding: 5px 10px; border-radius: 10px; white-space: nowrap; }
.status.ok { background: rgba(95, 214, 138, .15); color: #8ee8ad; }
.status.pending { background: rgba(255, 209, 102, .14); color: #ffd98a; }
.status.error { background: rgba(255, 138, 128, .16); color: #ffb4ab; }
.card .body { margin-top: 12px; }
.card .msg { color: var(--tx2); font-size: 13.5px; margin: 8px 0 0; }
.msg:empty { display: none; }

/* red */
.search { width: 100%; background: var(--glass); border: 1px solid var(--edge); border-radius: 22px; padding: 14px 20px 14px 50px; outline: none; font-size: 15px; backdrop-filter: var(--blur); }
.search:focus { border-color: var(--pri); }
.searchwrap { position: relative; margin: 12px 0 10px; }
.searchwrap .ms { position: absolute; left: 17px; top: 14px; color: var(--tx2); }
.list { background: var(--glass); border: 1px solid var(--edge); border-radius: var(--r); overflow: hidden; backdrop-filter: var(--blur); -webkit-backdrop-filter: var(--blur); }
.li { display: flex; align-items: center; gap: 14px; padding: 12px 18px; border-bottom: 1px solid var(--edge); text-align: left; width: 100%; transition: background .15s; }
.li:last-child { border-bottom: 0; }
.li:hover { background: rgba(255, 255, 255, .04); }
.li .ico { width: 40px; height: 40px; border-radius: 13px; background: rgba(255, 255, 255, .07); display: grid; place-items: center; color: var(--tx2); flex: none; }
.li .t { flex: 1; min-width: 0; }
.li .t b { display: block; font-weight: 600; font-size: 14.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.li .t small { color: var(--tx2); font-size: 12.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; display: block; }
.li .r { text-align: right; font-size: 12px; color: var(--tx3); flex: none; }
.dot { width: 8px; height: 8px; border-radius: 50%; display: inline-block; background: var(--tx3); margin-right: 6px; }
.dot.on { background: var(--ok); box-shadow: 0 0 0 3px rgba(95, 214, 138, .18); }
.people { display: flex; gap: 14px; overflow-x: auto; padding-bottom: 4px; }
.person { flex: none; display: flex; flex-direction: column; align-items: center; gap: 8px; width: 96px; text-align: center; font-size: 13px; }
.person .av { width: 68px; height: 68px; border-radius: 50%; display: grid; place-items: center; background: var(--glass2); border: 1px solid var(--edge2); font-size: 24px; font-weight: 650; position: relative; }
.person.in .av { background: linear-gradient(140deg, #8ab4ff, #b693ff); color: #0a1430; }
.person .av i { position: absolute; right: 2px; bottom: 2px; width: 15px; height: 15px; border-radius: 50%; border: 2.5px solid #12141a; background: var(--tx3); }
.person.in .av i { background: var(--ok); }
.person small { color: var(--tx2); font-size: 12px; }
.roomchips { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 12px; }
.roomchips .chip .x { font-size: 16px; margin-left: 2px; opacity: .7; }

.toast { position: fixed; left: 50%; bottom: 112px; transform: translate(-50%, 20px); background: rgba(245, 246, 248, .95); color: #111318; padding: 13px 20px; border-radius: 18px;
         font-size: 14px; font-weight: 550; opacity: 0; pointer-events: none; transition: .3s cubic-bezier(.2, 0, 0, 1); z-index: 50; max-width: 90vw; box-shadow: 0 12px 30px rgba(0, 0, 0, .45); backdrop-filter: var(--blur); }
.toast.show { opacity: 1; transform: translate(-50%, 0); }
@media (min-width: 900px) { .toast { bottom: 34px; } }

/* entrada suave al cambiar de pestaña */
main.entrar > * { animation: entra .35s cubic-bezier(.2, 0, 0, 1) both; }
@keyframes entra { from { opacity: 0; transform: translateY(6px); } }
@media (max-width: 599px) {
  .tile { flex-direction: column; align-items: flex-start; gap: 8px; min-height: 120px; padding: 14px 14px 12px; }
  .tile .ico { width: 54px; height: 54px; }
  .tile .more { top: 10px; right: 8px; transform: none; }
  .tile .txt { width: 100%; }
  .tile .nm { white-space: normal; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; line-height: 1.25; }
  .scene-card { width: 160px; height: 150px; }
  .room-card { width: 230px; height: 150px; }
}

/* precio de la luz: una serie, columnas finas, acento solo en las horas baratas */
.lz { padding: 18px 20px 14px; }
.lz-head { display: flex; justify-content: space-between; gap: 16px; align-items: flex-start; }
.lz-head b { display: block; font-size: 22px; font-weight: 700; letter-spacing: -.02em; margin: 2px 0; }
.lz-head small { color: var(--tx2); font-size: 13px; }
.lz-man { text-align: right; flex: none; }
.lz-man b { font-size: 20px; }
.lz-wrap { position: relative; margin-top: 10px; }
.lz-plot { position: relative; height: 170px; margin-top: 34px; border-bottom: 1px solid rgba(255, 255, 255, .12); }
.lz-cols { display: flex; align-items: flex-end; height: 100%; }
.lz-col { flex: 1; height: 100%; display: flex; align-items: flex-end; justify-content: center; position: relative; cursor: crosshair; }
.lz-col i { display: block; width: min(22px, calc(100% - 3px)); background: #6b7280; border-radius: 4px 4px 0 0; transition: height .5s, opacity .2s; }
.lz-col.barata i { background: #3987e5; }
.lz-col.pasada i { opacity: .35; }
.lz-col:hover i { opacity: 1; filter: brightness(1.25); }
.lz-col.ahora::after { content: ""; position: absolute; bottom: -11px; left: 50%; transform: translateX(-50%); border: 5px solid transparent; border-bottom: 6px solid var(--tx); }
.lz-lbl { position: absolute; transform: translateX(-50%); white-space: nowrap; font-size: 12.5px; font-weight: 650; color: var(--tx); pointer-events: none; }
.lz-eje { position: relative; height: 26px; }
.lz-eje span { position: absolute; top: 9px; transform: translateX(-50%); color: var(--tx3); font-size: 12px; white-space: nowrap; }
.lz-tip { position: absolute; top: -6px; transform: translate(-50%, -100%); pointer-events: none; opacity: 0; transition: opacity .12s;
          background: rgba(245, 246, 248, .96); color: #111318; border-radius: 10px; padding: 6px 10px; font-size: 12.5px; white-space: nowrap; box-shadow: 0 8px 20px rgba(0, 0, 0, .4); }
.lz-tip b { display: block; font-weight: 700; }
.lz-tip.show { opacity: 1; }
.lz-ley { display: flex; gap: 18px; flex-wrap: wrap; color: var(--tx2); font-size: 12.5px; margin-top: 6px; }
.lz-k { display: inline-block; width: 10px; height: 10px; border-radius: 3px; background: #6b7280; margin-right: 6px; vertical-align: -1px; }
.lz-k.barata { background: #3987e5; }
.lz-det { margin-top: 10px; color: var(--tx2); font-size: 13px; }
.lz-det summary { cursor: pointer; color: var(--pri); font-weight: 600; }
.lz-det h3 { font-size: 12px; text-transform: uppercase; letter-spacing: .08em; color: var(--tx3); margin: 12px 0 6px; }
.lz-tabla { display: grid; grid-template-columns: repeat(4, auto 1fr); gap: 4px 10px; margin-top: 10px; font-variant-numeric: tabular-nums; }
.lz-tabla span:nth-child(odd) { color: var(--tx3); }
@media (max-width: 599px) { .lz-tabla { grid-template-columns: repeat(2, auto 1fr); } .lz-head { flex-direction: column; } .lz-man { text-align: left; } }

/* aparatos por vincular: su render apagado con una insignia de enlace */
.art.pend img { filter: grayscale(.85) brightness(.6) !important; }
.art.pend:has(img) > .ms { opacity: 0; }
.pend-badge { position: absolute; right: -4px; bottom: -4px; width: 22px; height: 22px; border-radius: 50%; display: grid; place-items: center;
              background: var(--pri); color: var(--on-pri); box-shadow: 0 0 0 3px rgba(14, 16, 21, .9); font-style: normal; z-index: 2; }
.pend-badge .ms { font-size: 14px !important; color: var(--on-pri) !important; opacity: 1 !important; }

/* el filtro lleva aquí sin pegarse al borde, y la ficha no arrastra la página de detrás */
#dev-wrap { scroll-margin-top: 14px; }
.sheet { overscroll-behavior: contain; }
.scene-more { position: absolute; top: 10px; left: 10px; z-index: 3; width: 30px; height: 30px; border-radius: 50%; display: grid; place-items: center;
              background: rgba(0, 0, 0, .28); color: #fff; opacity: .75; transition: opacity .15s, background .15s; }
.scene-more .ms { font-size: 18px; }
.scene-more:hover { opacity: 1; background: rgba(0, 0, 0, .5); }
.nav-item[hidden] { display: none; }
/* barras de desplazamiento oscuras: la blanca de serie rompía la ficha en el PC */
html, .sheet { color-scheme: dark; scrollbar-width: thin; scrollbar-color: rgba(255, 255, 255, .22) transparent; }

/* pantalla de acceso */
.acceso { position: fixed; inset: 0; z-index: 50; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 14px; padding: 24px; background: #0b0d12; color: var(--tx); }
.acceso h1 { margin: 0 0 10px; font-size: 30px; letter-spacing: -.02em; }
.acceso input { width: min(320px, 100%); padding: 15px 18px; border-radius: 18px; border: 1px solid var(--edge2); background: rgba(255, 255, 255, .06); color: var(--tx); font: inherit; text-align: center; }
.acceso input:focus { outline: 2px solid rgba(138, 180, 255, .6); outline-offset: 1px; }
.acceso .btn { width: min(320px, 100%); justify-content: center; }
.acceso p { min-height: 22px; margin: 0; color: var(--tx2); font-size: 14px; text-align: center; }

/* pestaña Personas */
.familia { display: flex; flex-wrap: wrap; gap: 16px; }
.person { transition: opacity .3s; }
.person:not(.in) { opacity: .5; }
.person.in .av { box-shadow: 0 0 24px rgba(138, 180, 255, .75); }
.arnau-h { display: flex; align-items: center; gap: 14px; margin-bottom: 14px; }
.arnau-h .person { width: auto; }
.arnau-h b { display: block; font-size: 18px; }
.arnau-h small { color: var(--tx2); }
.mapa { position: relative; display: block; height: 320px; overflow: hidden; border-radius: 20px; background: #101218; }
.mapa-t { position: absolute; left: 50%; top: 50%; filter: invert(1) hue-rotate(180deg) brightness(.9) contrast(.85); }
.mapa-t img { position: absolute; width: 256px; height: 256px; max-width: none; }
.mapa-p { position: absolute; left: 50%; top: 50%; width: 18px; height: 18px; margin: -9px; border-radius: 50%; background: #8ab4ff; border: 3px solid #fff; box-shadow: 0 0 0 8px rgba(138, 180, 255, .3); }
.mapa small { position: absolute; right: 8px; bottom: 6px; font-size: 10px; color: rgba(255, 255, 255, .6); }

/* ==========================================================================
   Tema actual: en la línea de Google Home en modo oscuro. Superficies lisas (sin cristal ni fondo
   difuminado: en el móvil pesan), iconos planos y color solo en lo que está encendido.
   ========================================================================== */
:root {
  --bg0: #131314; --glass: #1e1f20; --glass2: #282a2c; --glass3: #333537;
  --edge: transparent; --edge2: rgba(255, 255, 255, .1);
  --tx: #e3e3e3; --tx2: #c4c7c5; --tx3: #8e918f;
  --pri: #a8c7fa; --on-pri: #062e6f; --tile-on: #a8c7fa; --tile-on-tx: #062e6f;
  --warm: #ffd591; --ok: #6dd58c; --r: 20px; --blur: none; --shadow: none;
}
html { background: var(--bg0); }
body { background: var(--bg0); -webkit-font-smoothing: antialiased; }
.bg { display: none; }
body::before { display: none; }
main.entrar > * { animation: none; }

/* navegación: barra inferior en el móvil, carril en el PC */
.rail { background: #1e1f20; border: 0; box-shadow: none; }
.nav-item { color: var(--tx2); font-size: 12px; font-weight: 500; }
.nav-item.on { color: var(--tx); font-weight: 600; }
.nav-item.on .nav-pill { background: #004a77; color: #c2e7ff; }
.badge { box-shadow: 0 0 0 2px #1e1f20; background: #f2b8b5; color: #601410; }
@media (max-width: 899px) {
  .rail { left: 0; right: 0; bottom: 0; border-radius: 0; padding: 4px 4px calc(2px + env(safe-area-inset-bottom)); }
  .nav-item { padding: 8px 0 8px; }
  .app { padding-bottom: 104px; }
}
@media (min-width: 900px) {
  .rail-logo { background: var(--pri); color: var(--on-pri); box-shadow: none; }
}
.app { max-width: 1120px; }

/* títulos */
.topbar { padding: 22px 0 4px; }
.saludo { display: none; }
h1 { font-size: 30px; font-weight: 600; letter-spacing: -.02em; margin: 0; }
h2 { font-size: 17px; font-weight: 600; letter-spacing: -.01em; margin: 28px 0 10px; }
h2 .count { font-size: 14px; font-weight: 500; }
#dev-wrap h2:not(:first-child) { font-size: 14px; color: var(--tx2); font-weight: 600; margin: 20px 0 8px; }
.conn { margin-bottom: 8px; }

/* portada */
.portada { padding: 18px 0 2px; }
.portada-top { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 14px; }
.portada-top small { color: var(--tx2); font-size: 14px; }
.hero-wx { margin: 0; min-height: 0; gap: 8px; font-size: 13px; text-align: right; }
.hero-wx .ms { font-size: 30px; }
.hero-wx span { display: block; }
.hero-wx b { display: block; font-size: 19px; font-weight: 600; line-height: 1.1; }
.hero-wx small { color: var(--tx2); font-size: 12px; }
.hero-pills { margin: 0; gap: 8px; }
.sum { padding: 9px 14px 9px 10px; border-radius: 16px; gap: 9px; background: var(--glass); }
.sum:hover { background: var(--glass2); }
.sum .ms { background: none; width: 24px; height: 24px; color: var(--pri); }
.sum b { font-size: 13.5px; font-weight: 600; }
.sum small { font-size: 12px; }

/* ahora mismo */
.live-card { background: var(--glass); padding: 10px 12px; }
.live-card:hover { background: var(--glass2); }
.live-card .live-art, .live-card .live-cover { width: 44px; height: 44px; border-radius: 50%; background: var(--glass3); }

/* escenas: botones compactos */
.scenes { gap: 8px; padding: 2px 0 4px; margin: 0; }
.scene-card { width: auto; height: 56px; padding: 0 44px 0 12px; flex-direction: row; align-items: center; justify-content: flex-start; gap: 10px;
              border: 0; border-radius: 16px; background: var(--glass) !important; }
.scene-card:hover { transform: none; box-shadow: none; background: var(--glass2) !important; }
.scene-card .art { position: static; width: 32px; height: 32px; flex: none; }
.scene-card .art img { display: none; }
.scene-card .art:has(img) > .ms { opacity: 1; }
.scene-card .art .ms { font-size: 22px; color: var(--pri); }
.scene-card b { font-size: 14px; font-weight: 600; white-space: nowrap; }
.scene-card small { display: none; }
.scene-more { top: 50%; left: auto; right: 8px; margin-top: -15px; background: none; color: var(--tx3); opacity: 1; }
.scene-more:hover { background: var(--glass3); }

/* filtros */
.chips { padding: 2px 0 8px; }
.chip { height: 34px; padding: 0 14px; border: 1px solid var(--edge2); border-radius: 10px; background: none; color: var(--tx2); font-weight: 500; }
.chip:hover { background: var(--glass); color: var(--tx); }
.chip .ms { font-size: 17px; margin-left: -3px; }
.chip.on { background: #004a77; border-color: transparent; color: #c2e7ff; }

/* baldosas: apagada gris, encendida con color */
.grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
@media (min-width: 640px) { .grid { grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 10px; } }
.tile { min-height: 72px; padding: 10px 30px 10px 10px; gap: 10px; background: var(--glass); border: 0; border-radius: 18px; }
.tile:hover { background: var(--glass2); }
.tile .ico { width: 42px; height: 42px; border-radius: 50%; background: var(--glass3); }
.tile .art img { display: none; }
.tile .art:has(img) > .ms { opacity: 1; }
.tile .art .ms { font-size: 22px; color: var(--tx2); }
.tile .nm { font-size: 14px; font-weight: 600; letter-spacing: 0; }
.tile .st { font-size: 12px; color: var(--tx2); }
.tile .more { right: 2px; opacity: .55; }
.tile.on { background: #004a77; color: #c2e7ff; box-shadow: none; }
.tile.on .ico { background: #c2e7ff; }
.tile.on .art .ms { color: #004a77; }
.tile.on .st, .tile.on .more { color: #a8c7fa; }
.tile.on.k-light { background: #5c4300; color: #ffdf9e; box-shadow: none; }
.tile.on.k-light .ico { background: var(--glow, #ffdf9e); }
.tile.on.k-light .art .ms { color: #3f2e00; }
.tile.on.k-light .st, .tile.on.k-light .more { color: #f5d78e; }
.tile.on.dim { background: #2c2415; }
.tile .fillbar { background: #5c4300; }
.tile.on.dim .txt, .tile.on.dim .ico { z-index: 1; }
.tile.offline { opacity: .5; }
.tile.setup { background: none; border: 1px dashed var(--edge2); }
.tile.k-door .ico { background: #004a77; }
.tile.k-door .art .ms { color: #c2e7ff; }

/* tarjetas, ficha y formularios */
.card, .list { background: var(--glass); border: 0; border-radius: var(--r); }
.sheet { background: #1e1f20; border: 0; box-shadow: 0 -8px 40px rgba(0, 0, 0, .5); }
.sh-hero { background: none; }
.scrim { backdrop-filter: none; }
.toast { background: #e3e3e3; color: #1e1f20; bottom: 96px; border-radius: 12px; }
.btn { border-radius: 20px; }
.kv { background: var(--glass2); border: 0; }
.field input, .field select { background: var(--glass2); border-color: transparent; }
.offline-banner { background: #4a3a00; backdrop-filter: none; }
.person .av { background: var(--glass2); border: 0; }
.person.in .av { background: var(--pri); color: var(--on-pri); box-shadow: 0 0 20px rgba(168, 199, 250, .55); }

/* precio de la luz, plegado */
.plegable { margin-top: 22px; background: var(--glass); border-radius: var(--r); }
.plegable > summary { display: flex; align-items: center; gap: 12px; padding: 12px 14px; cursor: pointer; list-style: none; }
.plegable > summary::-webkit-details-marker { display: none; }
.plegable > summary .ms:first-child { color: var(--pri); }
.plegable > summary span:not(.ms) { flex: 1; min-width: 0; }
.plegable > summary b { display: block; font-size: 14px; font-weight: 600; }
.plegable > summary small { color: var(--tx2); font-size: 12px; }
.plegable > summary .ms:last-child { color: var(--tx3); transition: transform .2s; }
.plegable[open] > summary .ms:last-child { transform: rotate(180deg); }
.plegable .card { background: none; padding-top: 0; }

/* acceso */
.acceso { background: var(--bg0); }
.acceso .rail-logo { display: grid; place-items: center; width: 64px; height: 64px; margin: 0; border-radius: 20px; background: var(--pri); color: var(--on-pri); box-shadow: none; }
.acceso .rail-logo .ms { font-size: 36px; }
.acceso input { background: var(--glass); border-color: transparent; }

/* aviso para instalar */
.instalar { position: fixed; z-index: 60; left: 10px; right: 10px; bottom: calc(82px + env(safe-area-inset-bottom)); display: flex; flex-wrap: wrap; align-items: center; justify-content: flex-end;
            gap: 6px 10px; padding: 12px 14px; border-radius: 20px; background: #282a2c; box-shadow: 0 8px 30px rgba(0, 0, 0, .55); animation: sube .3s cubic-bezier(.2, 0, 0, 1); }
.instalar img { width: 44px; height: 44px; border-radius: 12px; }
.instalar .t { flex: 1 1 60%; min-width: 0; }
.instalar b { display: block; font-size: 15px; font-weight: 600; }
.instalar small { color: var(--tx2); font-size: 12.5px; }
@keyframes sube { from { transform: translateY(24px); opacity: 0; } }
@media (min-width: 900px) { .instalar { left: auto; right: 24px; bottom: 24px; width: 400px; } }
