:root {
  --navy: #0f2744;
  --navy-2: #16365c;
  --panel: #ffffff;
  --line: #d7e0ea;
  --text: #1c2838;
  --muted: #5d6f84;
  --blue: #1b6fbf;
  --red: #c1121f;
  --green: #1f8a4c;
  --amber: #c98900;
  --shadow: 0 10px 28px rgba(16, 38, 67, 0.12);
  --topbar-h: 82px;
  font-family: "Segoe UI", Calibri, system-ui, sans-serif;
}

* { box-sizing: border-box; }
html, body { height: 100%; margin: 0; background: #eef3f8; color: var(--text); }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
.hidden { display: none !important; }

#app {
  height: 100%;
  display: grid;
  grid-template-rows: var(--topbar-h) 1fr;
  grid-template-columns: 1fr;
}
.topbar { grid-row: 1; }
.stage, .workspace { grid-row: 2; grid-column: 1; min-height: 0; }

.topbar {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 0 16px 0 8px;
  background: #f4f7fb;
  color: var(--navy);
  z-index: 30;
  box-shadow: 0 1px 0 var(--line);
  overflow-x: auto;
}
.topbar.alerting { background: #fdecee; }
.brand { display: flex; gap: 12px; align-items: center; flex-shrink: 0; }
.logo {
  display: block;
  height: 52px;
  width: auto;
  object-fit: contain;
  background: transparent;
  border-radius: 0;
  padding: 0;
}
.logo-crest,
.logo-macrosys {
  height: 72px;
  max-height: 72px;
  width: auto;
  max-width: 220px;
  object-fit: contain;
  background: transparent;
  border-radius: 0;
  padding: 0;
}
.logo-crest { cursor: pointer; }
.partner {
  display: flex;
  align-items: center;
  gap: 8px;
  padding-left: 10px;
  margin-left: 4px;
  border-left: 1px solid var(--line);
}
.partner span {
  font-size: 10px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted);
  white-space: nowrap;
}
.brand-mark {
  width: 11px;
  height: 11px;
  border-radius: 50%;
  background: #3ddc84;
  box-shadow: 0 0 0 4px rgba(61, 220, 132, 0.18);
}
.topbar.alerting .brand-mark {
  background: #ffd166;
  animation: ping 1s infinite;
}
.brand small { display: block; color: var(--muted); font-size: 11px; font-weight: 400; }
.brand strong { font-size: 14px; letter-spacing: 0.02em; }

