:root {
  --bg: #07111f;
  --panel: rgba(11, 19, 32, 0.78);
  --text: #e8eefb;
  --muted: #a8b3c7;
  --line: rgba(255, 255, 255, 0.14);
  --green: #16a34a;
  --yellow: #d97706;
  --red: #dc2626;
  --blue: #3b82f6;
}

* {
  box-sizing: border-box;
}

html,
body,
#app {
  width: 100%;
  height: 100vh;
  min-height: 100vh;
  margin: 0;
  overflow: hidden;
  overscroll-behavior: none;
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
  -webkit-user-drag: none;
  background: var(--bg);
  font-family: Segoe UI, Arial, sans-serif;
}

@supports (height: 100dvh) {
  html,
  body,
  #app {
    height: 100dvh;
    min-height: 100dvh;
  }
}

html,
body {
  position: fixed;
  inset: 0;
}

#app {
  position: fixed;
  inset: 0;
}

button {
  font: inherit;
  user-select: none;
  -webkit-user-select: none;
}

input,
select,
textarea {
  user-select: text;
  -webkit-user-select: text;
}

#viewport {
  position: absolute;
  inset: 0;
  z-index: 0;
  display: none;
}

#map {
  position: absolute;
  inset: 0;
  z-index: 0;
  background: var(--bg);
}

body.three-mode #viewport {
  display: block;
}

body.three-mode #map {
  display: none;
}

#glass {
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 2;
  background:
    linear-gradient(180deg, rgba(7, 17, 31, 0.08), rgba(7, 17, 31, 0)),
    radial-gradient(circle at 50% 50%, transparent 0 58%, rgba(7, 17, 31, 0.16));
}

.capture-3d-selection-box {
  position: absolute;
  border: 1.5px solid rgba(96, 165, 250, 0.95);
  background: rgba(59, 130, 246, 0.15);
  box-shadow: 0 0 0 1px rgba(7, 17, 31, 0.45) inset;
  border-radius: 4px;
  pointer-events: none;
  z-index: 4;
}

.export-format-menu {
  position: fixed;
  z-index: 1100;
  display: grid;
  gap: 5px;
  padding: 8px;
  color: var(--text);
  background: rgba(12, 24, 36, 0.97);
  border: 1px solid rgba(148, 163, 184, 0.34);
  border-radius: 8px;
  box-shadow: 0 14px 34px rgba(0, 0, 0, 0.42);
  backdrop-filter: blur(10px);
}

.export-format-menu[hidden] {
  display: none;
}

.export-format-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  padding: 2px 2px 5px;
}

.export-format-title {
  font-size: 13px;
  font-weight: 700;
  line-height: 1.2;
}

.export-format-count {
  margin-top: 2px;
  color: var(--muted);
  font-size: 11px;
}

.export-format-close {
  width: 28px;
  height: 28px;
  flex: 0 0 28px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  color: var(--muted);
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid var(--line);
  border-radius: 6px;
  font: 400 20px/1 Arial, sans-serif;
  cursor: pointer;
}

.export-format-close:hover {
  color: var(--text);
  background: rgba(255, 255, 255, 0.12);
}

.export-format-option {
  width: 100%;
  min-height: 52px;
  display: grid;
  gap: 3px;
  padding: 8px 10px;
  text-align: left;
  color: var(--text);
  background: rgba(255, 255, 255, 0.055);
  border: 1px solid rgba(148, 163, 184, 0.2);
  border-radius: 6px;
  cursor: pointer;
}

.export-format-option:hover,
.export-format-option:focus-visible {
  background: rgba(59, 130, 246, 0.14);
  border-color: rgba(96, 165, 250, 0.58);
  outline: none;
}

.export-format-name {
  font-size: 12px;
  font-weight: 700;
  line-height: 1.2;
}

.export-format-note {
  color: var(--muted);
  font-size: 10px;
  line-height: 1.3;
  white-space: normal;
}

canvas {
  display: block;
}

.card {
  background: var(--panel);
  color: var(--text);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 8px 10px;
  box-shadow: 0 10px 36px rgba(0, 0, 0, 0.28);
  backdrop-filter: blur(6px);
  overflow: hidden;
  touch-action: none;
}

.topbar {
  position: absolute;
  left: 10px;
  top: 10px;
  z-index: 20;
  color: var(--text);
  touch-action: none;
  display: flex;
  gap: 10px;
  align-items: flex-start;
  flex-wrap: wrap;
}

.titlebox {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 8px 5px 8px 10px;
  background: rgba(11, 19, 32, 0.7);
  border: 1px solid var(--line);
  border-radius: 10px;
  min-width: 0;
  width: fit-content;
  max-width: min(94vw, 360px);
}

.title-head {
  display: block;
}

.title-stack {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding-right: 0;
}

.title-row {
  display: inline-flex;
  align-items: flex-start;
  gap: 6px;
  flex-wrap: nowrap;
}

.title-meta-row {
  display: inline-flex;
  align-items: flex-start;
  gap: 15px;
  flex-wrap: nowrap;
}

