/* Route plotting tool panel (native inside index.html).
   Ported from the standalone route.html <style>, scoped under #panel-route so
   nothing leaks into the index. The results table inherits milkyway's
   .result-table styling (header glow / borders), matching the neighbors table. */
#panel-route {
  --accent:#1294d6;  /* EDGIS logo blue, the one blue for text and icons */ --dim:#3b5059; --dim-a:#3b505966;
  /* Match the index/neighbors results palette (milkyway.css). */
  --accent-blue:#3b505966; --accent-white:#f8f8ff; --head-ink:#8fa2ab;
  --text:#e5e7eb; --muted:#8b97a7; --neutron:#1294d6; --ok:#53d08a; --err:#ff6b6b;
  --warn:#ffd36b;  /* fuel-risk amber, kept distinct from the neutron blue */
  --line:rgba(255,255,255,.10); --line2:rgba(255,255,255,.08);
  /* Match the index .glass panel: a faint translucent tint + blur, not a dark box. */
  --panel:rgba(255,255,255,.03); --head:rgba(255,255,255,.04); --field:rgba(255,255,255,.05);
  --mono:ui-monospace,"SF Mono",Menlo,Consolas,monospace;
}
#panel-route * { box-sizing:border-box; }

/* Swap From/To lives in the actions row; the two-way arrow nudges on hover. */
#panel-route #swapFromTo .swap-ico { flex:none; transition:transform .18s ease; }
#panel-route #swapFromTo:hover:not(:disabled) .swap-ico { transform:scale(1.12); }
#panel-route a { color:var(--accent); text-decoration:none; }
#panel-route a:hover { text-decoration:underline; }

#panel-route .pill { display:inline-block; padding:2px 11px; border-radius:999px; font-size:11px; line-height:1.35;
        text-transform:uppercase; letter-spacing:.6px; border:1px solid var(--dim);
        color:var(--muted); background:rgba(255,255,255,.03); }
#panel-route .pill.ok { color:var(--ok); border-color:#2c6b48; }
#panel-route .pill.warn { color:var(--warn); border-color:#7a5f27; }

#panel-route .banner { border:1px solid var(--line); border-radius:10px; padding:10px 14px;
          margin-bottom:16px; background:var(--panel); font-size:13px; }
#panel-route .bannerkey { margin-top:10px; display:flex; align-items:center; gap:10px; flex-wrap:wrap; }
#panel-route .bannerkey label { font-size:11px; text-transform:uppercase; letter-spacing:.5px; color:var(--accent); font-weight:600; }
/* Buttons using the EDGIS index .tool-action styling (same colors). */
#panel-route button { font:inherit; cursor:pointer; display:inline-flex; align-items:center; justify-content:center;
         gap:.4rem; border:0; border-radius:.75rem; padding:.5rem 1rem; font-size:.875rem; white-space:nowrap;
         background:rgba(255,255,255,.04); color:#aaaaaa;
         transition:background .2s ease, color .2s ease; }
#panel-route button:hover:not(:disabled):not(.act-btn) { background:#107CB2; color:#fff; }
#panel-route button:disabled { opacity:.4; cursor:default; }
#panel-route button#go { background:var(--accent-blue); color:#fff; }
#panel-route .actions { display:flex; gap:10px; align-items:center; margin-top:16px; }
#panel-route .actions button { justify-content:center; }
/* Stack the actions (Plot / vs Neutron / vs Galaxy) on narrow screens. */
@media (max-width:560px) {
  #panel-route .actions { flex-direction:column; align-items:stretch; }
  #panel-route .actions button { width:100%; }
}
/* The author `button { display:inline-flex }` rule otherwise beats the UA
   [hidden] rule, so hidden buttons (vs Galaxy before a ship is set) still
   showed. Re-assert it. */
#panel-route button[hidden] { display:none; }
/* Actions sit on their own row above the table; wrap (never clip the compact
   switch) and keep the Export/Copy utility buttons compact. */
#panel-route .summary-actions { display:flex; flex-wrap:wrap; justify-content:flex-end; align-items:center;
                   gap:8px 12px; margin:10px 0 4px; }
