:root {
  --bg-primary: #F1F5F9;
  --bg-card: #FFFFFF;
  --accent: #0D9488;
  --accent-gold: #F59E0B;
  --text-main: #334155;
  --text-muted: #64748B;
  --border: rgba(51, 65, 85, 0.10);
  --shadow-soft: 0 8px 24px rgba(15, 23, 42, 0.10);
  --shadow-fab: 0 6px 18px rgba(15, 23, 42, 0.14);
  --font-family: "Poppins", "Noto Sans KR", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body, html {
  width: 100%;
  height: 100%;
  overflow: hidden;
  font-family: var(--font-family);
  background-color: var(--bg-primary);
  color: var(--text-main);
}

#map {
  width: 100%;
  height: 100%;
  z-index: 1;
}

/* Header Frosted Glass */
.header-glass {
  position: absolute;
  top: 12px;
  left: 12px;
  right: 12px;
  z-index: 1000;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0;
  background: transparent;
  border: none;
}

.header-left, .header-right {
  display: flex;
  align-items: center;
  gap: 8px;
}

.btn-icon {
  background: rgba(255, 255, 255, 0.16);
  border: 1px solid rgba(255, 255, 255, 0.58);
  color: var(--text-main);
  border-radius: 50%;
  width: 44px;
  height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  cursor: pointer;
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  box-shadow: 0 8px 22px rgba(15, 23, 42, 0.13);
}

.pill-info {
  background: rgba(255, 255, 255, 0.16);
  color: var(--text-main);
  padding: 10px 14px;
  border: 1px solid rgba(255, 255, 255, 0.58);
  border-radius: 999px;
  font-size: 13px;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 6px;
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  box-shadow: 0 8px 22px rgba(15, 23, 42, 0.11);
}

/* Destination bottom sheet */
.bottom-sheet {
  position: fixed;
  left: 50%;
  bottom: 0;
  z-index: 1300;
  width: min(100%, 560px);
  height: auto;
  max-height: 88dvh;
  display: flex;
  flex-direction: column;
  padding: 18px 20px 24px;
  color: #334155;

  background: rgba(255, 255, 255, 0.94);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);

  border: 1px solid rgba(255, 255, 255, 0.74);
  border-bottom: none;
  border-radius: 28px 28px 0 0;

  box-shadow:
    0 -8px 32px rgba(15, 23, 42, 0.16),
    0 -1px 0 rgba(255, 255, 255, 0.8);

  transform: translate(-50%, 105%);
  transition: transform 320ms cubic-bezier(0.16, 1, 0.3, 1);
  overflow: hidden;
}

.bottom-sheet.open {
  transform: translate(-50%, 0);
}

.sheet-handle {
  width: 42px;
  height: 4px;
  flex: 0 0 auto;
  align-self: center;
  margin: 0 0 18px;
  border-radius: 999px;
  background: rgba(51, 65, 85, 0.20);
}

.btn-close-sheet {
  position: absolute;
  top: 16px;
  right: 16px;
  width: 38px;
  height: 38px;

  display: flex;
  align-items: center;
  justify-content: center;

  border: 1px solid rgba(51, 65, 85, 0.08);
  border-radius: 50%;

  background: rgba(255, 255, 255, 0.72);
  color: #334155;

  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);

  box-shadow: 0 5px 16px rgba(15, 23, 42, 0.10);

  font-family: var(--font-family);
  font-size: 22px;
  line-height: 1;
  cursor: pointer;
}

.destination-heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  /* Reserve space for Close + Minimize controls */
  padding-right: 96px;
  margin-bottom: 18px;
}

.destination-heading-main {
  min-width: 0;
}

.destination-enriched-badge {
  width: fit-content;
  display: flex;
  align-items: center;
  gap: 5px;

  margin-bottom: 8px;
  padding: 5px 9px;

  border-radius: 999px;
  background: rgba(13, 148, 136, 0.09);
  color: #0D9488;

  font-size: 11px;
  font-weight: 600;
}

.destination-enriched-badge[hidden] {
  display: none;
}

.sheet-title {
  margin: 0;
  color: #1E293B;
  font-size: 24px;
  font-weight: 650;
  line-height: 1.18;
  letter-spacing: -0.02em;
}

.destination-meta {
  display: flex;
  flex-direction: column;
  gap: 3px;
  margin-top: 7px;

  color: #64748B;
  font-size: 12px;
  line-height: 1.4;
}

.sheet-distance {
  flex: 0 0 auto;
  margin-top: 3px;

  padding: 5px 9px;
  border-radius: 999px;

  background: rgba(13, 148, 136, 0.08);
  color: #0D9488;

  font-size: 11px;
  font-weight: 600;
}

.destination-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-bottom: 18px;
}

.destination-action {
  min-height: 48px;
  padding: 10px 14px;

  border-radius: 999px;
  font-family: var(--font-family);
  font-size: 13px;
  font-weight: 600;

  cursor: pointer;
  transition:
    transform 160ms ease,
    box-shadow 160ms ease;
}

.destination-action:active {
  transform: scale(0.98);
}

.destination-action-primary {
  border: none;
  background: #0D9488;
  color: #FFFFFF;
  box-shadow: 0 7px 18px rgba(13, 148, 136, 0.22);
}

