/* ==========================================================================
   Route Planner Pro - Mobile-first full-viewport map with bottom sheet
   ========================================================================== */

/* --------------------------------------------------------------------------
   App Container - full viewport
   -------------------------------------------------------------------------- */
#app-container {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 10;
}

/* Hide footer, fullscreen button, and zoom controls on the app page */
footer, .cookie-banner, .house-ad, .map-fullscreen-btn,
.leaflet-control-zoom {
  display: none !important;
}

/* Compact header for app page */
header {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 900;
}

#app-container {
  top: 73px;
}

main {
  padding: 0 !important;
  margin: 0 !important;
  max-width: none !important;
}

#map {
  width: 100%;
  height: 100%;
}

/* --------------------------------------------------------------------------
   Auth / Subscription Overlays
   -------------------------------------------------------------------------- */
.auth-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.6);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1500;
  padding: 20px;
}

.auth-card {
  background: var(--card, #fff);
  border-radius: 16px;
  padding: 40px 32px;
  max-width: 400px;
  width: 100%;
  text-align: center;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
}

.auth-card h2 {
  font-size: 24px;
  margin: 0 0 12px;
  color: var(--text, #0f172a);
}

.auth-card p {
  color: var(--text-muted, #6b7280);
  margin: 0 0 8px;
  font-size: 15px;
  line-height: 1.5;
}

.auth-price {
  font-weight: 700;
  color: var(--primary, #2563eb) !important;
  font-size: 18px !important;
  margin: 16px 0 24px !important;
}

.btn-google {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  padding: 14px 28px;
  background: #fff;
  color: #333;
  border: 1px solid #ddd;
  border-radius: 8px;
  font-size: 16px;
  font-weight: 600;
  cursor: pointer;
  width: 100%;
  justify-content: center;
  transition: box-shadow 0.2s;
}

.btn-google:hover {
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
}

.btn-trial {
  display: block;
  width: 100%;
  padding: 14px 28px;
  background: var(--primary, #2563eb);
  color: #fff;
  border: none;
  border-radius: 8px;
  font-size: 16px;
  font-weight: 600;
  cursor: pointer;
  transition: opacity 0.2s;
}

.btn-trial:hover {
  opacity: 0.9;
}

.btn-link {
  background: none;
  border: none;
  color: var(--text-muted, #6b7280);
  font-size: 14px;
  cursor: pointer;
  padding: 12px;
  text-decoration: underline;
}

.auth-note {
  font-size: 13px !important;
  margin-top: 16px !important;
}

.trial-banner {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 1100;
  background: #d97706;
  color: #fff;
  text-align: center;
  font-size: 13px;
  padding: 8px 16px;
  line-height: 1.4;
}

/* --------------------------------------------------------------------------
   Bottom Sheet
   -------------------------------------------------------------------------- */
.bottom-sheet {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  background: var(--card, #fff);
  border-radius: 16px 16px 0 0;
  box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.15);
  z-index: 1100;
  max-height: 85vh;
  transition: transform 0.3s ease;
  display: flex;
  flex-direction: column;
}

.sheet-handle {
  display: flex;
  justify-content: center;
  padding: 10px 0 4px;
  cursor: grab;
  touch-action: none;
}

.handle-bar {
  width: 40px;
  height: 4px;
  background: var(--border, rgba(0, 0, 0, 0.15));
  border-radius: 2px;
}

.sheet-summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 4px 56px 12px 16px;
  font-size: 14px;
  font-weight: 600;
  color: var(--text, #0f172a);
}

.btn-sheet-toggle {
  background: none;
  border: none;
  padding: 4px;
  cursor: pointer;
  color: var(--text-muted, #6b7280);
  transition: transform 0.3s;
}

.bottom-sheet.expanded .btn-sheet-toggle {
  transform: rotate(180deg);
}

/* --------------------------------------------------------------------------
   Sheet Panels
   -------------------------------------------------------------------------- */
.sheet-panel {
  padding: 0 16px 16px;
  overflow-y: auto;
  max-height: calc(85vh - 60px);
}

.input-group {
  margin-bottom: 12px;
}

.input-group label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-muted, #6b7280);
  margin-bottom: 4px;
}

.input-group .optional {
  font-weight: 400;
  color: var(--text-muted, #6b7280);
  opacity: 0.7;
}

.input-group input,
.input-group textarea {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--border, rgba(0, 0, 0, 0.1));
  border-radius: 8px;
  font-size: 15px;
  background: var(--bg, #fff);
  color: var(--text, #0f172a);
  box-sizing: border-box;
}

.input-group textarea {
  resize: vertical;
  min-height: 80px;
  font-family: inherit;
}

.input-group input:focus,
.input-group textarea:focus {
  outline: none;
  border-color: var(--primary, #2563eb);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.15);
}

/* --------------------------------------------------------------------------
   Upload Area
   -------------------------------------------------------------------------- */
.drop-zone {
  position: relative;
}

.drop-zone.drag-over textarea {
  border-color: var(--primary, #2563eb);
  border-style: dashed;
  background: rgba(37, 99, 235, 0.04);
}

.upload-area {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-top: 6px;
}

.btn-upload {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 6px 12px;
  background: none;
  border: 1px solid var(--border, rgba(0, 0, 0, 0.15));
  border-radius: 6px;
  font-size: 12px;
  color: var(--text-muted, #6b7280);
  cursor: pointer;
  transition: border-color 0.2s, color 0.2s;
}

.btn-upload:hover {
  border-color: var(--primary, #2563eb);
  color: var(--primary, #2563eb);
}

.btn-template {
  font-size: 12px;
  color: var(--text-muted, #6b7280);
  text-decoration: none;
  border-bottom: 1px dashed var(--border, rgba(0, 0, 0, 0.15));
}

.btn-template:hover {
  color: var(--primary, #2563eb);
  border-bottom-color: var(--primary, #2563eb);
}

/* --------------------------------------------------------------------------
   Column Mapping Modal
   -------------------------------------------------------------------------- */
.mapping-modal {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.6);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1300;
  padding: 20px;
}

.mapping-card {
  background: var(--card, #fff);
  border-radius: 16px;
  padding: 24px;
  max-width: 640px;
  width: 100%;
  max-height: 85vh;
  overflow-y: auto;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
}

.mapping-card h3 {
  font-size: 18px;
  margin: 0 0 4px;
  color: var(--text, #0f172a);
}

.mapping-hint {
  font-size: 13px;
  color: var(--text-muted, #6b7280);
  margin: 0 0 16px;
}

.mapping-table-wrap {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  margin-bottom: 12px;
}

.mapping-table {
  width: 100%;
  min-width: 400px;
  border-collapse: collapse;
  font-size: 13px;
}

.mapping-table th {
  padding: 4px 8px 8px;
  text-align: left;
  vertical-align: top;
}

.mapping-table td {
  padding: 6px 8px;
  border-top: 1px solid var(--border, rgba(0, 0, 0, 0.08));
  color: var(--text-muted, #6b7280);
  max-width: 180px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.mapping-select {
  width: 100%;
  padding: 6px 8px;
  border: 1px solid var(--border, rgba(0, 0, 0, 0.15));
  border-radius: 6px;
  font-size: 12px;
  background: var(--bg, #fff);
  color: var(--text, #0f172a);
  margin-bottom: 4px;
}

.mapping-col-header {
  font-size: 11px;
  color: var(--text-muted, #6b7280);
  font-weight: 400;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 140px;
}

.mapping-row-count {
  font-size: 12px;
  color: var(--text-muted, #6b7280);
  margin-bottom: 12px;
}

.mapping-actions {
  display: flex;
  gap: 8px;
}

.button-row {
  display: flex;
  gap: 8px;
  margin-top: 12px;
}

.btn {
  padding: 12px 20px;
  border: none;
  border-radius: 8px;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  transition: opacity 0.2s;
}

.btn:hover {
  opacity: 0.9;
}

.btn-primary {
  background: var(--success, #10b981);
  color: #fff;
  flex: 1;
}

.btn-secondary {
  background: var(--bg-secondary, #f4f7fb);
  color: var(--text, #0f172a);
  border: 1px solid var(--border, rgba(0, 0, 0, 0.1));
}

.btn-demo {
  display: block;
  width: 100%;
  padding: 10px;
  margin-top: 8px;
  background: none;
  border: 1px dashed var(--border, rgba(0, 0, 0, 0.15));
  border-radius: 8px;
  color: var(--text-muted, #6b7280);
  font-size: 13px;
  cursor: pointer;
  transition: border-color 0.2s;
}

.btn-demo:hover {
  border-color: var(--primary, #2563eb);
  color: var(--primary, #2563eb);
}

/* --------------------------------------------------------------------------
   Postcode Suggestions
   -------------------------------------------------------------------------- */
.input-with-suggestions {
  position: relative;
}

.suggestions {
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  background: var(--card, #fff);
  border: 1px solid var(--border, rgba(0, 0, 0, 0.1));
  border-top: none;
  border-radius: 0 0 8px 8px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
  max-height: 200px;
  overflow-y: auto;
  z-index: 600;
  display: none;
}

.suggestions.show {
  display: block;
}

.suggestions .item {
  padding: 10px 12px;
  cursor: pointer;
  font-size: 14px;
  color: var(--text, #0f172a);
  border-bottom: 1px solid var(--border, rgba(0, 0, 0, 0.05));
}

.suggestions .item:last-child {
  border-bottom: none;
}

.suggestions .item:hover {
  background: var(--bg-secondary, #f4f7fb);
}

/* --------------------------------------------------------------------------
   Stop List
   -------------------------------------------------------------------------- */
.stops-header {
  margin-bottom: 12px;
}

#route-stats {
  font-size: 14px;
  line-height: 1.6;
  margin-bottom: 8px;
}

#route-stats strong {
  color: var(--primary, #2563eb);
}

.stops-actions {
  display: flex;
  gap: 8px;
}

.btn-nav {
  background: var(--primary, #2563eb);
}

.stop-list {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.stop-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  background: var(--bg-secondary, #f4f7fb);
  border-radius: 8px;
  font-size: 14px;
  transition: background 0.15s;
}

.stop-item.current {
  background: rgba(37, 99, 235, 0.1);
  border: 2px solid var(--primary, #2563eb);
}

.stop-item.completed {
  opacity: 0.5;
}

.stop-number {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: 700;
  color: #fff;
  flex-shrink: 0;
}

.stop-number.start { background: #22c55e; }
.stop-number.end { background: #ef4444; }
.stop-number.stop { background: #3b82f6; }
.stop-number.done { background: #9ca3af; }

.stop-info {
  flex: 1;
  min-width: 0;
}

.stop-postcode {
  font-weight: 500;
  display: block;
}

.stop-label {
  display: block;
  font-size: 12px;
  color: var(--text-muted, #6b7280);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-top: 2px;
}

.stop-dup-note {
  display: inline-block;
  font-size: 11px;
  color: #f59e0b;
  margin-top: 2px;
}

.stop-detail {
  display: none;
  font-size: 13px;
  color: var(--text-muted, #6b7280);
  line-height: 1.5;
  margin-top: 6px;
  padding-top: 6px;
  border-top: 1px solid var(--border, rgba(0, 0, 0, 0.08));
  white-space: pre-line;
}

.stop-detail-notes {
  font-style: italic;
  opacity: 0.8;
}

.stop-item.expandable {
  cursor: pointer;
}

.stop-item.expanded .stop-detail {
  display: block;
}

.stop-item.expanded .stop-label {
  display: none;
}

.btn-undo {
  padding: 4px 10px;
  font-size: 11px;
  background: none;
  border: 1px solid var(--border, rgba(0, 0, 0, 0.15));
  border-radius: 4px;
  color: var(--text-muted, #6b7280);
  cursor: pointer;
  flex-shrink: 0;
  transition: border-color 0.2s, color 0.2s;
}

.btn-undo:hover {
  border-color: var(--primary, #2563eb);
  color: var(--primary, #2563eb);
}

.stop-distance {
  font-size: 12px;
  color: var(--text-muted, #6b7280);
  white-space: nowrap;
  flex-shrink: 0;
}

/* --------------------------------------------------------------------------
   Failed Stops & Inline Editing
   -------------------------------------------------------------------------- */
.stop-item.failed {
  background: rgba(245, 158, 11, 0.08);
  border: 1px dashed #f59e0b;
}

.stop-item.failed .stop-postcode {
  text-decoration: line-through;
  opacity: 0.6;
}

.stop-failed-msg {
  display: block;
  font-size: 11px;
  color: #ef4444;
  margin-top: 2px;
}

.stop-number.failed {
  background: #f59e0b;
}

.btn-fix {
  padding: 4px 10px;
  font-size: 11px;
  background: none;
  border: 1px solid #f59e0b;
  border-radius: 4px;
  color: #f59e0b;
  cursor: pointer;
  flex-shrink: 0;
}

.btn-fix:hover {
  background: #f59e0b;
  color: #fff;
}

.btn-remove-stop {
  padding: 2px 7px;
  font-size: 14px;
  background: none;
  border: none;
  color: var(--text-muted, #6b7280);
  cursor: pointer;
  flex-shrink: 0;
  opacity: 0.4;
  transition: opacity 0.2s, color 0.2s;
  line-height: 1;
}

.btn-remove-stop:hover {
  opacity: 1;
  color: #ef4444;
}

.stop-edit-inline {
  display: flex;
  align-items: center;
  gap: 6px;
  width: 100%;
  flex-wrap: wrap;
}

.stop-edit-input {
  flex: 1;
  min-width: 120px;
  padding: 8px 10px;
  border: 1px solid var(--border, rgba(0, 0, 0, 0.15));
  border-radius: 6px;
  font-size: 14px;
  background: var(--bg, #fff);
  color: var(--text, #0f172a);
}

.stop-edit-input:focus {
  outline: none;
  border-color: var(--primary, #2563eb);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.15);
}

.stop-edit-error {
  font-size: 12px;
  color: #ef4444;
  width: 100%;
}

.btn-sm {
  padding: 6px 12px;
  font-size: 12px;
}

.stop-confirm-remove {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  color: var(--text-muted, #6b7280);
  padding: 4px 0;
}

.stop-edit-row {
  padding: 8px 12px;
}

.reoptimise-banner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 14px;
  margin-bottom: 10px;
  background: rgba(37, 99, 235, 0.08);
  border: 1px solid rgba(37, 99, 235, 0.2);
  border-radius: 8px;
  font-size: 13px;
  font-weight: 500;
  color: var(--primary, #2563eb);
}

.btn-add-stop {
  display: block;
  width: 100%;
  padding: 10px;
  margin-top: 6px;
  background: none;
  border: 1px dashed var(--border, rgba(0, 0, 0, 0.15));
  border-radius: 8px;
  color: var(--text-muted, #6b7280);
  font-size: 13px;
  cursor: pointer;
  transition: border-color 0.2s, color 0.2s;
}

.btn-add-stop:hover {
  border-color: var(--primary, #2563eb);
  color: var(--primary, #2563eb);
}

/* --------------------------------------------------------------------------
   Saved Routes
   -------------------------------------------------------------------------- */
.saved-routes-wrap {
  position: relative;
}

.saved-routes-dropdown {
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  min-width: 240px;
  background: var(--card, #fff);
  border: 1px solid var(--border, rgba(0, 0, 0, 0.1));
  border-radius: 8px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.15);
  z-index: 600;
  max-height: 300px;
  overflow-y: auto;
  margin-top: 4px;
}

.saved-routes-loading,
.saved-routes-empty {
  padding: 16px;
  font-size: 13px;
  color: var(--text-muted, #6b7280);
  text-align: center;
}

.saved-route-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 14px;
  border-bottom: 1px solid var(--border, rgba(0, 0, 0, 0.05));
  cursor: pointer;
  transition: background 0.15s;
}

.saved-route-item:last-child {
  border-bottom: none;
}

.saved-route-item:hover {
  background: var(--bg-secondary, #f4f7fb);
}

.saved-route-info {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
  flex: 1;
}

.saved-route-name {
  font-size: 14px;
  font-weight: 500;
  color: var(--text, #0f172a);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.saved-route-meta {
  font-size: 11px;
  color: var(--text-muted, #6b7280);
}

.saved-route-delete {
  background: none;
  border: none;
  font-size: 16px;
  color: var(--text-muted, #6b7280);
  cursor: pointer;
  padding: 4px 8px;
  opacity: 0.4;
  transition: opacity 0.2s, color 0.2s;
  flex-shrink: 0;
}

.saved-route-delete:hover {
  opacity: 1;
  color: #ef4444;
}

.save-route-area {
  margin-top: 8px;
  padding-top: 8px;
  border-top: 1px solid var(--border, rgba(0, 0, 0, 0.08));
}

.btn-save-route {
  display: block;
  width: 100%;
  padding: 10px;
  background: none;
  border: 1px solid var(--border, rgba(0, 0, 0, 0.15));
  border-radius: 8px;
  color: var(--text-muted, #6b7280);
  font-size: 13px;
  cursor: pointer;
  transition: border-color 0.2s, color 0.2s;
}

.btn-save-route:hover {
  border-color: var(--primary, #2563eb);
  color: var(--primary, #2563eb);
}

.save-route-inline {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}

/* --------------------------------------------------------------------------
   Drag Reorder
   -------------------------------------------------------------------------- */
.stop-item[data-route-idx] {
  touch-action: pan-y;
  user-select: none;
  -webkit-user-select: none;
}

.stop-item.dragging {
  opacity: 0.9;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.2);
  border-radius: 8px;
  background: var(--card, #fff);
  pointer-events: none;
}

.stop-drag-placeholder {
  background: rgba(37, 99, 235, 0.08);
  border: 2px dashed rgba(37, 99, 235, 0.3);
  border-radius: 8px;
  margin: 2px 0;
}

/* --------------------------------------------------------------------------
   Navigation Card
   -------------------------------------------------------------------------- */
.nav-card {
  background: var(--primary, #2563eb);
  color: #fff;
  border-radius: 12px;
  padding: 16px;
  margin-bottom: 12px;
}

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

.nav-card-stop {
  font-size: 13px;
  opacity: 0.8;
}

.nav-card-postcode {
  font-size: 24px;
  font-weight: 700;
  margin-bottom: 4px;
}

.nav-card-label {
  font-size: 14px;
  opacity: 0.85;
  margin-bottom: 6px;
  padding: 4px 0;
}

.nav-card-label::after {
  content: ' \25BE';
  font-size: 10px;
  opacity: 0.6;
}

.nav-card-label.expanded::after {
  content: ' \25B4';
}

.nav-card-fulltext {
  font-size: 13px;
  opacity: 0.85;
  margin-bottom: 8px;
  padding: 8px;
  background: rgba(255, 255, 255, 0.1);
  border-radius: 6px;
  white-space: pre-line;
  line-height: 1.5;
  max-height: 120px;
  overflow-y: auto;
}

.nav-card-detail {
  font-size: 13px;
  opacity: 0.8;
  margin-bottom: 12px;
}

.nav-card-actions {
  display: flex;
  gap: 8px;
}

.btn-navigate {
  flex: 1;
  padding: 14px;
  background: #fff;
  color: var(--primary, #2563eb);
  border: none;
  border-radius: 8px;
  font-size: 16px;
  font-weight: 700;
  cursor: pointer;
}

.btn-done {
  flex: 1;
  padding: 14px;
  background: #22c55e;
  color: #fff;
  border: none;
  border-radius: 8px;
  font-size: 16px;
  font-weight: 700;
  cursor: pointer;
}

.btn-skip {
  padding: 14px 16px;
  background: rgba(255, 255, 255, 0.15);
  color: #fff;
  border: none;
  border-radius: 8px;
  font-size: 14px;
  cursor: pointer;
}

/* --------------------------------------------------------------------------
   Navigation Progress
   -------------------------------------------------------------------------- */
#nav-progress {
  margin-bottom: 12px;
}

.progress-bar-bg {
  height: 6px;
  background: var(--border, rgba(0, 0, 0, 0.1));
  border-radius: 3px;
  overflow: hidden;
  margin-bottom: 6px;
}

.progress-bar-fill {
  height: 100%;
  background: #22c55e;
  border-radius: 3px;
  transition: width 0.3s;
}

.progress-text {
  font-size: 12px;
  color: var(--text-muted, #6b7280);
}

.nav-actions {
  margin-top: 16px;
  padding-top: 12px;
  border-top: 1px solid var(--border, rgba(0, 0, 0, 0.1));
}

/* --------------------------------------------------------------------------
   Share Section
   -------------------------------------------------------------------------- */
.share-section {
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px solid var(--border, rgba(0, 0, 0, 0.1));
}

.share-buttons {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.btn-share {
  padding: 8px 14px;
  border: 1px solid var(--border, rgba(0, 0, 0, 0.1));
  border-radius: 6px;
  background: var(--bg, #fff);
  color: var(--text, #0f172a);
  font-size: 13px;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 6px;
  transition: background 0.15s;
}

.btn-share:hover {
  background: var(--bg-secondary, #f4f7fb);
}

/* --------------------------------------------------------------------------
   Completion Card
   -------------------------------------------------------------------------- */
.completion-card {
  background: #22c55e;
  color: #fff;
  border-radius: 12px;
  padding: 24px;
  text-align: center;
  margin-bottom: 12px;
}

.completion-card h3 {
  font-size: 20px;
  margin: 0 0 8px;
}

.completion-stats {
  display: flex;
  justify-content: center;
  gap: 24px;
  margin-top: 12px;
}

.completion-stat {
  text-align: center;
}

.completion-stat-value {
  font-size: 24px;
  font-weight: 700;
}

.completion-stat-label {
  font-size: 12px;
  opacity: 0.8;
}

/* --------------------------------------------------------------------------
   User Menu
   -------------------------------------------------------------------------- */
.user-menu {
  position: fixed;
  top: 85px;
  right: 12px;
  z-index: 1200;
}

.btn-user {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--primary, #2563eb);
  color: #fff;
  border: 2px solid #fff;
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
}

.user-dropdown {
  position: absolute;
  top: 44px;
  right: 0;
  background: var(--card, #fff);
  border-radius: 8px;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.15);
  min-width: 200px;
  overflow: hidden;
}

.user-dropdown-name {
  padding: 12px 16px 4px;
  font-weight: 600;
  font-size: 14px;
  color: var(--text, #0f172a);
}

.user-dropdown-status {
  padding: 0 16px 12px;
  font-size: 12px;
  color: var(--text-muted, #6b7280);
  border-bottom: 1px solid var(--border, rgba(0, 0, 0, 0.1));
}

.user-dropdown-item {
  display: block;
  padding: 10px 16px;
  font-size: 14px;
  color: var(--text, #0f172a);
  text-decoration: none;
  cursor: pointer;
}

.user-dropdown-item:hover {
  background: var(--bg-secondary, #f4f7fb);
}

/* --------------------------------------------------------------------------
   Mobile mapping modal
   -------------------------------------------------------------------------- */
@media (max-width: 767px) {
  .mapping-card {
    max-height: 90vh;
    border-radius: 16px 16px 0 0;
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    margin: 0;
  }

  .mapping-modal {
    align-items: flex-end;
    padding: 0;
  }

  .btn-upload {
    flex: 1;
  }
}

/* --------------------------------------------------------------------------
   Desktop layout - side panel instead of bottom sheet
   -------------------------------------------------------------------------- */
@media (min-width: 768px) {
  .bottom-sheet {
    position: fixed;
    top: 73px;
    left: 0;
    bottom: 0;
    right: auto;
    width: 400px;
    max-height: 100vh;
    border-radius: 0;
    box-shadow: 4px 0 20px rgba(0, 0, 0, 0.1);
    transform: none !important;
  }

  .sheet-handle {
    display: none;
  }

  .sheet-summary {
    padding: 16px 20px 12px;
    border-bottom: 1px solid var(--border, rgba(0, 0, 0, 0.1));
  }

  .btn-sheet-toggle {
    display: none;
  }

  .sheet-panel {
    padding: 0 20px 20px;
    max-height: calc(100vh - 60px);
  }

  #map {
    margin-left: 400px;
  }

  .user-menu {
    right: 16px;
    top: 85px;
  }

  .auth-overlay {
    margin-left: 400px;
  }
}

/* --------------------------------------------------------------------------
   Loading spinner
   -------------------------------------------------------------------------- */
.loading {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--primary, #2563eb);
  font-size: 14px;
  padding: 12px 0;
}

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

.spinner {
  width: 16px;
  height: 16px;
  border: 2px solid var(--border, rgba(0, 0, 0, 0.1));
  border-top-color: var(--primary, #2563eb);
  border-radius: 50%;
  animation: spin 0.6s linear infinite;
}

/* --------------------------------------------------------------------------
   Welcome Modal
   -------------------------------------------------------------------------- */
.welcome-modal {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.6);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1600;
  padding: 20px;
}

.welcome-card {
  background: var(--card, #fff);
  border-radius: 16px;
  padding: 32px 28px;
  max-width: 420px;
  width: 100%;
  text-align: center;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
}

.welcome-card h2 {
  font-size: 22px;
  margin: 0 0 8px;
  color: var(--text, #0f172a);
}

.welcome-subtitle {
  color: var(--text-muted, #6b7280);
  font-size: 14px;
  margin: 0 0 24px;
  line-height: 1.5;
}

.welcome-steps {
  text-align: left;
  display: flex;
  flex-direction: column;
  gap: 16px;
  margin-bottom: 28px;
}

.welcome-step {
  display: flex;
  align-items: flex-start;
  gap: 14px;
}

.welcome-step-number {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--primary, #2563eb);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  font-weight: 700;
  flex-shrink: 0;
}

.welcome-step div {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding-top: 4px;
}

.welcome-step strong {
  font-size: 15px;
  color: var(--text, #0f172a);
}

.welcome-step span {
  font-size: 13px;
  color: var(--text-muted, #6b7280);
  line-height: 1.4;
}

.welcome-demo-btn {
  width: 100%;
  padding: 14px;
  font-size: 16px;
}

.welcome-dismiss {
  display: block;
  width: 100%;
  margin-top: 8px;
  font-size: 13px;
}

/* Pulse animation for current nav marker */
@keyframes pulse {
  0%, 100% { transform: scale(1); opacity: 1; }
  50% { transform: scale(1.2); opacity: 0.8; }
}

.marker-current {
  animation: pulse 1.5s ease-in-out infinite;
}

/* --------------------------------------------------------------------------
   PWA Install Banner
   -------------------------------------------------------------------------- */
.pwa-install {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  background: var(--bg-card, #fff);
  border-top: 1px solid var(--border, #e2e8f0);
  padding: 12px 16px;
  display: flex;
  align-items: center;
  gap: 12px;
  z-index: 1000;
  box-shadow: 0 -2px 8px rgba(0,0,0,0.1);
  font-size: 0.9rem;
}

.pwa-install span {
  flex: 1;
}

.pwa-install .btn-sm {
  padding: 6px 16px;
  font-size: 0.85rem;
  white-space: nowrap;
}

.btn-pwa-dismiss {
  background: none;
  border: none;
  font-size: 1.4rem;
  color: var(--text-muted, #64748b);
  cursor: pointer;
  padding: 0 4px;
  line-height: 1;
}
