:root {
  --ink: #0b1220;
  --ink-soft: #1e293b;
  --muted: #64748b;
  --muted-2: #94a3b8;
  --line: #e2e8f0;
  --line-strong: #cbd5e1;
  --bg: #f8fafc;
  --card: #ffffff;
  --lime: #c8f45a;
  --lime-strong: #b6e83f;
  --lime-ink: #1a2e05;
  --teal: #0f766e;
  --teal-dark: #115e59;
  --amber: #b45309;
  --amber-bg: #fffbeb;
  --red: #b91c1c;
  --red-bg: #fef2f2;
  --blue: #2563eb;
  --shadow-sm: 0 1px 2px rgba(15, 23, 42, 0.06);
  --shadow: 0 18px 48px rgba(15, 23, 42, 0.18);
  --radius: 18px;
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  --sheet-peek: 44px;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html,
body {
  height: 100%;
}

body {
  margin: 0;
  overflow: hidden;
  background: var(--bg);
  color: var(--ink);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial,
    sans-serif;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  -webkit-tap-highlight-color: transparent;
}

button,
input {
  font: inherit;
}

button {
  cursor: pointer;
}

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

a {
  color: var(--teal-dark);
}

svg {
  display: block;
  width: 100%;
  height: 100%;
}

.hidden {
  display: none !important;
}

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

:focus-visible {
  outline: 3px solid rgba(15, 118, 110, 0.55);
  outline-offset: 2px;
}

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

#map {
  position: absolute;
  inset: 0;
  z-index: 0;
  background: #e5e7eb;
}

.map3d {
  position: absolute;
  inset: 0;
  z-index: 1;
  overflow: hidden;
  background: #dfe7ee;
}

.map3d-loader {
  position: absolute;
  top: calc(50% - 18px);
  left: 50%;
  z-index: 2;
  padding: 8px 14px;
  border-radius: 999px;
  background: rgba(11, 18, 32, 0.92);
  box-shadow: var(--shadow);
  color: #fff;
  font-size: 12px;
  font-weight: 700;
  transform: translateX(-50%);
  pointer-events: none;
}

.leaflet-container {
  font: inherit;
  background: #e5e7eb;
}

.leaflet-div-icon {
  background: transparent;
  border: 0;
}

.leaflet-control-attribution {
  font-size: 10px;
  padding: 2px 6px;
  border-radius: 8px 0 0 0;
  background: rgba(255, 255, 255, 0.86);
  color: #475569;
}

.leaflet-control-attribution a {
  color: #0f766e;
}

.leaflet-popup-content-wrapper {
  border-radius: 16px;
  box-shadow: var(--shadow);
  padding: 0;
}

.leaflet-popup-content {
  margin: 0;
  width: 260px !important;
}

.leaflet-popup-tip {
  box-shadow: var(--shadow);
}

.leaflet-popup-close-button {
  top: 6px !important;
  right: 6px !important;
  width: 28px !important;
  height: 28px !important;
  color: var(--muted) !important;
  font-size: 20px !important;
}

/* Top bar */

.topbar {
  position: absolute;
  top: calc(10px + var(--safe-top));
  left: 12px;
  right: 12px;
  z-index: 500;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  pointer-events: none;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 8px 12px 8px 8px;
  border: 1px solid rgba(226, 232, 240, 0.9);
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.92);
  box-shadow: var(--shadow-sm);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  color: var(--ink);
  text-decoration: none;
  pointer-events: auto;
}

.brand-mark {
  display: grid;
  place-items: center;
  width: 40px;
  height: 40px;
  padding: 9px;
  border-radius: 12px;
  background: var(--ink);
  color: var(--lime);
}

.brand-copy {
  display: flex;
  flex-direction: column;
  line-height: 1.1;
}

.brand-copy strong {
  font-size: 17px;
  letter-spacing: -0.02em;
}

.brand-copy small {
  margin-top: 3px;
  color: var(--muted);
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.topbar-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  pointer-events: auto;
}

.icon-btn {
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  padding: 11px;
  border: 1px solid rgba(226, 232, 240, 0.9);
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.92);
  box-shadow: var(--shadow-sm);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  color: var(--ink);
  transition: background 0.18s ease, transform 0.18s ease;
}

.icon-btn:hover {
  background: #fff;
}

#top3dBtn[aria-pressed="true"] {
  border-color: var(--ink);
  background: var(--ink);
  color: var(--lime);
}

.icon-btn:active {
  transform: scale(0.96);
}

/* Search */

.panel {
  position: relative;
  border: 1px solid rgba(226, 232, 240, 0.95);
  background: rgba(255, 255, 255, 0.98);
  box-shadow: var(--shadow);
}

.search-panel {
  position: absolute;
  top: calc(72px + var(--safe-top));
  left: 12px;
  right: 12px;
  z-index: 650;
  padding: 12px;
  border-radius: 20px;
}

.search-grid {
  display: grid;
  grid-template-columns: 18px minmax(0, 1fr) 40px;
  gap: 10px;
  align-items: stretch;
}

.route-rail {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 16px 0;
}

.dot {
  width: 9px;
  height: 9px;
  border-radius: 999px;
  flex: none;
}

.dot-a {
  background: var(--ink);
  box-shadow: 0 0 0 3px rgba(11, 18, 32, 0.12);
}

.dot-b {
  background: var(--lime-strong);
  box-shadow: 0 0 0 3px rgba(200, 244, 90, 0.3);
}

.rail {
  width: 2px;
  flex: 1;
  margin: 5px 0;
  border-radius: 99px;
  background: repeating-linear-gradient(
    to bottom,
    var(--line-strong) 0,
    var(--line-strong) 4px,
    transparent 4px,
    transparent 8px
  );
}

.fields {
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-width: 0;
}

.field {
  display: flex;
  align-items: center;
  height: 46px;
  padding: 0 6px 0 12px;
  border: 1px solid transparent;
  border-radius: 12px;
  background: #f1f5f9;
  transition: border-color 0.18s ease, background 0.18s ease;
}

.field:focus-within {
  border-color: rgba(15, 118, 110, 0.4);
  background: #fff;
}

.field input {
  flex: 1;
  min-width: 0;
  height: 100%;
  border: 0;
  outline: 0;
  background: transparent;
  color: var(--ink);
  font-size: 16px;
  font-weight: 600;
}

.field input::placeholder {
  color: var(--muted-2);
  font-weight: 500;
}

