:root {
  color-scheme: light;
  --ink: #17212b;
  --muted: #5d6977;
  --panel: #ffffff;
  --paper: #edf0e7;
  --accent: #1a6fb5;
  --accent-strong: #0d4f8c;
  --brand-orange: #e87722;
  --teal: #0c7c84;
  --line: #d8dddf;
  --shadow: 0 18px 44px rgba(30, 42, 50, 0.18);
}

* {
  box-sizing: border-box;
}

html,
body {
  height: 100%;
  margin: 0;
}

body {
  color: var(--ink);
  font-family:
    Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI",
    "Noto Sans Arabic", sans-serif;
  background: var(--paper);
}

button,
input,
select {
  font: inherit;
}

.app-shell {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  height: 100vh;
  min-height: 620px;
}

.panel {
  z-index: 2;
  display: flex;
  flex-direction: column;
  gap: 18px;
  padding: 22px;
  background: var(--panel);
  box-shadow: var(--shadow);
  width: 360px;
  min-width: 0;
  overflow: hidden;
  transition: width 0.28s ease;
}

.panel-top {
  display: none;
}

.brand-text {
  flex: 1;
  min-width: 0;
}

.brand-heading {
  display: flex;
  align-items: flex-start;
  gap: 8px;
}

.brand-heading h1 {
  flex: 1;
  min-width: 0;
}

.lang-toggle {
  flex: none;
  min-height: 26px;
  height: 26px;
  padding: 0 8px;
  margin-top: 1px;
  border: 1px solid var(--line);
  border-radius: 5px;
  color: var(--accent-strong);
  background: #f0f6fc;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.4px;
  line-height: 1;
  cursor: pointer;
  transition: background 0.12s ease, border-color 0.12s ease;
}

.lang-toggle:hover {
  background: #e3eef8;
  border-color: var(--accent);
}

.app-shell.panel-hidden .panel {
  width: 0;
  min-width: 0;
  padding: 0;
  border: 0;
  opacity: 0;
  pointer-events: none;
  overflow: hidden;
}

.brand {
  display: flex;
  gap: 12px;
  align-items: flex-start;
}

.brand-logo {
  flex: none;
  width: 56px;
  height: 56px;
  border-radius: 8px;
  object-fit: contain;
  border: 1px solid var(--line);
  background: #fff;
}

.brand-mark {
  width: 13px;
  height: 44px;
  border-radius: 999px;
  background: linear-gradient(180deg, var(--accent), var(--teal));
}

h1 {
  margin: 0;
  font-size: 15px;
  line-height: 1.25;
  letter-spacing: 0;
  color: var(--accent-strong);
}

p {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 13px;
}

.controls {
  display: grid;
  gap: 14px;
}

.controls > button[type="submit"] {
  grid-column: 1 / -1;
}

.map-style-wrap {
  margin-top: 2px;
}

label {
  display: grid;
  gap: 7px;
  color: #2d3843;
  font-size: 13px;
  font-weight: 700;
}

input:not(.damage-toggle-input),
select {
  width: 100%;
  min-height: 42px;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 0 12px;
  color: var(--ink);
  background: #f8faf7;
}

input:not(.damage-toggle-input):focus,
select:focus {
  outline: 2px solid rgba(12, 124, 132, 0.22);
  border-color: var(--teal);
}

button {
  min-height: 44px;
  border: 0;
  border-radius: 6px;
  color: white;
  background: var(--accent-strong);
  font-weight: 800;
  cursor: pointer;
}

button:disabled {
  cursor: wait;
  opacity: 0.72;
}

.damage-filter {
  display: grid;
  gap: 7px;
  grid-column: 1 / -1;
}

.damage-filter-heading {
  color: #2d3843;
  font-size: 13px;
  font-weight: 700;
}

.damage-filter-dropdown {
  position: relative;
}

.controls .damage-filter-trigger {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  width: 100%;
  min-height: 42px;
  padding: 0 12px;
  border: 1px solid var(--line) !important;
  border-radius: 6px;
  color: var(--ink) !important;
  background: #f8faf7 !important;
  font-size: 14px;
  font-weight: 600;
  text-align: start;
  cursor: pointer;
  box-shadow: none;
}

.controls .damage-filter-trigger:hover {
  border-color: #c5d0d8;
  background: #f3f7f4;
}

