/* ─── Plan / Draw Shapes panels ──────────────────────────────── */

.plan-panel,
.draw-shapes-panel {
  display: flex;
  flex-direction: column;
  width: 100%;
  height: 100%;
  overflow: hidden;
}

.panel-back-btn {
  display: flex;
  align-items: center;
  gap: 6px;
  width: 100%;
  padding: 10px 18px;
  background: none;
  border: none;
  border-bottom: 1px solid var(--blue-border);
  color: var(--gold);
  font-family: 'B612 Mono', ui-monospace, monospace;
  font-size: 12px;
  letter-spacing: 0.1em;
  text-align: left;
  cursor: pointer;
  transition: background 0.15s;
}

.panel-back-btn:hover {
  background: rgba(43, 58, 171, 0.25);
}

.panel-btn-group {
  display: flex;
  flex-direction: column;
  padding: 6px 0;
  border-bottom: 1px solid var(--blue-border);
}

.panel-section-btn {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 10px 18px;
  background: none;
  border: none;
  color: rgba(255, 255, 255, 0.85);
  font-family: 'B612 Mono', ui-monospace, monospace;
  font-size: 13px;
  letter-spacing: 0.06em;
  text-align: left;
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
}

.panel-section-btn:hover:not(.panel-section-btn--disabled) {
  background: rgba(43, 58, 171, 0.3);
  color: var(--gold);
}

.panel-section-btn--disabled {
  color: rgba(255, 255, 255, 0.3);
  cursor: not-allowed;
}

/* ─── Draw Shapes accordion sub-group ──────────────────────── */

.panel-btn-arrow {
  margin-left: auto;
  font-size: 10px;
  color: rgba(255, 255, 255, 0.4);
}

.panel-sub-group {
  display: none;
  flex-direction: column;
  background: rgba(0, 0, 0, 0.18);
}

.panel-sub-group--open {
  display: flex;
}

.panel-sub-btn {
  display: flex;
  align-items: center;
  width: 100%;
  padding: 8px 18px 8px 34px;
  background: none;
  border: none;
  color: rgba(255, 255, 255, 0.7);
  font-family: 'B612 Mono', ui-monospace, monospace;
  font-size: 12px;
  letter-spacing: 0.06em;
  text-align: left;
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
}

.panel-sub-btn:hover {
  background: rgba(43, 58, 171, 0.3);
  color: var(--gold);
}

/* ─── Side-menu root: enabled PLAN button ──────────────────── */

.side-menu__btn--enabled {
  color: rgba(255, 255, 255, 0.85);
  cursor: pointer;
}

.side-menu__btn--enabled:hover {
  background: rgba(43, 58, 171, 0.3);
  color: var(--gold);
}

/* ─── Shape table ───────────────────────────────────────────── */

.shape-table-wrap {
  flex: 1;
  overflow-y: auto;
  padding: 6px 0;
}

.shape-table-empty {
  padding: 12px 18px;
  color: rgba(255, 255, 255, 0.3);
  font-family: 'B612 Mono', ui-monospace, monospace;
  font-size: 11px;
  letter-spacing: 0.05em;
}

.shape-table {
  width: 100%;
  border-collapse: collapse;
  font-family: 'B612 Mono', ui-monospace, monospace;
  font-size: 11px;
  color: rgba(255, 255, 255, 0.75);
}

.shape-table thead th {
  padding: 4px 6px 4px 10px;
  text-align: left;
  color: rgba(255, 255, 255, 0.35);
  font-size: 10px;
  letter-spacing: 0.07em;
  border-bottom: 1px solid rgba(255, 255, 255, 0.07);
}

.shape-table tbody tr {
  cursor: grab;
  transition: background 0.1s;
}

.shape-table tbody tr:hover {
  background: rgba(43, 58, 171, 0.2);
}

.shape-table tbody tr.dragging {
  opacity: 0.45;
}

.shape-table tbody tr.drag-over {
  background: rgba(245, 168, 0, 0.12);
  outline: 1px solid rgba(245, 168, 0, 0.4);
}

