* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  overflow: hidden;
  height: 100vh;
  width: 100vw;
}

/* Map fills the entire viewport */
#map {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
}

/* Left Toolbar */
#toolbar {
  position: absolute;
  top: 10px;
  left: 10px;
  z-index: 10;
  background: rgba(30, 30, 30, 0.92);
  border-radius: 8px;
  padding: 8px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 100px;
  box-shadow: 0 2px 12px rgba(0,0,0,0.4);
}

.toolbar-section {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.toolbar-section + .toolbar-section {
  border-top: 1px solid rgba(255,255,255,0.15);
  padding-top: 6px;
  margin-top: 2px;
}

.toolbar-label {
  color: rgba(255,255,255,0.5);
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  padding: 2px 6px;
}

.tool-btn {
  display: flex;
  align-items: center;
  gap: 8px;
  background: transparent;
  border: 1px solid transparent;
  color: #ddd;
  padding: 6px 10px;
  border-radius: 5px;
  cursor: pointer;
  font-size: 13px;
  transition: background 0.15s;
  white-space: nowrap;
}

.tool-btn:hover {
  background: rgba(255,255,255,0.12);
}

.tool-btn.active {
  background: rgba(255,255,255,0.2);
  border-color: rgba(255,255,255,0.3);
  color: #fff;
}

/* Cone icons in toolbar */
.cone-icon {
  display: inline-block;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  flex-shrink: 0;
}

.cone-regular {
  background: #ff8c00;
}

.cone-pointer {
  background: #a3e635;
  border-radius: 2px;
  clip-path: polygon(50% 0%, 0% 100%, 100% 100%);
}

.cone-start {
  background: #22c55e;
}

.cone-finish {
  background: linear-gradient(45deg, #000 25%, #fff 25%, #fff 50%, #000 50%, #000 75%, #fff 75%);
  background-size: 8px 8px;
  border: 1px solid #666;
}

.tool-icon {
  font-size: 14px;
  width: 14px;
  text-align: center;
  flex-shrink: 0;
}

/* Search Bar */
#search-bar {
  position: absolute;
  top: 10px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 10;
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
}

#search-input {
  width: 320px;
  padding: 8px 12px;
  border: none;
  border-radius: 6px;
  font-size: 14px;
  background: rgba(255,255,255,0.95);
  box-shadow: 0 2px 8px rgba(0,0,0,0.3);
}

#search-input:focus {
  outline: 2px solid #3b82f6;
}

#search-btn {
  padding: 8px 16px;
  border: none;
  border-radius: 6px;
  background: #3b82f6;
  color: #fff;
  font-size: 14px;
  cursor: pointer;
  box-shadow: 0 2px 8px rgba(0,0,0,0.3);
}

#search-btn:hover {
  background: #2563eb;
}

/* Right Sidebar */
#sidebar {
  position: absolute;
  top: 10px;
  right: 0;
  z-index: 10;
  height: calc(100vh - 20px);
  display: flex;
  transition: transform 0.25s ease;
}

#sidebar.collapsed {
  transform: translateX(calc(100% - 28px));
}

#sidebar-toggle {
  background: rgba(30, 30, 30, 0.92);
  border: none;
  color: #ddd;
  width: 28px;
  cursor: pointer;
  border-radius: 6px 0 0 6px;
  font-size: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
}

#sidebar-toggle:hover {
  background: rgba(60, 60, 60, 0.95);
}

#sidebar.collapsed #sidebar-toggle {
  border-radius: 6px 0 0 6px;
}

#sidebar-content {
  background: rgba(30, 30, 30, 0.92);
  border-radius: 0 0 0 6px;
  padding: 12px;
  width: 220px;
  color: #ddd;
  overflow-y: auto;
  box-shadow: 0 2px 12px rgba(0,0,0,0.4);
}

#sidebar-content h3 {
  font-size: 13px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: rgba(255,255,255,0.5);
  margin-bottom: 8px;
  margin-top: 12px;
}

#sidebar-content h3:first-child {
  margin-top: 0;
}