.field-btn {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  padding: 8px;
  border: 0;
  border-radius: 9px;
  background: transparent;
  color: var(--muted);
}

.field-btn:hover {
  background: rgba(15, 23, 42, 0.06);
  color: var(--ink);
}

.swap-btn {
  align-self: center;
  display: grid;
  place-items: center;
  width: 40px;
  height: 40px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fff;
  color: var(--ink-soft);
}

.swap-btn:hover {
  border-color: var(--line-strong);
  background: #f8fafc;
}

.suggestions {
  margin-top: 8px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 14px;
  box-shadow: var(--shadow-sm);
}

.suggestions:empty {
  display: none;
}

.suggestion {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  width: 100%;
  padding: 10px 12px;
  border: 0;
  border-bottom: 1px solid var(--line);
  background: #fff;
  text-align: left;
}

.suggestion:last-child {
  border-bottom: 0;
}

.suggestion:hover,
.suggestion.active {
  background: #f8fafc;
}

.suggestion-icon {
  display: grid;
  place-items: center;
  width: 32px;
  height: 32px;
  flex: none;
  padding: 7px;
  border-radius: 10px;
  background: #ecfdf5;
  color: var(--teal-dark);
}

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

.suggestion-title {
  display: block;
  overflow: hidden;
  color: var(--ink);
  font-size: 14px;
  font-weight: 700;
  line-height: 1.25;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.suggestion-subtitle {
  display: block;
  overflow: hidden;
  margin-top: 2px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.3;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.suggestion-empty {
  padding: 14px;
  color: var(--muted);
  font-size: 13px;
  text-align: center;
}

.search-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-top: 10px;
}

.chips {
  display: flex;
  min-width: 0;
  gap: 6px;
  overflow-x: auto;
  scrollbar-width: none;
}

.chips::-webkit-scrollbar {
  display: none;
}

.chip {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  height: 34px;
  padding: 0 10px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #fff;
  color: var(--ink-soft);
  font-size: 12px;
  font-weight: 700;
  white-space: nowrap;
}

.chip svg {
  width: 14px;
  height: 14px;
  color: var(--teal-dark);
}

.chip:hover {
  border-color: var(--line-strong);
  background: #f8fafc;
}

.chip[aria-pressed="true"],
.chip.active {
  border-color: var(--ink);
  background: var(--ink);
  color: #fff;
}

.chip[aria-pressed="true"] svg,
.chip.active svg {
  color: var(--lime);
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 44px;
  padding: 0 18px;
  border: 1px solid transparent;
  border-radius: 12px;
  font-size: 14px;
  font-weight: 800;
  letter-spacing: -0.01em;
  transition: transform 0.18s ease, background 0.18s ease, box-shadow 0.18s ease;
}

.btn:active {
  transform: scale(0.98);
}

.btn.primary {
  background: var(--lime);
  color: var(--lime-ink);
  box-shadow: 0 6px 18px rgba(182, 232, 63, 0.28);
}

.btn.primary:hover {
  background: var(--lime-strong);
}

.btn.dark {
  background: var(--ink);
  color: #fff;
}

.btn.ghost {
  border-color: var(--line);
  background: #fff;
  color: var(--ink-soft);
}

.btn.danger {
  background: var(--red);
  color: #fff;
}

.btn.small {
  min-height: 36px;
  padding: 0 12px;
  border-radius: 10px;
  font-size: 12px;
}

.btn svg {
  width: 17px;
  height: 17px;
  flex: none;
}

.btn.small svg {
  width: 14px;
  height: 14px;
}

.spinner {
  width: 16px;
  height: 16px;
  border: 2px solid rgba(26, 46, 5, 0.25);
  border-top-color: var(--lime-ink);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

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

.status {
  min-height: 0;
  margin: 6px 2px 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.35;
}

.status:empty {
  display: none;
}

.credit {
  margin: 6px 2px 0;
  color: var(--muted);
  font-size: 10px;
  line-height: 1.3;
}

.credit a {
  color: var(--muted);
  text-decoration: underline;
  text-underline-offset: 2px;
}

/* Map controls */

.map-fabs {
  position: absolute;
  right: 12px;
  bottom: calc(var(--sheet-peek) + 14px + var(--safe-bottom));
  z-index: 550;
  display: flex;
  flex-direction: column;
  gap: 10px;
  transition: bottom 0.28s ease;
}

body.sheet-expanded .map-fabs {
  bottom: calc(58dvh + 14px + var(--safe-bottom));
}

.fab {
  display: grid;
  place-items: center;
  width: 48px;
  height: 48px;
  padding: 12px;
  border: 1px solid rgba(226, 232, 240, 0.95);
  border-radius: 15px;
  background: rgba(255, 255, 255, 0.96);
  box-shadow: var(--shadow-sm);
  backdrop-filter: blur(12px);
  color: var(--ink);
}

.fab:hover {
  background: #fff;
}

.fab[aria-pressed="true"] {
  border-color: var(--ink);
  background: var(--ink);
  color: var(--lime);
}

/* Sheet */

.sheet {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 600;
  display: flex;
  flex-direction: column;
  max-height: 58dvh;
  border-radius: 22px 22px 0 0;
  background: var(--card);
  box-shadow: 0 -18px 50px rgba(15, 23, 42, 0.2);
  padding-bottom: var(--safe-bottom);
  transform: translateY(0);
  transition: transform 0.3s cubic-bezier(0.2, 0.8, 0.2, 1);
}

.sheet.collapsed {
  transform: translateY(calc(100% - var(--sheet-peek)));
}

.sheet-handle {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 30px;
  flex: none;
  border: 0;
  background: transparent;
}

.sheet-handle span {
  width: 44px;
  height: 5px;
  border-radius: 999px;
  background: var(--line-strong);
}

.sheet-content {
  display: flex;
  flex-direction: column;
  min-height: 0;
  flex: 1;
}

.sheet-scroll {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  padding: 2px 16px 18px;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
}

.sheet-cta {
  flex: none;
  padding: 10px 16px 12px;
  border-top: 1px solid var(--line);
  background: #fff;
}

.sheet-cta .btn {
  width: 100%;
  min-height: 50px;
  font-size: 15px;
}

.cta-hint {
  margin: 7px 2px 0;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.4;
  text-align: center;
}

.empty-sheet {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 10px 20px 24px;
  text-align: center;
}

.empty-icon {
  display: grid;
  place-items: center;
  width: 52px;
  height: 52px;
  margin-bottom: 10px;
  padding: 13px;
  border-radius: 16px;
  background: #ecfdf5;
  color: var(--teal-dark);
}

.empty-sheet h2 {
  margin: 0;
  font-size: 20px;
  letter-spacing: -0.03em;
}

.empty-sheet p {
  max-width: 360px;
  margin: 8px 0 14px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.5;
}

.empty-tips {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 6px;
}

.empty-tips span {
  padding: 5px 9px;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
}

/* Route summary */

.route-summary {
  padding-top: 2px;
}

.route-kicker {
  display: flex;
  align-items: center;
  gap: 6px;
  color: var(--teal-dark);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.route-kicker svg {
  width: 14px;
  height: 14px;
}

.route-stats {
  display: flex;
  align-items: baseline;
  gap: 10px;
  margin-top: 4px;
}

.route-time {
  font-size: 30px;
  font-weight: 800;
  letter-spacing: -0.045em;
}

.route-distance {
  color: var(--muted);
  font-size: 15px;
  font-weight: 700;
}

.route-arrival {
  margin-top: 2px;
  color: var(--muted);
  font-size: 12px;
}

.badges {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 10px;
}

.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 8px;
  border-radius: 999px;
  background: #f1f5f9;
  color: var(--ink-soft);
  font-size: 11px;
  font-weight: 700;
}

.badge svg {
  width: 12px;
  height: 12px;
}

.badge.good {
  background: #ecfdf5;
  color: var(--teal-dark);
}

.badge.warn {
  background: var(--amber-bg);
  color: var(--amber);
}

.badge.bad {
  background: var(--red-bg);
  color: var(--red);
}

.battery-card {
  margin-top: 12px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: #fbfdff;
}

.battery-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
}

.battery-head strong {
  color: var(--ink);
  font-size: 12px;
}

.battery-track {
  position: relative;
  height: 10px;
  margin-top: 8px;
  overflow: hidden;
  border-radius: 999px;
  background: #e2e8f0;
}

.battery-fill {
  position: absolute;
  inset: 0 auto 0 0;
  border-radius: 999px;
  background: linear-gradient(90deg, var(--teal) 0%, #22c55e 58%, var(--lime-strong) 100%);
}

.battery-fill.low {
  background: linear-gradient(90deg, var(--red) 0%, #f59e0b 100%);
}

.battery-legend {
  display: flex;
  justify-content: space-between;
  margin-top: 6px;
  color: var(--muted);
  font-size: 10px;
}

.warnings {
  display: flex;
  flex-direction: column;
  gap: 7px;
  margin-top: 12px;
}

.warning {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  padding: 10px 11px;
  border: 1px solid #fde68a;
  border-radius: 12px;
  background: var(--amber-bg);
  color: #78350f;
  font-size: 12px;
  line-height: 1.4;
}

.warning.bad {
  border-color: #fecaca;
  background: var(--red-bg);
  color: #7f1d1d;
}

.warning svg {
  width: 15px;
  height: 15px;
  flex: none;
  margin-top: 1px;
}

/* Tabs */

.tabs {
  display: flex;
  gap: 4px;
  margin-top: 14px;
  padding: 4px;
  border-radius: 12px;
  background: #f1f5f9;
}

.tab {
  flex: 1;
  min-width: 0;
  min-height: 36px;
  padding: 0 6px;
  overflow: hidden;
  border: 0;
  border-radius: 9px;
  background: transparent;
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.tab.active {
  background: #fff;
  color: var(--ink);
  box-shadow: var(--shadow-sm);
}

.tab-panel {
  display: none;
  padding-top: 8px;
}

.tab-panel.active {
  display: block;
}

.plan-selector {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding: 2px 0 10px;
  scrollbar-width: none;
}

.plan-selector::-webkit-scrollbar {
  display: none;
}

.plan-option {
  display: flex;
  flex: 0 0 150px;
  flex-direction: column;
  align-items: flex-start;
  gap: 2px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: #fff;
  color: var(--ink);
  text-align: left;
}

.plan-option.active {
  border-color: var(--ink);
  background: #f8fafc;
  box-shadow: var(--shadow-sm);
}

.plan-option-label {
  overflow: hidden;
  max-width: 100%;
  color: var(--teal-dark);
  font-size: 9px;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-overflow: ellipsis;
  text-transform: uppercase;
  white-space: nowrap;
}

.plan-option-main {
  display: flex;
  align-items: baseline;
  gap: 6px;
}

.plan-option-main strong {
  font-size: 18px;
  letter-spacing: -0.03em;
}

.plan-option-main span {
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
}

.plan-option-meta {
  color: var(--muted);
  font-size: 10px;
  font-weight: 700;
}

.plan-option.active .plan-option-label {
  color: var(--ink);
}

.plan-note {
  margin: 0 0 10px;
  padding: 7px 9px;
  border-radius: 9px;
  background: #f8fafc;
  color: var(--muted);
  font-size: 10px;
  line-height: 1.4;
}

.poi-intro {
  margin: 0 0 8px;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.45;
}

.poi-filters {
  display: flex;
  gap: 5px;
  overflow-x: auto;
  margin: 0 0 10px;
  padding-bottom: 2px;
  scrollbar-width: none;
}

.poi-filters::-webkit-scrollbar {
  display: none;
}

.poi-filter {
  flex: none;
  height: 30px;
  padding: 0 10px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #fff;
  color: var(--ink-soft);
  font-size: 11px;
  font-weight: 700;
}

.poi-filter.active {
  border-color: var(--ink);
  background: var(--ink);
  color: #fff;
}

.poi-icon.eat {
  background: #fff7ed;
  color: #c2410c;
}

.poi-icon.drink {
  background: #fef3c7;
  color: #92400e;
}

.poi-icon.shop {
  background: #eff6ff;
  color: #1d4ed8;
}

.poi-tag.eat {
  background: #fff7ed;
  color: #9a3412;
}

.poi-tag.drink {
  background: #fef3c7;
  color: #92400e;
}

.poi-tag.shop {
  background: #eff6ff;
  color: #1e40af;
}

.poi-card .charger-tags {
  margin-top: 6px;
}

.muted {
  color: var(--muted);
}

.warning-box {
  border-color: #fde68a;
  background: var(--amber-bg);
  color: #78350f;
}

/* Steps */

.step-list {
  display: flex;
  flex-direction: column;
}

.step {
  display: grid;
  grid-template-columns: 32px minmax(0, 1fr) auto;
  gap: 10px;
  align-items: start;
  padding: 10px 0;
  border-bottom: 1px solid var(--line);
}

.step:last-child {
  border-bottom: 0;
}

.step-icon {
  display: grid;
  place-items: center;
  width: 32px;
  height: 32px;
  padding: 7px;
  border-radius: 10px;
  background: #f1f5f9;
  color: var(--ink-soft);
}

.step.arrive .step-icon {
  background: #ecfdf5;
  color: var(--teal-dark);
}

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

.step-title {
  color: var(--ink);
  font-size: 13px;
  font-weight: 700;
  line-height: 1.4;
}

.step-sub {
  margin-top: 2px;
  color: var(--muted);
  font-size: 11px;
}

.step-distance {
  padding-top: 3px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
  white-space: nowrap;
}

/* Chargers */

.section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin: 4px 0 8px;
}

.section-head h3 {
  margin: 0;
  font-size: 15px;
  letter-spacing: -0.02em;
}

.section-head span {
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
}

.charger-card {
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: #fff;
  box-shadow: var(--shadow-sm);
}

.charger-card + .charger-card {
  margin-top: 8px;
}

.charger-card.selected {
  border-color: #bbf7d0;
  background: #f7fff9;
}

.charger-top {
  display: flex;
  align-items: flex-start;
  gap: 9px;
}

.charger-icon {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  flex: none;
  padding: 8px;
  border-radius: 10px;
  background: #ecfdf5;
  color: var(--teal-dark);
}

.charger-card.selected .charger-icon {
  background: var(--ink);
  color: var(--lime);
}

.charger-copy {
  min-width: 0;
  flex: 1;
}

.charger-name {
  margin: 0;
  overflow: hidden;
  color: var(--ink);
  font-size: 13px;
  font-weight: 800;
  line-height: 1.3;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.charger-address {
  margin: 2px 0 0;
  overflow: hidden;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.35;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.charger-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  margin-top: 7px;
}

.tag {
  display: inline-flex;
  align-items: center;
  padding: 3px 6px;
  border-radius: 6px;
  background: #f1f5f9;
  color: #475569;
  font-size: 10px;
  font-weight: 700;
}

.tag.good {
  background: #ecfdf5;
  color: var(--teal-dark);
}

.tag.warn {
  background: var(--amber-bg);
  color: var(--amber);
}

.charger-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-top: 8px;
  color: var(--muted);
  font-size: 11px;
}

.charger-actions {
  display: flex;
  gap: 6px;
  margin-top: 9px;
}

.charger-actions .btn {
  flex: 1;
}

.charge-plan {
  margin-top: 10px;
  padding: 10px;
  border: 1px dashed #bbf7d0;
  border-radius: 12px;
  background: #f7fff9;
  color: #14532d;
  font-size: 11px;
  line-height: 1.45;
}

.charge-plan strong {
  font-weight: 800;
}

.note-box {
  margin-top: 12px;
  padding: 10px 11px;
  border-radius: 12px;
  background: #f8fafc;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.45;
}

.note-box ul {
  margin: 6px 0 0;
  padding-left: 16px;
}

.note-box li + li {
  margin-top: 3px;
}

/* Navigation */

.nav {
  position: absolute;
  inset: 0;
  z-index: 900;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  pointer-events: none;
}

.nav-top {
  display: flex;
  align-items: center;
  gap: 11px;
  margin: calc(10px + var(--safe-top)) 10px 0;
  padding: 11px 12px;
  border-radius: 18px;
  background: rgba(11, 18, 32, 0.96);
  box-shadow: var(--shadow);
  color: #fff;
  backdrop-filter: blur(14px);
  pointer-events: auto;
}

.nav-icon {
  display: grid;
  place-items: center;
  width: 52px;
  height: 52px;
  flex: none;
  padding: 12px;
  border-radius: 15px;
  background: var(--lime);
  color: var(--ink);
}

.nav-copy {
  min-width: 0;
  flex: 1;
}

.nav-distance {
  color: var(--lime);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.nav-instruction {
  margin-top: 2px;
  overflow: hidden;
  font-size: 16px;
  font-weight: 700;
  line-height: 1.25;
  text-overflow: ellipsis;
}

.nav-icon-btn {
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  flex: none;
  padding: 10px;
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.08);
  color: #fff;
}

.nav-icon-btn:hover {
  background: rgba(255, 255, 255, 0.16);
}

#nav3dBtn[aria-pressed="true"] {
  border-color: var(--lime);
  background: var(--lime);
  color: var(--ink);
}

.offroute {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin: 8px 10px 0;
  padding: 9px 10px 9px 14px;
  border: 1px solid #fde68a;
  border-radius: 12px;
  background: var(--amber-bg);
  color: #78350f;
  font-size: 12px;
  font-weight: 800;
  pointer-events: auto;
}

.nav-bottom {
  display: flex;
  align-items: center;
  gap: 4px;
  margin: 0 10px calc(10px + var(--safe-bottom));
  padding: 10px 10px 10px 14px;
  border-radius: 18px;
  background: rgba(11, 18, 32, 0.96);
  box-shadow: var(--shadow);
  color: #fff;
  backdrop-filter: blur(14px);
  pointer-events: auto;
}

.nav-stat {
  display: flex;
  min-width: 0;
  flex: 1;
  flex-direction: column;
  line-height: 1.05;
}

.nav-stat strong {
  overflow: hidden;
  font-size: 18px;
  letter-spacing: -0.03em;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.nav-stat small {
  margin-top: 3px;
  color: #94a3b8;
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.nav-actions {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-left: 4px;
}

body.nav-active .topbar,
body.nav-active .search-panel,
body.nav-active .map-fabs,
body.nav-active .sheet {
  display: none !important;
}

/* Toast */

.toast {
  position: fixed;
  left: 50%;
  bottom: calc(84px + var(--safe-bottom));
  z-index: 1200;
  max-width: min(92vw, 420px);
  padding: 10px 14px;
  border-radius: 12px;
  background: var(--ink);
  box-shadow: var(--shadow);
  color: #fff;
  font-size: 12px;
  font-weight: 600;
  line-height: 1.35;
  text-align: center;
  opacity: 0;
  transform: translate(-50%, 12px);
  transition: opacity 0.2s ease, transform 0.2s ease;
  pointer-events: none;
}

.toast.show {
  opacity: 1;
  transform: translate(-50%, 0);
}

/* Dialogs */

.dialog {
  width: min(92vw, 560px);
  max-height: 88dvh;
  padding: 0;
  border: 0;
  border-radius: 20px;
  background: var(--card);
  box-shadow: 0 30px 80px rgba(15, 23, 42, 0.35);
  color: var(--ink);
}

.dialog-wide {
  width: min(94vw, 720px);
}

.dialog::backdrop {
  background: rgba(11, 18, 32, 0.58);
  backdrop-filter: blur(3px);
  -webkit-backdrop-filter: blur(3px);
}

.dialog form {
  display: flex;
  flex-direction: column;
  max-height: 88dvh;
}

.dialog-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  padding: 18px 18px 12px;
  border-bottom: 1px solid var(--line);
}

.dialog-head h2 {
  margin: 2px 0 0;
  font-size: 21px;
  letter-spacing: -0.035em;
}

.eyebrow {
  color: var(--teal-dark);
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.dialog-body {
  min-height: 0;
  overflow-y: auto;
  padding: 16px 18px;
  -webkit-overflow-scrolling: touch;
}

.dialog-foot {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  padding: 12px 18px calc(14px + var(--safe-bottom));
  border-top: 1px solid var(--line);
}

.dialog-foot .btn {
  min-width: 110px;
}

.dialog-head .icon-btn {
  flex: none;
  border-color: var(--line);
  background: #fff;
  box-shadow: none;
}

.preset-row {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 16px;
}

.preset {
  min-height: 34px;
  padding: 0 10px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #fff;
  color: var(--ink-soft);
  font-size: 11px;
  font-weight: 700;
}

.preset:hover {
  border-color: var(--line-strong);
  background: #f8fafc;
}

.preset.active {
  border-color: var(--ink);
  background: var(--ink);
  color: #fff;
}

.range-field {
  display: block;
  margin-top: 14px;
}

.range-field > span {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  color: var(--ink-soft);
  font-size: 12px;
  font-weight: 700;
}

.range-field output {
  color: var(--teal-dark);
  font-weight: 800;
}

input[type="range"] {
  width: 100%;
  height: 30px;
  margin: 4px 0 0;
  accent-color: var(--teal);
}

.form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-top: 14px;
}

.form-grid label {
  display: flex;
  flex-direction: column;
  gap: 5px;
  color: var(--ink-soft);
  font-size: 12px;
  font-weight: 700;
}

.form-grid input {
  height: 42px;
  padding: 0 10px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #f8fafc;
  color: var(--ink);
  font-size: 15px;
  font-weight: 700;
}

.hint {
  margin: 14px 0 0;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.5;
}

/* Prose */

.prose {
  font-size: 13px;
  line-height: 1.6;
}

.prose section + section {
  margin-top: 20px;
  padding-top: 16px;
  border-top: 1px solid var(--line);
}

.prose h3 {
  margin: 0 0 8px;
  font-size: 15px;
  letter-spacing: -0.02em;
}

.prose p {
  margin: 0 0 8px;
}

.prose ul {
  margin: 0;
  padding-left: 18px;
}

.prose li {
  margin-bottom: 6px;
}

.prose li::marker {
  color: var(--teal);
}

.prose .callout {
  margin-top: 10px;
  padding: 10px 12px;
  border-left: 3px solid var(--amber);
  border-radius: 0 10px 10px 0;
  background: var(--amber-bg);
  color: #78350f;
  font-size: 12px;
}

.sources a {
  font-weight: 600;
  text-decoration-thickness: 1px;
  text-underline-offset: 2px;
}

/* Map markers */

.mk {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border-radius: 12px;
  box-shadow: 0 4px 14px rgba(15, 23, 42, 0.28);
}

.mk svg {
  width: 17px;
  height: 17px;
}

.mk-origin {
  background: var(--ink);
  color: #fff;
  border: 3px solid #fff;
}

.mk-dest {
  background: var(--lime);
  color: var(--ink);
  border: 3px solid var(--ink);
}

.mk-charger {
  width: 26px;
  height: 26px;
  padding: 6px;
  border: 2px solid #fff;
  border-radius: 9px;
  background: var(--teal);
  color: #fff;
}

.mk-charger.selected {
  background: var(--lime);
  color: var(--ink);
  border-color: var(--ink);
}

.mk-stop {
  background: var(--amber);
  color: #fff;
  border: 2px solid #fff;
}

.mk-poi {
  width: 26px;
  height: 26px;
  padding: 6px;
  border: 2px solid #fff;
  border-radius: 9px;
  color: #fff;
}

.mk-poi-eat {
  background: #ea580c;
}

.mk-poi-drink {
  background: #b45309;
}

.mk-poi-shop {
  background: #2563eb;
}

.car-marker {
  position: relative;
  display: grid;
  place-items: center;
  width: 48px;
  height: 48px;
}

.car-marker::before {
  content: "";
  position: absolute;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.2);
  box-shadow:
    0 0 0 1px rgba(255, 255, 255, 0.42),
    0 0 22px rgba(20, 184, 166, 0.45);
}

.car-pulse {
  position: absolute;
  width: 46px;
  height: 46px;
  border-radius: 999px;
  background: rgba(20, 184, 166, 0.2);
  animation: pulse 2.2s ease-out infinite;
}

.leaflet-marker-icon.car-marker-icon {
  transition: transform 0.8s linear;
}

.map-dragging .leaflet-marker-icon.car-marker-icon {
  transition: none;
}

.car-arrow {
  position: relative;
  display: grid;
  place-items: center;
  width: 40px;
  height: 40px;
  padding: 0;
  border: 0;
  background: transparent;
  filter: drop-shadow(0 5px 8px rgba(15, 23, 42, 0.35));
  transform: rotate(0deg);
  transform-origin: center;
  transition: transform 0.25s ease-out;
}

.car-arrow svg {
  display: block;
  width: 100%;
  height: 100%;
}

.mk-position {
  width: 22px;
  height: 22px;
  border: 3px solid #fff;
  border-radius: 999px;
  background: var(--blue);
  box-shadow: 0 0 0 5px rgba(37, 99, 235, 0.18), 0 3px 10px rgba(15, 23, 42, 0.3);
}

.pulse {
  position: relative;
}

.pulse::after {
  content: "";
  position: absolute;
  inset: -8px;
  border: 2px solid rgba(37, 99, 235, 0.35);
  border-radius: 999px;
  animation: pulse 2s ease-out infinite;
}

@keyframes pulse {
  0% {
    opacity: 0.8;
    transform: scale(0.7);
  }
  100% {
    opacity: 0;
    transform: scale(1.5);
  }
}

.popup {
  padding: 14px;
}

.popup h3 {
  margin: 0 0 3px;
  padding-right: 20px;
  font-size: 14px;
  line-height: 1.3;
}

.popup p {
  margin: 0;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.4;
}

.popup .popup-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  margin-top: 8px;
}

.popup .btn {
  width: 100%;
  margin-top: 10px;
}

/* Responsive */

@media (min-width: 900px) {
  .topbar {
    left: 20px;
    right: 20px;
  }

  .search-panel {
    left: 20px;
    right: auto;
    width: 420px;
    top: calc(84px + var(--safe-top));
  }

  .sheet {
    left: 20px;
    right: auto;
    bottom: 20px;
    width: 420px;
    max-height: calc(100dvh - 240px);
    border-radius: 20px;
    transform: none;
    padding-bottom: 0;
  }

  .sheet.collapsed {
    transform: none;
  }

  .map-fabs {
    right: 20px;
    bottom: 20px;
  }

  body.sheet-expanded .map-fabs {
    bottom: 20px;
  }

  .nav-top,
  .nav-bottom {
    width: min(560px, calc(100vw - 40px));
    margin-left: auto;
    margin-right: auto;
  }

  .nav-top {
    margin-top: calc(14px + var(--safe-top));
  }

  .nav-bottom {
    margin-bottom: calc(14px + var(--safe-bottom));
  }

  .toast {
    bottom: 28px;
  }
}

@media (max-width: 899px) {
  .sheet.collapsed .sheet-content {
    visibility: hidden;
    opacity: 0;
    pointer-events: none;
  }

  .sheet {
    max-height: 52dvh;
  }

  .search-panel.compact {
    padding: 9px 10px;
  }

  .search-panel.compact .chips,
  .search-panel.compact .status {
    display: none;
  }

  .search-panel.compact .field {
    height: 40px;
  }

  .search-panel.compact .search-actions {
    margin-top: 7px;
  }

  .search-panel.compact .search-actions .btn.primary {
    width: 100%;
    min-height: 40px;
  }

  .search-panel.compact .credit {
    margin-top: 5px;
  }

  body.sheet-expanded .map-fabs {
    display: none;
  }
}

@media (max-width: 420px) {
  .brand-copy small {
    display: none;
  }

  .brand {
    padding-right: 10px;
  }

  .search-actions {
    flex-wrap: wrap;
  }

  .chips {
    width: 100%;
  }

  .search-actions .btn.primary {
    width: 100%;
  }

  .route-time {
    font-size: 26px;
  }

  .nav-stat strong {
    font-size: 16px;
  }

  .nav-bottom {
    padding-left: 10px;
  }
}

@media (max-height: 680px) {
  .search-panel {
    padding: 10px;
  }

  .field {
    height: 42px;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
  }
}

/* Compass */

.compass {
  position: absolute;
  right: 14px;
  top: 50%;
  z-index: 620;
  display: grid;
  place-items: center;
  width: 54px;
  height: 54px;
  padding: 0;
  border: 1px solid rgba(226, 232, 240, 0.95);
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.96);
  box-shadow: var(--shadow-sm);
  color: var(--ink);
  transform: translateY(-50%);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
}

