:root {
  --bg: #000;
  --tile-bg: #0b0c0e;
  --fg: #e9eaec;
  --muted: #a3a8b0;
  --accent: #3d8bff;
  --warn-bg: #5a3b00;
  --warn-fg: #ffd58a;
  --err: #ff7a7a;
  --gap: 2px;
  --panel: rgba(20, 22, 26, 0.82);
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; background: var(--bg); color: var(--fg); }
body { font: 14px/1.35 -apple-system, BlinkMacSystemFont, "Segoe UI", system-ui, sans-serif; overflow: hidden; }
button { font: inherit; }

/* --- сетка --- */
.wall {
  display: grid;
  gap: var(--gap);
  width: 100vw;
  height: 100vh;
  height: 100dvh;
  background: var(--bg);
}
.tile {
  position: relative;
  min-width: 0;
  min-height: 0;
  overflow: hidden;
  background: var(--tile-bg);
  cursor: pointer;
  user-select: none;
  -webkit-user-select: none;
}
/* слой видео и рамок; при зуме колесом масштабируется целиком (tile-zoom.js), --k = текущий масштаб */
.tile .view { position: absolute; inset: 0; --k: 1; }
.tile video { display: block; width: 100%; height: 100%; background: #000; pointer-events: none; }
.tile video.fit-fill { object-fit: fill; }
.tile video.fit-contain { object-fit: contain; }
.tile:hover { outline: 2px solid var(--accent); outline-offset: -2px; }
.tile.waiting video { filter: brightness(0.45); }
.label {
  position: absolute;
  left: 6px;
  bottom: 6px;
  max-width: calc(100% - 12px);
  padding: 2px 7px;
  border-radius: 3px;
  background: rgba(0, 0, 0, 0.55);
  color: var(--fg);
  font-size: 12px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  pointer-events: none;
}
/* присутствие: «👤 ≈N» в углу и рамки пятен движения */
.people {
  position: absolute;
  left: 6px;
  top: 6px;
  padding: 2px 7px;
  border-radius: 3px;
  background: rgba(0, 0, 0, 0.55);
  color: var(--fg);
  font-size: 12px;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
  pointer-events: none;
}
.people.dim { color: var(--muted); }
/* текущий зум колесом в правом нижнем углу */
.zoom {
  position: absolute;
  right: 6px;
  bottom: 6px;
  padding: 2px 7px;
  border-radius: 3px;
  background: rgba(0, 0, 0, 0.55);
  color: var(--fg);
  font-size: 12px;
  font-variant-numeric: tabular-nums;
  pointer-events: none;
}
.tile.big .zoom { right: 10px; bottom: 10px; font-size: 16px; }
.tile.zoomed { cursor: grab; }
.tile.zoomed.dragging { cursor: grabbing; }
.focus .tile.zoomed { cursor: grab; }
.tile.big .people { left: 10px; top: 10px; font-size: 16px; }
.blob {
  position: absolute;
  border: calc(2px / var(--k, 1)) solid rgba(255, 82, 82, 0.9);
  border-radius: 2px;
  box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.45);
  pointer-events: none;
}
/* рамка человека от модели (camwall-detector) */
.person {
  position: absolute;
  border: calc(2px / var(--k, 1)) solid rgba(80, 230, 120, 0.95);
  border-radius: 3px;
  box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.5), inset 0 0 0 1px rgba(0, 0, 0, 0.25);
  pointer-events: none;
}
.overlay {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 12px;
  text-align: center;
  color: var(--muted);
  pointer-events: none;
}
.overlay span { padding: 6px 10px; border-radius: 4px; background: rgba(0, 0, 0, 0.6); }
.boot { display: flex; height: 100vh; align-items: center; justify-content: center; color: var(--muted); }

/* --- раскрытая камера --- */
.focus { position: fixed; inset: 0; z-index: 10; display: flex; flex-direction: column; background: var(--bg); }
.focus .tile { flex: 1; cursor: zoom-out; }
.focus .tile:hover { outline: none; }
.focus .tile .label { display: none; }
.focus-bar {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 6px 10px;
  background: var(--panel);
  font-size: 13px;
}
.focus-title { font-weight: 600; }
.note { flex: 1; color: var(--warn-fg); }
.note.dim { color: var(--muted); }
.focus-bar button {
  border: 0;
  border-radius: 4px;
  background: rgba(255, 255, 255, 0.1);
  color: var(--fg);
  cursor: pointer;
  padding: 4px 10px;
}
.focus-bar button:hover { background: rgba(255, 255, 255, 0.2); }
.focus-bar .nav { font-size: 18px; line-height: 1; padding: 2px 10px 4px; }
.focus-bar button.link { background: none; color: var(--accent); padding: 0 4px; text-decoration: underline; }