#course-info {
  font-size: 14px;
  line-height: 1.6;
}

/* Saved courses list */
#saved-list {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.saved-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 6px 8px;
  background: rgba(255,255,255,0.08);
  border-radius: 4px;
  font-size: 13px;
}

.saved-item span {
  cursor: pointer;
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.saved-item span:hover {
  color: #3b82f6;
}

.saved-item button {
  background: none;
  border: none;
  color: #f87171;
  cursor: pointer;
  font-size: 16px;
  padding: 0 2px;
  margin-left: 6px;
}

.saved-item button:hover {
  color: #ef4444;
}

/* Map Markers - Cones */
.cone-marker {
  cursor: crosshair;
}

.cone-marker.selected {
  transform: scale(1.4);
  filter: drop-shadow(0 0 4px rgba(255,255,255,0.8));
}

.marker-regular {
  width: 14px;
  height: 14px;
  background: #ff8c00;
  border: 2px solid #cc7000;
  border-radius: 50%;
}

.marker-pointer {
  width: 0;
  height: 0;
  border-left: 8px solid transparent;
  border-right: 8px solid transparent;
  border-bottom: 16px solid #a3e635;
  filter: drop-shadow(0 0 1px rgba(0,0,0,0.5));
  transform-origin: center 66%;
}

.marker-start {
  width: 14px;
  height: 14px;
  background: #22c55e;
  border: 2px solid #16a34a;
  border-radius: 50%;
}

.marker-finish {
  width: 16px;
  height: 16px;
  background: repeating-conic-gradient(#000 0% 25%, #fff 0% 50%) 50% / 8px 8px;
  border: 1px solid #666;
  border-radius: 2px;
}

/* Distance Label */
#distance-label {
  position: absolute;
  z-index: 20;
  background: rgba(0,0,0,0.85);
  color: #fff;
  padding: 4px 8px;
  border-radius: 4px;
  font-size: 13px;
  font-weight: 600;
  pointer-events: none;
  white-space: nowrap;
}

#distance-label.hidden {
  display: none;
}

/* Driving line waypoint */
.waypoint-marker {
  width: 8px;
  height: 8px;
  background: #60a5fa;
  border: 1px solid #3b82f6;
  border-radius: 50%;
  cursor: pointer;
}

/* Search Suggestions Dropdown */
#search-suggestions {
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  background: rgba(255, 255, 255, 0.97);
  border-radius: 0 0 6px 6px;
  box-shadow: 0 4px 12px rgba(0,0,0,0.3);
  z-index: 11;
  max-height: 200px;
  overflow-y: auto;
}

.suggestion-item {
  padding: 8px 12px;
  font-size: 13px;
  cursor: pointer;
  border-top: 1px solid rgba(0,0,0,0.06);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.suggestion-item:first-child {
  border-top: none;
}

.suggestion-item:hover {
  background: #e0edff;
}

/* Grid Canvas Overlay */
#grid-canvas {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 1;
  pointer-events: none;
}

/* Grid Rotation Control */
#grid-rotation-control {
  padding: 4px 6px;
}

#grid-rotation {
  width: 100%;
  margin: 2px 0;
  accent-color: #3b82f6;
}

.toolbar-sublabel {
  color: rgba(255,255,255,0.5);
  font-size: 10px;
}

.rotation-row {
  display: flex;
  align-items: center;
  gap: 2px;
}

#grid-rotation-number {
  width: 48px;
  padding: 2px 4px;
  border: 1px solid rgba(255,255,255,0.2);
  border-radius: 4px;
  background: rgba(255,255,255,0.1);
  color: #ddd;
  font-size: 12px;
  text-align: center;
  -moz-appearance: textfield;
}

#grid-rotation-number::-webkit-outer-spin-button,
#grid-rotation-number::-webkit-inner-spin-button {
  -webkit-appearance: none;
  margin: 0;
}

/* Cone z-index layering: regular cones above pointers */
.cone-marker-pointer {
  z-index: 1 !important;
}

.cone-marker-regular {
  z-index: 2 !important;
}

