:root {
  --bg: #F8F9FB;
  --card: #FFFFFF;
  --text: #101828;
  --muted: #667085;
  --line: #EAECF0;
  --line-strong: #D0D5DD;
  --soft: #F2F4F7;
  --lime: #22C55E;
  --dott: #3B82F6;
  --voi: #FF6B57;
  --alert: #EF4444;
  --success: #10B981;
  --shadow-sm: 0 8px 24px rgba(16, 24, 40, 0.08);
  --shadow-md: 0 18px 48px rgba(16, 24, 40, 0.14);
  --blur-bg: rgba(255, 255, 255, 0.78);
  --ease: 180ms ease;
}

* {
  box-sizing: border-box;
}

html,
body {
  height: 100%;
  margin: 0;
  font-family: Inter, -apple-system, BlinkMacSystemFont, "Segoe UI", ui-sans-serif, system-ui, sans-serif;
  color: var(--text);
  background: var(--bg);
}

body {
  overflow: hidden;
}

button,
input,
select {
  font: inherit;
}

button {
  border: 0;
}

button,
label,
summary {
  -webkit-tap-highlight-color: transparent;
}

button:not(:disabled),
summary {
  cursor: pointer;
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.5;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

#app {
  position: relative;
  width: 100%;
  height: 100%;
  overflow: hidden;
}

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

#map.freehand-zone-drawing {
  cursor: crosshair;
  touch-action: none;
}

.address-search-panel {
  position: absolute;
  z-index: 670;
  top: 16px;
  left: 50%;
  width: clamp(280px, calc(100vw - 360px), 420px);
  display: grid;
  gap: 8px;
  transform: translateX(-50%);
}

.address-search-row {
  display: flex;
  gap: 8px;
  align-items: flex-start;
}

.address-search-row .address-search-form {
  flex: 1;
  min-width: 0;
}

.address-filter-btn {
  flex-shrink: 0;
  width: 48px;
  height: 48px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid rgba(255, 255, 255, 0.74);
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.9);
  box-shadow: var(--shadow-md);
  backdrop-filter: blur(22px) saturate(1.18);
  -webkit-backdrop-filter: blur(22px) saturate(1.18);
  color: var(--text);
  transition: transform var(--ease), background var(--ease), color var(--ease);
}

.address-filter-btn:hover {
  transform: translateY(-1px);
}

.address-filter-btn.filters-active {
  background: #101828;
  color: #fff;
  border-color: transparent;
}

.address-search-form {
  position: relative;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  min-height: 48px;
  padding: 0 8px 0 14px;
  border: 1px solid rgba(255, 255, 255, 0.74);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.9);
  box-shadow: var(--shadow-md);
  backdrop-filter: blur(22px) saturate(1.18);
  -webkit-backdrop-filter: blur(22px) saturate(1.18);
}

.address-search-icon {
  display: inline-grid;
  place-items: center;
  width: 24px;
  height: 24px;
  color: var(--muted);
  font-size: 18px;
  line-height: 1;
}

.address-search-form input {
  min-width: 0;
  min-height: 46px;
  border: 0;
  outline: none;
  background: transparent;
  color: var(--text);
  padding: 0 8px;
  font-size: 14px;
}

.address-search-form input::placeholder {
  color: #98A2B3;
}

.address-search-clear {
  width: 32px;
  height: 32px;
  display: inline-grid;
  place-items: center;
  border-radius: 50%;
  background: rgba(242, 244, 247, 0.92);
  color: var(--muted);
  font-size: 18px;
  line-height: 1;
}

.address-search-results,
.address-zone-proposal {
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.74);
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.94);
  box-shadow: var(--shadow-md);
  backdrop-filter: blur(22px) saturate(1.18);
  -webkit-backdrop-filter: blur(22px) saturate(1.18);
}

.address-search-results[hidden],
.address-zone-proposal[hidden] {
  display: none;
}

.address-result-button {
  width: 100%;
  min-width: 0;
  display: grid;
  gap: 3px;
  padding: 11px 14px;
  border-bottom: 1px solid rgba(234, 236, 240, 0.92);
  background: transparent;
  color: var(--text);
  text-align: left;
}

.address-result-button:last-child {
  border-bottom: 0;
}

.address-result-button:hover,
.address-result-button:focus-visible,
.address-result-button[aria-selected="true"] {
  background: rgba(242, 244, 247, 0.82);
  outline: none;
}

.address-result-button strong,
.address-result-button span {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.address-result-button strong {
  font-size: 13px;
  font-weight: 700;
}

.address-result-button span {
  color: var(--muted);
  font-size: 11px;
}

.address-search-message {
  padding: 12px 14px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.35;
}

.address-zone-proposal {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  align-items: center;
  gap: 11px;
  padding: 12px 14px;
}

.address-zone-proposal div {
  min-width: 0;
  display: grid;
  gap: 3px;
}

.address-zone-proposal span,
.address-zone-proposal strong {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.address-zone-proposal span {
  color: var(--muted);
  font-size: 11px;
}

.address-zone-proposal strong {
  color: var(--text);
  font-size: 13px;
  font-weight: 700;
}

.address-zone-actions {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 6px;
}

.address-zone-create,
.address-zone-secondary {
  min-height: 34px;
  min-width: 0;
  padding: 0 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 700;
  white-space: nowrap;
}

.address-zone-create {
  background: #101828;
  color: #fff;
}

.address-zone-secondary {
  background: var(--soft);
  color: var(--text);
}

.address-zone-create:hover,
.address-zone-create:focus-visible,
.address-zone-secondary:hover,
.address-zone-secondary:focus-visible {
  transform: translateY(-1px);
  outline: none;
}

.address-marker-icon {
  position: relative;
  width: 28px !important;
  height: 28px !important;
  margin-left: -14px !important;
  margin-top: -14px !important;
  border: 3px solid #fff;
  border-radius: 50%;
  background: #101828;
  box-shadow: 0 10px 24px rgba(16, 24, 40, 0.28);
}

.address-marker-icon::after {
  content: "";
  position: absolute;
  left: 50%;
  bottom: -7px;
  width: 10px;
  height: 10px;
  border-right: 3px solid #fff;
  border-bottom: 3px solid #fff;
  background: #101828;
  transform: translateX(-50%) rotate(45deg);
}

.address-radius-preview {
  stroke-dasharray: 7 7;
}

.floating-panel {
  position: absolute;
  z-index: 650;
  top: 16px;
  left: 16px;
  width: min(300px, calc(100vw - 32px));
  display: grid;
  grid-template-rows: auto auto auto auto auto auto;
  gap: 12px;
  max-height: calc(100vh - 32px);
  padding: 14px;
  border: 1px solid rgba(255, 255, 255, 0.74);
  border-radius: 24px;
  background: var(--blur-bg);
  box-shadow: var(--shadow-md);
  backdrop-filter: blur(26px) saturate(1.25);
  -webkit-backdrop-filter: blur(26px) saturate(1.25);
  animation: panel-enter 260ms ease both;
}

.floating-panel.panel-has-bike-list {
  grid-template-rows: auto auto auto minmax(112px, 1fr) auto auto;
  height: calc(100vh - 32px);
}

@keyframes panel-enter {
  from {
    opacity: 0;
    transform: translateY(8px) scale(0.985);
  }

  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

.panel-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
}

.panel-header h1 {
  margin: 0;
  color: var(--text);
  font-size: 19px;
  line-height: 1.14;
  font-weight: 600;
  letter-spacing: 0;
}

.panel-header p {
  margin: 6px 0 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.35;
  font-weight: 400;
}

/* ── Contextual panel (bike / cluster tapped on mobile) ── */
.panel-context[hidden] {
  display: none;
}

.panel-context-header {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 4px;
}

.panel-context-close {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  height: 28px;
  padding: 0 11px;
  border-radius: 999px;
  background: var(--soft);
  color: var(--muted);
  font-size: 12px;
  font-weight: 600;
  transition: background var(--ease), color var(--ease);
  flex-shrink: 0;
}

.panel-context-close:hover {
  background: var(--line);
  color: var(--text);
}

/* panelTimelineHost: hidden by default, shown only in timeline mode */
#panelTimelineHost {
  display: none;
}

/* Flatten popup cards when shown inside the panel */
.panel-context .bike-popup-card,
.panel-context .cluster-popup-card {
  min-width: 0;
  padding: 0;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
}

.live-status-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 24px;
  padding: 5px 9px;
  border-radius: 999px;
  background: rgba(16, 185, 129, 0.1);
  color: #047857;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0;
  white-space: nowrap;
}

