/* Foundry design system. Dark by default, light on request.
   Motion is reserved for boot, loading, and hover — not lists. */

:root {
  --bg: #12161c;
  --bg-2: #181d25;
  --panel: rgba(32, 38, 48, 0.86);
  --panel-solid: #1e2530;
  --line: rgba(170, 182, 200, 0.18);
  --line-strong: rgba(170, 182, 200, 0.32);
  --text: #eef2f7;
  --text-dim: #a8b4c6;
  --text-faint: #7e8b9c;
  --ice: #7ec8ff;
  --bone: #d6dce6;
  --gold: #ffb545;
  --teal: #4de1c1;
  --blue: #5aa9ff;
  --rose: #ff6b8a;
  --violet: #a98bff;
  --good: #4de1c1;
  --bad: #ff6b8a;
  --warn: #ffb545;
  --accent: var(--bone);
  --radius: 14px;
  --radius-sm: 9px;
  --shadow: 0 18px 44px rgba(0, 0, 0, 0.5);
  --glow: 0 0 0 1px rgba(214, 220, 228, 0.22), 0 8px 22px rgba(0, 0, 0, 0.28);
  --ease: cubic-bezier(0.22, 0.61, 0.36, 1);
  --rail: 220px;
}

html[data-theme="light"] {
  --bg: #f4f6fb;
  --bg-2: #eaeef6;
  --panel: rgba(255, 255, 255, 0.86);
  --panel-solid: #ffffff;
  --line: rgba(38, 62, 98, 0.14);
  --line-strong: rgba(38, 62, 98, 0.26);
  --text: #16202f;
  --text-dim: #4c5c75;
  --text-faint: #7286a3;
  --ice: #1d6fb8;
  --bone: #3d4a5c;
  --gold: #b3701a;
  --teal: #0f8f77;
  --blue: #2470c8;
  --rose: #c2385a;
  --violet: #6b4bd0;
  --good: #0f8f77;
  --bad: #c2385a;
  --warn: #b3701a;
  --accent: var(--bone);
  --shadow: 0 14px 34px rgba(28, 44, 72, 0.12);
  --glow: 0 0 0 1px rgba(61, 74, 92, 0.28), 0 8px 22px rgba(28, 44, 72, 0.1);
}

* { box-sizing: border-box; }

html, body {
  width: 100%;
  height: 100%;
  margin: 0;
  overflow: hidden;
}

body {
  background: var(--bg);
  color: var(--text);
  font-family: "Segoe UI Variable Text", "Segoe UI", Inter, system-ui, sans-serif;
  font-size: 14px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3, h4 { margin: 0; font-weight: 600; letter-spacing: -0.01em; }
p { margin: 0; }
button, input, select { font: inherit; color: inherit; }
a { color: var(--blue); }

.num { font-variant-numeric: tabular-nums; }

/* ------------------------------------------------------------- background */

.starfield { position: fixed; inset: 0; overflow: hidden; z-index: 0; pointer-events: none; }
.starfield span {
  position: absolute;
  border-radius: 50%;
  opacity: 0.5;
}
.starfield span:nth-child(1) {
  width: 46vw; height: 46vw; left: -8vw; top: -12vw;
  background: radial-gradient(circle, rgba(77, 225, 193, 0.1), transparent 68%);
}
.starfield span:nth-child(2) {
  width: 38vw; height: 38vw; right: -6vw; top: 24vh;
  background: radial-gradient(circle, rgba(170, 182, 200, 0.08), transparent 68%);
}
.starfield span:nth-child(3) {
  width: 34vw; height: 34vw; left: 32vw; bottom: -14vw;
  background: radial-gradient(circle, rgba(170, 182, 200, 0.06), transparent 70%);
}
html[data-theme="light"] .starfield span { opacity: 0.35; }

/* ------------------------------------------------------------------- boot */

.boot {
  position: fixed; inset: 0; z-index: 60;
  display: grid; place-items: center;
  background: var(--bg);
  transform: translateZ(0);
  transition: opacity 0.55s cubic-bezier(0.4, 0, 0.2, 1);
}
.boot[hidden] { display: none; }
.boot.out { opacity: 0; pointer-events: none; }
.boot-card { text-align: center; display: grid; gap: 16px; justify-items: center; }
.boot-brand { display: grid; gap: 12px; justify-items: center; }
.boot-brand .brand-mark {
  width: 52px; height: 52px;
  transform-origin: center center;
  transform: translateZ(0);
  transition: transform 0.55s cubic-bezier(0.4, 0, 0.2, 1);
}
.boot-brand .brand-core { animation: pulse 2.4s var(--ease) infinite; }
.boot-card h1 {
  font-size: 15px; letter-spacing: 0.2em; text-transform: uppercase; font-weight: 600;
}
.boot-card p { color: var(--text-dim); min-height: 21px; font-size: 13px; }
.boot-bar { width: 220px; height: 3px; background: var(--line); border-radius: 3px; overflow: hidden; }
.boot-bar i {
  display: block; height: 100%; width: 8%;
  background: var(--good);
  border-radius: 3px;
  transform: none;
  animation: none;
  transition: width 0.45s var(--ease);
}
.boot.handoff {
  background: transparent;
  pointer-events: none;
}
.boot.handoff #bootMsg,
.boot.handoff .boot-bar,
.boot.handoff .boot-brand h1 {
  opacity: 0;
  transition: opacity 0.28s cubic-bezier(0.4, 0, 0.2, 1);
}
.boot.handoff .boot-brand .brand-mark {
  transform: translate3d(var(--hx, 0px), var(--hy, 0px), 0) scale(var(--hs, 0.5));
}
.boot.handoff .boot-brand .brand-core { animation: none; }

.boot.welcome .boot-brand .brand-mark {
  animation: welcome-hex 1.65s cubic-bezier(0.22, 0.61, 0.36, 1) both;
}
.boot.welcome .boot-brand .brand-core {
  animation: welcome-core 1.65s cubic-bezier(0.22, 0.61, 0.36, 1) both;
}
.boot.welcome #bootMsg {
  color: var(--text);
  animation: welcome-copy 0.7s cubic-bezier(0.22, 0.61, 0.36, 1) both;
}
.boot.welcome .boot-bar i {
  background: var(--good);
}

.boot.gate .boot-brand .brand-core {
  animation: pulse 1.6s var(--ease) infinite;
}
.boot.gate .boot-bar i {
  width: 36% !important;
  transition: none;
  animation: boot-sweep 1.35s cubic-bezier(0.22, 0.61, 0.36, 1) infinite;
}

@keyframes welcome-hex {
  0% { transform: scale(0.9); filter: saturate(0.7); }
  42% { transform: scale(1.1); }
  100% { transform: scale(1); filter: none; }
}
@keyframes welcome-core {
  0% { opacity: 0.28; }
  40% { opacity: 1; }
  100% { opacity: 0.9; }
}
@keyframes welcome-copy {
  from { opacity: 0; letter-spacing: 0.08em; }
  to { opacity: 1; letter-spacing: normal; }
}

.shell.entering { opacity: 0; }
.shell.entering.in {
  opacity: 1;
  transition: opacity 0.55s cubic-bezier(0.4, 0, 0.2, 1);
}

@keyframes spin { to { transform: rotate(360deg); } }
@keyframes pulse { 0%, 100% { opacity: 0.45; transform: scale(1); } 50% { opacity: 1; transform: scale(1.12); } }
@keyframes boot-sweep { from { transform: translateX(-100%); } to { transform: translateX(280%); } }
@keyframes rise { from { opacity: 0; } }

@media (prefers-reduced-motion: reduce) {
  .boot.handoff .boot-brand .brand-mark { transform: none; }
  .boot.welcome .boot-brand .brand-mark,
  .boot.welcome .boot-brand .brand-core,
  .boot.welcome #bootMsg,
  .boot.gate .boot-bar i { animation: none; }
}

/* ------------------------------------------------------------------ shell */

.shell {
  position: relative; z-index: 1;
  display: grid; grid-template-columns: var(--rail) minmax(0, 1fr);
  height: 100%; max-height: 100%;
  overflow: hidden;
}
.shell[hidden] { display: none; }

.rail {
  display: flex; flex-direction: column; gap: 6px; padding: 16px 12px;
  border-right: 1px solid var(--line);
  background: linear-gradient(180deg, rgba(24, 29, 38, 0.94), rgba(16, 20, 27, 0.84));
  backdrop-filter: blur(14px);
  min-height: 0; overflow: auto;
}
html[data-theme="light"] .rail { background: linear-gradient(180deg, rgba(255,255,255,0.9), rgba(240,243,250,0.7)); }

.brand { display: flex; align-items: center; gap: 10px; padding: 6px 8px 18px; }
.brand-mark { width: 26px; height: 26px; fill: none; stroke: var(--bone); stroke-width: 1.6; }
.brand-core { fill: rgba(77, 225, 193, 0.18); stroke: var(--good); }
.brand-text { font-weight: 600; letter-spacing: 0.2em; text-transform: uppercase; font-size: 13px; }
.pack-dot {
  width: 6px; height: 6px; border-radius: 50%; flex: none;
  background: var(--text-faint); opacity: 0.45;
  transition: background 0.2s var(--ease), box-shadow 0.2s var(--ease), opacity 0.2s var(--ease);
}
.pack-dot.ok { background: var(--good); box-shadow: 0 0 8px var(--good); opacity: 1; }
.pack-dot.warn { background: var(--warn); box-shadow: 0 0 8px var(--warn); opacity: 1; }
.pack-dot.bad { background: var(--bad); box-shadow: 0 0 8px var(--bad); opacity: 1; }

.rail-links { display: flex; flex-direction: column; gap: 12px; }
.rail-group { display: grid; gap: 3px; }
.rail-kicker {
  font-size: 10px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--text-faint);
  padding: 2px 11px 4px;
}
.rail-group.tail {
  padding-top: 12px;
  border-top: 1px solid var(--line);
}
.rail-foot {
  margin-top: auto;
  padding: 16px 10px 6px;
  display: grid;
  gap: 5px;
}
.sync-stamp {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 12px;
  font-size: 11px;
  font-variant-numeric: tabular-nums;
  color: var(--text-dim);
}
.sync-stamp span {
  color: var(--text-faint);
  font-size: 10px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}
.sync-stamp time { color: var(--text-dim); }
.rail-link {
  display: flex; align-items: center; gap: 11px;
  padding: 9px 11px; border-radius: var(--radius-sm);
  background: transparent; border: 1px solid transparent; cursor: pointer;
  color: var(--text-dim); text-align: left; width: 100%;
  transition: background 0.18s var(--ease), color 0.18s var(--ease);
}
.rail-link:hover { background: rgba(126, 152, 190, 0.1); color: var(--text); }
.rail-link.on {
  background: linear-gradient(90deg, rgba(214, 220, 228, 0.14), rgba(214, 220, 228, 0.02));
  border-color: rgba(214, 220, 228, 0.32); color: var(--text);
}
.rail-link.on .ico { color: var(--text); }
.rail-label { font-size: 13px; }

.ico { width: 18px; height: 18px; display: inline-grid; place-items: center; flex: none; color: currentColor; }
.ico svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }

/* ----------------------------------------------------------------- topbar */

