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

/* ── Design tokens ───────────────────────────────────────────────────────── */
:root {
  --tags-h:        0px;
  --bg:            #f2f2f7;
  --surface:       #ffffff;
  --surface2:      #e8e8ed;
  --glass:         rgba(255,255,255,0.82);
  --glass-border:  rgba(0,0,0,0.06);
  --text:          #1c1c1e;
  --text-muted:    #6c6c70;
  --accent:        #1c1c1e;
  --accent-dim:    rgba(0,0,0,0.07);
  --border:        rgba(0,0,0,0.10);
  --blur:          blur(24px) saturate(180%);
  --shadow-sm:     0 1px 3px rgba(0,0,0,0.07), 0 1px 2px rgba(0,0,0,0.04);
  --shadow:        0 8px 40px rgba(0,0,0,0.12), 0 2px 8px rgba(0,0,0,0.06);
  --shadow-sheet:  0 -2px 24px rgba(0,0,0,0.09);
  --header-h:      56px;
  --sheet-peek:    80px;
  --radius:        16px;
  --bus-ida:       #2563eb;
  --bus-volta:     #ea580c;
  --stop-normal:   #9ca3af;
  --stop-active:   #f59e0b;
  --user-color:    #10b981;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg:           #000000;
    --surface:      #1c1c1e;
    --surface2:     #2c2c2e;
    --glass:        rgba(28,28,30,0.88);
    --glass-border: rgba(255,255,255,0.07);
    --text:         #f2f2f7;
    --text-muted:   #8e8e93;
    --accent:       #f2f2f7;
    --accent-dim:   rgba(255,255,255,0.08);
    --border:       rgba(255,255,255,0.10);
    --shadow-sm:    0 1px 4px rgba(0,0,0,0.5);
    --shadow:       0 8px 40px rgba(0,0,0,0.7);
    --shadow-sheet: 0 -2px 24px rgba(0,0,0,0.5);
    --bus-ida:      #60a5fa;
    --bus-volta:    #fb923c;
    --stop-normal:  #555;
    --stop-active:  #fbbf24;
  }
}

/* ── Base ────────────────────────────────────────────────────────────────── */
html, body {
  height: 100%; width: 100%;
  overflow: hidden;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  font-size: 15px;
  background: var(--bg);
  color: var(--text);
  -webkit-font-smoothing: antialiased;
}

/* ── Header ──────────────────────────────────────────────────────────────── */
.top-bar {
  position: fixed;
  top: 0; left: 0; right: 0;
  height: calc(var(--header-h) + env(safe-area-inset-top, 0px));
  padding-top: env(safe-area-inset-top, 0px);
  background: var(--glass);
  backdrop-filter: var(--blur);
  -webkit-backdrop-filter: var(--blur);
  border-bottom: 1px solid var(--glass-border);
  display: flex;
  align-items: center;
  gap: 6px;
  padding-left: 14px;
  padding-right: 6px;
  z-index: 1000;
}

.app-brand { display: flex; align-items: center; flex-shrink: 0; }
.app-brand img { width: 30px; height: 30px; border-radius: 8px; }

/* Search */
.search-wrap {
  flex: 1;
  position: relative;
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 6px;
}

.search-mode-btn {
  flex-shrink: 0;
  background: var(--surface2);
  border: none;
  border-radius: 10px;
  padding: 8px;
  cursor: pointer;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  transition: background 0.15s, color 0.15s;
}
.search-mode-btn:hover  { color: var(--text); }
.search-mode-btn.active { background: var(--accent); color: var(--surface); }

.search-wrap input {
  flex: 1;
  min-width: 0;
  padding: 9px 16px;
  border: none;
  border-radius: 22px;
  background: var(--surface2);
  color: var(--text);
  font-size: 15px;
  outline: none;
  transition: box-shadow 0.18s, background 0.18s;
}
.search-wrap input::placeholder { color: var(--text-muted); }
.search-wrap input:focus {
  background: var(--surface);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 35%, transparent);
}