.search-wrap { position: relative; display: flex; align-items: stretch; gap: 6px; flex: 1; min-width: 180px; max-width: 460px; }
.search-wrap input {
  flex: 1;
  min-width: 0;
  width: auto;
  border: 0;
  background: #fff;
  color: var(--text);
  border-radius: 8px;
  padding: 9px 12px;
  box-shadow: inset 0 0 0 1px transparent;
}
.btn-sync {
  width: 38px;
  height: 38px;
  flex-shrink: 0;
  border: 0;
  border-radius: 8px;
  background: #fff;
  color: #111;
  display: grid;
  place-items: center;
  cursor: pointer;
  padding: 0;
}
.btn-sync svg { width: 20px; height: 20px; display: block; }
.btn-sync:hover { background: #e8eef4; }
.btn-sync.need { color: #fff; background: #c1121f; }
.btn-sync.need:hover { background: #9b0e18; }
.btn-sync:disabled { opacity: 0.45; cursor: wait; }
.search-results {
  position: absolute;
  z-index: 40;
  left: 0;
  right: 0;
  top: calc(100% + 6px);
  background: #fff;
  color: var(--text);
  border-radius: 10px;
  overflow: hidden;
  box-shadow: var(--shadow);
}
.search-results button {
  display: block;
  width: 100%;
  text-align: left;
  background: none;
  border: 0;
  padding: 9px 12px;
  font-size: 13px;
}
.search-results button:hover { background: #f3f7fb; }

.status-cluster, .test-cluster { display: flex; align-items: center; gap: 8px; }
.status-cluster { flex-shrink: 0; }
.test-cluster { margin-left: auto; }
.status-cluster select,
.test-cluster select {
  width: 240px;
  border: 1px solid var(--line);
  background: #fff;
  color: var(--navy);
  border-radius: 8px;
  padding: 7px 8px;
}

.pill {
  border: 1px solid var(--line);
  background: #fff;
  border-radius: 999px;
  padding: 4px 10px;
  font-size: 12px;
  color: var(--muted);
  white-space: nowrap;
}
.pill.ok { color: var(--green); border-color: #b7e0c6; background: #eef8f2; }
.pill.warn { color: #8a6a12; border-color: #ead7a0; background: #fff8e8; }
.pill.pill-danger { color: #fff; background: var(--red); border-color: var(--red); }
#status-online, #map-status-online, #status-offline, #map-status-offline, #status-total, #map-status-total {
  cursor: pointer;
}
.pill.is-filter { box-shadow: 0 0 0 2px #1e3a5f; }
button.pill.pill-danger {
  cursor: pointer;
  font: inherit;
  font-weight: 700;
  line-height: 1.2;
}
button.pill.pill-danger:hover { filter: brightness(1.08); }

.btn, menu button, .note-form button {
  background: #fff;
  color: var(--navy);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 8px 12px;
  font-size: 13px;
  font-weight: 600;
}
.btn.ghost {
  background: #fff;
  color: var(--navy);
  border-color: var(--line);
}
.topbar .btn { background: #fff; color: var(--navy); border: 0; }
.topbar .btn.ghost { background: #fff; color: var(--navy); border: 1px solid var(--line); }
.btn.primary { background: var(--blue); color: #fff; border: 0; }
.btn.clock-box {
  display: grid;
  gap: 8px;
  margin: 12px 0;
  padding: 14px 16px;
  border: 1px solid var(--line, #d8e0ea);
  border-radius: 10px;
  background: #f7fafd;
}
.clock-row {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  font-size: 14px;
}
.clock-row span { color: #5d6f84; }
.clock-row strong { font-variant-numeric: tabular-nums; }

.report-pick.on { background: var(--blue); color: #fff; border-color: var(--blue); }
.btn:hover { filter: brightness(1.05); }

.switch {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  color: var(--muted);
  white-space: nowrap;
}
.switch input { width: auto; accent-color: #3ddc84; }

.panic {
  border: 0;
  background: var(--red);
  color: #fff;
  border-radius: 8px;
  padding: 8px 14px;
  font-weight: 700;
  letter-spacing: 0.04em;
}
.panic:hover { background: #a50e19; }
.panic.stopping {
  background: var(--navy);
}
.panic.stopping:hover { background: #16365c; }

.stage { position: relative; min-height: 0; }
.map-stack {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  min-height: 0;
  z-index: 1;
}
#map { position: relative; flex: 1; height: auto; min-height: 0; width: 100%; background: #dfe8f0; z-index: 1; }
.map-status-bar {
  display: none;
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 168px;
  flex-direction: column;
  background: #fff;
  border-top: 1px solid var(--line);
  box-shadow: 0 -8px 24px rgba(15, 39, 68, 0.08);
  z-index: 40;
  min-height: 120px;
  overflow: hidden;
}
.stage.map-status-on .map-status-bar {
  display: flex;
}
.stage.map-status-on .map-status-bar.hidden { display: flex; }
.stage.map-status-on:not(.status-loose) .inspector:not(.loose) { bottom: 184px; }
.stage.map-status-on:not(.status-loose):has(#side-right:not(.loose)) .map-status-bar:not(.loose) {
  right: 392px;
}
.map-status-bar.loose {
  right: auto;
  bottom: auto;
  border: 1px solid #e4ebf2;
  border-radius: 14px;
  box-shadow: var(--shadow);
}
.map-status-bar:not(.pinned) .map-status-head { cursor: move; }
.map-status-bar.pinned .inspector-split {
  pointer-events: none;
  cursor: default;
}
.map-status-head {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 12px;
  border-bottom: 1px solid var(--line);
  flex: 0 0 auto;
  flex-wrap: wrap;
}
.map-status-head strong {
  font-size: 11px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--navy);
  margin-right: 4px;
}
.map-status-table-wrap {
  overflow: auto;
  flex: 1;
  min-height: 0;
}
.map-status-table { margin: 0; font-size: 12px; }
.map-status-table thead th {
  position: sticky;
  top: 0;
  background: #f4f7fb;
  z-index: 1;
}
.map-status-table tbody tr { cursor: pointer; }
.map-status-table tbody tr:hover { background: #eef4fb; }

.inspector {
  position: absolute;
  top: 16px;
  right: 16px;
  bottom: 16px;
  width: 360px;
  min-width: 280px;
  background: #fff;
  border: 1px solid #e4ebf2;
  border-radius: 14px;
  box-shadow: var(--shadow);
  overflow: auto;
  padding: 14px;
  z-index: 5000;
  display: flex;
  flex-direction: column;
}
.inspector.live {
  box-shadow: 0 0 0 3px rgba(193, 18, 31, 0.28), var(--shadow);
}
.inspector.loose {
  bottom: auto;
  right: auto;
}
.inspector-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: -14px -14px 12px;
  padding: 8px 10px;
  background: #f4f7fb;
  border-bottom: 1px solid var(--line);
  border-radius: 14px 14px 0 0;
  position: sticky;
  top: -14px;
  z-index: 3;
}
.inspector.loose:not(.pinned) .inspector-bar { cursor: move; }
.inspector-bar-title {
  flex: 0 0 auto;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: #6a7d93;
}
.inspector-bar-spacer { flex: 1; }
.cam-lock-toggle {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  cursor: pointer;
  user-select: none;
  font-size: 11px;
  font-weight: 700;
  color: #6a7d93;
}
.cam-lock-toggle input { position: absolute; opacity: 0; width: 0; height: 0; }
.cam-lock-switch {
  width: 28px;
  height: 16px;
  border-radius: 999px;
  background: #c5d0dc;
  position: relative;
  flex: 0 0 auto;
}
.cam-lock-switch::after {
  content: "";
  position: absolute;
  top: 2px;
  left: 2px;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 1px 2px rgba(0,0,0,.2);
  transition: transform 120ms ease;
}
.cam-lock-toggle input:checked + .cam-lock-switch { background: var(--navy); }
.cam-lock-toggle input:checked + .cam-lock-switch::after { transform: translateX(12px); }
.cam-lock-toggle input:checked ~ .cam-lock-text { color: var(--navy); }
.cam-lock-error { color: #b42318 !important; }
.inspector-pin,
.inspector-restore {
  width: auto;
  padding: 5px 10px;
  font-size: 12px;
}
.inspector-pin.on {
  background: var(--navy);
  color: #fff;
  border-color: var(--navy);
}
.inspector-split {
  position: absolute;
  z-index: 9;
  background: transparent;
}
.inspector-split.w { left: 0; top: 12px; bottom: 12px; width: 8px; cursor: ew-resize; }
.inspector-split.e { right: 0; top: 12px; bottom: 12px; width: 8px; cursor: ew-resize; }
.inspector-split.n { top: 0; left: 12px; right: 12px; height: 8px; cursor: ns-resize; }
.inspector-split.s { bottom: 0; left: 12px; right: 12px; height: 8px; cursor: ns-resize; }
.inspector-split.nw { left: 0; top: 0; width: 14px; height: 14px; cursor: nwse-resize; }
.inspector-split.ne { right: 0; top: 0; width: 14px; height: 14px; cursor: nesw-resize; }
.inspector-split.sw { left: 0; bottom: 0; width: 14px; height: 14px; cursor: nesw-resize; }
.inspector-split.se { right: 0; bottom: 0; width: 14px; height: 14px; cursor: nwse-resize; }
.inspector-split:hover { background: rgba(27, 111, 191, 0.14); }
.inspector.pinned .inspector-split {
  pointer-events: none;
  cursor: default;
}
body.resizing-inspector { user-select: none !important; }
body.resizing-n, body.resizing-s, body.resizing-n *, body.resizing-s * { cursor: ns-resize !important; }
body.resizing-e, body.resizing-w, body.resizing-e *, body.resizing-w * { cursor: ew-resize !important; }
body.resizing-nw, body.resizing-se, body.resizing-nw *, body.resizing-se * { cursor: nwse-resize !important; }
body.resizing-ne, body.resizing-sw, body.resizing-ne *, body.resizing-sw * { cursor: nesw-resize !important; }
body.resizing-move, body.resizing-move * { cursor: move !important; }

h2, h3 {
  margin: 0;
  font-size: 11px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: #6a7d93;
  font-weight: 700;
}
.section-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  margin-bottom: 8px;
}
section { margin-bottom: 16px; }
.hint { color: var(--muted); font-size: 12px; line-height: 1.4; }
.place-hint { color: var(--navy); font-weight: 600; }

.button-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.button-card {
  background: #f6f9fc;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 9px 10px;
  cursor: pointer;
}
.button-card.active { border-color: var(--blue); background: #eef5fc; }
.button-card header {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  font-weight: 650;
  font-size: 13px;
}
.meta { color: var(--muted); font-size: 12px; margin-top: 4px; }
#overlay-ack-by.ack-other { color: var(--navy); font-weight: 700; font-size: 14px; }
.dot { width: 8px; height: 8px; border-radius: 50%; display: inline-block; margin-right: 6px; }
.dot.on { background: var(--green); }
.dot.off { background: var(--red); }
.dot.alert { background: var(--red); animation: ping 1s infinite; }

.tiny {
  font-size: 11px;
  padding: 4px 8px;
  border-radius: 6px;
  border: 1px solid var(--line);
  background: #fff;
  color: var(--navy);
  font-weight: 600;
}

.field { display: flex; flex-direction: column; gap: 6px; font-size: 12px; color: var(--muted); margin: 8px 0; }
.field-hint { margin: -4px 0 10px; font-size: 11px; line-height: 1.4; color: var(--muted); }
.check { display: flex; gap: 8px; align-items: center; font-size: 13px; margin: 8px 0; color: var(--muted); }
.check input { width: auto; }
.cam-laptop-check { margin: 0 0 0 4px; white-space: nowrap; }
input, select, textarea {
  width: 100%;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 8px 10px;
}

.video-frame {
  position: relative;
  aspect-ratio: 16/10;
  background: #0e1a28;
  border-radius: 10px;
  overflow: hidden;
}
.video-frame video, .video-frame img, .video-frame iframe {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  border: 0;
  background: #000;
}
.video-placeholder {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  color: #c5d3e2;
  font-size: 13px;
  padding: 16px;
  text-align: center;
}
.video-frame.live .btn-cam-max { display: flex; }
.btn-cam-max {
  display: none;
  position: absolute;
  top: 8px;
  right: 8px;
  z-index: 6;
  border: 0;
  border-radius: 8px;
  background: rgba(8, 16, 28, 0.72);
  color: #fff;
  font-size: 12px;
  font-weight: 700;
  padding: 6px 10px;
  cursor: pointer;
}
.btn-cam-max:hover { background: rgba(8, 16, 28, 0.9); }
.cam-q-badge {
  display: none;
  position: absolute;
  top: 8px;
  left: 8px;
  z-index: 6;
  border-radius: 8px;
  background: rgba(8, 16, 28, 0.72);
  color: #d6e4f2;
  font-size: 11px;
  font-weight: 700;
  padding: 6px 8px;
  letter-spacing: 0.04em;
}
body.cam-max-on::after {
  content: "";
  position: fixed;
  inset: 0;
  background: rgba(8, 16, 28, 0.72);
  z-index: 65;
}
.video-frame.cam-max {
  position: fixed;
  inset: 18px;
  z-index: 70;
  aspect-ratio: auto;
  border-radius: 12px;
  box-shadow: 0 24px 70px rgba(0, 0, 0, 0.45);
}
.video-frame.cam-max video,
.video-frame.cam-max img,
.video-frame.cam-max iframe {
  object-fit: contain;
}
.cam-lock-box {
  position: absolute;
  inset: 0;
  z-index: 5;
  display: grid;
  place-items: center;
  padding: 12px;
  background: rgba(8, 16, 28, 0.35);
}
.cam-lock-box.hidden { display: none !important; }
.video-frame.live .cam-lock-box { display: none !important; }
.cam-lock-card {
  width: min(200px, 92%);
  background: #fff;
  color: var(--navy);
  border-radius: 10px;
  padding: 12px;
  box-shadow: 0 10px 28px rgba(0, 0, 0, 0.4);
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.cam-lock-card label {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: #6a7d93;
}
.cam-lock-card input {
  text-align: center;
  font-size: 14px;
  padding: 8px 10px;
}
.cam-lock-card .btn { width: 100%; }
.cam-lock-card .cam-lock-error {
  margin: 0;
  font-size: 11px;
  text-align: center;
}
.rec-badge {
  position: absolute;
  top: 8px;
  left: 8px;
  background: var(--red);
  color: #fff;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.08em;
  padding: 4px 8px;
  border-radius: 4px;
}
.audio-viz {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin: 8px 0 2px;
}
.audio-viz.hidden { display: none !important; }
.vu-meter {
  display: flex;
  align-items: center;
  gap: 8px;
}
.vu-track {
  position: relative;
  flex: 1;
  height: 18px;
  background: #e6edf4;
  border: 1px solid var(--line);
  border-radius: 999px;
  overflow: hidden;
}
.vu-fill {
  height: 100%;
  width: 0%;
  border-radius: inherit;
  background: #22c55e;
  transition: width 50ms linear, background 80ms;
}
.vu-peak {
  position: absolute;
  top: 2px;
  bottom: 2px;
  width: 2px;
  left: 0;
  background: #16324f;
  opacity: 0.55;
  transition: left 80ms linear;
}
.vu-cap {
  flex: 0 0 72px;
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--muted);
}
.audio-viz.live .vu-cap { color: #1b7a3a; }
.audio-controls {
  display: none;
  align-items: center;
  gap: 6px;
}
.audio-viz.speakers .audio-controls { display: flex; }
.audio-btn {
  flex: 0 0 auto !important;
  min-width: 44px;
  padding: 6px 8px;
  font-size: 12px;
}
#cam-vol {
  flex: 1;
  height: 6px;
  accent-color: var(--navy, #16324f);
}
#cam-vol-pct {
  width: 36px;
  font-size: 11px;
  font-weight: 700;
  color: var(--muted);
  text-align: right;
}
.audio-viz.muted .vu-cap { color: #9a3b3b; }
.row-actions { display: flex; gap: 6px; margin-top: 8px; flex-wrap: wrap; }
.row-actions .btn, .row-actions button { flex: 1; font-size: 12px; }
.tg-send-row {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 6px;
}
.tg-send-btn {
  width: auto;
  flex: 0 0 auto;
  margin: 0;
  padding: 5px 10px;
  font-size: 11px;
  border: 0;
  background: var(--navy);
  color: #fff;
  font-weight: 700;
  letter-spacing: 0.03em;
}
.tg-send-btn:hover { filter: brightness(1.08); }
.tg-send-btn:disabled {
  background: #c5d0dc;
  color: #fff;
  cursor: not-allowed;
  filter: none;
}
.tg-send-btn.sent {
  background: #1b7a3a;
}

.inspector .ghost {
  background: #fff;
  color: var(--navy);
  border: 1px solid var(--line);
}

.alert-detail {
  background: #f6f9fc;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 10px;
  font-size: 13px;
}
.alert-detail.empty { color: var(--muted); }
.alert-detail h3 { text-transform: none; letter-spacing: 0; font-size: 15px; color: var(--text); }
.note-form { display: flex; flex-direction: column; gap: 6px; margin-top: 8px; }
.evidence-list { list-style: none; padding: 0; margin: 10px 0 0; display: flex; flex-direction: column; gap: 8px; }
.evidence-list li {
  background: #f6f9fc;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 8px;
  font-size: 12px;
}
.evidence-list img, .evidence-list video { width: 100%; border-radius: 6px; margin-top: 6px; }
.ev-actions { display: flex; gap: 6px; margin-top: 6px; }

.overlay {
  position: fixed;
  top: calc(var(--topbar-h) + 16px);
  left: 16px;
  right: 392px;
  bottom: auto;
  background: transparent;
  display: block;
  z-index: 40;
}
.overlay.moved {
  left: auto;
  right: auto;
  width: auto;
}
.overlay-card {
  background: #fff;
  border-left: 5px solid var(--red);
  border-radius: 12px;
  padding: 12px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  box-shadow: var(--shadow);
  position: relative;
  text-align: left;
  cursor: grab;
}
.overlay-card.dragging { cursor: grabbing; }
.kicker { color: var(--red); letter-spacing: 0.18em; text-transform: uppercase; font-size: 11px; margin: 0 0 4px; }
.overlay-card h2 { font-size: 18px; color: var(--navy); text-transform: none; letter-spacing: 0; margin: 0; }
.overlay-card p { margin: 4px 0 0; color: var(--muted); }
.overlay-times:empty { display: none; }
.overlay-actions { display: flex; gap: 8px; justify-content: flex-end; flex-wrap: wrap; margin: 0; cursor: default; }
.overlay-actions #overlay-stop,
.overlay-actions button:first-child {
  background: var(--navy);
  border: 0;
  color: white;
  padding: 10px 16px;
  border-radius: 8px;
  font-weight: 700;
}
.btn-ack {
  border: 0;
  color: #fff;
  background: var(--red);
  border-radius: 8px;
  padding: 8px 14px;
  font-weight: 700;
  animation: ack-blink 0.7s ease-in-out infinite;
}
.btn-ack-on {
  border: 0;
  color: #fff;
  background: var(--green);
  border-radius: 8px;
  padding: 8px 14px;
  font-weight: 700;
  animation: none;
}
@keyframes ack-blink {
  0%, 100% { background: #c1121f; box-shadow: 0 0 0 0 rgba(193, 18, 31, 0.45); }
  50% { background: #ff3b3b; box-shadow: 0 0 0 6px rgba(193, 18, 31, 0); }
}
.siren { display: none; }

dialog {
  border: 0;
  background: #fff;
  color: var(--text);
  border-radius: 12px;
  width: min(440px, 92vw);
  box-shadow: var(--shadow);
  padding: 20px;
}
dialog::backdrop { background: rgba(15, 39, 68, 0.45); }
dialog h3 { color: var(--navy); font-size: 16px; text-transform: none; letter-spacing: 0; margin-bottom: 8px; }
.pdf-pass-tabs { display: flex; gap: 6px; margin: 4px 0 12px; }
.pdf-pass-tabs .tab { flex: 1; font-size: 12px; padding: 7px 8px; }
.pdf-pass-tabs .tab:disabled { opacity: 0.55; cursor: default; }
menu { display: flex; justify-content: flex-end; gap: 8px; padding: 0; margin: 16px 0 0; }
.api-help {
  margin-top: 10px;
  font-size: 11px;
  color: var(--muted);
  background: #f6f9fc;
  border-radius: 8px;
  padding: 8px;
  white-space: pre-wrap;
}

#toasts {
  position: fixed;
  right: 372px;
  bottom: 20px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  z-index: 80;
}
.toast {
  background: #fff;
  border: 1px solid var(--line);
  padding: 10px 12px;
  border-radius: 10px;
  min-width: 240px;
  box-shadow: var(--shadow);
  color: var(--text);
}
.toast.danger { border-color: var(--red); }
.toast.warn { border-color: var(--amber); }

.alert-queue {
  position: absolute;
  top: 14px;
  left: 14px;
  z-index: 620;
  width: 288px;
  max-height: 46vh;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 10px;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.97);
  border: 2px solid #d64545;
  box-shadow: 0 10px 26px rgba(15, 39, 68, 0.22);
}
.alert-queue.flash { animation: queue-flash 1.1s ease-out 2; }
@keyframes queue-flash {
  0% { box-shadow: 0 0 0 0 rgba(214, 69, 69, 0.55); }
  70% { box-shadow: 0 0 0 14px rgba(214, 69, 69, 0); }
  100% { box-shadow: 0 10px 26px rgba(15, 39, 68, 0.22); }
}
.alert-queue-head {
  font-size: 12px;
  font-weight: 700;
  color: #8a2222;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}
.alert-queue-row {
  display: flex;
  flex-direction: column;
  gap: 2px;
  text-align: left;
  padding: 8px 10px;
  border-radius: 9px;
  border: 1px solid #e6d2d2;
  background: #fff7f7;
  cursor: pointer;
  font: inherit;
  color: var(--text);
}
.alert-queue-row:hover { background: #ffeded; border-color: #d64545; }
.alert-queue-row span { font-size: 11px; color: #6d7c8d; }
.alert-queue-row.urgent { background: #d64545; border-color: #a52020; color: #fff; }
.alert-queue-row.urgent span { color: #ffe2e2; }

.del-user-box {
  margin-top: 10px;
  padding: 10px;
  border-radius: 10px;
  border: 1px solid #e6d2d2;
  background: #fff7f7;
}

.leaflet-popup-content-wrapper {
  border-radius: 8px;
  box-shadow: var(--shadow);
}
.leaflet-popup-content { margin: 10px 12px; font-family: inherit; color: var(--text); }

.pin { position: relative; text-align: center; }
.pin-head {
  width: 32px;
  height: 32px;
  margin: 0 auto;
  border-radius: 50% 50% 50% 4px;
  transform: rotate(-45deg);
  border: 3px solid #fff;
  box-shadow: 0 6px 14px rgba(16, 38, 67, 0.28);
  display: grid;
  place-items: center;
}
.pin-head span {
  transform: rotate(45deg);
  font-size: 10px;
  font-weight: 800;
  color: #fff;
}
.pin-label {
  margin-top: 4px;
  background: #fff;
  color: var(--navy);
  font-size: 10px;
  font-weight: 700;
  padding: 2px 6px;
  border-radius: 4px;
  box-shadow: 0 2px 6px rgba(16, 38, 67, 0.15);
  white-space: nowrap;
}
.marker-online { background: var(--green); }
.marker-offline { background: var(--red); }
.marker-alert { background: var(--red); animation: ping 1s infinite; }
.alert-halo {
  position: absolute;
  left: 50%;
  top: 4px;
  width: 70px;
  height: 70px;
  margin-left: -35px;
  border: 5px solid #c1121f;
  border-radius: 50%;
  animation: halo 1.15s ease-out infinite;
  pointer-events: none;
  box-sizing: border-box;
}
.alert-halo.delay { animation-delay: 0.45s; }
@keyframes halo {
  0% { transform: scale(0.45); opacity: 0.95; }
  100% { transform: scale(2.4); opacity: 0; }
}

@keyframes ping {
  0% { box-shadow: 0 0 0 0 rgba(193, 18, 31, 0.45); }
  70% { box-shadow: 0 0 0 12px rgba(193, 18, 31, 0); }
  100% { box-shadow: 0 0 0 0 rgba(193, 18, 31, 0); }
}

@media (max-width: 1400px) {
  .search-wrap { max-width: 320px; }
}
@media (max-width: 1100px) {
  .inspector { width: min(320px, calc(100% - 24px)); }
  .test-cluster select { width: 110px; }
  #toasts { right: 16px; }
  .logo-crest,
  .logo-macrosys { height: 60px; max-height: 60px; max-width: 180px; }
}

.view-tabs { display: flex; gap: 6px; flex-shrink: 0; }
.tab {
  border: 1px solid var(--line);
  background: #fff;
  color: var(--navy);
  border-radius: 8px;
  padding: 8px 12px;
  font-weight: 700;
}
.tab.on { background: var(--navy); color: #fff; border-color: var(--navy); }
.user-chip { display: flex; align-items: center; gap: 8px; font-size: 13px; font-weight: 600; white-space: nowrap; }

.workspace {
  display: grid;
  grid-template-columns: 230px 1fr;
  background: #e8eef5;
  z-index: 8;
}
.status-workspace { grid-template-columns: 1fr; }
.status-summary { display: flex; gap: 8px; flex-wrap: wrap; margin: 12px 0 18px; }
#status-table .dot { margin-right: 6px; }
#status-table tr.is-offline td,
.map-status-table tr.is-offline td { color: var(--red); }
.settings-nav {
  background: #fff;
  border-right: 1px solid var(--line);
  padding: 18px 12px;
}
.nav-label {
  font-size: 11px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
  margin: 0 8px 10px;
}
.nav-item {
  display: block;
  width: 100%;
  text-align: left;
  background: transparent;
  border: 0;
  border-radius: 8px;
  padding: 10px 12px;
  color: var(--navy);
  font-weight: 600;
}
.nav-item.on, .nav-item:hover { background: #eef5fc; }
.nav-item.hidden { display: none !important; }
.settings-body { overflow: auto; padding: 24px 28px; }
.settings-panel { display: none; max-width: 920px; }
.settings-panel.on { display: block; }
.settings-panel h3 {
  font-size: 22px;
  text-transform: none;
  letter-spacing: 0;
  color: var(--navy);
  margin-bottom: 8px;
}
.perm-grid {
  display: grid;
  gap: 8px;
  margin: 12px 0 16px;
}
.perm-grid label {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  margin: 0;
  font-size: 14px;
  color: var(--text);
}
.pdfpass-card {
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 14px;
  margin-bottom: 12px;
  background: #fff;
}
.pdfpass-card h4 { margin: 0 0 8px; color: var(--navy); }
.pdfpass-flags { font-size: 12px; color: var(--muted); margin-bottom: 10px; }
.settings-panel { display: none; max-width: 920px; }
.settings-panel.on { display: block; }
.settings-panel h3 {
  font-size: 22px;
  text-transform: none;
  letter-spacing: 0;
  color: var(--navy);
  margin-bottom: 8px;
}
.card-form {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 16px;
  margin: 12px 0 18px;
  box-shadow: var(--shadow);
}
#sound-preview { width: 100%; margin: 8px 0 12px; }
.sound-current { margin: 0 0 4px; font-weight: 700; color: var(--navy); }
.sound-specs {
  color: var(--muted);
  font-size: 13px;
  line-height: 1.55;
  padding-left: 18px;
  margin: 8px 0 14px;
  max-width: 720px;
}
.sound-specs strong { color: var(--text); }
.sound-specs code {
  font-family: Consolas, "Segoe UI", monospace;
  background: #eef3f8;
  padding: 1px 5px;
  border-radius: 4px;
  color: var(--navy);
}
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 0 16px; }
table.data { width: 100%; border-collapse: collapse; background: #fff; border-radius: 12px; overflow: hidden; }
table.data th, table.data td { text-align: left; padding: 10px 12px; border-bottom: 1px solid var(--line); font-size: 13px; }
table.data th { background: #f4f7fb; color: var(--muted); font-size: 11px; letter-spacing: 0.06em; text-transform: uppercase; }
button.linkish {
  background: none;
  border: 0;
  color: #1b6fbf;
  cursor: pointer;
  font: inherit;
  padding: 0;
  text-decoration: underline;
}
.unit-jump { display: flex; flex-wrap: wrap; gap: 8px; margin: 0 0 16px; }
.unit-jump-btn {
  border: 1px solid var(--line);
  background: #eef3f8;
  color: var(--navy);
  border-radius: 8px;
  padding: 8px 12px;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
}
.unit-jump-btn:hover, .unit-jump-btn.on { background: var(--navy); color: #fff; border-color: var(--navy); }
.unit-card { position: relative; background: #fff; border: 1px solid var(--line); border-radius: 12px; padding: 14px; margin-bottom: 12px; scroll-margin-top: 12px; }
.unit-card .grid-2 { align-items: end; }
.unit-card-top {
  display: flex;
  justify-content: flex-end;
  margin: -4px 0 10px;
}
.btn-danger {
  background: #c1121f;
  color: #fff;
  border: 0;
  border-radius: 8px;
  padding: 6px 12px;
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
}
.btn-danger:hover { filter: brightness(1.08); }
.rtmp-box {
  margin: 8px 0 12px;
  padding: 10px 12px;
  background: #f4f7fb;
  border: 1px dashed var(--line);
  border-radius: 10px;
}
.rtmp-box code {
  display: block;
  margin: 6px 0 8px;
  font-size: 12px;
  word-break: break-all;
  color: var(--navy);
}
.rtmp-status { margin: 0; font-size: 12px; font-weight: 700; color: var(--muted); }
.rtmp-status.ready { color: #1b7a3a; }
.rtmp-status.wait { color: #b45309; }
.rtmp-status.down { color: #c1121f; }

.rtmp-pill {
  display: inline-block;
  padding: 2px 9px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 600;
  white-space: nowrap;
}
.rtmp-pill.ready { background: #e4f6ea; color: #1b7a3a; }
.rtmp-pill.wait { background: #fdf1de; color: #b45309; }
.rtmp-pill.down { background: #fde8ea; color: #c1121f; }

.recordings-body { max-width: none; }
.recordings-body h3 {
  font-size: 22px;
  text-transform: none;
  letter-spacing: 0;
  color: var(--navy);
  margin: 0 0 6px;
}
.recordings-nav-item small {
  display: block;
  margin-top: 2px;
  font-weight: 400;
  color: var(--muted);
  font-size: 11px;
  letter-spacing: 0;
  text-transform: none;
}
.recordings-player {
  background: #0e1a28;
  border-radius: 12px;
  overflow: hidden;
  margin: 16px 0;
  min-height: 220px;
}
.recordings-body:has(#rec-player-meta:not(.hidden)) .recordings-player {
  border-radius: 12px 12px 0 0;
  margin-bottom: 0;
}
.recordings-player video,
.recordings-player audio {
  display: block;
  width: 100%;
  background: #0e1a28;
}
.recordings-player video {
  aspect-ratio: 16 / 9;
  max-height: 58vh;
  object-fit: contain;
}
.recordings-player .rec-empty {
  margin: 0;
  padding: 28px;
  background: transparent;
  color: #c5d4e4;
}
.rec-player-meta {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  align-items: center;
  padding: 10px 14px;
  background: #fff;
  border: 1px solid var(--line);
  border-top: 0;
  border-radius: 0 0 12px 12px;
  margin: 0 0 16px;
}
.recordings-list { display: flex; flex-direction: column; gap: 8px; margin-top: 8px; }
.rec-event {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 12px 14px;
  text-align: left;
  width: 100%;
  color: inherit;
}
.rec-event:hover, .rec-event.on { border-color: var(--blue); background: #eef5fc; }
.rec-event strong { display: block; font-size: 14px; color: var(--navy); }
.rec-event .meta { margin-top: 2px; }
.rec-empty { color: var(--muted); background: #fff; border-radius: 12px; padding: 24px; }

.login-gate {
  position: fixed;
  inset: 0;
  z-index: 30000;
  display: grid;
  place-items: center;
  background:
    radial-gradient(circle at 20% 0%, #fff 0, transparent 40%),
    linear-gradient(180deg, #f4f7fb, #d9e3ee);
}
html:not(.c4-in) #app {
  visibility: hidden !important;
  pointer-events: none;
}
html:not(.c4-in) .inspector,
body:has(#login-gate:not(.hidden)) .inspector {
  display: none !important;
}
html.c4-in #login-gate {
  display: none !important;
}
.login-body {
  min-height: 100%;
  display: grid;
  place-items: center;
  background:
    radial-gradient(circle at 20% 0%, #fff 0, transparent 40%),
    linear-gradient(180deg, #f4f7fb, #d9e3ee);
}
.login-card {
  width: min(420px, 92vw);
  max-width: 420px;
  margin: 0 auto;
  background: #fff;
  border-radius: 16px;
  padding: 28px 28px 20px;
  box-shadow: var(--shadow);
  text-align: center;
  box-sizing: border-box;
}
.login-card .field,
.login-card .field input,
.login-card .password-wrap {
  width: 100%;
  max-width: 100%;
  box-sizing: border-box;
}
.login-crest {
  height: 96px;
  width: auto;
  max-width: 100%;
  margin: 0 auto 12px;
  object-fit: contain;
  background: transparent;
  padding: 0;
}
.password-wrap { position: relative; }
.password-wrap input { padding-right: 40px; }
.eye-btn {
  position: absolute;
  right: 4px;
  top: 50%;
  transform: translateY(-50%);
  border: 0;
  background: transparent;
  color: #90a0b0;
  width: 32px;
  height: 32px;
  border-radius: 6px;
  display: grid;
  place-items: center;
  padding: 0;
  cursor: pointer;
}
.eye-btn svg { width: 18px; height: 18px; display: block; }
.eye-btn .eye-slash { display: none; }
.eye-btn.on .eye-slash { display: block; }
.eye-btn:hover { color: #1b4f8a; background: transparent; }
.eye-btn.on { color: #1b4f8a; }
.login-kicker { margin: 0; color: var(--muted); letter-spacing: 0.12em; text-transform: uppercase; font-size: 11px; }
.login-card h1 { margin: 6px 0 8px; font-size: 22px; color: var(--navy); }
.login-error { color: var(--red); font-size: 13px; }
.login-help { margin-top: 14px; }
.login-foot {
  margin-top: 18px;
  padding-top: 12px;
  border-top: 1px solid var(--line);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  color: var(--muted);
  font-size: 11px;
}
.login-foot img { height: 42px; }
