:root {
  --bg: #f5f7f4;
  --panel: #ffffff;
  --text: #172027;
  --muted: #66737b;
  --line: #d9e1df;
  --teal: #116d75;
  --teal-dark: #0b4d55;
  --mint: #dcefed;
  --amber: #c98119;
  --amber-soft: #f7e8cc;
  --red: #b34a44;
  --blue: #2f65a7;
  --brand-blue: #0b4fa2;
  --electric-blue: #58d0ff;
  --popup-top-clearance: 68px;
  --popup-bottom-clearance: 24px;
  --sheet-peek: 96px;
  --shadow: 0 18px 42px rgba(31, 45, 48, 0.16);
}

* {
  box-sizing: border-box;
}

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

body {
  overflow: hidden;
  background: var(--bg);
  color: var(--text);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

button,
input,
select {
  font: inherit;
}

button,
a,
select,
input,
summary {
  -webkit-tap-highlight-color: transparent;
}

:is(button, a, select, input, summary):focus-visible {
  outline: 3px solid var(--brand-blue);
  outline-offset: 2px;
}

.search-field:focus-within {
  outline: 3px solid var(--brand-blue);
  outline-offset: 2px;
}

.search-field input:focus-visible {
  outline: none;
}

:is(h1, h2, .station-address, .station-meta, .station-connectors, .source-link) {
  overflow-wrap: anywhere;
}

.bike-app {
  display: grid;
  grid-template-columns: minmax(340px, 420px) minmax(0, 1fr);
  width: 100%;
  height: 100%;
  transition: grid-template-columns 180ms ease;
}

.bike-app.sidebar-collapsed {
  grid-template-columns: 0 minmax(0, 1fr);
}

.sidebar {
  display: flex;
  flex-direction: column;
  min-width: 0;
  height: 100%;
  border-right: 1px solid var(--line);
  background: var(--panel);
  z-index: 500;
  overflow: hidden;
}

@media (min-width: 981px) {
  .bike-app.sidebar-collapsed .sidebar {
    width: 0;
    border-right: 0;
    pointer-events: none;
  }
}

.sidebar-content {
  display: flex;
  flex-direction: column;
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
}

.drawer-handle {
  display: none;
}

.app-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  flex: 0 0 auto;
  padding: 22px 22px 16px;
  border-bottom: 1px solid var(--line);
  background: #ffffff;
}

.app-header > div:first-child {
  min-width: 0;
}

.brand-lockup {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}

.app-logo {
  flex: 0 0 auto;
  width: 44px;
  height: 44px;
  border-radius: 10px;
  box-shadow: 0 8px 20px rgba(11, 79, 162, 0.28);
}

.brand-lockup > div {
  min-width: 0;
}

.eyebrow {
  margin: 0 0 5px;
  color: var(--teal);
  font-size: 0.75rem;
  font-weight: 800;
  text-transform: uppercase;
}

h1 {
  margin: 0;
  max-width: 260px;
  font-size: 1.45rem;
  line-height: 1.12;
}

.total-counter {
  display: grid;
  justify-items: end;
  gap: 1px;
  min-width: 74px;
  padding-top: 2px;
}

.total-counter strong {
  font-size: 1.55rem;
  line-height: 1;
}

.total-counter span,
.stats span,
.select-field span {
  color: var(--muted);
  font-size: 0.76rem;
  font-weight: 700;
}

.controls {
  display: grid;
  gap: 12px;
  flex: 0 0 auto;
  padding: 16px 18px;
  border-bottom: 1px solid var(--line);
  background: #fbfcfb;
}

.search-field {
  display: flex;
  align-items: center;
  gap: 9px;
  height: 44px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #ffffff;
}

.search-field svg {
  flex: 0 0 auto;
  width: 18px;
  height: 18px;
  color: var(--muted);
}

.search-field input {
  width: 100%;
  min-width: 0;
  border: 0;
  outline: 0;
  background: transparent;
  color: var(--text);
}

.control-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.select-field {
  display: grid;
  gap: 5px;
  min-width: 0;
}