/* Print Dialog */
#print-dialog {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 100;
  background: rgba(0, 0, 0, 0.6);
  display: flex;
  align-items: center;
  justify-content: center;
}

.print-dialog-content {
  background: rgba(30, 30, 30, 0.97);
  border-radius: 10px;
  padding: 20px 24px;
  color: #ddd;
  min-width: 260px;
  box-shadow: 0 4px 20px rgba(0,0,0,0.5);
}

.print-dialog-content h3 {
  font-size: 15px;
  margin-bottom: 14px;
  color: #fff;
}

.print-option {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  cursor: pointer;
  margin-bottom: 16px;
}

.print-option input[type="checkbox"] {
  accent-color: #3b82f6;
  width: 16px;
  height: 16px;
}

.print-dialog-buttons {
  display: flex;
  gap: 8px;
}

.print-btn-confirm {
  flex: 1;
  padding: 8px 12px;
  border: none;
  border-radius: 6px;
  background: #3b82f6;
  color: #fff;
  font-size: 13px;
  cursor: pointer;
}

.print-btn-confirm:hover {
  background: #2563eb;
}

.print-btn-cancel {
  padding: 8px 12px;
  border: 1px solid rgba(255,255,255,0.2);
  border-radius: 6px;
  background: transparent;
  color: #ddd;
  font-size: 13px;
  cursor: pointer;
}

.print-btn-cancel:hover {
  background: rgba(255,255,255,0.1);
}

/* ===== Mode Selection Banner ===== */
#mode-banner {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 200;
  background: rgba(15, 15, 20, 0.97);
  display: flex;
  align-items: center;
  justify-content: center;
}

#mode-choices {
  text-align: center;
  max-width: 600px;
  padding: 40px;
}

.banner-title {
  color: #fff;
  font-size: 28px;
  font-weight: 700;
  margin-bottom: 8px;
}

.banner-subtitle {
  color: rgba(255,255,255,0.5);
  font-size: 15px;
  margin-bottom: 36px;
}

.banner-buttons {
  display: flex;
  gap: 20px;
  justify-content: center;
  flex-wrap: wrap;
}

.banner-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  background: rgba(255,255,255,0.07);
  border: 2px solid rgba(255,255,255,0.15);
  border-radius: 14px;
  padding: 28px 32px;
  cursor: pointer;
  transition: background 0.2s, border-color 0.2s, transform 0.15s;
  min-width: 220px;
}

.banner-btn:hover {
  background: rgba(255,255,255,0.13);
  border-color: rgba(255,255,255,0.35);
  transform: translateY(-2px);
}

.banner-icon {
  font-size: 40px;
}

.banner-btn-label {
  color: #fff;
  font-size: 17px;
  font-weight: 600;
}

.banner-btn-desc {
  color: rgba(255,255,255,0.45);
  font-size: 12px;
  max-width: 180px;
}

/* ===== Image Gallery ===== */
#image-gallery {
  text-align: center;
  max-width: 700px;
  padding: 40px;
}

.gallery-header {
  color: #fff;
  font-size: 22px;
  font-weight: 600;
  margin-bottom: 24px;
}

.gallery-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
  justify-content: center;
  margin-bottom: 20px;
}

.gallery-thumb {
  width: 140px;
  height: 120px;
  background: rgba(255,255,255,0.07);
  border: 2px solid rgba(255,255,255,0.12);
  border-radius: 10px;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  transition: border-color 0.2s, transform 0.15s;
}

.gallery-thumb:hover {
  border-color: #3b82f6;
  transform: translateY(-2px);
}

.gallery-thumb img {
  width: 100%;
  height: 80px;
  object-fit: cover;
  border-radius: 8px 8px 0 0;
}

.gallery-thumb span {
  color: rgba(255,255,255,0.7);
  font-size: 11px;
  padding: 4px;
  text-overflow: ellipsis;
  overflow: hidden;
  white-space: nowrap;
  width: 100%;
  text-align: center;
}

.gallery-upload-btn {
  border-style: dashed;
  border-color: rgba(255,255,255,0.25);
}