.destination-action-secondary {
  border: 1px solid rgba(13, 148, 136, 0.22);
  background: rgba(255, 255, 255, 0.60);
  color: #0D9488;
}

.destination-content {
  flex: 1;
  min-height: 0;
  overflow-y: auto;

  margin: 0;
  padding: 4px 4px 12px 0;

  color: #475569;
  font-size: 14px;
  line-height: 1.7;

  scrollbar-width: thin;
}

.destination-content[hidden] {
  display: none;
}

.destination-audio {
  flex: 0 0 auto;
  margin-top: auto;
  padding-top: 14px;
}

.destination-audio[hidden] {
  display: none;
}

.btn-audio {
  width: 100%;
  min-height: 46px;

  display: flex;
  align-items: center;
  justify-content: center;

  border: 1px solid rgba(13, 148, 136, 0.18);
  border-radius: 999px;

  background: rgba(13, 148, 136, 0.09);
  color: #0D9488;

  font-family: var(--font-family);
  font-size: 13px;
  font-weight: 600;

  cursor: pointer;
}


@media (max-width: 600px) {
  .bottom-sheet {
    width: 100%;
    height: auto;
    max-height: 88dvh;
    padding-left: 18px;
    padding-right: 18px;
  }

  .sheet-title {
    font-size: 22px;
  }
}

/* Modais */
.modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 2000;
  background: rgba(0, 0, 0, 0.7);
  backdrop-filter: blur(8px);
  display: none;
  align-items: center;
  justify-content: center;
  padding: 16px;
}

.modal-overlay.open {
  display: flex;
}

.modal-box {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 16px;
  width: 100%;
  max-width: 420px;
  padding: 24px;
  color: var(--text-main);
}

/* Itinerary timeline */
.itinerary-strip {
  position: fixed;
  top: 76px;
  left: 12px;
  right: 12px;
  z-index: 1050;
  min-height: 72px;
  display: flex;
  align-items: stretch;
  background: rgba(255, 255, 255, 0.96);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid rgba(51, 65, 85, 0.08);
  border-radius: 18px;
  box-shadow: var(--shadow-soft);
  color: #334155;
  overflow: hidden;
  transition:
    width 220ms ease,
    opacity 180ms ease,
    transform 220ms ease;
}

.itinerary-strip[hidden] {
  display: none;
}

.itinerary-toggle {
  width: 32px;
  flex: 0 0 32px;
  border: none;
  border-right: 1px solid rgba(51, 65, 85, 0.08);
  background: #FFFFFF;
  color: #0D9488;
  border-radius: 18px 0 0 18px;
  cursor: pointer;
}

.itinerary-toggle-icon {
  font-size: 24px;
  line-height: 1;
}

.itinerary-header {
  display: flex;
  align-items: center;
  padding: 0 12px;
  border-right: 1px solid rgba(51, 65, 85, 0.08);
}

.itinerary-title {
  font-size: 12px;
  font-weight: 600;
  color: #334155;
  white-space: nowrap;
}

.itinerary-timeline-wrap {
  position: relative;
  flex: 1;
  min-width: 0;
  display: flex;
  align-items: center;
}

.itinerary-timeline {
  flex: 1;
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
  padding: 8px 28px;
  overflow-x: auto;
  scroll-behavior: smooth;
  scrollbar-width: none;
  -webkit-overflow-scrolling: touch;
}

.itinerary-timeline::-webkit-scrollbar {
  display: none;
}

.itinerary-scroll-hint {
  position: absolute;
  top: 50%;
  z-index: 3;
  transform: translateY(-50%);
  border: none;
  background: transparent;
  color: rgba(13, 148, 136, 0.42);
  font-size: 28px;
  font-weight: 500;
  line-height: 1;
  padding: 5px;
  opacity: 0;
  pointer-events: none;
  transition:
    opacity 180ms ease,
    transform 180ms ease;
}

.itinerary-scroll-hint.visible {
  opacity: 1;
}

.itinerary-scroll-hint-left {
  left: 2px;
}

.itinerary-scroll-hint-right {
  right: 2px;
}

.itinerary-strip.has-active-event .itinerary-scroll-hint {
  font-weight: 800;
  color: rgba(13, 148, 136, 0.72);
}

.itinerary-event {
  position: relative;
  flex: 0 0 auto;
  min-width: 144px;
  padding: 9px 11px;
  border-radius: 13px;
  border: 1px solid rgba(51, 65, 85, 0.10);
  background: #FFFFFF;
}

.itinerary-event.past {
  opacity: 0.46;
}

.itinerary-event.active {
  border-color: rgba(13, 148, 136, 0.45);
  background: rgba(13, 148, 136, 0.07);
}

.itinerary-event.upcoming {
  opacity: 0.94;
}

.itinerary-event.starts-soon {
  box-shadow: 0 0 0 1px rgba(245, 158, 11, 0.45);
}

.itinerary-event-time {
  font-size: 10px;
  font-weight: 600;
  color: #64748B;
  margin-bottom: 3px;
}

.itinerary-event-title {
  font-size: 12px;
  font-weight: 600;
  line-height: 1.3;
  color: #334155;
}

.itinerary-event-attachments {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-top: 6px;
  min-height: 18px;
}

.itinerary-event-attachment {
  width: 18px;
  height: 18px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: #0D9488;
  opacity: 0.82;
}