#panel-route .summary-actions .switch { margin-right:auto; }   /* compact toggle stays left */
#panel-route #exportBtn, #panel-route #copyRoute, #panel-route #shareRoute { padding:.4rem .7rem; font-size:.8rem; }
#panel-route #copyRoute svg, #panel-route #exportBtn svg, #panel-route #shareRoute svg { width:14px; height:14px; vertical-align:-2px; margin-right:2px; }
/* Export format picker sits next to the Export button in the actions row. */
#panel-route .export-group { display:inline-flex; align-items:center; gap:6px; }
#panel-route #exportFmt { background:rgba(255,255,255,.04); color:var(--text);
         border:1px solid var(--line); border-radius:.5rem; padding:.34rem .5rem; font-size:.8rem; cursor:pointer; }
/* Per-leg fuel-risk marker in the results table: a red warning triangle on the
   system and a faint red tint + left accent on the row, so a strand / over-range
   leg is obvious at a glance. */
#panel-route .risk { color:var(--err); display:inline-flex; vertical-align:-2px; margin-left:4px; cursor:help; }
#panel-route .risk svg { width:14px; height:14px; }
#panel-route tr.risk-row > td { background:rgba(255,107,107,.09); }
#panel-route tr.risk-row > td:first-child { box-shadow:inset 3px 0 0 var(--err); }
#panel-route tr.risk-row .sys { color:var(--err); font-weight:600; }

/* Departure system shown as row #0 (like spansh): mark it as the origin. */
#panel-route tr.src-row .sys { color:var(--accent); }

/* Per-row "done" progress checkboxes (manual tracking, like spansh). */
#panel-route th.chk-head, #panel-route td.chk { width:26px; text-align:center; padding-left:6px; padding-right:2px; }
#panel-route .done-box { cursor:pointer; accent-color:var(--ok); width:15px; height:15px; vertical-align:middle; margin:0; }
#panel-route tr.done > td:not(.chk) { opacity:.45; }       /* keep the box fully usable */
#panel-route tr.done .sys { text-decoration:line-through; }

/* Native <select> popups render on the OS layer and don't inherit the glass
   panel, so the unselected option showed as near-invisible light text on the
   UA's white. Force a dark background + light text on every panel dropdown. */
#panel-route select { color:var(--text); }
#panel-route select option { background:#0c1218; color:var(--text); }
#panel-route select option:checked { background:#107CB2; color:#fff; }
#panel-route .go-logo { width:16px; height:16px; }
/* Plot button "warming up" state: the logo rotates slowly, stays visible while
   disabled. The mark's blades converge above box centre, so pivot on that hub
   (47% 38%) or it orbits. Counter-clockwise, unhurried. */
#panel-route button#go.warming { opacity:.8; cursor:progress; }
#panel-route button#go.warming .go-logo { animation:gospin 2.6s linear infinite; transform-origin:47% 38%; }
@keyframes gospin { to { transform:rotate(-360deg); } }
/* "New version getting ready" line + bar under the actions while warming up. */
#panel-route .warm-note { margin-top:.6rem; font-size:.8rem; color:var(--muted); }
#panel-route .warm-note[hidden] { display:none; }
#panel-route .warm-note__track { position:relative; height:4px; margin-top:.4rem; border-radius:999px; background:rgba(255,255,255,.1); overflow:hidden; }
#panel-route .warm-note__track span { display:block; height:100%; width:0; border-radius:inherit; background:var(--neutron); transition:width 3s linear; }
#panel-route .warm-note.indeterminate .warm-note__track span { width:30%; transition:none; animation:warmslide 1.6s ease-in-out infinite; }
@keyframes warmslide { from { transform:translateX(-100%); } to { transform:translateX(340%); } }
@media (prefers-reduced-motion: reduce) {
  #panel-route .warm-note__track span { transition:none; }
  #panel-route .warm-note.indeterminate .warm-note__track span { animation:none; width:100%; opacity:.4; }
}
#panel-route .cmp-logo { width:16px; height:16px; border-radius:50%; }
/* Spin the spansh logo while a compare query is in flight, so it is obvious. */
#panel-route #cmpGalaxy.querying .cmp-logo { animation:gospin 0.8s linear infinite; }
/* Blue 60s progress line for the spansh exact (Galaxy) plotter query. */
#panel-route .spansh-bar { height:4px; margin-top:6px; border-radius:3px; background:rgba(18,148,214,0.18); overflow:hidden; }
#panel-route .spansh-bar-fill { height:100%; width:0; border-radius:3px; background:#1294d6; animation:spansh-fill 60s linear forwards; }
@keyframes spansh-fill { from { width:0; } to { width:100%; } }

