:root {
  --bg: #0d1015;
  --panel: #151920;
  --panel-2: #1a1f28;
  --panel-3: #202632;
  --line: #282f3b;
  --line-2: #343d4b;
  --text: #e9edf5;
  --muted: #8c96a8;
  --faint: #5e6878;
  --blue: #438cf6;
  --green: #33d39b;
  --amber: #f4b64b;
  --red: #ff6173;
  --radius: 9px;
  /* Деньги: тёплый оранжевый — не путается ни с зелёной «нормой», ни с красным сигналом. */
  --money: #ff9f45;
  /* Комментарий человека: фиолетовый не спорит ни с сигналами, ни с деньгами, ни с синим «активным». */
  --note: #b995ff;
}

.money { color: var(--money); font-weight: 700; font-variant-numeric: tabular-nums; white-space: nowrap; }

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { height: 100%; margin: 0; }
body {
  background: var(--bg);
  color: var(--text);
  font: 13px/1.45 Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-variant-numeric: tabular-nums;
}
button, input, select { font: inherit; color: inherit; }
button { cursor: pointer; }
button:disabled { cursor: not-allowed; opacity: .48; }

.eyebrow {
  margin: 0 0 7px;
  color: var(--blue);
  font-size: 10px;
  font-weight: 800;
  letter-spacing: .14em;
}

