:root {
  color-scheme: light;
  --ink: #172026;
  --muted: #63717a;
  --soft: #eef3f1;
  --paper: #fbfcfb;
  --panel: #ffffff;
  --line: #d8e1df;
  --field: #f8faf9;
  --button-soft: #f3f7f6;
  --button-active: #ffffff;
  --button-hover-line: #a9bbb6;
  --label: #2a383e;
  --accent: #14745f;
  --accent-strong: #0d5949;
  --accent-hover: #0d5949;
  --sky: #dcecf9;
  --sky-ink: #24485f;
  --warning: #f3bc55;
  --danger: #b84b4b;
  --marker: #253840;
  --map-bg: #dfe9e5;
  --overlay: rgba(255, 255, 255, 0.94);
  --overlay-border: rgba(216, 225, 223, 0.95);
  --overlay-shadow: 0 8px 22px rgba(23, 32, 38, 0.14);
  --pin-border: #ffffff;
  --toast-bg: #172026;
  --shadow: 0 18px 48px rgba(18, 35, 42, 0.16);
}

:root[data-theme="dark"] {
  color-scheme: dark;
  --ink: #edf4f2;
  --muted: #9fb0ad;
  --soft: #0f1719;
  --paper: #111b1d;
  --panel: #152123;
  --line: #314245;
  --field: #10191b;
  --button-soft: #1d2b2e;
  --button-active: #233537;
  --button-hover-line: #4d6869;
  --label: #d8e6e2;
  --accent: #2fc59d;
  --accent-strong: #64e0bf;
  --accent-hover: #229b7e;
  --sky: #213f4d;
  --sky-ink: #cfeefa;
  --warning: #f0c15d;
  --danger: #ff8983;
  --marker: #32484f;
  --map-bg: #11191b;
  --overlay: rgba(21, 33, 35, 0.94);
  --overlay-border: rgba(64, 84, 88, 0.96);
  --overlay-shadow: 0 12px 30px rgba(0, 0, 0, 0.34);
  --pin-border: #0f1719;
  --toast-bg: #edf4f2;
  --shadow: 0 18px 48px rgba(0, 0, 0, 0.34);
}

* {
  box-sizing: border-box;
}

.leaflet-container {
  position: relative;
  overflow: hidden;
  background: var(--map-bg);
  outline-offset: 1px;
  font-family: inherit;
  touch-action: none;
}

.leaflet-pane,
.leaflet-tile,
.leaflet-marker-icon,
.leaflet-marker-shadow,
.leaflet-tile-container,
.leaflet-pane > svg,
.leaflet-pane > canvas,
.leaflet-zoom-box,
.leaflet-image-layer,
.leaflet-layer {
  position: absolute;
  top: 0;
  left: 0;
}

.leaflet-tile,
.leaflet-marker-icon,
.leaflet-marker-shadow {
  user-select: none;
  -webkit-user-drag: none;
}

.leaflet-container img.leaflet-tile,
.leaflet-container .leaflet-marker-icon,
.leaflet-container .leaflet-marker-shadow {
  max-width: none !important;
  max-height: none !important;
}

.leaflet-tile {
  visibility: hidden;
}

.leaflet-tile-loaded {
  visibility: inherit;
}

.leaflet-map-pane {
  z-index: auto;
}

.leaflet-tile-pane {
  z-index: 200;
}

.leaflet-overlay-pane {
  z-index: 400;
}

.leaflet-shadow-pane {
  z-index: 500;
}

.leaflet-marker-pane {
  z-index: 600;
}

.leaflet-tooltip-pane {
  z-index: 650;
}

.leaflet-popup-pane {
  z-index: 700;
}

.leaflet-top,
.leaflet-bottom {
  position: absolute;
  z-index: 1000;
  pointer-events: none;
}

.leaflet-top {
  top: 0;
}

.leaflet-right {
  right: 0;
}

.leaflet-bottom {
  bottom: 0;
}

.leaflet-left {
  left: 0;
}

.leaflet-control {
  position: relative;
  z-index: 800;
  float: left;
  clear: both;
  pointer-events: auto;
}