.shape-table td {
  padding: 5px 5px 5px 8px;
  vertical-align: middle;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Fixed-width small columns so Name + Location can share the rest */
.shape-table th:nth-child(3),
.shape-table td:nth-child(3) { width: 24px; padding-left: 4px; padding-right: 4px; }
.shape-table th:nth-child(4),
.shape-table td:nth-child(4) { width: 26px; padding-left: 2px; padding-right: 2px; }
.shape-table th:nth-child(5),
.shape-table td:nth-child(5) { width: 22px; padding-left: 0; padding-right: 4px; }

.shape-table__name {
  max-width: 90px;
}

.shape-table__loc {
  max-width: 110px;
  font-size: 10px;
  color: rgba(255, 255, 255, 0.45);
}

.shape-table__swatch {
  display: inline-block;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  border: 1px solid rgba(255, 255, 255, 0.2);
  vertical-align: middle;
}

.shape-table__eye {
  background: none;
  border: none;
  color: rgba(255, 255, 255, 0.5);
  cursor: pointer;
  padding: 2px;
  display: flex;
  align-items: center;
  transition: color 0.15s;
}

.shape-table__eye:hover {
  color: var(--gold);
}

/* Three-dot button */
.shape-table__dots-cell {
  padding: 0 4px 0 0 !important;
  width: 20px;
}

.shape-table__dots {
  background: none;
  border: none;
  color: rgba(255, 255, 255, 0.35);
  cursor: pointer;
  padding: 2px 4px;
  font-size: 14px;
  line-height: 1;
  border-radius: 3px;
  transition: background 0.1s, color 0.15s;
}

.shape-table__dots:hover {
  background: rgba(255, 255, 255, 0.1);
  color: rgba(255, 255, 255, 0.85);
}

/* Three-dot dropdown (fixed, appended to body) */
.shape-dots-menu {
  position: fixed;
  z-index: 2100;
  min-width: 110px;
  background: rgba(14, 22, 52, 0.98);
  border: 1px solid var(--blue-border);
  border-radius: 4px;
  padding: 4px 0;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
}

.shape-dots-menu__item {
  display: block;
  width: 100%;
  padding: 8px 14px;
  background: none;
  border: none;
  color: rgba(255, 255, 255, 0.8);
  font-family: 'B612 Mono', ui-monospace, monospace;
  font-size: 12px;
  letter-spacing: 0.05em;
  text-align: left;
  cursor: pointer;
  transition: background 0.1s, color 0.15s;
}

.shape-dots-menu__item:hover {
  background: rgba(43, 58, 171, 0.35);
  color: var(--gold);
}

.shape-dots-menu__item--danger:hover {
  background: rgba(230, 57, 70, 0.2);
  color: #e63946;
}

/* ─── Shape Popup ───────────────────────────────────────────── */

.shape-popup {
  position: fixed;
  top: calc(var(--top-bar-height) + 12px);
  left: 12px;
  z-index: 1997;
  width: 260px;
  background: rgba(14, 22, 52, 0.96);
  border: 1px solid var(--blue-border);
  border-radius: 6px;
  padding: 14px;
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.6);
  font-family: 'B612 Mono', ui-monospace, monospace;
}

.shape-popup__title {
  font-size: 12px;
  letter-spacing: 0.1em;
  color: var(--gold);
  margin-bottom: 12px;
  font-weight: 700;
  cursor: move;
  user-select: none;
}

.shape-popup__field {
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin-bottom: 10px;
}

.shape-popup__field label {
  font-size: 10px;
  letter-spacing: 0.07em;
  color: rgba(255, 255, 255, 0.4);
}

.sp-input {
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 3px;
  color: rgba(255, 255, 255, 0.9);
  font-family: 'B612 Mono', ui-monospace, monospace;
  font-size: 11px;
  padding: 5px 7px;
  outline: none;
  transition: border-color 0.15s;
  width: 100%;
  box-sizing: border-box;
}

.sp-input:focus {
  border-color: var(--blue-border);
}

