:root {
  --void: #070b16;
  --deep: #0d1426;
  --panel: #111a30;
  --line: #1f2c4a;
  --ink: #e8edf9;
  --dim: #8797b8;
  --hot: #ffb03a;      /* burn / prograde */
  --cold: #4fd1ff;     /* orbit / retrograde */
  --good: #5be3a7;
  --bad: #ff6b6b;
  --shadow: 0 10px 40px rgba(0, 0, 0, .5);
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background:
    radial-gradient(1200px 700px at 78% -10%, #16224a 0%, transparent 60%),
    radial-gradient(900px 500px at 5% 110%, #17143a 0%, transparent 55%),
    var(--void);
  color: var(--ink);
  font: 15px/1.55 ui-sans-serif, -apple-system, "Segoe UI", Inter, system-ui, sans-serif;
  min-height: 100vh;
  letter-spacing: .01em;
}

.wrap { max-width: 1120px; margin: 0 auto; padding: 40px 24px 96px; }

header.top { margin-bottom: 28px; }
header.top h1 {
  margin: 0;
  font-size: 30px;
  font-weight: 620;
  letter-spacing: -.02em;
}
header.top p { margin: 6px 0 0; color: var(--dim); max-width: 62ch; }

.tabs { display: flex; flex-wrap: wrap; gap: 6px; margin: 26px 0 20px; }
.tab {
  background: transparent; color: var(--dim);
  border: 1px solid var(--line); border-radius: 999px;
  padding: 7px 15px; font-size: 13.5px; cursor: pointer;
  transition: color .18s, border-color .18s, background .18s, transform .18s;
}
.tab:hover { color: var(--ink); border-color: #33456f; transform: translateY(-1px); }
.tab.on { background: var(--cold); border-color: var(--cold); color: #04121c; font-weight: 600; }
.tab .count { opacity: .6; margin-left: 6px; font-variant-numeric: tabular-nums; }

.panel {
  background: linear-gradient(180deg, var(--panel), var(--deep));
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 22px;
  box-shadow: var(--shadow);
  animation: rise .35s cubic-bezier(.2, .8, .3, 1);
}
@keyframes rise { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }

h2 { margin: 0 0 4px; font-size: 18px; font-weight: 600; letter-spacing: -.01em; }
.hint { color: var(--dim); font-size: 13.5px; margin: 0 0 18px; }

form.grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 14px; }
label { display: block; font-size: 12px; text-transform: uppercase; letter-spacing: .07em; color: var(--dim); margin-bottom: 5px; }
input, select, textarea {
  width: 100%; background: #0a1122; color: var(--ink);
  border: 1px solid var(--line); border-radius: 9px; padding: 9px 11px;
  font: inherit; font-size: 14px; transition: border-color .16s, box-shadow .16s;
}
input:focus, select:focus, textarea:focus {
  outline: none; border-color: var(--cold); box-shadow: 0 0 0 3px rgba(79, 209, 255, .15);
}

.actions { display: flex; gap: 10px; align-items: center; margin-top: 18px; flex-wrap: wrap; }
button.primary {
  background: var(--cold); color: #04121c; border: 0; border-radius: 9px;
  padding: 10px 18px; font: inherit; font-weight: 600; cursor: pointer;
  transition: filter .16s, transform .16s;
}
button.primary:hover { filter: brightness(1.1); transform: translateY(-1px); }
button.primary:disabled { opacity: .5; cursor: default; transform: none; }
button.ghost {
  background: transparent; color: var(--dim); border: 1px solid var(--line);
  border-radius: 9px; padding: 9px 15px; font: inherit; cursor: pointer;
  transition: color .16s, border-color .16s;
}
button.ghost:hover { color: var(--ink); border-color: #33456f; }
button.warm { background: var(--hot); color: #201200; border: 0; border-radius: 9px; padding: 10px 18px; font: inherit; font-weight: 600; cursor: pointer; }
button.warm:hover { filter: brightness(1.08); }
button.link { background: none; border: 0; color: var(--dim); cursor: pointer; font: inherit; font-size: 13px; padding: 4px 6px; }
button.link:hover { color: var(--cold); }
button.link.danger:hover { color: var(--bad); }

table { width: 100%; border-collapse: collapse; margin-top: 22px; font-size: 13.5px; }
th {
  text-align: left; color: var(--dim); font-weight: 500; font-size: 11.5px;
  text-transform: uppercase; letter-spacing: .07em;
  padding: 8px 10px; border-bottom: 1px solid var(--line); white-space: nowrap;
}
td { padding: 9px 10px; border-bottom: 1px solid rgba(31, 44, 74, .5); font-variant-numeric: tabular-nums; }
tbody tr { transition: background .15s; }
tbody tr:hover { background: rgba(79, 209, 255, .05); }
td.id { color: var(--dim); font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 12px; }
.scroll { overflow-x: auto; }

.empty { text-align: center; color: var(--dim); padding: 44px 20px; }
.empty .mark { font-size: 30px; opacity: .5; display: block; margin-bottom: 10px; }

.note { border-radius: 10px; padding: 11px 14px; font-size: 13.5px; margin-top: 16px; animation: rise .25s ease; }
.note.ok { background: rgba(91, 227, 167, .1); border: 1px solid rgba(91, 227, 167, .35); color: var(--good); }
.note.err { background: rgba(255, 107, 107, .1); border: 1px solid rgba(255, 107, 107, .35); color: var(--bad); }

.loading { color: var(--dim); padding: 40px; text-align: center; }
.loading::after { content: ''; display: inline-block; width: 7px; height: 7px; margin-left: 8px; border-radius: 50%; background: var(--cold); animation: pulse 1s infinite; }
@keyframes pulse { 0%, 100% { opacity: .25; } 50% { opacity: 1; } }

.mapwrap { margin-top: 26px; }
.mapwrap h3 { font-size: 13px; text-transform: uppercase; letter-spacing: .08em; color: var(--dim); font-weight: 500; margin: 0 0 8px; }
svg.map { width: 100%; height: 300px; background: #060a14; border: 1px solid var(--line); border-radius: 12px; display: block; }

/* ---- screen switch ---- */
.screens { display: flex; gap: 8px; margin: 22px 0 20px; }
.screenbtn {
  background: transparent; border: 1px solid var(--line); color: var(--dim);
  padding: 9px 20px; border-radius: 10px; font: inherit; font-size: 14px; cursor: pointer;
  transition: color .18s, border-color .18s, background .18s;
}
.screenbtn:hover { color: var(--ink); border-color: #33456f; }
.screenbtn.on { background: rgba(79, 209, 255, .12); border-color: var(--cold); color: var(--ink); font-weight: 600; }

/* ---- burn planner ---- */
.plannerhead { display: flex; justify-content: space-between; align-items: flex-start; gap: 20px; }
.plannergrid { display: grid; grid-template-columns: minmax(0, 1.45fr) minmax(290px, 1fr); gap: 22px; margin-top: 12px; }
@media (max-width: 900px) { .plannergrid { grid-template-columns: 1fr; } }

svg.orbitview {
  width: 100%; height: 460px; display: block; cursor: crosshair;
  background: radial-gradient(circle at 50% 50%, #0a1020 0%, #060a14 70%);
  border: 1px solid var(--line); border-radius: 14px;
}

.panelside { display: flex; flex-direction: column; gap: 16px; min-width: 0; }

.readouts { display: flex; flex-direction: column; gap: 1px; background: var(--line); border: 1px solid var(--line); border-radius: 12px; overflow: hidden; }
.readout { display: grid; grid-template-columns: 1fr auto; align-items: baseline; gap: 6px 10px; padding: 11px 14px; background: #0c1426; }
.readout .rl { font-size: 11.5px; text-transform: uppercase; letter-spacing: .06em; color: var(--dim); grid-column: 1; }
.readout .rv { font-size: 16px; font-variant-numeric: tabular-nums; font-weight: 600; grid-column: 1; }
.readout .rd { grid-column: 2; grid-row: 1 / span 2; font-size: 12px; align-self: center; padding: 3px 9px; border-radius: 999px; }
.readout .rd.up { color: #c69bff; background: rgba(198, 155, 255, .14); }
.readout .rd.down { color: var(--good); background: rgba(91, 227, 167, .12); }
.readout .rd.flat { color: var(--dim); background: rgba(135, 151, 184, .1); }
.readout.apo .rv { color: #c69bff; }
.readout.peri .rv { color: var(--good); }

.burnbox { border: 1px solid var(--line); border-radius: 12px; padding: 16px; background: #0c1426; }
.dirpick { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-bottom: 16px; }
.dirbtn {
  background: transparent; border: 1px solid var(--line); border-radius: 10px;
  padding: 10px 8px; color: var(--dim); font: inherit; font-size: 13.5px; font-weight: 600;
  cursor: pointer; display: flex; flex-direction: column; gap: 3px; transition: all .18s;
}
.dirbtn small { font-weight: 400; font-size: 11px; opacity: .85; }
.dirbtn:hover { color: var(--ink); border-color: #33456f; }
.dirbtn.on.pro { border-color: var(--hot); color: var(--hot); background: rgba(255, 176, 58, .1); }
.dirbtn.on.ret { border-color: var(--cold); color: var(--cold); background: rgba(79, 209, 255, .1); }

.burnbox label { margin-top: 12px; }
input[type=range] { -webkit-appearance: none; appearance: none; height: 4px; padding: 0; background: var(--line); border: 0; border-radius: 3px; }
input[type=range]::-webkit-slider-thumb { -webkit-appearance: none; width: 16px; height: 16px; border-radius: 50%; background: var(--cold); cursor: grab; border: 2px solid #0c1426; }
input[type=range]::-moz-range-thumb { width: 16px; height: 16px; border-radius: 50%; background: var(--cold); cursor: grab; border: 2px solid #0c1426; }

.wherenote { color: var(--dim); font-size: 12.5px; margin: 8px 0 4px; min-height: 2.6em; }
button.wide { width: 100%; margin-top: 12px; padding: 12px; }

/* ---- transfer helper + before/after ---- */
.boxhead { font-size: 13px; text-transform: uppercase; letter-spacing: .07em; color: var(--dim); font-weight: 600; margin: 0 0 6px; }
.hint.small { font-size: 12.5px; margin-bottom: 12px; }
.targets { display: flex; flex-direction: column; gap: 7px; }
.target {
  display: flex; justify-content: space-between; align-items: center; gap: 10px;
  background: transparent; border: 1px solid var(--line); border-radius: 9px;
  padding: 10px 13px; color: var(--ink); font: inherit; font-size: 13.5px;
  cursor: pointer; text-align: left; transition: border-color .16s, background .16s, transform .16s;
}
.target:hover:not(:disabled) { border-color: var(--cold); background: rgba(79, 209, 255, .07); transform: translateX(2px); }
.target:disabled { opacity: .4; cursor: default; }
.target .tname { font-weight: 600; }
.target .tdv { color: var(--hot); font-size: 12.5px; font-variant-numeric: tabular-nums; }

.compare { border: 1px solid var(--line); border-radius: 12px; overflow: hidden; }
.chead, .crow { display: grid; grid-template-columns: 1fr auto auto; gap: 14px; padding: 9px 14px; align-items: baseline; }
.chead { background: #0a1122; color: var(--dim); font-size: 11px; text-transform: uppercase; letter-spacing: .06em; }
.chead span:first-child { grid-column: 2; }
.crow { border-top: 1px solid rgba(31, 44, 74, .6); font-size: 13.5px; font-variant-numeric: tabular-nums; }
.crow .clab { color: var(--dim); font-size: 12px; }
.crow span:nth-child(2) { color: var(--dim); }
.crow .moved { color: var(--hot); font-weight: 600; }

/* ---- system map screen ---- */
.mapgrid { display: grid; grid-template-columns: minmax(0, 1.5fr) minmax(280px, 1fr); gap: 22px; }
svg.systemscene {
  width: 100%; height: 520px; display: block;
  background: radial-gradient(circle at 50% 50%, #0a1020 0%, #05080f 72%);
  border: 1px solid var(--line); border-radius: 14px;
}
.planetnode text { pointer-events: none; }
.factlist { display: flex; flex-direction: column; gap: 9px; font-size: 13.5px; }
.factlist > div { display: flex; justify-content: space-between; gap: 12px; align-items: baseline; }
.factlist span { color: var(--dim); font-size: 12px; }
.factlist b { font-weight: 600; text-align: right; }
.ghost.wide { width: 100%; margin-top: 6px; }

.statebar {
  display: flex; flex-wrap: wrap; gap: 8px 22px; align-items: baseline;
  border: 1px solid var(--line); border-radius: 12px; padding: 13px 16px;
  margin-bottom: 4px; font-size: 13px; color: var(--dim); background: #0c1426;
}
.statebar b { color: var(--ink); font-size: 15px; font-variant-numeric: tabular-nums; margin-right: 4px; }
.statebar .saved { margin-left: auto; color: var(--good); }

/* ---- phones ---- */
@media (max-width: 860px) {
  .wrap { padding: 24px 16px 80px; }
  header.top h1 { font-size: 24px; }
  .mapgrid, .plannergrid { grid-template-columns: 1fr; }
  svg.systemscene { height: 380px; }
  svg.orbitview { height: 340px; }
  .screens { position: sticky; top: 0; z-index: 5; padding: 10px 0; margin: 14px 0 16px;
    background: linear-gradient(180deg, var(--void) 70%, transparent); }
  .screenbtn { flex: 1; padding: 12px 8px; min-height: 46px; font-size: 13.5px; }
  .panel { padding: 16px; border-radius: 14px; }
  form.grid { grid-template-columns: 1fr; }
  .statebar .saved { margin-left: 0; width: 100%; }
  /* the record tables scroll inside their own box, never the page */
  .scroll { -webkit-overflow-scrolling: touch; }
  table { min-width: 560px; }
  .tab, button.primary, button.ghost, button.warm, .dirbtn, .target { min-height: 44px; }
  .tab { padding: 11px 15px; }
  button.link { min-height: 44px; padding: 10px 8px; }
  /* the slider's track stays thin, but the thing you drag is finger-sized
     and the whole control is 44px tall to grab at */
  input[type=range] { height: 44px; background: transparent; }
  input[type=range]::-webkit-slider-runnable-track { height: 5px; background: var(--line); border-radius: 3px; }
  input[type=range]::-moz-range-track { height: 5px; background: var(--line); border-radius: 3px; }
  input[type=range]::-webkit-slider-thumb { width: 26px; height: 26px; margin-top: -10px; }
  input[type=range]::-moz-range-thumb { width: 26px; height: 26px; }
  .chead, .crow { grid-template-columns: 1fr auto auto; gap: 8px; font-size: 12.5px; }
}
html, body { max-width: 100%; overflow-x: hidden; }

/* the picture stays put while the controls beside it scroll */
@media (min-width: 861px) {
  svg.orbitview, svg.systemscene { position: sticky; top: 20px; }
  .plannergrid, .mapgrid { align-items: start; }
}

/* ---- who you are ---- */
.whoami {
  display: flex; flex-wrap: wrap; align-items: center; gap: 10px 16px;
  border: 1px solid var(--line); border-radius: 12px; padding: 12px 16px;
  background: #0c1426; font-size: 13.5px; color: var(--dim); margin-top: 18px;
}
.whoami.out { border-color: rgba(255, 176, 58, .3); background: rgba(255, 176, 58, .05); }
.whoami b { color: var(--ink); }
.waysin { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; margin-left: auto; }
.waysin form { display: flex; gap: 8px; }
.waysin input { width: 210px; min-height: 40px; }
.gbtn {
  display: inline-flex; align-items: center; min-height: 40px; padding: 0 16px;
  background: #fff; color: #1a1a1a; border-radius: 9px; text-decoration: none;
  font-weight: 600; font-size: 13.5px; transition: filter .16s;
}
.gbtn:hover { filter: brightness(.94); }
.sentnote { color: var(--good); }
@media (max-width: 860px) {
  .waysin { margin-left: 0; width: 100%; }
  .waysin form, .waysin input { width: 100%; }
  .gbtn { width: 100%; justify-content: center; min-height: 46px; }
}