.leaflet-right .leaflet-control {
  float: right;
}

.leaflet-control-zoom {
  border: 1px solid var(--overlay-border);
  border-radius: 8px;
  overflow: hidden;
  box-shadow: var(--overlay-shadow);
}

.leaflet-control-zoom a {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  background: var(--overlay);
  color: var(--ink);
  text-decoration: none;
  font-weight: 800;
  line-height: 1;
}

.leaflet-control-zoom a + a {
  border-top: 1px solid var(--overlay-border);
}

.leaflet-control-attribution {
  padding: 2px 6px;
  background: var(--overlay);
  color: var(--muted);
}

.leaflet-control-attribution a {
  color: var(--accent-strong);
}

.leaflet-popup {
  position: absolute;
  margin-bottom: 20px;
  text-align: center;
}

.leaflet-popup-content-wrapper {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  color: var(--ink);
  box-shadow: var(--shadow);
  text-align: left;
}

.leaflet-popup-content {
  min-width: 160px;
  margin: 12px 14px;
  line-height: 1.35;
  font-size: 0.9rem;
}

.leaflet-popup-tip-container {
  position: absolute;
  left: 50%;
  width: 24px;
  height: 12px;
  margin-left: -12px;
  overflow: hidden;
  pointer-events: none;
}

.leaflet-popup-tip {
  width: 16px;
  height: 16px;
  margin: -8px auto 0;
  border-right: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  background: var(--panel);
  transform: rotate(45deg);
}

.leaflet-popup-close-button {
  position: absolute;
  top: 7px;
  right: 8px;
  color: var(--muted);
  text-decoration: none;
  font-size: 18px;
  line-height: 1;
}

body {
  margin: 0;
  min-width: 320px;
  background: var(--soft);
  color: var(--ink);
  font-family: "Segoe UI", system-ui, -apple-system, BlinkMacSystemFont, sans-serif;
  font-size: 16px;
  overflow-x: hidden;
}

button,
input,
label,
a {
  font: inherit;
}

button,
a,
.file-button {
  -webkit-tap-highlight-color: transparent;
}

.app-shell {
  display: grid;
  grid-template-columns: minmax(340px, 410px) minmax(0, 1fr);
  height: 100vh;
  min-height: 100vh;
  overflow: hidden;
}

html, body {
  height: 100%;
  overflow: hidden;
}

.planner-panel {
  z-index: 10;
  display: flex;
  flex-direction: column;
  gap: 18px;
  min-width: 0;
  min-height: 100vh;
  padding: 22px;
  overflow: auto;
  background: var(--panel);
  border-right: 1px solid var(--line);
  box-shadow: var(--shadow);
}

.app-header {
  display: flex;
  align-items: center;
  gap: 14px;
}

.app-header > div:nth-child(2) {
  min-width: 0;
}

.theme-toggle {
  margin-left: auto;
}

.brand-mark {
  display: grid;
  place-items: center;
  flex: 0 0 44px;
  width: 44px;
  height: 44px;
  border-radius: 8px;
  background: var(--accent);
  color: white;
}

.brand-mark svg {
  width: 25px;
  height: 25px;
}

h1 {
  margin: 0;
  font-size: 1.45rem;
  line-height: 1.15;
  letter-spacing: 0;
}

p {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 0.95rem;
}

.control-section {
  display: grid;
  gap: 10px;
  min-width: 0;
}

.control-section.compact {
  gap: 8px;
}

.section-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  min-width: 0;
}

label,
.section-title > label {
  color: var(--label);
  font-weight: 700;
  font-size: 0.92rem;
}

.input-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
}

input[type="text"] {
  width: 100%;
  min-height: 44px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--field);
  color: var(--ink);
  outline: none;
}

input[type="text"]:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(20, 116, 95, 0.15);
}

.primary-button,
.secondary-button,
.icon-button,
.mode-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  min-height: 40px;
  border: 1px solid transparent;
  border-radius: 8px;
  cursor: pointer;
  text-decoration: none;
  white-space: nowrap;
}