/* Color swatches row */
.color-swatches {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

.color-swatch {
  width: 20px;
  height: 20px;
  border-radius: 50%;
  border: 2px solid transparent;
  cursor: pointer;
  padding: 0;
  transition: border-color 0.15s, transform 0.1s;
}

.color-swatch:hover {
  transform: scale(1.15);
}

.color-swatch--selected {
  border-color: var(--gold);
}

/* Transparency row */
.sp-transparency-row {
  display: flex;
  align-items: center;
  gap: 8px;
}

.sp-transparency {
  flex: 1;
  accent-color: var(--gold);
}

.sp-transparency-label {
  font-size: 10px;
  color: rgba(255, 255, 255, 0.45);
  white-space: nowrap;
}

/* Action buttons */
.shape-popup__actions {
  display: flex;
  gap: 8px;
  margin-top: 4px;
}

.sp-btn {
  flex: 1;
  padding: 7px 0;
  border-radius: 3px;
  border: 1px solid rgba(255, 255, 255, 0.15);
  font-family: 'B612 Mono', ui-monospace, monospace;
  font-size: 11px;
  letter-spacing: 0.07em;
  cursor: pointer;
  background: rgba(255, 255, 255, 0.05);
  color: rgba(255, 255, 255, 0.7);
  transition: background 0.15s, color 0.15s;
}

.sp-btn:hover {
  background: rgba(255, 255, 255, 0.1);
  color: rgba(255, 255, 255, 0.9);
}

.sp-btn--primary {
  background: var(--blue-border);
  border-color: var(--blue-border);
  color: rgba(255, 255, 255, 0.95);
}

.sp-btn--primary:hover {
  background: rgba(43, 58, 171, 0.8);
}

/* Description textarea */
.sp-description {
  resize: vertical;
  min-height: 42px;
  max-height: 80px;
  line-height: 1.5;
}

/* Altitude section */
.sp-alt-header {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 10px;
  letter-spacing: 0.07em;
  color: rgba(255, 255, 255, 0.4);
  cursor: pointer;
  user-select: none;
}

.sp-alt-header input[type="checkbox"] {
  accent-color: var(--gold);
  cursor: pointer;
  width: 12px;
  height: 12px;
  margin: 0;
}

.sp-alt-fields {
  display: flex;
  align-items: center;
  gap: 4px;
  margin-top: 4px;
}

.sp-alt-fields .sp-input {
  flex: 1;
  min-width: 0;
}

.sp-alt-sep {
  color: rgba(255, 255, 255, 0.3);
  font-size: 11px;
  flex-shrink: 0;
}

.sp-alt-fields--disabled .sp-input {
  opacity: 0.3;
  pointer-events: none;
}

/* Map legend overlay */
.map-legend {
  position: fixed;
  bottom: calc(var(--bottom-bar-height) + 8px);
  left: 10px;
  z-index: 1100;
  background: rgba(14, 22, 52, 0.95);
  border: 1px solid var(--blue-border);
  border-radius: 6px;
  padding: 10px 12px;
  font-family: 'B612 Mono', ui-monospace, monospace;
  font-size: 10px;
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  min-width: 160px;
  pointer-events: none;
}

.map-legend__section-title {
  color: var(--gold);
  letter-spacing: 0.1em;
  font-size: 9px;
  font-weight: 700;
  margin-bottom: 5px;
  margin-top: 8px;
}

.map-legend__section-title:first-child {
  margin-top: 0;
}

.map-legend__row {
  display: flex;
  align-items: center;
  gap: 7px;
  margin-bottom: 4px;
  color: rgba(255, 255, 255, 0.75);
  letter-spacing: 0.05em;
}

.map-legend__swatch {
  width: 14px;
  height: 10px;
  border-radius: 2px;
  flex-shrink: 0;
  opacity: 0.85;
}

.map-legend__icon {
  width: 16px;
  height: 16px;
  flex-shrink: 0;
  display: flex;
  align-items: center;
}

/* ─── Mobile: shape popups as bottom sheets ────────────────── */

@media (max-width: 640px) {
  .shape-popup,
  .polygon-popup,
  .line-popup,
  .point-popup {
    top: unset;
    right: 0;
    left: 0;
    bottom: var(--bottom-bar-height);
    border-radius: 12px 12px 0 0;
    max-height: 55vh;
    overflow-y: auto;
    width: 100%;
  }
}

/* ─── Radius label (divIcon on map) ────────────────────────── */

.radius-label {
  background: transparent !important;
  border: none !important;
  pointer-events: none !important;
}

.radius-label div {
  font-family: 'B612 Mono', ui-monospace, monospace;
  font-size: 11px;
  color: #f5a800;
  white-space: nowrap;
  text-shadow: 0 0 4px rgba(0, 0, 0, 0.9);
}

/* ─── Draggable center marker (divIcon on map) ──────────────── */

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

.center-marker__dot {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: rgba(245, 168, 0, 0.9);
  border: 2px solid rgba(255, 255, 255, 0.9);
  box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.6), 0 0 6px rgba(245, 168, 0, 0.6);
  cursor: grab;
  box-sizing: border-box;
}

.center-marker__dot:active {
  cursor: grabbing;
}

