/* p_mon — оформление. Цвета — только токенами (светлая и тёмная темы) */
:root {
  --bg: #f6f7f9; --surface: #ffffff; --surface-2: #f0f2f5; --border: #d9dde3;
  --text: #1b1f24; --muted: #5f6b7a; --accent: var(--brand-light, #1f6feb); --accent-text: var(--brand-light-text, #ffffff);
  --ok: #1a7f37; --indoor: #8250df; --nav-in: #1a7f37; --nav-out: #1f6feb; --warn: #9a6700; --danger: #cf222e; --danger-bg: #ffebe9; --offline: #8c959f; --archive-bg: #ddf4ff; --lbs-bg: #fff8c5;
  --shadow: 0 1px 3px rgb(0 0 0 / 0.12), 0 4px 16px rgb(0 0 0 / 0.06);
  --radius: 10px;
  /* Строки диаграммы Ганта в отчётах (палитра проверена validate_palette: светлая и тёмная) */
  --gc-1: #257de0; --gc-2: #f47230; --gc-3: #00b894; --gc-4: #f2a600; --gc-5: #ee7fac; --gc-6: #008a17; --gc-7: #6a4ce2; --gc-8: #ec4647;
  /* Состояния (мониторинг сервера): одни и те же в обеих темах, всегда с подписью */
  --st-good: #0aac23; --st-warning: #fbb315; --st-critical: #dc3c3d;
  color-scheme: light;
}
/* Тема (Настройки → Оформление): как в системе, всегда светлая (data-theme=light), всегда тёмная (data-theme=dark) */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0f1216; --surface: #171b21; --surface-2: #1f242b; --border: #2e353e;
    --text: #e6e9ed; --muted: #97a1ad; --accent: var(--brand-dark, #4c8dff); --accent-text: var(--brand-dark-text, #0b0e12);
    --ok: #3fb950; --indoor: #b083f0; --nav-in: #3fb950; --nav-out: #58a6ff; --warn: #d29922; --danger: #ff6b6b; --danger-bg: #3a1d1f; --offline: #6e7681; --archive-bg: #0c2d4a; --lbs-bg: #3b2e00;
    --shadow: 0 1px 3px rgb(0 0 0 / 0.5), 0 4px 16px rgb(0 0 0 / 0.3);
    --gc-1: #338ced; --gc-2: #e76624; --gc-3: #00a888; --gc-4: #d28e05; --gc-5: #e24d8b; --gc-6: #0aac23; --gc-7: #9887ef; --gc-8: #eb6263;
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
    --bg: #0f1216; --surface: #171b21; --surface-2: #1f242b; --border: #2e353e;
    --text: #e6e9ed; --muted: #97a1ad; --accent: var(--brand-dark, #4c8dff); --accent-text: var(--brand-dark-text, #0b0e12);
    --ok: #3fb950; --indoor: #b083f0; --nav-in: #3fb950; --nav-out: #58a6ff; --warn: #d29922; --danger: #ff6b6b; --danger-bg: #3a1d1f; --offline: #6e7681; --archive-bg: #0c2d4a; --lbs-bg: #3b2e00;
    --shadow: 0 1px 3px rgb(0 0 0 / 0.5), 0 4px 16px rgb(0 0 0 / 0.3);
    --gc-1: #338ced; --gc-2: #e76624; --gc-3: #00a888; --gc-4: #d28e05; --gc-5: #e24d8b; --gc-6: #0aac23; --gc-7: #9887ef; --gc-8: #eb6263;
    color-scheme: dark;
}
* { box-sizing: border-box; }
html, body, #app { height: 100%; margin: 0; }
body { background: var(--bg); color: var(--text); font: 15px/1.45 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; }
button, input, select, textarea { font: inherit; color: inherit; }
a { color: var(--accent); }
.boot { display: grid; place-items: center; height: 100%; color: var(--muted); }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.hidden { display: none !important; }

button, .btn {
  border: 1px solid var(--border); background: var(--surface); border-radius: 8px; padding: 7px 12px; cursor: pointer;
}
button:hover { background: var(--surface-2); }
button.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-text); }
button.danger { color: var(--danger); }
button:disabled { opacity: 0.6; cursor: default; }
input, select, textarea { background: var(--surface); border: 1px solid var(--border); border-radius: 8px; padding: 7px 10px; width: 100%; }
label { display: grid; gap: 4px; font-size: 13px; color: var(--muted); }
label.check { display: flex; align-items: center; gap: 8px; color: var(--text); font-size: 15px; }
label.check input { width: auto; }
/* Атрибут hidden скрывает и элементы со своим display (label — grid): строки настроек объекта, таблица импорта */
[hidden] { display: none !important; }
.form { display: grid; gap: 12px; }
.row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.error { color: var(--danger); min-height: 1.2em; }

/* Вход */
.login { display: grid; place-items: center; min-height: 100%; padding: 16px; }
.login form { width: min(360px, 100%); background: var(--surface); padding: 24px; border-radius: var(--radius); box-shadow: var(--shadow); }
.login h1 { margin: 0 0 4px; font-size: 22px; }
/* Бренд: логотип на странице входа и в шапке, контакты поддержки */
.brand-logo { display: block; max-width: 220px; max-height: 56px; margin: 0 0 8px; }
.topbar .brand-logo { display: inline-block; max-height: 26px; max-width: 140px; margin: 0; vertical-align: middle; }
.login-support { text-align: center; margin-top: 12px; }
.brand-swatch { display: inline-block; background: var(--accent); width: 14px; height: 14px; border-radius: 4px; border: 1px solid var(--border); vertical-align: -2px; margin-right: 4px; }
.brand-icon { width: 32px; height: 32px; border-radius: 7px; vertical-align: middle; }
.brand-preview { display: flex; gap: 10px; align-items: center; min-width: 180px; }
.brand-swatch.big { width: 32px; height: 32px; border-radius: 7px; flex: none; }
.chip { white-space: nowrap; }

