/* ── Workspace ── */
.workspace {
  grid-area: workspace;
  position: relative;
  overflow: hidden;
  background: var(--workspace);
  touch-action: none;
}

.drop-zone {
  position: absolute;
  top: 50%; left: 50%;
  transform: translate(-50%, -50%);
  z-index: 5;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  padding: 36px 32px;
  border: 1px dashed var(--border-strong);
  border-radius: var(--radius);
  color: var(--text-muted);
  text-align: center;
  background: var(--surface);
  max-width: 90%;
  transition: border-color 0.2s;
}

.drop-icon { font-size: 40px !important; color: var(--text-muted); }

.drop-zone.drag-over {
  border-color: var(--primary);
}

.drop-zone .link {
  color: var(--primary);
  cursor: pointer;
  font-weight: 500;
}

.drop-zone .hint { font-size: 0.78rem; }

.hidden { display: none !important; }

.viewport {
  position: absolute;
  inset: 0;
  overflow: hidden;
  touch-action: none;
}

.canvas-stage {
  position: absolute;
  top: 0; left: 0;
  transform-origin: 0 0;
  will-change: transform;
}

.viewport.can-pan-bg { cursor: grab; }
.viewport.can-pan-bg:active { cursor: grabbing; }

.viewport .canvas-wrapper {
  box-shadow: var(--shadow-sm), 0 0 0 1px var(--primary-muted);
}

.viewport.format-fullscreen .canvas-wrapper {
  box-shadow: none;
}

.viewport.resizing { cursor: nwse-resize; }

/* Material icons */
.material-symbols-outlined {
  font-family: 'Material Symbols Outlined';
  font-weight: normal;
  font-style: normal;
  font-size: 20px;
  line-height: 1;
  display: inline-block;
  direction: ltr;
  -webkit-font-smoothing: antialiased;
}

/* Corner handles */
.corner-handle {
  position: fixed;
  z-index: 22;
  width: 28px;
  height: 28px;
  transform: translate(-50%, -50%);
  background: var(--surface);
  border: 1px solid var(--border-strong);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text);
  box-shadow: var(--shadow-sm);
  touch-action: none;
  user-select: none;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s;
}

.corner-handle .material-symbols-outlined { font-size: 17px; }

.corner-handle:hover {
  background: var(--surface-2);
}

.corner-handle-color {
  border-color: var(--handle-accent, var(--text-muted));
}

.corner-handle-color .material-symbols-outlined {
  color: var(--handle-accent, var(--text-muted));
}

#resize-handle { cursor: nwse-resize; }

.corner-handle-rotate {
  width: 36px;
  height: 36px;
  border-radius: 11px;
  background: var(--chrome-bg);
  backdrop-filter: var(--chrome-blur);
  -webkit-backdrop-filter: var(--chrome-blur);
  border: 1px solid rgba(255, 255, 255, 0.1);
  box-shadow: 0 8px 28px rgba(0, 0, 0, 0.28);
  color: var(--text-muted);
  cursor: grab;
  -webkit-tap-highlight-color: transparent;
}

.corner-handle-rotate:focus,
.corner-handle-rotate:focus-visible {
  outline: none;
  background: var(--chrome-bg);
  border-color: rgba(255, 255, 255, 0.1);
  color: var(--text-muted);
}

.corner-handle-rotate:active,
.viewport.rotating .corner-handle-rotate {
  background: rgba(12, 12, 14, 0.94);
  border-color: rgba(255, 255, 255, 0.32);
  color: #fff;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.14), 0 4px 14px rgba(0, 0, 0, 0.45);
}

@media (hover: hover) and (pointer: fine) {
  .corner-handle-rotate:hover {
    border-color: rgba(255, 255, 255, 0.22);
    color: var(--text);
  }
}

/* Map/chrome glass style for route Bearbeiten handle */
.corner-handle-glass,
.corner-handle-route.corner-handle-glass {
  width: 36px;
  height: 36px;
  border-radius: 11px;
  background: var(--chrome-bg);
  backdrop-filter: var(--chrome-blur);
  -webkit-backdrop-filter: var(--chrome-blur);
  border: 1px solid rgba(255, 255, 255, 0.1);
  box-shadow: 0 8px 28px rgba(0, 0, 0, 0.28);
  color: var(--text-muted);
}

.corner-handle-glass:hover,
.corner-handle-route.corner-handle-glass:hover {
  background: rgba(255, 255, 255, 0.1);
  border-color: rgba(255, 255, 255, 0.18);
  color: var(--text);
}


.corner-handle-delete {
  display: none !important;
}

.viewport.rotating .corner-handle-rotate {
  cursor: grabbing;
}

.corner-handle-delete:hover {
  background: var(--danger-bg);
  border-color: var(--danger);
  color: var(--danger);
}

/* Color popover */
.color-popover {
  position: fixed;
  z-index: 30;
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px 8px;
  background: var(--surface-2);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow);
  transform: translateY(-50%);
}

.color-presets {
  display: flex;
  align-items: center;
  gap: 5px;
}

.color-swatch {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  border: 2px solid rgba(255, 255, 255, 0.2);
  background: var(--swatch);
  cursor: pointer;
  padding: 0;
  transition: transform 0.12s, border-color 0.12s;
}

