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

:root {
  --bg: #0d2137;
  --bg2: #112a45;
  --card: #112a45;
  --card2: #163050;
  --border: rgba(255,255,255,0.07);
  --text: #e2f0f9;
  --sub: #8ba8c4;
  --dim: #4a6a84;
  --teal: #2dd4bf;
  --green: #4ade80;
  --cyan: #22d3ee;
  --red: #f43f5e;
  --orange: #fb923c;
  --grad: linear-gradient(135deg, var(--teal), var(--green));
  --r: 8px;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'SF Pro Text', 'Inter', system-ui, sans-serif;
  height: 100dvh; overflow: hidden;
  background: var(--bg); color: var(--text);
  -webkit-font-smoothing: antialiased;
}
.hidden { display: none !important; }

/* ── Map ─────────────────────────────────── */
#map { position: fixed; inset: 0; z-index: 0; }
.leaflet-control-zoom, .leaflet-popup { display: none !important; }
.leaflet-control-attribution { font-size: 7px !important; opacity: 0.2; }

/* ═══ HEADER ═════════════════════════════ */
#hd {
  position: fixed; top: 0; left: 0; right: 0; z-index: 710;
  display: flex; align-items: center; justify-content: center;
  height: 52px;
  background: rgba(13,33,55,0.94);
  backdrop-filter: blur(16px); -webkit-backdrop-filter: blur(16px);
  border-bottom: 1px solid var(--border);
}

#logo-icon { height: 1.5rem; width: 1.5rem; margin-right: 8px; }

#logo {
  font-size: 1.5rem; font-weight: 800; letter-spacing: 0.25em;
  background: var(--grad);
  -webkit-background-clip: text; -webkit-text-fill-color: transparent; background-clip: text;
}

/* ═══ TOOLBAR (en rad) ═══════════════════ */
#tb {
  position: fixed; top: 52px; left: 0; right: 0; z-index: 700;
  display: flex; align-items: center; gap: 4px;
  height: 34px;
  padding: 0 8px;
  background: rgba(13,33,55,0.9);
  backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
}

.tb-sep { width: 1px; height: 18px; background: var(--border); flex-shrink: 0; }

.tb-btn {
  padding: 4px 8px; border-radius: 5px;
  border: 1px solid var(--border); background: transparent;
  color: var(--sub); font-size: 0.62rem; font-weight: 700;
  cursor: pointer; white-space: nowrap;
}
.tb-btn:active { background: rgba(255,255,255,0.04); }
.tb-btn.icon { padding: 4px 6px; font-size: 0.75rem; }
.tb-btn.primary {
  background: var(--teal); color: var(--bg);
  border-color: var(--teal); font-weight: 800;
}
.tb-btn.primary:active { opacity: 0.85; }

#region-select {
  padding: 4px 20px 4px 7px;
  border-radius: 5px; border: 1px solid var(--border);
  background: var(--bg2); color: var(--text);
  font-size: 0.62rem; font-weight: 600;
  cursor: pointer; outline: none;
  -webkit-appearance: none; appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='8' height='5'%3E%3Cpath d='M0 0l4 5 4-5' fill='%236b8fac'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 5px center;
}
#region-select option { background: var(--bg); }

.tb-tog {
  display: flex; align-items: center; gap: 3px;
  font-size: 0.6rem; color: var(--sub); cursor: pointer;
  padding: 4px 7px; border-radius: 5px;
  border: 1px solid var(--border); white-space: nowrap;
}
.tb-tog input { display: none; }
.tb-tog:has(input:checked) { border-color: var(--teal); color: var(--teal); }

.fbtn {
  display: flex; align-items: center; gap: 3px;
  padding: 3px 7px; border-radius: 12px;
  border: 1px solid var(--border); background: transparent;
  color: var(--sub); font-size: 0.58rem; font-weight: 700;
  cursor: pointer; transition: all 0.15s;
}
.fbtn.on { color: var(--text); border-color: rgba(255,255,255,0.12); background: rgba(255,255,255,0.04); }
.fd { width: 6px; height: 6px; border-radius: 50%; background: var(--c); }
.fbtn:not(.on) .fd { opacity: 0.2; }