.controls .damage-filter-trigger[aria-expanded="true"] {
  border-color: var(--teal);
  box-shadow: 0 0 0 2px rgba(12, 124, 132, 0.14);
}

.damage-filter-chevron {
  flex: none;
  color: var(--muted);
  font-size: 12px;
  line-height: 1;
  transition: transform 0.16s ease;
}

.controls .damage-filter-trigger[aria-expanded="true"] .damage-filter-chevron {
  transform: rotate(180deg);
}

.damage-filter-menu:not([hidden]) {
  display: grid;
  gap: 4px;
  position: absolute;
  top: calc(100% + 6px);
  inset-inline: 0;
  z-index: 30;
  padding: 8px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  box-shadow: 0 10px 28px rgba(20, 30, 40, 0.12), 0 2px 6px rgba(20, 30, 40, 0.06);
}

.damage-filter-menu[hidden] {
  display: none !important;
}

.damage-filter-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-height: 40px;
  padding: 6px 8px;
  border-radius: 6px;
  cursor: pointer;
  user-select: none;
}

.damage-filter-row:hover {
  background: #f5f8f6;
}

.damage-filter-row-label {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
  flex: 1;
  color: #2d3843;
  font-size: 13px;
  font-weight: 600;
  line-height: 1.2;
}

.toggle-switch {
  position: relative;
  display: inline-block;
  flex: none;
  width: 46px;
  height: 26px;
}

.damage-toggle-input {
  position: absolute;
  opacity: 0;
  width: 0;
  height: 0;
  margin: 0;
  pointer-events: none;
}

.toggle-switch-track {
  position: absolute;
  inset: 0;
  border: 1px solid #bcc8c0;
  border-radius: 999px;
  background: #dde5df;
  transition: background 0.18s ease, border-color 0.18s ease;
}

.toggle-switch-track::before {
  content: "";
  position: absolute;
  top: 2px;
  inset-inline-start: 2px;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 1px 4px rgba(20, 30, 40, 0.2);
  transition: transform 0.18s ease;
}

.damage-toggle-input:checked + .toggle-switch-track {
  background: var(--teal);
  border-color: #0a6d74;
}

.damage-toggle-input:checked + .toggle-switch-track::before {
  transform: translateX(20px);
}

[dir="rtl"] .damage-toggle-input:checked + .toggle-switch-track::before {
  transform: translateX(-20px);
}

.damage-toggle-input:focus-visible + .toggle-switch-track {
  outline: 2px solid rgba(12, 124, 132, 0.28);
  outline-offset: 2px;
}

.damage-filter-row-divider {
  margin-top: 4px;
  padding-top: 10px;
  border-top: 1px solid #e6ece8;
}

.debris-label-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: none;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  border: 2px solid #3b82f6;
  color: #2563eb;
  background: #eff6ff;
  font-size: 9px;
  font-weight: 900;
  line-height: 1;
}

.debris-callouts-layer {
  position: absolute;
  inset: 0;
  z-index: 4;
  pointer-events: none;
  overflow: hidden;
  contain: layout style paint;
}

.debris-callout {
  position: absolute;
  top: 0;
  left: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  will-change: transform;
}

.debris-callout-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 5px 11px;
  border-radius: 999px;
  border: 1.5px solid rgba(37, 99, 235, 0.85);
  background: rgba(255, 255, 255, 0.94);
  color: #1e40af;
  box-shadow:
    0 2px 8px rgba(30, 64, 175, 0.18),
    0 0 0 1px rgba(255, 255, 255, 0.65) inset;
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  line-height: 1.15;
  white-space: nowrap;
  transform-origin: 50% 100%;
  -webkit-font-smoothing: antialiased;
}

.debris-callout-text {
  font-size: 12px;
  font-weight: 800;
  letter-spacing: -0.01em;
}

.debris-callout-unit {
  margin-left: 0.28em;
  font-size: 0.82em;
  font-weight: 700;
  opacity: 0.9;
}

.debris-callout-line {
  width: 2px;
  height: 20px;
  margin-top: 1px;
  background: linear-gradient(to bottom, rgba(37, 99, 235, 0.9), rgba(37, 99, 235, 0.35));
  border-radius: 1px;
}

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

.stats.stats-zone {
  grid-template-columns: repeat(2, 1fr);
}

.stats div {
  min-width: 0;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #f8faf7;
}