.compass:hover {
  background: #fff;
}

.compass-dial {
  display: block;
  width: 38px;
  height: 38px;
  transition: transform 0.16s linear;
}

.compass-dial svg {
  display: block;
  width: 100%;
  height: 100%;
}

/* Connections */

.settings-connections {
  display: flex;
  width: 100%;
  align-items: center;
  gap: 10px;
  margin: 0 0 16px;
  padding: 10px 11px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: #fbfdff;
  color: var(--ink);
  text-align: left;
}

.settings-connections:hover {
  border-color: var(--line-strong);
  background: #f8fafc;
}

.settings-connections-icon {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  flex: none;
  padding: 8px;
  border-radius: 10px;
  background: var(--ink);
  color: var(--lime);
}

.settings-connections-icon svg {
  width: 18px;
  height: 18px;
}

.settings-connections-copy {
  display: flex;
  min-width: 0;
  flex: 1;
  flex-direction: column;
  line-height: 1.2;
}

.settings-connections-copy strong {
  font-size: 13px;
}

.settings-connections-copy small {
  margin-top: 3px;
  color: var(--muted);
  font-size: 10px;
  font-weight: 600;
}

.settings-connections-arrow {
  width: 16px;
  flex: none;
  color: var(--muted);
}

.settings-connections-arrow svg {
  width: 16px;
  height: 16px;
}

