/* 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; --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;
  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; --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);
    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; --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);
    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; }
.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-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"); }
.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-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M12 3l2 4 4-2-2 4 4 2-4 2 2 4-4-2-2 4-2-4-4 2 2-4-4-2 4-2-2-4 4 2z'/%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"); }
.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: 500; 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-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: 18px; height: 18px; vertical-align: -4px; background: var(--muted);
  -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-linecap='round' stroke-linejoin='round'%3E%3Crect x='9' y='9' width='6' height='6' transform='rotate(45 12 12)'/%3E%3Cpath d='M4 10l3-3 3 3-3 3zM14 20l3-3 3 3-3 3zM14 4l3-3M20 10l3-3M3 17a4 4 0 0 0 4 4'/%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-linecap='round' stroke-linejoin='round'%3E%3Crect x='9' y='9' width='6' height='6' transform='rotate(45 12 12)'/%3E%3Cpath d='M4 10l3-3 3 3-3 3zM14 20l3-3 3 3-3 3zM14 4l3-3M20 10l3-3M3 17a4 4 0 0 0 4 4'/%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::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; }
@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.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: 600; 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 {
  body > *: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.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); }
.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; }