.stats strong,
.stats span {
  display: block;
}

.stats strong {
  overflow-wrap: anywhere;
  font-size: 18px;
  line-height: 1.15;
}

.stats span {
  margin-top: 4px;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.2;
}

.status {
  min-height: 72px;
  padding: 12px;
  border-left: 4px solid var(--teal);
  color: #263341;
  background: #eef7f5;
  font-size: 13px;
  line-height: 1.45;
}

.legend {
  display: grid;
  gap: 10px;
  margin-top: auto;
  color: #34424f;
  font-size: 13px;
}

.legend[hidden] {
  display: none !important;
}

.legend div {
  display: flex;
  gap: 10px;
  align-items: center;
}

.line {
  width: 34px;
  height: 0;
  border-top: 5px solid;
}

.line.road {
  border-color: var(--accent);
}

.road-badge {
  z-index: 460;
  cursor: pointer;
  border: 1.5px solid rgba(255, 255, 255, 0.9);
  border-radius: 7px;
  padding: 2px 8px;
  color: #fff;
  font-family: inherit;
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.2px;
  line-height: 1.35;
  white-space: nowrap;
  box-shadow: 0 2px 7px rgba(20, 30, 40, 0.4);
  transition: transform 0.08s ease;
}

.road-badge:hover {
  transform: scale(1.14);
}

.road-badge.europa {
  background: #1f7a34;
}

.road-badge.riks {
  background: #34424f;
}

.badge-swatch {
  flex: none;
  padding: 1px 6px;
  border-radius: 6px;
  background: #1f7a34;
  color: #fff;
  font-size: 11px;
  font-weight: 800;
}

.line.spine {
  border-color: rgba(47, 52, 64, 0.5);
  border-top-style: dashed;
}

.line.bar {
  height: 7px;
  border-top: 0;
  border-radius: 2px;
  background: linear-gradient(
    90deg,
    rgb(59, 130, 189),
    rgb(38, 166, 154),
    rgb(242, 181, 61),
    rgb(214, 64, 56)
  );
}

.swatch {
  flex: none;
  width: 18px;
  height: 18px;
  border-radius: 4px;
  border: 1px solid rgba(36, 48, 65, 0.25);
}

.swatch.damage-total {
  background: #d64038;
}

.swatch.damage-partial {
  background: #f2b53d;
}

.swatch.damage-unknown {
  background: #3b82f6;
}

.legend-hint {
  font-size: 12px;
  line-height: 1.45;
  color: var(--muted);
}

.popup-note {
  margin-top: 8px;
  font-size: 12px;
  line-height: 1.45;
  color: var(--muted);
}

.zone-legend {
  gap: 8px;
}

.app-shell.chart-focus .year-selector,
.app-shell.chart-focus .time-dial {
  visibility: hidden;
  pointer-events: none;
}

.map-wrap {
  position: relative;
  overflow: hidden;
  min-width: 0;
  height: 100vh;
  min-height: 620px;
}

#map {
  position: absolute;
  inset: 0;
  width: 100%;
  height: auto;
  background: #dde7ec;
}

#chartOverlay {
  position: absolute;
  inset: 0;
  z-index: 450;
  width: 100%;
  height: 100%;
  overflow: visible;
  pointer-events: none;
}

.chart-spine {
  fill: none;
  stroke: rgba(37, 41, 50, 0.7);
  stroke-width: 1.8;
  stroke-linejoin: round;
  stroke-linecap: round;
}

.guide-curve {
  fill: none;
  stroke: rgba(37, 41, 50, 0.4);
  stroke-width: 1;
}

.guide-text {
  fill: #20242c;
  font-size: 11px;
  font-weight: 700;
  paint-order: stroke;
  stroke: rgba(255, 255, 255, 0.9);
  stroke-width: 3;
}

.density-bin {
  fill: rgba(123, 35, 143, 0.62);
  stroke: rgba(123, 35, 143, 0.52);
  stroke-width: 0.6;
}

.panel-toggle {
  position: absolute;
  top: 16px;
  left: 16px;
  z-index: 500;
  width: 40px;
  min-height: 40px;
  height: 40px;
  padding: 0;
  border-radius: 10px;
  color: var(--ink);
  background: rgba(255, 255, 255, 0.92);
  box-shadow: var(--shadow);
  display: flex;
  align-items: center;
  justify-content: center;
}

