:root {
  color-scheme: dark;
  --bg: #07090b;
  --panel: #12171b;
  --panel-strong: #1a2228;
  --text: #f3f7f8;
  --muted: #9fb0b8;
  --accent: #22c55e;
  --line: #2a3339;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  width: 100vw;
  height: 100vh;
  height: 100dvh;
  overflow: hidden;
  background: var(--bg);
  color: var(--text);
  font-family: "Segoe UI", system-ui, sans-serif;
}

.topbar {
  display: grid;
  grid-template-columns: clamp(48px, 5vw, 100px) minmax(0, 1fr) clamp(48px, 5vw, 100px);
  align-items: center;
  gap: clamp(6px, 1vw, 14px);
  height: auto;
  min-height: clamp(64px, 10dvh, 110px);
  padding: clamp(5px, 0.8vw, 8px) clamp(8px, 1.4vw, 20px);
  border-bottom: 1px solid var(--line);
  background: var(--panel);
  overflow: hidden;
}

.brand-shield {
  width: clamp(40px, 4.5vw, 80px);
  height: clamp(48px, 5.4vw, 92px);
  object-fit: contain;
  justify-self: center;
}

.brand-shield.right {
  width: clamp(40px, 4.5vw, 80px);
  height: clamp(48px, 5.4vw, 92px);
  justify-self: center;
}

.brand-title {
  min-width: 0;
  text-align: center;
}

h1,
h2,
p {
  margin: 0;
}

h1 {
  font-size: clamp(13px, 1.6vw, 24px);
  line-height: 1.1;
  font-weight: 800;
  color: #fff;
}

.brand-title strong {
  display: block;
  margin-top: clamp(1px, 0.2vw, 3px);
  font-size: clamp(10px, 1.1vw, 17px);
  color: #fff;
}

.brand-title p {
  margin-top: clamp(1px, 0.2vw, 3px);
  font-size: clamp(11px, 1.2vw, 18px);
  font-weight: 650;
  color: #fff;
}

.layout-buttons {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 5px;
}

button,
a {
  min-height: 34px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--panel-strong);
  color: var(--text);
  padding: 7px 12px;
  font: inherit;
  font-size: 13px;
  text-decoration: none;
  cursor: pointer;
}

button.active {
  border-color: var(--accent);
  color: #dcfce7;
}

button.listen {
  min-height: 30px;
  padding: 5px 10px;
}

button.feature {
  min-height: 30px;
  padding: 5px 10px;
}

button.feature.active {
  border-color: #38bdf8;
  color: #bae6fd;
}

button.listen.active {
  border-color: #f59e0b;
  color: #fde68a;
}

button.record.active {
  border-color: #ef4444;
  color: #fecaca;
}

.shell {
  display: grid;
  grid-template-columns: clamp(260px, 16vw, 320px) minmax(0, 1fr);
  gap: clamp(6px, 0.7vw, 10px);
  height: calc(100dvh - clamp(86px, 14dvh, 134px));
  padding: clamp(6px, 0.7vw, 10px);
  overflow: hidden;
}

.sidebar {
  display: grid;
  grid-template-rows: auto auto minmax(0, 1fr) auto;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
}

.sidebar-head,
.mode-panel,
.layout-panel,
.objectives-panel {
  padding: 10px;
}

.mode-panel {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  border-bottom: 1px solid var(--line);
}

.mode-panel #refresh,
.mode-panel #logout,
.mode-panel #sessionInfo,
.mode-panel #status {
  grid-column: 1 / -1;
}

.mode-panel .recordings-link,
.mode-panel #recordActive {
  grid-column: 1 / -1;
}

.mode-panel .admin-link {
  grid-column: 1;
}

.mode-panel #logout {
  grid-column: 2;
}

.nav-link {
  display: grid;
  min-height: 34px;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #0d1317;
}

.nav-link.active {
  border-color: var(--accent);
  color: #dcfce7;
}

#status {
  color: var(--muted);
  font-size: 12px;
}

#sessionInfo {
  color: #bbf7d0;
  font-size: 12px;
}

.admin-only {
  display: none;
}

body.is-admin .admin-only {
  display: grid;
}

.operation-form.admin-only {
  display: none;
}

body.is-admin .operation-form.admin-only {
  display: grid;
}

.login-page {
  display: grid;
  place-items: center;
}

.login-box {
  display: grid;
  gap: 12px;
  width: min(360px, calc(100vw - 30px));
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  padding: 22px;
  text-align: center;
}

.login-box img {
  width: 86px;
  height: 100px;
  object-fit: contain;
  justify-self: center;
}

.login-box h1 {
  font-size: 24px;
}

.login-box p,
.login-box span {
  color: var(--muted);
}

.login-box form {
  display: grid;
  gap: 10px;
}

.login-box input {
  min-height: 38px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #0b0f12;
  color: var(--text);
  padding: 8px 10px;
  font: inherit;
}

.admin-shell {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  gap: 10px;
  height: calc(100dvh - var(--topbar-h, 90px));
  padding: 10px;
  overflow: auto;
}

.recordings-shell {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  gap: 10px;
  height: calc(100vh - 134px);
  padding: 10px;
  overflow: hidden;
}

.wall-page {
  background: #030506;
}

.wall-topbar {
  height: clamp(118px, 13dvh, 142px);
  overflow: hidden;
}

.wall-topbar .brand-shield,
.wall-topbar .brand-shield.right {
  width: clamp(62px, 5.4vw, 84px);
  height: clamp(74px, 6.4vw, 98px);
}

.wall-topbar h1 {
  font-size: clamp(20px, 1.82vw, 30px);
  line-height: 1.03;
}

.wall-topbar .brand-title strong {
  font-size: clamp(15px, 1.22vw, 20px);
}

.wall-topbar .brand-title p {
  font-size: clamp(16px, 1.34vw, 22px);
}

.wall-shell {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  gap: clamp(4px, 0.45vw, 7px);
  height: calc(100dvh - clamp(118px, 13dvh, 142px));
  min-height: 0;
  padding: clamp(4px, 0.45vw, 7px);
  overflow: hidden;
}

.wall-toolbar {
  display: grid;
  grid-template-columns: repeat(7, minmax(86px, 112px)) minmax(250px, 280px) minmax(58px, 72px) max-content minmax(230px, 1fr) max-content;
  align-items: center;
  gap: 6px;
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  padding: 6px;
}

.wall-selector {
  grid-column: 1 / -1;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(190px, 1fr));
  gap: 6px;
  max-height: 150px;
  overflow: auto;
  border-top: 1px solid var(--line);
  padding-top: 6px;
}

.wall-selector[hidden] {
  display: none;
}

.wall-selector-row {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 7px;
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #0b0f12;
  padding: 6px 8px;
  font-size: 12px;
}

.wall-selector-row span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.camera-choice.operator-hidden {
  opacity: 0.74;
}

.operator-permission {
  justify-self: start;
  margin-top: 4px;
  min-height: 24px;
  padding: 3px 8px;
  border-color: rgba(34, 197, 94, 0.55);
  color: #bbf7d0;
}

.operator-permission.off {
  border-color: rgba(248, 113, 113, 0.65);
  color: #fecaca;
}

.wall-toolbar button,
.wall-toolbar .nav-link {
  min-height: 28px;
  padding: 4px 8px;
  font-size: 12px;
  white-space: nowrap;
}

body:not(.is-admin) .wall-toolbar {
  grid-template-columns: repeat(4, minmax(88px, auto)) minmax(88px, 120px) minmax(70px, 95px) auto minmax(190px, 1fr) auto;
}

body:not(.is-admin) .wall-toolbar button,
body:not(.is-admin) .wall-toolbar .nav-link {
  min-height: 28px;
  padding: 4px 8px;
  font-size: 12px;
}

.operation-form {
  display: grid;
  grid-template-columns: minmax(175px, 1fr) 62px;
  gap: 6px;
  min-width: 0;
}

.operation-form input {
  min-width: 0;
  min-height: 28px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #0b0f12;
  color: var(--text);
  padding: 4px 8px;
  font: inherit;
  font-size: 12px;
}

.operation-form button {
  min-width: 0;
}

.map-wall-shell {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  gap: clamp(4px, 0.45vw, 7px);
  height: calc(100dvh - clamp(118px, 13dvh, 142px));
  min-height: 0;
  padding: clamp(4px, 0.45vw, 7px);
  overflow: hidden;
}

.map-wall-toolbar {
  grid-template-columns: repeat(6, minmax(96px, auto)) minmax(140px, 1fr) auto auto;
}