.live-status-badge::before {
  content: "";
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: currentColor;
  box-shadow: 0 0 0 4px rgba(16, 185, 129, 0.12);
}

.live-status-badge[data-state="offline"],
.live-status-badge[data-state="reconnecting"] {
  color: #B42318;
  background: rgba(239, 68, 68, 0.1);
}

.live-status-badge[data-state="loading"],
.live-status-badge[data-state="snapshot"],
.live-status-badge[data-state="draw"] {
  color: #1D4ED8;
  background: rgba(59, 130, 246, 0.1);
}

.hero-metric {
  display: grid;
  gap: 3px;
  min-height: 58px;
}

.hero-metric span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 500;
}

.hero-metric strong {
  color: var(--text);
  font-size: 36px;
  line-height: 1;
  font-weight: 600;
  letter-spacing: 0;
  font-variant-numeric: tabular-nums;
}

.provider-chips {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 6px;
}

.provider-chip {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-width: 0;
  min-height: 32px;
  padding: 5px 8px;
  border: 1px solid transparent;
  border-radius: 999px;
  background: var(--soft);
  color: var(--muted);
  user-select: none;
  transition: transform var(--ease), background var(--ease), color var(--ease), border-color var(--ease), opacity var(--ease), box-shadow var(--ease);
}

.provider-chip:hover {
  transform: translateY(-1px);
}

.provider-chip input {
  position: absolute;
  inset: 0;
  opacity: 0;
  cursor: pointer;
}

.provider-chip::before {
  display: none;
}

.provider-chip:has(input:checked) {
  color: var(--text);
  border-color: color-mix(in srgb, var(--brand) 24%, white);
  background: color-mix(in srgb, var(--brand) 13%, white);
  box-shadow: 0 7px 16px color-mix(in srgb, var(--brand) 12%, transparent);
}

.provider-chip:has(input:not(:checked)) {
  opacity: 0.54;
  border-color: rgba(148, 163, 184, 0.16);
  background: rgba(243, 244, 246, 0.72);
  color: #64748B;
}

.provider-chip:has(input:not(:checked)) .provider-logo {
  filter: grayscale(1) saturate(0.15);
  opacity: 0.58;
  box-shadow: none;
}

.provider-chip:has(input:not(:checked)):hover {
  opacity: 0.72;
}

.provider-logo,
.provider-chip-count {
  position: relative;
  z-index: 1;
}

.provider-logo {
  width: 23px;
  height: 23px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 3px 9px color-mix(in srgb, var(--brand) 22%, transparent);
  flex: 0 0 auto;
  transition: filter var(--ease), opacity var(--ease), box-shadow var(--ease);
  object-fit: contain;
}

.provider-chip-count {
  min-width: 0;
  font-size: 13px;
  font-weight: 500;
}

.provider-chip-count {
  color: inherit;
  font-variant-numeric: tabular-nums;
}

.battery-filter {
  display: grid;
  gap: 7px;
  padding: 10px 12px;
  border-radius: 16px;
  background: rgba(248, 249, 251, 0.82);
}

.battery-filter-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.battery-filter-header span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 500;
}

.battery-filter-header strong {
  color: var(--text);
  font-size: 13px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

.battery-filter input[type="range"] {
  width: 100%;
  accent-color: #101828;
}

.zone-summary {
  display: grid;
  gap: 10px;
  padding: 11px 12px;
  border-radius: 16px;
  background: rgba(248, 249, 251, 0.82);
}

.zone-summary header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.zone-summary header div {
  display: grid;
  gap: 4px;
  min-width: 0;
}

.zone-summary span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 500;
}

.zone-summary strong {
  color: var(--text);
  font-size: 14px;
  font-weight: 600;
}

.zone-summary.zone-empty strong {
  color: var(--alert);
}

.zone-summary.zone-has-bikes strong {
  color: #047857;
}

.zone-summary.zone-arrival-pulse {
  animation: zone-summary-arrival 900ms ease-in-out 2;
}

.zone-list {
  display: grid;
  gap: 7px;
}

.zone-list-empty {
  padding: 9px 10px;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.7);
  color: var(--muted);
  font-size: 12px;
  line-height: 1.35;
}

.zone-list-row {
  width: 100%;
  min-width: 0;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto;
  align-items: center;
  gap: 6px;
  min-height: 40px;
  padding: 4px;
  border: 1px solid transparent;
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.72);
  color: var(--text);
}

.zone-list-select {
  min-width: 0;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) minmax(38px, 58px) auto;
  align-items: center;
  gap: 9px;
  min-height: 32px;
  padding: 4px 5px;
  border: 0;
  border-radius: 10px;
  background: transparent;
  color: inherit;
  text-align: left;
}