.line-dropdown {
  position: absolute;
  top: calc(100% + 8px);
  left: 0; right: 0;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 16px;
  max-height: 280px;
  overflow-y: auto;
  box-shadow: var(--shadow);
  z-index: 2000;
}
.line-dropdown:empty, .line-dropdown[hidden] { display: none; }

.line-opt {
  padding: 13px 16px;
  cursor: pointer;
  font-size: 15px;
  border-bottom: 1px solid var(--border);
  transition: background 0.12s;
}
.line-opt:last-child { border-bottom: none; }
.line-opt:hover, .line-opt:active { background: var(--surface2); }
.line-opt .cod { font-weight: 700; color: var(--accent); margin-right: 8px; }

/* Icon buttons */
.icon-btn {
  flex-shrink: 0;
  background: none;
  border: none;
  min-width: 44px;
  min-height: 44px;
  padding: 10px;
  border-radius: 12px;
  cursor: pointer;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.15s, color 0.12s, transform 0.1s;
}
.icon-btn:hover  { background: var(--accent-dim); color: var(--text); }
.icon-btn:active { transform: scale(0.88); }
.icon-btn.spinning svg { animation: spin 0.9s linear infinite; }

/* ── Map ─────────────────────────────────────────────────────────────────── */
#map {
  position: fixed;
  inset: calc(var(--header-h) + env(safe-area-inset-top, 0px) + var(--tags-h)) 0 var(--sheet-peek) 0;
  transition: bottom 0.3s ease;
}

/* ── Bottom sheet ────────────────────────────────────────────────────────── */
.sheet {
  position: fixed;
  inset: auto 0 0 0;
  height: calc(100dvh - var(--header-h) - env(safe-area-inset-top, 0px) - 28px);
  background: var(--surface);
  border-radius: 22px 22px 0 0;
  box-shadow: var(--shadow-sheet);
  transform: translateY(calc(100% - var(--sheet-peek)));
  transition: transform 0.34s cubic-bezier(0.4, 0, 0.2, 1);
  z-index: 500;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.sheet.open { transform: translateY(0); }
.sheet.mid  { transform: translateY(calc(100% - 46dvh)); }

.sheet-drag {
  width: 40px; height: 5px;
  background: var(--border);
  border-radius: 3px;
  margin: 12px auto 4px;
  flex-shrink: 0;
  cursor: grab;
  opacity: 0.55;
}

.sheet-peek-row {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 4px 18px 12px;
  flex-shrink: 0;
  cursor: pointer;
}

.sheet-peek-title {
  flex: 1;
  font-weight: 700;
  font-size: 16px;
  letter-spacing: -0.2px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.sheet-peek-sub {
  font-size: 13px;
  color: var(--text-muted);
  font-variant-numeric: tabular-nums;
  flex-shrink: 0;
}

.sheet-divider { height: 1px; background: var(--border); flex-shrink: 0; }

.sheet-body {
  flex: 1;
  overflow-y: auto;
  padding: 14px 16px calc(28px + env(safe-area-inset-bottom, 0px));
  overscroll-behavior: contain;
}

/* ── Sentido tabs ────────────────────────────────────────────────────────── */
/* Hidden by default; revealed via CSS when the sheet is fully open.
   On desktop (sidebar always visible) always shown. */
.sentido-tabs { display: none; gap: 8px; margin-bottom: 16px; }
.sheet.open .sentido-tabs { display: flex; }

.stab {
  flex: 1;
  padding: 8px 0;
  border: 1.5px solid var(--border);
  border-radius: 22px;
  background: none;
  color: var(--text-muted);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.18s;
  text-align: center;
}
.stab.active-ida   { border-color: var(--bus-ida);   background: var(--bus-ida);   color: white; }
.stab.active-volta { border-color: var(--bus-volta); background: var(--bus-volta); color: white; }
.stab.active-both  { border-color: transparent; background: linear-gradient(90deg, var(--bus-ida), var(--bus-volta)); color: white; }

/* ── Stop list ───────────────────────────────────────────────────────────── */
.stop-list { list-style: none; }

.stop-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 8px;
  border-bottom: 1px solid var(--border);
  cursor: pointer;
  border-radius: 10px;
  transition: background 0.12s;
}
.stop-item:last-child { border-bottom: none; }
.stop-item:hover, .stop-item:active { background: var(--surface2); }

.stop-icon-wrap {
  width: 38px; height: 38px;
  border-radius: 50%;
  background: var(--accent-dim);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  color: var(--text-muted);
}

.stop-info { flex: 1; min-width: 0; }
.stop-name { font-weight: 600; font-size: 14px; }
.stop-sub  { font-size: 12px; color: var(--text-muted); margin-top: 2px; }

.stop-eta {
  font-weight: 700;
  font-size: 14px;
  color: var(--accent);
  flex-shrink: 0;
  font-variant-numeric: tabular-nums;
}

/* ── Vehicle list ────────────────────────────────────────────────────────── */
.vehicle-list { list-style: none; }

.vehicle-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 8px;
  border-bottom: 1px solid var(--border);
}
.vehicle-item:last-child { border-bottom: none; }