#panel-route .keyrow { margin-top:12px; font-size:12px; color:var(--muted); }
#panel-route .keyrow summary { cursor:pointer; color:var(--accent); text-transform:uppercase; letter-spacing:.5px; font-size:11px; }

#panel-route .shiprow { margin-top:12px; font-size:12px; color:var(--muted); }
#panel-route .shiprow summary { cursor:pointer; color:var(--accent); text-transform:uppercase; letter-spacing:.5px; font-size:11px; }
#panel-route .shipline { margin:8px 0; display:flex; align-items:center; gap:14px; flex-wrap:wrap; }
#panel-route .cargo-field { font-size:11px; text-transform:uppercase; letter-spacing:.5px; color:var(--muted);
               display:inline-flex; align-items:center; gap:6px; }
#panel-route #shipInfo { font-family:var(--mono); }
/* Ship bay: the active ship's recap (left) and the stored ships (right). */
#panel-route .shipbay { display:grid; grid-template-columns:minmax(0,1.35fr) minmax(0,1fr); gap:16px; align-items:start; }
@media (max-width:560px) { #panel-route .shipbay { grid-template-columns:minmax(0,1fr); } }
#panel-route .ship-card { border:1px solid var(--line); border-radius:10px; padding:12px 14px; background:var(--panel); min-height:100%; }
#panel-route .ship-card__head { padding-bottom:10px; margin-bottom:2px; border-bottom:1px solid var(--line); }
#panel-route .ship-card__name { font-size:18px; font-weight:600; line-height:1.25; color:var(--accent-white); overflow-wrap:anywhere; }
#panel-route .ship-card__type { margin-top:2px; font-size:13px; color:var(--text); }
#panel-route .ship-card__ident { margin-left:6px; padding:0 6px; border:1px solid var(--line); border-radius:4px;
        font-family:var(--mono); font-size:11px; color:var(--muted); }
#panel-route .ship-card p { margin:8px 0 0; }
#panel-route .ship-specs { display:grid; grid-template-columns:auto minmax(0,1fr); gap:6px 14px; margin:12px 0 4px; font-size:13px; }
#panel-route .ship-specs dt { color:var(--muted); font-size:11px; text-transform:uppercase; letter-spacing:.5px; padding-top:2px; }
#panel-route .ship-specs dd { margin:0; color:var(--text); }
#panel-route .ship-specs b { color:var(--accent-white); font-family:var(--mono); }
/* Text-styled buttons (Clear all, Plot without a ship). */
#panel-route button.linkbtn { background:none; padding:0; border-radius:0; color:var(--accent); font-size:12px; }
#panel-route button.linkbtn:hover:not(:disabled) { background:none; color:var(--accent-white); text-decoration:underline; }
#panel-route .ship-card .linkbtn { margin-top:8px; }

#panel-route .ship-fleet__head { display:flex; justify-content:space-between; align-items:baseline; margin-bottom:6px;
        font-size:11px; text-transform:uppercase; letter-spacing:.5px; color:var(--muted); }
/* About five rows tall, then it scrolls: a big fleet doesn't push the options down. */
#panel-route .ship-list { list-style:none; margin:0; padding:0; max-height:15.5rem; overflow-y:auto;
        border:1px solid var(--line); border-radius:10px; }
#panel-route .ship-row { display:flex; align-items:stretch; border-bottom:1px solid var(--line2); }
#panel-route .ship-row:last-child { border-bottom:0; }
#panel-route .ship-row.active { background:rgba(18,148,214,.12); box-shadow:inset 3px 0 0 var(--accent); }
#panel-route .ship-empty { padding:10px 12px; }
#panel-route .ship-list button { border-radius:0; background:transparent; }
#panel-route .ship-list button.ship-pick { flex:1 1 auto; min-width:0; flex-direction:column; align-items:flex-start; gap:1px;
        padding:7px 12px; text-align:left; white-space:normal; }
