/* ═══════════════════════════════════════════════════════════════════════════
   NPTOI Dashboard — main.css
   Light theme, WCAG AA contrast
   ═══════════════════════════════════════════════════════════════════════════ */

/* ── CSS variables ──────────────────────────────────────────────────────── */
:root {
  --app-font: Inter, Roboto, "Segoe UI", Arial, sans-serif;
  --blue:      #1a73e8;
  --green:     #34a853;
  --orange:    #fa7b17;
  --red:       #ea4335;
  --surface:   #f8f9fa;
  --border:    #dadce0;
  --text:      #202124;
  --muted:     #5f6368;
  --shadow:    0 1px 4px rgba(60,64,67,.18), 0 2px 6px rgba(60,64,67,.08);
  --sidebar-w: 420px;
  --prediction-w: calc(var(--sidebar-w) * 1.75);
  --controls-h: 148px;
  --ranking-h: min(330px, calc(100vh - var(--controls-h) - 80px));
  --ranking-w: 360px;
  --ranking-open-h: 0px;
}

/* ── Reset / base ───────────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; }

body {
  margin: 0;
  font-family: var(--app-font);
  font-size: 14px;
  color: var(--text);
  background: #fff;
  overflow: hidden;
}

body.login-page {
  min-height: 100vh;
  overflow: auto;
  background: #fff;
}

body.login-page::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  background:
    linear-gradient(115deg, transparent 0 38%, rgba(26, 115, 232, .06) 38.2% 38.7%, transparent 39%),
    linear-gradient(112deg, transparent 0 45%, rgba(52, 168, 83, .055) 45.1% 45.55%, transparent 45.8%),
    linear-gradient(90deg, rgba(210, 227, 252, .28) 1px, transparent 1px),
    linear-gradient(0deg, rgba(210, 227, 252, .22) 1px, transparent 1px);
  background-size: auto, auto, 72px 72px, 72px 72px;
  mask-image: radial-gradient(circle at 50% 42%, #000 0, rgba(0, 0, 0, .82) 34%, transparent 72%);
  opacity: .9;
}

.login-shell {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 40px 20px;
}

.login-panel {
  width: min(680px, 100%);
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 22px;
  position: relative;
  z-index: 1;
}

.login-brand {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
  text-align: center;
  padding: 8px 0 0;
}

.login-logo {
  width: min(520px, 82vw);
  height: auto;
  object-fit: contain;
  filter: drop-shadow(0 14px 28px rgba(60, 64, 67, .08));
}

.login-title {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;
  gap: 8px;
  color: #58616d;
  font-size: 16px;
  font-weight: 800;
  letter-spacing: .08em;
  text-transform: uppercase;
}

.login-form {
  width: min(420px, 100%);
  margin: 0 auto;
  padding: 24px;
  border: 1px solid rgba(210, 227, 252, .95);
  border-radius: 8px;
  background: rgba(255, 255, 255, .92);
  box-shadow: 0 18px 42px rgba(60, 64, 67, .12), 0 0 0 1px rgba(255, 255, 255, .85);
  backdrop-filter: blur(6px);
}

.login-form-head {
  margin-bottom: 18px;
}

.login-form-head h1 {
  margin: 0 0 5px;
  color: #202124;
  font-size: 22px;
  font-weight: 800;
  letter-spacing: 0;
}

.login-form-head p {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.45;
}

.login-field {
  display: block;
  margin-bottom: 14px;
}

.login-field span {
  display: block;
  margin-bottom: 6px;
  color: #3c4043;
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .05em;
}

.login-field input {
  width: 100%;
  height: 42px;
  padding: 0 12px;
  border: 1px solid #d2e3fc;
  border-radius: 6px;
  background: #fff;
  color: var(--text);
  font: inherit;
  outline: none;
  transition: border-color .12s ease, box-shadow .12s ease;
}

.login-field input:focus {
  border-color: var(--blue);
  box-shadow: 0 0 0 3px rgba(26, 115, 232, .14);
}

.login-submit {
  width: 100%;
  height: 42px;
  margin-top: 4px;
  border: 0;
  border-radius: 6px;
  background: var(--blue);
  color: #fff;
  font-size: 14px;
  font-weight: 800;
  cursor: pointer;
  box-shadow: 0 8px 18px rgba(26, 115, 232, .24);
  transition: background-color .12s ease, transform .12s ease, box-shadow .12s ease;
}

.login-submit:hover {
  background: #1765cc;
  box-shadow: 0 10px 22px rgba(26, 115, 232, .28);
}

.login-submit:active {
  transform: translateY(1px);
}

.login-error {
  margin-bottom: 14px;
  padding: 9px 10px;
  border: 1px solid rgba(234, 67, 53, .26);
  border-radius: 6px;
  background: rgba(234, 67, 53, .08);
  color: #b3261e;
  font-size: 13px;
  font-weight: 700;
}

#app-splash {
  position: fixed;
  inset: 0;
  z-index: 2000;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #fff;
  transition: opacity .42s ease, visibility .42s ease;
}

.splash-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
  transform: translateY(-2vh);
}

.splash-logo {
  width: min(520px, 72vw);
  height: auto;
  object-fit: contain;
  filter: drop-shadow(0 18px 34px rgba(26, 115, 232, .08));
  animation: splashPulse 1.15s ease-in-out infinite;
}

.splash-title {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  color: #3c4043;
  font-size: 16px;
  font-weight: 800;
  letter-spacing: .08em;
  text-transform: uppercase;
}

.splash-dots {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
}

.splash-dots span {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--blue);
  opacity: .35;
  animation: splashDot 1.05s ease-in-out infinite;
}

.splash-dots span:nth-child(2) {
  animation-delay: .15s;
  background: var(--green);
}

.splash-dots span:nth-child(3) {
  animation-delay: .30s;
  background: var(--orange);
}

body.app-ready #app-splash {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}

.boot-stage {
  opacity: 0;
  transform: translateY(12px);
  transition: opacity .48s ease, transform .48s ease;
}

.boot-stage.is-visible {
  opacity: 1;
  transform: translateY(0);
}

@keyframes splashPulse {
  0%, 100% {
    opacity: .84;
    transform: scale(.975);
  }
  50% {
    opacity: 1;
    transform: scale(1.035);
  }
}

@keyframes splashDot {
  0%, 100% {
    opacity: .28;
    transform: translateY(0) scale(.86);
  }
  50% {
    opacity: 1;
    transform: translateY(-3px) scale(1.08);
  }
}

@media (prefers-reduced-motion: reduce) {
  .splash-logo,
  .splash-dots span {
    animation: none;
  }

  #app-splash,
  .boot-stage {
    transition: none;
  }
}

/* ══════════════════════════════════════════════════════════════════════════
   Controls bar
   ══════════════════════════════════════════════════════════════════════════ */
#controls-bar {
  position: fixed;
  top: 0; left: 0; right: 0;
  z-index: 200;
  background: #fff;
  border-bottom: 1px solid var(--border);
  box-shadow: var(--shadow);
}

#brand-row {
  display: grid;
  grid-template-columns: minmax(220px, 300px) 1fr minmax(180px, 250px);
  align-items: center;
  gap: 14px;
  min-height: 54px;
  padding: 5px 16px 4px;
  background: #fff;
  border-bottom: 1px solid rgba(218, 220, 224, .95);
}

#controls-row1 {
  min-height: 52px;
  gap: .75rem !important;
}

.action-controls {
  position: relative;
  display: inline-flex;
  align-items: center;
  flex-shrink: 0;
}

.action-mode-toggle {
  --mode-count: 3;
  --mode-index: 0;
  position: relative;
  display: grid;
  grid-template-columns: repeat(var(--mode-count), minmax(0, 1fr));
  gap: 2px;
  padding: 3px;
  border: 1px solid #d2e3fc;
  border-radius: 999px;
  overflow: hidden;
  background: #eef3fe;
  box-shadow: inset 0 1px 2px rgba(60, 64, 67, .08), 0 1px 2px rgba(60, 64, 67, .06);
}

.action-mode-toggle[data-mode="prediction"] { --mode-index: 1; }
.action-mode-toggle[data-mode="ranking"] { --mode-index: 2; }

.action-mode-toggle::before {
  content: "";
  position: absolute;
  top: 3px;
  bottom: 3px;
  left: 3px;
  width: calc((100% - 6px - 4px) / var(--mode-count));
  background: var(--blue);
  border-radius: 999px;
  box-shadow: 0 2px 8px rgba(26, 115, 232, .24);
  transform: translateX(calc(var(--mode-index) * (100% + 2px)));
  transition: transform .16s ease;
  z-index: 0;
}

.action-mode-toggle .btn {
  position: relative;
  z-index: 1;
  min-width: 122px;
  min-height: 32px;
  border: 0;
  border-radius: 999px;
  background: transparent;
  color: #315f9f;
  font-size: 13px;
  font-weight: 700;
  line-height: 1.1;
  padding: 0 12px;
  box-shadow: none !important;
  transition: color .12s ease, background-color .12s ease;
}

.action-mode-toggle .btn + .btn {
  border-left: 0;
}

.action-mode-toggle .btn.active,
.action-mode-toggle .btn:active {
  background: transparent;
  color: #fff;
}

.action-mode-toggle .btn:not(.active):hover {
  background: rgba(26, 115, 232, .08);
  color: #174ea6;
}

.action-mode-toggle .btn.is-unavailable {
  color: #8a98aa;
  cursor: not-allowed;
  opacity: .72;
}

.action-mode-toggle .btn.is-unavailable:hover {
  background: rgba(95, 99, 104, .08);
  color: #6f7d90;
}