.select-field select {
  width: 100%;
  height: 40px;
  padding: 0 34px 0 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #ffffff;
  color: var(--text);
}

.country-filter {
  display: grid;
  gap: 5px;
  min-width: 0;
  margin: 0;
  padding: 0;
  border: 0;
}

.country-filter legend {
  margin: 0 0 5px;
  padding: 0;
  color: var(--muted);
  font-size: 0.76rem;
  font-weight: 700;
}

.segmented-control {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  min-height: 40px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #ffffff;
}

.country-choice {
  position: relative;
  min-width: 0;
  border-left: 1px solid var(--line);
  cursor: pointer;
}

.country-choice:first-child {
  border-left: 0;
}

.country-choice input {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
}

.country-choice span {
  display: flex;
  align-items: center;
  justify-content: center;
  min-width: 0;
  height: 100%;
  padding: 0 8px;
  color: #405158;
  font-size: 0.82rem;
  font-weight: 800;
  text-align: center;
}

.country-choice input:checked + span {
  background: var(--brand-blue);
  color: #ffffff;
}

.country-choice input:focus-visible + span {
  box-shadow: inset 0 0 0 3px var(--electric-blue);
}

.source-picker {
  position: relative;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #ffffff;
}

.source-picker summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  min-height: 42px;
  padding: 0 12px;
  cursor: pointer;
  list-style: none;
}

.source-picker summary::-webkit-details-marker {
  display: none;
}

.source-picker summary span {
  color: var(--muted);
  font-size: 0.76rem;
  font-weight: 800;
}

.source-picker summary strong {
  min-width: 0;
  color: var(--text);
  font-size: 0.88rem;
  text-align: right;
}

.source-actions {
  display: flex;
  gap: 8px;
  padding: 10px 10px 6px;
  border-top: 1px solid var(--line);
}

.source-actions button {
  min-height: 32px;
  padding: 0 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f7f9f8;
  color: var(--text);
  font-size: 0.78rem;
  font-weight: 800;
  cursor: pointer;
}

.source-options {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
  max-height: 168px;
  overflow: auto;
  padding: 8px 10px 10px;
}

.source-option {
  display: flex;
  align-items: center;
  gap: 7px;
  min-width: 0;
  color: #304047;
  font-size: 0.82rem;
  font-weight: 700;
}

.source-option input {
  flex: 0 0 auto;
  width: 16px;
  height: 16px;
  accent-color: var(--teal);
}

.source-option span {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.action-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}

.icon-button,
.download-link,
.toolbar-button,
.pill-button,
.preview-open-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 38px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #ffffff;
  color: var(--text);
  text-decoration: none;
  cursor: pointer;
}

.icon-button {
  width: 40px;
}

.download-link {
  gap: 7px;
  padding: 0 10px;
  font-size: 0.82rem;
  font-weight: 800;
}

.icon-button svg,
.download-link svg,
.toolbar-button svg,
.pill-button svg,
.preview-open-button svg {
  width: 18px;
  height: 18px;
}

.icon-button:hover,
.download-link:hover,
.toolbar-button:hover,
.pill-button:hover,
.station-item:hover,
.source-actions button:hover,
.preview-card:hover {
  border-color: rgba(17, 109, 117, 0.45);
  background: var(--mint);
}

.icon-button.is-active,
.icon-button.is-active:hover,
.toolbar-button.is-active,
.toolbar-button.is-active:hover {
  border-color: var(--brand-blue);
  background: var(--brand-blue);
  color: #ffffff;
}

.stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1px;
  flex: 0 0 auto;
  border-bottom: 1px solid var(--line);
  background: var(--line);
}

.stats div {
  display: grid;
  gap: 2px;
  padding: 12px 14px;
  background: #ffffff;
}

.stats strong {
  font-size: 1.05rem;
}

.station-list {
  flex: 1 1 auto;
  min-height: 120px;
  overflow: auto;
  overscroll-behavior: contain;
  padding: 12px;
  background: #f7f9f8;
}

.station-item {
  display: grid;
  gap: 8px;
  width: 100%;
  margin: 0 0 9px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #ffffff;
  color: inherit;
  text-align: left;
  cursor: pointer;
}