.title-wifi {
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.title-telemetry {
  flex: 0 0 auto;
  min-width: 0;
  display: inline-flex;
  align-items: flex-start;
  justify-content: flex-start;
  margin-left: 0;
  padding-top: 0;
}

.title-telemetry .esp-metrics-col {
  align-items: flex-start;
}

.title {
  font-weight: 700;
  letter-spacing: 0.02em;
}

.subtitle {
  font-size: 12px;
  color: var(--muted);
  line-height: 1.05;
}

.title-actions {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-top: 4px;
}

.mousebox {
  display: flex;
  flex-direction: column;
  gap: 1px;
  padding: 0;
  background: transparent;
  border: none;
  min-width: 255px;
  max-width: 45vw;
  color: var(--text);
}

.mouse-head {
  font-size: 11px;
  color: var(--muted);
  line-height: 1.05;
}

.mouse-coords {
  font-size: 12px;
  color: var(--text);
  line-height: 1.05;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.layer-control {
  position: relative;
  margin-top: 0;
  width: max-content;
  margin-left: 0;
}

.layer-btn,
.config-icon-btn {
  width: 27px;
  height: 24px;
  display: grid;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: rgba(255, 255, 255, 0.07);
  cursor: pointer;
  padding: 0;
  box-shadow: none;
  transition:
    background 0.18s ease,
    border-color 0.18s ease,
    transform 0.08s ease;
}

.config-icon-btn {
  position: static;
}

.layer-btn span {
  grid-area: 1 / 1;
  width: 12px;
  height: 12px;
  border: 1.6px solid rgba(232, 238, 251, 0.78);
  border-top: 0;
  border-right: 0;
  background: transparent;
  transform: rotate(-45deg) skew(10deg, 10deg);
}

.layer-btn span:nth-child(1) {
  margin-top: -5px;
  opacity: 0.6;
}

.layer-btn span:nth-child(2) {
  margin-top: 0;
  opacity: 0.82;
}

.layer-btn span:nth-child(3) {
  margin-top: 5px;
  opacity: 1;
}

.layer-btn.active,
.layer-btn:hover,
.config-icon-btn.active,
.config-icon-btn:hover {
  background: rgba(22, 163, 74, 0.18);
  border-color: rgba(22, 163, 74, 0.58);
}

.layer-btn:active,
.config-icon-btn:active {
  transform: translateY(1px);
}

.config-icon-btn span {
  grid-column: 1;
  width: 13px;
  height: 2px;
  border-radius: 999px;
  background: rgba(232, 238, 251, 0.82);
  position: relative;
}

.config-icon-btn span::after {
  content: "";
  position: absolute;
  top: 50%;
  width: 4px;
  height: 4px;
  border: 1px solid rgba(232, 238, 251, 0.9);
  border-radius: 50%;
  background: rgba(11, 19, 32, 0.96);
  transform: translateY(-50%);
}

.config-icon-btn span:nth-child(1)::after {
  left: 1px;
}

.config-icon-btn span:nth-child(2)::after {
  right: 1px;
}

.config-icon-btn span:nth-child(3)::after {
  left: 6px;
}

.layer-menu {
  position: absolute;
  left: 0;
  top: 34px;
  width: 230px;
  z-index: 40;
  display: grid;
  gap: 4px;
  padding: 8px;
  background: #0b1320;
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 10px;
  box-shadow: 0 10px 36px rgba(0, 0, 0, 0.34);
  backdrop-filter: none;
}

.layer-menu[hidden] {
  display: none;
}

.layer-menu-title {
  padding: 2px 5px 6px;
  color: var(--muted);
  font-size: 11px;
  line-height: 14px;
}

.layer-option {
  height: 32px;
  line-height: 30px;
  border: 1px solid transparent;
  border-radius: 7px;
  background: transparent;
  color: var(--text);
  text-align: left;
  padding: 0 8px;
  font-size: 12px;
  cursor: pointer;
  white-space: nowrap;
  display: flex;
  align-items: center;
  gap: 8px;
}

.layer-option:hover {
  background: rgba(255, 255, 255, 0.08);
}

.layer-option.active {
  background: rgba(22, 163, 74, 0.22);
  border-color: rgba(22, 163, 74, 0.58);
}

.layer-option-actions {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  flex: 0 0 auto;
}

.layer-action-btn {
  width: 20px;
  height: 20px;
  border-radius: 6px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.08);
  color: #9ca3af;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  cursor: pointer;
}

.layer-action-btn.active {
  color: #f8fafc;
}

.layer-action-btn:disabled {
  color: #6b7280;
  opacity: 1;
  cursor: not-allowed;
}

.layer-action-apply {
  width: auto;
  min-width: 58px;
  height: 20px;
  padding: 0 6px;
  font-size: 11px;
  text-transform: lowercase;
}

.layer-action-apply.active {
  color: #dcfce7;
  border-color: rgba(34, 197, 94, 0.62);
  background: rgba(22, 163, 74, 0.26);
}

.layer-option-label {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
}

.layer-tools {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
  padding: 7px;
  border-top: 1px solid rgba(255, 255, 255, 0.12);
}

.layer-tool-btn {
  min-height: 28px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: rgba(255, 255, 255, 0.07);
  color: var(--muted);
  font-size: 12px;
  cursor: pointer;
}

.layer-tool-btn .tool-icon {
  width: 16px;
  height: 16px;
}

.layer-tool-btn.active {
  color: var(--text);
  border-color: rgba(34, 197, 94, 0.62);
  background: rgba(22, 163, 74, 0.18);
}

.layer-tool-btn:disabled {
  opacity: 0.48;
  cursor: default;
}

.cadastre-layer-list {
  display: grid;
  gap: 5px;
  padding: 7px;
  border-top: 1px solid rgba(255, 255, 255, 0.12);
}

.cadastre-layer-title {
  color: var(--muted);
  font-size: 11px;
  line-height: 14px;
  padding: 0 1px 2px;
}

.cadastre-layer-row {
  display: grid;
  grid-template-columns: 1fr 24px;
  gap: 4px;
  align-items: center;
  border: 1px solid transparent;
  border-radius: 7px;
  padding: 3px;
}

.cadastre-layer-row.active {
  border-color: rgba(34, 197, 94, 0.35);
  background: rgba(22, 163, 74, 0.12);
}

.cadastre-layer-toggle {
  justify-content: flex-start;
  min-width: 0;
}

.cadastre-layer-toggle span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.cadastre-layer-delete {
  width: 22px;
  height: 22px;
}

.cadastre-layer-sub {
  grid-column: 1 / -1;
  color: var(--muted);
  font-size: 10px;
  line-height: 13px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  padding: 0 3px 1px 25px;
}

.cadastre-popup {
  color: #e5edf8;
  font-size: 12px;
  line-height: 16px;
  max-width: min(78vw, 420px);
  overflow-wrap: anywhere;
  word-break: normal;
}

.cadastre-popup-title {
  font-weight: 700;
  color: #f8fafc;
  margin-bottom: 3px;
}

.cadastre-popup-point {
  display: grid;
  gap: 3px;
}

.cadastre-popup-point-main {
  color: #f8fafc;
  font-size: 12.5px;
  font-weight: 500;
  line-height: 16px;
}

.cadastre-popup-point-sub {
  color: #cbd5e1;
  font-size: 10.5px;
  font-weight: 600;
  line-height: 12.5px;
}

.cadastre-popup-object {
  color: #e5edf8;
  font-size: 12px;
  font-weight: 700;
  line-height: 15px;
}

.cadastre-popup-meta {
  color: #93c5fd;
  font-size: 11px;
  line-height: 13px;
}

.cadastre-popup-inline {
  margin-top: -1px;
}

.cadastre-popup-muted {
  color: #a8b3c4;
  font-size: 10.5px;
  line-height: 13px;
}

.leaflet-popup-content-wrapper {
  border: 1px solid rgba(148, 163, 184, 0.45);
  background: rgba(8, 15, 28, 0.9);
  color: #e5edf8;
  border-radius: 8px;
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.45);
}

.leaflet-popup-content {
  margin: 8px 10px;
  color: #e5edf8;
  max-width: min(78vw, 420px);
}

.leaflet-popup-tip {
  border: 1px solid rgba(148, 163, 184, 0.35);
  background: rgba(8, 15, 28, 0.9);
}

.leaflet-container a.leaflet-popup-close-button {
  color: #cbd5e1;
}

.leaflet-container a.leaflet-popup-close-button:hover {
  color: #ffffff;
}

.cadastre-highlight-label {
  background: transparent;
  border: 0;
  pointer-events: none;
}