.zone-list-row[data-selected="true"] {
  border-color: color-mix(in srgb, var(--zone-color) 42%, transparent);
  background: color-mix(in srgb, var(--zone-color) 10%, #fff);
}

.zone-list-row[data-enabled="false"] {
  opacity: 0.56;
}

.zone-list-swatch {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--zone-color);
  box-shadow: 0 0 0 4px color-mix(in srgb, var(--zone-color) 14%, transparent);
}

.zone-list-label {
  display: grid;
  gap: 2px;
  min-width: 0;
}

.zone-list-label strong,
.zone-list-label span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.zone-list-label strong {
  color: var(--alert);
  font-size: 12px;
  font-weight: 700;
}

.zone-list-row[data-has-bikes="true"] .zone-list-label strong {
  color: #047857;
}

.zone-list-label span {
  color: var(--muted);
  font-size: 10px;
}

.zone-list-edit {
  min-width: 0;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  align-items: center;
  gap: 9px;
  min-height: 32px;
  padding: 4px 5px;
}

.zone-list-name-input {
  width: 100%;
  min-width: 0;
  height: 28px;
  border: 1px solid color-mix(in srgb, var(--zone-color) 36%, var(--line));
  border-radius: 8px;
  background: #fff;
  color: var(--text);
  font: inherit;
  font-size: 12px;
  font-weight: 700;
  line-height: 1;
  outline: none;
  padding: 0 8px;
}

.zone-list-name-input:focus {
  border-color: var(--zone-color);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--zone-color) 16%, transparent);
}

.zone-list-count {
  color: var(--text);
  font-size: 11px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.zone-mini-history {
  width: 58px;
  height: 20px;
  display: inline-flex;
  align-items: end;
  justify-content: flex-end;
  gap: 2px;
  opacity: 0.88;
}

.zone-mini-history i {
  width: 3px;
  min-height: 2px;
  border-radius: 3px 3px 0 0;
  background: color-mix(in srgb, var(--zone-color) 72%, #ffffff);
}

.zone-mini-history.is-empty i {
  height: 5px;
  background: rgba(152, 162, 179, 0.22);
}

.zone-list-action,
.zone-list-remove {
  width: 22px;
  height: 22px;
  display: inline-grid;
  place-items: center;
  border: 0;
  border-radius: 50%;
  background: transparent;
  color: #98A2B3;
  font-size: 14px;
  line-height: 1;
}

.zone-list-action {
  width: auto;
  min-width: 34px;
  padding: 0 7px;
  border-radius: 999px;
  color: #667085;
  font-size: 10px;
  font-weight: 700;
}

.zone-list-action:hover {
  background: color-mix(in srgb, var(--zone-color) 12%, transparent);
  color: var(--text);
}

.zone-list-remove:hover {
  background: rgba(152, 162, 179, 0.12);
  color: #667085;
}

.zone-history {
  display: grid;
  gap: 6px;
  min-height: 0;
  padding: 10px;
  border-radius: 16px;
  background: rgba(248, 249, 251, 0.82);
  overflow: hidden;
}

.zone-history[hidden] {
  display: none;
}

.zone-history header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.zone-history-view-switch {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 3px;
  flex-shrink: 0;
}

.zone-history-view-switch button {
  min-width: 0;
  min-height: 20px;
  padding: 2px 7px;
  border: 1px solid rgba(148, 163, 184, 0.18);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.64);
  color: var(--muted);
  font-size: 10px;
  font-weight: 500;
  cursor: pointer;
  transition: background 0.15s, color 0.15s, border-color 0.15s;
  white-space: nowrap;
}

.zone-history-view-switch button[aria-pressed="true"] {
  border-color: rgba(16, 24, 40, 0.16);
  background: #101828;
  color: #fff;
}

.zone-history header span {
  min-width: 0;
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--muted);
  font-size: 11px;
  font-weight: 500;
}

.zone-history header strong {
  flex-shrink: 0;
  color: var(--text);
  font-size: 10px;
  font-weight: 600;
  white-space: nowrap;
}

.zone-history-tabs {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 3px;
}

.zone-history-tabs button {
  min-width: 0;
  min-height: 21px;
  padding: 3px 5px;
  border: 1px solid rgba(148, 163, 184, 0.18);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.64);
  color: var(--muted);
  font-size: 10px;
  font-weight: 500;
}

.zone-history-tabs button[aria-pressed="true"] {
  border-color: rgba(16, 24, 40, 0.16);
  background: #101828;
  color: #fff;
}

.zone-history-chart-wrap {
  position: relative;
  min-height: 68px;
}

.zone-history-loader {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 2px;
  z-index: 3;
  border-radius: 1px;
  overflow: hidden;
  background: rgba(16, 24, 40, 0.06);
}

.zone-history-loader::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(90deg, transparent 0%, #101828 50%, transparent 100%);
  background-size: 50% 100%;
  animation: zh-sweep 1.1s ease-in-out infinite;
}

.zone-history-loader[hidden] {
  display: none;
}

@keyframes zh-sweep {
  0%   { transform: translateX(-100%); }
  100% { transform: translateX(300%); }
}

.zone-history canvas {
  display: block;
  width: 100%;
  height: 72px;
  cursor: crosshair;
  touch-action: none;
}

.zone-history-empty {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.3;
  text-align: center;
}

.zone-history-empty::before {
  content: "";
  flex-shrink: 0;
  width: 11px;
  height: 11px;
  border: 1.5px solid rgba(100, 116, 139, 0.25);
  border-top-color: rgba(100, 116, 139, 0.7);
  border-radius: 50%;
  animation: zh-spin 0.75s linear infinite;
}

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

.zone-history-empty[hidden] {
  display: none;
}

.zone-history-tooltip {
  position: absolute;
  z-index: 2;
  display: grid;
  gap: 1px;
  min-width: 82px;
  padding: 6px 8px;
  border: 1px solid rgba(16, 24, 40, 0.08);
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.94);
  box-shadow: 0 10px 22px rgba(16, 24, 40, 0.14);
  pointer-events: none;
  transform: translateY(-2px);
}

.zone-history-tooltip[hidden] {
  display: none;
}

.zone-history-tooltip strong {
  color: var(--text);
  font-size: 11px;
  font-weight: 700;
  line-height: 1.15;
  white-space: nowrap;
}

.zone-history-tooltip span {
  color: var(--muted);
  font-size: 10px;
  line-height: 1.15;
  white-space: nowrap;
}

.zone-history-debug {
  min-height: 12px;
  color: rgba(100, 116, 139, 0.78);
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 10px;
  line-height: 1.3;
  text-align: right;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.zone-history-debug[hidden] {
  display: none;
}

.zone-bike-list {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  gap: 7px;
  height: 100%;
  min-height: 0;
}

.zone-bike-list[hidden] {
  display: none;
}

.zone-bike-list header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 0 1px;
}

.zone-bike-list header span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 500;
}