.color-swatch:hover {
  transform: scale(1.12);
  border-color: rgba(255, 255, 255, 0.5);
}

.color-swatch.active {
  border-color: var(--text);
}

.color-more {
  width: 26px;
  height: 26px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  background: var(--surface-3);
  color: var(--text-muted);
  font-family: inherit;
  font-size: 1rem;
  font-weight: 600;
  line-height: 1;
  cursor: pointer;
  padding: 0;
  transition: background 0.12s, color 0.12s;
  position: relative;
  overflow: hidden;
}

.color-more input[type="color"] {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  opacity: 0;
  cursor: pointer;
  border: none;
  padding: 0;
}

.color-more:hover {
  background: var(--surface-hover);
  color: var(--text);
}

.corner-handle-text {
  border-color: var(--text-muted);
  color: var(--text-muted);
}

.corner-handle-text:hover,
.corner-handle-text.active {
  background: var(--surface-2);
  border-color: var(--text);
  color: var(--text);
}

.corner-handle-confirm {
  border-color: #27AE60;
  color: #27AE60;
}

.corner-handle-confirm:hover {
  background: rgba(39, 174, 96, 0.15);
  border-color: #27AE60;
  color: #27AE60;
}

/* Text input overlay */
.text-input-overlay {
  position: fixed;
  inset: 0;
  z-index: 25;
  pointer-events: none;
}

.text-input-overlay textarea {
  position: fixed;
  display: block;
  margin: 0;
  padding: 0;
  border: none;
  border-radius: 0;
  background: transparent;
  color: #fff;
  font-family: 'DM Sans', system-ui, sans-serif;
  font-weight: 600;
  font-size: 20px;
  line-height: 1.25;
  text-align: center;
  resize: none;
  overflow: hidden;
  outline: none;
  box-sizing: border-box;
  pointer-events: auto;
  white-space: pre-wrap;
  word-break: break-word;
}

.save-status {
  position: absolute;
  bottom: 14px;
  left: 10px;
  padding: 6px 10px;
  border-radius: 12px;
  background: var(--chrome-bg);
  backdrop-filter: var(--chrome-blur);
  -webkit-backdrop-filter: var(--chrome-blur);
  border: 1px solid rgba(255, 255, 255, 0.1);
  box-shadow: 0 8px 28px rgba(0, 0, 0, 0.28);
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--text-muted);
  pointer-events: none;
  /* Above selection dialogs (objekte-screen z-index 280) */
  z-index: 400;
  transform: translateX(0);
  transition:
    color 0.2s ease,
    opacity 0.2s ease,
    transform 0.34s cubic-bezier(0.22, 1, 0.36, 1);
}

body.sheet-open .save-status {
  transform: translateX(calc(12px + min(var(--sheet-width), 88vw)));
}

@media (prefers-reduced-motion: reduce) {
  .save-status {
    transition: color 0.2s ease, opacity 0.2s ease;
  }
}

.save-status-icon { display: none; }

@keyframes save-status-spin {
  to { transform: rotate(360deg); }
}

.save-status.is-pending { color: var(--text); }
.save-status.is-saved { color: #7cb87c; }
.save-status.is-toast { font-weight: 600; }
.save-status.is-toast.is-saved { color: #7cb87c; }
.save-status.is-error,
.save-status.is-quota,
.save-status.is-offline { color: var(--danger); }

/* Full-screen PWA update splash — blocks map drag/placing until reload */
body.app-is-updating #workspace,
body.app-is-updating #app-shell {
  pointer-events: none !important;
}

.app-update-overlay {
  position: fixed;
  inset: 0;
  z-index: 4000;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(12, 12, 16, 0.88);
  pointer-events: auto;
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
}

.app-update-overlay.hidden {
  display: none !important;
}

.app-update-overlay-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
  padding: 28px 36px;
  text-align: center;
}

.app-update-overlay-text {
  margin: 0;
  font-size: 1.05rem;
  font-weight: 600;
  color: var(--text);
}

.app-update-banner {
  position: fixed;
  left: 50%;
  bottom: calc(78px + env(safe-area-inset-bottom, 0px));
  transform: translateX(-50%);
  z-index: 80;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  border-radius: 12px;
  background: rgba(18, 18, 22, 0.94);
  border: 1px solid rgba(255, 255, 255, 0.12);
  color: var(--text);
  font-size: 0.82rem;
  box-shadow: 0 8px 28px rgba(0, 0, 0, 0.35);
  max-width: calc(100% - 24px);
}

.app-update-reload {
  border: 0;
  border-radius: 8px;
  padding: 6px 12px;
  background: var(--primary);
  color: #111;
  font: inherit;
  font-weight: 600;
  cursor: pointer;
}

.canvas-wrapper {
  position: relative;
  line-height: 0;
  overflow: hidden;
  border-radius: 2px;
  box-shadow: var(--shadow-sm), 0 0 0 1px var(--border);
}

/* Basemap-only desaturate overview (~90% color out).
 * Marker class only — actual desaturation is MapLibre paint on style/raster
 * layers (see map-desaturate-ui.js). CSS filter must NOT be used: the MapLibre
 * WebGL canvas also hosts custom fp-* layers (3D buildings, PlanObjects3D).
 * Overlay canvases (#canvas-draw etc.) are siblings and stay full-color.
 */