/* ─── Polygon popup — corners table ─────────────────────────── */

/* Slightly taller popup for the corners table */
.polygon-popup {
  width: 280px;
}

.pp-corners-field {
  gap: 6px;
}

.pp-coord-wrap {
  max-height: 180px;
  overflow-y: auto;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 3px;
}

.pp-coord-table {
  width: 100%;
  border-collapse: collapse;
  font-family: 'B612 Mono', ui-monospace, monospace;
  font-size: 10px;
}

.pp-coord-row:nth-child(odd) {
  background: rgba(255, 255, 255, 0.03);
}

.pp-coord-num {
  color: rgba(255, 255, 255, 0.3);
  padding: 3px 4px 3px 6px;
  width: 16px;
  text-align: right;
  vertical-align: middle;
  user-select: none;
}

.pp-coord-input-cell {
  padding: 2px 3px;
  vertical-align: middle;
}

.pp-coord-input {
  width: 100%;
  font-size: 10px !important;
  padding: 3px 5px !important;
  box-sizing: border-box;
}

.pp-coord-minus-cell {
  padding: 2px 4px 2px 2px;
  vertical-align: middle;
  width: 20px;
}

.pp-corner-minus {
  background: none;
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: 3px;
  color: rgba(255, 255, 255, 0.4);
  cursor: pointer;
  font-size: 13px;
  line-height: 1;
  width: 18px;
  height: 18px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  transition: border-color 0.15s, color 0.15s, background 0.15s;
}

.pp-corner-minus:hover {
  border-color: #e63946;
  color: #e63946;
  background: rgba(230, 57, 70, 0.1);
}

/* ─── Line popup ─────────────────────────────────────────────── */

.line-popup {
  width: 280px;
}

/* Name row: input + eyeball side by side */
.lp-name-row {
  display: flex;
  gap: 6px;
  align-items: center;
}

.lp-name-row .sp-name {
  flex: 1;
}

.lp-label-eye {
  background: none;
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: 3px;
  color: rgba(255, 255, 255, 0.35);
  cursor: pointer;
  padding: 4px 6px;
  display: flex;
  align-items: center;
  flex-shrink: 0;
  transition: border-color 0.15s, color 0.15s, background 0.15s;
}

.lp-label-eye:hover {
  border-color: var(--gold);
  color: var(--gold);
}

.lp-label-eye--active {
  border-color: var(--gold);
  color: var(--gold);
  background: rgba(245, 168, 0, 0.1);
}

/* Dash select */
.lp-dash-select {
  appearance: none;
  -webkit-appearance: none;
  cursor: pointer;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6'%3E%3Cpath d='M0 0l5 6 5-6z' fill='rgba(255,255,255,0.4)'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 8px center;
  padding-right: 24px !important;
}

/* Points field */
.lp-points-field {
  gap: 6px;
}

/* Place toggle button */
.lp-place-btn {
  display: block;
  width: 100%;
  padding: 7px 0;
  margin-bottom: 10px;
  border-radius: 3px;
  border: 1px solid rgba(255, 255, 255, 0.15);
  font-family: 'B612 Mono', ui-monospace, monospace;
  font-size: 11px;
  letter-spacing: 0.1em;
  cursor: pointer;
  background: rgba(255, 255, 255, 0.05);
  color: rgba(255, 255, 255, 0.45);
  transition: background 0.15s, color 0.15s, border-color 0.15s;
}

.lp-place-btn:hover {
  background: rgba(255, 255, 255, 0.1);
  color: rgba(255, 255, 255, 0.75);
}

.lp-place-btn--on {
  background: rgba(45, 198, 83, 0.12);
  border-color: rgba(45, 198, 83, 0.5);
  color: #2dc653;
}

.lp-place-btn--on:hover {
  background: rgba(45, 198, 83, 0.2);
  color: #2dc653;
}

/* ─── Point symbol (divIcon on map) ─────────────────────────── */

.point-symbol-icon {
  background: transparent !important;
  border: none !important;
  pointer-events: none;
}

/* Point symbol in shape table */
.shape-table__point-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  vertical-align: middle;
}

/* Point name label (divIcon placed to the right of symbol) */
.point-name-label {
  background: transparent !important;
  border: none !important;
  box-shadow: none !important;
  pointer-events: none;
  font-family: 'B612 Mono', monospace;
  font-size: 10px;
  white-space: nowrap;
}
.point-name-label::before {
  display: none !important;
}