.station-item.is-active {
  border-color: var(--teal);
  box-shadow: 0 0 0 2px rgba(17, 109, 117, 0.14);
}

.station-title-row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
}

.station-title {
  margin: 0;
  font-size: 0.98rem;
  line-height: 1.24;
}

.station-address,
.station-meta,
.station-connectors {
  margin: 0;
  color: var(--muted);
  font-size: 0.82rem;
  line-height: 1.35;
}

.station-connectors {
  color: #405158;
}

.badge-row {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.badge {
  display: inline-flex;
  align-items: center;
  min-height: 23px;
  padding: 0 7px;
  border-radius: 999px;
  font-size: 0.72rem;
  font-weight: 800;
}

.badge.high {
  background: var(--mint);
  color: var(--teal-dark);
}

.badge.medium {
  background: var(--amber-soft);
  color: #7b4b06;
}

.badge.low {
  background: #f3d7d5;
  color: #81312d;
}

.badge.source {
  background: #e7ecf4;
  color: #314c76;
}

.map-shell {
  position: relative;
  isolation: isolate;
  min-width: 0;
  height: 100%;
}

#map {
  width: 100%;
  height: 100%;
  background: #dfe8e5;
}

.map-toolbar {
  position: absolute;
  top: 14px;
  right: 14px;
  display: flex;
  gap: 8px;
  z-index: 710;
}

.toolbar-button {
  gap: 8px;
  min-width: 42px;
  padding: 0 12px;
  box-shadow: 0 8px 20px rgba(31, 45, 48, 0.14);
  font-weight: 800;
}

.toolbar-button.icon-only {
  width: 42px;
  padding: 0;
}

.basemap-picker {
  position: relative;
}

.basemap-menu {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  display: grid;
  gap: 4px;
  width: 220px;
  padding: 6px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.98);
  box-shadow: 0 12px 30px rgba(31, 45, 48, 0.18);
}

.basemap-menu[hidden],
.navigation-panel[hidden] {
  display: none;
}

.basemap-choice {
  display: grid;
  grid-template-columns: 18px minmax(0, 1fr);
  align-items: center;
  gap: 9px;
  min-height: 52px;
  padding: 7px 9px;
  border-radius: 6px;
  cursor: pointer;
}

.basemap-choice:hover,
.basemap-choice:has(input:checked) {
  background: var(--mint);
}

.basemap-choice input {
  width: 16px;
  height: 16px;
  margin: 0;
  accent-color: var(--teal);
}

.basemap-choice span {
  display: grid;
  gap: 2px;
  min-width: 0;
}

.basemap-choice strong {
  font-size: 0.84rem;
  line-height: 1.15;
}

.basemap-choice small {
  color: var(--muted);
  font-size: 0.72rem;
  line-height: 1.2;
}

.navigation-panel {
  position: absolute;
  top: 68px;
  left: 50%;
  z-index: 660;
  display: grid;
  grid-template-columns: 40px minmax(0, 1fr) 34px;
  align-items: center;
  gap: 10px;
  width: min(460px, calc(100% - 32px));
  min-height: 54px;
  padding: 7px 8px;
  border: 1px solid rgba(11, 79, 162, 0.24);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.96);
  box-shadow: 0 10px 26px rgba(31, 45, 48, 0.18);
  transform: translateX(-50%);
  backdrop-filter: blur(4px);
}

.navigation-heading {
  display: grid;
  place-items: center;
  width: 40px;
  height: 40px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: var(--brand-blue);
  color: #ffffff;
  box-shadow: 0 5px 14px rgba(11, 79, 162, 0.28);
  cursor: pointer;
  transition: transform 260ms ease-out;
}

.navigation-heading:focus-visible {
  outline: 3px solid rgba(88, 208, 255, 0.72);
  outline-offset: 2px;
}

.location-status {
  position: absolute;
  left: 50%;
  bottom: 28px;
  z-index: 710;
  width: max-content;
  max-width: calc(100% - 32px);
  margin: 0;
  padding: 9px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #ffffff;
  color: var(--text);
  box-shadow: var(--shadow);
  font-size: 0.82rem;
  overflow-wrap: anywhere;
  transform: translateX(-50%);
}