.gallery-upload-btn:hover {
  border-color: #3b82f6;
}

.upload-icon {
  font-size: 36px;
  color: rgba(255,255,255,0.4);
  line-height: 1;
  margin-bottom: 4px;
}

.gallery-back-btn {
  background: transparent;
  border: 1px solid rgba(255,255,255,0.2);
  color: rgba(255,255,255,0.6);
  padding: 8px 20px;
  border-radius: 6px;
  cursor: pointer;
  font-size: 13px;
  margin-top: 8px;
}

.gallery-back-btn:hover {
  background: rgba(255,255,255,0.08);
  color: #fff;
}

/* ===== Image Mode ===== */
#map.image-mode {
  overflow: hidden;
  background: #1a1a2e;
  cursor: crosshair;
}

.image-wrapper {
  position: absolute;
  top: 0;
  left: 0;
  background-repeat: no-repeat;
  background-position: 0 0;
}

.image-marker-container {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
}

.image-line-canvas {
  position: absolute;
  top: 0;
  left: 0;
  pointer-events: none;
}

/* ===== Scale Calibration (Image Mode) ===== */
.image-mode-only {
  /* shown/hidden via JS */
}

.toolbar-hint {
  color: rgba(255,255,255,0.4);
  font-size: 10px;
  padding: 2px 6px;
}

.toolbar-hint.calibrated {
  color: #4ade80;
}

#scale-hint {
  position: fixed;
  top: 50px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 30;
  background: rgba(0,0,0,0.85);
  color: #fff;
  padding: 8px 16px;
  border-radius: 6px;
  font-size: 13px;
  pointer-events: none;
  white-space: nowrap;
}

.scale-point {
  position: absolute;
  width: 12px;
  height: 12px;
  background: #f43f5e;
  border: 2px solid #fff;
  border-radius: 50%;
  transform: translate(-50%, -50%);
  pointer-events: none;
  z-index: 5;
}

.scale-line-overlay {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 4;
}

#scale-dialog,
#slalom-dialog {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 100;
  background: rgba(0, 0, 0, 0.6);
  display: flex;
  align-items: center;
  justify-content: center;
}

.scale-dialog-content {
  background: rgba(30, 30, 30, 0.97);
  border-radius: 10px;
  padding: 20px 24px;
  color: #ddd;
  min-width: 280px;
  box-shadow: 0 4px 20px rgba(0,0,0,0.5);
}

.scale-dialog-content h3 {
  font-size: 15px;
  margin-bottom: 10px;
  color: #fff;
}

.scale-dialog-text {
  font-size: 13px;
  color: rgba(255,255,255,0.6);
  margin-bottom: 14px;
  line-height: 1.4;
}

.scale-input-row {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 16px;
}

.scale-input-row input {
  flex: 1;
  padding: 8px 10px;
  border: 1px solid rgba(255,255,255,0.2);
  border-radius: 6px;
  background: rgba(255,255,255,0.1);
  color: #fff;
  font-size: 15px;
  text-align: center;
}

.scale-input-row input:focus {
  outline: 2px solid #3b82f6;
}

.scale-unit {
  color: rgba(255,255,255,0.5);
  font-size: 14px;
  font-weight: 600;
}

.scale-dialog-buttons {
  display: flex;
  gap: 8px;
}

/* Toast Notifications */
#toast-container {
  position: fixed;
  bottom: 20px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 300;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  pointer-events: none;
}

.toast {
  padding: 10px 20px;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 500;
  color: #fff;
  box-shadow: 0 4px 16px rgba(0,0,0,0.4);
  animation: toast-in 0.25s ease;
  pointer-events: auto;
  max-width: 400px;
  text-align: center;
}

.toast-warning {
  background: rgba(217, 119, 6, 0.92);
}

.toast-error {
  background: rgba(220, 38, 38, 0.92);
}

.toast-info {
  background: rgba(37, 99, 235, 0.92);
}

.toast-fade-out {
  animation: toast-out 0.3s ease forwards;
}