.maplibre-bg.maplibre-bg--desaturated {
  /* no filter — paint path only */
}

.maplibre-bg {
  position: absolute;
  top: 0;
  left: 0;
  z-index: 0;
  pointer-events: none;
  overflow: hidden;
  /* Same pending/empty underlay on BOTH panes (sky blue while tiles load). */
  background: #9dcef5;
}

/*
 * Pending = not yet revealed. MUST NOT use display:none — MapLibre measures
 * clientWidth/Height on resize(); display:none forces 0×0 and leaves a tiny
 * map in the top-left corner after show().
 * Keep background visible (opacity 0 would hide tiles AND underlay — use
 * only pointer-events; stage fill matches map host).
 */
.maplibre-bg.map-pending {
  /* Still occupy layout; hide WebGL content via visibility but keep CSS fill
     visible by painting the stage the same color (see .map-plan-view__stage). */
  visibility: hidden !important;
  pointer-events: none !important;
}

body.map-3d-active .split-pane--primary #canvas-stage {
  z-index: 1;
}

body.map-3d-active .split-pane--primary .maplibre-bg,
body.map-3d-active .split-pane .map-plan-view__map {
  z-index: 0;
  pointer-events: auto;
  touch-action: none;
  background: #9dcef5;
}

body.map-3d-active .split-pane--primary #canvas-overlay,
body.map-3d-active .split-pane .map-plan-view__overlay {
  z-index: 2;
  pointer-events: none;
}

body.map-3d-active .split-pane--primary #canvas-draw,
body.map-3d-active .split-pane .map-plan-view__plan {
  z-index: 3;
  pointer-events: none;
}

body.map-3d-active.map-3d-draw-active .split-pane--primary #canvas-draw,
body.map-3d-active.map-3d-draw-active .split-pane--primary #canvas-overlay,
body.map-3d-active.map-3d-draw-active .split-pane .map-plan-view__plan {
  pointer-events: auto;
}

body.map-3d-active .split-pane--primary #canvas-bg {
  opacity: 0;
  pointer-events: none;
}

body.map-3d-active #viewport > .canvas-toolbar-dock,
body.map-3d-active #viewport > .canvas-toolbar-dock .canvas-toolbar,
body.map-3d-active #viewport > .canvas-toolbar-dock .canvas-toolbar-props,
body.map-3d-active #viewport > .canvas-toolbar-dock .canvas-toolbar-sphere-elev,
body.map-3d-active #viewport > .canvas-toolbar-dock .canvas-toolbar-vehicle,
body.map-3d-active #viewport > .canvas-toolbar-dock .canvas-tool-popover {
  z-index: 40;
  pointer-events: auto;
}

body.map-3d-active .split-pane .layer-options {
  z-index: 50;
}

.building-info-panel {
  position: absolute;
  /* Below chrome-float--start so the hamburger stays free. */
  top: 68px;
  left: 12px;
  z-index: 28;
  width: min(300px, calc(100vw - 24px));
  max-height: min(70vh, 420px);
  overflow: auto;
  padding: 10px 12px 12px;
  border-radius: 16px;
  background: var(--chrome-bg);
  backdrop-filter: var(--chrome-blur);
  -webkit-backdrop-filter: var(--chrome-blur);
  border: 1px solid rgba(255, 255, 255, 0.1);
  box-shadow: 0 8px 28px rgba(0, 0, 0, 0.28);
  pointer-events: auto;
  color: var(--text);
}

.building-info-panel.hidden {
  display: none;
}

body.split-active .building-info-panel {
  left: 68px;
}

.building-info-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 8px;
}

.building-info-title {
  margin: 0;
  font-size: 0.82rem;
  font-weight: 600;
  letter-spacing: -0.02em;
  line-height: 1.3;
}

.building-info-close {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  padding: 0;
  border: none;
  border-radius: 11px;
  background: transparent;
  color: var(--text-muted);
  cursor: pointer;
  transition: background 0.12s, color 0.12s;
}

.building-info-close:hover {
  background: rgba(255, 255, 255, 0.1);
  color: var(--text);
}

.building-info-content {
  font-size: 0.78rem;
  line-height: 1.4;
}

.building-info-list {
  margin: 0;
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 4px 10px;
}

.building-info-list dt {
  margin: 0;
  color: var(--text-muted);
  font-weight: 500;
}

.building-info-list dd {
  margin: 0;
  word-break: break-word;
}

.building-info-toggle {
  display: none;
  margin-top: 12px;
  width: 100%;
  padding: 8px 12px;
  border: none;
  border-radius: 11px;
  background: rgba(255, 255, 255, 0.06);
  color: var(--text);
  font: inherit;
  font-size: 0.82rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.12s, color 0.12s;
}

.building-info-toggle:hover {
  background: rgba(255, 255, 255, 0.1);
}

.building-info-toggle.building-info-toggle-on {
  background: var(--primary);
  color: #fff;
}

.layer-options-hint {
  margin: 0 0 10px;
  font-size: 0.72rem;
  line-height: 1.35;
  color: var(--text-muted);
}

