/* ===========================
   BASE
   =========================== */
html,
body {
  height: 100%;
  margin: 0;
  padding: 0;
  font-family:
    "Inter",
    -apple-system,
    BlinkMacSystemFont,
    "Segoe UI",
    sans-serif;
  font-size: 14px;
  color: #202124;
}

#map {
  position: absolute;
  inset: 0;
  z-index: 0;
}

.hidden {
  display: none !important;
}

/* ===========================
   FLOATING SIDEBAR
   =========================== */
/* Desktop sidebar collapse toggle */
.sidebar-toggle {
  display: flex;
  position: absolute;
  top: 50%;
  right: 430px;
  transform: translateY(-50%);
  z-index: 16;
  width: 28px;
  height: 56px;
  border: 1px solid rgba(0, 0, 0, 0.06);
  border-right: none;
  border-radius: 10px 0 0 10px;
  background: #fff;
  box-shadow: -2px 2px 8px rgba(0, 0, 0, 0.06);
  cursor: pointer;
  padding: 0;
  align-items: center;
  justify-content: center;
  color: #9aa0a6;
  transition:
    right 0.35s cubic-bezier(0.25, 0.1, 0.25, 1),
    color 0.12s;
}

.sidebar-toggle:hover {
  color: #202124;
}

.sidebar-toggle svg {
  transition: transform 0.35s cubic-bezier(0.25, 0.1, 0.25, 1);
}

#sidebar {
  position: absolute;
  top: 50%;
  right: 10px;
  transform: translateY(-50%);
  height: 80vh;
  width: 420px;
  z-index: 15;
  background: #fff;
  border-radius: 18px;
  box-shadow:
    0 4px 12px rgba(0, 0, 0, 0.06),
    0 20px 50px rgba(0, 0, 0, 0.1);
  border: 1px solid rgba(0, 0, 0, 0.06);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  transition: transform 0.35s cubic-bezier(0.25, 0.1, 0.25, 1);
}

/* Collapsed state */
#sidebar.collapsed {
  transform: translateY(-50%) translateX(calc(100% + 10px));
}

.sidebar-toggle.sidebar-collapsed {
  right: 0;
}

.sidebar-toggle.sidebar-collapsed svg {
  transform: rotate(180deg);
}

/* ===========================
   HEADER
   =========================== */
.sidebar-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 18px 0;
  margin: 0;
  flex-shrink: 0;
}

a.header-left {
  display: flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  transition: opacity 0.15s;
}

a.header-left:hover {
  opacity: 0.8;
}

.logo {
  font-size: 18px;
  font-weight: 800;
  color: #163300;
  letter-spacing: -0.04em;
  line-height: 1;
}

.logo span {
  color: #9fe870;
}

.header-subtitle {
  font-size: 12px;
  font-weight: 500;
  color: #9aa0a6;
  letter-spacing: -0.01em;
}

.header-actions {
  display: flex;
  gap: 6px;
}

#theme-toggle {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 30px;
  height: 30px;
  border: none;
  border-radius: 8px;
  background: #f1f3f4;
  cursor: pointer;
  color: #5f6368;
  transition: all 0.15s;
  flex-shrink: 0;
}

#theme-toggle:hover {
  background: #e8eaed;
  color: #202124;
}

/* ===========================
   TAB BAR
   =========================== */
.sidebar-tabs {
  display: flex;
  gap: 4px;
  padding: 10px 18px 12px;
  flex-shrink: 0;
}

.tab-btn {
  display: flex;
  align-items: center;
  gap: 5px;
  padding: 7px 16px;
  border-radius: 8px;
  border: none;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  font-family: inherit;
  transition: all 0.15s;
  background: transparent;
  color: #5f6368;
}

.tab-btn:hover {
  background: #f1f3f4;
}

.tab-btn.active {
  background: #2f5711;
  color: #fff;
}

.tab-btn.active:hover {
  background: #244a0d;
}

/* ===========================
   UPLOAD SECTION
   =========================== */
#upload-section {
  padding: 4px 18px 18px;
  flex: 1;
  border-bottom: 1px solid #f0f0f0;
  overflow-y: auto;
}

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

.field-label {
  display: block;
  font-size: 12px;
  font-weight: 650;
  color: #5f6368;
  margin-bottom: 6px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.field-label-row {
  display: flex;
  align-items: center;
  gap: 3px;
  margin-bottom: 6px;
}

.field-label-row .field-label {
  margin-bottom: 0;
}

.required {
  color: #ea4335;
  font-weight: 700;
  font-size: 12px;
}

/* Select wrapper */
.select-wrap {
  position: relative;
}

.select-wrap select {
  width: 100%;
  padding: 10px 34px 10px 12px;
  border-radius: 12px;
  border: 1.5px solid #e0e0e0;
  background: #fff;
  font-size: 13px;
  font-weight: 500;
  color: #202124;
  appearance: none;
  cursor: pointer;
  outline: none;
  font-family: inherit;
  transition:
    border-color 0.15s,
    box-shadow 0.15s;
}

.select-wrap select:focus {
  border-color: #2f5711;
  box-shadow: 0 0 0 3px rgba(47, 87, 17, 0.08);
}

.select-chevron {
  position: absolute;
  right: 12px;
  top: 50%;
  transform: translateY(-50%);
  pointer-events: none;
  color: #9aa0a6;
}

/* ===========================
   FILE DROP ZONE
   =========================== */
.file-upload-row {
  display: flex;
  align-items: center;
  gap: 10px;
}

.file-choose-btn {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 8px 14px;
  border-radius: 10px;
  border: 1.5px solid #e0e0e0;
  background: #fff;
  font-size: 13px;
  font-weight: 600;
  color: #202124;
  cursor: pointer;
  font-family: inherit;
  transition: all 0.12s;
  white-space: nowrap;
  flex-shrink: 0;
}

.file-choose-btn:hover {
  background: #f8f9fa;
  border-color: #d0d0d0;
}

.file-choose-btn svg {
  color: #5f6368;
}

.file-name-display {
  flex: 1;
  font-size: 13px;
  color: #9aa0a6;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.file-name-display.has-file {
  color: #202124;
  font-weight: 500;
}

.file-clear-btn {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  border: none;
  background: #f1f3f4;
  color: #5f6368;
  font-size: 16px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: all 0.12s;
  padding: 0;
  line-height: 1;
}

.file-clear-btn:hover {
  background: #e8eaed;
  color: #202124;
}

#file-name-display {
  flex: 1;
  font-size: 13px;
  font-weight: 600;
  color: #202124;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  min-width: 0;
}

#file-clear-btn {
  background: none;
  border: none;
  font-size: 18px;
  color: #9aa0a6;
  cursor: pointer;
  padding: 0 4px;
  line-height: 1;
  transition: color 0.15s;
}

#file-clear-btn:hover {
  color: #ea4335;
}

.hint {
  margin: 5px 0 0;
  font-size: 11px;
  color: #9aa0a6;
}

/* ===========================
   INPUT MODE TOGGLE
   =========================== */
.input-mode-toggle {
  display: flex;
  background: #f1f3f4;
  border-radius: 10px;
  padding: 3px;
  margin-bottom: 12px;
}

.mode-btn {
  flex: 1;
  padding: 8px;
  border-radius: 8px;
  border: none;
  font-size: 12.5px;
  font-weight: 600;
  cursor: pointer;
  font-family: inherit;
  transition: all 0.15s;
  background: transparent;
  color: #5f6368;
}

.mode-btn:hover:not(.active) {
  color: #202124;
}

.mode-btn.active {
  background: #fff;
  color: #202124;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

/* ===========================
   MANUAL ENTRY
   =========================== */
#manual-entry-section {
  margin-bottom: 12px;
}

#manual-entry-section .address-row {
  margin-bottom: 0;
}

.manual-text-input {
  width: 100%;
  padding: 9px 10px;
  border: 1.5px solid #e0e0e0;
  border-radius: 10px;
  font-size: 13px;
  font-family: inherit;
  color: #202124;
  outline: none;
  box-sizing: border-box;
  transition:
    border-color 0.15s,
    box-shadow 0.15s;
}

.manual-text-input:focus {
  border-color: #2f5711;
  box-shadow: 0 0 0 3px rgba(47, 87, 17, 0.08);
}

.manual-coords-row {
  margin-top: 6px;
  align-items: flex-end;
}

.add-coords-btn {
  width: 42px;
  height: 42px;
  border-radius: 10px;
  border: none;
  background: #2f5711;
  color: #fff;
  font-size: 20px;
  font-weight: 600;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: background 0.15s;
  font-family: inherit;
}

.add-coords-btn:hover {
  background: #244a0d;
}

#manual-stops-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 12px;
  margin-bottom: 4px;
}

#manual-stops-count {
  font-size: 11px;
  font-weight: 700;
  color: #9aa0a6;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

#manual-clear-all {
  background: none;
  border: none;
  font-size: 11px;
  font-weight: 600;
  color: #9aa0a6;
  cursor: pointer;
  font-family: inherit;
  padding: 2px 4px;
  transition: color 0.15s;
}

#manual-clear-all:hover {
  color: #ea4335;
}

#manual-stops-list {
  list-style: none;
  padding: 0;
  margin: 0;
}

.manual-stop-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 7px 10px;
  border-radius: 10px;
  background: #fafafa;
  margin-bottom: 4px;
  transition: background 0.1s;
}

.manual-stop-item:hover {
  background: #f1f3f4;
}

.manual-stop-num {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 22px;
  height: 22px;
  background: #2f5711;
  color: white;
  border-radius: 11px;
  font-size: 11px;
  font-weight: 700;
  flex-shrink: 0;
}

.manual-stop-name {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 13px;
  font-weight: 500;
  color: #202124;
}

.manual-stop-remove {
  background: none;
  border: none;
  color: #ccc;
  font-size: 16px;
  cursor: pointer;
  padding: 0 2px;
  line-height: 1;
  flex-shrink: 0;
  transition: color 0.15s;
}

.manual-stop-remove:hover {
  color: #ea4335;
}

/* ===========================
   MANAGE STOPS BUTTON + MODAL (hidden on desktop by default)
   =========================== */
.manage-stops-btn {
  display: none;
}
.stops-modal {
  display: none;
}