@keyframes toast-in {
  from { opacity: 0; transform: translateY(12px); }
  to   { opacity: 1; transform: translateY(0); }
}

@keyframes toast-out {
  from { opacity: 1; transform: translateY(0); }
  to   { opacity: 0; transform: translateY(12px); }
}

/* ===== Placeable Element Markers ===== */
.cone-marker.resizable {
  overflow: visible;
}

.resize-handle {
  position: absolute;
  bottom: -4px;
  right: -4px;
  width: 10px;
  height: 10px;
  background: rgba(255, 255, 255, 0.8);
  border: 1px solid #666;
  border-radius: 2px;
  cursor: nwse-resize;
  z-index: 5;
  opacity: 0;
  transition: opacity 0.15s;
}

.cone-marker.resizable:hover .resize-handle,
.cone-marker.resizable.selected .resize-handle {
  opacity: 1;
}

.rotate-handle {
  position: absolute;
  top: -18px;
  left: 50%;
  transform: translateX(-50%);
  width: 12px;
  height: 12px;
  background: rgba(96, 165, 250, 0.9);
  border: 1px solid #3b82f6;
  border-radius: 50%;
  cursor: grab;
  z-index: 5;
  opacity: 0;
  transition: opacity 0.15s;
}

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

.cone-marker.resizable:hover .rotate-handle,
.cone-marker.resizable.selected .rotate-handle {
  opacity: 1;
}

.marker-trailer {
  width: 40px;
  height: 20px;
  background: rgba(120, 120, 140, 0.8);
  border: 2px solid #666;
  border-radius: 3px;
}

.marker-staging-grid {
  width: 80px;
  height: 50px;
  border: 2px dashed rgba(255, 200, 50, 0.8);
  border-radius: 4px;
  background: rgba(255, 200, 50, 0.1);
  color: rgba(255, 200, 50, 0.9);
  font-size: 11px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  letter-spacing: 1px;
}

/* Element icons in toolbar */
.element-icon {
  display: inline-block;
  width: 14px;
  height: 14px;
  flex-shrink: 0;
  font-size: 14px;
  text-align: center;
  line-height: 14px;
}

/* ===== Measurement Markers ===== */
.measurement-endpoint {
  width: 10px;
  height: 10px;
  background: #f472b6;
  border: 2px solid #be185d;
  border-radius: 50%;
  cursor: grab;
  box-shadow: 0 0 4px rgba(244, 114, 182, 0.6);
}
.measurement-endpoint:active {
  cursor: grabbing;
}

/* ===== Course Outline Markers ===== */
.outline-endpoint {
  width: 8px;
  height: 8px;
  background: #ffffff;
  border: 2px solid #a3a3a3;
  border-radius: 50%;
  cursor: grab;
  box-shadow: 0 0 4px rgba(255, 255, 255, 0.6);
}
.outline-endpoint:active {
  cursor: grabbing;
}
.outline-control {
  width: 10px;
  height: 10px;
  background: transparent;
  border: 2px solid #ffffff;
  border-radius: 50%;
  cursor: grab;
  box-shadow: 0 0 4px rgba(255, 255, 255, 0.6);
}
.outline-control:active {
  cursor: grabbing;
}

.measurement-label {
  position: absolute;
  z-index: 20;
  background: rgba(190, 24, 93, 0.9);
  color: #fff;
  padding: 3px 7px;
  border-radius: 4px;
  font-size: 12px;
  font-weight: 600;
  white-space: nowrap;
  cursor: pointer;
  transform: translate(-50%, -100%);
}

.measurement-line-svg {
  z-index: 1;
}

