/* Full detail pages share the timetable's soft grouped surfaces and typography. */
:is(.home-route-detail,.home-vehicle-detail) {
  --detail-surface:rgba(255,255,255,.83);
  --detail-group:rgba(118,118,128,.065);
  --detail-line:rgba(60,60,67,.12);
  --detail-shadow:0 8px 32px rgba(24,37,49,.045);
  font-family:-apple-system,BlinkMacSystemFont,"SF Pro Text",system-ui,sans-serif;
  max-width:1120px;
  gap:22px;
  padding-bottom:64px;
}
body.night :is(.home-route-detail,.home-vehicle-detail) {
  --detail-surface:rgba(29,34,42,.91);
  --detail-group:rgba(118,118,128,.12);
  --detail-line:rgba(235,235,245,.12);
  --detail-shadow:0 8px 32px #00000012;
}
:is(.home-route-hero,.home-vehicle-hero,.home-route-vehicles,.home-vehicle-history) {
  border:1px solid var(--detail-line);
  border-radius:25px;
  background:var(--detail-surface);
  box-shadow:var(--detail-shadow),inset 0 1px 0 var(--home-glass-highlight);
  backdrop-filter:none;
  -webkit-backdrop-filter:none;
}
body.home-route-view .home-route-hero {
  display:grid;
  grid-template-columns:auto minmax(0,1fr);
  align-items:center;
  gap:20px;
  padding:30px 64px 24px 28px;
}
body.home-route-view .home-route-hero > .route-badge {
  grid-column:1;
  align-self:center;
  margin:0 6px 0 2px;
  height:42px;
  min-width:36px;
  padding:0 11px;
  font-size:32px;
}
body.home-route-view .home-route-hero .route-destination-block { grid-column:2; min-width:0; padding:0; }
body.home-route-view .home-route-hero .route-destination {
  display:block;
  font-size:28px;
  font-weight:750;
  letter-spacing:-.8px;
  line-height:1.25;
  white-space:normal;
  overflow-wrap:break-word;
}
body.home-route-view .home-route-hero .route-via { font-size:13px; line-height:1.5; margin-top:5px; color:var(--home-muted); }
.detail-page-kicker { display:block; margin-bottom:7px; color:var(--home-muted); font-size:11px; font-weight:600; line-height:1.35; letter-spacing:.15px; }
.home-route-operators { margin-top:10px; font-size:11px; line-height:1.5; }
.home-route-operator-link { text-decoration-color:var(--detail-line); }
.detail-route-actions {
  grid-column:1 / -1;
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:16px;
  margin-top:2px;
  padding-top:18px;
  border-top:1px solid var(--detail-line);
}
body.home-route-view .home-route-hero .home-route-live-count {
  display:flex;
  align-items:baseline;
  flex-direction:row;
  justify-content:flex-start;
  gap:8px;
  margin:0;
  padding:0;
  border:0;
  background:none;
  box-shadow:none;
  color:var(--home-muted);
}
body.home-route-view .home-route-hero .home-route-live-count strong { font-size:25px; font-weight:750; letter-spacing:-.6px; color:var(--home-text); }
body.home-route-view .home-route-hero .home-route-live-count span { font-size:11px; }
.detail-route-actions .route-timetable-button {
  min-height:42px;
  border:1px solid color-mix(in srgb,var(--home-accent) 30%,var(--detail-line));
  border-radius:13px;
  padding:10px 20px;
  font-size:12px;
  font-weight:650;
  color:var(--home-text);
  background:color-mix(in srgb,var(--home-accent) 13%,var(--detail-surface));
  box-shadow:inset 0 1px 0 var(--home-glass-highlight);
}
:is(.home-route-detail,.home-vehicle-detail) .home-detail-back {
  display:grid;
  place-items:center;
  padding:0;
  box-sizing:border-box;
  line-height:1;
  top:16px; right:16px; width:32px; height:32px; min-width:32px;
  border:0; border-radius:50%; background:var(--detail-group); color:var(--home-muted);
  box-shadow:none; backdrop-filter:none; -webkit-backdrop-filter:none;
}
:is(.home-route-detail,.home-vehicle-detail) .home-detail-back svg { display:block; flex:none; margin:0; width:18px; height:18px; stroke-width:2; }
:is(.home-route-detail,.home-vehicle-detail) .home-detail-back:hover { background:color-mix(in srgb,var(--home-accent) 13%,var(--detail-group)); transform:none; }
.home-vehicle-hero { grid-template-columns:minmax(200px,.85fr) minmax(0,1.15fr); gap:22px; padding:26px 62px 24px 26px; }
.home-vehicle-meta { gap:6px; min-width:0; padding:0; }
.home-vehicle-meta .detail-page-kicker { margin-bottom:4px; }
.home-vehicle-meta .vehicle-meta-label { font-size:17px; font-weight:700; letter-spacing:-.3px; }
.home-vehicle-meta .vehicle-meta-value { font-size:27px; font-weight:750; letter-spacing:-.8px; }
.home-vehicle-meta :is(.home-vehicle-company-link,.home-vehicle-company-link-static,.home-vehicle-type-link) {
  padding:0; min-height:0; border:0; background:none; box-shadow:none;
  color:var(--home-text); text-align:left; border-radius:5px; transform:none;
}
.home-vehicle-meta .home-vehicle-type-link { font-size:13px; font-weight:500; line-height:1.5; }
.home-vehicle-meta .route-vehicle-details { font-size:11px; line-height:1.5; color:var(--home-muted); }
.home-vehicle-meta .route-vehicle-class { font-size:11px; margin-top:4px; }
.home-vehicle-current { min-width:0; padding:16px; border:1px solid var(--detail-line); border-radius:18px; background:var(--detail-group); }
.home-vehicle-current .route-destination { font-size:20px; font-weight:700; letter-spacing:-.4px; line-height:1.3; white-space:normal; }
.home-vehicle-current .route-via { font-size:12px; line-height:1.45; }
.home-vehicle-route-started,.home-vehicle-route-age { color:var(--home-muted); font-size:10px; line-height:1.5; margin-top:10px; }
.home-vehicle-upcoming { padding-top:16px; border-color:var(--detail-line); gap:12px; }
.home-vehicle-upcoming-toggle { width:100%; min-height:44px; justify-content:space-between; border:0; border-radius:12px; background:var(--detail-group); color:var(--home-text); box-shadow:none; font-size:12px; font-weight:600; padding:10px 14px; }
:is(.home-route-map,.home-vehicle-map):not(.is-expanded) { border-radius:24px; border:1px solid var(--detail-line); box-shadow:var(--detail-shadow); overflow:hidden; }
:is(.home-route-map,.home-vehicle-map):not(.is-expanded)::before { border-radius:24px; box-shadow:inset 0 0 0 1px var(--home-glass-highlight); }
:is(.home-route-detail,.home-vehicle-detail) .cutout-destination { background:var(--detail-surface); border:1px solid var(--detail-line); border-radius:12px; box-shadow:0 3px 12px #00000008; }
:is(.home-route-vehicles,.home-vehicle-history) { padding:20px; }
:is(.home-route-detail,.home-vehicle-detail) .route-history-controls { gap:12px; padding:0 0 16px; margin:0 0 14px; border-bottom:1px solid var(--detail-line); background:none; box-shadow:none; }
:is(.home-route-detail,.home-vehicle-detail) :is(.route-history-title,.home-vehicle-history-title) { font-size:17px; font-weight:700; letter-spacing:-.3px; }
:is(.home-route-detail,.home-vehicle-detail) :is(.route-history-toggle,.route-history-mode-button,.home-operator-toggle,.route-history-date-step) {
  border:1px solid var(--detail-line); border-radius:11px; background:var(--detail-group); color:var(--home-text);
  box-shadow:none; backdrop-filter:none; -webkit-backdrop-filter:none; font-weight:550; transform:none;
}
:is(.home-route-detail,.home-vehicle-detail) :is(.route-history-toggle,.route-history-mode-button)[aria-pressed="true"],
:is(.home-route-detail,.home-vehicle-detail) .route-history-mode-button.is-active { background:var(--detail-surface); box-shadow:0 1px 4px #0000000d; font-weight:650; }
:is(.home-route-detail,.home-vehicle-detail) .route-vehicle-row {
  border-radius:15px; border-color:var(--detail-line); padding:15px 16px; margin-bottom:8px;
  box-shadow:none; backdrop-filter:none; -webkit-backdrop-filter:none; transition:border-color .15s ease; transform:none;
}
:is(.home-route-detail,.home-vehicle-detail) .route-vehicle-row:hover { transform:none; box-shadow:none; border-color:color-mix(in srgb,var(--home-accent) 40%,var(--detail-line)); }
:is(.home-route-detail,.home-vehicle-detail) .route-vehicle-row .route-destination { font-size:15px; line-height:1.35; font-weight:650; letter-spacing:-.15px; }
:is(.home-route-detail,.home-vehicle-detail) .route-vehicle-row .route-via { font-size:11px; line-height:1.45; }
:is(.home-route-detail,.home-vehicle-detail) .route-vehicle-row :is(.route-vehicle-type,.route-vehicle-details) { font-size:11px; line-height:1.45; color:var(--home-muted); }
:is(.home-route-detail,.home-vehicle-detail) .route-vehicle-row .route-vehicle-operator { font-size:13px; font-weight:650; }
:is(.home-route-detail,.home-vehicle-detail) .route-vehicle-row :is(.route-vehicle-status,.route-vehicle-class) { font-size:11px; }
.home-vehicle-history .route-history-periods { border:1px solid var(--detail-line); border-radius:16px; background:var(--detail-group); box-shadow:none; padding:10px; margin-top:12px; }
:is(.home-route-detail,.home-vehicle-detail) :is(button,a,input,select):focus-visible { outline:2px solid var(--home-accent); outline-offset:3px; }
@media(min-width:940px) { .home-vehicle-hero { padding:30px 64px 26px 28px; } }
@media(max-width:700px) {
  :is(.home-route-detail,.home-vehicle-detail) { gap:16px; }
  body.home-route-view .home-route-hero { grid-template-columns:auto minmax(0,1fr); gap:16px; padding:24px 18px 18px; }
  body.home-route-view .home-route-hero > .route-badge { grid-column:1; max-width:none; height:34px; font-size:25px; padding:0 8px; margin-right:2px; }
  body.home-route-view .home-route-hero .route-destination-block { grid-column:2; width:auto; padding-right:25px; }
  body.home-route-view .home-route-hero .route-destination { font-size:22px; line-height:1.3; }
  body.home-route-view .home-route-hero:has(.route-badge-text--city) { grid-template-columns:minmax(0,1fr); }
  body.home-route-view .home-route-hero:has(.route-badge-text--city) .route-destination-block { grid-column:1; }
  .detail-route-actions { padding-top:14px; }
  .home-vehicle-hero { grid-template-columns:minmax(0,1fr); padding:24px 18px 18px; gap:18px; }
  .home-vehicle-meta { padding-right:26px; }
  :is(.home-route-vehicles,.home-vehicle-history) { padding:14px; border-radius:21px; }
  :is(.home-route-map,.home-vehicle-map):not(.is-expanded) { border-radius:21px; }
  :is(.home-route-detail,.home-vehicle-detail) .route-vehicle-row { padding:13px 12px; }
}
@media(prefers-reduced-motion:reduce) { :is(.home-route-detail,.home-vehicle-detail) .route-vehicle-row { transition:none; } }

/* Retain route identity as a tint rather than filling the entire overview. */
body :is(#home-route-hero,#home-vehicle-hero).home-result--route-tinted {
  border-color:color-mix(in srgb,var(--home-result-route-color,var(--home-accent)) 22%,var(--detail-line));
  background:linear-gradient(135deg,color-mix(in srgb,var(--home-result-route-color,var(--home-accent)) 7%,var(--detail-surface)),var(--detail-surface));
  box-shadow:var(--detail-shadow),inset 0 1px 0 var(--home-glass-highlight);
}
body :is(#home-route-detail,#home-vehicle-detail) .route-vehicle-row--route-tinted {
  border-color:color-mix(in srgb,var(--route-row-color,var(--home-accent)) 25%,var(--detail-line));
  background:linear-gradient(125deg,color-mix(in srgb,var(--route-row-color,var(--home-accent)) 10%,var(--detail-surface)),color-mix(in srgb,var(--route-row-color,var(--home-accent)) 4%,var(--detail-surface)));
  box-shadow:none;
}
body #home-vehicle-history .route-history-periods .route-vehicle-row--route-tinted {
  background:color-mix(in srgb,var(--route-row-color,var(--home-accent)) 9%,var(--detail-surface)) !important;
}
body :is(#home-route-detail,#home-vehicle-detail) .route-history-controls-main { background:var(--detail-group); border-radius:13px; padding:5px; gap:6px; }
body :is(#home-route-detail,#home-vehicle-detail) .route-history-mode-button.is-active {
  color:var(--home-text); background:var(--detail-surface); border-color:var(--detail-line);
  border-radius:10px; box-shadow:0 1px 4px #0000000d; text-shadow:none;
}
body :is(#home-route-detail,#home-vehicle-detail) .route-history-toggle {
  background:var(--detail-group); color:var(--home-text); border-color:var(--detail-line); text-shadow:none;
  box-shadow:none; border-radius:11px;
}
body :is(#home-route-detail,#home-vehicle-detail) .route-history-toggle[aria-pressed="true"] {
  background:color-mix(in srgb,var(--home-accent) 13%,var(--detail-surface));
  color:var(--home-text);
}
.home-route-vehicles .route-fleet-summary { padding:14px; margin:0 0 16px; border-radius:16px; border-color:var(--detail-line); background:var(--detail-group); box-shadow:none; }
.home-route-vehicles .route-fleet-summary h3 { font-size:13px; font-weight:650; letter-spacing:-.1px; }
.home-vehicle-upcoming-body { border-radius:14px; background:var(--detail-group); }
:is(.home-route-detail,.home-vehicle-detail),
:is(.home-route-detail,.home-vehicle-detail) > :is(.home-route-hero,.home-vehicle-hero,.home-route-vehicles,.home-vehicle-history,.home-route-map,.home-vehicle-map) { box-sizing:border-box; min-width:0; }

/* Compact overview banners and a more consistent, readable type scale. */
.home-vehicle-hero {
  align-items:start;
  gap:12px 20px;
  padding:20px 58px 18px 22px;
}
.home-vehicle-meta { align-content:start; gap:3px; }
.home-vehicle-meta .detail-page-kicker { margin-bottom:2px; font-size:11px; }
.home-vehicle-meta .vehicle-meta-label { font-size:16px; line-height:1.35; }
.home-vehicle-meta .vehicle-meta-value { font-size:24px; line-height:1.2; letter-spacing:-.5px; }
.home-vehicle-meta .home-vehicle-type-link { font-size:14px; line-height:1.4; }
.home-vehicle-meta .route-vehicle-details { font-size:12px; line-height:1.4; }
.home-vehicle-meta .route-vehicle-class { font-size:12px; line-height:1.3; margin-top:2px; }
.home-vehicle-current { align-self:start; padding:12px 14px; gap:4px; border-radius:15px; }
.home-vehicle-current .detail-page-kicker { margin-bottom:3px; }
.home-vehicle-current .route-destination { font-size:19px; line-height:1.3; letter-spacing:-.3px; }
.home-vehicle-current .route-via { font-size:12px; }
.home-vehicle-route-started,.home-vehicle-route-age { font-size:11px; margin-top:5px; }
.home-vehicle-upcoming { gap:8px; padding-top:10px; }
.home-vehicle-upcoming-toggle { min-height:40px; padding:9px 12px; font-size:13px; }
body.home-route-view .home-route-hero { padding:20px 58px 18px 22px; gap:16px; }
body.home-route-view .home-route-hero .route-destination { font-size:24px; letter-spacing:-.5px; line-height:1.3; }
body.home-route-view .home-route-hero > .route-badge { height:36px; min-width:30px; padding:0 9px; font-size:27px; }
.home-route-operators { margin-top:6px; font-size:12px; }
.detail-page-kicker { margin-bottom:5px; font-size:11px; }
.detail-route-actions { padding-top:12px; gap:12px; }
body.home-route-view .home-route-hero .home-route-live-count strong { font-size:22px; }
body.home-route-view .home-route-hero .home-route-live-count span { font-size:12px; }
:is(.home-route-detail,.home-vehicle-detail) .route-vehicle-row .route-destination { font-size:16px; }
:is(.home-route-detail,.home-vehicle-detail) .route-vehicle-row :is(.route-vehicle-type,.route-vehicle-details,.route-via) { font-size:12px; }
:is(.home-route-detail,.home-vehicle-detail) .route-vehicle-row :is(.route-vehicle-status,.route-vehicle-class) { font-size:12px; }
@media(min-width:800px) {
  body.home-route-view .home-route-hero { grid-template-columns:auto minmax(0,1fr) auto; }
  .detail-route-actions { grid-column:3; grid-row:1; flex-direction:column; align-items:flex-end; justify-content:center; border:0; padding:0; margin:0 0 0 12px; }
}
@media(max-width:700px) {
  .home-vehicle-hero { padding:18px 16px 16px; gap:12px; }
  .home-vehicle-current { width:100%; box-sizing:border-box; }
  body.home-route-view .home-route-hero { padding:20px 16px 16px; gap:12px; }
  body.home-route-view .home-route-hero .route-destination { font-size:21px; }
  .detail-route-actions { grid-column:1 / -1; }
}

/* Cutout maps share the floating inspector's stop markers and timing labels. */
body:is(.home-route-view,.home-vehicle-view) .route-cutout-stop.home-route-stop-marker {
  display:block;
  width:12px;
  height:12px;
  padding:0;
  border:0;
  border-radius:50%;
  background:none;
  opacity:1;
  z-index:3;
  pointer-events:auto;
  cursor:pointer;
}
body:is(.home-route-view,.home-vehicle-view) .route-cutout-stop.is-terminal { width:16px; height:16px; }
body:is(.home-route-view,.home-vehicle-view) .route-cutout-stop .route-stop-map-dot { width:100%; height:100%; border:2px solid var(--route-color); background:#fff; box-shadow:none; }
body:is(.home-route-view,.home-vehicle-view) .route-cutout-stop.is-timing-point .route-stop-map-dot { background:var(--route-color); }
body:is(.home-route-view,.home-vehicle-view) .route-cutout-label.home-route-stop-label {
  display:block;
  width:max-content;
  max-width:none;
  min-height:0;
  padding:4px 6px;
  margin:0;
  border:1px solid color-mix(in srgb,var(--route-color) 55%,transparent);
  border-radius:6px;
  background:color-mix(in srgb,var(--route-color) 12%,#f7f8fa);
  color:#202124;
  font:600 11px/18px system-ui,sans-serif;
  letter-spacing:normal;
  box-shadow:none;
  text-shadow:none;
  backdrop-filter:none;
  -webkit-backdrop-filter:none;
  translate:0 0;
  transition:none;
  z-index:5;
  pointer-events:auto;
  cursor:pointer;
}
body.night:is(.home-route-view,.home-vehicle-view) .route-cutout-label.home-route-stop-label { background:color-mix(in srgb,var(--route-color) 18%,#171a1f); color:#e8eaed; }
body:is(.home-route-view,.home-vehicle-view) .route-cutout-label .home-route-stop-label__text { display:block; font:inherit; color:inherit; white-space:nowrap; max-width:none; overflow:visible; text-overflow:clip; text-shadow:none; }
body:is(.home-route-view,.home-vehicle-view) :is(.route-cutout-stop,.route-cutout-label):focus-visible { outline:2px solid var(--route-color); outline-offset:3px; }

/* One predictable activity switch replaces changing history/journey buttons. */
.detail-activity-tabs { display:flex; align-items:center; flex-wrap:wrap; gap:3px; width:fit-content; max-width:100%; padding:3px; border-radius:12px; background:var(--detail-group); }
.detail-activity-tabs button { flex:1 0 auto; min-height:36px; padding:8px 14px; border:0; border-radius:9px; background:transparent; color:var(--home-muted); font:550 12px/1.3 -apple-system,BlinkMacSystemFont,system-ui,sans-serif; box-shadow:none; cursor:pointer; white-space:nowrap; }
.detail-activity-tabs button[aria-pressed="true"] { background:var(--detail-surface); color:var(--home-text); box-shadow:0 1px 4px #00000012; font-weight:650; }
body :is(#home-route-detail,#home-vehicle-detail) .route-history-controls-main { display:flex; flex-wrap:wrap; align-items:center; justify-content:space-between; padding:0; gap:12px; border-radius:0; background:none; }
body :is(#home-route-detail,#home-vehicle-detail) .route-history-actions { display:flex; align-items:center; gap:8px; margin-left:auto; }
body #home-vehicle-history .home-vehicle-history-title { display:flex; align-items:center; justify-content:space-between; flex-wrap:wrap; gap:12px; margin:0 0 16px; padding:0 0 14px; border-bottom:1px solid var(--detail-line); }
body #home-vehicle-history .home-history-mode-switch { min-height:36px; width:auto; padding:8px 12px; font-size:11px; font-weight:550; }
.detail-activity-description { margin:0 0 16px; color:var(--home-muted); font-size:12px; line-height:1.5; }
.detail-journey-tools { display:flex; align-items:center; flex-wrap:wrap; gap:10px 18px; margin-bottom:16px; padding:12px; background:var(--detail-group); border-radius:13px; }
.detail-journey-tools label { display:flex; align-items:center; gap:10px; font-size:11px; color:var(--home-muted); }
.detail-journey-tools p { margin:0; font-size:11px; color:var(--home-muted); line-height:1.5; }
:is(.home-route-detail,.home-vehicle-detail) .route-trip-history-summary { border:1px solid var(--detail-line); border-radius:13px; background:var(--detail-group); box-shadow:none; padding:12px 14px; margin-bottom:12px; }
:is(.home-route-detail,.home-vehicle-detail) .route-trip-history-summary-label { font-size:10px; color:var(--home-muted); }
:is(.home-route-detail,.home-vehicle-detail) .route-trip-history-summary-main strong { font-size:13px; }
:is(.home-route-detail,.home-vehicle-detail) .route-trip-history-summary-stats { font-size:11px; }

/* Vehicle identity is one compact group, not a stack of competing headings. */
body #home-vehicle-hero .home-vehicle-meta { display:flex; flex-direction:column; align-items:flex-start; gap:4px; }
body #home-vehicle-hero .home-vehicle-meta > .detail-page-kicker { display:none; }
body #home-vehicle-hero .home-vehicle-company-link,body #home-vehicle-hero .home-vehicle-company-link-static { display:flex; align-items:baseline; flex-wrap:wrap; gap:8px; margin:0 0 2px; padding:0; min-height:0; }
body #home-vehicle-hero .vehicle-meta-label { font-size:16px; font-weight:650; line-height:1.35; }
body #home-vehicle-hero .vehicle-meta-value { font-size:23px; font-weight:750; line-height:1.2; letter-spacing:-.45px; }
body #home-vehicle-hero .home-vehicle-type-link { font-size:14px; font-weight:500; line-height:1.4; }
body #home-vehicle-hero .route-vehicle-details { font-size:12px; line-height:1.4; margin:0; }
body #home-vehicle-hero .home-vehicle-meta > .route-vehicle-class { font-size:11px; line-height:1.3; margin:2px 0; }
body #home-vehicle-hero .home-vehicle-occupancy { margin:2px 0 0; }
body #home-vehicle-hero { padding:18px 58px 16px 20px; gap:12px 18px; }

/* The same quiet timeline as the floating bus panel. */
body #home-vehicle-hero .home-vehicle-upcoming { padding-top:10px; gap:8px; }
body #home-vehicle-hero .home-vehicle-upcoming-toggle { width:100%; min-height:40px; box-sizing:border-box; padding:9px 12px; border:0; border-radius:11px; font-size:12px; font-weight:600; line-height:1.4; box-shadow:none; background:var(--detail-group); transform:none; }
.home-vehicle-upcoming-body { padding:8px; border-radius:13px; background:var(--detail-group); }
.home-vehicle-upcoming-list { display:flex; flex-direction:column; gap:0; border:0; }
body #home-vehicle-hero .home-vehicle-upcoming-stop { position:relative; display:flex; flex:0 0 auto; align-items:center; justify-content:space-between; gap:14px; width:100%; min-height:44px; box-sizing:border-box; padding:9px 8px 9px 28px; border:0; border-radius:8px; background:transparent; color:var(--home-text); box-shadow:none; text-align:left; transform:none; }
.home-vehicle-upcoming-stop::before { content:''; position:absolute; left:11px; top:0; bottom:0; width:2px; background:color-mix(in srgb,var(--home-accent) 35%,var(--detail-line)); }
.home-vehicle-upcoming-stop::after { content:''; position:absolute; left:8px; top:calc(50% - 4px); width:8px; height:8px; box-sizing:border-box; border:2px solid var(--home-accent); border-radius:50%; background:var(--home-panel-strong); }
.home-vehicle-upcoming-stop:first-child::before { top:50%; }
.home-vehicle-upcoming-stop:last-child::before { bottom:50%; }
body #home-vehicle-hero .home-vehicle-upcoming-stop.is-current { background:color-mix(in srgb,var(--home-accent) 9%,transparent); }
.home-vehicle-upcoming-stop.is-current::after { background:var(--home-accent); }
.home-vehicle-upcoming-stop-main { min-width:0; }
.home-vehicle-upcoming-stop-heading { display:block; }
body #home-vehicle-hero .home-vehicle-upcoming-stop-name { display:inline; font-size:12px; font-weight:550; line-height:1.4; }
body #home-vehicle-hero .home-vehicle-upcoming-stop-state { display:block; font-size:9px; font-weight:400; color:var(--home-muted); margin:0 0 2px; }
body #home-vehicle-hero .home-vehicle-upcoming-stop-platform { display:inline-block; font-size:10px; padding:0 4px; margin-left:4px; border:0; border-radius:4px; background:color-mix(in srgb,var(--home-muted) 12%,transparent); color:var(--home-muted); }
body #home-vehicle-hero .stop-timing-point { display:inline-block; margin-left:4px; font-size:9px; font-weight:500; padding:1px 4px; border-radius:4px; }
.home-vehicle-upcoming-stop-times { display:flex; flex-direction:column; align-items:flex-end; gap:1px; flex:none; font-variant-numeric:tabular-nums; }
body #home-vehicle-hero .home-vehicle-upcoming-stop-time.is-primary { font-size:12px; font-weight:650; }
body #home-vehicle-hero .home-vehicle-upcoming-stop-time.is-scheduled { font-size:9px; font-weight:400; text-decoration:line-through; color:var(--home-muted); }
@media(max-width:700px) {
  body #home-vehicle-hero { padding:18px 16px 16px; }
  .detail-activity-tabs { width:100%; box-sizing:border-box; }
  .detail-activity-tabs button { flex:1; padding:8px 10px; min-width:0; }
  body #home-vehicle-history .home-vehicle-history-title { align-items:flex-start; }
  body #home-route-vehicles .route-history-actions { margin-left:0; }
}
body #home-vehicle-hero .home-vehicle-upcoming-stop.is-current .home-vehicle-upcoming-stop-name { padding:0; border:0; background:none; border-radius:0; box-shadow:none; }

/* Give historical records their own layout, independent of live vehicle rows. */
.detail-history-day { margin:24px 2px 10px; font-size:12px; font-weight:650; line-height:1.4; color:var(--home-muted); text-transform:capitalize; }
.detail-period-layout { display:grid; grid-template-columns:minmax(0,1fr) auto; align-items:center; gap:14px 24px; }
.detail-period-identity { min-width:0; display:flex; flex-direction:column; align-items:flex-start; gap:5px; }
.detail-period-identity .route-vehicle-route-main { min-width:0; width:100%; gap:12px; }
.detail-period-identity .route-destination-block { min-width:0; flex:1; }
.detail-period-label,.detail-period-count { color:var(--home-muted); font-size:11px; font-weight:500; }
.detail-period-time { display:flex; flex-direction:column; align-items:flex-end; gap:5px; min-width:0; font-variant-numeric:tabular-nums; }
.detail-period-date { color:var(--home-muted); font-size:11px; line-height:1.5; }
.detail-period-clocks { display:flex; align-items:center; gap:10px; font-size:13px; color:var(--home-text); }
.detail-period-clocks strong { font-weight:650; }
.detail-period-clocks > span { color:var(--home-muted); font-size:11px; }
body :is(#home-route-detail,#home-vehicle-detail) .detail-period-card { padding:15px 16px; border-radius:15px; margin-bottom:8px; }
body #home-vehicle-history .home-vehicle-history-route-summary.detail-period-card { padding:0; margin:0; border:0; background:none; box-shadow:none; }
body #home-vehicle-history .home-vehicle-history-route-card { padding:16px; }
body #home-vehicle-history .home-vehicle-history-route-header { display:grid; grid-template-columns:minmax(0,1fr) 32px; align-items:center; gap:12px; padding:0; }
body #home-vehicle-history .home-vehicle-history-route-header .route-history-expand { position:static; width:32px; height:32px; padding:0; transform:none; border-radius:9px; border:0; background:var(--detail-group); box-shadow:none; }
body #home-vehicle-history .home-vehicle-history-time-list { margin-top:14px; padding:8px; }
body #home-vehicle-history .home-vehicle-history-time-row { padding:10px 12px; background:var(--detail-surface); border-radius:10px; }
body #home-vehicle-history .home-vehicle-history-time-row .detail-period-time { width:100%; flex-direction:row; justify-content:space-between; align-items:center; gap:16px; }

.detail-journey-card { display:grid; grid-template-columns:minmax(0,1fr) auto; align-items:center; gap:16px 24px; padding:17px 18px; margin:0 0 9px; border:1px solid color-mix(in srgb,var(--route-row-color) 25%,var(--detail-line)); border-radius:16px; background:linear-gradient(110deg,color-mix(in srgb,var(--route-row-color) 7%,var(--detail-surface)),var(--detail-surface)); }
.detail-journey-route { display:flex; align-items:center; gap:13px; min-width:0; }
.detail-journey-route > .route-badge { flex:none; display:inline-flex; height:27px; min-width:22px; font-size:21px; padding:0 7px; border-radius:6px; }
.detail-journey-route > div { min-width:0; }
.detail-journey-destination { display:block; font-size:15px; font-weight:650; letter-spacing:-.2px; line-height:1.35; overflow-wrap:break-word; }
.detail-journey-route .route-via { display:block; font-size:12px; line-height:1.45; margin-top:3px; color:var(--home-muted); }
.detail-journey-vehicle { display:block; font-size:11px; line-height:1.5; margin-top:7px; color:var(--home-muted); }
.detail-journey-times { display:flex; align-items:center; gap:13px; font-variant-numeric:tabular-nums; }
.detail-journey-times > div { display:flex; flex-direction:column; gap:5px; }
.detail-journey-times > div > span { color:var(--home-muted); font-size:10px; }
.detail-journey-times strong { color:var(--home-text); font-size:15px; font-weight:650; letter-spacing:-.2px; }
.detail-journey-arrow { color:var(--home-muted); font-size:12px; padding-top:15px; }
.detail-journey-duration { align-self:center; margin-left:3px; padding:5px 8px; border-radius:8px; background:var(--detail-group); color:var(--home-muted); font-size:11px; white-space:nowrap; }

/* Nested journeys are disclosure rows, with dates and times in separate columns. */
body :is(#home-route-detail,#home-vehicle-detail) .route-trip-history { margin:12px 0 0; border:0; border-top:1px solid var(--detail-line); border-radius:0; background:transparent; padding:0; }
body :is(#home-route-detail,#home-vehicle-detail) .route-trip-history summary { display:flex; align-items:center; justify-content:space-between; gap:12px; list-style:none; padding:11px 0 0; font-size:11px; font-weight:550; color:var(--home-muted); cursor:pointer; }
.route-trip-history summary::-webkit-details-marker { display:none; }
body :is(#home-route-detail,#home-vehicle-detail) .route-trip-history summary small { margin-left:auto; font-size:10px; padding:3px 6px; border-radius:6px; background:var(--detail-group); }
body :is(#home-route-detail,#home-vehicle-detail) .route-trip-history summary::after { content:'⌄'; font-size:14px; }
body :is(#home-route-detail,#home-vehicle-detail) .route-trip-history[open] summary::after { content:'⌃'; }
body :is(#home-route-detail,#home-vehicle-detail) .route-trip-history-list { display:flex; flex-direction:column; gap:0; margin-top:10px; padding:0; }
body :is(#home-route-detail,#home-vehicle-detail) .route-trip-history-row { display:grid; grid-template-columns:minmax(0,1fr) auto; gap:12px; align-items:center; padding:11px 0; border:0; border-top:1px solid var(--detail-line); border-radius:0; background:none; }
body :is(#home-route-detail,#home-vehicle-detail) .route-trip-history-main { font-size:12px; line-height:1.4; font-weight:550; }
body :is(#home-route-detail,#home-vehicle-detail) .route-trip-history-meta { display:flex; align-items:center; gap:12px; color:var(--home-muted); font-size:10px; font-variant-numeric:tabular-nums; }
.route-trip-history-meta strong { color:var(--home-text); font-size:12px; font-weight:600; }
.detail-trip-duration { padding:3px 6px; border-radius:6px; background:var(--detail-group); }

/* At desktop widths, the overview and map form a pair above the activity section. */
@media(min-width:1200px) {
  :is(.home-route-detail,.home-vehicle-detail) { display:grid; grid-template-columns:minmax(0,.85fr) minmax(0,1.15fr); gap:20px; align-items:start; }
  :is(.home-route-hero,.home-vehicle-hero) { grid-column:1; grid-row:1; }
  :is(.home-route-map,.home-vehicle-map):not(.is-expanded) { grid-column:2; grid-row:1; width:100%; height:300px; min-height:0; aspect-ratio:auto; }
  :is(.home-route-vehicles,.home-vehicle-history) { grid-column:1 / -1; }
  body.home-route-view .home-route-hero { grid-template-columns:auto minmax(0,1fr); padding:24px 20px 18px; }
  body.home-route-view .home-route-hero .route-destination-block { padding-right:20px; }
  body.home-route-view .home-route-hero .route-destination { font-size:22px; }
  .detail-route-actions { grid-column:1 / -1; grid-row:auto; flex-direction:row; align-items:center; justify-content:space-between; margin:0; padding-top:14px; border-top:1px solid var(--detail-line); }
  body #home-vehicle-hero { grid-template-columns:minmax(0,1fr); padding:20px; }
  body #home-vehicle-hero .home-vehicle-meta { padding-right:30px; }
  .home-vehicle-current { padding:12px; }
}
@media(max-width:700px) {
  .detail-period-layout { grid-template-columns:minmax(0,1fr); gap:10px; }
  .detail-period-time { align-items:flex-start; }
  .detail-period-card .detail-period-time { padding-top:9px; border-top:1px solid var(--detail-line); }
  .detail-period-date { font-size:11px; }
  .detail-journey-card { grid-template-columns:minmax(0,1fr); gap:13px; padding:14px; }
  .detail-journey-times { justify-content:flex-start; gap:16px; padding-top:11px; border-top:1px solid var(--detail-line); }
  .detail-journey-duration { margin-left:auto; }
  body :is(#home-route-detail,#home-vehicle-detail) .route-trip-history-row { grid-template-columns:minmax(0,1fr); gap:6px; }
  body :is(#home-route-detail,#home-vehicle-detail) .route-trip-history-meta { justify-content:space-between; gap:8px; flex-wrap:wrap; }
}
body #home-route-vehicles .detail-history-header { display:grid; grid-template-columns:minmax(0,1fr) auto 32px; align-items:center; gap:16px; padding:0; }
body #home-route-vehicles .detail-history-header .route-history-header-top { display:block; }
body #home-route-vehicles .detail-history-header .route-history-header-main { min-width:0; }
body #home-route-vehicles .detail-history-header .route-history-latest { margin:0; color:inherit; font:inherit; text-align:right; }
body #home-route-vehicles .detail-history-header .route-history-expand { position:static; width:32px; height:32px; transform:none; background:var(--detail-group); border:0; border-radius:9px; box-shadow:none; }
body #home-route-vehicles .detail-history-header .detail-period-count { display:block; margin-top:6px; }
@media(max-width:700px) {
  body #home-route-vehicles .detail-history-header { grid-template-columns:minmax(0,1fr) 32px; gap:10px; }
  body #home-route-vehicles .detail-history-header .route-history-latest { grid-column:1; grid-row:2; text-align:left; }
  body #home-route-vehicles .detail-history-header .route-history-expand { grid-column:2; grid-row:1 / 3; }
}

/* Keep the split desktop overview compact instead of stacking two large panels. */
body #home-vehicle-hero .home-vehicle-meta :is(.home-vehicle-company-link,.home-vehicle-company-link-static,.home-vehicle-type-link) { margin:0; padding:0; }
body #home-vehicle-hero .home-vehicle-meta > :is(.route-vehicle-details,.route-vehicle-class,.home-vehicle-occupancy) { margin-left:0; }
body #home-vehicle-hero .home-vehicle-current { margin:0; min-height:0; height:auto; gap:4px; }
body #home-vehicle-hero .home-vehicle-current .detail-page-kicker { margin-bottom:3px; }
body #home-vehicle-hero .home-vehicle-route-started { margin-top:4px; font-size:11px; }
body #home-vehicle-hero .home-vehicle-upcoming { padding-top:9px; margin-top:0; }
@media(min-width:1200px) {
  body #home-vehicle-hero { grid-template-columns:minmax(0,1fr) minmax(0,1.12fr); align-items:start; gap:14px; padding:20px 18px 16px; }
  body #home-vehicle-hero .home-vehicle-meta { padding:0; gap:5px; }
  body #home-vehicle-hero .home-vehicle-current { padding:11px; border-radius:13px; }
  body #home-vehicle-hero .home-vehicle-current .route-destination { font-size:17px; line-height:1.3; }
  body #home-vehicle-hero .home-vehicle-current .route-via { font-size:11px; }
  body #home-vehicle-hero .home-vehicle-current .route-badge { font-size:20px; height:26px; min-width:22px; padding:0 6px; }
  body #home-vehicle-hero .home-vehicle-current .route-vehicle-route-main { gap:10px; }
  body #home-vehicle-hero .home-vehicle-meta .vehicle-meta-label { font-size:14px; }
  body #home-vehicle-hero .home-vehicle-meta .vehicle-meta-value { font-size:22px; }
  body #home-vehicle-hero .home-vehicle-meta .home-vehicle-type-link { font-size:13px; }
  body #home-vehicle-hero .home-vehicle-meta .route-vehicle-details { font-size:11px; }
  body #home-vehicle-hero .home-detail-back { top:8px; right:8px; width:26px; height:26px; min-width:26px; }
  body #home-vehicle-hero .home-vehicle-current { margin-top:20px; }
}

/* Journey records align by the list's width, not by each destination's length. */
:is(#home-route-vehicles,#home-vehicle-history) .route-history-list--trips { container-type:inline-size; container-name:journey-list; min-width:0; }
body :is(#home-route-vehicles,#home-vehicle-history) .detail-journey-card {
  display:grid;
  grid-template-columns:minmax(0,1fr) 250px;
  align-items:center;
  gap:20px;
  box-sizing:border-box;
  min-width:0;
  padding:16px 18px;
  margin:0 0 9px;
  overflow:visible;
}
.detail-journey-route { align-items:center; min-width:0; }
.detail-journey-route:has(.route-via) { align-items:flex-start; }
.detail-journey-route:has(.route-via) > .route-badge { margin-top:2px; }
.detail-journey-vehicle { white-space:normal; overflow-wrap:break-word; }
body :is(#home-route-vehicles,#home-vehicle-history) .detail-journey-times {
  display:grid;
  grid-template-columns:52px 16px 52px minmax(68px,1fr);
  align-items:end;
  gap:10px;
  min-width:0;
  padding:0 0 0 18px;
  border:0;
  border-left:1px solid var(--detail-line);
}
.detail-journey-times > div { align-items:flex-start; gap:5px; }
.detail-journey-times > div > span { line-height:1.3; }
.detail-journey-times strong { line-height:1.4; white-space:nowrap; }
.detail-journey-arrow { align-self:end; text-align:center; padding:0 0 3px; line-height:1.4; }
.detail-journey-duration { justify-self:end; align-self:end; margin:0; text-align:center; padding:5px 8px; font-size:11px; line-height:1.4; }
@container journey-list (max-width:740px) {
  body :is(#home-route-vehicles,#home-vehicle-history) .detail-journey-card { grid-template-columns:minmax(0,1fr); gap:12px; padding:14px; }
  body :is(#home-route-vehicles,#home-vehicle-history) .detail-journey-times { grid-template-columns:52px 16px 52px minmax(68px,1fr); border-left:0; border-top:1px solid var(--detail-line); padding:11px 0 0; gap:10px; }
}
/* Hidden native fields must not override their replacement calendar buttons. */
:is(#home-route-detail,#home-vehicle-detail) input[type="date"][hidden] { display:none !important; }
:is(#home-route-detail,#home-vehicle-detail) .app-date-trigger { display:flex; align-items:center; justify-content:center; min-height:36px; padding:6px 10px; border:0; border-radius:9px; background:var(--detail-surface); color:var(--home-text); font:600 12px/1.4 system-ui,sans-serif; cursor:pointer; }

/* Solid grouped-page surfaces replace the blurred map backdrop on detail pages. */
body:is(.home-route-view,.home-vehicle-view) {
  --detail-page-bg:#f3f3f5;
  --detail-card-bg:#fff;
  background:var(--detail-page-bg);
}
body.night:is(.home-route-view,.home-vehicle-view) {
  --detail-page-bg:#0b0c0e;
  --detail-card-bg:#151619;
}
body:is(.home-route-view,.home-vehicle-view) #home-stop-veil-surface {
  background:var(--detail-page-bg);
  backdrop-filter:none;
  -webkit-backdrop-filter:none;
}
body:is(.home-route-view,.home-vehicle-view) #map-root { filter:none; transform:none; }
body:is(.home-route-view,.home-vehicle-view) #home { padding-top:16px; }
body:is(.home-route-view,.home-vehicle-view) .site-header { background:var(--detail-page-bg); }
/* Badge-style gradients shared by both header buttons in either theme. */
body :is(#home-link,#view-map-btn) {
  --header-badge-color:var(--home-default-accent,#65c01f);
  background:linear-gradient(145deg,
    color-mix(in srgb,var(--header-badge-color) 70%,#ffffff),
    color-mix(in srgb,var(--header-badge-color) 52%,#080c10));
  border:1px solid color-mix(in srgb,var(--header-badge-color) 76%,#ffffff);
  color:#fff;
  border-radius:13px;
  box-shadow:0 4px 12px color-mix(in srgb,var(--header-badge-color) 24%,transparent),inset 0 1px 0 #ffffff57;
  backdrop-filter:none;
  -webkit-backdrop-filter:none;
  text-shadow:0 1px 2px #13210e66;
  font-weight:650;
  letter-spacing:.01em;
  transition:filter .15s ease,box-shadow .15s ease,transform .12s ease;
}
body :is(#home-link,#view-map-btn):hover {
  filter:brightness(1.06);
  box-shadow:0 6px 16px color-mix(in srgb,var(--header-badge-color) 34%,transparent),inset 0 1px 0 #ffffff70;
}
body :is(#home-link,#view-map-btn):active {
  filter:brightness(.94);
  box-shadow:inset 0 1px 3px #13210e33;
}
body :is(#home-link,#view-map-btn):focus-visible {
  outline:2px solid var(--header-badge-color);
  outline-offset:3px;
}
body :is(#home-link,#view-map-btn) {
  --header-badge-color:var(--home-accent,var(--home-default-accent,#65c01f));
  background:linear-gradient(145deg,
    color-mix(in srgb,var(--header-badge-color) 70%,#ffffff),
    color-mix(in srgb,var(--header-badge-color) 52%,#080c10));
  border-color:color-mix(in srgb,var(--header-badge-color) 76%,#ffffff);
  box-shadow:0 10px 22px color-mix(in srgb,var(--header-badge-color) 30%,transparent),inset 0 1px 0 #ffffff57;
}
body.night :is(#home-link,#view-map-btn) {
  color:#1a1d22;
  text-shadow:none;
}
body:is(.home-route-view,.home-vehicle-view) :is(.home-route-detail,.home-vehicle-detail) {
  --detail-surface:var(--detail-card-bg);
  --detail-group:rgba(118,118,128,.055);
  --detail-line:rgba(60,60,67,.12);
  max-width:1200px;
  display:flex;
  flex-direction:column;
  gap:18px;
}
body.night:is(.home-route-view,.home-vehicle-view) :is(.home-route-detail,.home-vehicle-detail) {
  --detail-group:rgba(118,118,128,.13);
  --detail-line:rgba(235,235,245,.12);
}
body :is(#home-route-hero,#home-vehicle-hero).home-result--route-tinted {
  background:linear-gradient(115deg,color-mix(in srgb,var(--home-result-route-color,var(--home-accent)) 8%,var(--detail-card-bg)),color-mix(in srgb,var(--home-result-route-color,var(--home-accent)) 2%,var(--detail-card-bg)) 75%);
  border-color:color-mix(in srgb,var(--home-result-route-color,var(--home-accent)) 14%,var(--detail-card-bg));
  box-shadow:inset 0 1px 0 #ffffff80,0 8px 28px #20362b0a;
}
body:is(.home-route-view,.home-vehicle-view) :is(.home-route-hero,.home-vehicle-hero,.home-route-vehicles,.home-vehicle-history) {
  border-radius:22px;
  background:var(--detail-card-bg);
  border-color:var(--detail-line);
  box-shadow:0 5px 22px #20362b08,0 1px 3px #20362b04;
}
body.home-route-view .home-route-hero {
  display:grid;
  grid-template-columns:auto minmax(0,1fr) auto;
  align-items:center;
  gap:20px;
  padding:22px 62px 22px 24px;
}
body.home-route-view .home-route-hero .route-destination { font-size:25px; }
body.home-route-view .home-route-hero .route-destination-block { padding:0; }
body.home-route-view .detail-route-actions { grid-column:3; grid-row:1; flex-direction:column; align-items:flex-end; justify-content:center; gap:10px; margin:0 0 0 12px; padding:0; border:0; }
body #home-vehicle-hero {
  display:grid;
  grid-template-columns:minmax(0,1fr) minmax(0,1.1fr);
  align-items:start;
  gap:14px 28px;
  padding:22px 62px 18px 24px;
}
body #home-vehicle-hero .home-vehicle-current { margin:0; padding:12px 16px; background:var(--detail-group); border:0; }
body #home-vehicle-hero .home-vehicle-meta { padding:0; gap:4px; }
body #home-vehicle-hero .home-vehicle-meta .vehicle-meta-label { font-size:16px; }
body #home-vehicle-hero .home-vehicle-meta .vehicle-meta-value {
  font-size:17px;
  font-weight:700;
  line-height:1.35;
  letter-spacing:-.2px;
}
body #home-vehicle-hero .home-vehicle-meta .home-vehicle-type-link { font-size:14px; }
body #home-vehicle-hero .home-detail-back { top:14px; right:14px; width:30px; height:30px; min-width:30px; }
body #home-vehicle-hero .home-vehicle-current .route-destination { font-size:19px; }
body #home-vehicle-hero .home-vehicle-upcoming { border-color:var(--detail-line); }
body:is(.home-route-view,.home-vehicle-view) :is(.home-route-map,.home-vehicle-map):not(.is-expanded) {
  width:100%;
  height:280px;
  min-height:0;
  aspect-ratio:auto;
  border:1px solid var(--detail-line);
  border-radius:22px;
  box-shadow:0 2px 8px #00000003;
}
body:is(.home-route-view,.home-vehicle-view) :is(.home-route-vehicles,.home-vehicle-history) { min-width:0; padding:20px; }
body:is(.home-route-view,.home-vehicle-view) .detail-history-day { margin-top:22px; font-size:11px; letter-spacing:.1px; }
body:is(.home-route-view,.home-vehicle-view) .detail-journey-card { background:var(--detail-card-bg); border-color:var(--detail-line); border-left:3px solid color-mix(in srgb,var(--route-row-color) 55%,var(--detail-line)); border-radius:13px; }
body:is(.home-route-view,.home-vehicle-view) .detail-period-card { background:var(--detail-card-bg); }
@media(min-width:1080px) {
  body:is(.home-route-view,.home-vehicle-view) :is(.home-route-detail,.home-vehicle-detail) {
    display:grid;
    grid-template-columns:minmax(0,1.8fr) minmax(300px,1fr);
    align-items:start;
    gap:20px;
  }
  body:is(.home-route-view,.home-vehicle-view) :is(.home-route-hero,.home-vehicle-hero) { grid-column:1 / -1; grid-row:1; }
  body:is(.home-route-view,.home-vehicle-view) :is(.home-route-vehicles,.home-vehicle-history) { grid-column:1; grid-row:2; }
  body:is(.home-route-view,.home-vehicle-view) :is(.home-route-map,.home-vehicle-map):not(.is-expanded) {
    grid-column:2;
    grid-row:2;
    position:sticky;
    top:84px;
    height:340px;
    align-self:start;
  }
  body:is(.home-route-view,.home-vehicle-view) :is(.home-route-detail,.home-vehicle-detail) {
    display:flex;
    flex-direction:column;
    align-items:stretch;
  }
  body:is(.home-route-view,.home-vehicle-view) :is(.home-route-map,.home-vehicle-map):not(.is-expanded) {
    position:relative;
    top:auto;
    align-self:stretch;
  }
}
@media(max-width:700px) {
  body:is(.home-route-view,.home-vehicle-view) #home { padding:12px 12px 90px; }
  body.home-route-view .home-route-hero { grid-template-columns:auto minmax(0,1fr); padding:20px 16px 16px; gap:14px; }
  body.home-route-view .home-route-hero .route-destination { font-size:21px; }
  body.home-route-view .home-route-hero .route-destination-block { padding-right:24px; }
  body.home-route-view .detail-route-actions { grid-column:1 / -1; grid-row:auto; flex-direction:row; align-items:center; justify-content:space-between; padding-top:12px; margin:0; border-top:1px solid var(--detail-line); }
  body.home-route-view .home-route-hero:has(.route-badge-text--city) { grid-template-columns:minmax(0,1fr); }
  body.home-route-view .home-route-hero:has(.route-badge-text--city) .route-destination-block { grid-column:1; }
  body #home-vehicle-hero { grid-template-columns:minmax(0,1fr); padding:20px 16px 16px; gap:12px; }
  body #home-vehicle-hero .home-vehicle-meta { padding-right:26px; }
  body:is(.home-route-view,.home-vehicle-view) :is(.home-route-vehicles,.home-vehicle-history) { padding:14px; border-radius:20px; }
  body:is(.home-route-view,.home-vehicle-view) :is(.home-route-map,.home-vehicle-map):not(.is-expanded) { height:240px; border-radius:20px; }
}

/* Give the grouped cards a little colour and tactile depth. */
body:is(.home-route-view,.home-vehicle-view) .detail-activity-tabs {
  padding:4px;
  background:color-mix(in srgb,var(--home-accent) 4%,var(--detail-card-bg));
  border:1px solid color-mix(in srgb,var(--home-accent) 5%,var(--detail-card-bg));
}
body:is(.home-route-view,.home-vehicle-view) .detail-activity-tabs button[aria-pressed="true"] {
  color:var(--home-text);
  background:var(--detail-card-bg);
  box-shadow:0 2px 7px #243b2d16;
}
body #home-vehicle-hero .home-vehicle-current {
  background:color-mix(in srgb,var(--home-result-route-color,var(--home-accent)) 6%,var(--detail-card-bg));
  border:1px solid color-mix(in srgb,var(--home-result-route-color,var(--home-accent)) 7%,var(--detail-card-bg));
}
body:is(.home-route-view,.home-vehicle-view) .detail-journey-card {
  background:linear-gradient(110deg,color-mix(in srgb,var(--route-row-color,var(--home-accent)) 5%,var(--detail-card-bg)),color-mix(in srgb,var(--route-row-color,var(--home-accent)) 2%,var(--detail-card-bg)) 85%);
  border-radius:16px;
}
body:is(.home-route-view,.home-vehicle-view) .detail-history-day {
  display:flex;
  align-items:center;
  gap:12px;
  font-size:12px;
  font-weight:650;
}
body:is(.home-route-view,.home-vehicle-view) .detail-history-day::after {
  content:'';
  height:1px;
  flex:1;
  background:var(--detail-line);
}
body:is(.home-route-view,.home-vehicle-view) :is(.home-route-map,.home-vehicle-map):not(.is-expanded) {
  border:3px solid var(--detail-card-bg);
  box-shadow:0 6px 24px #20362b12;
}
body.home-route-view .home-route-hero .detail-page-kicker {
  color:color-mix(in srgb,var(--home-result-route-color,var(--home-accent)) 65%,var(--home-text));
}

/* A restrained wash keeps every card connected to the route palette. */
body :is(#home-route-detail,#home-vehicle-detail) :is(.detail-period-card,.route-vehicle-row) {
  background:linear-gradient(115deg,color-mix(in srgb,var(--route-row-color,var(--home-accent)) 5%,var(--detail-card-bg)),color-mix(in srgb,var(--route-row-color,var(--home-accent)) 2%,var(--detail-card-bg)));
  border-color:color-mix(in srgb,var(--route-row-color,var(--home-accent)) 13%,var(--detail-card-bg));
}

body:is(.home-route-view,.home-vehicle-view) :is(.home-route-vehicles,.home-vehicle-history) {
  background:color-mix(in srgb,var(--home-accent) 2%,var(--detail-card-bg));
}
body:is(.home-route-view,.home-vehicle-view) :is(.home-route-map,.home-vehicle-map):not(.is-expanded) {
  border-color:color-mix(in srgb,var(--home-accent) 6%,var(--detail-card-bg));
}
body #home-vehicle-history .route-history-periods .route-vehicle-row--route-tinted {
  background:color-mix(in srgb,var(--route-row-color,var(--home-accent)) 5%,var(--detail-card-bg)) !important;
}

/* Soft grey daylight surfaces retain the route-colour accents. */
body:not(.night):is(.home-route-view,.home-vehicle-view) {
  --detail-page-bg:#dce1e5;
  --detail-page-backdrop:linear-gradient(180deg,#e4e8eb 0%,#d9dfe4 520px);
  --detail-card-bg:#edf0f2;
  background:var(--detail-page-backdrop);
}
body:not(.night):is(.home-route-view,.home-vehicle-view) #home-stop-veil-surface {
  background:var(--detail-page-backdrop);
}
body:not(.night):is(.home-route-view,.home-vehicle-view) .site-header {
  background:transparent;
}
body:not(.night):is(.home-route-view,.home-vehicle-view) :is(.home-route-detail,.home-vehicle-detail) {
  --detail-line:#b4bec6;
  --detail-group:#dfe5e9;
}
body:not(.night) :is(#home-route-hero,#home-vehicle-hero).home-result--route-tinted {
  background:linear-gradient(115deg,
    color-mix(in srgb,var(--home-result-route-color,var(--home-accent)) 16%,var(--detail-card-bg)),
    color-mix(in srgb,var(--home-result-route-color,var(--home-accent)) 4%,var(--detail-card-bg)) 85%);
  border-color:color-mix(in srgb,var(--home-result-route-color,var(--home-accent)) 25%,var(--detail-card-bg));
  box-shadow:0 8px 28px #354c2410,inset 0 1px 0 #ffffffb3;
}
body:not(.night):is(.home-route-view,.home-vehicle-view) :is(.home-route-vehicles,.home-vehicle-history) {
  background:var(--detail-card-bg);
  box-shadow:0 6px 24px #354c240c,0 1px 3px #354c2408;
}
body:not(.night) :is(#home-route-detail,#home-vehicle-detail) :is(.route-vehicle-row,.detail-period-card,.detail-journey-card) {
  background:linear-gradient(110deg,
    color-mix(in srgb,var(--route-row-color,var(--home-accent)) 18%,var(--detail-card-bg)),
    color-mix(in srgb,var(--route-row-color,var(--home-accent)) 9%,var(--detail-card-bg)) 85%);
  border-color:color-mix(in srgb,var(--route-row-color,var(--home-accent)) 36%,#a6afb6);
}
body:not(.night) #home-vehicle-history .route-history-periods .route-vehicle-row--route-tinted {
  background:color-mix(in srgb,var(--route-row-color,var(--home-accent)) 14%,var(--detail-card-bg)) !important;
}
body:not(.night) :is(#home-route-hero,#home-vehicle-hero).home-result--route-tinted {
  border-color:color-mix(in srgb,var(--home-result-route-color,var(--home-accent)) 32%,#a6afb6);
}
body:not(.night):is(.home-route-view,.home-vehicle-view) :is(.home-route-map,.home-vehicle-map):not(.is-expanded) {
  border-color:#a6afb6;
}
body:not(.night):is(.home-route-view,.home-vehicle-view) .detail-history-day {
  color:#59636a;
}

/* More distinct route colour in daylight, with neutral text surfaces. */
body:not(.night) :is(#home-route-hero,#home-vehicle-hero).home-result--route-tinted {
  background:linear-gradient(115deg,
    color-mix(in srgb,var(--home-result-route-color,var(--home-accent)) 22%,var(--detail-card-bg)),
    color-mix(in srgb,var(--home-result-route-color,var(--home-accent)) 12%,var(--detail-card-bg)) 85%);
  border-color:color-mix(in srgb,var(--home-result-route-color,var(--home-accent)) 42%,#a6afb6);
}
body:not(.night) :is(#home-route-detail,#home-vehicle-detail) :is(.route-vehicle-row,.detail-period-card,.detail-journey-card) {
  background:linear-gradient(110deg,
    color-mix(in srgb,var(--route-row-color,var(--home-accent)) 20%,var(--detail-card-bg)),
    color-mix(in srgb,var(--route-row-color,var(--home-accent)) 10%,var(--detail-card-bg)) 85%);
  border-color:color-mix(in srgb,var(--route-row-color,var(--home-accent)) 42%,#a6afb6);
}

/* Deeper night surfaces with richer colour in existing accented areas. */
body.night :is(#home-route-hero,#home-vehicle-hero).home-result--route-tinted {
  background:linear-gradient(115deg,
    color-mix(in srgb,var(--home-result-route-color,var(--home-accent)) 14%,var(--detail-card-bg)),
    color-mix(in srgb,var(--home-result-route-color,var(--home-accent)) 5%,var(--detail-card-bg)) 85%);
  border-color:color-mix(in srgb,var(--home-result-route-color,var(--home-accent)) 27%,var(--detail-card-bg));
}
body.night :is(#home-route-detail,#home-vehicle-detail) :is(.route-vehicle-row,.detail-period-card,.detail-journey-card) {
  background:linear-gradient(110deg,
    color-mix(in srgb,var(--route-row-color,var(--home-accent)) 11%,var(--detail-card-bg)),
    color-mix(in srgb,var(--route-row-color,var(--home-accent)) 4%,var(--detail-card-bg)) 85%);
  border-color:color-mix(in srgb,var(--route-row-color,var(--home-accent)) 24%,var(--detail-card-bg));
}
body.night #home-vehicle-history .route-history-periods .route-vehicle-row--route-tinted {
  background:color-mix(in srgb,var(--route-row-color,var(--home-accent)) 10%,var(--detail-card-bg)) !important;
}
body.night #home-vehicle-hero .home-vehicle-current {
  background:color-mix(in srgb,var(--home-result-route-color,var(--home-accent)) 11%,var(--detail-card-bg));
  border-color:color-mix(in srgb,var(--home-result-route-color,var(--home-accent)) 18%,var(--detail-card-bg));
}

/* Daylight hierarchy: crisp outlines and quiet groups. */
body:not(.night):is(.home-route-view,.home-vehicle-view) {
  --home-text:#23313d;
  --home-muted:#566471;
}
body:not(.night) :is(#home-route-hero,#home-vehicle-hero).home-result--route-tinted {
  box-shadow:0 6px 18px #23313d0a;
}
body:not(.night):is(.home-route-view,.home-vehicle-view) :is(.home-route-vehicles,.home-vehicle-history) {
  background:#e6ebee;
  border-color:#b4bec6;
  box-shadow:0 3px 12px #23313d08;
}
body:not(.night):is(.home-route-view,.home-vehicle-view) .detail-activity-tabs {
  background:#d6dee4;
  border-color:#b4bec6;
  box-shadow:inset 0 1px 2px #23313d08;
}
body:not(.night):is(.home-route-view,.home-vehicle-view) .detail-activity-tabs button[aria-pressed="true"] {
  background:#f1f4f6;
  color:#23313d;
  box-shadow:0 1px 4px #23313d21;
}
body:not(.night):is(.home-route-view,.home-vehicle-view) .detail-history-day {
  color:#425361;
}
body:not(.night):is(.home-route-view,.home-vehicle-view) :is(.home-route-map,.home-vehicle-map):not(.is-expanded) {
  border:2px solid #aab7c1;
  box-shadow:0 4px 14px #23313d10;
}

/* Quiet, clearly defined close and compact controls. */
body:not(.night) .home-detail-back {
  background:#dce3e8;
  color:#425461;
  border:1px solid #aab7c1;
  box-shadow:0 1px 3px #23313d12,inset 0 1px 0 #ffffff80;
}
body:not(.night) .home-detail-back:hover {
  background:#cdd7df;
  border-color:#8c9eac;
  color:#23313d;
}
body .route-compact-toggle-wrap .route-history-toggle--icon {
  width:36px;
  height:36px;
  min-width:36px;
  min-height:36px;
  padding:7px;
  display:inline-flex;
  align-items:center;
  justify-content:center;
  border-radius:10px;
  background:#e4e9ed !important;
  border:1px solid #aab7c1 !important;
  color:#425461 !important;
  box-shadow:0 1px 3px #23313d0c !important;
  text-shadow:none;
  transform:none;
  transition:background .15s ease,border-color .15s ease,color .15s ease;
}
body .route-compact-toggle-wrap .route-history-toggle--icon:hover {
  background:#d3dde4 !important;
  border-color:#8c9eac !important;
}
body .route-compact-toggle-wrap .route-history-toggle--icon[aria-pressed="true"] {
  background:color-mix(in srgb,var(--history-control-tint,var(--home-accent)) 25%,#e4e9ed) !important;
  border-color:color-mix(in srgb,var(--history-control-tint,var(--home-accent)) 55%,#73818c) !important;
  color:color-mix(in srgb,var(--history-control-tint,var(--home-accent)) 30%,#23313d) !important;
  box-shadow:inset 0 1px 2px #23313d14 !important;
}
body.night .route-compact-toggle-wrap .route-history-toggle--icon {
  background:#252b31 !important;
  border-color:#49535d !important;
  color:#b6c2cc !important;
  box-shadow:0 1px 3px #0003 !important;
}
body.night .route-compact-toggle-wrap .route-history-toggle--icon:hover {
  background:#333d46 !important;
  border-color:#657480 !important;
}
body.night .route-compact-toggle-wrap .route-history-toggle--icon[aria-pressed="true"] {
  background:color-mix(in srgb,var(--history-control-tint,var(--home-accent)) 23%,#252b31) !important;
  border-color:color-mix(in srgb,var(--history-control-tint,var(--home-accent)) 50%,#49535d) !important;
  color:color-mix(in srgb,var(--history-control-tint,var(--home-accent)) 35%,#e0e7ed) !important;
}
body .route-compact-toggle-wrap .route-history-toggle--icon:focus-visible,
body .home-detail-back:focus-visible {
  outline:2px solid #688ca7;
  outline-offset:3px;
}

/* Keep long line-history lists comfortably compact. */
body #home-route-vehicles .route-vehicle-grid--route-detail { position:relative; }
body #home-route-vehicles .route-vehicle-grid--route-detail > .route-vehicle-wide-route-status {
  display:flex;
  position:absolute;
  right:0;
  bottom:0;
  justify-content:flex-end;
  gap:8px;
  margin:0;
  flex-wrap:nowrap;
  line-height:16px;
}
body #home-route-vehicles .route-vehicle-grid--route-detail > .route-vehicle-wide-route-status .route-vehicle-status {
  font-size:11px;
  line-height:16px;
  padding:0 5px;
  white-space:nowrap;
  flex:none;
}
body #home-route-vehicles .route-vehicle-grid--route-detail:has(> .route-vehicle-wide-route-status:not(:empty)) > .route-vehicle-side {
  box-sizing:border-box;
  padding-bottom:22px;
}
body #home-route-vehicles .route-vehicle-grid--route-detail > .route-vehicle-wide-route-status:empty { display:none; }
body #home-route-vehicles .route-vehicle-grid--route-detail .route-vehicle-meta :is(.route-vehicle-status,.route-vehicle-minutes) { display:none; }
body #home-route-vehicles .route-history-card {
  padding:10px 14px;
  margin-bottom:6px;
}
body #home-route-vehicles .detail-history-header .detail-period-count { margin-top:3px; }
body #home-route-vehicles .route-history-card .detail-period-time { gap:3px; }
body #home-route-vehicles .route-history-card .detail-period-card {
  padding:10px 12px;
  margin-bottom:5px;
}
@media(max-width:700px) {
  body #home-route-vehicles .detail-history-header { row-gap:6px; }
  body #home-route-vehicles .route-history-card .detail-period-layout { gap:6px; }
  body #home-route-vehicles .route-history-card .detail-period-card .detail-period-time { padding-top:6px; }
}

/* Floating route inspector uses the full pages' grouped surface treatment. */
body .route-sheet {
  --inspector-surface:#edf0f2;
  --inspector-group:#dfe5e9;
  --inspector-line:#b4bec6;
  --inspector-text:#23313d;
  --inspector-muted:#566471;
  --home-muted:var(--inspector-muted);
  background:#e4e9ed;
  color:var(--inspector-text);
  border:1px solid var(--inspector-line);
  border-radius:22px;
  box-shadow:0 12px 36px #17232e29;
  backdrop-filter:none;
  -webkit-backdrop-filter:none;
}
body.night .route-sheet {
  --inspector-surface:#151619;
  --inspector-group:#252a30;
  --inspector-line:#383f47;
  --inspector-text:#dce4ec;
  --inspector-muted:#a3afbb;
  background:#101113;
  box-shadow:0 12px 36px #0006;
}
body .route-sheet .route-sheet-vehicles { gap:8px; }
body .route-sheet .route-vehicle-row--route-tinted {
  padding:11px 12px;
  border-radius:14px;
  background:linear-gradient(110deg,color-mix(in srgb,var(--route-row-color,var(--route-color)) 20%,var(--inspector-surface)),color-mix(in srgb,var(--route-row-color,var(--route-color)) 10%,var(--inspector-surface)));
  border:1px solid color-mix(in srgb,var(--route-color) 38%,var(--inspector-line));
  box-shadow:none;
  backdrop-filter:none;
  -webkit-backdrop-filter:none;
  transform:none;
}
body.night .route-sheet .route-vehicle-row--route-tinted {
  background:linear-gradient(110deg,color-mix(in srgb,var(--route-color) 11%,var(--inspector-surface)),color-mix(in srgb,var(--route-color) 4%,var(--inspector-surface)));
  border-color:color-mix(in srgb,var(--route-color) 24%,var(--inspector-line));
}
body .route-sheet .route-destination { color:var(--inspector-text); font-weight:650; }
body .route-sheet :is(.route-vehicle-type,.route-vehicle-details,.route-via) { color:var(--inspector-muted); opacity:1; }