.action-controls:has(#export-report.is-unavailable:hover)::after,
.action-controls:has(#export-report.is-unavailable:focus-visible)::after {
  content: attr(data-ranking-tooltip);
  position: absolute;
  right: 0;
  top: calc(100% + 8px);
  z-index: 10000;
  width: max-content;
  max-width: 280px;
  padding: 8px 10px;
  border-radius: 6px;
  background: #1f2937;
  color: #fff;
  box-shadow: 0 8px 18px rgba(15, 23, 42, .22);
  font-size: 12px;
  font-weight: 600;
  line-height: 1.35;
  white-space: normal;
  pointer-events: none;
}

.action-controls:has(#export-report.is-unavailable:hover)::before,
.action-controls:has(#export-report.is-unavailable:focus-visible)::before {
  content: "";
  position: absolute;
  right: 38px;
  top: calc(100% + 2px);
  z-index: 10001;
  border: 6px solid transparent;
  border-bottom-color: #1f2937;
  pointer-events: none;
}

.action-mode-toggle .btn:focus-visible {
  outline: 2px solid rgba(26, 115, 232, .45);
  outline-offset: 1px;
}

.network-mode-stack {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 6px;
  flex: 0 0 auto;
}

.network-toggle {
  --network-index: 2;
  position: relative;
  display: inline-grid !important;
  grid-template-columns: repeat(3, 1fr);
  gap: 2px;
  padding: 3px;
  width: 220px;
  border: 1px solid #d2e3fc;
  border-radius: 999px;
  overflow: hidden;
  background: #eef3fe;
  box-shadow: inset 0 1px 2px rgba(60, 64, 67, .08), 0 1px 2px rgba(60, 64, 67, .06);
}

.network-toggle:has(#net-arterial:checked) { --network-index: 0; }
.network-toggle:has(#net-freeway:checked) { --network-index: 1; }
.network-toggle:has(#net-both:checked) { --network-index: 2; }

.network-toggle::before {
  content: "";
  position: absolute;
  top: 3px;
  bottom: 3px;
  left: 3px;
  width: calc((100% - 10px) / 3);
  background: var(--blue);
  border-radius: 999px;
  box-shadow: 0 2px 8px rgba(26, 115, 232, .24);
  transform: translateX(calc(var(--network-index) * (100% + 2px)));
  transition: transform .16s ease;
  z-index: 0;
}

.network-toggle .btn {
  position: relative;
  z-index: 1;
  width: 100%;
  min-width: 0;
  min-height: 30px;
  display: inline-flex !important;
  align-items: center;
  justify-content: center;
  border: 0 !important;
  border-radius: 999px !important;
  background: transparent !important;
  color: #315f9f !important;
  font-size: 13px;
  font-weight: 700;
  line-height: 1.1;
  margin: 0 !important;
  padding: 0 10px !important;
  box-shadow: none !important;
}

.network-toggle .btn-check:checked + .btn {
  color: #fff !important;
}

.network-toggle .btn:hover {
  background: rgba(26, 115, 232, .08) !important;
  color: #174ea6 !important;
}

.network-toggle .btn-check:checked + .btn:hover {
  background: transparent !important;
  color: #fff !important;
}

.network-toggle .btn-check:disabled + .btn,
.network-toggle .btn.disabled {
  color: #8a949e !important;
  cursor: not-allowed;
  opacity: .48;
  pointer-events: auto;
}

.network-toggle .btn-check:disabled + .btn:hover,
.network-toggle .btn.disabled:hover {
  background: transparent !important;
  color: #8a949e !important;
}

.mode-unavailable-tooltip {
  position: fixed;
  z-index: 20000;
  max-width: 280px;
  padding: 8px 10px;
  border-radius: 6px;
  background: #1f2937;
  color: #fff;
  box-shadow: 0 8px 18px rgba(15, 23, 42, .22);
  font-size: 12px;
  font-weight: 600;
  line-height: 1.35;
  opacity: 0;
  transform: translate(-50%, 4px);
  transition: opacity .08s ease, transform .08s ease;
  pointer-events: none;
}

.mode-unavailable-tooltip.is-visible {
  opacity: 1;
  transform: translate(-50%, 0);
}

.nptoi-logo {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.nptoi-logo-img {
  display: block;
  width: min(30vw, 300px);
  min-width: 210px;
  height: 48px;
  object-fit: contain;
  object-position: left center;
}

.about-logo-button {
  width: min(30vw, 300px);
  min-width: 210px;
  height: 48px;
  display: inline-flex;
  align-items: center;
  justify-content: flex-start;
  border: 0;
  background: transparent;
  padding: 0;
  cursor: pointer;
}

.about-logo-button:hover {
  opacity: .9;
}

.about-logo-button:focus-visible {
  outline: 2px solid rgba(26, 115, 232, .65);
  outline-offset: 3px;
  border-radius: 6px;
}

.about-logo-button .nptoi-logo-img {
  width: 100%;
  min-width: 0;
}

.nptoi-emblem {
  position: relative;
  width: 48px;
  height: 48px;
  flex-shrink: 0;
  overflow: hidden;
}

.nptoi-gauge {
  position: absolute;
  inset: 3px 4px 5px 4px;
  border: 5px solid #1266d6;
  border-right-color: #12aa4b;
  border-bottom-color: transparent;
  border-radius: 50%;
  transform: rotate(-18deg);
}

.nptoi-gauge::after {
  content: "";
  position: absolute;
  right: -6px;
  top: 3px;
  width: 8px;
  height: 18px;
  border-radius: 7px;
  background: #fa7b17;
  transform: rotate(7deg);
}

.nptoi-needle {
  position: absolute;
  left: 26px;
  top: 20px;
  width: 3px;
  height: 24px;
  background: #0d47a1;
  border-radius: 999px;
  transform: rotate(41deg);
  transform-origin: top center;
}

.nptoi-needle::after {
  content: "";
  position: absolute;
  left: -4px;
  top: -5px;
  width: 11px;
  height: 11px;
  border: 3px solid #0d47a1;
  border-radius: 50%;
  background: #fff;
}

.nptoi-car {
  position: absolute;
  left: 9px;
  bottom: 10px;
  width: 17px;
  height: 10px;
  border-radius: 5px 5px 3px 3px;
  background: #1266d6;
}

.nptoi-car::before {
  content: "";
  position: absolute;
  left: 3px;
  top: -5px;
  width: 11px;
  height: 7px;
  border-radius: 6px 6px 1px 1px;
  background: #1266d6;
}

.nptoi-car::after {
  content: "";
  position: absolute;
  left: 2px;
  right: 2px;
  bottom: -3px;
  height: 4px;
  border-left: 4px solid #0d47a1;
  border-right: 4px solid #0d47a1;
}

.nptoi-road {
  position: absolute;
  bottom: 0;
  height: 28px;
  border-radius: 100% 100% 0 0;
  transform-origin: bottom center;
}

.nptoi-road-blue {
  left: 20px;
  width: 14px;
  background: #0d47a1;
  transform: skewX(-25deg) rotate(9deg);
}

.nptoi-road-green {
  right: 2px;
  width: 8px;
  background: #12aa4b;
  transform: skewX(-17deg) rotate(13deg);
}

.nptoi-dot {
  position: absolute;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #1266d6;
}

.nptoi-dot-a { left: 7px; top: 25px; }
.nptoi-dot-b { left: 18px; top: 14px; background: #fa7b17; }
.nptoi-dot-c { left: 28px; top: 9px; background: #12aa4b; }

.nptoi-wordmark {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.nptoi-word {
  font-size: 34px;
  font-weight: 900;
  font-style: italic;
  line-height: .92;
  letter-spacing: .035em;
  color: #1266d6;
}

.nptoi-word::first-letter {
  color: #1266d6;
}

.nptoi-wordmark .nptoi-word {
  background: linear-gradient(90deg, #1266d6 0%, #1266d6 66%, #10a84a 67%, #10a84a 100%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.nptoi-tagline {
  display: flex;
  align-items: center;
  gap: 8px;
  color: #0d47a1;
  font-size: 12px;
  font-weight: 800;
  line-height: 1;
  white-space: nowrap;
}

.nptoi-tagline span {
  width: 34px;
  height: 2px;
  background: currentColor;
}

.nptoi-tagline span:last-child {
  background: #10a84a;
}

.dashboard-title {
  justify-self: center;
  align-self: center;
  text-align: center;
  color: #050505;
  font-family: Inter, Roboto, "Segoe UI", Arial, sans-serif;
  font-size: clamp(15px, 1.95vw, 24px);
  font-weight: 800;
  line-height: 1.12;
  letter-spacing: .02em;
  text-transform: uppercase;
  transform: translateY(1px);
}

.partner-links {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
}

.partner-logo {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 76px;
  height: 42px;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  text-decoration: none;
  box-shadow: none;
}

.partner-logo:hover {
  opacity: .82;
}

.partner-logo img {
  display: block;
  max-width: 100%;
  max-height: 34px;
  object-fit: contain;
}

.partner-ucf {
  width: 76px;
}

.partner-fdot {
  width: 98px;
}

.compact-control {
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 2px;
}

.compact-select {
  height: 26px;
  min-width: 82px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: #fff;
  color: var(--text);
  font-family: var(--app-font);
  font-size: 12px;
  padding: 0 6px;
}

.map-overlay-control {
  margin: 10px 0 0 12px;
  display: flex;
  flex-direction: column;
  gap: 3px;
  padding: 7px 8px 8px;
  border: 1px solid rgba(218, 220, 224, .9);
  border-radius: 8px;
  background: rgba(255, 255, 255, .94);
  box-shadow: 0 2px 8px rgba(60, 64, 67, .16);
  backdrop-filter: blur(6px);
}

.map-overlay-control .compact-select {
  min-width: 108px;
}

.brand-lockup {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-width: 128px;
  color: var(--text);
  outline: none;
}

.brand-mark {
  position: relative;
  width: 32px;
  height: 32px;
  flex-shrink: 0;
  border-radius: 8px;
  background: linear-gradient(135deg, #111827 0%, #1a73e8 58%, #f4b400 100%);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .32), 0 2px 8px rgba(26, 115, 232, .18);
  overflow: hidden;
}

.brand-road {
  position: absolute;
  left: 7px;
  right: 7px;
  top: 15px;
  height: 2px;
  background: rgba(255, 255, 255, .92);
  transform: rotate(-24deg);
}

.brand-road::after {
  content: "";
  position: absolute;
  left: 8px;
  top: -9px;
  width: 2px;
  height: 20px;
  background: rgba(255, 255, 255, .72);
  transform: rotate(58deg);
}

.brand-node {
  position: absolute;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 0 0 2px rgba(244, 180, 0, .35);
}

.brand-node-a { left: 7px; bottom: 8px; }
.brand-node-b { right: 8px; top: 8px; }
.brand-node-c {
  right: 8px;
  bottom: 8px;
  background: #f4b400;
  box-shadow: 0 0 0 2px rgba(255, 255, 255, .42);
}

.brand-copy {
  display: flex;
  flex-direction: column;
  gap: 1px;
  min-width: 0;
}

.brand {
  font-weight: 800;
  font-size: 17px;
  color: var(--blue);
  white-space: nowrap;
  line-height: 1;
  letter-spacing: .01em;
}

.brand-subtitle {
  font-size: 9px;
  font-weight: 600;
  color: var(--muted);
  line-height: 1.1;
  white-space: nowrap;
}

.brand-popover {
  position: absolute;
  top: calc(100% + 10px);
  left: 0;
  z-index: 530;
  display: none;
  width: 300px;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: rgba(255, 255, 255, .98);
  box-shadow: 0 14px 36px rgba(60, 64, 67, .20), 0 4px 12px rgba(60, 64, 67, .12);
  color: var(--text);
  font-size: 11px;
  line-height: 1.35;
}

.brand-popover strong,
.brand-popover span {
  display: block;
}

.brand-popover span {
  margin-top: 6px;
  color: var(--muted);
}

.brand-lockup:hover .brand-popover,
.brand-lockup:focus-visible .brand-popover {
  display: block;
}

.control-kicker {
  font-size: 10px;
  font-weight: 700;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: .06em;
}

/* About modal */
.about-dialog {
  max-width: min(920px, calc(100vw - 32px));
}

.about-modal-content {
  position: relative;
  border: 1px solid rgba(32, 33, 36, .12);
  border-radius: 8px;
  box-shadow: 0 22px 60px rgba(32, 33, 36, .24), 0 6px 18px rgba(32, 33, 36, .16);
  overflow: hidden;
}

.about-close {
  position: absolute;
  top: 8px;
  right: 10px;
  z-index: 2;
  width: 28px;
  height: 28px;
  border: 0;
  background: transparent;
  color: #8a8f94;
  font-size: 28px;
  line-height: 1;
}

.about-close:hover {
  color: var(--text);
}

.about-hero {
  display: grid;
  grid-template-columns: minmax(210px, 300px) 1fr;
  align-items: center;
  gap: 22px;
  padding: 26px 34px 18px;
  border-bottom: 1px solid var(--border);
  background: linear-gradient(180deg, #ffffff 0%, #f8fbff 100%);
}

.about-logo {
  width: 100%;
  max-height: 86px;
  object-fit: contain;
  object-position: left center;
}

.about-title-wrap h2 {
  margin: 0;
  color: #202124;
  font-size: 32px;
  font-weight: 800;
  line-height: 1;
  letter-spacing: 0;
}

.about-version {
  display: inline-block;
  margin-left: 8px;
  color: #174ea6;
  font-size: 14px;
  font-weight: 800;
  vertical-align: middle;
}

.about-title-wrap p {
  margin: 8px 0 0;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.35;
}

.about-summary {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding: 14px 34px;
  border-bottom: 1px solid var(--border);
  background: #fff;
}

.about-summary-inline {
  margin-top: 14px;
  padding: 0;
  border: 0;
  background: transparent;
}

.about-chip {
  display: inline-flex;
  align-items: center;
  min-height: 26px;
  padding: 4px 10px;
  border: 1px solid rgba(26, 115, 232, .18);
  border-radius: 999px;
  background: #f4f8ff;
  color: #174ea6;
  font-size: 12px;
  font-weight: 700;
}

.about-grid {
  display: grid;
  grid-template-columns: 1.12fr .88fr;
  gap: 10px;
  padding: 10px;
  background: #eef1f4;
}

.about-card {
  padding: 16px 18px;
  border: 1px solid rgba(218, 220, 224, .95);
  border-radius: 6px;
  background: #fff;
  box-shadow: 0 1px 3px rgba(60, 64, 67, .10);
}

.about-platform-card,
.about-team-card {
  grid-column: 1 / -1;
}

.about-card-title {
  display: flex;
  align-items: center;
  gap: 9px;
  margin-bottom: 9px;
}

.about-card-title h3 {
  margin: 0;
  color: #2b2f33;
  font-size: 18px;
  font-weight: 800;
  line-height: 1.15;
}

.about-icon {
  width: 30px;
  height: 30px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  border: 1px solid rgba(26, 115, 232, .24);
  border-radius: 6px;
  background: #e8f0fe;
  color: #174ea6;
  font-size: 11px;
  font-weight: 900;
  letter-spacing: 0;
}

.about-card p {
  margin: 0;
  color: #3c4043;
  font-size: 14px;
  line-height: 1.52;
}

.about-feature-list {
  display: grid;
  gap: 8px;
}

.about-feature-list span {
  position: relative;
  padding-left: 16px;
  color: #3c4043;
  font-size: 13px;
  line-height: 1.35;
}

.about-feature-list span::before {
  content: "";
  position: absolute;
  left: 0;
  top: .55em;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--green);
}

.about-team-list {
  display: grid;
  gap: 7px;
  color: #3c4043;
  font-size: 13px;
  line-height: 1.4;
}

.about-team-list span {
  display: inline-flex;
  min-width: 78px;
  margin-right: 8px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: .05em;
}

/* ── Satellite button ─────────────────────────────────────────────────── */
#satellite-toggle.active {
  background-color: #1a73e8;
  border-color: #1a73e8;
  color: #fff;
}

/* ── Time slider row ──────────────────────────────────────────────────── */
#time-row {
  position: relative;
  z-index: 1;
  width: clamp(430px, 38vw, 620px);
  min-width: 390px;
  flex-shrink: 1;
  padding: 0;
}

.time-control-top,
.time-control-bottom {
  display: flex;
  align-items: center;
  gap: 7px;
}

.time-control-top {
  display: grid;
  grid-template-columns: minmax(42px, auto) 1fr auto;
  gap: 8px;
  margin-bottom: 2px;
}

.time-control-bottom {
  gap: 8px;
}

.time-row-label {
  font-size: 11px;
  font-weight: 700;
  color: var(--muted);
  flex-shrink: 0;
  min-width: 2.3rem;
  letter-spacing: .03em;
  text-transform: uppercase;
}

.time-play-group {
  display: inline-flex;
  align-items: center;
  justify-content: flex-end;
  gap: 6px;
}

.time-play-button {
  width: 22px;
  height: 22px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid rgba(26, 115, 232, .45);
  border-radius: 4px;
  background: #fff;
  color: var(--blue);
  font-size: 10px;
  line-height: 1;
  padding: 0;
  flex-shrink: 0;
}

.time-play-button:hover,
.time-play-button[aria-pressed="true"] {
  background: var(--blue);
  color: #fff;
  border-color: var(--blue);
}

.time-play-speed {
  width: 48px;
  height: 22px;
  border: 1px solid var(--border);
  border-radius: 4px;
  background: #fff;
  color: var(--text);
  font-size: 10px;
  padding: 0 4px;
  flex-shrink: 0;
}

.time-bound {
  font-size: 10px;
  color: var(--muted);
  flex-shrink: 0;
  font-variant-numeric: tabular-nums;
}

.time-value {
  min-width: 7.6rem;
  justify-self: center;
  text-align: center;
  font-size: 1.03rem;
  font-weight: 700;
  color: var(--blue);
  flex-shrink: 0;
  font-variant-numeric: tabular-nums;
  line-height: 1.1;
  white-space: nowrap;
}

.time-value.is-window-label {
  min-width: 12rem;
  font-size: .95rem;
  color: #0b57d0;
}

.time-value.is-prediction-label {
  color: var(--blue);
}

.time-prediction-offset {
  color: #188038;
}

.time-ticks {
  position: relative;
  height: 11px;
  margin-top: -2px;
}

.time-ticks span {
  position: absolute;
  top: 0;
  transform: translateX(-50%);
  font-size: 9px;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}

.time-ticks span:nth-child(1) {
  left: 25%;
}

.time-ticks span:nth-child(2) {
  left: 50%;
}

.time-ticks span:nth-child(3) {
  left: 75%;
}

/* Range input baseline */
input[type="range"].form-range {
  height: 6px;
  cursor: pointer;
}

.time-slider-inline {
  width: 100%;
  --time-window-start: 0%;
  --time-window-end: 0%;
  --time-window-start-2: 100%;
  --time-window-end-2: 100%;
  --time-track-base: #e9ecef;
  --time-track-window: rgba(26, 115, 232, .32);
  --time-track-prediction: rgba(52, 168, 83, .36);
  --time-pred-start: 0%;
  --time-pred-end: 0%;
}

.time-slider-stack {
  flex: 1 1 auto;
  min-width: 260px;
}

.time-slider-inline::-webkit-slider-runnable-track {
  height: 6px;
  border-radius: 999px;
  background: var(--time-track-base);
}

.time-slider-inline.has-window-range::-webkit-slider-runnable-track {
  background:
    linear-gradient(
      to right,
      var(--time-track-base) 0%,
      var(--time-track-base) var(--time-window-start),
      var(--time-track-window) var(--time-window-start),
      var(--time-track-window) var(--time-window-end),
      var(--time-track-base) var(--time-window-end),
      var(--time-track-base) var(--time-window-start-2),
      var(--time-track-window) var(--time-window-start-2),
      var(--time-track-window) var(--time-window-end-2),
      var(--time-track-base) var(--time-window-end-2),
      var(--time-track-base) 100%
    );
}

.time-slider-inline.has-prediction-range::-webkit-slider-runnable-track {
  background:
    linear-gradient(
      to right,
      var(--time-track-base) 0%,
      var(--time-track-base) var(--time-pred-start),
      var(--time-track-prediction) var(--time-pred-start),
      var(--time-track-prediction) var(--time-pred-end),
      var(--time-track-base) var(--time-pred-end),
      var(--time-track-base) 100%
    );
}

.time-slider-inline::-moz-range-track {
  height: 6px;
  border-radius: 999px;
  background: var(--time-track-base);
}

.time-slider-inline.has-window-range::-moz-range-track {
  background:
    linear-gradient(
      to right,
      var(--time-track-base) 0%,
      var(--time-track-base) var(--time-window-start),
      var(--time-track-window) var(--time-window-start),
      var(--time-track-window) var(--time-window-end),
      var(--time-track-base) var(--time-window-end),
      var(--time-track-base) var(--time-window-start-2),
      var(--time-track-window) var(--time-window-start-2),
      var(--time-track-window) var(--time-window-end-2),
      var(--time-track-base) var(--time-window-end-2),
      var(--time-track-base) 100%
    );
}

.time-slider-inline.has-prediction-range::-moz-range-track {
  background:
    linear-gradient(
      to right,
      var(--time-track-base) 0%,
      var(--time-track-base) var(--time-pred-start),
      var(--time-track-prediction) var(--time-pred-start),
      var(--time-track-prediction) var(--time-pred-end),
      var(--time-track-base) var(--time-pred-end),
      var(--time-track-base) 100%
    );
}
input[type="range"].form-range::-webkit-slider-thumb {
  width: 16px;
  height: 16px;
}

.time-slider-inline.has-prediction-range::-webkit-slider-thumb {
  background-color: #188038;
  border-color: #188038;
}

.time-slider-inline.has-prediction-range::-moz-range-thumb {
  background-color: #188038;
  border-color: #188038;
}

.time-slider-inline.is-window-representative::-webkit-slider-thumb {
  background-color: #8ab4f8;
  border-color: #8ab4f8;
  opacity: .58;
}

.time-slider-inline.is-window-representative::-moz-range-thumb {
  background-color: #8ab4f8;
  border-color: #8ab4f8;
  opacity: .58;
}

/* ══════════════════════════════════════════════════════════════════════════
   App layout
   ══════════════════════════════════════════════════════════════════════════ */
#app-layout {
  display: flex;
  position: relative;
  height: calc(100vh - var(--controls-h));
  margin-top: var(--controls-h);
}

body.ranking-panel-open {
  --ranking-open-h: var(--ranking-h);
}

/* ══════════════════════════════════════════════════════════════════════════
   Chart sidebar
   ══════════════════════════════════════════════════════════════════════════ */
#chart-sidebar {
  width: var(--sidebar-w);
  height: calc(100% - var(--ranking-open-h));
  flex-shrink: 0;
  background: #fff;
  border-right: 0;
  box-shadow: var(--shadow);
  overflow-y: hidden;
  overflow-x: hidden;
  overscroll-behavior: contain;
  z-index: 100;
  display: flex;
  flex-direction: column;
  position: relative;   /* needed for loading overlay */
}

#sidebar-resize-handle {
  position: absolute;
  top: 0;
  right: -4px;
  width: 8px;
  height: 100%;
  cursor: ew-resize;
  z-index: 130;
  background: transparent;
  touch-action: none;
}

#sidebar-resize-handle::after {
  content: "";
  position: absolute;
  top: 0;
  bottom: 0;
  left: 3px;
  width: 2px;
  background: transparent;
  transition: background .12s ease;
}

#sidebar-resize-handle:hover::after,
body.is-resizing-sidebar #sidebar-resize-handle::after {
  background: rgba(26, 115, 232, .45);
}

body.is-resizing-sidebar {
  cursor: ew-resize;
  user-select: none;
}

#sidebar-header {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
  min-height: 56px;
  height: 56px;
  overflow: hidden;
}

#sidebar-scroll-body {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  overflow-x: hidden;
  overscroll-behavior: contain;
  display: flex;
  flex-direction: column;
  background: #fff;
}

#sidebar-scroll-body > #chart-tab-content {
  flex: 0 0 auto;
  min-height: auto;
  overflow: visible;
}

#sidebar-scroll-body > .prediction-content {
  flex: 0 0 auto;
  min-height: auto;
  overflow: visible;
}

