:root {
  --bg: #080c12;
  --bg-soft: #0b1118;
  --panel: #0f1720;
  --panel-2: #131e29;
  --line: #223142;
  --line-soft: #1a2735;
  --text: #dbe6f2;
  --muted: #8fa3b8;
  --dim: #667a8f;
  --accent: #ff9d2e;
  --accent-soft: #5c3a12;
  --ok: #5ee08a;
  --warn: #f2c14e;
  --danger: #ff6b6b;
  --link: #7fc7ff;
  --radius: 10px;
  --mono: "SFMono-Regular", "Cascadia Mono", "Consolas", "Liberation Mono", monospace;
  --page-pad: clamp(1rem, 2vw, 3rem);
  --text-xs: 0.72rem;
  --text-sm: 0.82rem;
  --text-base: 0.95rem;
  --text-lg: 1.08rem;
  --measure: 88ch;
}

* { box-sizing: border-box; }

html, body { margin: 0; padding: 0; }

body {
  background:
    radial-gradient(1100px 500px at 15% -10%, rgba(255, 157, 46, 0.08), transparent 60%),
    radial-gradient(900px 500px at 100% 0%, rgba(127, 199, 255, 0.06), transparent 55%),
    var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  font-size: 15px;
  line-height: 1.55;
  min-height: 100vh;
}

a { color: var(--link); text-decoration: none; }
a:hover { text-decoration: underline; }

h1, h2, h3, h4 { margin: 0 0 0.5rem; line-height: 1.25; font-weight: 650; }
h1 { font-size: 1.9rem; letter-spacing: -0.025em; }
h2 { font-size: 1.15rem; letter-spacing: -0.012em; }
h3 { font-size: 1rem; }
h4 { font-size: 0.78rem; letter-spacing: 0.065em; text-transform: uppercase; color: var(--muted); }
p { margin: 0.4rem 0 0.85rem; max-width: var(--measure); }
p.lead, .lead { color: var(--muted); font-size: var(--text-base); line-height: 1.55; max-width: 78ch; }

.mono, code, .num { font-family: var(--mono); font-variant-numeric: tabular-nums; }
.mt-sm { margin-top: 0.5rem; }
.muted { color: var(--muted); }
.dim { color: var(--dim); }
.small { font-size: var(--text-sm); }
.nowrap { white-space: nowrap; }
.center { text-align: center; }
.right { text-align: right; }

.topbar {
  display: flex;
  align-items: center;
  gap: 1.25rem;
  padding: 0.7rem 1.5rem;
  border-bottom: 1px solid var(--line);
  background: rgba(8, 12, 18, 0.88);
  backdrop-filter: blur(8px);
  position: sticky;
  top: 0;
  z-index: 20;
}

.brand {
  color: var(--text);
  font-weight: 800;
  letter-spacing: 0.12em;
  font-size: 0.95rem;
  white-space: nowrap;
}
.brand span { color: var(--accent); }
.brand:hover { text-decoration: none; }

.nav { display: flex; align-items: center; gap: 0.25rem; flex-wrap: wrap; }
.nav a {
  color: var(--muted);
  padding: 0.35rem 0.65rem;
  border-radius: 7px;
  font-size: 0.92rem;
}
.nav a:hover { color: var(--text); background: var(--panel-2); text-decoration: none; }
.nav a.active { color: var(--text); background: var(--panel-2); box-shadow: inset 0 -2px 0 var(--accent); }

.userbox { margin-left: auto; display: flex; align-items: center; gap: 0.6rem; font-size: 0.9rem; }
.userbox a { color: var(--text); }

.page { width: 100%; max-width: none; margin: 0; padding: 1.5rem var(--page-pad); }

.footer {
  width: 100%;
  max-width: none;
  margin: 0;
  padding: 1.5rem var(--page-pad);
  color: var(--dim);
  font-size: 0.82rem;
  border-top: 1px solid var(--line-soft);
}

.page-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
  margin-bottom: 1.25rem;
}
.page-head .lead { margin: 0.25rem 0 0; }

.grid-stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 0.75rem;
  margin-bottom: 1.1rem;
}