.view-toggle {
  position: absolute;
  top: 16px;
  left: 66px;
  z-index: 500;
  width: 54px;
  min-height: 40px;
  height: 40px;
  padding: 0;
  border-radius: 10px;
  color: var(--ink);
  background: rgba(255, 255, 255, 0.92);
  font-size: 15px;
  font-weight: 800;
  box-shadow: var(--shadow);
}

.view-toggle.active {
  color: #fff;
  background: var(--accent-strong);
}

.year-selector {
  position: absolute;
  top: 16px;
  right: 16px;
  z-index: 500;
  width: 188px;
  padding: 14px;
  border-radius: 14px;
  border: 1px solid rgba(255, 255, 255, 0.6);
  background: rgba(255, 255, 255, 0.82);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  box-shadow: 0 8px 32px rgba(20, 30, 40, 0.14), 0 1px 4px rgba(20, 30, 40, 0.08);
}

.year-title,
.time-title {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  margin-bottom: 10px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.7px;
  text-transform: uppercase;
  color: var(--muted);
}

.year-title .year-road-name {
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
}

.year-road-name {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 6px;
  border: 1.5px solid rgba(255, 255, 255, 0.9);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.2px;
  line-height: 1.35;
  color: #fff;
  white-space: nowrap;
  box-shadow: 0 2px 6px rgba(20, 30, 40, 0.3);
  text-transform: none;
}

.year-road-name.europa {
  background: #1f7a34;
}

.year-road-name.riks {
  background: #34424f;
}

.year-road-name.aiocp {
  background: #0d4f8c;
}

#yearButtons {
  display: grid;
  gap: 3px;
}

.year-btn {
  display: grid;
  grid-template-columns: 22px 1fr auto;
  align-items: center;
  gap: 8px;
  min-height: 32px;
  padding: 4px 8px;
  border: 1px solid transparent;
  border-radius: 8px;
  background: transparent;
  color: var(--muted);
  font-weight: 600;
  text-align: left;
  cursor: pointer;
  transition: background 0.12s ease, border-color 0.12s ease, color 0.12s ease;
}

.year-btn:hover {
  background: rgba(26, 111, 181, 0.06);
  color: var(--ink);
}

.year-btn.active {
  border-color: rgba(26, 111, 181, 0.18);
  background: rgba(26, 111, 181, 0.09);
  color: var(--ink);
}

.year-dot {
  justify-self: center;
  border-radius: 999px;
  background: linear-gradient(180deg, var(--accent), var(--teal));
}

.damage-class-swatch {
  border-radius: 3px;
  justify-self: center;
}

.damage-class-btn-all {
  min-height: 38px;
  margin-bottom: 4px;
  padding-top: 6px;
  padding-bottom: 6px;
}

.damage-class-btn-all .year-label {
  font-size: 12px;
  font-weight: 700;
}

.damage-class-btn .year-label {
  font-size: 11px;
}

.year-label {
  font-size: 12px;
}

.year-count {
  color: var(--ink);
  font-size: 11px;
  font-weight: 800;
  opacity: 0.75;
}

.year-btn.active .year-count {
  opacity: 1;
}

.time-dial {
  position: absolute;
  bottom: 16px;
  left: 16px;
  z-index: 500;
  width: 168px;
  padding: 12px 12px 6px;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.92);
  box-shadow: var(--shadow);
}

.map-loader {
  position: absolute;
  inset: 0;
  z-index: 600;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(221, 231, 236, 0.72);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
}

.map-loader[hidden] {
  display: none !important;
}

.map-loader-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
  padding: 22px 28px;
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.96);
  box-shadow: 0 10px 40px rgba(20, 30, 40, 0.14);
}

.map-loader-spinner {
  width: 40px;
  height: 40px;
  border: 3px solid rgba(13, 79, 140, 0.15);
  border-top-color: var(--accent-strong);
  border-radius: 50%;
  animation: map-loader-spin 0.85s linear infinite;
}

.map-loader-text {
  font-size: 13px;
  font-weight: 600;
  color: var(--ink);
}

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

.dial-svg {
  width: 144px;
  height: 144px;
  touch-action: none;
}

.dial-track {
  fill: none;
  stroke: var(--line);
  stroke-width: 6;
}

.dial-arc {
  fill: none;
  stroke: var(--accent);
  stroke-width: 6;
  stroke-linecap: round;
}

