.shipment-route {
  --route-ink: #202a25;
  --route-muted: #56675f;
  --route-stroke: #dce5df;
  --route-paper: #fff;
  --route-surface: #f5f8f6;
  --route-active: #e9f3ed;
  --route-accent: #20583e;
  margin-block-start: 14px;
  min-width: 0;
  color: var(--route-ink);
  container-type: inline-size;
}

[data-workspace-theme="dark"] .shipment-route {
  --route-ink: #ebf0ed;
  --route-muted: #b2bfb9;
  --route-stroke: #3d4946;
  --route-paper: #232729;
  --route-surface: #2a3030;
  --route-active: #263e34;
  --route-accent: #a3dcc0;
}

.shipment-route__columns {
  display: grid;
  gap: 14px;
  align-items: start;
}

.shipment-route__hero,
.shipment-route__history {
  min-width: 0;
  background: var(--route-paper);
  border: 1px solid var(--route-stroke);
  border-radius: 17px;
  overflow: hidden;
}

.shipment-route__heading,
.shipment-route__controls {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 12px 14px;
}

.shipment-route__heading h4,
.shipment-route__history h4 {
  margin: 0;
  color: var(--route-ink);
  font-size: 16px;
  line-height: 1.4;
  font-weight: 700;
}

.shipment-route__mode {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 5px 8px;
  color: var(--route-accent);
  background: var(--route-active);
  border-radius: 999px;
  font-size: 11px;
}

.shipment-route svg:not(.shipment-map-geometry) {
  display: block;
  flex: none;
  width: 17px;
  height: 17px;
}

.shipment-route__map {
  position: relative;
  isolation: isolate;
  height: clamp(310px, 52vw, 465px);
  background: #f0f2f3;
  cursor: grab;
  overflow: hidden;
  touch-action: none;
  user-select: none;
}