.cadastre-highlight-label span {
  display: inline-block;
  width: 190px;
  color: #ffffff;
  font: 900 11px/13px Segoe UI, Arial, sans-serif;
  text-align: center;
  white-space: nowrap;
  text-shadow:
    0 1px 2px rgba(0, 0, 0, 0.95),
    0 0 4px rgba(0, 0, 0, 0.85);
}

@media (max-width: 760px) {
  .leaflet-popup-content {
    max-width: 72vw;
    margin: 7px 9px;
  }

  .cadastre-popup {
    max-width: 72vw;
  }

  .cadastre-popup-point-main {
    font-size: 12px;
    line-height: 15px;
  }

  .cadastre-popup-point-sub {
    font-size: 10px;
    line-height: 12px;
  }

  .cadastre-popup-object {
    font-size: 11px;
    line-height: 14px;
  }

  .cadastre-popup-meta {
    font-size: 10.5px;
    line-height: 12.5px;
  }

  .cadastre-popup-muted {
    font-size: 10px;
    line-height: 12.5px;
  }

  .cadastre-highlight-label span {
    width: 150px;
    font-size: 10px;
    line-height: 12px;
  }
}

.view-toggle,
.tile-toggle {
  position: absolute;
  top: 10px;
  z-index: 60;
  border: 1px solid var(--line);
  background: rgba(11, 19, 32, 0.82);
  color: var(--text);
  border-radius: 8px;
  padding: 4px 8px;
  font-size: 11px;
  cursor: pointer;
  touch-action: manipulation;
  transition:
    transform 0.08s ease,
    box-shadow 0.18s ease,
    background 0.18s ease,
    border-color 0.18s ease;
}

.mode-toggle {
  border: 1px solid var(--line);
  background: rgba(11, 19, 32, 0.82);
  color: var(--text);
  border-radius: 8px;
  padding: 4px 8px;
  font-size: 11px;
  cursor: pointer;
  touch-action: manipulation;
  transition:
    transform 0.08s ease,
    box-shadow 0.18s ease,
    background 0.18s ease,
    border-color 0.18s ease;
}

.view-toggle {
  right: 10px;
}

.title-actions .config-icon-btn {
  position: static;
  top: auto;
  right: auto;
  z-index: auto;
  padding: 0;
}

.tile-toggle {
  right: 86px;
}

.view-toggle.active,
.tile-toggle.active,
.mode-toggle.active,
.mini-toggle.active,
.detail-toggle.active {
  background: rgba(22, 163, 74, 0.22);
  border-color: rgba(22, 163, 74, 0.7);
}

.view-toggle:hover,
.tile-toggle:hover,
.mode-toggle:hover,
.mini-toggle:hover,
.detail-toggle:hover {
  background: rgba(255, 255, 255, 0.14);
  border-color: rgba(255, 255, 255, 0.28);
}

.view-toggle:active,
.tile-toggle:active,
.mode-toggle:active,
.mini-toggle:active,
.detail-toggle:active {
  transform: translateY(1px) scale(0.98);
  box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.22) inset;
}

.hud {
  position: absolute;
  left: 10px;
  right: 10px;
  bottom: 10px;
  z-index: 3;
  display: grid;
  grid-template-columns: minmax(180px, 220px) minmax(0, 1fr);
  gap: 8px;
  align-items: end;
  touch-action: none;
}

.status-list {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 3px 5px;
  align-content: start;
  width: 100px;
  min-width: 100px;
  max-width: 100px;
}

.status-list.card {
  padding: 5px 6px;
  border-radius: 10px;
}

#statusCells {
  display: contents;
}

.status-row {
  display: flex;
  align-items: center;
  gap: 4px;
  font-size: 9px;
  font-weight: 700;
  white-space: nowrap;
}

.sq {
  width: 8px;
  height: 8px;
  border-radius: 2px;
  flex: 0 0 8px;
  box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.15) inset;
}

.green {
  background: var(--green);
}

.yellow {
  background: var(--yellow);
}

.red {
  background: var(--red);
}

.gray {
  background: #6b7280;
}

.status-cta {
  grid-column: 2;
  justify-self: end;
  align-self: center;
  margin-top: 0;
  margin-right: 2px;
  font-size: 9px;
  padding: 2px 6px;
  border-radius: 7px;
}

.mini-toggle,
.detail-toggle {
  align-self: flex-start;
  margin-top: 2px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.08);
  color: var(--text);
  border-radius: 8px;
  padding: 3px 8px;
  font-size: 11px;
  cursor: pointer;
  white-space: nowrap;
}

.status-list .status-cta {
  grid-column: 1 / -1;
  justify-self: stretch;
  align-self: center;
  margin-top: 0;
  margin-right: 0;
  font-size: 9px;
  line-height: 1.05;
  padding: 1px 5px;
  border-radius: 7px;
  text-align: center;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
}

.icon-toggle {
  min-width: 36px;
  padding: 3px 6px;
  text-align: center;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: #9ca3af;
}

.icon-toggle,
.icon-toggle.active {
  background: rgba(255, 255, 255, 0.08);
  border-color: var(--line);
}

.icon-toggle.active {
  color: #f8fafc;
}

#voicePtt.voice-listening {
  border-color: rgba(239, 68, 68, 0.85);
  box-shadow: 0 0 0 1px rgba(239, 68, 68, 0.35) inset, 0 0 10px rgba(239, 68, 68, 0.35);
}

#voicePtt.voice-enabled:not(.voice-listening) {
  border-color: rgba(248, 250, 252, 0.45);
  box-shadow: 0 0 0 1px rgba(248, 250, 252, 0.12) inset;
}

.icon-toggle:disabled {
  color: #6b7280;
  opacity: 1;
}

.tool-icon {
  width: 14px;
  height: 14px;
  display: block;
  pointer-events: none;
}

#lockPoint.active {
  background: rgba(255, 255, 255, 0.08);
  border-color: var(--line);
}

.mini-toggle:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.lines {
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: 13px;
  line-height: 1.15;
}