/* Pre-placement placeholder row in coordinate tables */
.pp-pre-label {
  padding: 6px 8px;
  font-size: 10px;
  color: rgba(255, 255, 255, 0.3);
  font-style: italic;
  text-align: center;
}

/* ─── Route Popup ───────────────────────────────────────────── */

.route-popup {
  width: 380px;
  max-height: calc(100vh - 100px);
  overflow-y: auto;
}

/* Header grid: label | input pairs */
.rp-header-grid {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 4px 8px;
  margin-bottom: 10px;
  align-items: center;
}

.rp-lbl {
  font-size: 10px;
  letter-spacing: 0.07em;
  color: rgba(255, 255, 255, 0.4);
  white-space: nowrap;
}

.rp-lbl-mid {
  font-size: 10px;
  color: rgba(255, 255, 255, 0.35);
  white-space: nowrap;
  padding: 0 2px;
}

.rp-inline-group {
  display: flex;
  align-items: center;
  gap: 3px;
  flex-wrap: nowrap;
}

.rp-time-input { width: 57px !important; flex: none !important; }
.rp-short-input { width: 47px !important; flex: none !important; }
.rp-medium-input { width: 69px !important; flex: none !important; }

/* Waypoint container */
.rp-wp-container {
  border: 1px solid rgba(255, 255, 255, 0.07);
  border-radius: 3px;
  margin-bottom: 8px;
  max-height: 320px;
  overflow-y: auto;
}

/* Each WP block */
.route-wp-card {
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
  padding: 5px 6px;
}

.route-wp-card:last-child {
  border-bottom: none;
}

/* Row inside a card */
.route-wp-row {
  display: flex;
  align-items: center;
  gap: 3px;
  flex-wrap: nowrap;
  margin-bottom: 3px;
}

.route-wp-row:last-child {
  margin-bottom: 0;
}

/* Leg row (L1, L2...) is slightly dimmer */
.route-leg-row {
  margin-top: 2px;
}

/* Actions row */
.route-act-row {
  margin-top: 2px;
}

/* WP/Leg prefix label */
.route-wp-label {
  font-size: 10px;
  color: rgba(255, 255, 255, 0.4);
  white-space: nowrap;
  min-width: 24px;
  flex-shrink: 0;
  letter-spacing: 0.05em;
}

.route-wp-label--dim {
  color: rgba(255, 255, 255, 0.25);
}

/* Editable inputs */
.route-field {
  min-width: 0;
}

.route-coord-input {
  flex: 1;
  font-size: 10px !important;
  padding: 3px 5px !important;
}

.route-ident-input {
  width: 52px !important;
  flex: none !important;
  font-size: 10px !important;
  padding: 3px 5px !important;
}

.route-alt-input {
  width: 60px !important;
  flex: none !important;
  font-size: 10px !important;
  padding: 3px 5px !important;
}

.route-short-input {
  width: 43px !important;
  flex: none !important;
  font-size: 10px !important;
  padding: 3px 5px !important;
}

/* Compact "/" separator between paired inputs (e.g. wind HDG / SPD) */
.route-sep {
  font-size: 10px;
  color: rgba(255, 255, 255, 0.3);
  flex-shrink: 0;
  padding: 0 1px;
}

/* Computed (read-only) cells */
.route-field--computed {
  font-size: 10px;
  color: rgba(255, 255, 255, 0.45);
  white-space: nowrap;
  padding: 0 3px;
  flex-shrink: 0;
  pointer-events: none;
  font-family: 'B612 Mono', ui-monospace, monospace;
}

/* Totals row */
.rp-totals {
  margin-bottom: 8px;
}

.route-totals {
  display: flex;
  align-items: center;
  gap: 4px;
  border-top: 1px solid rgba(245, 168, 0, 0.3);
  padding-top: 6px;
  flex-wrap: wrap;
}

.route-totals__label {
  font-size: 10px;
  color: var(--gold);
  letter-spacing: 0.07em;
  white-space: nowrap;
}

/* Place button (reuses lp-place-btn styles) */
.rp-place-btn {
  margin-bottom: 8px;
}

/* ─── WP dot marker (draggable L.marker) ────────────────────── */

.route-wp-marker {
  background: transparent !important;
  border: none !important;
}

.route-wp-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: #a0a0a0;
  border: 1.5px solid #ffffff;
  box-sizing: border-box;
  cursor: grab;
}