#seg-name { font-size: 15px; }
#seg-name .seg-id {
  color: var(--muted);
  font-size: 12px;
  font-weight: 500;
}
#seg-date { font-size: 12px; }

#close-sidebar {
  width: 28px;
  min-width: 28px;
  height: 28px;
  padding: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid transparent;
  border-radius: 6px;
  background: transparent;
  color: #3c4043;
  font-size: 0;
  font-weight: 500;
  line-height: 1;
}

#close-sidebar::before {
  content: "\00d7";
  font-size: 22px;
  font-weight: 400;
  line-height: 1;
  transform: translateY(-1px);
}

#close-sidebar:hover {
  border-color: var(--border);
  background: #fff;
  color: #202124;
}

#close-sidebar:focus-visible {
  outline: 2px solid rgba(26, 115, 232, .55);
  outline-offset: 2px;
}

/* ── Day Statistics strip ─────────────────────────────────────────────── */
.summary-section-title {
  font-size: 10px;
  font-weight: 700;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: .06em;
}

#summary-strip {
  border-bottom: 1px solid var(--border);
  background: #f8f9fa;
  flex-shrink: 0;
}

body.prediction-panel-mode #chart-tab-content,
body.prediction-panel-mode #sidebar-loading,
body.prediction-panel-mode #no-data-msg {
  display: none !important;
}