.map-wall-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) clamp(250px, 18vw, 340px);
  gap: clamp(5px, 0.55vw, 8px);
  min-width: 0;
  min-height: 0;
}

.map-wall-layout.with-follow-video {
  grid-template-columns: minmax(0, 1.45fr) minmax(320px, 0.95fr) clamp(250px, 18vw, 340px);
}

.map-wall-layout.with-dual-follow {
  grid-template-columns: minmax(0, 1fr) clamp(250px, 18vw, 340px);
}

.map-wall {
  min-width: 0;
  min-height: 0;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #050607;
}

.follow-tracks {
  display: grid;
  grid-template-rows: repeat(2, minmax(0, 1fr));
  gap: clamp(5px, 0.55vw, 8px);
  min-width: 0;
  min-height: 0;
}

.follow-tracks[hidden] {
  display: none;
}

.follow-track {
  display: grid;
  grid-template-columns: minmax(0, 1.45fr) minmax(300px, 0.95fr);
  grid-template-rows: auto minmax(0, 1fr);
  min-width: 0;
  min-height: 0;
  overflow: hidden;
  border: 1px solid rgba(34, 211, 238, 0.45);
  border-radius: 8px;
  background: #070b0f;
}

.follow-track header {
  grid-column: 1 / -1;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  border-bottom: 1px solid rgba(34, 211, 238, 0.24);
  padding: 6px 10px;
}

.follow-track h2 {
  overflow: hidden;
  font-size: 16px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.follow-track p {
  overflow: hidden;
  color: var(--muted);
  font-size: 12px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.follow-track span {
  border: 1px solid rgba(34, 197, 94, 0.65);
  border-radius: 999px;
  padding: 5px 8px;
  color: #bbf7d0;
  font-size: 12px;
  font-weight: 800;
  white-space: nowrap;
}

.follow-track.follow-1 {
  border-color: rgba(34, 211, 238, 0.65);
}

.follow-track.follow-2 {
  border-color: rgba(250, 204, 21, 0.65);
}

.follow-track.follow-2 header {
  border-bottom-color: rgba(250, 204, 21, 0.28);
}

.follow-track-map,
.follow-track-video {
  min-width: 0;
  min-height: 0;
  background: #000;
}

.follow-track-video {
  display: grid;
  place-items: center;
}

.follow-track-video iframe {
  width: 100%;
  height: 100%;
  border: 0;
}

.follow-track-video .offline {
  color: #fff;
  font-size: 18px;
  font-weight: 900;
}

.map-wall-panel {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  min-width: 0;
  min-height: 0;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
}

.follow-video-panel {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  min-width: 0;
  min-height: 0;
  overflow: hidden;
  border: 1px solid rgba(34, 211, 238, 0.55);
  border-radius: 8px;
  background: #070b0f;
  box-shadow: inset 0 0 0 1px rgba(34, 211, 238, 0.12);
}

.follow-video-panel[hidden] {
  display: none;
}

.follow-video-panel header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  border-bottom: 1px solid rgba(34, 211, 238, 0.28);
  padding: 10px;
}

.follow-video-panel h2 {
  overflow: hidden;
  font-size: 17px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.follow-video-panel p {
  overflow: hidden;
  color: var(--muted);
  font-size: 12px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

#followVideoState {
  border: 1px solid rgba(34, 197, 94, 0.65);
  border-radius: 999px;
  padding: 5px 8px;
  color: #bbf7d0;
  font-size: 12px;
  font-weight: 800;
  white-space: nowrap;
}

#followVideoState.recording {
  border-color: rgba(239, 68, 68, 0.85);
  color: #fecaca;
}

.follow-video-frame {
  display: grid;
  min-width: 0;
  min-height: 0;
  place-items: center;
  background: #000;
}

.follow-video-frame iframe {
  width: 100%;
  height: 100%;
  border: 0;
}

.follow-video-frame .offline {
  color: #fff;
  font-size: 20px;
  font-weight: 900;
}

.follow-dialog {
  max-width: min(520px, calc(100vw - 32px));
  border: 1px solid rgba(34, 211, 238, 0.5);
  border-radius: 10px;
  background: #0b1116;
  color: var(--text);
  box-shadow: 0 24px 80px rgba(0, 0, 0, 0.55);
}

.follow-dialog::backdrop {
  background: rgba(0, 0, 0, 0.62);
}

.follow-dialog form {
  display: grid;
  gap: 10px;
  padding: 16px;
}

.follow-dialog h2 {
  font-size: 20px;
}

.follow-dialog p {
  color: var(--muted);
}

.follow-dialog-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.follow-dialog-actions button:last-child {
  grid-column: 1 / -1;
}

.map-wall-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  border-bottom: 1px solid var(--line);
  padding: 10px;
}

.map-wall-head h2 {
  font-size: 16px;
}

#mapWallCount {
  border: 1px solid rgba(34, 197, 94, 0.45);
  border-radius: 999px;
  padding: 3px 8px;
  color: #bbf7d0;
  font-size: 12px;
}

.assignment-list {
  display: grid;
  align-content: start;
  gap: 7px;
  min-height: 0;
  overflow: auto;
  padding: 8px;
}

.assignment-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 7px;
  align-items: center;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #101418;
  padding: 8px;
}

.assignment-row h3,
.assignment-row p {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.assignment-row h3 {
  font-size: 15px;
}

.assignment-row p,
.assignment-row span {
  grid-column: 1 / 2;
  color: var(--muted);
  font-size: 12px;
}

.assignment-row .telemetry {
  grid-column: 1 / -1;
  gap: 8px;
  font-size: 11px;
}

.assignment-row .follow-button {
  min-height: 28px;
  padding: 4px 9px;
  font-size: 12px;
}

.assignment-row .follow-button.active {
  border-color: var(--accent);
  color: #bbf7d0;
}

.assignment-row strong {
  border: 1px solid rgba(148, 163, 184, 0.35);
  border-radius: 999px;
  padding: 5px 8px;
  color: #e2e8f0;
  font-size: 13px;
  white-space: nowrap;
}

.assignment-row select {
  grid-column: 1 / -1;
  width: 100%;
  min-height: 30px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #0b0f12;
  color: var(--text);
  padding: 5px 8px;
  font: inherit;
  font-size: 12px;
}

.assignment-row.near-warning {
  border-color: rgba(245, 158, 11, 0.75);
  box-shadow: inset 0 0 0 1px rgba(245, 158, 11, 0.18);
}

.assignment-row.near-warning strong {
  border-color: rgba(245, 158, 11, 0.8);
  color: #fde68a;
}

.assignment-row.near-critical {
  border-color: rgba(34, 197, 94, 0.85);
  box-shadow: inset 0 0 0 1px rgba(34, 197, 94, 0.24);
}

.assignment-row.near-critical strong {
  border-color: rgba(34, 197, 94, 0.85);
  color: #bbf7d0;
}

.camera-target-select {
  width: 100%;
  min-height: 28px;
  margin-top: 6px;
  border: 1px solid var(--line);
  border-radius: 5px;
  background: #0b0f12;
  color: var(--text);
  padding: 4px 7px;
  font: inherit;
  font-size: 12px;
}

.wall-toolbar #sessionInfo {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

#wallStatus {
  justify-self: end;
  color: #bbf7d0;
  font-size: clamp(12px, 0.85vw, 15px);
  white-space: nowrap;
}

#wallClock {
  min-width: 82px;
  border: 1px solid rgba(148, 163, 184, 0.35);
  border-radius: 999px;
  padding: 6px 10px;
  color: #e2e8f0;
  text-align: center;
  font-variant-numeric: tabular-nums;
}

.wall-grid {
  display: grid;
  grid-template-columns: repeat(var(--wall-cols, 1), minmax(0, 1fr));
  grid-template-rows: repeat(var(--wall-rows, 1), minmax(0, 1fr));
  grid-auto-flow: dense;
  gap: clamp(4px, 0.45vw, 7px);
  min-width: 0;
  min-height: 0;
  height: 100%;
  overflow: hidden;
}

.wall-card {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;
  min-width: 0;
  min-height: 0;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #050607;
}

.wall-grid.features-enabled .wall-card.featured {
  grid-column: span 2;
  grid-row: span 2;
}

.wall-card header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  min-width: 0;
  padding: clamp(4px, 0.45vw, 7px) clamp(6px, 0.62vw, 10px);
  border-bottom: 1px solid var(--line);
  background: var(--panel);
}

.wall-card header > div:first-child {
  min-width: 0;
}