.itinerary-strip.collapsed {
  right: auto;
  width: 32px;
  min-height: 72px;
}

.itinerary-strip.collapsed .itinerary-header,
.itinerary-strip.collapsed .itinerary-timeline-wrap {
  display: none;
}

.itinerary-event-alert {
  margin-bottom: 6px;
  padding: 7px 8px;
  border-radius: 9px;
  background: rgba(245, 158, 11, 0.10);
  border: 1px solid rgba(245, 158, 11, 0.22);
}

.itinerary-event-alert-text {
  font-size: 10px;
  font-weight: 600;
  margin-bottom: 5px;
  color: #334155;
}

.itinerary-event-alert-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.itinerary-event-alert-button {
  border: none;
  background: transparent;
  color: #0D9488;
  font-size: 10px;
  font-weight: 600;
  padding: 2px 0;
  cursor: pointer;
}

.itinerary-event-note {
  width: 22px;
  height: 22px;
  margin-top: 6px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: none;
  background: transparent;
  color: #64748B;
  font-size: 15px;
  cursor: pointer;
  opacity: 0.72;
}

.itinerary-event-note:hover {
  opacity: 1;
}

.itinerary-empty-state {
  width: 100%;
  min-height: 54px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  border: none;
  background: transparent;
  color: #0D9488;
  cursor: pointer;
  font-family: var(--font-family);
}

.itinerary-empty-icon {
  font-size: 21px;
  line-height: 1;
  font-weight: 400;
}

.itinerary-empty-label {
  font-size: 12px;
  font-weight: 600;
}

#pillXp {
  background: rgba(245, 158, 11, 0.12);
  color: #334155;
  border: 1px solid rgba(245, 158, 11, 0.24);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  box-shadow: 0 8px 22px rgba(245, 158, 11, 0.12);
}

#pillGps {
  background: rgba(255, 255, 255, 0.16);
  color: #334155;
  border: 1px solid rgba(255, 255, 255, 0.58);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  box-shadow: 0 8px 22px rgba(15, 23, 42, 0.11);
}

#btnSimulateGps {
  border: none;
  border-radius: 999px;
  padding: 10px 14px;
  background: #FFFFFF;
  color: #334155;
  font-family: var(--font-family);
  font-size: 12px;
  font-weight: 600;
  box-shadow: var(--shadow-soft);
  cursor: pointer;
}


.map-controls .map-control-btn,
.map-controls .map-search-trigger {
  background: rgba(255, 255, 255, 0.16);
  color: #0D9488;
  border: 1px solid rgba(255, 255, 255, 0.58);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  box-shadow: 0 8px 22px rgba(15, 23, 42, 0.13);
}

#btnRecenter {
  box-shadow: 0 10px 26px rgba(13, 148, 136, 0.22);
}

.orientation-north-icon,
.orientation-heading-icon {
  color: #0D9488;
}

#btnCloseMenu {
  color: #ffffff;
}

/* Improved language selector */
.menu-language select {
  min-height: 44px;
  padding: 10px 38px 10px 12px;
  border-radius: 12px;
  border: 1px solid rgba(255, 255, 255, 0.28);
  background: rgba(30, 41, 59, 0.92);
  color: #f8fafc;
  font-size: 16px;
  line-height: 1.3;
}

/* Glass / liquid edge for floating buttons */
.btn-icon {
  border: 1px solid rgba(255, 255, 255, 0.86);
  box-shadow:
    0 8px 22px rgba(15, 23, 42, 0.13),
    inset 0 1px 0 rgba(255, 255, 255, 0.9),
    inset 0 -1px 0 rgba(148, 163, 184, 0.18);
}

/* Google Places search */
.map-search-container {
  width: 100%;
  border-radius: 999px;
  overflow: hidden;
  background: rgba(255, 255, 255, 0.92);
  border: 1px solid rgba(255, 255, 255, 0.84);
  box-shadow:
    0 8px 22px rgba(15, 23, 42, 0.12),
    inset 0 1px 0 rgba(255, 255, 255, 0.9),
    inset 0 -1px 0 rgba(148, 163, 184, 0.18);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
}

.map-search-container gmp-place-autocomplete {
  display: block;
  width: 100%;
  border-radius: 999px;
  overflow: hidden;
  color-scheme: light;
}

/* urbanXplorer Premium POI marker */
.map-poi-marker {
  width: 20px;
  height: 20px;
  padding: 0;
  border-radius: 50%;
  border: 2px solid rgba(255, 255, 255, 0.96);
  background: #f59e0b;
  cursor: pointer;
  box-shadow:
    0 2px 6px rgba(0, 0, 0, 0.22),
    0 0 0 0 rgba(245, 158, 11, 0.34);
  animation: premium-poi-pulse 2.8s ease-in-out infinite;
}

@keyframes premium-poi-pulse {
  0%,
  100% {
    box-shadow:
      0 2px 6px rgba(0, 0, 0, 0.22),
      0 0 0 0 rgba(245, 158, 11, 0.28);
  }

  50% {
    box-shadow:
      0 2px 8px rgba(0, 0, 0, 0.20),
      0 0 0 7px rgba(245, 158, 11, 0.10);
  }
}

#btnCloseMenu {
  position: relative;
  font-size: 0;
}