/* Desktop: show manage stops when > 3 stops */
#results-container.show-manage-stops .manage-stops-btn {
  display: flex;
  align-items: center;
  gap: 8px;
  width: calc(100% - 36px);
  margin: 4px 18px 8px;
  padding: 12px 16px;
  border-radius: 12px;
  border: 1.5px solid #e0e0e0;
  background: #fff;
  font-size: 13px;
  font-weight: 600;
  color: #202124;
  cursor: pointer;
  font-family: inherit;
  transition: all 0.12s;
}

#results-container.show-manage-stops .manage-stops-btn:hover {
  background: #f8f9fa;
  border-color: #d0d0d0;
}

#results-container.show-manage-stops .manage-stops-count {
  margin-left: auto;
  font-size: 12px;
  font-weight: 700;
  color: #9aa0a6;
  background: #f1f3f4;
  padding: 2px 8px;
  border-radius: 6px;
}

#results-container.show-manage-stops .manage-stops-chevron {
  color: #9aa0a6;
  flex-shrink: 0;
}

#results-container.show-manage-stops > .stops-header,
#results-container.show-manage-stops > #results-list,
#results-container.show-manage-stops > #add-stop-section {
  display: none;
}

/* Desktop stops modal (centered overlay with backdrop) */
.stops-modal.desktop-open {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  position: fixed;
  inset: 0;
  z-index: 1100;
  background: rgba(0, 0, 0, 0.35);
  backdrop-filter: blur(3px);
  opacity: 0;
  transition: opacity 0.2s ease;
}

.stops-modal.desktop-open.open {
  opacity: 1;
}

/* Card wrapper effect via header + body */
.stops-modal.desktop-open .stops-modal-header {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 14px 18px 12px;
  border-bottom: 1px solid #eee;
  flex-shrink: 0;
  background: #fff;
  width: 440px;
  border-radius: 14px 14px 0 0;
  box-shadow: 0 -4px 24px rgba(0, 0, 0, 0.06);
}

.stops-modal.desktop-open .stops-modal-close {
  width: 32px;
  height: 32px;
  border-radius: 8px;
  border: none;
  background: #f1f3f4;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  color: #5f6368;
  flex-shrink: 0;
  transition: all 0.12s;
}

.stops-modal.desktop-open .stops-modal-close:hover {
  background: #e8eaed;
  color: #202124;
}

.stops-modal.desktop-open .stops-modal-title {
  font-size: 15px;
  font-weight: 700;
  color: #202124;
  flex: 1;
}

.stops-modal.desktop-open .stops-modal-count {
  font-size: 11px;
  font-weight: 700;
  color: #9aa0a6;
  background: #f1f3f4;
  padding: 2px 9px;
  border-radius: 6px;
}

.stops-modal.desktop-open .stops-modal-body {
  flex: 0 1 auto;
  max-height: 55vh;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  background: #fff;
  width: 440px;
  padding: 4px 18px;
  border-radius: 0 0 14px 14px;
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.12);
}

.stops-modal.desktop-open .stops-modal-body > .stops-header {
  display: block;
  padding: 8px 18px 6px;
  flex-shrink: 0;
  border-top: none;
}

.stops-modal.desktop-open .stops-modal-body > #results-list {
  display: block;
  flex: 1;
  overflow-y: auto;
}

.stops-modal.desktop-open .stops-modal-body > #results-list li {
  padding: 8px 18px;
}

.stops-modal.desktop-open .stops-modal-body > #add-stop-section {
  display: block;
  padding: 10px 18px;
  border-top: 1px solid #f0f0f0;
  flex-shrink: 0;
  background: #fff;
  border-radius: 0 0 14px 14px;
}

/* ===========================
   MANAGE ROUTES BUTTON + MODAL (hidden by default)
   =========================== */
.manage-routes-btn {
  display: none;
}
.routes-modal {
  display: none;
}

/* Desktop: show manage routes when > 3 route links */
#results-container.show-manage-routes .manage-routes-btn {
  display: flex;
  align-items: center;
  gap: 8px;
  width: calc(100% - 36px);
  margin: 4px 18px 8px;
  padding: 12px 16px;
  border-radius: 12px;
  border: 1.5px solid #e0e0e0;
  background: #fff;
  font-size: 13px;
  font-weight: 600;
  color: #202124;
  cursor: pointer;
  font-family: inherit;
  transition: all 0.12s;
}

#results-container.show-manage-routes .manage-routes-btn:hover {
  background: #f8f9fa;
  border-color: #d0d0d0;
}

#results-container.show-manage-routes .manage-routes-count {
  margin-left: auto;
  font-size: 12px;
  font-weight: 700;
  color: #9aa0a6;
  background: #f1f3f4;
  padding: 2px 8px;
  border-radius: 6px;
}

#results-container.show-manage-routes .manage-routes-chevron {
  color: #9aa0a6;
  flex-shrink: 0;
}

#results-container.show-manage-routes #route-actions {
  display: none;
}

/* Desktop routes modal (centered overlay with backdrop) */
.routes-modal.desktop-open {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  position: fixed;
  inset: 0;
  z-index: 1100;
  background: rgba(0, 0, 0, 0.35);
  backdrop-filter: blur(3px);
  opacity: 0;
  transition: opacity 0.2s ease;
}

.routes-modal.desktop-open.open {
  opacity: 1;
}

.routes-modal.desktop-open .routes-modal-header {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 14px 18px 12px;
  border-bottom: 1px solid #eee;
  flex-shrink: 0;
  background: #fff;
  width: 440px;
  border-radius: 14px 14px 0 0;
  box-shadow: 0 -4px 24px rgba(0, 0, 0, 0.06);
}

.routes-modal.desktop-open .routes-modal-close {
  width: 32px;
  height: 32px;
  border-radius: 8px;
  border: none;
  background: #f1f3f4;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  color: #5f6368;
  flex-shrink: 0;
  transition: all 0.12s;
}

.routes-modal.desktop-open .routes-modal-close:hover {
  background: #e8eaed;
  color: #202124;
}

.routes-modal.desktop-open .routes-modal-title {
  font-size: 15px;
  font-weight: 700;
  color: #202124;
  flex: 1;
}

.routes-modal.desktop-open .routes-modal-count {
  font-size: 11px;
  font-weight: 700;
  color: #9aa0a6;
  background: #f1f3f4;
  padding: 2px 9px;
  border-radius: 6px;
}

.routes-modal.desktop-open .routes-modal-body {
  flex: 0 1 auto;
  max-height: 55vh;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 5px;
  padding: 14px 18px;
  background: #fff;
  width: 440px;
  border-radius: 0 0 14px 14px;
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.12);
}

/* ===========================
   COLLAPSIBLE (starting location)
   =========================== */
.collapsible {
  border-radius: 12px;
  border: 1.5px solid #eee;
  overflow: hidden;
  margin-bottom: 12px;
}

.collapsible-header {
  padding: 11px 12px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: #fafafa;
  user-select: none;
  transition: background 0.15s;
}

.collapsible-header:hover {
  background: #f5f5f5;
}

.collapsible-title {
  font-size: 13px;
  font-weight: 600;
  color: #202124;
}

.collapsible-opt {
  font-weight: 400;
  color: #9aa0a6;
}

.collapsible-chevron {
  color: #9aa0a6;
  transition: transform 0.2s;
  flex-shrink: 0;
}

.collapsible.open .collapsible-chevron {
  transform: rotate(180deg);
}

.collapsible-body {
  max-height: 0;
  overflow: hidden;
  transition: max-height 0.25s ease;
  padding: 0 12px;
}

.collapsible.open .collapsible-body {
  max-height: 300px;
  padding: 0 12px 12px;
}

/* Location helpers */
.location-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  width: 100%;
  padding: 0.5rem;
  margin-top: 0.5rem;
  border: 1px dashed #a8dab5;
  border-radius: 8px;
  background: #f2f7ed;
  color: #2f5711;
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.15s;
  font-family: inherit;
}

.location-btn:hover {
  background: #e8f5e0;
  border-color: #6abf69;
}

.location-btn:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

.divider-text {
  display: flex;
  align-items: center;
  margin: 8px 0;
  font-size: 11px;
  color: #aaa;
}

.divider-text::before,
.divider-text::after {
  content: "";
  flex: 1;
  border-top: 1px solid #e0e0e0;
}

.divider-text span {
  padding: 0 0.5rem;
}

.address-row {
  display: flex;
  gap: 6px;
}

.address-autocomplete {
  flex: 1;
  position: relative;
}

.address-autocomplete input {
  width: 100%;
  padding: 9px 10px;
  border: 1.5px solid #e0e0e0;
  border-radius: 10px;
  font-size: 13px;
  box-sizing: border-box;
  font-family: inherit;
  color: #202124;
  outline: none;
  transition:
    border-color 0.15s,
    box-shadow 0.15s;
}

.address-autocomplete input:focus {
  border-color: #2f5711;
  box-shadow: 0 0 0 3px rgba(47, 87, 17, 0.08);
}

.address-row button {
  padding: 9px 12px;
  border: 1.5px solid #e0e0e0;
  border-radius: 10px;
  background: #fff;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.15s;
  font-family: inherit;
  color: #202124;
}

.address-row button:hover {
  background: #f8f9fa;
  border-color: #ccc;
}

.address-row button:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

.fields-row {
  display: flex;
  gap: 8px;
  margin-top: 0;
}

.fields-row > div {
  flex: 1;
}

.fields-row input[type="number"] {
  width: 100%;
  padding: 9px 10px;
  border: 1.5px solid #e0e0e0;
  border-radius: 10px;
  font-size: 13px;
  font-family: monospace;
  color: #202124;
  outline: none;
  box-sizing: border-box;
  transition: border-color 0.15s;
}

.fields-row input[type="number"]:focus {
  border-color: #2f5711;
}

.fields-row .field-label {
  font-size: 11px;
  margin-bottom: 4px;
}

/* Suggestions dropdown */
.suggestions-list {
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  margin: 2px 0 0;
  padding: 0;
  list-style: none;
  background: white;
  border: 1px solid #ddd;
  border-radius: 10px;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.12);
  z-index: 1000;
  max-height: 200px;
  overflow-y: auto;
}

.suggestions-list li {
  padding: 8px 10px;
  cursor: pointer;
  border-bottom: 1px solid #f3f4f6;
  transition: background 0.1s;
}

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

.suggestions-list li:hover,
.suggestions-list li.active {
  background: #f2f7ed;
}