.connection-card {
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: #fbfdff;
}

.connection-card + .connection-card {
  margin-top: 12px;
}

.connection-head {
  display: flex;
  align-items: flex-start;
  gap: 10px;
}

.connection-icon {
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  flex: none;
  padding: 9px;
  border-radius: 11px;
  background: #eef2f7;
  color: var(--ink);
}

.connection-icon.music {
  background: #ecfdf5;
  color: var(--teal-dark);
}

.connection-icon.vehicle {
  background: #eff6ff;
  color: #1d4ed8;
}

.connection-icon svg {
  width: 19px;
  height: 19px;
}

.connection-head h3 {
  margin: 0;
  font-size: 15px;
  letter-spacing: -0.02em;
}

.connection-head p {
  margin: 3px 0 0;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.45;
}

.music-apps {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin: 12px 0 10px;
}

.music-app {
  min-height: 34px;
  padding: 0 11px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #fff;
  color: var(--ink-soft);
  font-size: 12px;
  font-weight: 700;
}

.music-app:hover {
  border-color: var(--line-strong);
  background: #f8fafc;
}

.music-app.active,
.music-app[aria-pressed="true"] {
  border-color: var(--ink);
  background: var(--ink);
  color: var(--lime);
}

.connection-note {
  margin: 10px 0 0;
  color: var(--muted);
  font-size: 10px;
  line-height: 1.5;
}