.wall-card h2 {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: clamp(15px, 1.1vw, 22px);
}

.wall-card p {
  overflow: hidden;
  margin-top: 2px;
  color: var(--muted);
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: clamp(11px, 0.82vw, 14px);
}

.wall-state {
  flex: 0 0 auto;
  border: 1px solid rgba(148, 163, 184, 0.45);
  border-radius: 999px;
  padding: 5px 10px;
  color: #cbd5e1;
  font-size: clamp(11px, 0.82vw, 14px);
  font-weight: 800;
}

.wall-actions {
  display: flex;
  flex: 0 0 auto;
  align-items: center;
  justify-content: flex-end;
  gap: 6px;
}

.wall-actions button {
  min-height: 29px;
  padding: 4px 8px;
  font-size: clamp(11px, 0.78vw, 13px);
  white-space: nowrap;
}

.wall-state.online {
  border-color: rgba(34, 197, 94, 0.55);
  color: #bbf7d0;
}

.wall-state.recording {
  border-color: rgba(239, 68, 68, 0.75);
  color: #fecaca;
}

.wall-frame {
  min-width: 0;
  min-height: 0;
  background: #000;
}

.wall-card footer {
  overflow: hidden;
  border-top: 1px solid var(--line);
  background: var(--panel);
  padding: 4px 8px;
  font-size: clamp(10px, 0.72vw, 12px);
}

.telemetry {
  display: flex;
  min-width: 0;
  align-items: center;
  gap: 10px;
  overflow: hidden;
  color: #bae6fd;
  white-space: nowrap;
}

.telemetry-item {
  display: inline-flex;
  min-width: 0;
  align-items: center;
  gap: 5px;
  overflow: hidden;
  color: #bae6fd;
  text-overflow: ellipsis;
}

.telemetry-item.ok {
  color: #bbf7d0;
}

.telemetry-item.warn {
  color: #fde68a;
}

.telemetry-item.bad {
  color: #fecaca;
}

.battery-icon {
  position: relative;
  display: inline-grid;
  grid-template-columns: repeat(5, 3px);
  gap: 1px;
  width: 24px;
  height: 10px;
  border: 1px solid currentColor;
  border-radius: 2px;
  padding: 1px;
}

.battery-icon::after {
  position: absolute;
  top: 2px;
  right: -4px;
  width: 2px;
  height: 4px;
  border-radius: 0 2px 2px 0;
  background: currentColor;
  content: "";
}

.battery-icon b {
  display: block;
  border-radius: 1px;
  background: rgba(148, 163, 184, 0.2);
}

.battery-icon b.on,
.signal-icon b.on {
  background: currentColor;
}

.signal-icon {
  display: inline-flex;
  align-items: end;
  gap: 2px;
  width: 18px;
  height: 13px;
}

.signal-icon b {
  display: block;
  width: 3px;
  border-radius: 2px 2px 0 0;
  background: rgba(148, 163, 184, 0.25);
}

.signal-icon b:nth-child(1) {
  height: 4px;
}

.signal-icon b:nth-child(2) {
  height: 7px;
}

.signal-icon b:nth-child(3) {
  height: 10px;
}

.signal-icon b:nth-child(4) {
  height: 13px;
}

.gps-icon {
  position: relative;
  display: inline-block;
  width: 13px;
  height: 13px;
  border: 1px solid currentColor;
  border-radius: 50%;
}

.gps-icon::before,
.gps-icon::after {
  position: absolute;
  background: currentColor;
  content: "";
}

.gps-icon::before {
  top: 5px;
  left: -3px;
  width: 17px;
  height: 1px;
}

.gps-icon::after {
  top: -3px;
  left: 5px;
  width: 1px;
  height: 17px;
}

.wall-page:fullscreen .wall-toolbar {
  display: none;
}

.wall-page:fullscreen .wall-topbar {
  height: 132px !important;
  padding-block: 10px !important;
}

.wall-page:fullscreen .wall-topbar .brand-shield,
.wall-page:fullscreen .wall-topbar .brand-shield.right {
  width: 96px !important;
  height: 112px !important;
}

.wall-page:fullscreen .wall-topbar h1 {
  font-size: 31px !important;
}

.wall-page:fullscreen .wall-topbar .brand-title strong {
  font-size: 21px !important;
}

.wall-page:fullscreen .wall-topbar .brand-title p {
  font-size: 24px !important;
}

.wall-page:fullscreen .wall-shell {
  display: grid !important;
  grid-template-rows: minmax(0, 1fr) !important;
  height: calc(100dvh - 132px) !important;
  min-height: calc(100dvh - 132px) !important;
  padding: 6px !important;
}

:fullscreen .wall-toolbar {
  display: none;
}

:fullscreen .wall-topbar {
  height: 132px !important;
  padding-block: 10px !important;
}

:fullscreen .wall-topbar .brand-shield,
:fullscreen .wall-topbar .brand-shield.right {
  width: 96px !important;
  height: 112px !important;
}

:fullscreen .wall-topbar h1 {
  font-size: 31px !important;
}

:fullscreen .wall-topbar .brand-title strong {
  font-size: 21px !important;
}

:fullscreen .wall-topbar .brand-title p {
  font-size: 24px !important;
}

:fullscreen .wall-shell {
  display: grid !important;
  grid-template-rows: minmax(0, 1fr) !important;
  height: calc(100dvh - 132px) !important;
  min-height: calc(100dvh - 132px) !important;
  padding: 6px !important;
}

.map-wall-page:fullscreen .wall-toolbar,
.map-wall-page:fullscreen .map-wall-toolbar {
  display: none;
}

.map-wall-page:fullscreen .wall-topbar,
:fullscreen .map-wall-page .wall-topbar {
  height: 132px !important;
  padding-block: 10px !important;
}

.map-wall-page:fullscreen .map-wall-shell,
:fullscreen .map-wall-shell {
  height: calc(100dvh - 132px) !important;
  grid-template-rows: minmax(0, 1fr) !important;
  padding: 6px !important;
}

.map-wall-page:fullscreen .map-wall-layout,
:fullscreen .map-wall-layout {
  height: 100% !important;
}

:fullscreen .wall-grid {
  height: 100% !important;
  min-height: 0 !important;
  grid-template-rows: repeat(var(--wall-rows, 1), minmax(0, 1fr)) !important;
  gap: 6px;
}

.wall-page:fullscreen .wall-grid {
  height: 100% !important;
  min-height: 0 !important;
  grid-template-rows: repeat(var(--wall-rows, 1), minmax(0, 1fr)) !important;
}

.wall-page:fullscreen .wall-card,
:fullscreen .wall-card {
  height: 100%;
  min-height: 0;
}

.recordings-grid {
  display: grid;
  grid-template-columns: minmax(420px, 0.8fr) minmax(0, 1.2fr);
  gap: 10px;
  min-height: 0;
}

.recordings-grid article {
  display: grid;
  grid-template-rows: auto auto minmax(0, 1fr);
  min-width: 0;
  min-height: 0;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  padding: 10px;
}

.recordings-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 8px;
}

.recordings-head span {
  overflow: hidden;
  color: var(--muted);
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 12px;
}

.telemetry-log-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: flex-end;
}

.telemetry-log-actions button.active {
  border-color: #f59e0b;
  background: #3b2604;
  color: #fde68a;
}

.telemetry-log-actions .disabled {
  opacity: 0.45;
  pointer-events: none;
}

.readonly-id {
  display: inline-flex;
  min-width: 120px;
  min-height: 32px;
  align-items: center;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #0b0f12;
  padding: 0 10px;
  color: var(--muted);
}

.recordings-list {
  display: grid;
  align-content: start;
  gap: 8px;
  min-height: 0;
  overflow: auto;
}

.recording-item {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
  align-items: center;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #0b0f12;
  padding: 9px;
}

.recording-item strong,
.recording-item span {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.recording-item span,
.empty-state {
  color: var(--muted);
  font-size: 12px;
}

.recording-item div:last-child {
  display: flex;
  gap: 6px;
}

#recordingPlayer {
  min-height: 0;
  border-radius: 6px;
}

.admin-nav {
  display: grid;
  grid-template-columns: repeat(4, max-content) 1fr;
  align-items: center;
  gap: 8px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  padding: 10px;
}

.recordings-shell .admin-nav {
  grid-template-columns: repeat(7, max-content) 1fr;
}

.admin-grid {
  display: grid;
  grid-template-columns: minmax(520px, 1.2fr) minmax(420px, 0.9fr);
  grid-auto-rows: minmax(300px, auto);
  gap: 10px;
  min-height: min-content;
}