.suggestion-main {
  display: block;
  font-size: 12px;
  font-weight: 500;
  color: #1e293b;
}

.suggestion-secondary {
  display: block;
  font-size: 11px;
  color: #94a3b8;
  margin-top: 1px;
}

#start-location-status {
  font-size: 12px;
  margin-top: 6px;
  min-height: 1em;
}

#start-location-status.loc-success {
  color: #34a853;
}
#start-location-status.loc-error {
  color: #ea4335;
}
#start-location-status.loc-loading {
  color: #5f6368;
}

/* ===========================
   TOGGLE SWITCH
   =========================== */
.toggle-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 11px 12px;
  border-radius: 12px;
  border: 1.5px solid #eee;
  cursor: pointer;
  user-select: none;
  background: #fafafa;
  margin-bottom: 14px;
  transition: background 0.15s;
}

.toggle-row:hover {
  background: #f5f5f5;
}

.toggle-label {
  font-size: 13px;
  font-weight: 600;
  color: #202124;
}

.toggle-track {
  width: 40px;
  height: 22px;
  border-radius: 11px;
  padding: 2px;
  background: #d5d9de;
  transition: background 0.2s;
  cursor: pointer;
}

.toggle-track.active {
  background: #2f5711;
}

.toggle-thumb {
  width: 18px;
  height: 18px;
  border-radius: 9px;
  background: #fff;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.15);
  transition: transform 0.2s ease-out;
}

.toggle-track.active .toggle-thumb {
  transform: translateX(18px);
}

/* ===========================
   PROGRESS BAR
   =========================== */
#progress-section {
  margin-bottom: 10px;
}

.progress-header {
  display: flex;
  justify-content: space-between;
  margin-bottom: 5px;
}

#progress-label {
  font-size: 12px;
  font-weight: 600;
  color: #202124;
}

#progress-pct {
  font-size: 11px;
  font-weight: 700;
  color: #2f5711;
  font-family: monospace;
}

.progress-track {
  height: 4px;
  border-radius: 2px;
  background: #f1f3f4;
  overflow: hidden;
}

.progress-fill {
  height: 100%;
  border-radius: 2px;
  background: linear-gradient(90deg, #2f5711, #9fe870);
  width: 0%;
  transition: width 0.25s ease-out;
}

/* ===========================
   OPTIMIZE BUTTON
   =========================== */
#optimize-btn {
  width: 100%;
  padding: 13px;
  border-radius: 12px;
  border: none;
  background: linear-gradient(135deg, #2f5711, #163300);
  color: white;
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
  font-family: inherit;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  box-shadow: 0 4px 16px rgba(47, 87, 17, 0.25);
  transition: all 0.2s;
}

#optimize-btn:hover {
  box-shadow: 0 6px 24px rgba(47, 87, 17, 0.35);
  transform: translateY(-1px);
}

#optimize-btn:disabled {
  background: #e8eaed;
  color: #9aa0a6;
  box-shadow: none;
  cursor: not-allowed;
  transform: none;
}

/* ===========================
   STATUS
   =========================== */
#status {
  margin-top: 8px;
  font-size: 12px;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  min-height: 1.2em;
}

.status-error {
  color: #ea4335;
}
.status-success {
  color: #34a853;
}
.status-loading {
  color: #5f6368;
}

.spinner {
  display: inline-block;
  width: 14px;
  height: 14px;
  border: 2px solid #e0e0e0;
  border-top-color: #2f5711;
  border-radius: 50%;
  animation: spin 0.6s linear infinite;
}

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

/* ===========================
   RESULTS CONTAINER
   =========================== */
#results-container {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.results-top {
  padding: 16px 18px 12px;
  flex-shrink: 0;
}

/* New route button */
#new-route-btn {
  display: flex;
  align-items: center;
  gap: 4px;
  background: none;
  border: none;
  cursor: pointer;
  padding: 0;
  margin-bottom: 14px;
  font-size: 13px;
  color: #2f5711;
  font-weight: 600;
  font-family: inherit;
  transition: color 0.15s;
}

#new-route-btn:hover {
  color: #163300;
}

/* Stats bar */
.summary-card {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr 1fr;
  gap: 1px;
  background: #f0f0f0;
  border-radius: 12px;
  overflow: hidden;
  border: 1px solid #eee;
  margin-bottom: 12px;
}

.summary-item {
  background: white;
  padding: 12px 8px;
  text-align: center;
}

.summary-label {
  display: block;
  font-size: 10px;
  font-weight: 700;
  color: #9aa0a6;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin-bottom: 4px;
}

.summary-value {
  display: block;
  font-size: 15px;
  font-weight: 800;
  color: #202124;
  letter-spacing: -0.02em;
}

/* Route action buttons */
#route-actions {
  display: flex;
  flex-direction: column;
  gap: 5px;
  margin-bottom: 0;
}

.route-action-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 12px;
  border-radius: 10px;
  border: 1.5px solid #e0e0e0;
  background: #fff;
  font-size: 13px;
  font-weight: 600;
  text-decoration: none;
  color: #202124;
  cursor: pointer;
  transition: all 0.12s;
  font-family: inherit;
}

.route-action-btn:hover {
  background: #f8f9fa;
  border-color: #ccc;
  transform: translateY(-1px);
}

.route-action-btn .nav-icon {
  width: 16px;
  height: 16px;
  flex-shrink: 0;
}

.route-action-btn .gmaps-range {
  font-size: 11px;
  font-weight: 600;
  font-family: monospace;
  color: #9aa0a6;
  background: #f1f3f4;
  padding: 2px 7px;
  border-radius: 5px;
  margin-left: auto;
}

/* ===========================
   SPLIT SETTINGS
   =========================== */
.split-settings {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 10px;
  flex-wrap: wrap;
}

.split-mode-toggle {
  display: flex;
  background: #f1f3f4;
  border-radius: 8px;
  padding: 2px;
}

.split-mode-btn {
  padding: 5px 10px;
  border-radius: 6px;
  border: none;
  font-size: 11.5px;
  font-weight: 600;
  cursor: pointer;
  font-family: inherit;
  transition: all 0.15s;
  background: transparent;
  color: #5f6368;
  white-space: nowrap;
}

.split-mode-btn:hover:not(.active) {
  color: #202124;
}

.split-mode-btn.active {
  background: #fff;
  color: #202124;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.split-value-wrap {
  display: flex;
  align-items: center;
  gap: 6px;
}

.split-value-input {
  width: 64px;
  padding: 5px 6px;
  border: 1.5px solid #e0e0e0;
  border-radius: 8px;
  font-size: 12px;
  font-family: monospace;
  text-align: center;
  color: #202124;
  outline: none;
  box-sizing: border-box;
  transition: border-color 0.15s;
}

.split-value-input:focus {
  border-color: #2f5711;
  box-shadow: 0 0 0 2px rgba(47, 87, 17, 0.08);
}

.split-value-label {
  font-size: 11px;
  font-weight: 600;
  color: #9aa0a6;
  white-space: nowrap;
}

/* ===========================
   STOPS HEADER + SEARCH
   =========================== */
.stops-header {
  padding: 10px 18px 6px;
  border-top: 1px solid #f0f0f0;
  flex-shrink: 0;
}

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

.stops-count-label {
  font-size: 11px;
  font-weight: 700;
  color: #9aa0a6;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.stops-dist-label {
  font-size: 11px;
  font-weight: 600;
  font-family: monospace;
  color: #9aa0a6;
}

.stops-search-wrap {
  position: relative;
}

.stops-search-wrap svg {
  position: absolute;
  left: 10px;
  top: 50%;
  transform: translateY(-50%);
  color: #9aa0a6;
  pointer-events: none;
}

#stops-search {
  width: 100%;
  padding: 9px 10px 9px 32px;
  border-radius: 10px;
  border: 1.5px solid #eee;
  background: #fafafa;
  font-size: 13px;
  font-family: inherit;
  color: #202124;
  outline: none;
  box-sizing: border-box;
  transition:
    border-color 0.15s,
    background 0.15s;
}

#stops-search:focus {
  border-color: #2f5711;
  background: #fff;
}

/* ===========================
   STOP LIST
   =========================== */
#results-list {
  list-style: none;
  padding: 0;
  margin: 0;
  overflow-y: auto;
  flex: 1;
}

#results-list li {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 18px;
  font-size: 13px;
  transition: background 0.1s;
  border-bottom: 1px solid #f5f5f5;
}

#results-list li:last-child {
  border-bottom: none;
}

#results-list li:hover {
  background: #f8f9fa;
}

.order-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 26px;
  height: 26px;
  background: #2f5711;
  color: white;
  border-radius: 13px;
  font-size: 11px;
  font-weight: 700;
  flex-shrink: 0;
}

.order-badge.start {
  background: #ea4335;
}

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

#results-list li .stop-name {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-weight: 600;
  color: #202124;
  letter-spacing: -0.01em;
}

.stop-sub {
  display: block;
  font-size: 11px;
  color: #9aa0a6;
  font-weight: 400;
  margin-top: 1px;
}

.leg-info {
  font-size: 11.5px;
  font-family: monospace;
  font-weight: 600;
  color: #5f6368;
  white-space: nowrap;
  flex-shrink: 0;
  text-align: right;
  min-width: 54px;
}

.stop-nav-btn {
  width: 30px;
  height: 30px;
  border-radius: 8px;
  border: 1.5px solid #e0e0e0;
  background: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  flex-shrink: 0;
  transition: all 0.12s;
  padding: 0;
}

.stop-nav-btn:hover {
  background: #f2f7ed;
  border-color: #a8dab5;
}

.stop-remove {
  background: none;
  border: none;
  color: #ccc;
  font-size: 16px;
  cursor: pointer;
  padding: 0 2px;
  line-height: 1;
  flex-shrink: 0;
  transition: color 0.15s;
}

.stop-remove:hover {
  color: #ea4335;
}

/* ===========================
   ADD STOP + FOOTER
   =========================== */
#add-stop-section {
  padding: 8px 18px;
  flex-shrink: 0;
}

#results-footer {
  display: flex;
  gap: 6px;
  padding: 10px 18px 14px;
  flex-shrink: 0;
}

.footer-action {
  flex: 1;
  padding: 9px;
  border-radius: 10px;
  border: 1.5px solid #e0e0e0;
  background: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  font-size: 12px;
  font-weight: 600;
  color: #5f6368;
  font-family: inherit;
  cursor: pointer;
  transition: all 0.12s;
}

