.route-test-tools {
  display: none;
  position: absolute;
  top: 20px;
  right: 20px;
  z-index: 1100;
  width: min(370px, calc(100% - 40px));
  color: #19313d;
  pointer-events: auto;
}

.route-test-overlay { position: absolute; inset: 0; z-index: 620; width: 100%; height: 100%; pointer-events: none; font: inherit; }
.route-test-overlay[hidden] { display: none; }
.route-test-factory-marker > rect:nth-of-type(2) { filter: drop-shadow(0 3px 5px #173c3d35); }
.route-test-hit { pointer-events: stroke; cursor: grab; touch-action: none; }
.route-test-handle { pointer-events: all; cursor: grab; touch-action: none; }
.test-leg-options select { margin: 4px 0; }
.test-leg-metrics { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 5px 10px; padding: 6px 7px 8px; color: #617a76; font-size: 9px; line-height: 1.45; }
.test-leg-metrics strong { color: #19313d; font-variant-numeric: tabular-nums; }
.route-test-panel .test-leg-source { margin: 5px 0 0; padding: 5px 7px; border-radius: 6px; background: #f0f5f3; color: #526e69; font-size: 9px; overflow-wrap: anywhere; }
.route-test-panel .test-leg-source[data-source-kind="saved"] { background: #eaf5ef; color: #29634f; }
.route-test-panel .test-leg-source[data-source-kind="edited"] { background: #faf2e5; color: #815c29; }
.route-test-panel .test-source-season { margin: 0 0 11px; font-weight: 600; color: #075c55; }
.route-test-panel .test-return-note { padding: 7px 9px; border-radius: 7px; background: #f0f7f4; color: #075c55; margin-top: 0; }
.test-total-title { margin: 12px 0 -5px; font-size: 11px; color: #075c55; }
#route-test-road-points { display: flex; flex-wrap: wrap; gap: 5px; margin-bottom: 10px; }
#route-test-road-points button { padding: 5px 7px; color: #7b4b41; }

.map-only-view .route-test-tools { display: flex; flex-direction: column; align-items: flex-end; }

.route-test-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-height: 36px;
  padding: 8px 12px;
  border: 1px solid #dce5e6;
  border-radius: 10px;
  background: #fff;
  color: #075c55;
  box-shadow: 0 4px 14px #153d421a;
  font: inherit;
  font-size: 11px;
  font-weight: 600;
  cursor: pointer;
  touch-action: manipulation;
}

.route-test-toggle[aria-expanded="true"] { border-color: #9acfc6; background: #edf8f5; }
.route-test-toggle:hover { border-color: #9acfc6; }

.route-test-panel {
  width: 100%;
  max-height: calc(100dvh - 86px);
  margin-top: 8px;
  padding: 14px;
  overflow: auto;
  overscroll-behavior: contain;
  scrollbar-width: thin;
  scrollbar-color: #a7bdb7 #f4f8f6;
  border: 1px solid #d9e6e2;
  border-radius: 14px;
  background: #fffffffa;
  box-shadow: 0 8px 32px #193c3a25;
}

.route-test-panel[hidden] { display: none !important; }

.route-test-panel > header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 7px;
}

.route-test-panel h2 { margin: 0; font-size: 14px; font-weight: 700; }
.route-test-panel p { margin: 7px 0 12px; color: #657c8d; font-size: 10px; line-height: 1.55; }
.route-test-panel label { display: block; min-width: 0; color: #49616a; font-size: 10px; line-height: 1.4; }

.route-test-panel button {
  border: 1px solid #d4e2dd;
  border-radius: 8px;
  background: #fff;
  color: #075c55;
  font: inherit;
  font-size: 10px;
  font-weight: 600;
  line-height: 1.4;
  cursor: pointer;
  touch-action: manipulation;
}

.route-test-panel button:hover:not(:disabled) { background: #edf8f5; border-color: #9acfc6; }
.route-test-panel button:disabled { opacity: .45; cursor: default; }
.route-test-tools button:focus-visible,
.route-test-panel select:focus-visible,
.route-test-panel input:focus-visible { outline: 3px solid #0d766c66; outline-offset: 2px; }

#route-test-close { flex: none; width: 28px; height: 28px; padding: 0; font-size: 16px; }

#route-test-locations { display: flex; flex-direction: column; gap: 7px; }
.route-test-location-row { display: grid; grid-template-columns: 22px minmax(0, 1fr) 80px; align-items: center; gap: 6px; }
.route-test-location-row > .number { display: grid; place-items: center; width: 22px; height: 22px; border-radius: 50%; background: #e4f3ef; color: #087368; font-size: 10px; font-weight: 700; }

.route-test-panel select,
.route-test-panel input[type="number"] {
  width: 100%;
  min-width: 0;
  height: 35px;
  padding: 6px 8px;
  border: 1px solid #d3e0dd;
  border-radius: 8px;
  background: #fff;
  color: #19313d;
  font: inherit;
  font-size: 11px;
}

.test-location-actions { display: flex; gap: 4px; justify-content: flex-end; }
.test-location-actions button { flex: none; width: 24px; height: 29px; padding: 0; font-size: 12px; }
#route-test-add { width: 100%; min-height: 34px; margin: 9px 0 13px; padding: 7px 10px; border-style: dashed; background: #f5faf8; }
#route-test-diesel { margin-top: 5px; }

.route-test-metrics { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 5px; margin: 13px 0 8px; }
.route-test-metrics > * { min-width: 0; padding: 10px 5px; border-radius: 9px; background: #edf6f2; text-align: center; overflow-wrap: anywhere; }
.route-test-metrics strong { display: block; color: #19313d; font-size: 15px; line-height: 1.35; font-variant-numeric: tabular-nums; }
.route-test-metrics small { display: block; margin-top: 3px; color: #617a76; font-size: 9px; line-height: 1.4; }
#route-test-distance,
#route-test-liters,
#route-test-cost { font-variant-numeric: tabular-nums; }

.route-test-panel #route-test-status { min-height: 16px; margin: 6px 0 11px; color: #526e69; }
.route-test-panel #route-test-status[data-state="error"] { color: #a24533; }
#route-test-legs { display: flex; flex-direction: column; gap: 5px; margin: 7px 0 10px; }
#route-test-legs button { width: 100%; min-height: 34px; padding: 7px 9px; text-align: left; overflow-wrap: anywhere; }
#route-test-legs button[aria-pressed="true"],
#route-test-legs button.is-active { background: #e6f4ef; border-color: #89c3b4; color: #075c55; }
.route-test-actions { display: flex; flex-wrap: wrap; gap: 5px; }
#route-test-undo,
#route-test-restore,
#route-test-clear { min-height: 32px; padding: 6px 10px; }
#route-test-clear { color: #7b4b41; }

@media (max-width: 760px) {
  .route-test-tools { top: 11px; right: 11px; width: min(370px, calc(100% - 22px)); }
  .route-test-panel { max-height: calc(100dvh - 67px); }
}

@media (max-width: 400px) {
  .route-test-panel { padding: 11px; }
  .route-test-location-row { grid-template-columns: 19px minmax(0, 1fr) 74px; gap: 5px; }
  .route-test-location-row > .number { width: 19px; height: 19px; }
  .test-location-actions { gap: 3px; }
  .test-location-actions button { width: 23px; }
  .route-test-metrics strong { font-size: 13px; }
}