#tb-live {
  margin-left: auto;
  display: flex; align-items: center; gap: 4px;
  font-size: 0.58rem; color: var(--sub); white-space: nowrap;
}
#live-dot { width: 5px; height: 5px; border-radius: 50%; background: var(--dim); }
#live-dot.on { background: var(--green); box-shadow: 0 0 6px rgba(74,222,128,0.4); }
#v-count { font-weight: 700; color: var(--text); }

/* ── Paneler (trip, search) — desktop ────── */
#trip-bar, #search-bar {
  position: fixed; top: 94px; left: 10px; z-index: 700;
  background: rgba(17,42,69,0.95);
  backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px);
  border: 1px solid var(--border);
  border-radius: var(--r);
  padding: 12px;
  box-shadow: 0 8px 30px rgba(0,0,0,0.4);
  animation: fadeIn .15s ease;
  max-height: 70dvh; overflow-y: auto;
}

#trip-bar { width: 340px; }
#search-bar { width: 300px; }

#trip-bar .tp-f { margin-bottom: 6px; }
#trip-bar .tp-fl { margin-bottom: 6px; }
#trip-bar .tp-go { margin-bottom: 6px; }
#trip-results { max-height: 40dvh; overflow-y: auto; scrollbar-width: none; }

#search {
  width: 100%; padding: 10px 14px; border-radius: var(--r);
  border: 1px solid var(--border); background: var(--card2);
  color: var(--text); font-size: 0.85rem; outline: none;
}
#search::placeholder { color: var(--dim); }
#search:focus { border-color: var(--teal); }
#search-list { margin-top: 6px; border-radius: var(--r); background: var(--card2); border: 1px solid var(--border); overflow: hidden; max-height: 250px; overflow-y: auto; }
.s-item { padding: 12px 14px; font-size: 0.82rem; cursor: pointer; border-bottom: 1px solid var(--border); }
.s-item:last-child { border-bottom: none; }
.s-item:active { background: rgba(255,255,255,0.03); }

/* ── Follow ──────────────────────────────── */
#follow {
  position: fixed; top: 94px; left: 50%; transform: translateX(-50%); z-index: 720;
  display: flex; align-items: center; gap: 8px;
  padding: 6px 10px 6px 14px; border-radius: 20px;
  background: var(--teal); color: var(--bg);
  font-size: 0.7rem; font-weight: 700;
  box-shadow: 0 4px 16px rgba(45,212,191,0.3);
}
#follow-end { width: 20px; height: 20px; border-radius: 50%; border: none; background: rgba(0,0,0,0.15); color: var(--bg); font-size: 0.6rem; cursor: pointer; }

/* ═══ STOPS PANEL ════════════════════════ */
#stops-panel {
  position: fixed;
  right: 10px; top: 94px; bottom: 10px;
  width: 260px;
  z-index: 600;
  background: rgba(13,33,55,0.9);
  backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px);
  border: 1px solid var(--border);
  border-radius: 12px;
  overflow-y: auto;
  scrollbar-width: thin; scrollbar-color: var(--dim) transparent;
  display: flex; flex-direction: column;
}

#sp-empty {
  flex: 1; display: flex; align-items: center; justify-content: center;
}

#sp-placeholder {
  color: var(--dim); font-size: 0.72rem; text-align: center; padding: 20px;
  line-height: 1.5;
}

#sp-content { padding: 12px; }

.sp-head {
  display: flex; align-items: center; gap: 8px;
  margin-bottom: 10px; padding-bottom: 8px;
  border-bottom: 1px solid var(--border);
}
.sp-dot { width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0; }
.sp-title { font-size: 0.78rem; font-weight: 700; flex: 1; }
.sp-speed { font-size: 0.68rem; font-weight: 700; color: var(--sub); }
.sp-close { width: 22px; height: 22px; border-radius: 50%; border: none; background: var(--card2); color: var(--sub); font-size: 0.7rem; cursor: pointer; }