.zone-bike-list header strong {
  color: var(--text);
  font-size: 12px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

.zone-bike-list-actions {
  display: inline-flex;
  align-items: center;
  gap: 7px;
}

.zone-cycle-controls {
  display: inline-flex;
  align-items: center;
  gap: 3px;
}

.zone-cycle-controls[hidden] {
  display: none;
}

.zone-cycle-btn {
  width: 24px;
  height: 24px;
  display: inline-grid;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.78);
  color: var(--text);
  font-size: 15px;
  line-height: 1;
}

.zone-cycle-btn:hover {
  border-color: rgba(16, 24, 40, 0.18);
  background: #ffffff;
}

.zone-bike-list-body {
  display: grid;
  align-content: start;
  gap: 7px;
  height: 100%;
  min-height: 0;
  overflow: auto;
  padding-right: 2px;
}

.zone-bike-row {
  display: block;
  min-width: 0;
}

.zone-bike-main {
  min-width: 0;
  width: 100%;
  min-height: 38px;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) 70px;
  align-items: center;
  gap: 8px;
  padding: 7px 9px;
  border-radius: 13px;
  background: rgba(255, 255, 255, 0.82);
  color: var(--text);
  box-shadow: var(--shadow-sm);
  text-align: left;
}

.zone-bike-dot {
  display: block;
  width: 10px;
  height: 10px;
  flex: 0 0 auto;
  border-radius: 50%;
  background: var(--brand);
  box-shadow: 0 0 0 4px color-mix(in srgb, var(--brand) 14%, transparent);
}

.zone-bike-main > span:not(.zone-bike-dot):not(.zone-bike-meta) {
  display: grid;
  gap: 2px;
  min-width: 0;
}

.zone-bike-main strong,
.zone-bike-main span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.zone-bike-main strong {
  font-size: 12px;
  font-weight: 700;
}

.zone-bike-main span {
  color: var(--muted);
  font-size: 10px;
}

.zone-bike-meta {
  display: grid;
  justify-items: end;
  gap: 2px;
  min-width: 70px;
}

.zone-bike-meta strong {
  color: var(--text);
  font-size: 12px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

.zone-bike-action {
  color: var(--muted);
  font-size: 10px;
  font-weight: 500;
  line-height: 1.1;
  text-decoration: none;
  white-space: nowrap;
}

.zone-bike-action:hover {
  color: var(--text);
  text-decoration: none;
}

.zone-bike-empty {
  padding: 10px 12px;
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.72);
  color: var(--muted);
  font-size: 12px;
  line-height: 1.35;
}

@keyframes zone-summary-arrival {
  35% {
    background: rgba(16, 185, 129, 0.16);
    box-shadow: 0 0 0 7px rgba(16, 185, 129, 0.12);
    transform: translateY(-1px);
  }
}

.arrival-signal {
  display: grid;
  grid-template-columns: auto 1fr;
  align-items: center;
  gap: 11px;
  min-height: 58px;
  padding: 12px 13px;
  border: 1px solid rgba(16, 185, 129, 0.18);
  border-radius: 18px;
  background: rgba(236, 253, 245, 0.92);
  color: #065f46;
  box-shadow: 0 14px 34px rgba(16, 185, 129, 0.14);
  opacity: 0;
  pointer-events: none;
  transform: translateY(6px) scale(0.985);
}

/* Remove from grid flow when not animating — prevents blank space at bottom of panel */
.arrival-signal:not(.show) {
  display: none;
}

.arrival-signal.show {
  display: grid;
  animation: arrival-signal-enter 420ms ease forwards, arrival-signal-glow 900ms ease-in-out 3 420ms;
}

.arrival-signal.has-rental-link {
  pointer-events: auto;
  cursor: pointer;
}

.arrival-signal-dot {
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: #10B981;
  box-shadow: 0 0 0 7px rgba(16, 185, 129, 0.14);
  animation: arrival-dot-ping 900ms ease-in-out infinite;
}

.arrival-signal div {
  display: grid;
  gap: 3px;
  min-width: 0;
}

.arrival-signal strong {
  font-size: 13px;
  font-weight: 700;
}

.arrival-signal span:not(.arrival-signal-dot) {
  overflow: hidden;
  color: rgba(6, 95, 70, 0.76);
  font-size: 12px;
  line-height: 1.25;
  text-overflow: ellipsis;
  white-space: nowrap;
}

@keyframes arrival-signal-enter {
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

@keyframes arrival-signal-glow {
  50% {
    box-shadow: 0 0 0 6px rgba(16, 185, 129, 0.12), 0 14px 34px rgba(16, 185, 129, 0.16);
  }
}

@keyframes arrival-dot-ping {
  50% {
    transform: scale(0.76);
    box-shadow: 0 0 0 12px rgba(16, 185, 129, 0.04);
  }
}

.warning-stack {
  display: grid;
  gap: 8px;
}

.notice {
  display: none;
  padding: 10px 12px;
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.86);
  color: var(--muted);
  box-shadow: var(--shadow-sm);
  font-size: 12px;
  line-height: 1.35;
}

.notice.show {
  display: block;
}

.notice.urgent-arrival {
  color: #047857;
  background: rgba(16, 185, 129, 0.11);
  animation: urgent-arrival-pop 900ms ease-in-out 4;
}

.notice-action {
  display: inline-flex;
  margin-left: 6px;
  color: #0369A1;
  font-weight: 700;
  text-decoration: none;
  white-space: nowrap;
}

.notice-action:hover {
  text-decoration: underline;
}

@keyframes urgent-arrival-pop {
  50% {
    transform: translateY(-2px);
    box-shadow: 0 0 0 5px rgba(16, 185, 129, 0.12), var(--shadow-sm);
  }
}

.map-floating-actions {
  position: absolute;
  z-index: 660;
  right: 20px;
  bottom: 22px;
  display: flex;
  align-items: center;
  gap: 10px;
}

.pill-action,
.round-action,
.icon-button,
.drawer-primary,
.drawer-secondary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: transform var(--ease), box-shadow var(--ease), background var(--ease), color var(--ease);
}

.pill-action:hover,
.round-action:hover,
.icon-button:hover,
.drawer-primary:hover,
.drawer-secondary:hover {
  transform: translateY(-1px);
}

.pill-action.primary {
  min-height: 48px;
  gap: 9px;
  padding: 0 18px;
  border-radius: 999px;
  background: #101828;
  color: #fff;
  box-shadow: var(--shadow-md);
  font-size: 14px;
  font-weight: 600;
}

.pill-action.timeline {
  min-height: 44px;
  padding: 0 16px;
  border: 1px solid rgba(255, 255, 255, 0.74);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.84);
  color: var(--text);
  box-shadow: var(--shadow-sm);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
  font-size: 13px;
  font-weight: 700;
}