.main {
  display: flex; flex-direction: column;
  min-width: 0; min-height: 0; height: 100%;
  overflow: hidden;
}
.topbar {
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
  padding: 12px 20px;
  border-bottom: 1px solid var(--line);
  min-height: 58px;
  flex-wrap: nowrap;
}
.crumbs { min-width: 0; flex: 1 1 12rem; display: flex; align-items: center; gap: 10px; }
.crumbs-text { min-width: 0; }
.crumbs h2 {
  font-size: 18px; line-height: 1.25;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.crumbs p {
  color: var(--text-faint); font-size: 12.5px; margin-top: 2px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.back-btn {
  flex: none;
  width: 34px; height: 34px; margin-top: 1px;
  display: grid; place-items: center;
  border-radius: 10px; cursor: pointer;
  border: 1px solid var(--line-strong); background: var(--panel); color: var(--text);
  transition: background 0.16s var(--ease), border-color 0.16s var(--ease), opacity 0.16s var(--ease);
}
.back-btn:hover:not(:disabled) { background: rgba(126, 152, 190, 0.12); border-color: rgba(126, 152, 190, 0.35); }
.back-btn:disabled { opacity: 0.35; cursor: default; }
.back-btn .ico, .back-btn .ico svg { width: 18px; height: 18px; }
.topbar-right {
  display: flex; align-items: center; gap: 8px;
  flex: 0 0 auto; flex-wrap: nowrap;
}

.chips { display: flex; align-items: center; gap: 6px; flex-wrap: nowrap; }
.chip {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 4px 10px; border-radius: 20px; font-size: 11.5px;
  border: 1px solid var(--line); color: var(--text-dim); background: var(--panel);
}
.chip b { color: var(--text); font-weight: 600; }
.chip .dot { width: 6px; height: 6px; border-radius: 50%; background: var(--text-faint); }
.chip.ok .dot { background: var(--good); box-shadow: 0 0 8px var(--good); }
.chip.warn .dot { background: var(--warn); box-shadow: 0 0 8px var(--warn); }
.chip.bad .dot { background: var(--bad); box-shadow: 0 0 8px var(--bad); }

.btn {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 8px 14px; border-radius: 10px; cursor: pointer;
  border: 1px solid var(--line-strong); background: var(--panel); color: var(--text);
  transition: background 0.14s var(--ease), border-color 0.14s var(--ease);
  white-space: nowrap;
}
.btn:hover { background: rgba(126, 152, 190, 0.12); }
.btn:active { background: rgba(126, 152, 190, 0.18); }
.btn.primary { background: rgba(77, 225, 193, 0.1); border-color: rgba(77, 225, 193, 0.42); }
.btn.primary:hover { background: rgba(77, 225, 193, 0.18); }
.btn.update-ready {
  background: rgba(77, 225, 193, 0.14);
  border-color: rgba(77, 225, 193, 0.5);
}
.btn.ghost { background: transparent; }
.btn.ghost:hover { background: rgba(126, 152, 190, 0.1); }
.btn.danger {
  color: var(--bad);
  border-color: color-mix(in srgb, var(--bad) 48%, transparent);
  background: color-mix(in srgb, var(--bad) 14%, transparent);
}
.btn.danger:hover { background: color-mix(in srgb, var(--bad) 22%, transparent); }
.btn.small { padding: 5px 10px; font-size: 12.5px; }
.btn.busy { pointer-events: none; opacity: 0.75; }
.btn.busy .ico svg { animation: spin 1s linear infinite; }
.theme-switch {
  display: inline-flex; align-items: center; gap: 2px;
  padding: 3px; border-radius: 11px;
  border: 1px solid var(--line-strong); background: var(--panel);
}
.theme-switch button {
  display: inline-flex; align-items: center; gap: 6px;
  border: 0; background: transparent; color: var(--text-dim);
  padding: 6px 11px; border-radius: 8px; cursor: pointer;
  font-size: 12.5px; line-height: 1;
  transition: background 0.16s var(--ease), color 0.16s var(--ease);
}
.theme-switch button:hover { color: var(--text); background: rgba(126, 152, 190, 0.1); }
.theme-switch button.on {
  background: rgba(214, 220, 228, 0.16);
  color: var(--text);
  box-shadow: 0 0 0 1px rgba(214, 220, 228, 0.32);
}
.theme-switch button.on .ico { color: var(--bone); }
html[data-theme="light"] .theme-switch button.on {
  background: rgba(61, 74, 92, 0.12);
  box-shadow: 0 0 0 1px rgba(61, 74, 92, 0.28);
}
.panel .theme-switch { margin-top: 10px; }
html.tight .theme-label { display: none; }
html.tight .theme-switch button { padding: 6px 8px; }

.netbar { height: 2px; background: transparent; overflow: hidden; }
.netbar[hidden] { display: none; }
.netbar i {
  display: block; height: 100%; width: 34%;
  background: linear-gradient(90deg, transparent, var(--good), transparent);
  animation: sweep 1.1s var(--ease) infinite;
}
@keyframes sweep { from { transform: translateX(-100%); } to { transform: translateX(320%); } }

.view {
  flex: 1 1 auto;
  min-width: 0;
  min-height: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  padding: 0;
}
.mark {
  position: fixed;
  right: 26px;
  bottom: 56px;
  z-index: 8;
  margin: 0;
  padding: 0;
  pointer-events: none;
  user-select: none;
  white-space: nowrap;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.12em;
  line-height: 1;
  color: var(--text-dim);
  opacity: 0.55;
  transform: rotate(90deg);
  transform-origin: right bottom;
}
html[data-theme="light"] .mark { opacity: 0.48; }
.shell[hidden] ~ .mark { display: none; }
.page-scroll {
  flex: 1 1 auto;
  min-width: 0;
  min-height: 0;
  overflow-x: hidden;
  overflow-y: auto;
  padding: 18px 20px 48px;
  overscroll-behavior: contain;
  scroll-padding-top: 12px;
}
.page-scroll:has(> .sheet) {
  display: flex;
  flex-direction: column;
  overflow: hidden;
  padding-bottom: 18px;
}
.page-scroll::-webkit-scrollbar,
.sheet-body::-webkit-scrollbar { width: 10px; }
.page-scroll::-webkit-scrollbar-track,
.sheet-body::-webkit-scrollbar-track { background: rgba(126, 152, 190, 0.06); }
.page-scroll::-webkit-scrollbar-thumb,
.sheet-body::-webkit-scrollbar-thumb { background: var(--line-strong); border-radius: 10px; }

.sheet {
  display: flex;
  flex-direction: column;
  flex: 1 1 auto;
  min-height: 0;
  gap: 14px;
}
.sheet-tools { flex: none; }
.sheet-body {
  flex: 1 1 auto;
  min-height: 0;
  min-width: 0;
  overflow-x: hidden;
  overflow-y: auto;
  padding: 0;
}

/* ----------------------------------------------------------------- panels */

.panel {
  position: relative; z-index: 1;
  background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 16px 18px; backdrop-filter: blur(12px);
  min-width: 0; max-width: 100%;
  container-type: inline-size;
}
.panel:has(.searchbox) { z-index: 20; }
.panel + .panel { margin-top: 14px; }
.grid > .panel + .panel,
.sheet .panel + .panel,
.home .panel + .panel,
.wallet .panel + .panel,
.settings > .panel + .panel,
.characters > .panel + .panel { margin-top: 0; }
.panel.sheet-body { padding: 0; }
.panel-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 12px; flex-wrap: wrap; }
.panel-head h3 { font-size: 14px; line-height: 1.4; padding: 2px 0; }
.panel-head .hint { color: var(--text-faint); font-size: 12px; }
.panel-actions { display: flex; align-items: center; gap: 8px; flex: none; }

.grid { display: grid; gap: 14px; min-width: 0; }
.grid.two { grid-template-columns: minmax(0, 1.45fr) minmax(0, 1fr); }
.grid.two > * { min-width: 0; }
.grid.metrics { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.grid.metrics > * { min-width: 0; }
.grid.metrics.six,
.grid.metrics.three { grid-template-columns: repeat(3, minmax(0, 1fr)); }
@media (max-width: 1180px) { .grid.two { grid-template-columns: 1fr; } }
html.tight .grid.metrics { grid-template-columns: repeat(2, minmax(0, 1fr)); }

.metric {
  position: relative;
  background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 13px 15px;
}
.metric::after {
  content: ""; position: absolute; inset: 0 0 auto 0; height: 2px;
  background: linear-gradient(90deg, var(--accent, var(--bone)), transparent);
}
.metric .label { color: var(--text-faint); font-size: 11.5px; text-transform: uppercase; letter-spacing: 0.08em; }
.metric .value {
  /* Full ISK runs to about 17 characters, so this shrinks to fit rather than wrap. */
  font-size: clamp(14px, 1.15vw, 20px);
  font-weight: 600; margin-top: 5px;
  font-variant-numeric: tabular-nums; letter-spacing: -0.01em;
  white-space: nowrap; overflow: hidden; text-overflow: clip;
}
.metric .sub { color: var(--text-dim); font-size: 12px; margin-top: 3px; }
.metric.good { --accent: var(--good); }
.metric.bad { --accent: var(--bad); }
.metric.warn { --accent: var(--warn); }
.metric.good .value { color: var(--good); }
.metric.bad .value { color: var(--bad); }
.metric.warn .value { color: var(--warn); }
button.metric {
  width: 100%;
  text-align: left;
  color: inherit;
  font: inherit;
  cursor: pointer;
}
button.metric:hover { background: rgba(126, 152, 190, 0.08); }

/* ------------------------------------------------------------------ table */

table {
  width: 100%;
  max-width: 100%;
  table-layout: fixed;
  border-collapse: separate;
  border-spacing: 0;
}
th, td { overflow: hidden; text-overflow: ellipsis; }
th {
  text-align: left; font-size: 11px; text-transform: uppercase; letter-spacing: 0.07em;
  color: var(--text-faint); font-weight: 600; line-height: 1.45;
  padding: 10px 8px 9px; border-bottom: 1px solid var(--line);
}
td { padding: 8px; border-bottom: 1px solid rgba(126, 152, 190, 0.08); vertical-align: middle; }
.sheet-body thead {
  position: sticky; top: 0; z-index: 5;
}
.sheet-body th {
  background: var(--panel-solid);
  box-shadow: 0 1px 0 var(--line), 0 -12px 0 var(--panel-solid);
}
tbody tr:hover { background: rgba(126, 152, 190, 0.07); }
.right { text-align: right; }
.mono { font-variant-numeric: tabular-nums; }
.dim { color: var(--text-dim); }
.faint { color: var(--text-faint); }
.hide { display: none !important; }
.good { color: var(--good); }
.bad { color: var(--bad); }
.warn { color: var(--warn); }

.icon-type { width: 28px; height: 28px; border-radius: 6px; background: rgba(126,152,190,0.1); flex: none; }
.icon-missing { object-fit: contain; background: rgba(126,152,190,0.08); }
.cell { display: flex; align-items: center; gap: 9px; min-width: 0; overflow: hidden; }
.cell > div { min-width: 0; overflow: hidden; }
.cell .name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cell .sub { color: var(--text-faint); font-size: 11.5px; }

.tag {
  display: inline-flex; align-items: center; gap: 5px; padding: 2px 8px; border-radius: 6px;
  font-size: 11px; border: 1px solid var(--line); color: var(--text-dim); white-space: nowrap;
}
.tag.build { border-color: rgba(77,225,193,0.4); color: var(--teal); }
.tag.buy { border-color: rgba(90,169,255,0.4); color: var(--blue); }
.tag.invent { border-color: rgba(169,139,255,0.45); color: var(--violet); }
.tag.react { border-color: rgba(255,181,69,0.4); color: var(--gold); }
.tag.stock { border-color: rgba(126,152,190,0.35); }
.tag.faint { opacity: 0.7; border-style: dashed; }

/* ------------------------------------------------------------------- tree */

.tree-row {
  display: grid;
  grid-template-columns: minmax(0, 1.4fr) minmax(48px, 0.35fr) minmax(72px, 0.5fr) minmax(64px, 0.45fr) minmax(52px, 0.35fr);
  gap: 8px; align-items: center;
}
.tree-row > * { min-width: 0; overflow: hidden; text-overflow: ellipsis; }
.tree-scroll { overflow: visible; }
.tree-row.head {
  color: var(--text-faint); font-size: 11px; text-transform: uppercase; letter-spacing: 0.07em;
  line-height: 1.45; padding: 8px 8px 10px; border-bottom: 1px solid var(--line);
}
.node {
  border-bottom: 1px solid rgba(126, 152, 190, 0.08);
  padding: 7px 8px;
}
.node:hover { background: rgba(126, 152, 190, 0.06); }
.node .twist {
  width: 18px; height: 18px; border: 0; background: transparent; cursor: pointer;
  color: var(--text-faint); display: grid; place-items: center; flex: none;
  transition: transform 0.2s var(--ease), color 0.2s var(--ease);
}
.node .twist:hover { color: var(--text); }
.node.closed .twist { transform: rotate(-90deg); }
.node .spacer { flex: none; }
.kids { overflow: hidden; }
.kids.hide { display: none; }

/* --------------------------------------------------------------- controls */

.controls { display: flex; flex-wrap: wrap; gap: 10px; align-items: flex-end; }
.field { display: grid; gap: 5px; min-width: 0; }
.field.grow { flex: 1 1 160px; }
.field.shrink { flex: 0 1 88px; width: 88px; }
.field > span { font-size: 11px; text-transform: uppercase; letter-spacing: 0.07em; color: var(--text-faint); }
input[type="text"], input[type="number"], select, textarea {
  background: var(--panel-solid); border: 1px solid var(--line-strong); color: var(--text);
  border-radius: 9px; padding: 8px 11px; min-width: 0;
  transition: border-color 0.16s var(--ease), box-shadow 0.16s var(--ease);
}
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--bone); box-shadow: var(--glow); }
.clearable { position: relative; display: block; min-width: 0; width: 100%; }
.clearable input, .clearable textarea { width: 100%; padding-right: 2rem; }
.field-clear {
  position: absolute; right: 5px; top: 50%; transform: translateY(-50%);
  width: 22px; height: 22px; padding: 0; border: 0; border-radius: 99px;
  background: transparent; color: var(--text-faint); cursor: pointer;
  display: none; place-items: center;
}
.field-clear .ico, .field-clear .ico svg { width: 14px; height: 14px; }
.clearable.has-value .field-clear { display: grid; }
.field-clear:hover { color: var(--text); background: rgba(126, 152, 190, 0.16); }
.clearable.is-area .field-clear { top: 8px; transform: none; }
textarea {
  width: 100%;
  min-height: 132px;
  resize: vertical;
  font: inherit;
  line-height: 1.45;
}
input[type="range"] { accent-color: var(--bone); }