.sp-next {
  display: flex; align-items: center; justify-content: space-between;
  padding: 6px 0; margin-bottom: 4px;
}
.sp-next-left { display: flex; flex-direction: column; gap: 1px; }
.sp-next-label { font-size: 0.48rem; font-weight: 700; color: var(--dim); text-transform: uppercase; letter-spacing: 0.5px; }
.sp-next-name { font-size: 0.78rem; font-weight: 600; }
.sp-next-time { font-size: 0.88rem; font-weight: 800; color: var(--teal); }

.sp-stops-label { font-size: 0.5rem; font-weight: 700; color: var(--dim); text-transform: uppercase; letter-spacing: 0.8px; margin-bottom: 4px; }

.sp-row { display: flex; align-items: center; gap: 6px; padding: 3px 0; }
.sp-row.p { opacity: 0.15; }
.sp-row.n .sp-time { color: var(--text); font-weight: 800; }
.sp-row.n .sp-name { font-weight: 700; }
.sp-time { font-size: 0.65rem; font-weight: 600; color: var(--dim); width: 32px; flex-shrink: 0; font-variant-numeric: tabular-nums; }
.sp-rdot { width: 4px; height: 4px; border-radius: 50%; flex-shrink: 0; }
.sp-row.n .sp-rdot { width: 6px; height: 6px; box-shadow: 0 0 0 2px rgba(45,212,191,0.2); }
.sp-name { font-size: 0.7rem; flex: 1; }

.sp-btns { display: flex; gap: 4px; margin-bottom: 14px; }
.sp-btn {
  flex: 1; padding: 6px; border-radius: 6px;
  border: 1px solid var(--border); background: transparent;
  font-size: 0.65rem; font-weight: 700; color: var(--sub); cursor: pointer;
}
.sp-btn:active { background: rgba(255,255,255,0.03); }
.sp-btn.f { border-color: var(--teal); color: var(--teal); }
.sp-btn.f.on { background: var(--teal); color: var(--bg); }

/* ═══ CARD ═══════════════════════════════ */
#card {
  position: fixed; bottom: 16px; left: 10px; z-index: 800;
  width: 300px; max-height: 50dvh;
  overflow-y: auto;
  padding: 12px 12px 16px;
  background: rgba(17,42,69,0.95);
  backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px);
  border: 1px solid var(--border);
  border-radius: var(--r);
  box-shadow: 0 8px 30px rgba(0,0,0,0.4);
  animation: fadeIn .15s ease;
  scrollbar-width: none;
}
#card::-webkit-scrollbar { display: none; }
.card-bar { display: none; }
.card-x { float: right; width: 22px; height: 22px; border-radius: 50%; border: none; background: var(--card2); color: var(--sub); font-size: 0.7rem; cursor: pointer; position: relative; z-index: 10; margin-bottom: 8px; }