.primary-button {
  min-width: 82px;
  padding: 0 14px;
  background: var(--accent);
  color: white;
  font-weight: 700;
}

.primary-button:hover {
  background: var(--accent-hover);
}

.secondary-button {
  min-height: 40px;
  padding: 0 12px;
  background: var(--button-soft);
  border-color: var(--line);
  color: var(--ink);
  font-weight: 700;
}

.secondary-button:hover,
.icon-button:hover,
.mode-button:hover {
  border-color: var(--button-hover-line);
}

.secondary-button.small {
  min-height: 34px;
  padding: 0 10px;
  font-size: 0.88rem;
}

.icon-button {
  flex: 0 0 40px;
  width: 40px;
  height: 40px;
  background: var(--button-soft);
  border-color: var(--line);
  color: var(--ink);
}

.icon-button.light,
.secondary-button.light {
  background: var(--overlay);
  border-color: var(--overlay-border);
  box-shadow: var(--overlay-shadow);
}

.icon-button svg,
.primary-button svg,
.secondary-button svg,
.mode-button svg {
  width: 18px;
  height: 18px;
  flex: 0 0 18px;
}

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

.file-button input {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
  pointer-events: none;
}

.segmented-control {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 4px;
  min-width: 0;
  padding: 4px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--button-soft);
}

.mode-button {
  min-width: 0;
  padding: 0 8px;
  background: transparent;
  color: var(--muted);
  font-weight: 700;
}

.mode-button.active {
  background: var(--button-active);
  color: var(--accent-strong);
  border-color: var(--line);
  box-shadow: 0 2px 8px rgba(18, 35, 42, 0.08);
}

.pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 30px;
  height: 24px;
  padding: 0 9px;
  border-radius: 999px;
  background: var(--sky);
  color: var(--sky-ink);
  font-weight: 800;
  font-size: 0.82rem;
}

.inline-actions {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}

.result-line {
  min-height: 20px;
  color: var(--muted);
  font-size: 0.86rem;
  line-height: 1.35;
}

.result-line.error {
  color: var(--danger);
}

.stop-section {
  min-height: 0;
}

.stop-list {
  display: grid;
  gap: 8px;
  min-height: 90px;
  max-height: calc(100vh - 575px);
  margin: 0;
  padding: 0;
  overflow: auto;
  overflow-x: hidden;
  list-style: none;
}

.stop-card {
  display: grid;
  grid-template-columns: 32px minmax(0, 1fr) auto;
  align-items: center;
  gap: 10px;
  min-width: 0;
  max-width: 100%;
  min-height: 62px;
  padding: 9px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--paper);
}

.stop-number {
  display: grid;
  place-items: center;
  width: 32px;
  height: 32px;
  border-radius: 8px;
  background: var(--marker);
  color: #ffffff;
  font-weight: 800;
  font-size: 0.88rem;
}

.stop-main {
  min-width: 0;
}

.stop-main strong,
.stop-main span {
  display: block;
  overflow-wrap: anywhere;
}

.stop-main strong {
  color: var(--ink);
  font-size: 0.94rem;
  line-height: 1.25;
}

.stop-main span {
  margin-top: 2px;
  color: var(--muted);
  font-size: 0.82rem;
  line-height: 1.3;
}

.stop-tools {
  display: inline-grid;
  grid-auto-flow: column;
  gap: 4px;
  max-width: 100%;
}

.stop-tools .icon-button {
  width: 32px;
  height: 32px;
  min-height: 32px;
  flex-basis: 32px;
}

.stop-tools .icon-button svg {
  width: 15px;
  height: 15px;
}

.empty-state {
  display: grid;
  place-items: center;
  gap: 8px;
  min-height: 110px;
  border: 1px dashed var(--button-hover-line);
  border-radius: 8px;
  color: var(--muted);
  font-weight: 700;
}

.empty-state.hidden {
  display: none;
}

.empty-state svg {
  width: 26px;
  height: 26px;
}

