/* static/overview.css
   Сводка по всем подсистемам. Оформление то же, что на остальных
   страницах: полупрозрачные поверхности, тонкая светлая грань, размытие
   фона, скругления из общей шкалы. */

:root {
    /* Сплошной цвет под обоями. Пока картинка едет, слой фона был
       прозрачным — экран оставался белым, и на телефоне это читалось как
       зависание приложения. Цвет красит его мгновенно. */
    --bg-solid: #0f1216;

    /* Прозрачность стекла — как на эталонной странице инвертера
       (static/style.css): иначе на разных страницах степень размытия
       читается по-разному, хотя backdrop-filter один и тот же. */
    --lg-bg: rgba(255, 255, 255, 0.12);
    --lg-bg-weak: rgba(255, 255, 255, 0.06);
    --lg-shadow: 0 10px 34px rgba(0, 0, 0, 0.34), 0 1px 1px rgba(0, 0, 0, 0.20);
}

@media (prefers-color-scheme: light) {
    :root:not([data-theme="dark"]) {
        --bg-file: url('/static/wallpaper.jpg');
        --bg-solid: #e9edf3;
        --dash-bg: rgba(255, 255, 255, 0.12);
        --card-bg: rgba(255, 255, 255, 0.22);
        --card-bg-strong: rgba(255, 255, 255, 0.55);
        --card-border: rgba(255, 255, 255, 0.55);
        --card-highlight: rgba(255, 255, 255, 0.75);
        --lg-bg: rgba(255, 255, 255, 0.55);
        --lg-bg-weak: rgba(255, 255, 255, 0.34);
        --lg-shadow: 0 10px 34px rgba(31, 38, 74, 0.14), 0 1px 1px rgba(31, 38, 74, 0.05);
        --text-main: #1c1c1e;
    }
}

:root[data-theme="light"] {
    --bg-file: url('/static/wallpaper.jpg');
    --bg-solid: #e9edf3;
    --dash-bg: rgba(255, 255, 255, 0.12);
    --card-bg: rgba(255, 255, 255, 0.22);
    --card-bg-strong: rgba(255, 255, 255, 0.55);
    --card-border: rgba(255, 255, 255, 0.55);
    --card-highlight: rgba(255, 255, 255, 0.75);
    --lg-bg: rgba(255, 255, 255, 0.55);
    --lg-bg-weak: rgba(255, 255, 255, 0.34);
    --lg-shadow: 0 10px 34px rgba(31, 38, 74, 0.14), 0 1px 1px rgba(31, 38, 74, 0.05);
    --text-main: #1c1c1e;
}

* { box-sizing: border-box; }

body {
    margin: 0;
    font-family: var(--font-apple);
    letter-spacing: -0.01em;
    color: var(--text-main);
    min-height: 100vh;
    padding: var(--sat) var(--sar) var(--sab) var(--sal);
    position: relative;
}

/* Фон — отдельным зафиксированным слоем (::before), а НЕ
   background-attachment:fixed на body: в Chromium это ломает
   backdrop-filter у потомков (см. static/style.css) — размытие
   карточек переставало рендериться вовсе. */
body::before {
    content: '';
    position: fixed;
    inset: 0;
    z-index: -1;
    background-color: var(--bg-solid);
    background-image: var(--bg-file);
    background-position: center center;
    background-repeat: no-repeat;
    background-size: cover;
}

.shell {
    min-height: 100vh;
    padding: 26px 22px 40px;
    background: var(--dash-bg);
    backdrop-filter: blur(var(--lg-blur)) saturate(var(--lg-saturate));
    -webkit-backdrop-filter: blur(var(--lg-blur)) saturate(var(--lg-saturate));
}

/* ── Шапка и навигация ─────────────────────────────────────────────── */
.page-head {
    display: flex; align-items: center; gap: 18px; flex-wrap: wrap;
    margin: 0 auto 20px; max-width: min(100%, 2400px);
}
.page-head h1 {
    display: flex; align-items: center; gap: 9px; margin: 0;
    font-size: 21px; font-weight: 700; letter-spacing: -0.02em; line-height: 1.2;
}
/* «Выйти» вынесена из правой обоймы прямым ребёнком шапки: только так её
   можно переставить в строку с названием, когда экран узкий. На широком
   она возвращается на своё место — последней справа. */
#logout { order: 3; }
.page-head h1 { order: 0; }
.wx { order: 1; }
.head-right { order: 2; }

.brand-logo { width: 28px; height: 28px; border-radius: 7px; display: block; object-fit: contain; }
.ver { font-size: 12px; font-weight: 600; opacity: 0.5; letter-spacing: 0; }

.topnav { display: flex; gap: 6px; flex-wrap: wrap; }
.topnav-item {
    padding: 6px 14px; border-radius: var(--lg-radius-pill);
    background: var(--lg-bg-weak); border: 1px solid var(--card-border);
    box-shadow: inset 0 1px 0 var(--card-highlight);
    color: var(--text-main); text-decoration: none;
    font-size: 0.78rem; font-weight: 600;
    transition: background 0.18s ease;
}
.topnav-item:hover { background: var(--lg-bg); }
.topnav-item.current { background: var(--lg-bg); opacity: 0.75; cursor: default; }

/* ---------- Погодная полоса ----------
   Живёт в самой шапке, в пустом месте между названием и кнопками: там
   была широкая пустота во всю строку, а погода — как раз то, что читают
   взглядом мимоходом. Высота держится в размер шапки, поэтому всё
   плотное: показатели идут колонками «название сверху, значение снизу»,
   часы и дни при нехватке места прокручиваются вбок, а на узком экране
   вся полоса переносится под название целиком. */