.shipment-route__map.is-dragging { cursor: grabbing; }
.shipment-route__map:focus-visible { outline: 2px solid #216746; outline-offset: -2px; }

.shipment-map-geometry,
.shipment-map-labels,
.shipment-map-markers {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
}

.shipment-map-geometry path { vector-effect: non-scaling-stroke; }
.shipment-map-area { fill: none; stroke: #b0beb4; stroke-width: .75; }
.shipment-map-area[data-level="province"] { fill: #f6f7ef; stroke: #8fa397; stroke-width: 1.2; fill-rule: evenodd; }
.shipment-map-area[data-level="city"] { stroke: #9eaea1; stroke-width: 1; }
.shipment-map-area[data-level="county"] { stroke: #b9c5bb; }
.shipment-map-water { fill: #c9dfe7; stroke: #b1d2dc; stroke-width: .65; fill-rule: evenodd; }
.shipment-map-water[data-level="river"] { fill: none; stroke: #a9ccd9; }
.shipment-map-road { fill: none; stroke: #dabf9b; stroke-linecap: round; stroke-linejoin: round; stroke-width: .65; }
.shipment-map-road[data-level="motorway"],
.shipment-map-road[data-level="trunk"] { stroke: #caac84; stroke-width: 1.1; }
.shipment-map-trail { fill: none; stroke-linecap: round; stroke-linejoin: round; }
.shipment-map-trail[data-kind="road"] { stroke: #276b4c; stroke-width: 3.5; }
.shipment-map-trail[data-kind="air"] { stroke: #31738a; stroke-width: 3; }
.shipment-map-trail[data-kind="unresolved"] { stroke: #748279; stroke-width: 2; stroke-dasharray: 3 6; }
.shipment-map-trail[data-kind="future"] { stroke: #84928a; stroke-width: 1.5; stroke-dasharray: 1 7; }
.shipment-map-vehicle {
  position: absolute;
  left: 0;
  top: 0;
  z-index: 2;
  display: grid;
  place-items: center;
  width: 36px;
  height: 36px;
  color: #fff;
  background: #20583e;
  border: 2px solid #fff;
  border-radius: 50%;
  box-shadow: 0 2px 7px #173e3440;
}
.shipment-map-vehicle[hidden],
[data-map-animation-pending] .shipment-map-vehicle { visibility: hidden; }
[data-map-zoom="national"] .shipment-map-area:is([data-level="city"], [data-level="county"]),
[data-map-zoom="national"] :is(.shipment-map-road, .shipment-map-water[data-level="river"]),
[data-map-zoom="region"] .shipment-map-area[data-level="county"],
[data-map-zoom="region"] .shipment-map-water[data-level="river"],
:is([data-map-zoom="region"], [data-map-zoom="county"]) .shipment-map-road[data-level="secondary"] { display: none; }

.shipment-map-labels span {
  position: absolute;
  transform: translate(-50%, -50%);
  color: #465750;
  font-size: 11px;
  white-space: nowrap;
  text-shadow: -1px 0 #f7faf4, 1px 0 #f7faf4, 0 -1px #f7faf4, 0 1px #f7faf4;
}

.shipment-map-labels [data-map-place-level="province"],
.shipment-map-labels [data-map-place-level="city"] { font-weight: 700; }
.shipment-map-labels [data-map-place-level="town"] { color: #65726a; font-size: 10px; }

.shipment-route .shipment-map-pin {
  position: absolute;
  display: grid;
  place-items: center;
  width: 32px;
  height: 32px;
  min-width: 0;
  min-height: 0;
  padding: 0;
  transform: translate(-50%, -50%);
  color: #fff;
  background: transparent;
  border: 0;
  border-radius: 50%;
  box-shadow: none;
  pointer-events: auto;
}

.shipment-route .shipment-map-pin[hidden] { display: none; }
.shipment-map-pin i {
  width: 11px;
  height: 11px;
  background: #286549;
  border: 2px solid #fff;
  border-radius: 50%;
  box-shadow: 0 0 0 1px #82a793;
}

.shipment-map-pin:not(button) { pointer-events: none; }
.shipment-map-pin.is-origin i { background: #fff; border-color: #286549; }
.shipment-map-pin.is-destination i {
  width: 14px;
  height: 14px;
  background: #fff;
  border: 3px solid #20583e;
}
.shipment-map-pin.is-active { z-index: 1; }
.shipment-map-pin.is-active span { top: calc(100% + 5px); }
.shipment-map-pin b {
  display: block;
  color: #526c5d;
  font-size: 10px;
  font-weight: 650;
  line-height: 1.25;
}

.shipment-map-pin span {
  position: absolute;
  top: calc(100% + 1px);
  left: 50%;
  transform: translateX(-50%);
  inline-size: max-content;
  max-inline-size: 150px;
  padding: 4px 7px;
  color: #204332;
  background: #fff;
  border: 1px solid #dce6df;
  border-radius: 8px;
  box-shadow: 0 2px 6px #173e3414;
  font-size: 12px;
  line-height: 1.35;
  font-weight: 700;
  overflow-wrap: anywhere;
}

[data-map-zoom="national"] .shipment-map-pin span { visibility: hidden; }
[data-map-zoom="national"] .shipment-map-vehicle { width: 26px; height: 26px; }
[data-map-zoom="national"] .shipment-map-vehicle svg { width: 14px; height: 14px; }
[data-map-zoom="national"] .shipment-map-pin:hover span,
[data-map-zoom="national"] .shipment-map-pin:focus-visible span { visibility: visible; }

.shipment-map-pin[data-label-side="right"] span { left: -2px; transform: none; }
.shipment-map-pin[data-label-side="left"] span { left: auto; right: -2px; transform: none; }

.shipment-map-tools {
  position: absolute;
  z-index: 3;
  top: 10px;
  right: 10px;
  display: grid;
  gap: 4px;
}

.shipment-route .shipment-map-tools button,
.shipment-route .shipment-route__actions button {
  display: grid;
  place-items: center;
  min-height: 44px;
  min-width: 44px;
  padding: 0;
  border: 1px solid var(--route-stroke);
  border-radius: 11px;
  color: var(--route-accent);
  background: var(--route-paper);
  box-shadow: none;
  touch-action: manipulation;
}

.shipment-route .shipment-map-tools button {
  color: #225740;
  background: #fff;
  border-color: #d9e4dd;
  box-shadow: 0 1px 3px #1c473115;
}

.shipment-route .shipment-map-tools :is([data-map-action="national"], [data-map-action="overview"]) {
  gap: 2px;
  padding-block: 4px;
  font-size: 11px;
  line-height: 1.15;
}
.shipment-route .shipment-map-tools :is([data-map-action="national"], [data-map-action="overview"]) svg { width: 14px; height: 14px; }

.shipment-route .shipment-map-tools [aria-pressed="true"] { background: #e6f1e9; }
.shipment-route button:disabled { opacity: .53; cursor: default; }
.shipment-route button:focus-visible { outline: 2px solid #42825f; outline-offset: -2px; }

.shipment-map-meta {
  position: absolute;
  inset: auto 0 0;
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 3px;
  padding: 4px 6px;
  pointer-events: none;
}

.shipment-map-meta a, [data-map-scale] {
  color: #384b43;
  background: #f8fbf5ed;
  font-size: 10px;
  line-height: 1.45;
}

[data-map-attribution] { display: flex; flex-wrap: wrap; gap: 0 5px; justify-content: flex-end; }
.shipment-map-meta a { text-decoration: underline; pointer-events: auto; }
[data-map-scale]:not(:empty) { flex: none; border: 1px solid #53685b; border-top: 0; text-align: center; white-space: nowrap; }

.shipment-map-message {
  position: absolute;
  top: 10px;
  left: 10px;
  max-width: calc(100% - 72px);
  padding: 6px 9px;
  color: #364c42;
  background: #fff;
  border-radius: 6px;
  font-size: 12px;
}
.shipment-map-message:empty { display: none; }

.shipment-route__active {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 4px 8px;
  min-width: 0;
  overflow-wrap: anywhere;
}

.shipment-route__active strong { color: var(--route-ink); font-size: 15px; }
.shipment-route__active span, .shipment-route__active time { color: var(--route-muted); font-size: 12px; }
.shipment-route__active [data-route-precision]:not(:empty) {
  background: var(--route-active);
  border-radius: 4px;
  padding: 1px 4px;
  color: var(--route-accent);
}
.shipment-route__active time { flex-basis: 100%; }

.shipment-route__actions { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 5px; }
.shipment-route__actions:has([data-route-action="refresh"]) { flex: 0 0 auto; }
.shipment-route .shipment-route__actions [data-route-action="refresh"] {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding-inline: 10px;
  background: var(--route-active);
  font-size: 13px;
  font-weight: 650;
  white-space: nowrap;
}
.shipment-route__actions [data-route-action="refresh"][aria-disabled="true"] {
  opacity: .7;
  cursor: progress;
}
.shipment-route__refresh-status {
  margin: 0;
  padding: 0 14px 8px;
  color: var(--route-muted);
  font-size: 12px;
  line-height: 1.45;
}
.shipment-route__refresh-status:empty { display: none; }
.shipment-route__refresh-status[data-error="true"] { font-weight: 650; }

@container (max-width: 435px) {
  .shipment-route__controls:has([data-route-action="refresh"]) { flex-wrap: wrap; }
  .shipment-route__controls:has([data-route-action="refresh"]) .shipment-route__actions {
    flex: 0 1 auto;
    margin-inline-start: auto;
  }
}
.shipment-route__caption {
  margin: 0;
  padding: 0 14px 10px;
  color: var(--route-muted);
  font-size: 11px;
  line-height: 1.45;
}

.shipment-route__history { padding: 14px 10px; }
.shipment-route__history-head { padding-inline: 4px; }
.shipment-route__history-head p { margin: 4px 0 0; color: var(--route-muted); font-size: 11px; line-height: 1.5; }
.shipment-route__history ol { list-style: none; margin: 9px 0 0; padding: 0; }
.shipment-route__history li { position: relative; }
.shipment-route__history li + li { margin-top: 3px; }

.shipment-route__history li:not(:last-child)::after {
  position: absolute;
  top: 35px;
  bottom: -8px;
  left: 23px;
  width: 1px;
  background: var(--route-stroke);
  pointer-events: none;
  content: "";
}

.shipment-route .shipment-route__history button {
  display: grid;
  grid-template-columns: 28px minmax(0, 1fr);
  gap: 8px;
  align-items: start;
  width: 100%;
  min-height: 52px;
  padding: 8px 9px;
  text-align: left;
  border: 1px solid transparent;
  border-radius: 10px;
  color: var(--route-ink);
  background: transparent;
  box-shadow: none;
}

.shipment-route .shipment-route__history button[aria-current="step"] { background: var(--route-active); border-color: var(--route-stroke); }
.shipment-route__step-icon {
  display: grid;
  place-items: center;
  position: relative;
  z-index: 1;
  width: 28px;
  height: 28px;
  color: var(--route-accent);
  background: var(--route-surface);
  border: 1px solid var(--route-stroke);
  border-radius: 50%;
}

.shipment-route [aria-current="step"] .shipment-route__step-icon {
  color: var(--route-paper);
  background: var(--route-accent);
  border-color: var(--route-accent);
}

.shipment-route__step-copy { display: grid; gap: 3px; overflow-wrap: anywhere; }
.shipment-route__step-title { display: flex; align-items: baseline; gap: 6px; flex-wrap: wrap; font-size: 13px; }
.shipment-route__latest { color: var(--route-accent); font-size: 10px; }
.shipment-route__history :is(small, time), .shipment-route__empty {
  color: var(--route-muted);
  font-size: 12px;
  font-weight: 400;
}
.shipment-route__history time { font-variant-numeric: tabular-nums; }

@media (hover: hover) {
  .shipment-route .shipment-route__history button:hover:not([aria-current="step"]) { background: var(--route-surface); }
  .shipment-route .shipment-map-tools button:hover:not(:disabled) { background: #eaf5ed; }
}

@container (min-width: 740px) {
  .shipment-route__columns { grid-template-columns: minmax(0, 1.65fr) minmax(250px, 1fr); }
  .shipment-route__history { max-height: 100%; overflow: auto; scrollbar-width: thin; }
  .shipment-route__history ol { max-height: clamp(330px, 44vw, 555px); overflow: auto; }
}

@container (max-width: 370px) {
  .shipment-route__controls { padding-inline: 10px; }
  .shipment-route__actions { flex: 0 0 auto; }
}

@container (max-width: 290px) {
  .shipment-route__controls { align-items: flex-start; flex-wrap: wrap; }
  .shipment-route__actions { margin-inline-start: auto; }
}

[data-workspace-theme="dark"] #customer-app .shipment-record:has(.shipment-route) {
  background: var(--pwa-surface, #202725);
  border-color: var(--pwa-line, #42514c);
}

.shipment-map-provider {
  position: absolute;
  inset: 0;
  touch-action: none;
}

.shipment-map-provider__pin {
  position: relative;
  width: 32px;
  height: 32px;
}

.shipment-map-provider__pin .shipment-map-pin {
  left: 50%;
  top: 50%;
}

.shipment-map-provider .shipment-map-vehicle {
  position: relative;
}

.shipment-map-message { z-index: 2; }
.shipment-map-meta { z-index: 2; }
[data-map-provider] .shipment-map-meta { display: none; }

.shipment-map-vehicle:not([hidden])::before {
  content: "";
  position: absolute;
  inset: -12px;
  border: 1px solid #276b4c22;
  border-radius: 50%;
  background: #5d9c5326;
  pointer-events: none;
}

[data-map-zoom="national"] .shipment-map-vehicle::before { content: none; }

.shipment-route__journey {
  display: flex;
  flex-wrap: wrap;
  gap: .65rem 1rem;
  align-items: center;
  justify-content: space-between;
  padding: .55rem .85rem .8rem;
  border-top: 1px solid var(--route-stroke);
}
.shipment-route__ends {
  display: flex;
  gap: .55rem;
  align-items: center;
  min-width: 0;
  color: var(--route-ink);
}
.shipment-route__ends > span,
.shipment-route__eta {
  display: grid;
  min-width: 0;
  gap: .12rem;
}
.shipment-route__journey small {
  font-size: .72rem;
  color: var(--route-muted);
}
.shipment-route__journey strong {
  font-size: .86rem;
  overflow-wrap: anywhere;
}
.shipment-route__ends > svg {
  flex: none;
  color: var(--route-muted);
}
.shipment-route__eta strong {
  color: var(--route-accent);
}
.shipment-route__eta small:empty {
  display: none;
}
[data-map-zoom="national"] .shipment-map-pin:is(.is-origin, .is-destination) span {
  visibility: visible;
}
[data-map-zoom="national"] .shipment-map-pin:is(.is-origin, .is-destination) span {
  max-width: 6.5rem;
  padding: .22rem .38rem;
  font-size: .75rem;
}