/* ── Departures ──────────────────────────── */
.dep-h { font-size: 0.82rem; font-weight: 800; margin-bottom: 2px; }
.dep-sub { font-size: 0.55rem; font-weight: 700; color: var(--dim); text-transform: uppercase; letter-spacing: 0.5px; margin-bottom: 8px; }
.dr { display: flex; align-items: center; gap: 6px; padding: 6px 8px; background: var(--card2); border-radius: 6px; margin-bottom: 3px; }
.dr-l { min-width: 28px; padding: 2px 5px; border-radius: 4px; color: var(--bg); font-weight: 800; font-size: 0.62rem; text-align: center; }
.dr-d { flex: 1; font-size: 0.68rem; color: var(--text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.dr-t { font-size: 0.72rem; font-weight: 800; color: #fff; flex-shrink: 0; }
.dr-late { color: var(--red); font-size: 0.6rem; font-weight: 700; margin-left: 2px; }

/* ── Trip ────────────────────────────────── */
.tp-h { font-size: 0.88rem; font-weight: 800; margin-bottom: 10px; }
.tp-f { display: flex; flex-direction: column; position: relative; margin-bottom: 8px; }
.tp-f input { padding: 10px 12px; background: var(--card2); border: 1px solid rgba(255,255,255,0.1); color: var(--text); font-size: 0.8rem; outline: none; }
.tp-f input:first-child { border-radius: 8px 8px 0 0; }
.tp-f input:last-of-type { border-radius: 0 0 8px 8px; border-top: none; }
.tp-f input::placeholder { color: var(--sub); }
.tp-f input:focus { border-color: rgba(45,212,191,0.4); z-index: 1; }
.tp-sw { position: absolute; right: 8px; top: 50%; transform: translateY(-50%); width: 22px; height: 22px; border-radius: 50%; background: var(--teal); color: var(--bg); display: flex; align-items: center; justify-content: center; font-size: 0.6rem; cursor: pointer; z-index: 2; border: none; }
.tp-fl { display: flex; gap: 4px; margin-bottom: 8px; }
.tp-c { flex: 1; padding: 6px; border-radius: 6px; background: var(--card2); border: 1px solid var(--border); color: var(--sub); font-size: 0.68rem; font-weight: 700; text-align: center; cursor: pointer; }
.tp-c:has(input:checked) { border-color: rgba(45,212,191,0.4); color: var(--teal); }
.tp-c input { display: none; }
.tp-go { width: 100%; padding: 10px; border-radius: 8px; background: rgba(45,212,191,0.8); border: none; color: var(--bg); font-size: 0.8rem; font-weight: 800; cursor: pointer; margin-bottom: 10px; }
.tp-go:hover { background: var(--teal); }

.tc { background: var(--card2); border-radius: 10px; overflow: hidden; margin-bottom: 8px; border: 1px solid var(--border); }
.tc-top { display: flex; justify-content: space-between; align-items: center; padding: 12px 14px; }
.tc-t { font-size: 1rem; font-weight: 800; color: #fff; }
.tc-a { color: var(--sub); font-size: 0.8rem; font-weight: 500; }
.tc-dur { font-size: 0.78rem; font-weight: 700; color: var(--text); text-align: right; }
.tc-ch { font-size: 0.58rem; color: var(--sub); display: block; margin-top: 1px; }
.tc-legs { padding: 4px 14px 10px; display: flex; gap: 4px; flex-wrap: wrap; align-items: center; }
.tc-b { padding: 4px 8px; border-radius: 5px; color: var(--bg); font-size: 0.65rem; font-weight: 800; }
.tc-s { color: var(--dim); font-size: 0.65rem; }
.tc-det { border-top: 1px solid var(--border); }
.tc-det summary { padding: 8px 14px; font-size: 0.68rem; color: var(--teal); cursor: pointer; font-weight: 700; }
.tc-det-in { padding: 0 14px 12px; }
.tl { display: flex; gap: 6px; min-height: 40px; }
.tl.w { min-height: 16px; }
.tl-b { display: flex; flex-direction: column; align-items: center; width: 8px; flex-shrink: 0; }
.tl-d { width: 5px; height: 5px; border-radius: 50%; border: 1.5px solid; background: var(--card); flex-shrink: 0; z-index: 1; }
.tl-l { flex: 1; width: 1.5px; margin: -1px 0; min-height: 6px; }
.tl-l.da { background: repeating-linear-gradient(to bottom, var(--dim), var(--dim) 2px, transparent 2px, transparent 5px) !important; }
.tl-i { flex: 1; display: flex; flex-direction: column; justify-content: space-between; }
.tl-s { font-size: 0.68rem; color: var(--text); }
.tl-s b { margin-right: 3px; color: #fff; }
.tl-m { display: flex; align-items: center; gap: 4px; padding: 1px 0; }
.tl-badge { padding: 2px 6px; border-radius: 4px; color: var(--bg); font-size: 0.6rem; font-weight: 800; }
.tl-dir { font-size: 0.6rem; color: var(--sub); }
.tl-wt { font-size: 0.64rem; color: var(--sub); }

/* ── Alerts ──────────────────────────────── */
.al-h { font-size: 0.88rem; font-weight: 800; margin-bottom: 10px; }
.al-count { font-size: 0.65rem; font-weight: 600; color: var(--dim); }

.al {
  border-radius: 8px; background: var(--card2);
  border-left: 3px solid var(--orange);
  margin-bottom: 5px;
}
.al.sev { border-left-color: var(--red); }

.al-t {
  font-size: 0.72rem; font-weight: 700;
  padding: 10px;
  cursor: pointer;
  list-style: none;
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
}

.al-t::after {
  content: '';
  width: 5px; height: 5px;
  border-right: 1.5px solid var(--sub);
  border-bottom: 1.5px solid var(--sub);
  transform: rotate(-45deg);
  flex-shrink: 0;
  transition: transform 0.2s;
}

.al[open] .al-t::after { transform: rotate(45deg); }
.al-t::-webkit-details-marker { display: none; }

.al-d {
  font-size: 0.68rem; color: var(--sub); line-height: 1.6;
  padding: 0 10px 10px;
  border-top: 1px solid var(--border);
  padding-top: 8px;
}

/* ── About ───────────────────────────────── */
.about-title { font-size: 0.92rem; font-weight: 800; margin-bottom: 12px; }
.about-text { font-size: 0.72rem; color: var(--sub); line-height: 1.6; margin-bottom: 8px; }
.about-section { margin-bottom: 12px; }
.about-label { font-size: 0.58rem; font-weight: 700; color: var(--dim); text-transform: uppercase; letter-spacing: 0.5px; margin-bottom: 4px; }
.about-link { display: inline-block; font-size: 0.7rem; font-weight: 600; color: var(--teal); text-decoration: none; }
.about-dev { display: inline-flex; align-items: center; gap: 6px; font-size: 0.78rem; font-weight: 700; color: var(--teal); text-decoration: none; padding: 6px 0; }
.about-footer { font-size: 0.58rem; color: var(--dim); margin-top: 12px; padding-top: 8px; border-top: 1px solid var(--border); }

/* Stats */
.stats-h { font-size: 0.88rem; font-weight: 800; margin-bottom: 12px; padding-right: 30px; }
.stats-chart { display: flex; align-items: flex-end; gap: 3px; height: 100px; margin-bottom: 12px; padding-top: 16px; }
.stats-bar { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 3px; min-width: 0; }
.stats-bar-fill { width: 100%; border-radius: 3px 3px 0 0; min-height: 2px; background: var(--teal); position: relative; }
.stats-bar:last-child .stats-bar-fill { opacity: 0.4; }
.stats-bar-count { font-size: 0.55rem; font-weight: 800; color: var(--text); position: absolute; top: -14px; left: 50%; transform: translateX(-50%); }
.stats-bar-label { font-size: 0.55rem; color: var(--sub); }
.stats-bar-line { width: 100%; height: 2px; background: var(--teal); opacity: 0.3; border-radius: 1px; }
.stats-summary { display: flex; gap: 10px; padding-top: 10px; border-top: 1px solid var(--border); }
.stats-item { text-align: center; flex: 1; }
.stats-val { font-size: 1rem; font-weight: 800; display: block; color: var(--text); }
.stats-label { font-size: 0.58rem; color: var(--sub); text-transform: uppercase; letter-spacing: 0.5px; }

/* ── Vehicle dots ────────────────────────── */
.vdot { border-radius: 50%; box-shadow: 0 0 8px rgba(0,0,0,0.3); cursor: pointer; border: 1.5px solid rgba(255,255,255,0.1); }
.vdot:hover { transform: scale(1.4); }
.vdot.follow { border-color: #fff; box-shadow: 0 0 0 3px rgba(45,212,191,0.2), 0 0 8px rgba(0,0,0,0.3); animation: pulse 2s infinite; }
@keyframes pulse { 0%,100% { box-shadow: 0 0 0 3px rgba(45,212,191,0.2); } 50% { box-shadow: 0 0 0 6px rgba(45,212,191,0.06); } }
.stop-dot { width: 4px; height: 4px; background: rgba(148,163,184,0.3); border-radius: 50%; }
.rs { border-radius: 50%; border: 1.5px solid; }
.rs.next { box-shadow: 0 0 0 3px rgba(45,212,191,0.2); }
.spinner { width: 16px; height: 16px; border: 2px solid var(--border); border-top-color: var(--teal); border-radius: 50%; animation: spin .6s linear infinite; margin: 14px auto; }
@keyframes spin { to { transform: rotate(360deg); } }
.empty { text-align: center; padding: 16px; color: var(--dim); font-size: 0.72rem; }

/* ── Light ───────────────────────────────── */
body.light { --bg: #f0f4f8; --bg2: #e2e8f0; --card: #fff; --card2: #f0f4f8; --border: rgba(0,0,0,0.08); --text: #0d2137; --sub: #64748b; --dim: #94a3b8; }
body.light #hd, body.light #tb, body.light #stops-panel { background: rgba(240,244,248,0.94); }
body.light #search { background: rgba(255,255,255,0.95); }
body.light #region-select { background: var(--card); }
body.light .vdot { box-shadow: 0 0 4px rgba(0,0,0,0.15); border-color: rgba(0,0,0,0.08); }

@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }

/* ── Mobil navbar (dold på desktop) ────── */
#mob-nav, #mob-filter, #mob-more { display: none; }

/* ── Mobile ──────────────────────────────── */
@media (max-width: 768px) {
  /* Dölj desktop toolbar */
  #tb { display: none; }
  #hd { height: 44px; }
  #logo { font-size: 1.1rem; letter-spacing: 0.18em; }
  #logo-icon { height: 1.1rem; width: 1.1rem; margin-right: 5px; }

  /* Bottom navbar */
  #mob-nav {
    display: flex;
    position: fixed;
    bottom: 0; left: 0; right: 0;
    z-index: 800;
    height: calc(68px + env(safe-area-inset-bottom, 0px));
    padding: 8px 0 calc(8px + env(safe-area-inset-bottom, 0px));
    background: rgba(13,33,55,0.95);
    backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px);
    border-top: 1px solid var(--border);
  }

  /* Extra höjd i PWA standalone-läge */
  @media (display-mode: standalone) {
    #mob-nav {
      height: calc(78px + env(safe-area-inset-bottom, 0px));
      padding: 10px 0 calc(12px + env(safe-area-inset-bottom, 0px));
    }
    #trip-bar, #search-bar, #mob-filter, #mob-more {
      bottom: calc(78px + env(safe-area-inset-bottom, 0px)) !important;
    }
  }

  .nav-btn {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 2px;
    border: none;
    background: transparent;
    color: var(--sub);
    font-size: 0.55rem;
    font-weight: 600;
    cursor: pointer;
    transition: color 0.15s;
  }

  .nav-btn.active { color: var(--teal); }
  .nav-icon { width: 22px; height: 22px; opacity: 0.8; }
  .nav-btn.active .nav-icon { opacity: 1; filter: brightness(1.5) saturate(1.5); }

  /* Alla paneler som bottom-sheets på mobil */
  #trip-bar, #search-bar, #mob-filter, #mob-more {
    position: fixed !important;
    top: auto !important; left: 0 !important; right: 0 !important;
    bottom: calc(68px + env(safe-area-inset-bottom, 0px)) !important;
    width: 100% !important;
    max-height: 65dvh;
    border-radius: 16px 16px 0 0;
    border: none;
    border-top: 1px solid var(--border);
    box-shadow: 0 -4px 20px rgba(0,0,0,0.4);
    animation: up .2s cubic-bezier(.32,.72,0,1);
    padding: 16px;
    z-index: 810 !important;
  }

  #search { font-size: 0.88rem; padding: 12px 14px; }
  #search-list { max-height: 40dvh; }
  #trip-results { max-height: 45dvh; }
  #follow { top: 48px; }

  #card {
    left: 0 !important; right: 0 !important; width: 100% !important;
    bottom: calc(68px + env(safe-area-inset-bottom, 0px)) !important;
    max-height: 55dvh;
    border-radius: 16px 16px 0 0;
    z-index: 810;
  }

  @media (display-mode: standalone) {
    #card {
      bottom: calc(78px + env(safe-area-inset-bottom, 0px)) !important;
    }
  }

  /* Sidopanel overlay */
  #stops-panel {
    position: fixed; inset: 0;
    width: 100%; height: 100%;
    border-radius: 0;
    background: rgba(13,33,55,0.6);
    backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px);
    z-index: 850;
    display: flex; align-items: flex-end;
    padding: 0 0 68px; /* space for navbar */
  }

  #stops-panel:has(#sp-empty:not(.hidden)) { display: none; }

  #sp-content {
    width: 100%;
    max-height: 70dvh;
    background: var(--card);
    border-radius: 16px 16px 0 0;
    border-top: 2px solid var(--teal);
    padding: 14px;
    overflow-y: auto;
    animation: up .25s cubic-bezier(.32,.72,0,1);
  }

  #sp-empty { display: none; }

  /* Filter/mer panel visibility */
  #mob-filter:not(.hidden), #mob-more:not(.hidden) { display: block; }

  #mob-filter-inner, #mob-more-inner {
    background: var(--card);
    border-radius: 0;
    border-top: none;
    padding: 16px;
    box-shadow: 0 -4px 20px rgba(0,0,0,0.4);
  }

  .mf-title { font-size: 0.85rem; font-weight: 800; margin-bottom: 14px; }
  .mf-section { margin-bottom: 14px; }
  .mf-label { font-size: 0.6rem; font-weight: 700; color: var(--dim); text-transform: uppercase; letter-spacing: 0.5px; margin-bottom: 8px; }

  .mf-row { display: flex; gap: 8px; }

  .mf-btn {
    flex: 1;
    display: flex; align-items: center; justify-content: center; gap: 6px;
    padding: 10px;
    border-radius: 10px;
    border: 1px solid var(--border);
    background: transparent;
    color: var(--sub);
    font-size: 0.75rem;
    font-weight: 700;
    cursor: pointer;
  }

  .mf-btn.on { color: var(--text); border-color: rgba(255,255,255,0.15); background: rgba(255,255,255,0.05); }
  .mf-btn .fd { width: 8px; height: 8px; }

  #mob-region {
    width: 100%;
    padding: 10px 12px;
    border-radius: 10px;
    border: 1px solid var(--border);
    background: var(--bg2);
    color: var(--text);
    font-size: 0.8rem;
    font-weight: 600;
    -webkit-appearance: none; appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6'%3E%3Cpath d='M0 0l5 6 5-6' fill='%236b8fac'/%3E%3C/svg%3E");
    background-repeat: no-repeat; background-position: right 10px center;
  }

  .mf-toggle {
    flex: 1;
    display: flex; align-items: center; justify-content: center; gap: 6px;
    padding: 10px;
    border-radius: 10px;
    border: 1px solid var(--border);
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--sub);
    cursor: pointer;
  }
  .mf-toggle input { display: none; }
  .mf-toggle:has(input:checked) { border-color: var(--teal); color: var(--teal); }

  /* Mer-meny */
  #mob-more-inner { padding: 8px 0; }

  .mm-btn {
    display: flex; align-items: center; gap: 10px;
    width: 100%;
    padding: 14px 16px;
    border: none;
    background: transparent;
    color: var(--text);
    font-size: 0.88rem;
    font-weight: 600;
    text-align: left;
    cursor: pointer;
    border-bottom: 1px solid var(--border);
    border-radius: 0;
  }
  .mm-btn:last-child { border-bottom: none; }
  .mm-btn:active { background: rgba(255,255,255,0.04); }
  .mm-btn svg { opacity: 0.7; }
}

/* Desktop */
@media (min-width: 769px) {
  #card { width: calc(100% - 290px); }
}
