:root {
  --bg-dark: #1a1a1a;
  --accent: #d32f2f;
  --text-light: #e0e0e0;
  --border: #333;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  padding: 0;
  width: 100%;
  height: 100%;
  font-family: system-ui, -apple-system, sans-serif;
  background: var(--bg-dark);
  color: var(--text-light);
  overflow: hidden;
}

.app-shell {
  height: 100vh;
  display: grid;
  grid-template-rows: 56px 1fr;
}

#timeline-container { display: none !important; }

.app-header {
  height: 56px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: var(--bg-dark);
  border-bottom: 1px solid var(--border);
  padding: 0 16px;
}

.header-left {
  display: flex;
  align-items: center;
  gap: 14px;
}

.logo {
  padding: 6px 10px;
  border: 1px solid var(--border);
  border-radius: 6px;
  font-weight: 700;
}

.title {
  font-size: 15px;
  font-weight: 600;
}

.header-right {
  display: flex;
  align-items: center;
  gap: 14px;
}

/* ── Theme toggle (sun/moon switch) ──────────────────────────────── */
.theme-toggle {
  appearance: none;
  border: 0;
  background: transparent;
  padding: 0;
  cursor: pointer;
  width: 64px;
  height: 30px;
}
.theme-toggle .theme-toggle-track {
  position: relative;
  display: block;
  width: 64px;
  height: 30px;
  border-radius: 999px;
  background: #1c2128;
  border: 1px solid #30363d;
  box-shadow: inset 0 2px 6px rgba(0,0,0,0.6);
  transition: background 0.25s ease;
}
.theme-toggle .theme-toggle-thumb {
  position: absolute;
  top: 2px;
  left: 2px;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: linear-gradient(180deg, #424a55 0%, #2b3038 100%);
  box-shadow: 0 1px 3px rgba(0,0,0,0.6), 0 0 0 1px rgba(255,255,255,0.05) inset;
  transition: transform 0.25s cubic-bezier(0.22, 1, 0.36, 1), background 0.25s ease;
}
.theme-toggle .theme-toggle-icon {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  font-size: 13px;
  pointer-events: none;
  transition: opacity 0.2s ease;
}
.theme-toggle .icon-sun  { left: 8px;  color: #ffb74d; opacity: 0.45; }
.theme-toggle .icon-moon { right: 8px; color: #cfd8dc; opacity: 1; }

.theme-toggle.is-light .theme-toggle-track {
  background: #d7dde4;
  border-color: #8a939c;
  box-shadow: inset 0 2px 6px rgba(0,0,0,0.15);
}
.theme-toggle.is-light .theme-toggle-thumb {
  transform: translateX(34px);
  background: linear-gradient(180deg, #ffe082 0%, #ffb74d 100%);
}
.theme-toggle.is-light .icon-sun  { opacity: 1; }
.theme-toggle.is-light .icon-moon { opacity: 0.45; color: #4a5158; }

/* ── Scale bar + coordinates readout (horizontal: zoom on far right) ─ */
.leaflet-bottom.leaflet-right {
  display: flex;
  flex-direction: row;
  align-items: flex-end;
  gap: 6px;
}
.leaflet-bottom.leaflet-right > * {
  clear: none !important;
  float: none !important;
  margin: 0 0 14px 0 !important;
}
.leaflet-bottom.leaflet-right > .leaflet-control-zoom {
  margin-right: 14px !important;
}

.leaflet-control-scale-line {
  background: rgba(13, 17, 23, 0.85) !important;
  color: #e6edf3 !important;
  border: 1px solid #30363d !important;
  border-top: none !important;
  font-size: 11px !important;
  padding: 2px 6px !important;
  text-shadow: none !important;
}
.leaflet-coords-control {
  background: rgba(13, 17, 23, 0.85);
  border: 1px solid #30363d;
  border-radius: 4px;
  color: #e6edf3;
  padding: 3px 8px;
  font: 11px ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  letter-spacing: 0.3px;
  pointer-events: none;
  white-space: nowrap;
}

.system-clock {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 14px;
}

.connection-status {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
}

.connection-status .dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
}

.connection-status.online .dot {
  background: #2e7d32;
}

.connection-status.offline .dot {
  background: #c62828;
}

.language-switcher {
  display: inline-flex;
  border: 1px solid var(--border);
  border-radius: 6px;
  overflow: hidden;
}

.mode-toggle {
  height: 30px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: #242424;
  color: var(--text-light);
  padding: 0 10px;
  cursor: pointer;
}

.mode-toggle.live {
  background: #37474f;
}

.lang-btn {
  width: 42px;
  height: 30px;
  border: 0;
  color: var(--text-light);
  background: #222;
  cursor: pointer;
  transition: all 0.2s ease;
}

.lang-btn.active {
  background: var(--accent);
  color: #fff;
}

.lang-btn:hover {
  background: #444;
}

.map-layout {
  position: relative;
  width: 100%;
  height: 100%;
}

#map {
  width: 100%;
  height: 100%;
  background: #0a0e14; /* тёмный фон, согласован с Carto Dark */
}

#map .maplibregl-canvas,
#map .maplibregl-canvas-container.maplibregl-interactive {
  cursor: default;
}

#map .maplibregl-canvas:active {
  cursor: grabbing;
}

#map.leaflet-wheel-previewing .leaflet-map-pane {
  will-change: transform;
}

#map.leaflet-wheel-committing .leaflet-marker-icon,
#map.leaflet-wheel-committing .leaflet-marker-shadow {
  transition: none !important;
}

#map.leaflet-zoom-anim .leaflet-zoom-animated {
  transition-duration: 180ms;
  transition-timing-function: cubic-bezier(0.22, 1, 0.36, 1);
}

.leaflet-tile-ghost {
  z-index: 250 !important;
  pointer-events: none !important;
  transition: opacity 260ms ease;
  will-change: opacity;
}

.leaflet-tile-ghost .leaflet-tile {
  opacity: 1 !important;
  transition: none !important;
}

.leaflet-vector-ghost {
  z-index: 450 !important;
  pointer-events: none !important;
  transition: opacity 180ms ease;
  will-change: opacity;
}

.leaflet-vector-ghost canvas,
.leaflet-vector-ghost svg {
  pointer-events: none !important;
}

/* Правый док под виджеты (план 2026-05-20: правая 20% — для виджетов / KPI / ИИ-сводки) */
.widget-rail {
  position: absolute; top: 12px; right: 12px; bottom: 60px;
  width: 280px;
  display: flex; flex-direction: column; gap: 10px;
  pointer-events: none;
  z-index: 500;
  transition: transform 0.25s ease, opacity 0.25s ease;
}
body.widget-rail-collapsed .widget-rail {
  transform: translateX(calc(100% + 16px));
  opacity: 0;
  pointer-events: none;
}

/* Кнопка свернуть/развернуть */
.widget-rail-toggle {
  position: absolute; top: 50%; right: 0;
  transform: translateY(-50%);
  width: 22px; height: 56px;
  background: rgba(13, 17, 23, 0.92);
  border: 1px solid rgba(255,255,255,0.12);
  border-right: none;
  border-radius: 6px 0 0 6px;
  color: #e94560; font-size: 12px; font-weight: 700;
  cursor: pointer; padding: 0;
  z-index: 600;
  display: flex; align-items: center; justify-content: center;
  transition: right 0.25s ease, background 0.15s ease;
}
.widget-rail-toggle:hover { background: rgba(20, 26, 36, 0.96); }
body:not(.widget-rail-collapsed) .widget-rail-toggle { right: 304px; }
.widget-card {
  pointer-events: auto;
  background: rgba(13, 17, 23, 0.85);
  color: #c9d1d9;
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: 8px;
  padding: 10px 12px;
  font-size: 12px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.45);
  -webkit-backdrop-filter: blur(4px);
  backdrop-filter: blur(4px);
}
.widget-card h4 {
  margin: 0 0 6px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.5px;
  text-transform: uppercase;
  color: #e94560;
}
.widget-kpi-row {
  display: flex; justify-content: space-between; align-items: baseline;
  padding: 2px 0; font-size: 12px;
}
.widget-kpi-value { font-weight: 700; color: #fff; }

#timeline-container {
  background: var(--bg-dark);
  border-top: 1px solid var(--border);
  overflow: hidden;
}