body.prediction-panel-mode #chart-tabs {
  display: flex !important;
}

body.prediction-panel-mode #chart-tabs .nav-item:not(:first-child) {
  display: none !important;
}

body.prediction-panel-mode #prediction-content {
  display: flex !important;
}

body.prediction-panel-mode #window-control {
  display: grid !important;
}

#chart-tabs {
  order: 10;
}

#window-control {
  order: 11;
}

#window-control {
  --window-slider-left: 96px;
  --window-slider-right: 24px;
  display: grid;
  grid-template-columns: 78px minmax(0, 1fr);
  align-items: stretch;
  column-gap: 10px;
}

#chart-tab-content {
  order: 13;
}

.prediction-content {
  display: flex;
  flex: 1;
  min-height: 0;
  flex-direction: column;
  overflow: hidden;
  background: #fff;
  order: 14;
}

.summary-chip {
  display: flex;
  flex-direction: column;
  align-items: center;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 4px 7px;
  min-width: 58px;
}
.summary-chip .chip-val { font-weight: 700; font-size: 14px; color: var(--blue); }
.summary-chip .chip-lbl {
  font-size: 10px;
  color: var(--muted);
  line-height: 1.05;
  text-align: center;
}

/* ── Tab nav ──────────────────────────────────────────────────────────── */
#chart-tabs { flex-shrink: 0; border-bottom: 1px solid var(--border); }
#chart-tabs .nav-link {
  font-size: 12px;
  padding: 6px 12px;
  color: var(--muted);
}
#chart-tabs .nav-link.active {
  color: var(--blue);
  border-color: var(--border) var(--border) #fff;
}

/* ── Zoom / window slider ─────────────────────────────────────────────── */
#window-control {
  background: #f1f3f4;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
  min-height: 42px;
  padding-top: 5px !important;
  padding-bottom: 4px !important;
}

.window-slider-area {
  --window-slider-left: 8px;
  --window-slider-right: 8px;
  min-width: 0;
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.window-ticks {
  position: relative;
  display: block;
  height: 16px;
  margin-top: 0;
  flex-shrink: 0;
  background: transparent;
  border-bottom: 0;
  padding: 0 !important;
}

.window-ticks span {
  position: absolute;
  top: 2px;
  font-size: 9px;
  color: var(--muted);
  text-align: center;
  transform: translateX(-50%);
  white-space: nowrap;
}

.window-ticks span { left: 24px; }

#window-slider {
  display: block;
  width: calc(100% - 16px) !important;
  margin-left: 8px;
  margin-right: 8px;
  margin-top: 0;
  margin-bottom: 0;
}

body.prediction-panel-mode #window-slider {
  width: calc(100% - 16px) !important;
  margin-left: 8px;
  margin-right: 8px;
}

.window-control-label {
  width: 78px;
  display: flex;
  align-items: center;
  justify-content: flex-start;
  color: var(--muted);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: .04em;
  line-height: 1.1;
  text-transform: uppercase;
  white-space: normal;
}

body.prediction-panel-mode .window-control-label {
  width: 78px;
  font-size: 10px;
  font-weight: 700;
}

/* ── Chart content ────────────────────────────────────────────────────── */
.tab-content {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  overflow-x: hidden;
  overscroll-behavior: contain;
  overflow-anchor: none;
}

.ranking-focus-bar {
  position: sticky;
  top: 0;
  z-index: 30;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin: -2px 0 8px;
  padding: 6px 8px;
  border: 1px solid #d2e3fc;
  border-radius: 6px;
  background: #f8fbff;
  color: #3c4043;
  font-size: 11px;
  line-height: 1.2;
  box-shadow: 0 1px 2px rgba(60, 64, 67, .08);
}

.ranking-focus-label {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.ranking-focus-show-all {
  flex: 0 0 auto;
  border: 0;
  background: transparent;
  color: var(--blue);
  font-size: 11px;
  font-weight: 700;
  padding: 2px 0;
}

.ranking-focus-show-all:hover {
  text-decoration: underline;
}

.ranking-focus-hidden {
  display: none !important;
}

.chart-title {
  font-size: 11px;
  font-weight: 600;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: .04em;
  margin-bottom: 4px;
}

.mobility-section-title {
  font-size: inherit;
  font-weight: inherit;
  color: var(--muted);
  text-transform: none;
  letter-spacing: 0;
}

.chart-title-wrap {
  position: relative;
  display: inline-block;
  margin-bottom: 4px;
}

.chart-title-button {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  border: 0;
  background: transparent;
  padding: 0;
  color: var(--muted);
  font: inherit;
  cursor: default;
}

.chart-title-button.is-clickable {
  cursor: pointer;
}

.chart-title-button.is-clickable:hover > span:first-child,
.chart-title-button[aria-expanded="true"] > span:first-child {
  color: var(--text);
}

.chart-info-dot {
  display: none;
  align-items: center;
  justify-content: center;
  width: 13px;
  height: 13px;
  border: 1px solid rgba(95, 99, 104, .55);
  border-radius: 50%;
  color: var(--muted);
  font-size: 9px;
  font-weight: 700;
  line-height: 1;
  text-transform: none;
  letter-spacing: 0;
}

.chart-title-button.is-clickable .chart-info-dot {
  display: inline-flex;
}

.chart-title-button:focus {
  outline: none !important;
  box-shadow: none !important;
}

.chart-title-button:focus-visible {
  outline: 1px solid rgba(26, 115, 232, .45);
  outline-offset: 2px;
  border-radius: 3px;
}

.chart-info-popover {
  position: absolute;
  left: 0;
  top: calc(100% + 6px);
  z-index: 80;
  width: min(340px, calc(100vw - 48px));
  padding: 10px 12px;
  background: rgba(255, 255, 255, .98);
  border: 1px solid var(--border);
  border-radius: 8px;
  box-shadow: 0 10px 28px rgba(60, 64, 67, .18), 0 3px 10px rgba(60, 64, 67, .12);
  color: var(--text);
  text-transform: none;
  letter-spacing: 0;
}

.chart-info-popover p {
  margin: 0;
  font-size: 11px;
  line-height: 1.35;
  color: var(--text);
}

.chart-info-popover p + p {
  margin-top: 7px;
}

.custom-chart-legend {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 46px;
  height: 22px;
  margin: -2px 0 2px;
  font-size: 10px;
  color: var(--text);
  line-height: 1;
}

.custom-legend-item {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  border: 0;
  background: transparent;
  padding: 2px 4px;
  color: inherit;
  font: inherit;
  line-height: inherit;
  white-space: nowrap;
  cursor: pointer;
  transition: opacity .12s ease;
}

.custom-legend-item:hover {
  opacity: .75;
}

.custom-legend-item:focus {
  outline: none;
}

.custom-legend-item:focus-visible {
  outline: 1px solid rgba(26, 115, 232, .45);
  outline-offset: 2px;
  border-radius: 3px;
}

.custom-legend-item.is-muted {
  opacity: .35;
}

.custom-speed-legend {
  gap: 12px;
  justify-content: flex-start;
  padding-left: 18px;
  padding-right: 4px;
  font-size: 9px;
}

.custom-speed-legend .custom-legend-item {
  gap: 5px;
  padding-left: 2px;
  padding-right: 2px;
}

.custom-speed-legend .legend-speed-band {
  width: 26px;
}

.custom-speed-legend .legend-cv-line,
.custom-speed-legend .legend-line-dashed {
  width: 26px;
}

.legend-speed-band {
  position: relative;
  width: 30px;
  height: 14px;
  background: rgba(26, 115, 232, .14);
  flex-shrink: 0;
}

.legend-speed-band::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  top: 50%;
  border-top: 2px solid #1a73e8;
  transform: translateY(-50%);
}