.admin-grid article {
  min-width: 0;
  min-height: 0;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  padding: 10px;
}

.admin-grid h2 {
  margin-bottom: 8px;
}

.admin-table {
  overflow: auto;
  height: calc(100% - 28px);
}

.ops-admin,
.telemetry-admin,
.devices-admin {
  grid-column: 1 / -1;
}

.users-admin {
  min-height: 380px;
}

.recordings-admin {
  display: grid;
  grid-template-rows: auto auto auto minmax(0, 1fr);
  min-height: 520px;
}

.recordings-admin .recordings-head {
  margin-bottom: 8px;
}

.admin-recording-filters {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-bottom: 8px;
}

.admin-recording-filters select,
.admin-recording-filters button:first-of-type,
.admin-recording-filters button:last-of-type {
  grid-column: 1 / -1;
}

.admin-recording-filters input,
.admin-recording-filters select {
  min-width: 0;
  min-height: 32px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #0b0f12;
  color: var(--text);
  padding: 6px 8px;
  font: inherit;
  font-size: 12px;
}

.admin-recording-preview {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #05080a;
  margin-bottom: 8px;
  padding: 8px;
}

.admin-recording-preview video {
  display: block;
  width: 100%;
  max-height: 300px;
  background: #000;
  border-radius: 6px;
}

.ops-table .metric {
  display: inline-grid;
  min-width: 56px;
  border: 1px solid rgba(148, 163, 184, 0.35);
  border-radius: 999px;
  padding: 3px 8px;
  color: #dbeafe;
  text-align: center;
}

.ops-table .metric.ok {
  border-color: rgba(34, 197, 94, 0.55);
  color: #bbf7d0;
}

.ops-table .metric.warn {
  border-color: rgba(245, 158, 11, 0.65);
  color: #fde68a;
}

.ops-table .metric.bad {
  border-color: rgba(239, 68, 68, 0.72);
  color: #fecaca;
}

.recording-actions {
  display: flex;
  gap: 6px;
  align-items: center;
  flex-wrap: wrap;
}

.recording-actions a,
.recording-actions button {
  min-height: 28px;
  padding: 5px 8px;
  font-size: 12px;
}

.admin-devices {
  overflow: auto;
  height: calc(100% - 28px);
}

.admin-devices table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12px;
}

.admin-devices th,
.admin-devices td {
  border-bottom: 1px solid var(--line);
  padding: 6px;
  text-align: left;
  vertical-align: middle;
  white-space: nowrap;
}

.admin-devices th {
  color: #bbf7d0;
  background: #0d1317;
  position: sticky;
  top: 0;
  z-index: 1;
}

.admin-devices input,
.admin-devices select {
  min-width: 120px;
  min-height: 30px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #0b0f12;
  color: var(--text);
  padding: 6px 8px;
  font: inherit;
  font-size: 12px;
}

.token-control {
  display: grid;
  grid-template-columns: minmax(120px, 1fr) auto;
  gap: 6px;
  align-items: center;
  min-width: 210px;
}

.token-control input {
  min-width: 0;
}

.token-control button {
  min-height: 30px;
  padding: 5px 8px;
  font-size: 12px;
}

.inline-check {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: #dbeafe;
  white-space: nowrap;
}

.inline-check input {
  min-width: auto;
  min-height: auto;
}

.admin-table table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12px;
}

.admin-table th,
.admin-table td {
  border-bottom: 1px solid var(--line);
  padding: 7px;
  text-align: left;
  white-space: nowrap;
}

.admin-table th {
  color: #bbf7d0;
  background: #0d1317;
  position: sticky;
  top: 0;
}

.user-form,
.admin-users {
  display: grid;
  gap: 8px;
}

.user-form {
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) 150px 140px;
  margin-bottom: 10px;
}

.user-form select,
.user-form input,
.admin-users select,
.admin-users input {
  min-width: 0;
  min-height: 34px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #0b0f12;
  color: var(--text);
  padding: 7px 9px;
  font: inherit;
  font-size: 13px;
}

.user-form button {
  grid-column: auto;
}

.admin-users {
  height: calc(100% - 118px);
  overflow: auto;
  align-content: start;
}

.admin-users table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12px;
}

.admin-users th,
.admin-users td {
  border-bottom: 1px solid var(--line);
  padding: 7px;
  text-align: left;
  vertical-align: middle;
}

.admin-users th {
  color: #bbf7d0;
  background: #0d1317;
  position: sticky;
  top: 0;
  z-index: 1;
}

.status-badge,
.session-badge {
  display: inline-grid;
  min-width: 36px;
  min-height: 24px;
  place-items: center;
  border: 1px solid #475569;
  border-radius: 999px;
  color: #dbeafe;
  padding: 2px 8px;
}

.status-badge.active {
  border-color: rgba(34, 197, 94, 0.6);
  color: #bbf7d0;
}

.status-badge.disabled {
  color: #cbd5e1;
  opacity: 0.7;
}

.session-badge.warning {
  border-color: #f59e0b;
  color: #fde68a;
}

.password-action,
.user-actions {
  display: grid;
  grid-template-columns: minmax(120px, 1fr) auto;
  gap: 6px;
}

.user-actions {
  grid-template-columns: repeat(3, max-content);
}

.user-actions button {
  min-height: 30px;
  padding: 5px 7px;
  font-size: 12px;
}

button.danger {
  border-color: rgba(239, 68, 68, 0.65);
  color: #fecaca;
}

.sos-dismiss {
  border-color: rgba(239, 68, 68, 0.8);
  background: rgba(127, 29, 29, 0.72);
  color: #fee2e2;
  font-weight: 800;
}

.sos-audio-button {
  position: fixed;
  right: 14px;
  bottom: 14px;
  z-index: 60;
  border: 1px solid rgba(245, 158, 11, 0.8);
  border-radius: 999px;
  background: rgba(69, 26, 3, 0.94);
  color: #fef3c7;
  padding: 9px 13px;
  font-weight: 800;
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.35);
}

.sos-audio-button.active {
  border-color: rgba(34, 197, 94, 0.75);
  background: rgba(20, 83, 45, 0.94);
  color: #dcfce7;
}

.idle-overlay {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: none;
  place-items: center;
  background: rgba(0, 0, 0, 0.72);
}

.idle-overlay.visible {
  display: grid;
}

.idle-box {
  display: grid;
  gap: 12px;
  width: min(420px, calc(100vw - 28px));
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  padding: 22px;
  text-align: center;
  box-shadow: 0 20px 80px rgba(0, 0, 0, 0.45);
}

.idle-box h2 {
  font-size: 24px;
}

.idle-box p {
  color: var(--muted);
}

.idle-box strong {
  color: #fde68a;
}

.idle-box div {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.sidebar-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--line);
}

.sidebar h2 {
  font-size: 15px;
}

#count {
  border: 1px solid rgba(34, 197, 94, 0.45);
  border-radius: 999px;
  padding: 3px 8px;
  color: #bbf7d0;
  font-size: 12px;
}

.camera-list {
  display: grid;
  align-content: start;
  gap: 1px;
  overflow: auto;
}

.camera-choice {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: start;
  gap: 8px;
  padding: 8px 10px;
  background: #101418;
}

.choice-text {
  min-width: 0;
}

.camera-choice strong,
.camera-choice small {
  display: block;
}

.camera-choice small {
  margin-top: 2px;
  color: var(--muted);
}

.camera-alias {
  width: 100%;
  min-height: 26px;
  margin-top: 5px;
  border: 1px solid var(--line);
  border-radius: 5px;
  background: #0b0f12;
  color: var(--text);
  padding: 4px 7px;
  font: inherit;
  font-size: 12px;
}

.edit-camera {
  min-height: 26px;
  margin-top: 6px;
  padding: 3px 8px;
  font-size: 12px;
}

.camera-editor {
  display: none;
  margin-top: 2px;
}

.camera-choice.editing .camera-editor {
  display: block;
}

.dot {
  width: 9px;
  height: 9px;
  margin-top: 6px;
  border-radius: 50%;
  background: #64748b;
}

.dot.online {
  background: var(--accent);
  box-shadow: 0 0 10px rgba(34, 197, 94, 0.7);
}

.layout-panel {
  border-top: 1px solid var(--line);
}

.objectives-panel {
  display: grid;
  grid-template-rows: auto auto minmax(0, 1fr);
  gap: 8px;
  min-height: 260px;
  border-top: 1px solid var(--line);
}

.target-form {
  display: grid;
  gap: 6px;
}