.canvas-wrapper canvas {
  position: absolute;
  top: 0; left: 0;
}

#canvas-bg {
  position: relative;
  z-index: 1;
}

/* OSM live MapLibre: canvas-bg must not cover the WebGL basemap (same idea as
   body.map-3d-active … #canvas-bg). Image-BG path never gets maplibre-active. */
#canvas-bg.maplibre-active {
  background: transparent;
  opacity: 0;
  pointer-events: none;
}

#canvas-overlay,
#canvas-draw {
  z-index: 2;
}

/* Scrollbar */
.sidebar::-webkit-scrollbar { width: 5px; }
.sidebar::-webkit-scrollbar-thumb {
  background: var(--surface-3);
  border-radius: 3px;
}

.mobile-sheet {
  display: none;
}

@media (max-width: 1100px) {
  body {
    display: block;
  }

  .sidebar {
    position: fixed;
    left: -9999px;
    width: 1px;
    height: 1px;
    overflow: hidden;
    opacity: 0;
    pointer-events: none;
  }

  .workspace {
    padding-bottom: calc(68px + env(safe-area-inset-bottom, 0px));
  }

  .corner-handle-rotate {
    width: 44px;
    height: 44px;
  }

  .canvas-toolbar-dock {
    top: auto;
    bottom: calc(10px + env(safe-area-inset-bottom, 0px));
    left: 6px;
    right: 6px;
    transform: none;
    max-width: none;
    width: auto;
  }

  .canvas-toolbar-dock-label {
    display: none;
  }

  .canvas-toolbar-dock .canvas-toolbar {
    margin-top: 0;
    border: none;
    border-radius: 0;
    width: 100%;
    max-width: 100%;
    padding: 0;
    gap: 6px;
    justify-content: flex-start;
  }

  .canvas-toolbar-dock .canvas-toolbar.canvas-toolbar--building,
  .canvas-toolbar-dock .canvas-toolbar.canvas-toolbar--buildings,
  .canvas-toolbar-dock .canvas-toolbar.canvas-toolbar--sphere,
  .canvas-toolbar-dock .canvas-toolbar.canvas-toolbar--vehicle,
  .canvas-toolbar-dock .canvas-toolbar.canvas-toolbar--absprache,
  .canvas-toolbar-dock .canvas-toolbar.canvas-toolbar--nav,
  .canvas-toolbar-dock .canvas-toolbar.canvas-toolbar--nav-stop {
    width: 100%;
    max-width: 100%;
    justify-content: center;
    margin-left: auto;
    margin-right: auto;
  }

  #canvas-toolbar-io {
    display: none !important;
  }

  #canvas-toolbar-einsatz {
    display: none !important;
  }

  .canvas-overflow-item--mobile {
    display: flex;
  }

  .canvas-overflow-sep {
    display: block;
  }

  .canvas-toolbar-draw {
    flex: 1 1 auto;
    min-width: 0;
  }

  .canvas-toolbar-symbols {
    flex: 1 1 auto;
    min-width: 0;
  }

  .canvas-toolbar-group {
    height: auto;
    padding: 3px;
    border-radius: 14px;
  }

  .canvas-tb-btn {
    width: 34px;
    height: 34px;
  }

  .canvas-tb-symbol {
    width: 34px;
    height: 34px;
  }

  .canvas-toolbar-divider {
    height: 24px;
    margin: 0 2px;
  }

  .canvas-toolbar--sphere .canvas-toolbar-sphere-elev,
  .canvas-toolbar--vehicle .canvas-toolbar-vehicle,
  .canvas-toolbar--absprache .canvas-toolbar-absprache,
  .canvas-toolbar--building .canvas-toolbar-building,
  .canvas-toolbar--nav .canvas-toolbar-nav,
  .canvas-toolbar--nav-stop .canvas-toolbar-nav-stop {
    width: 100%;
    max-width: 100%;
    justify-content: center;
    box-sizing: border-box;
    flex-wrap: wrap;
  }

  .canvas-toolbar-nav .canvas-obj-label-field {
    flex: 1 1 100%;
    min-width: 0;
    width: 100%;
  }

  .canvas-toolbar-nav-actions {
    flex: 1 1 100%;
    width: 100%;
    justify-content: center;
    flex-wrap: wrap;
  }

  #canvas-nav-place-stops .sphere-chip-label-text {
    display: none;
  }

  #canvas-nav-place-stops {
    width: 34px;
    min-width: 34px;
    padding: 0;
  }

  .canvas-toolbar-vehicle-picks:not(.canvas-toolbar-symbol-picks--compact),
  .canvas-toolbar-symbol-picks:not(.canvas-toolbar-symbol-picks--compact) {
    max-width: 100%;
  }

  .canvas-toolbar-sphere-elev {
    gap: 4px;
    padding: 3px;
    justify-content: center;
  }

  .canvas-tb-btn.sphere-chip-label,
  .canvas-tb-btn.building-chip-label {
    flex: 0 1 auto;
    min-width: 0;
  }

  .canvas-tb-btn.sphere-chip-label {
    max-width: 8.5rem;
  }

  .canvas-tb-btn.building-chip-label {
    max-width: min(14rem, calc(100vw - 9.5rem));
  }

  .sphere-label-popover {
    left: 0;
    right: 0;
    width: auto;
    transform: none;
  }

  /* Online: icon-only; tap → .is-open expands ~10s. Offline: JS keeps .is-open sticky. */
  .save-status {
    top: calc(8px + env(safe-area-inset-top, 0px) + 56px + 12px);
    left: 12px;
    right: auto;
    bottom: auto;
    width: 36px;
    max-width: 36px;
    height: 36px;
    padding: 0;
    gap: 6px;
    overflow: hidden;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: flex-start;
    font-size: 0;
    box-shadow: none;
    transform: none;
    pointer-events: auto;
    cursor: pointer;
    transition: max-width 200ms ease, border-radius 200ms ease, color 0.2s ease, opacity 0.2s ease;
  }

  .save-status.is-open {
    width: auto;
    max-width: min(280px, calc(100vw - 24px));
    padding: 0 12px 0 0;
    border-radius: 18px;
    font-size: 0.72rem;
  }

  body.sheet-open .save-status,
  body.help-open .save-status {
    display: none;
    transform: none;
  }

  .save-status-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    flex-shrink: 0;
    font-size: 15px;
    line-height: 1;
  }

  .save-status.is-pending .save-status-icon {
    animation: none;
  }

  .save-status-label {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
  }

  .save-status.is-open .save-status-label {
    position: static;
    width: auto;
    height: auto;
    overflow: visible;
    clip: auto;
    font-size: 0.72rem;
    font-weight: 600;
    line-height: 1.2;
    white-space: nowrap;
    text-align: left;
  }

  .mobile-sheet {
    display: block;
    position: fixed;
    inset: 0;
    z-index: 60;
    pointer-events: none;
    visibility: hidden;
    transition: visibility 0.2s;
  }

  .mobile-sheet.open {
    pointer-events: auto;
    visibility: visible;
  }

  .mobile-sheet-scrim {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.45);
    opacity: 0;
    transition: opacity 0.2s;
  }

  .mobile-sheet.open .mobile-sheet-scrim { opacity: 1; }

  .mobile-sheet-panel {
    position: absolute;
    left: 0;
    right: 0;
    bottom: 0;
    max-height: min(70vh, 520px);
    overflow-y: auto;
    background: var(--surface);
    border-radius: 12px 12px 0 0;
    border-top: 1px solid var(--border);
    padding: 12px 14px calc(14px + env(safe-area-inset-bottom, 0px));
    transform: translateY(100%);
    transition: transform 0.25s cubic-bezier(0.4, 0, 0.2, 1);
  }

  .mobile-sheet.open .mobile-sheet-panel {
    transform: translateY(0);
  }

  .mobile-sheet-close {
    position: absolute;
    top: 10px;
    right: 10px;
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: none;
    border-radius: 50%;
    background: var(--surface-3);
    color: var(--text-muted);
    cursor: pointer;
    z-index: 2;
  }

  .mobile-sheet-pane {
    padding-top: 8px;
  }

  .mobile-sheet-pane .card-title,
  .mobile-sheet-pane .card-hint,
  .mobile-sheet-pane .symbol-panel-title {
    display: none;
  }

  .mobile-sheet-pane .card-subtitle {
    font-size: 0.68rem;
    margin: 0 0 8px;
  }

  .mobile-sheet-pane .map-style-pills .format-pill {
    font-size: 0.68rem;
    padding: 8px 2px;
  }

  .mobile-sheet-pane .symbol-grid {
    grid-template-columns: repeat(5, 1fr);
    max-height: none;
  }

  .drop-zone p { font-size: 0.82rem; }
  .drop-zone .hint { display: none; }

  .export-menu {
    min-width: 140px;
    z-index: 55;
  }

  .shape-prop-popover {
    top: auto;
    bottom: calc(100% + 8px);
  }

  .canvas-toolbar--props {
    max-width: calc(100vw - 16px);
  }

  .canvas-toolbar-props .color-swatch,
  .canvas-toolbar-props .color-more {
    width: 20px;
    height: 20px;
  }

  .canvas-toolbar-dock .canvas-toolbar {
    padding: 0;
    border-radius: 0;
  }

}