.footer-action:hover {
  background: #f8f9fa;
  border-color: #ccc;
}

/* Warnings */
.warnings-block {
  margin: 0;
  padding: 0 18px 12px;
  font-size: 12px;
  color: #e65100;
}

.warnings-block ul {
  padding-left: 1.2rem;
  margin: 0.3rem 0 0;
}

/* ===========================
   SAVED ROUTES
   =========================== */
#saved-routes-section {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

#saved-routes-empty {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  padding: 40px 20px;
  color: #9aa0a6;
}

#saved-routes-empty svg {
  margin-bottom: 6px;
}

.empty-title {
  font-size: 14px;
  font-weight: 600;
  color: #5f6368;
  margin: 0;
}

.empty-hint {
  font-size: 12px;
  color: #9aa0a6;
  margin: 0;
}

#saved-routes-list {
  list-style: none;
  padding: 0;
  margin: 0;
  overflow-y: auto;
  flex: 1;
}

.saved-route-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 18px;
  border-bottom: 1px solid #f5f5f5;
  transition: background 0.1s;
}

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

.saved-route-item:hover {
  background: #f8f9fa;
}

.saved-route-icon {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  background: #f2f7ed;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  color: #2f5711;
}

.saved-route-info {
  flex: 1;
  min-width: 0;
  overflow: hidden;
}

.saved-route-name {
  font-size: 13px;
  font-weight: 600;
  color: #202124;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.saved-route-meta {
  font-size: 11px;
  color: #9aa0a6;
  margin-top: 2px;
}

.saved-route-date {
  font-size: 10px;
  color: #bdc1c6;
  margin-top: 1px;
}

.saved-route-actions {
  display: flex;
  gap: 4px;
  flex-shrink: 0;
}

.saved-route-load {
  padding: 6px 12px;
  border-radius: 7px;
  border: 1.5px solid #2f5711;
  background: #fff;
  color: #2f5711;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  font-family: inherit;
  transition: all 0.12s;
}

.saved-route-load:hover {
  background: #2f5711;
  color: #fff;
}

.saved-route-delete {
  width: 30px;
  height: 30px;
  border-radius: 7px;
  border: 1.5px solid #e0e0e0;
  background: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  color: #9aa0a6;
  font-size: 14px;
  transition: all 0.12s;
  padding: 0;
}

.saved-route-delete:hover {
  border-color: #ea4335;
  color: #ea4335;
  background: #fef2f2;
}

/* ===========================
   BRANDING FOOTER
   =========================== */
.sidebar-branding {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 10px 18px;
  border-top: 1px solid #f0f0f0;
  flex-shrink: 0;
}

.branding-link {
  font-size: 11px;
  font-weight: 500;
  color: #9aa0a6;
  text-decoration: none;
  transition: color 0.15s;
}

.branding-link:hover {
  color: #2f5711;
}

.branding-sep {
  font-size: 11px;
  color: #d0d0d0;
}

/* ===========================
   FLOATING MAP STATS
   =========================== */
#floating-stats {
  position: absolute;
  bottom: 18px;
  left: 18px;
  z-index: 10;
  display: flex;
  border-radius: 14px;
  overflow: hidden;
  background: #fff;
  box-shadow:
    0 2px 8px rgba(0, 0, 0, 0.06),
    0 12px 36px rgba(0, 0, 0, 0.08);
  border: 1px solid #eee;
}

.floating-stat {
  padding: 12px 18px;
  border-right: 1px solid #f0f0f0;
  display: flex;
  align-items: center;
  gap: 9px;
}

.floating-stat:last-child {
  border-right: none;
}

.floating-stat-emoji {
  font-size: 18px;
}

.floating-stat-value {
  font-size: 14px;
  font-weight: 700;
  color: #202124;
  letter-spacing: -0.02em;
  line-height: 1;
}

.floating-stat-label {
  font-size: 11px;
  color: #9aa0a6;
  margin-top: 2px;
}

/* ===========================
   FLOATING WEATHER WIDGET
   =========================== */
#weather-widget {
  position: absolute;
  top: 18px;
  left: 18px;
  z-index: 10;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 16px;
  border-radius: 14px;
  background: #fff;
  box-shadow:
    0 2px 8px rgba(0, 0, 0, 0.06),
    0 12px 36px rgba(0, 0, 0, 0.08);
  border: 1px solid #eee;
  font-family:
    "Inter",
    -apple-system,
    BlinkMacSystemFont,
    "Segoe UI",
    sans-serif;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.3s ease;
}

#weather-widget.loaded {
  opacity: 1;
  pointer-events: auto;
}

.weather-widget-icon svg {
  width: 28px;
  height: 28px;
  display: block;
  color: #5f6368;
}

.weather-widget-temp {
  font-size: 16px;
  font-weight: 700;
  color: #202124;
  letter-spacing: -0.02em;
  line-height: 1;
}

.weather-widget-date {
  font-size: 11px;
  color: #9aa0a6;
  margin-top: 3px;
}

/* ===========================
   NUMBERED MAP MARKERS
   =========================== */
.numbered-marker div {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: 700;
  font-family:
    "Inter",
    -apple-system,
    BlinkMacSystemFont,
    sans-serif;
  border: 2px solid white;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.3);
}

/* ===========================
   MAPKIT CALLOUT OVERRIDES
   =========================== */
.mapkit-callout {
  border-radius: 16px;
  padding: 0;
  box-shadow:
    0 1px 3px rgba(0, 0, 0, 0.04),
    0 8px 32px rgba(0, 0, 0, 0.08);
  border: 1px solid #edf0f4;
  overflow: hidden;
  background: white;
  font-family:
    "Inter",
    -apple-system,
    BlinkMacSystemFont,
    "Segoe UI",
    sans-serif;
  line-height: 1.4;
  max-width: 320px;
  min-width: 280px;
}

.popup-accent {
  height: 3px;
  border-radius: 16px 16px 0 0;
}

.popup-body {
  padding: 14px 16px 0;
}

.popup-header {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  margin-bottom: 10px;
}

.popup-badge {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  font-weight: 700;
  flex-shrink: 0;
  font-variant-numeric: tabular-nums;
}

.popup-title-group {
  min-width: 0;
  flex: 1;
}

.popup-name {
  font-size: 14px;
  font-weight: 600;
  color: #0f172a;
  letter-spacing: -0.01em;
  line-height: 1.25;
}

.popup-type {
  font-size: 11.5px;
  color: #94a3b8;
  margin-top: 2px;
  font-weight: 450;
}

.popup-location {
  display: flex;
  align-items: center;
  gap: 5px;
  margin-bottom: 12px;
  font-size: 12px;
  color: #64748b;
}

.popup-location svg {
  flex-shrink: 0;
}

.popup-nav {
  display: flex;
  gap: 6px;
  padding: 12px 16px;
  border-top: 1px solid #f1f5f9;
}

.nav-link {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  padding: 7px 12px;
  border-radius: 10px;
  border: 1px solid #e8ecf1;
  background: #fff;
  font-size: 12px;
  font-weight: 500;
  text-decoration: none;
  color: #1e293b;
  flex: 1;
  cursor: pointer;
  transition: all 0.2s ease;
  letter-spacing: 0.01em;
  font-family: inherit;
}

.nav-link:hover {
  transform: translateY(-1px);
}

.nav-gmaps:hover {
  background: rgba(52, 168, 83, 0.04);
  border-color: rgba(52, 168, 83, 0.27);
  color: #34a853;
  box-shadow: 0 2px 8px rgba(52, 168, 83, 0.08);
}

.nav-waze:hover {
  background: rgba(51, 204, 255, 0.04);
  border-color: rgba(51, 204, 255, 0.27);
  color: #05b5f0;
  box-shadow: 0 2px 8px rgba(51, 204, 255, 0.08);
}

.nav-copy:hover {
  background: rgba(139, 92, 246, 0.04);
  border-color: rgba(139, 92, 246, 0.27);
  color: #8b5cf6;
  box-shadow: 0 2px 8px rgba(139, 92, 246, 0.08);
}

.nav-icon {
  width: 16px;
  height: 16px;
  flex-shrink: 0;
}

.popup-leg {
  background: #fafbfc;
  border-top: 1px solid #f1f5f9;
  padding: 9px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.popup-leg-label {
  display: flex;
  align-items: center;
  gap: 5px;
  font-size: 12px;
  color: #94a3b8;
  min-width: 0;
  flex: 1;
}

.popup-leg-label svg {
  flex-shrink: 0;
}

.popup-leg-name {
  color: #334155;
  font-weight: 600;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.popup-leg-stats {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 3px 9px;
  border-radius: 7px;
  background: #f1f5f9;
  flex-shrink: 0;
  font-variant-numeric: tabular-nums;
}

.popup-leg-dist {
  font-size: 11px;
  color: #475569;
  font-weight: 600;
}
.popup-leg-sep {
  color: #cbd5e1;
  font-size: 10px;
}
.popup-leg-dur {
  font-size: 11px;
  color: #94a3b8;
}

.popup-final {
  background: #ecfdf5;
  border-top: 1px solid #a7f3d0;
  padding: 9px 16px;
  display: flex;
  align-items: center;
  gap: 5px;
  font-size: 12px;
  color: #059669;
  font-weight: 600;
}

/* ===========================
   COOKIE CONSENT BANNER
   =========================== */
.cookie-banner {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 3000;
  transform: translateY(100%);
  transition:
    transform 0.4s cubic-bezier(0.25, 0.1, 0.25, 1),
    opacity 0.4s cubic-bezier(0.25, 0.1, 0.25, 1);
  opacity: 0;
  pointer-events: none;
}

.cookie-banner.visible {
  transform: translateY(0);
  opacity: 1;
  pointer-events: auto;
}

.cookie-banner-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  max-width: 960px;
  margin: 0 auto 16px;
  padding: 16px 20px;
  background: #fff;
  border-radius: 14px;
  box-shadow:
    0 4px 12px rgba(0, 0, 0, 0.08),
    0 12px 40px rgba(0, 0, 0, 0.12);
  border: 1px solid rgba(0, 0, 0, 0.06);
  font-family:
    "Inter",
    -apple-system,
    BlinkMacSystemFont,
    "Segoe UI",
    sans-serif;
}

.cookie-banner-text {
  margin: 0;
  font-size: 13px;
  line-height: 1.5;
  color: #5f6368;
}

.cookie-banner-link {
  font-weight: 500;
  color: #2f5711;
  text-decoration: underline;
  text-underline-offset: 2px;
  white-space: nowrap;
}

.cookie-banner-link:hover {
  color: #3a6d16;
}

.cookie-banner-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
}