.seg { display: inline-flex; border: 1px solid var(--line-strong); border-radius: 9px; overflow: hidden; }
.seg button {
  border: 0; background: transparent; color: var(--text-dim); padding: 7px 12px; cursor: pointer;
  transition: background 0.16s var(--ease), color 0.16s var(--ease); font-size: 12.5px; white-space: nowrap;
}
.seg button + button { border-left: 1px solid var(--line); }
.seg button.on { background: rgba(214, 220, 228, 0.16); color: var(--text); }
.seg button:hover:not(.on) { background: rgba(126, 152, 190, 0.1); }

.switch { display: inline-flex; align-items: center; gap: 8px; cursor: pointer; color: var(--text-dim); }
.switch input { appearance: none; width: 36px; height: 20px; border-radius: 20px; background: var(--line-strong); position: relative; cursor: pointer; transition: background 0.2s var(--ease); }
.switch input::after { content: ""; position: absolute; top: 2px; left: 2px; width: 16px; height: 16px; border-radius: 50%; background: var(--text-dim); transition: transform 0.2s var(--ease), background 0.2s var(--ease); }
.switch input:checked { background: rgba(214, 220, 228, 0.4); }
.switch input:checked::after { transform: translateX(16px); background: var(--bone); }

/* ------------------------------------------------------------------ search */

.searchbox { position: relative; z-index: 2; flex: 1 1 180px; min-width: 0; }
.results {
  position: absolute; z-index: 30; left: 0; right: 0; top: calc(100% + 6px);
  background: var(--panel-solid); border: 1px solid var(--line-strong); border-radius: 12px;
  box-shadow: var(--shadow); max-height: 340px; overflow: auto; padding: 5px;
  animation: rise 0.18s var(--ease);
}
.results[hidden] { display: none; }
.result {
  display: flex; align-items: center; gap: 10px; padding: 7px 9px; border-radius: 8px; cursor: pointer;
}
.result:hover, .result.on { background: rgba(214, 220, 228, 0.12); }
.result-main { min-width: 0; flex: 1; }
.result-main .name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.result .sub { color: var(--text-faint); font-size: 11.5px; }

/* ------------------------------------------------------------------- bars */

.bar { height: 7px; border-radius: 7px; background: var(--line); overflow: hidden; display: flex; }
.bar span { height: 100%; }
.legend { display: flex; gap: 14px; flex-wrap: wrap; margin-top: 9px; font-size: 12px; color: var(--text-dim); }
.legend i { width: 8px; height: 8px; border-radius: 3px; display: inline-block; margin-right: 6px; }

.ledger { display: grid; gap: 7px; }
.ledger-row {
  display: grid;
  grid-template-columns: minmax(7.5rem, 0.9fr) minmax(0, 1fr) minmax(2.6rem, auto) minmax(5.4rem, auto);
  gap: 8px;
  align-items: center;
  min-width: 0;
}
.ledger-label { display: flex; align-items: center; gap: 8px; min-width: 0; }
.swatch {
  width: 8px; height: 8px; border-radius: 3px; flex: none;
}
.swatch.mats, .ledger-bar i.mats { background: var(--blue); }
.swatch.jobs, .ledger-bar i.jobs { background: var(--gold); }
.swatch.invent, .ledger-bar i.invent { background: var(--violet); }
.ledger-bar {
  height: 6px; border-radius: 6px; background: var(--line); overflow: hidden;
}
.ledger-bar i { display: block; height: 100%; border-radius: 6px; }
.ledger-share { text-align: right; font-variant-numeric: tabular-nums; font-size: 12px; }
.ledger-amt { text-align: right; }
.ledger-row.total {
  margin-top: 4px; padding-top: 8px; border-top: 1px solid var(--line); font-weight: 600;
}
.ledger-row.muted .ledger-label, .ledger-row.muted .ledger-amt { color: var(--text-dim); }
.ledger-row.up .ledger-amt { color: var(--good); font-weight: 600; }
.ledger-row.down .ledger-amt { color: var(--bad); font-weight: 600; }
.ledger-note { color: var(--text-faint); font-size: 12px; margin-top: 8px; }

.hero-pnl { text-align: right; flex: none; min-width: 13rem; }
.hero-pnl .label { font-size: 11px; text-transform: uppercase; letter-spacing: 0.08em; color: var(--text-faint); }
.hero-pnl .value {
  font-size: clamp(15px, 1.2vw, 21px); font-weight: 600;
  font-variant-numeric: tabular-nums; letter-spacing: -0.01em;
  white-space: nowrap; margin-top: 2px;
}
.hero-pnl.good .value { color: var(--good); }
.hero-pnl.bad .value { color: var(--bad); }
.hero-pnl .sub { color: var(--text-dim); font-size: 12px; margin-top: 2px; }

html.tight .ledger-row { grid-template-columns: minmax(0, 1fr) minmax(5.4rem, auto); }
html.tight .ledger-bar, html.tight .ledger-share { display: none; }

.progress { height: 5px; border-radius: 5px; background: var(--line); overflow: hidden; }
.progress i { display: block; height: 100%; background: linear-gradient(90deg, var(--teal), var(--gold)); }

/* ----------------------------------------------------------------- states */

.empty {
  display: grid; place-items: center; gap: 10px; padding: 46px 20px; text-align: center;
  color: var(--text-dim);
}
.empty .big { font-size: 15px; color: var(--text); }
.skeleton { display: grid; gap: 9px; }
.skeleton i {
  display: block; height: 13px; border-radius: 7px;
  background: linear-gradient(90deg, rgba(126,152,190,0.08), rgba(126,152,190,0.2), rgba(126,152,190,0.08));
  background-size: 220% 100%; animation: shimmer 1.3s linear infinite;
}
.skeleton i:nth-child(odd) { width: 82%; }
@keyframes shimmer { to { background-position: -120% 0; } }

.loading { display: grid; place-items: center; gap: 12px; padding: 48px 20px; }
.loading p { color: var(--text-dim); }
.loading-bar {
  width: 148px; height: 3px; border-radius: 3px; overflow: hidden;
  background: var(--line);
}
.loading-bar i {
  display: block; height: 100%; width: 38%;
  background: var(--good);
  animation: sweep 0.95s var(--ease) infinite;
}

/* ---------------------------------------------------------------- inventory */

.place-pick { min-width: 220px; flex: 1 1 220px; }