/* ===== Note Markers ===== */
.note-marker {
  width: 24px;
  height: 24px;
  background: #8b5cf6;
  border: 2px solid #6d28d9;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}

.note-marker:hover {
  transform: scale(1.15);
}

.note-marker.note-highlight {
  animation: note-pulse 0.5s ease 3;
}

@keyframes note-pulse {
  0%, 100% { transform: scale(1); box-shadow: 0 0 0 rgba(139, 92, 246, 0); }
  50% { transform: scale(1.3); box-shadow: 0 0 12px rgba(139, 92, 246, 0.7); }
}

.note-number {
  color: #fff;
  font-size: 11px;
  font-weight: 700;
  line-height: 1;
  pointer-events: none;
}

/* Note items in sidebar */
.note-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 8px;
  background: rgba(255,255,255,0.08);
  border-radius: 4px;
  font-size: 13px;
  cursor: pointer;
  margin-bottom: 4px;
}

.note-item:hover {
  background: rgba(139, 92, 246, 0.2);
}

.note-item-number {
  width: 20px;
  height: 20px;
  background: #8b5cf6;
  border-radius: 50%;
  color: #fff;
  font-size: 10px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.note-item-text {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: rgba(255,255,255,0.8);
}

/* ===== Obstacle Markers ===== */
.obstacle-marker {
  width: 22px;
  height: 22px;
  background: rgba(30, 30, 30, 0.85);
  border: 2px solid #ef4444;
  border-radius: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}

.obstacle-symbol {
  font-size: 14px;
  font-weight: 700;
  line-height: 1;
}

/* ===== Worker Station Markers ===== */
.worker-marker {
  width: 24px;
  height: 24px;
  background: #3b82f6;
  border: 2px solid #1d4ed8;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}

.worker-marker:hover {
  transform: scale(1.15);
}

.worker-marker.worker-highlight {
  animation: note-pulse 0.5s ease 3;
}

.worker-number {
  color: #fff;
  font-size: 11px;
  font-weight: 700;
  line-height: 1;
  pointer-events: none;
}

/* Worker items in sidebar */
.worker-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 8px;
  background: rgba(255,255,255,0.08);
  border-radius: 4px;
  font-size: 13px;
  cursor: pointer;
  margin-bottom: 4px;
}

.worker-item:hover {
  background: rgba(59, 130, 246, 0.2);
}

.worker-item-number {
  width: 20px;
  height: 20px;
  background: #3b82f6;
  border-radius: 50%;
  color: #fff;
  font-size: 10px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.worker-item-text {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: rgba(255,255,255,0.8);
}

/* ===== Layer Toggles ===== */
.layer-toggle {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 4px 0;
  font-size: 13px;
  color: rgba(255,255,255,0.8);
  cursor: pointer;
}

.layer-toggle input[type="checkbox"] {
  accent-color: #3b82f6;
  width: 14px;
  height: 14px;
}

/* ===== Venue Items ===== */
.venue-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 6px 8px;
  background: rgba(255,255,255,0.08);
  border-radius: 4px;
  font-size: 13px;
  margin-bottom: 4px;
}

.venue-item span {
  cursor: pointer;
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.venue-item span:hover {
  color: #3b82f6;
}

.venue-item button {
  background: none;
  border: none;
  color: #f87171;
  cursor: pointer;
  font-size: 16px;
  padding: 0 2px;
  margin-left: 6px;
}

.venue-item button:hover {
  color: #ef4444;
}

/* ===== Multi-Select ===== */
.multi-selected {
  filter: drop-shadow(0 0 4px rgba(59, 130, 246, 0.9)) !important;
  outline: 2px solid #3b82f6;
  outline-offset: 2px;
}

.selection-box {
  position: fixed;
  border: 2px dashed #3b82f6;
  background: rgba(59, 130, 246, 0.1);
  z-index: 50;
  pointer-events: none;
}

/* ===== Obstacle Type Selector ===== */
.obstacle-type-select {
  width: 100%;
  padding: 4px 6px;
  border: 1px solid rgba(255,255,255,0.2);
  border-radius: 4px;
  background: rgba(255,255,255,0.1);
  color: #ddd;
  font-size: 12px;
  cursor: pointer;
}

/* ===== Map Opacity Slider ===== */
#map-opacity-control {
  padding: 4px 6px;
}

#map-opacity {
  width: 100%;
  margin: 2px 0;
  accent-color: #3b82f6;
}