.logo-mark {
  width: 19px;
  height: 19px;
  display: inline-block;
  border-radius: 5px;
  background: linear-gradient(145deg, #438cf6, #32d6c2);
  box-shadow: 0 0 24px rgba(67, 140, 246, .22);
}

/* Login */
.login-view {
  min-height: 100%;
  display: grid;
  place-items: center;
  padding: 24px;
  background:
    radial-gradient(circle at 73% 0%, rgba(55, 111, 203, .2), transparent 33rem),
    linear-gradient(145deg, #0a0d12, #10151d 60%, #0a0d12);
}
.login-card {
  width: min(420px, 100%);
  padding: 34px;
  border: 1px solid var(--line);
  border-radius: 17px;
  background: rgba(21, 25, 32, .96);
  box-shadow: 0 30px 90px rgba(0, 0, 0, .44);
}
.login-brand { display: flex; align-items: center; gap: 10px; margin-bottom: 38px; font-size: 15px; font-weight: 750; }
.login-card h1 { margin: 0 0 10px; font-size: 30px; letter-spacing: -.04em; }
.login-copy { margin: 0 0 27px; color: var(--muted); }
.login-card form, dialog form { display: grid; gap: 15px; }
label { display: grid; gap: 6px; color: var(--muted); font-size: 12px; }
input {
  width: 100%;
  height: 43px;
  border: 1px solid var(--line-2);
  border-radius: 8px;
  outline: none;
  padding: 0 12px;
  background: #10141a;
}
input:focus { border-color: var(--blue); box-shadow: 0 0 0 3px rgba(67, 140, 246, .13); }
.primary, .secondary, .subtle, .logout {
  min-height: 36px;
  border: 1px solid var(--line-2);
  border-radius: 7px;
  padding: 7px 13px;
  background: var(--panel-2);
}
.primary { border-color: #316eba; background: #17375d; }
.primary:hover { background: #1c4779; }
.secondary:hover, .subtle:hover, .logout:hover { border-color: var(--blue); }
.login-card .primary { height: 44px; margin-top: 4px; }
.form-error { margin: -3px 0 0; color: var(--red); font-size: 12px; }
.secure-note { margin-top: 24px; padding-top: 18px; border-top: 1px solid var(--line); color: var(--faint); font-size: 11px; }
.secure-note span { display: inline-block; width: 7px; height: 7px; margin-right: 7px; border-radius: 50%; background: var(--green); }

/* Shell */
.app-shell { height: 100%; display: flex; flex-direction: column; overflow: hidden; }
.mobile-menu-button, .mobile-drawer-head { display: none; }
.mobile-overlay {
  position: fixed;
  z-index: 75;
  inset: 0;
  border: 0;
  padding: 0;
  background: rgba(3, 6, 10, .72);
  backdrop-filter: blur(3px);
}
.topbar {
  height: 54px;
  flex: none;
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 0 13px;
  border-bottom: 1px solid var(--line);
  background: var(--panel);
}
/* Разделы стоят ровно по центру шапки: левая и правая группы занимают равные
   доли, поэтому кнопки не съезжают от длины имени объекта или пользователя. */
.top-left, .top-right { display: flex; align-items: center; gap: 11px; flex: 1 1 0; min-width: 0; }
.top-right { justify-content: flex-end; }
.brand { display: flex; align-items: center; gap: 8px; margin-right: 8px; }
.brand small { margin-left: -3px; color: var(--faint); font-size: 10px; }
#siteSelect {
  min-width: 130px;
  border: 1px solid var(--line-2);
  border-radius: 7px;
  outline: none;
  padding: 6px 30px 6px 9px;
  background: var(--panel-2);
}
#modes { display: flex; flex: none; gap: 3px; padding: 3px; border: 1px solid var(--line-2); border-radius: 9px; background: var(--panel-2); }
#modes button { border: 0; border-radius: 6px; padding: 7px 18px; color: var(--muted); background: transparent;
  font-size: 13px; font-weight: 600; letter-spacing: .01em; white-space: nowrap; }
#modes button:hover { color: var(--text); }
#modes button.on { color: var(--text); background: var(--panel-3); box-shadow: inset 0 0 0 1px rgba(255,255,255,.07); }
.top-spacer { flex: 1; }
.live-state { display: flex; align-items: center; gap: 7px; color: var(--muted); font-size: 11px; }
.live-state i { width: 7px; height: 7px; border-radius: 50%; background: var(--green); box-shadow: 0 0 0 4px rgba(51, 211, 155, .08); }
.live-state.bad i { background: var(--red); }
.user-block { display: grid; margin-left: 12px; text-align: right; line-height: 1.15; }
.user-block span { font-size: 12px; }
.user-block small { color: var(--faint); font-size: 10px; }
.logout { min-height: 29px; padding: 4px 10px; color: var(--muted); font-size: 11px; }

.workspace {
  flex: 1;
  min-height: 0;
  display: grid;
  grid-template-columns: 320px minmax(620px, 1fr);
  gap: 1px;
  background: var(--line);
}
.left-panel, .center-panel { min-height: 0; background: var(--panel); }
.left-panel { display: flex; flex-direction: column; }
.center-panel { display: flex; flex-direction: column; overflow-y: auto; }
.control-stack { flex: none; background: var(--panel); }
.section-label {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 9px 12px 6px;
  color: var(--faint);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: .09em;
  text-transform: uppercase;
}
.section-label b { display: grid; min-width: 18px; height: 18px; place-items: center; border-radius: 10px; background: var(--panel-3); font-size: 9px; }
/* Левая колонка: карточка поста и заголовок фиксированы, список сессий листается
   внутри блока поста на всю оставшуюся высоту. */
#postList { flex: 1 1 0; min-height: 0; display: flex; flex-direction: column; }
#postList .post-card, #postList .visit-heading { flex: none; }
.post-card {
  width: 100%;
  min-height: 72px;
  display: grid;
  grid-template-columns: 3px 1fr auto;
  align-items: center;
  gap: 11px;
  border: 0;
  padding: 10px 11px 10px 0;
  text-align: left;
  background: var(--panel-3);
}
.post-marker { align-self: stretch; border-radius: 0 2px 2px 0; background: var(--blue); }
.post-copy, .post-health { display: grid; }
.post-copy strong { font-size: 15px; }
.post-copy small, .post-health small { color: var(--muted); font-size: 11px; }
.post-health { justify-items: end; }
.post-health b { color: var(--green); font-size: 11px; }
.post-health b.warn { color: var(--amber); }
.incident-empty { padding: 34px 24px; text-align: center; color: var(--faint); }
.incident-empty i { display: block; width: 9px; height: 9px; margin: 0 auto 12px; border-radius: 50%; background: var(--green); }
.incident-empty strong, .incident-empty span { display: block; }
.incident-empty strong { color: var(--muted); font-size: 12px; }
.incident-empty span { margin-top: 5px; font-size: 11px; }
.incident-card {
  width: 100%;
  display: grid;
  gap: 3px;
  border: 0;
  border-bottom: 1px solid var(--line);
  border-left: 3px solid var(--amber);
  padding: 10px 12px;
  text-align: left;
  background: transparent;
}
.incident-card:hover { background: var(--panel-2); }
.incident-card.severity-critical { border-left-color: var(--red); }
.incident-card.severity-info { border-left-color: var(--blue); }
.incident-card .incident-time, .incident-card small { color: var(--faint); font-size: 10px; }
.incident-card strong { font-size: 12px; }

/* Cameras */
.camera-grid { display: grid; gap: 2px; padding: 0 2px; background: #080a0d; }
.camera-grid.overview { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.camera-grid.focus { grid-template-columns: minmax(0, 1fr); }
.camera-card {
  position: relative;
  min-width: 0;
  aspect-ratio: 16 / 9;
  overflow: hidden;
  border: 0;
  padding: 0;
  text-align: left;
  background: #080a0d;
}
.camera-grid.focus .camera-card { max-height: 58vh; }
.camera-visual, .camera-visual img, .camera-visual video, .camera-fallback { position: absolute; inset: 0; }
.camera-visual img, .camera-visual video { width: 100%; height: 100%; object-fit: cover; opacity: 0; transition: opacity .15s; }
.camera-visual.loaded img { opacity: 1; }
.camera-visual.loaded video { opacity: 1; }
.camera-fallback {
  display: grid;
  place-items: center;
  color: var(--faint);
  background: repeating-linear-gradient(45deg, #0e1218, #0e1218 10px, #11161d 10px, #11161d 20px);
  font-size: 11px;
}
.camera-visual.loaded .camera-fallback { display: none; }
/* Кадр раскадровки под ползунком: показывается мгновенно, пока видео
   подтягивает нужную секунду, и гаснет, как только оно её показало. */
.camera-visual .scrub-frame {
  position: absolute;
  inset: 0;
  z-index: 1;
  background-repeat: no-repeat;
  background-color: #080a0d;
  opacity: 0;
  transition: opacity .12s;
  pointer-events: none;
}
.camera-visual.scrubbing .scrub-frame { opacity: 1; }
.camera-visual.scrubbing .camera-fallback { display: none; }
.camera-visual.cold .camera-fallback { color: var(--amber); }
.camera-label, .camera-meta { position: absolute; z-index: 2; display: flex; align-items: center; }
.camera-label { top: 0; left: 0; gap: 8px; padding: 5px 8px; background: rgba(0, 0, 0, .72); }
.camera-label b { font-size: 11px; }
.camera-label i { color: var(--green); font-size: 9px; font-style: normal; text-transform: uppercase; }
.state-degraded .camera-label i { color: var(--amber); }
.state-offline .camera-label i { color: var(--red); }
.state-unknown .camera-label i { color: var(--faint); }
.camera-meta { right: 0; bottom: 0; left: 0; justify-content: space-between; padding: 18px 8px 5px; color: #d7dde8; font-size: 9px; background: linear-gradient(transparent, rgba(0, 0, 0, .78)); }
.camera-meta time { color: #aab3c1; }
.camera-card:hover::after { content: ''; position: absolute; z-index: 3; inset: 0; border: 1px solid var(--blue); pointer-events: none; }
.camera-toolbar { display: flex; align-items: center; gap: 6px; padding: 6px 12px; border-bottom: 1px solid var(--line); }
.camera-buttons { flex: 1; display: flex; gap: 5px; overflow-x: auto; scrollbar-width: none; }
.camera-buttons::-webkit-scrollbar { display: none; }
/* Кнопка камеры — ровная плитка с номером; точка состояния в углу, чтобы номер не
   переносился на вторую строку и не резался (так было при точке в потоке текста). */
.camera-buttons button {
  flex: none;
  min-width: 36px;
  height: 28px;
  padding: 0 9px 0 13px;
  border: 1px solid var(--line-2);
  border-radius: 7px;
  color: var(--muted);
  background: var(--panel-2);
  font-size: 11px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}
.camera-buttons button:hover { color: var(--text); border-color: var(--blue); }
.camera-buttons button::before { content: ''; position: absolute; top: 4px; left: 5px; width: 5px; height: 5px; border-radius: 50%; background: var(--green); }
.camera-buttons button.state-degraded::before { background: var(--amber); }
.camera-buttons button.state-offline::before { background: var(--red); }
.camera-buttons button.on { color: var(--text); border-color: var(--blue); background: #153354; }
.subtle { min-height: 27px; padding: 4px 10px; color: var(--muted); font-size: 10px; }
.live-button.on { color: var(--green); border-color: rgba(51, 211, 155, .45); background: rgba(51, 211, 155, .08); }
.transport, .rate-buttons button {
  height: 27px;
  flex: none;
  border: 1px solid var(--line-2);
  border-radius: 6px;
  padding: 0 9px;
  color: var(--muted);
  background: var(--panel-2);
  font-size: 10px;
}
.transport:hover, .rate-buttons button:hover { color: var(--text); border-color: var(--blue); }
.transport:disabled, .rate-buttons button:disabled { opacity: .35; }
#playbackPlay { width: 29px; padding: 0; color: var(--text); }
.rate-buttons { display: flex; gap: 2px; }
.rate-buttons button { padding: 0 7px; border-radius: 5px; }
.rate-buttons button.on { color: var(--text); border-color: var(--blue); background: #153354; }

/* Shared archive scrubber — ported from the finished multi-camera prototype. */
.playback-panel { padding: 10px 13px 9px; border-bottom: 1px solid var(--line); background: #12161d; }
.playback-head { display: flex; align-items: end; justify-content: space-between; gap: 14px; margin-bottom: 7px; }
.playback-head > div:first-child { display: grid; gap: 1px; }
.playback-head strong { font-size: 11px; }
.playback-head small { color: var(--faint); font-size: 9px; }
.playback-window { display: flex; align-items: center; gap: 7px; }
.playback-window label { display: inline; color: var(--faint); font-size: 9px; }
.playback-window select {
  height: 25px;
  border: 1px solid var(--line-2);
  border-radius: 5px;
  outline: none;
  padding: 0 22px 0 7px;
  color: var(--muted);
  background: var(--panel-2);
  font-size: 9px;
}
.playback-window time { min-width: 116px; color: var(--text); text-align: right; font-size: 11px; font-weight: 650; }
.playback-scrubber { position: relative; height: 20px; display: flex; align-items: center; }
.playback-scrubber::before {
  content: '';
  position: absolute;
  right: 0;
  left: 0;
  height: 7px;
  border-radius: 4px;
  background: linear-gradient(90deg, #253142, #35608f 78%, #2d865f);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .04);
}
/* Камера с заранее загруженным архивом: перемотка по ней мгновенная. */
/* Полоска снизу — у камеры уже загружен архив (мгновенный отклик при перемотке). */
.camera-buttons button.warm::after {
  content: '';
  position: absolute;
  left: 7px;
  right: 7px;
  bottom: 3px;
  height: 2px;
  border-radius: 1px;
  background: #4ebe8a;
  box-shadow: 0 0 4px rgba(78, 190, 138, .7);
}
.camera-buttons button { position: relative; }

/* Прогретый участок архива: открывается мгновенно, без ожидания регистратора. */
/* Контейнер растянут на всю шкалу и прозрачен; прогретое лежит островами,
   и каждый остров рисуется отдельной полосой внутри него. */
#playbackWarmBand {
  position: absolute;
  z-index: 1;
  left: 0;
  right: 0;
  height: 7px;
  pointer-events: none;
}
#playbackWarmBand > i {
  position: absolute;
  top: 0;
  height: 100%;
  border-radius: 4px;
  background: linear-gradient(90deg, rgba(45, 134, 95, .85), rgba(78, 190, 138, .95));
  box-shadow: 0 0 8px rgba(78, 190, 138, .35);
}
#playbackWarmBand.partial { opacity: .3; }
#playbackSlider {
  position: relative;
  z-index: 2;
  width: 100%;
  height: 20px;
  margin: 0;
  border: 0;
  padding: 0;
  appearance: none;
  background: transparent;
  box-shadow: none;
  cursor: ew-resize;
}
#playbackSlider::-webkit-slider-runnable-track { height: 7px; background: transparent; }
#playbackSlider::-webkit-slider-thumb {
  width: 4px;
  height: 19px;
  margin-top: -6px;
  appearance: none;
  border: 0;
  border-radius: 2px;
  background: #f4f7fb;
  box-shadow: 0 0 0 1px #0d1015, 0 0 9px rgba(67, 140, 246, .8);
}
#playbackSlider::-moz-range-track { height: 7px; border: 0; border-radius: 4px; background: transparent; }
#playbackSlider::-moz-range-thumb { width: 4px; height: 19px; border: 0; border-radius: 2px; background: #f4f7fb; }
#playbackLiveEdge { position: absolute; z-index: 1; top: 4px; right: 0; width: 2px; height: 12px; background: var(--green); }
.playback-axis { display: flex; align-items: center; justify-content: space-between; color: var(--faint); font-size: 8px; }
.playback-axis span:nth-child(2) { color: var(--muted); }
.archive-loading .camera-fallback { color: var(--blue); }
.archive-failed .camera-fallback { color: var(--red); }

/* Health timeline */
.health-head { display: flex; align-items: end; justify-content: space-between; margin-bottom: 8px; }
.health-head div { display: flex; align-items: baseline; gap: 8px; }
.health-head span { font-size: 11px; font-weight: 600; }
.health-head small { color: var(--faint); font-size: 9px; }
.health-head b { font-size: 12px; }
.health-timeline { display: grid; gap: 3px; }
.health-row { display: grid; grid-template-columns: 55px 1fr; gap: 7px; align-items: center; }
.health-row > button, .health-row > b { border: 0; padding: 0; color: var(--faint); text-align: right; background: transparent;
  font-size: 9px; font-weight: 500; }
.health-row > button:hover { color: var(--text); }
.health-rail { height: 7px; display: grid; grid-template-columns: repeat(60, 1fr); gap: 1px; overflow: hidden; border-radius: 2px; background: #10141a; }
.health-rail i { min-width: 0; background: var(--faint); }
.health-rail i.state-online { background: rgba(51, 211, 155, .78); }
.health-rail i.state-degraded { background: var(--amber); }
.health-rail i.state-offline { background: var(--red); }
.health-rail i.state-unknown { background: #272e39; }

.note { margin: 0; color: var(--muted); font-size: 11px; }
.quality-ok { margin: 0; color: var(--green); font-size: 11px; }

.table-wrap { overflow: hidden; border: 1px solid var(--line); border-radius: var(--radius); background: var(--panel); }
table { width: 100%; border-collapse: collapse; }
th, td { padding: 11px 13px; border-bottom: 1px solid var(--line); text-align: right; }
th { color: var(--faint); font-size: 9px; letter-spacing: .08em; text-transform: uppercase; }
th:first-child, td:first-child { text-align: left; }
td.good { color: var(--green); }
td.bad { color: var(--red); }

dialog { width: min(430px, calc(100% - 32px)); border: 1px solid var(--line-2); border-radius: 14px; padding: 27px; color: var(--text); background: var(--panel); box-shadow: 0 30px 90px #000a; }
dialog::backdrop { background: rgba(5, 7, 10, .82); backdrop-filter: blur(5px); }
dialog h2 { margin: 0; }
dialog p:not(.eyebrow, .form-error) { margin: -5px 0 4px; color: var(--muted); }
.toast { position: fixed; z-index: 20; left: 50%; bottom: 25px; transform: translateX(-50%); border: 1px solid var(--line-2); border-radius: 8px; padding: 9px 15px; background: var(--panel-3); box-shadow: 0 14px 42px #000a; }
.toast.error { color: var(--red); }
.empty { padding: 28px 18px; color: var(--faint); text-align: center; }

@media (max-width: 1280px) {
  .workspace { grid-template-columns: 290px minmax(560px, 1fr); }
  .camera-grid.overview { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}

@media (max-width: 880px) {
  :root { --mobile-topbar: calc(52px + env(safe-area-inset-top)); }
  html, body { min-height: 100%; height: auto; overscroll-behavior-y: none; }
  body.mobile-layer-open { overflow: hidden; }
  button, select, input { touch-action: manipulation; }

  .app-shell { min-height: 100dvh; height: auto; overflow: visible; }
  .topbar {
    position: sticky;
    z-index: 70;
    top: 0;
    height: var(--mobile-topbar);
    gap: 5px;
    overflow: hidden;
    padding: env(safe-area-inset-top) 6px 0;
    box-shadow: 0 5px 20px rgba(0, 0, 0, .22);
  }
  .mobile-menu-button {
    width: 40px;
    height: 40px;
    flex: none;
    display: grid;
    align-content: center;
    gap: 4px;
    border: 1px solid var(--line-2);
    border-radius: 8px;
    padding: 0 10px;
    background: var(--panel-2);
  }
  .mobile-menu-button span { display: block; height: 2px; border-radius: 2px; background: var(--text); }
  .mobile-menu-button[aria-expanded="true"] { border-color: var(--blue); background: #153354; }
  .brand { gap: 6px; margin-right: 0; }
  .brand .logo-mark { width: 18px; height: 18px; }
  .brand strong { font-size: 12px; }
  .brand small, #siteSelect, .live-state, .user-block, .top-spacer { display: none; }
  .top-left, .top-right { flex: none; gap: 7px; }
  #modes { margin: 0 auto; flex: none; }
  /* На телефоне четыре полных названия не помещаются, а прятать четвёртое нельзя:
     показываем короткие подписи из data-short, порядок и адреса те же. */
  #modes button { min-height: 34px; padding: 5px 7px; font-size: 0; font-weight: 600; }
  #modes button::after { content: attr(data-short); font-size: 10.5px; }
  /* Логотип на телефоне уступает место разделам: приложение и так опознаётся
     по бургеру, а четвёртая кнопка иначе вытесняет «Выйти» за край. */
  .brand { display: none; }
  .logout { min-width: 45px; min-height: 36px; padding: 4px 7px; font-size: 9px; }

  .workspace { display: block; min-height: calc(100dvh - var(--mobile-topbar)); overflow: visible; background: var(--panel); }
  .left-panel {
    position: fixed;
    z-index: 80;
    top: var(--mobile-topbar);
    bottom: 0;
    left: 0;
    width: min(88vw, 360px);
    min-height: 0;
    border-right: 1px solid var(--line-2);
    transform: translateX(-105%);
    transition: transform .2s ease;
    box-shadow: 24px 0 60px rgba(0, 0, 0, .45);
  }
  body.mobile-drawer-open .left-panel { transform: translateX(0); }
  .mobile-drawer-head {
    height: 47px;
    flex: none;
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-bottom: 1px solid var(--line);
    padding: 0 8px 0 14px;
  }
  .mobile-drawer-head strong { font-size: 12px; }
  .mobile-drawer-head button {
    width: 36px;
    height: 36px;
    border: 0;
    border-radius: 50%;
    color: var(--muted);
    background: var(--panel-3);
    font-size: 17px;
  }
  .left-panel .section-label { min-height: 36px; padding-inline: 14px; }
  .post-card { min-height: 76px; }
  .incident-card { min-height: 64px; padding: 11px 14px; }

  .center-panel { min-height: calc(100dvh - var(--mobile-topbar)); overflow: visible; }
  .control-stack {
    position: sticky;
    z-index: 24;
    top: var(--mobile-topbar);
    border-top: 1px solid var(--line);
    box-shadow: 0 8px 22px rgba(0, 0, 0, .38);
  }
  /* Прокрутка к камерам при открытии заезда — с поправкой на липкую шапку. */
  .camera-grid, #archiveUnavailable { scroll-margin-top: var(--mobile-topbar); }
  .camera-grid.overview { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .camera-grid.focus { grid-template-columns: minmax(0, 1fr); }
  .camera-grid.focus .camera-card { max-height: none; }
  .camera-card:focus-visible::after { content: ''; position: absolute; z-index: 3; inset: 0; border: 2px solid var(--blue); pointer-events: none; }

  .camera-toolbar { gap: 5px; padding: 6px 8px; }
  .camera-buttons { gap: 5px; padding: 0 0 2px; }
  .camera-buttons button { min-width: 40px; height: 38px; font-size: 12px; }
  .transport { min-width: 40px; padding: 0 9px; font-size: 11px; }
  #playbackPlay { width: 40px; }
  .rate-buttons { gap: 3px; }
  .rate-buttons button { min-width: 36px; padding: 0 6px; font-size: 10px; }
  #refreshButton { display: none; }

  .playback-panel { padding: 7px 9px 6px; }
  .playback-head { align-items: center; gap: 8px; margin-bottom: 2px; }
  .playback-head > div:first-child { min-width: 0; flex: 1; }
  .playback-head strong, .playback-head small { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .playback-head strong { font-size: 10px; }
  .playback-head small { font-size: 8px; }
  .playback-window { flex: none; gap: 4px; }
  .playback-window label { display: none; }
  .playback-window select { width: 58px; height: 30px; padding-inline: 5px; font-size: 8px; }
  .playback-window time { min-width: 96px; font-size: 9px; }
  .playback-scrubber { height: 32px; }
  .playback-scrubber::before, #playbackSlider::-webkit-slider-runnable-track, #playbackWarmBand { height: 10px; }
  #playbackWarmBand > i { border-radius: 5px; }
  #playbackSlider { height: 32px; }
  #playbackSlider::-webkit-slider-thumb { width: 8px; height: 28px; margin-top: -9px; border-radius: 4px; }
  #playbackSlider::-moz-range-track { height: 10px; }
  #playbackSlider::-moz-range-thumb { width: 8px; height: 28px; border-radius: 4px; }
  #playbackLiveEdge { top: 7px; width: 3px; height: 18px; }
  .playback-axis { font-size: 7px; }
  #playbackCenter { display: none; }

  .health-head { margin-bottom: 9px; }
  .health-row { grid-template-columns: 48px 1fr; gap: 6px; }
  .health-rail { height: 9px; }

  .table-wrap { overflow-x: auto; }
  table { min-width: 650px; }
  th, td { padding: 10px 11px; }

  .toast { z-index: 100; right: 12px; bottom: max(14px, env(safe-area-inset-bottom)); left: 12px; width: auto; transform: none; text-align: center; }
}

@media (max-width: 560px) {
  .login-view { min-height: 100dvh; padding: 16px; }
  .login-card { padding: 25px 21px; }
  .login-brand { margin-bottom: 28px; }
  .camera-meta { padding-inline: 5px; font-size: 7.5px; }
  .camera-meta > span { max-width: 55%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .camera-label { gap: 5px; padding: 4px 5px; }
  .camera-label b { font-size: 9px; }
  .camera-label i { font-size: 7px; }
}

@media (max-width: 390px) {
  .brand strong { display: none; }
  #modes button { padding-inline: 10px; }
  .camera-toolbar { gap: 4px; }
  .session-player > .subtle { padding-inline: 8px; }
  .transport { min-width: 38px; padding-inline: 7px; }
  #playbackPlay { width: 38px; }
  .rate-buttons button { min-width: 33px; }
  .playback-head small { display: none; }
  .playback-window time { min-width: 86px; font-size: 8px; }
}

.camera-visual.archive-loading .camera-fallback { color: var(--muted); }
.camera-visual.archive-failed .camera-fallback { color: var(--faint); }
/* Сессии машин под карточкой поста */
.visit-heading { margin-top: 14px; display: flex; justify-content: space-between; align-items: center; }
.visit-heading b { font-size: 11px; color: var(--muted, #8a93a5); }
.visit-heading b.warn { color: #f59e0b; }
.visit-list { flex: 1 1 0; min-height: 0; overflow-y: auto; display: flex; flex-direction: column; gap: 6px; margin-top: 6px; padding: 0 6px 8px; }
.visit-empty { font-size: 12px; color: #8a93a5; padding: 8px 4px; }
/* Same-height visit rows; processing status is explicit, not a spinner. */
.visit-row { display: grid; grid-template-columns: 132px minmax(0, 1fr); gap: 10px; align-items: stretch; width: 100%;
  height: 120px; flex: 0 0 120px;
  padding: 8px; border: 1px solid rgba(255,255,255,.06); border-radius: 8px; background: rgba(255,255,255,.03);
  color: inherit; text-align: left; cursor: pointer; }
.visit-row:hover, .visit-row.on { border-color: rgba(78,190,138,.6); background: rgba(78,190,138,.08); }
.visit-row.verdict-warning { border-left: 3px solid #f59e0b; }
.visit-row.verdict-critical { border-left: 3px solid #ef4444; }
.visit-row.verdict-ok { border-left: 3px solid #10b981; }
/* contain, а не cover: у разобранных заездов это вырезанная машина, и обрезать её
   ещё раз нельзя — именно по ней узнают клиента. */
.visit-thumb { display: grid; place-items: center; width: 132px; min-height: 84px; height: 100%;
  border-radius: 6px; background: #10151d; overflow: hidden; }
.visit-thumb img { width: 100%; height: 100%; object-fit: contain; display: block; }
.visit-noshot { font-style: normal; font-size: 10px; color: #55606f; }
.visit-copy { display: flex; flex-direction: column; justify-content: center; gap: 3px; min-width: 0; }
.visit-when { display: flex; align-items: center; gap: 7px; font-variant-numeric: tabular-nums; }
.visit-when b { font-size: 14px; }
.visit-when i { font-style: normal; font-size: 11.5px; color: #8a93a5; }
.visit-mark { width: 15px; height: 15px; margin-left: auto; flex: none; }
.visit-note { margin-left: auto; color: var(--note); font-size: 13px; line-height: 1; }
.visit-note + .visit-mark { margin-left: 0; }
.visit-mark.ok { color: #4ebe8a; }
.visit-mark.warning { color: #f5b544; }
.visit-mark.critical { color: #ef4444; }
.visit-mark.unknown { color: #8a93a5; }
.visit-copy .car-plate { font-size: 13.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.visit-copy .car-plate.none { font-size: 12px; }
.visit-copy .car-name { margin: 0; font-size: 11.5px; white-space: nowrap; }
.visit-copy small { font-size: 11px; color: #8a93a5; }
.visit-row .visit-thumb { min-height: 0; height: 102px; }
.visit-copy .visit-analysis-state { overflow: hidden; white-space: nowrap; text-overflow: ellipsis; line-height: 16px; }
.visit-analysis-state.clear { color: #4ebe8a; }
.visit-analysis-state.pending { color: #f5b544; }
.visit-analysis-state.confirmed { color: var(--red); }
/* Камера крупно: одна картинка во весь экран и свой ползунок архива. */
.cam-modal { width: min(1280px, 94vw); max-width: none; padding: 0; border: 1px solid var(--line-2); border-radius: 12px;
  background: var(--panel); color: var(--text); }
.cam-modal::backdrop { background: rgba(5, 7, 10, .82); }
.cam-modal-head { display: flex; align-items: center; gap: 12px; padding: 10px 14px; border-bottom: 1px solid var(--line); font-size: 12px; }
.cam-modal-head b { font-size: 13px; letter-spacing: .04em; }
.cam-modal-zone { color: var(--muted); }
.cam-modal-state { font-style: normal; color: var(--blue); font-size: 11px; letter-spacing: .06em; }
.cam-modal-clock { margin-left: auto; color: var(--text); font-variant-numeric: tabular-nums; }
.cam-modal-tech { display: block; padding: 5px 14px 0; color: var(--faint); font-size: 10.5px; }
.cam-modal-tech:empty { display: none; }
.cam-modal-close { width: 30px; height: 30px; padding: 0; border: 1px solid var(--line-2); border-radius: 8px;
  background: var(--panel-2); color: var(--text); font-size: 16px; line-height: 1; cursor: pointer; }
.cam-modal-close:hover { border-color: var(--blue); }
.cam-modal-visual { position: relative; display: block; width: 100%; aspect-ratio: 16 / 9; background: #05070a; overflow: hidden; }
/* В архиве живой снимок снимается (src убран) и остаётся только кадр раскадровки — alt-текст картинки поверх него не нужен. */
.cam-modal-visual img:not([src]) { display: none; }
.cam-modal-visual video, .cam-modal-visual img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: contain; }
.cam-modal-scrub { position: relative; height: 26px; margin: 12px 14px 0; }
.cam-modal-slider { width: 100%; height: 26px; margin: 0; appearance: none; background: transparent; cursor: ew-resize; }
.cam-modal-slider::-webkit-slider-runnable-track { height: 6px; border-radius: 3px; background: var(--panel-3); }
.cam-modal-slider::-webkit-slider-thumb { width: 6px; height: 22px; margin-top: -8px; appearance: none; border: 0; border-radius: 3px;
  background: #f4f7fb; box-shadow: 0 0 0 1px #0d1015, 0 0 9px rgba(67,140,246,.8); }
.cam-modal-slider::-moz-range-track { height: 6px; border-radius: 3px; background: var(--panel-3); }
.cam-modal-slider::-moz-range-thumb { width: 6px; height: 22px; border: 0; border-radius: 3px; background: #f4f7fb; }
.cam-modal-axis { display: flex; justify-content: space-between; padding: 0 14px; color: var(--faint); font-size: 10px; }
.cam-modal-controls { display: flex; gap: 8px; padding: 10px 14px 14px; }
@media (max-width: 620px) {
  .cam-modal { width: 100vw; border-radius: 0; }
}

.visit-pay { display: flex; align-items: baseline; gap: 6px; min-width: 0; }
.visit-pay .money { font-size: 12.5px; }
.visit-program { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.visit-meta { font-variant-numeric: tabular-nums; }
.visit-badge { font-size: 11px; font-variant-numeric: tabular-nums; color: #8a93a5; white-space: nowrap; }
.verdict-warning .visit-badge { color: #f59e0b; }
.verdict-critical .visit-badge { color: #ef4444; }

/* Разобранные сессии под окнами камер: карточка = фазы → этапы → события */
.sessions { display: flex; flex-direction: column; gap: 10px; padding: 12px 10px 4px; }
.sessions-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 12px; padding: 0 4px; }
.sessions-head h2 { margin: 2px 0 0; font-size: 17px; }
.sessions-head small { color: #8a93a5; font-size: 11px; text-align: right; }
.session-card { border: 1px solid var(--line, #26303d); border-left: 3px solid var(--cause, #8a93a5); border-radius: 10px; background: var(--panel, #131924); }
.session-card.on { border-color: rgba(78,190,138,.55); border-left-color: var(--cause, #8a93a5); box-shadow: 0 0 0 1px rgba(78,190,138,.15); }
/* Полоска сессии: ползунок поверх цветной ленты фаз, как шкала архива, но от приезда до выезда */
.sess-scrub-wrap { margin: 10px 0 2px; }
.sess-scrub { position: relative; height: 22px; }
.sess-band { position: absolute; z-index: 1; left: 0; right: 0; top: 7px; height: 8px; border-radius: 4px; background: rgba(255,255,255,.06); overflow: hidden; pointer-events: none; }
.sess-band i { position: absolute; top: 0; height: 100%; background: rgba(138,147,165,.5); }
.sess-band i.ph-queue { background: rgba(245,158,11,.55); }
.sess-band i.ph-entry { background: rgba(6,182,212,.55); }
.sess-band i.ph-wash { background: rgba(59,130,246,.7); }
.sess-band i.ph-robot { background: rgba(59,130,246,.7); }
.sess-band i.ph-grate_wait { background: rgba(217,130,43,.6); }
.sess-band i.ph-exit { background: rgba(6,182,212,.55); }
.sess-band i.ph-dry { background: rgba(168,85,247,.55); }
/* Склеенные детектором машины в одной сессии: фазы 2-й/3-й машины тех же цветов */
.sess-band i.ph-queue2, .sess-band i.ph-queue3 { background: rgba(245,158,11,.4); }
.sess-band i.ph-wash2, .sess-band i.ph-wash3 { background: rgba(59,130,246,.5); }
.sess-band i.ph-dry2, .sess-band i.ph-dry3 { background: rgba(168,85,247,.4); }
.sess-slider { position: relative; z-index: 2; width: 100%; height: 22px; margin: 0; border: 0; padding: 0; appearance: none; background: transparent; box-shadow: none; cursor: ew-resize; }
.sess-slider::-webkit-slider-runnable-track { height: 8px; background: transparent; }
.sess-slider::-webkit-slider-thumb { width: 4px; height: 20px; margin-top: -6px; appearance: none; border: 0; border-radius: 2px; background: #f4f7fb; box-shadow: 0 0 0 1px #0d1015, 0 0 9px rgba(67,140,246,.8); }
.sess-slider::-moz-range-track { height: 8px; border: 0; border-radius: 4px; background: transparent; }
.sess-slider::-moz-range-thumb { width: 4px; height: 20px; border: 0; border-radius: 2px; background: #f4f7fb; }
.sess-slider.outside::-webkit-slider-thumb { opacity: .35; }
.sess-slider.outside::-moz-range-thumb { opacity: .35; }
.sess-axis { display: flex; align-items: center; justify-content: space-between; font-size: 10px; color: #5b6577; font-variant-numeric: tabular-nums; }
.sess-axis b { color: #e6eaf0; font-weight: 600; }
.pchips .phase.now { box-shadow: inset 0 0 0 1px rgba(244,247,251,.45); }
.visit-copy small .money { font-size: 12px; }
.session-body { padding: 8px 14px 14px; border-top: 1px solid rgba(255,255,255,.06); }
.session-foot { display: grid; grid-template-columns: minmax(0, 1fr); gap: 16px; margin-top: 14px; }
.events-table { width: 100%; border-collapse: collapse; font-size: 12.5px; line-height: 1.35; color: #c9d1dc; }
.events-table th { padding: 0 8px 6px 0; color: #8a93a5; font-size: 10px; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; text-align: left; border-bottom: 1px solid var(--line); }
.events-table td { padding: 5px 8px 5px 0; border-bottom: 1px solid var(--line); vertical-align: top; text-align: left; font-size: 12.5px; letter-spacing: 0; text-transform: none; }
.events-table .ev-toggle { margin: 0 6px 0 0; padding: 0 4px; border: 0; background: none; color: #8a93a5; font-size: 12px; line-height: 1; cursor: pointer; }
.events-table .ev-toggle:hover { color: #e6ebf5; }
.events-table .ev-sub td { padding-top: 3px; padding-bottom: 3px; color: #9aa4b6; font-size: 12px; background: rgba(255, 255, 255, .02); }
.events-table .ev-sub .ev-l { padding-left: 22px; }
.events-table .ev-sub .ev-p { color: #8a93a5; }
.events-table .ev-sub[hidden] { display: none; }
.events-table .ev-sub.now td { background: rgba(78,190,138,.12); color: #d7dee8; box-shadow: inset 2px 0 0 rgba(78,190,138,.55); }
.events-table tr:last-child td { border-bottom: 0; }
.events-table .ev-t { width: 72px; color: var(--muted); font-variant-numeric: tabular-nums; white-space: nowrap; }
.events-table .ev-d { width: 56px; text-align: right; padding-right: 14px; font-variant-numeric: tabular-nums; white-space: nowrap; }
.events-table th.ev-d { text-align: right; }
.events-table .ev-row { cursor: pointer; }
.events-table .ev-row:hover td { background: rgba(255,255,255,.04); color: #e6eaf0; }
.events-table .ev-row.now td { background: rgba(78,190,138,.16); color: #e6eaf0; box-shadow: inset 2px 0 0 #4ebe8a; }
/* Строка, на которой что-то пошло не так: жёлтая — предупреждение, красная —
   критично. Цвет стоит после «.now», иначе текущий момент закрашивал бы проблему. */
.events-table .ev-row.sev-warning td { background: rgba(245,158,11,.14); color: #e6eaf0; }
.events-table .ev-row.sev-critical td { background: rgba(239,68,68,.16); color: #e6eaf0; }
.events-table .ev-row.sev-warning.now td, .events-table .ev-row.sev-critical.now td { box-shadow: inset 2px 0 0 #4ebe8a; }
.events-table .ev-p { width: 160px; padding-right: 0; }
.events-table th.ev-p { text-align: left; }
.ev-problem { display: inline-flex; align-items: baseline; gap: 3px; max-width: 100%; padding: 2px 8px; border: 1px solid transparent;
  border-radius: 999px; background: rgba(255,255,255,.06); color: #c9d1dc; font: inherit; font-size: 11.5px; line-height: 1.3;
  text-align: left; cursor: pointer; }
.ev-problem:hover { background: rgba(255,255,255,.12); }
.ev-problem i { font-style: normal; opacity: .7; }
.ev-problem.sev-warning { border-color: rgba(245,158,11,.55); color: #f6c26b; background: rgba(245,158,11,.14); }
.ev-problem.sev-critical { border-color: rgba(239,68,68,.6); color: #ff9a9a; background: rgba(239,68,68,.16); }
/* Разбор отклонения поверх таблицы: интерфейс остаётся узким, текст живёт в окне. */
.problem-modal { width: min(560px, 94vw); max-width: none; padding: 0; border: 1px solid var(--line-2); border-radius: 12px;
  background: var(--panel); color: var(--text); }
.problem-modal::backdrop { background: rgba(5, 7, 10, .8); }
.problem-head { display: flex; align-items: center; gap: 10px; padding: 12px 14px; border-bottom: 1px solid var(--line); }
.problem-head b { font-size: 13px; }
.problem-when { margin-left: auto; color: var(--muted); font-size: 11.5px; }
.problem-body { display: flex; flex-direction: column; gap: 8px; padding: 12px 14px 14px; }
.problem-body .incident-card { margin: 0; }
.session-foot h3 { margin: 0 0 6px; font-size: 10px; letter-spacing: .06em; text-transform: uppercase; color: #8a93a5; }
.session-foot .note { margin: 0; font-size: 12.5px; line-height: 1.45; color: #c9d1dc; }
.session-foot .incident-card { margin-bottom: 6px; }
.session-foot .quality-ok { margin: 0; }
@media (max-width: 880px) {
  .sessions { padding: 10px 6px 4px; }
  .sessions-head { flex-direction: column; align-items: flex-start; }
  .sessions-head small { text-align: left; }
  .session-foot { grid-template-columns: minmax(0, 1fr); }
  .session-foot > div { min-width: 0; overflow-x: auto; overscroll-behavior-x: contain; }
  /* Пять фаз не влезают в ширину телефона — переносим чипы на вторую строку. */
  .pchips { flex-wrap: wrap; }
  .pchips .phase { flex: 1 1 30%; min-width: 96px; }
}
.pchips { display: flex; gap: 4px; }
.pchips .phase { display: flex; flex-direction: column; gap: 2px; min-width: 84px; padding: 7px 9px; border: 1px solid rgba(255,255,255,.08); border-radius: 8px;
  background: rgba(255,255,255,.04); color: inherit; text-align: left; cursor: pointer; font: inherit; }
.pchips .phase.none { opacity: .6; }
.pchips .phase b { font-size: 12px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pchips .phase span { font-size: 11px; color: #8a93a5; font-variant-numeric: tabular-nums; }
.pchips .phase em { font-size: 11px; font-style: normal; }
.pchips .phase em.o { color: #f59e0b; }
.pchips .phase em.u { color: #4ebe8a; }
.cause-chip { display: inline-flex; align-items: center; gap: 6px; margin: 6px 0; padding: 3px 8px 3px 4px; border: 1px solid; border-radius: 999px; font-size: 11px; }
.cause-chip i { display: inline-flex; width: 16px; height: 16px; align-items: center; justify-content: center; border-radius: 50%; color: #0f141b; font-style: normal; font-size: 10px; font-weight: 700; }
.incident-card .acts { display: flex; gap: 6px; margin-top: 6px; }
.incident-card .acts button { font-size: 11px; padding: 3px 8px; }
.incident-card.confirmed { outline: 1px solid rgba(78,190,138,.5); }
.visit-row { border-left: 3px solid var(--cause, #8a93a5); }
.visit-reviewed { font-style: normal; color: #4ebe8a; }

/* ── Настройки: оборудование и подключения ─────────────────────────────────
   Экран для администратора. Раньше эти данные жили либо внизу оперативной
   панели (полоска камер), либо только в наших головах и в .env на сервере. */
.settings-view { flex: 1; min-height: 0; overflow-y: auto; background: var(--bg); }
.settings-content { width: 100%; max-width: 1400px; margin: 0 auto; padding: 18px 20px 40px; display: flex; flex-direction: column; gap: 18px; }
.settings-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; }
.settings-head h1 { margin: 2px 0 0; font-size: 20px; }
.settings-block { border: 1px solid var(--line); border-radius: 12px; background: var(--panel); padding: 14px 16px 16px; }
.settings-block h2 { margin: 0; font-size: 13px; letter-spacing: .04em; text-transform: uppercase; color: var(--muted); }
.settings-note { margin: 6px 0 12px; font-size: 12.5px; color: var(--muted); }
.settings-note code { font-size: 12px; color: #c9d1dc; }
.settings-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 10px; }
.settings-review-queue { display: grid; gap: 8px; }
.settings-review-row { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px 16px; border-top: 1px solid var(--line); padding-top: 10px; font-size: 12px; }
.settings-review-row > div:first-child { flex: 1 1 250px; min-width: 0; }
.settings-review-row p { margin-bottom: 0; }
.settings-review-actions { display: flex; gap: 8px; }
.settings-review-actions a { text-decoration: none; }
.settings-card { border: 1px solid var(--line-2); border-left: 3px solid #8a93a5; border-radius: 10px; padding: 10px 12px; background: rgba(255,255,255,.03); }
.settings-card.ok { border-left-color: #10b981; }
.settings-card.stale { border-left-color: #f59e0b; }
.settings-card.off { border-left-color: #ef4444; }
.settings-card-head { display: flex; align-items: center; gap: 8px; }
.settings-card-head b { font-size: 13px; }
.settings-card-state { margin-left: auto; font-size: 11px; color: var(--muted); }
.settings-dot { width: 8px; height: 8px; border-radius: 50%; background: #8a93a5; flex: none; }
.settings-dot.ok { background: #10b981; }
.settings-dot.stale { background: #f59e0b; }
.settings-dot.off { background: #ef4444; }
.settings-card-what { margin: 6px 0 0; font-size: 12px; color: var(--muted); line-height: 1.4; }
.settings-card-value { margin: 6px 0 0; font-size: 13px; color: var(--text); font-variant-numeric: tabular-nums; }
.settings-card-foot { display: block; margin-top: 6px; font-size: 11px; color: var(--faint); }
.settings-table-wrap { overflow-x: auto; }
.settings-table { width: 100%; border-collapse: collapse; font-size: 12.5px; }
.settings-table th { padding: 0 10px 6px 0; text-align: left; font-size: 10px; font-weight: 600; letter-spacing: .06em;
  text-transform: uppercase; color: var(--muted); border-bottom: 1px solid var(--line); white-space: nowrap; }
.settings-table td { padding: 6px 10px 6px 0; border-bottom: 1px solid var(--line); vertical-align: middle; }
.settings-table tr:last-child td { border-bottom: 0; }
.settings-table tr.settings-off td { opacity: .5; }
.settings-channel { font-variant-numeric: tabular-nums; font-weight: 700; width: 56px; }
.settings-input, .settings-select { width: 100%; min-width: 120px; padding: 4px 6px; border: 1px solid var(--line-2); border-radius: 6px;
  background: var(--panel-2); color: var(--text); font: inherit; font-size: 12.5px; }
.settings-input:focus, .settings-select:focus { border-color: var(--blue); outline: none; }
.settings-input:disabled, .settings-select:disabled { opacity: .6; }
.settings-state { white-space: nowrap; font-size: 12px; }
.settings-state.state-online { color: #4ebe8a; }
.settings-state.state-degraded { color: #f59e0b; }
.settings-state.state-offline { color: #ef4444; }
.settings-shot { color: var(--muted); white-space: nowrap; font-variant-numeric: tabular-nums; }
.settings-toggle { display: inline-flex; align-items: center; cursor: pointer; }
.settings-toggle input { position: absolute; opacity: 0; width: 0; height: 0; }
.settings-toggle i { width: 34px; height: 18px; border-radius: 999px; background: rgba(255,255,255,.14); position: relative; transition: background .15s; }
.settings-toggle i::after { content: ''; position: absolute; top: 2px; left: 2px; width: 14px; height: 14px; border-radius: 50%;
  background: #e6eaf0; transition: transform .15s; }
.settings-toggle input:checked + i { background: rgba(78,190,138,.7); }
.settings-toggle input:checked + i::after { transform: translateX(16px); }
.settings-toggle input:disabled + i { opacity: .4; }
.settings-limit-label { font-weight: 600; white-space: nowrap; }
.settings-limit-value { font-variant-numeric: tabular-nums; white-space: nowrap; }
.settings-source { color: var(--faint); font-size: 11.5px; }
.settings-empty { color: var(--muted); padding: 10px 0; }
.settings-retention { white-space: nowrap; }
.settings-days { width: 64px; min-width: 64px; text-align: right; font-variant-numeric: tabular-nums; }
.settings-days-unit { margin-left: 6px; color: var(--muted); }
.settings-retention-foot { margin: 10px 0 0; }
.settings-foot { display: flex; justify-content: flex-end; font-size: 11.5px; color: var(--faint); }
.settings-view .health-head { display: flex; align-items: baseline; justify-content: space-between; margin-bottom: 8px; }
@media (max-width: 880px) {
  .settings-content { padding: 12px 10px 28px; }
  .settings-cards { grid-template-columns: 1fr; }
}


/* ── Записи камер ──────────────────────────────────────────────────────────
   Отдельный экран для архива: сетка камер и одна общая шкала. В оперативной
   панели шкала спорила с полоской заезда — оператор не понимал, какая из них
   сейчас управляет картинкой. */
.recordings-view { flex: 1; min-height: 0; overflow-y: auto; background: var(--bg); }
.recordings-content { width: 100%; max-width: 1700px; margin: 0 auto; padding: 16px 18px 32px;
  display: flex; flex-direction: column; gap: 14px; }
.recordings-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; }
.recordings-head h1 { margin: 2px 0 0; font-size: 20px; }
.recordings-head small { color: var(--muted); font-size: 12px; }
.recordings-view .playback-panel { border: 1px solid var(--line); border-radius: 12px; background: var(--panel); }
.recordings-view .camera-grid { gap: 8px; }
@media (max-width: 880px) {
  .recordings-content { padding: 10px 8px 24px; }
  .recordings-head { flex-direction: column; align-items: flex-start; gap: 4px; }
}
/* Доказательная часть разбора под таблицей событий: наблюдения, кадры, номер, услуги, мозаики. */
/* Разбор по кадрам: один дропдаун, внутри — факты сеткой, доказательства списком.
   Прежняя версия сыпала абзацы и ссылки в столбик без структуры. */
.session-analysis { margin-top: 16px; scroll-margin-top: 52px; }
.session-analysis:empty { display: none; }
.session-analysis > .muted { color: var(--muted); font-size: 12px; margin: 8px 0; }

.analysis-root { border: 1px solid var(--line, #2b3440); border-radius: 10px; background: rgba(255,255,255,.015); }
.analysis-root > summary { cursor: pointer; padding: 10px 14px; list-style: none; display: flex;
  align-items: baseline; gap: 10px; flex-wrap: wrap; border-radius: 10px; }
.analysis-root > summary::-webkit-details-marker { display: none; }
.analysis-root > summary::before { content: '▸'; color: var(--muted); font-size: 11px; line-height: 1.6; }
.analysis-root[open] > summary::before { content: '▾'; }
.analysis-root > summary:hover { background: rgba(255,255,255,.03); }
.a-root-title { font-size: 11px; letter-spacing: .06em; text-transform: uppercase; color: #c3ccda; }
.a-root-meta { font-size: 11px; color: var(--muted); margin-left: auto; }

.a-body { padding: 4px 14px 14px; display: flex; flex-direction: column; gap: 14px; }
.a-facts { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 1px;
  background: var(--line, #2b3440); border: 1px solid var(--line, #2b3440); border-radius: 8px; overflow: hidden; }
.a-fact { display: flex; flex-direction: column; gap: 2px; padding: 9px 11px; background: #11161d; }
.a-fact-label { font-size: 10px; letter-spacing: .05em; text-transform: uppercase; color: var(--muted); }
.a-fact-value { font-size: 14px; color: #e6eaf0; overflow-wrap: anywhere; }
.a-fact-note { font-size: 11px; color: var(--muted); }

.a-verdict { margin: 0; font-weight: 600; }
.a-verdict.clear { color: var(--green); }
.a-verdict.pending { color: var(--amber); }
.a-verdict.insufficient { color: var(--muted); }
.a-summary { margin: 0; line-height: 1.5; overflow-wrap: anywhere; }

.a-group { display: flex; flex-direction: column; gap: 8px; }
.a-head { display: flex; align-items: baseline; gap: 8px; }
.a-head h4 { margin: 0; font-size: 10px; letter-spacing: .06em; text-transform: uppercase; color: #8a93a5; }
.a-head-value { font-size: 11px; color: var(--muted); margin-left: auto; }

.a-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.a-item { display: flex; flex-direction: column; gap: 6px; padding: 10px 12px; border-radius: 8px;
  background: rgba(255,255,255,.025); border: 1px solid transparent; }
.a-item-text { margin: 0; line-height: 1.45; color: #d7dee8; overflow-wrap: anywhere; }
.a-item-note { margin: 0; font-size: 11px; line-height: 1.4; color: var(--muted); overflow-wrap: anywhere; }
.a-plain { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 4px;
  font-size: 12px; color: var(--muted); }
.a-plain li { padding-left: 12px; position: relative; line-height: 1.45; }
.a-plain li::before { content: '—'; position: absolute; left: 0; color: #3d4757; }
.a-notes { font-size: 11px; color: var(--muted); display: flex; flex-direction: column; gap: 4px; }
.a-notes p { margin: 0; line-height: 1.45; }

.a-service { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.a-service-name { color: #e6eaf0; }
.a-status { font-size: 11px; padding: 2px 8px; border-radius: 999px; margin-left: auto; white-space: nowrap; }
.a-status.ok { color: var(--green); background: rgba(78,190,138,.12); }
.a-status.warn { color: var(--amber); background: rgba(245,158,11,.14); }
.a-status.none { color: var(--muted); background: rgba(255,255,255,.05); }

.a-frames { display: flex; flex-wrap: wrap; gap: 6px; }
.a-frame { display: inline-flex; align-items: stretch; border: 1px solid var(--line, #2b3440);
  border-radius: 999px; overflow: hidden; background: rgba(255,255,255,.03); }
.a-frame-seek { border: 0; background: none; color: #cfd8e6; font: inherit; font-size: 12px;
  padding: 4px 10px; cursor: pointer; white-space: nowrap; }
.a-frame-seek:hover { background: rgba(121,181,255,.14); color: #eaf1fb; }
.a-frame-open { display: inline-flex; align-items: center; padding: 4px 8px; color: #79b5ff;
  font-size: 12px; text-decoration: none; border-left: 1px solid var(--line, #2b3440); }
.a-frame-open:hover { background: rgba(121,181,255,.14); }
.a-frame-open.wide { border: 1px solid var(--line, #2b3440); border-radius: 999px; padding: 4px 10px; }
.a-frames-more { font-size: 11px; color: var(--muted); align-self: center; }

.a-more { border-top: 1px solid var(--line, #2b3440); padding-top: 10px; }
.a-more > summary { cursor: pointer; font-size: 12px; color: #c3ccda; padding: 2px 0; }
.a-more > summary:hover { color: #e6eaf0; }
.a-more > * { margin-top: 8px; }
.a-board { display: block; }
.a-board img { width: 100%; height: auto; display: block; border-radius: 6px; }
.a-foot { margin: 0; font-size: 11px; color: var(--muted); }
.analysis-open { margin:0 0 10px; padding:9px 12px; color:var(--text); border:1px solid var(--line); border-radius:7px; background:var(--panel); }
.analysis-brief { padding: 12px 14px; margin-bottom: 12px; border: 1px solid var(--line); border-radius: 8px; background: var(--panel-2); }
.analysis-brief-head { display: flex; flex-wrap: wrap; align-items: baseline; gap: 5px 12px; font-size: 13px; }
.analysis-brief-head span { font-size: 12px; color: var(--muted); }
.analysis-brief.clear .analysis-brief-head span { color: var(--green); }
.analysis-brief.pending .analysis-brief-head span { color: var(--amber); }
.analysis-brief.confirmed .analysis-brief-head span { color: var(--red); }
.analysis-brief p { margin: 8px 0 0; font-size: 13px; line-height: 1.5; overflow-wrap: anywhere; }
.analysis-brief .analysis-attention { color: #d6b77b; }
.analysis-brief .analysis-open { display: block; margin: 10px 0 0; font-size: 12px; }
@media (max-width:880px) {
  .analysis-open { width:100%; min-height:44px; }
  .a-frame-seek, .a-frame-open { min-height:40px; display:inline-flex; align-items:center; }
  .a-root-meta { margin-left:0; flex-basis:100%; }
  .a-status { margin-left:0; }
}
.report-status-chip.insufficient { color:var(--muted); background:#ffffff08; }