.live-battery-card {
  margin: 12px 0;
  padding: 11px;
  border: 1px solid var(--line);
  border-radius: 13px;
  background: #fff;
}

.live-battery-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
}

.live-battery-head strong {
  color: var(--ink);
  font-size: 14px;
}

.live-battery-meta {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  margin-top: 6px;
  color: var(--muted);
  font-size: 10px;
  font-weight: 600;
}

.live-battery-meta .stale {
  color: #b45309;
}

.connection-form {
  margin-top: 10px;
}

.connection-form .full,
.form-grid .full {
  grid-column: 1 / -1;
}

.connection-form input {
  font-size: 13px;
  font-weight: 600;
}

.connection-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 10px;
}

.connection-status {
  min-height: 17px;
  margin: 8px 0 0;
  color: var(--muted);
  font-size: 11px;
  font-weight: 600;
  line-height: 1.4;
}

.connection-status.ok {
  color: var(--teal-dark);
}

.connection-status.error {
  color: var(--red);
}

.connection-help {
  margin-top: 10px;
  color: var(--muted);
  font-size: 10px;
  line-height: 1.5;
}

.connection-help summary {
  cursor: pointer;
  color: var(--ink-soft);
  font-weight: 700;
}

.connection-help pre {
  overflow-x: auto;
  margin: 8px 0;
  padding: 9px;
  border-radius: 8px;
  background: #f1f5f9;
  color: var(--ink);
  font-size: 10px;
}