.vdot {
  width: 12px; height: 12px;
  border-radius: 50%;
  flex-shrink: 0;
}
.vdot.ida   { background: var(--bus-ida); }
.vdot.volta { background: var(--bus-volta); }

.vehicle-info { flex: 1; min-width: 0; }
.v-line   { font-weight: 700; font-size: 14px; }
.v-detail { font-size: 12px; color: var(--text-muted); margin-top: 2px; }

.vehicle-eta {
  font-weight: 700;
  font-size: 14px;
  color: var(--accent);
  flex-shrink: 0;
  font-variant-numeric: tabular-nums;
}

/* ── Section header ──────────────────────────────────────────────────────── */
.sec-title {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.8px;
  color: var(--text-muted);
  padding: 12px 0 6px;
}

/* ── Loading / empty ─────────────────────────────────────────────────────── */
.center-msg {
  text-align: center;
  padding: 32px 16px;
  color: var(--text-muted);
  font-size: 14px;
  line-height: 1.5;
}

.spinner {
  display: inline-block;
  width: 22px; height: 22px;
  border: 2px solid var(--border);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
  vertical-align: middle;
}

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

/* ── Map markers ─────────────────────────────────────────────────────────── */
.stop-pin {
  border-radius: 50%;
  border: 2px solid white;
  box-shadow: 0 1px 5px rgba(0,0,0,0.28);
  transition: transform 0.15s;
}

.user-pin {
  width: 16px; height: 16px;
  background: var(--user-color);
  border: 3px solid white;
  border-radius: 50%;
  box-shadow: 0 0 0 4px rgba(16,185,129,0.25);
  animation: user-pulse 2s ease-in-out infinite;
}

@keyframes user-pulse {
  0%, 100% { box-shadow: 0 0 0 4px rgba(16,185,129,0.25); }
  50%       { box-shadow: 0 0 0 9px rgba(16,185,129,0.07); }
}

/* ── Route directional arrows (SVG animateMotion) ────────────────────────── */
.route-anim-arrow {
  visibility: hidden;
  pointer-events: none;
}
#map.zoom-arrows .route-anim-arrow {
  visibility: visible;
}

/* ── Leaflet overrides ───────────────────────────────────────────────────── */
.leaflet-container { background: var(--bg) !important; }

.leaflet-control-zoom a {
  background: var(--glass) !important;
  backdrop-filter: var(--blur);
  -webkit-backdrop-filter: var(--blur);
  color: var(--text) !important;
  border-color: var(--glass-border) !important;
}

.leaflet-popup-content-wrapper {
  background: var(--surface);
  color: var(--text);
  border-radius: 14px;
  box-shadow: var(--shadow);
}
.leaflet-popup-tip { background: var(--surface); }

.leaflet-control-attribution { display: none !important; }