.lines .big {
  font-size: 13px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.lines .big.pos-line {
  display: flex;
  align-items: center;
  gap: 6px;
}

.pos-line-icon {
  width: 13px;
  height: 13px;
  flex: 0 0 13px;
  color: #93c5fd;
  opacity: 0.96;
}

.pos-line-text {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

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

.detail {
  display: none;
}

.details-open .detail {
  display: block;
}

.esp-row {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: nowrap;
  margin-bottom: 2px;
}

.esp-tools-row {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: nowrap;
  margin: 2px 0 4px;
}

.esp-tools-row:empty {
  display: none;
}

.esp-row .small {
  min-width: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.measure-label-2d {
  color: #f8fafc;
  font-size: 12px;
  font-weight: 700;
  line-height: 1.1;
  text-shadow: 0 1px 3px rgba(0, 0, 0, 0.95);
  white-space: nowrap;
  pointer-events: none;
}

.measure-area-label-2d {
  color: #cbd5e1;
  font-size: 12px;
  letter-spacing: 0;
}

.control-computed-cross-icon,
.control-computed-arrow-icon,
.control-computed-mm-icon {
  background: transparent !important;
  border: 0 !important;
}

.control-computed-cross {
  position: relative;
  display: block;
  width: 14px;
  height: 14px;
}

.control-computed-cross::before,
.control-computed-cross::after {
  content: "";
  position: absolute;
  left: 50%;
  top: 50%;
  background: #cbd5e1;
  transform: translate(-50%, -50%);
}

.control-computed-cross::before {
  width: 10px;
  height: 1.8px;
}

.control-computed-cross::after {
  width: 1.8px;
  height: 10px;
}

.control-computed-arrow {
  display: block;
  width: 14px;
  height: 14px;
  color: #cbd5e1;
  font-size: 14px;
  line-height: 14px;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.8);
  transform-origin: 50% 50%;
}

.control-computed-mm {
  display: inline-block;
  color: #e2e8f0;
  font-size: 11px;
  font-weight: 700;
  line-height: 1;
  white-space: nowrap;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.95);
}

.esp-compact {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: transparent;
  padding: 0;
  border: none;
  border-radius: 0;
}

.esp-compact.is-offline {
  opacity: 0.85;
}

.esp-wifi {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 18px;
  height: 18px;
  color: #f8fafc;
}

.esp-wifi.is-offline {
  color: #9ca3af;
}

.esp-wifi-icon {
  width: 19px;
  height: 19px;
  display: block;
}

.title-wifi .esp-wifi-icon {
  width: 17px;
  height: 17px;
}

.esp-metric {
  color: var(--muted);
  font-size: 12px;
  letter-spacing: 0;
  white-space: nowrap;
}

.titlebox.esp-offline .esp-metric {
  color: #7f8ea3;
}

.title-telemetry .esp-metric {
  font-size: 9px;
}

.esp-metrics-col {
  display: inline-flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 1px;
  line-height: 1.05;
}

#espLine {
  display: none !important;
}

@media (min-width: 701px) {
  .title-stack { padding-right: 0; }
}

.ui-hover-tooltip {
  position: fixed;
  z-index: 1400;
  max-width: 280px;
  padding: 6px 9px;
  border: 1px solid rgba(255, 255, 255, 0.22);
  border-radius: 8px;
  background: rgba(9, 16, 28, 0.95);
  color: var(--text);
  font-size: 12px;
  line-height: 1.25;
  box-shadow: 0 10px 28px rgba(0, 0, 0, 0.35);
  backdrop-filter: blur(4px);
  pointer-events: none;
  white-space: normal;
}

.skywrap {
  position: absolute;
  top: 16px;
  right: 18px;
  z-index: 3;
  width: 198px;
  height: 198px;
  pointer-events: none;
}

.skybox {
  position: absolute;
  inset: 0;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.04);
  box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.18) inset;
  backdrop-filter: blur(2px);
}

.vscale {
  position: absolute;
  left: -3px;
  top: 106px;
  bottom: 188px;
  width: 84px;
  z-index: 3;
  pointer-events: none;
  color: rgba(232, 238, 251, 0.72);
  font-size: 10px;
  line-height: 1;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  justify-content: flex-start;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.5);
}

.vscale-canvas {
  display: block;
  width: 84px;
  flex: 1 1 auto;
}

.view-gizmo {
  position: absolute;
  right: 14px;
  bottom: 112px;
  width: 132px;
  height: 132px;
  z-index: 6;
  display: none;
  grid-template-columns: repeat(3, 1fr);
  grid-template-rows: repeat(3, 1fr);
  gap: 4px;
  align-items: center;
  justify-items: center;
  padding: 8px;
  border: none;
  border-radius: 0;
  background: transparent;
  backdrop-filter: none;
}

body.three-mode .view-gizmo {
  display: grid;
}

.view-gizmo-canvas {
  grid-column: 1 / -1;
  grid-row: 1 / -1;
  width: 96px;
  height: 96px;
  pointer-events: none;
  opacity: 0.95;
}

.gizmo-btn {
  width: 26px;
  height: 22px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.08);
  color: var(--text);
  font-size: 11px;
  line-height: 1;
  padding: 0;
  cursor: pointer;
}

.gizmo-btn.active {
  background: rgba(236, 72, 153, 0.24);
  border-color: rgba(236, 72, 153, 0.78);
  box-shadow: 0 0 0 1px rgba(236, 72, 153, 0.25) inset;
}

.gizmo-btn:hover {
  background: rgba(255, 255, 255, 0.16);
}

.gizmo-top {
  grid-column: 2;
  grid-row: 1;
}

.gizmo-left {
  grid-column: 1;
  grid-row: 2;
}

.gizmo-iso {
  grid-column: 3;
  grid-row: 1;
}

.gizmo-right {
  grid-column: 3;
  grid-row: 2;
}

.gizmo-front {
  grid-column: 1;
  grid-row: 3;
}

.gizmo-bottom {
  grid-column: 2;
  grid-row: 3;
}

.gizmo-back {
  grid-column: 3;
  grid-row: 3;
}

.cursor-cross {
  position: absolute;
  left: 0;
  top: 0;
  z-index: 4;
  pointer-events: none;
  display: none;
  width: 18px;
  height: 18px;
  transform: translate(-50%, -50%);
  filter: drop-shadow(0 1px 2px rgba(0, 0, 0, 0.55));
}

.cursor-cross::before,
.cursor-cross::after {
  content: "";
  position: absolute;
  background: rgba(255, 255, 255, 0.88);
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
}

.cursor-cross::before {
  width: 18px;
  height: 2px;
  border-radius: 2px;
}

.cursor-cross::after {
  width: 2px;
  height: 18px;
  border-radius: 2px;
}

.cursor-cross i {
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  width: 6px;
  height: 6px;
  border: 1px solid rgba(255, 255, 255, 0.95);
  border-radius: 50%;
  background: rgba(59, 130, 246, 0.75);
}

.toast {
  position: fixed;
  z-index: 10;
  left: 50%;
  bottom: 92px;
  transform: translateX(-50%);
  max-width: calc(100vw - 24px);
  padding: 9px 13px;
  border-radius: 10px;
  color: var(--text);
  font-size: 13px;
  background: var(--panel);
  border: 1px solid var(--line);
  box-shadow: 0 10px 36px rgba(0, 0, 0, 0.28);
  backdrop-filter: blur(6px);
  white-space: normal;
  overflow-wrap: anywhere;
  word-break: break-word;
}

.confirm-modal {
  position: fixed;
  inset: 0;
  z-index: 30;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  background: rgba(2, 8, 23, 0.56);
  backdrop-filter: blur(3px);
}

.confirm-modal[hidden] {
  display: none;
}