.map-pane {
  position: relative;
  min-width: 0;
  height: 100vh;
  min-height: 0;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

#map {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  min-height: 0;
  background: var(--map-bg);
}

.map-topbar {
  position: absolute;
  z-index: 500;
  top: 18px;
  left: 18px;
  right: 18px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  pointer-events: none;
}

.map-topbar > * {
  pointer-events: auto;
}

.route-summary {
  display: inline-flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
  min-height: 44px;
  max-width: min(620px, 100%);
  padding: 8px 12px;
  border: 1px solid var(--overlay-border);
  border-radius: 8px;
  background: var(--overlay);
  box-shadow: var(--overlay-shadow);
}

.route-summary strong {
  font-size: 1.02rem;
}

.route-summary span {
  color: var(--muted);
  font-size: 0.92rem;
}

.map-actions {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.leaflet-control-attribution {
  font-size: 0.68rem;
}

:root[data-theme="dark"] .leaflet-tile-pane {
  filter: brightness(0.62) invert(1) contrast(0.92) hue-rotate(170deg) saturate(0.72);
}

.pin-marker {
  display: grid;
  place-items: center;
  width: 32px;
  height: 32px;
  border: 2px solid var(--pin-border);
  border-radius: 50%;
  background: var(--marker);
  color: #ffffff;
  box-shadow: 0 6px 16px rgba(23, 32, 38, 0.28);
  font-weight: 800;
  font-size: 0.88rem;
}

.pin-marker.origin {
  background: var(--accent);
}

.toast {
  position: fixed;
  z-index: 1000;
  right: 18px;
  bottom: 18px;
  max-width: min(360px, calc(100vw - 36px));
  padding: 12px 14px;
  border-radius: 8px;
  background: var(--toast-bg);
  color: var(--soft);
  box-shadow: var(--shadow);
  font-weight: 700;
}

@media (max-width: 900px) {
  .app-shell {
    grid-template-columns: 1fr;
    grid-template-rows: auto 1fr;
    height: 100vh;
    overflow: hidden;
  }

  .planner-panel {
    max-height: 45vh;
    min-height: auto;
    overflow: auto;
    box-shadow: none;
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

  .stop-list {
    max-height: 160px;
  }

  .map-pane {
    height: auto;
    min-height: 0;
    position: relative;
  }

  #map {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
  }
}

@media (max-width: 560px) {
  .planner-panel {
    padding: 16px;
  }

  .section-title {
    flex-wrap: wrap;
  }

  .stop-section .section-title {
    align-items: flex-start;
  }

  .stop-section .inline-actions {
    width: 100%;
    justify-content: space-between;
  }

  .app-header {
    align-items: flex-start;
  }

  .input-row,
  .file-actions {
    grid-template-columns: 1fr;
  }

  .primary-button,
  .secondary-button {
    width: 100%;
  }

  .stop-section .secondary-button.small {
    width: auto;
  }

  .mode-button {
    gap: 5px;
    padding: 0 5px;
  }

  .mode-button span {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  .map-topbar {
    top: 10px;
    left: 10px;
    right: 10px;
    align-items: stretch;
    flex-direction: column;
  }

  .map-actions {
    justify-content: flex-end;
  }

  .route-summary {
    width: 100%;
  }

  .stop-card {
    grid-template-columns: 32px minmax(0, 1fr);
  }

  .stop-tools {
    grid-column: 1 / -1;
    justify-content: end;
  }
}

/* ── Autocomplete dropdown ─────────────────────────────────────── */
.autocomplete-wrapper {
  position: relative;
  flex: 1 1 0;
  min-width: 0;
}

.autocomplete-wrapper input[type="text"] {
  width: 100%;
}

.autocomplete-list {
  position: fixed;
  z-index: 9999;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 10px;
  box-shadow: 0 8px 24px rgba(0,0,0,.14);
  overflow: hidden;
  list-style: none;
  margin: 0;
  padding: 4px 0;
  max-height: 240px;
  overflow-y: auto;
}

.autocomplete-list li {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 10px 14px;
  cursor: pointer;
  font-size: 13px;
  line-height: 1.35;
  transition: background 0.1s;
}

.autocomplete-list li:hover,
.autocomplete-list li[aria-selected="true"] {
  background: var(--soft);
}

.autocomplete-list li .ac-icon {
  flex-shrink: 0;
  margin-top: 1px;
  color: var(--accent);
  opacity: 0.8;
}

.autocomplete-list li .ac-main {
  font-weight: 500;
  color: var(--ink);
}

.autocomplete-list li .ac-sub {
  color: var(--ink-muted, var(--ink));
  opacity: 0.6;
  font-size: 11.5px;
}

.autocomplete-list li .ac-text {
  display: flex;
  flex-direction: column;
  gap: 1px;
  min-width: 0;
  overflow: hidden;
}

.autocomplete-loading {
  padding: 10px 14px;
  font-size: 13px;
  color: var(--ink);
  opacity: 0.6;
}

/* ── Preset chips ──────────────────────────────────────────────── */
.preset-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
}

.preset-chip {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 5px 11px;
  background: var(--field);
  border: 1px solid var(--line);
  border-radius: 100px;
  font-size: 0.78rem;
  font-weight: 500;
  color: var(--ink);
  cursor: pointer;
  transition: background 0.12s, border-color 0.12s;
  white-space: nowrap;
}

.preset-chip:hover {
  background: var(--soft);
  border-color: var(--accent);
  color: var(--accent);
}

.preset-chip svg {
  flex-shrink: 0;
  opacity: 0.6;
}

/* ── Section drag-and-drop ─────────────────────────────────────── */
.drag-handle {
  display: inline-flex;
  align-items: center;
  color: var(--muted);
  opacity: 0;
  cursor: grab;
  transition: opacity 0.15s;
  flex-shrink: 0;
  padding: 2px;
  margin-right: 2px;
}

.drag-handle:active {
  cursor: grabbing;
}

.control-section:hover .drag-handle {
  opacity: 0.5;
}

.drag-handle:hover {
  opacity: 1 !important;
}

.control-section[draggable="true"] {
  transition: opacity 0.15s;
}

.control-section.section-dragging {
  opacity: 0.3;
  outline: 2px dashed var(--accent);
  outline-offset: 2px;
  border-radius: 10px;
}

.control-section.section-drag-over {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
  border-radius: 10px;
  background: var(--soft);
}

/* ── Dockable file-actions ─────────────────────────────────────── */
.file-actions-dock {
  display: flex;
  flex-direction: column;
  gap: 8px;
  border: 1px solid var(--line);
  border-radius: 10px;
  overflow: hidden;
  background: var(--field);
}

.dock-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 6px 10px 6px 12px;
  background: var(--soft);
  border-bottom: 1px solid var(--line);
}