.connection-help code {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 10px;
}

.link-btn {
  display: inline-block;
  margin: 9px 0 0;
  padding: 0;
  border: 0;
  background: none;
  color: var(--teal-dark);
  font-size: 11px;
  font-weight: 700;
  text-align: left;
  text-decoration: underline;
  text-underline-offset: 2px;
}

.chip.has-live {
  position: relative;
  padding-right: 22px;
  border-color: rgba(34, 197, 94, 0.55);
}

.chip.has-live::after {
  content: "";
  position: absolute;
  top: 7px;
  right: 8px;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #22c55e;
  box-shadow: 0 0 0 2px rgba(34, 197, 94, 0.16);
}

/* Live battery in navigation */

.nav-live-battery {
  display: flex;
  align-items: center;
  gap: 5px;
  margin-top: 4px;
  color: #f8fafc;
  font-size: 18px;
  font-weight: 800;
  line-height: 1.2;
  letter-spacing: -0.02em;
}

.nav-live-battery svg {
  width: 17px;
  height: 17px;
  flex: none;
  color: var(--lime);
}

.nav-live-battery.charging {
  color: var(--lime);
}

.nav-live-battery.stale {
  color: #fbbf24;
}

button.nav-live-battery {
  border: 0;
  background: none;
  padding: 0;
  font-family: inherit;
  text-align: left;
  cursor: pointer;
}