.confirm-dialog {
  width: min(420px, calc(100vw - 26px));
  border-radius: 12px;
  border: 1px solid rgba(148, 163, 184, 0.36);
  background: linear-gradient(180deg, rgba(12, 23, 40, 0.96), rgba(8, 17, 31, 0.96));
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.38);
  padding: 14px;
  color: var(--text);
}

.confirm-title {
  font-size: 14px;
  font-weight: 700;
  margin-bottom: 8px;
}

.confirm-message {
  font-size: 13px;
  color: #dbe7f5;
  line-height: 1.35;
  margin-bottom: 14px;
}

.confirm-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
}

body.confirm-open {
  overflow: hidden;
}

#targetLine {
  white-space: normal;
  overflow: visible;
  text-overflow: clip;
  overflow-wrap: anywhere;
}

.target-action-btn {
  position: relative;
  align-self: flex-start;
  min-width: 38px;
  height: 25px;
  margin: 2px 0 0;
  padding: 3px 8px;
  border-radius: 8px;
  border: 1px solid rgba(96, 165, 250, 0.45);
  background: rgba(15, 23, 42, 0.9);
  color: #bfdbfe;
  font-size: 11px;
  font-weight: 700;
}

.target-action-btn[hidden] {
  display: none;
}

.target-action-btn.target-action-pulse::after {
  content: "создать геопункт";
  position: absolute;
  left: 50%;
  top: calc(100% + 7px);
  transform: translateX(-50%);
  z-index: 20;
  min-width: 118px;
  padding: 5px 8px;
  border: 1px solid rgba(125, 211, 252, 0.5);
  border-radius: 8px;
  background: rgba(8, 17, 31, 0.96);
  color: #dbeafe;
  font-size: 11px;
  font-weight: 600;
  line-height: 1.1;
  white-space: nowrap;
  pointer-events: none;
  box-shadow: 0 10px 22px rgba(0, 0, 0, 0.36);
}

.target-action-btn.target-action-pulse {
  animation: targetActionPulse 0.85s ease-in-out 4;
}

#mskCalibrate.msk-calibrate-pulse {
  position: relative;
  animation: targetActionPulse 0.85s ease-in-out 4;
}

#mskCalibrate.msk-calibrate-pulse::after {
  content: "притянуть МСК";
  position: absolute;
  left: 50%;
  top: calc(100% + 7px);
  transform: translateX(-50%);
  z-index: 20;
  min-width: 104px;
  padding: 5px 8px;
  border: 1px solid rgba(125, 211, 252, 0.5);
  border-radius: 8px;
  background: rgba(8, 17, 31, 0.96);
  color: #dbeafe;
  font-size: 11px;
  font-weight: 600;
  line-height: 1.1;
  white-space: nowrap;
  pointer-events: none;
  box-shadow: 0 10px 22px rgba(0, 0, 0, 0.36);
}

@keyframes targetActionPulse {
  0%, 100% {
    border-color: rgba(96, 165, 250, 0.45);
    background: rgba(15, 23, 42, 0.9);
    box-shadow: none;
  }
  50% {
    border-color: rgba(125, 211, 252, 0.95);
    background: rgba(14, 116, 144, 0.32);
    box-shadow: 0 0 0 1px rgba(125, 211, 252, 0.26) inset, 0 0 12px rgba(56, 189, 248, 0.38);
  }
}

.geo-point-modal {
  position: fixed;
  inset: 0;
  z-index: 35;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 14px;
  background: rgba(2, 8, 23, 0.62);
  backdrop-filter: blur(3px);
}

.geo-point-dialog {
  width: min(460px, calc(100vw - 24px));
  border: 1px solid rgba(148, 163, 184, 0.38);
  border-radius: 12px;
  background: rgba(8, 17, 31, 0.97);
  box-shadow: 0 22px 44px rgba(0, 0, 0, 0.42);
  color: var(--text);
  padding: 14px;
}

.geo-point-title {
  font-size: 15px;
  font-weight: 700;
  margin-bottom: 6px;
}

.geo-point-note,
.geo-point-ref {
  color: #cbd5e1;
  font-size: 12px;
  line-height: 1.35;
  margin-bottom: 10px;
}

.geo-point-dialog label {
  display: flex;
  flex-direction: column;
  gap: 4px;
  color: #cbd5e1;
  font-size: 12px;
  margin-bottom: 8px;
}

.geo-point-dialog input {
  height: 32px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: rgba(30, 41, 59, 0.92);
  color: var(--text);
  padding: 0 9px;
  font: inherit;
}

.geo-point-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

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

.geo-point-save {
  border-color: rgba(34, 197, 94, 0.56);
  background: rgba(22, 101, 52, 0.34);
  color: #dcfce7;
}

.config-view {
  display: none;
  position: absolute;
  top: 42px;
  left: 10px;
  right: 10px;
  bottom: 10px;
  z-index: 4;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 8px;
  color: var(--text);
  box-shadow: 0 10px 36px rgba(0, 0, 0, 0.28);
  backdrop-filter: blur(6px);
  overflow: auto;
  touch-action: pan-y;
  user-select: text;
  -webkit-user-select: text;
}

body.config-mode #viewport,
body.config-mode #map,
body.config-mode #glass,
body.config-mode .hud,
body.config-mode .skywrap,
body.config-mode .vscale,
body.config-mode .view-gizmo {
  display: none;
}

body.config-mode .titlebox {
  display: none;
}

body.config-mode .mousebox {
  display: none;
}

body.config-mode .topbar {
  display: none;
}

body.config-mode .config-view {
  display: block;
  top: 10px;
}

.cfg-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 6px;
  position: sticky;
  top: -8px;
  z-index: 30;
  background: rgba(7, 17, 31, 0.96);
  padding: 8px 2px 6px;
  border-bottom: 1px solid rgba(148, 163, 184, 0.2);
  backdrop-filter: blur(4px);
}

.cfg-title {
  font-weight: 700;
  margin-bottom: 0;
}

.cfg-subtitle {
  color: var(--muted);
  font-size: 12px;
  margin: 0;
}

.cfg-close-btn {
  flex: 0 0 auto;
  height: 28px;
  min-width: 72px;
  border: 1px solid rgba(34, 197, 94, 0.58);
  border-radius: 7px;
  background: rgba(22, 163, 74, 0.18);
  color: var(--text);
  font-size: 12px;
  cursor: pointer;
}

.cfg-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 4px 10px;
  align-items: end;
}

.cfg-sections {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.cfg-group {
  border: 1px solid rgba(148, 163, 184, 0.26);
  border-radius: 8px;
  padding: 8px;
  background: rgba(7, 17, 31, 0.3);
}

.cfg-group-title {
  font-size: 12px;
  color: #cbd5e1;
  margin-bottom: 6px;
  font-weight: 600;
}

.cfg-field {
  display: flex;
  flex-direction: column;
  gap: 1px;
}

.cfg-field label {
  font-size: 12px;
  color: var(--muted);
}

.cfg-field input,
.cfg-field select {
  height: 25px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.08);
  color: var(--text);
  padding: 3px 7px;
  font-size: 13px;
}

