/* Swervo web route planner.
   Same tokens as web/site/styles.css, which mirror the app's theme
   (src/theme/colors.ts, colors.dark.ts, radius.ts). Light by default; dark
   only through the header toggle (data-theme="dark"). */

:root {
  --primary: #0A84FF;
  --primary-dark: #005BBB;
  --primary-soft: #D6EDFF;
  --primary-tint: #EAF4FF;
  --bg: #F5F7FA;
  --bg-2: #EDF0F5;
  --surface: #FFFFFF;
  --text: #111111;
  --text-2: #5F6670;
  --muted: #9CA3AF;
  --border: #E5E7EB;
  --border-soft: #ECF0F3;
  --success: #34C759;
  --danger: #FF3B30;
  --warning-bg: #FFF4E5;
  --warning-text: #8A4B00;
  --chip-bg: #FFFFFF;
  --shadow-sm: 0 2px 6px rgba(15, 23, 42, 0.06);
  --shadow-md: 0 8px 24px rgba(15, 23, 42, 0.10);
  --shadow-lg: 0 30px 60px -20px rgba(15, 23, 42, 0.35), 0 12px 24px -12px rgba(15, 23, 42, 0.18);
  --r-sm: 8px;
  --r-md: 12px;
  --r-lg: 18px;
  --r-xl: 24px;
  --top-h: 60px;
  --panel-w: 400px;
  --font: "Inter", -apple-system, BlinkMacSystemFont, "SF Pro Text", Roboto, "Segoe UI", Helvetica, Arial, sans-serif;
  color-scheme: light;
}

:root[data-theme="dark"] {
  --primary: #1DA1FF;
  --primary-dark: #0A74C9;
  --primary-soft: #153B57;
  --primary-tint: #16283A;
  --bg: #121820;
  --bg-2: #171E27;
  --surface: #1B222C;
  --text: #F4F7FA;
  --text-2: #B5BEC9;
  --muted: #7E8996;
  --border: #303A46;
  --border-soft: #26313D;
  --success: #30D158;
  --danger: #FF453A;
  --warning-bg: #3A2A10;
  --warning-text: #FFD38A;
  --chip-bg: #222A35;
  --shadow-sm: 0 2px 6px rgba(0, 0, 0, 0.3);
  --shadow-md: 0 8px 24px rgba(0, 0, 0, 0.4);
  --shadow-lg: 0 30px 60px -20px rgba(0, 0, 0, 0.7), 0 12px 24px -12px rgba(0, 0, 0, 0.5);
  color-scheme: dark;
}

*, *::before, *::after { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  font-family: var(--font); font-size: 15px; line-height: 1.45; color: var(--text); background: var(--bg);
  -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale;
}
a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }
button, input, textarea, select { font: inherit; color: inherit; }
button { -webkit-tap-highlight-color: transparent; }
[hidden] { display: none !important; }
.sprite { position: absolute; width: 0; height: 0; overflow: hidden; }
.icon { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; flex: none; }
:focus-visible { outline: 3px solid var(--primary); outline-offset: 2px; border-radius: 6px; }

