/* «Умный дом» (22.11.2026) — home.js. Блок поверх Viki, z-index 60 (до 99 — Настройки/Профиль открываются поверх сами). */
#home{position:fixed;inset:0;z-index:60;background:var(--bg);color:var(--text);display:flex;flex-direction:column;
  padding:env(safe-area-inset-top,0) 0 env(safe-area-inset-bottom,0)}
#home .hm-top{display:flex;align-items:center;gap:8px;padding:10px 12px;border-bottom:1px solid var(--line);flex:none}
#home .hm-top h1{flex:1;font-size:19px}
#home .dz-round svg{width:22px;height:22px;fill:none;stroke:currentColor;stroke-width:2;stroke-linecap:round;stroke-linejoin:round}
#home .hm-body{flex:1;overflow-y:auto;padding:12px 14px 24px}
#home .hm-hero,#home .hm-empty{max-width:440px;margin:28px auto;text-align:center;display:flex;flex-direction:column;align-items:center;gap:12px}
#home .hm-big{width:84px;height:84px;color:var(--acc);filter:drop-shadow(0 6px 18px rgba(124,235,70,.25))}
#home .hm-wide{width:100%;max-width:340px;min-height:48px;font-size:16px}
#home .hm-h{font-weight:700;margin:2px 2px 8px}
#home .hm-scs{display:flex;gap:8px;overflow-x:auto;padding-bottom:10px;scrollbar-width:none}
#home .hm-sc{flex:none;display:flex;align-items:center;gap:8px;padding:10px 14px;border-radius:14px;border:none;background:var(--card);color:var(--text);font-size:14.5px}
#home .hm-sc svg{width:18px;height:18px;color:var(--acc)}
#home .hm-rooms{display:flex;gap:6px;overflow-x:auto;padding:2px 0 12px;scrollbar-width:none}
#home .hm-room{flex:none;padding:8px 14px;border-radius:18px;border:1px solid var(--line);background:transparent;color:var(--text);font-size:14px}
#home .hm-room.on{background:var(--text);color:var(--bg);border-color:var(--text);font-weight:600}
#home .hm-grid{display:grid;grid-template-columns:repeat(auto-fill,minmax(150px,1fr));gap:10px}
#home .hm-tile{display:flex;flex-direction:column;align-items:flex-start;gap:6px;padding:14px;border-radius:20px;border:none;
  background:var(--card);color:var(--text);text-align:left;min-height:118px;user-select:none;-webkit-user-select:none;-webkit-touch-callout:none;transition:transform .12s}
#home .hm-tile:active{transform:scale(.96)}
#home .hm-ic{width:46px;height:46px;border-radius:50%;display:flex;align-items:center;justify-content:center;background:var(--card2);color:var(--muted)}
#home .hm-ic svg{width:26px;height:26px}
#home .hm-tile.on{background:var(--card2)}
#home .hm-tile.on .hm-ic{background:var(--hc);color:#111;box-shadow:0 4px 16px color-mix(in srgb,var(--hc) 45%,transparent)}
#home .hm-tile.off{opacity:.5}
#home .hm-nm{font-weight:650;font-size:15.5px;line-height:1.2;overflow:hidden;text-overflow:ellipsis;display:-webkit-box;-webkit-line-clamp:2;-webkit-box-orient:vertical}
#home .hm-st{font-size:12.5px;color:var(--muted)}
#home .hm-foot{text-align:center;margin-top:18px}
#home .hm-sheet{position:absolute;inset:0;background:rgba(0,0,0,.45);display:flex;align-items:flex-end;justify-content:center;z-index:2}
#home .hm-card{width:100%;max-width:480px;background:var(--bg);border-radius:22px 22px 0 0;padding:14px 16px calc(18px + env(safe-area-inset-bottom,0));
  display:flex;flex-direction:column;gap:12px;max-height:85vh;overflow-y:auto}