.target-form input,
.target-row select,
.target-row input {
  width: 100%;
  min-height: 28px;
  border: 1px solid var(--line);
  border-radius: 5px;
  background: #0b0f12;
  color: var(--text);
  padding: 5px 7px;
  font: inherit;
  font-size: 12px;
}

.target-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
}

.target-list {
  display: grid;
  align-content: start;
  gap: 7px;
  min-height: 0;
  overflow: auto;
  padding-bottom: 42px;
  scroll-padding-bottom: 42px;
}

.target-row {
  display: grid;
  grid-template-columns: 1fr auto auto;
  gap: 6px;
  align-items: center;
  border: 1px solid rgba(245, 158, 11, 0.22);
  border-radius: 6px;
  background: #101418;
  padding: 7px;
}

.target-row input,
.target-row select,
.target-row span {
  grid-column: 1 / -1;
}

.target-row span {
  color: var(--muted);
  font-size: 12px;
}

.target-row button {
  min-height: 28px;
  padding: 4px 8px;
  font-size: 12px;
}

.map-shell .sidebar {
  grid-template-rows: auto auto minmax(150px, 34%) minmax(380px, 1fr);
}

.layout-buttons {
  margin-top: 8px;
}

.layout-buttons button {
  display: grid;
  min-width: 0;
  min-height: 32px;
  place-items: center;
  padding: 4px 5px;
  font-size: 12px;
}

.map-shell {
  grid-template-columns: clamp(300px, 20vw, 390px) minmax(0, 1fr);
}

.map-workspace {
  min-width: 0;
  min-height: 0;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #050607;
}

.live-map {
  width: 100%;
  height: 100%;
  min-height: 0;
}

.camera-map-marker {
  display: flex;
  align-items: center;
  gap: 6px;
  color: #fff;
  font: 700 12px "Segoe UI", system-ui, sans-serif;
  text-shadow: 0 1px 2px #000;
}

.camera-map-marker span {
  position: relative;
  width: 16px;
  height: 16px;
  border: 3px solid #dcfce7;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 18px rgba(34, 197, 94, 0.85);
}

.camera-map-marker.sos span {
  width: 16px;
  height: 16px;
  border-color: #fee2e2;
  background: #ef4444;
  box-shadow: 0 0 22px rgba(239, 68, 68, 1);
}

.camera-map-marker.sos span::before,
.camera-map-marker.sos span::after {
  content: "";
  position: absolute;
  left: 50%;
  top: 50%;
  width: 18px;
  height: 18px;
  border: 4px solid rgba(239, 68, 68, 0.78);
  border-radius: 50%;
  transform: translate(-50%, -50%) scale(1);
  animation: sos-map-rings 1.5s ease-out infinite;
  pointer-events: none;
}

.camera-map-marker.sos span::after {
  animation-delay: 0.55s;
}

.camera-map-marker.sos strong {
  border-color: rgba(239, 68, 68, 0.95);
  background: rgba(127, 29, 29, 0.96);
  color: #fee2e2;
  box-shadow: 0 0 18px rgba(239, 68, 68, 0.45);
}

@keyframes sos-map-rings {
  0% { opacity: 0.95; transform: translate(-50%, -50%) scale(1); }
  100% { opacity: 0; transform: translate(-50%, -50%) scale(6.5); }
}

.camera-map-marker.following span {
  width: 22px;
  height: 22px;
  border-color: #fef08a;
  background: #06b6d4;
  box-shadow: 0 0 0 5px rgba(6, 182, 212, 0.28), 0 0 28px rgba(34, 211, 238, 0.95);
}

.camera-map-marker.following strong,
.target-map-marker.following strong {
  border-color: rgba(34, 211, 238, 0.95);
  background: rgba(8, 47, 73, 0.96);
  color: #ecfeff;
  box-shadow: 0 0 18px rgba(34, 211, 238, 0.38);
}

.camera-map-marker.follow-2 span {
  border-color: #e0f2fe;
  background: #facc15;
  box-shadow: 0 0 0 5px rgba(250, 204, 21, 0.26), 0 0 28px rgba(250, 204, 21, 0.95);
}

.camera-map-marker.follow-2 strong,
.target-map-marker.follow-2 strong {
  border-color: rgba(250, 204, 21, 0.95);
  background: rgba(66, 32, 6, 0.96);
  color: #fef9c3;
  box-shadow: 0 0 18px rgba(250, 204, 21, 0.34);
}

.target-map-marker {
  display: flex;
  align-items: center;
  gap: 6px;
  color: #fff;
  font: 700 12px "Segoe UI", system-ui, sans-serif;
  text-shadow: 0 1px 2px #000;
}

.target-map-marker .pin {
  position: relative;
  width: 22px;
  height: 22px;
  border: 3px solid #fee2e2;
  border-radius: 50% 50% 50% 0;
  background: #ef4444;
  transform: rotate(-45deg);
  box-shadow: 0 0 18px rgba(239, 68, 68, 0.85);
}

.target-map-marker.following .pin {
  width: 28px;
  height: 28px;
  border-color: #fef08a;
  background: #06b6d4;
  box-shadow: 0 0 0 6px rgba(6, 182, 212, 0.25), 0 0 30px rgba(34, 211, 238, 0.95);
}

.target-map-marker.follow-2 .pin {
  border-color: #e0f2fe;
  background: #facc15;
  box-shadow: 0 0 0 6px rgba(250, 204, 21, 0.25), 0 0 30px rgba(250, 204, 21, 0.95);
}

.target-map-marker .pin::after {
  content: "";
  position: absolute;
  left: 50%;
  top: 50%;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #fff;
  transform: translate(-50%, -50%);
}

.target-map-marker strong {
  max-width: 104px;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 5px;
  background: rgba(7, 9, 11, 0.82);
  padding: 3px 6px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.camera-map-marker strong {
  max-width: 96px;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 5px;
  background: rgba(7, 9, 11, 0.82);
  padding: 3px 6px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.leaflet-popup-content-wrapper,
.leaflet-popup-tip {
  background: #101418;
  color: var(--text);
}

.camera-grid {
  display: grid;
  grid-template-columns: repeat(var(--grid-cols, 1), minmax(0, 1fr));
  grid-template-rows: repeat(var(--grid-rows, 1), minmax(0, 1fr));
  grid-auto-flow: dense;
  grid-auto-rows: minmax(0, 1fr);
  gap: clamp(5px, 0.65vw, 10px);
  min-width: 0;
  min-height: 0;
  height: 100%;
  overflow: hidden;
}

.camera {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  min-width: 0;
  min-height: 0;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #050607;
  cursor: grab;
}

.camera.sos,
.wall-card.sos,
.assignment-row.sos,
.follow-track.sos {
  border-color: rgba(239, 68, 68, 0.98);
  box-shadow: 0 0 0 1px rgba(239, 68, 68, 0.85), 0 0 24px rgba(239, 68, 68, 0.38);
}

.camera-grid.features-enabled .camera.featured {
  grid-column: span 2;
  grid-row: span 2;
}

.camera-header {
  display: flex;
  align-items: start;
  justify-content: space-between;
  gap: clamp(5px, 0.6vw, 10px);
  min-height: clamp(32px, 4.6dvh, 38px);
  padding: clamp(4px, 0.55vw, 7px) clamp(5px, 0.65vw, 9px);
  background: var(--panel);
}

.camera-header {
  border-bottom: 1px solid var(--line);
}

.camera h2 {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: clamp(12px, 0.82vw, 14px);
}

.camera-header p {
  overflow: hidden;
  margin-top: 2px;
  color: var(--muted);
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: clamp(10px, 0.72vw, 12px);
}

.camera-actions {
  display: flex;
  flex: 0 0 auto;
  flex-wrap: wrap;
  align-items: center;
  justify-content: flex-end;
  gap: 4px;
  max-width: 66%;
}

.camera-actions a,
.camera-actions button {
  min-height: 27px;
  padding: 4px 7px;
  font-size: clamp(10px, 0.72vw, 12px);
  white-space: nowrap;
}

.state {
  flex: 0 0 auto;
  border: 1px solid rgba(148, 163, 184, 0.45);
  border-radius: 999px;
  padding: 4px 7px;
  color: #cbd5e1;
  font-size: clamp(10px, 0.72vw, 12px);
}

.state.online {
  border-color: rgba(34, 197, 94, 0.45);
  color: #bbf7d0;
}

.state.recording {
  border-color: rgba(239, 68, 68, 0.7);
  color: #fecaca;
}

.camera-frame {
  min-height: 0;
  background: #000;
}

.offline {
  display: grid;
  width: 100%;
  height: 100%;
  place-items: center;
  background: #000;
  color: #cbd5e1;
  font-size: 18px;
  font-weight: 800;
}

iframe {
  display: block;
  width: 100%;
  height: 100%;
  border: 0;
  background: #000;
}

video {
  display: block;
  width: 100%;
  height: 100%;
  background: #000;
  object-fit: contain;
}

.camera-grid iframe {
  display: block;
}

@media (max-width: 1100px) {
  .shell,
  .map-shell {
    grid-template-columns: minmax(210px, 26vw) minmax(0, 1fr);
  }

  .wall-toolbar {
    grid-template-columns: repeat(3, minmax(95px, 1fr)) repeat(2, minmax(95px, 1fr));
  }

  .wall-toolbar #sessionInfo,
  #wallStatus,
  #wallClock {
    justify-self: stretch;
  }

  .wall-toolbar #sessionInfo,
  #wallStatus {
    grid-column: span 2;
  }

  .mode-panel,
  .sidebar-head,
  .layout-panel,
  .objectives-panel {
    padding: 8px;
  }

  button,
  a {
    min-height: 31px;
    padding: 6px 8px;
    font-size: 12px;
  }

  .layout-buttons {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }
}

