
  * { box-sizing: border-box; }
  html, body {
    width: 100%; height: 100%; margin: 0; padding: 0;
    font-family: Inter, system-ui, -apple-system, sans-serif;
    color: #0f172a; overflow: hidden; background: #0f172a;
  }
  [x-cloak] { display: none !important; }

  /* True Fullscreen Map */
  #map {
    position: absolute; inset: 0; width: 100% !important; height: 100% !important; z-index: 1;
  }
  .mapboxgl-canvas-container, .mapboxgl-canvas {
    width: 100% !important; height: 100% !important;
  }

  /* Top Navigation Overlay */
  .top-nav {
    position: absolute; top: 16px; left: 16px; right: 16px; z-index: 20;
    display: flex; justify-content: space-between; align-items: center; pointer-events: none;
  }
  .nav-group { display: flex; align-items: center; gap: 10px; pointer-events: auto; }

  /* Floating Branding */
  .brand-pill {
    background: rgba(15, 23, 42, 0.88); backdrop-filter: blur(12px);
    border: 1px solid rgba(51, 65, 85, 0.7); border-radius: 30px;
    padding: 8px 16px; display: flex; align-items: center; gap: 10px;
    color: #f8fafc; font-size: 13.5px; font-weight: 600; box-shadow: 0 4px 20px rgba(0,0,0,0.3);
  }
  .brand-pill svg { color: #38bdf8; }
  .brand-pill span { color: #94a3b8; font-weight: 400; font-size: 12px; }
  /* Which planner and engine answered: the admin lab always said so, the public page did not (2026-09-23). */
  .brand-ver { color: #64748b; font-weight: 400; font-size: 10.5px; margin-left: 10px; white-space: nowrap; font-variant-numeric: tabular-nums; }

  /* User / Auth Badges */
  .btn-auth {
    background: #0284c7; color: #fff; text-decoration: none; padding: 8px 16px;
    border-radius: 24px; font-size: 13px; font-weight: 600; display: inline-flex;
    align-items: center; gap: 8px; box-shadow: 0 4px 14px rgba(2,132,199,0.4);
    transition: all 0.15s ease; border: 1px solid rgba(255,255,255,0.15);
  }
  .btn-auth:hover { background: #0369a1; transform: translateY(-1px); }

  .user-badge {
    background: rgba(15, 23, 42, 0.88); backdrop-filter: blur(12px);
    border: 1px solid rgba(51, 65, 85, 0.7); border-radius: 30px;
    padding: 6px 14px; display: flex; align-items: center; gap: 10px;
    color: #f8fafc; font-size: 13px; box-shadow: 0 4px 20px rgba(0,0,0,0.3);
  }
  .tier-pill {
    font-size: 10px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.06em;
    padding: 2px 7px; border-radius: 12px;
  }
  .tier-pill.premium { background: #059669; color: #fff; }
  .tier-pill.superadmin { background: #dc2626; color: #fff; }
  .tier-pill.free { background: #475569; color: #cbd5e1; }

  .btn-admin-lab {
    background: #4f46e5; color: #fff; text-decoration: none; padding: 8px 14px;
    border-radius: 24px; font-size: 12.5px; font-weight: 600; display: inline-flex;
    align-items: center; gap: 6px; box-shadow: 0 4px 14px rgba(79,70,229,0.35);
  }
  .btn-admin-lab:hover { background: #4338ca; }

  .btn-logout {
    color: #94a3b8; font-size: 12px; text-decoration: none; margin-left: 4px;
  }
  .btn-logout:hover { color: #f87171; text-decoration: underline; }

  /* Floating Directions Card (Google Maps style) */
  .floating-card {
    position: absolute; top: 76px; left: 16px; z-index: 20;
    width: 410px; max-height: calc(100vh - 96px); display: flex; flex-direction: column;
    background: rgba(255, 255, 255, 0.98); backdrop-filter: blur(16px);
    border-radius: 16px; box-shadow: 0 16px 40px -10px rgba(15,23,42,0.35), 0 0 0 1px rgba(0,0,0,0.06);
    overflow: hidden; transition: all 0.25s cubic-bezier(0.16, 1, 0.3, 1);
  }
  .floating-card.is-minimized {
    width: 320px;
  }

  /* Card Header */
  .card-header {
    padding: 14px 18px; border-bottom: 1px solid #f1f5f9; display: flex;
    align-items: center; justify-content: space-between; user-select: none;
  }
  .card-title {
    font-size: 15px; font-weight: 700; color: #0f172a; margin: 0;
    display: flex; align-items: center; gap: 8px;
  }
  .card-title svg { color: #0284c7; }

  .header-actions { display: flex; align-items: center; gap: 6px; }
  .btn-toggle-min {
    background: #f1f5f9; border: none; border-radius: 8px; width: 28px; height: 28px;
    display: flex; align-items: center; justify-content: center; cursor: pointer;
    color: #475569; transition: all 0.15s;
  }
  .btn-toggle-min:hover { background: #e2e8f0; color: #0284c7; }

  /* Minimized Summary Bar */
  .minimized-body {
    padding: 12px 18px; background: #fff; cursor: pointer; display: flex;
    align-items: center; justify-content: space-between; gap: 10px; font-size: 13px;
  }
  .minimized-summary {
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis; color: #334155; font-weight: 500;
  }
  .minimized-expand-btn {
    font-size: 12px; color: #0284c7; font-weight: 600; white-space: nowrap;
  }

  /* Card Scrollable Content */
  .card-content {
    overflow-y: auto; display: flex; flex-direction: column;
  }
  /* The body scrolls; its sections keep their height. Allowed to shrink, the results were squeezed to a
     28-60 px strip once a route loaded (1440x900 and phones) and the RTZ button left the card (2026-09-25). */
  .card-content > * { flex-shrink: 0; }

  /* Stops Container (Multi-Stop A -> B -> C -> D) */
  .stops-container {
    padding: 14px 18px 8px; display: flex; flex-direction: column; gap: 8px; position: relative;
  }
  .stop-row {
    position: relative; display: flex; align-items: center; gap: 8px;
  }
  .stop-badge {
    width: 24px; height: 24px; border-radius: 50%; font-size: 11px; font-weight: 700;
    display: flex; align-items: center; justify-content: center; flex-shrink: 0; color: #fff;
  }
  .stop-badge.origin { background: #059669; box-shadow: 0 0 0 2px #d1fae5; }
  .stop-badge.waypoint { background: #0284c7; box-shadow: 0 0 0 2px #e0f2fe; }
  .stop-badge.dest { background: #e11d48; box-shadow: 0 0 0 2px #ffe4e6; }

  .stop-input-wrapper { position: relative; flex: 1; }
  .place-input {
    width: 100%; height: 38px; padding: 8px 12px; font-size: 13.5px;
    color: #0f172a; background: #f8fafc; border: 1.5px solid #e2e8f0; border-radius: 8px;
    outline: none; transition: all 0.15s ease;
  }
  .place-input:focus { background: #fff; border-color: #0284c7; box-shadow: 0 0 0 3px rgba(2,132,199,0.15); }
  .place-input::placeholder { color: #94a3b8; font-size: 12.5px; }

  .btn-stop-remove {
    background: none; border: none; color: #94a3b8; font-size: 16px; cursor: pointer;
    width: 24px; height: 24px; display: flex; align-items: center; justify-content: center;
    border-radius: 4px; transition: all 0.15s;
  }
  .btn-stop-remove:hover { color: #e11d48; background: #ffe4e6; }

  /* Stops Toolbar */
  .stops-toolbar {
    display: flex; align-items: center; justify-content: space-between; padding: 4px 2px 8px;
  }
  .btn-tool {
    background: none; border: none; font-size: 12.5px; font-weight: 600; color: #0284c7;
    cursor: pointer; display: inline-flex; align-items: center; gap: 4px; padding: 4px 6px;
    border-radius: 6px; transition: background 0.15s;
  }
  .btn-tool:hover { background: #f0f9ff; color: #0369a1; }
  .btn-tool.secondary { color: #64748b; }
  .btn-tool.secondary:hover { background: #f1f5f9; color: #0f172a; }

  /* Autocomplete Dropdown */
  .dropdown {
    position: absolute; top: calc(100% + 4px); left: 0; right: 0; z-index: 100;
    background: #fff; border: 1px solid #e2e8f0; border-radius: 10px;
    box-shadow: 0 12px 28px -6px rgba(15,23,42,0.25); max-height: 220px; overflow-y: auto;
    -webkit-overflow-scrolling: touch;
  }
  .dropdown-item {
    padding: 9px 12px; display: flex; justify-content: space-between; align-items: center;
    cursor: pointer; border-bottom: 1px solid #f8fafc; transition: background 0.1s;
  }
  .dropdown-item:last-child { border-bottom: none; }
  .dropdown-item:hover { background: #f0f9ff; }
  .item-main { font-size: 13px; font-weight: 600; color: #0f172a; }
  .item-sub { font-size: 11px; color: #64748b; margin-top: 1px; }
  .item-badge {
    font-size: 9px; font-weight: 700; text-transform: uppercase; padding: 2px 6px;
    border-radius: 4px; letter-spacing: 0.05em;
  }
  .item-badge.port { background: #e0f2fe; color: #0369a1; }
  .item-badge.yard { background: #fce7f3; color: #be185d; }
  .item-badge.pilot { background: #dcfce7; color: #15803d; }

  /* Voyage Options */
  .options-row {
    padding: 0 18px 10px; display: grid; grid-template-columns: 1fr 1fr; gap: 8px;
  }
  .option-box { display: flex; flex-direction: column; gap: 3px; }
  .option-label { font-size: 10.5px; font-weight: 600; color: #64748b; text-transform: uppercase; letter-spacing: 0.04em; }
  .option-select, .option-input {
    width: 100%; height: 34px; padding: 5px 8px; font-size: 12.5px; color: #0f172a;
    background: #f8fafc; border: 1.5px solid #e2e8f0; border-radius: 8px; outline: none;
  }
  .option-select:focus, .option-input:focus { border-color: #0284c7; background: #fff; }

  .premium-pill-tag {
    font-size: 8.5px; font-weight: 700; background: #059669; color: #fff;
    padding: 1px 4px; border-radius: 4px; margin-left: 3px; text-transform: uppercase;
  }

  /* Route Button */
  .btn-calculate {
    margin: 4px 18px 14px; height: 42px; background: #0284c7; color: #fff;
    border: none; border-radius: 10px; font-size: 13.5px; font-weight: 600;
    display: flex; align-items: center; justify-content: center; gap: 8px;
    cursor: pointer; transition: all 0.15s ease; box-shadow: 0 4px 12px rgba(2,132,199,0.3);
  }
  .btn-calculate:hover { background: #0369a1; }
  .btn-calculate:disabled { opacity: 0.6; cursor: not-allowed; }

  /* Results Section */
  .results-card {
    padding: 14px 18px; border-top: 1px solid #f1f5f9; background: #f8fafc;
  }
  .metrics-grid {
    display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-bottom: 12px;
  }
  .metric-box {
    background: #fff; border: 1px solid #e2e8f0; border-radius: 10px; padding: 10px 12px;
  }
  .metric-title { font-size: 10.5px; font-weight: 600; color: #64748b; text-transform: uppercase; }
  .metric-value { font-size: 18px; font-weight: 700; color: #0f172a; margin-top: 2px; }
  .metric-value small { font-size: 12px; font-weight: 500; color: #64748b; }
  .metric-wide { grid-column: 1 / -1; }
  .metric-share { margin-left: 4px; }
  .eca-zones { list-style: none; margin: 6px 0 0; padding: 0; font-size: 12px; color: #475569; }
  .eca-zones li { display: flex; justify-content: space-between; gap: 8px; padding: 2px 0; }
  .eca-zones li b { font-weight: 600; color: #0f172a; white-space: nowrap; }

  /* Voyage Legs Breakdown */
  .legs-container {
    background: #fff; border: 1px solid #e2e8f0; border-radius: 10px; padding: 10px 12px; margin-bottom: 12px;
  }
  .legs-header {
    font-size: 11px; font-weight: 700; color: #64748b; text-transform: uppercase;
    display: flex; justify-content: space-between; margin-bottom: 8px;
  }
  .leg-item {
    display: flex; align-items: center; justify-content: space-between;
    font-size: 12.5px; padding: 5px 0; border-bottom: 1px solid #f1f5f9;
  }
  .leg-item:last-child { border-bottom: none; }
  .leg-names { font-weight: 500; color: #1e293b; max-width: 220px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .leg-stats { font-weight: 600; color: #0284c7; font-size: 12px; }

  /* Passages / Chokepoints Badges */
  .passages-container { margin-bottom: 12px; }
  .passages-title { font-size: 10.5px; font-weight: 700; color: #64748b; text-transform: uppercase; margin-bottom: 6px; }
  .badges-list { display: flex; flex-wrap: wrap; gap: 5px; }
  .passage-badge {
    background: #e0f2fe; color: #0369a1; border: 1px solid #bae6fd;
    border-radius: 6px; padding: 3px 7px; font-size: 11px; font-weight: 600;
  }

  /* Action Buttons */
  .action-buttons { display: flex; flex-direction: column; gap: 8px; margin-top: 10px; }
  .btn-rtz {
    width: 100%; height: 38px; background: #059669; color: #fff; border: none;
    border-radius: 8px; font-size: 13px; font-weight: 600; display: flex;
    align-items: center; justify-content: center; gap: 8px; cursor: pointer;
    text-decoration: none; box-shadow: 0 2px 8px rgba(5,150,105,0.25);
  }
  .btn-rtz:hover { background: #047857; }
  .btn-rtz.locked { background: #e2e8f0; color: #64748b; box-shadow: none; }

  /* Premium Upsell Modal */
  .modal-overlay {
    position: fixed; inset: 0; z-index: 50; background: rgba(15, 23, 42, 0.7);
    backdrop-filter: blur(4px); display: flex; align-items: center; justify-content: center; padding: 20px;
  }
  .modal-card {
    background: #fff; border-radius: 16px; max-width: 440px; width: 100%;
    padding: 28px; box-shadow: 0 24px 48px rgba(0,0,0,0.3); text-align: center;
  }
  .modal-icon {
    width: 52px; height: 52px; border-radius: 50%; background: #ecfdf5;
    color: #059669; display: flex; align-items: center; justify-content: center;
    margin: 0 auto 16px; font-size: 24px;
  }
  .modal-title { font-size: 18px; font-weight: 700; color: #0f172a; margin: 0 0 8px; }
  .modal-desc { font-size: 13.5px; color: #64748b; line-height: 1.5; margin: 0 0 20px; }
  .modal-benefits { text-align: left; background: #f8fafc; border-radius: 10px; padding: 14px; margin-bottom: 20px; font-size: 13px; color: #334155; }
  .modal-benefits li { margin-bottom: 6px; }
  .modal-benefits li:last-child { margin-bottom: 0; }
  .modal-btn {
    display: block; width: 100%; padding: 11px; background: #059669; color: #fff;
    border-radius: 8px; font-weight: 600; text-decoration: none; font-size: 14px;
  }
  .modal-btn:hover { background: #047857; }
  .modal-close {
    background: none; border: none; color: #94a3b8; font-size: 13px; margin-top: 12px;
    cursor: pointer; text-decoration: underline;
  }

  /* Map Markers */
  .map-stop-marker {
    width: 26px; height: 26px; border-radius: 50%; display: flex;
    align-items: center; justify-content: center; font-size: 12px; font-weight: 800;
    color: #fff; box-shadow: 0 3px 8px rgba(0,0,0,0.4); border: 2px solid #fff; cursor: pointer;
  }
  .map-stop-marker.origin { background: #059669; }
  .map-stop-marker.waypoint { background: #0284c7; }
  .map-stop-marker.dest { background: #e11d48; }

  @media (max-width: 640px) {
    .floating-card { top: auto; bottom: 0; left: 0; right: 0; width: 100%; max-height: 80vh; border-radius: 20px 20px 0 0; }
    .floating-card.is-minimized { width: 100%; }
    .top-nav { left: 12px; right: 12px; }
    .brand-pill span { display: none; }
    .brand-ver { display: none; }
  }

  /* Weather point popup */
  .wx-popup .mapboxgl-popup-content {
    background: rgba(15,23,42,.92);
    backdrop-filter: blur(12px);
    border: 1px solid rgba(255,255,255,.10);
    border-radius: 10px;
    padding: 12px 14px;
    box-shadow: 0 8px 32px rgba(0,0,0,.45);
    color: #cbd5e1;
  }
  .wx-popup .mapboxgl-popup-tip { border-top-color: rgba(15,23,42,.92); }
  .wx-popup .mapboxgl-popup-close-button { color: #94a3b8; font-size: 18px; padding: 4px 8px; }
  .wx-popup .mapboxgl-popup-close-button:hover { color: #fff; background: transparent; }

  .search-status { padding: 10px 12px; font-size: 12px; color: #475569; }
  .dropdown-item.selected { background: #e0f2fe; outline: 2px solid #0284c7; outline-offset: -2px; }
  .hint { font-size: 11px; line-height: 1.5; color: #64748b; margin: 5px 0; }
  .input-help { margin: 0 18px 10px; }
  .departure-section, .weather-section, .route-options { padding: 8px 18px; }
  .departure-row { display: flex; gap: 8px; margin-top: 5px; }
  .departure-row input { min-width: 0; flex: 1; }
  .weather-toggles { display: flex; gap: 20px; margin: 8px 0; font-size: 13px; }
  .route-options summary { cursor: pointer; font-size: 12px; font-weight: 600; color: #0369a1; }
  .preference-checks, .passage-options { display: flex; flex-direction: column; gap: 8px; font-size: 12px; padding-top: 10px; }
  .passage-options { max-height: 180px; overflow-y: auto; }
  /* Each list keeps its heading while it scrolls; without this the two boxes read as one duplicated list. */
  .passage-options .option-label { position: sticky; top: 0; background: #fff; padding: 2px 0 4px; z-index: 1; }
  .passage-options + .passage-options { margin-top: 6px; border-top: 1px solid #e2e8f0; }
  .forecast-label { display: block; font-size: 12px; font-weight: 600; }
  #forecast-hour { width: 100%; min-height: 32px; }
  .inline-error { background: #fff7ed; border: 1px solid #fdba74; border-radius: 8px; padding: 10px; margin: 8px 18px; color: #9a3412; font-size: 12px; line-height: 1.5; }
  .weather-section .inline-error { margin: 8px 0; }
  .voyage-times { font-size: 12px; line-height: 1.7; margin: 8px 0; color: #334155; }
  button:focus-visible, a:focus-visible, [role="button"]:focus-visible, summary:focus-visible { outline: 3px solid #0284c7; outline-offset: 2px; }
  .floating-card, .card-content { min-height: 0; }
  .stop-input-wrapper { min-width: 0; }
  .btn-tool, .btn-stop-remove, .btn-toggle-min { min-height: 36px; }
  .user-badge b { max-width: 180px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  @media (max-width: 640px) {
    .floating-card { max-height: 58vh; max-height: 58dvh; }
    .floating-card.is-minimized { max-height: 130px; }
    .place-input { font-size: 16px; }
    .btn-stop-remove, .btn-toggle-min { min-width: 36px; }
    .nav-group { gap: 5px; }
    .brand-pill { padding: 8px 10px; font-size: 12px; }
    .user-badge { padding: 6px 8px; gap: 5px; }
    .user-badge b { max-width: 65px; font-size: 11px; }
    .tier-pill { display: none; }
    .btn-admin-lab { font-size: 0; padding: 8px; }
    .mapboxgl-ctrl-bottom-right { bottom: calc(var(--planner-height, 58vh) + 8px); }
    .mapboxgl-ctrl-bottom-left { bottom: calc(var(--planner-height, 58vh) + 8px); }
  }

  .eca-legend { display: flex; flex-wrap: wrap; gap: 8px 14px; font-size: 11px; color: #475569; }
  .eca-legend span { display: inline-flex; align-items: center; gap: 5px; }
  .eca-legend i { display: inline-block; width: 15px; height: 12px; }
  .eca-active { background: #0f766e47; border: 2px solid #0f766e; }
  .eca-future { background: #b4530947; border: 2px dashed #b45309; }

  .weather-heading { display:flex; align-items:center; justify-content:space-between; gap:8px; }
  .weather-model { color:#64748b; font-size:10px; letter-spacing:.04em; }
  .weather-selector { display:flex; gap:4px; border:1px solid #dbe5eb; border-radius:12px; padding:4px; margin:10px 0; background:#edf3f6; min-width:0; }
  .weather-selector label { position:relative; display:flex; flex:1; align-items:center; justify-content:center; gap:7px; min-height:38px; border-radius:8px; font-size:12px; font-weight:600; color:#64748b; cursor:pointer; transition:background .18s,color .18s,box-shadow .18s; }
  .weather-selector label.selected { color:#075985; background:white; box-shadow:0 2px 6px #16334d14; }
  .weather-selector label:hover { color:#075985; }
  .weather-selector label:focus-within { outline:2px solid #0284c7; outline-offset:1px; }
  .weather-selector input { position:absolute; opacity:0; width:1px; height:1px; }
  .weather-selector:disabled { opacity:.55; }
  .weather-selector svg { width:18px; height:18px; }
  .weather-forecast { border:1px solid #dce7ed; border-radius:12px; padding:12px; background:linear-gradient(145deg,#f8fbfd,#f0f7f9); margin:10px 0; }
  .weather-legend { margin-bottom:12px; }
  .weather-legend-title { display:flex; justify-content:space-between; font-size:11px; font-weight:600; color:#334155; margin-bottom:7px; }
  .weather-colour-bar { height:8px; border-radius:5px; background:linear-gradient(90deg,#3566b5 0%,#359dc1 16.67%,#2bbb9e 33.33%,#5cc168 50%,#d0be4e 66.67%,#c35875 83.33%,#6f3e91 100%); }
  .weather-colour-bar.waves { background:linear-gradient(90deg,#2e64ab 0%,#2fadb2 16.67%,#61be9d 33.33%,#b9c36c 50%,#e6a15d 66.67%,#d2646f 83.33%,#9d4285 100%); }
  .weather-legend-ticks { display:flex; justify-content:space-between; color:#64748b; font-size:10px; font-variant-numeric:tabular-nums; margin-top:5px; }
  .weather-motion { display:flex; align-items:center; gap:5px; font-size:11px; color:#475569; margin-bottom:12px; }
  .weather-motion input { accent-color:#0284c7; }
  .weather-forecast .forecast-label { color:#0c4a6e; line-height:1.5; }
  .weather-forecast #forecast-hour { accent-color:#0284c7; cursor:ew-resize; }
  .weather-motion-note { border-top:1px solid #dce7ed; padding-top:9px; }
  @media (prefers-reduced-motion: reduce) { .weather-selector label { transition:none; } }

  .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; }

  .forecast-slider-row { display:flex; align-items:center; gap:5px; }
  .forecast-progress { min-height:38px; display:flex; align-items:center; gap:7px; font-size:11px; line-height:1.4; color:#64748b; }
  .forecast-progress.is-loading { color:#0369a1; font-weight:600; }
  .forecast-spinner { width:12px; height:12px; flex:0 0 12px; border:2px solid #bae6fd; border-top-color:#0284c7; border-radius:50%; animation:forecast-spin .7s linear infinite; }
  @keyframes forecast-spin { to { transform:rotate(360deg); } }
  @media (prefers-reduced-motion:reduce) { .forecast-spinner { animation:none; } }
  .forecast-slider-row #forecast-hour { flex:1; min-width:0; touch-action:none; }
  .forecast-slider-row .forecast-step { flex:0 0 32px; padding:0; min-height:40px; font-size:23px; line-height:1; }
  .forecast-step:disabled { opacity:.35; cursor:default; }

  /* Voyage cost estimate */
  .cost-card { background: #fff; border: 1px solid #e2e8f0; border-radius: 10px; margin-bottom: 12px; padding: 0 12px; }
  .cost-toggle {
    width: 100%; display: flex; justify-content: space-between; align-items: center; gap: 8px; padding: 10px 0;
    background: none; border: 0; cursor: pointer; font-size: 10.5px; font-weight: 600; color: #64748b;
    text-transform: uppercase; text-align: left;
  }
  .cost-headline { font-size: 13px; font-weight: 700; color: #0f172a; text-transform: none; white-space: nowrap; }
  .cost-inputs { display: grid; grid-template-columns: 1fr 1fr; gap: 6px 8px; margin-bottom: 8px; }
  .cost-inputs label { display: flex; flex-direction: column; gap: 2px; font-size: 11px; color: #475569; }
  .cost-inputs input[type=number], .cost-fuels input {
    width: 100%; box-sizing: border-box; padding: 4px 6px; border: 1px solid #cbd5e1; border-radius: 6px; font-size: 12px;
  }
  .cost-inputs .cost-check { flex-direction: row; align-items: center; gap: 6px; align-self: end; padding-bottom: 4px; }
  .cost-fuels { width: 100%; border-collapse: collapse; font-size: 11px; color: #475569; }
  .cost-fuels th { text-align: left; font-weight: 600; padding: 2px 4px 2px 0; }
  .cost-fuels td { padding: 2px 4px 2px 0; }
  .cost-fuels tr.ls th, .cost-results .ls { color: #15803d; }
  .cost-results { display: grid; grid-template-columns: auto 1fr; gap: 3px 10px; font-size: 12px; margin: 8px 0; }
  .cost-results dt { color: #475569; }
  .cost-results dd { margin: 0; text-align: right; font-weight: 600; color: #0f172a; }
  .cost-results .total { font-weight: 700; border-top: 1px solid #e2e8f0; padding-top: 4px; }
  .cost-reset { background: none; border: 0; color: #0284c7; font-size: 12px; cursor: pointer; padding: 0 0 10px; }

/* A phone planner presents one task at a time and keeps its primary action reachable. */
.account-toggle,.planner-tabs,.minimize-label{display:none}
.planner-plan,.planner-weather,.planner-results{min-width:0}
.planner-actions{flex-shrink:0;background:#fff;border-top:1px solid #e2e8f0;padding:10px 0 max(0px,env(safe-area-inset-bottom))}
.planner-actions .btn-calculate{width:calc(100% - 36px);margin:0 18px 10px;min-height:44px}
.voyage-settings{border:0}.voyage-settings>summary{display:none}
.btn-pick-stop{flex-shrink:0;width:36px;min-height:38px;border:1px solid #cbd5e1;border-radius:8px;color:#0369a1;background:#f0f9ff;cursor:pointer;font-size:23px}
.btn-pick-stop:disabled{opacity:.4;cursor:default}
.results-empty{padding:18px;color:#475569;font-size:14px;line-height:1.6}
.map-pick-prompt{position:absolute;z-index:30;top:76px;left:50%;transform:translateX(-50%);width:max-content;max-width:calc(100% - 24px);padding:8px 12px;display:flex;align-items:center;gap:12px;background:#fff;border:1px solid #bae6fd;border-radius:12px;box-shadow:0 4px 20px #0003;font-size:13px}
.map-pick-prompt button{border:0;background:#f0f9ff;color:#0369a1;border-radius:8px;min-height:44px;padding:8px 12px;cursor:pointer}
.modal-card{max-height:calc(var(--viewport-height,100dvh) - 32px);overflow-y:auto;overscroll-behavior:contain}
@media(max-width:900px), (max-height:500px) and (max-width:950px) and (orientation:landscape){
  .top-nav{top:max(8px,env(safe-area-inset-top));left:8px;right:8px;gap:8px}
  .brand-pill{padding:10px 12px;font-size:13px;min-height:44px;border-radius:12px}.brand-pill span,.brand-ver{display:none}
  .account-toggle{display:block;pointer-events:auto;min-height:44px;padding:8px 14px;color:#f8fafc;background:#0f172ae8;border:1px solid #475569;border-radius:12px;font:inherit;font-size:13px;cursor:pointer}
  .account-menu{position:absolute;top:52px;right:0;max-width:calc(100vw - 16px);padding:12px;background:#0f172af5;border:1px solid #475569;border-radius:12px;display:flex;flex-direction:column;align-items:stretch;gap:8px;box-shadow:0 6px 24px #0004}
  .user-badge{flex-wrap:wrap;border:0;box-shadow:none;padding:0;gap:8px;background:none;border-radius:0}.user-badge b{max-width:230px;font-size:12px}.tier-pill{display:inline-block}
  .btn-admin-lab{font-size:12px;min-height:44px;justify-content:center}.btn-logout{min-height:44px;display:inline-flex;align-items:center;margin:0}.btn-auth{min-height:44px;justify-content:center}
  .floating-card{top:auto;left:0;right:0;bottom:max(0px,calc(100dvh - var(--viewport-height,100dvh) - var(--viewport-top,0px)));width:100%;max-height:min(64dvh,calc(var(--viewport-height,100dvh) - 68px));border-radius:18px 18px 0 0;transition:none}
  .floating-card.is-minimized{width:100%;max-height:120px;padding-bottom:env(safe-area-inset-bottom)}
  .floating-card.is-searching{max-height:calc(var(--viewport-height,100dvh) - 12px)}
  .card-header{padding:6px 12px;min-height:52px;flex-shrink:0}.card-title{font-size:14px}
  .btn-toggle-min{width:auto;min-width:64px;min-height:44px;padding:0 10px;gap:6px}.minimize-label{display:inline;font-size:12px;font-weight:600}
  .planner-tabs{display:flex;gap:4px;padding:0 12px 8px;flex-shrink:0;border-bottom:1px solid #e2e8f0}
  .planner-tabs button{flex:1;min-height:44px;border:0;border-radius:8px;background:#f1f5f9;font:inherit;font-size:13px;color:#475569;cursor:pointer}
  .planner-tabs button[aria-selected=true]{background:#e0f2fe;color:#075985;font-weight:600}
  .card-content{overscroll-behavior:contain;scroll-padding:8px;min-height:0}
  .stops-container{padding:12px 12px 4px;gap:8px}.stop-row{gap:6px}.stop-badge{width:22px;height:22px}
  .place-input,.option-input,.option-select,.cost-inputs input[type=number],.cost-fuels input{font-size:16px;min-height:44px}
  .place-input{padding:8px}.place-input::placeholder{font-size:12px}
  .btn-pick-stop,.btn-stop-remove{width:36px;min-width:36px;min-height:44px}
  .btn-tool{min-height:44px}.stops-toolbar{gap:8px;padding-bottom:0}
  .options-row{padding:4px 12px 10px;grid-template-columns:repeat(2,minmax(0,1fr))}.option-box{min-width:0}
  .voyage-settings>summary{display:flex;flex-direction:column;justify-content:center;min-height:52px;margin:0 12px 10px;padding:8px 12px;border:1px solid #e2e8f0;border-radius:9px;font-size:13px;font-weight:600;color:#0369a1;cursor:pointer;list-style:none}
  .voyage-settings>summary span{font-weight:400;font-size:11px;color:#64748b;margin-top:3px}
  .voyage-settings>summary::after{content:'+';position:absolute;right:24px;font-size:20px}.voyage-settings[open]>summary::after{content:'−'}
  .departure-section,.weather-section,.route-options{padding:8px 12px}.departure-row .btn-tool{flex-shrink:0}
  .route-options summary{min-height:44px;align-content:center}
  .preference-checks label,.passage-options label,.weather-toggles,.weather-motion{min-height:44px;display:flex;align-items:center;gap:8px;margin:0}
  .weather-selector label{min-height:44px}.weather-forecast{padding:10px}
  .forecast-slider-row .forecast-step{flex-basis:44px;min-height:44px}.forecast-slider-row #forecast-hour{height:44px}
  .planner-actions{padding:8px 12px max(8px,env(safe-area-inset-bottom));box-shadow:0 -3px 12px #0f172a08}
  .planner-actions .btn-calculate{width:100%;margin:0;min-height:48px}
  .dropdown{position:static;margin-top:6px;max-height:190px;box-shadow:none;overscroll-behavior:contain}
  .dropdown-item{min-height:52px;padding:10px 8px;gap:6px}.item-main,.item-sub{overflow-wrap:anywhere}.item-badge{flex-shrink:0}
  .stop-row{align-items:flex-start}.stop-badge{margin-top:11px}
  .results-card{padding:12px;border-top:0}.metric-box{padding:10px;min-width:0}.metric-value{font-size:18px;overflow-wrap:anywhere}
  .leg-item{gap:8px;align-items:flex-start}.leg-names{max-width:58%;white-space:normal}.leg-stats{flex-shrink:0;font-size:11px}
  .btn-rtz{min-height:48px;height:auto;padding:10px;font-size:12px;text-align:center}.btn-rtz svg{flex-shrink:0}
  .cost-toggle,.cost-reset{min-height:44px}.cost-fuels{table-layout:fixed}.cost-fuels th{font-size:10px;overflow-wrap:anywhere}.cost-fuels input{padding:4px 2px;min-width:0}
  .minimized-body{min-height:44px;padding:6px 12px}.minimized-summary{font-size:12px}.minimized-expand-btn{font-size:11px}
  .mapboxgl-ctrl-bottom-right,.mapboxgl-ctrl-bottom-left{bottom:calc(var(--planner-height,64dvh) + 6px)}
  .mapboxgl-ctrl-group button{width:40px;height:40px}
  .modal-overlay{padding:12px}.modal-card{padding:20px;max-height:calc(var(--viewport-height,100dvh) - 24px)}.modal-close,.modal-btn{min-height:44px}
  .map-pick-prompt{top:64px}
}
@media(max-height:500px) and (max-width:950px) and (orientation:landscape){
  .floating-card{top:64px;bottom:8px;left:8px;right:auto;width:min(360px,52vw);max-height:calc(var(--viewport-height,100dvh) - 72px);border-radius:12px}
  .floating-card.is-minimized{top:auto;width:min(360px,52vw)}
  .floating-card.is-searching{max-height:calc(var(--viewport-height,100dvh) - 72px)}
  .card-header{padding:2px 10px;min-height:44px}.planner-tabs{padding:0 8px 4px}
  .planner-tabs button{min-height:40px}.planner-actions{padding:6px 10px}.planner-actions .btn-calculate{min-height:44px}
  .mapboxgl-ctrl-bottom-right,.mapboxgl-ctrl-bottom-left{bottom:8px}.mapboxgl-ctrl-bottom-left{left:auto;right:56px}
  .map-pick-prompt{left:auto;right:8px;transform:none;max-width:44%;top:64px}
}
@media(prefers-reduced-motion:reduce){*,*::before,*::after{transition:none!important;scroll-behavior:auto!important}}
@media(max-width:900px){
  .mapboxgl-ctrl-compass{display:none!important}
  body:has(.is-searching) .mapboxgl-ctrl-bottom-right,body:has(.is-searching) .mapboxgl-ctrl-bottom-left{visibility:hidden}
}