#btnCloseMenu::before,
#btnCloseMenu::after {
  content: '';
  position: absolute;
  left: 50%;
  top: 50%;
  width: 18px;
  height: 2px;
  background: #ffffff;
  border-radius: 2px;
  transform-origin: center;
}

#btnCloseMenu::before {
  transform: translate(-50%, -50%) rotate(45deg);
}

#btnCloseMenu::after {
  transform: translate(-50%, -50%) rotate(-45deg);
}

/* Collapsed itinerary handle */
.itinerary-strip.collapsed {
  left: -18px;
  right: auto;
  width: 58px;
  min-height: 48px;
  border-radius: 0 24px 24px 0;
  overflow: visible;
}

.itinerary-strip.collapsed .itinerary-toggle {
  width: 58px;
  flex: 0 0 58px;
  min-height: 48px;
  border-right: none;
  border-radius: 0 24px 24px 0;
  background: rgba(255, 255, 255, 0.96);
  box-shadow:
    0 8px 20px rgba(15, 23, 42, 0.14),
    inset 0 1px 0 rgba(255, 255, 255, 0.9);
}

.itinerary-strip.collapsed .itinerary-toggle-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  font-size: 22px;
  line-height: 1;
  transform: translateX(8px);
}

/* Itinerary docked / fullscreen states */
.itinerary-strip:not(.collapsed) {
  top: auto;
  bottom: 12px;
  left: 12px;
  right: 12px;
  min-height: 0;
  height: min(64vh, 620px);
  align-items: stretch;
  border-radius: 20px;
}

.itinerary-strip:not(.collapsed) .itinerary-toggle {
  width: 34px;
  flex: 0 0 34px;
  border-radius: 20px 0 0 20px;
}

.itinerary-strip:not(.collapsed) .itinerary-header {
  width: 118px;
  flex: 0 0 118px;
  padding: 12px 10px;
  flex-direction: column;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
}

.itinerary-strip:not(.collapsed) .itinerary-title {
  font-size: 13px;
}

.itinerary-expand {
  width: 32px;
  height: 32px;
  padding: 0;
  border: 1px solid rgba(51, 65, 85, 0.10);
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.82);
  color: #0D9488;
  font-size: 17px;
  line-height: 1;
  cursor: pointer;
}

.itinerary-strip:not(.collapsed) .itinerary-timeline-wrap {
  align-items: stretch;
}

.itinerary-strip:not(.collapsed) .itinerary-timeline {
  align-items: flex-start;
  padding: 14px 30px 18px;
}

.itinerary-strip.fullscreen {
  top: 12px;
  bottom: 12px;
  height: auto;
}

.itinerary-strip.fullscreen .itinerary-header {
  padding-top: 16px;
}

/* Itinerary top-anchored layout */
.itinerary-strip:not(.collapsed) {
  top: 76px;
  bottom: auto;
  left: 12px;
  right: 12px;
  height: auto;
  max-height: calc(100vh - 88px);
  align-items: stretch;
}

.itinerary-strip:not(.collapsed) .itinerary-timeline-wrap {
  min-height: 120px;
  max-height: calc(100vh - 120px);
  overflow: hidden;
}

.itinerary-strip:not(.collapsed) .itinerary-timeline {
  align-items: flex-start;
  overflow-x: auto;
  overflow-y: auto;
}

.itinerary-strip.fullscreen {
  top: 12px;
  bottom: 12px;
  height: auto;
  max-height: none;
}

.itinerary-strip.fullscreen .itinerary-timeline-wrap {
  max-height: none;
}

/* Itinerary top-anchored layout */
.itinerary-strip:not(.collapsed) {
  top: 76px;
  bottom: auto;
  left: 12px;
  right: 12px;
  height: auto;
  max-height: calc(100vh - 88px);
  align-items: stretch;
}

.itinerary-strip:not(.collapsed) .itinerary-timeline-wrap {
  min-height: 120px;
  max-height: calc(100vh - 120px);
  overflow: hidden;
}

.itinerary-strip:not(.collapsed) .itinerary-timeline {
  align-items: flex-start;
  overflow-x: auto;
  overflow-y: auto;
}

.itinerary-strip.fullscreen {
  top: 12px;
  bottom: 12px;
  height: auto;
  max-height: none;
}

.itinerary-strip.fullscreen .itinerary-timeline-wrap {
  max-height: none;
}

/* Route mode selector */
.destination-actions {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-bottom: 18px;
}

.route-actions {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 8px;
}

.route-mode {
  min-height: 42px;
  padding: 0;
  border: 1px solid rgba(13, 148, 136, 0.18);
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.72);
  color: #0D9488;
  font-family: var(--font-family);
  font-size: 20px;
  cursor: pointer;
  transition:
    transform 160ms ease,
    background 160ms ease,
    border-color 160ms ease,
    box-shadow 160ms ease;
}

.route-mode:active {
  transform: scale(0.96);
}

.route-mode.active {
  background: rgba(13, 148, 136, 0.10);
  border-color: rgba(13, 148, 136, 0.42);
  box-shadow: 0 5px 14px rgba(13, 148, 136, 0.12);
}

.route-mode:disabled {
  opacity: 0.38;
  cursor: default;
}

.destination-actions .destination-action-secondary {
  width: 100%;
}


/* Route origin selector */
.route-origin {
  position: relative;
  width: 100%;
}

