/* Softline · Мониторинг событий — мир «щит диспетчера» (ISA-101).
   Нормальное состояние серое и тихое; цвет — только отклонение, выбор и действие. */
:root {
  --ground: #1d2024;
  --panel: #272b30;
  --panel-2: #2e3339;
  --inset: #202328;
  --line: #3a4047;
  --line-2: #4a5159;
  --text: #dde1e5;
  --text-2: #aab1b8;
  --text-3: #858d95;
  --select: #5d8fd6;
  --select-2: #3e5f8f;
  --select-bg: rgba(93, 143, 214, .14);
  --p1: #e0443f;
  --p2: #d9a13a;
  --p3: #cdbf4c;
  --p4: #5fb0c6;
  --p1-bg: rgba(224, 68, 63, .16);
  --p2-bg: rgba(217, 161, 58, .15);
  --p3-bg: rgba(205, 191, 76, .13);
  --p4-bg: rgba(95, 176, 198, .13);
  --chart-other: #7a848e;
  --ok: #8fb99a;
  --radius: 4px;
  --font: "Segoe UI Variable Text", "Segoe UI", system-ui, -apple-system, "Helvetica Neue", Arial, sans-serif;
  --mono: "Cascadia Mono", Consolas, "Liberation Mono", monospace;
  --shadow: 0 8px 24px rgba(0, 0, 0, .35), 0 1px 2px rgba(0, 0, 0, .3);
  --ease: cubic-bezier(.16, 1, .3, 1);
  color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0; background: var(--ground); color: var(--text);
  font: 14px/1.45 var(--font); font-variant-numeric: tabular-nums;
  -webkit-font-smoothing: antialiased;
}
::selection { background: var(--select-2); color: #fff; }
* { scrollbar-color: var(--line-2) transparent; scrollbar-width: thin; }
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-thumb { background: var(--line-2); border-radius: 10px; border: 2px solid var(--ground); }
a { color: var(--select); text-underline-offset: 3px; }
button, input, select, textarea { font: inherit; color: inherit; }
:focus-visible { outline: 2px solid var(--select); outline-offset: 2px; }
[hidden] { display: none !important; }
.mono { font-family: var(--mono); }
.muted { color: var(--text-2); }
.faint { color: var(--text-3); }
h1, h2, h3 { margin: 0; font-weight: 600; letter-spacing: -.005em; }
h1 { font-size: 20px; }
h2 { font-size: 16px; }
h3 { font-size: 14px; }
.icon { width: 18px; height: 18px; flex: none; stroke: currentColor; fill: none; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }
.icon.sm { width: 15px; height: 15px; }

/* ---------------------------------------------------------------- controls */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px; height: 32px; padding: 0 12px;
  border: 1px solid var(--line-2); border-radius: var(--radius); background: var(--panel-2); color: var(--text);
  cursor: pointer; white-space: nowrap; transition: background .15s, border-color .15s, color .15s;
}
.btn:hover { background: #363c43; border-color: #58606a; }
.btn:active { background: #2b3036; }
.btn:disabled { opacity: .45; cursor: not-allowed; }
.btn.primary { background: var(--select); border-color: var(--select); color: #fff; font-weight: 600; }
.btn.primary:hover { background: #6d9ce0; border-color: #6d9ce0; }
.btn.danger { border-color: rgba(224, 68, 63, .6); color: #f2a19e; background: transparent; }
.btn.danger:hover { background: var(--p1-bg); }
.btn.ghost { background: transparent; border-color: transparent; color: var(--text-2); }
.btn.ghost:hover { background: var(--panel-2); color: var(--text); }
.btn.sm { height: 26px; padding: 0 9px; font-size: 13px; }
.btn.icon-only { width: 32px; padding: 0; }
.btn.sm.icon-only { width: 26px; }
.btn[aria-busy="true"] { color: transparent; position: relative; }
.btn[aria-busy="true"]::after {
  content: ""; position: absolute; width: 14px; height: 14px; border-radius: 50%;
  border: 2px solid rgba(255, 255, 255, .35); border-top-color: #fff; animation: spin .7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

.field { display: grid; gap: 5px; }
.field > span { font-size: 12.5px; color: var(--text-2); }
.field .hint { font-size: 12px; color: var(--text-3); }
.input, .select, .textarea {
  height: 32px; padding: 0 10px; width: 100%; background: var(--inset); color: var(--text);
  border: 1px solid var(--line); border-radius: var(--radius); transition: border-color .15s, background .15s;
}
.textarea { height: auto; min-height: 72px; padding: 8px 10px; resize: vertical; }
.input::placeholder, .textarea::placeholder { color: var(--text-3); }
.input:hover, .select:hover, .textarea:hover { border-color: var(--line-2); }
.input:focus, .select:focus, .textarea:focus { outline: none; border-color: var(--select); background: #1b1e22; }
.input[aria-invalid="true"] { border-color: var(--p1); }
.select { appearance: none; padding-right: 28px; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' fill='none' stroke='%23aab1b8' stroke-width='1.6'%3E%3Cpath d='m2.5 4.5 3.5 3.5 3.5-3.5'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 9px center; }
.checkbox { display: inline-flex; gap: 8px; align-items: center; cursor: pointer; }
.checkbox input { accent-color: var(--select); width: 15px; height: 15px; }

.switch { position: relative; display: inline-flex; align-items: center; gap: 10px; cursor: pointer; }
.switch input { position: absolute; opacity: 0; }
.switch i { width: 34px; height: 20px; border-radius: 20px; background: var(--line-2); position: relative; transition: background .2s; flex: none; }
.switch i::after { content: ""; position: absolute; top: 3px; left: 3px; width: 14px; height: 14px; border-radius: 50%; background: #cfd4d9; transition: transform .2s var(--ease); }
.switch input:checked + i { background: var(--select); }
.switch input:checked + i::after { transform: translateX(14px); background: #fff; }
.switch input:focus-visible + i { outline: 2px solid var(--select); outline-offset: 2px; }
.switch input:disabled + i { opacity: .45; }

.seg { display: inline-flex; border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
.seg button { border: 0; background: transparent; color: var(--text-2); height: 30px; padding: 0 11px; cursor: pointer; }
.seg button + button { border-left: 1px solid var(--line); }
.seg button:hover { color: var(--text); background: var(--panel-2); }
.seg button[aria-pressed="true"] { background: var(--select-bg); color: var(--text); box-shadow: inset 0 -2px 0 var(--select); }

/* ---------------------------------------------------------------- priority & status */
.prio {
  display: inline-grid; place-items: center; width: 22px; height: 22px; border-radius: 3px; flex: none;
  font: 700 12px/1 var(--font); color: #111;
}
.prio.p1 { background: var(--p1); }
.prio.p2 { background: var(--p2); clip-path: polygon(50% 0, 100% 100%, 0 100%); padding-top: 6px; }
.prio.p3 { background: var(--p3); clip-path: polygon(50% 0, 100% 50%, 50% 100%, 0 50%); }
.prio.p4 { background: var(--p4); border-radius: 50%; }
.prio.off { background: var(--line-2); color: var(--text-2); }

@keyframes flash { 50% { opacity: .28; } }


.status { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; white-space: nowrap; }
.status::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: var(--text-3); flex: none; }
.status.new::before { background: transparent; border: 2px solid currentColor; }
.status.new { color: #f0f2f4; font-weight: 600; }
.status.acknowledged::before { background: var(--select); }
.status.escalated::before { background: var(--p2); border-radius: 1px; transform: rotate(45deg); }
.status.closed { color: var(--text-2); }
.status.false_alarm { color: var(--text-3); text-decoration: line-through; text-decoration-color: var(--text-3); }
.status.false_alarm::before { background: transparent; border: 1px dashed var(--text-3); }

.tag { display: inline-flex; align-items: center; height: 22px; padding: 0 8px; border-radius: 3px; background: var(--panel-2); border: 1px solid var(--line); color: var(--text-2); font-size: 12px; white-space: nowrap; }
.tag.demo { border-color: rgba(217, 161, 58, .45); color: #e6c282; background: rgba(217, 161, 58, .08); }

/* ---------------------------------------------------------------- shell */
.app { display: grid; grid-template-columns: 216px 1fr; grid-template-rows: 52px 1fr; height: 100vh; }
.app.rail-collapsed { grid-template-columns: 60px 1fr; }
.rail { grid-row: 1 / 3; background: var(--panel); border-right: 1px solid var(--line); display: flex; flex-direction: column; min-height: 0; }
.brand { height: 52px; display: flex; align-items: center; gap: 10px; padding: 0 16px; border-bottom: 1px solid var(--line); }
.wordmark { font-weight: 700; font-size: 16px; letter-spacing: .01em; color: #f4f6f8; }
.wordmark b { color: var(--select); font-weight: 700; }
.brand small { color: var(--text-3); font-size: 11.5px; line-height: 1.15; }
.nav { padding: 10px 8px; display: grid; gap: 2px; }
.nav a {
  display: flex; align-items: center; gap: 12px; height: 38px; padding: 0 10px; border-radius: var(--radius);
  color: var(--text-2); text-decoration: none; position: relative;
}
.nav a:hover { background: var(--panel-2); color: var(--text); }
.nav a[aria-current="page"] { background: var(--select-bg); color: #fff; }
.nav a[aria-current="page"]::after { content: ""; position: absolute; left: -8px; top: 9px; bottom: 9px; width: 2px; background: var(--select); border-radius: 2px; }
.nav .count { margin-left: auto; min-width: 20px; height: 18px; padding: 0 5px; border-radius: 9px; background: var(--p1); color: #fff; font-size: 11.5px; font-weight: 700; display: grid; place-items: center; }
.rail-foot { margin-top: auto; padding: 10px 8px; border-top: 1px solid var(--line); display: grid; gap: 6px; }
.app.rail-collapsed .nav span, .app.rail-collapsed .brand small, .app.rail-collapsed .wordmark, .app.rail-collapsed .rail-foot .label, .app.rail-collapsed .nav .count { display: none; }
.app.rail-collapsed .brand { justify-content: center; padding: 0; }

.topbar { display: flex; align-items: center; gap: 16px; padding: 0 16px; border-bottom: 1px solid var(--line); background: var(--panel); min-width: 0; }
.topbar h1 { font-size: 16px; white-space: nowrap; }
.crumbs { display: flex; gap: 8px; align-items: center; color: var(--text-3); font-size: 13px; white-space: nowrap; }
.crumbs a { color: var(--text-2); text-decoration: none; }
.crumbs a:hover { color: var(--text); }

.help-btn { height: 34px; padding: 0 11px; white-space: nowrap; text-decoration: none; }

.alarm-banner { display: flex; align-items: stretch; height: 34px; border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; margin-left: auto; }
.alarm-banner button { display: flex; align-items: center; gap: 8px; padding: 0 11px; border: 0; background: transparent; cursor: pointer; color: var(--text-2); }
.alarm-banner button + button { border-left: 1px solid var(--line); }
.alarm-banner button:hover { background: var(--panel-2); color: var(--text); }
.alarm-banner b { font-size: 15px; color: var(--text); min-width: 1ch; }
.alarm-banner .zero { opacity: .55; }
.alarm-banner .zero .prio { background: var(--line-2); }
.shift { display: grid; line-height: 1.15; text-align: right; }
.shift b { font-size: 14px; font-weight: 600; }
.shift span { font-size: 11.5px; color: var(--text-3); }
.user-btn { display: flex; align-items: center; gap: 10px; border: 0; background: transparent; cursor: pointer; padding: 4px 6px; border-radius: var(--radius); }
.user-btn:hover { background: var(--panel-2); }
.avatar { width: 30px; height: 30px; border-radius: 50%; background: #3b4250; display: grid; place-items: center; font-size: 12px; font-weight: 700; color: #cdd6e3; }
.user-btn .who { display: grid; text-align: left; line-height: 1.15; }
.user-btn .who small { color: var(--text-3); font-size: 11.5px; }
.menu { position: fixed; min-width: 220px; background: var(--panel-2); border: 1px solid var(--line-2); border-radius: 6px; box-shadow: var(--shadow); padding: 6px; z-index: 50; }
.menu button, .menu a { display: flex; width: 100%; align-items: center; gap: 10px; height: 34px; padding: 0 10px; border: 0; background: transparent; color: var(--text); border-radius: 4px; cursor: pointer; text-decoration: none; }
.menu button:hover, .menu a:hover { background: var(--select-bg); }
.menu hr { border: 0; border-top: 1px solid var(--line); margin: 6px 0; }
.menu .meta { padding: 6px 10px 8px; color: var(--text-3); font-size: 12px; }

.main { min-width: 0; min-height: 0; overflow: auto; position: relative; }
.page { padding: 18px 20px 28px; }
.page-head { display: flex; align-items: center; gap: 12px; margin-bottom: 14px; flex-wrap: wrap; }
.page-head .actions { margin-left: auto; display: flex; gap: 8px; flex-wrap: wrap; }

.panel { background: var(--panel); border: 1px solid var(--line); border-radius: 6px; min-width: 0; }
.panel-head { display: flex; align-items: center; gap: 10px; padding: 11px 14px; border-bottom: 1px solid var(--line); min-height: 46px; }
.panel-head h2 { font-size: 14px; }
.panel-head .actions { margin-left: auto; display: flex; gap: 6px; align-items: center; }
.panel-body { padding: 14px; }

.filters { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; padding: 10px 14px; border-bottom: 1px solid var(--line); }
.filters .input, .filters .select { width: auto; min-width: 140px; }
.filters .grow { flex: 1; min-width: 200px; }

.tabs { display: flex; gap: 2px; border-bottom: 1px solid var(--line); padding: 0 14px; overflow-x: auto; }
.tabs button { border: 0; background: transparent; color: var(--text-2); height: 42px; padding: 0 12px; cursor: pointer; position: relative; white-space: nowrap; }
.tabs button:hover { color: var(--text); }
.tabs button[aria-selected="true"] { color: #fff; }
.tabs button[aria-selected="true"]::after { content: ""; position: absolute; left: 8px; right: 8px; bottom: -1px; height: 2px; background: var(--select); }

/* ---------------------------------------------------------------- tables */
.table-wrap { overflow: auto; }
table.data { width: 100%; border-collapse: collapse; }
.data th { position: sticky; top: 0; background: var(--panel); z-index: 1; text-align: left; font-weight: 500; font-size: 12.5px; color: var(--text-3); padding: 9px 12px; border-bottom: 1px solid var(--line); white-space: nowrap; }
.data td { padding: 9px 12px; border-bottom: 1px solid #30353b; vertical-align: middle; }
.data tbody tr { transition: background .12s; }
.data tbody tr.clickable { cursor: pointer; }
.data tbody tr:hover { background: #2c3136; }
.data tbody tr[aria-selected="true"] { background: var(--select-bg); }
.data .num { text-align: right; }
.data .thumb { width: 64px; height: 40px; object-fit: cover; border-radius: 3px; background: #000; display: block; }
.cell-main { font-weight: 500; }
.cell-sub { font-size: 12.5px; color: var(--text-3); }
.pager { display: flex; align-items: center; gap: 10px; padding: 10px 14px; border-top: 1px solid var(--line); color: var(--text-2); font-size: 13px; }
.pager .actions { margin-left: auto; display: flex; gap: 6px; }

.empty { padding: 36px 20px; text-align: center; color: var(--text-2); display: grid; gap: 8px; justify-items: center; }
.empty .icon { width: 28px; height: 28px; color: var(--text-3); }
.empty b { color: var(--text); font-weight: 600; }
.skeleton { background: linear-gradient(90deg, #2b3035 0%, #33393f 50%, #2b3035 100%); background-size: 200% 100%; animation: shimmer 1.4s infinite; border-radius: 3px; }
@keyframes shimmer { to { background-position: -200% 0; } }

/* ---------------------------------------------------------------- console */
.console { display: grid; grid-template-columns: 300px minmax(0, 1fr) 372px; height: calc(100vh - 52px); }
.console > * { min-height: 0; }
.site-col { border-right: 1px solid var(--line); background: var(--panel); display: flex; flex-direction: column; }
.site-col .tabs { padding: 0 8px; }
.plan-box { padding: 10px; border-bottom: 1px solid var(--line); flex: none; }
.plan { width: 100%; display: block; background: var(--inset); border: 1px solid var(--line); border-radius: 4px; }
.plan .sh-building { fill: #2c3137; stroke: #59616a; stroke-width: 2; }
.plan .sh-room { fill: none; stroke: #4a525a; stroke-width: 1.5; }
.plan .sh-area { fill: rgba(255, 255, 255, .02); stroke: #4a525a; stroke-width: 1.5; stroke-dasharray: 8 6; }
.plan .sh-fence { fill: none; stroke: #7c858e; stroke-width: 3; stroke-dasharray: 2 7; stroke-linecap: round; }
.plan .sh-road { fill: none; stroke: #3a4046; stroke-width: 16; stroke-linecap: round; stroke-linejoin: round; }
.plan .sh-label { fill: #9aa2aa; font: 500 21px var(--font); }
.plan .sh-gate { fill: #4a5159; }
.plan .cam { cursor: pointer; }
.plan .cam .fov { fill: rgba(170, 177, 184, .10); }
.plan .cam .node { fill: #8f979f; stroke: #1c1f23; stroke-width: 3; }
.plan .cam text { fill: #d5d9dc; font: 700 30px var(--font); paint-order: stroke; stroke: #202328; stroke-width: 5px; }
.plan .cam:hover .node, .plan .cam.focus .node { fill: #fff; }
.plan .cam.focus .fov { fill: rgba(93, 143, 214, .22); }
.plan .cam.alarm-1 .node { fill: var(--p1); } .plan .cam.alarm-1 .fov { fill: rgba(224, 68, 63, .22); }
.plan .cam.alarm-2 .node { fill: var(--p2); } .plan .cam.alarm-2 .fov { fill: rgba(217, 161, 58, .2); }
.plan .cam.alarm-3 .node { fill: var(--p3); } .plan .cam.alarm-3 .fov { fill: rgba(205, 191, 76, .18); }

.cam-list { overflow: auto; padding: 6px; }
.cam-row { display: grid; grid-template-columns: 22px 1fr auto; gap: 10px; align-items: center; padding: 5px 8px; border-radius: 4px; cursor: pointer; }
.cam-row:hover { background: var(--panel-2); }
.cam-row[aria-current="true"] { background: var(--select-bg); }
.cam-row .code { font-size: 12px; color: var(--text-3); }
.cam-dot { width: 10px; height: 10px; border-radius: 50%; background: #6b737b; justify-self: center; }

.wall-col { display: flex; flex-direction: column; min-width: 0; }
.wall-toolbar { display: flex; align-items: center; gap: 10px; padding: 8px 12px; border-bottom: 1px solid var(--line); background: var(--panel); }
.wall { flex: 1; min-height: 0; display: grid; gap: 6px; padding: 6px; background: #15171a; overflow: hidden; }
.wall.l1 { grid-template-columns: 1fr; grid-template-rows: 1fr; }
.wall.l4 { grid-template-columns: repeat(2, minmax(0, 1fr)); grid-template-rows: repeat(2, minmax(0, 1fr)); }
.wall.l9 { grid-template-columns: repeat(3, minmax(0, 1fr)); grid-template-rows: repeat(3, minmax(0, 1fr)); }
.wall.l16 { grid-template-columns: repeat(4, minmax(0, 1fr)); grid-template-rows: repeat(4, minmax(0, 1fr)); }
.tile { position: relative; background: #000; border-radius: 3px; overflow: hidden; outline: 1px solid #2c3136; min-height: 0; }

.tile video { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.tile-head { position: absolute; left: 0; right: 0; top: 0; display: flex; align-items: center; gap: 8px; padding: 6px 8px; background: linear-gradient(rgba(10, 12, 14, .85), rgba(10, 12, 14, 0)); font-size: 12.5px; }
.tile-head b { font-weight: 600; white-space: nowrap; }
.tile-head .actions { margin-left: auto; display: flex; gap: 4px; opacity: 0; transition: opacity .15s; }
.tile:hover .tile-head .actions, .tile:focus-within .tile-head .actions { opacity: 1; }
.tile-head .btn { background: rgba(30, 33, 37, .85); border-color: rgba(255, 255, 255, .12); }
.tile.alarm-1 { outline: 2px solid var(--p1); }
.tile.alarm-2 { outline: 2px solid rgba(217, 161, 58, .8); }
.tile.alarm-3 { outline: 1px solid rgba(205, 191, 76, .6); }

@keyframes tile-flash { 50% { outline-color: transparent; } }
.tile-alarm { position: absolute; left: 8px; top: 34px; display: flex; gap: 8px; align-items: center; padding: 4px 10px 4px 5px; border-radius: 3px; background: rgba(18, 20, 23, .9); font-size: 12.5px; font-weight: 600; max-width: calc(100% - 16px); }
.tile-alarm span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tile.selected { outline: 3px solid var(--select); outline-offset: -1px; }

.queue-col { border-left: 1px solid var(--line); background: var(--panel); display: flex; flex-direction: column; min-width: 0; }
.queue { overflow: auto; flex: 1; }
.alarm {
  display: grid; grid-template-columns: 22px 88px 1fr; gap: 10px; padding: 10px 12px; border-bottom: 1px solid #31363c;
  cursor: pointer; position: relative;
}
.alarm:hover { background: #2c3136; }
.alarm[aria-current="true"] { background: var(--select-bg); }
.alarm img { width: 88px; height: 56px; object-fit: cover; border-radius: 3px; background: #000; }
.alarm .t1 { font-weight: 600; line-height: 1.25; }
.alarm .t2 { font-size: 12.5px; color: var(--text-2); margin-top: 2px; }
.alarm .t3 { display: flex; align-items: center; gap: 8px; margin-top: 5px; font-size: 12.5px; }
.alarm .age { color: var(--text-3); margin-left: auto; }
.alarm.new .t1 { color: #fff; }

/* ---------------------------------------------------------------- event detail */
.detail { display: flex; flex-direction: column; min-height: 0; flex: 1; }
.detail-body { overflow: auto; padding: 12px; display: grid; gap: 12px; align-content: start; }
.player { position: relative; background: #000; border-radius: 4px; overflow: hidden; }
.player video { width: 100%; display: block; aspect-ratio: 16 / 10; object-fit: contain; }
.facts { display: grid; grid-template-columns: max-content 1fr; gap: 6px 14px; font-size: 13px; margin: 0; }
.facts dt { color: var(--text-3); }
.facts dd { margin: 0; }
.log { list-style: none; margin: 0; padding: 0; display: grid; gap: 0; }
.log li { display: grid; grid-template-columns: 14px 1fr; gap: 10px; padding-bottom: 12px; position: relative; font-size: 13px; }
.log li::before { content: ""; width: 9px; height: 9px; border-radius: 50%; background: var(--line-2); margin-top: 5px; }
.log li:not(:last-child)::after { content: ""; position: absolute; left: 4px; top: 16px; bottom: 0; width: 1px; background: var(--line); }
.log li.closed::before { background: var(--text-2); }
.log li.acknowledged::before { background: var(--select); }
.log li.escalated::before { background: var(--p2); }
.log li.created::before { background: var(--p1); }
.log time { color: var(--text-3); font-size: 12px; }
.action-bar { display: grid; gap: 8px; padding: 12px; border-top: 1px solid var(--line); background: #2a2e33; }
.action-bar .row { display: flex; gap: 8px; flex-wrap: wrap; }
.action-bar .row .btn { flex: 1; }

/* ---------------------------------------------------------------- forms & settings */
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px 16px; }
.form-grid .wide { grid-column: 1 / -1; }
.form-actions { display: flex; gap: 8px; align-items: center; padding-top: 4px; }
.form-actions .note { color: var(--text-3); font-size: 13px; }
.section { display: grid; grid-template-columns: 240px minmax(0, 1fr); gap: 24px; padding: 18px 0; border-bottom: 1px solid var(--line); }
.section:last-child { border-bottom: 0; }
.section > header p { margin: 4px 0 0; color: var(--text-3); font-size: 13px; }
.notice { display: flex; gap: 10px; padding: 10px 12px; border-radius: 4px; background: rgba(217, 161, 58, .08); border: 1px solid rgba(217, 161, 58, .35); color: #e8cf9c; font-size: 13px; }
.notice.info { background: var(--select-bg); border-color: rgba(93, 143, 214, .4); color: #c7d9f2; }
.notice.ok { background: rgba(143, 185, 154, .1); border-color: rgba(143, 185, 154, .4); color: #c7e0cd; }
.notice.error { background: var(--p1-bg); border-color: rgba(224, 68, 63, .5); color: #f4b3b0; }

.toggle-list { display: grid; gap: 1px; background: var(--line); border: 1px solid var(--line); border-radius: 4px; overflow: hidden; }
.toggle-item { display: grid; grid-template-columns: 22px 1fr auto; gap: 12px; align-items: center; padding: 10px 12px; background: var(--panel); }
.toggle-item .cell-sub { margin-top: 1px; }
.toggle-group-title { font-size: 12.5px; color: var(--text-3); margin: 14px 0 6px; }

.zone-editor { display: grid; grid-template-columns: minmax(0, 1fr) 320px; gap: 14px; align-items: start; }
.zone-canvas { position: relative; background: #000; border-radius: 4px; overflow: hidden; user-select: none; }
.zone-canvas img { display: block; width: 100%; }
.zone-canvas svg { position: absolute; inset: 0; width: 100%; height: 100%; cursor: crosshair; }
.zone-canvas polygon { stroke-width: 2; vector-effect: non-scaling-stroke; }
.zone-canvas .vertex { fill: #fff; stroke: #111; stroke-width: 2; vector-effect: non-scaling-stroke; cursor: grab; }
.zone-list { display: grid; gap: 8px; }
.zone-item { border: 1px solid var(--line); border-radius: 4px; padding: 10px; display: grid; gap: 8px; background: var(--panel); }
.zone-item[aria-current="true"] { border-color: var(--select); }
.zone-item header { display: flex; gap: 8px; align-items: center; }
.swatch { width: 12px; height: 12px; border-radius: 2px; flex: none; }

.schedule { display: grid; grid-template-columns: 34px repeat(24, minmax(0, 1fr)); gap: 2px; user-select: none; }
.schedule .h { font-size: 11px; color: var(--text-3); text-align: center; }
.schedule .d { font-size: 12px; color: var(--text-2); display: flex; align-items: center; }
.schedule button { height: 26px; border: 0; border-radius: 2px; background: #33393f; cursor: pointer; padding: 0; }
.schedule button[aria-pressed="true"] { background: var(--select-2); }
.schedule button:hover { outline: 1px solid var(--select); }

/* ---------------------------------------------------------------- dashboard */
.dash { display: grid; grid-template-columns: repeat(12, minmax(0, 1fr)); gap: 14px; }
.span-12 { grid-column: span 12; } .span-8 { grid-column: span 8; } .span-7 { grid-column: span 7; }
.span-6 { grid-column: span 6; } .span-5 { grid-column: span 5; } .span-4 { grid-column: span 4; } .span-3 { grid-column: span 3; } .span-9 { grid-column: span 9; }
.summary { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); }
.summary > div { padding: 12px 16px; border-right: 1px solid var(--line); display: grid; gap: 3px; }
.summary > div:last-child { border-right: 0; }
.summary dt { font-size: 12.5px; color: var(--text-3); }
.summary dd { margin: 0; display: flex; align-items: baseline; gap: 8px; font-size: 22px; font-weight: 600; }
.summary dd small { font-size: 12.5px; font-weight: 500; color: var(--text-2); }
.chart { width: 100%; display: block; }
.chart .grid line { stroke: #353a40; }
.chart .axis text, .chart text.axis { fill: var(--text-3); font: 12px var(--font); }
.chart .lbl { fill: var(--text-2); font: 12.5px var(--font); }
.chart .val { fill: var(--text); font: 600 12.5px var(--font); }
.chart .hit { fill: transparent; cursor: pointer; }
.chart .hit:hover + .hover-mark, .chart .col:hover rect.mark { opacity: .85; }
.legend { display: flex; gap: 14px; flex-wrap: wrap; font-size: 12.5px; color: var(--text-2); }
.legend i { display: inline-block; width: 10px; height: 10px; border-radius: 2px; margin-right: 6px; vertical-align: -1px; }
.tooltip { position: fixed; pointer-events: none; background: #111316; border: 1px solid var(--line-2); border-radius: 4px; padding: 8px 10px; font-size: 12.5px; z-index: 60; box-shadow: var(--shadow); min-width: 140px; }
.tooltip b { display: block; margin-bottom: 4px; }
.tooltip .r { display: flex; justify-content: space-between; gap: 16px; }

/* ---------------------------------------------------------------- login */
.login { min-height: 100vh; display: grid; grid-template-columns: minmax(0, 1.25fr) minmax(380px, .75fr); }
.login-art { position: relative; overflow: hidden; background: #191c20; border-right: 1px solid var(--line); display: flex; flex-direction: column; justify-content: space-between; padding: 32px 40px; }
.login-art svg.bg { position: absolute; inset: 0; width: 100%; height: 100%; opacity: .6; }
.login-art > * { position: relative; }
.login-art h1 { font-size: 34px; line-height: 1.15; max-width: 16ch; letter-spacing: -.015em; }
.login-art p { color: var(--text-2); max-width: 52ch; font-size: 15px; }
.login-form { display: grid; align-content: center; padding: 40px; gap: 18px; max-width: 460px; width: 100%; justify-self: center; }
.login-form h2 { font-size: 22px; }
.demo-accounts { display: grid; gap: 6px; }
.demo-accounts button { display: grid; grid-template-columns: 1fr auto; text-align: left; gap: 2px 10px; padding: 10px 12px; border: 1px solid var(--line); border-radius: 4px; background: var(--panel); cursor: pointer; }
.demo-accounts button:hover { border-color: var(--select); background: var(--panel-2); }
.demo-accounts small { color: var(--text-3); grid-column: 1; }
.demo-accounts code { grid-row: 1 / 3; grid-column: 2; align-self: center; color: var(--text-2); font-family: var(--mono); font-size: 12.5px; }

/* ---------------------------------------------------------------- toast */
.toasts { position: fixed; right: 16px; top: 62px; display: grid; gap: 8px; z-index: 70; }
.toast { display: flex; gap: 10px; align-items: flex-start; min-width: 280px; max-width: 420px; padding: 11px 13px; border-radius: 5px; background: #111316; border: 1px solid var(--line-2); box-shadow: var(--shadow); animation: toast-in .25s var(--ease); }
.toast.error { border-color: rgba(224, 68, 63, .6); }
@keyframes toast-in { from { transform: translateY(8px); opacity: 0; } }

/* ---------------------------------------------------------------- responsive */
@media (max-width: 1280px) {
  .console { grid-template-columns: 250px minmax(0, 1fr) 330px; }
  .summary { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .summary > div:nth-child(3n) { border-right: 0; }
  .summary > div:nth-child(-n+3) { border-bottom: 1px solid var(--line); }
}
@media (max-width: 1080px) {
  .console { grid-template-columns: minmax(0, 1fr) 330px; }
  .site-col { display: none; }
  .span-9, .span-3, .span-8, .span-7, .span-6, .span-5, .span-4 { grid-column: span 12; }
  .zone-editor { grid-template-columns: 1fr; }
  .section { grid-template-columns: 1fr; gap: 12px; }
}
@media (max-width: 760px) {
  .app, .app.rail-collapsed { grid-template-columns: 1fr; grid-template-rows: 52px 1fr 58px; }
  .rail { grid-row: 3; grid-column: 1; flex-direction: row; border-right: 0; border-top: 1px solid var(--line); }
  .brand, .rail-foot { display: none; }
  .nav { grid-auto-flow: column; grid-auto-columns: 1fr; width: 100%; padding: 4px; }
  .nav a { flex-direction: column; height: 48px; gap: 2px; justify-content: center; font-size: 11px; padding: 0 2px; }
  .nav a[aria-current="page"]::after { left: 20%; right: 20%; top: auto; bottom: -4px; width: auto; height: 2px; }
  .nav .count { position: absolute; top: 2px; right: 10%; margin: 0; }
  .topbar { padding: 0 10px; gap: 10px; }
  .shift, .user-btn .who, .topbar .tag.demo, .help-btn span { display: none; }
  .help-btn { padding: 0 8px; }
  .alarm-banner button { padding: 0 8px; }
  .console { grid-template-columns: 1fr; height: auto; }
  .queue-col { border-left: 0; border-top: 1px solid var(--line); max-height: none; }
  .wall.l9, .wall.l16, .wall.l4 { grid-template-columns: 1fr; }
  .page { padding: 14px 12px 24px; }
  .form-grid { grid-template-columns: 1fr; }
  .summary { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .summary > div { border-right: 0; border-bottom: 1px solid var(--line); }
  .login { grid-template-columns: 1fr; }
  .login-art { min-height: 260px; padding: 24px; }
  .login-art h1 { font-size: 26px; }
  .login-form { padding: 24px 16px; }
  .data .hide-sm { display: none; }
}

/* ---------------------------------------------------------------- journal, charts, misc */
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.status.ok::before { background: var(--ok); }
.events-layout { display: grid; grid-template-columns: minmax(0, 1fr); gap: 14px; align-items: start; }
.events-layout.with-detail { grid-template-columns: minmax(0, 1fr) 420px; }
.detail-panel { position: sticky; top: 0; max-height: calc(100vh - 52px - 46px); display: flex; flex-direction: column; overflow: hidden; }
.events-table .table-wrap { max-height: calc(100vh - 52px - 46px - 110px); }
.hbar { display: grid; gap: 5px; color: inherit; text-decoration: none; border-radius: 3px; }
.hbar:hover .hbar-track div { background: var(--select); }
.hbar-track { height: 8px; background: #2c3136; border-radius: 4px; overflow: hidden; }
.hbar-track div { height: 100%; background: #8a929a; border-radius: 0 4px 4px 0; transition: background .15s; }
.chart rect[data-tip]:hover { stroke: #fff; stroke-width: 1; }
.chart .hit:hover { fill: rgba(255, 255, 255, .04); stroke: none; }

.section header h2 { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.page-head h1 { overflow-wrap: anywhere; }
@media (max-width: 1280px) { .events-layout.with-detail { grid-template-columns: minmax(0, 1fr) 360px; } }
@media (max-width: 1080px) {
  .events-layout.with-detail { grid-template-columns: 1fr; }
  .detail-panel { position: fixed; inset: 52px 0 0 0; max-height: none; z-index: 40; border-radius: 0; }
}
@media (max-width: 760px) {
  .hide-sm { display: none !important; }
  .detail-panel { inset: 52px 0 58px 0; }
  .events-table .table-wrap { max-height: none; }
  .filters .input, .filters .select { min-width: 0; flex: 1 1 140px; }
  .page-head .actions { margin-left: 0; }
  .topbar .crumbs { display: flex; }
  .topbar h1 { font-size: 14px; }
}

/* ---------------------------------------------------------------- site editor, modules, help */
.editor-page { display: flex; flex-direction: column; height: calc(100vh - 52px); }
.editor-bar { display: flex; align-items: center; gap: 12px; padding: 8px 16px; border-bottom: 1px solid var(--line); background: var(--panel); flex-wrap: wrap; }
.editor-bar .tools { flex-wrap: wrap; }
.editor-bar .actions { margin-left: auto; display: flex; gap: 8px; align-items: center; }
.editor-body { flex: 1; min-height: 0; display: grid; grid-template-columns: minmax(0, 1fr) 300px; }
.se-canvas { min-height: 0; overflow: auto; padding: 16px; background: #181a1d; display: grid; place-items: center; }
.se-canvas .plan { width: 100%; max-height: 100%; touch-action: none; user-select: none; outline: none; background: var(--inset); }
.se-canvas .plan:focus-visible { outline: 2px solid var(--select); }
.se-canvas svg[data-tool="select"] { cursor: default; }
.se-canvas svg:not([data-tool="select"]) { cursor: crosshair; }
.se-canvas svg[data-tool="select"] .sh-building, .se-canvas svg[data-tool="select"] .sh-room, .se-canvas svg[data-tool="select"] .sh-area,
.se-canvas svg[data-tool="select"] .sh-gate, .se-canvas svg[data-tool="select"] .sh-free, .se-canvas svg[data-tool="select"] .cam { cursor: move; }
.se-canvas .sh-building, .se-canvas .sh-room, .se-canvas .sh-area, .se-canvas .sh-gate, .se-canvas .sh-free { pointer-events: all; }
.se-canvas svg:not([data-tool="select"]) [data-shape], .se-canvas svg:not([data-tool="select"]) .cam { pointer-events: none; }
.se-canvas .sh-fence, .se-canvas .sh-road { pointer-events: stroke; }
.se-canvas svg[data-tool="select"] .sh-fence, .se-canvas svg[data-tool="select"] .sh-road { cursor: move; }
.sh-free { fill: #c3c9cf; font: 500 34px var(--font); }
.se-draft { opacity: .7; pointer-events: none; }
.se-outline { fill: none; stroke: var(--select); stroke-width: 2; stroke-dasharray: 8 5; pointer-events: none; }
.se-handle { fill: #fff; stroke: var(--select); stroke-width: 3; }
.se-handle[data-vertex], .se-handle[data-rotate] { cursor: grab; }
.se-side { border-left: 1px solid var(--line); background: var(--panel); padding: 14px; display: grid; gap: 14px; align-content: start; overflow: auto; }
.se-side #se-props:empty, .se-side #se-cams:empty { display: none; }
.se-group { display: grid; gap: 10px; padding-top: 14px; border-top: 1px solid var(--line); }
.se-row { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.site-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(340px, 1fr)); gap: 14px; }
.site-card { display: grid; color: inherit; text-decoration: none; overflow: hidden; transition: border-color .15s; }
.site-card:hover { border-color: var(--select); }
.site-card .plan { border: 0; border-radius: 0; border-bottom: 1px solid var(--line); }
.site-card-body { padding: 12px 14px; display: grid; gap: 3px; }
.plan-box { position: relative; }
.plan-edit { position: absolute; top: 16px; right: 16px; z-index: 1; background: rgba(30, 33, 37, .9); }
.zone-canvas polygon { cursor: move; }
.modules { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 12px; }
.module { display: grid; gap: 8px; align-content: start; padding: 14px; border: 1px solid var(--line); border-radius: 6px; background: var(--panel-2); }
.module.off { opacity: .6; }
.module header { display: flex; gap: 10px; align-items: flex-start; justify-content: space-between; }
.module h4 { margin: 0; font-size: 14px; font-weight: 600; }
.module p { margin: 0; font-size: 13px; }
.module footer { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; font-size: 12.5px; color: var(--text-2); padding-top: 8px; border-top: 1px solid var(--line); }
.chips { display: flex; flex-wrap: wrap; gap: 4px; }
.help { display: grid; grid-template-columns: 220px minmax(0, 860px); gap: 32px; }
.help-toc { position: sticky; top: 18px; align-self: start; display: grid; gap: 2px; }
.help-toc a { color: var(--text-2); text-decoration: none; padding: 7px 10px; border-radius: 4px; border-left: 2px solid transparent; }
.help-toc a:hover { color: var(--text); background: var(--panel); }
.help-toc a[aria-current] { color: #fff; border-left-color: var(--select); background: var(--select-bg); }
.help-body { display: grid; gap: 40px; line-height: 1.6; }
.help-body section { display: grid; gap: 14px; }
.help-body h1 { font-size: 22px; } .help-body h2 { font-size: 19px; } .help-body h3 { font-size: 15px; margin-top: 6px; }
.help-body p { margin: 0; max-width: 72ch; }
.help-body .lead { font-size: 15px; color: var(--text-2); }
.flow { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; counter-reset: f; }
.flow li { counter-increment: f; position: relative; display: grid; gap: 3px; padding: 12px 14px 12px 44px; background: var(--panel); border: 1px solid var(--line); border-radius: 6px; font-size: 13px; line-height: 1.4; }
.flow li::before { content: counter(f); position: absolute; left: 12px; top: 12px; width: 22px; height: 22px; border-radius: 50%; border: 1px solid var(--line-2); display: grid; place-items: center; font-size: 12px; color: var(--text-2); }
.flow li span { color: var(--text-3); }
.steps { margin: 0; padding-left: 22px; display: grid; gap: 8px; max-width: 76ch; }
.steps li::marker { color: var(--text-3); font-weight: 600; }
.bullets { margin: 12px 0 0; padding-left: 20px; display: grid; gap: 6px; color: var(--text-2); max-width: 80ch; }
.data.access td.num { text-align: center; } .data.access th.num { text-align: center; }
@media (max-width: 1080px) {
  .editor-body { grid-template-columns: 1fr; }
  .editor-page { height: auto; }
  .se-side { border-left: 0; border-top: 1px solid var(--line); }
  .help { grid-template-columns: 1fr; gap: 16px; }
  .help-toc { position: static; display: flex; flex-wrap: wrap; }
  .flow { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 760px) { .flow { grid-template-columns: 1fr; } .modules { grid-template-columns: 1fr; } }

/* ---------------------------------------------------------------- alarm flow */
.ellipsis { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
kbd { font: 600 11px var(--mono); padding: 1px 5px; border-radius: 3px; border: 1px solid rgba(255, 255, 255, .35); margin-left: 8px; opacity: .8; }
.btn.big { height: 42px; font-size: 15px; width: 100%; }
.stepper { list-style: none; margin: 0; padding: 10px 14px; display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; border-bottom: 1px solid var(--line); }
.stepper li { display: flex; align-items: center; gap: 7px; font-size: 13px; color: var(--text-3); }
.stepper li b, .stepper li .icon { width: 20px; height: 20px; flex: none; border-radius: 50%; display: grid; place-items: center; font-size: 11.5px; border: 1px solid var(--line-2); }
.stepper li.current { color: #fff; font-weight: 600; }
.stepper li.current b { background: var(--select); border-color: var(--select); color: #fff; }
.stepper li.done { color: var(--text-2); }
.stepper li.done .icon { padding: 3px; color: var(--ok); border-color: rgba(143, 185, 154, .5); }
.player { display: grid; gap: 6px; background: none; overflow: visible; }
.detail-body > * { min-height: min-content; }
.player video { border-radius: 4px; background: #000; }
.player-mode { justify-self: start; }
.log-box summary { cursor: pointer; color: var(--text-2); font-size: 13px; padding: 4px 0; }
.log-box[open] summary { margin-bottom: 8px; }
.choice-title { font-size: 12.5px; color: var(--text-3); }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip { border: 1px solid var(--line-2); background: var(--panel); color: var(--text); border-radius: 14px; padding: 4px 10px; font-size: 12.5px; cursor: pointer; text-align: left; }
.chip:hover { border-color: var(--select); }
.chip[aria-pressed="true"] { background: var(--select-bg); border-color: var(--select); }
.false-box { display: grid; gap: 6px; }
.action-bar [aria-pressed="true"].btn { background: var(--select-bg); border-color: var(--select); }
.queue-group { position: sticky; top: 0; z-index: 1; padding: 8px 12px; font-size: 12.5px; color: var(--text-3); background: var(--panel); border-bottom: 1px solid var(--line); }
.queue-group b { color: var(--text); margin-left: 4px; }
.alarm.new { background: rgba(93, 143, 214, .07); }
.alarm.acknowledged, .alarm.escalated { opacity: .82; }
.wait { font-family: var(--mono); font-size: 12.5px; color: var(--text-2); }
.wait.overdue { color: #f2a19e; font-family: var(--font); font-weight: 600; }
.alarm.arrive { animation: arrive 1.1s ease-in-out 3; }
@keyframes arrive { 50% { background: rgba(93, 143, 214, .22); } }
.next-alarm { display: flex; align-items: center; gap: 10px; min-width: 0; padding: 6px 12px; border-bottom: 1px solid var(--line); background: var(--panel-2); font-size: 13.5px; }
.next-alarm .btn { margin-left: auto; flex: none; }
@media (prefers-reduced-motion: reduce) { .alarm.arrive { animation: none; background: rgba(93, 143, 214, .16); } }

/* увеличенная камера поверх видеостены */
.zoom { position: fixed; inset: 52px 0 0 0; background: rgba(12, 14, 16, .82); display: grid; place-items: center; padding: 20px; z-index: 45; }
.zoom-frame { width: min(1400px, 100%); max-height: 100%; background: #000; border: 1px solid var(--line-2); border-radius: 6px; overflow: hidden; box-shadow: var(--shadow); display: grid; grid-template-rows: auto minmax(0, 1fr); }
.zoom-head { display: flex; align-items: center; gap: 10px; padding: 8px 10px; background: var(--panel); border-bottom: 1px solid var(--line); }
.zoom-head .actions { margin-left: auto; display: flex; gap: 6px; align-items: center; }
.zoom-frame video { width: 100%; height: 100%; max-height: calc(100vh - 160px); object-fit: contain; display: block; background: #000; }
.tile-alarm[data-alarm] { cursor: pointer; }
.tile-alarm[data-alarm]:hover { background: rgba(30, 34, 39, .96); outline: 1px solid var(--line-2); }
@media (max-width: 760px) { .zoom { inset: 52px 0 58px 0; padding: 8px; } }

.player-bar { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.player-bar .seg button { padding: 0 9px; }
.player-bar .faint { margin-left: auto; font-size: 12px; }

/* ---------------------------------------------------------------- polish pass */
.dash > .panel { align-self: start; }
.data.events-grid { table-layout: fixed; width: 100%; }
.data.events-grid td { overflow: hidden; }
.data.events-grid td > div { min-width: 0; }
.data.events-grid .cell-main, .data.events-grid .cell-sub { overflow: hidden; text-overflow: ellipsis; }
.data.events-grid th:nth-child(1), .data.events-grid td:nth-child(1) { width: 44px; }
.data.events-grid th:nth-child(2), .data.events-grid td:nth-child(2) { width: 76px; }
.data.events-grid th:nth-child(3), .data.events-grid td:nth-child(3) { width: 112px; }
.data.events-grid th:nth-child(5), .data.events-grid td:nth-child(5) { width: 170px; }
.data.events-grid th:nth-child(6), .data.events-grid td:nth-child(6) { width: 112px; }
.data.events-grid th:nth-child(7), .data.events-grid td:nth-child(7) { width: 150px; }
/* с открытой карточкой места мало: ответственный и решение читаются в самой карточке */
.events-layout.with-detail .events-grid th:nth-child(7), .events-layout.with-detail .events-grid td:nth-child(7),
.events-layout.with-detail .events-grid th:nth-child(8), .events-layout.with-detail .events-grid td:nth-child(8) { display: none; }
.shift-strip { display: flex; gap: 14px; align-items: baseline; padding: 8px 12px; border-bottom: 1px solid var(--line); font-size: 12.5px; color: var(--text-3); }
.shift-strip b { color: var(--text); font-weight: 600; }
@media (max-width: 760px) {
  .nav a span { font-size: 10.5px; }
  .nav a .full { display: none; }
  .alarm-banner button.zero { display: none; }
  .tile-alarm { font-size: 12px; }
}
@media (min-width: 761px) { .nav a .short { display: none; } }
/* плотные раскладки: подпись тревоги важнее времени и имени камеры */
.wall.l9 .tile-head .muted, .wall.l16 .tile-head .muted { display: none; }
.wall.l9 .tile-alarm .faint, .wall.l16 .tile-alarm .faint { display: none; }
.wall.l16 .tile-alarm { padding: 3px 7px 3px 4px; font-size: 11.5px; }
@media (max-width: 760px) {
  /* на телефоне стена не растягивается по высоте: кадры идут лентой с обычной пропорцией */
  .wall, .wall.l4, .wall.l9, .wall.l16 { grid-template-columns: 1fr; grid-template-rows: none; overflow: visible; }
  .wall .tile { aspect-ratio: 16 / 9; }
}

@media (min-width: 1100px) { .panel > .tabs { flex-wrap: wrap; row-gap: 0; } }

/* Производство: вкладки переделов, лента камер, запись со шкалой событий, «Сейчас», ряды параметров */
.tag.sim { border-color: var(--p2); color: var(--p2); }
.pm-tabs { margin-bottom: 10px; }
.pm-tabs small { margin-left: 8px; color: var(--text-3); }
.pm-tabs [aria-selected="true"] small { color: inherit; }
.pm-strip { display: flex; gap: 10px; overflow-x: auto; padding: 2px 2px 10px; margin-bottom: 4px; scroll-snap-type: x proximity; }
.pm-cam { flex: 0 0 196px; display: grid; gap: 4px; text-align: left; padding: 6px 6px 8px; background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); color: var(--text); font: inherit; cursor: pointer; scroll-snap-align: start; transition: border-color .15s var(--ease), background-color .15s var(--ease); }
.pm-cam:hover { background: var(--panel-2); }
.pm-cam.on { border-color: var(--select); background: var(--select-bg); }
.pm-cam-img { position: relative; aspect-ratio: 16 / 9; background: var(--inset); border-radius: 3px; overflow: hidden; display: block; }
.pm-cam-img img { width: 100%; height: 100%; object-fit: cover; display: block; }
.pm-cam-img .tag { position: absolute; left: 6px; top: 6px; background: rgba(17, 19, 22, .8); }
.pm-cam-code { font-size: 12px; color: var(--text-3); margin-top: 2px; }
.pm-cam-title { font-size: 13px; font-weight: 600; line-height: 1.3; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; min-height: 2.6em; }
.pm-cam-state { display: flex; gap: 6px; align-items: center; font-size: 12.5px; color: var(--text-2); }
.pm-cam-state .prio, .pm-ev .prio, .pm-read .prio { width: 16px; height: 16px; font-size: 10px; flex: none; }
.pm-main { display: grid; grid-template-columns: minmax(0, 1fr) 340px; gap: 14px; align-items: start; }
.pm-video video { width: 100%; max-height: 50vh; display: block; background: #000; object-fit: contain; }
.pm-timeline { padding: 12px 14px 0; }
.pm-tl-track { position: relative; height: 26px; background: var(--inset); border: 1px solid var(--line); border-radius: 3px; cursor: pointer; }
.pm-tl-track #pm-head { position: absolute; left: 0; top: -3px; bottom: -3px; width: 2px; background: var(--text); border-radius: 1px; pointer-events: none; }
.pm-tl-ev { position: absolute; top: 50%; transform: translate(-50%, -50%); padding: 0; background: none; border: 0; cursor: pointer; line-height: 0; }
.pm-tl-ev .prio { width: 16px; height: 16px; font-size: 10px; }
.pm-tl-ticks { display: flex; justify-content: space-between; font-size: 12px; color: var(--text-3); margin-top: 4px; }
.pm-note { margin: 8px 14px 14px; color: var(--text-2); max-width: 90ch; }
.pm-side { display: grid; gap: 14px; }
.pm-now { display: grid; grid-template-columns: 1fr 1fr; }
.pm-read { padding: 10px 14px 12px; border-top: 1px solid var(--line); display: grid; gap: 2px; align-content: start; }
.pm-read:nth-child(-n+2) { border-top: 0; }
.pm-read:nth-child(odd) { border-right: 1px solid var(--line); }
.pm-read > span { font-size: 12.5px; color: var(--text-3); line-height: 1.3; }
.pm-read b { display: flex; align-items: center; gap: 6px; font-size: 22px; font-weight: 600; }
.pm-read em { font-style: normal; }
.pm-read small { font-size: 12.5px; font-weight: 500; color: var(--text-2); }
.pm-read i:empty { display: none; }
.pm-read.dev em { color: var(--p2); }
.pm-evs { display: grid; }
.pm-ev { display: flex; gap: 10px; align-items: flex-start; text-align: left; padding: 10px 14px; background: none; border: 0; border-top: 1px solid var(--line); color: var(--text); font: inherit; cursor: pointer; }
.pm-ev:first-child { border-top: 0; }
.pm-ev:hover { background: var(--panel-2); }
.pm-ev.on { background: var(--select-bg); }
.pm-ev b { display: block; font-weight: 600; }
.pm-ev small { color: var(--text-2); font-size: 12.5px; }
.pm-sum { display: grid; grid-template-columns: 1fr auto; gap: 6px 12px; margin: 0; padding: 12px 14px; font-size: 13px; }
.pm-sum dt { color: var(--text-3); }
.pm-sum dd { margin: 0; text-align: right; font-weight: 600; }
.pm-series { margin-top: 14px; }
.pm-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(340px, 1fr)); gap: 12px; }
.pm-chart { background: var(--inset); border: 1px solid var(--line); border-radius: var(--radius); padding: 8px 10px 4px; }
.pm-chart-head { display: flex; align-items: baseline; gap: 6px; font-size: 12.5px; color: var(--text-2); }
.pm-chart-head b { margin-left: auto; font-size: 18px; color: var(--text); }
.pm-chart-head small { color: var(--text-3); }
.pm-chart .hit { cursor: crosshair; }
.pm-method { margin-top: 14px; }
.pm-method > summary { cursor: pointer; list-style: none; }
.pm-method > summary::-webkit-details-marker { display: none; }
.pm-method > summary h2::before { content: ""; display: inline-block; width: 7px; height: 7px; margin-right: 10px; border-right: 2px solid var(--text-3); border-bottom: 2px solid var(--text-3); transform: rotate(-45deg); transition: transform .15s var(--ease); vertical-align: 2px; }
.pm-method[open] > summary h2::before { transform: rotate(45deg); }
@media (max-width: 1280px) { .pm-main { grid-template-columns: minmax(0, 1fr) 300px; } }
@media (max-width: 1080px) { .pm-main { grid-template-columns: 1fr; } .pm-side { grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); } }
@media (max-width: 760px) { .pm-cam { flex-basis: 160px; } .pm-grid { grid-template-columns: 1fr; } .pm-tabs { overflow-x: auto; max-width: 100%; } }

/* Демо-режим: показ на весь экран */
.demo-show { position: fixed; inset: 0; z-index: 1000; background: #111316; color: var(--text); display: grid; grid-template-rows: 1fr auto 3px; }
.ds-stage { min-height: 0; display: grid; }
.ds-hero { place-self: center; text-align: center; max-width: 900px; padding: 24px; display: grid; gap: 14px; justify-items: center; }
.ds-hero h1 { font-size: 56px; letter-spacing: .04em; margin: 0; }
.ds-hero p { font-size: 20px; color: var(--text-2); margin: 0; }
.ds-stats { display: flex; gap: 40px; margin-top: 16px; }
.ds-stats div { display: grid; } .ds-stats b { font-size: 40px; } .ds-stats span { color: var(--text-3); }
.ds-split { display: grid; grid-template-columns: minmax(0, 1fr) 380px; min-height: 0; }
.ds-split video, .ds-split canvas { width: 100%; height: 100%; min-height: 0; object-fit: contain; background: #000; display: block; }
.ds-side { padding: 22px; display: flex; flex-direction: column; gap: 10px; overflow: auto; border-left: 1px solid var(--line); background: var(--panel); }
.ds-side h2 { font-size: 20px; margin: 0; } .ds-side p { margin: 0; color: var(--text-2); font-size: 15px; }
.ds-ev { display: flex; gap: 10px; align-items: flex-start; padding: 10px 12px; background: var(--inset); border: 1px solid var(--line); border-radius: var(--radius); animation: ds-in .4s var(--ease); }
.ds-ev .prio { flex: none; }
.ds-ev b { display: block; } .ds-ev small { color: var(--text-2); }
.ds-kv { display: flex; justify-content: space-between; gap: 12px; padding: 6px 0; border-bottom: 1px solid var(--line); }
.ds-kv span { color: var(--text-2); }
.ds-bar { display: grid; grid-template-columns: auto 1fr auto; gap: 20px; align-items: center; padding: 10px 18px; background: var(--panel); border-top: 1px solid var(--line); }
.ds-brand b { letter-spacing: .06em; margin-left: 6px; }
.ds-title { display: grid; } .ds-title b { font-size: 16px; } .ds-title span { color: var(--text-3); font-size: 12.5px; }
.ds-ctl { display: flex; gap: 8px; align-items: center; }
.ds-progress { background: var(--line); overflow: hidden; } .ds-progress i { display: block; height: 100%; width: 100%; background: var(--select); transform-origin: left; transition: transform .4s var(--ease); }
@keyframes ds-in { from { opacity: 0; transform: translateY(-6px); } to { opacity: 1; transform: none; } }
@media (max-width: 900px) { .ds-split { grid-template-columns: 1fr; grid-template-rows: 1fr auto; } .ds-side { max-height: 40vh; border-left: 0; } .ds-hero h1 { font-size: 36px; } }
@media (prefers-reduced-motion: reduce) { .ds-ev { animation: none; } }

/* Ковши: парк силуэтами, шапка ковша, сетка разделов */
.ladles .fleet { margin-bottom: 14px; }
.fleet-row { display: grid; grid-template-columns: repeat(10, minmax(0, 1fr)); gap: 2px; padding: 6px; }
.ladle-tile { display: grid; justify-items: center; gap: 2px; padding: 10px 6px 8px; background: none; border: 1px solid transparent; border-radius: var(--radius); color: var(--text); cursor: pointer; font: inherit; transition: background-color .15s var(--ease), border-color .15s var(--ease); }
.ladle-tile:hover { background: var(--panel-2); }
.ladle-tile.on { background: var(--select-bg); border-color: var(--select); }
.ladle-tile svg { width: 44px; height: 50px; }
.lt-num { display: inline-flex; gap: 6px; align-items: center; font-weight: 600; }
.lt-num .prio { width: 16px; height: 16px; font-size: 10px; }
.lt-min { font-size: 12.5px; color: var(--text-2); } .lt-min b { color: var(--text); font-size: 15px; }
.lt-sub { font-size: 12px; color: var(--text-3); }
.ladle-head { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; }
.lh-title { padding: 12px 16px 4px; display: flex; flex-wrap: wrap; gap: 4px 12px; align-items: baseline; }
.lh-title h2 { font-size: 18px; margin: 0; }
.lh-title .faint { font-size: 12.5px; }
.lh-verdict { padding: 12px 16px 4px; display: flex; gap: 8px; align-items: center; font-size: 15px; }
.lh-kpi { grid-column: 1 / -1; grid-template-columns: repeat(4, minmax(0, 1fr)); border-top: 1px solid var(--line); margin-top: 8px !important; }
.ladle-grid { display: grid; grid-template-columns: minmax(0, 5fr) minmax(0, 7fr); gap: 14px; margin-top: 14px; }
.l-3d canvas { width: 100%; height: 440px; display: block; cursor: grab; touch-action: none; }
.l-map, .l-trend { min-width: 0; }
.l-def { grid-column: 1 / -1; }
.data tr.on td { background: var(--select-bg); }

/* карта износа: подписи — HTML (реальный кегль), карта — canvas с интерполяцией */
.wm { display: grid; grid-template-columns: 128px minmax(0, 1fr); row-gap: 4px; }
.wm-labels { position: relative; }
.wm-belt { position: absolute; right: 10px; left: 0; display: flex; align-items: center; justify-content: flex-end; font-size: 12px; color: var(--text-2); text-align: right; line-height: 1.15; }
.wm-map { position: relative; border-radius: 3px; overflow: visible; }
.wm-map canvas { width: 100%; height: 380px; display: block; border-radius: 3px; image-rendering: auto; }
.wm-line { position: absolute; left: 0; right: 0; border-top: 1px solid rgba(17, 19, 22, .85); pointer-events: none; }
.wm-def { position: absolute; transform: translate(-50%, -50%); padding: 3px; border-radius: 50%; border: 2px solid #fff; background: rgba(17, 19, 22, .6); cursor: pointer; line-height: 0; }
.wm-def .prio { width: 14px; height: 14px; font-size: 9px; }
.wm-def.on, .wm-def:hover { box-shadow: 0 0 0 3px var(--select); }
.wm-ticks { position: relative; height: 16px; font-size: 12px; color: var(--text-3); }
.wm-ticks span { position: absolute; transform: translateX(-50%); }
.wm-ticks span:first-child { transform: none; } .wm-ticks span:last-child { transform: translateX(-100%); }
.wm-legend { display: flex; flex-wrap: wrap; gap: 8px 18px; align-items: center; margin-top: 12px; font-size: 12.5px; }
.wm-legend .prio { width: 14px; height: 14px; font-size: 9px; vertical-align: -2px; margin-right: 4px; }
.wm-ramp { width: 110px; height: 10px; border-radius: 2px; background: linear-gradient(90deg, rgb(46,52,59), rgb(64,104,160) 55%, rgb(150,186,230)); }

/* пояса: полоса исходной толщины, заливка — средний остаток, риски — минимум и предел */
.belts { display: grid; gap: 14px; }
.belt-row { display: grid; grid-template-columns: 132px minmax(0, 1fr) 150px; gap: 12px; align-items: center; }
.belt-name { font-size: 13px; color: var(--text-2); }
.belt-track { position: relative; height: 14px; background: var(--inset); border: 1px solid var(--line); border-radius: 3px; }
.belt-fill { position: absolute; inset: 0 auto 0 0; background: var(--chart-other); border-radius: 2px 0 0 2px; }
.belt-limit { position: absolute; top: -4px; bottom: -4px; width: 0; border-left: 2px dashed var(--p1); }
.belt-min { position: absolute; top: -5px; bottom: -5px; width: 3px; margin-left: -1.5px; background: var(--text); border-radius: 2px; }
.belt-min.p2 { background: var(--p2); } .belt-min.p1 { background: var(--p1); }
.belt-val { display: flex; align-items: baseline; gap: 6px; justify-content: flex-end; }
.belt-val b { font-size: 16px; } .belt-val small { color: var(--text-3); font-size: 12px; }
.belt-val .prio { width: 14px; height: 14px; font-size: 9px; align-self: center; }
.belt-key { display: flex; gap: 16px; font-size: 12px; margin-top: 4px; }
.belt-key i { display: inline-block; vertical-align: -1px; margin-right: 6px; }
.belt-key .k-fill { width: 14px; height: 10px; background: var(--chart-other); border-radius: 2px; }
.belt-key .k-min { width: 3px; height: 12px; background: var(--text); }
.belt-key .k-lim { width: 0; height: 12px; border-left: 2px dashed var(--p1); }

@media (max-width: 1280px) { .fleet-row { grid-template-columns: repeat(5, minmax(0, 1fr)); } }
@media (max-width: 1080px) {
  .ladle-grid { grid-template-columns: 1fr; }
  .lh-kpi { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .l-3d canvas { height: 360px; }
}
@media (max-width: 760px) {
  .fleet-row { display: flex; overflow-x: auto; scroll-snap-type: x mandatory; }
  .ladle-tile { flex: 0 0 84px; scroll-snap-align: start; }
  .ladle-head { grid-template-columns: 1fr; }
  .l-3d .panel-head .actions, .l-3d .panel-head > .faint { display: none; }
  .wm { grid-template-columns: 84px minmax(0, 1fr); }
  .wm-map canvas { height: 260px; }
  .belt-row { grid-template-columns: 1fr; gap: 4px; }
  .belt-val { justify-content: flex-start; }
}

/* Носимые регистраторы: разбор записи и чек-лист наряда */
.bc-head { display: grid; }
.bc-title { padding: 12px 16px 4px; display: flex; flex-wrap: wrap; gap: 4px 12px; align-items: baseline; }
.bc-title h2 { font-size: 18px; margin: 0; } .bc-title .faint { font-size: 12.5px; }
.bc-kpi { grid-template-columns: repeat(4, minmax(0, 1fr)); border-top: 1px solid var(--line); margin-top: 8px !important; }
.bc-main { display: grid; grid-template-columns: minmax(0, 1fr) 420px; gap: 14px; margin-top: 14px; align-items: start; }
.bc-video video { width: 100%; max-height: 52vh; display: block; background: #000; }
.bc-evs { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 10px; padding: 14px; }
.bc-ev { display: grid; gap: 6px; padding: 0 0 8px; background: var(--inset); border: 1px solid var(--line); border-radius: var(--radius); color: var(--text); font: inherit; text-align: left; cursor: pointer; overflow: hidden; transition: border-color .15s var(--ease); }
.bc-ev:hover { border-color: var(--line-2); } .bc-ev.on { border-color: var(--select); background: var(--select-bg); }
.bc-ev img { width: 100%; aspect-ratio: 4 / 3; object-fit: cover; display: block; }
.bc-ev span { display: grid; grid-template-columns: auto 1fr; gap: 2px 8px; padding: 0 10px; align-items: center; }
.bc-ev span small { grid-column: 2; color: var(--text-3); font-size: 12px; }
.bc-ev .prio { width: 16px; height: 16px; font-size: 10px; }
.bc-group { margin: 0; padding: 12px 16px 6px; font-size: 12.5px; font-weight: 600; color: var(--text-3); border-top: 1px solid var(--line); }
.bc-chk .panel-head + .bc-group { border-top: 0; }
.bc-item { display: grid; grid-template-columns: 22px minmax(0, 1fr) auto; gap: 10px; align-items: start; padding: 8px 16px 10px; }
.bc-item .prio { width: 18px; height: 18px; font-size: 11px; margin-top: 1px; }
.bc-item-body { display: grid; gap: 2px; }
.bc-item-body b { font-weight: 600; } .bc-item-body small { color: var(--text-3); font-size: 12px; }
.bc-item-body .muted { font-size: 13px; }
.bc-item .btn { padding: 2px; height: auto; } .bc-item .btn img { width: 72px; height: 48px; object-fit: cover; display: block; border-radius: 2px; }
.chk-ok { display: grid; place-items: center; width: 18px; height: 18px; border-radius: 50%; background: rgba(143, 185, 154, .18); color: var(--ok); margin-top: 1px; }
.chk-ok .icon { width: 13px; height: 13px; stroke-width: 2.6; }
.chk-unk { display: grid; place-items: center; width: 18px; height: 18px; border-radius: 50%; border: 1px dashed var(--text-3); color: var(--text-3); font-size: 11px; font-weight: 700; margin-top: 1px; }
@media (max-width: 1280px) { .bc-main { grid-template-columns: minmax(0, 1fr) 360px; } }
@media (max-width: 1080px) { .bc-main { grid-template-columns: 1fr; } .bc-kpi { grid-template-columns: repeat(2, minmax(0, 1fr)); } }

/* Конвейерные ленты: карта по длине, стыки, считанное полотно */
.belt-row6 { grid-template-columns: repeat(6, minmax(0, 1fr)); }
.belt-tile svg { width: 84px; height: 36px; }
.bm { display: grid; grid-template-columns: 64px minmax(0, 1fr); row-gap: 4px; }
.bm-side { display: flex; flex-direction: column; justify-content: space-between; font-size: 12px; color: var(--text-3); padding: 2px 10px 2px 0; text-align: right; }
.bm-map { position: relative; }
.bm-map canvas { width: 100%; height: 200px; display: block; border-radius: 3px; }
.bm-joint { position: absolute; top: -6px; bottom: -6px; width: 0; padding: 0; border: 0; border-left: 2px solid rgba(221, 225, 229, .75); background: none; cursor: pointer; }
.bm-joint.p2 { border-left-color: var(--p2); } .bm-joint.p1 { border-left-color: var(--p1); }
.bm-joint span { position: absolute; top: -18px; left: -10px; font-size: 11px; color: var(--text-2); white-space: nowrap; }
.scan-strip { overflow-x: auto; padding: 10px 14px 4px; contain: inline-size; width: 100%; }
.belts .panel, .belts #belt { min-width: 0; }
.scan-img { position: relative; height: 200px; display: flex; }
.scan-img img { height: 180px; display: block; }
.scan-ticks { position: absolute; left: 0; right: 0; top: 182px; height: 18px; font-size: 11px; color: var(--text-3); }
.scan-ticks span { position: absolute; border-left: 1px solid var(--line-2); padding-left: 3px; }
.belts .belt-name small { font-size: 11.5px; }
@media (max-width: 1080px) { .belt-row6 { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
@media (max-width: 760px) { .bm { grid-template-columns: 1fr; } .bm-side { display: none; } .bm-map canvas { height: 150px; } }

.pm-lim-form { border-bottom: 1px solid var(--line); }
.pm-lim-form .input { width: 100%; min-width: 80px; height: 30px; }
.pm-lim-form td small { display: inline; }

/* Поиск объектов */
.ob-kpi { grid-template-columns: repeat(3, minmax(0, 1fr)); border-bottom: 1px solid var(--line); }
.ob-filters { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; padding: 12px 14px 4px; }
.ob-filters .input { flex: 1 1 320px; height: 36px; }
.ob-classes { padding: 8px 14px 14px; display: flex; flex-wrap: wrap; gap: 6px; }
.ob-classes .chip { cursor: pointer; font: inherit; font-size: 13px; }
.ob-classes .chip.on { border-color: var(--select); background: var(--select-bg); color: var(--text); }
.ob-player { margin-top: 14px; } .ob-player video { width: 100%; max-height: 56vh; display: block; background: #000; }
.objects > .panel + .panel, .objects .panel + section { margin-top: 14px; }
.ob-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(168px, 1fr)); gap: 10px; padding: 14px; }
.ob-card { display: grid; gap: 4px; padding: 0 0 8px; text-align: left; background: var(--inset); border: 1px solid var(--line); border-radius: var(--radius); color: var(--text); font: inherit; cursor: pointer; overflow: hidden; transition: border-color .15s var(--ease); }
.ob-card:hover { border-color: var(--select); }
.ob-card img { width: 100%; aspect-ratio: 4 / 3; object-fit: cover; display: block; background: #000; }
.ob-card-ru { padding: 0 10px; font-weight: 600; font-size: 13px; }
.ob-card-cam { padding: 0 10px; font-size: 12px; color: var(--text-3); }
.pm-layer { position: absolute; right: 14px; margin-top: 10px; z-index: 2; }
.pm-video { position: relative; }

.mat-bar { display: flex; height: 18px; border-radius: 3px; overflow: hidden; gap: 2px; background: var(--inset); }
.mat-bar i { display: block; height: 100%; min-width: 2px; }
.mat-legend { display: grid; gap: 6px; margin-top: 10px; font-size: 13px; }
.mat-legend span { display: flex; align-items: center; gap: 8px; color: var(--text-2); }
.mat-legend b { margin-left: auto; color: var(--text); }
.mat-legend i { width: 10px; height: 10px; border-radius: 2px; display: inline-block; }