.inv-list { min-width: 0; padding: 8px 12px 12px; }
.inv-head, .inv-row {
  display: grid;
  gap: 8px;
  align-items: center;
  min-width: 0;
}
.hangar-list .inv-head { grid-template-columns: minmax(0, 1fr) minmax(5.4rem, auto) minmax(5.2rem, auto) minmax(5.6rem, auto); }
.hangar-list .inv-row { grid-template-columns: 32px minmax(0, 1fr) minmax(5.4rem, auto) minmax(5.2rem, auto) minmax(5.6rem, auto); }
.orders-list .inv-head { grid-template-columns: minmax(0, 1fr) minmax(3.6rem, auto) minmax(5.2rem, auto) minmax(5.6rem, auto) minmax(5.8rem, auto); }
.orders-list .inv-row { grid-template-columns: 32px minmax(0, 1fr) minmax(3.6rem, auto) minmax(5.2rem, auto) minmax(5.6rem, auto) minmax(5.8rem, auto); }
.prints-list .inv-head { grid-template-columns: minmax(0, 1fr) minmax(3.6rem, auto) minmax(4.6rem, auto) minmax(4.2rem, auto); }
.prints-list .inv-row { grid-template-columns: 32px minmax(0, 1fr) minmax(3.6rem, auto) minmax(4.6rem, auto) minmax(4.2rem, auto); }
.inv-head {
  color: var(--text-faint); font-size: 11px; text-transform: uppercase; letter-spacing: 0.07em;
  font-weight: 600; padding: 6px 8px 8px 45px; border-bottom: 1px solid var(--line);
}
.inv-head .qty, .inv-head .unit, .inv-head .val,
.inv-head .kind, .inv-head .me, .inv-head .runs,
.inv-row .qty, .inv-row .unit, .inv-row .val,
.inv-row .kind, .inv-row .me, .inv-row .runs { text-align: right; }
.hangar-list .inv-head .sort-col,
.prints-list .inv-head .sort-col {
  border: 0; background: transparent; color: inherit;
  font: inherit; letter-spacing: inherit; font-weight: inherit;
  text-transform: inherit; cursor: pointer; padding: 0;
  display: inline-flex; align-items: center; gap: 5px;
  width: 100%; min-width: 0;
}
.hangar-list .inv-head .sort-col.name,
.prints-list .inv-head .sort-col.name { justify-content: flex-start; }
.hangar-list .inv-head .sort-col.qty,
.hangar-list .inv-head .sort-col.unit,
.hangar-list .inv-head .sort-col.val,
.prints-list .inv-head .sort-col.kind,
.prints-list .inv-head .sort-col.me,
.prints-list .inv-head .sort-col.runs { justify-content: flex-end; }
.hangar-list .inv-head .sort-col:hover,
.prints-list .inv-head .sort-col:hover,
.hangar-list .inv-head .sort-col.on,
.prints-list .inv-head .sort-col.on { color: var(--text); }
.hangar-list .inv-head .sort-mark,
.prints-list .inv-head .sort-mark {
  width: 0; height: 0; flex: none;
  border-left: 4px solid transparent;
  border-right: 4px solid transparent;
}
.hangar-list .inv-head .sort-col.desc .sort-mark,
.prints-list .inv-head .sort-col.desc .sort-mark { border-top: 5px solid currentColor; }
.hangar-list .inv-head .sort-col.asc .sort-mark,
.prints-list .inv-head .sort-col.asc .sort-mark { border-bottom: 5px solid currentColor; }
.orders-list .qty .sub { font-size: 11px; color: var(--text-faint); font-weight: 500; }
.orders-list .side { text-align: left; }
.appraisal-list .inv-head { grid-template-columns: minmax(0, 1fr) minmax(4.4rem, auto) minmax(5.2rem, auto) minmax(6.2rem, auto) minmax(6.2rem, auto) minmax(6.2rem, auto); }
.appraisal-list .inv-row { grid-template-columns: 32px minmax(0, 1fr) minmax(4.4rem, auto) minmax(5.2rem, auto) minmax(6.2rem, auto) minmax(6.2rem, auto) minmax(6.2rem, auto); }
.appraisal-list .inv-head .vol, .appraisal-list .inv-head .buy, .appraisal-list .inv-head .sell, .appraisal-list .inv-head .split,
.appraisal-list .vol, .appraisal-list .buy, .appraisal-list .sell, .appraisal-list .split { text-align: right; }
.appraisal-list .inv-row { cursor: default; }
.appraisal .controls { margin-top: 10px; }
.lp-store-pick { flex: 1 1 240px; max-width: 360px; z-index: 5; }
.lp-search { flex: 1 1 200px; max-width: 280px; }
.lp-rate { flex: 0 1 132px; width: 132px; }
.lp-list .inv-head,
.lp-list .inv-row {
  gap: 12px;
  grid-template-columns: 32px minmax(0, 1.4fr) 3.2rem 7rem 9.6rem minmax(0, 1fr);
}
.lp-list .inv-head { padding-left: 8px; }
.lp-list .inv-row {
  cursor: default;
  padding-top: 7px;
  padding-bottom: 7px;
}
.lp-list.has-ak .inv-head,
.lp-list.has-ak .inv-row {
  grid-template-columns: 32px minmax(0, 1.4fr) 3.2rem 7rem 9.6rem 4.4rem minmax(0, 1fr);
}
.lp-list.has-rate .inv-head,
.lp-list.has-rate .inv-row {
  grid-template-columns: 32px minmax(0, 1.4fr) 3.2rem 7rem 9.6rem 9.6rem minmax(0, 1fr);
}
.lp-list.has-ak.has-rate .inv-head,
.lp-list.has-ak.has-rate .inv-row {
  grid-template-columns: 32px minmax(0, 1.4fr) 3.2rem 7rem 9.6rem 4.4rem 9.6rem minmax(0, 1fr);
}
.lp-list .inv-head .sort-col {
  border: 0; background: transparent; color: inherit;
  font: inherit; letter-spacing: inherit; font-weight: inherit;
  text-transform: inherit; cursor: pointer; padding: 0;
  display: inline-flex; align-items: center; gap: 5px;
  width: 100%; min-width: 0;
}
.lp-list .inv-head .sort-col.name,
.lp-list .inv-head .sort-col.need { justify-content: flex-start; }
.lp-list .inv-head .sort-col.qty,
.lp-list .inv-head .sort-col.lp,
.lp-list .inv-head .sort-col.isk,
.lp-list .inv-head .sort-col.ak,
.lp-list .inv-head .sort-col.paid { justify-content: flex-end; }
.lp-list .inv-head .sort-col:hover,
.lp-list .inv-head .sort-col.on { color: var(--text); }
.lp-list .inv-head .sort-mark {
  width: 0; height: 0; flex: none;
  border-left: 4px solid transparent;
  border-right: 4px solid transparent;
}
.lp-list .inv-head .sort-col.desc .sort-mark { border-top: 5px solid currentColor; }
.lp-list .inv-head .sort-col.asc .sort-mark { border-bottom: 5px solid currentColor; }
.lp-list .inv-row > * { min-width: 0; }
.lp-list .qty, .lp-list .lp, .lp-list .isk, .lp-list .ak, .lp-list .paid {
  text-align: right;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
  overflow: hidden;
}
.lp-list .need {
  display: grid;
  gap: 3px;
  align-content: start;
  font-size: 12.5px; color: var(--text-dim); line-height: 1.35; min-width: 0;
}
.lp-list .need-line {
  display: grid;
  grid-template-columns: 3.2rem minmax(0, 1fr);
  gap: 8px;
  align-items: baseline;
  min-width: 0;
}
.lp-list .need-qty {
  text-align: right;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}