.route-origin-button {
  width: 100%;
  min-height: 46px;
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 8px;

  padding: 9px 12px;

  border: 1px solid rgba(51, 65, 85, 0.10);
  border-radius: 14px;

  background: rgba(255, 255, 255, 0.88);
  color: #334155;

  text-align: left;
  cursor: pointer;
}

.route-origin-label {
  font-size: 11px;
  font-weight: 600;
  color: #64748B;
}

.route-origin-button strong {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;

  font-size: 13px;
  font-weight: 700;
  color: #0F172A;
}

.route-origin-chevron {
  font-size: 18px;
  line-height: 1;
  color: #0D9488;
}

.route-origin-button[aria-expanded="true"] .route-origin-chevron {
  transform: rotate(180deg);
}

.route-origin-menu {
  position: absolute;
  left: 0;
  right: 0;
  bottom: calc(100% + 8px);

  z-index: 20;

  padding: 6px;

  border: 1px solid rgba(51, 65, 85, 0.10);
  border-radius: 14px;

  background: rgba(255, 255, 255, 0.98);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);

  box-shadow: 0 12px 30px rgba(15, 23, 42, 0.16);
}

.route-origin-menu[hidden] {
  display: none;
}

.route-origin-menu button {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 10px;

  padding: 10px 11px;

  border: none;
  border-radius: 10px;

  background: transparent;
  color: #334155;

  font-size: 13px;
  text-align: left;
  cursor: pointer;
}

.route-origin-menu button:hover,
.route-origin-menu button:focus-visible {
  background: rgba(13, 148, 136, 0.08);
}


.route-origin-search {
  margin-top: 6px;
  padding: 4px;
}

.route-origin-search[hidden] {
  display: none;
}

.route-origin-map-prompt {
  margin-top: 6px;

  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;

  padding: 9px 10px;

  border-radius: 10px;
  background: rgba(13, 148, 136, 0.08);

  font-size: 12px;
  color: #334155;
}

.route-origin-map-prompt[hidden] {
  display: none;
}

.route-origin-map-prompt button {
  flex: 0 0 auto;

  border: none;
  border-radius: 8px;

  padding: 6px 9px;

  background: rgba(51, 65, 85, 0.08);
  color: #334155;

  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
}


/* Temporary compact state while choosing a route origin on the map */
.destination-sheet.origin-map-selecting {
  min-height: 0;
  height: auto;
  padding: 10px 12px;
}

.destination-sheet.origin-map-selecting .sheet-handle,
.destination-sheet.origin-map-selecting .destination-heading,
.destination-sheet.origin-map-selecting .route-actions,
.destination-sheet.origin-map-selecting .destination-action,
.destination-sheet.origin-map-selecting .destination-content,
.destination-sheet.origin-map-selecting .destination-audio,
.destination-sheet.origin-map-selecting .destination-enriched-badge,
.destination-sheet.origin-map-selecting .btn-minimize-sheet,
.destination-sheet.origin-map-selecting .route-origin-button,
.destination-sheet.origin-map-selecting .route-origin-menu,
.destination-sheet.origin-map-selecting .route-origin-search {
  display: none !important;
}

.destination-sheet.origin-map-selecting .destination-actions {
  display: block;
  margin: 0;
}

.destination-sheet.origin-map-selecting .route-origin {
  display: block;
}

.destination-sheet.origin-map-selecting .route-origin-map-prompt {
  display: flex;
  margin: 0;
}



/* Itinerary quick editor */

.itinerary-editor {
  position: fixed;
  inset: 0;
  z-index: 5000;
}

.itinerary-editor[hidden] {
  display: none;
}

.itinerary-editor-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(15, 23, 42, 0.34);
  backdrop-filter: blur(3px);
}

.itinerary-editor-card {
  position: absolute;
  left: 50%;
  bottom: 14px;
  transform: translateX(-50%);

  width: min(calc(100vw - 24px), 520px);
  max-height: calc(100vh - 28px);
  overflow-y: auto;

  padding: 10px 18px 18px;

  border-radius: 28px;
  background: rgba(255, 255, 255, 0.98);
  box-shadow: 0 20px 50px rgba(15, 23, 42, 0.22);
}

.itinerary-editor-handle {
  width: 48px;
  height: 5px;
  margin: 2px auto 14px;
  border-radius: 999px;
  background: #CBD5E1;
}

.itinerary-editor-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 16px;
}

.itinerary-editor-header h3 {
  margin: 0;
  color: #0F172A;
  font-size: 20px;
}

.itinerary-editor-close {
  width: 38px;
  height: 38px;
  border: none;
  border-radius: 50%;
  background: #F1F5F9;
  color: #334155;
  font-size: 24px;
  cursor: pointer;
}

.itinerary-editor-field {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 12px;
}

.itinerary-editor-field > span {
  color: #64748B;
  font-size: 12px;
  font-weight: 700;
}

.itinerary-editor-field input,
.itinerary-editor-field textarea,
.itinerary-editor-field select {
  width: 100%;
  box-sizing: border-box;

  padding: 11px 12px;

  border: 1px solid #E2E8F0;
  border-radius: 12px;

  background: #FFFFFF;
  color: #0F172A;

  font: inherit;
}

.itinerary-editor-field textarea {
  resize: vertical;
}