/* ── Header ─────────────────────────────────────────────── */
.top {
  position: relative; z-index: 20; height: var(--top-h); display: flex; align-items: center; gap: 14px;
  padding: 0 16px; padding-left: max(16px, env(safe-area-inset-left)); padding-right: max(16px, env(safe-area-inset-right));
  background: var(--surface); border-bottom: 1px solid var(--border);
}
.logo { display: inline-flex; align-items: center; gap: 10px; font-weight: 800; font-size: 19px; letter-spacing: -0.02em; color: var(--text); }
.logo:hover { text-decoration: none; }
.logo-mark {
  width: 34px; height: 34px; border-radius: 10px; display: grid; place-items: center;
  background: linear-gradient(160deg, #3DA0FF, var(--primary) 55%, #0066D6); color: #fff;
  box-shadow: 0 6px 14px -4px rgba(10, 132, 255, .6);
}
.logo-mark img { display: block; height: 25px; width: auto; }
.top-title { padding-left: 14px; border-left: 1px solid var(--border); font-weight: 700; color: var(--text-2); white-space: nowrap; }
.top-spacer { flex: 1; }
.theme-toggle { display: inline-flex; gap: 2px; padding: 3px; border-radius: 999px; background: var(--bg-2); border: 1px solid var(--border); flex: none; }
.theme-toggle button { width: 32px; height: 32px; border-radius: 50%; border: 0; background: none; color: var(--text-2); display: grid; place-items: center; cursor: pointer; transition: background-color .2s, color .2s; }
.theme-toggle button:hover { color: var(--text); }
.theme-toggle button[aria-pressed="true"] { background: var(--surface); color: var(--primary); box-shadow: var(--shadow-sm); }
.theme-toggle .icon { width: 17px; height: 17px; }

.account { position: relative; flex: none; }
.avatar-btn { border: 0; background: none; padding: 0; cursor: pointer; border-radius: 50%; display: block; }
.avatar {
  width: 36px; height: 36px; border-radius: 50%; display: grid; place-items: center; overflow: hidden;
  background: var(--primary-soft); color: var(--primary); font-weight: 800; font-size: 15px;
}
.avatar img { width: 100%; height: 100%; object-fit: cover; }
.account-pop {
  position: absolute; right: 0; top: calc(100% + 8px); min-width: 220px; max-width: 280px; padding: 6px;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-md); box-shadow: var(--shadow-md);
}
.account-email { margin: 0; padding: 8px 10px 10px; font-size: 13px; color: var(--text-2); overflow-wrap: anywhere; border-bottom: 1px solid var(--border-soft); }
.pop-item { display: block; width: 100%; text-align: left; padding: 10px; margin-top: 4px; border: 0; background: none; border-radius: var(--r-sm); font-weight: 600; cursor: pointer; }
.pop-item:hover { background: var(--bg-2); }