.dock-label {
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: var(--muted);
}

.dock-undock-btn {
  min-height: 26px;
  min-width: 26px;
  opacity: 0.6;
  transition: opacity 0.15s;
}

.dock-undock-btn:hover {
  opacity: 1;
}

.file-actions-dock .file-actions {
  padding: 10px;
  border: none;
}

/* ── Floating panel ────────────────────────────────────────────── */
.floating-panel {
  position: fixed;
  z-index: 800;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 12px;
  box-shadow: 0 12px 40px rgba(0,0,0,0.25);
  min-width: 240px;
  max-width: 320px;
  user-select: none;
  overflow: hidden;
}

.floating-panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 9px 10px 9px 14px;
  background: var(--soft);
  border-bottom: 1px solid var(--line);
  cursor: grab;
  gap: 8px;
}

.floating-panel-header:active {
  cursor: grabbing;
}

.floating-panel-title {
  display: flex;
  align-items: center;
  gap: 7px;
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--ink);
}

.floating-panel-title svg {
  color: var(--accent);
  flex-shrink: 0;
}

.floating-panel-body {
  padding: 12px;
  overflow: hidden;
  transition: max-height 0.2s ease, padding 0.2s;
  max-height: 300px;
}

.floating-panel-body.collapsed {
  max-height: 0;
  padding-top: 0;
  padding-bottom: 0;
}