/* —— Einsatz-Chat panel (slides in from the right like Hilfe) —— */
.einsatz-chat-panel {
  --chat-sheet-span: min(360px, calc(100vw - 24px));
  --chat-sheet-shift: calc(12px + var(--chat-sheet-span) + 8px);
  position: absolute;
  right: 12px;
  top: 72px;
  bottom: 96px;
  width: var(--chat-sheet-span);
  z-index: 40;
  display: flex;
  flex-direction: column;
  background: var(--surface, #1c1c20);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 12px;
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.35);
  overflow: hidden;
  /* Off-canvas when closed; body.chat-open slides it in (Hilfe pattern). */
  transform: translateX(calc(100% + 24px));
  pointer-events: none;
  transition: transform 0.34s cubic-bezier(0.22, 1, 0.36, 1);
}
body.chat-open .einsatz-chat-panel:not(.hidden) {
  transform: none;
  pointer-events: auto;
}
/* Desktop: edge-hugging like Hilfe; map toolbars are pushed via chrome.css. */
@media (min-width: 1101px) {
  .einsatz-chat-panel {
    --chat-sheet-span: min(360px, calc(100vw - 24px));
    right: 12px;
    width: var(--chat-sheet-span);
  }
}
.einsatz-chat-panel.hidden { display: none; }
.einsatz-chat-header {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 12px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}
.einsatz-chat-title { flex: 1; font-size: 0.95rem; }
.einsatz-chat-filters {
  --chat-accent-user: #3dba7a;
  --chat-accent-vehicle: #4aa3e8;
  --chat-accent-protocol: #e0b83a;
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  padding: 8px 12px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}
.einsatz-chat-filter-chip {
  flex: 1 1 auto;
  min-width: 0;
  padding: 5px 8px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.04);
  color: inherit;
  font: inherit;
  font-size: 0.72rem;
  font-weight: 500;
  cursor: pointer;
  opacity: 0.78;
}
.einsatz-chat-filter-chip:hover {
  opacity: 1;
  background: rgba(255, 255, 255, 0.08);
}
.einsatz-chat-filter-chip.active {
  opacity: 1;
  font-weight: 600;
  color: #111;
  border-color: transparent;
}
.einsatz-chat-filter-chip[data-chat-filter="all"].active {
  background: rgba(255, 255, 255, 0.22);
  color: inherit;
}
.einsatz-chat-filter-chip[data-chat-filter="user"].active {
  background: var(--chat-accent-user);
}
.einsatz-chat-filter-chip[data-chat-filter="vehicle"].active {
  background: var(--chat-accent-vehicle);
}
.einsatz-chat-filter-chip[data-chat-filter="protocol"].active {
  background: var(--chat-accent-protocol);
}
.einsatz-chat-filter-chip.hidden { display: none; }
.einsatz-chat-list {
  flex: 1;
  overflow: auto;
  padding: 10px 12px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.einsatz-chat-empty {
  margin: 12px 0;
  opacity: 0.6;
  font-size: 0.9rem;
}
.einsatz-chat-msg {
  --chat-accent-user: #3dba7a;
  --chat-accent-vehicle: #4aa3e8;
  --chat-accent-protocol: #e0b83a;
  border-radius: 10px;
  padding: 8px 10px 8px 12px;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.08);
  box-shadow: inset 3px 0 0 transparent;
}
.einsatz-chat-msg--human {
  box-shadow: inset 3px 0 0 var(--chat-accent-user);
}
.einsatz-chat-msg--system,
.einsatz-chat-msg--protocol {
  align-self: stretch;
  max-width: 100%;
  background: rgba(224, 184, 58, 0.12);
  border-color: rgba(224, 184, 58, 0.28);
  box-shadow: inset 3px 0 0 var(--chat-accent-protocol);
}
.einsatz-chat-msg--vehicle {
  background: rgba(74, 163, 232, 0.12);
  border-color: rgba(74, 163, 232, 0.30);
  box-shadow: inset 3px 0 0 var(--chat-accent-vehicle);
}
.einsatz-chat-msg--own {
  align-self: flex-end;
  max-width: 85%;
  background: rgba(61, 186, 122, 0.22);
  border-color: rgba(61, 186, 122, 0.38);
  box-shadow: inset 3px 0 0 var(--chat-accent-user);
}
.einsatz-chat-msg--user:not(.einsatz-chat-msg--own):not(.einsatz-chat-msg--protocol) {
  align-self: flex-start;
  max-width: 85%;
}
.einsatz-chat-msg--unread {
  border-width: 2px;
  border-color: rgba(255, 255, 255, 0.55);
}