.legend-cv-line {
  width: 32px;
  height: 0;
  border-top: 2px dashed #34a853;
  flex-shrink: 0;
}

.custom-speed-legend.is-arterial-speed .legend-freeflow-line {
  color: #082f6f;
}

.custom-delay-legend {
  gap: 20px;
}

.custom-queue-legend {
  gap: 16px;
}

.custom-signal-legend,
.custom-turning-legend {
  gap: 14px;
}

.custom-safety-legend {
  gap: 14px;
}

.custom-legend-pair,
.legend-parenthetical {
  display: inline-flex;
  align-items: center;
  gap: 2px;
}

.custom-legend-pair {
  gap: 4px;
}

.legend-parenthetical {
  color: var(--muted);
}

.legend-parenthetical .custom-legend-item {
  color: var(--text);
}

.legend-bar-swatch {
  width: 16px;
  height: 10px;
  border-radius: 2px;
  border: 1px solid rgba(32, 33, 36, .18);
  flex-shrink: 0;
}

.legend-hard-accel { background: rgba(250, 123, 23, .75); }
.legend-hard-brake { background: rgba(234, 67, 53, .75); }
.legend-lc-left { background: rgba(179, 226, 163, .92); border-color: rgba(92, 171, 68, .65); }
.legend-lc-right { background: rgba(190, 230, 240, .92); border-color: rgba(54, 132, 160, .62); }
.legend-hard-lc-left { background: rgba(69, 167, 41, .92); border-color: rgba(49, 132, 30, .98); }
.legend-hard-lc-right { background: rgba(11, 48, 111, .92); border-color: rgba(7, 34, 80, .98); }
.legend-speeding-count { background: rgba(234, 67, 53, .72); }
.legend-speeding-ratio-line { color: #9c27b0; }
.legend-hard-left-turn { background: rgba(69, 167, 41, .88); border-color: rgba(49, 132, 30, .98); }
.legend-hard-right-turn { background: rgba(11, 48, 111, .88); border-color: rgba(7, 34, 80, .98); }
.legend-left-dilemma { background: rgba(251, 188, 4, .70); border-color: rgba(194, 138, 0, .85); }
.legend-through-dilemma { background: rgba(250, 123, 23, .70); border-color: rgba(188, 84, 0, .85); }
.legend-left-rlr { background: rgba(234, 67, 53, .66); border-color: rgba(190, 42, 34, .86); }
.legend-through-rlr { background: rgba(176, 35, 24, .82); border-color: rgba(135, 26, 18, .95); }
.legend-turn-left { background: rgba(250, 123, 23, .72); }
.legend-turn-right { background: rgba(26, 115, 232, .72); }
.legend-turn-through { background: rgba(52, 168, 83, .72); }
.legend-turn-uturn { background: rgba(156, 39, 176, .72); }

.legend-line-point,
.legend-line-dashed,
.legend-line-solid {
  position: relative;
  width: 30px;
  height: 10px;
  flex-shrink: 0;
}

.legend-line-point::before,
.legend-line-dashed::before,
.legend-line-solid::before {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  top: 50%;
  border-top-width: 2px;
  border-top-style: solid;
  transform: translateY(-50%);
}

.legend-line-point::after {
  content: "";
  position: absolute;
  left: 50%;
  top: 50%;
  width: 6px;
  height: 6px;
  border: 2px solid currentColor;
  border-radius: 50%;
  background: #fff;
  transform: translate(-50%, -50%);
}

.legend-line-dashed::before {
  border-top-style: dashed;
}

.legend-shockwave-symbol {
  position: relative;
  width: 22px;
  height: 12px;
  flex-shrink: 0;
}

.legend-shockwave-symbol::before {
  content: "";
  position: absolute;
  left: 3px;
  top: 50%;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #ea4335;
  transform: translateY(-50%);
}

.legend-shockwave-symbol::after {
  content: "";
  position: absolute;
  right: 3px;
  top: 50%;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #34a853;
  transform: translateY(-50%);
}

.legend-delay-line {
  color: #ea4335;
}

.legend-stop-delay-line {
  color: #fa7b17;
}

.legend-queue-line {
  color: #082f6f;
}

.legend-time-line {
  color: #9c27b0;
}

.legend-freeflow-line {
  color: #34a853;
}

[data-legend-target="freeflow-speed"] .legend-freeflow-line {
  color: #202124;
}

.legend-cumulative-queue-line {
  color: #fa7b17;
}

.legend-shockwave-line {
  color: #009688;
}

.legend-aog-line {
  color: #34a853;
}

.legend-split-line {
  color: #ea4335;
}

.legend-delay-line::before,
.legend-stop-delay-line::before,
.legend-time-line::before,
.legend-freeflow-line::before,
.legend-queue-line::before,
.legend-cumulative-queue-line::before,
.legend-shockwave-line::before,
.legend-aog-line::before,
.legend-split-line::before,
.legend-line-solid::before {
  border-top-color: currentColor;
}

.legend-time-band {
  position: relative;
  width: 30px;
  height: 14px;
  background: rgba(156, 39, 176, .15);
  color: #9c27b0;
  flex-shrink: 0;
}

.legend-time-band::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  top: 50%;
  border-top: 2px dashed currentColor;
  transform: translateY(-50%);
}

/* ── Date hint ────────────────────────────────────────────────────────── */
.date-control {
  position: relative;
  z-index: 30;
}

.date-hint {
  font-size: 10px;
  color: var(--muted);
  line-height: 1.2;
}

.date-popover {
  position: absolute;
  top: calc(100% + 8px);
  left: 0;
  z-index: 700;
  width: 268px;
  padding: 10px;
  background: rgba(255, 255, 255, .98);
  border: 1px solid var(--border);
  border-radius: 8px;
  box-shadow: 0 14px 36px rgba(60, 64, 67, .20), 0 4px 12px rgba(60, 64, 67, .12);
}

.date-popover-head {
  display: grid;
  grid-template-columns: 26px 1fr 26px;
  gap: 6px;
  align-items: center;
  margin-bottom: 8px;
}

.date-nav-button,
.date-month-select,
.date-day-button {
  border: 1px solid var(--border);
  background: #fff;
  color: var(--text);
  font-family: var(--app-font);
}

.date-nav-button {
  height: 26px;
  border-radius: 5px;
  font-size: 12px;
  font-weight: 700;
  line-height: 1;
}

.date-nav-button:disabled {
  color: #bdc1c6;
  background: #f8f9fa;
}

.date-month-select {
  height: 26px;
  border-radius: 5px;
  font-size: 12px;
  padding: 0 6px;
}

.date-weekdays,
.date-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
}

.date-weekdays {
  margin-bottom: 4px;
  color: var(--muted);
  font-size: 9px;
  font-weight: 700;
  text-align: center;
  text-transform: uppercase;
}

.date-grid {
  gap: 3px;
}

.date-day-spacer {
  height: 28px;
}

.date-day-button {
  height: 28px;
  border-radius: 5px;
  font-size: 11px;
  font-variant-numeric: tabular-nums;
  padding: 0;
}

.date-day-button.is-available {
  border-color: rgba(26, 115, 232, .32);
  color: var(--blue);
  font-weight: 600;
}

.date-day-button.is-available:hover {
  background: #f4f8ff;
  border-color: rgba(26, 115, 232, .65);
}

.date-day-button.is-selected {
  background: var(--blue);
  border-color: var(--blue);
  color: #fff;
}

.date-day-button:disabled {
  color: #c4c7c5;
  background: #f8f9fa;
  border-color: #edf0f2;
}

.date-popover-footer {
  min-height: 14px;
  margin-top: 8px;
  color: var(--muted);
  font-size: 10px;
  line-height: 1.25;
}

/* ── Sidebar loading overlay ──────────────────────────────────────────── */
#sidebar-loading {
  position: absolute;
  inset: 0;
  background: rgba(255, 255, 255, .88);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  z-index: 60;
  backdrop-filter: blur(2px);
}

/* ══════════════════════════════════════════════════════════════════════════
   Map container
   ══════════════════════════════════════════════════════════════════════════ */
#map-container {
  flex: 1;
  height: calc(100% - var(--ranking-open-h));
  position: relative;
  overflow: hidden;
}

#map-magnifier {
  position: absolute;
  top: 0;
  left: 0;
  width: 280px;
  height: 280px;
  border: 3px solid #fff;
  border-radius: 8px;
  box-shadow: 0 14px 34px rgba(32, 33, 36, .3), 0 0 0 1px rgba(26, 115, 232, .32);
  overflow: hidden;
  opacity: 0;
  pointer-events: none;
  transform: translate(-9999px, -9999px);
  transition: opacity .08s ease;
  z-index: 45;
}

#map-magnifier.is-visible {
  opacity: 1;
  pointer-events: auto;
}

