/* Route Map page (V2 test). Layout: map fills the screen, route panel on the right
   (desktop) or as a bottom sheet (narrow screens / iPad portrait). */
.rm-body { height: 100vh; height: 100dvh; display: flex; flex-direction: column; overflow: hidden; }
.rm-header { padding: 10px 16px; flex: 0 0 auto; }
.rm-main { flex: 1 1 auto; min-height: 0; display: flex; }
.rm-map-wrap { position: relative; flex: 1 1 auto; min-width: 0; }
#rmMap { position: absolute; inset: 0; background: #0b1724; }

.rm-panel {
  flex: 0 0 340px; width: 340px; display: flex; flex-direction: column; gap: 10px;
  padding: 12px; overflow-y: auto; background: #0e1d2e;
  border-left: 1px solid rgba(255, 255, 255, .1);
}
.rm-search { position: relative; }
.rm-results {
  position: absolute; left: 0; right: 0; top: calc(100% + 4px); z-index: 1200; margin: 0; padding: 4px;
  list-style: none; max-height: 260px; overflow-y: auto; background: #102235;
  border: 1px solid rgba(255, 255, 255, .18); border-radius: 12px; box-shadow: 0 12px 30px rgba(0, 0, 0, .45);
}
.rm-results li { padding: 8px 10px; border-radius: 8px; cursor: pointer; display: flex; gap: 8px; align-items: baseline; }
.rm-results li:hover, .rm-results li.active { background: rgba(96, 165, 250, .2); }
.rm-results .id { font-weight: 800; }
.rm-results .nm { font-size: 12px; opacity: .75; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.rm-route-head { display: flex; justify-content: space-between; align-items: baseline; }
.rm-total { font-weight: 800; color: #93c5fd; }
.rm-hint { margin: 0; font-size: 12px; line-height: 1.4; color: #9fb3c8; }
.rm-route-list { margin: 0; padding: 0; list-style: none; display: grid; gap: 6px; }
.rm-route-list li.pt {
  display: grid; grid-template-columns: 26px 1fr auto; gap: 8px; align-items: center;
  padding: 6px 8px; border-radius: 10px; background: rgba(255, 255, 255, .06);
  border: 1px solid rgba(255, 255, 255, .1);
}
.rm-route-list .num {
  width: 24px; height: 24px; border-radius: 50%; background: #2563eb; color: #fff;
  display: inline-flex; align-items: center; justify-content: center; font-size: 12px; font-weight: 800;
}
.rm-route-list .pid { font-weight: 800; }
.rm-route-list .pnm { font-size: 11px; opacity: .7; margin-left: 6px; }
.rm-route-list .btns { display: flex; gap: 4px; }
.rm-route-list .btns button { padding: 2px 8px; min-height: 30px; border-radius: 8px; font-size: 13px; }
.rm-route-list li.leg {
  margin: -2px 0 -2px 12px; padding: 0 0 0 22px; font-size: 12px; color: #93c5fd;
  border-left: 2px solid rgba(96, 165, 250, .5); min-height: 22px; display: flex; align-items: center;
  cursor: pointer; border-radius: 0 8px 8px 0;
}
.rm-route-list li.leg.sel { color: #fbbf24; border-left-color: #fbbf24; background: rgba(251, 191, 36, .12); }
.rm-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.rm-actions button { flex: 1 1 auto; }
.rm-legend { display: flex; flex-wrap: wrap; gap: 6px 14px; font-size: 12px; color: #c4d4e4; margin-top: auto; padding-top: 6px; }
.rm-legend .dot { display: inline-block; width: 10px; height: 10px; border-radius: 50%; margin-right: 5px; vertical-align: -1px; }
.dot.ad { background: #ef4444; } .dot.wpt { background: #38bdf8; } .dot.nav { background: #a78bfa; }
.dot.tun { background: #f59e0b; }

.rm-toast {
  position: absolute; left: 50%; bottom: 18px; transform: translateX(-50%) translateY(20px); z-index: 1100;
  background: rgba(16, 34, 53, .96); color: #fff; padding: 8px 14px; border-radius: 12px; font-size: 13px;
  border: 1px solid rgba(255, 255, 255, .18); opacity: 0; pointer-events: none; transition: opacity .2s, transform .2s;
  max-width: calc(100% - 24px); text-align: center;
}
.rm-toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
.rm-nolib { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; z-index: 1300; background: #0b1724; }

/* Point labels shown when zoomed in */
.rm-label { background: none !important; border: none !important; }
.rm-label span {
  display: inline-block; transform: translate(11px, -8px); font-size: 11px; font-weight: 700; color: #fff;
  text-shadow: 0 0 3px #000, 0 0 3px #000, 0 0 3px #000; white-space: nowrap; pointer-events: none;
}
.rm-num-icon { background: none !important; border: none !important; }
.rm-num-icon span {
  display: flex; width: 22px; height: 22px; border-radius: 50%; background: #2563eb; color: #fff; border: 2px solid #fff;
  align-items: center; justify-content: center; font-size: 11px; font-weight: 800; box-shadow: 0 1px 4px rgba(0, 0, 0, .6);
}
.leaflet-container { font-family: inherit; }

/* New-point dialog */
.rm-overlay { position: fixed; inset: 0; z-index: 99999; background: rgba(0, 0, 0, .55); display: flex; align-items: center; justify-content: center; padding: 12px; }
.rm-overlay.hidden { display: none; }
.rm-dialog {
  width: 480px; max-width: 100%; max-height: 100%; overflow-y: auto; background: #102235; color: #f2f7fb;
  border: 1px solid rgba(255, 255, 255, .18); border-radius: 18px; padding: 18px; box-shadow: 0 20px 60px rgba(0, 0, 0, .45);
}
.rm-dialog h3 { margin: 0 0 12px; font-size: 20px; }
.rm-form { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.rm-check { display: flex; flex-direction: row; align-items: center; gap: 8px; margin-top: 12px; }
.rm-check input { width: auto; }
.rm-error { margin: 10px 0 0; color: #fca5a5; font-size: 13px; }
.rm-dialog-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 16px; }

/* Tall, narrow screens (phone / tablet upright): the panel goes under the map.
   Wide screens, and phones on their side: the panel is beside the map. */
@media (max-width: 900px) and (orientation: portrait) {
  .rm-main { flex-direction: column; }
  .rm-panel { flex: 0 0 40%; width: auto; border-left: none; border-top: 1px solid rgba(255, 255, 255, .1); }
}
@media (max-width: 900px) {
  .rm-hint { display: none; }
  .rm-form { grid-template-columns: 1fr; }
}

/* Map-style chooser (Leaflet layers control): undo the app-wide label/input styles */
.leaflet-control-layers-list { padding: 4px 6px; }
.leaflet-control-layers label { display: block; color: #1f2937; font-size: 14px; padding: 5px 2px; gap: 0; }
.leaflet-control-layers label > span { display: flex; align-items: center; gap: 8px; }
.leaflet-control-layers-selector { width: auto; padding: 0; margin: 0; border: none; box-shadow: none; accent-color: #2563eb; }

/* Dark map style: OSM tiles inverted and toned down */
.rm-dark-tiles { filter: invert(1) hue-rotate(180deg) brightness(.95) contrast(.9) saturate(.7); }

/* "Show on map" filters: toggle switches, collapsible */
.rm-show { display: grid; gap: 2px; padding: 8px 12px; border-radius: 12px; background: rgba(255, 255, 255, .05); border: 1px solid rgba(255, 255, 255, .1); }
.rm-show-title { display: flex; justify-content: space-between; align-items: center; font-size: 12px; font-weight: 700; color: #9fb3c8; letter-spacing: .04em; text-transform: uppercase; padding: 4px 0; cursor: pointer; user-select: none; -webkit-tap-highlight-color: transparent; }
.rm-chev { font-size: 14px; transition: transform .15s; }
.rm-show.collapsed .rm-chev { transform: rotate(-90deg); }
.rm-show.collapsed .rm-sw, .rm-show.collapsed .rm-sel { display: none; }
.rm-sw { position: relative; display: flex; flex-direction: row; align-items: center; gap: 10px; font-size: 14px; cursor: pointer; min-height: 38px; user-select: none; -webkit-tap-highlight-color: transparent; }
.rm-sw svg { flex: 0 0 20px; }
.rm-sw span { flex: 1 1 auto; }
.rm-sw input { position: absolute; opacity: 0; width: 1px; height: 1px; margin: 0; pointer-events: none; }
.rm-sw-ui { flex: 0 0 auto; position: relative; width: 42px; height: 24px; border-radius: 999px; background: #475569; transition: background .15s; }
.rm-sw-ui::after { content: ""; position: absolute; top: 3px; left: 3px; width: 18px; height: 18px; border-radius: 50%; background: #fff; box-shadow: 0 1px 3px rgba(0, 0, 0, .4); transition: transform .15s; }
.rm-sw input:checked ~ .rm-sw-ui { background: #2563eb; }
.rm-sw input:checked ~ .rm-sw-ui::after { transform: translateX(18px); }
.rm-sw input:focus-visible ~ .rm-sw-ui { box-shadow: 0 0 0 3px rgba(59, 130, 246, .4); }
.leaflet-tooltip { font-family: inherit; }

/* Drag to reorder */
.rm-panel { position: relative; }
.rm-route-list .num { cursor: grab; touch-action: none; user-select: none; -webkit-user-select: none; }
.rm-route-list li.pt { position: relative; }
.rm-route-list li.pt.dragging { z-index: 20; opacity: .92; box-shadow: 0 10px 28px rgba(0, 0, 0, .55); background: #18314b; transition: none; }
.rm-route-list li.pt.dragging .num { cursor: grabbing; }
.rm-route-list.reordering { user-select: none; }
.rm-route-list li.pt.drop-before { box-shadow: 0 -3px 0 0 #fbbf24; }
.rm-route-list li.pt.drop-after { box-shadow: 0 3px 0 0 #fbbf24; }

/* VFR tunnels: green line + code label, and the "tunnel detected" prompt */
.rm-tn-label { background: none !important; border: none !important; }
.rm-tn-label span { display: inline-block; transform: translate(-50%, calc(-50% + var(--dy, 0px))); padding: 1px 6px; border-radius: 8px; background: #166534; color: #fff; font-size: 11px; font-weight: 800; border: 1px solid #bbf7d0; white-space: nowrap; pointer-events: none; }
.rm-tn-msg { margin: 0 0 14px; line-height: 1.45; color: #dbe7f3; }
.rm-tn-choices { display: grid; gap: 8px; }
.rm-tn-choices button { text-align: left; }

/* tunnel filter + Flight Plan route box */
.rm-sel { display: flex; flex-direction: row; align-items: center; gap: 10px; min-height: 38px; font-size: 14px; padding-left: 0; }
.rm-sel span { flex: 1 1 auto; color: #c4d4e4; }
.rm-sel svg { flex: 0 0 20px; }
.rm-sel select { flex: 0 0 auto; width: auto; min-width: 96px; min-height: 32px; padding: 2px 8px; }
.rm-fp { display: grid; gap: 6px; padding: 10px 12px; border-radius: 12px; background: rgba(255, 255, 255, .05); border: 1px solid rgba(255, 255, 255, .1); }
.rm-fp-head { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.rm-fp-head button { min-height: 32px; padding: 2px 10px; font-size: 13px; }
.rm-fp-text { font: 600 14px/1.5 Consolas, Menlo, monospace; word-break: break-word; user-select: all; }
.rm-fp small { color: #9fb3c8; }

/* ---- wind chart ---- */
.rm-wind { display: grid; gap: 8px; padding: 8px 12px; border-radius: 12px; background: rgba(255, 255, 255, .05); border: 1px solid rgba(255, 255, 255, .1); }
.rm-wind .hidden { display: none !important; }
.rm-wind.collapsed .rm-chev { transform: rotate(-90deg); }
.rm-wind.collapsed .rm-wind-body { display: none; }
.rm-wind-body { display: grid; gap: 8px; }
.rm-wind-row { display: flex; gap: 8px; }
.rm-wind-row button { flex: 1 1 auto; }
.rm-wind-status { margin: 0; font-size: 12px; line-height: 1.4; color: #9fb3c8; }
.rm-wind-opts { display: grid; gap: 6px; }
.rm-wind-opts label { display: grid; grid-template-columns: 1fr 120px; gap: 8px; align-items: center; font-size: 13px; }
.rm-wind-opts label.rm-wind-chk { grid-template-columns: auto 1fr; justify-content: start; }
.rm-wind-opts input, .rm-wind-opts select { min-height: 32px; }
.rm-wind-switches { display: flex; flex-wrap: wrap; gap: 8px 18px; }
.rm-wind-opts label.rm-sw { display: flex; grid-template-columns: none; align-items: center; gap: 8px; font-size: 13px; cursor: pointer; }
.rm-switch { position: relative; flex: none; width: 38px; height: 22px; }
.rm-wind-opts .rm-switch input { position: absolute; inset: 0; width: 100%; height: 100%; min-height: 0; margin: 0; opacity: 0; cursor: pointer; z-index: 1; }
.rm-switch span { position: absolute; inset: 0; border-radius: 11px; background: #2a3d52; transition: background .15s; }
.rm-switch span::after { content: ""; position: absolute; top: 3px; left: 3px; width: 16px; height: 16px; border-radius: 50%; background: #9fb3c6; transition: transform .15s, background .15s; }
.rm-switch input:checked + span { background: #4aa3ff; }
.rm-switch input:checked + span::after { transform: translateX(16px); background: #fff; }
.rm-switch input:focus-visible + span { box-shadow: 0 0 0 3px rgba(74, 163, 255, .35); }
.rm-wind-legs { display: grid; gap: 6px; }
.rm-wl { display: grid; gap: 4px; padding: 6px 8px; border-radius: 10px; background: rgba(255, 255, 255, .06); border: 1px solid rgba(255, 255, 255, .1); font-size: 13px; }
.rm-wl-head { font-weight: 800; }
.rm-wl-head small { font-weight: 400; opacity: .7; margin-left: 6px; }
.rm-wl-row { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.rm-wl-row input, .rm-wl-row select { min-height: 30px; padding: 2px 6px; width: 64px; }
.rm-wl-row select { width: 86px; }
.rm-wl-row .sep { opacity: .6; }
.rm-wl-chart { color: #93c5fd; }
.rm-sp { min-height: 28px; padding: 2px 10px; border-radius: 8px; border: 1px solid rgba(255, 255, 255, .18); background: rgba(255, 255, 255, .06); color: inherit; font: 700 12px/1 system-ui, sans-serif; cursor: pointer; }
.rm-sp.on { background: #4aa3ff; border-color: #4aa3ff; color: #06192b; }
.rm-wl-row select[data-f="barb"] { width: auto; flex: 1; min-width: 150px; max-width: 100%; }
.rm-pick-tip { background: rgba(15, 23, 42, .9); color: #67e8f9; border: 1px solid #22d3ee; font: 700 10px/1 system-ui, sans-serif; padding: 2px 4px; }
.rm-wl-warn { color: #fbbf24; font-size: 12px; }
.rm-wb-wrap { pointer-events: none; }
.rm-wb { position: absolute; transform: translate(5px, 4px); white-space: nowrap; font: 700 10px/1 system-ui, sans-serif; padding: 2px 3px; border-radius: 4px; color: #fde68a; background: rgba(15, 23, 42, .88); border: 1px solid rgba(255, 255, 255, .25); }
.rm-wb.miss { color: #fecaca; border-color: #ef4444; }
.rm-wb.pen { color: #fed7aa; border-color: #f97316; }
.rm-wind-charts { display: grid; gap: 6px; }
.rm-wc { display: flex; gap: 8px; align-items: center; padding: 4px 8px; border-radius: 10px; background: rgba(255, 255, 255, .06); border: 1px solid rgba(255, 255, 255, .1); font-size: 13px; }
.rm-wc-show { display: flex; gap: 6px; align-items: center; flex: 1 1 auto; }
.rm-wc input[type="number"] { width: 78px; min-height: 30px; padding: 2px 6px; }
.rm-wc button { padding: 2px 8px; min-height: 30px; border-radius: 8px; }
.rm-wc-show input { width: auto; flex: 0 0 auto; margin: 0; } .rm-wc-show span { flex: 0 0 auto; }

/* ---- collapsible route ---- */
.rm-routebox { display: grid; gap: 8px; }
.rm-route-body { display: grid; gap: 10px; }
.rm-route-head { cursor: pointer; user-select: none; -webkit-tap-highlight-color: transparent; align-items: center; }
.rm-route-right { display: flex; align-items: center; gap: 10px; }
.rm-routebox.collapsed .rm-route-body { display: none; }
.rm-routebox.collapsed .rm-chev { transform: rotate(-90deg); }

/* ---- Route as a card, same look as "Show on map" and "Wind chart" ---- */
.rm-routebox { padding: 8px 12px; border-radius: 12px; background: rgba(255, 255, 255, .05); border: 1px solid rgba(255, 255, 255, .1); }
.rm-route-head { padding: 4px 0; font-size: 12px; font-weight: 700; color: #9fb3c8; letter-spacing: .04em; text-transform: uppercase; }
.rm-route-head strong { font-size: 12px; font-weight: 700; color: inherit; }
.rm-route-head .rm-total { font-size: 14px; letter-spacing: 0; }

/* ---- draggable divider between the map and the panel ---- */
.rm-split { flex: 0 0 12px; position: relative; z-index: 5; cursor: col-resize; touch-action: none; background: #0e1d2e; display: flex; align-items: center; justify-content: center; -webkit-tap-highlight-color: transparent; user-select: none; }
.rm-split span { width: 4px; height: 44px; border-radius: 4px; background: rgba(255, 255, 255, .28); transition: background .15s; }
.rm-split:hover span, .rm-split.drag span { background: #60a5fa; }
.rm-panel { border-left: none; }
@media (max-width: 900px) and (orientation: portrait) {
  .rm-split { cursor: row-resize; flex: 0 0 16px; border-top: 1px solid rgba(255, 255, 255, .1); }
  .rm-split span { width: 44px; height: 4px; }
}

/* ---- Alternate box ---- */
.rm-alt { display: grid; gap: 8px; padding: 8px 12px; border-radius: 12px; background: rgba(255, 255, 255, .05); border: 1px solid rgba(255, 255, 255, .1); }
.rm-alt .rm-total { font-size: 14px; letter-spacing: 0; }
.rm-alt-body { display: grid; gap: 8px; }
.rm-alt.collapsed .rm-alt-body { display: none; }
.rm-alt.collapsed .rm-chev { transform: rotate(-90deg); }
.rm-alt-row { display: flex; align-items: center; gap: 8px; }
.rm-alt-row .id { font-weight: 800; color: #fbbf24; }
.rm-alt-row .nm { flex: 1 1 auto; min-width: 0; font-size: 12px; opacity: .8; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rm-alt-row button { padding: 4px 10px; }
.rm-hint2 { margin: 0; font-size: 12px; color: #9fb3c8; }
.rm-alt-icon span { width: 30px; border-radius: 11px; background: #f59e0b; color: #1f1300; border-color: #1f1300; font-size: 11px; }
.rm-wl-alt .rm-wl-head { color: #fbbf24; }

/* ---- Send to Nav Log: always visible at the bottom of the panel ---- */
.rm-sendbar { position: sticky; bottom: -12px; z-index: 20; margin: auto -12px -12px; padding: 10px 12px; background: #0e1d2e; border-top: 1px solid rgba(255, 255, 255, .12); box-shadow: 0 -8px 16px rgba(0, 0, 0, .35); }
.rm-sendbar button { width: 100%; }
.rm-sendbar { display: grid; gap: 8px; }

/* ---- leg labels, wind legend, day/night button ---- */
.rm-leg-label { background: none !important; border: none !important; }
.rm-leg-label span { display: inline-block; transform: translate(-50%, -50%); padding: 1px 6px; border-radius: 9px; background: rgba(11, 23, 36, .82); color: #fff; font-size: 10.5px; font-weight: 700; white-space: nowrap; border: 1px solid rgba(255, 255, 255, .35); pointer-events: none; }
.rm-leg-label.alt span { background: rgba(120, 70, 0, .88); border-color: #f59e0b; }
.rm-legend { background: rgba(11, 23, 36, .85); border: 1px solid rgba(255, 255, 255, .25); border-radius: 8px; padding: 5px 8px 4px; margin-bottom: 26px !important; }
.rm-legend-bar { width: 110px; height: 7px; border-radius: 4px; background: linear-gradient(90deg, #22c55e, #2563eb, #ef4444); }
.rm-legend-t { display: flex; justify-content: space-between; width: 110px; gap: 8px; font-size: 10px; color: #cbd5e1; margin-top: 2px; }
.rm-night a { font-size: 17px; line-height: 30px; text-decoration: none; }
.rm-actions button:disabled { opacity: .45; cursor: default; }
/* legend: bar on top, the two words underneath it */
.rm-legend { display: grid !important; grid-template-columns: 110px; gap: 3px; width: auto; }
.rm-legend .rm-legend-bar { display: block; width: 110px; }
.rm-legend .rm-legend-t { display: flex; width: 110px; justify-content: space-between; margin: 0; }
/* top buttons: two per row */
.rm-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.rm-actions button { padding-left: 8px; padding-right: 8px; font-size: 14px; white-space: nowrap; }

/* ---- leg cards: summary line, open / close ---- */
.rm-wl-head { display: flex; align-items: center; gap: 8px; cursor: pointer; user-select: none; -webkit-tap-highlight-color: transparent; }
.rm-wl-title { white-space: nowrap; }
.rm-wl-sum { margin-left: auto; min-width: 0; font-size: 12px; font-weight: 500; color: #93c5fd; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.rm-wl-w { color: #fbbf24; font-size: 12px; }
.rm-wl-body { display: grid; gap: 4px; }
.rm-wl:not(.open) .rm-wl-body { display: none; }
.rm-wl:not(.open) .rm-chev { transform: rotate(-90deg); }

/* ---- saved routes ---- */
.rm-saved { display: grid; gap: 8px; padding: 8px 12px; border-radius: 12px; background: rgba(255, 255, 255, .05); border: 1px solid rgba(255, 255, 255, .1); }
.rm-saved .rm-total { font-size: 14px; letter-spacing: 0; }
.rm-saved-body { display: grid; gap: 8px; }
.rm-saved.collapsed .rm-saved-body { display: none; }
.rm-saved.collapsed .rm-chev { transform: rotate(-90deg); }
.rm-saved-new { display: flex; gap: 8px; }
.rm-saved-new input { flex: 1 1 auto; min-width: 0; }
.rm-saved-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.rm-saved-list li { display: flex; align-items: center; gap: 6px; padding: 6px 8px; border-radius: 10px; background: rgba(255, 255, 255, .06); border: 1px solid rgba(255, 255, 255, .1); }
.rm-saved-info { flex: 1 1 auto; min-width: 0; display: grid; }
.rm-saved-info b { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rm-saved-info small { opacity: .7; }
.rm-saved-list button { padding: 4px 10px; }
.rm-saved-empty { opacity: .6; justify-content: center; }
.rm-total { text-transform: none; }
.rm-panel { overflow-x: hidden; }
.rm-wind, .rm-wind-body, .rm-wind-legs, .rm-wind-opts, .rm-wl, .rm-wl-body { min-width: 0; }
.rm-wind-body, .rm-wind-legs, .rm-wl, .rm-wl-body { grid-template-columns: minmax(0, 1fr); }
.rm-wl-head { min-width: 0; }
.rm-wl-row input, .rm-wl-row select { max-width: 100%; }

/* ---- phones ---- */
@media (max-width: 600px) {
  .rm-header { padding: 6px 10px; }
  .rm-header .header-top { gap: 8px; }
  .rm-header .page-title-with-logo { gap: 8px; min-width: 0; font-size: 20px; }
  .rm-header .page-logo-mini { width: 40px; height: 40px; }
  .rm-header .page-logo-mini img { width: 36px; height: 36px; }
  .rm-header .top-nav { gap: 6px; }
  .rm-header .nav-link { padding: 6px 10px; font-size: 14px; }
  .rm-panel { padding: 8px 10px; gap: 8px; }
  .rm-sendbar { grid-template-columns: 1fr auto; margin: auto -10px -8px; padding: 8px 10px calc(8px + env(safe-area-inset-bottom)); bottom: -8px; }
  .rm-sendbar button { width: auto; }
  .rm-sendbar #rmSend { width: 100%; }
}
/* phone on its side: little height, so a compact header and a narrower panel */
@media (max-height: 520px) and (orientation: landscape) {
  .rm-header { padding: 4px 10px; }
  .rm-header .page-title-with-logo { gap: 8px; font-size: 18px; }
  .rm-header .page-logo-mini { width: 34px; height: 34px; }
  .rm-header .page-logo-mini img { width: 30px; height: 30px; }
  .rm-header .nav-link { padding: 4px 10px; font-size: 13px; }
  .rm-panel { flex-basis: 300px; width: 300px; }
  .rm-sendbar { grid-template-columns: 1fr auto; }
  .rm-sendbar button { width: auto; }
  .rm-sendbar #rmSend { width: 100%; }
}
@media (max-width: 360px) {
  .rm-header .page-title-with-logo { font-size: 17px; gap: 6px; }
  .rm-header .page-logo-mini { width: 34px; height: 34px; }
  .rm-header .page-logo-mini img { width: 30px; height: 30px; }
  .rm-header .nav-link { padding: 5px 8px; font-size: 13px; }
  .rm-header .top-nav { gap: 4px; }
}
.rm-legend.off { display: none !important; }

/* ---- Route summary ---- */
.rm-calc { display: grid; gap: 8px; padding: 8px 12px; border-radius: 12px; background: rgba(255, 255, 255, .05); border: 1px solid rgba(255, 255, 255, .1); }
.rm-calc .rm-total { font-size: 14px; letter-spacing: 0; }
.rm-calc-body { display: grid; gap: 8px; }
.rm-calc.collapsed .rm-calc-body { display: none; }
.rm-calc.collapsed .rm-chev { transform: rotate(-90deg); }
.rm-calc-in { display: flex; gap: 8px; flex-wrap: wrap; }
.rm-calc-in label { display: grid; gap: 2px; font-size: 11px; color: #9fb3c8; flex: 1 1 110px; min-width: 0; }
.rm-calc-in input { min-height: 32px; width: 100%; box-sizing: border-box; }
.rm-cs { width: 100%; border-collapse: collapse; font-size: 12px; font-variant-numeric: tabular-nums; }
.rm-cs th { text-align: right; font-size: 10px; color: #9fb3c8; font-weight: 700; padding: 2px 3px; }
.rm-cs td { text-align: right; padding: 2px 3px; }
.rm-cs th:nth-child(1), .rm-cs td:nth-child(1), .rm-cs th:nth-child(2), .rm-cs td.nm { text-align: left; }
.rm-cs td.nm { max-width: 110px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rm-cs tr.sub td { font-size: 11px; color: #93c5fd; padding-top: 0; text-align: left; opacity: .9; }
.rm-cs tr.bad td { color: #fbbf24; }
.rm-cs tr.tot td { font-weight: 800; border-top: 1px solid rgba(255, 255, 255, .2); }
.rm-cs-fuel { display: grid; grid-template-columns: 1fr auto; gap: 2px 12px; margin: 0; font-size: 12px; }
.rm-cs-fuel dt, .rm-cs-fuel dd { margin: 0; }
.rm-cs-fuel dd { text-align: right; font-variant-numeric: tabular-nums; }
.rm-cs-fuel .req { font-weight: 800; border-top: 1px solid rgba(255, 255, 255, .2); padding-top: 2px; }

/* ---- Aerodrome card and suggested alternates ---- */
.rm-info { padding: 2px 8px; min-height: 30px; border-radius: 8px; font-size: 14px; }
.rm-sugs { display: grid; gap: 4px; }
.rm-sug-t { font-size: 11px; color: #9fb3c8; font-weight: 700; text-transform: uppercase; letter-spacing: .04em; }
.rm-sug { display: flex; align-items: center; gap: 8px; padding: 4px 6px; border-radius: 8px; background: rgba(255, 255, 255, .05); cursor: pointer; font-size: 12px; }
.rm-sug:hover { background: rgba(255, 255, 255, .1); }
.rm-sug .id { font-weight: 800; color: #fbbf24; }
.rm-sug .nm { flex: 1 1 auto; min-width: 0; opacity: .8; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rm-sug .d { font-size: 11px; color: #93c5fd; text-align: right; }
.rm-alt-row .rm-info { flex: none; }
.rm-dialog h3 small { font-size: 13px; font-weight: 400; opacity: .7; }
.rm-ad-line { margin: 4px 0 8px; font-size: 14px; }
.rm-ad-tab { width: 100%; border-collapse: collapse; font-size: 13px; margin: 6px 0 10px; font-variant-numeric: tabular-nums; }
.rm-ad-tab th { text-align: left; font-size: 11px; color: #9fb3c8; padding: 3px 6px; border-bottom: 1px solid rgba(255, 255, 255, .15); }
.rm-ad-tab td { padding: 3px 6px; }
.rm-ad-tab td.fq { text-align: right; font-weight: 700; color: #93c5fd; }
.rm-dialog-actions { flex-wrap: wrap; }

.rm-dragging, .rm-dragging * { cursor: grabbing !important; }

/* ---- Direction arrows and time marks on the route ---- */
.rm-arrow { background: none !important; border: none !important; pointer-events: none; }
.rm-arrow svg { display: block; filter: drop-shadow(0 0 2px rgba(0, 0, 0, .6)); }
.rm-tm { background: none !important; border: none !important; pointer-events: none; }
.rm-tm i { position: absolute; left: -4px; top: -4px; width: 8px; height: 8px; border-radius: 50%; background: #fff; border: 2px solid #0b1724; box-sizing: content-box; margin: -2px 0 0 -2px; }
.rm-tm b { position: absolute; left: 7px; top: -17px; padding: 0 4px; border-radius: 6px; background: rgba(11, 23, 36, .88); border: 1px solid rgba(255, 255, 255, .4); color: #fde68a; font: 700 10px/14px system-ui, sans-serif; white-space: nowrap; }

/* measure tool */
#rmMap.rm-measuring, #rmMap.rm-measuring * { cursor: crosshair !important; }
.rm-night a.active { background: #fbbf24; color: #0b1724; }
.rm-measure-box { position: absolute; top: 10px; right: 10px; z-index: 1000; width: 230px; max-width: calc(100% - 70px); background: rgba(11, 23, 36, .94); color: #e5edf5; border: 1px solid rgba(255, 255, 255, .2); border-radius: 12px; padding: 10px; font-size: 12px; box-shadow: 0 4px 16px rgba(0, 0, 0, .4); }
.rm-measure-box.hidden { display: none; }
.rm-mb-h { display: flex; justify-content: space-between; gap: 8px; margin-bottom: 6px; font-size: 13px; }
.rm-mb-h span { color: #fde68a; font-weight: 700; }
.rm-mb-list { max-height: 160px; overflow: auto; }
.rm-mb-row { display: grid; grid-template-columns: 18px 1fr auto; gap: 6px; padding: 2px 0; font-variant-numeric: tabular-nums; border-top: 1px solid rgba(255, 255, 255, .08); }
.rm-mb-btns { display: flex; gap: 6px; margin-top: 8px; flex-wrap: wrap; }
.rm-mb-btns button { flex: 1 1 auto; min-height: 30px; padding: 4px 8px; font-size: 12px; }
.rm-leg-label.rm-meas span { color: #fde68a; border-color: #fbbf24; }
/* sunrise / sunset */
.rm-sun { margin-top: 10px; }
.rm-sun-t { font-size: 11px; font-weight: 700; color: #9fb3c8; margin-bottom: 2px; }
.rm-sun-w { margin: 4px 0 0; font-size: 12px; color: #fbbf24; font-weight: 600; }

/* in-app confirmation */
.rm-ask { max-width: 380px; }
.rm-ask-msg { margin: 0; font-size: 15px; line-height: 1.45; }

/* hover tip of an aerodrome: ⓘ button that opens the info card */
.leaflet-tooltip.leaflet-interactive { pointer-events: auto; cursor: default; }
.rm-tip-i { margin-left: 8px; padding: 0 7px; min-height: 22px; border-radius: 6px; font-size: 13px; line-height: 20px; vertical-align: middle; cursor: pointer; }

/* ---- v8.6.4: panel minimise + GPS ---- */
.rm-main.panel-min .rm-panel, .rm-main.panel-min .rm-split { display: none; }
.rm-panelbtn a { display: flex; align-items: center; justify-content: center; width: 30px; height: 30px; color: #1f2937; }
.rm-night a.active { background: #2f8bff; color: #fff; }

.rm-gps-icon { background: none !important; border: none !important; }
.rm-gps-pulse { position: absolute; left: 11px; top: 11px; width: 22px; height: 22px; border-radius: 50%; background: rgba(47, 139, 255, .35); animation: rmGpsPulse 2s ease-out infinite; }
@keyframes rmGpsPulse { 0% { transform: scale(.7); opacity: .9 } 100% { transform: scale(2.1); opacity: 0 } }
.rm-gps-icon svg { position: absolute; left: 0; top: 0; filter: drop-shadow(0 1px 3px rgba(0, 0, 0, .6)); transition: transform .3s; }

.rm-gps {
  position: absolute; z-index: 1000; left: 50%; top: 10px; transform: translate(calc(-50% + var(--dx, 0px)), var(--dy, 0px));
  width: min(560px, calc(100% - 130px)); display: grid; gap: 6px; padding: 8px 10px;
  background: rgba(10, 22, 38, .88); color: #fff; border: 1px solid rgba(255, 255, 255, .16); border-radius: 14px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, .45); -webkit-backdrop-filter: blur(8px); backdrop-filter: blur(8px);
}
.rm-gps.hidden { display: none; }
.rm-gps-row { display: flex; align-items: stretch; gap: 6px; }
.rm-gps-tools { flex-wrap: wrap; }
.rm-gps .g { flex: 1 1 0; min-width: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; line-height: 1.1; }
.rm-gps .g.wide { flex: 1.6 1 0; align-items: flex-start; text-align: left; }
.rm-gps .g b { font-size: 22px; font-weight: 800; font-variant-numeric: tabular-nums; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 100%; }
.rm-gps .g i { font-style: normal; font-size: 10px; font-weight: 700; letter-spacing: .05em; color: #9fb3c8; text-transform: uppercase; }
.rm-gps-next { padding-top: 6px; border-top: 1px solid rgba(255, 255, 255, .12); }
.rm-gps-next .g b { font-size: 19px; color: #7dd3fc; }
.rm-gps-next .g.wide b { color: #fde68a; }
.rm-gps-tools { align-items: center; gap: 6px; }
.rm-gps-status { flex: 1 1 auto; font-size: 11.5px; color: #86efac; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rm-gps-status.bad { color: #fca5a5; }
.rm-gps-tools button { flex: 0 0 auto; min-height: 32px !important; padding: 0 10px !important; font-size: 12px !important; font-weight: 700; border-radius: 9px !important; background: rgba(255, 255, 255, .08) !important; color: #dbe7f5 !important; border: 1px solid rgba(255, 255, 255, .18) !important; box-shadow: none !important; }
.rm-gps-tools button.on { background: #2f8bff !important; color: #fff !important; border-color: #2f8bff !important; }
@media (max-width: 600px) {
  .rm-gps { width: auto; left: 50px; right: 52px; transform: translate(var(--dx, 0px), var(--dy, 0px)); padding: 6px 8px; gap: 4px; top: 6px; }
  .rm-gps .g b { font-size: 18px; } .rm-gps-next .g b { font-size: 16px; }
  .rm-gps .g i { font-size: 9px; }
}

.rm-actions button.active { background: #2f8bff !important; color: #fff !important; border-color: #2f8bff !important; }
.rm-actions .rm-gps-ico { vertical-align: -3px; margin-right: 6px; }
@media (max-width: 900px) {
  .rm-sendbar #rmSend { grid-column: 1 / -1; }
  .rm-sendbar #rmFp { width: 100%; }
}

.rm-atabar { position: absolute; z-index: 1001; left: 50%; bottom: 26px; transform: translateX(-50%); display: flex; align-items: center; gap: 12px; padding: 8px 8px 8px 16px; border-radius: 12px; background: rgba(10, 22, 38, .94); color: #fff; font-weight: 700; border: 1px solid rgba(34, 197, 94, .55); box-shadow: 0 8px 24px rgba(0, 0, 0, .5); }
.rm-atabar.hidden { display: none; }
.rm-atabar button { min-height: 34px !important; padding: 0 14px !important; font-size: 13px !important; border-radius: 9px !important; background: rgba(255, 255, 255, .1) !important; color: #fff !important; border: 1px solid rgba(255, 255, 255, .25) !important; }

.rm-fuel { display: grid; gap: 6px; padding-top: 8px; border-top: 1px solid rgba(255, 255, 255, .12); max-height: 46vh; overflow: auto; }
.rm-fuel.hidden { display: none; }
.rm-fuel-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; }
.rm-fuel .g { display: flex; flex-direction: column; align-items: center; text-align: center; line-height: 1.1; }
.rm-fuel .g b { font-size: 21px; font-weight: 800; font-variant-numeric: tabular-nums; color: #fff; }
.rm-fuel .g i { font-style: normal; font-size: 10px; font-weight: 700; letter-spacing: .05em; color: #9fb3c8; }
.rm-fuel .ok { color: #86efac !important; } .rm-fuel .warn { color: #fde68a !important; } .rm-fuel .bad { color: #fca5a5 !important; }
.rm-fuel-sub { font-size: 11.5px; color: #9fb3c8; text-align: center; }
.rm-fuel-warn { font-size: 12px; color: #fde68a; background: rgba(250, 204, 21, .1); border: 1px solid rgba(250, 204, 21, .3); border-radius: 8px; padding: 6px 8px; }
.rm-fuel-tbl { width: 100%; border-collapse: collapse; font-size: 12px; }
.rm-fuel-tbl th { text-align: left; color: #9fb3c8; font-weight: 700; font-size: 10px; letter-spacing: .04em; text-transform: uppercase; padding: 3px 4px; background: none; border: 0; }
.rm-fuel-tbl td { padding: 4px; border-top: 1px solid rgba(255, 255, 255, .08); font-variant-numeric: tabular-nums; }
.rm-fuel-foot { display: flex; align-items: center; justify-content: space-between; gap: 8px; font-size: 11.5px; color: #9fb3c8; }
.rm-fuel-foot button { min-height: 32px !important; padding: 0 12px !important; font-size: 12px !important; font-weight: 700; border-radius: 9px !important; background: rgba(255, 255, 255, .08) !important; color: #dbe7f5 !important; border: 1px solid rgba(255, 255, 255, .18) !important; box-shadow: none !important; }
@media (max-width: 600px) { .rm-fuel .g b { font-size: 17px; } .rm-fuel-grid { gap: 3px; } }

/* ---- Legs & times panel (inside the GPS HUD, next to Check fuel) ---- */
.rm-flt { display: flex; flex-direction: column; gap: 8px; padding-top: 8px; border-top: 1px solid rgba(255, 255, 255, .12); max-height: 58vh; overflow: hidden; }
.rm-flt.hidden { display: none; }
.rm-flt > * { flex: 0 0 auto; }
.rm-flt-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; font-size: 12px; }
.rm-flt-clock { font-weight: 800; font-size: 15px; color: #fff; font-variant-numeric: tabular-nums; }
.rm-flt-head a { color: #7dd3fc; font-weight: 700; text-decoration: none; }
.rm-flt button { min-height: 32px !important; padding: 0 10px !important; font-size: 12px !important; font-weight: 700; border-radius: 9px !important; background: rgba(255, 255, 255, .08) !important; color: #dbe7f5 !important; border: 1px solid rgba(255, 255, 255, .18) !important; box-shadow: none !important; }
.rm-flt-tiles { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; }
.rm-flt .tl { position: relative; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 5px; min-height: 78px; padding: 18px 4px 6px; border-radius: 10px; background: rgba(255, 255, 255, .05); border: 1px solid rgba(255, 255, 255, .12); text-align: center; }
.rm-flt .tl.main { border-color: rgba(125, 211, 252, .45); }
.rm-flt .tl.done { background: rgba(34, 197, 94, .12); border-color: rgba(34, 197, 94, .45); padding-bottom: 32px; }
.rm-flt .tl i { position: absolute; top: 4px; left: 0; right: 0; font-style: normal; font-size: 10px; font-weight: 700; letter-spacing: .05em; color: #9fb3c8; text-transform: uppercase; pointer-events: none; }
.rm-flt .tl.empty i { right: 22px; }
.rm-flt .tl b { font-size: 21px; font-weight: 800; font-variant-numeric: tabular-nums; line-height: 1; color: #fff; }
.rm-flt .tl b small { font-size: 11px; color: #9fb3c8; margin-left: 1px; }
.rm-flt .tl .now { width: calc(100% - 8px); min-height: 40px !important; background: #2f8bff !important; border-color: #2f8bff !important; color: #fff !important; }
.rm-flt .tl .ed, .rm-flt .tl .clr { position: absolute; min-height: 26px !important; width: 28px; padding: 0 !important; font-size: 13px !important; }
.rm-flt .tl.done .ed { right: 3px; bottom: 3px; } .rm-flt .tl.done .clr { left: 3px; bottom: 3px; }
.rm-flt .tl.empty .ed { top: 1px; right: 1px; min-height: 22px !important; width: 24px; font-size: 12px !important; border: 0 !important; background: none !important; }
.rm-flt-edit { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; font-size: 12px; color: #9fb3c8; }
.rm-flt-edit input { width: 92px; min-height: 36px; padding: 0 8px; font-size: 16px; font-weight: 700; text-align: center; border-radius: 9px; border: 1px solid rgba(255, 255, 255, .3); background: rgba(255, 255, 255, .1); color: #fff; font-variant-numeric: tabular-nums; }
.rm-flt-fin { display: grid; grid-template-columns: repeat(auto-fit, minmax(0, 1fr)); gap: 6px; padding: 6px 4px; border-radius: 10px; background: rgba(255, 255, 255, .05); }
.rm-flt .g { display: flex; flex-direction: column; align-items: center; text-align: center; line-height: 1.1; min-width: 0; }
.rm-flt .g b { font-size: 18px; font-weight: 800; font-variant-numeric: tabular-nums; color: #fff; white-space: nowrap; }
.rm-flt .g i { font-style: normal; font-size: 10px; font-weight: 700; letter-spacing: .05em; color: #9fb3c8; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 100%; }
.rm-flt .ok { color: #86efac !important; } .rm-flt .bad { color: #fca5a5 !important; }
.rm-flt-scroll { flex: 1 1 auto !important; min-height: 100px; overflow-y: auto; overflow-x: hidden; -webkit-overflow-scrolling: touch; overscroll-behavior: contain; }
.rm-flt-tbl { width: 100%; border-collapse: collapse; table-layout: fixed; font-size: 12.5px; }
.rm-flt-tbl th { position: sticky; top: 0; z-index: 1; text-align: left; color: #9fb3c8; font-weight: 700; font-size: 10px; letter-spacing: .04em; text-transform: uppercase; padding: 3px 4px; background: #0d1b2e; border: 0; }
.rm-flt-tbl td { padding: 3px 4px; border-top: 1px solid rgba(255, 255, 255, .08); font-variant-numeric: tabular-nums; vertical-align: middle; }
.rm-flt-tbl .n { width: 22px; color: #9fb3c8; } .rm-flt-tbl .dist { width: 44px; text-align: right; } .rm-flt-tbl .eta { width: 54px; } .rm-flt-tbl .ata { width: 112px; }
.rm-flt-tbl td.lg { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 700; }
.rm-flt-tbl td.eta.rev { color: #fde68a; }
.rm-flt-tbl tr.sub td.lg { font-weight: 500; color: #9fb3c8; }
.rm-flt-tbl tr.done td.lg { color: #86efac; }
.rm-flt-tbl tr.cur td { background: rgba(250, 204, 21, .12); }
.rm-flt-tbl td.ata { white-space: nowrap; }
.rm-flt-tbl td.ata b { font-weight: 800; color: #86efac; }
.rm-flt-tbl td.ata em { font-style: normal; font-size: 11px; font-weight: 800; margin-left: 4px; }
.rm-flt-tbl td.ata em.late { color: #fca5a5; } .rm-flt-tbl td.ata em.early { color: #86efac; } .rm-flt-tbl td.ata em.ok { color: #9fb3c8; }
.rm-flt-tbl td.ata button { min-height: 28px !important; padding: 0 10px !important; }
.rm-flt-tbl td.ata .clr { padding: 0 !important; width: 26px; margin-left: 4px; }
.rm-flt-tbl td.ata .now.cur { background: #2f8bff !important; border-color: #2f8bff !important; color: #fff !important; }
@media (max-width: 600px) {
  .rm-flt { gap: 6px; max-height: 60vh; }
  .rm-flt-tiles { grid-template-columns: repeat(2, 1fr); gap: 5px; }
  .rm-flt .tl { min-height: 62px; padding: 16px 4px 5px; }
  .rm-flt .tl .now { min-height: 34px !important; }
  .rm-flt .tl.done { padding: 16px 34px 5px; }
  .rm-flt .tl.done .ed, .rm-flt .tl.done .clr { bottom: auto; top: 22px; }
  .rm-flt .tl b { font-size: 20px; }
  .rm-flt .g b { font-size: 15px; } .rm-flt .g i { font-size: 9px; letter-spacing: .02em; }
  .rm-flt-tbl .dist { display: none; }
  .rm-flt-tbl .ata { width: 104px; }
  .rm-flt-tbl td.lg { white-space: normal; line-height: 1.05; }
  .rm-flt-tbl td.lg .fr { display: block; font-size: 10px; font-weight: 500; color: #9fb3c8; }
  .rm-flt-tbl td.lg .ar { display: none; }
  .rm-flt > .rm-fuel-sub:last-child { display: none; }
}
@media (max-height: 520px) { .rm-flt { overflow-y: auto; } .rm-flt-scroll { flex: 0 0 auto !important; overflow: visible; } }

/* ---- Movable panel ---- */
.rm-gps-grip { display: flex; align-items: center; justify-content: center; height: 16px; margin: -6px 0 -6px; cursor: grab; touch-action: none; -webkit-user-select: none; user-select: none; }
.rm-gps-grip span { width: 44px; height: 5px; border-radius: 3px; background: rgba(255, 255, 255, .35); }
.rm-gps-main, .rm-gps-next, .rm-flt-head { cursor: grab; touch-action: none; -webkit-user-select: none; user-select: none; }
.rm-gps.dragging, .rm-gps.dragging * { cursor: grabbing; }
@media (max-width: 600px) {
  .rm-gps-next .g.wide { flex: 1.1 1 0; }
  .rm-gps-next #gEte { font-size: 14px; letter-spacing: -.02em; overflow: visible; }
}