@media (max-width: 760px) {
  body {
    overflow: auto;
  }

  .topbar {
    position: sticky;
    top: 0;
    z-index: 5;
    grid-template-columns: 54px minmax(0, 1fr) 54px;
    height: auto;
    min-height: 78px;
  }

  .brand-shield,
  .brand-shield.right {
    width: 48px;
    height: 58px;
  }

  h1 {
    font-size: clamp(13px, 3.7vw, 18px);
  }

  .brand-title strong {
    font-size: clamp(11px, 3.1vw, 15px);
  }

  .brand-title p {
    font-size: clamp(12px, 3.4vw, 16px);
  }

  .shell,
  .map-shell {
    grid-template-columns: 1fr;
    grid-template-rows: auto minmax(420px, 1fr);
    height: auto;
    min-height: calc(100dvh - 78px);
    overflow: visible;
  }

  .sidebar {
    grid-template-rows: auto auto minmax(120px, 28dvh) auto;
    max-height: 48dvh;
  }

  .map-shell .sidebar {
    grid-template-rows: auto auto minmax(110px, 22dvh) minmax(210px, 1fr);
    max-height: none;
  }

  .camera-grid {
    --grid-cols: 2 !important;
    --grid-rows: auto !important;
    grid-template-rows: none;
    grid-auto-rows: minmax(220px, 36dvh);
    min-height: 420px;
    overflow: visible;
  }

  .camera-grid.features-enabled .camera.featured {
    grid-column: span 1;
    grid-row: span 1;
  }

  .map-workspace {
    min-height: 58dvh;
  }

  .wall-page {
    overflow: auto;
  }

  .wall-topbar {
    min-height: 78px;
    height: auto;
  }

  .wall-topbar .brand-shield,
  .wall-topbar .brand-shield.right {
    width: 48px;
    height: 58px;
  }

  .wall-shell {
    height: auto;
    min-height: calc(100dvh - 78px);
    overflow: visible;
  }

  .wall-toolbar {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .wall-toolbar #sessionInfo,
  #wallStatus,
  #wallClock {
    grid-column: 1 / -1;
  }

  .wall-grid {
    --wall-cols: 2 !important;
    --wall-rows: auto !important;
    grid-template-rows: none;
    grid-auto-rows: minmax(220px, 36dvh);
    overflow: visible;
  }

  .wall-grid.features-enabled .wall-card.featured {
    grid-column: span 1;
    grid-row: span 1;
  }
}

@media (max-width: 520px) {
  .topbar {
    grid-template-columns: 44px minmax(0, 1fr) 44px;
    min-height: 70px;
    padding-inline: 5px;
  }

  .brand-shield,
  .brand-shield.right {
    width: 39px;
    height: 48px;
  }

  .mode-panel {
    grid-template-columns: 1fr 1fr;
    gap: 6px;
  }

  .camera-header {
    align-items: start;
  }

  .camera-actions {
    max-width: 58%;
  }

  .camera-actions a,
  .camera-actions button,
  .state {
    padding-inline: 5px;
  }

  .camera-grid {
    --grid-cols: 1 !important;
    grid-auto-rows: minmax(220px, 44dvh);
  }

  .wall-grid {
    --wall-cols: 1 !important;
    grid-auto-rows: minmax(220px, 44dvh);
  }
}


/* === ADMIN RESPONSIVE === */
@media (max-width: 1100px) {
  .admin-grid {
    grid-template-columns: 1fr;
    grid-auto-rows: auto;
  }

  .admin-grid article {
    min-height: 280px;
  }

  .admin-nav {
    grid-template-columns: repeat(3, 1fr);
    gap: 6px;
  }

  .recordings-shell .admin-nav {
    grid-template-columns: repeat(4, 1fr);
  }

  .user-form {
    grid-template-columns: 1fr 1fr;
  }

  .recordings-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 760px) {
  .admin-shell {
    height: auto;
    overflow: auto;
    padding: 8px;
  }

  .admin-grid {
    grid-template-columns: 1fr;
    grid-auto-rows: auto;
    gap: 8px;
  }

  .admin-grid article {
    min-height: auto;
    max-height: none;
    overflow: visible;
  }

  .admin-table,
  .admin-users,
  .admin-devices {
    height: auto;
    max-height: 50dvh;
    overflow: auto;
  }

  .admin-nav {
    grid-template-columns: repeat(3, 1fr);
    gap: 5px;
  }

  .admin-nav span {
    grid-column: 1 / -1;
    text-align: center;
  }

  .recordings-shell .admin-nav {
    grid-template-columns: repeat(3, 1fr);
  }

  .user-form {
    grid-template-columns: 1fr;
  }

  .user-form button {
    grid-column: 1;
  }

  .admin-table table,
  .admin-users table,
  .admin-devices table,
  .ops-table table {
    display: block;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }

  .password-action {
    grid-template-columns: 1fr auto;
  }

  .user-actions {
    grid-template-columns: repeat(2, 1fr);
    gap: 4px;
  }

  .user-actions button {
    font-size: 11px;
    padding: 4px 5px;
  }

  .token-control {
    min-width: 160px;
  }

  .recordings-grid {
    grid-template-columns: 1fr;
    grid-auto-rows: auto;
  }

  .recording-actions {
    flex-direction: column;
    gap: 4px;
  }

  .admin-recording-filters {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 520px) {
  .admin-shell {
    padding: 5px;
  }

  .admin-nav {
    grid-template-columns: repeat(2, 1fr);
    gap: 4px;
    padding: 8px;
  }

  .admin-nav .nav-link,
  .admin-nav button {
    font-size: 11px;
    padding: 5px 4px;
    min-height: 30px;
  }

  .admin-grid article {
    padding: 8px;
  }

  .admin-grid h2 {
    font-size: 15px;
  }

  .ops-table .metric {
    min-width: 44px;
    padding: 2px 5px;
    font-size: 10px;
  }

  .token-control {
    min-width: 130px;
    grid-template-columns: minmax(80px, 1fr) auto;
  }

  .admin-devices input,
  .admin-devices select {
    min-width: 90px;
    font-size: 11px;
  }
}


/* === ADMIN TOPBAR RESPONSIVE === */
@media (max-width: 760px) {
  .admin-shell .topbar,
  body:has(.admin-shell) .topbar {
    height: auto;
    min-height: 60px;
    padding: 5px 8px;
  }
}

body:has(.admin-shell) {
  overflow: auto;
}

@media (max-width: 760px) {
  .topbar {
    position: sticky;
    top: 0;
    z-index: 10;
  }

  .topbar h1 {
    font-size: clamp(11px, 3.2vw, 16px);
    line-height: 1.1;
  }

  .topbar .brand-title strong {
    font-size: clamp(9px, 2.6vw, 13px);
  }

  .topbar .brand-title p {
    font-size: clamp(10px, 2.8vw, 14px);
  }
}

@media (max-width: 520px) {
  .topbar {
    gap: 4px;
    padding: 4px 4px;
    min-height: 54px;
  }

  .topbar .brand-shield,
  .topbar .brand-shield.right {
    width: 32px !important;
    height: 40px !important;
  }

  .topbar h1 {
    font-size: clamp(9px, 2.8vw, 13px);
  }

  .topbar .brand-title strong {
    font-size: clamp(8px, 2.3vw, 11px);
  }

  .topbar .brand-title p {
    font-size: clamp(9px, 2.5vw, 12px);
  }
}


/* === SOS ALERT === */
@keyframes sos-blink {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.3; }
}