.pill-action.timeline[aria-pressed="true"] {
  background: #101828;
  color: #fff;
  box-shadow: var(--shadow-md);
}

.pill-action.primary span {
  font-size: 19px;
  line-height: 1;
}

.round-action,
.icon-button {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  color: var(--text);
  background: rgba(255, 255, 255, 0.86);
  box-shadow: var(--shadow-sm);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
  font-size: 17px;
  font-weight: 500;
}

.icon-button {
  width: 36px;
  height: 36px;
  box-shadow: none;
}

.icon-button.subtle {
  color: var(--muted);
  background: rgba(255, 255, 255, 0.72);
}

.timeline-panel {
  position: absolute;
  z-index: 665;
  left: 50%;
  bottom: 86px;
  width: min(560px, calc(100vw - 40px));
  display: grid;
  gap: 12px;
  padding: 16px;
  border: 1px solid rgba(255, 255, 255, 0.74);
  border-radius: 18px;
  background: var(--blur-bg);
  box-shadow: var(--shadow-md);
  backdrop-filter: blur(26px) saturate(1.25);
  -webkit-backdrop-filter: blur(26px) saturate(1.25);
  transform: translateX(-50%);
}

.timeline-panel[hidden] {
  display: none;
}

.timeline-panel header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
}

.timeline-panel strong {
  color: var(--text);
  font-size: 16px;
  font-weight: 700;
}

.timeline-track-wrapper {
  position: relative;
}

.timeline-track-bg {
  position: absolute;
  left: 0;
  right: 0;
  top: 10px;
  height: 8px;
  border-radius: 6px;
  pointer-events: none;
  background: var(--line);
  overflow: hidden;
}

.timeline-track-wrapper input[type="range"] {
  position: relative;
  z-index: 1;
  width: 100%;
  height: 28px;
  margin: 0;
  padding: 0;
  -webkit-appearance: none;
  appearance: none;
  background: transparent;
  cursor: pointer;
}

.timeline-track-wrapper input[type="range"]:focus {
  outline: none;
}

.timeline-track-wrapper input[type="range"]::-webkit-slider-runnable-track {
  height: 8px;
  background: transparent;
  border-radius: 6px;
}

.timeline-track-wrapper input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 4px;
  height: 28px;
  background: #fff;
  border-radius: 3px;
  box-shadow: 0 0 0 2px rgba(16, 24, 40, 0.55), 0 2px 8px rgba(0, 0, 0, 0.28);
  margin-top: -10px;
  cursor: grab;
}

.timeline-track-wrapper input[type="range"]::-moz-range-track {
  height: 8px;
  background: transparent;
  border-radius: 6px;
  border: none;
}

.timeline-track-wrapper input[type="range"]::-moz-range-thumb {
  width: 4px;
  height: 28px;
  background: #fff;
  border-radius: 3px;
  box-shadow: 0 0 0 2px rgba(16, 24, 40, 0.55), 0 2px 8px rgba(0, 0, 0, 0.28);
  border: none;
  cursor: grab;
}

.timeline-markers {
  position: relative;
  height: 20px;
  margin-top: 2px;
}

.timeline-marker {
  position: absolute;
  transform: translateX(-50%);
  font-size: 10px;
  line-height: 1;
  color: var(--muted);
  font-weight: 500;
  white-space: nowrap;
  pointer-events: none;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
}

.timeline-marker::before {
  content: '';
  width: 1px;
  height: 4px;
  background: var(--line-strong);
  display: block;
}

.timeline-marker-now {
  font-weight: 600;
  color: var(--text);
}

.timeline-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
}

.timeline-meta strong {
  font-size: 12px;
  font-variant-numeric: tabular-nums;
}

.timeline-analysis {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.timeline-play-btn {
  min-height: 30px;
  padding: 5px 14px;
  border: 0;
  border-radius: 999px;
  background: #101828;
  color: #fff;
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
  transition: transform 0.15s, background 0.15s;
}

.timeline-play-btn:hover {
  transform: translateY(-1px);
}

.timeline-play-btn[aria-pressed="true"] {
  background: #2563EB;
}

.timeline-nudge {
  display: flex;
  gap: 3px;
  flex-shrink: 0;
}

.timeline-nudge-btn {
  min-height: 20px;
  padding: 2px 6px;
  border: 1px solid rgba(148, 163, 184, 0.22);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.6);
  color: var(--muted);
  font-size: 10px;
  font-weight: 500;
  white-space: nowrap;
  cursor: pointer;
  transition: background 0.12s, color 0.12s, border-color 0.12s;
}

.timeline-nudge-btn:hover:not(:disabled) {
  background: rgba(16, 24, 40, 0.08);
  color: var(--text);
  border-color: rgba(16, 24, 40, 0.18);
}

.timeline-nudge-btn:active:not(:disabled) {
  background: #101828;
  color: #fff;
  border-color: #101828;
}

.timeline-nudge-btn:disabled {
  opacity: 0.35;
}

.timeline-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
}

.timeline-mode-switch {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 4px;
  flex-shrink: 0;
}

.timeline-mode-btn {
  min-width: 0;
  min-height: 24px;
  padding: 4px 10px;
  border: 1px solid rgba(148, 163, 184, 0.18);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.64);
  color: var(--muted);
  font-size: 10px;
  font-weight: 500;
  cursor: pointer;
  transition: background 0.15s, color 0.15s, border-color 0.15s;
  line-height: 1.4;
  white-space: nowrap;
}

.timeline-mode-btn[aria-pressed="true"] {
  border-color: rgba(16, 24, 40, 0.16);
  background: #101828;
  color: #fff;
}

.timeline-mode-btn:hover:not([aria-pressed="true"]) {
  color: var(--text);
}

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

.timeline-legend[hidden] {
  display: none;
}

.timeline-provider-chip {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 4px 10px 4px 7px;
  border: 1px solid rgba(148, 163, 184, 0.18);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.64);
  color: var(--muted);
  font-size: 10px;
  font-weight: 500;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s, color 0.15s, opacity 0.15s, box-shadow 0.15s;
  line-height: 1.4;
}

.timeline-provider-chip[aria-pressed="true"] {
  border-color: color-mix(in srgb, var(--brand) 24%, white);
  background: color-mix(in srgb, var(--brand) 13%, white);
  box-shadow: 0 4px 10px color-mix(in srgb, var(--brand) 12%, transparent);
  color: var(--text);
}

.timeline-provider-chip[aria-pressed="false"] {
  opacity: 0.45;
}

.timeline-legend-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
}

.timeline-heatmap-layer {
  mix-blend-mode: multiply;
}