/* ── Buttons ────────────────────────────────────────────── */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  height: 48px; padding: 0 22px; border-radius: 14px; border: 0; cursor: pointer;
  font-weight: 700; font-size: 16px; white-space: nowrap;
  transition: transform .15s, box-shadow .2s, background-color .2s, opacity .2s;
}
.btn:active:not(:disabled) { transform: scale(.97); }
.btn:disabled { cursor: not-allowed; opacity: .45; box-shadow: none; }
.btn-primary { background: var(--primary); color: #fff; box-shadow: 0 8px 18px -8px rgba(10, 132, 255, .8); }
.btn-primary:hover:not(:disabled) { background: var(--primary-dark); }
.btn-soft { background: var(--primary-tint); color: var(--primary); }
.btn-soft:hover:not(:disabled) { background: var(--primary-soft); }
.btn-ghost { background: transparent; color: var(--primary); border: 1.5px solid var(--border); }
.btn-ghost:hover:not(:disabled) { border-color: var(--primary); }
.btn-sm { height: 38px; padding: 0 14px; font-size: 14px; border-radius: 12px; }
.btn-sm .icon { width: 17px; height: 17px; }
.btn-block { width: 100%; }

/* ── Layout ─────────────────────────────────────────────── */
.layout { display: grid; grid-template-columns: var(--panel-w) 1fr; height: calc(100vh - var(--top-h)); height: calc(100dvh - var(--top-h)); }
.panel { position: relative; z-index: 10; display: flex; flex-direction: column; min-height: 0; background: var(--surface); border-right: 1px solid var(--border); }
.panel-scroll { flex: 1; min-height: 0; overflow-y: auto; padding: 16px 18px 20px; overscroll-behavior: contain; }
.panel-foot { padding: 12px 18px 14px; border-top: 1px solid var(--border); background: var(--surface); }
.foot-note { margin: 8px 0 0; text-align: center; font-size: 12.5px; color: var(--muted); }
.map-wrap { position: relative; min-width: 0; min-height: 0; }
#map { position: absolute; inset: 0; background: var(--bg-2); }

/* ── Tabs ───────────────────────────────────────────────── */
.tabs { display: grid; grid-template-columns: 1fr 1fr; gap: 4px; padding: 4px; margin-bottom: 16px; border-radius: 14px; background: var(--bg-2); }
.tabs button {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px; height: 40px; border: 0; border-radius: 11px;
  background: none; font-weight: 700; font-size: 14px; color: var(--text-2); cursor: pointer; white-space: nowrap;
}
.tabs .icon { width: 17px; height: 17px; }
.tabs button[aria-selected="true"] { background: var(--surface); color: var(--text); box-shadow: var(--shadow-sm); }
.tabs button[aria-selected="true"] .icon { color: var(--primary); }

/* ── Search ─────────────────────────────────────────────── */
.search { position: relative; }
.search input {
  width: 100%; height: 46px; padding: 0 14px 0 42px; border-radius: var(--r-md); border: 1px solid var(--border);
  background: var(--bg); font-size: 15px; outline: none; transition: border-color .15s, background-color .15s;
}
.search input::placeholder { color: var(--muted); }
.search input:focus { border-color: var(--primary); background: var(--surface); }
.search input::-webkit-search-cancel-button { cursor: pointer; }
.search-icon { position: absolute; left: 14px; top: 13px; width: 20px; height: 20px; color: var(--muted); pointer-events: none; }
.suggest {
  position: absolute; z-index: 30; left: 0; right: 0; top: calc(100% + 6px); margin: 0; padding: 6px; list-style: none;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-md); box-shadow: var(--shadow-md);
  max-height: 320px; overflow-y: auto;
}
.suggest li { display: flex; gap: 10px; align-items: flex-start; padding: 9px 10px; border-radius: var(--r-sm); cursor: pointer; }
.suggest li[aria-selected="true"], .suggest li:hover { background: var(--bg-2); }
.suggest li .icon { width: 18px; height: 18px; margin-top: 1px; color: var(--muted); }
.suggest .s-name { display: block; font-weight: 600; }
.suggest .s-sub { display: block; font-size: 13px; color: var(--text-2); }
.suggest .s-empty { cursor: default; color: var(--text-2); font-size: 14px; }
.suggest .s-empty:hover { background: none; }

/* ── Stops ──────────────────────────────────────────────── */
.stops { list-style: none; margin: 14px 0 0; padding: 0; position: relative; }
.stop {
  position: relative; display: flex; align-items: center; gap: 10px; min-height: 52px; padding: 6px 6px 6px 4px;
  background: var(--surface); border-radius: var(--r-md); touch-action: pan-y;
}
.stop + .stop { margin-top: 2px; }
.stop:hover { background: var(--bg); }
.stop.is-dragging { z-index: 5; background: var(--surface); box-shadow: var(--shadow-md); }
.stop.is-via .stop-label { color: var(--text-2); }
/* The dotted line joining the badges */
.stop:not(:last-child)::after {
  content: ""; position: absolute; left: 49px; top: calc(50% + 14px); height: calc(100% - 26px); border-left: 2px dotted var(--border);
}
.stop.is-dragging::after { display: none; }
.grip { width: 22px; height: 32px; display: grid; place-items: center; color: var(--muted); cursor: grab; border: 0; background: none; padding: 0; touch-action: none; border-radius: 6px; }
.grip:active { cursor: grabbing; }
.grip .icon { width: 18px; height: 18px; }
/* The itinerary's stop icons (app/itinerary.tsx stopIcon): primary circles,
   white content. */