/* --- кнопки в углу --- */
.toolbar {
  position: fixed;
  top: 8px;
  right: 8px;
  z-index: 5;
  display: flex;
  gap: 6px;
  opacity: 0;
  transition: opacity 0.25s;
  pointer-events: none;
}
.toolbar.shown { opacity: 1; pointer-events: auto; }
.toolbar .load { align-self: center; padding: 5px 10px; border-radius: 4px; background: var(--panel); color: var(--muted); font-size: 12px; white-space: nowrap; }
.toolbar button {
  border: 0;
  border-radius: 4px;
  padding: 5px 10px;
  background: var(--panel);
  color: var(--fg);
  cursor: pointer;
  font-size: 12px;
}
.toolbar button:hover { background: rgba(61, 139, 255, 0.85); }
.toolbar button.accent { background: #fc3f1d; }

.banner {
  position: fixed;
  left: 50%;
  bottom: 12px;
  z-index: 20;
  transform: translateX(-50%);
  max-width: calc(100vw - 32px);
  padding: 8px 14px;
  border-radius: 6px;
  background: var(--warn-bg);
  color: var(--warn-fg);
  font-size: 13px;
  text-align: center;
}

/* --- вход --- */
.login {
  width: min(340px, calc(100vw - 32px));
  margin: 18vh auto 0;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.login h1 { margin: 0; font-size: 22px; }
.login .hint { margin: 0 0 8px; color: var(--muted); }
.login label { color: var(--muted); font-size: 13px; }
.login input {
  padding: 10px 12px;
  border: 1px solid #2c3038;
  border-radius: 6px;
  background: #121418;
  color: var(--fg);
  font-size: 16px;
}
.login input:focus { outline: 2px solid var(--accent); border-color: transparent; }
.login button {
  padding: 10px 12px;
  border: 0;
  border-radius: 6px;
  background: var(--accent);
  color: #fff;
  font-size: 15px;
  cursor: pointer;
}
.login button:disabled { opacity: 0.5; cursor: default; }
.login .err { margin: 4px 0 0; color: var(--err); }

@media (max-width: 600px) {
  .label { font-size: 10px; left: 3px; bottom: 3px; padding: 1px 4px; }
  .people { font-size: 10px; left: 3px; top: 3px; padding: 1px 4px; }
  .toolbar { top: 4px; right: 4px; }
  .note { display: none; }
  .toolbar .load { display: none; }
}

/* --- вход через Яндекс --- */
.login button.yandex, .login a.yandex {
  display: block;
  padding: 11px 12px;
  border: 0;
  border-radius: 6px;
  background: #fc3f1d;
  color: #fff;
  font-size: 15px;
  text-align: center;
  text-decoration: none;
  cursor: pointer;
}
.login button.yandex:disabled { opacity: 0.5; cursor: default; }
.login button.link {
  align-self: flex-start;
  padding: 0;
  background: none;
  color: var(--accent);
  font-size: 13px;
  text-decoration: underline;
}
.login .key-form { display: flex; flex-direction: column; gap: 10px; margin-top: 6px; }
.login .small { font-size: 12px; }
.login .code-step p { margin: 4px 0; }
.login .code {
  padding: 10px 0;
  font: 600 32px/1.1 ui-monospace, SFMono-Regular, Menlo, monospace;
  letter-spacing: 0.12em;
  text-align: center;
  background: #121418;
  border-radius: 6px;
}

/* --- моя раскладка --- */
.toolbar .who { align-self: center; padding: 5px 10px; border-radius: 4px; background: var(--panel); color: var(--fg); font-size: 12px; white-space: nowrap; }
.modal {
  position: fixed;
  inset: 0;
  z-index: 30;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  background: rgba(0, 0, 0, 0.6);
}
.panel {
  width: min(560px, 100%);
  max-height: calc(100vh - 32px);
  overflow: auto;
  padding: 16px 18px;
  border-radius: 8px;
  background: #15171b;
  color: var(--fg);
}
.panel h2 { margin: 0 0 12px; font-size: 18px; }
.panel h3 { margin: 14px 0 6px; font-size: 13px; color: var(--muted); font-weight: 600; }
.panel .row { display: flex; align-items: center; gap: 10px; }
.panel select { padding: 4px 8px; border-radius: 4px; background: #121418; color: var(--fg); border: 1px solid #2c3038; }
.panel button {
  padding: 4px 10px;
  border: 0;
  border-radius: 4px;
  background: rgba(255, 255, 255, 0.1);
  color: var(--fg);
  cursor: pointer;
}
.panel button:disabled { opacity: 0.35; cursor: default; }
.panel button.primary { background: var(--accent); color: #fff; }
.cam-list, .cam-add { margin: 0; padding: 0; list-style: none; }
.cam-list li, .cam-add li { display: flex; align-items: center; gap: 6px; padding: 4px 0; border-bottom: 1px solid #23262c; }
.cam-list { counter-reset: cam; }
.cam-list li::before { counter-increment: cam; content: counter(cam); width: 20px; color: var(--muted); font-size: 12px; }
.cam-list .name { flex: 1; }
.cam-add .dim, .panel .dim { color: var(--muted); font-size: 12px; }
.panel .actions { display: flex; gap: 8px; margin-top: 14px; }
.panel .spacer { flex: 1; }
.panel .err { color: var(--err); }

/* --- разметка «сотрудник / посторонний» (только владелец) --- */
.person.labelable {
  pointer-events: auto;
  cursor: pointer;
  border-color: rgba(255, 212, 0, 0.95);
}
.person.labelable:hover { background: rgba(255, 212, 0, 0.15); }
.label-panel { width: min(460px, 100%); }
.label-panel h2 .dim { font-size: 13px; font-weight: 400; }
.label-panel .crop {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 200px;
  margin-bottom: 4px;
  border-radius: 6px;
  background: #0b0c0e;
}
.label-panel .crop img { height: min(52vh, 420px); max-width: 100%; object-fit: contain; }
.label-panel .actions { flex-wrap: wrap; }
.label-panel .dim { margin-top: 8px; }
.label-toast {
  position: fixed;
  left: 50%;
  bottom: 24px;
  z-index: 40;
  transform: translateX(-50%);
  padding: 8px 14px;
  border-radius: 6px;
  background: var(--panel);
  color: var(--fg);
  font-size: 13px;
}

/* --- сотрудник / посторонний по форме --- */
.person.u-o { border-color: rgba(255, 150, 30, 0.98); }
.person.u-q { border-color: rgba(220, 220, 220, 0.85); border-style: dashed; }
.person .tag {
  position: absolute;
  left: 0;
  bottom: 100%;
  padding: 0 calc(3px / var(--k, 1));
  border-radius: calc(2px / var(--k, 1));
  font-size: calc(10px / var(--k, 1));
  line-height: 1.4;
  white-space: nowrap;
  color: #000;
  background: rgba(80, 230, 120, 0.95);
}
.person.u-o .tag { background: rgba(255, 150, 30, 0.98); }
.person.u-q .tag { background: rgba(220, 220, 220, 0.9); }
.tile.big .person .tag { font-size: calc(13px / var(--k, 1)); }
.people.warn { color: #ffb347; }
/* движение без рамки человека — возможно, человек, которого модель не видит */
.blob.extra { border-style: dashed; }

/* --- зоны на камерах и инциденты (2026-11-08) --- */
.zones { position: absolute; overflow: visible; pointer-events: none; }
.zones polygon { fill: none; stroke-width: 2px; stroke-opacity: 0.85; }
.zones polygon.zt-staff_only, .zone-editor polygon.zt-staff_only { stroke: #ff5a5a; }
.zones polygon.zt-service, .zone-editor polygon.zt-service { stroke: #ffa53d; }
.zones polygon.zt-work, .zone-editor polygon.zt-work { stroke: #4da3ff; }
.zones polygon.zt-smoke, .zone-editor polygon.zt-smoke { stroke: #b0b0b0; stroke-dasharray: 6 4; }
.zones polygon.zt-state, .zone-editor polygon.zt-state { stroke: #b48cff; stroke-dasharray: 2 3; }
.zones polygon.lv-warn { fill: rgba(255, 212, 0, 0.16); stroke: #ffd400; }
.zones polygon.lv-alarm { fill: rgba(255, 40, 40, 0.22); stroke: #ff2b2b; animation: zone-pulse 1s ease-in-out infinite alternate; }
@keyframes zone-pulse { from { fill-opacity: 0.25; } to { fill-opacity: 1; } }
.zone-label {
  position: absolute;
  transform: translateY(-100%);
  padding: 0 calc(4px / var(--k, 1));
  border-radius: calc(2px / var(--k, 1));
  font-size: calc(10px / var(--k, 1));
  line-height: 1.5;
  white-space: nowrap;
  color: #fff;
  background: rgba(0, 0, 0, 0.55);
  pointer-events: none;
}
.tile.big .zone-label { font-size: calc(13px / var(--k, 1)); }
.zone-label.lv-alarm { background: rgba(220, 0, 0, 0.85); }
.zone-label.lv-warn { background: rgba(150, 120, 0, 0.85); }
.incident {
  position: absolute;
  z-index: 3;
  left: 6px;
  bottom: 6px;
  max-width: calc(100% - 12px);
  padding: 3px 8px;
  border-radius: 4px;
  font-size: 12px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  color: #fff;
  pointer-events: none;
}
.incident.alarm { background: rgba(210, 0, 0, 0.9); }
.incident.warn { background: rgba(140, 110, 0, 0.9); }
.tile.big .incident { font-size: 15px; bottom: 12px; left: 12px; }
.zone-editor { position: fixed; inset: 0; z-index: 25; pointer-events: none; }
.zone-surface { position: fixed; pointer-events: auto; cursor: crosshair; }
.zone-surface svg { position: absolute; inset: 0; width: 100%; height: 100%; overflow: visible; }
.zone-editor polygon { fill: rgba(255, 255, 255, 0.06); stroke-width: 2px; }
.zone-editor polygon.faded { opacity: 0.3; }
.zone-editor polyline.drawing { fill: none; stroke: #ffd400; stroke-width: 2px; stroke-dasharray: 5 3; }
.zone-pt { position: absolute; width: 10px; height: 10px; margin: -5px 0 0 -5px; border-radius: 50%; background: #ffd400; box-shadow: 0 0 0 1px #000; }
.zone-pt.first { width: 14px; height: 14px; margin: -7px 0 0 -7px; background: #fff; }
.zone-panel { position: fixed; top: 12px; right: 12px; width: min(330px, calc(100% - 24px)); pointer-events: auto; }
.zone-panel .field { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin: 6px 0; }
.zone-panel .field input, .zone-panel .field select { width: 170px; padding: 4px 6px; border-radius: 4px; background: #121418; color: var(--fg); border: 1px solid #2c3038; }
.zone-panel .check { display: flex; align-items: center; gap: 6px; margin: 6px 0; }
.zone-list { margin: 0; padding: 0; list-style: none; }
.zone-list li { display: flex; align-items: center; gap: 6px; padding: 4px 0; border-bottom: 1px solid #23262c; }
.zone-list .name { flex: 1; }
.zone-list .swatch { width: 10px; height: 10px; border-radius: 2px; border: 2px solid #888; }
.zone-list .swatch.zt-staff_only { border-color: #ff5a5a; }
.zone-list .swatch.zt-service { border-color: #ffa53d; }
.zone-list .swatch.zt-work { border-color: #4da3ff; }
.zone-list .swatch.zt-smoke { border-color: #b0b0b0; }
.zone-list .swatch.zt-state { border-color: #b48cff; }

/* --- настройки камеры и общие настройки зон --- */
.defaults-panel { width: min(760px, 100%); }
.camera-settings { width: min(520px, 100%); }
.camera-settings .field { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin: 8px 0; }
.camera-settings .field input, .camera-settings .field select { width: 260px; padding: 4px 6px; border-radius: 4px; background: #121418; color: var(--fg); border: 1px solid #2c3038; }
.zone-list input.zone-name { flex: 1; min-width: 0; padding: 3px 6px; border-radius: 4px; background: #121418; color: var(--fg); border: 1px solid #2c3038; }
.cam-table { width: 100%; border-collapse: collapse; margin: 4px 0 10px; }
.cam-table th { text-align: left; font-weight: 600; font-size: 12px; color: var(--muted); padding: 4px 6px; border-bottom: 1px solid #23262c; }
.cam-table td { padding: 3px 6px; border-bottom: 1px solid #1d2026; }
.cam-table input:not([type="checkbox"]), .cam-table select { width: 100%; padding: 3px 6px; border-radius: 4px; background: #121418; color: var(--fg); border: 1px solid #2c3038; }
.cam-table input.num { width: 72px; }
.cam-table input.hours { width: 110px; }

/* --- режим настройки: перетаскивание камер, клик — настройки --- */
.tile.setup { cursor: grab; outline: 2px dashed rgba(61, 139, 255, 0.7); outline-offset: -2px; }
.tile.drop-target { outline: 3px solid #3d8bff; outline-offset: -3px; }
.setup-overlay {
  position: absolute;
  inset: 0;
  z-index: 4;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  background: rgba(0, 0, 0, 0.35);
  color: #fff;
  text-align: center;
  pointer-events: none;
}
.setup-overlay .name { font-size: 15px; font-weight: 600; }
.setup-overlay .hint { font-size: 11px; color: #d6d9de; }

/* --- панель «События» и просмотр события (2026-11-08) --- */
.wall.with-events { width: calc(100vw - 380px); }
.events-panel {
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  z-index: 8;
  width: 380px;
  display: flex;
  flex-direction: column;
  background: #121418;
  border-left: 1px solid #23262c;
}
.events-panel header { display: flex; align-items: center; justify-content: space-between; padding: 10px 12px 6px; }
.events-panel h2 { margin: 0; font-size: 16px; }
.events-panel header button { border: 0; background: none; color: var(--muted); font-size: 16px; cursor: pointer; }
.events-panel .filters { display: flex; flex-wrap: wrap; gap: 6px; padding: 0 12px 8px; font-size: 12px; align-items: center; }
.events-panel .filters select { padding: 3px 6px; border-radius: 4px; background: #1a1d22; color: var(--fg); border: 1px solid #2c3038; }
.events-list { flex: 1; overflow: auto; margin: 0; padding: 0 8px 12px; list-style: none; }
.events-list li { padding: 7px 8px; margin-bottom: 4px; border-radius: 5px; background: #181b20; border-left: 3px solid #8a7300; cursor: pointer; }
.events-list li.alarm { border-left-color: #e02020; }
.events-list li.going { background: #2a1416; }
.events-list li.picked { outline: 1px solid var(--accent); }
.events-list li:hover { background: #1f2329; }
.events-list .row1 { display: flex; gap: 8px; font-size: 12px; }
.events-list .time { font-variant-numeric: tabular-nums; color: var(--fg); font-weight: 600; }
.events-list .cam { color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.events-list .row2 { font-size: 13px; margin-top: 2px; }
.events-list .row3 { font-size: 11px; margin-top: 2px; }
.events-panel .empty { padding: 12px; }
.replay-panel { width: min(980px, 100%); }
.replay-stage { display: flex; flex-direction: column; align-items: center; gap: 8px; }
.replay-frame { position: relative; display: inline-block; line-height: 0; }
.replay-frame img { max-width: 100%; max-height: 62vh; }
.replay-frame svg { position: absolute; inset: 0; width: 100%; height: 100%; }
.replay-frame polygon.zone { fill: rgba(255, 40, 40, 0.08); stroke: #ff5a5a; stroke-width: 2px; }
.replay-frame rect { fill: none; stroke-width: 2px; }
.replay-frame rect.u-e { stroke: rgba(80, 230, 120, 0.95); }
.replay-frame rect.u-o { stroke: rgba(255, 150, 30, 0.98); }
.replay-frame rect.u-q { stroke: rgba(220, 220, 220, 0.9); stroke-dasharray: 4 3; }
.replay-controls { display: flex; align-items: center; gap: 8px; width: 100%; }
.replay-controls input[type="range"] { flex: 1; }
.replay-controls button { padding: 3px 10px; border: 0; border-radius: 4px; background: rgba(255, 255, 255, 0.1); color: var(--fg); cursor: pointer; }
@media (max-width: 900px) { .wall.with-events { width: 100vw; } .events-panel { width: 100vw; } }

/* --- библиотека людей (2026-11-08) --- */
.library-panel { width: min(1200px, 100%); height: calc(100vh - 32px); display: flex; flex-direction: column; }
.lib-head { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.lib-head h2 { margin: 0; }
.lib-head select { padding: 3px 6px; border-radius: 4px; background: #121418; color: var(--fg); border: 1px solid #2c3038; }
.lib-head button { border: 0; background: none; color: var(--muted); font-size: 16px; cursor: pointer; }
.lib-grid { flex: 1; overflow: auto; display: grid; grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); gap: 8px; padding: 8px 2px; align-content: start; }
.lib-item { position: relative; padding: 4px; border-radius: 6px; background: #0b0c0e; border: 2px solid transparent; cursor: pointer; }
.lib-item img { width: 100%; height: 190px; object-fit: contain; display: block; background: #000; }
.lib-item.focused { border-color: #6b7280; }
.lib-item.selected { border-color: #3d8bff; background: #12233d; }
.lib-meta { font-size: 11px; line-height: 1.4; margin-top: 3px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.lib-meta .guess { padding: 0 4px; border-radius: 3px; background: #333; color: #fff; }
.lib-meta .guess.g-e { background: rgba(80, 230, 120, 0.9); color: #000; }
.lib-meta .guess.g-o { background: rgba(255, 150, 30, 0.95); color: #000; }
.lib-actions { flex-wrap: wrap; }
/* --- состояния зон (2026-11-08) --- */
.state-body { flex: 1; min-height: 0; display: flex; gap: 12px; }
.state-now { width: 320px; flex: none; display: flex; flex-direction: column; gap: 8px; overflow: auto; padding-top: 8px; }
.state-now img { width: 100%; max-height: 260px; object-fit: contain; background: #000; border-radius: 4px; }
.state-status { font-size: 13px; }
.state-now-buttons { display: flex; flex-wrap: wrap; gap: 6px; }
.state-now-buttons button.bad { border-color: #a35; }
.state-library .lib-item img { height: 150px; }
.lib-more { grid-column: 1 / -1; justify-self: center; }
.state-empty { padding: 16px 4px; max-width: 70ch; line-height: 1.5; }
.state-defs { display: flex; flex-direction: column; gap: 6px; }
.state-table { border-collapse: collapse; font-size: 13px; }
.state-table th { text-align: left; font-weight: normal; color: var(--muted); padding: 2px 4px; }
.state-table td { padding: 2px 4px; }
.state-table input { width: 150px; }
@media (max-width: 760px) { .state-body { flex-direction: column; } .state-now { width: 100%; } .state-table input { width: 110px; } }
/* --- график рабочей зоны --- */
.schedule-modal { z-index: 40; }
.schedule-panel { width: min(1000px, 100%); }
.brushes { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; margin: 8px 0; font-size: 12px; }
.brushes button.active { outline: 2px solid var(--accent); }
.brushes input { width: 90px; padding: 3px 6px; border-radius: 4px; background: #121418; color: var(--fg); border: 1px solid #2c3038; }
table.schedule { border-collapse: collapse; user-select: none; font-size: 11px; width: 100%; }
table.schedule th { color: var(--muted); font-weight: 500; padding: 2px; }
table.schedule td { width: 3.8%; height: 24px; text-align: center; border: 1px solid #23262c; cursor: crosshair; }
table.schedule td.off { background: #0f1114; color: transparent; }
table.schedule td.strict { background: #6b1d1d; }
table.schedule td.mid { background: #6b4d12; }
table.schedule td.loose { background: #1f4a2c; }
.zone-panel:has(.state-defs) { width: min(480px, calc(100% - 24px)); max-height: calc(100vh - 24px); overflow: auto; }
.state-table input, .state-table select { padding: 3px 5px; border-radius: 4px; background: #121418; color: var(--fg); border: 1px solid #2c3038; }

/* --- зона «Норма людей» (склад, 2026-11-14): среднее, секундомер ниже нормы, сумма за день --- */
.zones polygon.zt-norm, .zone-editor polygon.zt-norm { stroke: #3ddc97; stroke-dasharray: 8 4; }
.zones polygon.zt-norm.lv-warn { fill: none; stroke: #ffd400; stroke-width: 3px; }
.zone-list .swatch.zt-norm { border-color: #3ddc97; }
.norm-line {
  position: absolute;
  z-index: 3;
  left: 6px;
  bottom: 6px;
  max-width: calc(100% - 12px);
  padding: 3px 8px;
  border-radius: 4px;
  font-size: 12px;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  color: #fff;
  pointer-events: none;
}
.norm-line.ok { background: rgba(0, 0, 0, 0.55); }
.norm-line.warn { background: rgba(140, 110, 0, 0.92); }
.norm-line.above { bottom: 32px; }
.tile.big .norm-line { font-size: 15px; bottom: 12px; left: 12px; }
.tile.big .norm-line.above { bottom: 44px; }