#panel-route .ship-row__name { color:var(--text); font-size:13px; overflow:hidden; text-overflow:ellipsis; max-width:100%; }
#panel-route .ship-row.active .ship-row__name { color:var(--accent); font-weight:600; }
#panel-route .ship-row__sub { color:var(--muted); font-size:11px; }
#panel-route .ship-list button.ship-ren,
#panel-route .ship-list button.ship-del { flex:none; padding:0 9px; color:var(--muted); font-size:13px; }
#panel-route .ship-list button.ship-pick:hover:not(:disabled) { background:rgba(255,255,255,.06); color:inherit; }
#panel-route .ship-list button.ship-ren:hover:not(:disabled) { background:rgba(255,255,255,.06); color:var(--text); }
#panel-route .ship-list button.ship-del:hover:not(:disabled) { background:rgba(255,255,255,.06); color:var(--err); }
#panel-route .ship-name-input { flex:1 1 auto; min-width:0; background:rgba(255,255,255,0.06); border:0; color:var(--text);
        padding:9px 12px; font-size:13px; outline:none; }
#panel-route .ship-add { display:flex; flex-wrap:wrap; gap:8px; margin-top:10px; }
#panel-route .ship-add button { flex:1 1 auto; }
#panel-route .paste-panel { margin-top:12px; }
#panel-route .ship-msg:empty { display:none; }
#panel-route .ship-msg { margin-top:8px; }
#panel-route .fuelbar { margin:12px 0 2px; font-size:13px; }

#panel-route .summary { display:flex; gap:24px; flex-wrap:wrap; margin:20px 0 8px; align-items:flex-end; }
#panel-route .stat { display:flex; flex-direction:column; }
#panel-route .stat b { font-size:20px; font-family:var(--mono); color:var(--accent-white,#f8f8ff); }
#panel-route .stat span { color:var(--muted); font-size:11px; text-transform:uppercase; letter-spacing:.5px; }
#panel-route .meta { color:var(--muted); font-size:12px; font-family:var(--mono); }
#panel-route #cmpOut { margin:12px 0 2px; font-size:13px; }
#panel-route .good { color:var(--ok); } #panel-route .bad { color:var(--err); }
#panel-route .legend { color:var(--muted); font-size:12px; margin:8px 0 2px; }
#panel-route .legend b { color:var(--neutron); }

/* Flat results table matching the index/neighbors tool results: no outer box,
   a translucent header (--head) with accent-blue text, bottom borders only.
   The table itself inherits milkyway's .result-table rules. */
#panel-route .tablewrap { overflow-x:auto; margin-top:8px; }
/* Full-width table (the own `table{width:100%}` rule is dropped in favour of
   milkyway's .result-table, which doesn't set width). */
#panel-route .tablewrap table { width:100%; font-size:12px; }
/* milkyway's .result-table gives borders + horizontal padding but not these:
   left-aligned headers (numeric + actions stay right), no-wrap cells (so the
   star icon + spectral letter sit on one line), vertical padding, row rules. */
#panel-route .tablewrap th { text-align:left; padding-top:4px; padding-bottom:4px; }
#panel-route .tablewrap th.num, #panel-route .tablewrap th.acts-head { text-align:right; }
#panel-route .tablewrap td { white-space:nowrap; padding-top:4px; padding-bottom:4px;
                             border-bottom:1px solid var(--line2); }
#panel-route .num { text-align:right; font-family:var(--mono); font-variant-numeric:tabular-nums; }
#panel-route .sys { font-family:var(--mono); }
#panel-route .boost { color:var(--neutron); }
#panel-route .spec { color:var(--muted); font-family:var(--mono); }
/* Neutron class letter in neutron-blue (neutron steps are blue by convention,
   matching the button-icon blue). */
#panel-route .spec.neutron { color:var(--neutron); }
/* Spectral letter + fuel icon on one baseline-centred line (icon to the right). */
#panel-route .starcell { display:inline-flex; align-items:center; gap:5px; }
#panel-route .fuel { color:var(--ok); flex:none; }
/* In-system scoop (neutron with a scoopable companion): green fuel-pump (the
   scooping colour), help cursor shows the companion distance tooltip. */
#panel-route .inflight-scoop { display:inline-flex; cursor:help; }
/* Companion-neutron arrival distance ("@120 Ls"): muted neutron-blue, help cursor. */
#panel-route .arrls { color:var(--neutron); opacity:.8; font-size:11px; cursor:help; white-space:nowrap; }
/* In-system scoop distance reuses .arrls but in the fuel (green) colour. */
#panel-route .arrls.scoop-ls { color:var(--ok); }
/* FSD synthesis injection: violet delta icon (distinct from neutron-amber and
   fuel-green) on a jump that needs it, and
   the summary bar listing how many of each grade the route requires. */