/* ── Tags bar ────────────────────────────────────────────────────────────── */
.line-tags-bar {
  position: fixed;
  top: calc(var(--header-h) + env(safe-area-inset-top, 0px));
  left: 0; right: 0;
  height: var(--tags-h);
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 0 12px;
  overflow-x: auto;
  background: var(--glass);
  backdrop-filter: var(--blur);
  -webkit-backdrop-filter: var(--blur);
  border-bottom: 1px solid var(--glass-border);
  z-index: 999;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
}
.line-tags-bar::-webkit-scrollbar { display: none; }

.line-tag {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 4px 10px 4px 12px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 700;
  white-space: nowrap;
  color: white;
  flex-shrink: 0;
  cursor: pointer;
  opacity: 0.7;
  transition: opacity 0.15s, box-shadow 0.15s;
  text-shadow: 0 1px 2px rgba(0,0,0,0.2);
}
.line-tag.focused { opacity: 1; box-shadow: 0 0 0 2px white, 0 0 0 4px rgba(0,0,0,0.2); }

.tag-x { font-size: 13px; opacity: 0.8; padding: 1px 2px; cursor: pointer; }

/* ── Selected stop ───────────────────────────────────────────────────────── */
.stop-selected { background: var(--accent-dim) !important; border-radius: 10px; }
.stop-selected .stop-name { color: var(--accent); }

/* ── Timeline ────────────────────────────────────────────────────────────── */
.timeline { list-style: none; padding: 0 0 0 4px; }

.tl-item {
  display: flex;
  align-items: flex-start;
  position: relative;
  cursor: pointer;
  border-radius: 10px;
  padding: 1px 6px 1px 0;
  transition: background 0.12s;
}
.tl-item:hover, .tl-item:active { background: var(--surface2); }
.tl-item.tl-incoming { background: color-mix(in srgb, var(--bus-ida) 6%, transparent); }
.tl-item.tl-incoming:hover { background: color-mix(in srgb, var(--bus-ida) 10%, transparent); }

.tl-rail {
  display: flex;
  flex-direction: column;
  align-items: center;
  flex-shrink: 0;
  width: 30px;
}

.tl-dot {
  width: 10px; height: 10px;
  border-radius: 50%;
  flex-shrink: 0;
  z-index: 1;
  box-sizing: border-box;
  transition: transform 0.15s;
}
.tl-item:hover .tl-dot { transform: scale(1.2); }

.tl-dot.ida   { background: var(--bus-ida); }
.tl-dot.volta { background: var(--bus-volta); }
.tl-dot.both  { background: var(--stop-normal); }