/* Live vehicle screen */

.vehicle-live-hero {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
  margin-bottom: 8px;
}

.vehicle-live-hero > div,
.vehicle-live-metric {
  min-width: 0;
  padding: 11px 12px;
  border: 1px solid var(--line);
  border-radius: 13px;
  background: #fff;
}

.vehicle-live-hero span,
.vehicle-live-metric span {
  display: block;
  color: var(--muted);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.vehicle-live-hero strong {
  display: block;
  margin-top: 4px;
  font-size: clamp(19px, 5vw, 25px);
  letter-spacing: -0.04em;
  white-space: nowrap;
}

.vehicle-live-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.vehicle-live-metric strong {
  display: block;
  margin-top: 3px;
  font-size: 15px;
  letter-spacing: -0.02em;
}

@media (max-width: 420px) {
  .vehicle-live-hero {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .vehicle-live-hero > div:last-child {
    grid-column: 1 / -1;
  }
}

/* Empty sheet hidden until a route exists */

body:not(.has-plan) .map-fabs {
  bottom: calc(14px + var(--safe-bottom));
}

/* Saved places */

.mk-place {
  background: #b45309;
  color: #fff;
  border: 2px solid #fff;
  border-radius: 10px;
}

.place-tooltip {
  padding: 3px 7px;
  border: 0;
  border-radius: 999px;
  background: rgba(11, 18, 32, 0.92);
  box-shadow: var(--shadow-sm);
  color: #fff;
  font-size: 10px;
  font-weight: 700;
  white-space: nowrap;
}

.place-tooltip::before {
  border-top-color: rgba(11, 18, 32, 0.92);
}

.popup-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 9px;
}

.place-name-field {
  display: flex;
  flex-direction: column;
  gap: 6px;
  color: var(--ink-soft);
  font-size: 12px;
  font-weight: 700;
}

.place-name-field input {
  height: 44px;
  padding: 0 11px;
  border: 1px solid var(--line);
  border-radius: 11px;
  background: #f8fafc;
  color: var(--ink);
  font-size: 15px;
  font-weight: 700;
}

/* Settings sections */

.settings-section {
  padding-top: 14px;
  border-top: 1px solid var(--line);
}

.settings-section + .settings-section {
  margin-top: 14px;
}

.settings-section-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 10px;
}

.settings-section-head h3 {
  margin: 0;
  font-size: 15px;
  letter-spacing: -0.02em;
}