.top-controls {
  position: fixed;
  top: 56px;
  left: 80px;
  transform: none;
  z-index: 1400;
  width: 360px;
  height: 58px;
  padding: 10px 12px;
  background: rgba(13, 17, 23, 0.96);
  border-right: 1px solid #30363d;
  border-bottom: 1px solid #21262d;
}

/* Big scenario timer removed per request */
.big-timer { display: none !important; }

.search-box {
  position: relative;
  display: flex;
  align-items: center;
  gap: 8px;
}

.search-box input {
  flex: 1;
  height: 38px;
  border: 1px solid var(--border);
  background: rgba(26, 26, 26, 0.92);
  color: var(--text-light);
  border-radius: 8px;
  padding: 0 12px;
  outline: none;
}

.search-box button {
  height: 38px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: rgba(26, 26, 26, 0.92);
  color: var(--text-light);
  padding: 0 14px;
  cursor: pointer;
}

.search-box button:hover {
  background: var(--accent);
}

.search-results {
  position: absolute;
  top: 42px;
  left: 0;
  right: 0;
  max-height: 290px;
  overflow: auto;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: rgba(20, 20, 20, 0.95);
  z-index: 1200;
}

.search-result {
  padding: 10px 12px;
  border-bottom: 1px solid #2c2c2c;
  cursor: pointer;
  transition: background 0.2s ease;
}

.search-result:last-child {
  border-bottom: 0;
}

.search-result:hover {
  background: #2f2f2f;
}

.search-result small {
  color: #aaa;
}

.fullscreen-btn {
  position: absolute;
  right: 16px;
  bottom: 112px;
  width: 42px;
  height: 42px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: rgba(26, 26, 26, 0.95);
  color: var(--text-light);
  cursor: pointer;
  z-index: 1100;
  transition: all 0.2s ease;
}

.fullscreen-btn:hover {
  background: var(--accent);
}

.hidden {
  display: none !important;
}

.toast {
  position: fixed;
  right: 16px;
  bottom: 120px;
  background: #222;
  color: var(--text-light);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 10px 14px;
  z-index: 2000;
}

.error-overlay {
  position: fixed;
  inset: 0;
  background: rgba(10, 10, 10, 0.85);
  z-index: 2500;
  display: flex;
  align-items: center;
  justify-content: center;
}

.error-card {
  width: min(420px, calc(100% - 24px));
  background: #1f1f1f;
  border: 1px solid #7a2323;
  border-radius: 12px;
  padding: 18px;
}

.error-card h2 {
  margin: 0 0 10px;
}

.error-card button {
  margin-top: 10px;
  border: 1px solid var(--border);
  background: var(--accent);
  color: #fff;
  border-radius: 8px;
  padding: 9px 12px;
  cursor: pointer;
}

.loading-spinner {
  position: fixed;
  inset: 0;
  z-index: 2400;
  background: #111;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
}