@media (min-width:768px){#home .hm-sheet{align-items:center}#home .hm-card{border-radius:22px}}
#home .hm-ed{display:flex;align-items:center;gap:10px}#home .hm-ed h3{flex:1;text-align:center;font-size:17px}
#home .hm-line{gap:8px;padding:6px 2px}#home .hm-line input[type=range]{width:100%;accent-color:var(--acc)}
#home .hm-cols{display:flex;flex-wrap:wrap;gap:10px}
#home .hm-col{width:38px;height:38px;border-radius:50%;border:2px solid var(--line)}#home .hm-col.on{outline:3px solid var(--acc);outline-offset:2px}
#home .hm-brand{display:flex;flex-direction:column;gap:4px;text-align:left;padding:12px 14px;border-radius:16px;background:var(--card);border:none;color:var(--text);font-size:15px}
#home .hm-modes{display:flex;gap:6px;flex-wrap:wrap;margin:4px 0}
#home .hm-tile{position:relative;overflow:hidden}
#home .hm-tile.hm-hold::after{content:'';position:absolute;inset:0;background:color-mix(in srgb,var(--acc) 28%,transparent);transform-origin:left;animation:hmfill 3s linear forwards;pointer-events:none}
@keyframes hmfill{from{transform:scaleX(0)}to{transform:scaleX(1)}}
#home .hm-more{position:absolute;top:6px;right:6px;width:32px;height:32px;border-radius:50%;display:flex;align-items:center;justify-content:center;font-size:20px;line-height:1;color:var(--muted);z-index:1}
/* 22.11.2026 — раздел целиком: список, вкладки, карточка, автоматика, энергия (стиль Viki: --card, --acc, кнопки .btn, ползунки role=switch) */
#home .dz-round[hidden]{display:none}
#home .btn.small{height:38px;padding:0 14px;font-size:14px;border-radius:12px}
#home .btn.danger{border-color:#FF8A80}
#home .hm-small{width:auto;min-width:0;height:42px;padding:0 10px}
#home .hm-sub{margin-top:-6px}
#home .hm-banner{width:100%;margin-bottom:12px}
#home .hm-star{width:15px;height:15px;margin-right:5px;vertical-align:-2px;color:#FFC93C}
#home .hm-homes{padding-bottom:6px}
#home .hm-sc.on{background:var(--acc);color:var(--acc-ink)}#home .hm-sc.on svg{color:var(--acc-ink)}
#home .hm-modebar,#home .hm-editbar{display:flex;align-items:center;gap:10px;padding:10px 14px;border-radius:14px;background:var(--card);margin-bottom:10px}
#home .hm-modebar svg{width:20px;height:20px;color:var(--acc)}
#home .hm-fav{position:absolute;top:12px;right:12px;width:16px;height:16px;color:#FFC93C}#home .hm-fav svg{width:16px;height:16px}
/* список */
#home .hm-list{display:flex;flex-direction:column;gap:6px}
#home .hm-row{display:flex;align-items:center;gap:12px;padding:10px 12px;border-radius:16px;background:var(--card);position:relative;overflow:hidden;
  user-select:none;-webkit-user-select:none;-webkit-touch-callout:none;cursor:pointer}
