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

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

#map { position: absolute; inset: 0; }

.rounded-panel {
  position: absolute;
  background: rgba(255, 255, 255, 0.95);
  backdrop-filter: blur(6px);
  border-radius: 16px;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
  padding: 12px 14px;
  z-index: 10;
  display: flex;
  flex-direction: column;
  gap: 8px;
  font-size: 13px;
  max-width: 260px;
}

#top-controls {
  top: 16px; right: 16px;
  flex-direction: row; flex-wrap: wrap;
  gap: 6px; padding: 10px 12px;
}

#route-controls {
  bottom: 16px; left: 16px;
  max-height: calc(100vh - 120px);
  overflow-y: auto;
  width: 260px;
}

button {
  background: #4a6fa5; color: #fff; border: none;
  border-radius: 8px; padding: 7px 12px;
  font-size: 13px; cursor: pointer; transition: background .15s;
}
button:hover { background: #3b5a8a; }
button:disabled { background: #b0b0b0; cursor: not-allowed; }
button.active { background: #e67e22; }

#btn-delete-point.active { background: #c0392b; }

#btn-undo {
  background: #6b7280;
}
#btn-undo:hover:not(:disabled) { background: #4b5563; }
#btn-undo:disabled { background: #d1d5db; color: #9ca3af; cursor: not-allowed; }

#btn-clear-all { background: #8e3b3b; }
#btn-clear-all:hover { background: #6f2f2f; }

.button-row { display: flex; gap: 6px; }
.button-row button { flex: 1; padding: 7px 4px; font-size: 12px; }

.section {
  display: flex; flex-direction: column; gap: 6px;
  padding-bottom: 10px; border-bottom: 1px solid #e8e8e8;
}
.section:last-child { border-bottom: none; padding-bottom: 0; }
.section h3 {
  font-size: 11px; text-transform: uppercase;
  letter-spacing: .5px; color: #666; margin-bottom: 2px;
}

input[type="text"],
input[type="number"],
select {
  border: 1px solid #ccc; border-radius: 8px;
  padding: 6px 10px; font-size: 13px; width: 100%;
  background: #fff;
}
.inline-row { display: flex; gap: 6px; }
.inline-row input { flex: 2; }
.inline-row select { flex: 1; }

.pref-row { display: flex; align-items: center; gap: 8px; }
.pref-row label { font-size: 12px; color: #444; flex: 0 0 auto; }
.pref-row select { flex: 1; }

.time-row { align-items: center; }
.time-row input { min-width: 0; }
.time-row .times {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 2px;
  color: #888;
  font-weight: 600;
  font-size: 14px;
  flex: 0 0 auto;
}

.distance-display {
  font-weight: 600; color: #2c3e50; font-size: 14px;
  padding: 4px 0;
}

.hint { font-size: 11px; color: #888; line-height: 1.4; }

.checkbox-label {
  display: flex; align-items: center; gap: 6px;
  font-size: 12px; color: #444; cursor: pointer;
}
.checkbox-label input { width: auto; accent-color: #4a6fa5; }

.status-section { padding-top: 4px; }
.status {
  font-size: 11px; color: #666; line-height: 1.4;
  min-height: 1.2em;
}

.address-wrap { position: relative; }
.suggestions {
  display: none;
  position: absolute;
  top: 100%; left: 0; right: 0;
  background: #fff;
  border: 1px solid #ddd;
  border-radius: 8px;
  box-shadow: 0 6px 16px rgba(0,0,0,.15);
  max-height: 200px; overflow-y: auto;
  z-index: 100;
  margin-top: 2px;
}
.suggestion-item {
  padding: 6px 10px; cursor: pointer;
  font-size: 12px; line-height: 1.3;
  border-bottom: 1px solid #f0f0f0;
}
.suggestion-item:last-child { border-bottom: none; }
.suggestion-item:hover { background: #f0f4fa; }
.suggestion-item.muted { color: #999; cursor: default; }

#route-controls::-webkit-scrollbar { width: 6px; }
#route-controls::-webkit-scrollbar-thumb { background: #ccc; border-radius: 3px; }

/* Save modal — mirrors the gpx uploader success card */
.modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  background: rgba(0, 0, 0, 0.45);
}
.modal-overlay[hidden] { display: none; }

.modal-card {
  width: 100%;
  max-width: 380px;
  max-height: calc(100vh - 40px);
  overflow-y: auto;
  padding: 26px 24px;
  border-radius: 16px;
  background: #fff;
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.3);
  text-align: center;
}

.modal-title { font-size: 1.15rem; font-weight: 600; margin-bottom: 8px; }

.modal-name {
  color: #71717a;
  margin-bottom: 22px;
  word-break: break-word;
}

.modal-code-label {
  color: #71717a;
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin-bottom: 7px;
}

.modal-code {
  display: inline-block;
  padding: 12px 20px;
  border-radius: 12px;
  background: linear-gradient(135deg, #f4e8fa, #ece9ff);
  color: #39208f;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  font-size: 2rem;
  font-weight: 700;
  letter-spacing: 0.14em;
  margin-bottom: 18px;
}

.modal-note { color: #71717a; font-size: 0.85rem; line-height: 1.5; }

.modal-note.error {
  padding: 12px 14px;
  border-radius: 12px;
  background: #fef2f2;
  color: #991b1b;
  border: 1px solid #fecaca;
  text-align: left;
}

.modal-actions { display: flex; gap: 8px; justify-content: center; margin-top: 22px; }
.modal-actions button { flex: 1; }
.modal-actions button.secondary { background: #e5e7eb; color: #374151; }
.modal-actions button.secondary:hover { background: #d1d5db; }