.route-wp-dot:active {
  cursor: grabbing;
}

/* ─── Leg label (divIcon on map) ─────────────────────────────── */

.route-leg-label {
  background: transparent !important;
  border: none !important;
  pointer-events: none !important;
}

.route-leg-label div {
  font-family: 'B612 Mono', ui-monospace, monospace;
  font-size: 10px;
  color: rgba(200, 200, 200, 0.85);
  white-space: nowrap;
  text-shadow: 0 0 4px rgba(0, 0, 0, 0.9), 0 0 8px rgba(0, 0, 0, 0.8);
}

/* Hide number input spinners — values are typed, not clicked */
.route-popup input[type="number"]::-webkit-outer-spin-button,
.route-popup input[type="number"]::-webkit-inner-spin-button {
  -webkit-appearance: none;
  margin: 0;
}
.route-popup input[type="number"] {
  -moz-appearance: textfield;
}

/* Mobile: route popup as bottom sheet */
@media (max-width: 640px) {
  .route-popup {
    top: unset;
    right: 0;
    left: 0;
    bottom: var(--bottom-bar-height);
    border-radius: 12px 12px 0 0;
    max-height: 60vh;
    overflow-y: auto;
    width: 100%;
  }
}

/* ─── Line name label (divIcon on map) ─────────────────────────── */
.line-label {
  background: transparent !important;
  border: none !important;
  pointer-events: none !important;
}

.line-label div {
  font-family: 'B612 Mono', ui-monospace, monospace;
  font-size: 11px;
  font-weight: 700;
  white-space: nowrap;
  text-shadow: 0 0 4px rgba(0, 0, 0, 0.95), 0 0 8px rgba(0, 0, 0, 0.8);
}

/* ─── Op Mission Popup ──────────────────────────────────────── */

.opm-popup {
  width: 310px;
  max-height: calc(100vh - 100px);
  overflow-y: auto;
}

/* WP container — scrollable */
.opm-wp-container {
  border: 1px solid rgba(255, 255, 255, 0.07);
  border-radius: 3px;
  margin-bottom: 8px;
  max-height: 360px;
  overflow-y: auto;
}

/* Each WP block */
.opm-wp-card {
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
  padding: 5px 6px;
  cursor: pointer;
  transition: background 0.1s;
}

.opm-wp-card:last-child {
  border-bottom: none;
}

.opm-wp-card:hover {
  background: rgba(244, 162, 97, 0.05);
}

.opm-wp-card--selected {
  background: rgba(244, 162, 97, 0.12) !important;
  border-left: 2px solid #f4a261;
  padding-left: 4px;
}

/* Row inside a card */
.opm-wp-row {
  display: flex;
  align-items: center;
  gap: 3px;
  flex-wrap: nowrap;
  margin-bottom: 3px;
}

.opm-wp-row:last-child {
  margin-bottom: 0;
}

.opm-act-row {
  margin-top: 2px;
}

/* WP prefix label */
.opm-wp-label {
  font-size: 10px;
  color: rgba(255, 255, 255, 0.4);
  white-space: nowrap;
  min-width: 20px;
  flex-shrink: 0;
  letter-spacing: 0.05em;
}

/* Coord input — takes remaining width */
.opm-coord-input {
  flex: 1 !important;
  font-size: 10px !important;
  padding: 3px 5px !important;
  min-width: 0;
}

/* FIX ident input */
.opm-ident-input {
  width: 68px !important;
  flex: none !important;
  font-size: 10px !important;
  padding: 3px 5px !important;
}

/* Altitude input */
.opm-alt-input {
  width: 69px !important;
  flex: none !important;
  font-size: 10px !important;
  padding: 3px 5px !important;
}

/* Short input (radius, exit value) */
.opm-short-input {
  width: 47px !important;
  flex: none !important;
  font-size: 10px !important;
  padding: 3px 5px !important;
}

/* Exit select dropdown */
.opm-exit-select {
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 3px;
  color: rgba(255, 255, 255, 0.9);
  font-family: 'B612 Mono', ui-monospace, monospace;
  outline: none;
}

.opm-exit-select option {
  background: #0e1634;
}

/* ─── Op Mission WP dot marker (draggable L.marker) ─────────── */

.opm-wp-marker {
  background: transparent !important;
  border: none !important;
  z-index: 999 !important; /* ensure above SVG polyline in same pane */
}