.stat {
  border: 1px solid var(--line);
  background: linear-gradient(180deg, var(--panel-2), var(--panel));
  border-radius: var(--radius);
  padding: 0.8rem 0.9rem;
}
.stat .value { font-size: 1.6rem; font-weight: 750; font-family: var(--mono); line-height: 1.15; }
.stat .label { color: var(--muted); font-size: var(--text-xs); text-transform: uppercase; letter-spacing: 0.07em; line-height: 1.35; }

.panel {
  border: 1px solid var(--line);
  background: var(--panel);
  border-radius: var(--radius);
  padding: 1.05rem 1.1rem;
  margin-bottom: 1rem;
}
.panel.tight { padding: 0.7rem 0.8rem; }
.panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  flex-wrap: wrap;
  margin-bottom: 0.85rem;
  padding-bottom: 0.55rem;
  border-bottom: 1px solid var(--line-soft);
}
.panel-head h2, .panel-head h3 { margin: 0; }
.panel-head h2 { font-size: var(--text-lg); }
.panel-head h3 { font-size: 1rem; }

.split { display: grid; grid-template-columns: minmax(0, 1.35fr) minmax(0, 1fr); gap: 1rem; }
@media (max-width: 980px) { .split { grid-template-columns: 1fr; } }

.table-wrap { overflow-x: auto; border-radius: 8px; }
table { width: 100%; border-collapse: collapse; font-size: 0.88rem; line-height: 1.45; }
th {
  text-align: left;
  color: var(--muted);
  font-size: var(--text-xs);
  text-transform: uppercase;
  letter-spacing: 0.07em;
  font-weight: 650;
  padding: 0.5rem 0.55rem;
  border-bottom: 1px solid var(--line);
  white-space: nowrap;
}
td { padding: 0.55rem; border-bottom: 1px solid var(--line-soft); vertical-align: top; }
tbody tr:hover { background: rgba(127, 199, 255, 0.035); }
table.compact { font-size: 0.88rem; }
table.compact td, table.compact th { padding: 0.4rem 0.5rem; }
td.name { font-weight: 600; }
td .sub { display: block; color: var(--muted); font-size: var(--text-sm); font-weight: 400; line-height: 1.35; }