/* ===== Undo/Redo Buttons ===== */
.tool-btn:disabled {
  opacity: 0.35;
  cursor: not-allowed;
}

.tool-btn:disabled:hover {
  background: transparent;
}

/* Gate width control */
.gate-width-row {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 2px 6px;
}

#gate-width-input {
  width: 48px;
  padding: 2px 4px;
  border: 1px solid rgba(255,255,255,0.2);
  border-radius: 4px;
  background: rgba(255,255,255,0.1);
  color: #ddd;
  font-size: 12px;
  text-align: center;
  -moz-appearance: textfield;
}

#gate-width-input::-webkit-outer-spin-button,
#gate-width-input::-webkit-inner-spin-button {
  -webkit-appearance: none;
  margin: 0;
}

/* ===== Help Dialog ===== */
#help-dialog {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 100;
  background: rgba(0, 0, 0, 0.6);
  display: flex;
  align-items: center;
  justify-content: center;
}

.help-dialog-content {
  background: rgba(30, 30, 30, 0.97);
  border-radius: 10px;
  color: #ddd;
  width: 520px;
  max-height: 80vh;
  display: flex;
  flex-direction: column;
  box-shadow: 0 4px 20px rgba(0,0,0,0.5);
}

.help-dialog-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px 12px;
  border-bottom: 1px solid rgba(255,255,255,0.1);
}

.help-dialog-header h3 {
  font-size: 16px;
  color: #fff;
  margin: 0;
}

.help-close-btn {
  background: none;
  border: none;
  color: rgba(255,255,255,0.5);
  font-size: 22px;
  cursor: pointer;
  padding: 0 4px;
  line-height: 1;
}

.help-close-btn:hover {
  color: #fff;
}

.help-dialog-body {
  padding: 16px 20px 20px;
  overflow-y: auto;
  font-size: 13px;
  line-height: 1.55;
}

.help-dialog-body h4 {
  color: #fff;
  font-size: 13px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin: 16px 0 6px;
}

.help-dialog-body h4:first-child {
  margin-top: 0;
}

.help-dialog-body p {
  color: rgba(255,255,255,0.7);
  margin: 0 0 6px;
}

.help-dialog-body kbd {
  background: rgba(255,255,255,0.12);
  border: 1px solid rgba(255,255,255,0.2);
  border-radius: 3px;
  padding: 1px 5px;
  font-size: 11px;
  font-family: inherit;
  color: #ddd;
}

.help-shortcuts {
  width: 100%;
  border-collapse: collapse;
}

.help-shortcuts td {
  padding: 3px 8px 3px 0;
  color: rgba(255,255,255,0.7);
  font-size: 12px;
}

.help-shortcuts td:first-child {
  white-space: nowrap;
  width: 100px;
}

/* ===== Auth Gate ===== */
#auth-gate {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 500;
  background: rgba(15, 15, 20, 0.98);
  display: flex;
  align-items: center;
  justify-content: center;
}

.auth-box {
  text-align: center;
  max-width: 320px;
  padding: 40px;
}

.auth-title {
  color: #fff;
  font-size: 22px;
  font-weight: 700;
  margin-bottom: 6px;
}

.auth-subtitle {
  color: rgba(255,255,255,0.45);
  font-size: 14px;
  margin-bottom: 24px;
}

#auth-input {
  width: 100%;
  padding: 10px 14px;
  border: 2px solid rgba(255,255,255,0.15);
  border-radius: 8px;
  background: rgba(255,255,255,0.07);
  color: #fff;
  font-size: 16px;
  text-align: center;
  letter-spacing: 2px;
  margin-bottom: 12px;
}

#auth-input:focus {
  outline: none;
  border-color: #3b82f6;
}

#auth-submit {
  width: 100%;
  padding: 10px;
  border: none;
  border-radius: 8px;
  background: #3b82f6;
  color: #fff;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
}

#auth-submit:hover {
  background: #2563eb;
}

.auth-error {
  color: #f87171;
  font-size: 13px;
  margin-top: 12px;
}

/* Utility */
.hidden {
  display: none !important;
}