.cfg-field select option {
  background: #0b1422;
  color: var(--text);
}

.cfg-inline {
  display: flex;
  gap: 6px;
  align-items: center;
}

.cfg-inline input,
.cfg-inline select {
  flex: 1 1 auto;
}

.cfg-wifi-native-hidden {
  display: none !important;
}

.cfg-wifi-dropdown {
  position: relative;
  flex: 1 1 auto;
  min-width: 0;
}

.cfg-wifi-trigger {
  width: 100%;
  height: 25px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.08);
  color: var(--text);
  padding: 3px 8px;
  font-size: 13px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.cfg-wifi-trigger-text {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.cfg-wifi-trigger-caret {
  color: var(--muted);
  width: 14px;
  height: 14px;
  flex: 0 0 14px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.cfg-wifi-trigger-caret svg {
  width: 14px;
  height: 14px;
  display: block;
}

.cfg-wifi-menu {
  position: absolute;
  top: calc(100% + 4px);
  left: 0;
  right: 0;
  max-height: 260px;
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #07162b;
  z-index: 20;
  box-shadow: 0 10px 28px rgba(0, 0, 0, 0.35);
}

.cfg-wifi-item {
  width: 100%;
  border: 0;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
  background: transparent;
  color: var(--text);
  font-size: 13px;
  padding: 5px 8px;
  display: flex;
  align-items: center;
  gap: 8px;
  text-align: left;
}

.cfg-wifi-item:last-child {
  border-bottom: 0;
}

.cfg-wifi-item:hover,
.cfg-wifi-item.active {
  background: rgba(59, 130, 246, 0.28);
}

.cfg-wifi-signal {
  font-family: monospace;
  letter-spacing: 0;
  min-width: 40px;
}

.cfg-wifi-lock {
  display: inline-flex;
  width: 13px;
  height: 13px;
  flex: 0 0 13px;
}

.cfg-wifi-lock svg {
  width: 100%;
  height: 100%;
  display: block;
}

.cfg-wifi-lock.is-locked {
  color: #f8fafc;
}

.cfg-wifi-lock.is-open {
  color: #9ca3af;
}

.cfg-wifi-ssid {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.cfg-actions {
  display: flex;
  gap: 8px;
  margin-top: 8px;
  flex-wrap: wrap;
}

.cfg-journal {
  margin-top: 10px;
  border: 1px solid rgba(148, 163, 184, 0.26);
  border-radius: 8px;
  padding: 8px;
  background: rgba(7, 17, 31, 0.3);
}

.cfg-journal-actions {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
  color: #94a3b8;
  font-size: 11px;
}

.cfg-journal-wrap {
  width: 100%;
  max-height: 280px;
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.06);
}

.cfg-journal-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 11px;
}

.cfg-journal-table thead th {
  position: sticky;
  top: 0;
  z-index: 1;
  background: rgba(7, 17, 31, 0.95);
  color: #cbd5e1;
  text-align: left;
  padding: 4px 6px;
  border-bottom: 1px solid rgba(148, 163, 184, 0.25);
  white-space: nowrap;
}

.cfg-journal-table td {
  padding: 4px 6px;
  border-bottom: 1px solid rgba(148, 163, 184, 0.14);
  vertical-align: top;
  white-space: nowrap;
}

.cfg-journal-table td.cfg-journal-comment {
  white-space: normal;
  min-width: 160px;
}

.cfg-journal-mesh-state {
  color: #94a3b8;
  font-size: 10px;
}

.cfg-calib {
  margin-top: 10px;
  border: 1px solid rgba(148, 163, 184, 0.26);
  border-radius: 8px;
  padding: 8px;
  background: rgba(7, 17, 31, 0.3);
}

.cfg-calib-title {
  font-size: 12px;
  color: #cbd5e1;
  margin-bottom: 6px;
}

.cfg-calib-points {
  max-height: 140px;
  overflow: auto;
  border: 1px solid rgba(148, 163, 184, 0.2);
  border-radius: 6px;
}

.cfg-calib-point {
  display: grid;
  grid-template-columns: 16px minmax(0, 1fr) auto auto;
  gap: 6px;
  align-items: center;
  padding: 4px 6px;
  border-bottom: 1px solid rgba(148, 163, 184, 0.12);
  font-size: 12px;
}

.cfg-calib-point:last-child {
  border-bottom: 0;
}

.cfg-calib-r {
  color: #94a3b8;
  white-space: nowrap;
}

.cfg-calib-point .cfg-mini-btn-icon {
  justify-self: end;
}

.cfg-calib-actions {
  display: flex;
  gap: 8px;
  margin-top: 7px;
  flex-wrap: wrap;
}

.cfg-calib-history {
  margin-top: 7px;
  max-height: 150px;
  overflow: auto;
  border: 1px solid rgba(148, 163, 184, 0.2);
  border-radius: 6px;
  padding: 4px;
}

.cfg-calib-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 4px;
  border-bottom: 1px solid rgba(148, 163, 184, 0.12);
}

.cfg-calib-item:last-child {
  border-bottom: 0;
}

.cfg-calib-item.active {
  background: rgba(34, 197, 94, 0.12);
}

.cfg-calib-meta {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
  font-size: 11px;
  color: #cbd5e1;
}

.cfg-calib-meta span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.cfg-calib-btns {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.cfg-calib-empty {
  padding: 6px;
  font-size: 12px;
  color: #94a3b8;
}

.cfg-btn,
.cfg-mini-btn,
.cfg-log-toggle {
  height: 28px;
  min-width: 88px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.08);
  color: var(--text);
  font-size: 12px;
  cursor: pointer;
  transition:
    transform 0.08s ease,
    box-shadow 0.18s ease,
    background 0.18s ease,
    border-color 0.18s ease;
}

.btn-ok {
  animation: btnPulseOk 0.62s ease-in-out 1;
  border-color: rgba(34, 197, 94, 0.72) !important;
  background: rgba(34, 197, 94, 0.22) !important;
  box-shadow:
    0 0 0 2px rgba(34, 197, 94, 0.28) inset,
    0 0 16px rgba(34, 197, 94, 0.45);
}

.btn-err {
  animation: btnPulseOk 0.62s ease-in-out 1;
  border-color: rgba(239, 68, 68, 0.72) !important;
  background: rgba(239, 68, 68, 0.22) !important;
  box-shadow:
    0 0 0 2px rgba(239, 68, 68, 0.28) inset,
    0 0 16px rgba(239, 68, 68, 0.45);
}

@keyframes btnPulseOk {
  0% {
    transform: scale(1);
  }

  35% {
    transform: scale(1.05);
  }

  100% {
    transform: scale(1);
  }
}

.cfg-mini-btn,
.cfg-log-toggle {
  height: 25px;
  min-width: 84px;
  font-size: 11px;
  padding: 0 8px;
  white-space: nowrap;
}