.cookie-btn {
  padding: 8px 16px;
  border-radius: 10px;
  font-family: inherit;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  border: none;
  white-space: nowrap;
  transition:
    background 0.15s,
    transform 0.15s,
    box-shadow 0.15s;
}

.cookie-btn:focus-visible {
  outline: 2px solid #9fe870;
  outline-offset: 2px;
}

.cookie-btn-reject {
  background: #f1f3f4;
  color: #5f6368;
}

.cookie-btn-reject:hover {
  background: #e8eaed;
}

.cookie-btn-accept {
  background: linear-gradient(135deg, #2f5711, #3a6d16);
  color: #fff;
  box-shadow: 0 2px 8px rgba(47, 87, 17, 0.25);
}

.cookie-btn-accept:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 16px rgba(47, 87, 17, 0.35);
}

/* ===========================
   DARK THEME
   =========================== */
body.dark {
  background: #0f0f1a;
  color: #d1d5db;
}

body.dark .sidebar-toggle {
  background: #16192a;
  border-color: rgba(255, 255, 255, 0.06);
  color: #6b7280;
  box-shadow: -2px 2px 8px rgba(0, 0, 0, 0.2);
}
body.dark .sidebar-toggle:hover {
  color: #e5e7eb;
}

body.dark #sidebar {
  background: #16192a;
  border-color: rgba(255, 255, 255, 0.06);
  box-shadow:
    0 4px 12px rgba(0, 0, 0, 0.2),
    0 20px 50px rgba(0, 0, 0, 0.3);
}

body.dark .logo {
  color: #e5e7eb;
}
body.dark .logo span {
  color: #9fe870;
}
body.dark .header-subtitle {
  color: #6b7280;
}

body.dark #theme-toggle {
  background: #1e2235;
  color: #f59e0b;
}

body.dark #theme-toggle:hover {
  background: #252940;
  color: #fbbf24;
}

body.dark .tab-btn {
  color: #8b8fa3;
}

body.dark .tab-btn:hover {
  background: #1e2235;
}

body.dark .tab-btn.active {
  background: #9fe870;
  color: #163300;
}

body.dark .tab-btn.active:hover {
  background: #8dd960;
}

body.dark #upload-section {
  border-bottom-color: #2a2d40;
}

body.dark .field-label {
  color: #8b8fa3;
}

body.dark .select-wrap select {
  background: #1e2235;
  border-color: #2a2d40;
  color: #d1d5db;
}

body.dark .select-wrap select:focus {
  border-color: #9fe870;
  box-shadow: 0 0 0 3px rgba(159, 232, 112, 0.1);
}

body.dark .select-chevron {
  color: #6b7280;
}

body.dark .file-choose-btn {
  background: #1e2235;
  border-color: #2a2d40;
  color: #d1d5db;
}
body.dark .file-choose-btn:hover {
  background: #252940;
  border-color: #3a3f54;
}
body.dark .file-choose-btn svg {
  color: #6b7280;
}
body.dark .file-name-display {
  color: #6b7280;
}
body.dark .file-name-display.has-file {
  color: #d1d5db;
}
body.dark .file-clear-btn {
  background: #252940;
  color: #6b7280;
}
body.dark .file-clear-btn:hover {
  background: #2a2d40;
  color: #e5e7eb;
}

body.dark .hint {
  color: #6b7280;
}
body.dark .required {
  color: #f87171;
}

body.dark .input-mode-toggle {
  background: #1a1e30;
}
body.dark .mode-btn {
  color: #8b8fa3;
}
body.dark .mode-btn:hover:not(.active) {
  color: #d1d5db;
}
body.dark .mode-btn.active {
  background: #252940;
  color: #e5e7eb;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.3);
}

body.dark .manual-text-input {
  background: #1e2235;
  border-color: #2a2d40;
  color: #d1d5db;
}
body.dark .manual-text-input::placeholder {
  color: #6b7280;
}
body.dark .manual-text-input:focus {
  border-color: #9fe870;
  box-shadow: 0 0 0 3px rgba(159, 232, 112, 0.1);
}
body.dark .add-coords-btn {
  background: #9fe870;
  color: #163300;
}
body.dark .add-coords-btn:hover {
  background: #8dd960;
}
body.dark #manual-stops-count {
  color: #6b7280;
}
body.dark #manual-clear-all {
  color: #6b7280;
}
body.dark #manual-clear-all:hover {
  color: #f87171;
}
body.dark .manual-stop-item {
  background: #1a1e30;
}
body.dark .manual-stop-item:hover {
  background: #1e2235;
}
body.dark .manual-stop-num {
  background: #9fe870;
  color: #163300;
}
body.dark .manual-stop-name {
  color: #e5e7eb;
}
body.dark .manual-stop-remove {
  color: #4b5563;
}
body.dark .manual-stop-remove:hover {
  color: #f87171;
}

body.dark .collapsible {
  border-color: #2a2d40;
}
body.dark .collapsible-header {
  background: #1a1e30;
}
body.dark .collapsible-header:hover {
  background: #1e2235;
}
body.dark .collapsible-title {
  color: #d1d5db;
}
body.dark .collapsible-opt {
  color: #6b7280;
}
body.dark .collapsible-chevron {
  color: #6b7280;
}

body.dark .location-btn {
  background: #1e2235;
  border-color: #2d5a1a;
  color: #9fe870;
}

body.dark .location-btn:hover {
  background: #1a2e1a;
  border-color: #4a8a30;
}

body.dark .divider-text {
  color: #4b5563;
}
body.dark .divider-text::before,
body.dark .divider-text::after {
  border-top-color: #2a2d40;
}

body.dark .address-autocomplete input {
  background: #1e2235;
  border-color: #2a2d40;
  color: #d1d5db;
}

body.dark .address-autocomplete input::placeholder {
  color: #6b7280;
}

body.dark .address-autocomplete input:focus {
  border-color: #9fe870;
  box-shadow: 0 0 0 3px rgba(159, 232, 112, 0.1);
}

body.dark .address-row button {
  background: #1e2235;
  border-color: #2a2d40;
  color: #d1d5db;
}

body.dark .address-row button:hover {
  background: #252940;
}

body.dark .fields-row input[type="number"] {
  background: #1e2235;
  border-color: #2a2d40;
  color: #d1d5db;
}

body.dark .fields-row input[type="number"]:focus {
  border-color: #9fe870;
}
body.dark .fields-row input::placeholder {
  color: #6b7280;
}

body.dark .suggestions-list {
  background: #1e2235;
  border-color: #2a2d40;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.4);
}

body.dark .suggestions-list li {
  border-bottom-color: #252940;
}
body.dark .suggestions-list li:hover,
body.dark .suggestions-list li.active {
  background: #252940;
}
body.dark .suggestion-main {
  color: #e5e7eb;
}
body.dark .suggestion-secondary {
  color: #6b7280;
}

body.dark #start-location-status.loc-success {
  color: #4ade80;
}
body.dark #start-location-status.loc-error {
  color: #f87171;
}
body.dark #start-location-status.loc-loading {
  color: #9ca3af;
}

body.dark .toggle-row {
  border-color: #2a2d40;
  background: #1a1e30;
}

body.dark .toggle-row:hover {
  background: #1e2235;
}
body.dark .toggle-label {
  color: #d1d5db;
}
body.dark .toggle-track {
  background: #3a3f54;
}
body.dark .toggle-track.active {
  background: #9fe870;
}

body.dark #progress-label {
  color: #d1d5db;
}
body.dark #progress-pct {
  color: #9fe870;
}
body.dark .progress-track {
  background: #2a2d40;
}
body.dark .progress-fill {
  background: linear-gradient(90deg, #2f5711, #9fe870);
}

body.dark #optimize-btn {
  background: linear-gradient(135deg, #9fe870, #2f5711);
  color: #163300;
  box-shadow: 0 4px 16px rgba(159, 232, 112, 0.25);
}

body.dark #optimize-btn:hover {
  box-shadow: 0 6px 24px rgba(159, 232, 112, 0.35);
}

body.dark #optimize-btn:disabled {
  background: #252940;
  color: #6b7280;
  box-shadow: none;
}

body.dark .status-error {
  color: #f87171;
}
body.dark .status-success {
  color: #4ade80;
}
body.dark .status-loading {
  color: #9ca3af;
}

body.dark .spinner {
  border-color: #2a2d40;
  border-top-color: #9fe870;
}

body.dark #new-route-btn {
  color: #9fe870;
}
body.dark #new-route-btn:hover {
  color: #b5f098;
}

body.dark .summary-card {
  background: #2a2d40;
  border-color: #2a2d40;
}
body.dark .summary-item {
  background: #1e2235;
}
body.dark .summary-label {
  color: #6b7280;
}
body.dark .summary-value {
  color: #e5e7eb;
}

body.dark .route-action-btn {
  background: #1e2235;
  border-color: #2a2d40;
  color: #d1d5db;
}

body.dark .route-action-btn:hover {
  background: #252940;
  border-color: #3a3f54;
}

body.dark .split-mode-toggle {
  background: #1a1e30;
}
body.dark .split-mode-btn {
  color: #8b8fa3;
}
body.dark .split-mode-btn:hover:not(.active) {
  color: #d1d5db;
}
body.dark .split-mode-btn.active {
  background: #252940;
  color: #e5e7eb;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.3);
}
body.dark .split-value-input {
  background: #1e2235;
  border-color: #2a2d40;
  color: #d1d5db;
}
body.dark .split-value-input:focus {
  border-color: #9fe870;
  box-shadow: 0 0 0 2px rgba(159, 232, 112, 0.1);
}
body.dark .split-value-label {
  color: #6b7280;
}

body.dark .stops-header {
  border-top-color: #2a2d40;
}
body.dark .stops-count-label {
  color: #6b7280;
}
body.dark .stops-dist-label {
  color: #6b7280;
}

body.dark #stops-search {
  background: #1a1e30;
  border-color: #2a2d40;
  color: #d1d5db;
}