.metric.sos {
  border-color: rgba(239, 68, 68, 0.95);
  color: #fecaca;
  background: rgba(239, 68, 68, 0.25);
  animation: sos-blink 0.8s ease-in-out infinite;
  font-weight: 800;
}

.state.sos {
  border-color: rgba(239, 68, 68, 0.95);
  color: #fecaca;
  background: rgba(239, 68, 68, 0.3);
  animation: sos-blink 0.8s ease-in-out infinite;
  font-weight: 800;
}

.wall-state.sos {
  border-color: rgba(239, 68, 68, 0.95);
  color: #fecaca;
  background: rgba(239, 68, 68, 0.3);
  animation: sos-blink 0.8s ease-in-out infinite;
  font-weight: 800;
}

.camera-map-marker.sos span,
.camera-map-marker.sos.following span,
.camera-map-marker.sos.follow-2 span {
  width: 16px;
  height: 16px;
  border-color: #fee2e2;
  background: #ef4444;
  box-shadow: 0 0 22px rgba(239, 68, 68, 1);
}

.camera-map-marker.sos strong,
.camera-map-marker.sos.following strong,
.camera-map-marker.sos.follow-2 strong {
  border-color: rgba(239, 68, 68, 0.95);
  background: rgba(127, 29, 29, 0.96);
  color: #fee2e2;
  box-shadow: 0 0 22px rgba(239, 68, 68, 0.55);
}


/* ============================================================
   RESPONSIVE MOBILE — Centro de Comando
   Agregado 2026-06-12
   ============================================================ */

/* Botón hamburguesa — oculto en escritorio */
.mobile-menu-btn {
  display: none;
  position: fixed;
  bottom: 20px;
  left: 20px;
  z-index: 300;
  min-height: 52px;
  min-width: 52px;
  width: 52px;
  height: 52px;
  border-radius: 50%;
  background: var(--accent);
  color: #000;
  font-size: 22px;
  border: none;
  box-shadow: 0 3px 14px rgba(0,0,0,0.6);
  cursor: pointer;
  padding: 0;
  line-height: 1;
}

/* ─── PORTRAIT / MOBILE ≤ 768px ─── */
@media (max-width: 768px) {

  /* Mostrar botón hamburguesa */
  .mobile-menu-btn {
    display: grid;
    place-items: center;
  }

  /* Shell: una sola columna → video/mapa ocupa todo */
  .shell {
    grid-template-columns: 1fr;
    padding: 4px;
    gap: 4px;
    height: calc(100dvh - clamp(54px, 10dvh, 90px));
  }

  /* Sidebar: oculta por defecto, se convierte en overlay */
  .sidebar {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    z-index: 250;
    width: min(300px, 85vw);
    border-radius: 0 8px 8px 0;
    overflow-y: auto;
    box-shadow: 4px 0 20px rgba(0,0,0,0.7);
  }

  /* Sidebar visible cuando shell tiene clase sidebar-open */
  .shell.sidebar-open .sidebar {
    display: grid;
  }

  /* Botones del sidebar más fáciles de tocar en móvil */
  .mode-panel a,
  .mode-panel button {
    min-height: 42px;
    font-size: 14px;
  }

  .camera-list .camera-item {
    min-height: 44px;
  }

  /* Map shell: igual que shell genérico */
  .map-shell {
    grid-template-columns: 1fr;
  }

  /* Wall toolbar: scroll horizontal para caber en pantalla chica */
  .wall-toolbar,
  .map-wall-toolbar {
    display: flex;
    flex-wrap: nowrap;
    overflow-x: auto;
    gap: 6px;
    padding: 6px 8px;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
  }

  .wall-toolbar::-webkit-scrollbar,
  .map-wall-toolbar::-webkit-scrollbar {
    display: none;
  }

  .wall-toolbar .nav-link,
  .wall-toolbar button,
  .map-wall-toolbar .nav-link,
  .map-wall-toolbar button {
    white-space: nowrap;
    flex-shrink: 0;
    min-height: 40px;
    font-size: 13px;
  }

  /* Muro Mapa: ocultar panel lateral en móvil portrait */
  .map-wall-panel {
    display: none;
  }

  /* Layout principal del Muro+Mapa: una columna */
  .map-wall-layout {
    grid-template-columns: 1fr;
    grid-template-rows: 1fr;
  }

  /* Camera grid: al menos 1 columna en móvil */
  .camera-grid {
    min-height: 200px;
  }

  /* Recordings en móvil */
  .recordings-shell {
    height: calc(100dvh - 90px);
    overflow: auto;
  }

  .recordings-grid {
    grid-template-columns: 1fr;
  }

  /* Admin nav scroll horizontal */
  .admin-nav {
    display: flex;
    flex-wrap: nowrap;
    overflow-x: auto;
    gap: 6px;
    padding: 6px;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
  }

  .admin-nav::-webkit-scrollbar { display: none; }

  .admin-nav a,
  .admin-nav button {
    white-space: nowrap;
    flex-shrink: 0;
    min-height: 40px;
  }
}

/* ─── LANDSCAPE MOBILE ≤ 768px alto ─── */
@media (max-height: 500px) and (max-width: 900px) {

  /* En landscape: sidebar sigue siendo overlay pero más compacta */
  .shell {
    grid-template-columns: 1fr;
    height: calc(100dvh - 54px);
  }

  .sidebar {
    display: none;
    position: fixed;
    top: 0; left: 0; bottom: 0;
    z-index: 250;
    width: min(280px, 70vw);
    border-radius: 0 8px 8px 0;
    overflow-y: auto;
  }

  .shell.sidebar-open .sidebar {
    display: grid;
  }

  .mobile-menu-btn {
    display: grid;
    place-items: center;
    bottom: 12px;
    left: 12px;
    min-height: 44px;
    min-width: 44px;
    width: 44px;
    height: 44px;
  }

  /* Topbar más compacta en landscape */
  .topbar {
    min-height: 54px !important;
    padding: 3px 6px !important;
  }

  .wall-toolbar,
  .map-wall-toolbar {
    padding: 4px 6px;
    gap: 4px;
  }
}

/* ─── TELÉFONO MUY CHICO ≤ 400px ─── */
@media (max-width: 400px) {
  .sidebar {
    width: 92vw;
  }

  .mode-panel {
    gap: 6px;
  }
}


/* ============================================================
   FIXES V2 — 2026-06-12
   ============================================================ */

/* --- Toolbar muro/muro-mapa: flex con scroll horizontal (no grid) --- */
/* Reemplazar grid con columnas fijas por flex con scroll — más robusto */
.wall-toolbar {
  display: flex !important;
  flex-wrap: nowrap !important;
  overflow-x: auto !important;
  overflow-y: hidden !important;
  scrollbar-width: none !important;
  gap: 6px !important;
}
.wall-toolbar::-webkit-scrollbar { display: none !important; }

/* El selector de cámaras ocupa toda la fila */
.wall-selector {
  flex: 0 0 100% !important;
  order: 99;
}

/* Session info y status toman el espacio sobrante */
.wall-toolbar #sessionInfo,
.wall-toolbar #wallStatus,
.wall-toolbar #wallClock {
  flex-shrink: 0;
  margin-left: auto;
}

/* El form de operación tiene ancho fijo */
.wall-toolbar .operation-form {
  flex-shrink: 0;
  min-width: 280px;
}

/* body:not(.is-admin) no cambia nada extra con flex */
body:not(.is-admin) .wall-toolbar {
  display: flex !important;
}

/* --- Map wall toolbar: también flex --- */
.map-wall-toolbar {
  display: flex !important;
  flex-wrap: nowrap !important;
  overflow-x: auto !important;
  overflow-y: hidden !important;
  scrollbar-width: none !important;
  gap: 6px !important;
}
.map-wall-toolbar::-webkit-scrollbar { display: none !important; }

.map-wall-toolbar #sessionInfo,
.map-wall-toolbar #wallStatus,
.map-wall-toolbar #wallClock {
  flex-shrink: 0;
  margin-left: auto;
}

/* --- Admin nav: flex con scroll — aplica siempre (PC y móvil) --- */
.admin-nav {
  display: flex !important;
  flex-wrap: nowrap !important;
  overflow-x: auto !important;
  scrollbar-width: none !important;
  gap: 6px !important;
  padding: 6px !important;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
}
.admin-nav::-webkit-scrollbar { display: none !important; }