#map-magnifier::after {
  content: "";
  position: absolute;
  inset: 50%;
  width: 18px;
  height: 18px;
  border-left: 1px solid rgba(32, 33, 36, .4);
  border-top: 1px solid rgba(32, 33, 36, .4);
  transform: translate(-50%, -50%) rotate(45deg);
  pointer-events: none;
}

#map-magnifier-map {
  width: 100%;
  height: 100%;
}

.prediction-sidebar-head {
  display: none;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
  border-bottom: 1px solid var(--border);
  background: #fff;
  flex-shrink: 0;
}

.prediction-title-block {
  min-width: 0;
  flex: 1 1 auto;
}

.prediction-sidebar-head {
  overflow: visible;
  position: relative;
  z-index: 160;
}

.prediction-title-row {
  display: flex;
  align-items: center;
  gap: 6px;
  width: 100%;
  max-width: 100%;
  cursor: pointer;
  border-radius: 6px;
}

.prediction-title-row .fw-semibold {
  flex: 0 1 auto;
  display: block;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--text);
  font-size: 15px;
  font-weight: 600;
}

#prediction-context {
  display: none !important;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--muted) !important;
  font-size: 12px;
}

.prediction-horizon-control {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  flex: 0 0 auto;
  margin-left: 8px;
  color: var(--muted);
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .04em;
}

.prediction-horizon-control select {
  width: 58px;
  height: 26px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: #fff;
  color: var(--text);
  font-family: var(--app-font);
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0;
  text-transform: none;
  padding: 0 5px;
}

.prediction-title-row:focus-visible {
  outline: 2px solid #1a73e8;
  outline-offset: 2px;
}

.prediction-info-button {
  width: auto;
  height: auto;
  padding: 0;
  border: 0;
  background: transparent;
  color: inherit;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 auto;
}

.prediction-info-button .chart-info-dot {
  display: inline-flex;
}

.prediction-info-popover {
  top: calc(100% + 6px);
  left: 12px;
  right: 42px;
  width: auto;
  z-index: 220;
}

.prediction-panel-body {
  display: flex;
  flex-direction: column;
  gap: 0;
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  overflow-x: hidden;
  overscroll-behavior: contain;
  overflow-anchor: none;
  position: relative;
}

.prediction-panel-body.is-loading::before,
.ranking-chart-area.is-loading::before {
  content: "";
  position: absolute;
  inset: 0;
  background: rgba(255, 255, 255, .52);
  backdrop-filter: blur(1.5px);
  z-index: 25;
  pointer-events: none;
}

.prediction-panel-body.is-loading::after,
.ranking-chart-area.is-loading::after {
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  z-index: 26;
  min-width: 148px;
  padding: 12px 18px 12px 42px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background:
    radial-gradient(circle at 22px 50%, transparent 0 7px, rgba(26, 115, 232, .18) 7px 10px, transparent 10px),
    rgba(255, 255, 255, .96);
  color: var(--muted);
  font-size: 12px;
  box-shadow: var(--shadow);
  pointer-events: none;
}

.prediction-panel-body.is-loading::after {
  content: "Loading predictions...";
}

.prediction-card {
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #fff;
  padding: 10px;
}

.prediction-kicker {
  font-size: 10px;
  font-weight: 700;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: .06em;
  margin-bottom: 6px;
}

.prediction-body {
  font-size: 12px;
  line-height: 1.4;
}

.prediction-state,
.prediction-status {
  font-size: 12px;
  line-height: 1.45;
}

.prediction-state {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 8px 10px;
  border: 1px solid #d2e3fc;
  border-radius: 8px;
  background: #f8fbff;
  color: #202124;
}

.prediction-status {
  min-height: 0;
}

.prediction-metrics {
  display: flex;
  flex-direction: column;
  gap: 0;
}

.prediction-metric-card {
  min-height: 0;
  border: 0;
  border-radius: 0;
  padding: 6px 0 12px;
  background: transparent;
  flex: 0 0 auto;
}

.prediction-metric-card + .prediction-metric-card {
  border-top: 0;
}

.prediction-card-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 0;
  flex-wrap: nowrap;
  min-height: 24px;
}

.prediction-title-wrap {
  margin-bottom: 0;
  min-width: 0;
  flex: 1 1 auto;
}

.prediction-card-title {
  font-size: 14px;
  font-weight: 400;
  color: var(--muted);
  min-width: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.prediction-card-unit {
  font-size: 11px;
  font-weight: 700;
  color: var(--muted);
}

.prediction-card-stats {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  margin-bottom: 6px;
}

.prediction-card-stats-inline {
  display: grid;
  grid-template-columns: 62px 18px 62px;
  align-items: center;
  justify-content: end;
  gap: 5px;
  margin-bottom: 0;
  flex: 0 0 152px;
  width: 152px;
  min-width: 152px;
}

.prediction-stat {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
  padding: 5px 7px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: #fff;
  font-size: 11px;
  color: var(--muted);
}

.prediction-card-stats-inline .prediction-stat {
  width: 62px;
  min-width: 62px;
  padding: 2px 5px;
  gap: 4px;
  overflow: hidden;
}

.prediction-card-stats-inline .prediction-stat strong {
  font-size: 11px;
  font-variant-numeric: tabular-nums;
  min-width: 24px;
  text-align: right;
}

.prediction-stat strong {
  color: #1a73e8;
  font-size: 13px;
}

.prediction-trend {
  width: 18px;
  height: 18px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 18px;
  border-radius: 50%;
  font-size: 12px;
  font-weight: 800;
  line-height: 1;
}

.prediction-trend-good {
  background: #e6f4ea;
  color: #188038;
}

.prediction-trend-bad {
  background: #fce8e6;
  color: #d93025;
}

.prediction-trend-flat {
  background: #f1f3f4;
  color: var(--muted);
}

.prediction-chart-canvas {
  display: block;
  width: 100% !important;
  height: auto !important;
  margin-bottom: 2px;
}

/* ═══════════════════════════════════════════════════════════════════════════
   Network ranking panel
   ═══════════════════════════════════════════════════════════════════════════ */
.network-ranking-panel {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: var(--ranking-h);
  min-height: 300px;
  width: auto;
  z-index: 105;
  display: grid;
  grid-template-columns: var(--ranking-w) minmax(0, 1fr);
  align-items: stretch;
  background: #fff;
  border-top: 1px solid var(--border);
  box-shadow: var(--shadow);
  min-width: 0;
}

body.prediction-panel-mode .network-ranking-panel {
  display: none !important;
}

#ranking-resize-handle {
  position: absolute;
  top: -5px;
  left: 0;
  right: 0;
  height: 10px;
  cursor: ns-resize;
  z-index: 3;
  background: transparent;
}

#ranking-resize-handle::after {
  content: "";
  position: absolute;
  top: 4px;
  left: 50%;
  width: 72px;
  height: 3px;
  border-radius: 999px;
  background: rgba(95, 99, 104, .28);
  transform: translateX(-50%);
}

#ranking-resize-handle:hover::after,
body.is-resizing-ranking #ranking-resize-handle::after {
  background: rgba(26, 115, 232, .55);
}

body.is-resizing-ranking {
  cursor: ns-resize;
  user-select: none;
}

.ranking-controls {
  min-width: 0;
  min-height: 0;
  padding: 10px 10px;
  border-right: 1px solid var(--border);
  border-bottom: 0;
  background: var(--surface);
  display: flex;
  flex-direction: column;
  gap: 8px;
  overflow-y: auto;
  overflow-x: hidden;
  overscroll-behavior: contain;
}

.ranking-panel-title,
.ranking-chart-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.ranking-panel-title span {
  font-size: 15px;
  font-weight: 700;
  color: var(--text);
}

#ranking-close {
  width: 28px;
  height: 28px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid transparent;
  border-radius: 6px;
  background: transparent;
  color: #3c4043;
  font-size: 22px;
  line-height: 1;
}

#ranking-close:hover {
  border-color: var(--border);
  background: #fff;
}

.ranking-report-button {
  height: 36px;
  min-height: 36px;
  max-height: 36px;
  width: 100%;
  flex: 0 0 36px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  margin: 0;
  padding: 0 12px;
  border: 1px solid var(--blue);
  border-radius: 6px;
  background: var(--blue);
  color: #fff;
  font: 800 13px var(--app-font);
  line-height: 1;
  box-shadow: 0 2px 6px rgba(26, 115, 232, .22);
}

.ranking-report-dock {
  position: relative;
  bottom: auto;
  z-index: 4;
  margin: 0;
  padding: 0;
  border-top: 0;
  background: transparent;
  flex: 0 0 auto;
}

.ranking-report-button:hover:not(:disabled) {
  background: #0b57d0;
  border-color: #0b57d0;
}

.ranking-report-button:disabled {
  opacity: .45;
  cursor: not-allowed;
}

.ranking-field {
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin: 0;
}

.ranking-field > span {
  color: var(--muted);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: .05em;
  text-transform: uppercase;
}

.ranking-field select {
  height: 31px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: #fff;
  color: var(--text);
  font-family: var(--app-font);
  font-size: 13px;
  padding: 0 8px;
}

.ranking-segmented {
  display: grid;
  grid-template-columns: 1fr 1fr;
  border: 1px solid var(--blue);
  border-radius: 6px;
  overflow: hidden;
  background: #fff;
}

.ranking-segmented button {
  height: 31px;
  border: 0;
  background: #fff;
  color: var(--blue);
  font: 600 13px var(--app-font);
}

.ranking-segmented button + button {
  border-left: 1px solid var(--blue);
}

.ranking-segmented button.active {
  background: var(--blue);
  color: #fff;
}

.ranking-status {
  min-height: 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.35;
}

.ranking-status:empty {
  display: none;
}

.ranking-chart-area {
  min-width: 0;
  min-height: 0;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  padding: 10px 10px 10px;
  background: #fff;
  position: relative;
}

.ranking-chart-area.is-loading::after {
  content: "Loading ranking...";
}

.ranking-chart-head {
  flex: 0 0 auto;
}

.ranking-title-wrap {
  margin-bottom: 0;
}

.ranking-title-button {
  gap: 5px;
  cursor: pointer;
}

.ranking-title-button .chart-info-dot {
  display: inline-flex;
  margin-top: 1px;
}

.ranking-chart-info {
  width: min(420px, calc(100vw - 48px));
}

.ranking-chart-title {
  font-size: 15px;
  font-weight: 700;
  color: var(--text);
}

.ranking-chart-context,
.ranking-count {
  color: var(--muted);
  font-size: 12px;
}