body.dark #stops-search::placeholder {
  color: #6b7280;
}
body.dark #stops-search:focus {
  border-color: #9fe870;
  background: #1e2235;
}
body.dark .stops-search-wrap svg {
  color: #6b7280;
}

body.dark #results-list li {
  border-bottom-color: #22263a;
  color: #d1d5db;
}

body.dark #results-list li:hover {
  background: #1e2235;
}
body.dark #results-list li .stop-name {
  color: #e5e7eb;
}
body.dark .stop-sub {
  color: #6b7280;
}
body.dark .leg-info {
  color: #8b8fa3;
}

body.dark .stop-nav-btn {
  background: #1e2235;
  border-color: #2a2d40;
}

body.dark .stop-nav-btn:hover {
  background: #1a2e1a;
  border-color: #2d5a1a;
}

body.dark .stop-remove {
  color: #4b5563;
}
body.dark .stop-remove:hover {
  color: #f87171;
}

body.dark .footer-action {
  background: #1e2235;
  border-color: #2a2d40;
  color: #8b8fa3;
}

body.dark .footer-action:hover {
  background: #252940;
  color: #d1d5db;
}

body.dark .manage-stops-btn {
  background: #1e2235;
  border-color: #2a2d40;
  color: #d1d5db;
}
body.dark .manage-stops-btn:hover {
  background: #252940;
  border-color: #3a3f54;
}
body.dark .manage-stops-btn:active {
  background: #1a1e30;
}
body.dark .manage-stops-count {
  background: #252940;
  color: #6b7280;
}
body.dark .manage-stops-chevron {
  color: #6b7280;
}
body.dark .stops-modal {
  background: #16192a;
}
body.dark .stops-modal-header {
  border-bottom-color: #2a2d40;
}
body.dark .stops-modal-close {
  background: #1e2235;
  color: #8b8fa3;
}
body.dark .stops-modal-close:hover {
  background: #252940;
  color: #d1d5db;
}
body.dark .stops-modal-title {
  color: #e5e7eb;
}
body.dark .stops-modal-count {
  background: #252940;
  color: #6b7280;
}
body.dark .stops-modal-body > #add-stop-section {
  border-top-color: #2a2d40;
  background: #16192a;
}

body.dark .warnings-block {
  color: #fb923c;
}

body.dark #floating-stats {
  background: #1e2235;
  border-color: #2a2d40;
  box-shadow:
    0 2px 8px rgba(0, 0, 0, 0.2),
    0 12px 36px rgba(0, 0, 0, 0.3);
}

body.dark .floating-stat {
  border-right-color: #2a2d40;
}
body.dark .floating-stat-value {
  color: #e5e7eb;
}
body.dark .floating-stat-label {
  color: #6b7280;
}

body.dark #weather-widget {
  background: #1e2235;
  border-color: #2a2d40;
  box-shadow:
    0 2px 8px rgba(0, 0, 0, 0.2),
    0 12px 36px rgba(0, 0, 0, 0.3);
}
body.dark .weather-widget-temp {
  color: #e5e7eb;
}
body.dark .weather-widget-date {
  color: #6b7280;
}
body.dark .weather-widget-icon svg {
  color: #e5e7eb;
}

body.dark .mapkit-callout {
  background: #1e293b;
  border-color: #334155;
}
body.dark .popup-name {
  color: #f1f5f9;
}
body.dark .popup-type {
  color: #64748b;
}
body.dark .popup-location {
  color: #94a3b8;
}
body.dark .popup-nav {
  border-top-color: #334155;
}

body.dark .nav-link {
  background: #1e293b;
  border-color: #334155;
  color: #cbd5e1;
}

body.dark .nav-gmaps:hover {
  background: rgba(52, 168, 83, 0.08);
  border-color: rgba(52, 168, 83, 0.35);
  color: #4ade80;
}
body.dark .nav-waze:hover {
  background: rgba(51, 204, 255, 0.08);
  border-color: rgba(51, 204, 255, 0.35);
  color: #22d3ee;
}
body.dark .nav-copy:hover {
  background: rgba(139, 92, 246, 0.08);
  border-color: rgba(139, 92, 246, 0.35);
  color: #a78bfa;
}

body.dark .popup-leg {
  background: #162032;
  border-top-color: #334155;
}
body.dark .popup-leg-name {
  color: #e2e8f0;
}
body.dark .popup-leg-stats {
  background: #1e293b;
}
body.dark .popup-leg-dist {
  color: #cbd5e1;
}
body.dark .popup-leg-sep {
  color: #475569;
}
body.dark .popup-leg-dur {
  color: #64748b;
}

body.dark .popup-final {
  background: #0c2a1e;
  border-top-color: #14532d;
  color: #4ade80;
}

body.dark #saved-routes-empty {
  color: #6b7280;
}
body.dark .empty-title {
  color: #9ca3af;
}
body.dark .empty-hint {
  color: #6b7280;
}

body.dark .saved-route-item {
  border-bottom-color: #22263a;
}
body.dark .saved-route-item:hover {
  background: #1e2235;
}
body.dark .saved-route-icon {
  background: #1a2e1a;
  color: #9fe870;
}
body.dark .saved-route-name {
  color: #e5e7eb;
}
body.dark .saved-route-meta {
  color: #6b7280;
}
body.dark .saved-route-date {
  color: #4b5563;
}

body.dark .saved-route-load {
  background: #1e2235;
  border-color: #9fe870;
  color: #9fe870;
}

body.dark .saved-route-load:hover {
  background: #9fe870;
  color: #163300;
}

body.dark .saved-route-delete {
  background: #1e2235;
  border-color: #2a2d40;
  color: #6b7280;
}

body.dark .saved-route-delete:hover {
  border-color: #f87171;
  color: #f87171;
  background: #2a1520;
}

body.dark .numbered-marker div {
  border-color: #1a1a2e;
}

body.dark .route-action-btn .gmaps-range {
  background: #252940;
  color: #6b7280;
}

body.dark .sidebar-branding {
  border-top-color: #2a2d40;
}
body.dark .branding-link {
  color: #6b7280;
}
body.dark .branding-link:hover {
  color: #9fe870;
}
body.dark .branding-sep {
  color: #3a3f54;
}

/* ===========================
   MOBILE DRAG HANDLE (hidden on desktop)
   =========================== */
.sidebar-handle {
  display: none;
}

/* ===========================
   MOBILE / RESPONSIVE
   =========================== */