.wx {
    flex: 1 1 460px; min-width: 0;
    display: flex; align-items: center; gap: 14px;
    padding: 7px 14px; border-radius: var(--lg-radius-md);
    background: var(--lg-bg-weak); border: 1px solid var(--card-border);
    box-shadow: inset 0 1px 0 var(--card-highlight);
}
.wx-sep { width: 1px; align-self: stretch; background: var(--card-border);
          flex: 0 0 auto; margin: 2px 0; }

/* Сейчас: значок, крупные градусы, словом и разброс за сутки */
.wx-now { display: flex; align-items: center; gap: 10px; flex: 0 0 auto; }
.wx-now > svg { width: 38px; height: 38px; flex: 0 0 auto; }
.wx-temp { font-size: 1.55rem; font-weight: 800; letter-spacing: -0.03em; line-height: 1; }
.wx-word { font-size: 0.76rem; font-weight: 700; margin-top: 2px; white-space: nowrap; }
.wx-range { font-size: 0.68rem; opacity: 0.55; margin-top: 1px; font-variant-numeric: tabular-nums; }

/* Показатели: колонка на каждый — подпись сверху мелким, значение снизу.
   В строку они не помещались: девять пар «название: значение» съедали
   всю ширину шапки. */
/* Сетка равными долями, а не строка: колонки растягиваются на всю
   ширину ячейки, и справа не остаётся пустоты. При нехватке места
   auto-fit сам переносит их в два ряда, ничего не сминая. */
.wx-params { display: grid; grid-template-columns: repeat(auto-fit, minmax(104px, 1fr));
             gap: 4px 12px; flex: 1 1 auto; min-width: 0; align-content: center;
             justify-items: start; }
.wx-p { display: flex; flex-direction: column; gap: 1px; min-width: 0; }
.wx-p i { font-style: normal; font-size: 0.72rem; opacity: 0.58; font-weight: 500;
          white-space: nowrap; letter-spacing: 0.01em; }
.wx-p b { font-size: 0.92rem; font-weight: 700; white-space: nowrap;
          font-variant-numeric: tabular-nums; display: flex; align-items: center; gap: 4px; }
.wx-arrow { opacity: 0.7; flex: 0 0 auto; }

/* Часы: узкие колонки, при нехватке места едут вбок */
.wx-strip { display: flex; gap: 1px; flex: 0 1 auto; overflow-x: auto;
            scrollbar-width: none; }
.wx-strip::-webkit-scrollbar { display: none; }
.wx-h { display: flex; flex-direction: column; align-items: center; gap: 1px;
        padding: 2px 6px; border-radius: var(--lg-radius-sm); min-width: 44px; }