.location-status[hidden] {
  display: none;
}

.navigation-heading svg {
  width: 21px;
  height: 21px;
}

.navigation-copy {
  display: grid;
  gap: 2px;
  min-width: 0;
}

.navigation-copy strong,
.navigation-copy span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.navigation-copy strong {
  font-size: 0.86rem;
  line-height: 1.2;
}

.navigation-copy span {
  color: var(--muted);
  font-size: 0.74rem;
  font-weight: 700;
}

.navigation-stop {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: transparent;
  color: #405158;
  cursor: pointer;
}

.navigation-stop:hover {
  background: #eef3f2;
  color: var(--brand-blue);
}

.navigation-stop svg {
  width: 19px;
  height: 19px;
}

.user-location-marker {
  position: relative;
  display: block;
  width: 38px;
  height: 38px;
}

.user-location-dot {
  position: absolute;
  top: 50%;
  left: 50%;
  width: 16px;
  height: 16px;
  border: 3px solid #ffffff;
  border-radius: 50%;
  background: var(--brand-blue);
  box-shadow: 0 3px 10px rgba(8, 46, 84, 0.42);
  transform: translate(-50%, -50%) scale(1);
  transition: opacity 180ms ease, transform 220ms ease;
}

.user-direction-arrow {
  position: absolute;
  inset: 0;
  display: block;
  width: 38px;
  height: 38px;
  transform-origin: center;
  opacity: 0;
  transition: transform 420ms linear, opacity 180ms ease;
  filter: drop-shadow(0 2px 4px rgba(8, 46, 84, 0.42));
}

.user-location-marker.is-moving .user-location-dot {
  opacity: 0;
  transform: translate(-50%, -50%) scale(0.35);
}

.user-location-marker.is-moving .user-direction-arrow {
  opacity: 1;
}

.user-direction-arrow svg {
  position: absolute;
  inset: 3px;
  width: 32px;
  height: 32px;
  fill: rgba(30, 116, 202, 0.18);
  stroke-linejoin: round;
}

.user-direction-arrow .user-arrow-outline {
  color: #ffffff;
  stroke-width: 6;
}

.user-direction-arrow .user-arrow-core {
  color: var(--brand-blue);
  stroke-width: 2.8;
}

.navigation-distance-label-icon {
  background: transparent;
  border: 0;
  pointer-events: none;
}

.navigation-distance-label-icon span {
  display: grid;
  place-items: center;
  width: 88px;
  height: 22px;
  color: #087f92;
  font-size: 0.78rem;
  font-weight: 900;
  line-height: 1;
  white-space: nowrap;
  transform-origin: center;
  text-shadow:
    -2px -2px 0 #ffffff,
    2px -2px 0 #ffffff,
    -2px 2px 0 #ffffff,
    2px 2px 0 #ffffff,
    0 2px 4px rgba(31, 45, 48, 0.34);
}

.leaflet-control-attribution {
  display: flex;
  align-items: center;
  gap: 5px;
  min-height: 20px;
}

.detail-panel {
  position: absolute;
  right: 16px;
  bottom: 16px;
  z-index: 700;
  width: min(460px, calc(100% - 32px));
  max-height: min(76vh, 680px);
  overflow: auto;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.98);
  box-shadow: var(--shadow);
}

.detail-panel.is-hidden {
  display: none;
}

.preview-card {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 12px;
  width: 100%;
  padding: 14px;
  border: 0;
  background: transparent;
  color: inherit;
  text-align: left;
  cursor: pointer;
}

.preview-card h2,
.detail-panel h2 {
  margin: 0;
  font-size: 1.15rem;
  line-height: 1.2;
}

.preview-card p {
  margin: 5px 0 9px;
  color: var(--muted);
  font-size: 0.88rem;
  line-height: 1.35;
}

.preview-open-button {
  width: 40px;
  border-radius: 50%;
}

.detail-content {
  padding: 18px;
}

