/* ===== RoutePlanner — expedition brand: teal + sunset accent ===== */
:root {
  --teal: #1b5e57;
  --teal-deep: #0e3b36;
  --bg: #f7f7f5;
  --gold: #b8860b;
  --sunset: #ff6a2b;
  --amber: #ffb347;
  --blue: #2471a3;
  --line: #e3e3e0;
  --text: #333;
  --muted: #777;
  --display: 'Bricolage Grotesque', 'Hanken Grotesk', -apple-system, sans-serif;
  --body: 'Hanken Grotesk', -apple-system, "Helvetica Neue", Arial, sans-serif;
}

* { box-sizing: border-box; }
html, body {
  margin: 0; padding: 0; height: 100%;
  font-family: var(--body);
  color: var(--text); background: var(--bg);
}
.brand { font-family: var(--display); }

/* ---- Top bar ---- */
#topbar {
  height: calc(54px + env(safe-area-inset-top, 0px));
  display: flex; align-items: center; justify-content: space-between;
  padding: env(safe-area-inset-top, 0px) 18px 0; color: #fff;
  background: linear-gradient(115deg, var(--teal) 0%, var(--teal-deep) 100%);
  border-bottom: 2px solid var(--sunset);
  position: relative; z-index: 500;
}
#topbar.hidden { display: none; }
#topbar .brand { display: flex; align-items: center; gap: 9px; font-family: var(--display); font-weight: 800; font-size: 18px; letter-spacing: -0.3px; }
#topbar .brand-word span { color: var(--amber); }
#topbar .bm-pin { width: 16px; height: 16px; box-shadow: 0 2px 8px rgba(255,106,43,0.45); }
#topbar .bm-pin::after { inset: 5px; background: var(--teal-deep); }
.topbar-right { display: flex; align-items: center; gap: 12px; }
.topbar-email { font-size: 13px; opacity: 0.9; }
.topbar-logout {
  background: rgba(255,255,255,0.15); color: #fff; border: 1px solid rgba(255,255,255,0.35);
  border-radius: 7px; padding: 6px 12px; font-size: 13px; cursor: pointer;
}
.topbar-logout:hover { background: rgba(255,255,255,0.25); }
.netbadge { display: none; font-size: 12px; font-weight: 700; color: #fff; background: var(--sunset); padding: 4px 10px; border-radius: 999px; }
body.offline .netbadge { display: inline-flex; align-items: center; }

/* ---- View host ---- */
#view { height: calc(100% - 54px - env(safe-area-inset-top, 0px)); overflow: auto; }
#view.fullbleed { overflow: hidden; }

/* ---- Buttons ---- */
button { font-family: inherit; }
.btn {
  display: inline-block; padding: 9px 14px; border: none; border-radius: 9px;
  cursor: pointer; font-size: 13px; font-weight: 700; color: #fff; background: var(--teal);
  transition: filter 0.15s, transform 0.1s, box-shadow 0.2s;
}
.btn:hover { filter: brightness(1.07); transform: translateY(-1px); }
.btn:active { transform: none; }
.btn:disabled { opacity: 0.4; cursor: default; transform: none; }
.btn.secondary { background: var(--blue); }
.btn.gold { background: linear-gradient(120deg, var(--amber), var(--sunset)); box-shadow: 0 6px 16px rgba(255,106,43,0.28); }
.btn.ghost { background: #fff; color: var(--teal); border: 1px solid var(--line); }
.btn.danger { background: #c0392b; }
.btn.small { padding: 5px 9px; font-size: 12px; }
.btn.tiny { padding: 3px 8px; font-size: 11px; font-weight: 600; border-radius: 7px; }

/* stacked export/import buttons next to the undo button */

input[type=text], input[type=email], input[type=date], input[type=time], select, textarea {
  font-family: inherit; font-size: 14px; padding: 9px 11px;
  border: 1px solid var(--line); border-radius: 8px; background: #fff; color: var(--text);
  width: 100%;
}
textarea { resize: vertical; min-height: 90px; }
label.field { display: block; font-size: 12px; color: var(--muted); margin: 0 0 4px; }

/* ---- Login — expedition hero ---- */
.login-screen {
  position: fixed; inset: 0; overflow: auto; display: flex; align-items: center;
  padding: 40px 30px; color: #eaf3f1;
  background:
    radial-gradient(90% 60% at 82% -8%, rgba(255,122,61,0.28), transparent 60%),
    radial-gradient(70% 50% at 8% 108%, rgba(255,179,71,0.16), transparent 60%),
    linear-gradient(155deg, #14524b 0%, var(--teal-deep) 52%, #0a2a27 100%);
}
.login-screen .login-trail {
  position: absolute; inset: 0; width: 100%; height: 100%;
  opacity: 0.5; pointer-events: none; z-index: 0;
}
.login-trail .trailpath {
  stroke-dasharray: 7 11; animation: trailmarch 24s linear infinite;
}
@keyframes trailmarch { to { stroke-dashoffset: -360; } }
.login-trail .traildot {
  offset-path: path("M40 560 C 120 440 40 360 160 300 C 280 240 200 150 320 90");
  animation: trailride 7s ease-in-out infinite;
}
@keyframes trailride { 0%,100% { offset-distance: 0%; } 50% { offset-distance: 100%; } }
.login-trail .trailhalo { transform-box: fill-box; transform-origin: center; animation: halo 2.6s ease-out infinite; }
@keyframes halo { 0% { transform: scale(1); opacity: 0.55; } 70% { opacity: 0; } 100% { transform: scale(2.6); opacity: 0; } }

.login-inner { position: relative; z-index: 1; width: 100%; max-width: 480px; margin: 0 auto; }
.login-inner > * { animation: rise 0.7s cubic-bezier(0.2,0.7,0.2,1) backwards; }
.login-inner > *:nth-child(1) { animation-delay: 0.05s; }
.login-inner > *:nth-child(2) { animation-delay: 0.13s; }
.login-inner > *:nth-child(3) { animation-delay: 0.21s; }
.login-inner > *:nth-child(4) { animation-delay: 0.29s; }
.login-inner > *:nth-child(5) { animation-delay: 0.37s; }
.login-inner > *:nth-child(6) { animation-delay: 0.45s; }
@keyframes rise { from { opacity: 0; transform: translateY(16px); } to { opacity: 1; transform: none; } }

.brandmark { display: flex; align-items: center; gap: 11px; margin-bottom: 30px; }
.bm-pin {
  width: 20px; height: 20px; background: linear-gradient(150deg, var(--amber), var(--sunset));
  border-radius: 52% 52% 52% 6px; transform: rotate(45deg); position: relative;
  box-shadow: 0 4px 14px rgba(255,106,43,0.5);
}
.bm-pin::after { content: ""; position: absolute; inset: 6px; background: #0a2a27; border-radius: 50%; }
.bm-name { font-family: var(--display); font-weight: 800; font-size: 21px; color: #fff; letter-spacing: -0.4px; }
.bm-name span { color: var(--amber); }

.login-title {
  font-family: var(--display); font-weight: 800; font-size: clamp(38px, 9vw, 58px);
  line-height: 0.98; letter-spacing: -1.5px; margin: 0 0 18px; color: #fff;
}
.login-title .accent {
  background: linear-gradient(100deg, var(--amber), var(--sunset));
  -webkit-background-clip: text; background-clip: text; -webkit-text-fill-color: transparent;
}
.login-sub { font-size: 16px; line-height: 1.6; color: #b9d3ce; margin: 0 0 28px; max-width: 30em; }

.login-form { display: flex; gap: 10px; flex-wrap: wrap; }
#loginEmail {
  flex: 1; min-width: 200px; background: rgba(255,255,255,0.07); color: #fff;
  border: 1.5px solid rgba(255,255,255,0.18); border-radius: 14px; padding: 16px 18px;
  font-family: var(--body); font-size: 16px; transition: border-color 0.2s, background 0.2s;
}
#loginEmail::placeholder { color: #8fb0ab; }
#loginEmail:focus { outline: none; border-color: var(--amber); background: rgba(255,255,255,0.12); }
.login-go {
  border: none; cursor: pointer; border-radius: 14px; padding: 16px 26px;
  font-family: var(--body); font-weight: 800; font-size: 16px; color: #fff; white-space: nowrap;
  background: linear-gradient(120deg, var(--sunset), #ff8f3d);
  box-shadow: 0 10px 26px rgba(255,106,43,0.42);
  transition: transform 0.15s, box-shadow 0.2s;
}
.login-go .arr { display: inline-block; transition: transform 0.2s; }
.login-go:hover { transform: translateY(-2px); box-shadow: 0 14px 32px rgba(255,106,43,0.55); }
.login-go:hover .arr { transform: translateX(4px); }
.login-go:disabled { opacity: 0.6; cursor: default; transform: none; }

.login-msg { margin-top: 18px; font-size: 15px; color: #d7e8e4; line-height: 1.6; }
.login-msg .devlink { display: inline-block; margin-top: 8px; color: var(--amber); font-weight: 700; }
.login-err { margin-top: 18px; font-size: 14px; color: #ffd9c2; font-weight: 600; }
.login-tags { margin-top: 30px; font-size: 13px; color: #7fa39d; letter-spacing: 0.3px; }

/* ---- Dashboard ---- */
.dash-wrap { max-width: 880px; margin: 0 auto; padding: 28px 22px 60px; }
.dash-head { display: flex; align-items: flex-start; justify-content: space-between; flex-wrap: wrap; gap: 12px; margin-bottom: 8px; }
.dash-head h1 { font-family: var(--display); font-weight: 800; color: var(--teal); font-size: 30px; letter-spacing: -0.8px; margin: 0; }
.dash-tag { color: var(--muted); font-size: 13px; margin: 3px 0 0; }
.dash-actions { display: flex; gap: 10px; flex-wrap: wrap; }
.dash-section { margin-top: 28px; }
.dash-section h2 {
  font-family: var(--display); font-weight: 700; font-size: 17px; color: var(--teal);
  margin: 0 0 10px; padding-bottom: 6px; border-bottom: 2px solid var(--line);
  display: inline-block;
}
.route-row {
  display: flex; align-items: center; gap: 12px; background: #fff; border: 1px solid var(--line);
  border-radius: 12px; padding: 12px 14px; margin-bottom: 8px;
  transition: box-shadow 0.15s, border-color 0.15s;
}
.route-row:hover { border-color: #cbe0db; box-shadow: 0 4px 14px rgba(14,59,54,0.07); }
.route-row .mode {
  flex: none; width: 36px; height: 36px; border-radius: 10px;
  display: flex; align-items: center; justify-content: center;
  background: #eef3f2; color: var(--teal);
}
.route-row .mode svg { display: block; }
.route-row .rtitle { font-weight: 700; font-size: 15px; color: var(--teal-deep); letter-spacing: -0.1px; }
.route-row .rmeta { font-size: 12px; color: var(--muted); margin-top: 1px; }
.route-row .grow { flex: 1; min-width: 0; }
.route-row .row-actions { display: flex; gap: 7px; flex-wrap: wrap; align-items: center; }

/* quiet row buttons: one tinted primary (Fahren), the rest neutral */
.rbtn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  padding: 7px 13px; border-radius: 8px; cursor: pointer;
  font: 600 13px var(--body); color: #3d514d;
  background: #fff; border: 1px solid var(--line);
  transition: background 0.15s, border-color 0.15s, color 0.15s;
}
.rbtn:hover { background: #f2f6f5; border-color: #c6d5d1; color: var(--teal-deep); }
.rbtn svg { flex: none; }
.rbtn-drive { color: #fff; background: var(--teal); border-color: var(--teal); }
.rbtn-drive:hover { background: var(--teal-deep); border-color: var(--teal-deep); color: #fff; }
.rbtn-icon { padding: 7px 7px; color: var(--muted); }
.rbtn-icon:hover { color: var(--teal-deep); }

/* "⋯" overflow menu */
.rowmenu-wrap { position: relative; flex: none; }
.rowmenu {
  display: none; position: absolute; right: 0; top: calc(100% + 6px); z-index: 600;
  min-width: 172px; background: #fff; border: 1px solid var(--line); border-radius: 10px;
  box-shadow: 0 10px 30px rgba(14,59,54,0.16); padding: 5px;
}
.rowmenu.open { display: block; }
.rm-item {
  display: block; width: 100%; text-align: left; background: none; border: none;
  font: inherit; font-size: 13.5px; color: var(--text); padding: 8px 11px;
  border-radius: 7px; cursor: pointer;
}
.rm-item:hover { background: #f2f6f5; }
.rm-item.danger { color: #c0392b; }
.rm-item.danger:hover { background: #fdecea; }
.rm-sep { border-top: 1px solid var(--line); margin: 4px 6px; }
.empty { color: var(--muted); font-style: italic; font-size: 13px; padding: 8px 2px; }

.badge {
  display: inline-block; font-size: 11px; font-weight: bold; padding: 2px 8px;
  border-radius: 999px; vertical-align: middle;
}
.badge.read { background: #eef3f2; color: var(--teal); }
.badge.edit { background: #fff3da; color: var(--gold); }
.badge.admin { background: var(--gold); color: #fff; }
.badge.ro { background: #fdecea; color: #c0392b; }
.badge.approx { background: #fff3da; color: var(--gold); margin-left: 6px; }

.account-bar { margin-top: 30px; font-size: 13px; color: var(--muted); }
.account-bar a { color: var(--blue); cursor: pointer; text-decoration: underline; }

/* admin table */
.admin-table { width: 100%; border-collapse: collapse; font-size: 13px; background: #fff; border-radius: 10px; overflow: hidden; }
.admin-table th, .admin-table td { text-align: left; padding: 9px 11px; border-bottom: 1px solid var(--line); }
.admin-table th { background: #eef3f2; color: var(--teal); font-size: 12px; }
.admin-table tr:last-child td { border-bottom: none; }

/* ---- Editor ---- */
#editor-wrap { display: flex; height: 100%; position: relative; }
#map { flex: 1; height: 100%; }

/* ---- place search overlay on the map ---- */
.map-search {
  position: absolute; top: 12px; left: 50%; transform: translateX(-50%);
  z-index: 1000; width: min(380px, calc(100% - 84px));
  font-family: var(--body);
}
.map-search-input {
  width: 100%; box-sizing: border-box; padding: 10px 14px;
  border: none; border-radius: 999px; font-size: 14px; color: #1d1d1d;
  background: #fff; box-shadow: 0 4px 18px rgba(14,59,54,0.28);
  outline: 2px solid transparent; transition: outline-color .15s;
}
.map-search-input:focus { outline-color: var(--sunset); }
.map-search-results {
  display: none; margin-top: 6px; background: #fff; border-radius: 14px;
  overflow: hidden; box-shadow: 0 8px 26px rgba(14,59,54,0.30);
}
.map-search-results.open { display: block; }
.map-search-results .ms-item {
  display: flex; flex-direction: column; gap: 1px; width: 100%; text-align: left;
  padding: 9px 14px; border: none; background: none; cursor: pointer; border-bottom: 1px solid #f0efea;
}
.map-search-results .ms-item:last-child { border-bottom: none; }
.map-search-results .ms-item:hover { background: #fff4ec; }
.map-search-results .ms-name { font-weight: 700; font-size: 14px; color: var(--teal-deep); }
.map-search-results .ms-sub { font-size: 11.5px; color: #888; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.map-search-results .ms-empty { padding: 11px 14px; font-size: 13px; color: #888; }
/* search result pin (a temporary, not-yet-a-stop marker) */
.search-pin {
  width: 22px; height: 22px; border-radius: 50% 50% 50% 0; transform: rotate(-45deg);
  background: linear-gradient(150deg, var(--amber), var(--sunset));
  border: 2px solid #fff; box-shadow: 0 3px 8px rgba(0,0,0,0.4);
}
.sp-pop b { font-family: var(--display); font-size: 15px; color: var(--teal-deep); }
.sp-pop .sp-sub { font-size: 11.5px; color: #888; margin: 2px 0 8px; }
.sp-pop .sp-add {
  display: inline-block; border: none; cursor: pointer; padding: 7px 12px; border-radius: 999px;
  font: 600 13px var(--body); color: #fff; background: linear-gradient(120deg, var(--amber), var(--sunset));
  box-shadow: 0 4px 12px rgba(255,106,43,0.32);
}
.sp-pop .sp-ro { font-size: 12px; color: #999; }

@media (max-width: 720px) {
  .map-search { width: calc(100% - 84px); }
}
#panel {
  width: 340px; height: 100%; box-sizing: border-box; overflow-y: auto;
  background: var(--bg); border-left: 1px solid #ddd; padding: 16px;
}
#panel .toolbar { display: flex; flex-direction: column; gap: 8px; margin-bottom: 12px; }
#panel .toolbar .titlerow { display: flex; align-items: center; gap: 8px; }
#panel .toolbar .titlerow input { flex: 1; min-width: 0; font-family: var(--display); font-size: 18px; font-weight: 800; letter-spacing: -0.3px; color: var(--teal); }
/* ---- editor actions in the topbar + dropdown menu ---- */
.topbar-actions { display: flex; gap: 8px; align-items: center; }
.topbar-btn {
  background: rgba(255,255,255,0.15); color: #fff; border: 1px solid rgba(255,255,255,0.35);
  border-radius: 9px; padding: 8px 13px; font-size: 13px; font-weight: 700; cursor: pointer;
  white-space: nowrap;
}
.topbar-btn:hover { background: rgba(255,255,255,0.25); }
.topbar-menu { font-size: 16px; padding: 8px 12px; }
.topbar-save {
  background: linear-gradient(120deg, var(--amber), var(--sunset)); color: #fff;
  border: none; border-radius: 9px; padding: 8px 14px; font-size: 13px; font-weight: 800;
  cursor: pointer; white-space: nowrap; box-shadow: 0 2px 8px rgba(255,106,43,0.4);
}
.topbar-save:hover { filter: brightness(1.07); }
.topbar-save:disabled { opacity: 0.6; cursor: default; }
/* all saved: quiet ghost look — the amber gradient signals unsaved changes */
.topbar-save.saved {
  background: rgba(255,255,255,0.15); border: 1px solid rgba(255,255,255,0.35);
  box-shadow: none; font-weight: 700;
}
#topbar.editor-compact .topbar-email, #topbar.editor-compact .topbar-logout { display: none; }
#mapMenu {
  display: none; position: fixed; right: 12px; z-index: 1500;
  top: calc(60px + env(safe-area-inset-top, 0px));
  background: #fff; border: 1px solid var(--line); border-radius: 14px;
  box-shadow: 0 10px 32px rgba(0,0,0,0.22); padding: 6px; min-width: 265px;
}
#mapMenu.open { display: block; }
.mm-item {
  display: block; width: 100%; text-align: left; background: none; border: none;
  font: inherit; font-size: 14px; color: var(--text); padding: 10px 13px;
  border-radius: 9px; cursor: pointer;
}
.mm-item:hover { background: #f2f6f5; }
.mm-sep { border-top: 1px solid #eee; margin: 5px 8px; }
.mm-check {
  display: flex; gap: 8px; align-items: center; padding: 9px 13px;
  font-size: 13px; color: #555; cursor: pointer; user-select: none;
}
.mm-logout { color: #c0392b; }
/* Long-press auf Marker soll löschen, nicht das iOS-Kontext-Callout öffnen */
.leaflet-marker-icon { -webkit-touch-callout: none; -webkit-user-select: none; user-select: none; }
#total {
  background: linear-gradient(120deg, var(--teal), var(--teal-deep)); color: #fff;
  border-radius: 12px; padding: 13px 15px; font-size: 14px; line-height: 1.5; margin-bottom: 14px;
}
#total b { font-size: 19px; font-family: var(--display); font-weight: 800; }
.stop {
  background: #fff; border: 1px solid var(--line); border-radius: 8px;
  padding: 8px 10px; margin-bottom: 6px; font-size: 13px;
  display: flex; align-items: center; gap: 6px;
}
.stop .num {
  flex: none; width: 20px; height: 20px; line-height: 20px; text-align: center;
  border-radius: 50%; color: #fff; font-size: 11px; font-weight: bold;
}
.stop .stopname { min-width: 0; }
.stopdel {
  flex: none; width: 28px; height: 28px; border: none; border-radius: 7px;
  background: transparent; color: #bfb0ab; font-size: 13px; line-height: 1; cursor: pointer;
}
.stopdel:hover { background: #fdecea; color: #c0392b; }
.draghandle {
  flex: none; cursor: grab; color: #b0b0ac; font-size: 16px; line-height: 1;
  padding: 2px 4px; user-select: none; touch-action: none;
}
.draghandle:active { cursor: grabbing; }
.stoprow.dragging .stop { box-shadow: 0 4px 14px rgba(0,0,0,0.18); opacity: 0.92; }
.stoprow.dragging { opacity: 0.97; }
.leg { font-size: 11px; color: var(--gold); margin: 2px 0 6px 26px; }
.climb { color: var(--sunset); font-weight: 700; }   /* cumulative climb (bike) */
/* ⚡ charging time on a leg — separate color so it reads apart from driving time */
.legcharge { border: none; background: none; padding: 0; font: inherit; color: var(--teal); font-weight: 700; }
button.legcharge { cursor: pointer; }
button.legcharge:hover { text-decoration: underline; }
.seg-top .charge, .via-leg .charge { color: var(--teal); font-weight: 700; }

.export-btns { display: flex; flex-direction: column; gap: 8px; }
.export-btns .btn { width: 100%; text-align: left; }
.export-btns .btn span { font-weight: 400; opacity: 0.8; font-size: 12px; }
.loading { color: #999; font-style: italic; }
.btns { display: flex; gap: 8px; margin-bottom: 14px; }
#undoBtn {
  width: 38px; height: 38px; border-radius: 50%; border: 1px solid var(--line);
  background: #fff; color: var(--teal); font-size: 19px; line-height: 1; cursor: pointer;
  display: inline-flex; align-items: center; justify-content: center;
  box-shadow: 0 1px 3px rgba(0,0,0,0.08); transition: background 0.15s, transform 0.1s;
}
#undoBtn:hover:not(:disabled) { background: #eef3f2; }
#undoBtn:active:not(:disabled) { transform: scale(0.93); }
#undoBtn:disabled { opacity: 0.35; cursor: default; }

/* AI panel */
#aiPanel { display: none; background: #fff; border: 1px solid var(--line); border-radius: 10px; padding: 12px; margin-bottom: 14px; }
#aiPanel.open { display: block; }
#aiPanel h3 { margin: 0 0 8px; font-size: 14px; color: var(--teal); }
#aiPanel .ai-modes { display: flex; gap: 12px; margin: 8px 0; font-size: 13px; }
#aiPanel label.radio { display: flex; align-items: center; gap: 5px; cursor: pointer; }
#aiMsg { font-size: 12px; margin-top: 8px; color: var(--gold); }
.ai-spin { display: inline-block; animation: aispin 1.4s steps(8) infinite; }
@keyframes aispin { to { transform: rotate(360deg); } }
.ai-sep { height: 1px; background: var(--line); margin: 14px 0 12px; }
.ai-hint { font-size: 12px; color: var(--muted); margin: 0 0 8px; line-height: 1.45; }
#aiHlMsg { font-size: 12px; margin-top: 8px; color: var(--gold); }

/* per-stop highlights + info */
.stop .stopmain { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 3px; }
.stop-hl { margin: 1px 0 0; padding-left: 15px; font-size: 11px; color: #6c7a76; line-height: 1.4; }
.stop-hl li { margin: 0; }
.stopinfo {
  flex: none; width: 28px; height: 28px; border: none; border-radius: 7px;
  background: #eef3f2; color: var(--teal); font-size: 14px; line-height: 1; cursor: pointer;
}
.stopinfo:hover { background: #dce8e6; }
/* overnight-stop toggle (🌙) — yellow when active, matches the map marker */
.stopnight {
  flex: none; width: 28px; height: 28px; border: none; border-radius: 7px;
  background: transparent; font-size: 14px; line-height: 28px; text-align: center;
  cursor: pointer; filter: grayscale(1); opacity: 0.45; padding: 0;
}
span.stopnight { cursor: default; }
button.stopnight:hover { background: #faf3d6; opacity: 0.8; }
.stopnight.on { background: #fdf3c8; filter: none; opacity: 1; }
/* per-stop schedule (ETA/ETD) */
.stopsched { font-size: 11px; color: var(--blue); font-weight: 600; }
.stopcomment { font-size: 11px; color: #6c7a76; font-style: italic; }
.stopclock {
  flex: none; width: 28px; height: 28px; border: none; border-radius: 7px;
  background: transparent; font-size: 14px; line-height: 28px; text-align: center;
  cursor: pointer; filter: grayscale(1); opacity: 0.45; padding: 0;
}
.stopclock:hover { background: #e8f0f6; opacity: 0.8; }
.stopclock.on { background: #e3eef7; filter: none; opacity: 1; }
.sched-err { margin-top: 10px; font-size: 13px; font-weight: 600; color: #c0392b; }
.dt-row { display: flex; gap: 8px; }
.dt-row input[type=date] { flex: 1.5; min-width: 0; }
.dt-row input[type=time] { flex: 1; min-width: 0; }
.hl-list { margin: 4px 0 14px; padding-left: 18px; font-size: 14px; line-height: 1.6; color: var(--text); }
.hl-list li { margin: 0 0 4px; }
#modalCard .field { font-size: 12px; color: var(--muted); font-weight: 700; margin: 12px 0 0; text-transform: uppercase; letter-spacing: 0.4px; }

/* ---- Info window (ported verbatim) ---- */
#infoOverlay {
  display: none; position: fixed; inset: 0; z-index: 1000;
  background: rgba(0,0,0,0.45); align-items: center; justify-content: center;
}
#infoOverlay.open { display: flex; }
#infoCard {
  background: #fff; width: min(460px, 92vw); max-height: 88vh; overflow-y: auto;
  border-radius: 14px; box-shadow: 0 10px 40px rgba(0,0,0,0.35); position: relative;
}
#infoClose {
  position: absolute; top: 10px; right: 10px; width: 30px; height: 30px;
  border: none; border-radius: 50%; background: rgba(0,0,0,0.55); color: #fff;
  font-size: 18px; line-height: 30px; cursor: pointer; z-index: 2;
}
#infoGallery {
  display: grid; grid-template-columns: repeat(3, 1fr); gap: 3px;
  background: #eceae6; border-radius: 14px 14px 0 0; overflow: hidden; min-height: 96px;
}
#infoGallery a { display: block; aspect-ratio: 1 / 1; overflow: hidden; background: #e2e0db; }
#infoGallery img { width: 100%; height: 100%; object-fit: cover; display: block; transition: transform 0.2s; }
#infoGallery a:hover img { transform: scale(1.06); }
#infoGallery .galmsg {
  grid-column: 1 / -1; padding: 28px 12px; text-align: center;
  color: #999; font-style: italic; font-size: 13px;
}
#infoBody { padding: 16px 18px 18px; }
#infoTitle { margin: 0 0 8px; font-size: 19px; color: var(--teal); }
#infoText { font-size: 14px; line-height: 1.6; color: #333; margin: 0 0 14px; }
#infoText.muted { color: #999; font-style: italic; }
#infoLink {
  display: inline-block; font-size: 13px; font-weight: bold; text-decoration: none;
  color: #fff; background: var(--teal); padding: 8px 14px; border-radius: 8px;
}
#infoLink.secondary { background: var(--blue); margin-left: 8px; }

/* ---- Generic modal ---- */
#modalOverlay {
  display: none; position: fixed; inset: 0; z-index: 1100;
  background: rgba(0,0,0,0.45); align-items: center; justify-content: center;
}
#modalOverlay.open { display: flex; }
#modalCard {
  background: #fff; width: min(440px, 92vw); max-height: 88vh; overflow-y: auto;
  border-radius: 14px; box-shadow: 0 10px 40px rgba(0,0,0,0.35); position: relative;
  padding: 22px 22px 20px;
}
#modalClose {
  position: absolute; top: 10px; right: 12px; width: 28px; height: 28px;
  border: none; border-radius: 50%; background: #eee; color: #555;
  font-size: 17px; line-height: 28px; cursor: pointer;
}
#modalCard h2 { color: var(--teal); font-size: 18px; margin: 0 0 14px; }
#modalCard .modal-row { margin-bottom: 12px; }
.share-list { margin-top: 8px; }
.share-item {
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
  background: var(--bg); border: 1px solid var(--line); border-radius: 8px;
  padding: 7px 10px; margin-bottom: 6px; font-size: 13px;
}

/* ---- Timeline ("Zeitplan") overlay ---- */
#tlOverlay {
  display: none; position: fixed; inset: 0; z-index: 1050;
  background: rgba(0,0,0,0.45); align-items: center; justify-content: center;
}
#tlOverlay.open { display: flex; }
#tlCard {
  background: #fff; width: min(540px, 94vw); max-height: 90vh; overflow-y: auto;
  border-radius: 14px; box-shadow: 0 10px 40px rgba(0,0,0,0.35); position: relative;
  padding: 22px 22px 20px;
}
#tlClose {
  position: absolute; top: 10px; right: 12px; width: 28px; height: 28px;
  border: none; border-radius: 50%; background: #eee; color: #555;
  font-size: 17px; line-height: 28px; cursor: pointer;
}
#tlCard h2 { font-family: var(--display); color: var(--teal); font-size: 21px; margin: 0 0 2px; letter-spacing: -0.4px; }
.tl-route { font-size: 13px; color: var(--muted); margin-bottom: 14px; }
.tl-summary {
  background: linear-gradient(120deg, var(--teal), var(--teal-deep)); color: #fff;
  border-radius: 12px; padding: 12px 15px; font-size: 13px; line-height: 1.6; margin-bottom: 16px;
}
.tl-summary b { font-family: var(--display); font-size: 15px; }
.tl-hint { font-size: 12px; color: var(--muted); line-height: 1.5; margin: 12px 0 4px; }
.badge.night { background: #fdf3c8; color: #7a6410; }

/* horizontal stage cards (the Zeitplan's single view) */
#tlCard.horiz { width: min(940px, 96vw); }
#tlPrint { position: absolute; top: 13px; right: 50px; }
.tl-h { display: flex; align-items: stretch; overflow-x: auto; padding: 4px 2px 12px; }
.tl-hcard {
  flex: none; width: 132px; background: #fff; border: 1px solid var(--line); border-radius: 10px;
  padding: 7px 9px 8px; display: flex; flex-direction: column; gap: 2px;
}
.tl-hcard.editable { cursor: pointer; transition: border-color 0.15s, box-shadow 0.15s; }
.tl-hcard.editable:hover { border-color: #cbe0db; box-shadow: 0 4px 12px rgba(14,59,54,0.10); }
.tl-hday {
  height: 15px; font-size: 10px; font-weight: 800; color: var(--sunset);
  letter-spacing: 0.2px; white-space: nowrap; overflow: hidden;
}
.tl-hname { display: flex; align-items: center; gap: 6px; min-height: 20px; }
.tl-hname .num {
  flex: none; width: 18px; height: 18px; line-height: 18px; text-align: center;
  border-radius: 50%; color: #fff; font-size: 10px; font-weight: bold;
}
.tl-hname .nm {
  font-size: 11.5px; font-weight: 700; color: var(--teal-deep);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.tl-ht { font-size: 10.5px; color: var(--blue); font-weight: 600; }
.tl-ht.est { color: var(--muted); font-weight: 500; }
.tl-ht.none { color: #b0b0ac; }
.tl-ht.warn { color: #c0392b; }
.tl-hn .badge.night { font-size: 10px; padding: 1px 6px; }

/* stages view: overnight anchors on top, pass-through stops below as via-pills.
   The via list must never widen the connector, or the anchor row drifts apart. */
.tl-s { align-items: flex-start; }
.tl-s .tl-hcard { width: 118px; }
.tl-sseg { flex: none; display: flex; flex-direction: column; align-items: center; padding: 0 1px; width: 48px; }
.tl-sseg .seg-top {
  height: 76px; display: flex; flex-direction: column; align-items: center; justify-content: center;
  font-size: 9px; color: var(--gold); white-space: nowrap; line-height: 1.25;
}
.tl-sseg .seg-top .arr { color: #b0b0ac; font-size: 11px; }
/* full names, never truncated: pills stay centered on the narrow connector and
   may overhang sideways beneath the neighboring anchor cards */
.tl-sseg .seg-via {
  display: flex; flex-direction: column; align-items: center; gap: 2px; align-self: stretch;
  border-top: 2px dotted #d8d5cd; padding-top: 4px; margin-top: 2px;
}
.via-label { font-size: 8.5px; font-weight: 800; color: #b0b0ac; text-transform: uppercase; letter-spacing: 0.6px; }
.via-leg { font-size: 9px; color: var(--gold); line-height: 1.3; white-space: nowrap; }
.via-pill {
  display: flex; align-items: center; gap: 4px; border: 1px solid var(--line); border-radius: 999px;
  background: #fff; padding: 1px 7px 1px 2px; font: 600 10px var(--body); color: var(--teal-deep);
  flex: none; cursor: pointer;
}
.via-pill:hover { border-color: #cbe0db; background: #f4f8f7; }
.via-pill .vname { white-space: nowrap; }
.via-pill .vnum {
  flex: none; width: 14px; height: 14px; line-height: 14px; text-align: center;
  border-radius: 50%; color: #fff; font-size: 8.5px; font-weight: bold;
}

/* ---- Toast ---- */
#toast {
  position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%) translateY(20px);
  background: var(--teal); color: #fff; padding: 10px 18px; border-radius: 999px;
  font-size: 14px; font-weight: bold; opacity: 0; pointer-events: none;
  transition: opacity 0.2s, transform 0.2s; z-index: 2000;
}
#toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

/* ---- Photo lightbox ---- */
#rpLightbox {
  display: none; position: fixed; inset: 0; z-index: 1300;
  background: rgba(0,0,0,0.85); align-items: center; justify-content: center;
}
#rpLightbox.open { display: flex; }
#rpLightbox .lb-img {
  max-width: 92vw; max-height: 84vh; border-radius: 8px;
  box-shadow: 0 10px 50px rgba(0,0,0,0.6); background: #222;
}
#rpLightbox .lb-close {
  position: absolute; top: 16px; right: 18px; width: 38px; height: 38px;
  border: none; border-radius: 50%; background: rgba(255,255,255,0.15); color: #fff;
  font-size: 22px; line-height: 38px; cursor: pointer;
}
#rpLightbox .lb-close:hover { background: rgba(255,255,255,0.3); }
#rpLightbox .lb-link {
  position: absolute; bottom: 18px; left: 50%; transform: translateX(-50%);
  color: #fff; font-size: 13px; text-decoration: none;
  background: rgba(0,0,0,0.5); padding: 7px 14px; border-radius: 999px;
}
#rpLightbox .lb-link:hover { background: rgba(0,0,0,0.75); }
#rpLightbox .lb-nav {
  position: absolute; top: 50%; transform: translateY(-50%);
  width: 48px; height: 66px; border: none; border-radius: 8px;
  background: rgba(255,255,255,0.12); color: #fff; font-size: 34px; line-height: 1;
  cursor: pointer; display: flex; align-items: center; justify-content: center;
}
#rpLightbox .lb-nav:hover { background: rgba(255,255,255,0.28); }
#rpLightbox .lb-prev { left: 14px; }
#rpLightbox .lb-next { right: 14px; }
#rpLightbox .lb-count {
  position: absolute; top: 18px; left: 50%; transform: translateX(-50%);
  color: #fff; font-size: 13px; background: rgba(0,0,0,0.45); padding: 4px 10px; border-radius: 999px;
}
@media (max-width: 720px) { #rpLightbox .lb-nav { width: 40px; height: 56px; font-size: 28px; } }

/* editable stop name (manual rename) */
.stop.editable .stopname { cursor: text; border-bottom: 1px dashed transparent; }
.stop.editable .stopname:hover { border-bottom-color: var(--line); }
/* Tesla Supercharger map pin */
.sc-pin {
  width: 20px; height: 20px; box-sizing: border-box; border-radius: 6px;
  background: #e82127; color: #fff; font-size: 11px; line-height: 16px; text-align: center;
  border: 2px solid #fff; box-shadow: 0 1px 4px rgba(0,0,0,0.4);
}

/* ---- Mobile: stack the editor (full-width map on top, route list below) ---- */
@media (max-width: 720px) {
  #view.fullbleed { overflow: auto; -webkit-overflow-scrolling: touch; }
  #editor-wrap { flex-direction: column; height: auto; min-height: 100%; }
  #map { flex: none; width: 100%; height: 68vh; min-height: 360px; }
  #panel { width: 100%; height: auto; border-left: none; border-top: 1px solid #ddd; }
  /* topbar editor actions: icon-only to fit small screens */
  .tb-label { display: none; }
  #mapMenu { right: 8px; }
  /* topbar: let the email shrink/truncate so the layout doesn't overflow */
  .topbar-email { max-width: 34vw; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  /* dashboard route cards: stack actions below the title instead of overlapping */
  .route-row { flex-wrap: wrap; align-items: flex-start; }
  .route-row .grow { flex: 1 1 calc(100% - 48px); }
  .route-row .row-actions { flex-basis: 100%; margin-top: 10px; }
  .route-row .row-actions .rbtn { flex: 1 1 auto; }
  .route-row .row-actions .rowmenu-wrap { flex: none; }
  .dash-actions { width: 100%; }
  .dash-actions .btn { flex: 1 1 auto; text-align: center; }
}

/* ---- Drive view ("Fahrmodus") — after the media query so it wins over
       the mobile #view.fullbleed { overflow: auto } rule ---- */
#view.driving { height: 100%; overflow: hidden; }
#drive-wrap { position: relative; height: 100%; }
#dmap { position: absolute; inset: 0; }
#driveHud {
  position: absolute; top: calc(10px + env(safe-area-inset-top, 0px)); left: 10px; right: 10px;
  z-index: 1000; color: #fff;
  background: linear-gradient(120deg, var(--teal), var(--teal-deep));
  border-radius: 14px; padding: 12px 14px; box-shadow: 0 4px 18px rgba(0,0,0,0.3);
}
.dh-top { display: flex; align-items: center; gap: 8px; }
.dh-label { font-size: 10px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.7px; opacity: 0.75; white-space: nowrap; }
.dh-name { flex: 1; min-width: 0; font-family: var(--display); font-weight: 800; font-size: 17px; letter-spacing: -0.3px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
#driveExit {
  flex: none; width: 32px; height: 32px; border-radius: 50%; border: 1px solid rgba(255,255,255,0.35);
  background: rgba(255,255,255,0.15); color: #fff; font-size: 18px; line-height: 1; cursor: pointer;
}
#driveExit:hover { background: rgba(255,255,255,0.25); }
.dh-stats { display: flex; margin-top: 10px; }
.dh-cell { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 1px; }
.dh-cell + .dh-cell { border-left: 1px solid rgba(255,255,255,0.2); }
.dh-cell b { font-family: var(--display); font-weight: 800; font-size: 26px; letter-spacing: -0.5px; white-space: nowrap; }
.dh-cell span { font-size: 10px; text-transform: uppercase; letter-spacing: 0.7px; opacity: 0.75; }
.dh-status { margin-top: 8px; font-size: 11px; opacity: 0.85; min-height: 14px; }
.dh-status.warn { color: var(--amber); opacity: 1; font-weight: 700; }
.dh-status:empty { display: none; }
.dh-fab {
  position: absolute; bottom: calc(14px + env(safe-area-inset-bottom, 0px)); z-index: 1000;
  border: 1px solid var(--line); border-radius: 999px; padding: 10px 16px;
  background: #fff; color: var(--teal); font-size: 14px; font-weight: 700; cursor: pointer;
  box-shadow: 0 3px 12px rgba(0,0,0,0.25);
}
.dh-fab[hidden] { display: none; }
.dh-skip { right: 14px; }
/* location FAB (à la Google Maps) — always on the map, both views */
.loc-fab {
  position: absolute; right: 12px; bottom: 36px; z-index: 1000;
  width: 46px; height: 46px; border-radius: 50%; border: none; cursor: pointer;
  background: #fff; color: #5f6b73;
  display: flex; align-items: center; justify-content: center;
  box-shadow: 0 3px 12px rgba(0,0,0,0.3);
  transition: color 0.15s, transform 0.1s;
}
.loc-fab:active { transform: scale(0.93); }
.loc-fab.active { color: #1a73e8; }
.loc-fab .loc-n {
  display: none; position: absolute; top: 3px; right: 6px;
  font: 800 10px var(--body); color: #c0392b;
}
.loc-fab.north .loc-n { display: block; }
#drive-wrap .loc-fab { right: 14px; bottom: calc(76px + env(safe-area-inset-bottom, 0px)); }
/* GPS blue dot with pulse ring */
.gps-dot {
  position: relative; width: 16px; height: 16px; margin: 3px; border-radius: 50%;
  background: #1a73e8; border: 3px solid #fff; box-shadow: 0 1px 6px rgba(0,0,0,0.45);
}
.gps-dot::after {
  content: ''; position: absolute; inset: -3px; border-radius: 50%;
  background: rgba(26,115,232,0.4);
  transform-origin: center; animation: halo 2.6s ease-out infinite;
}

/* ---------- Onboarding-Tour (tour.js) ---------- */
#tourLayer {
  position: fixed; inset: 0; z-index: 1600;   /* über #mapMenu (1500), unter #toast (2000) */
}
.tour-spot {
  position: absolute; border-radius: 12px;
  box-shadow: 0 0 0 9999px rgba(14, 59, 54, 0.55);   /* Cutout: alles ausser dem Loch abdunkeln */
  transition: left 0.35s ease, top 0.35s ease, width 0.35s ease, height 0.35s ease;
  pointer-events: none;
}
.tour-tip {
  position: absolute; max-width: 340px; min-width: 260px;
  background: #fff; border-radius: 14px; padding: 18px 18px 14px;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.35);
  font-family: var(--body);
  transition: left 0.3s ease, top 0.3s ease;
}
.tour-tip.loading .tt-title::after { content: ' …'; }
.tour-tip .tour-close {
  position: absolute; top: 8px; right: 10px; border: none; background: none;
  font-size: 15px; color: var(--muted); cursor: pointer; padding: 4px;
}
.tour-tip .tt-title {
  font-family: var(--display); font-weight: 700; font-size: 17px;
  color: var(--teal); margin: 0 18px 6px 0;
}
.tour-tip .tt-text { font-size: 13.5px; line-height: 1.65; color: #555; }
.tour-tip .tt-progress {
  display: flex; align-items: center; justify-content: space-between;
  margin-top: 12px; font-size: 11.5px; color: var(--muted);
}
.tour-dots { display: inline-flex; gap: 4px; }
.tour-dots span {
  width: 6px; height: 6px; border-radius: 50%; background: var(--line); display: inline-block;
}
.tour-dots span.on { background: var(--sunset); }
.tour-tip .tt-actions { display: flex; gap: 8px; justify-content: flex-end; margin-top: 10px; }
.tour-tip .tt-actions button {
  font: inherit; font-size: 13px; font-weight: 600; border-radius: 8px;
  padding: 8px 14px; cursor: pointer; border: none;
}
.tour-tip .tt-back { background: #fff; color: var(--teal); border: 1px solid var(--line); }
.tour-tip .tt-next {
  background: linear-gradient(135deg, var(--amber), var(--sunset)); color: #fff;
}
@media (max-width: 720px) {
  .tour-tip {
    left: 8px !important; right: 8px; top: auto !important;
    bottom: calc(12px + env(safe-area-inset-bottom, 0px));
    max-width: none; min-width: 0;
  }
}