.admin-nav a,
.admin-nav button {
  flex-shrink: 0;
  white-space: nowrap;
}

.admin-nav #sessionInfo {
  flex-shrink: 0;
  margin-left: auto;
  white-space: nowrap;
}

/* recordings-shell nav hereda los mismos estilos */
.recordings-shell .admin-nav {
  flex-wrap: nowrap !important;
  overflow-x: auto !important;
}

/* --- MOBILE: correcciones (anulan CSS mobile anterior problemático) --- */

/* El panel lateral de Muro-Mapa NO se oculta — siempre visible */
@media (max-width: 768px) {
  .map-wall-panel {
    display: block !important;
    max-height: 200px;
    overflow-y: auto;
    border-left: 1px solid var(--line);
  }

  /* Sidebar overlay z-index por encima de Leaflet (1000) y otros */
  .sidebar {
    z-index: 1200 !important;
  }

  /* Oscurecer fondo cuando sidebar abierta */
  .shell.sidebar-open::before {
    content: '';
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.55);
    z-index: 1100;
  }

  /* Camera list: mantener clickeable, altura apropiada */
  .camera-list .camera-item {
    min-height: 38px !important;
    cursor: pointer;
  }

  /* Mode panel buttons: tamaño razonable sin romper layout */
  .mode-panel a,
  .mode-panel button {
    min-height: 38px !important;
    font-size: 13px !important;
  }

  /* Layout panel visible */
  .layout-panel {
    display: block !important;
  }
}

@media (max-height: 500px) and (max-width: 900px) {
  /* Landscape: mismo override */
  .sidebar {
    z-index: 1200 !important;
  }
}


/* ============================================================
   FIXES V3 — 2026-06-12
   Correcciones sobre V2
   ============================================================ */

/* ── FIX 1: FULLSCREEN — toolbar debe ocultarse (mi flex !important lo pisaba) ── */
.wall-page:fullscreen .wall-toolbar,
:fullscreen .wall-toolbar,
.map-wall-page:fullscreen .wall-toolbar,
.map-wall-page:fullscreen .map-wall-toolbar,
:fullscreen .map-wall-toolbar {
  display: none !important;
}

/* ── FIX 2: MOBILE — quitar el ::before backdrop que bloqueaba clicks ── */
/* El backdrop con z-index:1100 bloqueaba los clicks en la lista de cámaras */
@media (max-width: 768px) {
  .shell.sidebar-open::before {
    display: none !important;
    content: none !important;
  }

  /* Sidebar con sombra fuerte para que se vea sin backdrop */
  .sidebar {
    box-shadow: 4px 0 30px rgba(0,0,0,0.85) !important;
  }

  /* ── FIX 3: MURO MAPA mobile — NO cambiar el grid-template del layout ──
     El map-wall-layout tiene lógica JS que agrega clases (with-follow-video, etc.)
     No pisamos el grid para no romper el modo Seguir */
  .map-wall-layout {
    grid-template-columns: minmax(0, 1fr) clamp(180px, 30vw, 240px) !important;
    grid-template-rows: unset !important;
  }

  /* El panel de cámaras/objetivos en móvil: más angosto pero visible */
  .map-wall-panel {
    display: grid !important;
    overflow-y: auto;
    min-width: 150px;
  }

  /* Mapa ocupa todo el alto disponible */
  .map-wall {
    min-height: 0;
    overflow: hidden;
  }

  /* Panel de seguimiento de video */
  .follow-video-panel {
    min-width: 0;
  }
}

/* ── FIX 4: MOBILE LANDSCAPE — muro mapa también mantiene su grid ── */
@media (max-height: 500px) and (max-width: 900px) {
  .map-wall-layout {
    grid-template-columns: minmax(0, 1fr) clamp(160px, 28vw, 200px) !important;
    grid-template-rows: unset !important;
  }

  .map-wall-panel {
    display: grid !important;
  }
}


/* ── PTT BADGE — indicador de voz activa en cámara ── */
.ptt-badge {
  display: none;
  background: rgba(239, 68, 68, 0.9);
  color: #fff;
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.08em;
  padding: 2px 6px;
  border-radius: 3px;
  text-transform: uppercase;
  animation: ptt-pulse 0.6s ease-in-out infinite alternate;
  pointer-events: none;
}

@keyframes ptt-pulse {
  from { opacity: 1; background: rgba(239, 68, 68, 0.9); }
  to   { opacity: 0.7; background: rgba(239, 68, 68, 0.6); }
}

/* Badge en tile de muro */
.wall-cam .ptt-badge {
  position: absolute;
  top: 6px;
  left: 6px;
  z-index: 10;
  font-size: 11px;
  padding: 3px 8px;
}

/* Badge en lista de cámaras (sidebar) */
.camera-item .ptt-badge {
  margin-left: 4px;
  vertical-align: middle;
}

/* Borde rojo pulsante en tile de muro cuando PTT activo */
.wall-cam.ptt-active {
  outline: 2px solid rgba(239, 68, 68, 0.85);
  outline-offset: -2px;
}


/* ── PTT CYAN — Modulando (celeste) ── */
/* Reemplazar rojo por celeste en badges y bordes PTT */
.ptt-badge {
  background: rgba(6, 182, 212, 0.18) !important;
  color: #22d3ee !important;
  border: 1px solid rgba(34, 211, 238, 0.6) !important;
  font-weight: 700 !important;
  font-size: 11px !important;
  letter-spacing: 0.06em !important;
  animation: ptt-cyan-pulse 0.8s ease-in-out infinite alternate !important;
}

@keyframes ptt-cyan-pulse {
  from { opacity: 1; border-color: rgba(34, 211, 238, 0.7); }
  to   { opacity: 0.75; border-color: rgba(34, 211, 238, 0.3); }
}

/* Borde celeste en camera-choice (sidebar) cuando PTT activo */
.camera-choice.ptt-active,
.camera-choice[data-id].ptt-active {
  outline: 2px solid #22d3ee !important;
  outline-offset: -2px;
}

/* Borde celeste en tile de video cuando PTT activo */
.camera.ptt-active,
.wall-cam.ptt-active {
  outline: 2px solid #22d3ee !important;
  outline-offset: -2px;
  box-shadow: 0 0 18px rgba(34, 211, 238, 0.35) !important;
}

/* Banner superior: celeste en lugar de rojo */
#ptt-global-banner {
  background: rgba(6, 182, 212, 0.92) !important;
  color: #000 !important;
  box-shadow: 0 2px 12px rgba(34, 211, 238, 0.5) !important;
  font-weight: 900 !important;
  letter-spacing: 0.06em !important;
}


/* ── PTT BADGE IN ACTIONS — badge dentro de .camera-actions ── */
/* El badge .ptt-badge dentro de .camera-actions: se muestra como chip inline */
.camera-actions .ptt-badge {
  display: none;
  align-self: center;
  margin-right: 4px !important;
  font-size: 11px !important;
  padding: 2px 8px !important;
  border-radius: 4px !important;
  font-weight: 700 !important;
  letter-spacing: 0.05em !important;
  white-space: nowrap;
  /* sobrescribir position:absolute que heredaría de wall-cam */
  position: static !important;
}
.camera-actions .ptt-badge[style*="inline-block"] {
  display: inline-block !important;
}
/* badge en sidebar: sigue siendo inline después del nombre */
.camera-choice .ptt-badge {
  position: static !important;
  margin-left: 6px !important;
  font-size: 10px !important;
  padding: 1px 6px !important;
  border-radius: 3px !important;
}

/* ── PTT wall-card selector (Muro / Muro-Mapa) ── */
.wall-card.ptt-active {
  outline: 2px solid #22d3ee !important;
  outline-offset: -2px;
  box-shadow: 0 0 18px rgba(34,211,238,0.35) !important;
}
.wall-actions .ptt-badge {
  position: static !important;
  margin-right: 4px !important;
  font-size: 11px !important;
  padding: 2px 8px !important;
  border-radius: 4px !important;
  font-weight: 700 !important;
  white-space: nowrap;
}


/* ── Talk-back: boton "Hablar" en camera-actions ── */
button.talk {
  min-height: 30px;
  padding: 5px 10px;
}

button.talk.active {
  border-color: #22d3ee;
  color: #a5f3fc;
  background: rgba(6, 182, 212, 0.18);
}

button.talk-all {
  border-color: #22d3ee;
  color: #a5f3fc;
}

button.talk-all.active {
  background: rgba(6, 182, 212, 0.25);
  border-color: #22d3ee;
  color: #ecfeff;
}