.cfg-mini-btn-icon {
  min-width: 30px;
  width: 30px;
  padding: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.cfg-mini-btn-icon .tool-icon {
  width: 14px;
  height: 14px;
}

.cfg-mini-btn-danger {
  border-color: rgba(239, 68, 68, 0.38);
  color: #fecaca;
}

.cfg-mini-btn-danger:hover {
  background: rgba(239, 68, 68, 0.18);
  border-color: rgba(239, 68, 68, 0.62);
}

.cfg-btn:disabled,
.cfg-mini-btn:disabled {
  color: #6b7280;
  border-color: rgba(120, 132, 153, 0.42);
  background: rgba(255, 255, 255, 0.04);
  cursor: not-allowed;
  box-shadow: none;
}

.cfg-live {
  margin-top: 6px;
  border-top: 1px solid var(--line);
  padding-top: 6px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: 14px;
}

.cfg-log {
  margin-top: 10px;
  border-top: 1px solid var(--line);
  padding-top: 8px;
}

.cfg-log-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 4px;
  color: var(--muted);
  font-size: 12px;
}

.cfg-log-view {
  width: 100%;
  min-height: 140px;
  max-height: 320px;
  overflow: auto;
  touch-action: pan-y;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.06);
  color: var(--text);
  font-family: Consolas, monospace;
  font-size: 12px;
  padding: 8px;
  white-space: pre-wrap;
  line-height: 1.35;
}

.debug-mobile-panel {
  position: fixed;
  right: 8px;
  bottom: 8px;
  z-index: 5000;
  max-width: min(280px, calc(100vw - 16px));
  padding: 7px 9px;
  border: 1px solid rgba(34, 197, 94, 0.55);
  border-radius: 7px;
  background: rgba(2, 6, 23, 0.82);
  color: #bbf7d0;
  font: 10px/1.35 Consolas, monospace;
  white-space: pre-line;
  pointer-events: none;
  box-shadow: 0 0 0 1px rgba(2, 6, 23, 0.7), 0 10px 28px rgba(0, 0, 0, 0.32);
}

body.debug-mobile::after {
  content: "";
  position: fixed;
  inset: 0;
  z-index: 4999;
  pointer-events: none;
  box-shadow:
    inset 0 0 0 2px rgba(34, 197, 94, 0.9),
    inset 0 0 0 10px rgba(34, 197, 94, 0.08);
}

.log-line {
  display: block;
}

.log-raw {
  color: #f59e0b;
}

.log-corr {
  color: #22c55e;
}

.log-gga {
  color: #38bdf8;
}

.log-rtk {
  color: #a78bfa;
}

.log-err {
  color: #ef4444;
}

.log-info {
  color: #e5e7eb;
}

.leaflet-tooltip {
  background: rgba(11, 19, 32, 0.82);
  border: 1px solid rgba(255, 255, 255, 0.22);
  color: var(--text);
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.28);
  font: 700 11px Segoe UI, Arial, sans-serif;
  padding: 2px 5px;
}

.leaflet-tooltip::before {
  display: none;
}

.gps-marker-icon {
  background: transparent !important;
  border: none !important;
}

.gps-marker-dot {
  display: block;
  width: 18px;
  height: 18px;
  border: 2px solid #ffffff;
  border-radius: 50%;
  box-shadow:
    0 1px 4px rgba(0, 0, 0, 0.45),
    0 0 0 2px rgba(0, 0, 0, 0.18);
}

.gps-marker-dot.red {
  background: #ef4444;
}

.gps-marker-dot.yellow {
  background: #f59e0b;
}

.gps-marker-dot.green {
  background: #22c55e;
}

.gps-marker-dot.gray {
  background: #6b7280;
}

.ctrl-calib-menu-icon {
  background: transparent !important;
  border: none !important;
}

.ctrl-calib-menu {
  min-width: 210px;
  max-width: 260px;
  padding: 6px;
  border-radius: 8px;
  border: 1px solid rgba(148, 163, 184, 0.35);
  background: rgba(7, 17, 31, 0.94);
  box-shadow: 0 8px 22px rgba(0, 0, 0, 0.4);
  backdrop-filter: blur(4px);
}

.ctrl-calib-head {
  color: #e8eefb;
  font-size: 11px;
  font-weight: 700;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin: 0 0 5px;
}