.badge {
  display: inline-block;
  padding: 0.12rem 0.45rem;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: var(--panel-2);
  color: var(--muted);
  font-size: var(--text-xs);
  line-height: 1.45;
  white-space: nowrap;
}
.badge.role-admin { color: var(--accent); border-color: var(--accent-soft); }
.badge.role-officer { color: var(--link); border-color: #24465f; }
.badge.role-member { color: var(--ok); border-color: #24533a; }
.badge.role-guest { color: var(--muted); }
.badge.port-large_orbital { color: var(--accent); border-color: var(--accent-soft); }
.badge.port-planetary_port { color: var(--warn); border-color: #5c4a1c; }
.badge.port-planetary_outpost { color: #e0b85a; border-color: #5c4a1c; }
.badge.port-settlement { color: #c9a7ff; border-color: #3e2f5c; }
.badge.port-planetary, .badge.port-outpost,
.badge.port-orbital_outpost, .badge.port-megaship { color: var(--link); border-color: #24465f; }
.badge.port-construction, .badge.port-construction_orbital,
.badge.port-construction_planetary, .badge.port-construction_unknown { color: var(--muted); }
.badge.port-carrier { color: #c9a7ff; border-color: #3e2f5c; }
.badge.port-unknown { color: var(--danger); border-color: #5c2626; }
.badge.state-conflict { color: var(--danger); border-color: #5c2626; }
.badge.state-bad { color: var(--warn); border-color: #5c4a1c; }
.badge.state-good { color: var(--ok); border-color: #24533a; }
.badge.state-neutral { color: var(--muted); }
.badge.ok { color: var(--ok); border-color: #24533a; }
.badge.warn { color: var(--warn); border-color: #5c4a1c; }
.badge.danger { color: var(--danger); border-color: #5c2626; }

.chips { display: flex; flex-wrap: wrap; gap: 0.3rem; }
.chip {
  display: inline-block;
  padding: 0.08rem 0.4rem;
  border-radius: 5px;
  background: var(--panel-2);
  border: 1px solid var(--line-soft);
  color: var(--muted);
  font-size: var(--text-xs);
  white-space: nowrap;
}
.chip strong { color: var(--text); font-weight: 600; }

.btn, button {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  border: 1px solid var(--line);
  background: var(--panel-2);
  color: var(--text);
  border-radius: 7px;
  padding: 0.42rem 0.7rem;
  font: inherit;
  font-size: var(--text-sm);
  line-height: 1.3;
  cursor: pointer;
  text-decoration: none;
}
.btn:hover, button:hover { border-color: var(--accent-soft); text-decoration: none; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: #1a1205; font-weight: 700; }
.btn.primary:hover { filter: brightness(1.08); }
.btn.danger { color: var(--danger); border-color: #5c2626; }
.btn.small, button.small { padding: 0.25rem 0.5rem; font-size: var(--text-xs); }
.btn.ghost { background: transparent; }

.link-button {
  background: none;
  border: 0;
  padding: 0;
  color: var(--muted);
  font-size: var(--text-sm);
  cursor: pointer;
}
.link-button:hover { color: var(--text); text-decoration: underline; }

.inline { display: inline-flex; align-items: center; gap: 0.35rem; }
.actions { display: flex; flex-wrap: wrap; gap: 0.4rem; align-items: center; }

form.stack { display: grid; gap: 0.7rem; max-width: 820px; }
form.stack.wide { max-width: 1100px; }
form.grid-form { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0.8rem; }
form.grid-form .full { grid-column: 1 / -1; }
@media (max-width: 700px) { form.grid-form { grid-template-columns: 1fr; } }

label { display: block; color: var(--muted); font-size: var(--text-sm); margin-bottom: 0.25rem; }
input[type="text"], input[type="password"], input[type="search"], input[type="number"], select, textarea {
  width: 100%;
  background: var(--bg-soft);
  border: 1px solid var(--line);
  color: var(--text);
  border-radius: 7px;
  padding: 0.45rem 0.6rem;
  font: inherit;
  font-size: var(--text-base);
  line-height: 1.35;
}
input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 2px rgba(255, 157, 46, 0.14);
}
select { appearance: auto; }
.help { color: var(--dim); font-size: var(--text-xs); margin-top: 0.25rem; line-height: 1.4; }

.flash-wrap { width: 100%; max-width: none; margin: 1rem 0 0; padding: 0 var(--page-pad); display: grid; gap: 0.5rem; }
.flash {
  border: 1px solid var(--line);
  border-left: 3px solid var(--muted);
  background: var(--panel);
  padding: 0.55rem 0.75rem;
  border-radius: 7px;
  font-size: var(--text-base);
}
.flash.success { border-left-color: var(--ok); }
.flash.error { border-left-color: var(--danger); }
.flash.warning { border-left-color: var(--warn); }
.flash.info { border-left-color: var(--link); }

.auth-shell { min-height: 100vh; display: grid; place-items: center; padding: 1.5rem; }
.auth-card {
  width: 100%;
  max-width: 430px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: linear-gradient(180deg, var(--panel-2), var(--panel));
  padding: 1.5rem;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.35);
}
.auth-card .brand { display: block; margin-bottom: 1.2rem; font-size: 1.05rem; }
.auth-card h1 { font-size: 1.35rem; }
.auth-card .flash-wrap { max-width: none; margin: 0 0 0.9rem; padding: 0; }
.auth-foot { color: var(--dim); font-size: 0.8rem; margin-top: 1rem; }

.breadcrumbs { color: var(--dim); font-size: var(--text-sm); margin-bottom: 0.5rem; }
.breadcrumbs a { color: var(--muted); }

.detail-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
  margin-bottom: 1rem;
}
.detail-head .facts { display: flex; flex-wrap: wrap; gap: 0.4rem; margin-top: 0.45rem; }

.economy-box {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: linear-gradient(135deg, rgba(255, 157, 46, 0.08), transparent 55%), var(--panel);
  padding: 0.9rem 1rem;
  margin-bottom: 1rem;
}
.economy-box .primary { font-size: 1.15rem; font-weight: 650; }
.economy-box .role { color: var(--muted); font-size: var(--text-sm); }

.section { margin-bottom: 1.35rem; }
.section-title { display: flex; align-items: baseline; gap: 0.55rem; margin-bottom: 0.55rem; }
.section-title h2 { margin: 0; }
.section-title .count { color: var(--dim); font-family: var(--mono); font-size: var(--text-sm); }

details.panel summary { cursor: pointer; color: var(--muted); font-size: var(--text-base); }
details.panel summary:hover { color: var(--text); }
details.panel[open] summary { margin-bottom: 0.6rem; }

.empty {
  border: 1px dashed var(--line);
  border-radius: var(--radius);
  padding: 1rem;
  color: var(--muted);
  text-align: center;
  font-size: var(--text-base);
}

.notice {
  border: 1px solid var(--line);
  border-left: 3px solid var(--accent);
  background: var(--panel-2);
  padding: 0.7rem 0.85rem;
  border-radius: 8px;
  color: var(--muted);
  font-size: var(--text-base);
  line-height: 1.5;
  margin-bottom: 1rem;
}
.notice strong { color: var(--text); }

.meter { width: 100%; height: 0.45rem; }
meter { width: 100%; height: 0.55rem; }

.kv { display: grid; grid-template-columns: max-content minmax(0, 1fr); gap: 0.3rem 0.8rem; font-size: var(--text-base); }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; }

.filter-bar {
  display: flex;
  gap: 0.5rem;
  align-items: flex-end;
  flex-wrap: wrap;
  margin-bottom: 0.9rem;
}
.filter-bar .field { min-width: 160px; }
.filter-bar .grow { flex: 1 1 220px; }

.stat-line { display: flex; gap: 0.5rem; flex-wrap: wrap; color: var(--muted); font-size: var(--text-sm); }

@media (max-width: 720px) {
  .topbar { padding: 0.55rem 0.9rem; gap: 0.6rem; flex-wrap: wrap; }
  .page { padding: 1rem 0.9rem; }
  .footer { padding: 1.2rem 0.9rem; }
  .userbox { width: 100%; margin-left: 0; }
  .flash-wrap { padding: 0 0.9rem; }
  h1 { font-size: 1.45rem; }
}

pre.token {
  background: #070b10;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px 12px;
  overflow-x: auto;
  color: var(--accent);
  font-size: 0.85rem;
  user-select: all;
}

.advice-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 1rem;
  margin: 1rem 0;
}
.advice h3 {
  margin: 0;
  font-size: 1rem;
}
.advice h4 {
  margin: 0 0 0.4rem;
  color: var(--muted);
  font-size: var(--text-xs);
  letter-spacing: 0.07em;
  text-transform: uppercase;
}
.advice-list {
  margin: 0;
  padding-left: 18px;
  color: var(--text);
  font-size: var(--text-sm);
  line-height: 1.5;
}
.advice-list.avoid {
  color: var(--warn);
}

/* Tabular pages stay readable on wide screens: fixed proportions instead of
   letting every column float to the far edge. */
table.stations { table-layout: fixed; min-width: 1040px; }
table.stations .st-name { width: 18%; }
table.stations .st-dist { width: 7%; }
table.stations .st-pads { width: 7%; }
table.stations .st-econ { width: 19%; }
table.stations .st-services { width: 30%; }
table.stations .st-market { width: 8%; }
table.stations .st-id { width: 8%; }
table.stations td.name { overflow-wrap: anywhere; }
table.factions { table-layout: fixed; min-width: 1100px; }
table.factions th:nth-child(1) { width: 22%; }
table.factions th:nth-child(2) { width: 9%; }
table.factions th:nth-child(3) { width: 9%; }
table.factions th:nth-child(4) { width: 12%; }
table.factions th:nth-child(5) { width: 12%; }
table.factions th:nth-child(6) { width: 12%; }
table.factions th:nth-child(7) { width: 10%; }
table.factions th:nth-child(8) { width: 8%; }
table.factions th:nth-child(9) { width: 6%; }
table.conflicts { table-layout: fixed; min-width: 900px; }
table.conflicts th:nth-child(1) { width: 34%; }
table.conflicts th:nth-child(2) { width: 10%; }
table.conflicts th:nth-child(3) { width: 18%; }
table.conflicts th:nth-child(4) { width: 8%; }
table.conflicts th:nth-child(5) { width: 14%; }
table.conflicts th:nth-child(6) { width: 16%; }

.situation-grid {
  display: grid;
  grid-template-columns: minmax(0, 2fr) minmax(240px, 1fr);
  gap: 1.25rem;
  align-items: start;
}
.target-eyebrow {
  color: var(--accent);
  font-size: var(--text-xs);
  font-weight: 700;
  letter-spacing: 0.09em;
  text-transform: uppercase;
  margin-bottom: 0.15rem;
}
.target-status h3 { margin-bottom: 0.45rem; }
.target-status .stat-line { margin-bottom: 0.6rem; }
.state-row { margin: 0.35rem 0 0.65rem; }
.situation-states {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.9rem;
  margin-top: 0.35rem;
}
.target-conflicts {
  margin-top: 0.8rem;
  padding-top: 0.65rem;
  border-top: 1px solid var(--line-soft);
}
.situation-meta {
  border-left: 1px solid var(--line-soft);
  padding-left: 1.1rem;
}
.situation-meta .kv { margin-bottom: 0.85rem; }
details.reference {
  margin-top: 1rem;
  border-top: 1px solid var(--line-soft);
  padding-top: 0.7rem;
}
details.reference summary {
  cursor: pointer;
  color: var(--muted);
  font-size: var(--text-sm);
}
details.reference summary:hover { color: var(--text); }
details.reference[open] summary { margin-bottom: 0.6rem; }
.reference-table th:nth-child(1) { width: 30%; }
.reference-table th:nth-child(2) { width: 14%; }
.reference-table th:nth-child(3) { width: 20%; }
.reference-table th:nth-child(4) { width: 22%; }
.reference-table th:nth-child(5) { width: 14%; }
@media (max-width: 900px) {
  .situation-grid { grid-template-columns: 1fr; }
  .situation-meta { border-left: 0; padding-left: 0; border-top: 1px solid var(--line-soft); padding-top: 0.8rem; }
  .situation-states { grid-template-columns: 1fr; }
}

.route-form { align-items: end; }
.route-form .full { grid-column: 1 / -1; }
.route-form label.checkbox {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  color: var(--text);
  font-size: var(--text-sm);
}
.route-form label.checkbox input { width: auto; }
table.market-table { table-layout: fixed; min-width: 900px; }
table.market-table th:nth-child(1) { width: 24%; }
table.market-table th:nth-child(2) { width: 26%; }
table.market-table th:nth-child(3) { width: 16%; }
table.market-table th:nth-child(4) { width: 10%; }
table.market-table th:nth-child(5) { width: 16%; }
table.market-table th:nth-child(6) { width: 8%; }
table.route-table { table-layout: fixed; min-width: 1100px; }
table.route-table th:nth-child(1) { width: 4%; }
table.route-table th:nth-child(2) { width: 20%; }
table.route-table th:nth-child(3) { width: 17%; }
table.route-table th:nth-child(4) { width: 8%; }
table.route-table th:nth-child(5) { width: 20%; }
table.route-table th:nth-child(6) { width: 8%; }
table.route-table th:nth-child(7) { width: 7%; }
table.route-table th:nth-child(8) { width: 8%; }
table.route-table th:nth-child(9) { width: 4%; }
table.route-table th:nth-child(10) { width: 10%; }

.trade-tabs {
  display: flex;
  gap: 0.25rem;
  border-bottom: 1px solid var(--line);
  margin: 0 0 1rem;
}
.trade-tabs a {
  padding: 0.55rem 0.8rem;
  color: var(--muted);
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
}
.trade-tabs a.active, .trade-tabs a:hover { color: var(--text); border-bottom-color: var(--accent); text-decoration: none; }
.filter-bar {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(135px, 1fr));
  gap: 0.7rem;
  align-items: end;
  padding: 0.85rem;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 10px;
  margin-bottom: 1rem;
}
.filter-bar label { display: flex; flex-direction: column; gap: 0.25rem; font-size: var(--text-xs); color: var(--muted); }
.filter-bar input, .filter-bar select { width: 100%; }
.filter-bar label.check { flex-direction: row; align-items: center; gap: 0.4rem; color: var(--text); }
.filter-bar label.check input { width: auto; }
.filter-actions { display: flex; gap: 0.4rem; align-items: center; }
.inline-search { display: flex; gap: 0.4rem; align-items: center; }
.inline-search input { min-width: 12rem; }
.station-link { font-weight: 650; }
.commodity { font-weight: 650; }
.profit { color: var(--ok); font-weight: 750; }
.badge.te { color: #1a1205; background: var(--accent); border-color: var(--accent); }
.preset-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 0.6rem; margin-bottom: 1rem; }
.preset { display: flex; flex-direction: column; gap: 0.2rem; padding: 0.7rem 0.8rem; border: 1px solid var(--line); border-radius: 9px; background: var(--panel); color: var(--text); }
.preset span { color: var(--muted); font-size: var(--text-xs); }
.preset:hover { border-color: var(--accent-soft); text-decoration: none; }
table.contracts-table { table-layout: fixed; min-width: 1240px; }
table.contracts-table th:nth-child(1) { width: 16%; }
table.contracts-table th:nth-child(2) { width: 13%; }
table.contracts-table th:nth-child(3) { width: 16%; }
table.contracts-table th:nth-child(4) { width: 8%; }
table.contracts-table th:nth-child(5) { width: 8%; }
table.contracts-table th:nth-child(6) { width: 6%; }
table.contracts-table th:nth-child(7) { width: 8%; }
table.contracts-table th:nth-child(8) { width: 7%; }
table.contracts-table th:nth-child(9) { width: 4%; }
table.contracts-table th:nth-child(10) { width: 7%; }
table.contracts-table th:nth-child(11) { width: 7%; }
table.stations-table { min-width: 820px; }
table.deals-table { min-width: 760px; }
table.quotes-table { min-width: 760px; }
.route-summary { display: flex; flex-wrap: wrap; gap: 1rem; justify-content: space-between; align-items: center; padding: 1rem 1.1rem; margin: 1rem 0; border: 1px solid var(--line); border-radius: 10px; background: linear-gradient(135deg, var(--panel), var(--panel-2)); }
.route-profit .label { color: var(--muted); font-size: var(--text-xs); text-transform: uppercase; letter-spacing: 0.07em; display: block; }
.route-profit strong { font-family: var(--mono); font-size: 2rem; color: var(--ok); }
.route-profit small { font-size: 0.9rem; font-weight: 500; }
.route-meta { display: flex; gap: 1.2rem; flex-wrap: wrap; color: var(--muted); }
.route-meta b { color: var(--text); font-family: var(--mono); }
.route-cards { display: flex; flex-direction: column; gap: 0.55rem; }
.route-leg { display: grid; grid-template-columns: 2.4rem minmax(0, 1fr) auto; gap: 0.8rem; align-items: center; padding: 0.8rem 0.9rem; border: 1px solid var(--line); border-radius: 9px; background: var(--panel); }
.leg-number { font-family: var(--mono); color: var(--accent); font-size: 1.1rem; }
.leg-route { font-weight: 650; display: flex; gap: 0.45rem; flex-wrap: wrap; align-items: center; }
.leg-route .arrow { color: var(--accent); }
.leg-systems { color: var(--muted); font-size: var(--text-xs); margin-top: 0.1rem; }
.leg-trade { display: flex; gap: 0.6rem; flex-wrap: wrap; margin-top: 0.25rem; }
.leg-profit { font-family: var(--mono); color: var(--ok); font-weight: 750; white-space: nowrap; }
.leg-profit small { font-weight: 500; color: var(--muted); }
.route-note { margin: 0.6rem 0 0; }
@media (max-width: 700px) {
  .route-leg { grid-template-columns: 1.8rem minmax(0, 1fr); }
  .leg-profit { grid-column: 2; }
  .route-summary { align-items: flex-start; }
}

table.market-table.quotes-table { table-layout: fixed; min-width: 920px; }
table.market-table.quotes-table th:nth-child(1) { width: 25%; }
table.market-table.quotes-table th:nth-child(2) { width: 16%; }
table.market-table.quotes-table th:nth-child(3) { width: 11%; }
table.market-table.quotes-table th:nth-child(4) { width: 11%; }
table.market-table.quotes-table th:nth-child(5) { width: 11%; }
table.market-table.quotes-table th:nth-child(6) { width: 11%; }
table.market-table.quotes-table th:nth-child(7) { width: 11%; }
table.market-table.deals-table { table-layout: fixed; min-width: 820px; }
table.market-table.deals-table th:nth-child(1) { width: 22%; }
table.market-table.deals-table th:nth-child(2) { width: 11%; }
table.market-table.deals-table th:nth-child(3) { width: 24%; }
table.market-table.deals-table th:nth-child(4) { width: 11%; }
table.market-table.deals-table th:nth-child(5) { width: 11%; }
table.market-table.deals-table th:nth-child(6) { width: 10%; }
table.market-table.deals-table th:nth-child(7) { width: 11%; }
table.market-table.stations-table { table-layout: fixed; min-width: 900px; }
table.market-table.stations-table th:nth-child(1) { width: 20%; }
table.market-table.stations-table th:nth-child(2) { width: 25%; }
table.market-table.stations-table th:nth-child(3) { width: 15%; }
table.market-table.stations-table th:nth-child(4) { width: 9%; }
table.market-table.stations-table th:nth-child(5) { width: 9%; }
table.market-table.stations-table th:nth-child(6) { width: 14%; }
table.market-table.stations-table th:nth-child(7) { width: 8%; }

.activity-table { table-layout: fixed; min-width: 1000px; }
.activity-table th { font-size: var(--text-xs); }
.activity-table .ships { white-space: normal; }
.activity-table .ships .chip { margin: 0.1rem 0.2rem 0.1rem 0; }
.activity-table .ships .chip b { color: var(--text); font-family: var(--mono); margin-left: 0.2rem; }
.contribution-head { display: flex; flex-wrap: wrap; gap: 1rem; justify-content: space-between; align-items: flex-start; margin: 0.4rem 0 0.8rem; }
.contribution-head h2 { margin: 0; }
.contribution-head p { margin: 0.25rem 0 0; }
.tick-nav { display: flex; gap: 0.4rem; flex-wrap: wrap; margin-top: 0.55rem; }
.filter-bar label.local-station { grid-column: span 2; }

.colony-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(290px, 1fr)); gap: 0.8rem; }
.colony-card { padding: 0.9rem 1rem; border: 1px solid var(--line); border-radius: 10px; background: var(--panel); }
.colony-head { display: flex; justify-content: space-between; gap: 0.6rem; align-items: flex-start; }
.colony-head h2 { font-size: 1.05rem; margin: 0; }
.colony-head h2 a { color: var(--text); }
.colony-metrics { display: grid; grid-template-columns: repeat(3, 1fr); gap: 0.5rem; margin: 0.8rem 0; }
.colony-metrics div { display: flex; flex-direction: column; gap: 0.15rem; }
.colony-metrics span { color: var(--muted); font-size: var(--text-xs); }
.colony-metrics strong { font-family: var(--mono); font-size: 1rem; white-space: nowrap; }
.spark-block { margin: 0.35rem 0 0.7rem; }
.spark-block svg, .big-spark { width: 100%; display: block; margin-top: 0.25rem; }
.spark-block polyline, .big-spark polyline { fill: none; stroke: var(--accent); stroke-width: 2; vector-effect: non-scaling-stroke; }
.big-spark { height: 130px; }
.colony-charts { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 0.8rem; }
.connect-panel { max-width: 760px; }
.notice.error { color: var(--danger); }