.detail-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}

.detail-section {
  display: grid;
  gap: 7px;
  padding: 12px 0;
  border-top: 1px solid var(--line);
}

.detail-section h3 {
  margin: 0;
  color: #3a4b51;
  font-size: 0.78rem;
  text-transform: uppercase;
}

.detail-section p {
  margin: 0;
  color: #304047;
  font-size: 0.9rem;
  line-height: 1.45;
}

.detail-actions,
.source-links {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.pill-button {
  gap: 7px;
  padding: 0 11px;
  font-size: 0.83rem;
  font-weight: 800;
  line-height: 1;
  text-align: center;
  white-space: nowrap;
}

.pill-button span {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 1em;
  line-height: 1;
}

.pill-button.primary {
  border-color: var(--teal);
  background: var(--teal);
  color: #ffffff;
}

.pill-button.primary:hover {
  background: var(--teal-dark);
}

.pill-button.navigate-button {
  display: inline-grid;
  grid-template-columns: 18px minmax(0, auto) 18px;
  align-items: center;
  justify-content: center;
  column-gap: 7px;
  min-width: 126px;
  padding-right: 10px;
  padding-left: 10px;
}

.pill-button.navigate-button::after {
  width: 18px;
  height: 18px;
  content: "";
}

.pill-button.navigate-button svg {
  position: static;
  grid-column: 1;
}

.pill-button.navigate-button span {
  grid-column: 2;
}

.source-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 30px;
  padding: 0 9px;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--blue);
  font-size: 0.82rem;
  font-weight: 800;
  text-decoration: none;
}

.legend-panel {
  position: absolute;
  top: 12px;
  left: 12px;
  z-index: 650;
  width: max-content;
  max-width: min(220px, calc(100% - 24px));
  border: 1px solid rgba(217, 225, 223, 0.62);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.66);
  box-shadow: 0 5px 14px rgba(31, 45, 48, 0.08);
  backdrop-filter: blur(2px);
}

.legend-panel summary {
  display: flex;
  align-items: center;
  gap: 5px;
  min-height: 28px;
  padding: 0 8px;
  font-size: 0.74rem;
  font-weight: 800;
  cursor: pointer;
  list-style: none;
}

.legend-panel summary::-webkit-details-marker {
  display: none;
}

.legend-panel svg {
  width: 14px;
  height: 14px;
}

.legend-body {
  display: grid;
  gap: 5px;
  padding: 0 8px 8px;
  color: #405158;
  font-size: 0.72rem;
}

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

.legend-body .mapy-legend-attribution {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 7px;
  margin-top: 3px;
  padding-top: 7px;
  border-top: 1px solid rgba(64, 81, 88, 0.16);
}

.legend-body .mapy-legend-attribution[hidden] {
  display: none;
}

.mapy-legend-attribution a {
  color: #405158;
  font-size: 0.64rem;
  line-height: 1.15;
  text-decoration: none;
}

.mapy-legend-attribution img {
  display: block;
  width: auto;
  height: 20px;
}

.legend-dot,
.legend-cluster {
  flex: 0 0 auto;
  width: 13px;
  height: 13px;
  border: 1px solid rgba(255, 255, 255, 0.9);
  border-radius: 50%;
  box-shadow: 0 1px 4px rgba(20, 32, 38, 0.18);
}

.legend-dot.high {
  background: var(--teal);
}

.legend-dot.medium {
  background: var(--amber);
}

.legend-dot.low {
  background: var(--red);
}

.legend-cluster {
  display: grid;
  place-items: center;
  width: 18px;
  height: 18px;
  background: #286f9f;
  color: #ffffff;
  font-size: 0.56rem;
  font-weight: 900;
}

.empty-state,
.load-state {
  padding: 18px;
  color: var(--muted);
  font-size: 0.9rem;
  line-height: 1.45;
}

.bike-marker {
  position: relative;
  display: block;
  width: 28px;
  height: 28px;
  border: 2px solid #ffffff;
  border-radius: 50% 50% 50% 8px;
  box-shadow: 0 4px 12px rgba(20, 32, 38, 0.28);
  transform: rotate(-45deg);
}

