.planner-page { height: 100svh; overflow: hidden; }
.planner-page .site-nav { position: fixed; left: 0; right: 0; }
#map { position: fixed; top: var(--nav-h); left: 0; right: 0; bottom: 0; z-index: 0; background: var(--surface-2); }

#panel, #nearby {
  position: fixed; z-index: 500; top: calc(var(--nav-h) + 16px); left: 16px; bottom: 16px; width: 430px;
  display: flex; flex-direction: column; gap: 14px; padding: 18px; overflow-y: auto; overscroll-behavior: contain;
  background: var(--glass); backdrop-filter: blur(18px) saturate(1.5); -webkit-backdrop-filter: blur(18px) saturate(1.5);
  border: 1px solid var(--line); border-radius: 24px; box-shadow: var(--shadow-lg); scrollbar-width: thin;
  animation: panelIn .7s var(--ease) both;
}
@keyframes panelIn { from { transform: translateX(-24px); opacity: 0; } }
.sheet-handle { display: none; }

.panel-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; }
.panel-title { min-width: 0; }
.panel-title h1 { font-size: 22px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; margin-top: 2px; }
.panel-tools { display: flex; align-items: center; gap: 2px; flex: none; }
.panel-tools .icon-btn .i { width: 19px; height: 19px; }

/* Färdsätt */
.modes { position: relative; display: grid; grid-template-columns: repeat(4, 1fr); background: var(--surface-2); border-radius: 14px; padding: 4px; }
.mode { position: relative; z-index: 1; border: 0; background: none; padding: 8px 0; border-radius: 10px; cursor: pointer; display: flex; flex-direction: column; align-items: center; gap: 3px; font-size: 12px; font-weight: 650; color: var(--muted); transition: color .3s; }
.mode .i { width: 20px; height: 20px; }
.mode.active { color: #fff; }
.mode-indicator { position: absolute; z-index: 0; top: 4px; bottom: 4px; left: 4px; width: calc((100% - 8px) / 4); border-radius: 10px; background: var(--navy); box-shadow: 0 6px 16px -6px rgba(31, 95, 158, .6); transition: transform .45s var(--ease); }
:root[data-theme="dark"] .mode-indicator { background: var(--accent); }

/* Stopp */
.stops { display: grid; gap: 8px; }
.stop { display: grid; grid-template-columns: 22px 1fr auto; gap: 8px; align-items: center; position: relative; animation: drop .3s var(--ease); }
.stop:not(:last-child)::before { content: ""; position: absolute; left: 10px; top: 32px; height: calc(100% - 16px); border-left: 2px dotted color-mix(in srgb, var(--muted) 55%, transparent); }
.stop-dot { width: 20px; height: 20px; border-radius: 50%; display: grid; place-items: center; font-size: 11px; font-weight: 800; color: #fff; position: relative; z-index: 1; }
.stop-dot.start { background: var(--surface); border: 5px solid var(--navy); }
:root[data-theme="dark"] .stop-dot.start { border-color: #e9eef6; }
.stop-dot.mid { background: var(--navy-2); }
.stop-dot.end { background: var(--accent); box-shadow: 0 0 0 4px var(--accent-soft); }
.stop .input { padding: 11px 42px 11px 12px; }
.stop .locate { position: absolute; right: 2px; top: 50%; transform: translateY(-50%); width: 36px; height: 36px; color: var(--accent); }
.stop .locate.busy .i { animation: spin 1s linear infinite; }
.stop .field.loading::after { right: 44px; }
.stop-btns { display: flex; }
.stop-btns .icon-btn { width: 30px; height: 34px; border-radius: 8px; color: var(--muted); }
.stop-btns .icon-btn:hover:not(:disabled) { color: var(--text); }
.stop-btns .i { width: 17px; height: 17px; }
.stop-tools { display: flex; align-items: center; gap: 8px; }
.stop-tools #swap { margin-left: auto; }
.note { font-size: 13px; color: var(--info); background: var(--info-soft); padding: 10px 12px; border-radius: 12px; }
.time-row { display: flex; gap: 8px; }
.time-row select { width: auto; }

/* Tomt läge */
.start-help { display: grid; gap: 18px; padding: 6px 2px; color: var(--muted); font-size: 14.5px; }
.help-group h4 { font-size: 12px; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); margin-bottom: 8px; }
.recent-routes { display: grid; gap: 6px; }
.recent-route { display: flex; align-items: center; gap: 10px; text-align: left; width: 100%; padding: 10px 12px; border-radius: 12px; border: 1px solid var(--line); background: var(--surface); cursor: pointer; font-size: 14px; color: var(--text); transition: border-color .2s, transform .2s var(--ease); }
.recent-route:hover { border-color: var(--accent); transform: translateX(2px); }
.recent-route .i { color: var(--accent); width: 18px; height: 18px; }
.recent-route span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* Resultatkort */
.skeleton.rs { height: 96px; margin-bottom: 10px; }
.rcard { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; margin-bottom: 10px; cursor: pointer; transition: transform .25s var(--ease), box-shadow .25s, border-color .25s; animation: fadeUp .5s var(--ease) both; animation-delay: calc(var(--i, 0) * 70ms); }
@keyframes fadeUp { from { opacity: 0; transform: translateY(12px); } }
.rcard:hover { transform: translateY(-2px); box-shadow: var(--shadow); }
.rcard.selected { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); cursor: default; }
.rcard-top { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; }
.rcard-time { font-size: 22px; font-weight: 800; letter-spacing: -0.03em; }
.rcard-sub { color: var(--muted); font-size: 13.5px; margin-top: 2px; }
.badge-fast { font-size: 11px; font-weight: 700; color: var(--ok); background: var(--ok-soft); padding: 3px 9px; border-radius: 99px; }
.facts { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px; }
.fact { display: inline-flex; align-items: center; gap: 5px; font-size: 12px; font-weight: 600; padding: 4px 9px; border-radius: 8px; background: var(--surface-2); }
.fact .i { width: 14px; height: 14px; }
.fact.warn { background: var(--warn-soft); color: var(--warn); }
.fact.info { background: var(--info-soft); color: var(--info); }
.fact.ok { background: var(--ok-soft); color: var(--ok); }
.lines { display: flex; flex-wrap: wrap; align-items: center; gap: 4px; margin-top: 10px; }
.lines .sep { color: var(--muted); font-size: 12px; }
.line { display: inline-flex; align-items: center; gap: 4px; font-size: 12px; font-weight: 700; padding: 3px 8px; border-radius: 8px; color: #fff; }
.line.walk { background: var(--surface-2); color: var(--muted); }

.details { margin-top: 14px; border-top: 1px dashed var(--line); padding-top: 14px; animation: drop .3s var(--ease); display: grid; gap: 10px; }
.legs-summary { display: grid; gap: 6px; font-size: 13.5px; }
.legs-summary div { display: grid; grid-template-columns: 22px 1fr auto; gap: 8px; align-items: center; }
.legs-summary b { font-weight: 650; white-space: nowrap; }
.leg-n { width: 22px; height: 22px; border-radius: 50%; display: grid; place-items: center; background: var(--surface-2); font-size: 11px; font-weight: 800; }
.steps summary { cursor: pointer; font-weight: 650; font-size: 14px; padding: 6px 0; color: var(--muted); }
.steps summary:hover { color: var(--text); }
.step { display: flex; gap: 12px; padding: 7px 0; font-size: 14px; align-items: flex-start; }
.step-ico { flex: none; width: 30px; height: 30px; border-radius: 10px; display: grid; place-items: center; background: var(--accent-soft); color: var(--accent); font-weight: 700; }
.step small { display: block; color: var(--muted); }
.step .tag { display: inline-block; margin-left: 6px; font-size: 11px; font-weight: 700; padding: 1px 6px; border-radius: 6px; background: var(--warn-soft); color: var(--warn); }
.timeline { padding-left: 22px; }
.tl-leg { position: relative; padding: 2px 0 12px; font-size: 14px; }
.tl-leg::before { content: ""; position: absolute; left: -15px; top: 10px; bottom: -4px; width: 4px; border-radius: 4px; background: var(--c, #94a3b8); }
.tl-leg.walk::before { background: repeating-linear-gradient(var(--muted) 0 4px, transparent 4px 8px); width: 3px; left: -14px; }
.tl-leg:last-of-type::before { display: none; }
.tl-leg::after { content: ""; position: absolute; left: -19px; top: 4px; width: 12px; height: 12px; border-radius: 50%; background: var(--surface); border: 3px solid var(--c, #94a3b8); }
.tl-time { font-weight: 700; }
.tl-leg small { color: var(--muted); display: block; }
.late { color: var(--danger); font-weight: 700; }
.notice { margin-top: 6px; font-size: 13px; background: var(--warn-soft); color: var(--warn); border-radius: 12px; padding: 10px 12px; }
.notice b { display: flex; align-items: center; gap: 6px; }
.notice .i { width: 15px; height: 15px; }

/* Kartelement */
.route-anim { stroke-dasharray: 1; stroke-dashoffset: 1; animation: draw 1.1s var(--ease) forwards; }
@keyframes draw { to { stroke-dashoffset: 0; } }
.pin { position: relative; }
.pin span { position: absolute; left: 50%; bottom: 0; width: 30px; height: 30px; margin-left: -15px; border-radius: 50% 50% 50% 0; transform: rotate(-45deg); box-shadow: 0 6px 14px rgba(0, 0, 0, .3); animation: pinDrop .6s var(--ease) both; }
.pin span::after { content: ""; position: absolute; inset: 9px; background: #fff; border-radius: 50%; }
.pin-start { background: var(--navy); }
:root[data-theme="dark"] .pin-start { background: #e9eef6; }
:root[data-theme="dark"] .pin-start::after { background: var(--navy) !important; }
.pin-end { background: var(--accent); }
@keyframes pinDrop { from { transform: translateY(-40px) rotate(-45deg); opacity: 0; } }
.pin-mid { width: 28px; height: 28px; border-radius: 50%; display: grid; place-items: center; background: var(--navy-2); color: #fff; font: 800 13px 'Plus Jakarta Sans', sans-serif; border: 3px solid #fff; box-shadow: 0 4px 10px rgba(0, 0, 0, .3); animation: pop .4s var(--ease); }
@keyframes pop { from { transform: scale(.3); opacity: 0; } }
.me { width: 20px; height: 20px; border-radius: 50%; background: #2563eb; border: 3px solid #fff; box-shadow: 0 2px 8px rgba(0, 0, 0, .3); position: relative; }
.me::before { content: ""; position: absolute; inset: -12px; border-radius: 50%; background: rgba(37, 99, 235, .25); animation: pulse 2s ease-out infinite; }
@keyframes pulse { from { transform: scale(.4); opacity: 1; } to { transform: scale(1.6); opacity: 0; } }
.leaflet-control-zoom { border: 0 !important; box-shadow: var(--shadow) !important; border-radius: 14px !important; overflow: hidden; }
.leaflet-control-zoom a { width: 40px !important; height: 40px !important; line-height: 40px !important; background: var(--surface) !important; color: var(--text) !important; border-color: var(--line) !important; }
.leaflet-container { font-family: inherit; }

/* Navigeringsläge */
#guide { position: fixed; inset: 0; z-index: 1100; pointer-events: none; }
#guide > * { pointer-events: auto; }
.guide-banner { position: absolute; top: 16px; left: 50%; transform: translateX(-50%); width: min(560px, calc(100% - 32px)); display: flex; gap: 16px; align-items: center; padding: 18px 20px; border-radius: 22px; color: #fff; background: linear-gradient(135deg, var(--navy), var(--accent)); box-shadow: var(--shadow-lg); animation: bannerIn .6s var(--ease); }
@keyframes bannerIn { from { transform: translate(-50%, -30px); opacity: 0; } }
.guide-icon { flex: none; width: 64px; height: 64px; border-radius: 18px; background: var(--accent); display: grid; place-items: center; font-size: 36px; font-weight: 800; }
.guide-icon.swap { animation: pop .45s var(--ease); }
.guide-dist { font-size: 28px; font-weight: 800; letter-spacing: -0.02em; }
.guide-instr { font-size: 17px; font-weight: 600; opacity: .95; }
.guide-then { font-size: 13px; opacity: .7; margin-top: 4px; }
.guide-bottom { position: absolute; bottom: 16px; left: 50%; transform: translateX(-50%); width: min(560px, calc(100% - 32px)); display: flex; align-items: center; gap: 6px; padding: 12px; border-radius: 22px; background: var(--glass); backdrop-filter: blur(18px); border: 1px solid var(--line); box-shadow: var(--shadow-lg); animation: bannerUp .6s var(--ease); }
@keyframes bannerUp { from { transform: translate(-50%, 30px); opacity: 0; } }
.guide-stats { flex: 1; text-align: center; }
.guide-stats strong { display: block; font-size: 20px; font-weight: 800; color: var(--ok); }
.guide-stats span { color: var(--muted); font-size: 13px; }
.recenter { position: absolute; right: 16px; bottom: 110px; background: var(--surface); box-shadow: var(--shadow); width: 48px; height: 48px; color: var(--accent); }
body.navigating #panel, body.navigating #nearby, body.navigating .nearby-bar { transform: translateX(-120%); opacity: 0; transition: transform .5s var(--ease), opacity .4s; pointer-events: none; animation: none; }
body.navigating .site-nav { transform: translateY(-100%); transition: transform .4s var(--ease); }
body.navigating #map { top: 0; }
body.navigating .leaflet-control-zoom { display: none; }
body.navigating #toast { bottom: 110px; }

/* Mobil: panelen blir ett bottom sheet */
@media (max-width: 760px) {
  #panel, #nearby { top: auto; left: 0; right: 0; bottom: 0; width: auto; max-height: 58svh; border-radius: 24px 24px 0 0; padding: 10px 16px calc(16px + env(safe-area-inset-bottom)); animation-name: sheetIn; }
  @keyframes sheetIn { from { transform: translateY(40px); opacity: 0; } }
  .sheet-handle { display: block; flex: none; width: 40px; height: 5px; border-radius: 9px; background: var(--line); margin: 0 auto; }
  .panel-title h1 { font-size: 19px; }
  body.navigating #panel, body.navigating #nearby { transform: translateY(110%); }
  .leaflet-control-zoom { display: none; }
  .guide-dist { font-size: 22px; }
  .guide-icon { width: 52px; height: 52px; font-size: 30px; }
  .stop-btns .icon-btn { width: 28px; }
}

/* Boka biljett */
.book { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin: 12px 0 10px; padding: 12px; border-radius: 14px; background: var(--bg); }
.book-title { display: flex; align-items: center; gap: 6px; width: 100%; font-weight: 700; font-size: 13px; }
.book .i { width: 16px; height: 16px; }

/* I närheten */
.nearby-bar { position: fixed; z-index: 450; top: calc(var(--nav-h) + 16px); left: 462px; right: 16px; display: flex; gap: 8px; overflow-x: auto; scrollbar-width: none; padding: 2px; animation: rise .6s var(--ease) .2s both; }
.nearby-bar::-webkit-scrollbar { display: none; }
.nb-chip { flex: none; display: inline-flex; align-items: center; gap: 7px; padding: 9px 15px; border-radius: 999px; border: 1px solid var(--line); background: var(--surface); color: var(--text); font-weight: 650; font-size: 14px; cursor: pointer; box-shadow: var(--shadow-sm); transition: background .2s, color .2s, transform .2s var(--ease); }
.nb-chip .i { width: 17px; height: 17px; color: var(--accent); }
.nb-chip:hover { transform: translateY(-1px); }
.nb-chip[aria-pressed="true"] { background: var(--accent); border-color: var(--accent); color: #fff; }
.nb-chip[aria-pressed="true"] .i { color: #fff; }
#nearby { z-index: 600; background: var(--surface); gap: 12px; animation: panelIn .4s var(--ease) both; }
.nb-head { display: flex; align-items: center; gap: 10px; }
.nb-head h2 { flex: 1; min-width: 0; font-size: 19px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.nb-head-icon { width: 38px; height: 38px; border-radius: 12px; display: grid; place-items: center; background: var(--accent-soft); color: var(--accent); flex: none; }
.nb-research { align-self: flex-start; }
#nb-body { display: grid; gap: 8px; align-content: start; }
.nb-count { font-size: 13px; color: var(--muted); }
.nb-item { display: flex; gap: 12px; align-items: center; text-align: left; width: 100%; padding: 10px; border: 1px solid var(--line); border-radius: 14px; background: var(--surface); cursor: pointer; transition: border-color .2s, transform .2s var(--ease), box-shadow .2s; animation: drop .35s var(--ease) both; }
.nb-item:hover { border-color: var(--accent); box-shadow: var(--shadow-sm); transform: translateY(-1px); }
.nb-thumb { width: 52px; height: 52px; flex: none; border-radius: 12px; overflow: hidden; display: grid; place-items: center; background: var(--accent-soft); color: var(--accent); }
.nb-thumb img { width: 100%; height: 100%; object-fit: cover; }
.nb-info { display: grid; gap: 1px; min-width: 0; }
.nb-info b { font-size: 15px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.nb-info small { color: var(--muted); font-size: 12.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.nb-hero { width: 100%; aspect-ratio: 16 / 9; object-fit: cover; border-radius: 16px; }
.nb-text { font-size: 14.5px; }
.nb-actions { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin: 4px 0; }
.nb-actions .btn-primary { flex: 1; justify-content: center; }
.fav-toggle.on { color: #e0245e; }
.fav-toggle.on .i { fill: currentColor; }
.nb-facts { list-style: none; margin: 0; padding: 0; display: grid; gap: 2px; }
.nb-facts li { display: flex; gap: 12px; padding: 10px 2px; border-bottom: 1px solid var(--line); font-size: 14.5px; }
.nb-facts li:last-child { border-bottom: 0; }
.nb-facts .i { width: 18px; height: 18px; color: var(--accent); margin-top: 2px; }
.nb-facts a { color: var(--accent); word-break: break-all; }
.nb-source { margin-top: 6px; }
.empty-mini { display: grid; justify-items: center; gap: 10px; text-align: center; padding: 28px 12px; color: var(--muted); }
.empty-mini .i { width: 28px; height: 28px; }
.nb-pin { width: 32px; height: 32px; border-radius: 50%; display: grid; place-items: center; background: var(--surface); color: var(--accent); border: 2px solid var(--accent); box-shadow: 0 4px 10px rgba(20, 50, 79, .25); animation: pop .35s var(--ease); }
.nb-pin .i { width: 16px; height: 16px; }
.nb-pin.on { background: var(--accent); color: #fff; transform: scale(1.2); }
@media (max-width: 760px) {
  .nearby-bar { top: calc(var(--nav-h) + 10px); left: 0; right: 0; padding: 2px 12px; }
  #nearby { max-height: 62svh; }
  .nb-hero { aspect-ratio: auto; height: 150px; }
}