.spinner {
  width: 42px;
  height: 42px;
  border: 3px solid #3a3a3a;
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 1s linear infinite;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

.custom-layers-panel,
.legend-panel {
  z-index: 1200;
  color: var(--text-light);
  font-size: 13px;
  background: rgba(26, 26, 26, 0.92);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 12px;
  min-width: 220px;
  transition: all 0.2s ease;
}

.maplibre-legend-panel {
  position: absolute;
  left: 12px;
  bottom: 18px;
}

.custom-layers-panel h4,
.legend-panel h4 {
  margin: 0 0 8px;
  font-size: 14px;
}

.layer-item,
.legend-item {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 6px 0;
}

.layer-item input[type="checkbox"] {
  width: 16px;
  height: 16px;
}

.legend-toggle {
  width: 100%;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #212121;
  color: var(--text-light);
  padding: 8px 10px;
  cursor: pointer;
}

.legend-content {
  margin-top: 10px;
}

.legend-color {
  width: 14px;
  height: 14px;
  border-radius: 50%;
}

.timeline-root {
  height: 100%;
  display: grid;
  grid-template-columns: 300px 1fr 220px;
  align-items: center;
  gap: 12px;
  padding: 10px 14px;
}

.timeline-controls {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.timeline-btn {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  border: 1px solid var(--border);
  background: #252525;
  color: #fff;
  cursor: pointer;
  transition: all 0.2s ease;
}

.timeline-btn:hover,
.speed-btn:hover,
.speed-btn.active {
  background: var(--accent);
}

.speed-group {
  display: inline-flex;
  gap: 4px;
  margin-left: 8px;
}

.speed-btn {
  border: 1px solid var(--border);
  background: #252525;
  color: #fff;
  border-radius: 6px;
  padding: 0 8px;
  height: 30px;
  font-size: 12px;
  cursor: pointer;
  transition: all 0.2s ease;
}

.timeline-center {
  position: relative;
  padding-top: 18px;
}

.time-ticks {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  display: flex;
  justify-content: space-between;
  color: #999;
  font-size: 11px;
}

.event-markers {
  position: absolute;
  left: 0;
  right: 0;
  top: 22px;
  height: 10px;
  pointer-events: none;
}

.event-dot {
  position: absolute;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  transform: translateX(-50%);
}

.event-dot.start {
  background: #d32f2f;
}

.event-dot.end {
  background: #6d6d6d;
}

.timeline-slider {
  width: 100%;
  height: 6px;
  appearance: none;
  background: #333;
  border-radius: 10px;
  outline: none;
}

.timeline-slider::-webkit-slider-thumb {
  appearance: none;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  border: 1px solid #ddd;
  background: #fff;
  box-shadow: 0 1px 6px rgba(0, 0, 0, 0.5);
  cursor: pointer;
}

.timeline-right {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
}

.timeline-seconds {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  color: #bbb;
  font-size: 12px;
}

.timeline-subtitle {
  height: 26px;
  margin-top: 6px;
  padding: 4px 12px;
  border-top: 1px solid #2b2b2b;
  color: #fff;
  opacity: 0;
  transition: opacity 0.3s ease;
}

.timeline-subtitle.show {
  opacity: 1;
}

.timeline-clock {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 18px;
}

.now-btn {
  height: 36px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #252525;
  color: #fff;
  padding: 0 12px;
  cursor: pointer;
}

.info-card {
  background: #202020;
  color: #fff;
  border-radius: 8px;
  padding: 10px;
  max-width: 240px;
}

.incident-card {
  background: #2b1b1b;
  border: 1px solid #5a2a2a;
}

.info-card h3 {
  margin: 0 0 8px;
  font-size: 16px;
}

.info-card p {
  margin: 5px 0;
  font-size: 13px;
}

.info-card .badge {
  display: inline-block;
  font-size: 11px;
  border-radius: 999px;
  padding: 3px 8px;
  margin-bottom: 6px;
  color: #fff;
}

.info-card img {
  max-width: 200px;
  border-radius: 6px;
  display: block;
  margin-bottom: 8px;
}

.badge-regional {
  background: #1976d2;
}

.badge-city {
  background: #c62828;
}

.badge-rescue-station {
  background: #ef6c00;
}

.badge-fire-truck,
.badge-fire {
  background: #c62828;
}

.badge-ambulance {
  background: #ad1457;
}

.badge-rescue,
.badge-flood {
  background: #ef6c00;
}

.badge-drone,
.badge-helicopter {
  background: #1565c0;
}

.badge-earthquake,
.badge-chemical,
.badge-other {
  background: #8e2424;
}

.status-on-duty {
  color: #4caf50;
}

.status-en-route {
  color: #ffca28;
}

.status-at-scene {
  color: #ef5350;
}

.status-maintenance {
  color: #9e9e9e;
}

.leaflet-popup-content-wrapper,
.leaflet-popup-tip {
  background: transparent;
  box-shadow: none;
}

.leaflet-popup-content {
  margin: 0;
}

.leaflet-control-zoom a {
  transition: all 0.2s ease;
}

.leaflet-marker-icon {
  transition: transform 120ms linear;
}

body.timeline-busy .leaflet-marker-icon {
  transition: none;
}

::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}

::-webkit-scrollbar-track {
  background: #1f1f1f;
}

::-webkit-scrollbar-thumb {
  background: #444;
  border-radius: 10px;
}

.settlement-dot {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: var(--sdot-color, #d32f2f);
  border: 2px solid rgba(255, 255, 255, 0.85);
  box-shadow: 0 0 6px var(--sdot-color, #d32f2f);
  animation: sdot-pulse 2s ease-in-out infinite;
}

@keyframes sdot-pulse {
  0%, 100% { opacity: 1; }
  50%       { opacity: 0.6; }
}

.scenario-incident-dot {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background: #d32f2f;
  color: #fff;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 2px solid #fff;
}

.drone-icon span {
  font-size: 22px;
  filter: drop-shadow(0 1px 2px rgba(0, 0, 0, 0.5));
}

.drone-video-btn {
  height: 30px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: #333;
  color: #fff;
  cursor: pointer;
}

.video-panel {
  position: fixed;
  top: 68px;
  right: 12px;
  width: 320px;
  z-index: 1400;
  display: grid;
  gap: 8px;
}

.video-panel-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: rgba(13, 17, 23, 0.96);
  border: 1px solid #30363d;
  border-radius: 6px;
  padding: 7px 10px;
}
.video-panel-title {
  font-size: 12px;
  font-weight: 700;
  color: #f0f6fc;
  letter-spacing: 0.3px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  flex: 1;
  min-width: 0;
}
.video-panel-close {
  background: transparent;
  border: 0;
  color: #c9d1d9;
  font-size: 20px;
  line-height: 1;
  padding: 0 6px;
  margin-left: 6px;
  cursor: pointer;
}
.video-panel-close:hover { color: #f0f6fc; }

.video-panel-target {
  font-size: 11px;
  color: #8b949e;
  padding: 2px 10px 0;
  line-height: 1.4;
}

.video-tile {
  background: #111;
  border: 1px solid #333;
  border-radius: 8px;
  overflow: hidden;
  height: 200px;
  position: relative;
}

.video-tile video,
.video-tile iframe,
.video-tile .video-feed-slot {
  width: 100%;
  height: 100%;
  display: block;
  border: 0;
  background: #000;
}

.video-tile video { object-fit: cover; }

.video-panel-meta {
  font-size: 11px;
  color: #c9d1d9;
  padding: 0 10px 4px;
  letter-spacing: 0.3px;
}

.video-fallback {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 15px;
  font-weight: 600;
  letter-spacing: 1px;
  background: #3a3a3a;
  color: #d9d9d9;
}

.alert-channels {
  position: fixed;
  inset: 0;
  z-index: 1700;
  background: rgba(0, 0, 0, 0.45);
  display: flex;
  align-items: center;
  justify-content: center;
}

.alert-channels-card {
  background: rgba(26, 26, 26, 0.95);
  border: 1px solid #444;
  border-radius: 12px;
  padding: 14px;
  display: grid;
  grid-template-columns: repeat(5, minmax(110px, 1fr));
  gap: 8px;
}

.channel {
  border: 1px solid #333;
  border-radius: 8px;
  padding: 8px 10px;
  background: #242424;
  text-align: center;
}

.channel.pulse {
  animation: pulse-channel 0.6s ease 2;
}

@keyframes pulse-channel {
  0% { transform: scale(1); background: #242424; }
  50% { transform: scale(1.05); background: #d32f2f; }
  100% { transform: scale(1); background: #242424; }
}

.alert-mini-icon {
  height: 30px;
  width: 36px;
  border: 1px solid #333;
  border-radius: 6px;
  background: #252525;
  color: #fff;
  cursor: pointer;
}

/* ─── Right-side toast notifications for alert channels ───────────── */
.alert-toasts {
  position: fixed;
  top: 80px;
  right: 16px;
  z-index: 4000;
  display: flex;
  flex-direction: column;
  gap: 8px;
  width: 280px;
  pointer-events: none;
}

.alert-toast {
  display: grid;
  grid-template-columns: 30px 1fr 22px;
  align-items: center;
  gap: 10px;
  background: rgba(13, 17, 23, 0.96);
  border: 1px solid #30363d;
  border-left: 3px solid #58a6ff;
  border-radius: 6px;
  padding: 9px 12px;
  color: #c9d1d9;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.55);
  opacity: 0;
  transform: translateX(120%);
  transition: opacity 0.3s ease, transform 0.45s cubic-bezier(0.22, 1, 0.36, 1);
  pointer-events: auto;
}

.alert-toast.alert-toast-shown {
  opacity: 1;
  transform: translateX(0);
}

.alert-toast-icon {
  font-size: 20px;
  text-align: center;
  line-height: 1;
}

.alert-toast-title {
  font-size: 12px;
  font-weight: 700;
  color: #f0f6fc;
  letter-spacing: 0.3px;
}

.alert-toast-desc {
  font-size: 10px;
  color: #8b949e;
  margin-top: 2px;
}

.alert-toast-status {
  font-size: 14px;
  color: #3fb950;
  font-weight: 700;
  text-align: center;
}

.sidebar-catalog {
  position: fixed;
  left: 0;
  top: 56px;
  bottom: 0;
  width: 80px;
  background: rgba(26, 26, 26, 0.96);
  border-right: 1px solid #333;
  z-index: 1350;
  overflow-y: auto;
}

.sidebar-item {
  width: 100%;
  height: 72px;
  border: 0;
  border-bottom: 1px solid #2a2a2a;
  background: transparent;
  color: #e0e0e0;
  display: grid;
  grid-template-rows: 24px 1fr;
  align-items: center;
  justify-items: center;
  gap: 4px;
  padding: 8px 4px;
  padding: 6px 4px;
  cursor: pointer;
}

.sidebar-item .text {
  font-size: 10px;
  text-align: center;
  line-height: 1.1;
}

.sidebar-item.active,
.sidebar-item:hover {
  background: #2a2a2a;
}

.sidebar-content {
  position: fixed;
  left: 80px;
  top: 114px;
  bottom: 0;
  width: 360px;
  background: #0d1117;
  border-right: 1px solid #30363d;
  z-index: 1349;
  padding: 0;
  color: #c9d1d9;
}

/* Palantir-style task tree on the right is no longer used */
#tasks-tree-panel { display: none !important; }

/* ── Catalog pane (Palantir-style) ─────────────────────────────────────── */
.catalog-pane {
  display: flex;
  flex-direction: column;
  height: 100%;
}

.catalog-pane-header {
  padding: 10px 12px;
  border-bottom: 1px solid #21262d;
  background: #161b22;
}
.catalog-pane-header h3 {
  margin: 0 0 8px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.6px;
  color: #c9d1d9;
  text-transform: uppercase;
}
.catalog-filters {
  display: flex;
  gap: 6px;
}
.catalog-filters select,
.catalog-filters input {
  background: #0d1117;
  border: 1px solid #30363d;
  color: #c9d1d9;
  padding: 5px 8px;
  font-size: 11px;
  border-radius: 4px;
  outline: none;
}
.catalog-filters select { min-width: 110px; }
.catalog-filters input  { flex: 1; }
.catalog-filters select:focus,
.catalog-filters input:focus { border-color: #58a6ff; }

.catalog-list {
  flex: 1;
  overflow-y: auto;
}

/* ── Task accordion ────────────────────────────────────────────────────── */
.task-accordion { border-bottom: 1px solid #21262d; }
.task-accordion-head {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 9px 12px;
  cursor: pointer;
  background: #161b22;
  font-size: 12px;
  color: #c9d1d9;
}
.task-accordion-head:hover { background: #1c2128; }
.task-accordion-head .arrow {
  color: #6e7681;
  transition: transform 0.2s;
  font-size: 10px;
  width: 12px;
}
.task-accordion.expanded .task-accordion-head .arrow { transform: rotate(90deg); }
.task-accordion-head .title { flex: 1; font-weight: 600; }
.task-accordion-head .count {
  background: #30363d;
  color: #c9d1d9;
  padding: 1px 7px;
  border-radius: 10px;
  font-size: 10px;
  font-weight: 600;
}
.task-accordion.status-done .task-accordion-head .count       { background: #1f6e3d; color: #aff5b4; }
.task-accordion.status-in_progress .task-accordion-head .count { background: #9e6a03; color: #ffe1a8; }
.task-accordion.status-pending .task-accordion-head .count    { background: #82071e; color: #ffd1c4; }

.task-accordion-body {
  display: none;
  padding: 4px 8px 8px;
  background: #0d1117;
}
.task-accordion.expanded .task-accordion-body { display: block; }

/* ── Task card ─────────────────────────────────────────────────────────── */
.task-card {
  display: grid;
  grid-template-columns: 28px 1fr auto;
  grid-template-rows: auto auto auto;
  align-items: center;
  gap: 2px 8px;
  padding: 8px 10px;
  margin: 4px 0;
  background: #161b22;
  border: 1px solid #21262d;
  border-radius: 4px;
  cursor: pointer;
  transition: background 0.1s, border-color 0.1s;
}
.task-card:hover { background: #1c2128; border-color: #58a6ff; }
.task-card-icon {
  grid-row: 1 / 3;
  width: 24px; height: 24px;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 12px; font-weight: 700; color: #fff;
}
.task-card.status-done .task-card-icon       { background: #2ea043; }
.task-card.status-in_progress .task-card-icon { background: #db6d28; }
.task-card.status-pending .task-card-icon    { background: #cf222e; }

.task-card-title {
  grid-column: 2;
  font-size: 11px;
  font-weight: 700;
  color: #f0f6fc;
  text-transform: uppercase;
  letter-spacing: 0.3px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.task-card-subtitle {
  grid-column: 2;
  font-size: 11px;
  color: #8b949e;
}
.task-card-priority {
  grid-row: 1 / 3;
  grid-column: 3;
  background: #b62324;
  color: #fff;
  padding: 1px 6px;
  border-radius: 3px;
  font-size: 10px;
  font-weight: 700;
}
.task-card-footer {
  grid-column: 1 / 4;
  display: flex;
  justify-content: space-between;
  font-size: 9px;
  color: #8b949e;
  border-top: 1px solid #21262d;
  padding-top: 4px;
  margin-top: 3px;
  letter-spacing: 0.4px;
}
.task-card-status { text-transform: uppercase; font-weight: 600; }
.task-card.status-done .task-card-status        { color: #3fb950; }
.task-card.status-in_progress .task-card-status { color: #d29922; }
.task-card.status-pending .task-card-status     { color: #f85149; }

/* ── Vehicles tab ──────────────────────────────────────────────────────── */
.catalog-section {
  border-bottom: 1px solid #21262d;
}

.vehicles-section-header {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 9px 12px;
  background: #161b22;
  border: 0;
  border-bottom: 1px solid #21262d;
  font-size: 10px;
  color: #8b949e;
  text-transform: uppercase;
  font-weight: 700;
  letter-spacing: 0.6px;
  cursor: pointer;
  text-align: left;
}
.vehicles-section-header:hover {
  background: #1c2128;
}
.catalog-section-arrow {
  width: 12px;
  color: #6e7681;
  font-size: 10px;
  transition: transform 0.18s ease;
}
.catalog-section.expanded .catalog-section-arrow {
  transform: rotate(90deg);
}
.catalog-section-title {
  flex: 1;
}
.catalog-section-count {
  background: #30363d;
  color: #c9d1d9;
  border-radius: 999px;
  padding: 1px 7px;
  font-size: 10px;
  line-height: 1.4;
}
.catalog-section-body {
  display: none;
  background: #0d1117;
}
.catalog-section.expanded .catalog-section-body {
  display: block;
}
.vehicle-card {
  display: grid;
  grid-template-columns: 32px 1fr auto;
  grid-template-rows: auto auto;
  align-items: center;
  gap: 2px 10px;
  padding: 8px 12px;
  border-bottom: 1px solid #21262d;
  cursor: pointer;
}
.vehicle-card:hover { background: #1c2128; }
.vehicle-card-icon {
  grid-row: 1 / 3;
  font-size: 22px;
  text-align: center;
  line-height: 1;
}
.vehicle-card-title {
  grid-column: 2;
  font-size: 12px;
  color: #f0f6fc;
  font-weight: 700;
}
.vehicle-card-subtitle {
  grid-column: 2;
  font-size: 11px;
  color: #8b949e;
}
.vehicle-card-status {
  grid-row: 1 / 3;
  grid-column: 3;
  font-size: 10px;
  padding: 2px 7px;
  border-radius: 3px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.3px;
}
.vehicle-card.status-en-route .vehicle-card-status { background: #9e6a03; color: #ffe1a8; }
.vehicle-card.status-at-scene .vehicle-card-status { background: #1f6e3d; color: #aff5b4; }
.vehicle-card.status-on-duty .vehicle-card-status  { background: #30363d; color: #c9d1d9; }

.empty-row {
  padding: 14px 12px;
  font-size: 11px;
  color: #8b949e;
  font-style: italic;
}

/* ── Object card (KML description + Wikipedia thumbnail) ─────────── */
.object-card { min-width: 260px; max-width: 340px; }
.object-card-image-slot { min-height: 0; }
.object-card-image-slot:empty { display: none; }
.object-card-image {
  display: block;
  width: 100%;
  max-height: 180px;
  object-fit: cover;
  border-radius: 4px;
  margin: 0 0 10px;
  background: #161b22;
}
.object-meta { margin: 4px 0 8px; font-size: 12px; }
.kml-description {
  font-size: 12px;
  line-height: 1.5;
  color: #c9d1d9;
  margin: 8px 0 4px;
}
.kml-description b { color: #f0f6fc; }
.object-card-link-slot:empty { display: none; }
.object-card-link {
  display: inline-block;
  font-size: 11px;
  color: #58a6ff;
  text-decoration: none;
  margin-top: 6px;
  padding-top: 6px;
  border-top: 1px solid #21262d;
  width: 100%;
}
.object-card-link:hover { text-decoration: underline; }

.hydropower-icon img {
  display: block;
  filter: drop-shadow(0 1px 2px rgba(0,0,0,0.6));
}

.bridge-icon img {
  display: block;
  /* Bridge icon is solid black — invert to white + soft shadow for visibility on dark map */
  filter: invert(1) drop-shadow(0 1px 2px rgba(0,0,0,0.7));
}
.bridge-icon.bridge-landmark img    { filter: invert(0.8) sepia(1) hue-rotate(180deg) saturate(3) drop-shadow(0 1px 2px rgba(0,0,0,0.7)); }
.bridge-icon.bridge-rail img        { filter: invert(1) sepia(0.5) hue-rotate(50deg) drop-shadow(0 1px 2px rgba(0,0,0,0.7)); }
.bridge-icon.bridge-ped img         { filter: invert(1) sepia(1) hue-rotate(60deg) saturate(4) drop-shadow(0 1px 2px rgba(0,0,0,0.7)); }
.bridge-icon.bridge-interchange img { filter: invert(1) sepia(1) hue-rotate(-20deg) saturate(2.5) drop-shadow(0 1px 2px rgba(0,0,0,0.7)); }

/* Popup flips below the marker when it would overflow the top of the map.
   Actual offset is set inline via JS (= popup height + margin). Tip hidden. */
.leaflet-popup.popup-flipped .leaflet-popup-tip-container {
  display: none;
}
.hydropower-icon.hydropower-hpp_off img { filter: grayscale(1) opacity(0.7) drop-shadow(0 1px 2px rgba(0,0,0,0.5)); }
.hydropower-icon.hydropower-dam img      { filter: hue-rotate(140deg) drop-shadow(0 1px 2px rgba(0,0,0,0.5)); }
.hydropower-icon.hydropower-plan img     { filter: hue-rotate(-40deg) saturate(1.4) drop-shadow(0 1px 2px rgba(0,0,0,0.5)); }

.map-base-row,
.map-overlay-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 14px;
  border-bottom: 1px solid #21262d;
  cursor: pointer;
  font-size: 12px;
  color: #c9d1d9;
  transition: background 0.1s;
}
.map-base-row:hover,
.map-overlay-row:hover { background: #1c2128; }
.map-base-row input,
.map-overlay-row input {
  cursor: pointer;
  accent-color: #58a6ff;
  margin: 0;
}

.layer-row {
  display: grid;
  grid-template-columns: 24px 26px 1fr auto;
  align-items: center;
  gap: 10px;
  padding: 11px 14px;
  border-bottom: 1px solid #21262d;
  cursor: pointer;
  transition: background 0.1s;
}
.layer-row:hover { background: #1c2128; }
.layer-row input[type="checkbox"] {
  cursor: pointer;
  accent-color: #58a6ff;
  width: 16px; height: 16px;
}
.layer-row img {
  filter: brightness(1.1);
  vertical-align: middle;
}
.layer-row-label {
  font-size: 12px;
  color: #c9d1d9;
  font-weight: 500;
}
.layer-row-count {
  font-size: 11px;
  color: #8b949e;
  background: #21262d;
  padding: 1px 8px;
  border-radius: 10px;
  font-weight: 600;
}
.layer-row-emoji {
  font-size: 16px;
  text-align: center;
  line-height: 1;
  width: 22px;
  display: inline-block;
}
.osm-point-icon { background: transparent; border: 0; }

/* Оперативные группы — бейдж "ОТРЯД" с цветом по типу миссии */
.rg-icon {
  background: transparent !important;
  border: 0 !important;
  display: flex;
  align-items: center;
  justify-content: center;
}
.rg-icon .rg-label {
  color: #ffffff;
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.4px;
  padding: 3px 8px;
  border-radius: 4px;
  border: 1.5px solid rgba(255,255,255,0.9);
  box-shadow: 0 1px 4px rgba(0,0,0,0.7);
  white-space: nowrap;
  text-shadow: 0 1px 1px rgba(0,0,0,0.5);
}
.rg-flood   .rg-label { background: #0277bd; }
.rg-fire    .rg-label { background: #d32f2f; }
.rg-evac    .rg-label { background: #388e3c; }
.rg-reserve .rg-label { background: #455a64; }
.rg-enroute .rg-label { background: #fb8c00; }

.evac-icon {
  background: transparent !important;
  border: 0 !important;
  display: flex;
  align-items: center;
  justify-content: center;
}
.evac-icon .evac-label {
  color: #ffffff;
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.4px;
  padding: 3px 6px;
  border-radius: 4px;
  border: 1.5px solid rgba(255,255,255,0.9);
  box-shadow: 0 1px 3px rgba(0,0,0,0.65);
  white-space: nowrap;
}
.evac-icon-flood .evac-label { background: #2e7d32; }
.evac-icon-fire  .evac-label { background: #e64a19; }

.flood-icon { background: transparent; border: 0; }
.flood-dot {
  width: 18px; height: 22px;
  background: var(--fdot-color, #0288d1);
  border: 2px solid rgba(255,255,255,0.85);
  border-radius: 50% 50% 50% 50% / 60% 60% 40% 40%;
  box-shadow: 0 0 8px var(--fdot-color, #0288d1);
  animation: fdot-pulse 2.4s ease-in-out infinite;
  transform: translateY(-2px) rotate(-45deg);
}
@keyframes fdot-pulse {
  0%, 100% { opacity: 1; }
  50%      { opacity: 0.55; }
}

.sidebar-item .icon svg { display: block; margin: 0 auto; }

.catalog-empty {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 40px 20px;
  text-align: center;
  color: #6e7681;
}
.catalog-empty-icon {
  font-size: 48px;
  margin-bottom: 12px;
  opacity: 0.5;
}
.catalog-empty-text {
  font-size: 13px;
  font-weight: 600;
  color: #8b949e;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 6px;
}
.catalog-empty-hint {
  font-size: 11px;
  color: #6e7681;
  line-height: 1.5;
}

/* ── Task detail modal ────────────────────────────────────────────────── */
.task-detail-modal-backdrop {
  position: fixed; inset: 0;
  background: rgba(0, 0, 0, 0.55);
  z-index: 4999;
}
.task-detail-modal-backdrop.hidden { display: none; }

.task-detail-modal {
  position: fixed;
  top: 50%; left: 50%;
  transform: translate(-50%, -50%);
  width: 500px;
  max-height: 70vh;
  background: #0d1117;
  border: 1px solid #30363d;
  border-radius: 8px;
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.7);
  z-index: 5000;
  padding: 18px 22px;
  overflow-y: auto;
  color: #c9d1d9;
}
.task-detail-modal.hidden { display: none; }
.task-detail-modal h3 {
  margin: 0 0 14px;
  color: #f0f6fc;
  font-size: 15px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  padding-right: 24px;
}
.task-detail-modal .close {
  position: absolute;
  top: 10px; right: 14px;
  background: none;
  border: 0;
  color: #8b949e;
  font-size: 22px;
  line-height: 1;
  cursor: pointer;
}
.task-detail-modal .close:hover { color: #f0f6fc; }
.task-detail-modal-meta {
  display: grid;
  grid-template-columns: max-content 1fr;
  gap: 6px 18px;
  font-size: 12px;
  margin: 12px 0;
  padding: 14px;
  background: #161b22;
  border-radius: 4px;
}
.task-detail-modal-meta dt { color: #8b949e; font-size: 11px; text-transform: uppercase; letter-spacing: 0.4px; }
.task-detail-modal-meta dd { margin: 0; color: #c9d1d9; }
.task-detail-modal-meta dd.status-done        { color: #3fb950; font-weight: 600; }
.task-detail-modal-meta dd.status-in_progress { color: #d29922; font-weight: 600; }
.task-detail-modal-meta dd.status-pending     { color: #f85149; font-weight: 600; }
.task-detail-modal-desc {
  font-size: 12px;
  color: #8b949e;
  line-height: 1.6;
  margin: 8px 0 0;
}

.tasks-tree-panel {
  position: fixed;
  right: 340px;
  top: 68px;
  width: 360px;
  max-height: calc(100vh - 190px);
  background: rgba(20, 20, 20, 0.96);
  border: 1px solid #333;
  border-radius: 10px;
  z-index: 1450;
  display: grid;
  grid-template-rows: 42px 1fr;
}

.tasks-tree-head {
  border-bottom: 1px solid #333;
  padding: 10px 12px;
  font-weight: 600;
}

.tasks-tree-body {
  overflow: auto;
  padding: 8px 10px;
}

.tasks-tree-list {
  list-style: none;
  margin: 0;
  padding: 0;
}

.task-children {
  margin-left: 16px;
}

.task-node {
  display: grid;
  grid-template-columns: 22px 1fr auto auto;
  align-items: center;
  gap: 6px;
  border-bottom: 1px solid #2a2a2a;
  padding: 5px 0;
}

.task-toggle {
  width: 20px;
  height: 20px;
  border: 1px solid #333;
  border-radius: 4px;
  background: #222;
  color: #ddd;
  cursor: pointer;
}

.task-title {
  font-size: 12px;
}

.task-meta,
.task-weight {
  color: #9e9e9e;
  font-size: 11px;
}

.task-pill {
  font-size: 11px;
  border-radius: 10px;
  padding: 2px 7px;
  color: #fff;
}

.tasks-summary {
  font-size: 12px;
  color: #bdbdbd;
  margin-bottom: 8px;
}

.task-toggle-empty {
  display: inline-block;
}

.task-status-done {
  background: #2e7d32;
}

.task-status-progress {
  background: #f9a825;
}

.task-status-pending {
  background: #c62828;
}

.route-arrow {
  color: #2e7d32;
  font-size: 14px;
  font-weight: 700;
}

.sidebar-content-list {
  margin: 8px 0 0;
  padding-left: 16px;
  font-size: 13px;
}

.sidebar-content-list li {
  margin: 6px 0;
}

.leaflet-control-layers-expanded {
  max-height: 70vh;
  overflow-y: auto;
  max-width: 280px;
}

.leaflet-control-layers-expanded label {
  display: flex;
  align-items: center;
  gap: 6px;
  white-space: nowrap;
  font-size: 12px;
  line-height: 1.4;
  padding: 1px 0;
}

.leaflet-control-layers-separator {
  margin: 6px 0;
  border-top: 1px solid #d0d0d0;
}

/* ─── Режим записи ?record=1 ─────────────────────────────────────── */
body.record-mode,
body.record-mode * {
  cursor: none !important;
}

body.record-mode .header-right,
body.record-mode .system-clock,
body.record-mode #connection-status,
body.record-mode .mode-toggle,
body.record-mode .language-switcher,
body.record-mode .lang-btn,
body.record-mode .top-controls,
body.record-mode .search-box,
body.record-mode #search-input,
body.record-mode #share-btn,
body.record-mode .fullscreen-btn,
body.record-mode .timeline-controls,
body.record-mode .timeline-btn,
body.record-mode .speed-group,
body.record-mode .speed-btn,
body.record-mode .timeline-right,
body.record-mode .timeline-clock,
body.record-mode .timeline-seconds,
body.record-mode .timeline-slider,
body.record-mode .now-btn,
body.record-mode #toast,
body.record-mode .leaflet-control-zoom,
body.record-mode .leaflet-control-layers,
body.record-mode .leaflet-control-attribution,
body.record-mode .custom-layers-panel,
body.record-mode .legend-panel {
  display: none !important;
}

body.record-mode #video-panel.hidden,
body.record-mode #video-panel {
  display: grid !important;
}

body.record-mode .timeline-center {
  pointer-events: none;
}

body.record-mode .timeline-root {
  grid-template-columns: 0 1fr 0;
  padding: 8px 14px;
}

/* ─── Подсветка областей ─────────────────────────────────────────── */
.region-highlight {
  animation: region-pulse 1.4s ease-in-out infinite;
  pointer-events: none;
}

@keyframes region-pulse {
  0%, 100% {
    fill-opacity: 0.20;
    stroke-opacity: 0.7;
  }
  50% {
    fill-opacity: 0.45;
    stroke-opacity: 1.0;
  }
}

/* ─── Большой таймер сценария ────────────────────────────────────── */
.big-timer {
  position: fixed;
  top: 12px;
  right: 100px;
  z-index: 1500;
  font-family: ui-monospace, SFMono-Regular, "Cascadia Mono", Consolas, Menlo, monospace;
  font-size: 32px;
  font-weight: 700;
  letter-spacing: 3px;
  color: #ffffff;
  background: rgba(20, 20, 20, 0.7);
  border: 1px solid #333;
  border-radius: 8px;
  padding: 3px 14px;
  box-shadow: 0 4px 18px rgba(0, 0, 0, 0.6);
  text-shadow: 0 2px 6px rgba(0, 0, 0, 0.8);
  pointer-events: none;
  -webkit-user-select: none;
  user-select: none;
}

/* ─── Плашка-предупреждение ──────────────────────────────────────── */
.incident-banner {
  position: fixed;
  top: 168px;
  left: 50%;
  transform: translateX(-50%) translateY(0);
  z-index: 1500;
  min-width: 460px;
  max-width: 92vw;
  background: linear-gradient(180deg, #b71c1c 0%, #7f0000 100%);
  border: 2px solid #ff5252;
  border-radius: 12px;
  padding: 14px 22px;
  color: #ffffff;
  box-shadow: 0 6px 28px rgba(211, 47, 47, 0.55), 0 0 0 1px rgba(255, 82, 82, 0.4);
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.6);
  animation: incident-banner-glow 2s ease-in-out infinite;
  transition: transform 0.4s cubic-bezier(0.22, 1, 0.36, 1), opacity 0.3s ease;
}

.incident-banner.hidden {
  display: none !important;
}

.incident-banner-head {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 800;
  letter-spacing: 1px;
  font-size: 18px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.18);
  padding-bottom: 8px;
  margin-bottom: 8px;
}

.incident-banner-icon {
  font-size: 24px;
}

.incident-banner-body {
  display: grid;
  gap: 4px;
  font-size: 14px;
  font-family: ui-monospace, Consolas, Menlo, monospace;
}

.incident-banner-row .label {
  color: rgba(255, 255, 255, 0.7);
  margin-right: 6px;
}

.incident-banner-row.magnitude strong {
  font-size: 18px;
  color: #ffeb3b;
}

@keyframes incident-banner-glow {
  0%, 100% { box-shadow: 0 6px 28px rgba(211, 47, 47, 0.55), 0 0 0 1px rgba(255, 82, 82, 0.4); }
  50%      { box-shadow: 0 6px 38px rgba(255, 82, 82, 0.85), 0 0 0 2px rgba(255, 82, 82, 0.7); }
}

/* ─── Fake-курсор для записи ─────────────────────────────────────── */
.fake-cursor {
  position: fixed;
  top: 0;
  left: 0;
  width: 28px;
  height: 28px;
  pointer-events: none;
  z-index: 5000;
  display: none;
  transform: translate(-100px, -100px);
  will-change: transform;
}

body.record-mode .fake-cursor,
.fake-cursor.active {
  display: block;
}

.fake-cursor.fc-hidden,
body.record-mode .fake-cursor.fc-hidden {
  display: none !important;
}

.fake-cursor-arrow {
  position: absolute;
  inset: 0;
  filter: drop-shadow(0 2px 3px rgba(0, 0, 0, 0.6));
}

.fake-cursor-ripple {
  position: absolute;
  top: -10px;
  left: -10px;
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background: rgba(211, 47, 47, 0.0);
  border: 2px solid rgba(211, 47, 47, 0.0);
  transform: scale(0.4);
  pointer-events: none;
}

.fake-cursor.clicking .fake-cursor-ripple {
  animation: fake-cursor-ripple 0.6s ease-out forwards;
}

@keyframes fake-cursor-ripple {
  0%   { transform: scale(0.4); background: rgba(211, 47, 47, 0.45); border-color: rgba(255, 82, 82, 0.9); }
  100% { transform: scale(1.4); background: rgba(211, 47, 47, 0.0);  border-color: rgba(255, 82, 82, 0.0); }
}

/* ─── Рамка командного центра ────────────────────────────────────── */
.cc-frame {
  position: fixed;
  inset: 0;
  z-index: 4000;
  pointer-events: none;
  display: none;
  font-family: ui-monospace, "Cascadia Mono", Consolas, Menlo, monospace;
  color: #00e5ff;
  text-shadow: 0 0 6px rgba(0, 229, 255, 0.55);
}

body.record-mode .cc-frame,
body.frame-mode .cc-frame,
.cc-frame.active {
  display: block;
}

.cc-corner {
  position: absolute;
  width: 36px;
  height: 36px;
  border-color: #00e5ff;
  opacity: 0.85;
  filter: drop-shadow(0 0 4px rgba(0, 229, 255, 0.6));
}
.cc-corner-tl { top: 8px;    left: 8px;   border-top: 2px solid; border-left: 2px solid; }
.cc-corner-tr { top: 8px;    right: 8px;  border-top: 2px solid; border-right: 2px solid; }
.cc-corner-bl { bottom: 8px; left: 8px;   border-bottom: 2px solid; border-left: 2px solid; }
.cc-corner-br { bottom: 8px; right: 8px;  border-bottom: 2px solid; border-right: 2px solid; }

.cc-badge {
  position: absolute;
  top: 14px;
  left: 56px;
  font-size: 11px;
  letter-spacing: 2px;
  font-weight: 700;
  background: rgba(0, 0, 0, 0.55);
  border: 1px solid rgba(0, 229, 255, 0.45);
  border-radius: 4px;
  padding: 4px 10px;
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.cc-badge-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #ff5252;
  box-shadow: 0 0 8px rgba(255, 82, 82, 0.9);
  animation: cc-pulse 1.5s ease-in-out infinite;
}

.cc-indicators {
  position: absolute;
  bottom: 20px;
  right: 56px;
  display: grid;
  gap: 4px;
  font-size: 11px;
  letter-spacing: 1.5px;
  background: rgba(0, 0, 0, 0.55);
  border: 1px solid rgba(0, 229, 255, 0.45);
  border-radius: 4px;
  padding: 8px 12px;
  min-width: 120px;
}

.cc-indicator {
  display: flex;
  justify-content: space-between;
  gap: 14px;
}

.cc-indicator-label {
  color: rgba(0, 229, 255, 0.55);
  font-weight: 700;
}

.cc-indicator-value {
  color: #ffffff;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  text-shadow: 0 0 4px rgba(0, 229, 255, 0.7);
}

.cc-scanlines {
  position: absolute;
  inset: 0;
  background-image: repeating-linear-gradient(
    180deg,
    rgba(0, 229, 255, 0.06) 0px,
    rgba(0, 229, 255, 0.06) 1px,
    transparent 1px,
    transparent 4px
  );
  animation: cc-scan 8s linear infinite;
  mix-blend-mode: screen;
  pointer-events: none;
  opacity: 0.7;
}

@keyframes cc-scan {
  0%   { background-position-y: 0; }
  100% { background-position-y: 256px; }
}

@keyframes cc-pulse {
  0%, 100% { opacity: 1.0; }
  50%      { opacity: 0.4; }
}

/* ─── Анимация появления узлов дерева задач ──────────────────────── */
.task-node {
  animation: task-node-enter 320ms cubic-bezier(0.22, 1, 0.36, 1) both;
}

@keyframes task-node-enter {
  0%   { opacity: 0; transform: translateX(-12px); }
  100% { opacity: 1; transform: translateX(0); }
}

/* ─── Slide-in для левой панели-каталога ─────────────────────────── */
.sidebar-catalog {
  transition: transform 360ms cubic-bezier(0.22, 1, 0.36, 1), opacity 200ms ease;
  transform: translateX(0);
}

.sidebar-catalog.hidden {
  display: block !important;
  transform: translateX(-110%);
  opacity: 0;
  pointer-events: none;
}

.sidebar-content {
  transition: transform 360ms cubic-bezier(0.22, 1, 0.36, 1) 80ms, opacity 200ms ease 80ms;
  transform: translateX(0);
}

.sidebar-content.hidden {
  display: block !important;
  transform: translateX(-110%);
  opacity: 0;
  pointer-events: none;
}

/* ─── Бейджи каналов под узлом branch-alert ─────────────────────── */
.alert-channels-strip {
  grid-column: 1 / -1;
  display: flex;
  gap: 6px;
  margin-top: 4px;
  padding-left: 28px;
}

.alert-channel-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 26px;
  height: 26px;
  border-radius: 6px;
  border: 1px solid #444;
  background: #232323;
  font-size: 14px;
  transition: transform 0.2s ease, background 0.2s ease, box-shadow 0.2s ease;
}

.alert-channel-badge.pulse {
  background: #d32f2f;
  transform: scale(1.18);
  box-shadow: 0 0 14px rgba(255, 82, 82, 0.7);
  animation: alert-channel-flash 0.7s ease-out;
}

@keyframes alert-channel-flash {
  0%   { background: #232323; box-shadow: none; }
  40%  { background: #ff5252; box-shadow: 0 0 16px rgba(255, 82, 82, 0.95); }
  100% { background: #d32f2f; box-shadow: 0 0 8px rgba(255, 82, 82, 0.4); }
}

/* ─── Нижний подстрочник (cinematic subtitle) ────────────────────── */
.bottom-subtitle {
  position: fixed;
  left: 50%;
  bottom: 124px;
  transform: translateX(-50%);
  z-index: 1600;
  max-width: 80vw;
  min-width: 320px;
  padding: 14px 28px;
  background: rgba(0, 0, 0, 0.78);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 10px;
  font-size: 22px;
  font-weight: 500;
  line-height: 1.35;
  color: #ffffff;
  text-align: center;
  letter-spacing: 0.3px;
  text-shadow: 0 2px 6px rgba(0, 0, 0, 0.85);
  pointer-events: none;
  opacity: 1;
  transition: opacity 240ms ease;
}

body.record-mode .bottom-subtitle {
  bottom: 32px;
  font-size: 26px;
  padding: 16px 32px;
  background: rgba(0, 0, 0, 0.88);
}

.bottom-subtitle.hidden {
  display: none !important;
  opacity: 0;
}

/* ─── Vehicles cluster + ETA labels + Aviation (2026-05-15) ─── */
.vehicle-cluster {
  background: none !important;
  border: none !important;
}
/* Старый стиль на случай fallback — оставляем компактным и красным */
.vehicle-cluster-bubble {
  width: 28px; height: 28px;
  display: flex; align-items: center; justify-content: center;
  background: rgba(211,47,47,0.92);
  color: #fff; font-weight: 700; font-size: 12px;
  border-radius: 50%;
  border: 1.5px solid #fff;
  box-shadow: 0 1px 3px rgba(0,0,0,0.5);
}

/* Универсальный значок кластера (план 2026-05-20: убрать большие синие круги, оставить иконку + число) */
.cluster-icon-wrap { background: none !important; border: none !important; }
.cluster-uni {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 3px 8px;
  background: rgba(13, 17, 23, 0.88);
  border: 1.5px solid rgba(255,255,255,0.18);
  border-radius: 14px;
  color: #fff; font-weight: 700; font-size: 11px;
  box-shadow: 0 1px 4px rgba(0,0,0,0.5);
}
.cluster-vehicles { border-color: #d32f2f; }
.cluster-drones   { border-color: #1976d2; }
.cluster-uni-count { line-height: 1; min-width: 14px; text-align: center; }
/* Одиночные маркеры техники — оригинальные PNG/SVG без фона, компактные.
   Кластеры (большие teardrop-маркеры) рисуются adaptive-marker.svg. */
.vehicle-icon { background: none !important; border: none !important; }
.vehicle-bubble {
  width: 22px; height: 22px;
  display: flex; align-items: center; justify-content: center;
  background: transparent;
  filter: drop-shadow(0 1px 2px rgba(0,0,0,0.55));
}
.vehicle-bubble img {
  width: 22px; height: 22px;
  object-fit: contain;
  display: block;
  pointer-events: none;
  -webkit-user-drag: none;
}
/* Щит МЧС (план 2026-05-21) — единая иконка для центров ДЧС */
.mchs-shield-icon { filter: drop-shadow(0 2px 3px rgba(0,0,0,0.55)); }

/* RainViewer — анимация радара (плавающая панель внизу-по-центру карты) */
.rainviewer-control {
  position: absolute; left: 50%; bottom: 16px;
  transform: translateX(-50%);
  display: flex; align-items: center; gap: 8px;
  padding: 6px 12px;
  background: rgba(13, 17, 23, 0.92);
  border: 1px solid rgba(255,255,255,0.10);
  border-radius: 8px;
  color: #c9d1d9; font: 12px system-ui, sans-serif;
  box-shadow: 0 4px 12px rgba(0,0,0,0.55);
  z-index: 600;
  -webkit-backdrop-filter: blur(4px);
  backdrop-filter: blur(4px);
}
.rainviewer-control.hidden { display: none; }
.rainviewer-control .rv-btn {
  background: #e94560; color: #fff; border: none; border-radius: 4px;
  width: 28px; height: 24px; cursor: pointer; font-size: 12px; line-height: 1;
}
.rainviewer-control .rv-btn:hover { background: #c92e48; }
.rainviewer-control .rv-range { width: 220px; accent-color: #e94560; }
.rainviewer-control .rv-time { font-weight: 700; min-width: 44px; text-align: center; }
.rainviewer-control .rv-tag  {
  font-size: 10px; padding: 2px 6px; border-radius: 8px;
  background: #455a64; color: #fff;
}
.rainviewer-control .rv-tag-nowcast { background: #fb8c00; }

/* Метеомаркеры (план 2026-05-20: штормы / аномальная жара / похолодание) */
.meteo-icon { background: none !important; border: none !important; }
.meteo-bubble {
  width: 28px; height: 28px;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  color: #fff; font-size: 14px;
  border: 1.5px solid #fff;
  box-shadow: 0 1px 4px rgba(0,0,0,0.5);
}
.vehicle-icon.highlighted .vehicle-bubble {
  filter: drop-shadow(0 0 6px #ffeb3b) drop-shadow(0 0 10px rgba(255,235,59,0.7));
}

.vehicle-eta-label { background: none !important; border: none !important; pointer-events: none; }
.eta-pill {
  display: inline-block;
  background: rgba(183,28,28,0.92);
  color: #fff;
  padding: 3px 8px;
  border-radius: 10px;
  font-size: 11px;
  white-space: nowrap;
  box-shadow: 0 1px 3px rgba(0,0,0,0.4);
  border: 1px solid rgba(255,255,255,0.25);
}

.plane-icon { background: none !important; border: none !important; }
.plane-wrap {
  position: relative;
  width: 100%; height: 100%;
  display: flex; align-items: center; justify-content: center;
  transform-origin: 50% 50%;
}
.plane-emergency .plane-pulse {
  position: absolute; inset: -6px;
  border-radius: 50%; border: 2px solid #e53935;
  animation: plane-pulse 1.4s ease-out infinite;
  pointer-events: none;
}
@keyframes plane-pulse {
  0%   { transform: scale(0.6); opacity: 0.9; }
  100% { transform: scale(1.4); opacity: 0;   }
}

.vehicle-card-popup img.vehicle-photo,
.drone-card-popup img.drone-photo,
.flight-card-popup img.plane-photo {
  width: 100%;
  max-width: 100%;
  min-height: 110px;
  max-height: 160px;
  object-fit: cover;
  background: #eceff1;
}

.center-card-popup .center-photo-frame {
  width: 100%;
  min-height: 118px;
  margin-bottom: 8px;
  border-radius: 6px;
  background: #eceff1;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

.center-card-popup img.center-photo-real {
  width: 100%;
  max-width: 100%;
  min-height: 118px;
  max-height: 160px;
  object-fit: cover;
}

.center-card-popup img.center-photo-shield {
  width: 96px;
  height: 96px;
  object-fit: contain;
  margin: 0;
}

.vehicle-incident-link {
  color: #1565c0; text-decoration: underline; cursor: pointer; font-weight: 600;
}
.vehicle-incident-link:hover { color: #0d47a1; }

/* Маркер оповещения на карте */
.alert-icon { background: none !important; border: none !important; }
.alert-bubble {
  width: 32px; height: 32px;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  color: #fff; font-size: 16px;
  border: 2px solid #fff;
  box-shadow: 0 1px 4px rgba(0,0,0,0.45);
}

/* Шкалы пилл-кнопок статусов оповещений */
.alert-summary-row {
  display: flex; gap: 6px; flex-wrap: wrap; margin: 6px 0 4px;
}
.alert-pill {
  display: inline-block; padding: 2px 8px; border-radius: 10px;
  font-size: 11px; font-weight: 600;
}
.alert-pill-completed { background: #c8e6c9; color: #1b5e20; }
.alert-pill-progress  { background: #ffecb3; color: #b56500; }
.alert-pill-scheduled { background: #eceff1; color: #455a64; }

.alert-summary-row .alert-pill {
  color: #fff !important;
}

[data-list="alerts"] .vehicle-card .vehicle-card-status,
[data-list="alerts"] .vehicle-card.severity-critical .vehicle-card-status,
[data-list="alerts"] .vehicle-card.severity-moderate .vehicle-card-status {
  color: #fff !important;
}

.alert-channels-row {
  grid-column: 1 / -1;             /* во всю ширину карточки, не зажат в столбце */
  margin: 4px 0 0;
  font-size: 11px; line-height: 1.4; color: #b0bec5;
  white-space: normal;
  word-spacing: 2px;
}

.alert-card-popup .alert-ch {
  display: inline-block; margin-right: 4px; padding: 1px 6px;
  background: #eceff1; color: #455a64; border-radius: 8px; font-size: 11px;
}

.layer-row-placeholder { opacity: 0.5; cursor: not-allowed; }
.layer-row-placeholder .layer-row-label { font-style: italic; }
.layer-row-hint {
  margin-left: auto; margin-right: 6px;
  font-size: 10px; color: #b56500; font-style: italic;
}

/* Единая шкала критичности для карточек инцидентов (план 2026-05-19) */
.vehicle-card.severity-critical {
  border-left: 4px solid #d32f2f;
}
.vehicle-card.severity-critical .vehicle-card-status {
  color: #d32f2f; font-weight: 700;
}
.vehicle-card.severity-moderate {
  border-left: 4px solid #f57c00;
}
.vehicle-card.severity-moderate .vehicle-card-status {
  color: #ef6c00; font-weight: 600;
}

.drone-video-btn {
  display: inline-block;
  margin-top: 8px;
  padding: 6px 10px;
  background: #1565c0;
  color: #fff;
  border: none;
  border-radius: 4px;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
}
.drone-video-btn:hover { background: #0d47a1; }

/* ─── FlightRadar24-style flight popup (2026-05-15) ─── */
.flight-card-popup {
  min-width: 320px; max-width: 360px; padding: 0 !important;
  box-sizing: border-box; overflow: hidden;
}
.flight-photo-slot {
  width: 100%; height: 140px;
  background: linear-gradient(180deg, #1a237e 0%, #0d47a1 100%);
  border-radius: 6px 6px 0 0;
  display: flex; align-items: center; justify-content: center;
  overflow: hidden;
  margin-bottom: 8px;
}
.flight-photo-placeholder {
  color: rgba(255,255,255,0.7); font-size: 12px; font-weight: 600; letter-spacing: 0.5px;
}
.flight-photo {
  width: 100%; height: 100%; object-fit: cover; display: block;
}
.flight-emergency-banner {
  background: #b71c1c; color: #fff; font-weight: 700;
  padding: 8px 12px; font-size: 12px; line-height: 1.4;
  text-align: center;
  margin: 0 0 8px 0;
}
.flight-callsign-row {
  display: flex; justify-content: space-between; align-items: baseline;
  padding: 0 12px; margin-bottom: 10px;
}
.flight-callsign {
  font-size: 18px; font-weight: 800; color: #455a64; letter-spacing: 0.5px;
}
.flight-operator { font-size: 12px; color: #455a64; }

.flight-route-row {
  display: grid; grid-template-columns: 1fr 1.4fr 1fr;
  padding: 0 12px 8px; align-items: center; gap: 6px;
}
.flight-airport { text-align: left; }
.flight-airport-right { text-align: right; }
.flight-airport-code {
  font-size: 17px; font-weight: 800; color: #212121; line-height: 1;
}
.flight-airport-city { font-size: 11px; color: #607d8b; margin-top: 2px; }
.flight-airport-time {
  font-size: 14px; font-weight: 700; color: #1565c0; margin-top: 4px;
}
.flight-airport-label {
  font-size: 9.5px; color: #90a4ae; text-transform: uppercase; letter-spacing: 0.4px;
}

.flight-route-arrow {
  position: relative;
  height: 36px;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
}
.flight-route-line {
  position: absolute; left: 4px; right: 4px; top: 50%;
  height: 2px; background: #b0bec5; border-radius: 1px; transform: translateY(-50%);
}
.flight-route-progress {
  position: absolute; left: 4px; top: 50%;
  height: 2px; background: #fdd835; border-radius: 1px; transform: translateY(-50%);
}
.flight-route-plane-mini {
  position: relative; z-index: 2;
  background: #fff; color: #fdd835;
  font-size: 14px; line-height: 1;
  padding: 0 4px;
}
.flight-route-duration {
  position: absolute; top: -2px; left: 0; right: 0;
  text-align: center; font-size: 10px; color: #607d8b;
}

.flight-divert-eta {
  margin: 4px 12px 8px; padding: 6px 8px;
  background: #fff3e0; border-left: 3px solid #fb8c00;
  font-size: 11.5px; line-height: 1.45;
  display: grid; grid-template-columns: 1fr auto; gap: 2px 6px;
  align-items: baseline; word-break: break-word; white-space: normal;
  box-sizing: border-box; overflow: hidden;
}
.flight-divert-eta strong { grid-column: 1 / -1; font-weight: 700; color: #424242; }
.flight-divert-eta > span { min-width: 0; }

.flight-meta-grid {
  display: grid; grid-template-columns: 1fr 1fr;
  padding: 0 12px 12px; gap: 4px 10px;
  font-size: 12px;
}
.flight-meta-grid > div {
  display: flex; justify-content: space-between; align-items: baseline;
  border-bottom: 1px dotted #eceff1; padding: 3px 0;
  min-width: 0; gap: 4px;
}
.flight-meta-grid > div > span:last-child {
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  font-variant-numeric: tabular-nums; text-align: right;
}
.flight-meta-label { color: #78909c; font-size: 11px; flex: 0 0 auto; }