/* Каркас */
.shell { display: grid; grid-template-rows: auto minmax(0, 1fr); grid-template-columns: minmax(0, 1fr); height: 100%; height: 100dvh; }
.topbar { display: flex; align-items: center; gap: 12px; padding: 8px 12px; background: var(--surface); border-bottom: 1px solid var(--border); }
.topbar .brand { font-weight: 700; }
.topbar .spacer { flex: 1; }
.badge { display: inline-block; min-width: 20px; padding: 1px 7px; border-radius: 10px; background: var(--danger); color: #fff; font-size: 12px; text-align: center; }
.main { display: grid; grid-template-columns: 340px minmax(0, 1fr); min-height: 0; min-width: 0; }
.side { display: flex; flex-direction: column; min-height: 0; background: var(--surface); border-right: 1px solid var(--border); }
/* Скрытая левая колонка (переключатель в шапке) */
.main.side-hidden { grid-template-columns: minmax(0, 1fr); }
.main.side-hidden .side { display: none; }
/* Значки: кнопки-иконки (SVG-маска, цвет — токеном) */
.icon-btn { display: inline-flex; align-items: center; justify-content: center; width: 32px; height: 30px; padding: 0; }
.ico { display: inline-block; width: 18px; height: 18px; background: var(--muted); -webkit-mask: var(--ico) center / contain no-repeat; mask: var(--ico) center / contain no-repeat; }
.icon-btn:hover .ico { background: var(--accent); }
.ico-list { --ico: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M3 6h18M3 12h18M3 18h18'/%3E%3C/svg%3E"); }
.ico-track { --ico: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='6' cy='19' r='2'/%3E%3Ccircle cx='18' cy='5' r='2'/%3E%3Cpath d='M8 19h8.5a3.5 3.5 0 0 0 0-7h-9a3.5 3.5 0 0 1 0-7H16'/%3E%3C/svg%3E"); }
.ico-cmd { --ico: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M4 17l6-5-6-5M12 19h8'/%3E%3C/svg%3E"); }
.ico-gear { --ico: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='12' cy='12' r='3'/%3E%3Cpath d='M19.4 15a1.7 1.7 0 0 0 .3 1.8l.1.1a2 2 0 1 1-2.8 2.8l-.1-.1a1.7 1.7 0 0 0-1.8-.3 1.7 1.7 0 0 0-1 1.5V21a2 2 0 1 1-4 0v-.1a1.7 1.7 0 0 0-1.1-1.5 1.7 1.7 0 0 0-1.8.3l-.1.1a2 2 0 1 1-2.8-2.8l.1-.1a1.7 1.7 0 0 0 .3-1.8 1.7 1.7 0 0 0-1.5-1H3a2 2 0 1 1 0-4h.1a1.7 1.7 0 0 0 1.5-1.1 1.7 1.7 0 0 0-.3-1.8l-.1-.1a2 2 0 1 1 2.8-2.8l.1.1a1.7 1.7 0 0 0 1.8.3H9a1.7 1.7 0 0 0 1-1.5V3a2 2 0 1 1 4 0v.1a1.7 1.7 0 0 0 1 1.5 1.7 1.7 0 0 0 1.8-.3l.1-.1a2 2 0 1 1 2.8 2.8l-.1.1a1.7 1.7 0 0 0-.3 1.8V9a1.7 1.7 0 0 0 1.5 1H21a2 2 0 1 1 0 4h-.1a1.7 1.7 0 0 0-1.5 1z'/%3E%3C/svg%3E"); }
.item-actions { display: flex; gap: 4px; margin-top: 4px; align-items: center; flex-wrap: wrap; }
.ico-clock { --ico: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='12' cy='12' r='9'/%3E%3Cpath d='M12 7v5l3 2'/%3E%3C/svg%3E"); }
/* Значки действий (панель действий в таблицах, группы, режим) */
.ico-key { --ico: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='7.5' cy='15.5' r='4.5'/%3E%3Cpath d='M10.7 12.3L21 2M17 6l3 3M14 9l2 2'/%3E%3C/svg%3E"); }
.ico-lock { --ico: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Crect x='4' y='11' width='16' height='10' rx='2'/%3E%3Cpath d='M8 11V7a4 4 0 0 1 8 0v4M12 15v2'/%3E%3C/svg%3E"); }
.ico-shield { --ico: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M12 3l8 3v6c0 5-3.5 8-8 9-4.5-1-8-4-8-9V6z'/%3E%3Cpath d='M9 12l2 2 4-4'/%3E%3C/svg%3E"); }
.ico-power { --ico: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M12 2v10M18.4 6.6a9 9 0 1 1-12.8 0'/%3E%3C/svg%3E"); }
.ico-trash { --ico: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M3 6h18M8 6V4h8v2M19 6l-1 14H6L5 6M10 11v6M14 11v6'/%3E%3C/svg%3E"); }
.ico-edit { --ico: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M12 20h9M16.5 3.5a2.1 2.1 0 0 1 3 3L7 19l-4 1 1-4z'/%3E%3C/svg%3E"); }
.ico-plus { --ico: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M12 5v14M5 12h14'/%3E%3C/svg%3E"); }
.ico-toggles { --ico: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Crect x='2' y='5' width='20' height='6' rx='3'/%3E%3Ccircle cx='16' cy='8' r='1.5'/%3E%3Crect x='2' y='13' width='20' height='6' rx='3'/%3E%3Ccircle cx='8' cy='16' r='1.5'/%3E%3C/svg%3E"); }
.ico-brand { --ico: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M12 3a9 9 0 1 0 0 18c1.1 0 1.7-.9 1.4-1.9-.3-1 .3-2.1 1.4-2.1H17a4 4 0 0 0 4-4c0-5.5-4-10-9-10z'/%3E%3Ccircle cx='7.5' cy='11' r='1.2'/%3E%3Ccircle cx='10.5' cy='7' r='1.2'/%3E%3Ccircle cx='15' cy='7.5' r='1.2'/%3E%3C/svg%3E"); }
.ico-gauge { --ico: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M12 14l4-4M3.3 19a10 10 0 1 1 17.4 0'/%3E%3C/svg%3E"); }
.ico-send { --ico: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M5 12h14M13 6l6 6-6 6'/%3E%3C/svg%3E"); }
.ico-play { --ico: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='12' cy='12' r='9'/%3E%3Cpath d='M10 8l6 4-6 4z'/%3E%3C/svg%3E"); }
.ico-box { --ico: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M21 8l-9-5-9 5 9 5 9-5zM3 8v8l9 5 9-5V8M12 13v8'/%3E%3C/svg%3E"); }
.ico-mode { --ico: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M4 21v-7M4 10V3M12 21v-9M12 8V3M20 21v-5M20 12V3M1 14h6M9 8h6M17 16h6'/%3E%3C/svg%3E"); }
.ico-restore { --ico: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M3 12a9 9 0 1 0 3-6.7L3 8M3 3v5h5'/%3E%3C/svg%3E"); }
.ico-folder { --ico: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M3 7a2 2 0 0 1 2-2h4l2 2h8a2 2 0 0 1 2 2v8a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2z'/%3E%3C/svg%3E"); }
.ico-cargo { --ico: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Crect x='2' y='7' width='9' height='9' rx='1'/%3E%3Crect x='13' y='7' width='9' height='9' rx='1'/%3E%3Cpath d='M6.5 4v3M17.5 4v3M2 20h20'/%3E%3C/svg%3E"); }
.ico-bell { --ico: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M6 8a6 6 0 0 1 12 0c0 7 3 9 3 9H3s3-2 3-9M10.3 21a1.9 1.9 0 0 0 3.4 0'/%3E%3C/svg%3E"); }
/* Панель действий: значки одного размера, группы по назначению через разделитель */
.actions { display: flex; align-items: center; gap: 4px; flex-wrap: nowrap; justify-content: flex-end; }
.actions .icon-btn.act { width: 32px; height: 30px; border-radius: 6px; flex: none; }
.actions .icon-btn.act.danger:hover { border-color: var(--danger); }
.actions .icon-btn.act.danger:hover .ico { background: var(--danger); }
.actions-sep { width: 1px; height: 20px; background: var(--border); margin: 0 4px; flex: none; }
td:has(> .actions) { width: 1%; white-space: nowrap; }
/* Значки-показатели в ряду под названием: счётчик «на связи» и заряд */
.badge-ico { display: inline-flex; align-items: center; gap: 4px; height: 26px; padding: 0 6px; border: 1px solid var(--border);
  border-radius: 6px; font-size: 12px; color: var(--muted); background: var(--surface); white-space: nowrap; font-variant-numeric: tabular-nums; }
.badge-ico .ico { width: 15px; height: 15px; }
.since.online { color: var(--ok); }
.since.offline { color: var(--danger); }
.since.offline .ico { background: var(--danger); }
.ico-move { --ico: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M3 11l18-8-8 18-2-8z'/%3E%3C/svg%3E"); }
.ico-park { --ico: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Crect x='3' y='3' width='18' height='18' rx='3'/%3E%3Cpath d='M9 17V7h4a3 3 0 0 1 0 6H9'/%3E%3C/svg%3E"); }
.ico-indoor { --ico: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M3 21h18M5 21V5l7-3 7 3v16M9 9h1M14 9h1M9 13h1M14 13h1M10 21v-4h4v4'/%3E%3C/svg%3E"); }
/* На улице — классический спутник, как «Спутники» во всплывающем окне (владелец, 19.11 и 26.11.2026: не звезда-«шестерёнка») */
.ico-outdoor { --ico: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linejoin='round' stroke-linecap='round'%3E%3Cg transform='rotate(-45 12 12)'%3E%3Crect x='9.5' y='9' width='5' height='6' rx='1'/%3E%3Crect x='2' y='8.5' width='5.5' height='7' rx='0.5'/%3E%3Crect x='16.5' y='8.5' width='5.5' height='7' rx='0.5'/%3E%3Cpath d='M7.5 12h2M14.5 12h2M12 15v3'/%3E%3C/g%3E%3Cpath d='M15.5 21.5a6 6 0 0 0 6-6' stroke-width='1.8'/%3E%3C/svg%3E"); }
.ico-unknown { --ico: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='12' cy='12' r='9'/%3E%3Cpath d='M9.5 9a2.5 2.5 0 1 1 3.5 2.3c-.6.3-1 .9-1 1.6V14M12 17h.01'/%3E%3C/svg%3E"); }
/* «Сообщения», колонка «Статус» (владелец, 23.11.2026; решение 80): зелёный — помещение, синий — улица; стрелки — ответ на команду */
.ico-navdot { --ico: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Ccircle cx='12' cy='12' r='6' fill='black'/%3E%3C/svg%3E"); }
.ico-exchange { --ico: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M4 8h15l-4-4M20 16H5l4 4'/%3E%3C/svg%3E"); }
.msg-st { text-align: center; width: 1%; }
.msg-st .ico { vertical-align: middle; }
.msg-st .ico.in, .lg .ico.in { background: var(--nav-in); }
.msg-st .ico.out, .lg .ico.out { background: var(--nav-out); }
.msg-reply-text { font-style: italic; }
.msg-place { max-width: 260px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.place.indoor { color: var(--indoor); }
.place.indoor .ico { background: var(--indoor); }
.place.outdoor { color: var(--ok); }
.place.outdoor .ico { background: var(--ok); }
.place.stale { color: var(--muted); }
.place.stale .ico { background: var(--muted); }
.motion.moving { color: var(--accent); }
.motion.moving .ico { background: var(--accent); }
.motion.stale { color: var(--muted); }
.motion.stale .ico { background: var(--muted); }
.since.online .ico { background: var(--ok); }
.since-text { min-width: 2.8em; }
/* Значки без текста — квадратные */
.badge-ico.motion, .badge-ico.place, .badge-ico.batt { width: 30px; justify-content: center; padding: 0; }
.badge-ico.batt { width: 34px; }
.batt-body { position: relative; width: 20px; height: 10px; border: 1.5px solid currentColor; border-radius: 2px; }
.batt-body::after { content: ''; position: absolute; right: -4px; top: 2px; width: 2px; height: 4px; background: currentColor; border-radius: 0 1px 1px 0; }
.batt-fill { position: absolute; left: 1px; top: 1px; bottom: 1px; max-width: calc(100% - 2px); background: currentColor; border-radius: 1px; }
.batt.high { color: var(--ok); }
.batt.mid { color: var(--warn); }
.batt.low { color: var(--danger); }
.item-actions .icon-btn { width: 28px; height: 26px; border-radius: 6px; }
/* Окно команд */
dialog.commands { width: min(640px, calc(100% - 32px)); max-height: calc(100% - 32px); overflow: auto; display: grid; gap: 10px; }
dialog.commands:not([open]) { display: none; }
dialog.commands h2, dialog.commands h3 { margin: 0; }
.cmd-params { display: grid; gap: 8px; }
.status { font-weight: 600; }
.status.ok, .ok-text { color: var(--ok); }
.status.warn { color: var(--warn); }
.audit-row { cursor: pointer; }
.audit-row:hover td { background: var(--surface-2); }
.audit-detail { white-space: pre-wrap; margin: 6px 0 0; background: var(--surface-2); padding: 6px; border-radius: 6px; }
.check-list { display: grid; gap: 4px; max-height: 240px; overflow: auto; border: 1px solid var(--border); border-radius: 6px; padding: 8px; }
/* Функции — короткий список, без прокрутки */
.check-list.feature-list { max-height: none; gap: 8px; }
.tabs { display: flex; border-bottom: 1px solid var(--border); }
.tabs button { flex: 1; border: 0; border-radius: 0; background: transparent; padding: 10px; border-bottom: 2px solid transparent; }
.tabs button.active { border-bottom-color: var(--accent); font-weight: 600; }
.list { overflow: auto; flex: 1; }
.item { overflow-wrap: anywhere; padding: 10px 12px; border-bottom: 1px solid var(--border); cursor: pointer; display: grid; gap: 2px; }
.item:hover { background: var(--surface-2); }
.item.selected { background: var(--surface-2); box-shadow: inset 3px 0 0 var(--accent); }
.item .title { display: flex; align-items: center; gap: 8px; font-weight: 600; }
.dot { width: 9px; height: 9px; border-radius: 50%; background: var(--offline); flex: none; }
.dot.online { background: var(--ok); }
.dot.alarm { background: var(--danger); animation: blink 1s steps(2, start) infinite; }
@keyframes blink { to { visibility: hidden; } }
/* Окно тревоги — компактное, правый верхний угол, стопкой */
.alarm-popups { position: fixed; z-index: 3000; top: 64px; right: 12px; display: grid; gap: 8px; width: min(360px, calc(100vw - 24px)); }
.alarm-popup { background: var(--surface); border: 1px solid var(--border); border-left: 4px solid var(--danger); border-radius: 8px;
  box-shadow: var(--shadow); padding: 10px 12px; display: grid; gap: 4px; }
.alarm-popup .ap-head { display: flex; align-items: center; gap: 8px; color: var(--danger); }
.alarm-popup .icon-btn { width: 26px; height: 24px; border: 0; background: transparent; color: var(--muted); }
.chip { font-size: 12px; padding: 1px 7px; border-radius: 10px; background: var(--danger-bg); color: var(--danger); font-weight: 600; }
.chip.ok { background: var(--surface-2); color: var(--muted); font-weight: 400; }
.chip.state-ok { background: color-mix(in srgb, var(--ok) 15%, transparent); color: var(--ok); }
.chip.state-warn { background: color-mix(in srgb, var(--warn) 15%, transparent); color: var(--warn); }
.chip.state-danger { background: var(--danger-bg); color: var(--danger); }
.mapwrap { position: relative; min-height: 0; }
#map { position: absolute; inset: 0; }
.detail { position: absolute; z-index: 1050; top: 12px; right: 12px; width: min(340px, calc(100% - 24px)); max-height: calc(100% - 24px); overflow: auto;
  background: var(--surface); border-radius: var(--radius); box-shadow: var(--shadow); padding: 14px; display: grid; gap: 10px; }
.detail h2 { margin: 0; font-size: 17px; }
.kv { display: grid; grid-template-columns: auto 1fr; gap: 3px 12px; font-size: 14px; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; }
.detail { width: min(400px, calc(100% - 24px)); }
/* Раскрывающиеся таблицы параметров (карточка объекта) */
.sections { display: grid; gap: 6px; }
details.section > summary { list-style: none; cursor: pointer; display: flex; align-items: center; gap: 8px; padding: 6px 0;
  font-weight: 700; font-size: 16px; user-select: none; }
details.section > summary::-webkit-details-marker { display: none; }
details.section > summary::before { content: ''; width: 22px; height: 22px; flex: none; border-radius: 50%; background: var(--surface-2)
  url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%231f6feb' stroke-width='3' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M9 6l6 6-6 6'/%3E%3C/svg%3E")
  center / 14px no-repeat; transition: transform .15s; }
details.section[open] > summary::before { transform: rotate(90deg); }
details.section > summary:hover { color: var(--accent); }
table.grants td, table.grants th { text-align: center; }
.sensor-rows { display: grid; gap: 8px; }
.sensor-row { display: grid; grid-template-columns: 1.4fr 1.2fr 0.6fr auto; gap: 8px; align-items: end; }
.sensor-row select { max-width: 100%; }
dialog:has(.sensor-rows) { width: min(720px, calc(100% - 32px)); }
@media (max-width: 600px) { .sensor-row { grid-template-columns: 1fr 1fr; } }
table.grants td:first-child, table.grants th:first-child { text-align: left; }
dialog:has(table.grants) { width: min(640px, calc(100% - 32px)); }
table.params { width: 100%; border-collapse: collapse; font-size: 14px; table-layout: fixed; }
table.params td { border: 1px solid var(--border); padding: 7px 10px; vertical-align: top; overflow-wrap: anywhere; }
table.params td:first-child { width: 50%; color: var(--text); }
table.params tr:nth-child(even) td { background: color-mix(in srgb, var(--surface-2) 55%, transparent); }
table.params.raw td { padding: 5px 10px; font-size: 13px; }
table.params.compact { font-size: 13px; }
table.params.compact td { padding: 4px 8px; }
.mono { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 0.95em; }
pre.hex { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 12px; white-space: pre-wrap; word-break: break-all;
  background: var(--surface-2); border: 1px solid var(--border); border-radius: 6px; padding: 8px; margin: 6px 0; }
/* Всплывающее окно при наведении на объект в списке (по образцу Wialon) */
.hovercard { position: fixed; z-index: 2000; width: 400px; max-width: calc(100vw - 16px); background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); box-shadow: var(--shadow); padding: 10px; display: grid; gap: 8px; pointer-events: none; font-size: 14px; }
.hc-head { display: flex; align-items: center; gap: 8px; background: var(--surface-2); border-radius: 8px; padding: 8px 10px; }
.hc-head .title { font-weight: 700; font-size: 16px; }
.hc-time { color: var(--text); }
.hc-where { color: var(--muted); font-size: 12px; margin: 1px 0 2px; }
.hc-strip { display: grid; grid-template-columns: 1fr 1fr 0.8fr 1.6fr; border: 1px solid var(--border); }
.hc-strip .cell { display: flex; align-items: center; justify-content: center; text-align: center; padding: 6px 4px; border-left: 1px solid var(--border); }
.hc-strip .cell:first-child { border-left: 0; }
.hc-box { border: 1px solid var(--border); }
.sat-icon { display: inline-block; width: 20px; height: 20px; vertical-align: -5px; background: var(--muted);
  /* Классический спутник: корпус, две солнечные панели, антенна и сигнал (владелец, 19.11.2026) */
  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linejoin='round' stroke-linecap='round'%3E%3Cg transform='rotate(-45 12 12)'%3E%3Crect x='9.5' y='9' width='5' height='6' rx='1'/%3E%3Crect x='2' y='8.5' width='5.5' height='7' rx='0.5'/%3E%3Crect x='16.5' y='8.5' width='5.5' height='7' rx='0.5'/%3E%3Cpath d='M7.5 12h2M14.5 12h2M12 15v3'/%3E%3C/g%3E%3Cpath d='M15.5 21.5a6 6 0 0 0 6-6' stroke-width='1.8'/%3E%3C/svg%3E") center / contain no-repeat;
  mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linejoin='round' stroke-linecap='round'%3E%3Cg transform='rotate(-45 12 12)'%3E%3Crect x='9.5' y='9' width='5' height='6' rx='1'/%3E%3Crect x='2' y='8.5' width='5.5' height='7' rx='0.5'/%3E%3Crect x='16.5' y='8.5' width='5.5' height='7' rx='0.5'/%3E%3Cpath d='M7.5 12h2M14.5 12h2M12 15v3'/%3E%3C/g%3E%3Cpath d='M15.5 21.5a6 6 0 0 0 6-6' stroke-width='1.8'/%3E%3C/svg%3E") center / contain no-repeat; }
.hc-caption { background: var(--surface-2); padding: 6px 10px; border-bottom: 1px solid var(--border); }
.prow { display: grid; grid-template-columns: 1fr 1fr; border-bottom: 1px solid var(--border); }
.prow:last-child { border-bottom: 0; }
.prow.one { grid-template-columns: 1fr; }
.pair { padding: 6px 10px; overflow-wrap: anywhere; }
.prow .pair + .pair { border-left: 1px solid var(--border); }
.alarm { overflow-wrap: anywhere; padding: 10px 12px; border-bottom: 1px solid var(--border); display: grid; gap: 4px; }
.alarm.open { background: var(--danger-bg); }
.alarm .title { font-weight: 600; }

/* Страницы (профиль, пользователи, админка) */
.page { overflow: auto; padding: 16px; }
.page section { background: var(--surface); border-radius: var(--radius); box-shadow: var(--shadow); padding: 16px; margin: 0 auto 16px; max-width: 960px; }
.page h2 { margin: 0 0 12px; font-size: 18px; }
table { width: 100%; border-collapse: collapse; font-size: 14px; }
th, td { text-align: left; padding: 6px 8px; border-bottom: 1px solid var(--border); vertical-align: top; }
th { color: var(--muted); font-weight: 500; }
.table-scroll { overflow-x: auto; }

.toast-box { position: fixed; z-index: 2000; left: 50%; bottom: 16px; transform: translateX(-50%); display: grid; gap: 8px; width: min(420px, calc(100% - 32px)); }
.toast { background: var(--surface); border-left: 4px solid var(--accent); border-radius: 8px; box-shadow: var(--shadow); padding: 10px 14px; }
.toast.alarm-toast { border-left-color: var(--danger); }

dialog { border: 0; border-radius: var(--radius); box-shadow: var(--shadow); background: var(--surface); color: var(--text); width: min(440px, calc(100% - 32px)); padding: 20px; }
dialog:has(.dlg-tabs) { width: min(640px, calc(100% - 32px)); }
.dlg-tabs { margin: 0; flex-wrap: wrap; }
.dlg-tab { min-height: 300px; align-content: start; }
dialog::backdrop { background: rgb(0 0 0 / 0.4); }

.marker { width: 16px; height: 16px; border-radius: 50%; background: var(--accent); border: 2px solid #fff; box-shadow: 0 0 0 1px rgb(0 0 0 / 0.3); }
.marker.offline { background: var(--offline); }
.marker.alarm { background: var(--danger); animation: pulse 1.2s infinite; }
/* В движении — стрелка по курсу (владелец, 20.11.2026); белая обводка — тенью, как у точки */
.marker-arrow { width: 24px; height: 24px; display: grid; place-items: center; filter: drop-shadow(0 0 1px #fff) drop-shadow(0 0 1px #fff) drop-shadow(0 0 1px rgb(0 0 0 / 0.5)); }
.marker-arrow > span { width: 20px; height: 22px; background: var(--accent);
  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 20 22'%3E%3Cpath d='M10 0 L20 22 L10 16 L0 22 Z'/%3E%3C/svg%3E") center / contain no-repeat;
  mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 20 22'%3E%3Cpath d='M10 0 L20 22 L10 16 L0 22 Z'/%3E%3C/svg%3E") center / contain no-repeat; }
.marker-arrow.offline > span { background: var(--offline); }
.marker-arrow.alarm > span { background: var(--danger); }
.marker-arrow.alarm { animation: blink 1.2s infinite; }
@keyframes blink { 50% { opacity: 0.45; } }
/* Быстрый трек показан — значок синий (владелец, 20.11.2026) */
.item-actions .icon-btn.track.on { background: var(--accent); border-color: var(--accent); }
.item-actions .icon-btn.track.on .ico { background: var(--accent-text); }
/* Название объекта открывает карточку; рядом — геозона */
.item-name { cursor: pointer; }
/* Где объект — под названием: помещение или адрес (владелец, 23.11.2026) */
.item-where { display: flex; align-items: center; gap: 4px; font-size: 12px; color: var(--muted); margin: 1px 0 0 18px; min-width: 0; }
.item-where span:last-child { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.item-where .ico { width: 13px; height: 13px; flex: none; }
.item-sensors { display: flex; flex-wrap: wrap; gap: 2px 10px; font-size: 12px; margin: 2px 0 0 18px; }
.item-sensor { white-space: nowrap; }
.item-alarms { display: flex; flex-wrap: wrap; gap: 4px; margin: 3px 0 0 18px; }
.place-search { display: flex; gap: 8px; align-items: center; }
.place-search input { flex: 1; width: auto; min-width: 0; }
.place-found { display: flex; flex-direction: column; align-items: flex-start; gap: 2px; }
.item-name:hover { text-decoration: underline; }
.item-zone { font-size: 12px; color: var(--muted); border: 1px solid var(--border); border-radius: 10px; padding: 0 6px; margin-left: 6px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 45%; }
@keyframes pulse { 50% { box-shadow: 0 0 0 8px rgb(207 34 46 / 0.25); } }
.leaflet-container { background: var(--surface-2); font: inherit; }

@media (max-width: 760px) {
  .topbar { flex-wrap: wrap; gap: 6px; padding: 6px 8px; }
  .topbar .account { display: none; }
  .page { padding: 8px; }
  .page section { padding: 12px; }
}
.grow { flex: 1; }
.admin-body { display: grid; grid-template-rows: auto 1fr; min-height: 0; }
.admin-body > .tabs { background: var(--surface); overflow-x: auto; }
.admin-body > .tabs button { flex: none; padding: 10px 16px; }
.danger-text { color: var(--danger); }
/* Мастер режима работы, настройки объекта, отчёт о грузе */
dialog.mode-wizard, dialog.cargo-dialog { width: min(760px, calc(100% - 32px)); max-height: calc(100% - 32px); overflow: auto; }
dialog.object-settings { width: min(520px, calc(100% - 32px)); max-height: calc(100% - 32px); overflow: auto; display: grid; gap: 10px; }
/* Ретрансляторы */
dialog.retrans-dialog { width: min(960px, calc(100% - 32px)); max-height: calc(100% - 32px); overflow: auto; }
dialog.retrans-dialog:not([open]) { display: none; }
dialog.retrans-dialog h2 { margin: 0 0 8px; }
.retrans-objects { max-height: 45vh; overflow: auto; }
.retrans-objects input.mono { width: 14em; }
/* Импорт из Wialon (.wlp) */
dialog.wlp-import { width: min(900px, calc(100% - 32px)); max-height: calc(100% - 32px); overflow: auto; display: grid; gap: 10px; }
dialog.wlp-import:not([open]) { display: none; }
dialog.wlp-import h2 { margin: 0 0 4px; }
dialog.mode-wizard:not([open]), dialog.cargo-dialog:not([open]), dialog.object-settings:not([open]) { display: none; }
dialog.mode-wizard h2, dialog.cargo-dialog h2, dialog.object-settings h2 { margin: 0 0 8px; }
.mode-cards { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.mode-card { display: grid; gap: 4px; border: 1px solid var(--border); border-radius: 8px; padding: 10px; cursor: pointer; color: var(--text); font-size: 14px; }
.mode-card input { width: auto; justify-self: start; }
.mode-card:has(input:checked) { border-color: var(--accent); box-shadow: inset 0 0 0 1px var(--accent); }
.mode-section { border: 1px solid var(--border); border-radius: 8px; padding: 10px 12px; display: grid; gap: 10px; margin: 0; }
.mode-section legend { font-weight: 600; padding: 0 4px; }
.mode-section .row > label { flex: 1 1 200px; }
.cargo-rows { display: grid; gap: 6px; }
.cargo-row { display: grid; grid-template-columns: 110px 1.3fr 1fr auto; gap: 6px; align-items: center; }
.cmd-preview { max-height: 180px; overflow: auto; }
.cargo-report h3 { margin: 12px 0 6px; font-size: 15px; }
.sensor-check { max-height: 320px; }
@media (max-width: 600px) { .mode-cards { grid-template-columns: 1fr; } .cargo-row { grid-template-columns: 80px 1fr auto; } .cargo-row input[data-f=name] { grid-column: 1 / -2; } }
/* Группы объектов в левой колонке */
.group-bar { padding: 8px 12px; border-bottom: 1px solid var(--border); }
.group-head { display: flex; align-items: center; gap: 6px; padding: 8px 10px 8px 12px; background: var(--surface-2); border-bottom: 1px solid var(--border);
  cursor: pointer; user-select: none; position: sticky; top: 0; z-index: 1; }
.group-head .icon-btn { width: 28px; height: 26px; border: 0; background: transparent; }
.group-head.drop, .group-items.drop { box-shadow: inset 0 0 0 2px var(--accent); }
.group-items { min-height: 8px; }
.group-items .item { padding-left: 22px; }
.caret { width: 0; height: 0; border-left: 5px solid var(--muted); border-top: 4px solid transparent; border-bottom: 4px solid transparent; transition: transform .15s; flex: none; }
.caret.open { transform: rotate(90deg); }
.item[draggable=true] { cursor: grab; }
/* Окно тревог поверх карты */
.alarm-panel { position: absolute; z-index: 1060; top: 12px; left: 56px; width: min(380px, calc(100% - 68px)); max-height: calc(100% - 24px);
  display: flex; flex-direction: column; background: var(--surface); border-radius: var(--radius); box-shadow: var(--shadow); overflow: hidden; }
.alarm-panel .ap-bar { display: flex; align-items: center; gap: 8px; padding: 10px 12px; border-bottom: 1px solid var(--border); }
.alarm-panel .ap-bar .icon-btn { width: 28px; height: 26px; border: 0; background: transparent; }
.alarm-panel .list { overflow: auto; }
.alarm.notice .title { display: flex; align-items: center; gap: 6px; font-weight: 500; }
.alarm.notice .ico { width: 15px; height: 15px; background: var(--accent); }
/* Уведомление и «Трекер настроен» — оформление уведомления (синее), не тревоги */
.alarm-popup.notice-popup, .alarm-popup.config-popup { border-left-color: var(--accent); }
.alarm-popup.notice-popup .ap-head, .alarm-popup.config-popup .ap-head { color: var(--accent); }
.alarm-popup .ap-head .ico { background: var(--accent); width: 16px; height: 16px; }
.alarm-popup.config-popup.partial { border-left-color: var(--warn); }
.alarm-popup.config-popup.partial .ap-head { color: var(--warn); }
.alarm-popup.config-popup.partial .ap-head .ico { background: var(--warn); }
/* Значок-переключатель по состоянию: вход разрешён / учётная запись включена — зелёный, отключено — красный */
.actions .icon-btn.act.state-on .ico { background: var(--ok); }
.actions .icon-btn.act.state-off .ico { background: var(--danger); }
.actions .icon-btn.act.state-off { border-color: color-mix(in srgb, var(--danger) 45%, var(--border)); background: var(--danger-bg); }
dialog:has(.cmd-grants) { width: min(600px, calc(100% - 32px)); }
.cmd-grants { max-height: 360px; }
.cmd-grants label.check { align-items: flex-start; }
.ico-link { --ico: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M10 13a5 5 0 0 0 7.5.5l3-3a5 5 0 0 0-7-7l-1.7 1.7M14 11a5 5 0 0 0-7.5-.5l-3 3a5 5 0 0 0 7 7l1.7-1.7'/%3E%3C/svg%3E"); }
/* Ссылки для входа */
dialog.links-dialog { width: min(760px, calc(100% - 32px)); max-height: calc(100% - 32px); overflow: auto; display: grid; gap: 10px; }
dialog.links-dialog:not([open]) { display: none; }
dialog.links-dialog h2, dialog.links-dialog h3 { margin: 0; }
dialog.links-dialog .icon-btn { width: 32px; height: 30px; }
.link-objects { max-height: 200px; }
.link-created { display: grid; gap: 6px; border: 1px solid var(--accent); border-radius: 8px; padding: 10px; }
.link-created .row input { flex: 1; }
.ico-qr { --ico: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Crect x='3' y='3' width='7' height='7'/%3E%3Crect x='14' y='3' width='7' height='7'/%3E%3Crect x='3' y='14' width='7' height='7'/%3E%3Cpath d='M14 14h3v3h-3zM20 14v1M14 20h1M18 18h3v3'/%3E%3C/svg%3E"); }
/* Регистрация по коду трекера */
.login .reg-form { width: min(460px, 100%); background: var(--surface); padding: 24px; border-radius: var(--radius); box-shadow: var(--shadow); }
.reg-form h2 { margin: 6px 0 0; font-size: 17px; }
.reg-found { border: 1px solid var(--ok); border-radius: 8px; padding: 8px 10px; }
.seg { display: flex; gap: 16px; flex-wrap: wrap; }
.login-reg { text-align: center; }
.login .reg-done { width: min(460px, 100%); background: var(--surface); padding: 24px; border-radius: var(--radius); box-shadow: var(--shadow); }
dialog.reg-dialog, dialog.labels-dialog { width: min(640px, calc(100% - 32px)); max-height: calc(100% - 32px); overflow: auto; display: grid; gap: 10px; }
dialog.reg-dialog:not([open]), dialog.labels-dialog:not([open]) { display: none; }
dialog.reg-dialog h2, dialog.reg-dialog h3, dialog.labels-dialog h2 { margin: 0; }
dialog.reg-dialog .icon-btn, dialog.labels-dialog .icon-btn { width: 32px; height: 30px; }
.reg-sheet { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 10px; }
.reg-label { display: flex; gap: 10px; align-items: center; border: 1px dashed var(--border); border-radius: 6px; padding: 8px; background: #fff; color: #000; }
.reg-label svg { flex: none; }
.reg-code { font-size: 20px; font-weight: 700; letter-spacing: 1px; }
.print-only { display: none; }
@media print {
  /* Печать наклеек и меток из приложения; страница печати отчёта в PDF (body.print-mode) — не трогается */
  body:not(.print-mode) > *:not(.print-only) { display: none !important; }
  .print-only { display: grid !important; grid-template-columns: repeat(2, 1fr); gap: 6mm; }
  .print-only .reg-label { break-inside: avoid; border: 0.3mm dashed #999; }
}
.ico-copy { --ico: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Crect x='9' y='9' width='12' height='12' rx='2'/%3E%3Cpath d='M5 15H4a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h9a2 2 0 0 1 2 2v1'/%3E%3C/svg%3E"); }
/* Инструкция: как направить трекер на сервер (своё оборудование) */
.server-howto { font-size: 14px; }
.sms-steps { margin: 0; padding-left: 20px; display: grid; gap: 6px; }
.sms-cmd { display: inline-flex; align-items: center; gap: 6px; background: var(--surface-2); border: 1px solid var(--border); border-radius: 6px; padding: 2px 4px 2px 8px; margin-right: 6px; }
.sms-cmd .icon-btn { width: 26px; height: 24px; border: 0; background: transparent; }
/* «Войти как» */
.login .loginas-card { width: min(560px, 100%); background: var(--surface); padding: 24px; border-radius: var(--radius); box-shadow: var(--shadow); }
.loginas-list { display: grid; gap: 10px; max-height: 60vh; overflow: auto; }
.loginas-group { display: grid; gap: 4px; }
.loginas-account { padding: 4px 0; border-bottom: 1px solid var(--border); }
.loginas-user { display: grid; grid-template-columns: minmax(120px, auto) 1fr auto; gap: 10px; align-items: center; text-align: left; }
.warn-box { border: 1px solid var(--warn); border-left-width: 4px; border-radius: 8px; padding: 10px 12px; }
.warn-text { color: var(--warn); }
.acting { display: inline-flex; align-items: center; gap: 6px; }
.acting .chip { background: color-mix(in srgb, var(--warn) 20%, transparent); color: var(--warn); }

/* Окна: заголовок с крестиком справа вверху */
.dlg-head { display: flex; align-items: center; gap: 8px; }
.dlg-head h2 { margin: 0; }
.dlg-close, .dlg-x { width: 30px; height: 28px; border: 0; background: transparent; color: var(--muted); font-size: 16px; flex: none; }
.dlg-close:hover, .dlg-x:hover { color: var(--text); background: var(--surface-2); }
.dlg-x { position: absolute; top: 10px; right: 10px; z-index: 1; }
dialog:has(> .dlg-x) > h2:first-of-type, dialog:has(> .dlg-x) form > h2:first-child { padding-right: 36px; }

/* Меню в шапке — текстовые ссылки (как в админке) */
.navlinks { display: flex; align-items: center; gap: 2px; flex-wrap: wrap; min-width: 0; }
.navlink { color: var(--text); text-decoration: none; padding: 6px 10px; border-radius: 6px; white-space: nowrap; }
.navlink:hover { background: var(--surface-2); }
.navlink.active { color: var(--accent); font-weight: 600; box-shadow: inset 0 -2px 0 var(--accent); border-radius: 6px 6px 0 0; }
.navlink .badge { margin-left: 2px; }
.shell:not(.mobile) .mobile-only { display: none; }
.shell.mobile .desk-only { display: none; }

/* Вкладки внутри страницы («На мониторинге» / «Склад») и «＋» у заголовка */
.sub-tabs { margin: 0 0 8px; }
.sub-tabs button { flex: none; padding: 8px 14px; }
.ico-data { --ico: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M14 3H6a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V9z'/%3E%3Cpath d='M14 3v6h6M8 13h8M8 17h5'/%3E%3C/svg%3E"); }
.nowrap { white-space: nowrap; }
.spacer { flex: 1; }

/* «Сообщения»: сверху карта, посередине выбор объекта, периода и вида, снизу — таблица */
.msg-view { display: grid; grid-template-rows: minmax(160px, 42%) auto minmax(0, 1fr) auto; min-height: 0; }
.msg-mapwrap { position: relative; min-height: 0; }
.msg-mapbox { position: absolute; inset: 0; }
/* Окно сообщения поверх карты (по щелчку на строке) */
.msg-detail { position: absolute; z-index: 1001; top: 10px; right: 10px; width: min(400px, calc(100% - 20px)); max-height: calc(100% - 20px); overflow: auto;
  background: var(--surface); border-radius: var(--radius); box-shadow: var(--shadow); padding: 10px 12px; display: grid; gap: 6px; }
.msg-detail .icon-btn { width: 28px; height: 26px; border: 0; background: transparent; }
.msg-mark { padding: 3px 8px; border-radius: 6px; }
.msg-mark.msg-alarm { background: var(--danger-bg); color: var(--danger); }
.msg-mark.msg-archive { background: var(--archive-bg); }
.msg-mark.msg-lbs { background: var(--lbs-bg); }
/* Сообщение — одна строка; полностью — в подсказке и в окне */
.msg-pcell { max-width: 0; width: 100%; }
.msg-line { display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-size: 12px; }
.msg-table td { padding-top: 4px; padding-bottom: 4px; }
.msg-row.msg-alarm td { background: var(--danger-bg); }
.msg-row.msg-archive td { background: var(--archive-bg); }
.msg-row.msg-lbs td { background: var(--lbs-bg); }
.lbs-text { color: var(--warn); font-family: inherit; }
.msg-legend { display: inline-flex; gap: 6px; }
.msg-legend .lg { padding: 1px 8px; border-radius: 6px; border: 1px solid var(--border); }
.msg-legend .lg .ico { width: 14px; height: 14px; vertical-align: -2px; }
.msg-legend .lg.msg-alarm { background: var(--danger-bg); }
.msg-legend .lg.msg-archive { background: var(--archive-bg); }
.msg-legend .lg.msg-lbs { background: var(--lbs-bg); }
/* Навигация по страницам сообщений — внизу */
.msg-pager { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; padding: 6px 12px; background: var(--surface); border-top: 1px solid var(--border); }
.msg-pager button { padding: 4px 10px; }
.msg-pager select { width: auto; }
.msg-bar { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 14px; padding: 8px 12px; background: var(--surface);
  border-top: 1px solid var(--border); border-bottom: 1px solid var(--border); }
.msg-bar select.msg-device { width: auto; max-width: 260px; }
.seg-links { display: inline-flex; gap: 2px; flex-wrap: wrap; }
.seg-links a { padding: 4px 9px; border-radius: 6px; text-decoration: none; color: var(--text); white-space: nowrap; }
.seg-links a:hover { background: var(--surface-2); }
.seg-links a.active { background: var(--accent); color: var(--accent-text); }
/* «Сообщения»: порядок строк — две стрелки (владелец, 19.11.2026) */
.msg-order { display: inline-flex; gap: 2px; }
.msg-order .icon-btn.active { background: var(--accent); color: var(--accent-text); border-color: var(--accent); }
.msg-custom { display: inline-flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.msg-custom input { width: auto; }
.msg-tablebox { overflow: auto; min-height: 0; background: var(--surface); }
.msg-table { font-size: 13px; }
.msg-table th { position: sticky; top: 0; z-index: 1; background: var(--surface); box-shadow: 0 1px 0 var(--border); white-space: nowrap; }
.msg-table.sensors td { white-space: nowrap; }
.msg-row { cursor: pointer; }
.msg-row:hover td { background: var(--surface-2); }
.msg-row.selected td { box-shadow: inset 0 2px 0 var(--accent), inset 0 -2px 0 var(--accent); }
.msg-row.selected:not(.msg-alarm):not(.msg-archive):not(.msg-lbs) td { background: color-mix(in srgb, var(--accent) 12%, transparent); }
/* Данные трекера (админка) */
dialog.data-dialog { width: min(920px, calc(100% - 32px)); max-height: calc(100% - 32px); overflow: auto; display: grid; gap: 10px; }
dialog.data-dialog:not([open]) { display: none; }
dialog.data-dialog h2 { margin: 0; }
dialog.data-dialog select { width: auto; }
.data-list { display: grid; }
.data-item { display: grid; gap: 6px; padding: 6px 8px; border-bottom: 1px solid var(--border); }
.data-item.msg-alarm { background: var(--danger-bg); }
.data-item.msg-archive { background: var(--archive-bg); }
.data-item.msg-lbs { background: var(--lbs-bg); }
.data-head { display: flex; gap: 10px; align-items: baseline; cursor: pointer; min-width: 0; font-size: 13px; }
.data-head .msg-line { flex: 1; min-width: 0; }
.data-head:hover .msg-line { color: var(--accent); }

/* Телефон — упрощённый интерфейс (владелец, 18.11.2026): объекты, карта, уведомления; один экран за раз */
.shell.mobile .topbar { flex-wrap: nowrap; gap: 4px;
  padding: max(6px, env(safe-area-inset-top)) max(8px, env(safe-area-inset-right)) 6px max(8px, env(safe-area-inset-left)); }
.shell.mobile .topbar .account, .shell.mobile .side-toggle, .shell.mobile .topbar .brand { display: none; }
.shell.mobile .topbar .spacer { display: block; }
.shell.mobile .navlinks { flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; }
.shell.mobile .navlink { padding: 6px 8px; }
.shell.mobile .main, .shell.mobile .main.side-hidden { grid-template-columns: minmax(0, 1fr); grid-template-rows: minmax(0, 1fr); }
.shell.mobile .main[data-mview="list"] .mapwrap { display: none; }
.shell.mobile .main[data-mview="map"] .side { display: none; }
.shell.mobile .main[data-mview="list"] .side { display: flex; border-right: 0; }
.shell.mobile .item { padding: 12px max(12px, env(safe-area-inset-right)) 12px max(12px, env(safe-area-inset-left)); }
.shell.mobile .item-actions .icon-btn { display: none; }
.shell.mobile .group-bar, .shell.mobile .group-head .icon-btn { display: none; }
.shell.mobile .detail { top: auto; left: 8px; right: 8px; bottom: max(8px, env(safe-area-inset-bottom)); width: auto; max-height: 58%; padding: 12px; gap: 8px; }
.shell.mobile .m-detail h2 { font-size: 17px; }
.shell.mobile .alarm-panel { inset: 8px; width: auto; max-height: none; z-index: 1100; }
.shell.mobile ~ .alarm-popups, body:has(.shell.mobile) .alarm-popups { top: calc(52px + env(safe-area-inset-top)); left: 8px; right: 8px; width: auto; }
body:has(.shell.mobile) .toast-box { bottom: max(16px, env(safe-area-inset-bottom)); }
body:has(.shell.mobile) .hovercard { display: none; }

/* Необратимое удаление: красная кнопка, предупреждение */
button.primary.danger-fill { background: var(--danger); border-color: var(--danger); color: #fff; }
.delete-warning { display: grid; gap: 6px; font-size: 14px; }
.delete-warning p, .delete-warning ul { margin: 0; }
.delete-warning ul { padding-left: 20px; }
dialog:has(.delete-warning) { width: min(520px, calc(100% - 32px)); }
input[type="color"] { height: 38px; padding: 3px; cursor: pointer; }

/* Профиль по вкладкам (владелец, 19.11.2026) */
.profile-tabs { flex-wrap: wrap; max-width: 960px; margin: 0 auto 12px; }
.profile-tabs button { white-space: nowrap; }
.profile-body > section { margin-top: 0; }
/* Второй фактор: QR, ключ, резервные коды */
.totp-steps { margin: 0; padding-left: 20px; display: grid; gap: 8px; }
.totp-qr { margin: 8px 0; }
.totp-qr svg { display: block; max-width: 100%; height: auto; }
.totp-secret { word-break: break-all; user-select: all; }
.recovery-codes { margin: 0; padding: 12px; border: 1px solid var(--border); border-radius: 6px; background: var(--surface); line-height: 1.6;
  columns: 2; column-gap: 24px; user-select: all; }
.code-input { max-width: 12em; font-size: 1.2em; letter-spacing: 0.15em; font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; }
.ico-text { font-size: 11px; font-weight: 700; letter-spacing: 0.02em; color: var(--muted); }
.icon-btn:hover .ico-text { color: var(--accent); }
.totp-status { margin: -4px 0 12px; }
.totp-apps ul { margin: 4px 0 0; padding-left: 20px; }

/* Геозоны (этап 3): список слева, карта справа */
.page:has(> .gz-page) { padding: 0; overflow: hidden; }
.gz-page { display: grid; grid-template-columns: 360px minmax(0, 1fr); height: 100%; min-height: 0; }
.gz-side { display: flex; flex-direction: column; min-height: 0; border-right: 1px solid var(--border); background: var(--surface); }
.gz-head { padding: 12px 12px 8px; gap: 6px; }
.gz-head h2 { margin: 0; font-size: 18px; }
.gz-head button { padding: 6px 10px; }
.gz-panel { padding: 0 12px 12px; border-bottom: 1px solid var(--border); }
/* Форма правки (здание — самая высокая) и панель этажей не выходят за экран: панель прокручивается, список под ней
   сжимается; кнопки «Отмена» / «Сохранить» прилипают к низу панели — видны всегда (владелец, 23.11.2026) */
.gz-side > .gz-panel { flex: 0 1 auto; min-height: 0; overflow-y: auto; }
.gz-side > .gz-list { flex: 1 1 0; min-height: 60px; }
.gz-back { display: none; text-align: left; border: 0; border-bottom: 1px solid var(--border); background: transparent; color: var(--accent); padding: 8px 12px; font-weight: 600; }
.gz-back:hover { background: var(--hover, rgba(127, 127, 127, 0.08)); }
.gz-page.gz-focus .gz-back { display: block; }
.gz-page.gz-focus .gz-filter, .gz-page.gz-focus .gz-list { display: none; }
.gz-page.gz-focus .gz-side > .gz-panel { flex: 1 1 auto; border-bottom: 0; }
.gz-panel > form.form > .row:last-child { position: sticky; bottom: 0; z-index: 1; background: var(--surface); padding: 8px 0; margin-bottom: -12px; border-top: 1px solid var(--border); }
.gz-panel.hidden { display: none; }
.gz-list { overflow: auto; flex: 1; }
.gz-item { display: flex; gap: 10px; align-items: flex-start; padding: 10px 12px; border-bottom: 1px solid var(--border); cursor: pointer; }
.gz-item:hover { background: var(--hover, rgba(127, 127, 127, 0.08)); }
.gz-empty { padding: 12px; }
.gz-swatch { width: 14px; height: 14px; border-radius: 3px; flex: none; margin-top: 3px; }
.gz-colors { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 4px; }
.gz-color { width: 24px; height: 24px; padding: 0; border-radius: 50%; border: 2px solid transparent; }
.gz-color.active { border-color: var(--text); box-shadow: 0 0 0 2px var(--surface) inset; }
.gz-map { min-height: 0; height: 100%; }
.gz-drawing { cursor: crosshair; }
.gz-vertex { background: #fff; border: 2px solid #1f6feb; border-radius: 50%; box-sizing: border-box; }
.gz-vertex.first { background: #1f6feb; }
.gz-vertex.center { background: #1f6feb; border-color: #fff; }
.gz-vertex.handle { border-radius: 3px; }
.gz-vertex.mid { opacity: 0.6; transform: scale(0.75); border-style: dashed; }
.leaflet-control-layers label { display: flex; align-items: center; gap: 6px; margin: 0; font-size: 13px; color: inherit; }
.leaflet-control-layers-selector { margin: 0; }
.gz-results { display: flex; flex-direction: column; gap: 2px; max-height: 240px; overflow: auto; }
.gz-result { text-align: left; border: 0; border-radius: 6px; background: transparent; padding: 6px 8px; }
.gz-result:hover { background: var(--hover, rgba(127, 127, 127, 0.1)); }

/* Этажи и планы (3.3) */
.plan-layer { position: absolute; left: 0; top: 0; pointer-events: none; max-width: none !important; image-rendering: auto; }
.floors-panel { margin-top: 4px; }
.floor-row { display: flex; align-items: center; gap: 6px; border-radius: 6px; padding: 2px 4px; }
.floor-row.active { background: var(--archive-bg); }
.floor-name { flex: 1; text-align: left; border: 0; background: transparent; padding: 4px; }
.bind-overlay { position: fixed; inset: 0; z-index: 3000; background: rgba(0, 0, 0, 0.45); display: flex; padding: 16px; }
.bind-box { flex: 1; display: flex; flex-direction: column; gap: 8px; background: var(--surface); border-radius: var(--radius); padding: 12px 16px; min-height: 0; }
.bind-head h2 { margin: 0; font-size: 18px; }
.bind-panes { flex: 1; display: grid; grid-template-columns: 1fr 1fr; gap: 12px; min-height: 0; }
.bind-pane { display: flex; flex-direction: column; min-height: 0; }
.bind-map { flex: 1; min-height: 240px; border: 1px solid var(--border); border-radius: 6px; background: #eef0f2; }
.bind-list { margin: 0; padding-left: 20px; max-height: 70px; overflow: auto; }
.bind-foot { align-items: flex-end; }
.bind-num { background: #cf222e; color: #fff; border: 2px solid #fff; border-radius: 50%; font: 700 12px/18px sans-serif; text-align: center; box-shadow: 0 0 2px #000; }
.bind-num.pending { background: #9a6700; }
.floor-switch { background: var(--surface); display: flex; flex-direction: column; align-items: stretch; width: 34px; }
.floor-switch.hidden { display: none; }
.floor-switch-title { font-size: 10px; padding: 3px 2px; text-align: center; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; border-bottom: 1px solid var(--border); }
.leaflet-bar a.floor-btn { width: auto; min-width: 30px; text-align: center; color: var(--text); background: var(--surface); }
.leaflet-bar a.floor-btn.active { background: var(--accent); color: #fff; }
@media (max-width: 760px) { .bind-panes { grid-template-columns: 1fr; grid-template-rows: 1fr 1fr; } .bind-overlay { padding: 0; } }

/* Помещения и метки ADM34 на плане (3.3, часть 2) */
.indoor-panes { flex: 1; display: grid; grid-template-columns: minmax(260px, 340px) 1fr; gap: 12px; min-height: 0; }
.indoor-side { overflow-y: auto; min-height: 0; display: flex; flex-direction: column; gap: 2px; }
.indoor-side h3 { margin: 10px 0 4px; font-size: 15px; }
.indoor-side .gz-head h3 { margin: 0; }
.indoor-side .gz-head { align-items: center; margin-top: 4px; }
.indoor-side .gz-head button.icon-btn.gz-add { width: 32px; height: 30px; padding: 0; background: var(--accent); border-color: var(--accent); }
.indoor-side .gz-head button.icon-btn.gz-add .ico { background: var(--accent-text); }
.indoor-map { min-height: 300px; }
.indoor-beacon { background: var(--indoor); border: 2px solid #fff; border-radius: 50%; box-sizing: border-box; box-shadow: 0 0 2px #000; }
.indoor-beacon.free { background: var(--warn); }
.indoor-beacon.pending { background: var(--accent); }
.indoor-beacon-dot { width: 12px; height: 12px; border-radius: 50%; background: var(--indoor); flex: none; margin-top: 4px; }
.indoor-beacon-dot.free { background: var(--warn); }
.leaflet-tooltip.room-label { background: transparent; border: 0; box-shadow: none; font-weight: 600; color: #24292f; text-shadow: 0 0 3px #fff, 0 0 3px #fff; padding: 0; }
.leaflet-tooltip.room-label::before { display: none; }
.indoor-seen { display: flex; flex-direction: column; align-items: stretch; gap: 2px; max-height: 180px; overflow-y: auto; }
.indoor-pick { text-align: left; border: 1px solid var(--border); background: var(--surface); color: var(--text); border-radius: 4px; padding: 3px 6px; font-family: ui-monospace, monospace; }
.indoor-pick:hover:not(:disabled) { border-color: var(--accent); }
.indoor-pick:disabled { opacity: 0.55; }
.ico-beacon { --ico: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round'%3E%3Ccircle cx='12' cy='12' r='2.5' fill='black'/%3E%3Cpath d='M7.8 7.8a6 6 0 0 0 0 8.4M16.2 7.8a6 6 0 0 1 0 8.4M4.9 4.9a10 10 0 0 0 0 14.2M19.1 4.9a10 10 0 0 1 0 14.2'/%3E%3C/svg%3E"); }
.ico-rooms { --ico: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linejoin='round'%3E%3Crect x='3' y='3' width='18' height='18' rx='1'/%3E%3Cpath d='M3 12h7M10 3v5M10 12v9M14 12h7M14 12V9'/%3E%3C/svg%3E"); }
@media (max-width: 760px) { .indoor-panes { grid-template-columns: 1fr; grid-template-rows: minmax(0, 45%) 1fr; } }

/* Треки (владелец, 19.11.2026): колонка настроек слева, список построенных треков */
.trk-panel { display: flex; flex-direction: column; min-height: 0; height: 100%; overflow-y: auto; overflow-x: hidden; }
.trk-form { display: grid; gap: 8px; padding: 12px; border-bottom: 1px solid var(--border); }
.trk-row { display: grid; grid-template-columns: 96px minmax(0, 1fr); align-items: center; gap: 8px; margin: 0; }
.trk-row > select, .trk-row > input { width: 100%; min-width: 0; box-sizing: border-box; }
.trk-row > span { color: var(--muted); font-size: 13px; }
.trk-sub { padding-left: 24px; grid-template-columns: 72px minmax(0, 1fr); }
.trk-checks { display: grid; gap: 4px; }
.trk-quick { margin: 4px 0 0; }
.trk-quick { overflow: hidden; }
.trk-quick button { flex: 1 1 0; min-width: 0; padding: 8px 4px; }
.trk-actions { margin-top: 4px; }
.trk-legend { display: flex; flex-wrap: wrap; gap: 4px 10px; padding: 8px 12px 0; }
.trk-legend:empty { display: none; }
.trk-leg { display: inline-flex; align-items: center; gap: 4px; }
.trk-sw { display: inline-block; width: 12px; height: 12px; border-radius: 3px; flex: none; }
.trk-list { display: grid; }
.trk-item { border-bottom: 1px solid var(--border); }
.trk-item-head { display: flex; gap: 8px; align-items: flex-start; padding: 10px 12px; cursor: pointer; }
.trk-item-head > input[type=checkbox], .trk-item-head > input[type=radio] { width: auto; flex: none; margin: 3px 0 0; }
.trk-item-head .trk-sw { margin-top: 4px; }
.trk-trips { display: grid; padding: 0 12px 8px 36px; }
.trk-trip { display: flex; gap: 6px; align-items: center; text-align: left; border: 0; background: transparent; padding: 4px 6px; border-radius: 6px; font-size: 13px; }
.trk-trip:hover { background: var(--hover, rgba(127, 127, 127, 0.1)); }
.trk-trip.active { background: var(--surface-2); box-shadow: inset 3px 0 0 var(--accent); font-weight: 600; }
.trk-parking { background: #1f6feb; color: #fff; border: 2px solid #fff; border-radius: 4px; font: 700 11px/14px sans-serif; text-align: center; box-shadow: 0 0 2px rgba(0, 0, 0, 0.6); }
.leaflet-tooltip.trk-label { padding: 0 3px; font-size: 10px; line-height: 14px; box-shadow: none; opacity: 0.9; }

/* «Настройки» (владелец, 19.11.2026): меню слева — «Личные» и «Администрирование», справа — раздел */
.page:has(> .settings) { padding: 0; overflow: hidden; }
.settings { display: grid; grid-template-columns: 220px minmax(0, 1fr); height: 100%; min-height: 0; }
.settings-nav { display: flex; flex-direction: column; gap: 2px; padding: 12px 8px; border-right: 1px solid var(--border); background: var(--surface); overflow-y: auto; }
.settings-group { font-size: 12px; text-transform: uppercase; letter-spacing: 0.04em; color: var(--muted); padding: 12px 10px 4px; }
.settings-group:first-child { padding-top: 0; }
.settings-nav button { text-align: left; border: 0; background: transparent; border-radius: 6px; padding: 8px 10px; }
.settings-nav button:hover { background: var(--hover, rgba(127, 127, 127, 0.1)); }
.settings-nav button.active { background: var(--archive-bg); font-weight: 600; box-shadow: inset 3px 0 0 var(--accent); }
.settings-body { overflow: auto; padding: 16px; min-width: 0; }
@media (max-width: 760px) {
  .settings { grid-template-columns: minmax(0, 1fr); grid-template-rows: auto minmax(0, 1fr); }
  .settings-nav { flex-direction: row; flex-wrap: wrap; border-right: 0; border-bottom: 1px solid var(--border); padding: 8px; }
  .settings-group { width: 100%; padding: 4px 6px; }
  .settings-body { padding: 8px; }
}
/* «Карта при входе» — найденные города и адреса (владелец, 19.11.2026) */
.mv-results { display: grid; gap: 2px; }
.mv-results button { text-align: left; }
/* «Уведомления»: событие × способ (владелец, 19.11.2026) */
.notify-table { border-collapse: collapse; width: 100%; max-width: 640px; }
.notify-table th, .notify-table td { padding: 5px 8px; border-bottom: 1px solid var(--border); text-align: left; font-size: 14px; }
.notify-table th { font-weight: 600; vertical-align: bottom; font-size: 13px; }
.notify-table .c { text-align: center; }
.notify-table tr.grp td { background: var(--surface-2); font-weight: 600; font-size: 13px; }
.notify-wrap { overflow-x: auto; }
/* «Уведомления 2.0» — мастер (public/app/notify-wizard.js) */
.nw-steps { display: flex; flex-wrap: wrap; gap: 4px; list-style: none; padding: 0; margin: 4px 0 12px; }
.nw-steps button { background: none; border: 1px solid var(--border); border-radius: 999px; padding: 4px 12px; font-size: 13px; color: var(--muted); cursor: pointer; }
.nw-steps li.done button { color: inherit; }
.nw-steps li.active button { background: var(--accent); border-color: var(--accent); color: var(--accent-text); }
.nw-objects { display: grid; gap: 8px; max-height: 420px; overflow: auto; border: 1px solid var(--border); border-radius: 6px; padding: 8px; max-width: 640px; }
.nw-group-head { font-size: 14px; }
.nw-group-list { display: grid; gap: 4px; padding-left: 24px; }
.nw-objects > .nw-group-list { padding-left: 0; }
.nw-nav { margin-top: 12px; }
.nw-extras { display: grid; gap: 8px; max-width: 640px; }
.notify-wizard h3 { margin: 16px 0 6px; font-size: 15px; }
/* «Уведомления на этом устройстве» (Web Push) */
.push-block { display: grid; gap: 6px; padding: 10px 12px; border: 1px solid var(--border); border-radius: 8px; max-width: 640px; }
/* Телефон: «Настройки» значком в меню */
.navlink.nav-ico { display: inline-flex; align-items: center; padding-left: 8px; padding-right: 8px; }
.navlink.nav-ico .ico { width: 20px; height: 20px; background: currentColor; }
.shell:not(.mobile) .navlink.nav-ico { display: none; }
/* Телефон: меню из пяти пунктов помещается целиком (390 px); таблица уведомлений — без обрезки справа */
@media (max-width: 760px) {
  .shell.mobile .navlink { padding: 6px 6px; font-size: 15px; }
  .shell.mobile .navlink.nav-ico { padding: 6px 4px; }
  .notify-table th, .notify-table td { padding: 5px 3px; font-size: 13px; }
  .notify-table th { font-size: 12px; }
}

/* Значки телефонной версии: мониторинг, все объекты, где я, поиск (19.11.2026) */
.ico-nav { --ico: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M3 11l18-8-8 18-2-8z'/%3E%3C/svg%3E"); }
.ico-fit { --ico: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M4 9V4h5M20 9V4h-5M4 15v5h5M20 15v5h-5'/%3E%3C/svg%3E"); }
.ico-locate { --ico: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='12' cy='12' r='7'/%3E%3Ccircle cx='12' cy='12' r='2'/%3E%3Cpath d='M12 1v4M12 19v4M1 12h4M19 12h4'/%3E%3C/svg%3E"); }
.ico-search { --ico: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='11' cy='11' r='7'/%3E%3Cpath d='M20 20l-4-4'/%3E%3C/svg%3E"); }

/*
 * Телефон: карта и выдвижная панель (владелец, 19.11.2026; по образцу его скриншота, в нашем стиле).
 * Карта всегда на экране; снизу — панель с ручкой (свёрнута / наполовину / целиком); внизу — вкладки со значками.
 */
.m-tabbar, .m-sheet, .m-fabs { display: none; }
.shell.mobile { grid-template-rows: auto minmax(0, 1fr) auto; }
.shell.mobile > .topbar { grid-row: 1; }
.shell.mobile > .main, .shell.mobile > .msg-view, .shell.mobile > .page { grid-row: 2; }
/* Шапка на телефоне — только пометки «вошёл как» / «по ссылке» */
.shell.mobile .topbar:not(:has(.acting, .chip)) { display: none; }
.shell.mobile .topbar .navlinks { display: none; }
.shell.mobile .main .side, .shell.mobile .main[data-mview] .side { display: none; }
.shell.mobile .main[data-mview] .mapwrap { display: block; }
.shell.mobile .m-tabbar { grid-row: 3; display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; background: var(--surface);
  border-top: 1px solid var(--border); padding: 2px max(4px, env(safe-area-inset-right)) max(4px, env(safe-area-inset-bottom)) max(4px, env(safe-area-inset-left)); }
.m-tab { display: grid; justify-items: center; gap: 2px; border: 0; background: transparent; color: var(--muted); font-size: 11px; padding: 6px 2px 4px; border-radius: 8px; }
.m-tab .ico { width: 24px; height: 24px; background: currentColor; }
.m-tab.active { color: var(--accent); font-weight: 600; }
.m-tab-ico { position: relative; display: inline-flex; }
.m-dot { position: absolute; top: -5px; left: 16px; min-width: 16px; height: 16px; padding: 0 4px; border-radius: 8px; background: var(--danger);
  color: #fff; font-size: 10px; line-height: 16px; text-align: center; font-weight: 600; }
.shell.mobile .m-sheet { display: flex; flex-direction: column; position: absolute; z-index: 1040; left: 0; right: 0; bottom: 0; height: 50%;
  background: var(--surface); border-radius: 16px 16px 0 0; box-shadow: 0 -4px 16px rgb(0 0 0 / 0.18); transition: height 0.2s ease; }
.shell.mobile .m-sheet[data-state="peek"] { height: 150px; }
.shell.mobile .m-sheet[data-state="full"] { height: calc(100% - 24px); }
.m-handle { flex: none; display: flex; justify-content: center; padding: 8px 0 8px; cursor: grab; touch-action: none; }
.m-handle span { width: 40px; height: 5px; border-radius: 3px; background: var(--muted); opacity: 0.5; }
.m-sheet-body { flex: 1; min-height: 0; overflow-y: auto; overscroll-behavior: contain; }
.m-search-row { position: sticky; top: 0; z-index: 1; display: flex; align-items: center; gap: 8px; margin: 0 12px 6px; padding: 0 10px;
  border: 1px solid var(--border); border-radius: 10px; background: var(--surface-2); }
/* 16 px — iPhone не увеличивает страницу при вводе */
.m-search { border: 0; background: transparent; padding: 9px 0; flex: 1; min-width: 0; font-size: 16px; outline: none; }
.m-list .item:last-child { border-bottom: 0; }
.m-card { display: grid; gap: 8px; padding: 0 12px 12px; }
.m-card-head { display: flex; align-items: center; gap: 8px; }
.m-card-head h2 { margin: 0; font-size: 17px; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.m-back { font-size: 24px; line-height: 1; }
.m-track { display: flex; gap: 6px; }
.m-track button:not(.icon-btn) { flex: 1 1 0; padding-left: 4px; padding-right: 4px; white-space: nowrap; }
.m-track-info:empty { display: none; }
.shell.mobile .m-fabs { display: grid; gap: 10px; position: absolute; z-index: 1030; right: max(12px, env(safe-area-inset-right));
  bottom: calc(var(--sheet-h, 50%) + 12px); }
.m-fab { width: 46px; height: 46px; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center; padding: 0;
  background: var(--surface); border: 1px solid var(--border); box-shadow: 0 2px 8px rgb(0 0 0 / 0.2); }
.m-fab .ico { width: 22px; height: 22px; background: var(--text); }
/* Подписи карты — над панелью; окна тревог — сверху; сообщения — над вкладками */
.shell.mobile .leaflet-bottom { bottom: var(--sheet-h, 0); }
.shell.mobile .leaflet-control-attribution { font-size: 10px; }
.shell.mobile .alarm-panel { inset: max(8px, env(safe-area-inset-top)) 8px 8px 8px; }
body:has(.shell.mobile) .alarm-popups { top: max(8px, env(safe-area-inset-top)); }
body:has(.shell.mobile) .toast-box { bottom: calc(72px + env(safe-area-inset-bottom)); }
.m-logout { margin-top: 8px; }
/* Телефон: «Треки» в панели — прокрутка у панели, а не у колонки */
.m-sheet-body > .trk-panel { height: auto; overflow: visible; }
.shell:not(.mobile) .side .item { cursor: default; }
/* «Сообщения» в режиме редактирования (владелец, 20.11.2026): над колонкой флажков — удаление выбранных */
.msg-view.editing { grid-template-rows: minmax(160px, 42%) auto auto minmax(0, 1fr) auto; }
.msg-editbar { display: flex; align-items: center; gap: 10px; padding: 4px 8px; background: var(--surface); border-bottom: 1px solid var(--border); }
.msg-editbar .icon-btn.msg-del:not(:disabled):hover { border-color: var(--danger); }
.msg-editbar .icon-btn.msg-del:not(:disabled) .ico { background: var(--danger); }
.msg-table .msg-pick { width: 28px; text-align: center; padding-left: 8px; padding-right: 4px; }
.msg-table .msg-pick input { margin: 0; }
/* Геозоны (владелец, 20.11.2026): добавление — значками одного размера; поиск и фильтр «все / здания / геозоны» */
.ico-building { --ico: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M4 21V4a1 1 0 0 1 1-1h9a1 1 0 0 1 1 1v17M15 9h4a1 1 0 0 1 1 1v11M2 21h20M8 7h3M8 11h3M8 15h3'/%3E%3C/svg%3E"); }
.ico-polygon { --ico: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linejoin='round'%3E%3Cpath d='M12 3l9 6.5-3.5 10.5h-11L3 9.5z'/%3E%3C/svg%3E"); }
.ico-circle { --ico: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2'%3E%3Ccircle cx='12' cy='12' r='9'/%3E%3C/svg%3E"); }
.ico-line { --ico: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M3 18l6-8 5 5 7-10'/%3E%3Ccircle cx='3' cy='18' r='1.5'/%3E%3Ccircle cx='21' cy='5' r='1.5'/%3E%3C/svg%3E"); }
.gz-adds { display: flex; gap: 4px; }
.gz-head button.icon-btn.gz-add { width: 32px; height: 30px; padding: 0; background: var(--accent); border-color: var(--accent); }
.gz-head button.icon-btn.gz-add .ico { background: var(--accent-text); }
.gz-head button.icon-btn.gz-add:hover { filter: brightness(1.1); }
.gz-filter { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 8px; padding: 0 12px 8px; border-bottom: 1px solid var(--border); }
.gz-filter input.gz-search { flex: 1; min-width: 140px; }
.gz-filter .gz-kinds a { font-size: 13px; padding: 3px 8px; }
/* Подвал страниц (владелец, 20.11.2026): вход и регистрация — под формой; кабинет — одной строкой внизу; телефон — в «Настройках» */
.login { align-content: center; gap: 14px; }
.app-footer { font-size: 12px; color: var(--muted); text-align: center; line-height: 1.5; max-width: min(560px, 100%); overflow-wrap: anywhere; }
.app-footer a { color: var(--muted); text-decoration: underline; text-decoration-color: color-mix(in srgb, var(--muted) 50%, transparent); }
.app-footer a:hover { color: var(--accent); }
.shell > .app-footer.inline { max-width: none; padding: 3px 12px; background: var(--surface); border-top: 1px solid var(--border);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.shell.mobile > .app-footer { display: none; }
.settings-body > .app-footer { margin: 20px auto 8px; }
.footer-preview { border: 1px dashed var(--border); border-radius: 8px; padding: 10px; display: grid; place-items: center; }

/* План здания вместо карты (владелец, 23.11.2026): поверх карты, под карточкой объекта (1050) и панелью уведомлений (1060) */
.indoor-view { position: absolute; inset: 0; z-index: 1040; background: #eef0f2; }
.iv-map { position: absolute; inset: 0; background: #eef0f2; }
.iv-bar { position: absolute; left: 12px; bottom: 12px; z-index: 1001; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; max-width: calc(100% - 24px);
  background: var(--surface); color: var(--text); border: 1px solid var(--border); border-radius: var(--radius); padding: 6px 10px; box-shadow: 0 1px 4px rgba(0, 0, 0, 0.2); }
.iv-bar .ico { background: var(--indoor); }
.iv-floors { display: inline-flex; gap: 2px; }
.iv-floor { min-width: 28px; padding: 2px 6px; border: 1px solid var(--border); background: var(--surface); color: var(--text); border-radius: 4px; }
.iv-floor.active { background: var(--accent); border-color: var(--accent); color: var(--accent-text); }
.iv-back { border: 0; background: transparent; color: var(--accent); font-weight: 600; padding: 2px 4px; }
.iv-object { background: #cf222e; border: 3px solid #fff; border-radius: 50%; box-sizing: border-box; box-shadow: 0 0 3px #000; }
.iv-object:not(.selected) { background: #1f6feb; transform: scale(0.8); }
.shell.mobile .iv-bar { bottom: calc(var(--sheet-h, 0px) + 8px); }
/* Тепловая карта в здании (решение 81): пятна поверх плана, список меток слева сверху */
.heat-view .hm-spray { mix-blend-mode: multiply; }
.hm-list { position: absolute; left: 56px; top: 12px; z-index: 1002; width: min(280px, calc(100% - 68px)); max-height: calc(100% - 90px); overflow: auto;
  display: flex; flex-direction: column; gap: 6px; background: var(--surface); color: var(--text); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 10px 12px; box-shadow: 0 1px 6px rgba(0, 0, 0, 0.25); }
.hm-item { display: flex; align-items: center; gap: 8px; }
.hm-sw { width: 12px; height: 12px; border-radius: 50%; flex: none; }
.hm-legend { display: inline-flex; align-items: center; gap: 4px; }
.hm-ramp { display: inline-block; width: 90px; height: 8px; border-radius: 4px;
  background: linear-gradient(90deg, rgb(31, 111, 235), rgb(10, 170, 200) 30%, rgb(40, 170, 60) 50%, rgb(230, 200, 30) 68%, rgb(240, 120, 20) 84%, rgb(207, 34, 46)); }
.trk-heat { display: flex; flex-direction: column; gap: 6px; }
.trk-heat select { flex: 1; min-width: 0; }
.trk-heat-sw { width: 14px; height: 14px; border-radius: 50%; flex: none; }
/* Генератор координат меток ADM34 (решение 83) */
.tags-dialog { width: min(980px, calc(100vw - 24px)); }
.tags-body { display: flex; flex-direction: column; gap: 10px; }
.tags-alt input { width: 110px; }
.tags-floor-h { width: 80px; }
.tags-floor { border-top: 1px solid var(--border); padding-top: 8px; display: flex; flex-direction: column; gap: 6px; }
.tags-table td { vertical-align: top; }
.tag-state { margin-top: 2px; }
.tag-swap { display: block; margin-top: 4px; font-size: 12px; padding: 2px 8px; }
.print-tags { display: none; }
@media print {
  .print-only.print-tags { display: block !important; font: 11pt sans-serif; color: #000; }
  .print-tags table { width: 100%; border-collapse: collapse; margin-bottom: 6mm; }
  .print-tags th, .print-tags td { border: 0.3mm solid #999; padding: 1.5mm 2mm; text-align: left; }
  .print-tags tr { break-inside: avoid; }
}
/* Метки этажа: координаты для мобильного приложения ADM34 (решение 79) */
.iv-tags-btn { display: inline-flex; align-items: center; gap: 4px; border: 1px solid var(--border); background: var(--surface); color: var(--text); border-radius: 4px; padding: 2px 8px; }
.iv-tags-btn .ico { background: var(--accent); }
.iv-tags { position: absolute; left: 56px; top: 12px; z-index: 1002; width: min(320px, calc(100% - 68px)); max-height: calc(100% - 90px); overflow: auto;
  display: flex; flex-direction: column; gap: 10px; background: var(--surface); color: var(--text); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 10px 12px; box-shadow: 0 1px 6px rgba(0, 0, 0, 0.25); }
.shell.mobile .iv-tags { max-height: calc(100% - var(--sheet-h, 0px) - 80px); }
.iv-tag { display: flex; flex-direction: column; gap: 4px; }
.tag-coords { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 4px; }
.tag-coord { display: inline-flex; align-items: center; gap: 6px; border: 1px solid var(--border); background: var(--surface); color: var(--text);
  border-radius: 4px; padding: 4px 8px; min-height: 32px; cursor: pointer; }
.tag-coord:hover { border-color: var(--accent); }
.tag-coord .ico { background: var(--accent); }
.offscreen { position: fixed; left: -9999px; top: 0; opacity: 0; }
/* Телефон: план — под выдвижной панелью (1040), над кнопками карты (1030) */
.shell.mobile .indoor-view { z-index: 1035; }
/* Почта: подтверждена / не подтверждена (4з) */
.email-state { display: inline-flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.link-btn { background: none; border: 0; padding: 0; color: var(--accent); cursor: pointer; text-decoration: underline; font: inherit; }
/* Место по сотам (этап 4, LBS): квадратный значок с пунктиром, круг точности */
.marker.lbs { border-radius: 3px; border-style: dashed; }
.lbs-circle { stroke: var(--warn); fill: var(--warn); }
.trk-lbs { width: 16px; height: 16px; border-radius: 3px; border: 1px dashed var(--warn); background: var(--lbs-bg); color: var(--warn);
  display: grid; place-items: center; font-size: 12px; font-weight: 700; line-height: 1; }
/* Админка → «Соты» (этап 4, LBS) */
.cells-tiles { display: flex; flex-wrap: wrap; gap: 10px; margin: 8px 0; }
.cells-tile { display: grid; gap: 2px; padding: 8px 12px; border: 1px solid var(--border); border-radius: var(--radius); min-width: 110px; }
.cells-tile strong { font-size: 20px; }
.cells-settings-row { flex-wrap: wrap; align-items: flex-end; }
.cells-settings-row label { flex: 1 1 200px; }
.cells-map { height: 420px; border-radius: var(--radius); border: 1px solid var(--border); }
.lbs-circle.manual { stroke: var(--nav-out); fill: var(--nav-out); }
/* «Отчёты» (этап 4) */
.report-form { display: flex; flex-wrap: wrap; gap: 12px; align-items: flex-end; }
.report-form > label { display: grid; gap: 4px; min-width: 220px; }
.report-period .row { gap: 8px; }
.report-period label { display: grid; gap: 4px; }
.report-actions { gap: 8px; }
table.report td.num, table.report th.num { text-align: right; white-space: nowrap; }
table.report tr.totals td { border-top: 2px solid var(--border); }
table.report td.bold { font-weight: 600; }
.report-section h4 { margin: 12px 0 6px; }
/* Отчёт по тревогам (шаг 5): строки тревог — цветом, не подтверждённые — ярче; строка с флажком — щелчком */
table.report tr.ev-alarm td { background: color-mix(in srgb, var(--danger) 8%, transparent); }
table.report tr.ev-alarm-open td { background: color-mix(in srgb, var(--danger) 18%, transparent); }
table.report tr.ev-alarm td:nth-child(2), table.report tr.ev-alarm-open td:nth-child(2) { box-shadow: inset 3px 0 0 var(--danger); }
table.report tr.clickable { cursor: pointer; }
/* Диаграмма Ганта под итогами отчётов (владелец, 27.11.2026): слева название, время, доля; справа — посещения на шкале */
.report-gantt { margin: 14px 0 6px; overflow-x: auto; }
table.gantt { width: 100%; border-collapse: collapse; }
table.gantt td { padding: 2px 8px; border: 0; white-space: nowrap; }
table.gantt td.num { text-align: right; font-variant-numeric: tabular-nums; }
table.gantt td.gantt-name { max-width: 260px; overflow: hidden; text-overflow: ellipsis; }
table.gantt td.gantt-cell { width: 100%; min-width: 320px; padding: 2px 0 2px 8px; }
.gantt-track { display: block; width: 100%; height: 20px; background: var(--surface-2); border-radius: 4px; }
.gantt-track .gantt-grid { stroke: var(--border); stroke-width: 1; }
.gantt-track .gantt-bar:hover { opacity: 0.75; }
/* Тревоги (шаг 5): полоска — ожидание подтверждения; не подтверждённая — ярче; уведомления — отметкой */
.gantt-track .gantt-bar.gb-alarm { fill: color-mix(in srgb, var(--danger) 65%, transparent); } .gantt-swatch.gb-alarm { background: var(--danger); }
.gantt-track .gantt-bar.gb-open { fill: var(--danger); }
.gantt-track .gantt-bar.gb-notice { fill: var(--gc-1); } .gantt-swatch.gb-notice { background: var(--gc-1); }
.gantt-swatch { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: 6px; vertical-align: baseline; }
.gantt-track .gantt-bar.gc1 { fill: var(--gc-1); } .gantt-swatch.gc1 { background: var(--gc-1); }
.gantt-track .gantt-bar.gc2 { fill: var(--gc-2); } .gantt-swatch.gc2 { background: var(--gc-2); }
.gantt-track .gantt-bar.gc3 { fill: var(--gc-3); } .gantt-swatch.gc3 { background: var(--gc-3); }
.gantt-track .gantt-bar.gc4 { fill: var(--gc-4); } .gantt-swatch.gc4 { background: var(--gc-4); }
.gantt-track .gantt-bar.gc5 { fill: var(--gc-5); } .gantt-swatch.gc5 { background: var(--gc-5); }
.gantt-track .gantt-bar.gc6 { fill: var(--gc-6); } .gantt-swatch.gc6 { background: var(--gc-6); }
.gantt-track .gantt-bar.gc7 { fill: var(--gc-7); } .gantt-swatch.gc7 { background: var(--gc-7); }
.gantt-track .gantt-bar.gc8 { fill: var(--gc-8); } .gantt-swatch.gc8 { background: var(--gc-8); }
.gantt-axis { display: grid; font-size: 12px; color: var(--muted); }
.gantt-axis.gantt-p2 { grid-template-columns: repeat(2, 1fr); }
.gantt-axis.gantt-p3 { grid-template-columns: repeat(3, 1fr); }
.gantt-axis.gantt-p4 { grid-template-columns: repeat(4, 1fr); }
.gantt-axis.gantt-p5 { grid-template-columns: repeat(5, 1fr); }
.gantt-axis.gantt-p6 { grid-template-columns: repeat(6, 1fr); }
.gantt-axis.gantt-p7 { grid-template-columns: repeat(7, 1fr); }
.gantt-axis span { border-left: 1px solid var(--border); padding-left: 3px; white-space: nowrap; overflow: hidden; }
/* Таблицы отчётов широкие — страница шире обычной; название объекта — без переноса */
.reports-page section { max-width: 1600px; }
table.report td:first-child { white-space: nowrap; }
.report-options { display: flex; gap: 12px; flex-wrap: wrap; }
.report-options label { display: grid; gap: 4px; }
.report-options input { width: 90px; }
.report-options .row { gap: 6px; align-items: center; }
.report-options label.check { display: flex; align-items: center; align-self: flex-end; gap: 6px; }
/* Карта над отчётом «Поездки и стоянки» */
.report-map { height: 420px; border-radius: var(--radius); border: 1px solid var(--border); margin: 12px 0; }
/* «Поездки и стоянки»: флажок слева — показать поездку, стоянку или остановку на карте (владелец, 25.11.2026) */
table.report th.pick, table.report td.pick { width: 28px; padding-right: 0; text-align: center; }
table.report td.pick input { margin: 0; cursor: pointer; }
table.report tr.picked td { background: rgb(227 98 9 / 0.08); }

/* Событие — ссылкой на точку на карте (владелец, 25.11.2026): название в окне «Уведомления» и во всплывающих окнах */
.ev-link { color: inherit; text-decoration: underline dotted; text-underline-offset: 3px; cursor: pointer; }
.ev-link:hover, .ev-link:focus-visible { text-decoration-style: solid; }
.alarm .title .ev-link:hover { color: var(--accent); }
/* Отметка места события: тревога — красная, уведомление — синее; щелчок снимает */
.ev-point { stroke: #fff; fill: var(--danger); }
.ev-point.notice { fill: var(--accent); }
.leaflet-tooltip.ev-tooltip { padding: 4px 8px; line-height: 1.3; }
.leaflet-tooltip.ev-tooltip .muted { color: #57606a; }
/* Отчёт «Поездки и стоянки»: остановка — кружок */
.trk-stop { background: #9a6700; border: 2px solid #fff; border-radius: 50%; box-shadow: 0 0 2px rgba(0, 0, 0, 0.6); }
/* Отмеченная стоянка или остановка — оранжевая, того же размера (без свечения: крупный значок вводил в заблуждение) */
.trk-parking.picked, .trk-stop.picked { background: #e36209; }
/* Место события приблизительное (последняя точная точка или сота) — пунктирная обводка */
.ev-point.approx { stroke-dasharray: 4 3; fill-opacity: 0.6; }
/* «Посещения помещений»: план этажа с тепловой картой над отчётом (шаг 3а) — полоса этажей и легенда сверху */
.report-plan { display: flex; flex-direction: column; overflow: hidden; background: var(--surface); }
.report-plan .rp-bar { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 10px; padding: 6px 10px; border-bottom: 1px solid var(--border); }
.report-plan .rp-floors { display: flex; flex-wrap: wrap; gap: 4px; }
.report-plan .rp-map { flex: 1 1 auto; min-height: 0; background: #fff; }

/* Свои датчики 2.0 (шаг 6.2): список, окно датчика вкладками, предпросмотр, график пересчёта */
dialog.sensors-dialog { width: min(1000px, calc(100vw - 24px)); }
dialog.sensor-editor { width: min(760px, calc(100vw - 24px)); }
table.sensors-table { width: 100%; border-collapse: collapse; }
table.sensors-table th, table.sensors-table td { padding: 6px 8px; border-bottom: 1px solid var(--border); text-align: left; vertical-align: middle; }
table.sensors-table td.num { text-align: right; font-variant-numeric: tabular-nums; }
table.sensors-table tr.clickable-row { cursor: pointer; }
table.sensors-table tr.clickable-row:hover td { background: var(--hover, rgba(127,127,127,.08)); }
.sensor-swatch { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: 6px; vertical-align: baseline; border: 1px solid var(--border); }
.sensor-panes { margin-top: 10px; min-height: 300px; }
.sensor-pane .form { display: grid; gap: 10px; }
.sensor-form .row > label.grow { flex: 1; }
.iv-rows, .calib-rows { display: grid; gap: 6px; margin-bottom: 6px; }
.iv-row, .calib-row { display: flex; gap: 8px; align-items: center; }
.iv-row input[type=number], .calib-row input { width: 120px; }
.iv-row input[type=color] { width: 44px; height: 32px; padding: 2px; }
.iv-row input:not([type]) { flex: 1; }
.calib-graph { width: 100%; max-width: 420px; height: auto; display: block; margin-top: 6px; }
.calib-graph .cg-axis { stroke: var(--border); stroke-width: 1; }
.calib-graph .cg-line { fill: none; stroke: var(--accent); stroke-width: 2; stroke-linejoin: round; }
.calib-graph .cg-point { fill: var(--surface); stroke: var(--accent); stroke-width: 2; }
.calib-graph .cg-now { fill: var(--warn); stroke: var(--surface); stroke-width: 2; }
.calib-graph .cg-now-line { stroke: var(--warn); stroke-width: 1; stroke-dasharray: 3 3; }
.calib-graph .cg-label { fill: var(--muted); font-size: 10px; }
.sensor-preview { margin-top: 12px; padding: 10px 12px; border-radius: 8px; background: var(--surface-2); display: grid; gap: 6px; }
.sensor-now { font-size: 15px; }

/* ——— Мониторинг сервера (админка; public/app/server-monitor.js) ——— */
.mon-filters { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; margin: 4px 0 12px; }
.mon-filters .sub-tabs { margin: 0; }
.mon-server { display: flex; align-items: center; gap: 8px; }
.mon-server select { width: auto; }
.mon-h { margin: 18px 0 8px; font-size: 15px; }
.mon-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 10px; }
.mon-tile { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 12px 14px; display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.mon-tile-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.mon-label { color: var(--muted); font-size: 13px; }
.mon-value { font-size: 26px; font-weight: 600; line-height: 1.15; overflow-wrap: anywhere; }
.mon-of { font-size: 15px; font-weight: 400; color: var(--muted); }
.mon-dir { color: var(--muted); font-weight: 400; }
.mon-net { display: flex; flex-wrap: wrap; gap: 0 14px; font-size: 22px; }
.mon-net > span { white-space: nowrap; }
.mon-sub { color: var(--muted); font-size: 12px; }
.mon-meter { height: 6px; border-radius: 3px; background: var(--surface-2); overflow: hidden; }
.mon-meter-fill { height: 100%; border-radius: 3px; }
.mon-meter-fill.st-good { background: var(--st-good); } .mon-meter-fill.st-warning { background: var(--st-warning); } .mon-meter-fill.st-critical { background: var(--st-critical); }
.mon-state { display: inline-flex; align-items: center; gap: 4px; font-size: 12px; color: var(--muted); white-space: nowrap; }
.mon-state-dot { width: 8px; height: 8px; border-radius: 50%; }
.mon-state.st-good .mon-state-dot { background: var(--st-good); } .mon-state.st-warning .mon-state-dot { background: var(--st-warning); } .mon-state.st-critical .mon-state-dot { background: var(--st-critical); }
.mon-state.st-critical { color: var(--text); font-weight: 600; }
.mon-spark { display: block; margin-top: auto; }
.mon-spark-line { fill: none; stroke: var(--offline); stroke-width: 1.5; stroke-linejoin: round; stroke-linecap: round; }
.mon-spark-dot { fill: var(--gc-1); }
.mon-charts { display: grid; grid-template-columns: repeat(auto-fit, minmax(420px, 1fr)); gap: 10px; margin-top: 10px; }
.mon-chart { margin: 0; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 12px 14px; min-width: 0; }
.mon-chart-head { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 10px; margin-bottom: 4px; }
.mon-chart-title { font-weight: 600; }
.mon-legend { display: flex; flex-wrap: wrap; gap: 4px 14px; font-size: 12px; color: var(--muted); margin: 2px 0 4px; }
.mon-legend-item { display: inline-flex; align-items: center; gap: 6px; }
.mon-key { display: inline-block; width: 14px; height: 2px; border-radius: 1px; background: currentColor; }
.mon-key.s1, .mon-line.s1, .mon-dot.s1 { color: var(--gc-1); } .mon-key.s2, .mon-line.s2, .mon-dot.s2 { color: var(--gc-2); }
.mon-key.s3, .mon-line.s3, .mon-dot.s3 { color: var(--gc-3); } .mon-key.s4, .mon-line.s4, .mon-dot.s4 { color: var(--gc-4); }
.mon-plot { position: relative; }
.mon-svg { display: block; max-width: 100%; }
.mon-svg .mon-gridline { stroke: var(--border); stroke-width: 1; opacity: 0.6; }
.mon-svg .mon-axis { stroke: var(--border); stroke-width: 1; }
.mon-tick { fill: var(--muted); font-size: 11px; font-variant-numeric: tabular-nums; }
.mon-end { fill: var(--text); font-size: 11px; }
.mon-line { fill: none; stroke: currentColor; stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; }
.mon-dot { fill: currentColor; stroke: var(--surface); stroke-width: 2; }
.mon-cross { stroke: var(--muted); stroke-width: 1; }
.mon-hit { fill: transparent; cursor: crosshair; outline: none; }
.mon-hit:focus-visible { stroke: var(--accent); stroke-width: 1; }
.mon-tip { position: absolute; top: 4px; pointer-events: none; background: var(--surface); border: 1px solid var(--border); border-radius: 8px; box-shadow: var(--shadow);
  padding: 6px 10px; font-size: 12px; white-space: nowrap; z-index: 2; }
.mon-tip-time { color: var(--muted); margin-bottom: 2px; }
.mon-tip-row { display: flex; align-items: center; gap: 6px; }
.mon-tip-row .mon-key { color: inherit; }
.mon-tip-row .mon-key.s1 { color: var(--gc-1); } .mon-tip-row .mon-key.s2 { color: var(--gc-2); } .mon-tip-row .mon-key.s3 { color: var(--gc-3); } .mon-tip-row .mon-key.s4 { color: var(--gc-4); }
.mon-table { margin-top: 6px; }
.mon-table .table-scroll { max-height: 260px; overflow: auto; }
.mon-table td.num, .mon-table th.num { text-align: right; font-variant-numeric: tabular-nums; }
.mon-empty { color: var(--muted); font-size: 13px; padding: 24px 0; }
.mon-errors { width: 100%; border-collapse: collapse; font-size: 13px; }
.mon-errors th, .mon-errors td { padding: 4px 8px; border-bottom: 1px solid var(--border); text-align: left; vertical-align: top; }
.mon-errors .num { text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums; }
.mon-acc[data-level="2"] { padding-left: 16px; } .mon-acc[data-level="3"] { padding-left: 32px; } .mon-acc[data-level="4"] { padding-left: 48px; }
.mon-acc[data-level="1"] { font-weight: 600; }
.mon-acc-table th, .mon-acc-table th.num { white-space: normal; vertical-align: bottom; } .mon-acc-table td:first-child { white-space: nowrap; }
.mon-err-msg { max-width: 560px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
/* Оповещения мониторинга (4ф): плитка с превышением — рамкой цвета состояния и текстом оповещения */
.mon-tile.mon-tile-alert.st-critical { border-color: var(--st-critical); box-shadow: inset 0 0 0 1px var(--st-critical); }
.mon-tile.mon-tile-alert.st-warning { border-color: var(--st-warning); box-shadow: inset 0 0 0 1px var(--st-warning); }
.mon-alert-text { font-size: 13px; color: var(--text); }
.mon-alerts { margin: 8px 0 4px; padding: 8px 12px; border: 1px solid var(--border); border-radius: 8px; background: var(--surface); }
.mon-alert-list { margin: 0; padding: 0; list-style: none; display: flex; flex-direction: column; gap: 4px; }
.mon-alert { margin: 8px 0; padding: 8px 12px; border: 1px solid var(--border); border-radius: 8px; background: var(--surface); }
.mon-loading { opacity: 0.6; transition: opacity 0.2s; }
@media (max-width: 520px) { .mon-charts { grid-template-columns: 1fr; } }

/* ——— Графики в отчётах (этап 4, шаг 7): панели датчиков на общей оси времени, Гант состояний ——— */
.report-charts { display: grid; gap: 12px; margin: 10px 0; }
.ch-object { margin: 0; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 10px 12px; min-width: 0; }
.ch-head { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 14px; margin-bottom: 6px; }
.ch-title { font-weight: 600; }
.ch-tools { gap: 6px; align-items: center; flex-wrap: wrap; }
.ch-tools button { padding: 4px 10px; }
.ch-picks { display: flex; flex-wrap: wrap; gap: 2px 14px; font-size: 13px; margin-bottom: 6px; }
.ch-pick { display: inline-flex; align-items: center; gap: 6px; }
.ch-swatch { display: inline-block; width: 10px; height: 10px; border-radius: 2px; background: var(--muted); }
.ch-plot { position: relative; }
.ch-body { min-width: 0; }
.ch-panel + .ch-panel { margin-top: 2px; }
.ch-panel-head { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 8px; font-size: 13px; padding-left: 64px; min-height: 20px; }
.ch-name { font-weight: 600; }
.ch-value { margin-left: auto; font-variant-numeric: tabular-nums; font-weight: 600; }
.ch-empty { padding: 10px 0 10px 64px; }
.ch-svg { display: block; overflow: visible; user-select: none; -webkit-user-select: none; }
.ch-hit { cursor: crosshair; touch-action: pan-y; }
/* Подложка «сетка» (владелец, 30.11.2026): фон поля, основные линии по делениям, тонкие промежуточные; печать — тоже */
.ch-grid-bg { fill: color-mix(in srgb, var(--surface-2) 60%, var(--surface)); }
.ch-grid-minor { stroke: var(--border); stroke-width: 0.5; opacity: 0.55; }
.ch-grid-major { stroke: var(--border); stroke-width: 1; }
.ch-grid-frame { fill: none; stroke: var(--border); stroke-width: 1; }
.ch-scale { opacity: 0.9; }
.ch-key-iv { height: 4px; }
.ch-value { display: inline-flex; align-items: center; gap: 2px; }
.ch-line { stroke-width: 1.75; }
.ch-bar { opacity: 0.9; }
.ch-sel { fill: var(--accent); opacity: 0.14; pointer-events: none; }
.ch-states { display: flex; flex-wrap: wrap; gap: 2px 12px; margin-left: auto; }
.ch-state { display: inline-flex; align-items: center; gap: 5px; }
.ch-time { position: absolute; bottom: 2px; pointer-events: none; background: var(--surface); border: 1px solid var(--border); border-radius: 6px; padding: 1px 6px;
  font-size: 12px; font-variant-numeric: tabular-nums; box-shadow: var(--shadow); white-space: nowrap; }
.ch-axis { margin-top: 0; }

/* ——— Печать отчёта в PDF (шаг 8; public/print.html): без кнопок и флажков, строки таблиц не разрываются ——— */
.print-mode { background: #fff; margin: 0; }
/* Высота — по содержимому: html, body { height: 100% } при окне печати выше листа давали пустую последнюю страницу */
html:has(body.print-mode), body.print-mode { height: auto; min-height: 0; }
/* Таблицы плотнее: даты и числа в строку, место — текстовым колонкам (меньше переносов и страниц) */
.print-mode table.report { font-size: 11.5px; line-height: 1.3; width: 100%; }
.print-mode table.report th, .print-mode table.report td { padding: 3px 6px; }
.print-mode table.report th { white-space: normal; }
.print-mode .report-section h4 { margin: 8px 0 4px; }
/* Примечание — не отдельной страницей */
.print-mode .report-note { break-before: avoid; margin-top: 6px; }
.print-report { padding: 0 2px; }
.print-mode .ch-tools, .print-mode .pick, .print-mode .ch-pick input, .print-mode .ch-pick:has(input:not(:checked)),
.print-mode .leaflet-control-zoom, .print-mode .trk-quick, .print-mode .ch-time { display: none !important; }
.print-mode .table-scroll { overflow: visible; max-height: none; }
.print-mode tr, .print-mode .ch-panel, .print-mode .report-map, .print-mode .report-plan, .print-mode .report-gantt { break-inside: avoid; }
/* Блок графиков и разделы — разрываются между панелями и строками (иначе высокий блок уезжает на следующий лист,
   оставляя пустую страницу); подпись — не отрывается от того, что подписывает */
.print-mode .ch-panel-head { break-after: avoid; }
.print-mode .report-objects { font-size: 15px; font-weight: 600; margin: 2px 0; }
.print-mode .ch-object, .print-mode .report-section { break-inside: auto; }
.print-mode h3, .print-mode h4 { break-after: avoid; }

.report-objects { font-weight: 600; margin: 2px 0; }

/* ——— Рассылки отчётов (шаг 9) ——— */
dialog.mailings { width: min(1100px, 96vw); }
dialog.mailings td { vertical-align: top; }
dialog.mailings tr.muted td { opacity: 0.7; }
.mail-days { gap: 4px 12px; }

/* Сервер staging (ROADMAP 2.16): метка поверх интерфейса, не сдвигает разметку и не мешает нажатиям */
html[data-stage="staging"] body::after {
  content: "STAGING"; position: fixed; bottom: 0; left: 0; z-index: 100000; pointer-events: none;
  padding: 2px 14px; border-radius: 0 6px 0 0; background: #d97706; color: #fff; font: 700 11px/1.4 system-ui, sans-serif; letter-spacing: .12em;
}