.file-actions-float {
  grid-template-columns: 1fr 1fr;
}

.floating-panel .icon-button.light {
  min-height: 28px;
  min-width: 28px;
  opacity: 0.7;
}

.floating-panel .icon-button.light:hover {
  opacity: 1;
}

/* Placeholder shown in panel when undocked */
.file-actions-dock.undocked {
  opacity: 0.4;
  pointer-events: none;
  border-style: dashed;
}

.file-actions-dock.undocked .dock-label::after {
  content: " (flytande)";
  font-style: italic;
}

/* ── Free-floating file-actions panel ────────────────────────── */
.floating-panel {
  position: fixed;
  z-index: 800;
  bottom: 32px;
  right: 32px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 14px;
  box-shadow: 0 8px 32px rgba(0,0,0,0.22), 0 2px 8px rgba(0,0,0,0.10);
  min-width: 230px;
  max-width: 300px;
  user-select: none;
  overflow: hidden;
  transition: box-shadow 0.15s;
}

.floating-panel:hover {
  box-shadow: 0 12px 40px rgba(0,0,0,0.28), 0 2px 8px rgba(0,0,0,0.12);
}

.floating-panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 9px 8px 9px 13px;
  background: var(--soft);
  border-bottom: 1px solid var(--line);
  cursor: grab;
  gap: 6px;
}

.floating-panel-header:active {
  cursor: grabbing;
}

.floating-panel-title {
  display: flex;
  align-items: center;
  gap: 7px;
  font-size: 0.76rem;
  font-weight: 700;
  color: var(--ink);
  white-space: nowrap;
}

.floating-panel-title svg {
  color: var(--accent);
  flex-shrink: 0;
}

.floating-collapse-btn {
  min-height: 26px !important;
  min-width: 26px !important;
  opacity: 0.55;
  flex-shrink: 0;
}

.floating-collapse-btn:hover {
  opacity: 1;
}

.floating-panel-body {
  overflow: hidden;
  transition: max-height 0.22s cubic-bezier(0.4,0,0.2,1),
              padding 0.22s cubic-bezier(0.4,0,0.2,1),
              opacity 0.18s;
  max-height: 300px;
  opacity: 1;
  padding: 10px;
}

.floating-panel-body.collapsed {
  max-height: 0 !important;
  padding-top: 0;
  padding-bottom: 0;
  opacity: 0;
}

.file-actions-float {
  grid-template-columns: 1fr 1fr;
  gap: 7px;
}

/* Dragging state */
.floating-panel.is-dragging {
  box-shadow: 0 20px 60px rgba(0,0,0,0.35);
  transition: none;
}

/* ── Pin mode button active state ─────────────────────────────── */
#pinModeBtn.pin-active {
  background: var(--accent) !important;
  color: #fff !important;
  border-color: var(--accent) !important;
}

/* ── Map context menu ─────────────────────────────────────────── */
.map-ctx-menu {
  position: fixed;
  z-index: 1200;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 12px;
  box-shadow: 0 8px 28px rgba(0,0,0,0.22);
  padding: 6px;
  min-width: 200px;
  overflow: hidden;
}

.map-ctx-title {
  font-size: 0.7rem;
  font-weight: 600;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.07em;
  padding: 4px 10px 8px;
  border-bottom: 1px solid var(--line);
  margin-bottom: 4px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.map-ctx-item {
  display: flex;
  align-items: center;
  gap: 9px;
  width: 100%;
  padding: 9px 12px;
  background: none;
  border: none;
  border-radius: 8px;
  font-size: 0.84rem;
  font-weight: 500;
  color: var(--ink);
  cursor: pointer;
  text-align: left;
  transition: background 0.1s;
  font-family: inherit;
}

.map-ctx-item:hover {
  background: var(--soft);
}

.map-ctx-item svg {
  color: var(--accent);
  flex-shrink: 0;
}

.map-ctx-item-danger {
  color: var(--muted);
}

.map-ctx-item-danger svg {
  color: var(--muted);
}