.lp-list .need-name {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
html.tight .lp-list .inv-head,
html.tight .lp-list .inv-row {
  grid-template-columns: 32px minmax(0, 1.3fr) 7rem minmax(0, 1fr);
}
html.tight .lp-list.has-rate .inv-head,
html.tight .lp-list.has-rate .inv-row {
  grid-template-columns: 32px minmax(0, 1.3fr) 7rem 9.6rem minmax(0, 1fr);
}
html.tight .lp-list .qty,
html.tight .lp-list .isk,
html.tight .lp-list .ak { display: none; }
.inv-row {
  width: 100%;
  border: 0;
  background: transparent;
  color: inherit;
  font: inherit;
  text-align: left;
  padding: 8px;
  border-bottom: 1px solid rgba(126, 152, 190, 0.08);
  cursor: pointer;
}
.inv-row:hover { background: rgba(126, 152, 190, 0.07); }
.inv-row .inv-main { min-width: 0; overflow: hidden; }
.inv-row .name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.inv-row .sub { color: var(--text-faint); font-size: 11.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.inv-row .qty-inline { color: var(--text-faint); font-weight: 500; }
.icon-bp { border-radius: 4px; background: rgba(20, 28, 40, 0.6); }
.sec {
  display: inline-block;
  min-width: 2.1em;
  text-align: center;
  font-variant-numeric: tabular-nums;
  font-size: 11px;
  font-weight: 650;
  letter-spacing: 0.02em;
}
.sec.hs { color: var(--good); }
.sec.ls { color: var(--warn); }
.sec.ns { color: var(--bad); }
.panel.sheet-body .empty { padding: 36px 18px; }
.inv-foot {
  padding: 8px 12px; color: var(--text-faint); font-size: 12px;
  border-top: 1px solid var(--line);
}

html.tight .hangar-list .inv-head { grid-template-columns: minmax(0, 1fr) minmax(5.4rem, auto) minmax(5.6rem, auto); }
html.tight .hangar-list .inv-row { grid-template-columns: 32px minmax(0, 1fr) minmax(5.4rem, auto) minmax(5.6rem, auto); }
html.tight .hangar-list .unit { display: none; }
html.tight .orders-list .inv-head { grid-template-columns: minmax(0, 1fr) minmax(3.6rem, auto) minmax(5.2rem, auto) minmax(5.8rem, auto); }
html.tight .orders-list .inv-row { grid-template-columns: 32px minmax(0, 1fr) minmax(3.6rem, auto) minmax(5.2rem, auto) minmax(5.8rem, auto); }
html.tight .orders-list .unit { display: none; }
html.tight .appraisal-list .inv-head { grid-template-columns: minmax(0, 1fr) minmax(4.4rem, auto) minmax(6.2rem, auto) minmax(6.2rem, auto); }
html.tight .appraisal-list .inv-row { grid-template-columns: 32px minmax(0, 1fr) minmax(4.4rem, auto) minmax(6.2rem, auto) minmax(6.2rem, auto); }
html.tight .appraisal-list .vol, html.tight .appraisal-list .split { display: none; }
html.tight .prints-list .inv-head { grid-template-columns: minmax(0, 1fr) minmax(3.6rem, auto) minmax(4.2rem, auto); }
html.tight .prints-list .inv-row { grid-template-columns: 32px minmax(0, 1fr) minmax(3.6rem, auto) minmax(4.2rem, auto); }
html.tight .prints-list .me { display: none; }
html.tight .inv-head { padding-left: 45px; }

.watch-tools { gap: 10px 12px; }
.watch-tools .watch-pick {
  flex: 0 1 180px;
  width: 180px;
  max-width: 220px;
}
.watch-tools .watch-hub {
  flex: 0 0 128px;
  width: 128px;
  max-width: 148px;
}
.watch-tools .watch-avg {
  flex: 0 0 auto;
  width: auto;
  max-width: none;
}
.watch-tools .watch-avg .seg {
  height: 32px;
}
.watch-tools .watch-avg .seg button {
  padding: 6px 9px;
  min-width: 2.15rem;
}
.watch-tools .searchbox.watch-pick {
  flex: 1 1 200px;
  width: auto;
  max-width: 320px;
}
.watch-tools > .chip {
  flex: 0 0 auto;
  margin-left: auto;
  align-self: flex-end;
  white-space: nowrap;
}
.watch-tools .watch-pick input,
.watch-tools .watch-pick select {
  padding: 6px 9px;
  font-size: 13px;
}
.watch-filter-wrap {
  position: relative;
  z-index: 4;
  flex: 0 0 auto;
}
.watch-filter-btn {
  padding: 6px 11px;
  font-size: 13px;
}
.watch-filter-btn.on {
  border-color: rgba(214, 220, 228, 0.45);
  background: rgba(214, 220, 228, 0.12);
}
.watch-filter-btn b {
  min-width: 1.35em;
  padding: 0 6px;
  border-radius: 999px;
  background: rgba(214, 220, 228, 0.2);
  color: var(--text);
  font-size: 11.5px;
  font-weight: 600;
  text-align: center;
}
.watch-filter-pop {
  position: absolute;
  z-index: 40;
  top: calc(100% + 8px);
  left: 0;
  width: min(320px, calc(100vw - 40px));
  background: var(--panel-solid);
  border: 1px solid var(--line-strong);
  border-radius: 12px;
  box-shadow: var(--shadow);
  padding: 12px 14px;
  animation: rise 0.18s var(--ease);
}
.watch-filter-pop[hidden] { display: none; }
.watch-filter-body {
  display: grid;
  gap: 12px;
  max-height: min(70vh, 560px);
  overflow-y: auto;
  padding-right: 4px;
}
.watch-filter-group { display: grid; gap: 2px; }
.watch-filter-group h4 {
  margin: 0 0 4px;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: var(--text-faint);
}
.watch-check {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 4px 2px;
  cursor: pointer;
  color: var(--text-dim);
}
.watch-check:hover { color: var(--text); }
.watch-check input {
  appearance: none;
  width: 16px;
  height: 16px;
  flex: 0 0 16px;
  border-radius: 4px;
  border: 1px solid var(--line-strong);
  background: var(--panel);
  position: relative;
}
.watch-check input:checked {
  background: rgba(214, 220, 228, 0.22);
  border-color: var(--bone);
}
.watch-check input:checked::after {
  content: "";
  position: absolute;
  left: 4px;
  top: 1px;
  width: 5px;
  height: 8px;
  border-right: 2px solid var(--bone);
  border-bottom: 2px solid var(--bone);
  transform: rotate(40deg);
}
.watch-filter-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 12px;
  padding-top: 10px;
  border-top: 1px solid var(--line);
}
html.tight .watch-tools .watch-pick,
html.tight .watch-tools .searchbox.watch-pick {
  flex: 1 1 140px;
  width: auto;
  max-width: none;
}
.watch-list .inv-head,
.watch-list .inv-row {
  grid-template-columns: 2.2rem 32px minmax(8rem, 1.4fr) minmax(11.2rem, 1fr) minmax(11.2rem, 1fr) minmax(11.2rem, 1fr) 5.8rem minmax(10.8rem, 1fr);
}
.watch-list .inv-row.on { background: rgba(214, 220, 228, 0.08); }
.watch-list .inv-head { padding: 6px 8px 8px; }
.watch-list .rank { text-align: center; }
.watch-list .cost, .watch-list .sell, .watch-list .profit,
.watch-list .margin, .watch-list .rate {
  text-align: right;
  white-space: nowrap;
}
.watch-list .inv-head .sort-col {
  border: 0; background: transparent; color: inherit;
  font: inherit; letter-spacing: inherit; font-weight: inherit;
  text-transform: inherit; cursor: pointer; padding: 0;
  display: inline-flex; align-items: center; gap: 5px;
  width: 100%; min-width: 0;
}
.watch-list .inv-head .sort-col.name { justify-content: flex-start; }
.watch-list .inv-head .sort-col.cost,
.watch-list .inv-head .sort-col.sell,
.watch-list .inv-head .sort-col.profit,
.watch-list .inv-head .sort-col.margin,
.watch-list .inv-head .sort-col.rate { justify-content: flex-end; }
.watch-list .inv-head .sort-col:hover { color: var(--text); }
.watch-list .inv-head .sort-col.on { color: var(--text); }
.watch-list .inv-head .sort-mark {
  width: 0; height: 0; flex: none;
  border-left: 4px solid transparent;
  border-right: 4px solid transparent;
}
.watch-list .inv-head .sort-col.desc .sort-mark { border-top: 5px solid currentColor; }
.watch-list .inv-head .sort-col.asc .sort-mark { border-bottom: 5px solid currentColor; }
html.tight .watch-list .inv-head,
html.tight .watch-list .inv-row {
  grid-template-columns: 2.2rem 32px minmax(8rem, 1.4fr) minmax(11.2rem, 1fr) minmax(11.2rem, 1fr) 5.8rem minmax(10.8rem, 1fr);
}
html.tight .watch-list .inv-head { padding: 6px 8px 8px; }
html.tight .watch-list .cost { display: none; }
.watch-pager {
  display: flex;
  justify-content: center;
  gap: 6px;
  padding: 12px 8px 4px;
}
.watch-pager .btn { min-width: 2.2rem; }

.saved-list .inv-head {
  grid-template-columns: minmax(0, 1fr) auto;
  padding-left: 45px;
}
.saved-list .inv-row {
  grid-template-columns: 32px minmax(0, 1fr) auto;
  cursor: default;
}
.saved-actions {
  display: flex;
  gap: 6px;
  justify-content: flex-end;
  flex-wrap: wrap;
}
html.tight .saved-list .inv-head { padding-left: 45px; }
html.tight .saved-actions .btn { padding: 5px 8px; }

.contracts-list .inv-head,
.contracts-list .inv-row {
  grid-template-columns: minmax(0, 1.35fr) minmax(4.8rem, auto) minmax(4.6rem, auto) minmax(4.2rem, auto) minmax(0, 1fr) minmax(6.4rem, auto);
}
.contracts-list .inv-row {
  grid-template-columns: 32px minmax(0, 1.35fr) minmax(4.8rem, auto) minmax(4.6rem, auto) minmax(4.2rem, auto) minmax(0, 1fr) minmax(6.4rem, auto);
  cursor: default;
}
.contracts-list .me, .contracts-list .runs, .contracts-list .price { text-align: right; }
.contracts-list .loc { min-width: 0; overflow: hidden; }
.contracts-list .kind { display: flex; flex-wrap: wrap; gap: 4px; justify-content: flex-end; }
.contracts-list .inv-head .sort-col {
  border: 0; background: transparent; color: inherit;
  font: inherit; letter-spacing: inherit; font-weight: inherit;
  text-transform: inherit; cursor: pointer; padding: 0;
  display: inline-flex; align-items: center; gap: 5px;
  width: 100%; min-width: 0;
}
.contracts-list .inv-head .sort-col.name,
.contracts-list .inv-head .sort-col.loc { justify-content: flex-start; }
.contracts-list .inv-head .sort-col.kind,
.contracts-list .inv-head .sort-col.me,
.contracts-list .inv-head .sort-col.runs,
.contracts-list .inv-head .sort-col.price { justify-content: flex-end; }
.contracts-list .inv-head .sort-col:hover { color: var(--text); }
.contracts-list .inv-head .sort-col.on { color: var(--text); }
.contracts-list .inv-head .sort-mark {
  width: 0; height: 0; flex: none;
  border-left: 4px solid transparent;
  border-right: 4px solid transparent;
}
.contracts-list .inv-head .sort-col.desc .sort-mark { border-top: 5px solid currentColor; }
.contracts-list .inv-head .sort-col.asc .sort-mark { border-bottom: 5px solid currentColor; }
html.tight .contracts-list .inv-head,
html.tight .contracts-list .inv-row {
  grid-template-columns: minmax(0, 1fr) minmax(4.6rem, auto) minmax(4.2rem, auto) minmax(6.2rem, auto);
}
html.tight .contracts-list .inv-row {
  grid-template-columns: 32px minmax(0, 1fr) minmax(4.6rem, auto) minmax(4.2rem, auto) minmax(6.2rem, auto);
}
html.tight .contracts-list .kind,
html.tight .contracts-list .loc { display: none; }

/* ----------------------------------------------------------------- toasts */

.toasts {
  flex: 2 1 14rem; min-width: 0; z-index: 80;
  display: flex; justify-content: center; align-items: center; gap: 8px;
}
.toast {
  background: var(--panel-solid); border: 1px solid var(--line-strong); border-left: 3px solid var(--bone);
  border-radius: 10px; padding: 7px 12px; max-width: 100%;
  font-size: 12.5px; line-height: 1.35;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  animation: toastIn 0.18s var(--ease);
}
.toast.good { border-left-color: var(--good); }
.toast.bad { border-left-color: var(--bad); }
.toast.clickable { cursor: pointer; }
.toast.clickable:hover { border-color: var(--bone); background: rgba(214, 220, 228, 0.08); }
.toast.out { animation: toastOut 0.16s var(--ease) forwards; }
@keyframes toastIn { from { opacity: 0; } }
@keyframes toastOut { to { opacity: 0; } }

/* ----------------------------------------------------------------- dialog */

.ask {
  position: fixed; inset: 0; z-index: 90;
  display: grid; place-items: center;
  padding: 24px;
  background: color-mix(in srgb, var(--bg) 78%, transparent);
  backdrop-filter: blur(8px);
}
.ask-card {
  width: min(420px, 100%);
  background: var(--panel-solid);
  border: 1px solid var(--line-strong);
  border-left: 3px solid var(--bone);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 18px 20px 16px;
}
.ask-card.danger { border-left-color: var(--bad); }
.ask-head { display: flex; align-items: flex-start; gap: 12px; }
.ask-face {
  width: 44px; height: 44px; border-radius: 10px; flex: none;
  object-fit: cover; background: var(--bg-2);
}
.ask-copy { min-width: 0; flex: 1; }
.ask-card h3 { font-size: 16px; line-height: 1.3; overflow-wrap: anywhere; }
.ask-card p { color: var(--text-dim); font-size: 13.5px; line-height: 1.45; margin-top: 6px; }
.ask-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 16px; }

/* --------------------------------------------------------------- specials */

.hero {
  display: flex; align-items: center; gap: 16px; padding: 16px 18px; border-radius: var(--radius);
  border: 1px solid var(--line); background:
    linear-gradient(120deg, rgba(214, 220, 228, 0.1), transparent 60%), var(--panel);
  min-width: 0; flex-wrap: wrap;
}
.hero img { width: 64px; height: 64px; border-radius: 10px; flex: none; }
.hero .name { font-size: 18px; font-weight: 600; line-height: 1.3; }
.hero .meta { color: var(--text-dim); font-size: 12.5px; overflow-wrap: anywhere; }
.hero .spacer { margin-left: auto; }

.rowlist { display: grid; gap: 8px; }
.rowlist .item {
  display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: 10px;
  border: 1px solid var(--line); background: rgba(126,152,190,0.05);
}
.rowlist .item .spacer { margin-left: auto; }

.note { padding: 9px 12px; border-radius: 10px; font-size: 12.5px; border: 1px solid var(--line); color: var(--text-dim); }
.note.warn { border-color: rgba(255,181,69,0.35); background: rgba(255,181,69,0.08); color: var(--text); }