.itinerary-editor-time-grid {
  display: grid;
  grid-template-columns: 1.1fr 0.9fr 1fr;
  gap: 10px;
}

.itinerary-editor-unscheduled {
  display: flex;
  align-items: center;
  gap: 8px;

  margin: 2px 0 14px;

  color: #475569;
  font-size: 13px;
  font-weight: 600;
}

.itinerary-editor-location {
  margin-bottom: 16px;
  padding: 10px 12px;

  border-radius: 12px;

  background: rgba(13, 148, 136, 0.07);
  color: #334155;

  font-size: 12px;
  line-height: 1.4;
}

.itinerary-editor-actions {
  display: grid;
  grid-template-columns: 1fr 1.4fr;
  gap: 10px;
}

.itinerary-editor-actions button {
  min-height: 46px;
  border-radius: 999px;
  font: inherit;
  font-weight: 700;
  cursor: pointer;
}

.itinerary-editor-secondary {
  border: 1px solid #CBD5E1;
  background: #FFFFFF;
  color: #475569;
}

.itinerary-editor-primary {
  border: none;
  background: #0D9488;
  color: #FFFFFF;
}

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

  .itinerary-editor-time-grid .itinerary-editor-field:last-child {
    grid-column: 1 / -1;
  }
}


/* Route feedback popup */
.route-feedback {
  position: fixed;
  left: 50%;
  bottom: 24px;
  z-index: 1400;

  width: min(92vw, 420px);
  transform: translateX(-50%);

  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;

  padding: 12px 14px;

  border: 1px solid rgba(13, 148, 136, 0.16);
  border-radius: 16px;

  background: rgba(255, 255, 255, 0.96);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);

  box-shadow: 0 10px 28px rgba(15, 23, 42, 0.16);
}

.route-feedback[hidden] {
  display: none;
}