.settings-section-head span {
  color: var(--muted);
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.settings-select {
  display: flex;
  flex-direction: column;
  gap: 6px;
  color: var(--ink-soft);
  font-size: 12px;
  font-weight: 700;
}

.settings-select select {
  height: 44px;
  padding: 0 10px;
  border: 1px solid var(--line);
  border-radius: 11px;
  background: #f8fafc;
  color: var(--ink);
  font-size: 14px;
  font-weight: 700;
}

/* Transit */

.transit-callout {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-top: 12px;
  padding: 10px 11px;
  border: 1px solid #bae6fd;
  border-radius: 13px;
  background: #f0f9ff;
}

.transit-callout-copy {
  display: flex;
  min-width: 0;
  flex-direction: column;
  gap: 2px;
}

.transit-callout-copy strong {
  color: #075985;
  font-size: 12px;
}

.transit-callout-copy span {
  color: #0369a1;
  font-size: 10px;
  line-height: 1.35;
}

.transit-callout .btn {
  flex: none;
}

.transit-vsp-text {
  margin: 0 0 4px;
  color: var(--ink);
  font-size: 13px;
  font-weight: 800;
}

.transit-route-text {
  margin: 0 0 14px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.4;
}

.transit-options {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
}

.transit-options .btn {
  flex: 1 1 140px;
  justify-content: center;
  text-decoration: none;
}

/* Speed limit sign */

.speed-limit-sign {
  position: absolute;
  left: 14px;
  bottom: calc(88px + var(--safe-bottom));
  z-index: 2;
  display: flex;
  align-items: center;
  flex-direction: column;
  gap: 2px;
  pointer-events: none;
}

.speed-current-disc {
  display: grid;
  place-items: center;
  width: 54px;
  height: 54px;
  border: 5px solid #0f172a;
  border-radius: 50%;
  background: #0f172a;
  box-shadow: 0 6px 18px rgba(15, 23, 42, 0.28);
  color: #fff;
  font-size: 22px;
  font-weight: 900;
  letter-spacing: -0.06em;
}

@keyframes speed-over-limit {
  0%,
  100% {
    border-color: #dc2626;
    background: #dc2626;
    color: #fff;
    box-shadow: 0 0 0 0 rgba(220, 38, 38, 0.65);
  }
  50% {
    border-color: #dc2626;
    background: #fff;
    color: #dc2626;
    box-shadow: 0 0 0 10px rgba(220, 38, 38, 0);
  }
}

.speed-current-disc.over-limit {
  animation: speed-over-limit 0.7s ease-in-out infinite;
}

@media (prefers-reduced-motion: reduce) {
  .speed-current-disc.over-limit {
    animation: none;
    border-color: #dc2626;
    background: #dc2626;
    color: #fff;
  }
}

.speed-current-caption {
  padding: 2px 6px;
  border-radius: 999px;
  background: rgba(15, 23, 42, 0.9);
  color: #fff;
  font-size: 8px;
  font-weight: 800;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.speed-limit-disc {
  display: grid;
  place-items: center;
  width: 54px;
  height: 54px;
  border: 5px solid #dc2626;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 6px 18px rgba(15, 23, 42, 0.28);
  color: #111827;
  font-size: 22px;
  font-weight: 900;
  letter-spacing: -0.06em;
}

.speed-limit-value {
  line-height: 1;
}

.speed-limit-caption {
  padding: 2px 6px;
  border-radius: 999px;
  background: rgba(11, 18, 32, 0.82);
  color: #fff;
  font-size: 8px;
  font-weight: 800;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

/* Quick places */

.quick-places {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  margin-top: 8px;
}

.quick-places-label {
  color: var(--muted);
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.quick-place-item {
  position: relative;
  display: inline-flex;
  align-items: center;
}

.quick-place {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  height: 32px;
  padding: 0 10px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #fff;
  color: var(--ink-soft);
  font-size: 11px;
  font-weight: 700;
}

.quick-place:hover {
  border-color: var(--line-strong);
  background: #f8fafc;
}

.quick-place svg {
  width: 14px;
  height: 14px;
  color: var(--teal-dark);
}

.quick-place-item.defined .quick-place {
  border-color: rgba(20, 184, 166, 0.45);
  color: var(--ink);
}

.quick-place-item.defined .quick-place::after {
  content: "";
  width: 6px;
  height: 6px;
  margin-left: 1px;
  border-radius: 50%;
  background: #22c55e;
}

.quick-place-edit {
  display: none;
  place-items: center;
  width: 24px;
  height: 24px;
  margin-left: -2px;
  padding: 4px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #fff;
  color: var(--muted);
}

.quick-place-item.defined .quick-place-edit {
  display: grid;
}

.quick-place-edit:hover {
  color: var(--ink);
  background: #f8fafc;
}

.quick-place-edit svg {
  width: 12px;
  height: 12px;
}

.quick-place-locate-row {
  margin: 10px 0 0;
}

/* Stops */

.stops-bar {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-top: 8px;
  min-width: 0;
}

.waypoint-list {
  display: flex;
  flex-wrap: nowrap;
  gap: 5px;
  min-width: 0;
  overflow-x: auto;
  scrollbar-width: none;
}

.waypoint-list::-webkit-scrollbar {
  display: none;
}

.waypoint-chip {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  max-width: 190px;
  height: 30px;
  padding: 0 5px 0 7px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #f8fafc;
  color: var(--ink-soft);
  font-size: 10px;
  font-weight: 700;
  white-space: nowrap;
}

.waypoint-index {
  display: grid;
  place-items: center;
  width: 16px;
  height: 16px;
  flex: none;
  border-radius: 50%;
  background: var(--ink);
  color: var(--lime);
  font-size: 8px;
  font-weight: 900;
}

.waypoint-name {
  overflow: hidden;
  text-overflow: ellipsis;
}

.waypoint-chip button {
  display: grid;
  place-items: center;
  width: 18px;
  height: 18px;
  padding: 3px;
  border: 0;
  border-radius: 50%;
  background: transparent;
  color: var(--muted);
}

.waypoint-chip button:hover {
  background: #e2e8f0;
  color: var(--ink);
}

.waypoint-chip button svg {
  width: 11px;
  height: 11px;
}

.stop-add {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  height: 30px;
  flex: none;
  padding: 0 9px;
  border: 1px dashed var(--line-strong);
  border-radius: 999px;
  background: #fff;
  color: var(--ink-soft);
  font-size: 10px;
  font-weight: 700;
}

.stop-add:hover {
  border-color: var(--teal);
  color: var(--teal-dark);
}

.stop-add svg {
  width: 13px;
  height: 13px;
}

.stop-results {
  display: flex;
  flex-direction: column;
  gap: 5px;
  margin-top: 8px;
}

.stop-result {
  display: flex;
  width: 100%;
  flex-direction: column;
  gap: 2px;
  padding: 9px 10px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fff;
  text-align: left;
}

.stop-result:hover {
  border-color: var(--teal);
  background: #f0fdfa;
}

.stop-result strong {
  color: var(--ink);
  font-size: 12px;
}

.stop-result span {
  color: var(--muted);
  font-size: 10px;
  line-height: 1.35;
}

/* Numbered waypoints on the map */

.mk-waypoint {
  display: grid;
  place-items: center;
  width: 28px;
  height: 28px;
  border: 2px solid #fff;
  border-radius: 50%;
  background: var(--ink);
  box-shadow: 0 4px 14px rgba(15, 23, 42, 0.3);
  color: var(--lime);
  font-size: 11px;
  font-weight: 900;
}