.bike-marker::after {
  content: "";
  position: absolute;
  inset: 7px;
  border-radius: 50%;
  background: #ffffff;
}

.bike-marker.high {
  background: var(--teal);
}

.bike-marker.medium {
  background: var(--amber);
}

.bike-marker.low {
  background: var(--red);
}

.cluster-icon {
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  border: 3px solid #ffffff;
  border-radius: 50%;
  background: var(--teal);
  color: #ffffff;
  box-shadow: 0 7px 18px rgba(20, 32, 38, 0.28);
  font-size: 0.82rem;
  font-weight: 900;
}

.cluster-icon.medium {
  width: 48px;
  height: 48px;
  background: #286f9f;
}

.cluster-icon.large {
  width: 56px;
  height: 56px;
  background: #174a70;
}

.leaflet-popup-content-wrapper {
  border-radius: 8px;
}

.leaflet-popup-content {
  margin: 0;
}

.station-popup .leaflet-popup-content-wrapper {
  overflow: hidden;
  background: rgba(255, 255, 255, 0.97);
  box-shadow: 0 10px 28px rgba(31, 45, 48, 0.18);
}

.leaflet-container .station-popup a.leaflet-popup-close-button {
  top: 10px;
  right: 10px;
  z-index: 5;
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.94);
  color: #304047;
  font-size: 24px;
  line-height: 1;
  box-shadow: 0 4px 12px rgba(31, 45, 48, 0.12);
}

.leaflet-container .station-popup a.leaflet-popup-close-button:hover {
  background: #ffffff;
  color: var(--brand-blue);
}

.station-popup .leaflet-popup-content {
  max-height: min(72vh, 620px);
  max-height: min(72vh, 620px, calc(100dvh - var(--popup-top-clearance) - var(--popup-bottom-clearance) - 28px));
  overflow: auto;
}

.popup-detail {
  width: min(390px, calc(100vw - 42px));
  color: var(--text);
}

.popup-detail-header {
  display: grid;
  gap: 9px;
  padding: 15px 15px 12px;
  border-bottom: 1px solid var(--line);
  background: linear-gradient(180deg, rgba(220, 239, 237, 0.65), rgba(255, 255, 255, 0.98));
}

.station-popup .popup-detail-header {
  padding-right: 56px;
}

.popup-detail-header h2 {
  margin: 0;
  font-size: 1.04rem;
  line-height: 1.2;
}

.popup-detail-header p,
.popup-section p {
  margin: 5px 0 0;
  color: var(--muted);
  font-size: 0.82rem;
  line-height: 1.38;
}

.popup-actions {
  align-items: center;
  padding: 12px 15px 10px;
}

.popup-actions .pill-button {
  min-height: 34px;
  padding: 0 9px;
  font-size: 0.78rem;
}

.popup-section {
  display: grid;
  gap: 8px;
  padding: 12px 15px;
  border-top: 1px solid rgba(217, 225, 223, 0.74);
}

.popup-section h3 {
  margin: 0;
  color: #3a4b51;
  font-size: 0.72rem;
  text-transform: uppercase;
}

.connector-table,
.info-table {
  width: 100%;
  border-collapse: collapse;
  table-layout: fixed;
  font-size: 0.82rem;
}

.connector-table th,
.connector-table td,
.info-table th,
.info-table td {
  padding: 7px 0;
  border-top: 1px solid rgba(217, 225, 223, 0.72);
  vertical-align: top;
}

.connector-table tr:first-child th,
.connector-table tr:first-child td,
.info-table tr:first-child th,
.info-table tr:first-child td {
  border-top: 0;
}

.connector-table th,
.info-table th {
  width: 38%;
  padding-right: 10px;
  color: #4b5d64;
  font-weight: 800;
  text-align: left;
}

.connector-table td,
.info-table td {
  color: #23333a;
  overflow-wrap: anywhere;
}

.connector-state {
  display: inline-flex;
  align-items: center;
  min-height: 23px;
  padding: 0 8px;
  border-radius: 999px;
  background: var(--mint);
  color: var(--teal-dark);
  font-weight: 800;
}