#panel-route .inject-badge { display:inline-flex; vertical-align:-2px; margin-left:4px; cursor:help; color:#c495f6; }
#panel-route svg.inject { display:inline-block; }
#panel-route .injectbar { margin:8px 0 2px; font-size:13px; color:var(--text); display:flex; flex-direction:column; gap:4px; align-items:flex-start; }
#panel-route .injectbar svg.inject { color:#c495f6; vertical-align:-2px; margin-right:2px; }
#panel-route .injectbar .injectmats { color:var(--muted); font-size:12px; }
/* FSD-injection grade picker: a radio group so each in-game synthesis icon
   (1/2/3 bars, button-icon blue) sits inline with its label instead of looking
   bolted onto a native <select> (which can't show icons). */
#panel-route .inject-radios { display:flex; flex-direction:column; gap:4px; }
#panel-route .inj-opt { display:flex; align-items:center; gap:7px; cursor:pointer;
  padding:5px 9px; border:1px solid rgba(255,255,255,.1); border-radius:8px;
  font-size:13px; color:var(--text); }
#panel-route .inj-opt:hover { background:rgba(255,255,255,.04); }
#panel-route .inj-opt input { accent-color:#1294d6; margin:0; width:14px; height:14px; flex:none; }
#panel-route .inj-opt img { height:15px; width:auto; }
#panel-route .inj-opt .inj-txt { white-space:nowrap; }
#panel-route .inj-opt .inj-txt small { color:var(--muted); font-size:11px; }
#panel-route .inj-opt:has(input:checked) { border-color:#1294d6; background:rgba(18,148,214,.12); }
/* Options layout: the three short controls stack in one column, the taller FSD
   radio group sits beside them, so the row stays balanced and wraps on narrow. */
#panel-route .route-opts { display:flex; flex-wrap:wrap; gap:16px 24px; align-items:flex-start; }
#panel-route .opts-short { display:flex; flex-direction:column; gap:12px; flex:1 1 220px; min-width:200px; }
#panel-route .opt-field { display:flex; flex-direction:column; gap:6px; }
#panel-route .opts-inject { display:flex; flex-direction:column; gap:12px; flex:1 1 220px; min-width:200px; }
#panel-route .opt-label { display:inline-flex; align-items:center; gap:6px; }
#panel-route .fuelsafe-switch { align-self:flex-start; padding:4px 0; }
/* Fuel-safe toggle + an (i) info bubble; the long explainer lives in its hover/
   focus tooltip instead of a wall of text under the row. */
#panel-route .opt-field[hidden] { display:none; }
#panel-route .help-tip { position:relative; display:inline-flex; align-items:center; justify-content:center;
  width:16px; height:16px; border-radius:50%; border:1px solid var(--accent); color:var(--accent);
  font:italic 700 11px/1 Georgia, serif; cursor:help; user-select:none; }
#panel-route .help-tip .tip { position:absolute; top:calc(100% + 8px); left:0; z-index:30; width:340px; max-width:72vw;
  padding:10px 12px; border-radius:8px; background:#0c1218; border:1px solid rgba(255,255,255,.12);
  color:var(--muted); font-style:normal; font-weight:400; font-size:12px; line-height:1.5;
  font-family:ui-sans-serif,system-ui,-apple-system,"Segoe UI",Roboto,Arial,sans-serif;
  box-shadow:0 8px 24px rgba(0,0,0,.5);
  opacity:0; visibility:hidden; transition:opacity .12s; pointer-events:none; }
#panel-route .help-tip:hover .tip, #panel-route .help-tip:focus .tip, #panel-route .help-tip:focus-within .tip {
  opacity:1; visibility:visible; }
#panel-route .help-tip .tip b { color:var(--text); font-weight:600; }

/* Icons inherit gray-100 (#f3f4f6); .55 at rest, full on row/icon hover. */
#panel-route .copy-btn { all:unset; cursor:pointer; color:#f3f4f6; opacity:.55; margin-left:8px;
            vertical-align:-2px; transition:opacity .15s; }