.shop-list { min-width: 0; }
.shop-metrics { margin-bottom: 16px; }
.ore-panel { margin-top: 16px; }
.ore-lead { margin: 0 0 12px; }
.shop-group { margin-top: 16px; }
.shop-group:first-child { margin-top: 0; }
.shop-group-head {
  display: flex; justify-content: space-between; gap: 12px; align-items: baseline;
  font-size: 12px; font-weight: 600; letter-spacing: 0.02em;
  padding: 0 0 8px; color: var(--text);
}
.shop-head, .shop-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(6.2rem, auto) minmax(5.2rem, auto) minmax(5.8rem, auto);
  gap: 8px;
  align-items: center;
  min-width: 0;
}
.shop-head {
  color: var(--text-faint); font-size: 11px; text-transform: uppercase; letter-spacing: 0.07em;
  font-weight: 600; padding: 0 0 8px; border-bottom: 1px solid var(--line);
}
.shop-head .qty, .shop-head .unit, .shop-head .spend,
.shop-row .qty, .shop-row .unit, .shop-row .spend { text-align: right; }
.shop-row {
  padding: 8px 0;
  border-bottom: 1px solid rgba(126, 152, 190, 0.08);
}
.shop-row .qty {
  font-size: 13.5px; font-weight: 600; color: var(--text);
}
.shop-row .qty, .shop-row .unit, .shop-row .spend { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

html.tight .shop-head,
html.tight .shop-row { grid-template-columns: minmax(0, 1fr) minmax(5.6rem, auto) minmax(5.2rem, auto); }
html.tight .shop-list .unit { display: none; }
@container (max-width: 460px) {
  .shop-head, .shop-row { grid-template-columns: minmax(0, 1fr) minmax(5.6rem, auto) minmax(5.2rem, auto); }
  .shop-list .unit { display: none; }
}

.fac-row { display: flex; gap: 10px; padding: 12px 0; border-bottom: 1px solid var(--line); align-items: flex-start; }
.fac-row .actions { display: flex; gap: 6px; flex: none; }
.fac-row .tags { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 6px; }
.rig-slots {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 10px 16px;
  width: 100%;
  margin-top: 4px;
}
.rig-slots .field { width: 100%; min-width: 0; }
.rig-slots select { width: 100%; max-width: 100%; }

.tabs {
  display: flex; flex-wrap: wrap; gap: 2px;
  margin-top: 16px; border-bottom: 1px solid var(--line);
}
.subtabs {
  display: flex; flex-wrap: wrap; gap: 2px;
  margin: 4px 0 12px; border-bottom: 1px solid var(--line);
}
.tab {
  border: 0; background: transparent; color: var(--text-dim);
  padding: 9px 12px 10px; cursor: pointer;
  border-bottom: 2px solid transparent; margin-bottom: -1px;
  white-space: nowrap;
}
.tab:hover { color: var(--text); }
.tab.on { color: var(--text); border-bottom-color: var(--bone); }
.tab .count {
  display: inline-block; margin-left: 6px; color: var(--text-faint);
  font-size: 11px; font-variant-numeric: tabular-nums;
}
.tab-pane { margin-top: 14px; }
.tab-pane.hide { display: none; }
.job-list { display: grid; gap: 10px; }
.job-card {
  border: 1px solid var(--line); border-radius: 10px;
  padding: 8px 10px 10px; background: rgba(126,152,190,0.04);
}
.job-card .item { display: flex; align-items: center; gap: 10px; }
.job-card .item .spacer { margin-left: auto; }
.job-inputs {
  margin-top: 8px; display: grid; gap: 4px;
  padding: 8px 0 0 40px; border-top: 1px solid var(--line);
}
.job-inputs .in {
  display: flex; align-items: center; gap: 8px;
  font-size: 12.5px; color: var(--text-dim);
}
.job-inputs .in .icon-type { width: 22px; height: 22px; }
.ico-gap { width: 28px; display: grid; place-items: center; flex: none; color: var(--text-faint); }

.installs { margin-top: 2px; }
.install-toolbar {
  display: flex; align-items: flex-end; justify-content: space-between; gap: 12px;
  margin-bottom: 10px;
}
.install-toolbar .install-meta { margin-bottom: 6px; }
.install-toolbar .install-pilot { margin: 0; }
.btn.small.on {
  border-color: rgba(214, 220, 228, 0.45);
  background: rgba(214, 220, 228, 0.16);
}
.install-meta {
  font-size: 11px; letter-spacing: 0.12em; text-transform: uppercase;
  color: var(--text-faint); font-weight: 600; margin-bottom: 8px;
}
.install-pilot {
  font-size: 22px; font-weight: 650; letter-spacing: -0.02em;
  margin: 0 0 10px;
}
.install-group {
  width: 100%;
  display: flex; align-items: baseline; gap: 16px;
  text-align: left; color: inherit;
  background: transparent; border: 0; border-bottom: 1px solid var(--line);
  border-radius: 0; padding: 13px 4px;
  cursor: pointer;
}
.install-group:hover, .install-group.open { background: rgba(126, 152, 190, 0.06); }
.install-group .ig-name { font-weight: 600; font-size: 14.5px; }
.install-group .ig-metrics {
  margin-left: auto; display: flex; gap: 18px;
  color: var(--text-dim); font-size: 12.5px; font-variant-numeric: tabular-nums;
  white-space: nowrap;
}
.install-section {
  display: flex; justify-content: space-between; align-items: baseline; gap: 12px;
  margin: 2px 0 8px; font-weight: 600;
}
.install-section .faint { font-weight: 500; font-size: 12.5px; }
.install-note {
  margin: 0 4px 8px; font-size: 12.5px; color: var(--text-dim);
}
.install-table { padding: 4px 0 12px; }
.install-head, .install-row, .install-formula-row {
  display: grid;
  grid-template-columns: 22px 18px 28px minmax(0, 1fr) minmax(4.4rem, auto) minmax(4.4rem, auto) minmax(6.2rem, auto) minmax(3.6rem, auto);
  gap: 10px; align-items: center;
}
.install-head {
  padding: 6px 8px 8px;
  color: var(--text-faint); font-size: 11px; text-transform: uppercase;
  letter-spacing: 0.07em; font-weight: 600; border-bottom: 1px solid var(--line);
}
.install-head .num, .install-row .num { text-align: right; font-variant-numeric: tabular-nums; }
.install-job { border-bottom: 1px solid rgba(126, 152, 190, 0.08); }
.install-row {
  width: 100%;
  background: transparent; border: 0; color: inherit;
  padding: 9px 8px; cursor: pointer; text-align: left; border-radius: 8px;
}
.install-row:hover, .install-formula-row:hover { background: rgba(126, 152, 190, 0.07); }
.install-formula { margin: 0; }
.install-formula.open > .install-formula-row { background: rgba(126, 152, 190, 0.06); }
.install-formula.open > .install-formula-row .ig-twist { transform: rotate(-180deg); color: var(--bone); }
.install-formula-row {
  width: 100%;
  background: transparent; border: 0; color: inherit;
  padding: 9px 8px; cursor: pointer; text-align: left; border-radius: 8px;
}
.install-formula-row .ig-gap { width: 22px; }
.install-formula-row .ig-twist {
  display: grid; place-items: center; color: var(--text-faint);
  transition: transform 0.16s var(--ease);
}
.install-formula-row .ig-item { min-width: 0; display: grid; }
.install-formula-row .ig-item .name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.install-formula-body {
  margin: 0 0 4px 18px;
  padding: 0 0 2px 10px;
  border-left: 1px solid var(--line);
}
.install-job.open .install-row { background: rgba(126, 152, 190, 0.08); }
.install-row .ig-twist {
  display: grid; place-items: center; color: var(--text-faint);
  transition: transform 0.16s var(--ease);
  pointer-events: none;
}
.install-row .ig-twist, .install-row .ig-twist * { pointer-events: none; }
.install-job.open .ig-twist { transform: rotate(-180deg); color: var(--bone); }
.install-row .ig-item { min-width: 0; display: grid; }
.install-row .ig-item .name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.install-row .ig-item .sub { color: var(--text-faint); font-size: 11.5px; }
.install-row .num { font-size: 13px; }
.install-how {
  padding: 4px 8px 12px 56px;
}
.how-head {
  display: flex; justify-content: space-between; gap: 12px;
  font-size: 11px; text-transform: uppercase; letter-spacing: 0.06em;
  color: var(--text-faint); font-weight: 600; margin-bottom: 6px;
}
.how-in {
  display: flex; align-items: center; gap: 10px;
  padding: 5px 0; color: var(--text-dim);
}
.how-in .icon-type { width: 22px; height: 22px; }
.how-in .name { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.how-in .num {
  margin-left: auto; font-variant-numeric: tabular-nums;
  font-size: 13.5px; font-weight: 600; color: var(--text);
  display: flex; align-items: baseline; gap: 6px;
}
.how-in .num .faint { font-size: 12px; font-weight: 500; }

html.tight .install-head,
html.tight .install-row,
html.tight .install-formula-row { grid-template-columns: 22px 18px 28px minmax(0, 1fr) minmax(4.2rem, auto) minmax(5.4rem, auto) minmax(3.4rem, auto); }
html.tight .install-head span:nth-child(6),
html.tight .install-row .num.days { display: none; }

html.narrow {
  --rail: 72px;
}
html.narrow .rail { padding: 12px 8px; align-items: stretch; }
html.narrow .brand { justify-content: center; padding: 6px 0 14px; }
html.narrow .brand-text,
html.narrow .rail-label,
html.narrow .rail-kicker { display: none; }
html.narrow .rail-link { justify-content: center; padding: 10px 8px; }
html.narrow .btn kbd { display: none; }

html.narrow .characters { grid-template-columns: 1fr; }

html.narrow .chip-label { display: none; }
html.narrow .chip { padding: 6px; gap: 0; }
html.narrow #updateBtn:not(.update-ready) .btn-text { display: none; }
html.narrow #updateBtn:not(.update-ready) { padding: 8px 10px; }
html.tight #updateBtn .btn-text { display: none; }
html.tight #updateBtn { padding: 8px 10px; }
html.tight .tree-row {
  grid-template-columns: minmax(0, 1fr) minmax(48px, 0.35fr) minmax(64px, 0.45fr);
}
html.tight .tree-row .col.me,
html.tight .tree-row .col.time { display: none; }
html.tight .page-scroll { padding: 14px 12px 36px; }
html.tight .topbar { padding: 10px 12px; min-height: 52px; }
html.tight .toasts { flex-basis: 8rem; }
html.tight .toast { font-size: 12px; padding: 6px 10px; }
html.tight .metric .value { font-size: clamp(13px, 2.2vw, 17px); }

.home, .wallet { display: grid; gap: 14px; align-content: start; }
.home .panel { padding: 14px 16px; }
.home-list { display: grid; }
.home-list.compact { margin-top: 8px; }
.home-row {
  display: grid;
  grid-template-columns: 32px minmax(0, 1fr) auto;
  gap: 10px;
  align-items: center;
  width: 100%;
  border: 0;
  background: transparent;
  color: inherit;
  font: inherit;
  text-align: left;
  padding: 8px 4px;
  border-bottom: 1px solid rgba(126, 152, 190, 0.08);
  cursor: pointer;
}
.home-row:hover { background: rgba(126, 152, 190, 0.07); }
.home-row:last-child { border-bottom: 0; }
.home-eta { text-align: right; min-width: 4.8rem; }
.home-eta .home-bar { margin-top: 5px; }
.home-bar {
  height: 5px;
  border-radius: 99px;
  background: rgba(126, 152, 190, 0.14);
  overflow: hidden;
}
.home-bar > i {
  display: block; height: 100%; width: 0;
  background: linear-gradient(90deg, var(--gold), var(--teal));
  border-radius: 99px;
}
.home-bar.mute > i { background: rgba(126, 152, 190, 0.45); }
.slot-meters, .kind-bars { display: grid; gap: 10px; }
.slot-meter.full .home-bar > i { background: var(--gold); }
.slot-meter.idle .home-bar > i { background: var(--good); }

.kind-bar { --kind: #8b9bb4; }
.kind-bar[data-kind="minerals"] { --kind: var(--gold); }
.kind-bar[data-kind="ice"] { --kind: #6ec8e8; }
.kind-bar[data-kind="salvage"] { --kind: #d4a06a; }
.kind-bar[data-kind="pi"] { --kind: var(--teal); }
.kind-bar[data-kind="datacores"] { --kind: var(--violet); }
.kind-bar[data-kind="decryptors"] { --kind: #c9a6ff; }
.kind-bar[data-kind="relics"] { --kind: var(--rose); }
.kind-bar[data-kind="fuel"] { --kind: #ff8a3d; }
.kind-bar[data-kind="components"] { --kind: var(--blue); }
.kind-bar[data-kind="capital_parts"] { --kind: #f0c14b; }
.kind-bar[data-kind="polymers"] { --kind: #f472b6; }
.kind-bar[data-kind="moon_raw"] { --kind: #c084fc; }
.kind-bar[data-kind="moon_intermediate"] { --kind: #67e8f9; }
.kind-bar[data-kind="moon_advanced"] { --kind: #818cf8; }
.kind-bar[data-kind="other"] { --kind: #8b9bb4; }
.kind-bar .home-bar > i {
  background: var(--kind);
  box-shadow: 0 0 10px color-mix(in srgb, var(--kind) 40%, transparent);
}
.kind-bar .mono { color: var(--kind); }
.kind-name::before {
  content: "";
  display: inline-block;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--kind);
  margin-right: 8px;
  vertical-align: 1px;
  box-shadow: 0 0 8px color-mix(in srgb, var(--kind) 55%, transparent);
}
.slot-top {
  display: flex; justify-content: space-between; gap: 10px;
  font-size: 12.5px; margin-bottom: 5px;
}
.home-kicker {
  margin-top: 16px;
  font-size: 11px; text-transform: uppercase; letter-spacing: 0.07em;
  color: var(--text-faint); font-weight: 600;
}
.home-ready { margin-top: 4px; }
.kind-bars + .home-list { margin-top: 12px; }
.home .empty { padding: 18px 8px; }

button.kind-bar {
  width: 100%;
  border: 0;
  background: transparent;
  color: inherit;
  font: inherit;
  text-align: left;
  padding: 0;
  cursor: pointer;
}
button.kind-bar.on .slot-top { color: var(--bone); }

.wallet-journal { table-layout: auto; }
.wallet-journal th, .wallet-journal td { white-space: nowrap; }
.wallet-journal th:last-child, .wallet-journal td:last-child { white-space: normal; }
.wallet-journal th:first-child,
.wallet-journal td:first-child { width: 9.6rem; }
.wallet-journal th:nth-child(2),
.wallet-journal td:nth-child(2) { width: 16%; }
.wallet-journal th:nth-child(3),
.wallet-journal td:nth-child(3),
.wallet-journal th:nth-child(4),
.wallet-journal td:nth-child(4) { width: 8.8rem; }

.wallet-filters { margin-top: 10px; }
.jobs-table { table-layout: auto; }
.jobs-table th:nth-child(3),
.jobs-table td:nth-child(3) { width: 4.2rem; }
.jobs-table th:last-child,
.jobs-table td:last-child { width: 7.2rem; text-align: right; }

.wallet-list { padding: 0; }
.wallet-rows.journal .inv-head,
.wallet-rows.journal .inv-row { grid-template-columns: minmax(0, 1fr) minmax(6.6rem, auto); }
.wallet-rows.journal .inv-head { padding-left: 8px; }
.wallet-rows.market .inv-head,
.wallet-rows.market .inv-row { grid-template-columns: 32px minmax(0, 1fr) minmax(5rem, auto) minmax(6.6rem, auto); }
.inv-row.static { cursor: default; }
.chart-svg { width: 100%; height: auto; display: block; overflow: hidden; }
.chart-grid { stroke: var(--line); stroke-width: 1; }
.chart-tick { fill: var(--text-faint); font-size: 10px; font-variant-numeric: tabular-nums; }
.chart-xlabel { fill: var(--text-faint); font-size: 9px; }
.chart-in { fill: var(--good); opacity: 0.88; }
.chart-out { fill: var(--bad); opacity: 0.88; }
.chart-legend {
  display: flex; gap: 14px; justify-content: flex-end;
  font-size: 11px; margin-top: 8px; color: var(--text-faint);
}
.chart-legend .in { color: var(--good); }
.chart-legend .out { color: var(--bad); }
.cashflow-chart { position: relative; }
.chart-hit { fill: transparent; cursor: crosshair; }
.cash-day.on .chart-in, .cash-day.on .chart-out { opacity: 1; }
.cash-day.on .chart-in { fill: #7af0d8; }
.cash-day.on .chart-out { fill: #f0a0a8; }
.cashflow-chart .cashflow-tip {
  min-width: 12.4rem;
  transform: translate(-50%, 0);
}
.cashflow-chart .cashflow-tip::after { display: none; }
.cashflow-chart .cashflow-tip .good { color: var(--good); }
.cashflow-chart .cashflow-tip .bad { color: var(--bad); }
.type-split { display: grid; gap: 16px; }
.type-split h4 {
  margin: 0 0 8px;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: var(--text-faint);
}
.type-split .hint { color: var(--text-faint); font-size: 12px; margin: 0; }

.install-check {
  display: grid; place-items: center;
  pointer-events: auto;
}
.install-check input { width: 15px; height: 15px; accent-color: var(--bone); cursor: pointer; }
.install-job.installed .name { color: var(--good); }
.choice-list { display: grid; gap: 3px; }
.choice-head, .choice-row {
  display: grid;
  grid-template-columns: 14px minmax(0, 1fr) minmax(7rem, auto) minmax(7rem, auto) minmax(7rem, auto) 8.6rem;
  gap: 10px; align-items: center;
}
.choice-head {
  padding: 6px 8px 8px;
  color: var(--text-faint); font-size: 11px; text-transform: uppercase;
  letter-spacing: 0.07em; font-weight: 600; border-bottom: 1px solid var(--line);
}
.choice-row {
  padding: 7px 8px; border-radius: 8px;
  border-bottom: 1px solid rgba(126, 152, 190, 0.08);
}
.choice-row:hover { background: rgba(126, 152, 190, 0.06); }
.choice-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--text-faint); }
.choice-dot.good { background: var(--good); }
.choice-dot.warn { background: var(--warn); }
.choice-item { display: grid; min-width: 0; }
.choice-item .name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.choice-item .sub { color: var(--text-faint); font-size: 11.5px; }
.choice-seg button { padding: 4px 9px; font-size: 12px; }
.choice-row.building .choice-item .name { color: var(--gold); }

/* The Jobs count carries "how many times to install this", so it is the one thing
   that should stand out when it is more than once. */
.queue-install-row .num.jobs.many { color: var(--gold); font-weight: 650; }
.queue-install-head, .queue-install-row {
  grid-template-columns: 22px 28px minmax(0, 1fr) minmax(4.4rem, auto) minmax(4.4rem, auto) minmax(3.6rem, auto) minmax(5.2rem, auto) !important;
}
.queue-rx-head, .queue-rx-row, .queue-rx-formula {
  grid-template-columns: 22px 18px 28px minmax(0, 1fr) minmax(4.4rem, auto) minmax(4.4rem, auto) minmax(3.6rem, auto) minmax(5.2rem, auto) !important;
}
/* Stacked page: the whole thing scrolls in .page-scroll, so no .sheet here. */
.queue-page, .queue-plan { display: grid; gap: 14px; align-content: start; min-width: 0; }
.queue-plan:empty { display: none; }
.queue-list { display: grid; gap: 4px; }
.queue-head, .queue-row {
  display: grid;
  /* Fixed, not content-sized: these columns hold inputs, which would otherwise
     claim their default intrinsic width. */
  grid-template-columns: 32px minmax(0, 1.4fr) 4.4rem 4.4rem 4rem 4rem minmax(7rem, 1fr) 5.6rem;
  gap: 10px; align-items: center;
}
.queue-head {
  padding: 6px 8px 8px;
  color: var(--text-faint); font-size: 11px; text-transform: uppercase;
  letter-spacing: 0.07em; font-weight: 600; border-bottom: 1px solid var(--line);
}
.queue-row {
  padding: 8px; border-radius: 8px;
  border-bottom: 1px solid rgba(126, 152, 190, 0.08);
}
.queue-row input, .queue-row select {
  width: 100%; min-width: 0;
  background: var(--bg-2); color: var(--text);
  border: 1px solid var(--line); border-radius: 8px; padding: 6px 8px;
}
.research-table { width: 100%; font-size: 13px; }
.research-table th { color: var(--text-faint); font-size: 11px; text-transform: uppercase; letter-spacing: 0.06em; }
.research-table td, .research-table th { padding: 5px 6px; }
.research-table tbody tr:last-child td,
.research-table tbody tr:nth-last-child(2) td { color: var(--text-dim); }

.settings, .factories { display: grid; gap: 14px; align-content: start; max-width: 720px; }
.settings .hint { color: var(--text-faint); font-size: 13px; margin-bottom: 10px; }
.settings .field { margin-bottom: 12px; }
.settings-report .panel-head { margin-bottom: 16px; }
.settings-report .field { gap: 8px; margin-bottom: 16px; }
.settings-report .field > span {
  font-size: 12px;
  letter-spacing: 0.02em;
  text-transform: none;
  color: var(--text-dim);
}
.settings-report textarea {
  min-height: 160px;
  padding: 10px 12px;
  font-size: 14px;
}
.characters {
  display: grid;
  grid-template-columns: minmax(240px, 280px) minmax(0, 1fr);
  gap: 14px;
  align-content: start;
}
.char-roster { align-self: start; }
.pilot-list { display: grid; gap: 8px; }
.pilot-card {
  display: grid;
  grid-template-columns: 48px minmax(0, 1fr);
  gap: 12px;
  align-items: center;
  width: 100%;
  text-align: left;
  padding: 10px 12px;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: transparent;
  color: inherit;
  font: inherit;
  cursor: pointer;
}
.pilot-card:hover { background: rgba(126, 152, 190, 0.08); }
.pilot-card.on {
  border-color: rgba(214, 220, 228, 0.35);
  background: rgba(214, 220, 228, 0.08);
}
.pilot-face {
  width: 48px; height: 48px; border-radius: 10px;
  object-fit: cover; background: rgba(126, 152, 190, 0.1); flex: none;
}
.pilot-main { min-width: 0; }
.pilot-main .name { font-weight: 650; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pilot-slots {
  display: flex; flex-wrap: wrap; gap: 6px;
  font-size: 11px; color: var(--text-faint); margin-top: 5px;
  font-variant-numeric: tabular-nums;
}
.pilot-slots span {
  padding: 1px 6px; border-radius: 5px;
  border: 1px solid var(--line);
}

.char-hero {
  display: grid;
  grid-template-columns: 104px minmax(0, 1fr);
  gap: 16px;
  align-items: center;
  padding-bottom: 16px;
  margin-bottom: 16px;
  border-bottom: 1px solid var(--line);
}
.char-portrait {
  width: 104px; height: 104px; border-radius: 14px;
  object-fit: cover; flex: none;
  border: 1px solid rgba(214, 220, 228, 0.38);
  box-shadow: 0 0 0 1px rgba(214, 220, 228, 0.12), 0 14px 32px rgba(0, 0, 0, 0.38);
}
.char-id h2 { font-size: 22px; letter-spacing: -0.02em; line-height: 1.2; }
.char-title {
  display: flex; align-items: flex-start; justify-content: space-between; gap: 12px;
}
.char-title h2 { min-width: 0; }
.char-corp {
  display: flex; align-items: center; gap: 8px;
  color: var(--text-dim); margin-top: 6px; min-width: 0;
}
.char-corp img {
  width: 22px; height: 22px; border-radius: 5px;
  background: rgba(126, 152, 190, 0.1); flex: none;
}
.char-corp span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.char-trained {
  margin-top: 8px;
  font-size: 12px;
  color: var(--teal);
  letter-spacing: 0.01em;
}

.char-stats {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 10px;
  margin-bottom: 18px;
}
.char-stat { padding: 12px 13px; }
.char-stat .value { font-size: 20px; }

.skill-board {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 8px 28px;
}
.skill-group { min-width: 0; padding-top: 8px; }
.skill-kicker {
  display: flex; align-items: baseline; justify-content: space-between; gap: 10px;
  font-size: 11px; font-weight: 650; text-transform: uppercase; letter-spacing: 0.08em;
  color: var(--text-faint);
  padding-bottom: 6px;
  border-bottom: 1px solid var(--line);
}
.skill-kicker .hint { font-weight: 500; text-transform: none; letter-spacing: 0; }
.skill-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto minmax(3.6rem, auto);
  gap: 10px;
  align-items: center;
  padding: 8px 0;
  border-bottom: 1px solid rgba(126, 152, 190, 0.08);
}
.skill-copy { min-width: 0; }
.skill-copy .name { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.skill-level {
  display: flex; align-items: center; gap: 8px; flex: none;
}
.pips { display: flex; gap: 3px; }
.pips i {
  width: 7px; height: 7px; border-radius: 50%;
  background: rgba(126, 152, 190, 0.2);
  box-shadow: inset 0 0 0 1px var(--line);
}
.pips i.on {
  background: var(--gold);
  box-shadow: 0 0 7px rgba(255, 181, 69, 0.4);
}
.skill-row.maxed .pips i.on {
  background: var(--teal);
  box-shadow: 0 0 7px rgba(77, 225, 193, 0.4);
}
.roman {
  font-size: 12px; font-weight: 700; letter-spacing: 0.04em;
  color: var(--text-dim); min-width: 1.15em; text-align: right;
  font-variant-numeric: tabular-nums;
}
.skill-row.maxed .roman { color: var(--teal); }
.skill-val {
  font-variant-numeric: tabular-nums;
  font-weight: 650;
  color: var(--gold);
  text-align: right;
  white-space: nowrap;
}
.skill-row.maxed .skill-val { color: var(--teal); }
.skill-row.zero { opacity: 0.48; }
.skill-row.zero .skill-val { color: var(--text-faint); }

.projects-page { display: grid; gap: 14px; align-content: start; min-width: 0; }
.projects-page .empty .btn { margin-top: 12px; }
.proj-toolbar {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 12px;
}
.proj-toolbar .tabs { flex: 1; min-width: 0; margin-top: 0; }
.proj-toolbar [data-drop-all] { flex: none; margin-bottom: 6px; }
.proj { border-bottom: 1px solid rgba(126, 152, 190, 0.1); }
.proj:last-child { border-bottom: 0; }
.proj-row {
  display: grid;
  grid-template-columns: 18px 28px minmax(0, 1.3fr) minmax(8rem, 0.9fr) auto auto;
  gap: 10px;
  align-items: center;
  padding: 10px 8px;
  cursor: pointer;
  border-radius: 8px;
}
.proj-row:hover { background: rgba(126, 152, 190, 0.07); }
.proj.open .proj-row { background: rgba(126, 152, 190, 0.08); }
.proj.open > .proj-row .ig-twist { transform: rotate(-180deg); color: var(--bone); }
.proj-id { min-width: 0; display: grid; }
.proj-name {
  width: 100%;
  background: transparent;
  border: 1px solid transparent;
  color: inherit;
  font: inherit;
  font-weight: 600;
  padding: 2px 6px;
  border-radius: 8px;
}
.proj-name:hover, .proj-name:focus { border-color: var(--line-strong); background: var(--bg-2); }
.proj-meter { min-width: 0; text-align: right; }
.proj-bar { height: 5px; border-radius: 99px; background: rgba(126, 152, 190, 0.14); margin-top: 5px; overflow: hidden; }
.proj-bar .fill {
  flex: none;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--gold), var(--teal));
  transition: width 1s linear;
}
.proj-bar .fill.ready { background: var(--good); }
.proj-job-bar { height: 4px; margin: 0 0 4px; }
.proj-meter .remain { font-variant-numeric: tabular-nums; color: var(--text); }
.proj-meter .sub { color: var(--text-faint); font-size: 11.5px; }
.proj-body { padding: 4px 8px 14px 28px; }
.proj-cat { margin: 2px 0 6px; }
.proj-cat-row {
  display: grid;
  grid-template-columns: 18px minmax(0, 1fr) minmax(8rem, 0.9fr);
  gap: 10px;
  align-items: center;
  padding: 8px 4px;
  cursor: pointer;
  border-radius: 8px;
}
.proj-cat-row:hover { background: rgba(126, 152, 190, 0.07); }
.proj-cat.open .proj-cat-row { background: rgba(126, 152, 190, 0.06); }
.proj-cat.open > .proj-cat-row .ig-twist { transform: rotate(-180deg); color: var(--bone); }
.proj-cat-id { font-weight: 600; min-width: 0; }
.proj-cat-body { padding: 2px 0 8px 8px; }
.proj-formula { margin: 0; }
.proj-formula-row { cursor: pointer; }
.proj-formula-row:hover { background: rgba(126, 152, 190, 0.07); }
.proj-formula.open > .proj-formula-row { background: rgba(126, 152, 190, 0.06); }
.proj-formula.open > .proj-formula-row .ig-twist { transform: rotate(-180deg); color: var(--bone); }
.proj-formula.done > .proj-formula-row .name { color: var(--good); }
.proj-formula.running > .proj-formula-row .name { color: var(--gold); }
.proj-formula.skipped { opacity: 0.7; }
.proj-formula-body {
  margin: 0 0 4px 18px;
  padding: 0 0 2px 10px;
  border-left: 1px solid var(--line);
}
.proj-step {
  display: grid;
  grid-template-columns: 18px 28px minmax(0, 1fr) 4.8rem auto;
  gap: 10px;
  align-items: center;
  padding: 7px 4px;
  border-radius: 8px;
  border-bottom: 1px solid rgba(126, 152, 190, 0.08);
}
.proj-formula-row.proj-step {
  grid-template-columns: 18px 28px minmax(0, 1fr) 4.8rem;
}
.proj-step-actions { display: inline-flex; gap: 6px; min-height: 28px; min-width: 7.2rem; }
.proj-step .ig-item { min-width: 0; display: grid; }
.proj-step .ig-item .name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.proj-step .ig-item .sub { color: var(--text-faint); font-size: 11.5px; }
.proj-step .num { text-align: right; font-variant-numeric: tabular-nums; }
.proj-step .num.good { color: var(--good); }
.proj-step.done .name { color: var(--good); }
.proj-step.skipped { opacity: 0.55; }
.proj-step.running .name { color: var(--gold); }
.proj-step-wrap { padding-bottom: 4px; }
.proj-live { display: grid; gap: 2px; padding: 0 4px 6px 56px; }
.proj-live-row .sub { color: var(--text-faint); font-size: 11.5px; }
.proj.is-done .proj-name { color: var(--text-dim); }

html.tight .proj-row {
  grid-template-columns: 18px 28px minmax(0, 1fr) auto;
}
html.tight .proj-row .proj-meter { display: none; }
html.tight .proj-cat-row {
  grid-template-columns: 18px minmax(0, 1fr) minmax(7rem, 0.8fr);
}

html.narrow .proj-row {
  grid-template-columns: 18px minmax(0, 1fr);
}
html.narrow .proj-row .icon-type,
html.narrow .proj-row .proj-meter,
html.narrow .proj-row .btn { display: none; }
html.narrow .proj-body { padding-left: 8px; }
html.narrow .proj-cat-row {
  grid-template-columns: 18px minmax(0, 1fr);
}
html.narrow .proj-cat-row .proj-meter { display: none; }
html.narrow .proj-step {
  grid-template-columns: 18px 28px minmax(0, 1fr);
}
html.narrow .proj-step .num,
html.narrow .proj-step .btn { display: none; }

html.tight .char-stats { grid-template-columns: repeat(3, minmax(0, 1fr)); }
html.tight .skill-board { grid-template-columns: 1fr; }
html.narrow .char-hero { grid-template-columns: 72px minmax(0, 1fr); }
html.narrow .char-portrait { width: 72px; height: 72px; border-radius: 12px; }
html.narrow .char-id h2 { font-size: 18px; }
html.narrow .char-stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
html.narrow .skill-board { grid-template-columns: 1fr; }
html.narrow .skill-row { grid-template-columns: minmax(0, 1fr) auto; }
html.narrow .skill-val { display: none; }

.market-ask {
  position: fixed; inset: 0; z-index: 90;
  display: grid; place-items: center;
  padding: 24px;
  background: color-mix(in srgb, var(--bg) 78%, transparent);
  backdrop-filter: blur(8px);
}
.market-card {
  width: min(820px, 100%);
  max-height: min(92vh, 840px);
  overflow: auto;
  background: var(--panel-solid);
  border: 1px solid var(--line-strong);
  border-left: 3px solid var(--bone);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 16px 20px 16px;
}
.market-head {
  display: flex; align-items: flex-start; justify-content: space-between; gap: 12px;
  padding-bottom: 14px;
  border-bottom: 1px solid var(--line);
}
.market-id { display: flex; align-items: center; gap: 12px; min-width: 0; }
.market-id .icon-type { width: 40px; height: 40px; border-radius: 8px; }
.market-id .name { font-size: 18px; font-weight: 600; line-height: 1.25; }
.market-id .sub { color: var(--text-faint); font-size: 12.5px; margin-top: 2px; }
.market-actions { display: flex; gap: 8px; flex: none; }
.market-card .grid.metrics {
  gap: 0;
  margin: 14px 0 12px;
  background: var(--bg-2);
  border: 1px solid var(--line);
  border-radius: 10px;
  overflow: hidden;
}
html.tight .market-card .grid.metrics.three { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.market-card .metric {
  background: transparent;
  border: 0;
  border-radius: 0;
  padding: 12px 16px;
}
.market-card .metric::after { display: none; }
.market-card .metric + .metric { border-left: 1px solid var(--line); }
.market-card .metric .value { font-size: 17px; letter-spacing: -0.02em; }
.market-chart {
  position: relative;
  margin-top: 2px;
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 8px 6px 2px;
}
.market-chart .chart-svg { min-height: 248px; }
.market-split { stroke: var(--line); stroke-width: 1; }
.market-line-avg { fill: none; stroke: var(--ice); stroke-width: 1.6; }
.market-range { stroke: #d7dde6; stroke-width: 1.4; }
.market-avg-dot { fill: var(--warn); stroke: none; }
.market-vol { fill: #3aa8b8; }
.market-hit { fill: transparent; cursor: crosshair; }
.market-guide { stroke: rgba(255, 255, 255, 0.28); stroke-width: 1; display: none; }
.market-day.on .market-avg-dot { fill: #fff; }
.market-day.on .market-vol { fill: #5ec8d6; }
.market-day.on .market-guide { display: block; }
.market-tip {
  position: absolute;
  transform: translate(-50%, calc(-100% - 10px));
  min-width: 8.4rem;
  padding: 7px 10px 8px;
  background: #050608;
  border: 1px solid rgba(214, 220, 228, 0.55);
  color: #f4f6f8;
  font-size: 12px;
  line-height: 1.4;
  font-variant-numeric: tabular-nums;
  pointer-events: none;
  z-index: 2;
}
.market-tip[hidden] { display: none; }
.market-tip::after {
  content: "";
  position: absolute;
  left: 50%;
  bottom: -5px;
  width: 0; height: 0;
  margin-left: -5px;
  border: 5px solid transparent;
  border-top-color: #050608;
}
.market-tip .when { font-weight: 600; margin-bottom: 4px; letter-spacing: 0.04em; }
.market-tip .row { display: flex; justify-content: space-between; gap: 14px; }
.market-tip .row span:first-child { color: #9aa6b8; }
.market-legend {
  display: flex; gap: 16px; flex-wrap: wrap; align-items: center;
  font-size: 11px; margin: 8px 8px 4px; color: var(--text-faint);
}
.market-legend span { display: inline-flex; align-items: center; gap: 6px; }
.market-legend i {
  width: 8px; height: 8px; border-radius: 2px; display: inline-block; flex: none;
}
.market-legend .avg i { background: var(--warn); }
.market-legend .high i { background: #d7dde6; height: 10px; width: 2px; border-radius: 1px; }
.market-legend .vol i { background: #3aa8b8; }
.market-days-wrap {
  max-height: 240px;
  overflow: auto;
  margin-top: 12px;
}
.market-days {
  width: 100%;
  table-layout: auto;
  margin-top: 0;
  font-variant-numeric: tabular-nums;
}
.market-days th, .market-days td {
  padding: 7px 10px;
  text-align: right;
  border-bottom: 1px solid var(--line);
}
.market-days th:first-child, .market-days td:first-child { text-align: left; }
.market-days th {
  position: sticky;
  top: 0;
  z-index: 1;
  background: var(--panel-solid);
  color: var(--text-faint); font-size: 10px; text-transform: uppercase; letter-spacing: 0.08em;
  padding-top: 0;
}
.market-days td { font-size: 13px; }
.market-days th:nth-child(5),
.market-days td:nth-child(5),
.market-days th:nth-child(6),
.market-days td:nth-child(6) { width: 4.6rem; color: var(--text-dim); }
.market-days td:nth-child(5),
.market-days td:nth-child(6) { color: var(--text-dim); }
.market-days tr.on td { background: rgba(214, 220, 228, 0.08); }
.market-days tr.void td { color: var(--text-faint); }
.market-days .warn { color: var(--warn); }
.market-note { color: var(--text-faint); font-size: 11.5px; margin: 12px 0 0; }

@media (prefers-reduced-motion: reduce) {
  *, *::after, *::before { animation-duration: 0.01ms !important; animation-iteration-count: 1 !important; transition-duration: 0.01ms !important; }
}