.opm-wp-dot {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: #f4a261;
  border: 1.5px solid #1a1a1a;
  box-sizing: border-box;
  cursor: grab;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: 'B612 Mono', ui-monospace, monospace;
  font-size: 9px;
  font-weight: 700;
  color: #1a1a1a;
  line-height: 1;
}

.opm-wp-dot:active {
  cursor: grabbing;
}

/* ─── Loiter direction arrow (divIcon on map) ───────────────── */

.opm-loiter-arrow {
  background: transparent !important;
  border: none !important;
  pointer-events: none !important;
}

.opm-loiter-arrow div {
  font-size: 13px;
  font-weight: 700;
  color: #f4a261;
  text-shadow: 0 0 4px rgba(0, 0, 0, 0.9);
  line-height: 1;
  text-align: center;
  font-family: 'B612 Mono', ui-monospace, monospace;
}

/* ─── Selected WP pulsing ring (divIcon on map) ─────────────── */

@keyframes opm-pulse {
  0%   { transform: scale(1);   opacity: 0.9; }
  50%  { transform: scale(1.6); opacity: 0.4; }
  100% { transform: scale(1);   opacity: 0.9; }
}

.opm-selected-ring {
  background: transparent !important;
  border: none !important;
  pointer-events: none !important;
}

.opm-selected-ring div {
  width: 20px;
  height: 20px;
  border-radius: 50%;
  border: 2px solid #f4a261;
  box-sizing: border-box;
  animation: opm-pulse 1.4s ease-in-out infinite;
}

/* Hide number input spinners in opm-popup */
.opm-popup input[type="number"]::-webkit-outer-spin-button,
.opm-popup input[type="number"]::-webkit-inner-spin-button {
  -webkit-appearance: none;
  margin: 0;
}
.opm-popup input[type="number"] {
  -moz-appearance: textfield;
}

/* Mobile: opm popup as bottom sheet */
@media (max-width: 640px) {
  .opm-popup {
    top: unset;
    right: 0;
    left: 0;
    bottom: var(--bottom-bar-height);
    border-radius: 12px 12px 0 0;
    max-height: 65vh;
    overflow-y: auto;
    width: 100% !important;
  }
}

/* ─── E-Mission Popup ───────────────────────────────────────── */

.em-popup {
  width: 310px;
  max-height: calc(100vh - 100px);
  overflow-y: auto;
}

/* WP container — scrollable */
.em-popup .em-wp-container {
  border: 1px solid rgba(255, 255, 255, 0.07);
  border-radius: 3px;
  margin-bottom: 8px;
  max-height: 360px;
  overflow-y: auto;
}

/* Each WP block — red accent (reuses opm-wp-card layout) */
.em-wp-card {
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
  padding: 5px 6px;
  cursor: pointer;
  transition: background 0.1s;
}

.em-wp-card:last-child {
  border-bottom: none;
}

.em-wp-card:hover {
  background: rgba(230, 57, 70, 0.05);
}

.em-wp-card--selected {
  background: rgba(230, 57, 70, 0.12) !important;
  border-left: 2px solid #e63946;
  padding-left: 4px;
}

/* Last 6 label — lit red when active */
.em-last6-label {
  user-select: none;
  font-size: 10px;
  letter-spacing: 0.05em;
  white-space: nowrap;
}

/* Done button — red primary */
.em-done--red {
  background: rgba(230, 57, 70, 0.18) !important;
  border-color: #e63946 !important;
  color: #e63946 !important;
}

.em-done--red:not(:disabled):hover {
  background: rgba(230, 57, 70, 0.32) !important;
}

.em-done--red:disabled {
  opacity: 0.35;
  cursor: not-allowed;
}

/* Hide spinners inside em-popup number inputs */
.em-popup input[type="number"]::-webkit-outer-spin-button,
.em-popup input[type="number"]::-webkit-inner-spin-button {
  -webkit-appearance: none;
  margin: 0;
}
.em-popup input[type="number"] {
  -moz-appearance: textfield;
}

/* ─── E-Mission WP dot marker ───────────────────────────────── */

.em-wp-marker {
  background: transparent !important;
  border: none !important;
  z-index: 999 !important;
}

.em-wp-dot {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: #e63946;
  border: 1.5px solid #1a1a1a;
  box-sizing: border-box;
  cursor: grab;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: 'B612 Mono', ui-monospace, monospace;
  font-size: 9px;
  font-weight: 700;
  color: #1a1a1a;
  line-height: 1;
}