#panel-route tr:hover .copy-btn, #panel-route .copy-btn:hover, #panel-route .copy-btn:focus { opacity:1; }

/* Trailing per-row actions, same set as the neighbors search results.
   Full brightness (no dimming) -- the icons read too faint otherwise. */
#panel-route td.acts { white-space:nowrap; text-align:right; }
#panel-route .act-btn { all:unset; cursor:pointer; color:var(--row-act-ink,#f3f4f6); padding:2px 4px; vertical-align:-2px; }
/* Hover: tint the icon (currentColor) blue, no background change. */
#panel-route .act-btn:hover, #panel-route .act-btn:focus-visible { color:var(--row-act-hover,#1294d6); background:transparent; }

/* Small toggle switch (compact <-> all jumps). */
#panel-route .switch { display:inline-flex; align-items:center; gap:7px; cursor:pointer; color:var(--muted);
          font-size:11px; text-transform:uppercase; letter-spacing:.5px; user-select:none; }
#panel-route .switch input { position:absolute; opacity:0; pointer-events:none; }
#panel-route .switch .track { width:30px; height:16px; border-radius:999px; background:rgba(255,255,255,.08);
                 border:1px solid var(--dim); position:relative; transition:all .15s; }
#panel-route .switch .track::after { content:""; position:absolute; top:1px; left:1px; width:12px; height:12px;
                        border-radius:50%; background:var(--muted); transition:all .15s; }
#panel-route .switch input:checked + .track { background:rgba(18,148,214,.3); border-color:var(--accent); }
#panel-route .switch input:checked + .track::after { left:15px; background:var(--accent); }

#panel-route .msg { margin-top:16px; padding:12px 14px; border-radius:10px; border:1px solid var(--line); background:var(--panel); }
#panel-route .msg.err { border-color:#7a2f33; } #panel-route .msg.warn { border-color:#7a5f27; }
#panel-route .tiny { color:var(--muted); font-size:12px; }

/* From/To resolution: a badge inside the field (estimated / coordinates) and the
   position on the line below, so the CMDR can check an EDTS guess before plotting. */
#panel-route .sys-field { position:relative; }
#panel-route .sys-field input.sys-estimated { border-color:rgba(248,248,255,.55); }
#panel-route .sys-field input.has-badge { padding-right:7.5rem; }
#panel-route .sys-badge { position:absolute; right:8px; top:50%; transform:translateY(-50%); pointer-events:none;
        padding:1px 8px; border-radius:999px; font-size:10px; line-height:1.4; text-transform:uppercase;
        letter-spacing:.5px; border:1px solid var(--dim); color:var(--muted); background:rgba(0,0,0,.35); }
#panel-route .sys-badge.estimated,
#panel-route .sys-badge.coords { color:var(--accent-white); border-color:rgba(248,248,255,.55); }
#panel-route .sys-badge.unknown { color:var(--err); border-color:#7a2f33; }
#panel-route .sys-hint { margin:2px 2px 0; }
#panel-route .sys-hint .xyz { font-family:var(--mono); color:var(--text); }

/* Route stats + spansh comparison rows share one grid so their columns line
   up; spansh rows are the same cells, smaller. The best value per column is blue. */
#panel-route .statgrid { display:grid; grid-template-columns:repeat(6, auto); justify-content:space-between;
        column-gap:24px; row-gap:4px; margin:20px 0 8px; align-items:end; }
#panel-route .statgrid #cmpOut, #panel-route .statgrid .statrow { display:contents; }
#panel-route .cmp-head { grid-column:1 / -1; font-size:13px; margin-top:10px; }
#panel-route .statrow.small .stat b { font-size:14px; }
#panel-route .statrow.small .stat span { font-size:10px; }
#panel-route .stat.best b { color:var(--neutron); }
#panel-route .stat b .unit { font-size:.6em; font-weight:400; color:var(--muted); }
@media (max-width:560px) { #panel-route .statgrid { grid-template-columns:repeat(3, auto); } }

/* Jump range set by the selected ship: read-only, readable, marked as derived. */
#panel-route .range-note { margin-left:6px; font-size:11px; font-weight:400; color:var(--muted); text-transform:none; }
#panel-route input#range:read-only { border-style:dashed; color:var(--accent-white); cursor:default; }