.dial-tick {
  stroke: rgba(93, 105, 119, 0.55);
  stroke-width: 1;
}

.dial-tick.major {
  stroke: var(--muted);
  stroke-width: 1.6;
}

.dial-hour {
  fill: var(--muted);
  font-size: 9px;
  font-weight: 700;
  text-anchor: middle;
  dominant-baseline: middle;
}

.dial-handle {
  fill: #ffffff;
  stroke: var(--accent-strong);
  stroke-width: 2.5;
  cursor: grab;
}

.dial-value {
  fill: var(--ink);
  font-size: 15px;
  font-weight: 800;
  text-anchor: middle;
}

.dial-value-sub {
  fill: var(--muted);
  font-size: 12px;
  font-weight: 700;
  text-anchor: middle;
}

.road-info-overlay {
  position: absolute;
  bottom: 46px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 500;
  padding: 7px 20px;
  border-radius: 20px;
  background: rgba(255, 255, 255, 0.92);
  box-shadow: var(--shadow);
  font-size: 17px;
  font-weight: 800;
  color: var(--ink);
  pointer-events: none;
  white-space: nowrap;
  letter-spacing: 0.3px;
}

.bar-details {
  position: absolute;
  top: 72px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 520;
  width: min(320px, calc(100% - 32px));
  padding: 14px 16px 12px;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.96);
  box-shadow: var(--shadow);
  border: 1px solid var(--line);
}

.bar-details-close {
  position: absolute;
  top: 8px;
  right: 10px;
  width: 28px;
  min-height: 28px;
  height: 28px;
  padding: 0;
  border: 0;
  border-radius: 6px;
  color: var(--muted);
  background: transparent;
  font-size: 20px;
  line-height: 1;
  cursor: pointer;
}

.bar-details-close:hover {
  color: var(--ink);
  background: #f0f3f5;
}

.bar-details-content {
  padding-right: 20px;
}

html[dir="rtl"] .bar-details-content {
  padding-right: 0;
  padding-left: 20px;
}

html[dir="rtl"] .bar-details-close {
  right: auto;
  left: 10px;
}

.source {
  position: absolute;
  right: 14px;
  bottom: 14px;
  z-index: 500;
  max-width: min(520px, calc(100% - 28px));
  padding: 7px 10px;
  border-radius: 6px;
  color: #263341;
  background: rgba(255, 255, 255, 0.88);
  box-shadow: 0 8px 20px rgba(30, 42, 50, 0.14);
  font-size: 12px;
}

.leaflet-popup-content {
  margin: 12px 14px;
  min-width: 190px;
}

.popup-title {
  margin-bottom: 6px;
  font-weight: 800;
}

.popup-row {
  display: flex;
  justify-content: space-between;
  gap: 18px;
  color: #34424f;
  font-size: 12px;
}

.popup-row span:last-child {
  color: #111a22;
  font-weight: 700;
  text-align: right;
}

.panel-backdrop {
  display: none;
}