.route-feedback-main {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.route-feedback-icon {
  flex: 0 0 auto;
  font-size: 22px;
}

.route-feedback-text {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.route-feedback-text strong {
  font-size: 13px;
  color: #334155;
}

.route-feedback-text span {
  font-size: 12px;
  color: #64748B;
}

.route-feedback-close {
  flex: 0 0 auto;
  width: 30px;
  height: 30px;
  padding: 0;

  border: none;
  border-radius: 50%;

  background: rgba(51, 65, 85, 0.06);
  color: #334155;

  font-size: 20px;
  line-height: 1;
  cursor: pointer;
}

/* Route feedback popup: below header, without covering menu controls */
.route-feedback {
  top: 68px;
  bottom: auto;
  z-index: 1100;
}

/* If route feedback is visible, itinerary starts below it */
.itinerary-strip {
  top: var(--route-feedback-offset, 76px);
}

.itinerary-strip:not(.collapsed) {
  top: var(--route-feedback-offset, 76px);
}

.itinerary-strip.fullscreen {
  top: 12px;
}

/* Destination card compact route state */
.btn-minimize-sheet {
  position: absolute;
  top: 16px;
  right: 58px;
  z-index: 3;

  width: 38px;
  height: 38px;
  padding: 0;

  border: none;
  border-radius: 50%;

  background: rgba(255, 255, 255, 0.94);
  color: #334155;

  font-size: 22px;
  line-height: 1;
  cursor: pointer;

  box-shadow: 0 6px 18px rgba(15, 23, 42, 0.10);
}

.destination-route-compact {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;

  min-height: 58px;
  padding: 10px 12px;
}

.destination-route-compact[hidden] {
  display: none;
}

.destination-route-compact-main {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.destination-route-compact-main strong {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;

  color: #1E293B;
  font-size: 13px;
}

.destination-route-compact-main span {
  color: #64748B;
  font-size: 12px;
}

.destination-route-restore {
  flex: 0 0 auto;

  width: 42px;
  height: 42px;
  padding: 0;

  border: none;
  border-radius: 50%;

  background: #0D9488;
  color: #FFFFFF;

  font-size: 24px;
  font-weight: 700;
  line-height: 1;
  cursor: pointer;

  box-shadow: 0 8px 20px rgba(13, 148, 136, 0.26);
}

.destination-sheet.route-compact .destination-heading,
.destination-sheet.route-compact .destination-actions,
.destination-sheet.route-compact .destination-content,
.destination-sheet.route-compact .destination-audio,
.destination-sheet.route-compact .destination-enriched-badge,
.destination-sheet.route-compact .btn-minimize-sheet {
  display: none !important;
}

.destination-sheet.route-compact .destination-route-compact {
  display: flex;
}

/* Destination card action buttons alignment */
.btn-close-sheet,
.btn-minimize-sheet {
  top: 14px;
}

.btn-close-sheet {
  right: 14px;
}

.btn-minimize-sheet {
  right: 58px;
}

/* Compact card: keep restore + close side by side */
.destination-sheet.route-compact {
  padding-top: 8px;
}

.destination-sheet.route-compact .btn-close-sheet {
  top: 14px;
  right: 14px;
}

.destination-sheet.route-compact .destination-route-compact {
  padding-right: 94px;
}

.destination-sheet.route-compact .destination-route-restore {
  position: absolute;
  top: 14px;
  right: 56px;
  width: 38px;
  height: 38px;
  font-size: 22px;
}

.destination-sheet.route-compact .destination-route-compact-main {
  padding: 8px 0 8px 12px;
}


/* ==========================================================
   Itinerary command-center layout
   Authoritative overrides
   ========================================================== */

.itinerary-strip {
  touch-action: pan-x pan-y;
}

/* Open state: controls float, timeline gets the width */
.itinerary-strip:not(.collapsed) {
  display: block;

  top: 76px;
  bottom: auto;
  left: 12px;
  right: 12px;

  height: auto;
  min-height: 0;
  max-height: calc(100dvh - 88px);

  padding-top: 44px;

  overflow: hidden;
}

/* Remove the old reserved left column */
.itinerary-strip:not(.collapsed) .itinerary-toggle {
  position: absolute;
  top: 7px;
  left: 8px;
  z-index: 5;

  width: 32px;
  height: 32px;
  min-height: 32px;

  border: none;
  border-radius: 10px;

  background: rgba(241, 245, 249, 0.92);
}

/* Header becomes a lightweight top bar */
.itinerary-strip:not(.collapsed) .itinerary-header {
  position: absolute;
  top: 7px;
  left: 48px;
  right: 8px;
  z-index: 4;

  width: auto;
  height: 32px;
  min-height: 32px;

  padding: 0;

  display: flex;
  flex-direction: row;
  align-items: center;
  justify-content: space-between;

  border: none;
}

.itinerary-strip:not(.collapsed) .itinerary-title {
  font-size: 13px;
  font-weight: 700;
}

/* Timeline uses the complete available width */
.itinerary-strip:not(.collapsed) .itinerary-timeline-wrap {
  width: 100%;
  min-height: 0;
  max-height: none;

  overflow: hidden;
}

.itinerary-strip:not(.collapsed):not(.fullscreen)
.itinerary-timeline {
  width: 100%;
  min-height: 104px;

  padding: 8px 12px 14px;

  display: flex;
  flex-direction: row;
  align-items: stretch;
  gap: 10px;

  overflow-x: auto;
  overflow-y: hidden;

  scroll-snap-type: x proximity;
  scroll-padding-inline: 12px;

  touch-action: pan-x;
  overscroll-behavior-x: contain;
  -webkit-overflow-scrolling: touch;
}

/* Larger compact cards: usable information, still swipeable */
.itinerary-strip:not(.collapsed):not(.fullscreen)
.itinerary-event {
  flex: 0 0 auto;

  width: clamp(190px, 28vw, 260px);
  min-width: 190px;

  scroll-snap-align: start;
}

/* Start/end time becomes a primary metadata line */
.itinerary-event-time {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.01em;
}

.itinerary-event-title {
  font-size: 13px;
  font-weight: 700;
  line-height: 1.3;
}

.itinerary-event-content {
  margin-top: 5px;

  color: #64748B;
  font-size: 11px;
  line-height: 1.35;

  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;

  overflow: hidden;
}

/* Fullscreen = day command center, vertical */
.itinerary-strip.fullscreen {
  top: 12px;
  bottom: 12px;
  left: 12px;
  right: 12px;

  height: auto;
  max-height: none;

  padding-top: 48px;

  border-radius: 22px;
}

.itinerary-strip.fullscreen
.itinerary-timeline-wrap {
  height: calc(100dvh - 84px);
  max-height: none;

  overflow: hidden;
}

.itinerary-strip.fullscreen
.itinerary-timeline {
  height: 100%;

  padding: 10px 14px 24px;

  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 10px;

  overflow-x: hidden;
  overflow-y: auto;

  scroll-snap-type: none;

  touch-action: pan-y;
  overscroll-behavior-y: contain;
  -webkit-overflow-scrolling: touch;
}

.itinerary-strip.fullscreen
.itinerary-event {
  width: auto;
  min-width: 0;
  max-width: none;

  flex: 0 0 auto;

  padding: 14px 16px;
}

.itinerary-strip.fullscreen
.itinerary-event-time {
  font-size: 12px;
}

.itinerary-strip.fullscreen
.itinerary-event-title {
  margin-top: 2px;

  font-size: 16px;
}

.itinerary-strip.fullscreen
.itinerary-event-content {
  margin-top: 7px;

  font-size: 13px;

  display: block;
  overflow: visible;
}

/* Keep collapsed handle behaviour untouched */
.itinerary-strip.collapsed {
  padding-top: 0;
}



/* ==========================================================
   Itinerary visual system — liquid command center
   ========================================================== */

.itinerary-strip:not(.collapsed) {
  background:
    linear-gradient(
      145deg,
      rgba(255,255,255,0.91),
      rgba(240,253,250,0.86)
    );

  border:
    1px solid rgba(255,255,255,0.92);

  box-shadow:
    0 18px 46px rgba(15,23,42,0.13),
    inset 0 1px 0 rgba(255,255,255,0.96);

  backdrop-filter: blur(24px) saturate(145%);
  -webkit-backdrop-filter: blur(24px) saturate(145%);
}

.itinerary-strip:not(.collapsed)::before {
  content: '';
  position: absolute;
  inset: 0;
  pointer-events: none;

  background:
    radial-gradient(
      circle at 12% 0%,
      rgba(13,148,136,0.12),
      transparent 28%
    );

  border-radius: inherit;
}

.itinerary-event {
  position: relative;

  overflow: hidden;

  border:
    1px solid rgba(255,255,255,0.96);

  background:
    linear-gradient(
      145deg,
      rgba(255,255,255,0.94),
      rgba(248,250,252,0.82)
    );

  box-shadow:
    0 8px 24px rgba(15,23,42,0.08),
    inset 0 1px 0 rgba(255,255,255,0.96);

  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);

  cursor: pointer;

  transition:
    transform 180ms ease,
    box-shadow 180ms ease,
    border-color 180ms ease;
}

.itinerary-event::before {
  content: '';

  position: absolute;
  top: 0;
  left: 0;
  right: 0;

  height: 3px;

  background:
    linear-gradient(
      90deg,
      #0D9488,
      #2DD4BF,
      rgba(45,212,191,0.25)
    );
}

.itinerary-event:hover {
  transform: translateY(-2px);

  border-color:
    rgba(13,148,136,0.20);

  box-shadow:
    0 13px 30px rgba(15,23,42,0.12),
    inset 0 1px 0 rgba(255,255,255,0.98);
}

.itinerary-event.active {
  background:
    linear-gradient(
      145deg,
      rgba(240,253,250,0.98),
      rgba(204,251,241,0.72)
    );

  box-shadow:
    0 10px 28px rgba(13,148,136,0.16);
}

.itinerary-event-time {
  color: #0F766E;
}

.itinerary-event-title {
  color: #0F172A;
}

.itinerary-event-content {
  color: #64748B;
}

.itinerary-event-tool-row {
  display: flex;
  align-items: center;
  gap: 7px;

  margin-top: 9px;
}

.itinerary-event-tool {
  min-width: 28px;
  min-height: 27px;

  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 4px;

  padding: 4px 7px;

  border:
    1px solid rgba(13,148,136,0.12);

  border-radius: 999px;

  background:
    rgba(255,255,255,0.70);

  color: #0F766E;

  font-size: 11px;
  font-weight: 700;

  cursor: pointer;
}

.itinerary-event-tool.empty {
  color: #94A3B8;
  border-color: rgba(148,163,184,0.18);
}

.itinerary-event-route-preview {
  margin-left: auto;

  color: #475569;

  font-size: 11px;
  font-weight: 600;
}

.itinerary-expand,
.itinerary-toggle {
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);

  box-shadow:
    0 4px 14px rgba(15,23,42,0.08);
}


/* Editor refinements */

.itinerary-editor-card {
  background:
    linear-gradient(
      155deg,
      rgba(255,255,255,0.98),
      rgba(240,253,250,0.96)
    );

  backdrop-filter: blur(28px) saturate(145%);
  -webkit-backdrop-filter: blur(28px) saturate(145%);
}

.itinerary-editor-attachments {
  margin-bottom: 18px;
}

.itinerary-editor-section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;

  margin-bottom: 8px;

  color: #334155;

  font-size: 12px;
}