.badge {
  width: 28px; height: 28px; border-radius: 50%; display: grid; place-items: center; flex: none;
  font-size: 13px; font-weight: 700; color: #fff; background: var(--primary);
}
.badge .icon { width: 14px; height: 14px; }
.badge-dot { width: 8px; height: 8px; border-radius: 50%; background: #fff; }
.stop-main { flex: 1; min-width: 0; cursor: pointer; padding: 4px 0; background: none; border: 0; text-align: left; }
.stop-kind { display: block; font-size: 12px; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; }
.stop-label { display: block; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.icon-btn { width: 34px; height: 34px; border-radius: 50%; display: grid; place-items: center; border: 0; background: none; color: var(--muted); cursor: pointer; flex: none; }
.icon-btn:hover { background: var(--bg-2); color: var(--text); }
.icon-btn .icon { width: 17px; height: 17px; }
.stop-add-hint { margin: 8px 0 0; padding-left: 4px; font-size: 13px; color: var(--muted); display: flex; align-items: center; gap: 8px; }
.stop-add-hint .icon { width: 16px; height: 16px; }

.empty { margin-top: 14px; padding: 16px; border-radius: var(--r-lg); background: var(--bg); border: 1px dashed var(--border); }
.empty p { margin: 0 0 12px; color: var(--text-2); font-size: 14px; }
.empty strong { color: var(--text); }

/* ── Switch rows ────────────────────────────────────────── */
.switch-row { display: flex; align-items: center; justify-content: space-between; gap: 14px; margin-top: 14px; padding: 12px 14px; border-radius: var(--r-md); background: var(--bg); cursor: pointer; }
.switch-title { display: block; font-weight: 600; font-size: 14.5px; }
.switch-sub { display: block; font-size: 12.5px; color: var(--text-2); }
.switch { appearance: none; -webkit-appearance: none; position: relative; width: 46px; height: 28px; margin: 0; border-radius: 999px; background: var(--border); cursor: pointer; flex: none; transition: background-color .2s; }
.switch::after { content: ""; position: absolute; top: 3px; left: 3px; width: 22px; height: 22px; border-radius: 50%; background: #fff; box-shadow: 0 1px 3px rgba(0, 0, 0, .25); transition: transform .2s; }
.switch:checked { background: var(--primary); }
.switch:checked::after { transform: translateX(18px); }

/* ── Round trip ─────────────────────────────────────────── */
.label { margin: 18px 0 8px; font-size: 13px; font-weight: 700; color: var(--text-2); text-transform: uppercase; letter-spacing: .05em; }
#mode-loop > .label:first-child { margin-top: 0; }
.loop-start { display: flex; align-items: center; gap: 10px; margin-top: 10px; padding: 10px 12px; border-radius: var(--r-md); background: var(--bg); }
.loop-start-text { font-weight: 600; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.row-actions { display: flex; align-items: center; gap: 10px; margin-top: 10px; }
.hint { font-size: 13px; color: var(--muted); }
.field-head { display: flex; align-items: baseline; justify-content: space-between; }
.field-head .label { margin-bottom: 4px; }
.dist-value { font-weight: 800; font-size: 18px; color: var(--primary); }
input[type="range"] { width: 100%; accent-color: var(--primary); margin: 6px 0 0; height: 28px; }
.range-ends { display: flex; justify-content: space-between; font-size: 12px; color: var(--muted); }
.loop-go { margin-top: 18px; }
.loop-progress { margin: 10px 0 0; text-align: center; font-size: 13.5px; color: var(--text-2); }

/* ── Options ────────────────────────────────────────────── */
.opts { margin-top: 4px; }
.seg { display: grid; grid-template-columns: repeat(3, 1fr); gap: 4px; padding: 4px; border-radius: 14px; background: var(--bg-2); }
.seg button { height: 38px; border: 0; border-radius: 11px; background: none; font-weight: 700; font-size: 14px; color: var(--text-2); cursor: pointer; }
.seg button[aria-checked="true"] { background: var(--surface); color: var(--primary); box-shadow: var(--shadow-sm); }
.seg-help { margin: 8px 2px 0; font-size: 13px; color: var(--text-2); }

.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip {
  display: inline-flex; align-items: center; gap: 6px; height: 36px; padding: 0 14px; border-radius: 999px; cursor: pointer;
  background: var(--chip-bg); border: 1px solid var(--border); font-size: 14px; font-weight: 600; color: var(--text);
  transition: background-color .15s, border-color .15s, color .15s;
}
.chip:hover:not(:disabled) { border-color: var(--primary); }
.chip:disabled { cursor: default; opacity: .55; }
.chip .icon { width: 16px; height: 16px; }
.chip .chip-check { display: none; }
.chip[aria-pressed="true"], .chip[aria-checked="true"] { background: var(--primary-soft); border-color: var(--primary); color: var(--primary); }
.chip[aria-pressed="true"] .chip-check { display: block; }
.compass .chip { min-width: 44px; justify-content: center; padding: 0 10px; }

/* ── Summary ────────────────────────────────────────────── */
.summary { margin-top: 20px; padding: 12px 14px 14px; border-radius: var(--r-lg); background: var(--bg); border: 1px solid var(--border-soft); }
.stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; }
.stat { display: flex; flex-direction: column; align-items: center; text-align: center; gap: 2px; min-width: 0; }
.stat .icon { width: 18px; height: 18px; color: var(--primary); margin-bottom: 2px; }
.stat strong { font-size: 18px; font-weight: 800; letter-spacing: -0.01em; white-space: nowrap; }
.stat span { font-size: 12px; color: var(--text-2); }
.note { margin: 12px 0 0; padding: 9px 11px; border-radius: var(--r-sm); background: var(--warning-bg); color: var(--warning-text); font-size: 13px; }
.summary-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 12px; }
.summary-head h3 { margin: 0; font-size: 15px; font-weight: 800; }
.units { display: inline-flex; gap: 2px; padding: 2px; border-radius: 999px; background: var(--bg-2); }
.units button { height: 22px; padding: 0 8px; border: 0; border-radius: 999px; background: none; font-size: 11.5px; font-weight: 700; color: var(--muted); cursor: pointer; }
.units button[aria-pressed="true"] { background: var(--surface); color: var(--text); box-shadow: var(--shadow-sm); }
.route-error { margin: 14px 0 0; padding: 10px 12px; border-radius: var(--r-md); background: color-mix(in srgb, var(--danger) 12%, transparent); color: var(--danger); font-size: 13.5px; font-weight: 600; }

/* ── Tools ──────────────────────────────────────────────── */
.tools { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; margin-top: 16px; }
.tool {
  display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 10px 4px; border-radius: var(--r-md);
  border: 1px solid var(--border-soft); background: var(--surface); font-size: 12px; font-weight: 600; color: var(--text-2); cursor: pointer;
}
.tool .icon { width: 19px; height: 19px; color: var(--text); }
.tool:hover:not(:disabled) { background: var(--bg); }
.tool:disabled { opacity: .4; cursor: default; }
.tool-danger:hover:not(:disabled) .icon, .tool-danger:hover:not(:disabled) { color: var(--danger); }

/* ── Map overlays ───────────────────────────────────────── */
.map-hint, .map-busy {
  position: absolute; left: 50%; transform: translateX(-50%); z-index: 2; display: inline-flex; align-items: center; gap: 8px;
  padding: 8px 14px; border-radius: 999px; background: var(--surface); color: var(--text); box-shadow: var(--shadow-md);
  font-size: 13.5px; font-weight: 600; white-space: nowrap; pointer-events: none;
}
.map-hint { bottom: 28px; }
.map-busy { top: 14px; }
.spinner { width: 16px; height: 16px; border-radius: 50%; border: 2.5px solid var(--primary-soft); border-top-color: var(--primary); animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.map-failed { position: absolute; inset: 0; display: grid; place-items: center; padding: 24px; text-align: center; color: var(--text-2); background: var(--bg-2); }

/* Map markers: the app's RouteMarkers.tsx, one blue (#0A84FF) in both
   themes, as there. */
.mk {
  position: relative; width: 28px; height: 28px; border-radius: 50%; display: grid; place-items: center; cursor: grab;
  font: 800 13px/1 var(--font); color: #fff; background: #0A84FF; box-shadow: 0 2px 4px rgba(0, 0, 0, .25);
}
.mk:active { cursor: grabbing; }
.mk svg { width: 16px; height: 16px; fill: none; stroke: #fff; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.mk-start { width: 24px; height: 24px; }
.mk-dot { width: 8px; height: 8px; border-radius: 50%; background: #fff; }
.mk-loop-badge {
  position: absolute; right: -5px; bottom: -5px; width: 15px; height: 15px; border-radius: 50%;
  display: grid; place-items: center; background: #fff; border: 1.5px solid #0A84FF;
}
.mk .mk-loop-badge svg { width: 9px; height: 9px; stroke: #0A84FF; }
.mapboxgl-ctrl-group { border-radius: 12px !important; overflow: hidden; }
.mapboxgl-popup-content { font-family: var(--font); }

/* ── Sheets (dialogs) ───────────────────────────────────── */
.sheet {
  width: min(460px, calc(100% - 32px)); max-height: calc(100dvh - 48px); padding: 0; border: 0; border-radius: var(--r-xl);
  background: var(--surface); color: var(--text); box-shadow: var(--shadow-lg); overflow: auto;
}
.sheet::backdrop { background: rgba(10, 14, 20, .5); backdrop-filter: blur(2px); }
.sheet-body { padding: 22px 22px 20px; }
.sheet-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 6px; }
.sheet-head h2 { margin: 0; font-size: 21px; font-weight: 800; letter-spacing: -0.01em; }
.close { width: 34px; height: 34px; border-radius: 50%; border: 0; background: var(--bg-2); color: var(--text-2); display: grid; place-items: center; cursor: pointer; flex: none; }
.close .icon { width: 17px; height: 17px; }
.close:hover { color: var(--text); }
.sheet-sub { margin: 0 0 16px; color: var(--text-2); font-size: 14px; }
.sheet-foot { margin: 14px 0 0; text-align: center; font-size: 13px; color: var(--text-2); }
.field { display: block; margin: 0 0 14px; }
.field > span { display: block; margin-bottom: 6px; font-weight: 700; font-size: 13.5px; }
.field em { font-style: normal; font-weight: 500; color: var(--muted); }
.field input, .field textarea {
  width: 100%; padding: 12px 14px; border-radius: var(--r-md); border: 1px solid var(--border); background: var(--bg); outline: none; font-size: 15px;
}
.field textarea { resize: vertical; min-height: 76px; }
.field input:focus, .field textarea:focus { border-color: var(--primary); background: var(--surface); }
.field-help { margin: -2px 0 8px; font-size: 12.5px; color: var(--text-2); }
.form-error { margin: 0 0 12px; padding: 9px 12px; border-radius: var(--r-sm); background: color-mix(in srgb, var(--danger) 12%, transparent); color: var(--danger); font-size: 13.5px; font-weight: 600; }

.save-stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; margin: 10px 0 18px; padding: 12px 8px; border-radius: var(--r-lg); background: var(--bg); }
.save-stats div { display: flex; flex-direction: column; align-items: center; gap: 2px; text-align: center; }
.save-stats .icon { width: 18px; height: 18px; color: var(--primary); }
.save-stats strong { font-size: 16px; font-weight: 800; }
.save-stats span { font-size: 11.5px; color: var(--text-2); }

.vis { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.vis button {
  display: flex; align-items: flex-start; gap: 10px; padding: 12px; text-align: left; border-radius: var(--r-md);
  border: 1.5px solid var(--border); background: var(--surface); cursor: pointer;
}
.vis button .icon { width: 18px; height: 18px; margin-top: 1px; color: var(--text-2); }
.vis strong { display: block; font-size: 14px; }
.vis small { display: block; font-size: 12px; color: var(--text-2); }
.vis button[aria-checked="true"] { border-color: var(--primary); background: var(--primary-tint); }
.vis button[aria-checked="true"] .icon { color: var(--primary); }

.saved { text-align: center; padding-top: 28px; }
.saved-mark { width: 60px; height: 60px; margin: 0 auto 12px; border-radius: 50%; display: grid; place-items: center; background: color-mix(in srgb, var(--success) 16%, transparent); color: var(--success); }
.saved-mark .icon { width: 30px; height: 30px; stroke-width: 2.6; }
.saved h2 { margin: 0 0 8px; font-size: 22px; font-weight: 800; }
.saved p { margin: 0 0 20px; color: var(--text-2); }
.saved-actions { display: flex; gap: 10px; justify-content: center; flex-wrap: wrap; }

/* ── Toast ──────────────────────────────────────────────── */
.toast {
  position: fixed; left: 50%; bottom: 24px; z-index: 100; transform: translate(-50%, 20px); max-width: calc(100% - 32px);
  padding: 11px 16px; border-radius: 12px; background: #111; color: #fff; font-size: 14px; font-weight: 600;
  box-shadow: var(--shadow-md); opacity: 0; pointer-events: none; transition: opacity .2s, transform .2s;
}
:root[data-theme="dark"] .toast { background: #F4F7FA; color: #111; }
.toast.is-on { opacity: 1; transform: translate(-50%, 0); }
.toast.has-action.is-on { pointer-events: auto; display: flex; align-items: center; gap: 14px; }
.toast-action { border: 0; background: none; padding: 2px 4px; color: #4DB2FF; font-weight: 800; cursor: pointer; }
:root[data-theme="dark"] .toast-action { color: #0A74C9; }

/* ── Narrow screens: map on top, planner below ──────────── */
@media (max-width: 899px) {
  :root { --top-h: 56px; }
  .layout { display: flex; flex-direction: column; height: auto; min-height: calc(100dvh - var(--top-h)); }
  .map-wrap { order: -1; height: 46vh; height: 46svh; min-height: 260px; position: sticky; top: 0; z-index: 1; }
  .panel { border-right: 0; border-top: 1px solid var(--border); border-radius: var(--r-xl) var(--r-xl) 0 0; margin-top: -18px; box-shadow: 0 -8px 24px -12px rgba(15, 23, 42, .25); }
  .panel-scroll { overflow: visible; padding: 18px 16px 16px; }
  .panel-foot { position: sticky; bottom: 0; padding: 10px 16px calc(12px + env(safe-area-inset-bottom)); box-shadow: 0 -6px 16px -10px rgba(15, 23, 42, .3); }
  .top { gap: 10px; }
  /* The panel's rounded top overlaps the map by 18px: keep the Mapbox logo,
     attribution and scale above it. */
  .map-wrap .mapboxgl-ctrl-bottom-left, .map-wrap .mapboxgl-ctrl-bottom-right { bottom: 18px; }
  .map-wrap .mapboxgl-ctrl-scale { display: none; }
  .map-hint { bottom: 52px; font-size: 13px; padding: 7px 12px; }
}
@media (max-width: 520px) {
  .top-title { display: none; }
  .logo-word { font-size: 18px; }
  .tools { grid-template-columns: repeat(4, 1fr); }
  .vis { grid-template-columns: 1fr; }
  .sheet { width: 100%; max-width: none; margin: auto 0 0; border-radius: var(--r-xl) var(--r-xl) 0 0; max-height: 92dvh; }
  .sheet-body { padding-bottom: calc(20px + env(safe-area-inset-bottom)); }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; animation: none !important; }
}