.tl-dot.terminal { width: 13px; height: 13px; border-radius: 3px; }
.tl-dot.selected { width: 14px; height: 14px; background: #f59e0b !important; box-shadow: 0 0 0 3px rgba(245,158,11,0.3) !important; border: none !important; }
.tl-dot.passed   { width: 7px; height: 7px; background: var(--text-muted) !important; border: none !important; box-shadow: none !important; }

.tl-dot.upcoming { background: var(--surface) !important; box-shadow: none !important; }
.tl-dot.upcoming.ida   { border: 2px solid var(--bus-ida); }
.tl-dot.upcoming.volta { border: 2px solid var(--bus-volta); }
.tl-dot.upcoming.both  { border: 2px solid var(--stop-normal); }
.tl-dot.upcoming.terminal { border-width: 2.5px; }

.tl-dot.incoming { width: 13px; height: 13px; }
.tl-dot.incoming.ida   { box-shadow: 0 0 0 4px color-mix(in srgb, var(--bus-ida)   28%, transparent); animation: tl-pulse-ida   1.5s ease-in-out infinite; }
.tl-dot.incoming.volta { box-shadow: 0 0 0 4px color-mix(in srgb, var(--bus-volta) 28%, transparent); animation: tl-pulse-volta 1.5s ease-in-out infinite; }
.tl-dot.incoming.both  { box-shadow: 0 0 0 4px color-mix(in srgb, var(--stop-normal) 28%, transparent); }

@keyframes tl-pulse-ida {
  0%, 100% { box-shadow: 0 0 0 3px color-mix(in srgb, var(--bus-ida) 28%, transparent); }
  50%       { box-shadow: 0 0 0 9px color-mix(in srgb, var(--bus-ida)  8%, transparent); }
}
@keyframes tl-pulse-volta {
  0%, 100% { box-shadow: 0 0 0 3px color-mix(in srgb, var(--bus-volta) 28%, transparent); }
  50%       { box-shadow: 0 0 0 9px color-mix(in srgb, var(--bus-volta)  8%, transparent); }
}

.tl-line {
  width: 2px; flex: 1; min-height: 16px;
  background: var(--border);
}
.tl-line.passed.ida   { background: var(--bus-ida);     opacity: 0.7; width: 3px; }
.tl-line.passed.volta { background: var(--bus-volta);   opacity: 0.7; width: 3px; }
.tl-line.passed.both  { background: var(--stop-normal); opacity: 0.7; width: 3px; }
.tl-line.upcoming     { background: var(--border); opacity: 0.35; }
.tl-line.ida          { background: color-mix(in srgb, var(--bus-ida)   25%, var(--border)); }
.tl-line.volta        { background: color-mix(in srgb, var(--bus-volta) 25%, var(--border)); }
.tl-line.both         { background: var(--border); }

.tl-content { flex: 1; padding: 5px 0 5px 6px; min-width: 0; }
.tl-content.passed   { opacity: 0.35; }
.tl-content.upcoming { opacity: 0.6; }
.tl-content.incoming { opacity: 1; }

.tl-row { display: flex; align-items: center; gap: 6px; min-width: 0; }

.tl-name {
  flex: 1;
  font-size: 13px; font-weight: 500;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.tl-content.incoming .tl-name { font-weight: 700; font-size: 14px; }

.tl-sub { font-size: 11px; color: var(--text-muted); margin-top: 1px; }

.tl-buses { display: flex; gap: 3px; flex-shrink: 0; align-items: center; }
.tl-bus {
  font-size: 11px; font-weight: 700;
  padding: 2px 7px; border-radius: 9px;
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}
.tl-bus.ida   { background: var(--bus-ida);   color: white; }
.tl-bus.volta { background: var(--bus-volta); color: white; }

/* ── Favorites ───────────────────────────────────────────────────────────── */
.fav-list { list-style: none; }

.fav-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 13px 4px;
  border-bottom: 1px solid var(--border);
  cursor: pointer;
  border-radius: 10px;
  transition: background 0.12s;
}
.fav-item:last-child { border-bottom: none; }
.fav-item:active { background: var(--surface2); }

.fav-icon { font-size: 20px; flex-shrink: 0; }
.fav-info { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.fav-name { font-weight: 600; font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.fav-sub  { font-size: 12px; color: var(--text-muted); }
.fav-empty { font-size: 13px; color: var(--text-muted); padding: 4px 0 12px; }

.fav-btn-rm, .fav-btn-rename {
  background: none; border: none;
  cursor: pointer; padding: 8px;
  opacity: 0.45; flex-shrink: 0;
}
.fav-btn-rm:hover, .fav-btn-rename:hover { opacity: 1; }

.btn-back {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  background: none; border: none;
  color: var(--text-muted);
  font-size: 13px; font-weight: 600;
  cursor: pointer; padding: 4px 0;
  transition: color 0.15s;
}
.btn-back:hover { color: var(--text); }

.btn-fav-save {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  background: none;
  border: 1.5px solid var(--border);
  border-radius: 22px;
  padding: 5px 14px;
  font-size: 13px; font-weight: 600;
  color: var(--text-muted);
  cursor: pointer; margin-bottom: 12px;
  transition: border-color 0.15s, color 0.15s;
}
.btn-fav-save:hover { border-color: var(--accent); color: var(--text); }

/* ── ETA list ────────────────────────────────────────────────────────────── */
.eta-list { list-style: none; display: flex; flex-direction: column; gap: 6px; }

.eta-item {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  border-radius: 10px;
  padding: 4px 6px;
  transition: background 0.12s;
}
.eta-item[data-lid] { cursor: pointer; }
.eta-item[data-lid]:hover { background: var(--surface2); }

.eta-dir { min-width: 38px; font-weight: 600; color: var(--text-muted); }

.eta-badge {
  padding: 3px 9px; border-radius: 10px;
  font-size: 12px; font-weight: 700;
  font-variant-numeric: tabular-nums;
}
.eta-badge.passed   { background: color-mix(in srgb, #22c55e 15%, transparent); color: #22c55e; }
.eta-badge.upcoming { background: color-mix(in srgb, var(--accent) 10%, transparent); color: var(--text-muted); }

/* ── Welcome buttons ─────────────────────────────────────────────────────── */
.dev-badge {
  margin-left: auto;
  font-size: 10px;
  font-weight: 700;
  padding: 3px 7px;
  border-radius: 99px;
  background: color-mix(in srgb, #f97316 18%, transparent);
  color: #f97316;
  white-space: nowrap;
  letter-spacing: 0.02em;
  text-transform: uppercase;
}

.welcome-btn {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 16px 18px;
  border-radius: 14px;
  border: none;
  font-size: 15px; font-weight: 600;
  cursor: pointer;
  width: 100%;
  text-align: left;
  transition: opacity 0.15s, transform 0.12s;
}
.welcome-btn:active { transform: scale(0.975); opacity: 0.82; }
.welcome-btn.primary   { background: var(--accent); color: var(--surface); }
.welcome-btn.secondary { background: var(--surface2); color: var(--text); }

/* ── Floating controls group ─────────────────────────────────────────────── */
.float-group {
  position: fixed;
  bottom: calc(var(--sheet-peek) + 14px);
  left: 50%;
  transform: translateX(-50%);
  display: none;
  align-items: center;
  gap: 8px;
  z-index: 510;
  transition: bottom 0.34s cubic-bezier(0.4, 0, 0.2, 1);
}

.float-round-btn {
  width: 42px;
  height: 42px;
  border-radius: 50%;
  border: 1px solid var(--glass-border);
  background: var(--glass);
  backdrop-filter: var(--blur);
  -webkit-backdrop-filter: var(--blur);
  display: none;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  box-shadow: var(--shadow);
  color: var(--text);
  transition: transform 0.15s, opacity 0.15s;
  flex-shrink: 0;
}
.float-round-btn:active { transform: scale(0.9); opacity: 0.8; }

.sentido-float {
  display: none;
  background: var(--glass);
  backdrop-filter: var(--blur);
  -webkit-backdrop-filter: var(--blur);
  border: 1px solid var(--glass-border);
  border-radius: 30px;
  padding: 4px;
  gap: 2px;
  box-shadow: var(--shadow);
}

/* ── Vehicle tracker icon ─────────────────────────────────────────────────── */
.vt-icon-wrap {
  position: relative;
  width: 46px;
  height: 46px;
  flex-shrink: 0;
}
.vt-icon {
  width: 46px;
  height: 46px;
  border-radius: 50%;
  color: white;
  font-size: 13px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 2.5px solid rgba(255,255,255,0.95);
  box-shadow: 0 2px 8px rgba(0,0,0,0.3);
  position: relative;
  z-index: 1;
}
.vt-icon-ring {
  position: absolute;
  inset: -5px;
  border-radius: 50%;
  border: 2px solid;
  animation: vt-ring 2.2s ease-out infinite;
  opacity: 0;
}
@keyframes vt-ring {
  0%   { transform: scale(0.85); opacity: 0.7; }
  100% { transform: scale(1.55); opacity: 0; }
}

.sf-btn {
  padding: 8px 18px;
  border: none;
  border-radius: 26px;
  background: none;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-muted);
  cursor: pointer;
  transition: all 0.18s;
  white-space: nowrap;
}
.sf-btn:hover { color: var(--text); }
.sf-btn.active-ida   { background: var(--bus-ida);   color: white; }
.sf-btn.active-volta { background: var(--bus-volta); color: white; }
.sf-btn.active-both  { background: linear-gradient(90deg, var(--bus-ida), var(--bus-volta)); color: white; }

/* ── Closest stop card (nearby preview) ─────────────────────────────────── */
.closest-stop-card {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 12px;
  background: var(--surface2);
  border-radius: 14px;
  cursor: pointer;
  transition: background 0.12s;
}
.closest-stop-card:hover, .closest-stop-card:active { background: var(--border); }

.btn-more-stops {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  margin-top: 14px;
  padding: 12px 16px;
  border: 1.5px dashed var(--border);
  border-radius: 12px;
  background: none;
  color: var(--text-muted);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: border-color 0.15s, color 0.15s;
}
.btn-more-stops:hover { border-color: var(--accent); color: var(--text); }

/* ── Route planner ───────────────────────────────────────────────────────── */
.rp-input-wrap {
  position: relative;
  margin-bottom: 10px;
}
.rp-label {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.7px;
  color: var(--text-muted);
  margin-bottom: 5px;
}
.rp-input {
  width: 100%;
  padding: 12px 16px;
  border: 1.5px solid var(--border);
  border-radius: 12px;
  background: var(--surface2);
  color: var(--text);
  font-size: 14px;
  outline: none;
  transition: border-color 0.18s;
}
.rp-input:focus { border-color: var(--accent); }
.rp-dropdown {
  position: absolute;
  top: calc(100% + 4px);
  left: 0; right: 0;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  box-shadow: var(--shadow);
  z-index: 20;
  max-height: 200px;
  overflow-y: auto;
}
.rp-opt {
  padding: 11px 14px;
  cursor: pointer;
  font-size: 13px;
  border-bottom: 1px solid var(--border);
  transition: background 0.1s;
}
.rp-opt:last-child { border-bottom: none; }
.rp-opt:hover { background: var(--surface2); }
.rp-sect-label {
  padding: 6px 14px 4px;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text-muted);
  background: var(--surface2);
  border-bottom: 1px solid var(--border);
}
.rp-result-card {
  background: var(--surface2);
  border-radius: 14px;
  padding: 16px;
  margin-top: 12px;
}
.rp-step {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 8px 0;
  border-bottom: 1px solid var(--border);
}
.rp-step:last-child { border-bottom: none; }
.rp-step-num {
  width: 24px; height: 24px;
  border-radius: 50%;
  background: var(--accent);
  color: var(--surface);
  font-size: 12px;
  font-weight: 700;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
  margin-top: 1px;
}
.rp-step-body { flex: 1; min-width: 0; }
.rp-step-title { font-weight: 600; font-size: 14px; }
.rp-step-sub   { font-size: 12px; color: var(--text-muted); margin-top: 2px; }

/* ── Desktop sidebar ─────────────────────────────────────────────────────── */
@media (min-width: 640px) {
  .line-tags-bar { right: 340px; }

  #map { right: 340px; bottom: 0; transition: none; }

  .sheet {
    inset: calc(var(--header-h) + env(safe-area-inset-top, 0px) + var(--tags-h)) 0 0 auto;
    width: 340px;
    height: auto;
    border-radius: 0;
    border-left: 1px solid var(--border);
    box-shadow: none;
    transform: none !important;
  }

  .sheet-drag, .sheet-peek-row { display: none; }
  .sheet-body { padding-top: 16px; }
  .sentido-tabs { display: flex; } /* always visible in desktop sidebar */

  .float-group {
    bottom: 24px !important;
    top: auto !important;
    left: auto;
    right: 360px;
    transform: none;
  }
}

/* ── Search bar expands on mobile when focused ───────────────────────────── */
@media (max-width: 639px) {
  .top-bar.search-active .app-brand,
  .top-bar.search-active .icon-btn { display: none; }
}

/* ── Scrollbar ───────────────────────────────────────────────────────────── */
::-webkit-scrollbar { width: 4px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 2px; }

/* Tema escuro dos tiles OSM (CARTO dark_all passou a exigir API key) */
.tiles-dark .osm-tiles {
  filter: invert(1) hue-rotate(180deg) brightness(.95) contrast(.9) saturate(.6);
}
