/* «Дом», вариант «Пульт одной рукой». Цвета — themeParams Telegram (--tg-theme-*); свои — статусы, тон света, ряды
   графика. Сетка 4/8 px, карточки 16 px. Всё частое — у нижнего края: панель, док, шторка, тосты. */
:root {
  --bg: var(--tg-theme-secondary-bg-color, #efeff4);
  --card: var(--tg-theme-section-bg-color, var(--tg-theme-bg-color, #fff));
  --text: var(--tg-theme-text-color, #000);
  --hint: var(--tg-theme-hint-color, #8e8e93);
  --accent: var(--tg-theme-button-color, #2481cc);
  --on-accent: var(--tg-theme-button-text-color, #fff);
  --ink: var(--tg-theme-accent-text-color, var(--tg-theme-link-color, #2481cc));
  --head: var(--tg-theme-section-header-text-color, var(--tg-theme-hint-color, #6d6d72));
  --bar: var(--tg-theme-bottom-bar-bg-color, var(--tg-theme-bg-color, #fff));
  --line: rgba(128, 128, 128, .2); --fill: rgba(128, 128, 128, .11); --fill2: rgba(128, 128, 128, .24); --soft: rgba(36, 129, 204, .14);
  --shadow: 0 1px 2px rgba(0, 0, 0, .04), 0 3px 14px rgba(0, 0, 0, .05);
  --float: 0 12px 32px rgba(0, 0, 0, .16), 0 2px 6px rgba(0, 0, 0, .06);
  /* статусы: норма / внимание / тревога */
  --ok: #0ca30c; --warn: #fab219; --hot: #d03b3b; --ok-ink: #0a7d0a; --warn-ink: #8a5800; --hot-ink: #bf2a2c;
  --ok-bg: rgba(12, 163, 12, .12); --warn-bg: rgba(250, 178, 25, .17); --hot-bg: rgba(208, 59, 59, .12);
  /* ряды графика: проверенная палитра (синий, оранжевый, бирюзовый); свет — жёлтый, Вт — фиолетовый */
  --c1: #2a78d6; --c2: #eb6834; --c3: #1baf7a; --cl: #eda100; --cw: #6250d6;
  --font: -apple-system, system-ui, "SF Pro Text", "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --safe-b: max(env(safe-area-inset-bottom, 0px), var(--tg-safe-area-inset-bottom, 0px));
  --tabs-pb: max(4px, var(--safe-b)); /* нижнее поле панели: полоса жеста «Домой» iPhone или 4 px */
  --tabs-h: 56px; --dock-h: 72px; /* панель без нижнего поля; док с отступом */
  color-scheme: light;
}
[data-scheme="dark"] {
  --line: rgba(160, 160, 160, .16); --fill: rgba(160, 160, 160, .12); --fill2: rgba(160, 160, 160, .24);
  --shadow: 0 0 0 1px rgba(255, 255, 255, .045); --float: 0 14px 36px rgba(0, 0, 0, .5), 0 0 0 1px rgba(255, 255, 255, .06);
  --ok-ink: #48d466; --warn-ink: #ffc44d; --hot-ink: #ff7b72; --warn-bg: rgba(250, 178, 25, .15); --hot-bg: rgba(230, 72, 72, .2);
  --c1: #3987e5; --c2: #d95926; --c3: #199e70; --cl: #c98500; --cw: #9085e9; --soft: rgba(82, 136, 193, .26);
  color-scheme: dark;
}
@supports (color: color-mix(in srgb, red 50%, blue)) { /* оттенок кнопки Telegram для подложек */
  :root { --soft: color-mix(in srgb, var(--accent) 14%, transparent); }
  [data-scheme="dark"] { --soft: color-mix(in srgb, var(--accent) 24%, transparent); }
}

* { box-sizing: border-box; }
html, body { height: 100%; margin: 0; overflow: hidden; background: var(--bg); }
body { color: var(--text); font: 400 15px/1.35 var(--font); letter-spacing: -.005em; -webkit-font-smoothing: antialiased; -webkit-text-size-adjust: 100%; text-size-adjust: 100%; -webkit-tap-highlight-color: transparent; touch-action: manipulation; }
button { font: inherit; color: inherit; background: none; border: 0; padding: 0; margin: 0; cursor: pointer; text-align: inherit; }
a { color: inherit; text-decoration: none; }
h1, h2, p { margin: 0; }
[hidden] { display: none !important; }
:focus { outline: none; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 12px; }
small { font-size: .55em; font-weight: 600; color: var(--hint); letter-spacing: 0; }
.i { width: 24px; height: 24px; flex: none; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.i-f { fill: currentColor; stroke: none; }

/* каркас: своя прокрутка экрана, панель разделов — в потоке у нижнего края, док — над ней */
#app { position: fixed; inset: 0; display: flex; flex-direction: column; }
.view { flex: 1; min-height: 0; overflow-y: auto; overscroll-behavior: contain; display: flex; flex-direction: column; gap: 14px; padding: 10px max(16px, calc(50% - 304px)) 0; }
.view::after { content: ""; flex: none; height: 6px; }
body.has-dock .view::after { height: var(--dock-h); }
body.offline .view { padding-top: var(--net-h, 54px); } /* высота плашки связи: showNet() пишет её в --net-h (две строки у «Дом отвечает долго…») */
/* главная — в один экран: плитки сценариев над доком «Весь свет выкл» видны и при 360×720 с safe-area iPhone */
.view[data-screen="home"] { gap: 10px; padding-top: 8px; }
[data-screen="home"] .sec-h { padding-bottom: 6px; }
.view > section { display: flex; flex-direction: column; flex: none; min-width: 0; }
.view > .push { margin-top: auto; }
.head { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 8px 12px; min-height: 48px; padding: 2px 2px 0; }
.head > div { flex: 1 0 auto; max-width: 100%; } /* длинная плашка уходит на строку ниже, заголовок не сжимается */
.eyebrow { margin-bottom: 1px; overflow: hidden; font-size: 12.5px; font-weight: 600; color: var(--hint); white-space: nowrap; text-overflow: ellipsis; }
.title { font-size: 27px; line-height: 1.08; font-weight: 750; letter-spacing: -.032em; }
.h2 { font-size: 17px; font-weight: 650; letter-spacing: -.015em; }
.sub { margin-top: 2px; font-size: 13px; color: var(--hint); }
.stamp { display: inline-flex; align-items: center; gap: 6px; flex: none; height: 28px; padding: 0 10px; border-radius: 14px; background: var(--card); box-shadow: var(--shadow); color: var(--hint); font-size: 13px; font-weight: 650; white-space: nowrap; }
.stamp .i { width: 16px; height: 16px; }
.stamp.stale { background: var(--warn-bg); color: var(--warn-ink); box-shadow: none; }
.live { width: 7px; height: 7px; border-radius: 50%; background: var(--ok); box-shadow: 0 0 0 3px var(--ok-bg); }
.cap { font-size: 12px; font-weight: 650; letter-spacing: .07em; text-transform: uppercase; color: var(--head); }
.sec-h { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; padding: 0 4px 8px; }
.cap-r { font-size: 13px; font-weight: 600; color: var(--hint); }
.card { background: var(--card); border-radius: 16px; box-shadow: var(--shadow); }
.note { padding: 0 4px; font-size: 13px; line-height: 1.4; color: var(--hint); }
.press, .stat, .tile, .dbtn, .chip, .pbtn, .wide, .vbtn, .seg button, .room, .lc, .alarm { transition: transform .12s ease, background .2s, color .2s; }
.press:active, .stat:active, .tile:active, .dbtn:active, .chip:active, .pbtn:active, .wide:active, .vbtn:active, .seg button:active, .alarm:active,
.room:has(.room-hit:active), .lc:has(.lc-hit:active) { transform: scale(.97); }

.stamp, .cap-r, .net span, .s-sub, .room-n, .lc-meta, .r-v, .li-v, .ctl-v, .chip, .legend b, .tip b, .chart text, .corr-i b, .tbl, .ev time { font-variant-numeric: tabular-nums; }

/* плашки: связь, тревоги, ошибка экрана */
.net { position: fixed; top: 0; left: 0; right: 0; z-index: 60; display: flex; align-items: center; justify-content: center; gap: 10px; padding: calc(10px + var(--tg-content-safe-area-inset-top, 0px)) 16px 10px; background: #2b2b2e; color: #fff; font-size: 14px; font-weight: 650; box-shadow: 0 4px 16px rgba(0, 0, 0, .2); }
.net span { color: rgba(255, 255, 255, .7); font-weight: 500; }
.alarm { display: flex; align-items: center; gap: 8px; width: 100%; min-height: 48px; padding: 8px 10px 8px 12px; border-radius: 14px; background: var(--warn-bg); color: var(--warn-ink); box-shadow: inset 0 0 0 1px rgba(250, 178, 25, .45); text-align: left; }
.alarm.hot { background: var(--hot); color: #fff; box-shadow: 0 8px 22px rgba(208, 59, 59, .32); }
.a-list { flex: 1; min-width: 0; }
.a-lv { margin-right: 6px; font-size: 10.5px; font-weight: 750; letter-spacing: .08em; text-transform: uppercase; vertical-align: 1px; opacity: .85; }
.a-t { display: -webkit-box; overflow: hidden; font-size: 13.5px; font-weight: 650; line-height: 1.28; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.a-t + .a-t { margin-top: 3px; }
.alarm > .i { width: 18px; height: 18px; opacity: .7; }
.oops { display: flex; align-items: center; gap: 10px; padding: 6px 6px 6px 14px; border-radius: 14px; background: var(--warn-bg); color: var(--warn-ink); font-size: 13px; font-weight: 600; }
.oops > span { flex: 1; }
.oops .i { width: 20px; height: 20px; }
.oops button { min-height: 44px; padding: 0 12px; border-radius: 12px; font-weight: 650; color: var(--ink); }
.empty { padding: 28px 20px; text-align: center; color: var(--hint); font-size: 14px; line-height: 1.45; }
.empty > .i { display: block; width: 36px; height: 36px; margin: 0 auto 10px; opacity: .6; }
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 44px; margin-top: 14px; padding: 0 20px; border-radius: 14px; background: var(--accent); color: var(--on-accent); font-weight: 650; }

/* главная: щиток и сводка */
.panel { display: block; width: 100%; padding: 10px; text-align: left; }
.card-h { display: flex; align-items: center; justify-content: space-between; padding: 0 2px 6px; }
.go { display: inline-flex; align-items: center; gap: 2px; font-size: 12px; font-weight: 600; color: var(--hint); }
.go .i { width: 16px; height: 16px; }
.sensors { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 6px; }
.sensor { display: flex; flex-direction: column; min-width: 0; padding: 7px 8px 6px; border-radius: 12px; background: var(--fill); }
.sensor.warn { background: var(--warn-bg); }
.sensor.hot { background: var(--hot-bg); }
.s-name { overflow: hidden; font-size: 11.5px; font-weight: 650; color: var(--hint); white-space: nowrap; text-overflow: ellipsis; }
.s-t { margin-top: 1px; font-size: 24px; font-weight: 650; line-height: 1.05; letter-spacing: -.035em; white-space: nowrap; }
.s-t small { font-size: 13px; }
.warn .s-t { color: var(--warn-ink); }
.hot .s-t { color: var(--hot-ink); }
.off .s-t { color: var(--hint); }
.s-state, .s-sub { display: flex; align-items: center; gap: 5px; min-width: 0; margin-top: 2px; overflow: hidden; font-size: 11px; white-space: nowrap; }
.s-state { font-weight: 650; }
.s-sub { gap: 3px; color: var(--hint); }
.s-sub .i { width: 12px; height: 12px; }
.dot { flex: none; width: 7px; height: 7px; border-radius: 50%; background: var(--ok); }
.warn .dot { background: var(--warn); }
.hot .dot { background: var(--hot); }
.off .dot { background: var(--hint); }
.spark { display: block; width: 100%; height: 16px; margin-top: 4px; overflow: visible; color: var(--hint); }
.spark path { fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; vector-effect: non-scaling-stroke; }
.spark .base { stroke: var(--line); stroke-width: 1; }
.warn .spark { color: var(--warn); }
.hot .spark { color: var(--hot); }
.stats { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 6px; }
.stat { display: grid; grid-template-columns: auto minmax(0, 1fr); align-items: center; gap: 2px 6px; min-width: 0; min-height: 54px; padding: 8px 10px; border-radius: 16px; background: var(--card); box-shadow: var(--shadow); text-align: left; }
.stat .i { width: 18px; height: 18px; color: var(--hint); }
.stat b { overflow: hidden; font-size: 21px; font-weight: 650; line-height: 1.1; letter-spacing: -.035em; white-space: nowrap; text-overflow: ellipsis; }
.stat b small { margin-left: 1px; font-size: 12px; }
.stat > span:last-child { grid-column: 1 / -1; font-size: 11.5px; font-weight: 600; color: var(--hint); }
.stat.lit .i { color: #e08a1e; }
.stat.attn .i, .stat.attn b { color: var(--warn-ink); }

/* сценарии */
.scen { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 6px; }
.tile { display: flex; flex-direction: column; align-items: center; gap: 5px; min-width: 0; min-height: 76px; padding: 7px 2px 6px; border-radius: 16px; background: var(--card); box-shadow: var(--shadow); font-size: 11.5px; font-weight: 650; line-height: 1.15; text-align: center; letter-spacing: -.01em; }
.tile .ico { display: grid; place-items: center; width: 36px; height: 36px; border-radius: 12px; background: var(--soft); color: var(--ink); }
.tile .ico .i { width: 22px; height: 22px; }
.t-l { max-width: 100%; }
.t-l.fit { letter-spacing: -.02em; } /* «Возвращаюсь»: длинное слово — кегль меньше, крайний случай — мягкий перенос */
.tile.alt .ico { background: var(--fill); color: var(--text); }
.tile em { display: block; font-style: normal; font-weight: 600; color: var(--hint); }
.tile:disabled { opacity: .45; }
.tile.busy .ico { background: var(--accent); color: var(--on-accent); }
.wide { display: flex; align-items: center; justify-content: center; gap: 10px; width: 100%; min-height: 54px; margin-top: 8px; border-radius: 16px; background: var(--accent); color: var(--on-accent); font-size: 16px; font-weight: 650; }
.wide.ghost { background: var(--fill); color: var(--text); }
.wide:disabled { opacity: .5; }

/* нижняя панель и док (зона большого пальца) */
.tabs { position: relative; z-index: 5; flex: none; display: grid; grid-auto-columns: minmax(0, 1fr); grid-auto-flow: column; padding: 4px 6px var(--tabs-pb); background: var(--bar); box-shadow: 0 -1px 0 var(--line); }
.tab { position: relative; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; min-height: 52px; border-radius: 14px; color: var(--hint); font-size: 11px; font-weight: 650; letter-spacing: .01em; }
.tab .pill { display: grid; place-items: center; width: 60px; height: 30px; border-radius: 15px; transition: background .2s; }
.tab > span:not(.pill) { max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; } /* пять вкладок: подпись не выходит из колонки */
.tab[aria-current="page"] { color: var(--ink); }
.tab[aria-current="page"] .pill { background: var(--soft); }
.tab.alert::after { content: ""; position: absolute; top: 6px; left: calc(50% + 12px); width: 9px; height: 9px; border-radius: 50%; background: var(--hot); box-shadow: 0 0 0 2px var(--bar); }
.tab.alert.warn-only::after { background: var(--warn); }
.dock-slot { position: absolute; left: 0; right: 0; bottom: calc(var(--tabs-h) + var(--tabs-pb)); z-index: 4; padding: 0 12px 10px; pointer-events: none; }
.dock { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 6px; max-width: 616px; margin: 0 auto; padding: 6px; border-radius: 22px; background: var(--card); box-shadow: var(--float); pointer-events: auto; }
.dock.one { grid-template-columns: 1fr; }
.dbtn { display: flex; align-items: center; justify-content: center; gap: 8px; min-height: 50px; padding: 0 8px; border-radius: 16px; background: var(--fill); font-size: 14px; font-weight: 650; white-space: nowrap; }
.dbtn .i { width: 20px; height: 20px; }
.dbtn.primary { background: var(--accent); color: var(--on-accent); }
.dbtn:disabled { opacity: .5; }

/* комнаты */
.rooms { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.room { position: relative; isolation: isolate; display: flex; flex-direction: column; min-width: 0; min-height: 118px; padding: 14px; overflow: hidden; border-radius: 16px; background: var(--card); box-shadow: var(--shadow); }
.room.lit { background: radial-gradient(130% 100% at 0% 0%, rgba(255, 167, 87, .3), rgba(255, 167, 87, .07) 58%, transparent 78%), var(--card); }
.room-hit, .lc-hit { position: absolute; inset: 0; z-index: 1; border-radius: inherit; }
.room-hit:focus-visible, .lc-hit:focus-visible { outline-offset: -2px; }
.room .sw { position: absolute; top: 12px; right: 12px; z-index: 2; }
.room-t { padding-right: 60px; font-size: 16px; font-weight: 650; line-height: 1.2; letter-spacing: -.015em; }
.room-n { margin-top: auto; padding-top: 12px; font-size: 32px; font-weight: 650; line-height: 1; letter-spacing: -.04em; }
.room-n small { font-size: 16px; }
.room-s { margin-top: 5px; font-size: 12px; font-weight: 600; color: var(--hint); }
.room-s em { font-style: normal; color: var(--warn-ink); }
.pres { display: inline-flex; align-items: center; gap: 4px; margin-top: 6px; font-size: 12px; font-weight: 650; color: var(--hint); }
.pres .i { width: 14px; height: 14px; }
.pres.yes { color: var(--ink); }
.room.wide-r { grid-column: 1 / -1; flex-direction: row; align-items: center; gap: 14px; min-height: 76px; }
.room.wide-r .room-t { padding: 0; }
.room.wide-r .room-s { margin-top: 2px; }
.ico-b { display: grid; place-items: center; flex: none; width: 44px; height: 44px; border-radius: 14px; background: var(--soft); color: var(--ink); }
.chev { margin-left: auto; color: var(--hint); }

/* светильники: карточка светится тоном, полоска — яркость */
.lights { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.lc { --tone: 255 196 140; position: relative; isolation: isolate; display: flex; flex-direction: column; min-width: 0; min-height: 112px; padding: 12px; overflow: hidden; border-radius: 16px; background: var(--card); box-shadow: var(--shadow); }
.lc.on { background: linear-gradient(158deg, rgb(var(--tone) / .36), rgb(var(--tone) / .1) 56%, rgb(var(--tone) / 0) 82%), var(--card); }
.lc.off { opacity: .55; }
.lc .sw { position: absolute; top: 10px; right: 10px; z-index: 2; }
.lc-ico, .sh-ico { display: grid; place-items: center; flex: none; width: 36px; height: 36px; border-radius: 12px; background: var(--fill); color: var(--hint); transition: background .25s, color .25s, box-shadow .25s; }
.lc.on .lc-ico, .sh-ico.on { background: rgb(var(--tone)); color: #4a3418; box-shadow: 0 0 20px rgb(var(--tone) / .75); }
.lc-name { margin-top: 10px; overflow: hidden; font-size: 15px; font-weight: 650; line-height: 1.2; letter-spacing: -.012em; white-space: nowrap; text-overflow: ellipsis; }
.lc-meta { margin-top: 2px; font-size: 13px; color: var(--hint); white-space: nowrap; }
.lc.on .lc-meta { color: var(--text); opacity: .72; }
.lc.relay .lc-meta { white-space: normal; } /* «реле · состояние не сообщается» длиннее подписи светильника — переносится, а не обрезается */
.lc-bar { height: 4px; margin-top: auto; overflow: hidden; border-radius: 2px; background: var(--fill); }
.lc-bar i { display: block; width: var(--lvl, 0%); height: 100%; border-radius: inherit; background: rgb(var(--tone)); transition: width .3s ease; }

/* шторы, розетки, клавиши */
.curt { padding: 12px 14px 14px; }
.curt + .curt { margin-top: 8px; }
.curt.off { opacity: .55; }
.row-h { display: flex; align-items: center; gap: 10px; min-height: 28px; }
.row-h > .i { color: var(--hint); }
.r-t { flex: 1; min-width: 0; overflow: hidden; font-size: 15px; font-weight: 600; line-height: 1.25; white-space: nowrap; text-overflow: ellipsis; }
.r-t em { display: block; font-size: 12px; font-style: normal; font-weight: 500; color: var(--hint); }
.r-v { font-size: 20px; font-weight: 650; letter-spacing: -.03em; white-space: nowrap; }
.curt .rng-w { margin-top: 10px; }
.cpair { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-top: 10px; }
.pbtn { display: flex; align-items: center; justify-content: center; gap: 8px; min-height: 44px; border-radius: 13px; background: var(--fill); font-size: 14px; font-weight: 650; }
.pbtn .i { width: 20px; height: 20px; }
.pbtn:disabled { opacity: .4; }
details.more { margin-top: 8px; }
details.more > summary { display: flex; align-items: center; justify-content: space-between; min-height: 44px; padding: 0 14px; border-radius: 14px; background: var(--fill); color: var(--ink); font-size: 14px; font-weight: 600; list-style: none; cursor: pointer; }
details.more > summary::-webkit-details-marker { display: none; }
details.more > summary .i { width: 18px; height: 18px; transition: transform .2s; }
details.more[open] > summary { margin-bottom: 8px; }
details.more[open] > summary .i { transform: rotate(90deg); }
.list { padding: 2px 0; }
.li { position: relative; display: flex; align-items: center; gap: 12px; width: 100%; min-height: 60px; padding: 9px 14px; text-align: left; }
.li + .li::before { content: ""; position: absolute; top: 0; left: 60px; right: 0; height: 1px; background: var(--line); }
.li-ico { display: grid; place-items: center; flex: none; width: 34px; height: 34px; border-radius: 11px; background: var(--fill); color: var(--hint); }
.li-ico .i { width: 20px; height: 20px; }
.li-ico.prot, .li.on .li-ico { background: var(--soft); color: var(--ink); }
.li-ico.warm { color: #e08a1e; }
/* программы комнат: «время · дни» — один блок, при нехватке места переносится целиком (без висячего отступа), строка не обрезается;
   дни — вторичный текст цветом заголовков секций (контраст AA в обеих темах), строка foreign — цветом предупреждения */
.li.prog .li-t { -webkit-line-clamp: none; }
.li.prog .li-t .pt { display: inline-block; max-width: 100%; }
.li.prog .li-t b { font-variant-numeric: tabular-nums; }
.li.prog .li-t small { font-size: 12px; font-weight: 400; color: var(--head); }
.li-s.foreign { color: var(--warn-ink); }
.li.prog.on .li-ico.warm { background: var(--warn-bg); color: #e08a1e; }
.li.prog:not(.on) .li-ico.warm { color: var(--hint); }
.li-main { display: flex; flex-direction: column; gap: 1px; flex: 1; min-width: 0; }
.li-t { display: -webkit-box; overflow: hidden; font-size: 15px; font-weight: 550; line-height: 1.25; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.li-s { font-size: 12px; color: var(--hint); }
.li-v { font-size: 17px; font-weight: 650; letter-spacing: -.025em; white-space: nowrap; }
.li-v small { font-size: 12px; }
.locked .li-t { color: var(--hint); }
.keys .li-t { -webkit-line-clamp: none; } /* имя клавиши целиком: по нему и номеру в конце («… · 1» / «· 2») различают реле */
button.li-main { align-self: stretch; justify-content: center; min-height: 44px; text-align: left; }
.seg { display: flex; flex: none; gap: 6px; }
.seg button { min-width: 54px; min-height: 44px; padding: 0 10px; border-radius: 12px; background: var(--fill); font-size: 13px; font-weight: 650; text-align: center; }
.seg button.sel { background: var(--soft); color: var(--ink); box-shadow: inset 0 0 0 1.5px var(--accent); }
.seg button:disabled, .seg button[aria-disabled="true"] { opacity: .45; }

/* переключатель */
.sw { position: relative; flex: none; width: 52px; height: 32px; border-radius: 16px; background: var(--fill2); transition: background .22s ease; }
.sw::before { content: ""; position: absolute; inset: -6px -4px; }
.sw > i { position: absolute; top: 3px; left: 3px; width: 26px; height: 26px; border-radius: 50%; background: #fff; box-shadow: 0 1px 2px rgba(0, 0, 0, .2), 0 2px 6px rgba(0, 0, 0, .12); transition: transform .26s cubic-bezier(.3, 1.3, .5, 1); }
.sw[aria-checked="true"] { background: var(--accent); }
.sw[aria-checked="true"] > i { transform: translateX(20px); }
.sw:disabled, .sw[aria-disabled="true"] { opacity: .35; }
.sw.busy > i::after { content: ""; position: absolute; inset: 5px; border: 2px solid var(--fill2); border-top-color: var(--accent); border-radius: 50%; animation: spin .7s linear infinite; }

/* ползунки — широкие «клавиши пульта»: значение видно сразу, команда по отпусканию */
.ctl + .ctl { margin-top: 18px; }
.ctl-h { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; margin-bottom: 8px; }
.ctl-v { font-size: 30px; font-weight: 650; line-height: 1; letter-spacing: -.035em; }
.ctl-v small { font-size: 15px; }
.ctl-v.unset { font-size: 14px; font-weight: 600; letter-spacing: 0; color: var(--hint); }
.rng-w { position: relative; cursor: pointer; touch-action: pan-y; -webkit-user-select: none; user-select: none; -webkit-touch-callout: none; }
.sheet .rng-w { touch-action: none; }
.rng-w:has(.rng:disabled) { cursor: default; }
.rng { --p: 50%; --fc: var(--accent); display: block; width: 100%; height: 46px; margin: 0; padding: 0; border-radius: 15px; background: transparent; pointer-events: none; -webkit-appearance: none; appearance: none; }
.rng::-webkit-slider-runnable-track { height: 46px; border-radius: 15px; background: linear-gradient(90deg, var(--fc) 0 var(--p), var(--fill) var(--p) 100%); box-shadow: inset 0 0 0 1px var(--line); }
.rng::-moz-range-track { height: 46px; border-radius: 15px; background: linear-gradient(90deg, var(--fc) 0 var(--p), var(--fill) var(--p) 100%); }
.rng::-webkit-slider-thumb { width: 6px; height: 30px; margin-top: 8px; border-radius: 3px; background: #fff; box-shadow: 0 0 0 1px rgba(0, 0, 0, .12), 0 2px 6px rgba(0, 0, 0, .25); -webkit-appearance: none; appearance: none; }
.rng::-moz-range-thumb { width: 6px; height: 30px; border: 0; border-radius: 3px; background: #fff; box-shadow: 0 0 0 1px rgba(0, 0, 0, .12), 0 2px 6px rgba(0, 0, 0, .25); }
.rng.lvl { --fc: rgb(var(--tone, 255 196 140)); }
.rng.pos { --fc: rgba(36, 129, 204, .55); }
@supports (color: color-mix(in srgb, red 50%, blue)) { .rng.pos { --fc: color-mix(in srgb, var(--accent) 55%, var(--card)); } }
.rng.unset { --fc: var(--fill); }
.rng.tone::-webkit-slider-runnable-track { background: linear-gradient(90deg, #ffa757, #ffe2bf 42%, #f3f6ff 64%, #b9dbff); }
.rng.tone::-moz-range-track { background: linear-gradient(90deg, #ffa757, #ffe2bf 42%, #f3f6ff 64%, #b9dbff); }
.rng:disabled { opacity: .4; }
.rng:focus-visible { outline-offset: 3px; border-radius: 17px; }
.chips { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 6px; margin-top: 10px; }
.chip { display: flex; align-items: center; justify-content: center; gap: 5px; min-height: 44px; border-radius: 12px; background: var(--fill); font-size: 14px; font-weight: 650; }
.chip.sel { background: var(--accent); color: var(--on-accent); }
.chip:disabled { opacity: .4; }
.tdot { width: 10px; height: 10px; border-radius: 50%; box-shadow: inset 0 0 0 1px rgba(0, 0, 0, .12); }
.ctl-card { padding: 14px; }
.pair { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-bottom: 16px; }
.pair .wide { margin: 0; }

/* нижняя шторка */
.sheet { position: fixed; inset: 0; z-index: 40; }
.sheet-bg { position: absolute; inset: 0; background: rgba(0, 0, 0, .34); opacity: 0; transition: opacity .24s ease; }
.sheet-card { position: absolute; left: 0; right: 0; bottom: 0; max-width: 640px; max-height: 90%; margin: 0 auto; padding: 0 16px calc(18px + var(--safe-b)); overflow-y: auto; overscroll-behavior: contain; border-radius: 24px 24px 0 0; background: var(--card); box-shadow: 0 -10px 40px rgba(0, 0, 0, .2); transform: translateY(100%); transition: transform .3s cubic-bezier(.2, .85, .25, 1); }
.sheet.open .sheet-bg { opacity: 1; }
.sheet.open .sheet-card { transform: none; }
.sheet.dragging .sheet-card { transition: none; }
.grab { display: grid; place-items: center; height: 26px; margin: 0 -16px; cursor: grab; touch-action: none; }
.grab i { width: 38px; height: 5px; border-radius: 3px; background: var(--fill2); }
.sh-head { display: flex; align-items: center; gap: 12px; min-height: 52px; margin-bottom: 14px; }
.sh-head > div { flex: 1; min-width: 0; }
.sh-head h2 { font-size: 21px; font-weight: 700; line-height: 1.15; letter-spacing: -.025em; }
.sh-head p { margin-top: 2px; font-size: 13px; color: var(--hint); }
.sh-head p.foreign { color: var(--warn-ink); }
.sh-ico.pon { background: var(--soft); color: var(--ink); } /* значок программы: включена — как у строки списка (янтарный у «Утра») */
.sh-ico.pon.warm { background: var(--warn-bg); color: #e08a1e; }
/* редактор программы: группы полей шторки, сегменты в несколько рядов, семь дней в строку, поле времени, три чипа тона */
.pg + .pg { margin-top: 18px; }
.pg > .ctl-h .ctl-v { font-size: 16px; font-weight: 650; letter-spacing: 0; color: var(--head); }
.seg.wrap { flex-wrap: wrap; }
.seg.wrap button { flex: 1 1 0; min-width: 64px; padding: 0 6px; }
@media (max-width: 379px) { .seg.wrap button { padding: 0 3px; font-size: 12.5px; } }
@media (max-width: 359px) { .seg.n4 { display: grid; grid-template-columns: 1fr 1fr; } } /* четыре сегмента штор на узком экране — два ряда по два: «Не трогать» не переносится */
.seg.wrap + .ctl { margin-top: 14px; }
.days { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 6px; }
.wd { min-height: 44px; border-radius: 12px; background: var(--fill); font-size: 14px; font-weight: 650; text-align: center; }
.wd.sel { background: var(--accent); color: var(--on-accent); }
.wd[aria-disabled="true"] { opacity: .6; }
.ptime { display: block; width: 100%; min-height: 48px; padding: 6px 14px; border: 0; border-radius: 12px; background: var(--fill); color: inherit; font: inherit; font-size: 22px; font-weight: 650; font-variant-numeric: tabular-nums; text-align: left; -webkit-appearance: none; appearance: none; }
.chips.c3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.chips.c3 .chip { padding: 0 4px; font-size: 13px; }
.chips.c3 .tdot { flex: none; }
@media (max-width: 379px) { .chips.c3 { grid-template-columns: minmax(0, 1fr) minmax(0, 1.5fr) minmax(0, 1fr); } } /* «нейтральный» — самое длинное имя: ему больше места */
@media (max-width: 339px) { .chips.c3 .chip { gap: 3px; padding: 0 2px; font-size: 12px; } .chips.c3 .tdot { width: 8px; height: 8px; } }
.pnote { margin-top: 18px; }
/* панель редактора закреплена у нижнего края шторки: «Сохранить» доступна без прокрутки на любой высоте экрана; подсказка — одна строка
   фиксированной высоты. Высота панели 8 + 18 + 6 + 54 + 18 = 104 px (+ нижний отступ) — на неё же сдвинут scroll-padding карточки */
.pfoot { position: sticky; bottom: calc(-18px - var(--safe-b)); z-index: 2; margin: 10px -16px calc(-18px - var(--safe-b)); padding: 8px 16px calc(18px + var(--safe-b)); background: var(--card); box-shadow: 0 -1px 0 var(--line); }
.phint { height: 18px; margin: 0 0 6px; overflow: hidden; font-size: 12px; line-height: 18px; color: var(--head); white-space: nowrap; text-overflow: ellipsis; }
.pfoot .pair { grid-template-columns: 1.35fr 1fr; margin: 0; }
.pfoot .pair .wide { margin: 0; gap: 6px; padding: 0 6px; font-size: 14px; }
.wide[aria-disabled="true"] { opacity: .5; }
.sheet-card:has(.pfoot) { scroll-padding-bottom: calc(104px + var(--safe-b)); } /* фокус с клавиатуры (Tab) не уходит под закреплённую панель */
@media (max-width: 339px) { .pfoot .pair .wide { gap: 4px; padding: 0 4px; font-size: 13px; } .pfoot .pair .wide.ghost .i { display: none; } }
.sh-ico { width: 46px; height: 46px; border-radius: 15px; }
.sheet .wide { margin-top: 18px; }
.sh-list .li { padding-left: 2px; padding-right: 2px; }
.sh-list .li + .li::before { left: 48px; }

/* циркадный свет: карточка вверху «Программ» (ступени — таблица .tbl журнала) и редактор шести ступеней */
.oops + .circ { margin-top: 8px; }
.circ .tbl-wrap { margin: 0; padding: 0 14px 6px; }
.circ .li-t { -webkit-line-clamp: none; }
.tbl tr.cur td { color: var(--ink); font-weight: 650; }
.circ > .note { padding: 0 14px 10px; }
.cbtn { display: flex; gap: 8px; padding: 0 14px 14px; }
.cbtn .wide { margin: 0; font-size: 15px; }
#circ-foot .wide { margin: 0; }
.cst { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; padding: 12px 0; }
.cst + .cst { border-top: 1px solid var(--line); }
.cst > b, .cerr { grid-column: 1 / -1; }
.cst label { display: grid; gap: 4px; font-size: 12px; font-weight: 600; color: var(--head); }
.cst input, .cst select { width: 100%; min-height: 44px; padding: 6px 12px; border: 0; border-radius: 12px; background: var(--fill); color: var(--text); font: inherit; font-size: 17px; font-weight: 650; font-variant-numeric: tabular-nums; }
.cst input { -webkit-appearance: none; appearance: none; }
.cst [aria-invalid="true"] { box-shadow: inset 0 0 0 2px var(--hot); }
.cst.bad > b, .cerr { color: var(--hot-ink); }
.cerr { font-size: 13px; font-weight: 600; }
@media (min-width: 420px) { .cst { grid-template-columns: repeat(4, minmax(0, 1fr)); } }

/* тосты — сверху, в зоне взгляда: не закрывают пульт у пальца; экран целиком (401/403) */
.toasts { position: fixed; left: 12px; right: 12px; top: calc(10px + var(--tg-content-safe-area-inset-top, 0px)); z-index: 70; display: flex; flex-direction: column; gap: 8px; max-width: 616px; margin: 0 auto; pointer-events: none; }
body.offline .toasts { top: calc(var(--net-h, 54px) + 4px); }
.toast { display: flex; align-items: flex-start; gap: 10px; padding: 12px 14px; border-radius: 16px; background: rgba(28, 28, 30, .94); color: #fff; box-shadow: 0 10px 30px rgba(0, 0, 0, .25); pointer-events: auto; animation: toast-in .26s cubic-bezier(.2, .9, .3, 1.2); }
[data-scheme="dark"] .toast { background: rgba(58, 58, 62, .97); }
.toast .i { width: 22px; height: 22px; }
.toast.ok .i { color: #4cd964; }
.toast.warn .i { color: #ffc44d; }
.toast.bad .i { color: #ff6b63; }
.toast b { display: block; font-size: 15px; font-weight: 650; }
.toast span { display: block; margin-top: 2px; font-size: 13px; line-height: 1.35; color: rgba(255, 255, 255, .72); }
.toast.out { opacity: 0; transform: translateY(-8px); transition: opacity .2s, transform .2s; }
@keyframes toast-in { from { opacity: 0; transform: translateY(-12px) scale(.98); } }
.fatal { position: fixed; inset: 0; z-index: 80; display: grid; place-items: center; padding: 24px; background: var(--bg); }
.fatal-card { max-width: 340px; text-align: center; }
.fatal-card .ico-b { width: 76px; height: 76px; margin: 0 auto 18px; border-radius: 26px; background: var(--card); box-shadow: var(--shadow); }
.fatal-card .ico-b .i { width: 36px; height: 36px; }
.fatal-card h1 { font-size: 24px; font-weight: 750; line-height: 1.15; letter-spacing: -.025em; }
.fatal-card p { margin-top: 10px; font-size: 15px; line-height: 1.45; color: var(--hint); }
.fatal-card .btn { min-width: 180px; }

/* скелетоны и ожидание */
.sk { position: relative; overflow: hidden; border-radius: 16px; background: var(--card); box-shadow: var(--shadow); }
.sk::after { content: ""; position: absolute; inset: 0; background: linear-gradient(100deg, transparent 20%, rgba(128, 128, 128, .1) 45%, transparent 70%); transform: translateX(-100%); animation: shimmer 1.3s ease-in-out infinite; }
.sk-head { width: 60%; height: 54px; background: transparent; box-shadow: none; }
.sk-head::before { content: ""; position: absolute; left: 0; bottom: 4px; width: 100%; height: 30px; border-radius: 10px; background: var(--fill); }
.sk-panel { height: 160px; }
.sk-stats { height: 84px; }
.sk-scen { height: 240px; }
.sk-grid { height: 380px; }
.sk-list { height: 260px; }
.sk-chart { height: 340px; background: var(--fill); box-shadow: none; }
@keyframes shimmer { to { transform: translateX(100%); } }
.spin { display: inline-block; width: 22px; height: 22px; border: 2.5px solid currentColor; border-right-color: transparent; border-radius: 50%; animation: spin .75s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* пылесосы */
.vac { padding: 14px; }
.vac + .vac { margin-top: 12px; }
.vac-h { display: flex; align-items: center; gap: 12px; }
.vac-h > div { flex: 1; min-width: 0; }
.vac-h h2 { font-size: 19px; font-weight: 700; letter-spacing: -.02em; }
.vac-h p { font-size: 12px; color: var(--hint); }
.vac-h .ico-b { width: 46px; height: 46px; border-radius: 15px; background: var(--fill); color: var(--hint); }
.vac.run .vac-h .ico-b { background: var(--soft); color: var(--ink); }
.vac.run .vac-h .ico-b .i { animation: spin 3.2s linear infinite; }
.badge { display: inline-flex; align-items: center; gap: 6px; height: 26px; padding: 0 10px; border-radius: 13px; background: var(--soft); color: var(--ink); font-size: 12px; font-weight: 650; white-space: nowrap; }
.badge::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.badge.bad { background: var(--hot-bg); color: var(--hot-ink); }
.vac-state { margin-top: 12px; font-size: 20px; font-weight: 650; letter-spacing: -.02em; }
.vac-err { display: flex; align-items: center; gap: 8px; margin-top: 8px; padding: 8px 10px; border-radius: 12px; background: var(--hot-bg); color: var(--hot-ink); font-size: 13px; font-weight: 600; }
.vac-err .i { width: 18px; height: 18px; }
.metrics { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; margin-top: 12px; }
.metric { min-width: 0; padding: 10px 10px 9px; border-radius: 12px; background: var(--fill); }
.metric b { display: block; overflow: hidden; font-size: 22px; font-weight: 650; line-height: 1.05; letter-spacing: -.035em; white-space: nowrap; text-overflow: ellipsis; }
.metric b small { margin-left: 1px; font-size: 13px; }
.metric b.txt { font-size: 15px; line-height: 1.4; letter-spacing: -.01em; }
.metric span { display: block; margin-top: 3px; font-size: 12px; font-weight: 600; color: var(--hint); }
.meter { height: 4px; margin-top: 7px; overflow: hidden; border-radius: 2px; background: var(--fill2); }
.meter i { display: block; height: 100%; border-radius: inherit; background: var(--ok); }
.meter.low i { background: var(--warn); }
.vac-meta { margin-top: 10px; font-size: 13px; color: var(--hint); }
.vac-act { display: grid; grid-template-columns: 2fr 1fr 1fr 1fr; gap: 6px; margin-top: 14px; }
.vbtn { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px; min-height: 56px; padding: 4px; border-radius: 15px; background: var(--fill); font-size: 11px; font-weight: 650; }
.vbtn .i { width: 22px; height: 22px; }
.vbtn.main { flex-direction: row; gap: 8px; background: var(--accent); color: var(--on-accent); font-size: 16px; }
.vbtn:disabled { opacity: .4; }

/* журнал: график нагрева и лента */
.chart-card { padding: 14px 12px 12px; }
.ch-h, .feed-h { display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; padding: 0 4px 12px; }
.feed-h { align-items: center; padding: 4px 4px 2px; }
.segc { display: inline-flex; flex: none; padding: 3px; border-radius: 13px; background: var(--fill); }
.segc button { position: relative; min-width: 64px; min-height: 38px; padding: 0 12px; border-radius: 10px; color: var(--hint); font-size: 13px; font-weight: 650; text-align: center; }
.segc button::after { content: ""; position: absolute; inset: -3px 0; }
.segc button[aria-checked="true"] { background: var(--card); color: var(--text); box-shadow: 0 1px 3px rgba(0, 0, 0, .14); }
[data-scheme="dark"] .segc button[aria-checked="true"] { background: var(--fill2); }
.legend { display: flex; flex-wrap: wrap; gap: 6px 14px; padding: 0 4px 6px; font-size: 12px; font-weight: 600; }
.legend > span { display: inline-flex; align-items: center; gap: 6px; white-space: nowrap; }
.legend b, .tip b { color: var(--text); font-weight: 650; }
.key { width: 14px; height: 3px; border-radius: 2px; background: currentColor; }
.k1 { color: var(--c1); } .k2 { color: var(--c2); } .k3 { color: var(--c3); } .kl { color: var(--cl); } .kw { color: var(--cw); }
.legend > span > span { color: var(--hint); }
.chart { position: relative; margin: 0 -2px; touch-action: pan-y; }
.chart svg { display: block; width: 100%; height: auto; overflow: visible; }
.chart .gl { stroke: var(--line); stroke-width: 1; shape-rendering: crispEdges; }
.chart .base { stroke: var(--fill2); stroke-width: 1; shape-rendering: crispEdges; }
.chart text { fill: var(--hint); font-size: 10px; font-weight: 500; }
.chart text.pt { fill: var(--head); font-size: 10.5px; font-weight: 650; letter-spacing: .04em; }
.chart .ln { fill: none; stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; }
.chart .l1 { stroke: var(--c1); } .chart .l2 { stroke: var(--c2); } .chart .l3 { stroke: var(--c3); } .chart .lw { stroke: var(--cw); }
.chart .bar { fill: var(--cl); }
.chart .aw { fill: var(--cw); opacity: .1; }
.chart .thr { stroke-width: 1; shape-rendering: crispEdges; }
.chart .thr.w { stroke: var(--warn); } .chart .thr.h { stroke: var(--hot); }
.chart text.thr-t { font-weight: 650; }
.chart .xh { stroke: var(--text); stroke-opacity: .4; stroke-width: 1; shape-rendering: crispEdges; }
.chart .hd { stroke: var(--card); stroke-width: 2; }
.chart .d1 { fill: var(--c1); } .chart .d2 { fill: var(--c2); } .chart .d3 { fill: var(--c3); }
.chart .hit { fill: transparent; cursor: crosshair; }
.tip { position: absolute; top: 4px; z-index: 3; min-width: 136px; padding: 8px 10px; border-radius: 12px; background: var(--card); box-shadow: var(--float); font-size: 12px; line-height: 1.5; pointer-events: none; }
.tip time { display: block; margin-bottom: 2px; font-weight: 650; color: var(--hint); }
.tip > div { display: flex; align-items: center; gap: 6px; }
.tip b { margin-left: auto; padding-left: 10px; }
.tip .key { width: 10px; }
.corr { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-top: 12px; }
.corr-i { padding: 10px 12px; border-radius: 12px; background: var(--fill); }
.corr-i > span { display: block; font-size: 12px; font-weight: 600; color: var(--hint); }
.corr-i b { display: block; margin-top: 4px; font-size: 24px; font-weight: 650; line-height: 1; letter-spacing: -.03em; }
.corr-i em { display: block; margin-top: 3px; font-size: 12px; font-style: normal; font-weight: 650; }
.corr-m { height: 4px; margin-top: 8px; overflow: hidden; border-radius: 2px; background: var(--fill2); }
.corr-m i { display: block; height: 100%; border-radius: inherit; background: var(--accent); }
.chart-card .note { margin-top: 10px; padding: 0 2px; }
.tbl-wrap { margin: 0 -2px; padding: 0 2px; overflow-x: auto; }
.tbl { width: 100%; border-collapse: collapse; font-size: 12px; }
.tbl th, .tbl td { padding: 6px 4px; text-align: right; white-space: nowrap; }
.tbl th:first-child, .tbl td:first-child { text-align: left; }
.tbl th { font-weight: 650; color: var(--hint); white-space: normal; vertical-align: bottom; }
.tbl tr + tr td { border-top: 1px solid var(--line); }
.feed { margin: 0; padding: 4px 0; list-style: none; }
.day { padding: 12px 14px 4px; font-size: 12px; font-weight: 650; letter-spacing: .07em; text-transform: uppercase; color: var(--head); }
.ev { position: relative; display: grid; grid-template-columns: 42px minmax(0, 1fr); gap: 0 8px; padding: 10px 14px 10px 16px; }
.ev + .ev::before { content: ""; position: absolute; top: 0; left: 66px; right: 0; height: 1px; background: var(--line); }
.ev.ev-alarm::after { content: ""; position: absolute; top: 12px; bottom: 12px; left: 0; width: 3px; border-radius: 0 2px 2px 0; background: var(--warn); }
.ev.ev-hot::after { background: var(--hot); }
.ev.ev-ok::after { background: var(--ok); }
.ev time { font-size: 13px; font-weight: 650; line-height: 1.45; color: var(--hint); }
.ev p { font-size: 14px; line-height: 1.4; overflow-wrap: anywhere; }
.ev-who { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin-top: 4px; font-size: 12px; color: var(--hint); }
.who { font-weight: 650; }
.who.owner { color: var(--ink); }
.res { display: inline-flex; align-items: center; height: 20px; padding: 0 7px; border-radius: 10px; background: var(--ok-bg); color: var(--ok-ink); font-size: 11px; font-weight: 650; }
.res.warn { background: var(--warn-bg); color: var(--warn-ink); }
.res.bad { background: var(--hot-bg); color: var(--hot-ink); }

@media (min-width: 560px) { .lights, .rooms { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
@media (min-height: 800px) { /* высокий экран: место есть — главная просторнее, плитки и сводка крупнее */
  .view[data-screen="home"] { gap: 14px; padding-top: 10px; }
  .head { min-height: 56px; }
  .title { font-size: 30px; }
  .panel { padding: 12px; }
  .spark { height: 20px; margin-top: 6px; }
  .stat { min-height: 64px; padding: 11px 12px; }
  .stat b { font-size: 23px; }
  .tile { min-height: 88px; gap: 7px; padding-top: 10px; padding-bottom: 8px; font-size: 12px; }
  .tile .ico { width: 42px; height: 42px; border-radius: 14px; }
}
@media (max-width: 399px) { .t-l.fit { font-size: 11px; } }
@media (max-width: 379px) { .t-l.fit { font-size: 10.5px; letter-spacing: -.03em; } }
@media (max-width: 379px) { .tab { font-size: 10.5px; letter-spacing: 0; } } /* «Программы» целиком в колонке 360 px (69,6 px) */
@media (max-width: 339px) { .tab { font-size: 9.5px; letter-spacing: -.01em; } } /* и в колонке 320 px (61,6 px) */
@media (max-width: 350px) { .scen { grid-template-columns: repeat(3, minmax(0, 1fr)); } .title { font-size: 24px; } .s-t { font-size: 21px; } }
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
  :active, .room:has(.room-hit:active), .lc:has(.lc-hit:active) { transform: none !important; }
}