@media (max-width: 768px) {
  /* Prevent body scroll on mobile */
  html,
  body {
    overflow: hidden;
    position: fixed;
    width: 100%;
  }

  /* Hide sidebar toggle on mobile */
  .sidebar-toggle {
    display: none;
  }

  /* --- Bottom sheet sidebar --- */
  #sidebar {
    position: fixed;
    top: auto;
    left: 0;
    right: 0;
    bottom: 0;
    width: 100%;
    transform: none;
    border-radius: 20px 20px 0 0;
    box-shadow:
      0 -4px 20px rgba(0, 0, 0, 0.1),
      0 -12px 40px rgba(0, 0, 0, 0.06);
    height: var(--sheet-height, 55vh);
    max-height: 92vh;
    min-height: 80px;
    transition: height 0.3s cubic-bezier(0.25, 0.1, 0.25, 1);
    z-index: 1000;
    will-change: height;
  }

  #sidebar.dragging {
    transition: none;
  }

  /* Drag handle */
  .sidebar-handle {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 10px 0 2px;
    cursor: grab;
    flex-shrink: 0;
    touch-action: none;
    -webkit-user-select: none;
    user-select: none;
  }

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

  .handle-bar {
    width: 36px;
    height: 4px;
    border-radius: 2px;
    background: #d0d5dd;
    transition: background 0.15s;
  }

  body.dark .handle-bar {
    background: #3a3f54;
  }

  /* --- Map fills full screen --- */
  #map {
    position: fixed;
    inset: 0;
    z-index: 0;
  }

  /* --- Sidebar header --- */
  .sidebar-header {
    padding: 8px 16px 0;
  }

  .logo {
    font-size: 16px;
  }

  .header-subtitle {
    font-size: 11px;
  }

  /* --- Tab bar --- */
  .sidebar-tabs {
    padding: 8px 16px 10px;
  }

  .tab-btn {
    padding: 7px 14px;
    font-size: 12.5px;
  }

  /* --- Upload section --- */
  #upload-section {
    padding: 2px 16px 16px;
  }

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

  /* Larger touch targets for selects — font-size 16px prevents iOS zoom */
  .select-wrap select {
    padding: 12px 34px 12px 12px;
    font-size: 16px;
    -webkit-appearance: menulist-button;
    appearance: auto;
  }

  /* Hide custom chevron since native appearance is restored */
  .select-chevron {
    display: none;
  }

  /* Larger touch targets for inputs — font-size 16px prevents iOS zoom */
  .address-autocomplete input {
    padding: 12px 10px;
    font-size: 16px;
  }

  .address-row button {
    padding: 12px 14px;
    font-size: 16px;
  }

  .fields-row input[type="number"] {
    padding: 12px 10px;
    font-size: 16px;
  }

  .manual-text-input {
    font-size: 16px;
    padding: 12px 10px;
  }

  /* Location button */
  .location-btn {
    padding: 12px;
    font-size: 13px;
  }

  /* Toggle row */
  .toggle-row {
    padding: 13px 12px;
  }

  /* Collapsible */
  .collapsible-header {
    padding: 13px 12px;
  }

  /* Optimize button */
  #optimize-btn {
    padding: 15px;
    font-size: 15px;
  }

  /* --- Results section --- */
  .results-top {
    padding: 12px 16px 10px;
  }

  /* Summary card: 2x2 grid on mobile */
  .summary-card {
    grid-template-columns: 1fr 1fr;
  }

  .summary-item {
    padding: 10px 8px;
  }

  .summary-value {
    font-size: 14px;
  }

  /* Route action buttons */
  .route-action-btn {
    padding: 12px;
    font-size: 12.5px;
  }

  /* --- Split settings --- */
  .split-settings {
    flex-wrap: wrap;
  }

  .split-mode-toggle {
    width: 100%;
  }

  .split-mode-btn {
    flex: 1;
    text-align: center;
  }

  .split-value-input {
    font-size: 16px;
    width: 72px;
    padding: 8px 6px;
  }

  /* --- Manage Stops button (mobile only) --- */
  .manage-stops-btn {
    display: flex;
    align-items: center;
    gap: 8px;
    width: calc(100% - 32px);
    margin: 4px 16px 8px;
    padding: 14px 16px;
    border-radius: 12px;
    border: 1.5px solid #e0e0e0;
    background: #fff;
    font-size: 14px;
    font-weight: 600;
    color: #202124;
    cursor: pointer;
    font-family: inherit;
    transition: all 0.12s;
  }

  .manage-stops-btn:active {
    background: #f1f3f4;
    transform: scale(0.98);
  }

  .manage-stops-count {
    margin-left: auto;
    font-size: 12px;
    font-weight: 700;
    color: #9aa0a6;
    background: #f1f3f4;
    padding: 2px 8px;
    border-radius: 6px;
  }

  .manage-stops-chevron {
    color: #9aa0a6;
    flex-shrink: 0;
  }

  /* Hide inline stops content on mobile (shown in modal instead) */
  #results-container > .stops-header,
  #results-container > #results-list,
  #results-container > #add-stop-section {
    display: none;
  }

  /* --- Stops modal (full-screen slide-up) --- */
  .stops-modal[aria-hidden="false"] {
    display: flex;
    flex-direction: column;
    position: fixed;
    inset: 0;
    z-index: 1100;
    background: #fff;
    transform: translateY(100%);
    transition: transform 0.35s cubic-bezier(0.25, 0.1, 0.25, 1);
    will-change: transform;
  }

  .stops-modal.open {
    transform: translateY(0);
  }

  .stops-modal-header {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 16px 16px 12px;
    border-bottom: 1px solid #f0f0f0;
    flex-shrink: 0;
  }

  .stops-modal-close {
    width: 36px;
    height: 36px;
    border-radius: 10px;
    border: none;
    background: #f1f3f4;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    color: #5f6368;
    flex-shrink: 0;
    transition: all 0.12s;
  }

  .stops-modal-close:active {
    background: #e8eaed;
    color: #202124;
  }

  .stops-modal-title {
    font-size: 17px;
    font-weight: 700;
    color: #202124;
    flex: 1;
  }

  .stops-modal-count {
    font-size: 12px;
    font-weight: 700;
    color: #9aa0a6;
    background: #f1f3f4;
    padding: 3px 10px;
    border-radius: 6px;
  }

  .stops-modal-body {
    flex: 1;
    overflow: hidden;
    display: flex;
    flex-direction: column;
  }

  /* Make stops content visible when inside the modal */
  .stops-modal-body > .stops-header {
    display: block;
    padding: 10px 16px 6px;
    flex-shrink: 0;
  }

  .stops-modal-body > #results-list {
    display: block;
    flex: 1;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
  }

  .stops-modal-body > #add-stop-section {
    display: block;
    padding: 8px 16px;
    padding-bottom: calc(12px + env(safe-area-inset-bottom, 0px));
    border-top: 1px solid #f0f0f0;
    flex-shrink: 0;
    background: #fff;
  }

  /* Stops header */
  .stops-header {
    padding: 8px 16px 6px;
  }

  #stops-search {
    padding: 10px 10px 10px 32px;
    font-size: 14px;
  }

  /* Stop list items */
  #results-list li {
    padding: 10px 16px;
    gap: 8px;
  }

  .stop-nav-btn {
    width: 36px;
    height: 36px;
  }

  .stop-remove {
    font-size: 20px;
    padding: 0 6px;
  }

  /* Add stop */
  #add-stop-section {
    padding: 8px 16px;
  }

  #add-stop-section .address-autocomplete input {
    font-size: 14px;
  }

  /* Results footer */
  #results-footer {
    padding: 10px 16px 14px;
  }

  .footer-action {
    padding: 11px;
    font-size: 12px;
  }

  /* --- Saved routes --- */
  .saved-route-item {
    padding: 12px 16px;
  }

  .saved-route-load {
    padding: 8px 14px;
    font-size: 13px;
  }

  .saved-route-delete {
    width: 34px;
    height: 34px;
  }

  /* --- Floating stats --- */
  #floating-stats {
    left: 10px;
    right: 10px;
    bottom: auto;
    top: 10px;
    border-radius: 12px;
    justify-content: center;
  }

  .floating-stat {
    padding: 8px 12px;
    gap: 6px;
  }

  .floating-stat-value {
    font-size: 12px;
  }

  .floating-stat-label {
    font-size: 10px;
  }

  .floating-stat-emoji {
    font-size: 14px;
  }

  /* --- Weather widget mobile --- */
  #weather-widget {
    top: 10px;
    left: 10px;
    border-radius: 12px;
    padding: 8px 12px;
    gap: 8px;
  }

  .weather-widget-icon svg {
    width: 22px;
    height: 22px;
  }

  .weather-widget-temp {
    font-size: 13px;
  }
  .weather-widget-date {
    font-size: 10px;
  }

  /* Hide weather when floating stats are visible (same position) */
  #weather-widget.weather-hidden-mobile {
    display: none;
  }

  /* --- Branding footer: hide on mobile --- */
  .sidebar-branding {
    display: none;
  }

  /* --- Suggestions dropdown --- */
  .suggestions-list {
    max-height: 160px;
    border-radius: 8px;
  }

  .suggestions-list li {
    padding: 12px 10px;
  }

  /* --- MapKit callout tweaks --- */
  .mapkit-callout {
    max-width: calc(100vw - 40px);
  }

  .popup-nav {
    flex-wrap: wrap;
    gap: 4px;
    padding: 10px 12px;
  }

  .nav-link {
    padding: 10px 10px;
    font-size: 11.5px;
  }

  /* MapKit manages its own controls — no overrides needed */

  /* --- Print view --- */
  @media print {
    #sidebar {
      position: static;
      height: auto;
      width: 100%;
      border-radius: 0;
    }
    .sidebar-handle {
      display: none;
    }
  }
}

/* Extra small screens */
@media (max-width: 380px) {
  .sidebar-header {
    padding: 6px 12px 0;
  }

  .sidebar-tabs {
    padding: 6px 12px 8px;
  }

  #upload-section,
  #add-stop-section {
    padding-left: 12px;
    padding-right: 12px;
  }

  .results-top {
    padding: 10px 12px 8px;
  }

  .stops-header,
  #results-footer {
    padding-left: 12px;
    padding-right: 12px;
  }

  #results-list li {
    padding: 10px 12px;
  }

  .saved-route-item {
    padding: 12px;
  }

  .footer-action {
    padding: 10px 6px;
    font-size: 11px;
    gap: 3px;
  }

  .summary-value {
    font-size: 13px;
  }
}

/* ===========================
   RETURNING VISITOR INSIGHT POPUP
   =========================== */
.insight-overlay {
  position: fixed;
  inset: 0;
  z-index: 2000;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0, 0, 0, 0.45);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  opacity: 0;
  transition: opacity 0.3s cubic-bezier(0.25, 0.1, 0.25, 1);
  padding: 16px;
}

.insight-overlay.visible {
  opacity: 1;
}

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

.insight-popup {
  position: relative;
  width: 100%;
  max-width: 420px;
  background: #fff;
  border-radius: 18px;
  box-shadow:
    0 4px 12px rgba(0, 0, 0, 0.06),
    0 20px 50px rgba(0, 0, 0, 0.14);
  border: 1px solid rgba(0, 0, 0, 0.06);
  overflow: hidden;
  transform: translateY(12px) scale(0.97);
  transition: transform 0.3s cubic-bezier(0.25, 0.1, 0.25, 1);
}

.insight-overlay.visible .insight-popup {
  transform: translateY(0) scale(1);
}

.insight-accent {
  height: 4px;
  background: linear-gradient(90deg, #2f5711, #9fe870);
}

.insight-close {
  position: absolute;
  top: 14px;
  right: 14px;
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: none;
  border-radius: 8px;
  background: transparent;
  cursor: pointer;
  color: #9aa0a6;
  transition:
    background 0.15s,
    color 0.15s;
  z-index: 1;
}

.insight-close:hover {
  background: #f1f3f4;
  color: #5f6368;
}

#insight-form,
#insight-thanks {
  padding: 28px 24px 24px;
}

.insight-title {
  font-size: 17px;
  font-weight: 700;
  color: #202124;
  margin: 0 0 6px;
  letter-spacing: -0.02em;
  line-height: 1.3;
  padding-right: 28px;
}

.insight-subtitle {
  font-size: 13px;
  color: #5f6368;
  margin: 0 0 20px;
  line-height: 1.5;
}

.insight-field {
  margin-bottom: 16px;
}

.insight-label {
  display: block;
  font-size: 11px;
  font-weight: 600;
  color: #5f6368;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  margin-bottom: 8px;
}

.insight-options {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.insight-chip {
  padding: 7px 14px;
  border: 1.5px solid #e0e0e0;
  border-radius: 10px;
  background: #fff;
  font-family: inherit;
  font-size: 13px;
  font-weight: 500;
  color: #5f6368;
  cursor: pointer;
  transition: all 0.15s;
  line-height: 1;
}

.insight-chip:hover {
  border-color: #9fe870;
  color: #2f5711;
  background: rgba(159, 232, 112, 0.06);
}

.insight-chip.selected {
  border-color: #2f5711;
  background: rgba(47, 87, 17, 0.08);
  color: #2f5711;
  font-weight: 600;
}

.insight-text {
  width: 100%;
  padding: 10px 12px;
  border: 1.5px solid #e0e0e0;
  border-radius: 10px;
  font-family: inherit;
  font-size: 13px;
  color: #202124;
  outline: none;
  transition:
    border-color 0.15s,
    box-shadow 0.15s;
  box-sizing: border-box;
}

.insight-text::placeholder {
  color: #9aa0a6;
}

.insight-text:focus {
  border-color: #2f5711;
  box-shadow: 0 0 0 3px rgba(47, 87, 17, 0.08);
}

.insight-submit {
  width: 100%;
  margin-top: 8px;
  padding: 12px;
  border: none;
  border-radius: 12px;
  background: linear-gradient(135deg, #2f5711, #163300);
  color: #fff;
  font-family: inherit;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s;
  box-shadow: 0 2px 8px rgba(47, 87, 17, 0.25);
}

.insight-submit:hover:not(:disabled) {
  transform: translateY(-1px);
  box-shadow: 0 6px 24px rgba(47, 87, 17, 0.35);
}

.insight-submit:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
}

/* Thank you view */
.insight-check-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: rgba(159, 232, 112, 0.12);
  margin: 0 auto 16px;
}