.ranking-count {
  flex: 0 0 auto;
  font-variant-numeric: tabular-nums;
}

.ranking-csv-download {
  flex: 0 0 auto;
  height: 30px;
  border: 1px solid #1a73e8;
  border-radius: 6px;
  background: #fff;
  color: #1a73e8;
  font-size: 12px;
  font-weight: 700;
  padding: 0 10px;
}

.ranking-csv-download:hover:not(:disabled) {
  background: #e8f0fe;
}

.ranking-csv-download:disabled {
  cursor: not-allowed;
  opacity: .5;
}

.ranking-chart-actions {
  display: inline-flex;
  align-items: center;
  justify-content: flex-end;
  gap: 12px;
  min-width: 0;
  flex: 0 0 auto;
}

.ranking-road-filter {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin: 0;
  color: var(--muted);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: .05em;
  text-transform: uppercase;
}

.ranking-road-filter select {
  height: 30px;
  min-width: 180px;
  max-width: 260px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: #fff;
  color: var(--text);
  font-family: var(--app-font);
  font-size: 12px;
  font-weight: 500;
  letter-spacing: 0;
  text-transform: none;
  padding: 0 8px;
}

.ranking-chart-scroll {
  display: flex;
  flex-direction: column;
  flex: 1 1 auto;
  min-height: 160px;
  margin-top: 6px;
  overflow-x: hidden;
  overflow-y: hidden;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #fff;
  padding: 6px 10px 4px;
}

.ranking-plot-frame {
  display: flex;
  flex: 1 1 auto;
  min-height: 0;
  min-width: 0;
  overflow: hidden;
}

.ranking-y-axis {
  --ranking-axis-h: 180px;
  position: relative;
  flex: 0 0 48px;
  height: var(--ranking-axis-h);
  pointer-events: none;
  background: #fff;
  border-right: 1px solid rgba(218, 220, 224, .95);
}

.ranking-sticky-y-tick {
  position: absolute;
  right: 5px;
  transform: translateY(-50%);
  font-size: 10px;
  line-height: 1;
  white-space: nowrap;
  text-align: right;
}

.ranking-sticky-y-title {
  position: absolute;
  left: 15px;
  transform: translate(-50%, -50%) rotate(-90deg);
  transform-origin: center;
  width: max-content;
  max-width: var(--ranking-axis-h);
  text-align: center;
  font-size: 10px;
  line-height: 1.1;
  white-space: nowrap;
  opacity: .95;
}

.ranking-plot-scroll {
  flex: 1 1 auto;
  min-width: 0;
  overflow-x: auto;
  overflow-y: hidden;
}

.ranking-single-title {
  position: sticky;
  left: 0;
  z-index: 1;
  width: max-content;
  padding: 0 0 2px;
  color: var(--text);
  font-size: 13px;
  font-weight: 700;
  line-height: 1.2;
  background: #fff;
}

.ranking-chart-scroll.ranking-chart-split-host {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 10px;
  overflow: hidden;
  border: 0;
  border-radius: 0;
  background: transparent;
  padding: 0;
}

.ranking-split-panel {
  min-width: 0;
  min-height: 0;
  height: 100%;
  display: flex;
  flex-direction: column;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #fff;
  overflow: hidden;
}

.ranking-split-title {
  flex: 0 0 auto;
  padding: 6px 10px 0;
  color: var(--text);
  font-size: 13px;
  font-weight: 700;
}

.ranking-split-scroll {
  flex: 1 1 auto;
  min-height: 0;
  overflow-x: auto;
  overflow-y: hidden;
  padding: 4px 8px 10px;
}

.ranking-split-canvas {
  display: block;
  min-width: 100%;
  cursor: pointer;
}

#ranking-chart {
  display: block;
  min-width: 100%;
  cursor: pointer;
}

.ranking-report-dialog {
  max-width: min(1120px, calc(100vw - 48px));
}

.ranking-report-modal {
  border: 0;
  border-radius: 10px;
  overflow: hidden;
}

.ranking-report-modal-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  padding: 18px 22px 12px;
  border-bottom: 1px solid var(--border);
}

.ranking-report-modal-head h2 {
  margin: 0;
  font-size: 20px;
  font-weight: 800;
  color: var(--text);
}

.ranking-report-modal-head p {
  margin: 3px 0 0;
  color: var(--muted);
  font-size: 13px;
}

.ranking-report-modal-logos {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 14px;
  margin-left: auto;
  padding-top: 1px;
}

.ranking-report-modal-logos img {
  display: block;
  max-width: 94px;
  height: 34px;
  object-fit: contain;
}

.ranking-report-modal-logos img:nth-child(2) {
  max-width: 54px;
  height: 30px;
}

.ranking-report-preview {
  max-height: min(72vh, 760px);
  overflow: auto;
  padding: 18px;
  background: #eef2f7;
}

.ranking-report-page {
  width: 794px;
  margin: 0 auto;
  padding: 24px;
  background: #fff;
  color: #202124;
  font-family: var(--app-font);
  box-shadow: 0 10px 32px rgba(60, 64, 67, .18);
}

.ranking-report-page h1 {
  margin: 0;
  font-size: 20px;
  line-height: 1.18;
  font-weight: 800;
}

.ranking-report-page-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 20px;
}

.ranking-report-page-head p {
  margin: 4px 0 0;
  color: #5f6368;
  font-size: 13px;
  font-weight: 600;
}

.ranking-report-page-logos {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 14px;
  flex: 0 0 auto;
}

.ranking-report-page-logos img {
  display: block;
  width: 84px;
  height: 32px;
  object-fit: contain;
}

.ranking-report-page-logos img:nth-child(2) {
  width: 48px;
  height: 28px;
}

.ranking-report-meta {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px 16px;
  margin: 14px 0 18px;
  padding: 12px;
  border: 1px solid #dde3ea;
  border-radius: 8px;
  background: #f8fbff;
  font-size: 13px;
}

.ranking-report-meta span,
.ranking-report-summary span {
  display: block;
  color: #5f6368;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .04em;
  text-transform: uppercase;
}

.ranking-report-section {
  margin-top: 18px;
}

.ranking-report-section h3 {
  margin: 0 0 8px;
  font-size: 17px;
  font-weight: 800;
}

.ranking-report-executive {
  border: 1px solid #cfe0f5;
  border-radius: 8px;
  padding: 12px;
  background: #f7fbff;
}

.ranking-report-executive-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 10px;
}

.ranking-report-executive-head h3 {
  margin-bottom: 4px;
}

.ranking-report-executive-head p {
  margin: 0;
  color: #3c4043;
  font-size: 13px;
  line-height: 1.45;
}

.ranking-report-executive-head > span {
  flex: 0 0 auto;
  border-radius: 999px;
  padding: 5px 9px;
  background: #e8f0fe;
  color: #0b57d0;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: .04em;
  text-transform: uppercase;
}

.ranking-report-kpis {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
}

.ranking-report-kpis div {
  min-width: 0;
  border: 1px solid #dde3ea;
  border-radius: 8px;
  padding: 9px;
  background: #fff;
  color: #202124;
  font-size: 13px;
  font-weight: 700;
  overflow: hidden;
  text-overflow: ellipsis;
}

.ranking-report-kpis span {
  display: block;
  margin-bottom: 3px;
  color: #5f6368;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: .04em;
  text-transform: uppercase;
}

.ranking-report-map-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 12px;
}

.ranking-report-map-card {
  min-width: 0;
}

.ranking-report-map-label {
  margin-bottom: 5px;
  color: #5f6368;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: .04em;
  text-transform: uppercase;
}

.ranking-report-map-label span,
.ranking-report-selected-head h3 span {
  margin-left: 6px;
  color: #202124;
  font-weight: 800;
  letter-spacing: 0;
  text-transform: none;
}

.ranking-report-map {
  height: 300px;
  border: 1px solid #dde3ea;
  border-radius: 8px;
  overflow: hidden;
  background: #f1f3f4;
}

.ranking-report-map-card-overview .ranking-report-map {
  height: 300px;
}

.ranking-report-map-card-zoom .ranking-report-map {
  height: 260px;
}

.ranking-report-map img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
  background: #eef3f6;
}

.ranking-report-chart img {
  display: block;
  width: 100%;
  height: auto;
}

.ranking-report-map-fallback {
  min-height: 300px;
  display: grid;
  place-items: center;
  padding: 24px;
  color: #5f6368;
  text-align: center;
}

.ranking-report-legend {
  margin-top: 8px;
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 12px;
  color: #5f6368;
}

.ranking-report-legend-title {
  flex: 0 0 auto;
  min-width: 76px;
}

.ranking-report-legend-scale {
  position: relative;
  flex: 1 1 auto;
  min-width: 0;
  padding-bottom: 16px;
}

.ranking-report-legend-gradient {
  height: 10px;
  border-radius: 999px;
  border: 1px solid rgba(60, 64, 67, .16);
}

.ranking-report-legend-ticks {
  position: absolute;
  left: 0;
  right: 0;
  top: 13px;
  height: 14px;
}

.ranking-report-legend-ticks span {
  position: absolute;
  top: 0;
  transform: translateX(-50%);
  white-space: nowrap;
  font-size: 11px;
  color: #5f6368;
}

.ranking-report-legend-ticks span:first-child {
  transform: translateX(0);
}

.ranking-report-legend-ticks span:last-child {
  transform: translateX(-100%);
}

.ranking-report-legend-unit {
  flex: 0 0 auto;
  white-space: nowrap;
}

.ranking-report-summary {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 10px;
  margin-top: 12px;
}

.ranking-report-summary div {
  border: 1px solid #dde3ea;
  border-radius: 8px;
  padding: 10px;
  background: #fff;
  font-size: 13px;
}

.ranking-report-selected {
  border: 1px solid #dde3ea;
  border-radius: 8px;
  padding: 12px;
  background: #fbfdff;
}

.ranking-report-selected-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 10px;
}

.ranking-report-selected-head h3 {
  margin-bottom: 3px;
}

.ranking-report-selected-head p {
  margin: 0;
  color: #3c4043;
  font-size: 13px;
  font-weight: 700;
}

.ranking-report-selected-head > span {
  color: #5f6368;
  font-size: 12px;
  font-weight: 700;
  white-space: nowrap;
}

.ranking-report-selected-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.ranking-report-metric-group {
  min-width: 0;
  border: 1px solid #e8eaed;
  border-radius: 8px;
  background: #fff;
  overflow: hidden;
}