.itinerary-add-attachment {
  padding: 7px 10px;

  border-radius: 999px;

  background: rgba(13,148,136,0.09);
  color: #0F766E;

  font-weight: 700;

  cursor: pointer;
}

.itinerary-editor-attachment-list {
  display: flex;
  flex-direction: column;
  gap: 7px;
}

.itinerary-editor-attachment-item {
  display: flex;
  align-items: center;
  gap: 9px;

  padding: 9px 10px;

  border-radius: 11px;

  background: rgba(255,255,255,0.70);

  border: 1px solid rgba(51,65,85,0.08);
}

.itinerary-editor-attachment-open {
  flex: 1;

  overflow: hidden;

  border: none;
  background: transparent;

  color: #334155;

  text-align: left;

  white-space: nowrap;
  text-overflow: ellipsis;

  cursor: pointer;
}

.itinerary-editor-attachment-remove {
  border: none;
  background: transparent;

  color: #94A3B8;

  font-size: 18px;

  cursor: pointer;
}

.itinerary-editor-status {
  display: block;

  min-height: 16px;
  margin-top: 6px;

  color: #64748B;
}


/* Attachment viewer */

.itinerary-attachment-viewer {
  position: fixed;
  inset: 0;

  z-index: 6500;
}

.itinerary-attachment-viewer[hidden] {
  display: none;
}

.itinerary-attachment-viewer-backdrop {
  position: absolute;
  inset: 0;

  background: rgba(15,23,42,0.72);

  backdrop-filter: blur(8px);
}

.itinerary-attachment-viewer-card {
  position: absolute;

  top: 50%;
  left: 50%;

  transform: translate(-50%, -50%);

  width: min(92vw, 720px);
  height: min(86vh, 820px);

  padding: 48px 12px 12px;

  border-radius: 24px;

  background: rgba(255,255,255,0.98);

  box-shadow:
    0 24px 60px rgba(0,0,0,0.28);
}

.itinerary-attachment-viewer-close {
  position: absolute;

  top: 10px;
  right: 12px;

  width: 34px;
  height: 34px;

  border: none;
  border-radius: 50%;

  background: #F1F5F9;

  font-size: 22px;

  cursor: pointer;
}

.itinerary-attachment-viewer-content {
  width: 100%;
  height: 100%;
}

.itinerary-attachment-viewer-content img,
.itinerary-attachment-viewer-content iframe {
  width: 100%;
  height: 100%;

  object-fit: contain;

  border: none;
  border-radius: 14px;
}