.ctrl-calib-list {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.ctrl-calib-item {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 1px;
  width: 100%;
  border: 1px solid rgba(148, 163, 184, 0.3);
  border-radius: 6px;
  background: rgba(15, 23, 42, 0.78);
  color: #e8eefb;
  padding: 4px 6px;
  cursor: pointer;
  text-align: left;
}

.ctrl-calib-item:hover {
  border-color: rgba(125, 211, 252, 0.55);
  background: rgba(30, 41, 59, 0.86);
}

.ctrl-calib-item.active {
  border-color: rgba(34, 197, 94, 0.65);
  color: #86efac;
}

.ctrl-calib-item:disabled {
  opacity: 0.72;
  cursor: default;
}

.ctrl-calib-main {
  font-size: 11px;
  font-weight: 700;
  line-height: 1.1;
}

.ctrl-calib-shift {
  font-size: 10px;
  color: #dbeafe;
  line-height: 1.05;
}

.ctrl-calib-sub {
  font-size: 10px;
  color: #94a3b8;
  line-height: 1.05;
}

.nav-vector-icon {
  background: transparent !important;
  border: none !important;
}

.nav-vector-widget {
  width: 190px;
  height: 150px;
  pointer-events: none;
}

.nav-vector-svg {
  width: 190px;
  height: 150px;
  overflow: visible;
  filter: drop-shadow(0 2px 5px rgba(0, 0, 0, 0.4));
}

.vec-base {
  stroke: rgba(255, 255, 255, 0.45);
  stroke-width: 1.1;
  fill: none;
}

.vec-x line,
.vec-x polygon {
  stroke: #60a5fa;
  fill: #60a5fa;
}

.vec-y line,
.vec-y polygon {
  stroke: #f59e0b;
  fill: #f59e0b;
}

.vec-r line,
.vec-r polygon {
  stroke: #22c55e;
  fill: #22c55e;
}

.vec-x text,
.vec-y text,
.vec-r text {
  fill: #e8eefb;
  font: 400 11px/1 Segoe UI, Arial, sans-serif;
  paint-order: stroke;
  stroke: rgba(11, 19, 32, 0.88);
  stroke-width: 2px;
  stroke-linejoin: round;
}

@media (max-width: 1100px) {
  .hud {
    grid-template-columns: 1fr;
    align-items: stretch;
    gap: 6px;
  }

  .status-list {
    grid-template-columns: 1fr 1fr;
  }

  .skywrap {
    transform: scale(0.9);
    transform-origin: top right;
  }
}

@media (max-width: 700px) {
  .hud {
    left: 6px;
    right: 6px;
    bottom: 6px;
  }

  .card {
    padding: 7px 8px;
    border-radius: 10px;
  }

  .status-list {
    width: 100px;
    min-width: 100px;
    max-width: 100px;
  }

  .lines,
  .lines .big {
    font-size: 12px;
  }

  .skywrap {
    top: 8px;
    right: 8px;
    transform: scale(0.82);
    transform-origin: top right;
  }

  .vscale {
    left: -9px;
    top: 98px;
    bottom: 188px;
    transform: scale(0.92);
    transform-origin: top left;
    width: 74px;
  }

  .vscale-canvas {
    width: 74px;
  }

  .view-gizmo {
    right: 8px;
    bottom: 104px;
    width: 116px;
    height: 116px;
    padding: 7px;
  }

  .view-gizmo-canvas {
    width: 82px;
    height: 82px;
  }

  .gizmo-btn {
    width: 22px;
    height: 20px;
    font-size: 10px;
  }

  .mousebox {
    min-width: 220px;
    max-width: unset;
  }

  .titlebox {
    min-width: 0;
    max-width: min(86vw, 320px);
  }

  .title-head {
    gap: 8px;
  }

  .title-telemetry .esp-metric {
    font-size: 9px;
  }

  .view-toggle {
    right: 8px;
  }

  .tile-toggle {
    right: 78px;
  }

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

@media (max-width: 500px) {
  .title-stack { padding-right: 0; }
}

body.auth-pending #app,
body.auth-visible #app {
  visibility: hidden;
}

body.auth-ready .auth-screen {
  display: none;
}

.auth-register-field[hidden],
.auth-field[hidden],
.auth-mode-link[hidden],
.account-menu[hidden],
.account-users[hidden],
.account-menu-action[hidden] {
  display: none !important;
}

.auth-screen {
  position: fixed;
  inset: 0;
  z-index: 10000;
  overflow: hidden;
  background: #05080d;
  color: #f2f6fa;
}

.auth-globe,
.auth-shade {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
}

.auth-shade {
  background: rgba(0, 0, 0, 0.2);
  pointer-events: none;
}

.auth-brand {
  position: absolute;
  left: clamp(24px, 6vw, 92px);
  top: clamp(24px, 8vh, 96px);
  z-index: 2;
  max-width: 520px;
}

.auth-brand-mark {
  color: #f7fafc;
  font-size: clamp(34px, 5vw, 76px);
  font-weight: 700;
  line-height: 1;
  letter-spacing: 0;
}

.auth-brand-subtitle {
  margin-top: 14px;
  color: #aab7c3;
  font-size: clamp(14px, 1.5vw, 19px);
  line-height: 1.45;
}

.auth-panel {
  position: absolute;
  z-index: 3;
  right: clamp(24px, 7vw, 110px);
  top: 50%;
  width: min(360px, calc(100vw - 48px));
  transform: translateY(-50%);
  padding: 28px;
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 8px;
  background: rgba(13, 18, 24, 0.94);
  box-shadow: 0 22px 70px rgba(0, 0, 0, 0.5);
}

.auth-panel-title {
  margin-bottom: 22px;
  font-size: 24px;
  font-weight: 650;
}

.auth-field {
  display: grid;
  gap: 7px;
  margin-bottom: 16px;
  color: #b7c2cd;
  font-size: 13px;
}

.auth-field input {
  width: 100%;
  height: 44px;
  border: 1px solid #3c4752;
  border-radius: 6px;
  outline: none;
  padding: 0 12px;
  background: #080d12;
  color: #f5f8fa;
  font-size: 16px;
}

.auth-field input:focus {
  border-color: #4ed1b1;
  box-shadow: 0 0 0 2px rgba(78, 209, 177, 0.18);
}

.auth-submit,
.auth-mode-link {
  width: 100%;
  min-height: 43px;
  border-radius: 6px;
  cursor: pointer;
}

.auth-submit {
  border: 1px solid #55d4b4;
  background: #36b996;
  color: #04120e;
  font-weight: 700;
}

.auth-submit:disabled {
  cursor: wait;
  opacity: 0.6;
}

.auth-mode-link {
  margin-top: 10px;
  border: 0;
  background: transparent;
  color: #9db5c8;
}

.auth-error {
  margin: -2px 0 14px;
  color: #ff9c91;
  font-size: 13px;
  line-height: 1.4;
}

.auth-loading {
  position: absolute;
  z-index: 4;
  right: clamp(24px, 7vw, 110px);
  top: calc(50% + 206px);
  width: min(360px, calc(100vw - 48px));
  color: #85929e;
  font-size: 12px;
  text-align: center;
}

body.auth-visible .auth-loading {
  display: none;
}

.account-control {
  position: relative;
}

.account-btn {
  display: flex;
  align-items: center;
  gap: 7px;
  height: 34px;
  max-width: 150px;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 0 9px;
  background: rgba(8, 14, 23, 0.78);
  color: var(--text);
  cursor: pointer;
}

.account-avatar {
  width: 16px;
  height: 16px;
  flex: 0 0 16px;
  border: 2px solid #58d1b1;
  border-radius: 50%;
  box-shadow: inset 0 -5px 0 rgba(88, 209, 177, 0.35);
}

.account-login {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 12px;
}

.account-menu {
  position: absolute;
  top: calc(100% + 7px);
  left: 0;
  right: auto;
  z-index: 140;
  width: 270px;
  max-height: min(440px, 75vh);
  overflow: auto;
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: 7px;
  padding: 8px;
  background: #101823;
  box-shadow: 0 16px 42px rgba(0, 0, 0, 0.42);
}

.account-menu-current {
  padding: 8px 9px 10px;
  border-bottom: 1px solid var(--line);
  color: #aeb9c6;
  font-size: 12px;
}

.account-users {
  display: grid;
  gap: 3px;
  padding: 7px 0;
}

.account-user,
.account-menu-action {
  width: 100%;
  border: 0;
  border-radius: 5px;
  padding: 9px;
  background: transparent;
  color: #e8eef5;
  text-align: left;
  cursor: pointer;
}

.account-user:hover,
.account-menu-action:hover {
  background: rgba(255, 255, 255, 0.08);
}

.account-user.active {
  background: rgba(78, 209, 177, 0.14);
  color: #75e3c7;
}

.account-logout {
  margin-top: 4px;
  border-top: 1px solid var(--line);
  color: #ffaea5;
}

@media (max-width: 760px) {
  .auth-brand {
    top: 28px;
    left: 24px;
  }

  .auth-brand-subtitle {
    max-width: 290px;
  }

  .auth-panel {
    right: 24px;
    bottom: 28px;
    top: auto;
    transform: none;
  }

  .auth-loading {
    display: none;
  }

  .account-login {
    display: none;
  }

  .account-btn {
    width: 34px;
    padding: 0 8px;
  }

  .account-menu { width: min(270px, calc(100vw - 32px)); }
}