.ranking-report-metric-group h4 {
  margin: 0;
  padding: 8px 10px;
  border-bottom: 1px solid #e8eaed;
  background: #f8fbff;
  color: #202124;
  font-size: 13px;
  font-weight: 800;
}

.ranking-report-metric-list {
  display: grid;
}

.ranking-report-metric-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 112px 76px;
  align-items: center;
  gap: 8px;
  padding: 8px 10px;
  border-bottom: 1px solid #f1f3f4;
  font-size: 12px;
}

.ranking-report-metric-row:last-child {
  border-bottom: 0;
}

.ranking-report-metric-row.is-active-metric {
  background: #1a73e8;
  box-shadow: inset 3px 0 0 #0b57d0;
}

.ranking-report-metric-row.is-active-metric .ranking-report-metric-name,
.ranking-report-metric-row.is-active-metric strong,
.ranking-report-metric-row.is-active-metric em {
  color: #ffffff;
  font-weight: 800;
}

.ranking-report-metric-name {
  min-width: 0;
  color: #5f6368;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.ranking-report-metric-row strong {
  color: #202124;
  font-size: 12px;
  font-variant-numeric: tabular-nums;
  text-align: right;
}

.ranking-report-metric-row em {
  color: #5f6368;
  font-size: 11px;
  font-style: normal;
  font-variant-numeric: tabular-nums;
  text-align: right;
}

.ranking-report-chart {
  border: 1px solid #dde3ea;
  border-radius: 8px;
  padding: 10px;
}

.ranking-report-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12px;
}

.ranking-report-table th,
.ranking-report-table td {
  border-bottom: 1px solid #e8eaed;
  padding: 7px 8px;
  text-align: left;
}

.ranking-report-table th {
  color: #5f6368;
  font-size: 10px;
  letter-spacing: .04em;
  text-transform: uppercase;
}

.ranking-report-table tr.is-selected td {
  background: #e8f0fe;
  color: #0b57d0;
  font-weight: 700;
}

.ranking-report-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  padding: 12px 18px;
  border-top: 1px solid var(--border);
  background: #fff;
}

.ranking-report-status {
  margin-right: auto;
  color: var(--muted);
  font-size: 12px;
}

@media print {
  @page {
    size: A4 portrait;
    margin: 0.35in;
  }

  html,
  body,
  .ranking-report-print-body {
    background: #ffffff !important;
  }

  .ranking-report-print-body {
    margin: 0;
    padding: 0;
  }

  .ranking-report-print-body .ranking-report-page {
    width: 100%;
    margin: 0;
    padding: 0;
    box-shadow: none;
  }

  .ranking-report-print-body .ranking-report-section,
  .ranking-report-print-body .ranking-report-executive,
  .ranking-report-print-body .ranking-report-selected,
  .ranking-report-print-body .ranking-report-chart,
  .ranking-report-print-body .ranking-report-map-card {
    break-inside: avoid;
    page-break-inside: avoid;
  }

  .ranking-report-print-body .ranking-report-page-head,
  .ranking-report-print-body .ranking-report-meta,
  .ranking-report-print-body .ranking-report-executive {
    break-after: avoid;
    page-break-after: avoid;
  }

  .ranking-report-print-body .ranking-report-map img,
  .ranking-report-print-body .ranking-report-chart img {
    max-width: 100%;
  }
}

#map, #cesium-container {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
}

/* ── Map snapshot loading overlay ─────────────────────────────────────── */
#map-loading {
  position: absolute;
  inset: 0;
  background: rgba(255, 255, 255, .45);
  backdrop-filter: blur(1px);
  z-index: 300;
  display: flex;
  align-items: center;
  justify-content: center;
  pointer-events: none;
}

.map-loading-inner {
  background: rgba(255, 255, 255, .95);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 16px 24px;
  display: flex;
  flex-direction: column;
  align-items: center;
  font-size: 12px;
  color: var(--muted);
  box-shadow: var(--shadow);
}

/* ── 3D toggle ────────────────────────────────────────────────────────── */
#tilt-toggle.active {
  background-color: var(--blue);
  border-color: var(--blue);
  color: #fff;
}

/* ── Tiles warning banner ─────────────────────────────────────────────── */
#tiles-warning {
  position: absolute;
  top: 8px; left: 50%;
  transform: translateX(-50%);
  z-index: 300;
  background: #fff3cd;
  border: 1px solid #ffc107;
  border-radius: 6px;
  padding: 8px 14px;
  font-size: 12px;
  max-width: 420px;
  text-align: center;
  box-shadow: var(--shadow);
}

/* ── Map tooltip ──────────────────────────────────────────────────────── */
#map-tooltip {
  display: none;
  position: absolute;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 6px 10px;
  font-size: 12px;
  pointer-events: none;
  z-index: 500;
  box-shadow: var(--shadow);
  max-width: 200px;
}

/* ── Speed legend ────────────────────────────────────────────────────────── */
.color-control {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 3px;
  width: 310px;
  min-width: 310px;
}

.color-control-top {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: nowrap;
}

.color-control .control-kicker {
  font-size: 11px;
  flex: 0 0 auto;
  white-space: nowrap;
}

.color-menu-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  flex: 1 1 auto;
  min-width: 0;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: #fff;
  color: var(--text);
  padding: 4px 10px;
  font-size: 13px;
  font-weight: 600;
  line-height: 1.2;
  box-shadow: 0 1px 2px rgba(0,0,0,.06);
}

#color-current-label {
  flex: 1 1 auto;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  text-align: center;
}

.color-menu-button:hover,
.color-menu-button[aria-expanded="true"] {
  border-color: rgba(26, 115, 232, .35);
  box-shadow: 0 4px 14px rgba(26, 115, 232, .12);
}

.color-menu-chevron {
  font-size: 12px;
  color: var(--muted);
  flex: 0 0 auto;
}

.color-helper {
  font-size: 11px;
  color: var(--muted);
  line-height: 1.2;
  max-width: 250px;
}

.color-menu {
  position: absolute;
  top: calc(100% + 8px);
  left: 0;
  width: min(320px, calc(100vw - 32px));
  max-height: 380px;
  overflow-y: auto;
  padding: 8px;
  background: rgba(255, 255, 255, .98);
  border: 1px solid rgba(32, 33, 36, .08);
  border-radius: 16px;
  box-shadow: 0 18px 44px rgba(60, 64, 67, .18), 0 6px 18px rgba(60, 64, 67, .12);
  backdrop-filter: blur(10px);
  z-index: 420;
}

.color-menu-group + .color-menu-group {
  border-top: 1px solid rgba(218, 220, 224, .9);
  margin-top: 8px;
  padding-top: 8px;
}

.color-menu-title {
  margin: 0 0 6px;
  padding: 0 6px;
  font-size: 10px;
  font-weight: 700;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: .06em;
}

.color-menu-item {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  border: 0;
  border-radius: 12px;
  background: transparent;
  padding: 10px 10px 10px 12px;
  text-align: left;
}

.color-menu-item:hover,
.color-menu-item.is-active {
  background: #f4f8ff;
}

.color-menu-copy {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.color-menu-label {
  font-size: 12px;
  font-weight: 600;
  color: var(--text);
}

.color-menu-description {
  font-size: 11px;
  color: var(--muted);
  line-height: 1.3;
}

.color-menu-swatch {
  flex-shrink: 0;
  width: 48px;
  height: 12px;
  border-radius: 999px;
  border: 1px solid rgba(0, 0, 0, .08);
}

.speed-legend {
  display: flex;
  flex-direction: column;
  gap: 3px;
  width: 100%;
  min-width: 310px;
}

.legend-scale-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 72px;
  align-items: start;
  gap: 8px;
  width: 100%;
}

.legend-unit {
  padding-top: 1px;
  color: var(--muted);
  font-size: 10px;
  font-weight: 700;
  line-height: 1.1;
  text-align: left;
  white-space: nowrap;
}

.legend-scale {
  min-width: 0;
}

.legend-gradient {
  height: 11px;
  border-radius: 4px;
  background: linear-gradient(to right, #ea4335 0%, #fa7b17 33%, #fbbc04 55%, #7dc68b 75%, #34a853 100%);
  border: 1px solid rgba(0,0,0,.12);
}

.legend-gradient.is-discrete,
.color-menu-swatch.is-discrete {
  border-radius: 3px;
  image-rendering: crisp-edges;
  box-shadow:
    inset 1px 0 0 rgba(255, 255, 255, .55),
    inset -1px 0 0 rgba(0, 0, 0, .08);
}
.legend-ticks {
  display: flex;
  justify-content: space-between;
  font-size: 10px;
  color: var(--muted);
}

.legend-ticks.dual {
  display: flex;
  align-items: center;
  min-width: 0;
}

.legend-ticks-row {
  display: flex;
  justify-content: space-between;
  gap: 8px;
}

.legend-ticks-combined {
  width: 100%;
  gap: 6px;
  justify-content: space-between;
  white-space: nowrap;
}

.legend-ticks-row span {
  font-size: 9px;
  color: var(--muted);
}

.legend-tick-divider {
  color: #9aa0a6 !important;
  padding: 0 1px;
}

@media (max-width: 880px) {
  .about-hero,
  .about-grid {
    grid-template-columns: 1fr;
  }

  .about-hero {
    padding: 24px 22px 16px;
  }

  .about-summary {
    padding: 12px 22px;
  }

  .about-title-wrap h2 {
    font-size: 26px;
  }

  .color-control {
    width: min(100%, 320px);
    min-width: 0;
  }

  .color-helper {
    max-width: none;
  }

  .color-menu {
    width: min(100vw - 24px, 340px);
  }

}

@media print {
  #controls-bar,
  #map-container,
  #sidebar-loading,
  #map-loading {
    display: none !important;
  }

  #app-layout {
    margin: 0;
    height: auto;
    display: block;
  }

  #chart-sidebar {
    display: block !important;
    width: 100% !important;
    border: 0;
    box-shadow: none;
    overflow: visible;
  }
}

/* ══════════════════════════════════════════════════════════════════════════
   Cesium — hide default UI chrome
   ══════════════════════════════════════════════════════════════════════════ */
#cesium-container .cesium-widget-credits,
#cesium-container .cesium-infoBox,
#cesium-container .cesium-viewer-toolbar,
#cesium-container .cesium-viewer-animationContainer,
#cesium-container .cesium-viewer-timelineContainer,
#cesium-container .cesium-viewer-bottom {
  display: none !important;
}