.connector-state.unknown {
  background: #eef1f1;
  color: var(--muted);
}

.popup-links {
  max-height: 140px;
  overflow: auto;
}

.popup-preview {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 10px;
  width: 100%;
  min-width: 220px;
  max-width: 320px;
  padding: 13px;
  border: 0;
  background: transparent;
  color: inherit;
  text-align: left;
  cursor: pointer;
}

.popup-preview:hover {
  background: rgba(220, 239, 237, 0.66);
}

.popup-text {
  display: grid;
  gap: 7px;
  min-width: 0;
}

.popup-title {
  font-size: 0.95rem;
  line-height: 1.25;
}

.popup-meta {
  color: var(--muted);
  font-size: 0.82rem;
  line-height: 1.35;
}

.popup-open {
  display: grid;
  place-items: center;
  width: 30px;
  height: 30px;
  border: 1px solid var(--line);
  border-radius: 50%;
  color: var(--teal-dark);
}

.popup-open svg {
  width: 16px;
  height: 16px;
}

.install-prompt {
  position: fixed;
  left: 50%;
  bottom: 20px;
  z-index: 1200;
  display: grid;
  grid-template-columns: 52px minmax(0, 1fr) auto 36px;
  align-items: center;
  gap: 12px;
  width: min(560px, calc(100% - 32px));
  padding: 12px;
  border: 1px solid rgba(11, 79, 162, 0.22);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.98);
  box-shadow: 0 18px 42px rgba(14, 37, 66, 0.24);
  opacity: 0;
  pointer-events: none;
  transform: translate(-50%, 18px);
  transition: opacity 180ms ease, transform 180ms ease;
}

.install-prompt[hidden],
.install-button[hidden] {
  display: none;
}

.install-prompt.is-visible {
  opacity: 1;
  pointer-events: auto;
  transform: translate(-50%, 0);
}

.install-prompt > img {
  width: 52px;
  height: 52px;
  border-radius: 10px;
}

.install-copy {
  min-width: 0;
}

.install-copy strong {
  display: block;
  color: #10263f;
  font-size: 0.94rem;
  line-height: 1.2;
}

.install-copy p {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 0.78rem;
  line-height: 1.35;
}

.install-button,
.install-close {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 38px;
  border: 0;
  border-radius: 8px;
  cursor: pointer;
}

.install-button {
  gap: 7px;
  padding: 0 12px;
  background: var(--brand-blue);
  color: #ffffff;
  font-size: 0.82rem;
  font-weight: 800;
}

.install-close {
  width: 36px;
  padding: 0;
  background: transparent;
  color: var(--muted);
}

.install-button svg,
.install-close svg {
  width: 18px;
  height: 18px;
}

