.planner-wrap {
  display: flex;
  flex: 1 1 auto;
  /* Prefer flex fill over height:100% — percentage height fails when ancestors size to content. */
  min-height: 0;
  height: auto;
  overflow: hidden;
  position: relative;
  background: #0b1220;
}
.planner-wrap:fullscreen,
.planner-wrap:-webkit-full-screen {
  width: 100%;
  height: 100%;
  background: #0b1220;
}
html.planner-html {
  height: 100%;
}
@supports not (height: 100dvh) {
  body.planner-page-mobile { height: 100vh; max-height: 100vh; }
}
body.planner-page-mobile {
  /* Immersive planner: fill the viewport under the site header (or full screen on mobile). */
  overscroll-behavior: none;
  display: flex;
  flex-direction: column;
  height: 100dvh;
  max-height: 100dvh;
  overflow: hidden;
  padding-bottom: 0;
}
/*
  Next.js wraps the page in #__next. Flex must run through that node — body > main
  never matches, which left the map sizing to content (~half viewport).
*/
body.planner-page-mobile #__next {
  display: flex;
  flex-direction: column;
  flex: 1 1 auto;
  min-height: 0;
  height: 100%;
  max-height: 100%;
  overflow: hidden;
}
body.planner-page-mobile #__next > .menu-bar,
body.planner-page-mobile > .menu-bar {
  flex-shrink: 0;
}
body.planner-page-mobile #__next > main.planner-page-main,
body.planner-page-mobile #__next > main,
body.planner-page-mobile > main.planner-page-main,
body.planner-page-mobile > main {
  flex: 1 1 auto;
  min-height: 0;
  max-width: none !important;
  width: 100%;
  margin: 0 !important;
  padding: 0 !important;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
@media (max-width: 768px) {
  /* Top nav is hidden; map/planner uses the full dynamic viewport. */
  body.planner-page-mobile #__next > main.planner-page-main,
  body.planner-page-mobile #__next > main,
  body.planner-page-mobile > main.planner-page-main,
  body.planner-page-mobile > main {
    flex: 1 1 auto;
  }
}
.planner-chrome-links {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  margin-top: 10px; flex-wrap: wrap;
}
.planner-all-corridors-link {
  font-size: 0.74rem; font-weight: 700; color: #93c5fd; text-decoration: none;
}
.planner-all-corridors-link:hover { text-decoration: underline; color: #bfdbfe; }
.inline-example-link {
  background: none; border: none; padding: 0; color: #93c5fd; font: inherit;
  font-weight: 700; cursor: pointer; text-decoration: underline;
}
.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0;
}
.planner-sidebar {
  width: 380px; flex-shrink: 0; background: #1a1e2e; color: #e0e4ec;
  display: flex; flex-direction: column; overflow: hidden; z-index: 10;
  transition: margin-left 0.3s ease;
}
.planner-sidebar.collapsed { margin-left: -380px; }
.sidebar-toggle {
  position: absolute; top: 12px; z-index: 20;
  background: #1a1e2e; color: #e0e4ec; border: none; padding: 8px 10px;
  border-radius: 0 8px 8px 0; cursor: pointer; font-size: 1.1rem;
  box-shadow: 2px 2px 8px rgba(0,0,0,0.3); transition: left 0.3s ease;
}
.sidebar-toggle.open { left: 380px; }
.sidebar-toggle.closed { left: 0; }
.sidebar-header { padding: 16px 18px 12px; border-bottom: 1px solid rgba(255,255,255,0.08); flex-shrink: 0; }
.sidebar-header h1 { font-size: 1.15rem; margin: 0; color: #fff; font-weight: 700; letter-spacing: -0.3px; }
.sidebar-header p { font-size: 0.78rem; margin: 6px 0 0; color: #8892a4; }
.preset-section { padding: 14px 14px 10px; border-bottom: 1px solid rgba(255,255,255,0.08); flex-shrink: 0; }
.section-kicker { font-size: 0.72rem; color: #6b7890; font-weight: 700; letter-spacing: 0.06em; text-transform: uppercase; margin-bottom: 8px; }
.preset-grid { display: grid; grid-template-columns: 1fr; gap: 8px; }
.preset-card {
  text-align: left; padding: 10px 11px; border-radius: 10px; border: 1px solid rgba(255,255,255,0.1);
  background: rgba(255,255,255,0.04); color: #c0c8d8; cursor: pointer;
}
.preset-card.active { border-color: rgba(96,165,250,0.75); background: rgba(59,130,246,0.18); color: #fff; }
.preset-card span { display: block; font-size: 0.82rem; font-weight: 800; }
.preset-card small { display: block; margin-top: 4px; font-size: 0.69rem; line-height: 1.35; color: #8fa0bb; }
.preset-card.active small { color: #b8d4ff; }
.planner-main { flex: 1; overflow-y: auto; }
.planner-main::-webkit-scrollbar { width: 5px; }
.planner-main::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.15); border-radius: 3px; }
.planner-panel { min-height: 100%; padding-bottom: 16px; }
.panel-block { padding: 12px 18px; border-bottom: 1px solid rgba(255,255,255,0.06); }
.panel-block.subtle { background: rgba(255,255,255,0.02); }
.planner-select-label { display: grid; gap: 7px; font-size: 0.78rem; font-weight: 700; color: #c0c8d8; }
.planner-select {
  width: 100%; min-width: 0; border: 1px solid rgba(255,255,255,0.14); border-radius: 8px;
  background: #111827; color: #e0e4ec; padding: 8px 10px; font: inherit; outline: none;
}
.planner-select:focus { border-color: rgba(96,165,250,0.75); box-shadow: 0 0 0 2px rgba(59,130,246,0.18); }
.route-detail { padding: 14px 18px; border-bottom: 1px solid rgba(255,255,255,0.06); }
.route-detail h2 { display: flex; align-items: center; gap: 8px; font-size: 1.05rem; color: #fff; margin: 0 0 8px; }
.route-detail h2 span { width: 12px; height: 12px; border-radius: 50%; flex-shrink: 0; }
.route-detail p { color: #9aa0b0; font-size: 0.82rem; line-height: 1.5; margin: 0 0 8px; }
.route-actions { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 10px; }
.route-stats-line { display: flex; gap: 14px; flex-wrap: wrap; padding: 12px 18px; border-bottom: 1px solid rgba(255,255,255,0.06); color: #8892a4; font-size: 0.8rem; }
.route-stats-line strong { color: #fff; }
.route-message { padding: 10px 18px; color: #fbbf24; font-size: 0.76rem; line-height: 1.45; border-bottom: 1px solid rgba(255,255,255,0.06); }
.planner-empty { padding: 24px 18px; color: #6b7890; font-size: 0.84rem; line-height: 1.5; text-align: center; }
.checkbox-row { display: flex; align-items: center; gap: 8px; color: #a0aab8; font-size: 0.8rem; cursor: pointer; }
.city-list { display: grid; gap: 7px; margin: 8px 0 10px; }
.city-row { display: grid; grid-template-columns: 24px minmax(0, 1fr) 28px; align-items: center; gap: 8px; }
.city-row > span {
  width: 22px; height: 22px; border-radius: 999px; background: #3b82f6; color: #fff;
  display: flex; align-items: center; justify-content: center; font-size: 0.7rem; font-weight: 800;
}
.city-row button, .stop-list button {
  border: none; border-radius: 6px; background: rgba(255,255,255,0.08); color: #c0c8d8;
  cursor: pointer; font-size: 0.72rem; padding: 5px 7px;
}
.stop-list { list-style: none; margin: 0; padding: 8px 18px 16px; display: grid; gap: 6px; }
.stop-list li {
  display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; gap: 8px;
  padding: 8px 8px; border-bottom: 1px solid rgba(255,255,255,0.05); color: #c0c8d8; font-size: 0.8rem;
  border-radius: 8px; cursor: pointer;
}
.stop-list li:hover { background: rgba(255,255,255,0.05); color: #fff; }
.stop-list li.selected {
  background: rgba(59,130,246,0.18); border-color: rgba(96,165,250,0.45);
  box-shadow: inset 3px 0 0 #60a5fa; color: #fff;
}
.stop-list li.disabled { opacity: 0.5; }
.stop-list strong { color: #e0e4ec; font-size: 0.82rem; }
.stop-list span { color: #6b7890; font-size: 0.72rem; }
.filter-bar { display: flex; gap: 6px; padding: 10px 18px; flex-wrap: wrap; border-bottom: 1px solid rgba(255,255,255,0.06); flex-shrink: 0; }
.filter-bar.compact { padding: 0; border-bottom: 0; margin-top: 8px; }
.filter-chip {
  font-size: 0.72rem; padding: 4px 10px; border-radius: 20px; cursor: pointer; border: 1px solid rgba(255,255,255,0.15);
  background: transparent; color: #a0a8b8; transition: all 0.15s;
}
.filter-chip:hover { border-color: rgba(255,255,255,0.3); color: #d0d4dc; }
.filter-chip.active { background: rgba(255,255,255,0.12); border-color: rgba(255,255,255,0.3); color: #fff; }
.corridor-list { flex: 1; overflow-y: auto; padding: 8px 0; }
.history-trails-details {
  margin: 4px 12px 10px; border-radius: 10px; border: 1px solid rgba(255,255,255,0.12);
  background: rgba(255,255,255,0.04); flex-shrink: 0;
}
.history-trails-details summary {
  list-style: none; cursor: pointer; padding: 12px 14px; display: flex; align-items: center; gap: 10px;
  font-size: 0.92rem; font-weight: 600; color: #fff; user-select: none;
}
.history-trails-details summary::-webkit-details-marker { display: none; }
.history-trails-chevron { font-size: 0.75rem; color: #8892a4; transition: transform 0.2s ease; margin-left: auto; }
.history-trails-details[open] .history-trails-chevron { transform: rotate(90deg); }
.history-trails-badge {
  font-size: 0.68rem; font-weight: 700; padding: 2px 8px; border-radius: 999px;
  background: rgba(59,130,246,0.25); color: #93c5fd;
}
.history-trails-body { padding: 0 8px 10px 14px; border-top: 1px solid rgba(255,255,255,0.06); }
.history-trails-intro { font-size: 0.72rem; color: #8892a4; line-height: 1.45; margin: 10px 0 8px; padding-right: 6px; }
.history-trail-active-bar {
  position: relative; margin: 0 18px 8px; padding: 10px 40px 10px 12px; border-radius: 8px;
  background: rgba(201, 162, 39, 0.12); border: 1px solid rgba(201, 162, 39, 0.35);
  font-size: 0.78rem; color: #e8d9b0;
}
.history-trail-active-bar strong { color: #fff; font-weight: 700; display: block; line-height: 1.25; }
.history-trail-active-meta { color: #9aa4b7; margin-top: 4px; line-height: 1.35; }
.history-trail-active-actions { display: flex; align-items: center; gap: 8px; margin-top: 8px; flex-wrap: wrap; }
a.trail-guide-btn {
  display: inline-flex; align-items: center; justify-content: center; border-radius: 7px; padding: 5px 10px;
  color: #dbeafe; text-decoration: none; font-weight: 800; font-size: 0.72rem;
  background: rgba(59,130,246,0.18); border: 1px solid rgba(96,165,250,0.42);
}
a.trail-guide-btn:hover { background: rgba(59,130,246,0.28); border-color: rgba(147,197,253,0.62); }
.trail-clear-btn {
  position: absolute; top: 8px; right: 8px; width: 24px; height: 24px; padding: 0; border-radius: 999px;
  border: 1px solid rgba(255,255,255,0.18); background: rgba(255,255,255,0.06); color: #c0c8d8;
  cursor: pointer; font-size: 0.92rem; line-height: 1;
}
.trail-clear-btn:hover { background: rgba(255,255,255,0.1); }
.history-trails-row {
  display: flex; align-items: stretch; margin: 0 0 4px; border-radius: 8px;
  border: 1px solid transparent; overflow: hidden;
}
.history-trails-row.active { border-color: rgba(201, 162, 39, 0.45); background: rgba(201, 162, 39, 0.08); }
.history-trails-map-btn {
  flex: 1; display: flex; align-items: baseline; justify-content: space-between; gap: 10px;
  padding: 8px 8px 8px 6px; margin: 0; border: none; border-radius: 8px 0 0 8px; cursor: pointer;
  background: transparent; text-align: left; color: #c8d0e0; font-size: 0.8rem; font-family: inherit;
}
.history-trails-map-btn:hover { background: rgba(255,255,255,0.06); color: #fff; }
.history-trails-guide {
  display: flex; align-items: center; padding: 0 10px; font-size: 0.68rem; font-weight: 600; color: #6b9fff;
  text-decoration: none; white-space: nowrap; border-left: 1px solid rgba(255,255,255,0.08);
  background: rgba(255,255,255,0.02);
}
.history-trails-guide:hover { color: #93c5fd; text-decoration: underline; }
.history-trails-link-name { flex: 1; min-width: 0; line-height: 1.35; }
.history-trails-meta { font-size: 0.68rem; color: #6b7890; white-space: nowrap; flex-shrink: 0; }
.corridor-list::-webkit-scrollbar { width: 5px; }
.corridor-list::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.15); border-radius: 3px; }
.corridor-card {
  margin: 4px 12px; padding: 12px 14px; border-radius: 10px; cursor: pointer;
  border: 1px solid transparent; transition: all 0.15s;
  display: block; width: calc(100% - 24px); text-align: left;
  background: transparent; color: inherit; font: inherit;
}
.corridor-card:hover { background: rgba(255,255,255,0.04); }
.corridor-card.selected { background: rgba(255,255,255,0.08); border-color: rgba(255,255,255,0.15); }
.corridor-card-name { font-size: 0.92rem; font-weight: 600; display: flex; align-items: center; gap: 8px; }
.corridor-card-meta { font-size: 0.74rem; color: #8892a4; margin-top: 4px; display: flex; gap: 12px; flex-wrap: wrap; }
.corridor-card-desc { font-size: 0.78rem; color: #9aa0b0; margin-top: 6px; line-height: 1.4; }
.corridor-card-actions { display: flex; gap: 8px; margin-top: 8px; }
.action-btn {
  font-size: 0.72rem; padding: 4px 12px; border-radius: 6px; cursor: pointer; border: none; font-weight: 600; transition: all 0.15s;
}
.action-btn.primary { background: #3b82f6; color: #fff; }
.action-btn.primary:hover { background: #2563eb; }
.action-btn.secondary { background: rgba(255,255,255,0.08); color: #c0c8d8; }
.action-btn.secondary:hover { background: rgba(255,255,255,0.14); }
.action-btn.danger { background: rgba(239,68,68,0.15); color: #f87171; }
.detail-panel { flex: 1; overflow-y: auto; padding: 0; }
.detail-header { padding: 16px 18px; border-bottom: 1px solid rgba(255,255,255,0.06); }
.detail-back { font-size: 0.78rem; color: #6b7890; cursor: pointer; border: none; background: none; padding: 0; margin-bottom: 8px; }
.detail-back:hover { color: #a0a8b8; }
.detail-title { font-size: 1.1rem; font-weight: 700; color: #fff; margin: 0; }
.detail-subtitle { font-size: 0.8rem; color: #8892a4; margin-top: 4px; }
.detail-stats { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; padding: 12px 18px; }
.stat-box { background: rgba(255,255,255,0.04); padding: 10px; border-radius: 8px; }
.stat-val { font-size: 1rem; font-weight: 700; color: #fff; }
.stat-label { font-size: 0.7rem; color: #6b7890; margin-top: 2px; }
.poi-section { padding: 12px 18px; }
.poi-section h3 { font-size: 0.82rem; color: #8892a4; margin: 0 0 8px; text-transform: uppercase; letter-spacing: 0.5px; }
.poi-item {
  display: flex; align-items: center; gap: 8px; padding: 7px 8px; font-size: 0.8rem; color: #c0c8d8;
  border: none; border-bottom: 1px solid rgba(255,255,255,0.04); border-radius: 8px;
  cursor: pointer; background: none; width: 100%; text-align: left;
}
.poi-item strong { flex: 1; font-size: 0.8rem; font-weight: 600; }
.poi-item em { color: #d8973c; font-style: normal; font-size: 0.72rem; }
.poi-item small { color: #6b7890; white-space: nowrap; }
.poi-item:hover { color: #fff; }
.poi-item.selected {
  background: rgba(59,130,246,0.18); box-shadow: inset 3px 0 0 #60a5fa;
  color: #fff;
}
.poi-dist { font-size: 0.7rem; color: #6b7890; margin-left: auto; white-space: nowrap; }
.connections-section { padding: 12px 18px; border-top: 1px solid rgba(255,255,255,0.06); }
.connection-chip {
  display: inline-block; font-size: 0.74rem; padding: 4px 10px; margin: 3px 4px 3px 0;
  border-radius: 6px; background: rgba(255,255,255,0.06); color: #a0a8b8; cursor: pointer;
}
.connection-chip:hover { background: rgba(255,255,255,0.12); color: #fff; }
.trip-item { display: flex; align-items: center; gap: 8px; padding: 8px 0; border-bottom: 1px solid rgba(255,255,255,0.04); }
.trip-num { width: 22px; height: 22px; border-radius: 50%; display: flex; align-items: center; justify-content: center; font-size: 0.7rem; font-weight: 700; color: #fff; }
.trip-item-name { font-size: 0.82rem; color: #e0e4ec; flex: 1; }
.trip-item-miles { font-size: 0.72rem; color: #6b7890; }
.trip-remove { background: none; border: none; color: #6b7890; cursor: pointer; font-size: 0.9rem; padding: 2px 6px; }
.trip-remove:hover { color: #f87171; }
.mobile-handle {
  width: 36px; height: 4px; background: rgba(255,255,255,0.2); border-radius: 2px;
  margin: 8px auto 4px; cursor: pointer; display: none;
}
.route-alerts-control {
  position: absolute; top: 16px; left: 54px; z-index: 6;
  display: flex; flex-direction: column; align-items: flex-start; gap: 8px;
}
.route-alerts-button {
  display: inline-flex; align-items: center; gap: 7px; border: 1px solid rgba(255,255,255,0.18);
  border-radius: 999px; padding: 8px 12px; background: rgba(26,30,46,0.9); color: #fff;
  font-size: 0.78rem; font-weight: 800; cursor: pointer; box-shadow: 0 2px 12px rgba(0,0,0,0.28);
  backdrop-filter: blur(10px);
}
.route-alerts-button:hover { background: rgba(37,44,66,0.95); border-color: rgba(255,255,255,0.28); }
.route-alerts-popover {
  width: min(320px, calc(100vw - 36px)); border-radius: 14px; background: rgba(17,24,39,0.96);
  color: #e5e7eb; border: 1px solid rgba(255,255,255,0.14); box-shadow: 0 14px 32px rgba(0,0,0,0.36);
  padding: 14px; backdrop-filter: blur(14px);
}
.route-alerts-popover-header { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }
.route-alerts-popover h2 { margin: 0; font-size: 0.98rem; color: #fff; letter-spacing: -0.01em; }
.route-alerts-popover p { margin: 7px 0 0; color: #aab4c5; font-size: 0.8rem; line-height: 1.45; }
.route-alerts-close { border: none; background: rgba(255,255,255,0.08); color: #cbd5e1; cursor: pointer; border-radius: 999px; width: 26px; height: 26px; }
.route-alerts-popover .app-cta-inline {
  margin: 12px 0 0; padding: 0.6rem 0.75rem; background: transparent; border-left: 0; border-radius: 0; color: #e5e7eb;
}
.route-alerts-popover .app-cta-inline-icon { display: none; }
.route-alerts-popover .app-cta-inline-left { display: none; }
.route-alerts-popover .app-cta-inline-btn {
  margin: 0; width: 100%; text-align: center; border-radius: 999px; padding: 0.5rem 0.9rem; font-size: 0.78rem;
}
.route-alerts-popover .app-cta-inline-help {
  color: #d6dce8; margin-top: 0; line-height: 1.4; max-width: none;
}
.route-alerts-popover .app-cta-inline-help button { background: var(--gold-display, #d8973c); }
.poi-cap-note { padding: 0 18px 10px; color: #6b7890; font-size: 0.72rem; line-height: 1.4; }
.planner-map-shell.is-fullscreen {
  background: #0b1220;
}
.planner-map-chip-bar {
  position: absolute;
  bottom: 24px;
  left: 16px;
  z-index: 5;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  max-width: calc(100% - 32px);
  pointer-events: none;
}
.planner-map-chip-bar > * { pointer-events: auto; }
.planner-map-chip {
  position: static;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 40px;
  height: 36px;
  padding: 0 12px;
  border: 1px solid rgba(255,255,255,0.18);
  border-radius: 8px;
  background: rgba(26,30,46,0.9);
  color: #e0e4ec;
  font-size: 0.78rem;
  font-weight: 800;
  cursor: pointer;
  box-shadow: 0 2px 8px rgba(0,0,0,0.3);
  backdrop-filter: blur(10px);
}
.planner-map-chip:hover { background: rgba(37,44,66,0.95); border-color: rgba(255,255,255,0.28); }
.planner-map-chip.is-active {
  background: rgba(37,99,235,0.92);
  border-color: rgba(147,197,253,0.55);
  color: #fff;
}
.planner-map-chip:disabled { opacity: 0.55; cursor: default; }
.planner-map-chip.planner-map-status {
  max-width: min(280px, calc(100vw - 160px));
  cursor: default;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.planner-map-chip.planner-map-status.is-error {
  background: rgba(127,29,29,0.92);
  border-color: rgba(252,165,165,0.45);
}
.planner-map-pane {
  flex: 1 1 auto;
  position: relative;
  min-width: 0;
  min-height: 0;
  height: 100%;
}
@media (max-width: 768px) {
  .planner-wrap { flex: 1 1 auto; min-height: 0; }
  .planner-map-pane { height: 100%; min-height: 0; }
  .planner-sidebar {
    width: 100%; position: absolute; bottom: 0; left: 0; right: 0; top: auto;
    height: min(55dvh, 55vh); border-radius: 16px 16px 0 0; margin-left: 0 !important;
    padding-bottom: max(12px, env(safe-area-inset-bottom));
  }
  .planner-sidebar.collapsed { transform: translateY(calc(100% - 48px)); }
  .sidebar-toggle { display: none; }
  .mobile-handle { display: block; }
  .route-alerts-control { top: 12px; left: 12px; }
  .planner-map-chip-bar {
    bottom: max(20px, env(safe-area-inset-bottom));
    left: 12px;
    max-width: calc(100% - 24px);
  }
}