@media (max-width: 820px) {
  .app-shell {
    display: block;
    height: 100vh;
    height: 100dvh;
    min-height: 0;
    overflow: hidden;
  }

  .map-wrap {
    position: fixed;
    inset: 0;
    z-index: 1;
    width: 100%;
    height: 100vh;
    height: 100dvh;
    min-height: 0;
  }

  .panel {
    position: fixed;
    inset-block: 0;
    inset-inline-start: 0;
    z-index: 900;
    width: 360px;
    max-width: min(360px, 92vw);
    padding: 22px;
    gap: 18px;
    overflow-x: hidden;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    opacity: 1;
    pointer-events: auto;
    transform: translateX(0);
    transition: transform 0.28s ease;
    box-shadow: var(--shadow);
  }

  html[dir="rtl"] .panel {
    inset-inline-start: auto;
    inset-inline-end: 0;
  }

  .app-shell.panel-hidden .panel {
    width: 360px;
    max-width: min(360px, 92vw);
    min-width: 0;
    padding: 22px;
    border: 0;
    opacity: 1;
    pointer-events: none;
    overflow-y: auto;
    transform: translateX(-100%);
  }

  html[dir="rtl"] .app-shell.panel-hidden .panel {
    transform: translateX(100%);
  }

  .panel-backdrop {
    display: block;
    position: fixed;
    inset: 0;
    z-index: 850;
    border: 0;
    margin: 0;
    padding: 0;
    background: rgba(17, 26, 35, 0.45);
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.28s ease;
  }

  .panel-backdrop:not([hidden]) {
    opacity: 1;
    pointer-events: auto;
  }

  .panel-toggle,
  .view-toggle {
    z-index: 920;
  }

  .panel-toggle {
    top: max(16px, env(safe-area-inset-top, 0px));
    left: max(16px, env(safe-area-inset-left, 0px));
  }

  html[dir="rtl"] .panel-toggle {
    left: auto;
    right: max(16px, env(safe-area-inset-right, 0px));
  }

  .view-toggle {
    top: max(16px, env(safe-area-inset-top, 0px));
    left: max(66px, calc(16px + env(safe-area-inset-left, 0px) + 50px));
  }

  html[dir="rtl"] .view-toggle {
    left: auto;
    right: max(66px, calc(16px + env(safe-area-inset-right, 0px) + 50px));
  }

  .year-selector {
    top: max(16px, env(safe-area-inset-top, 0px));
    right: max(16px, env(safe-area-inset-right, 0px));
    width: min(188px, calc(100vw - 150px));
  }

  html[dir="rtl"] .year-selector {
    right: auto;
    left: max(16px, env(safe-area-inset-left, 0px));
  }

  .time-dial {
    bottom: max(16px, env(safe-area-inset-bottom, 0px));
    left: max(16px, env(safe-area-inset-left, 0px));
    width: min(168px, calc(100vw - 32px));
  }

  html[dir="rtl"] .time-dial {
    left: auto;
    right: max(16px, env(safe-area-inset-right, 0px));
  }

  .source {
    bottom: max(14px, env(safe-area-inset-bottom, 0px));
    right: max(14px, env(safe-area-inset-right, 0px));
    max-width: min(520px, calc(100vw - 28px));
    font-size: 11px;
  }

  html[dir="rtl"] .source {
    right: auto;
    left: max(14px, env(safe-area-inset-left, 0px));
  }

  .bar-details {
    top: max(72px, calc(56px + env(safe-area-inset-top, 0px)));
    width: min(320px, calc(100% - 24px));
  }

  .road-info-overlay {
    bottom: max(46px, calc(36px + env(safe-area-inset-bottom, 0px)));
    max-width: calc(100vw - 32px);
    font-size: 15px;
    white-space: normal;
    text-align: center;
  }
}

@media (max-width: 560px) {
  .year-selector {
    width: min(168px, calc(100vw - 140px));
    padding: 10px;
  }

  .time-dial {
    width: min(152px, calc(100vw - 32px));
    padding: 10px 10px 4px;
  }

  .dial-svg {
    width: 132px;
    height: 132px;
  }
}

/* Desktop/laptop short screens: shrink panel like browser 90% view */
@media (max-height: 900px) and (min-width: 821px) {
  .panel {
    zoom: 0.9;
  }
}

@media (max-height: 760px) and (min-width: 821px) {
  .panel {
    zoom: 0.82;
  }
}

html[dir="rtl"] .brand-heading {
  flex-direction: row-reverse;
}

html[dir="rtl"] .brand {
  flex-direction: row-reverse;
  text-align: right;
}

html[dir="rtl"] .legend div,
html[dir="rtl"] .year-btn {
  flex-direction: row-reverse;
  text-align: right;
}

html[dir="rtl"] .year-btn {
  grid-template-columns: auto 1fr 22px;
}

html[dir="rtl"] .source {
  right: auto;
  left: 14px;
  text-align: right;
}

.login-body {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
  background:
    radial-gradient(ellipse 80% 60% at 50% 0%, rgba(26, 111, 181, 0.08), transparent),
    var(--paper);
}

.login-shell {
  width: min(420px, 100%);
}

.login-card {
  display: grid;
  gap: 22px;
  padding: 28px 26px 26px;
  background: var(--panel);
  border-radius: 12px;
  box-shadow: var(--shadow);
}

.login-brand {
  margin-bottom: 4px;
}

.login-form {
  margin: 0;
}

.login-status {
  margin: 0;
}

.login-status-error {
  color: #b42318;
  background: #fef3f2;
  border: 1px solid #fecdca;
  border-radius: 6px;
  padding: 10px 12px;
}