@media (max-width: 980px) {
  body {
    overflow: hidden;
  }

  .bike-app {
    display: block;
  }

  .sidebar {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    width: 100vw;
    max-width: none;
    height: min(84vh, 720px);
    height: min(84dvh, 720px);
    padding-bottom: env(safe-area-inset-bottom);
    border-top: 1px solid var(--line);
    border-right: 0;
    border-radius: 24px 24px 0 0;
    box-shadow: 0 -20px 45px rgba(31, 45, 48, 0.22);
    overflow-y: hidden;
    overscroll-behavior: none;
    touch-action: none;
    transform: translateY(calc(100% - var(--sheet-peek) - env(safe-area-inset-bottom)));
    transition: transform 180ms ease;
  }

  body.sheet-open .sidebar {
    overflow-y: auto;
    overscroll-behavior: contain;
    touch-action: pan-y;
    transform: translateY(0);
  }

  .drawer-handle {
    display: grid;
    place-items: center;
    flex: 0 0 24px;
    position: sticky;
    top: 0;
    z-index: 3;
    width: 100%;
    border: 0;
    border-radius: 24px 24px 0 0;
    background: #ffffff;
    cursor: pointer;
    touch-action: none;
  }

  .drawer-handle span {
    width: 46px;
    height: 5px;
    border-radius: 999px;
    background: #c8d2d0;
  }

  .app-header {
    align-items: center;
    gap: 10px;
    flex: 0 0 auto;
    min-height: 72px;
    padding: 8px 16px 12px;
    cursor: pointer;
  }

  h1 {
    max-width: none;
    font-size: 1.06rem;
  }

  .app-logo {
    width: 38px;
    height: 38px;
    border-radius: 10px;
  }

  .total-counter {
    min-width: 64px;
  }

  .total-counter strong {
    font-size: 1.32rem;
  }

  .controls {
    padding: 12px 14px;
  }

  .sidebar-content {
    flex: 0 0 auto;
    overflow: visible;
  }

  .source-options {
    max-height: none;
    overflow: visible;
  }

  .station-list {
    flex: 0 0 auto;
    min-height: auto;
    overflow: visible;
  }

  .map-shell {
    height: 100vh;
    height: 100dvh;
  }

  .leaflet-control-zoom {
    margin-bottom: calc(var(--sheet-peek) + 36px + env(safe-area-inset-bottom));
  }

  .map-toolbar {
    top: max(12px, env(safe-area-inset-top));
    right: 12px;
  }

  .navigation-panel {
    top: calc(max(12px, env(safe-area-inset-top)) + 52px);
    left: 12px;
    right: 12px;
    width: auto;
    transform: none;
  }

  .desktop-list-toggle {
    display: none;
  }

  .legend-panel {
    left: 12px;
    top: max(12px, env(safe-area-inset-top));
    bottom: auto;
  }

  body.sheet-open .legend-panel {
    display: none;
  }

  body.sheet-open .navigation-panel {
    display: none;
  }

  .leaflet-control-attribution {
    max-width: calc(100vw - 24px);
    margin-bottom: calc(var(--sheet-peek) + 4px + env(safe-area-inset-bottom)) !important;
    flex-wrap: wrap;
    justify-content: flex-end;
  }

  .detail-panel {
    left: 12px;
    right: 12px;
    bottom: 106px;
    width: auto;
    max-height: 46vh;
  }

  body.sheet-open .detail-panel {
    display: none;
  }

  .location-status {
    bottom: calc(var(--sheet-peek) + 34px + env(safe-area-inset-bottom));
    max-width: calc(100% - 88px);
  }

  body.sheet-open .location-status {
    display: none;
  }

  .install-prompt {
    left: 12px;
    right: 12px;
    bottom: calc(var(--sheet-peek) + 12px + env(safe-area-inset-bottom));
    grid-template-columns: 48px minmax(0, 1fr) auto 36px;
    width: auto;
    transform: translateY(18px);
  }

  .install-prompt.is-visible {
    transform: translateY(0);
  }

  .install-prompt > img {
    width: 48px;
    height: 48px;
  }

  body.sheet-open .install-prompt {
    display: none;
  }

  .station-popup .leaflet-popup-content {
    max-height: min(64vh, 520px);
    max-height: min(64vh, 520px, calc(100dvh - var(--popup-top-clearance) - var(--popup-bottom-clearance) - 28px));
  }

  .popup-detail {
    width: min(340px, calc(100vw - 34px));
  }

  .popup-detail-header,
  .popup-section {
    padding-left: 13px;
    padding-right: 13px;
  }
}

@media (max-width: 520px) {
  .control-grid {
    grid-template-columns: 1fr;
  }

  .source-options {
    grid-template-columns: 1fr;
  }

  .stats {
    grid-template-columns: 1fr 1fr 1fr;
  }

  .stats div {
    padding: 10px 8px;
  }

  .stats span {
    font-size: 0.68rem;
  }

  .install-prompt {
    grid-template-columns: 44px minmax(0, 1fr) 36px;
    gap: 10px;
    padding: 10px;
  }

  .install-prompt > img {
    width: 44px;
    height: 44px;
  }

  .install-close {
    grid-column: 3;
    grid-row: 1;
  }

  .install-button {
    grid-column: 2 / 4;
    width: 100%;
  }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    transition: none !important;
    scroll-behavior: auto !important;
  }
}