.drawer-backdrop {
  position: absolute;
  z-index: 700;
  inset: 0;
  background: rgba(16, 24, 40, 0.2);
  opacity: 0;
  transition: opacity 220ms ease;
}

.drawer-backdrop.show {
  opacity: 1;
}

.drawer {
  position: absolute;
  z-index: 710;
  top: 20px;
  right: 20px;
  width: min(380px, calc(100vw - 40px));
  max-height: calc(100vh - 40px);
  display: grid;
  grid-template-rows: auto 1fr;
  border: 1px solid rgba(255, 255, 255, 0.72);
  border-radius: 24px;
  background: rgba(255, 255, 255, 0.92);
  box-shadow: var(--shadow-md);
  backdrop-filter: blur(28px) saturate(1.22);
  -webkit-backdrop-filter: blur(28px) saturate(1.22);
  overflow: hidden;
  opacity: 0;
  pointer-events: none;
  transform: translateX(24px) scale(0.98);
  transition: opacity 220ms ease, transform 220ms ease;
}

.drawer.open {
  opacity: 1;
  pointer-events: auto;
  transform: translateX(0) scale(1);
}

.drawer-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  padding: 22px 22px 14px;
}

.drawer-header span {
  display: block;
  margin-bottom: 5px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 500;
}

.drawer-header h2 {
  margin: 0;
  color: var(--text);
  font-size: 22px;
  line-height: 1.12;
  font-weight: 600;
  letter-spacing: 0;
}

.drawer-body {
  display: grid;
  gap: 14px;
  padding: 0 22px 22px;
  overflow: auto;
}

.drawer-copy {
  margin: 0;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.45;
}

.field-card,
.setting-row {
  display: grid;
  gap: 8px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: #fff;
}

.setting-row {
  grid-template-columns: 1fr auto;
  align-items: center;
  gap: 14px;
}

.setting-row div,
.field-card {
  min-width: 0;
}

.field-card span,
.setting-row span {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.35;
  font-weight: 400;
}

.setting-row strong {
  display: block;
  margin-bottom: 3px;
  color: var(--text);
  font-size: 14px;
  font-weight: 600;
}

.field-row {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--muted);
  font-size: 13px;
}

.text-input,
.select-input {
  width: 100%;
  min-height: 42px;
  border: 1px solid var(--line);
  border-radius: 14px;
  outline: none;
  background: var(--bg);
  color: var(--text);
  padding: 10px 12px;
  transition: border-color var(--ease), box-shadow var(--ease);
}

.text-input:focus,
.select-input:focus {
  border-color: #3B82F6;
  box-shadow: 0 0 0 4px rgba(59, 130, 246, 0.12);
}

.drawer-primary,
.drawer-secondary {
  min-height: 48px;
  width: 100%;
  border-radius: 999px;
  font-size: 14px;
  font-weight: 600;
}

.drawer-primary {
  color: #fff;
  background: #101828;
}

.drawer-secondary {
  color: var(--text);
  background: var(--soft);
}

.switch {
  position: relative;
  width: 48px;
  height: 30px;
  flex: 0 0 auto;
}

.switch input {
  width: 0;
  height: 0;
  opacity: 0;
}

.slider {
  position: absolute;
  inset: 0;
  border-radius: 999px;
  background: #D0D5DD;
  transition: background var(--ease);
}

.slider::before {
  content: "";
  position: absolute;
  top: 3px;
  left: 3px;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 2px 8px rgba(16, 24, 40, 0.18);
  transition: transform var(--ease);
}

.switch input:checked + .slider {
  background: #101828;
}

.switch input:checked + .slider::before {
  transform: translateX(18px);
}

.debug {
  border-radius: 18px;
  background: #fff;
  border: 1px solid var(--line);
  overflow: hidden;
}

.debug summary {
  list-style: none;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px;
  color: var(--text);
  font-size: 14px;
  font-weight: 500;
}

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

.debug-body {
  max-height: 260px;
  overflow: auto;
  padding: 0 14px 14px;
}

.debug-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12px;
}

.debug-table th,
.debug-table td {
  padding: 8px 0;
  border-top: 1px solid var(--line);
  text-align: left;
  vertical-align: top;
}

.debug-table th {
  width: 100px;
  color: var(--muted);
  font-weight: 500;
}

.debug-url {
  word-break: break-all;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}

.draggable-zone {
  cursor: grab;
}