#home .hm-row .hm-ic{width:40px;height:40px;flex:none}#home .hm-row .hm-ic svg{width:22px;height:22px}
#home .hm-row.on .hm-ic{background:var(--hc);color:#111}
#home .hm-row.off{opacity:.5}
#home .hm-row.hm-hold::after{content:'';position:absolute;inset:0;background:color-mix(in srgb,var(--acc) 28%,transparent);transform-origin:left;animation:hmfill 3s linear forwards;pointer-events:none}
#home .hm-rt{flex:1;min-width:0;display:flex;flex-direction:column;gap:2px}
#home .hm-row .hm-nm{-webkit-line-clamp:1}
#home .hm-row .hm-more{position:static}
/* как ползунки Viki (themes.css 22.11.2026): рамка цвета акцента, выкл — белый кружок слева, вкл — кружок акцента справа */
#home .hm-sw{width:48px;height:28px;border-radius:14px;background:transparent;box-shadow:inset 0 0 0 1.8px var(--acc);position:relative;flex:none}
#home .hm-sw i{position:absolute;left:3px;top:50%;transform:translateY(-50%);width:22px;height:22px;border-radius:11px;background:#fff;box-shadow:0 1px 3px rgba(0,0,0,.35);transition:.15s}
#home .hm-sw.on i{left:23px;background:var(--acc);box-shadow:none}
html[data-theme=light] #home .hm-sw:not(.on) i{box-shadow:0 0 0 1px rgba(0,0,0,.18),0 1px 3px rgba(0,0,0,.25)}
/* перетаскивание */
#home .hm-drag{opacity:.85;transform:scale(1.06);box-shadow:0 8px 24px rgba(0,0,0,.45);z-index:3}
#home .hm-editing .hm-tile{animation:hmjig .25s ease-in-out infinite alternate;touch-action:none}
#home [data-tabs] .hm-room{touch-action:pan-x}
@keyframes hmjig{from{transform:rotate(-1.2deg)}to{transform:rotate(1.2deg)}}
/* карточка */
#home .hm-icons{display:flex;flex-wrap:wrap;gap:8px}
#home .hm-icpick{width:44px;height:44px;border-radius:50%;border:none;background:var(--card2);color:var(--muted);display:flex;align-items:center;justify-content:center}
#home .hm-icpick svg{width:24px;height:24px}#home .hm-icpick.on{background:var(--hc);color:#111}
#home .hm-kel{background:linear-gradient(90deg,#FFB35C,#FFF6E5,#CFE3FF);border-radius:8px}
#home .hm-spark{width:100%;height:64px;display:block}#home .hm-spark polyline{fill:none;stroke:var(--acc);stroke-width:2;vector-effect:non-scaling-stroke}
#home .hm-log{padding:6px 0;border-bottom:1px solid var(--line);font-size:13.5px;color:var(--text)}#home .hm-log span:first-child{color:var(--muted);margin-right:6px}
/* автоматика */
#home .hm-rule{display:flex;align-items:center;gap:10px}#home .hm-rule .hm-brand{flex:1;min-width:0}#home .hm-rule.off .hm-brand{opacity:.55}
#home .hm-step{padding:10px;border-radius:14px;background:var(--card);display:flex;flex-direction:column;gap:8px}
#home .hm-how{font-size:11.5px;font-weight:600;padding:2px 8px;border-radius:10px;background:var(--card2);color:var(--muted);margin-left:6px;vertical-align:1px}
#home .hm-how.ok{background:color-mix(in srgb,var(--acc) 22%,transparent);color:var(--acc)}
/* энергия */
#home .hm-big2{font-size:17px;margin:6px 0 10px}#home .hm-big2 b{font-size:26px}
#home .hm-bars{display:flex;align-items:flex-end;gap:3px;height:120px;margin:6px 0 12px;overflow-x:auto}
#home .hm-bar{flex:1;min-width:12px;height:100%;display:flex;flex-direction:column;justify-content:flex-end;align-items:center;gap:3px}
#home .hm-bar i{display:block;width:100%;border-radius:4px 4px 0 0;background:var(--acc)}
#home .hm-bar span{font-size:9.5px;color:var(--muted)}
#home .hm-qr{display:flex;flex-direction:column;align-items:center;gap:8px}#home .hm-qr img{background:#fff;padding:8px;border-radius:12px;max-width:100%}
@media (min-width:768px){#home .hm-list{max-width:760px}}

#home .hm-tile .hm-more:has(+ .hm-fav){right:34px}
#home .hm-card .hm-sc{margin:0 6px 8px 0}
#home .hm-more svg{width:20px;height:20px}
#home .hm-tile.hm-rec,#home .hm-row.hm-rec{outline:2px solid var(--acc);box-shadow:0 0 0 6px color-mix(in srgb,var(--acc) 25%,transparent);animation:hmpulse 1s ease-in-out infinite}
@keyframes hmpulse{50%{box-shadow:0 0 0 10px color-mix(in srgb,var(--acc) 10%,transparent)}}
#home .hm-row .hm-more{margin-left:6px}
#home .hm-stb{display:grid;grid-template-columns:repeat(3,1fr);gap:8px;margin:6px 0 10px}
#home .hm-stc{display:flex;flex-direction:column;align-items:center;gap:2px;padding:10px 4px;border-radius:14px;border:0;background:color-mix(in srgb,var(--acc) 14%,transparent);color:inherit;font:inherit}
#home .hm-stc b{font-size:22px;line-height:1}#home .hm-stc span{font-size:12px;opacity:.8}
#home .hm-qr{display:flex;justify-content:center;margin:8px 0}#home .hm-qr img{background:#fff;padding:8px;border-radius:12px;max-width:100%}
#home .hm-steps{margin:8px 0 10px;padding-left:20px;line-height:1.45}#home .hm-steps li{margin-bottom:6px}