.einsatz-chat-msg--pending {
  opacity: 0.62;
  filter: grayscale(0.35);
}
.einsatz-chat-msg--pending-failed {
  opacity: 0.78;
  filter: grayscale(0.15);
  cursor: pointer;
}
.einsatz-chat-msg-pending-flag {
  font-style: italic;
  opacity: 0.85;
}
.einsatz-chat-unread-sep {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  margin: 4px 0 2px;
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  opacity: 0.72;
}
.einsatz-chat-unread-sep::before,
.einsatz-chat-unread-sep::after {
  content: '';
  flex: 1;
  height: 1px;
  background: rgba(255, 255, 255, 0.22);
}
.einsatz-chat-msg-meta {
  font-size: 0.72rem;
  opacity: 0.7;
  margin-bottom: 4px;
}
.einsatz-chat-msg-text {
  font-size: 0.9rem;
  white-space: pre-wrap;
  word-break: break-word;
}
.einsatz-chat-compose {
  display: flex;
  gap: 8px;
  padding: 10px 12px;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  align-items: flex-end;
}
.einsatz-chat-input {
  flex: 1;
  resize: none;
  min-height: 44px;
  border-radius: 8px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  background: rgba(0, 0, 0, 0.25);
  color: inherit;
  padding: 8px 10px;
  font: inherit;
}
.einsatz-chat-compose {
  flex-wrap: wrap;
}
.einsatz-chat-compose-tools {
  display: flex;
  gap: 4px;
  align-items: center;
}
.einsatz-chat-tool-btn {
  min-width: 40px;
  padding: 8px;
}
.einsatz-chat-tool-btn.is-recording {
  color: #f5c542;
  box-shadow: 0 0 0 1px rgba(245, 197, 66, 0.55);
}
.einsatz-chat-compose-status {
  flex: 1 1 100%;
  margin: 0;
  font-size: 0.78rem;
  opacity: 0.75;
}
.einsatz-chat-compose-status.is-error { color: #f0a0a0; opacity: 1; }
.einsatz-chat-msg-media { margin: 4px 0; }
.einsatz-chat-msg-thumb {
  display: block;
  max-width: 100%;
  max-height: 180px;
  border-radius: 8px;
  object-fit: cover;
  cursor: default;
}
.einsatz-chat-msg-audio {
  width: 100%;
  max-width: 280px;
  height: 36px;
}
.einsatz-chat-msg-file {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  max-width: 100%;
  padding: 6px 8px;
  border-radius: 8px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  background: rgba(0, 0, 0, 0.2);
  color: inherit;
  font: inherit;
  text-align: left;
  cursor: pointer;
}
.einsatz-chat-msg-file-name {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
#sphere-completed-btn.active {
  color: #7dcea0;
}

/* ── Absprachepunkte (Einsatz coordination points) ── */
/* Window / overlay layout lives in canvas.css only. */
.absprachepunkte-panel.hidden { display: none !important; }
.absprachepunkte-body {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.absprachepunkte-toggle {
  flex-shrink: 0;
  width: 16px;
  margin: 0;
  padding: 0;
  border: 0;
  border-left: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 0;
  background: rgba(255, 255, 255, 0.04);
  color: inherit;
  cursor: pointer;
  font: inherit;
  font-size: 0.85rem;
  font-weight: 700;
  line-height: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  align-self: stretch;
}
.absprachepunkte-toggle:hover {
  background: rgba(255, 255, 255, 0.1);
}
.absprachepunkte-toggle:focus-visible {
  outline: 2px solid #003399;
  outline-offset: -2px;
}
.absprachepunkte-header {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 5px 8px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}
.absprachepunkte-title {
  flex: 1;
  margin: 0;
  font-size: 0.78rem;
  font-weight: 600;
  line-height: 1.2;
}
.absprachepunkte-list {
  display: flex;
  flex-direction: column;
  gap: 3px;
  padding: 5px;
  overflow: auto;
}
.absprachepunkte-row {
  display: flex;
  align-items: center;
  gap: 7px;
  width: 100%;
  text-align: left;
  padding: 4px 5px;
  border-radius: 7px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  background: rgba(255, 255, 255, 0.04);
  color: inherit;
  cursor: pointer;
  font: inherit;
}
/* Yellow only when unset or in place/reset mode. */
.absprachepunkte-row.is-unset {
  background: rgba(245, 197, 24, 0.55);
  border-color: rgba(245, 197, 24, 0.75);
  color: #1a1a1a;
}
.absprachepunkte-row.is-set {
  background: rgba(255, 255, 255, 0.06);
}
.absprachepunkte-row.is-placing {
  box-shadow: 0 0 0 2px #F5C518;
  background: rgba(245, 197, 24, 0.55);
  border-color: rgba(245, 197, 24, 0.9);
  color: #1a1a1a;
}
/* Selected (set): blue — not yellow. */
.absprachepunkte-row.is-selected:not(.is-placing) {
  box-shadow: 0 0 0 2px #003399;
  background: rgba(0, 51, 153, 0.35);
  border-color: rgba(0, 51, 153, 0.9);
}
.absprachepunkte-row.is-set.is-selected:not(.is-placing) {
  background: rgba(0, 51, 153, 0.45);
}
.absprachepunkte-row.is-selected:not(.is-placing) .absprachepunkte-symbol {
  background: #003399;
  border-color: #003399;
}
.absprachepunkte-row.is-selected:not(.is-placing) .absprachepunkte-symbol img {
  filter: brightness(0) invert(1);
}
.absprachepunkte-row.is-disabled {
  opacity: 0.55;
  cursor: default;
  pointer-events: none;
}
.absprachepunkte-row.is-disabled .absprachepunkte-ort {
  pointer-events: none;
}
.absprachepunkte-actions {
  display: flex;
  flex-shrink: 0;
  gap: 2px;
  margin-left: auto;
}
.absprachepunkte-action {
  width: 32px;
  height: 32px;
  margin: 0;
  padding: 0;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: inherit;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}
.absprachepunkte-action .material-symbols-outlined {
  font-size: 20px;
}
.absprachepunkte-action:hover {
  background: rgba(255, 255, 255, 0.12);
}
.absprachepunkte-action:disabled {
  opacity: 0.35;
  pointer-events: none;
}
.absprachepunkte-row {
  transition: padding 180ms ease;
}
.absprachepunkte-row-main {
  display: flex;
  align-items: center;
  gap: 7px;
  width: 100%;
  min-width: 0;
}
.absprachepunkte-item.is-editing .absprachepunkte-row {
  flex-direction: column;
  align-items: stretch;
  gap: 8px;
  padding: 8px;
  box-shadow: none;
}
.absprachepunkte-editor {
  display: grid;
  grid-template-rows: 0fr;
  opacity: 0;
  width: 100%;
  transition: grid-template-rows 180ms ease, opacity 160ms ease;
}
.absprachepunkte-item.is-editing .absprachepunkte-editor {
  grid-template-rows: 1fr;
  opacity: 1;
}
.absprachepunkte-editor-inner {
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 6px;
  min-height: 0;
  width: 100%;
}
.absprachepunkte-draft {
  flex: 1;
  min-width: 0;
  min-height: 44px;
  box-sizing: border-box;
  border-radius: 12px;
  border: 1px solid rgba(255, 255, 255, 0.10);
  background-color: rgba(255, 255, 255, 0.05);
  background-clip: padding-box;
  color: #fafafa;
  font: inherit;
  text-align: left;
  padding: 10px 12px;
  outline: none;
  appearance: none;
}
.absprachepunkte-draft:focus {
  border-color: rgba(255, 255, 255, 0.22);
  outline: none;
}
@media (prefers-reduced-motion: reduce) {
  .absprachepunkte-editor,
  .absprachepunkte-row {
    transition: none;
  }
}
.absprachepunkte-symbol {
  flex-shrink: 0;
  width: 26px;
  height: 26px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.18);
  border: 1px solid rgba(255, 255, 255, 0.28);
}
.absprachepunkte-symbol img {
  width: 20px;
  height: 20px;
  object-fit: contain;
  display: block;
}
.absprachepunkte-meta {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.absprachepunkte-label {
  font-size: 0.72rem;
  font-weight: 600;
  line-height: 1.2;
}
.absprachepunkte-ort-hint {
  font-size: 0.66rem;
  opacity: 0.75;
  line-height: 1.2;
}
.absprachepunkte-ort {
  width: 100%;
  box-sizing: border-box;
  border-radius: 5px;
  border: 1px solid rgba(0, 0, 0, 0.15);
  background: rgba(255, 255, 255, 0.85);
  color: #111;
  padding: 2px 5px;
  font: inherit;
  font-size: 0.68rem;
  line-height: 1.25;
}
/* Fully closed / fully open only — no symbol-strip collapse (esp. mobile). */
.absprachepunkte-panel--collapsed,
.absprachepunkte-panel--closed {
  width: auto;
  min-width: 0;
  max-width: none;
  max-height: none;
}
.absprachepunkte-panel--collapsed .absprachepunkte-body,
.absprachepunkte-panel--closed .absprachepunkte-body {
  display: none;
}
.absprachepunkte-panel--collapsed .absprachepunkte-toggle,
.absprachepunkte-panel--closed .absprachepunkte-toggle {
  width: 28px;
  height: 36px;
  border-left: 0;
  border-radius: 10px;
  align-self: auto;
}
body.absprachepunkte-placing,
body.absprachepunkte-placing #viewport {
  cursor: crosshair !important;
}
/* Place-mode hint at top (under menubar) on all viewports. */
body.absprachepunkte-placing #chrome-nav-hint:not(.hidden) {
  display: block !important;
}


