:root {
  --bg: #0b0e13;
  --panel: #131821;
  --panel-2: #1a212c;
  --line: #263041;
  --text: #d8dee9;
  --muted: #8592a6;
  --accent: #e0a84a; /* amber — goo */
  --accent-ink: #1a1206;
  --good: #5cc28a;
  --warn: #e3b341;
  --bad: #e5675f;
  --info: #6aa7e8;
  --radius: 8px;
  --mono: ui-monospace, "Cascadia Mono", "SF Mono", Consolas, monospace;
  color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  background: var(--bg);
  color: var(--text);
  font: 14px/1.45 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  min-height: 100vh;
}
a { color: var(--info); }
h1, h2, h3 { margin: 0; font-weight: 600; }
h2 { font-size: 15px; letter-spacing: .02em; }
.muted { color: var(--muted); }
.small { font-size: 12px; }
.num { font-family: var(--mono); font-variant-numeric: tabular-nums; text-align: right; white-space: nowrap; }
[hidden] { display: none !important; }

/* Header */
.top {
  display: flex; align-items: center; gap: 12px;
  padding: 10px 20px; border-bottom: 1px solid var(--line); background: var(--panel);
  position: sticky; top: 0; z-index: 5;
}
.brand { display: flex; align-items: center; gap: 10px; font-weight: 700; letter-spacing: .04em; }
.brand .dot { width: 10px; height: 10px; border-radius: 50%; background: var(--accent); box-shadow: 0 0 12px var(--accent); }
.top .spacer { flex: 1; }
.who { display: flex; align-items: center; gap: 8px; color: var(--muted); }
.who img { width: 28px; height: 28px; border-radius: 4px; }

/* Layout */
main { max-width: 1240px; margin: 0 auto; padding: 20px 16px 120px; }
.card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; }
.stack > * + * { margin-top: 12px; }
.row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.grid-calc { display: grid; grid-template-columns: 320px 1fr; gap: 16px; align-items: start; }
@media (max-width: 900px) { .grid-calc { grid-template-columns: 1fr; } }
.sticky-side { position: sticky; top: 70px; }
@media (max-width: 900px) { .sticky-side { position: static; } }

/* Controls */
button, .btn {
  font: inherit; cursor: pointer; border-radius: 6px; padding: 7px 14px;
  border: 1px solid var(--line); background: var(--panel-2); color: var(--text); text-decoration: none;
  display: inline-flex; align-items: center; gap: 6px;
}
button:hover, .btn:hover { border-color: #3a475d; }
button:disabled { opacity: .5; cursor: default; }
.btn-primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); font-weight: 600; }
.btn-primary:hover { filter: brightness(1.08); border-color: var(--accent); }
.btn-danger { color: var(--bad); }
.btn-sm { padding: 3px 9px; font-size: 12px; }
input, textarea, select {
  font: inherit; color: var(--text); background: var(--bg); border: 1px solid var(--line);
  border-radius: 6px; padding: 6px 8px;
}
input:focus, textarea:focus { outline: 2px solid color-mix(in srgb, var(--accent) 60%, transparent); outline-offset: 0; border-color: transparent; }
textarea { width: 100%; min-height: 180px; resize: vertical; font-family: var(--mono); font-size: 12px; }
input.qty { width: 120px; text-align: right; font-family: var(--mono); }
input.pct { width: 70px; text-align: right; font-family: var(--mono); }
input.price { width: 110px; text-align: right; font-family: var(--mono); }
input.dirty { border-color: var(--accent); background: color-mix(in srgb, var(--accent) 8%, var(--bg)); }
label.check { display: inline-flex; gap: 6px; align-items: center; color: var(--muted); cursor: pointer; }

/* Tables */
.table-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: var(--radius); background: var(--panel); }
table { width: 100%; border-collapse: collapse; }
th, td { padding: 6px 10px; border-bottom: 1px solid var(--line); }
th { font-size: 11px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); text-align: left; font-weight: 600; background: var(--panel-2); position: sticky; top: 0; }
th.num { text-align: right; }
tr.tier td { background: var(--bg); color: var(--accent); font-weight: 700; font-size: 12px; letter-spacing: .08em; padding-top: 10px; }
tr.has-qty td { background: color-mix(in srgb, var(--accent) 6%, transparent); }
tr.v1 td:first-child { padding-left: 22px; }
tr.v2 td:first-child { padding-left: 22px; }
tbody tr:hover td { background: var(--panel-2); }

/* Badges */
.badge { display: inline-block; font-size: 10px; padding: 1px 6px; border-radius: 10px; border: 1px solid; text-transform: uppercase; letter-spacing: .05em; vertical-align: middle; margin-left: 6px; }
.badge.market { color: var(--good); border-color: color-mix(in srgb, var(--good) 40%, transparent); }
.badge.override { color: var(--info); border-color: color-mix(in srgb, var(--info) 40%, transparent); }
.badge.derived { color: var(--warn); border-color: color-mix(in srgb, var(--warn) 40%, transparent); }
.badge.none { color: var(--bad); border-color: color-mix(in srgb, var(--bad) 40%, transparent); }
.badge.owner { color: var(--accent); border-color: color-mix(in srgb, var(--accent) 40%, transparent); }
.flag { color: var(--warn); cursor: help; }

/* Notices */
.notice { padding: 10px 12px; border-radius: 6px; border: 1px solid var(--line); background: var(--panel-2); }
.notice.warn { border-color: color-mix(in srgb, var(--warn) 50%, transparent); color: var(--warn); }
.notice.bad { border-color: color-mix(in srgb, var(--bad) 50%, transparent); color: var(--bad); }
.notice.good { border-color: color-mix(in srgb, var(--good) 50%, transparent); color: var(--good); }
.ignored { font-family: var(--mono); font-size: 11px; color: var(--muted); max-height: 120px; overflow: auto; white-space: pre; }

/* Footer total */
.totalbar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 5;
  background: var(--panel); border-top: 1px solid var(--line);
  padding: 12px 20px; display: flex; align-items: center; gap: 16px; flex-wrap: wrap;
}
.totalbar .label { color: var(--muted); text-transform: uppercase; font-size: 11px; letter-spacing: .08em; }
.totalbar .total { font-family: var(--mono); font-size: 24px; font-weight: 700; color: var(--accent); }
.totalbar .spacer { flex: 1; }

/* Landing */
.center { min-height: 70vh; display: grid; place-items: center; }
.hero { max-width: 460px; text-align: center; }
.hero h1 { font-size: 26px; margin-bottom: 8px; }
.hero p { color: var(--muted); }
.btn-eve { background: #000; border-color: #444; color: #fff; padding: 10px 18px; font-weight: 600; }
.btn-discord { background: #5865f2; border-color: #5865f2; color: #fff; padding: 10px 18px; font-weight: 600; }

/* Tabs */
.tabs { display: flex; gap: 2px; border-bottom: 1px solid var(--line); margin-bottom: 16px; overflow-x: auto; }
.tabs button { border: none; border-bottom: 2px solid transparent; border-radius: 0; background: none; color: var(--muted); padding: 10px 14px; }
.tabs button.active { color: var(--text); border-bottom-color: var(--accent); }

.savebar { position: fixed; left: 0; right: 0; bottom: 0; z-index: 6; background: var(--panel); border-top: 1px solid var(--accent); padding: 10px 20px; display: flex; gap: 12px; align-items: center; }
.toast { position: fixed; right: 16px; bottom: 80px; z-index: 10; max-width: 380px; }