.wx-h:hover { background: var(--lg-bg); }
.wx-h span { font-size: 0.62rem; opacity: 0.55; font-variant-numeric: tabular-nums; }
.wx-h svg { width: 19px; height: 19px; }
.wx-h b { font-size: 0.76rem; font-weight: 700; font-variant-numeric: tabular-nums; }
/* Вероятность осадков — только когда есть о чём говорить */
.wx-h em { font-style: normal; font-size: 0.58rem; font-weight: 700; color: #3B9DFF; }
.wx-h em:empty { display: none; }

/* Дни: три строки в столбик, справа от часов */
.wx-days { display: flex; flex-direction: column; justify-content: center;
           gap: 1px; flex: 0 0 auto; }
.wx-day { display: flex; align-items: center; gap: 6px; font-size: 0.72rem; }
.wx-day span { opacity: 0.55; min-width: 52px; }
.wx-day svg { width: 16px; height: 16px; flex: 0 0 auto; }
.wx-day b { font-weight: 700; font-variant-numeric: tabular-nums; min-width: 26px; text-align: right; }
.wx-day i { font-style: normal; opacity: 0.5; font-variant-numeric: tabular-nums; }

/* Тесно — раздеваемся по очереди, начиная с того, без чего легче всего:
   сперва три дня, потом второстепенные показатели. Часы держим до
   последнего: на телефоне «что будет через два часа» полезнее, чем
   давление в гектопаскалях. */
@media (max-width: 1500px) { .wx-days, .wx-strip + .wx-sep { display: none; } }
@media (max-width: 1150px) { .wx-p--minor { display: none; } }

/* Телефон и PWA. Полоса занимает всю ширину и разворачивается в два
   этажа: сверху погода с показателями, снизу часы во всю ширину с
   прокруткой вбок. Раньше девять показателей ложились в две колонки —
   пять рядов, и шапка вырастала втрое; часы при этом были спрятаны,
   хотя как раз они здесь и нужны. */
@media (max-width: 860px) {
    /* Шапка складывается в этажи: название, погода, кнопки. Кнопки
       обязаны переноситься — без этого «Выйти» уезжала за правый край
       экрана и была наполовину срезана. */
    .page-head { gap: 10px 12px; }
    /* «Выйти» встаёт в строку с названием и прижимается к правому краю:
       строка с названием всё равно наполовину пустая, а обойме кнопок
       ниже от этого хватает места без переноса. */
    #logout { order: 0; margin-left: auto; }
    /* flex-end здесь давал пустой промежуток слева и ронял «Пользователи»
       на свою строку у правого края, когда обойма не помещалась в одну
       строку целиком — на телефоне это обычный случай. flex-start вместо
       этого прижимает всё к левому краю, второй ряд включая. */
    .head-right { flex-wrap: wrap; margin-left: 0; width: 100%;
                  justify-content: flex-start; row-gap: 6px; }
    .wx { flex-basis: 100%; flex-wrap: wrap; gap: 8px 12px; padding: 9px 12px; }
    .wx-sep { display: none; }
    .wx-temp { font-size: 1.4rem; }
    .wx-now { flex: 0 0 auto; }
    .wx-params { flex: 1 1 150px;
                 grid-template-columns: repeat(auto-fit, minmax(100px, 1fr)); gap: 3px 10px; }
    .wx-strip { display: flex; flex: 1 0 100%; justify-content: space-between;
                border-top: 1px solid var(--card-border); padding-top: 6px; }
    .wx-h { min-width: 40px; padding: 1px 3px; }
}
/* На телефоне восемь часов не влезают, и последний оказывался срезан на
   краю — а обрезанный столбик читается как поломка, а не как «листайте
   вбок». Показываем шесть целых. */
@media (max-width: 480px) {
    .wx-h:nth-child(n+7) { display: none; }
}

/* ── Полоса тревог: её нет, когда всё в порядке ────────────────────── */
.alerts { max-width: min(100%, 2400px); margin: 0 auto 16px; display: grid; gap: 8px; }
.alert {
    display: flex; align-items: center; gap: 10px;
    padding: 10px 14px; border-radius: var(--lg-radius-md);
    background: var(--card-bg); border: 1px solid var(--card-border);
    backdrop-filter: blur(var(--lg-blur-soft));
    -webkit-backdrop-filter: blur(var(--lg-blur-soft));
    color: var(--text-main); text-decoration: none;
    font-size: 0.85rem; font-weight: 600;
}
.alert-mark { width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0; }
.alert-error .alert-mark   { background: var(--danger-color);  box-shadow: 0 0 8px var(--danger-color); }
.alert-warning .alert-mark { background: var(--warning-color); box-shadow: 0 0 8px var(--warning-color); }
.alert-error   { border-color: rgba(255, 69, 58, 0.45); }
.alert-warning { border-color: rgba(255, 159, 10, 0.40); }

/* ── Плитки ────────────────────────────────────────────────────────── */
/* Плитки стоят колонками, а не рядами. В сетке высота ряда равнялась
   самой рослой карточке, и под низкими зияли дыры в пол-экрана. CSS-
   колонки (columns) эту беду не решают: браузер раскидывает содержимое
   по своему разумению, оставляя пустые верхушки — проверено, вышел
   бардак. Поэтому столбцы настоящие, а раскладывает по ним JS
   (layoutTiles): каждая плитка идёт в тот столбец, который сейчас
   короче. Здесь только рамка. */
.tiles {
    max-width: min(100%, 2400px); margin: 0 auto;
    display: flex; align-items: flex-start; gap: 20px;
}
.tiles-col { flex: 1 1 0; min-width: 0; display: flex; flex-direction: column; gap: 20px; }

.tile {
    display: block; text-decoration: none; color: var(--text-main);
    padding: 22px 24px 24px;
    background: var(--card-bg);
    backdrop-filter: blur(var(--lg-blur)) saturate(var(--lg-saturate));
    -webkit-backdrop-filter: blur(var(--lg-blur)) saturate(var(--lg-saturate));
    /* Слой под backdrop-filter раньше возникал случайно, из-за transform
       в :hover ниже — просим его явно, чтобы не зависеть от совпадения */
    will-change: backdrop-filter;
    border: 1px solid var(--card-border);
    border-radius: var(--lg-radius-xl);
    box-shadow: var(--lg-shadow), inset 0 1px 0 var(--card-highlight);
    transition: transform 0.18s ease, box-shadow 0.18s ease, background 0.25s ease;
}
.tile:hover {
    transform: translateY(-3px);
    box-shadow: var(--lg-shadow), inset 0 1px 0 var(--card-highlight),
                0 16px 44px rgba(0, 0, 0, 0.20);
}
.tile:active { transform: translateY(-1px); }

.tile-head {
    display: flex; align-items: center; gap: 10px;
    padding-bottom: 12px; margin-bottom: 14px;
    border-bottom: 1px solid var(--card-border);
}
.tile-icon { width: 26px; height: 26px; border-radius: 6px; object-fit: contain; }
.tile-title { font-size: 1rem; font-weight: 700; letter-spacing: -0.02em; }
.tile-go { margin-left: auto; opacity: 0.4; font-size: 1.1rem; }
.tile:hover .tile-go { opacity: 0.8; }

.pill {
    padding: 3px 10px; border-radius: var(--lg-radius-pill);
    font-size: 0.68rem; font-weight: 700; letter-spacing: 0;
    border: 1px solid var(--card-border); background: var(--lg-bg-weak);
}
.pill.ok   { color: var(--good-color);    border-color: rgba(48, 209, 88, 0.45); }
.pill.warn { color: var(--warning-color); border-color: rgba(255, 159, 10, 0.45); }
.pill.bad  { color: var(--danger-color);  border-color: rgba(255, 69, 58, 0.45); }

.split { display: flex; align-items: center; gap: 18px; }
.rows { flex: 1; min-width: 0; display: grid; gap: 9px; }

.row { display: flex; align-items: center; gap: 9px; min-width: 0; }
.row-icon { width: 16px; flex-shrink: 0; opacity: 0.75; }
.mi { width: 15px; height: 15px; display: block; }
.row-value {
    font-size: 1.05rem; font-weight: 700; font-variant-numeric: tabular-nums;
    flex-shrink: 0; min-width: 3.4em;
}
.row-value .u, .u { font-size: 0.66rem; font-weight: 600; opacity: 0.6; margin-left: 3px; }
.row-label {
    font-size: 0.74rem; opacity: 0.6; overflow: hidden;
    text-overflow: ellipsis; white-space: nowrap;
}

/* Кольцо заряда */
.ring { position: relative; width: 96px; flex-shrink: 0; text-align: center; }
.ring svg { width: 96px; height: 96px; transform: rotate(-90deg); display: block; }
.ring-bg { fill: none; stroke: var(--card-border); stroke-width: 7; }
.ring-fg {
    fill: none; stroke-width: 7; stroke-linecap: round;
    transition: stroke-dasharray 0.6s ease;
}
.ring-ok  .ring-fg { stroke: var(--good-color); }
.ring-mid .ring-fg { stroke: var(--warning-color); }
.ring-low .ring-fg { stroke: var(--danger-color); }
.ring-text {
    position: absolute; top: 30px; left: 0; right: 0;
    font-variant-numeric: tabular-nums; line-height: 1;
}
.ring-text b { font-size: 1.6rem; font-weight: 700; letter-spacing: -0.03em; }
.ring-text span { font-size: 0.7rem; opacity: 0.6; margin-left: 2px; }
.ring-label { font-size: 0.68rem; opacity: 0.55; margin-top: 2px; }

/* Подблоки в плитке Xiaomi */
.sub + .sub { margin-top: 14px; padding-top: 12px; border-top: 1px solid var(--card-border); }
.sub-head {
    display: flex; align-items: baseline; gap: 8px; margin-bottom: 8px;
    font-size: 0.78rem; font-weight: 700; text-transform: uppercase;
    letter-spacing: 0.06em; opacity: 0.7;
}
.sub-state { font-size: 0.72rem; font-weight: 600; text-transform: none;
             letter-spacing: 0; opacity: 0.8; margin-left: auto; }

.air-line { display: flex; align-items: baseline; gap: 7px; }
.air-line b { font-size: 1.5rem; font-weight: 700; letter-spacing: -0.02em; }
.air-word { font-size: 0.76rem; opacity: 0.7; }
.air-dot {
    width: 10px; height: 10px; border-radius: 50%; align-self: center;
    background: currentColor; box-shadow: 0 0 10px currentColor;
}
.air-excellent .air-dot { color: #2dd4b2; }
.air-good      .air-dot { color: #7ed957; }
.air-fair      .air-dot { color: #f2c94c; }
.air-poor      .air-dot { color: #f2994a; }
.air-bad       .air-dot { color: #eb5757; }

.empty { font-size: 0.82rem; opacity: 0.6; padding: 6px 0 2px; }

.foot {
    max-width: min(100%, 2400px); margin: 20px auto 0;
    font-size: 0.72rem; opacity: 0.45; text-align: right;
}


/* Короткие значения плитками: напряжения по фазам, температуры по комнатам.
   Пять коротких чисел читаются быстрее, чем столько же строк. */
.chips {
    display: flex; flex-wrap: wrap; gap: 8px;
    margin-top: 16px; padding-top: 14px;
    border-top: 1px solid var(--card-border);
}
.chip {
    display: flex; flex-direction: column; gap: 1px;
    padding: 7px 12px; min-width: 74px;
    background: var(--lg-bg-weak); border: 1px solid var(--card-border);
    border-radius: var(--lg-radius-md);
    box-shadow: inset 0 1px 0 var(--card-highlight);
}
.chip-k {
    font-size: 0.62rem; opacity: 0.55; white-space: nowrap;
    overflow: hidden; text-overflow: ellipsis; max-width: 10em;
}
.chip-v { font-size: 1rem; font-weight: 700; font-variant-numeric: tabular-nums; }
.chip-v i { font-style: normal; font-size: 0.62rem; opacity: 0.6; margin-left: 2px; }
.chip-v.bad { color: var(--danger-color); }
.chip-out { border-color: rgba(100, 210, 255, 0.4); }
.chip-out .chip-v { color: #64d2ff; }

/* Карта уборки прямо в плитке: по ней видно, где пылесос уже прошёл */
.map-thumb {
    margin-top: 14px; padding: 10px;
    background: var(--lg-bg-weak); border: 1px solid var(--card-border);
    border-radius: var(--lg-radius-lg);
    display: flex; justify-content: center;
}
.map-thumb img { max-height: 300px; max-width: 100%; display: block; }


/* Подзаголовок внутри плитки: делит её на смысловые части */
.sect {
    margin: 18px 0 10px; padding-top: 14px;
    border-top: 1px solid var(--card-border);
    font-size: 0.66rem; font-weight: 700; letter-spacing: 0.08em;
    text-transform: uppercase; opacity: 0.5;
}
.chips.flat { margin-top: 0; padding-top: 0; border-top: none; }

/* Полоски: кто потребляет и сколько осталось ресурса. Длина полоски
   показывает долю, поэтому сравнение читается без чтения чисел. */
.bars { display: grid; gap: 8px; }
.bar-row { display: flex; align-items: center; gap: 10px; }
.bar-name {
    font-size: 0.74rem; opacity: 0.75; width: 8.5em; flex-shrink: 0;
    overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.bar-wrap {
    flex: 1; height: 7px; border-radius: var(--lg-radius-pill);
    background: var(--lg-bg-weak); border: 1px solid var(--card-border);
    overflow: hidden; min-width: 40px;
}
.bar {
    display: block; height: 100%; border-radius: var(--lg-radius-pill);
    background: linear-gradient(90deg, #2dd4bf, #22a3e8);
    transition: width 0.5s ease;
}
.bar-low { background: linear-gradient(90deg, #f2994a, #eb5757); }
.bar-mid { background: linear-gradient(90deg, #ffd60a, #f2994a); }

/* Ресурс расходников пылесоса: четыре тона, чтобы полоски не сливались
   в одну — красный/оранжевый/жёлтый/зелёный по проценту остатка. */
.bar-crit    { background: linear-gradient(90deg, #ff453a, #eb5757); }
.bar-warn    { background: linear-gradient(90deg, #ff9f0a, #f2994a); }
.bar-caution { background: linear-gradient(90deg, #ffd60a, #ffcc00); }
.bar-good    { background: linear-gradient(90deg, #30d158, #2dd4bf); }
.bar-val {
    font-size: 0.78rem; font-weight: 700; font-variant-numeric: tabular-nums;
    width: 4.2em; text-align: right; flex-shrink: 0;
}
.bar-val i { font-style: normal; font-size: 0.6rem; opacity: 0.6; margin-left: 2px; }

/* Расписание уборки в сводке — только чтение */
.sched-line { display: flex; align-items: center; gap: 12px; margin-bottom: 6px; }
.sched-time {
    font-size: 1.1rem; font-weight: 700; font-variant-numeric: tabular-nums;
}
.sched-time.off { opacity: 0.45; text-decoration: line-through; }
.sched-days { display: flex; gap: 4px; }
.sched-days .d {
    padding: 2px 7px; border-radius: var(--lg-radius-pill);
    background: var(--lg-bg-weak); border: 1px solid var(--card-border);
    font-size: 0.62rem; font-weight: 600;
}

/* ── Переключатель темы: один на весь сайт, живёт на сводке ────────── */
.theme-toggle { position: relative; width: 54px; height: 28px; cursor: pointer; flex-shrink: 0; }
.theme-toggle input { position: absolute; opacity: 0; width: 100%; height: 100%; margin: 0; cursor: pointer; }
.theme-toggle .track {
    position: absolute; inset: 0; border-radius: var(--lg-radius-pill);
    background: var(--lg-bg-weak); border: 1px solid var(--card-border);
    box-shadow: inset 0 1px 0 var(--card-highlight);
    transition: background 0.35s ease; pointer-events: none;
}
.theme-toggle .thumb {
    position: absolute; top: 3px; left: 3px; width: 22px; height: 22px;
    border-radius: 50%; pointer-events: none;
    background: linear-gradient(160deg, #d8dbe6, #9aa2b8);
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.32);
    transition: transform 0.35s cubic-bezier(0.32, 0.72, 0, 1), background 0.35s ease;
}
.theme-toggle input:checked ~ .track { background: rgba(255, 214, 10, 0.28); }
.theme-toggle input:checked ~ .thumb {
    transform: translateX(26px);
    background: linear-gradient(160deg, #ffe27a, #ffb703);
}

/* ── Кнопки в шапке: один вид и одно место на всех страницах ───────
   Слева заголовок и разделы, справа управление. «Выйти» — самый правый и
   красный: это выход, его не нажимают вслепую. */
.head-right { display: flex; align-items: center; gap: 8px; margin-left: auto; }
.langs { display: flex; gap: 4px; }

.hdr-btn {
    padding: 6px 13px; border-radius: var(--lg-radius-pill);
    background: var(--lg-bg-weak); border: 1px solid var(--card-border);
    box-shadow: inset 0 1px 0 var(--card-highlight);
    color: var(--text-main); font: inherit;
    font-size: 0.75rem; font-weight: 700; letter-spacing: 0.02em;
    cursor: pointer; white-space: nowrap;
    /* «Пользователи» — это тег <a>, и браузер подчёркивал его как ссылку,
       хотя выглядит он кнопкой наравне с соседями. */
    text-decoration: none;
    transition: background 0.18s ease, border-color 0.18s ease;
}
.hdr-btn:hover { text-decoration: none; }
.hdr-btn:hover { background: var(--lg-bg); }
.hdr-btn.current {
    background: var(--lg-bg); cursor: default;
    border-color: rgba(48, 209, 88, 0.5); color: var(--good-color);
}
.hdr-btn.danger {
    background: rgba(255, 69, 58, 0.16);
    border-color: rgba(255, 69, 58, 0.45);
    color: #ff6b60;
}
.hdr-btn.danger:hover { background: rgba(255, 69, 58, 0.28); }


/* ── Общий верхний бар: одна мерка на все страницы ─────────────────
   Высота, кегль, размер значка и место кнопок заданы здесь и одинаковы
   везде. Заголовку задана постоянная ширина: без неё навигация начиналась
   на разном месте — у «Умный дом» и «Tuya · Устройства» разная длина, и
   кнопки плавали от страницы к странице. */
.page-head {
    display: flex; align-items: center; gap: 16px;
    min-height: 56px; box-sizing: border-box;
    /* Ширина обязательна: во флекс-колонке (страница Tuya) без неё шапка
       сжималась по содержимому, и margin: auto уводил её в центр. */
    width: 100%; flex-shrink: 0;
    margin: 0 auto 20px; max-width: min(100%, 2400px);
    padding: 0 2px; border-bottom: none;
}
.page-head h1 {
    display: flex; align-items: center; gap: 9px; margin: 0;
    width: 290px; flex-shrink: 0;
    font-size: 21px; font-weight: 700; letter-spacing: -0.02em; line-height: 1.2;
}
/* Фикс-ширина заголовка выше — ради общей мерки шапки между страницами
   (Tuya, Умный дом) на широком экране. На телефоне она держит 290px в
   контейнере ýже, чем это, и не даёт «Выйти» встать в ту же строку, как
   задумано в мобильном блоке ниже — та строка вместо этого превращается
   в одну лишь заголовок, а «Выйти» и всё, что после, разъезжается. */
@media (max-width: 860px) {
    .page-head h1 { width: auto; flex-shrink: 1; min-width: 0; }
}
.page-head .brand-logo,
.page-head .title-icon {
    width: 28px; height: 28px; border-radius: 7px;
    display: block; flex-shrink: 0; object-fit: contain; margin: 0;
}
.page-head .ver {
    font-size: 12px; font-weight: 600; opacity: 0.5; letter-spacing: 0;
}
.topnav { display: flex; gap: 6px; flex-shrink: 0; }
.topnav-item {
    padding: 6px 14px; font-size: 0.78rem; font-weight: 600;
    line-height: 1.4; white-space: nowrap;
}
.head-right { display: flex; align-items: center; gap: 8px; margin-left: auto; }

/* ── Плитка Xiaomi: пылесос слева, воздух справа ───────────────────
   Карта занимала всю ширину огромным квадратом, а справа от неё было
   пусто. Половина под пылесос, половина под воздух — и плитка перестала
   быть вдвое выше соседних. */
.halves { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
.half { min-width: 0; }
.half-air { display: flex; flex-direction: column; }

/* Свечение — то же, что на странице очистителя, только компактное:
   цвет отвечает за качество воздуха, и его видно, не читая цифр */
.air-mini {
    position: relative; aspect-ratio: 1; margin: 4px 0 2px;
    display: flex; align-items: center; justify-content: center;
}
.air-mini .air-blob {
    position: absolute; inset: 0;
    background: radial-gradient(closest-side circle at 50% 50%,
        rgba(var(--air), 0.95) 0%, rgba(var(--air), 0.5) 38%,
        rgba(var(--air), 0.14) 62%, rgba(var(--air), 0) 78%);
    animation: air-breathe 12s ease-in-out infinite;
}
.air-mini-text { position: relative; text-align: center; }
.air-mini-text b { font-size: 1.7rem; font-weight: 700; letter-spacing: -0.02em; }
.air-mini-word {
    text-align: center; font-size: 0.95rem; font-weight: 700;
    text-transform: capitalize; margin-top: -4px;
}
.air-mini-mode { text-align: center; font-size: 0.74rem; opacity: 0.6; margin-top: 2px; }

.air-excellent { --air: 45, 212, 178; }
.air-good      { --air: 126, 217,  87; }
.air-fair      { --air: 242, 201,  76; }
.air-poor      { --air: 242, 153,  74; }
.air-bad       { --air: 235,  87,  87; }

@keyframes air-breathe {
    0%, 100% { transform: scale(0.94); opacity: 0.88; }
    50%      { transform: scale(1.06); opacity: 1; }
}
@media (prefers-reduced-motion: reduce) { .air-mini .air-blob { animation: none; } }

/* Карта в половине плитки — по ширине колонки, без огромного квадрата */
.map-thumb { margin-top: 12px; padding: 8px; }
.map-thumb img { max-height: 260px; width: auto; max-width: 100%; }

@media (max-width: 700px) {
    .halves { grid-template-columns: 1fr; }
}

/* Пылинки вокруг шара воздуха — те же, что на странице очистителя */
.air-mini .air-dot {
    position: absolute; border-radius: 50%;
    background: rgb(var(--air)); opacity: 0.7;
    animation-name: air-float; animation-timing-function: ease-in-out;
    animation-iteration-count: infinite;
}
@keyframes air-float {
    0%, 100% { transform: translate(0, 0);        opacity: 0.35; }
    25%      { transform: translate(5px, -8px);   opacity: 0.85; }
    50%      { transform: translate(-4px, -14px); opacity: 0.55; }
    75%      { transform: translate(-7px, -6px);  opacity: 0.80; }
}
@media (prefers-reduced-motion: reduce) { .air-mini .air-dot { animation: none; } }

/* Подвал в состоянии ошибки: молчаливая серая строка тут не годится */
.foot-err { color: #ff6b6b !important; }

/* Протухшее показание датчика: число последнее известное, но нынешним
   его считать нельзя — датчик мог умереть три дня назад. */
.chip-stale { opacity: 0.5; }
.chip-stale .chip-v { text-decoration: line-through; text-decoration-thickness: 1px; }

/* Плитка «Климат»: строка на комнату — где сейчас сколько и что делает */
.ac-lines { display: flex; flex-direction: column; gap: 7px; margin-top: 4px; }
.ac-line {
    display: flex; align-items: baseline; gap: 9px;
    padding: 8px 11px; border-radius: 12px;
    background: rgba(120, 120, 128, 0.10);
}
.ac-line.on { background: rgba(10, 132, 255, 0.14); }
.ac-line.off { opacity: 0.5; }
.ac-room { font-size: 0.8rem; font-weight: 700; }
.ac-now {
    margin-left: auto; font-size: 1.15rem; font-weight: 700;
    font-variant-numeric: tabular-nums; letter-spacing: -0.02em;
}
.ac-now i { font-style: normal; font-size: 0.66rem; opacity: 0.6; margin-left: 1px; }
.ac-state { font-size: 0.7rem; opacity: 0.65; width: 8.5em; text-align: right; }

/* Логотип Neoclima в плитке «Климат»: надпись широкая, квадрат ей тесен.
   Вариантов два — на светлой теме родной тёмный, на тёмной перекрашенный. */
.tile-icon.wide { width: auto; height: 22px; border-radius: 0; }
.tile .dark-only { display: none; }
:root[data-theme="dark"] .tile .light-only { display: none; }
:root[data-theme="dark"] .tile .dark-only { display: inline; }
@media (prefers-color-scheme: dark) {
    :root:not([data-theme="light"]) .tile .light-only { display: none; }
    :root:not([data-theme="light"]) .tile .dark-only { display: inline; }
}

/* ── План квартиры ──────────────────────────────────────────────────────
   Геометрия снята с настоящего плана владельца: обводка стен дала сетку
   несущих линий, по ней комнаты и расставлены. Плитка широкая — план
   вертикальный и мелким его читать невозможно. */
/* План стоит в общем ряду одной колонкой: он вертикальный, и в ширину
   его тянуть незачем — лучше повыше. */
.tile-plan .tile-head { margin-bottom: 2px; }
.plan-wrap { display: flex; justify-content: center; padding: 6px 0 2px; }
.plan-svg { width: 100%; height: auto; max-height: 78vh; }

/* Сам чертёж владельца. Он нарисован тёмными линиями по прозрачному фону,
   поэтому на тёмной теме его выворачиваем — иначе линий не видно. */
.pl-img { opacity: 0.75; }
:root[data-theme="dark"] .pl-img { filter: invert(1) brightness(1.15); opacity: 0.5; }
@media (prefers-color-scheme: dark) {
    :root:not([data-theme="light"]) .pl-img { filter: invert(1) brightness(1.15); opacity: 0.5; }
}

/* Единый вид ВСЕХ показаний на плане — температура, влажность, CO2, пыль,
   что в комнатах, что у уличных датчиков: один класс, один размер, без
   деления на «главное» и «второстепенное» значение. */
.pl-val {
    /* fill сюда специально не идёт: температура красится по шкале через
       инлайновый fill="...", а класс с fill в CSS перебил бы его —
       в SVG презентационные атрибуты слабее правил из stylesheet */
    font-size: 18px; font-weight: 700;
    font-variant-numeric: tabular-nums; letter-spacing: -0.01em;
}
.pl-none { font-size: 18px; fill: var(--text-main); opacity: 0.25; }

/* Обводка фоном — только там, где подпись лежит поверх линий чертежа
   (комнаты). У уличных датчиков (над/под планом) под ними чистое поле,
   обводка не нужна — поэтому этот класс отдельно от .pl-val */
.pl-on-plan {
    text-anchor: middle;
    paint-order: stroke;
    stroke: var(--dash-bg, rgba(255,255,255,0.9));
    stroke-width: 5px;
    stroke-linejoin: round;
}

/* Пары «значок + число». Позиция каждой посчитана заранее, поэтому текст
   растёт вправо от своей точки, а не от середины — text-anchor тут start,
   в отличие от одиночного прочерка в пустой комнате. */
.pl-chip, .pl-chip-out { text-anchor: start; }
.pl-chip {
    paint-order: stroke;
    stroke: var(--dash-bg, rgba(255,255,255,0.9));
    stroke-width: 5px;
    stroke-linejoin: round;
}
/* Значок берёт цвет своей величины: градусник у температуры красится по
   той же шкале, что и число, остальные — цветом текста */
.pl-ico { opacity: 0.85; }




/* Две плитки в одной колонке: климат стоит прямо под Tuya, а не уезжает
   в следующий ряд. Занимают одну ячейку сетки на двоих. */
/* Постоянный узел под каждую плитку: сетка раскладывает именно его, а
   содержимое внутри подменяется только когда изменилось. Узел прозрачный
   и сам по себе ничего не рисует. */
/* Раньше был display: contents — хост исчезал, и плитка попадала прямо
   в сетку. Теперь хост живёт в столбце настоящим боксом: JS двигает
   именно его, а промежутки задаёт gap столбца. */
.tile-host { display: block; min-width: 0; }

.tile-stack { display: flex; flex-direction: column; gap: 20px; min-width: 0; }

/* Мини-сводка стоит поверх чертежа, а не в пустоте — в узких местах плана
   стены плана просвечивали сквозь текст. Плашка прячет их под собой, не
   требуя подгонки под конкретную геометрию комнат. */
.pl-sum-bg {
    fill: var(--card-bg); stroke: var(--card-border); stroke-width: 1;
}

/* Мини-сводка в свободном углу плана: подпись раздела мельче и приглушена,
   значения тем же кеглем, что и на самом плане, — единый размер по всей
   плитке, без деления на главное и второстепенное */
.pl-sum-cap {
    font-size: 10px; font-weight: 700; letter-spacing: 0.07em;
    text-transform: uppercase; fill: var(--text-main); opacity: 0.45;
    text-anchor: start;
}


/* Погода словом и совет под ней. Оба — пояснения, а не показания, поэтому
   мельче: правило «один кегль» держит числа, а не подписи к ним. */
.pl-sum-note {
    font-size: 13px; font-weight: 600; fill: var(--text-main);
    opacity: 0.6; text-anchor: start;
}
.pl-advice {
    font-size: 13px; font-weight: 600; fill: var(--text-main);
    opacity: 0.75; text-anchor: start;
}


/* ── Сеть (Keenetic) ──────────────────────────────────────────────────
   Полная ширина ряда: два канала в интернет и слабейшие сигналом
   приборы бок о бок читаются быстрее, чем друг под другом. */

/* Плитка «Сеть» той же ширины, что остальные, поэтому внутри всё идёт
   столбиком: сверху каналы и счётчики роутера, под ними сигналы приборов.
   Двумя колонками они помещались только в плитку двойной ширины. */
.net-body { display: flex; flex-direction: column; gap: 14px; margin-top: 4px; }
.net-left { display: flex; flex-direction: column; gap: 10px; }
.chan-list { display: flex; flex-direction: column; gap: 10px; }
.chan {
    display: flex; flex-direction: column; gap: 8px; padding: 10px 12px;
    border-radius: var(--lg-radius-md); background: var(--lg-bg-weak);
    border: 1px solid var(--card-border);
}
.chan-dot { width: 9px; height: 9px; border-radius: 50%; flex-shrink: 0; }
.chan-dot.on  { background: var(--good-color);   box-shadow: 0 0 6px var(--good-color); }
.chan-dot.off { background: var(--danger-color); box-shadow: 0 0 6px var(--danger-color); }
.chan-info { min-width: 0; }
.chan-name { font-weight: 700; font-size: 0.88rem; }
.chan-sub {
    font-size: 0.74rem; opacity: 0.6; overflow: hidden;
    text-overflow: ellipsis; white-space: nowrap;
}
.chan-right { margin-left: auto; text-align: right; flex-shrink: 0; }
.chan-role {
    font-size: 0.7rem; padding: 2px 8px; border-radius: var(--lg-radius-pill);
    background: rgba(255, 255, 255, 0.08); opacity: 0.75;
}
.chan-speed {
    display: block; margin-top: 4px; font-size: 0.7rem; opacity: 0.55;
    font-variant-numeric: tabular-nums;
}

/* Загрузка канала за час. Приём — заливка с чёткой кромкой, передача —
   линия поверх: так две величины различимы без подписи, какая где.
   Шкала логарифмическая, отметки стоят на 1, 10, 100 и 1000 Мбит/с. */
.chan-top { display: flex; align-items: center; gap: 10px; }
.net-chart { position: relative; height: 42px; }
.net-chart svg { width: 100%; height: 100%; display: block; }
.net-grid { stroke: var(--text-main); opacity: 0.10; stroke-width: 1; }
.net-rx-fill { fill: #0a84ff; opacity: 0.18; }
.net-rx { stroke: #0a84ff; }
.net-tx { stroke: #30d158; }
.net-live { stroke-dasharray: 1; stroke-dashoffset: 1; animation: net-line-in 0.42s ease-out forwards; }
@keyframes net-line-in { to { stroke-dashoffset: 0; } }

/* Точки под курсором — прозрачные до наведения, крупнее хвостика линии,
   чтобы попасть было проще, чем промазать */
.net-dot { fill: transparent; cursor: crosshair; }
.net-dot.rx:hover { fill: #0a84ff; }
.net-dot.tx:hover { fill: #30d158; }
.chan-speed .rx { color: #0a84ff; font-weight: 700; }
.chan-speed .tx { color: #30d158; font-weight: 700; }

/* Подписи шкалы — обычным текстом поверх: внутри растянутого svg буквы
   поехали бы вслед за ним */
.net-scale {
    position: absolute; inset: 0 2px 0 auto;
    display: flex; flex-direction: column; justify-content: space-between;
    pointer-events: none; padding: 1px 0;
}
.net-scale i {
    font-style: normal; font-size: 8px; font-weight: 700;
    color: var(--text-main); opacity: 0.35; line-height: 1;
    text-align: right;
}
.net-chart-tip {
    position: absolute; top: 2px; z-index: 3; width: 136px; padding: 5px 7px;
    border: 1px solid var(--card-border); border-radius: 8px; background: var(--card-bg);
    box-shadow: 0 5px 14px rgba(0,0,0,0.22); backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px); font-size: 9px; line-height: 1.35;
    pointer-events: none; font-variant-numeric: tabular-nums;
}
.net-chart-tip b, .net-chart-tip span { display: block; }
.net-chart-tip b { opacity: 0.65; margin-bottom: 1px; }
.net-chart-tip .rx { color: #0a84ff; }
.net-chart-tip .tx { color: #30d158; }
@media (prefers-reduced-motion: reduce) { .net-live { animation: none; stroke-dashoffset: 0; } }


/* Две камеры в одной плитке, одна под другой. Снимок остаётся во всю
   ширину плитки — рядом два кадра 16:9 съёживались вдвое и переставали
   читаться. Каждая половинка — ссылка на свою страницу. */
.cam-pair { display: flex; flex-direction: column; gap: 12px; }
.cam-half { display: flex; flex-direction: column; gap: 6px;
            text-decoration: none; color: inherit; }
.cam-half + .cam-half { border-top: 1px solid var(--card-border); padding-top: 12px; }
.cam-half-name { font-size: 0.72rem; font-weight: 600; opacity: 0.6; }
.cam-half:hover .cam-half-name { opacity: 0.9; }

/* Плитка камеры — снимок из прихожей, обновляется своим таймером,
   независимым от общего опроса сводки (JPEG в общий JSON не тащим). */
.cam-thumb-wrap {
    border-radius: 12px; overflow: hidden; aspect-ratio: 16/9;
    background: rgba(0, 0, 0, 0.25); position: relative;
}
.cam-thumb { width: 100%; height: 100%; object-fit: cover; display: block; opacity: 0;
             transition: opacity 0.25s; position: relative; z-index: 1; }
.cam-thumb.loaded { opacity: 1; }
.cam-thumb-empty {
    position: absolute; inset: 0; display: flex; align-items: center; justify-content: center;
    font-size: 0.78rem; opacity: 0.5;
}

/* Плитка принтера: название, что делает (в обводке) и как дела с
   чернилами. Счётчики и журнал ошибок живут на своей странице — на сводке
   это шум, о котором не спрашивают мимоходом. */
.pr-tile { display: flex; flex-direction: column; gap: 10px; }
.pr-model { font-size: 0.95rem; font-weight: 700; letter-spacing: -0.01em; }
.pr-ink { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.pr-ink .ink-dot {
    width: 14px; height: 14px; border-radius: 50%;
    border: 1px solid var(--card-border); flex-shrink: 0;
}
.pr-ink .ink-dot.low { box-shadow: 0 0 0 2px var(--warning-color); }
.ink-ok { font-size: 0.8rem; font-weight: 600; opacity: 0.6; margin-left: 4px; }
.ink-warn { font-size: 0.8rem; font-weight: 700; color: var(--warning-color); margin-left: 4px; }