#insight-thanks .insight-title {
  text-align: center;
  padding-right: 0;
}

#insight-thanks .insight-subtitle {
  text-align: center;
  margin-bottom: 16px;
}

.insight-cta-divider {
  height: 1px;
  background: #e0e0e0;
  margin: 0 0 16px;
}

.insight-cta-text {
  font-size: 14px;
  font-weight: 600;
  color: #202124;
  text-align: center;
  margin: 0 0 12px;
}

.insight-cta-btn {
  display: block;
  width: 100%;
  padding: 12px;
  border-radius: 12px;
  background: linear-gradient(135deg, #2f5711, #163300);
  color: #fff;
  font-family: inherit;
  font-size: 14px;
  font-weight: 600;
  text-align: center;
  text-decoration: none;
  transition: all 0.15s;
  box-shadow: 0 2px 8px rgba(47, 87, 17, 0.25);
  box-sizing: border-box;
}

.insight-cta-btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 24px rgba(47, 87, 17, 0.35);
}

/* Dark mode */
body.dark .insight-overlay {
  background: rgba(0, 0, 0, 0.6);
}

body.dark .insight-popup {
  background: #16192a;
  border-color: rgba(255, 255, 255, 0.06);
  box-shadow:
    0 4px 12px rgba(0, 0, 0, 0.2),
    0 20px 50px rgba(0, 0, 0, 0.3);
}

body.dark .insight-close {
  color: #6b7280;
}

body.dark .insight-close:hover {
  background: #1e2235;
  color: #d1d5db;
}

body.dark .insight-title {
  color: #e5e7eb;
}

body.dark .insight-subtitle {
  color: #6b7280;
}

body.dark .insight-label {
  color: #8b8fa3;
}

body.dark .insight-chip {
  background: #1e2235;
  border-color: #2a2d40;
  color: #8b8fa3;
}

body.dark .insight-chip:hover {
  border-color: #9fe870;
  color: #9fe870;
  background: rgba(159, 232, 112, 0.06);
}

body.dark .insight-chip.selected {
  border-color: #9fe870;
  background: rgba(159, 232, 112, 0.1);
  color: #9fe870;
}

body.dark .insight-text {
  background: #1e2235;
  border-color: #2a2d40;
  color: #d1d5db;
}

body.dark .insight-text::placeholder {
  color: #6b7280;
}

body.dark .insight-text:focus {
  border-color: #9fe870;
  box-shadow: 0 0 0 3px rgba(159, 232, 112, 0.1);
}

body.dark .insight-submit {
  background: linear-gradient(135deg, #9fe870, #7acc50);
  color: #163300;
}

body.dark .insight-submit:hover:not(:disabled) {
  box-shadow: 0 6px 24px rgba(159, 232, 112, 0.3);
}

body.dark .insight-check-icon {
  background: rgba(159, 232, 112, 0.08);
}

body.dark .insight-cta-divider {
  background: #2a2d40;
}

body.dark .insight-cta-text {
  color: #e5e7eb;
}

body.dark .insight-cta-btn {
  background: linear-gradient(135deg, #9fe870, #7acc50);
  color: #163300;
}

body.dark .insight-cta-btn:hover {
  box-shadow: 0 6px 24px rgba(159, 232, 112, 0.3);
}

/* ============================================
   Rating popup (mirrors insight-overlay pattern)
   ============================================ */

.rating-overlay {
  position: fixed;
  inset: 0;
  z-index: 2000;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0, 0, 0, 0.45);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  opacity: 0;
  transition: opacity 0.3s cubic-bezier(0.25, 0.1, 0.25, 1);
  padding: 16px;
}

.rating-overlay.visible {
  opacity: 1;
}

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

.rating-popup {
  position: relative;
  width: 100%;
  max-width: 420px;
  background: #fff;
  border-radius: 18px;
  box-shadow:
    0 4px 12px rgba(0, 0, 0, 0.06),
    0 20px 50px rgba(0, 0, 0, 0.14);
  border: 1px solid rgba(0, 0, 0, 0.06);
  overflow: hidden;
  transform: translateY(12px) scale(0.97);
  transition: transform 0.3s cubic-bezier(0.25, 0.1, 0.25, 1);
}

.rating-overlay.visible .rating-popup {
  transform: translateY(0) scale(1);
}

.rating-accent {
  height: 4px;
  background: linear-gradient(90deg, #2f5711, #9fe870);
}

.rating-close {
  position: absolute;
  top: 14px;
  right: 14px;
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: none;
  border-radius: 8px;
  background: transparent;
  cursor: pointer;
  color: #9aa0a6;
  transition:
    background 0.15s,
    color 0.15s;
  z-index: 1;
}

.rating-close:hover {
  background: #f1f3f4;
  color: #5f6368;
}

#rating-form,
#rating-thanks {
  padding: 28px 24px 24px;
}

.rating-title {
  font-size: 17px;
  font-weight: 700;
  color: #202124;
  margin: 0 0 6px;
  letter-spacing: -0.02em;
  line-height: 1.3;
  padding-right: 28px;
}

.rating-subtitle {
  font-size: 13px;
  color: #5f6368;
  margin: 0 0 20px;
  line-height: 1.5;
}

.rating-stars {
  display: flex;
  justify-content: center;
  gap: 8px;
  margin-bottom: 16px;
}

.rating-star {
  padding: 4px;
  border: none;
  background: transparent;
  cursor: pointer;
  color: #dadce0;
  transition:
    color 0.15s,
    transform 0.15s;
}

.rating-star:hover {
  transform: scale(1.15);
}

.rating-star.hovered,
.rating-star.selected {
  color: #f59e0b;
}

.rating-star.selected svg {
  fill: #f59e0b;
}

.rating-star.hovered svg {
  fill: #fbbf24;
}

.rating-comment {
  width: 100%;
  padding: 10px 12px;
  border: 1.5px solid #e0e0e0;
  border-radius: 10px;
  font-family: inherit;
  font-size: 13px;
  color: #202124;
  outline: none;
  transition:
    border-color 0.15s,
    box-shadow 0.15s;
  box-sizing: border-box;
  resize: vertical;
}

.rating-comment::placeholder {
  color: #9aa0a6;
}

.rating-comment:focus {
  border-color: #2f5711;
  box-shadow: 0 0 0 3px rgba(47, 87, 17, 0.08);
}

.rating-submit {
  width: 100%;
  margin-top: 8px;
  padding: 12px;
  border: none;
  border-radius: 12px;
  background: linear-gradient(135deg, #2f5711, #163300);
  color: #fff;
  font-family: inherit;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s;
  box-shadow: 0 2px 8px rgba(47, 87, 17, 0.25);
}

.rating-submit:hover:not(:disabled) {
  transform: translateY(-1px);
  box-shadow: 0 6px 24px rgba(47, 87, 17, 0.35);
}

.rating-submit:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
}

.rating-check-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: rgba(159, 232, 112, 0.12);
  margin: 0 auto 16px;
}

#rating-thanks .rating-title {
  text-align: center;
  padding-right: 0;
}

#rating-thanks .rating-subtitle {
  text-align: center;
  margin-bottom: 0;
}

/* Rating dark mode */
body.dark .rating-overlay {
  background: rgba(0, 0, 0, 0.6);
}

body.dark .rating-popup {
  background: #16192a;
  border-color: rgba(255, 255, 255, 0.06);
  box-shadow:
    0 4px 12px rgba(0, 0, 0, 0.2),
    0 20px 50px rgba(0, 0, 0, 0.3);
}

body.dark .rating-close {
  color: #6b7280;
}

body.dark .rating-close:hover {
  background: #1e2235;
  color: #d1d5db;
}

body.dark .rating-title {
  color: #e5e7eb;
}

body.dark .rating-subtitle {
  color: #6b7280;
}

body.dark .rating-star {
  color: #3a3d50;
}

body.dark .rating-star.hovered,
body.dark .rating-star.selected {
  color: #f59e0b;
}

body.dark .rating-comment {
  background: #1e2235;
  border-color: #2a2d40;
  color: #d1d5db;
}

body.dark .rating-comment::placeholder {
  color: #6b7280;
}

body.dark .rating-comment:focus {
  border-color: #9fe870;
  box-shadow: 0 0 0 3px rgba(159, 232, 112, 0.1);
}

body.dark .rating-submit {
  background: linear-gradient(135deg, #9fe870, #7acc50);
  color: #163300;
}

body.dark .rating-submit:hover:not(:disabled) {
  box-shadow: 0 6px 24px rgba(159, 232, 112, 0.3);
}

body.dark .rating-check-icon {
  background: rgba(159, 232, 112, 0.08);
}

/* Cookie banner dark */
body.dark .cookie-banner-inner {
  background: #16192a;
  border-color: rgba(255, 255, 255, 0.06);
  box-shadow:
    0 4px 12px rgba(0, 0, 0, 0.2),
    0 12px 40px rgba(0, 0, 0, 0.3);
}

body.dark .cookie-banner-text {
  color: #8b8fa3;
}

body.dark .cookie-banner-link {
  color: #9fe870;
}

body.dark .cookie-banner-link:hover {
  color: #b5f08e;
}

body.dark .cookie-btn-reject {
  background: #1e2235;
  color: #8b8fa3;
}

body.dark .cookie-btn-reject:hover {
  background: #252940;
  color: #d1d5db;
}

body.dark .cookie-btn-accept {
  background: linear-gradient(135deg, #9fe870, #7acc50);
  color: #163300;
}

/* Mobile responsiveness */
@media (max-width: 600px) {
  .insight-popup {
    max-width: 100%;
  }

  #insight-form,
  #insight-thanks {
    padding: 24px 18px 20px;
  }

  .insight-title {
    font-size: 16px;
  }

  .insight-chip {
    padding: 7px 12px;
    font-size: 12px;
  }

  .cookie-banner-inner {
    flex-direction: column;
    margin: 0 8px 8px;
    padding: 14px 16px;
    gap: 12px;
  }

  .cookie-banner-actions {
    width: 100%;
    justify-content: stretch;
  }

  .cookie-btn {
    flex: 1;
  }

  .cookie-banner-text {
    font-size: 12px;
  }
}