/* Create Gebäude radius panel — sits in bottom-dock position */
.create-buildings-radius-panel {
  position: absolute;
  left: 50%;
  /* Same vertical slot as .lage-dock (replaces dock while session active). */
  bottom: calc(8px + env(safe-area-inset-bottom, 0px));
  transform: translateX(-50%);
  z-index: 330;
  width: min(420px, calc(100vw - 32px));
  padding: 12px 14px 14px;
  border-radius: 16px;
  background: var(--chrome-bg);
  backdrop-filter: var(--chrome-blur);
  -webkit-backdrop-filter: var(--chrome-blur);
  border: 1px solid rgba(255, 255, 255, 0.1);
  box-shadow: 0 8px 28px rgba(0, 0, 0, 0.28);
  color: var(--text);
  pointer-events: auto;
}

.create-buildings-radius-panel.hidden {
  display: none;
}

.create-buildings-radius-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 4px;
}

.create-buildings-radius-title {
  margin: 0;
  font-size: 0.92rem;
  font-weight: 600;
  letter-spacing: -0.02em;
}

.create-buildings-radius-x {
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  padding: 0;
  border: none;
  border-radius: 11px;
  background: transparent;
  color: var(--text-muted);
  cursor: pointer;
}

.create-buildings-radius-x:hover {
  background: rgba(255, 255, 255, 0.1);
  color: var(--text);
}

.create-buildings-radius-hint {
  margin: 0 0 10px;
  font-size: 0.78rem;
  color: var(--text-muted);
  line-height: 1.35;
}

.create-buildings-radius-slider-label {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 6px;
  font-size: 0.8rem;
  font-weight: 500;
}

.create-buildings-radius-slider-label strong {
  font-variant-numeric: tabular-nums;
}

.create-buildings-radius-panel input[type="range"] {
  width: 100%;
  margin: 0 0 8px;
  accent-color: var(--primary, #c45c3e);
}

.create-buildings-radius-count {
  margin: 0 0 12px;
  font-size: 0.82rem;
  font-weight: 600;
}

.create-buildings-radius-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
}

@media (max-width: 1100px) {
  /* Compact: stretch like the bottom dock (left/right 16px). */
  .create-buildings-radius-panel {
    left: 16px;
    right: 16px;
    width: auto;
    transform: none;
    border-radius: var(--radius-chrome, 18px);
  }
}