.em-wp-dot:active {
  cursor: grabbing;
}

/* Last 6 dot — red fill, black border, black number for contrast over hexagon line */
.em-wp-dot--last6 {
  background: #e63946;
  border: 2px solid #1a1a1a;
  color: #1a1a1a;
}

/* ─── Loiter direction arrow (divIcon on map) ───────────────── */

.em-loiter-arrow {
  background: transparent !important;
  border: none !important;
  pointer-events: none !important;
}

.em-loiter-arrow div {
  font-size: 13px;
  font-weight: 700;
  color: #e63946;
  text-shadow: 0 0 4px rgba(0, 0, 0, 0.9);
  line-height: 1;
  text-align: center;
  font-family: 'B612 Mono', ui-monospace, monospace;
}

/* ─── Selected WP pulsing ring (red) ────────────────────────── */

@keyframes em-pulse {
  0%   { transform: scale(1);   opacity: 0.9; }
  50%  { transform: scale(1.6); opacity: 0.4; }
  100% { transform: scale(1);   opacity: 0.9; }
}

.em-selected-ring {
  background: transparent !important;
  border: none !important;
  pointer-events: none !important;
}

.em-selected-ring div {
  width: 20px;
  height: 20px;
  border-radius: 50%;
  border: 2px solid #e63946;
  box-sizing: border-box;
  animation: em-pulse 1.4s ease-in-out infinite;
}

/* Mobile: em popup as bottom sheet */
@media (max-width: 640px) {
  .em-popup {
    top: unset;
    right: 0;
    left: 0;
    bottom: var(--bottom-bar-height);
    border-radius: 12px 12px 0 0;
    max-height: 65vh;
    overflow-y: auto;
    width: 100% !important;
  }
}

/* ─── Insert waypoint (+) buttons ───────────────────────────── */

.rp-wp-insert-btn,
.opm-wp-insert-btn,
.em-wp-insert-btn {
  color: rgba(255,255,255,0.45);
  background: none;
  border: 1px solid rgba(255,255,255,0.15);
  border-radius: 3px;
  padding: 2px 6px;
  font-size: 13px;
  cursor: pointer;
  line-height: 1;
  transition: color 0.15s, border-color 0.15s;
}
.rp-wp-insert-btn:hover,
.opm-wp-insert-btn:hover,
.em-wp-insert-btn:hover {
  color: rgba(255,255,255,0.75);
  border-color: rgba(255,255,255,0.35);
}
.rp-wp-insert-btn--active,
.opm-wp-insert-btn--active,
.em-wp-insert-btn--active {
  color: var(--gold);
  border-color: rgba(245,168,0,0.5);
}

/* ─── Plan Overview table ────────────────────────────────────── */

.plan-overview {
  flex: 1;
  overflow-y: auto;
  padding: 4px 0 0;
  min-height: 0;
}

.plan-ov-empty {
  font-size: 11px;
  color: rgba(255,255,255,0.25);
  text-align: center;
  padding: 14px 18px;
  font-style: italic;
}

.plan-ov-category {
  font-size: 10px;
  color: rgba(255,255,255,0.3);
  padding: 8px 18px 3px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.plan-ov-row {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 4px 10px 4px 18px;
}

.plan-ov-row:hover {
  background: rgba(255,255,255,0.04);
}

.plan-ov-name {
  flex: 1;
  font-size: 12px;
  color: rgba(255,255,255,0.8);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.plan-ov-eye,
.plan-ov-edit {
  flex: none;
  background: none;
  border: none;
  color: rgba(255,255,255,0.4);
  padding: 3px 4px;
  cursor: pointer;
  display: flex;
  align-items: center;
  border-radius: 3px;
}

.plan-ov-eye:hover,
.plan-ov-edit:hover {
  color: rgba(255,255,255,0.85);
  background: rgba(255,255,255,0.08);
}

.plan-ov-del {
  flex: none;
  background: none;
  border: none;
  color: rgba(255,255,255,0.3);
  padding: 3px 4px;
  cursor: pointer;
  display: flex;
  align-items: center;
  border-radius: 3px;
}
.plan-ov-del:hover {
  color: #e63946;
  background: rgba(230,57,70,0.12);
}

.plan-overview-divider {
  height: 1px;
  background: rgba(255,255,255,0.1);
  margin: 6px 12px;
  flex: none;
}