.zone-hit-area {
  cursor: grab;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.draggable-zone.zone-dragging,
.draggable-zone.zone-resizing,
.zone-hit-area.zone-dragging {
  cursor: grabbing;
}

.draggable-zone.zone-arrival-blink {
  animation: zone-arrival-pulse 0.45s ease-in-out 4;
  filter: drop-shadow(0 0 12px rgba(16, 185, 129, 0.5));
}

.zone-edit-frame {
  pointer-events: none;
  filter: drop-shadow(0 1px 2px rgba(16, 24, 40, 0.14));
}

.zone-resize-handle {
  width: 16px !important;
  height: 16px !important;
  display: grid !important;
  place-items: center;
}

.zone-resize-handle span {
  width: 10px;
  height: 10px;
  display: block;
  box-sizing: border-box;
  border: 2px solid #1473E6;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 2px 7px rgba(16, 24, 40, 0.2);
  transition: transform 0.12s ease, box-shadow 0.12s ease;
}

.zone-resize-handle:hover span {
  box-shadow: 0 4px 12px rgba(16, 24, 40, 0.26);
  transform: scale(1.16);
}

.zone-resize-handle-nw,
.zone-resize-handle-se {
  cursor: nwse-resize;
}

.zone-resize-handle-ne,
.zone-resize-handle-sw {
  cursor: nesw-resize;
}

.zone-reference-icon {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 34px !important;
  height: 34px !important;
  margin-left: -17px !important;
  margin-top: -17px !important;
  border: 3px solid #fff;
  border-radius: 50%;
  background: #263044;
  box-shadow: 0 10px 24px rgba(16, 24, 40, 0.26);
}

.zone-reference-icon svg {
  width: 23px;
  height: 23px;
  overflow: visible;
  fill: none;
  stroke: #fff;
  stroke-width: 3;
  stroke-linecap: round;
  stroke-linejoin: round;
}

@keyframes zone-arrival-pulse {
  0%,
  100% {
    stroke-width: 2;
  }

  50% {
    stroke-width: 8;
    fill-opacity: 0.36;
  }
}

.leaflet-control-zoom {
  border: 0 !important;
  border-radius: 16px !important;
  box-shadow: var(--shadow-sm) !important;
  overflow: hidden;
}

.leaflet-control-zoom a {
  border: 0 !important;
  color: var(--text) !important;
  background: rgba(255, 255, 255, 0.9) !important;
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
}

.leaflet-control-attribution {
  color: var(--muted);
  font-size: 10px;
}

.leaflet-popup-content-wrapper,
.leaflet-popup-tip {
  background: transparent;
  box-shadow: none;
}

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

.leaflet-container a.leaflet-popup-close-button {
  top: 10px;
  right: 10px;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  color: var(--muted);
  background: rgba(242, 244, 247, 0.92);
  line-height: 24px;
}

.bike-popup-card {
  min-width: 230px;
  display: grid;
  gap: 14px;
  padding: 18px;
  border-radius: 24px;
  background: rgba(255, 255, 255, 0.96);
  box-shadow: var(--shadow-md);
  color: var(--text);
}

.bike-popup-card header {
  display: flex;
  align-items: center;
  gap: 11px;
}

.bike-popup-card header .popup-rental-action {
  margin-left: auto;
  flex-shrink: 0;
  min-height: 34px;
  padding: 0 12px;
  font-size: 12px;
}

.popup-brand-dot {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: var(--brand);
  box-shadow: 0 0 0 5px color-mix(in srgb, var(--brand) 14%, transparent);
}

.bike-popup-card h3 {
  margin: 0;
  font-size: 16px;
  line-height: 1.2;
  font-weight: 600;
}

.bike-popup-card p {
  margin: 3px 0 0;
  color: var(--muted);
  font-size: 12px;
}

.popup-detail-grid {
  display: grid;
  gap: 8px;
}

.popup-detail-grid > div {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  color: var(--muted);
  font-size: 13px;
}

.popup-detail-grid strong {
  color: var(--text);
  font-weight: 500;
}

.confidence-card {
  display: grid;
  gap: 8px;
  padding: 10px;
  border: 1px solid color-mix(in srgb, var(--confidence-color) 24%, rgba(16, 24, 40, 0.1));
  border-radius: 14px;
  background: color-mix(in srgb, var(--confidence-color) 7%, #ffffff);
}

.confidence-summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.confidence-summary span,
.confidence-details p,
.confidence-reasons {
  color: var(--muted);
  font-size: 11px;
  line-height: 1.35;
}

.confidence-summary strong {
  display: block;
  margin-top: 2px;
  color: var(--text);
  font-size: 18px;
  line-height: 1;
}

.confidence-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 64px;
  min-height: 24px;
  padding: 0 9px;
  border-radius: 999px;
  color: #fff;
  font-size: 11px;
  font-weight: 700;
}

.confidence-summary .confidence-badge {
  color: #fff;
}

.confidence-badge[data-tone="fresh"] {
  background: #10B981;
}

.confidence-badge[data-tone="reliable"] {
  background: #2563EB;
}

.confidence-badge[data-tone="maybe"] {
  background: #F59E0B;
}

.confidence-badge[data-tone="risky"] {
  background: #EF4444;
}

.confidence-details {
  display: grid;
  gap: 7px;
}

.confidence-details summary {
  width: fit-content;
  color: var(--text);
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
}

.confidence-details p {
  margin: 0;
}

.confidence-breakdown {
  display: grid;
  gap: 5px;
}

.confidence-breakdown div {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  color: var(--muted);
  font-size: 11px;
}

.confidence-breakdown strong {
  color: var(--text);
  font-weight: 600;
}

.confidence-reasons {
  margin: 0;
  padding-left: 16px;
}

.popup-rental-action {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 40px;
  padding: 0 14px;
  border-radius: 999px;
  background: var(--brand);
  color: #fff !important;
  font-size: 13px;
  font-weight: 700;
  text-decoration: none;
  box-shadow: 0 10px 22px color-mix(in srgb, var(--brand) 22%, transparent);
  transition: transform var(--ease), box-shadow var(--ease);
}

.popup-rental-action:hover {
  transform: translateY(-1px);
  box-shadow: 0 13px 28px color-mix(in srgb, var(--brand) 28%, transparent);
}

.popup-history-action {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 38px;
  border: 1px solid color-mix(in srgb, var(--brand) 24%, rgba(16, 24, 40, 0.12));
  border-radius: 999px;
  background: color-mix(in srgb, var(--brand) 9%, #ffffff);
  color: var(--text);
  font: inherit;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  transition: transform var(--ease), border-color var(--ease), background var(--ease);
}

.popup-history-action:hover {
  transform: translateY(-1px);
  border-color: color-mix(in srgb, var(--brand) 42%, rgba(16, 24, 40, 0.12));
  background: color-mix(in srgb, var(--brand) 14%, #ffffff);
}

.vehicle-history-panel {
  position: fixed;
  z-index: 820;
  left: 50%;
  bottom: 28px;
  width: min(440px, calc(100vw - 32px));
  transform: translateX(-50%);
  border: 1px solid rgba(16, 24, 40, 0.1);
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.94);
  box-shadow: var(--shadow-md);
  backdrop-filter: blur(18px);
  overflow: hidden;
}

.vehicle-history-panel header {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 12px;
  padding: 14px 14px 12px;
}

.vehicle-history-panel strong,
.vehicle-history-panel span {
  display: block;
}

.vehicle-history-panel strong {
  color: var(--text);
  font-size: 14px;
  line-height: 1.2;
}

.vehicle-history-panel span {
  margin-top: 2px;
  color: var(--muted);
  font-size: 12px;
}

.vehicle-history-dot {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: var(--brand);
  box-shadow: 0 0 0 6px color-mix(in srgb, var(--brand) 14%, transparent);
}

.vehicle-history-close {
  width: 32px;
  height: 32px;
  border: 0;
  border-radius: 50%;
  background: rgba(242, 244, 247, 0.92);
  color: var(--muted);
  font-size: 20px;
  line-height: 1;
  cursor: pointer;
}

.vehicle-history-stats {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 14px;
  border-top: 1px solid rgba(16, 24, 40, 0.08);
  background: rgba(248, 250, 252, 0.82);
}

.vehicle-history-stats span {
  margin: 0;
  font-size: 11px;
}

.battery-meter {
  --battery-color: #10B981;
  position: relative;
  display: inline-flex;
  align-items: center;
  width: 42px;
  height: 20px;
  flex: 0 0 auto;
}

.battery-meter-shell {
  position: relative;
  display: block;
  width: 36px;
  height: 18px;
  overflow: hidden;
  border: 2px solid color-mix(in srgb, var(--battery-color) 76%, #111827);
  border-radius: 5px;
  background: rgba(248, 250, 252, 0.95);
  box-sizing: border-box;
  padding: 3px;
}

.battery-meter::after {
  content: "";
  position: absolute;
  top: 7px;
  right: 0;
  width: 3px;
  height: 6px;
  border-radius: 0 2px 2px 0;
  background: color-mix(in srgb, var(--battery-color) 76%, #111827);
}

.battery-meter-fill {
  display: block;
  width: var(--battery-level);
  height: 100%;
  min-width: 0;
  border-radius: 2px;
  background: var(--battery-color);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.22);
}

.battery-meter-high {
  --battery-color: #10B981;
}

.battery-meter-medium {
  --battery-color: #F59E0B;
}

.battery-meter-low {
  --battery-color: #EF4444;
}

.battery-meter-unknown {
  --battery-color: #94A3B8;
  opacity: 0.66;
}

.battery-meter-unknown .battery-meter-shell {
  background: repeating-linear-gradient(
    -45deg,
    rgba(148, 163, 184, 0.14) 0 4px,
    rgba(148, 163, 184, 0.28) 4px 8px
  );
}

.cluster-popup-card {
  min-width: 220px;
  padding: 18px;
  border-radius: 24px;
  background: rgba(255, 255, 255, 0.96);
  box-shadow: var(--shadow-md);
}

.cluster-popup-card h3 {
  margin: 0 0 12px;
  color: var(--text);
  font-size: 16px;
  font-weight: 600;
}

.cluster-popup-row {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 7px 0;
  color: var(--muted);
  font-size: 13px;
}

.cluster-popup-row strong {
  color: var(--text);
  font-weight: 500;
}

.panel-drag-handle {
  display: none;
}

.panel-scroll-body {
  display: contents;
}

@media (max-width: 720px) {
  .address-search-panel {
    top: 12px;
    left: 12px;
    right: 12px;
    width: auto;
    transform: none;
  }

  /* Leave room for the filter button — address-search-row already handles layout */

  .address-search-form {
    min-height: 44px;
  }

  .address-search-form input {
    min-height: 42px;
    font-size: 13px;
  }

  .address-zone-proposal {
    grid-template-columns: minmax(0, 1fr);
  }

  .address-zone-actions {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .address-zone-create,
  .address-zone-secondary {
    width: 100%;
  }

  /* ── Bottom-sheet panel ── */
  .panel-drag-handle {
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 10px 0 6px;
    cursor: pointer;
    flex-shrink: 0;
    touch-action: none;
    user-select: none;
  }

  .panel-drag-handle::before {
    content: '';
    display: block;
    width: 36px;
    height: 4px;
    border-radius: 2px;
    background: rgba(16, 24, 40, 0.18);
    transition: background 0.15s;
  }

  .panel-drag-handle:hover::before,
  .panel-drag-handle:active::before {
    background: rgba(16, 24, 40, 0.34);
  }

  .panel-scroll-body {
    display: block;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    touch-action: pan-y;
    overscroll-behavior: contain;
    padding: 2px 14px calc(20px + env(safe-area-inset-bottom, 0px));
  }

  /* Tall mode: scroll body fills remaining space in the fixed-height panel */
  .floating-panel.panel-tall .panel-scroll-body {
    flex: 1;
    min-height: 0;
    overflow-y: scroll;
  }

  .floating-panel {
    position: absolute;
    top: auto;
    left: 0;
    right: 0;
    bottom: 0;
    width: 100%;
    /* Content-fit by default: grows with content up to max-height */
    height: auto;
    max-height: 60dvh;
    border-radius: 20px 20px 0 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 0;
    overflow: hidden; /* fallback for iOS < 16 */
    overflow: clip;   /* iOS 16+: clips without blocking child scroll */
    animation: none;
    transform: translateY(calc(100% - 76px));
    transition: transform 0.38s cubic-bezier(0.32, 0.72, 0, 1);
    will-change: transform;
  }

  /* Drag handle and header stay fixed — don't compress */
  .panel-drag-handle,
  .panel-header {
    flex-shrink: 0;
  }

  .floating-panel.panel-expanded {
    transform: translateY(0);
  }

  /* Tall mode: fixed 78dvh for zone details (history chart + bike list) */
  .floating-panel.panel-expanded.panel-tall {
    height: 78dvh;
    max-height: none;
  }

  /* panel-has-bike-list on mobile is now just an alias for tall */
  .floating-panel.panel-has-bike-list {
    height: auto;
    max-height: 60dvh;
  }

  .panel-header {
    padding: 0 16px 10px;
    cursor: pointer;
  }

  .panel-header h1 {
    font-size: 17px;
  }

  .panel-header p {
    max-width: 210px;
  }

  .hero-metric {
    min-height: auto;
  }

  .hero-metric strong {
    font-size: 30px;
  }

  .zone-summary {
    padding: 10px;
  }

  /* Zone bike list: natural height inside scroll body — no inner scroll */
  .zone-bike-list {
    height: auto;
  }

  .zone-bike-list-body {
    max-height: none;
    overflow: visible;
  }

  .map-floating-actions {
    left: 16px;
    right: 16px;
    bottom: 90px;
    justify-content: space-between;
    transition: opacity 0.25s ease, transform 0.25s ease;
  }

  /* Hide floating actions when bottom sheet is expanded */
  .floating-panel.panel-expanded ~ .map-floating-actions {
    opacity: 0;
    pointer-events: none;
    transform: translateY(10px);
  }

  .pill-action.primary {
    flex: 1;
  }

  /* Mobile timeline mode: replace all bottom sheet content with timeline controls only */
  .floating-panel.panel-timeline-active .hero-metric,
  .floating-panel.panel-timeline-active .zone-history,
  .floating-panel.panel-timeline-active .zone-bike-list,
  .floating-panel.panel-timeline-active .panel-context,
  .floating-panel.panel-timeline-active .warning-stack,
  .floating-panel.panel-timeline-active .arrival-signal {
    display: none !important;
  }

  .floating-panel.panel-timeline-active #panelTimelineHost {
    display: block;
  }

  .pill-action.timeline {
    min-width: 92px;
    padding: 0 12px;
  }

  .timeline-panel {
    left: 10px;
    right: 10px;
    bottom: 150px;
    width: auto;
    transform: none;
  }

  /* Timeline controls inlined into the bottom sheet panel */
  .timeline-panel.panel-inlined {
    position: static;
    width: auto;
    left: auto; right: auto; bottom: auto;
    transform: none;
    border: none;
    border-radius: 0;
    background: none;
    box-shadow: none;
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
    padding: 12px 0 4px;
    margin: 0;
  }

  .timeline-panel.panel-inlined header {
    padding: 0 0 4px;
  }

  .drawer {
    top: auto;
    left: 0;
    right: 0;
    bottom: 0;
    width: 100%;
    max-height: 80dvh;
    max-height: 80vh;
    border-radius: 24px 24px 0 0;
    transform: translateY(24px);
  }

  .drawer.open {
    transform: translateY(0);
  }

  .leaflet-top.leaflet-left {
    top: 10px;
  }
}
