:root {
  --bg: #0f1216;
  --panel: #171b22;
  --panel-2: #1c222c;
  --line: #2a3340;
  --text: #e8edf4;
  --muted: #8b97a8;
  --green: #3dbe7d;
  --red: #e85d5d;
  --amber: #e0a84a;
  --blue: #6aa7ff;
  --impulse: #1a2433;
}
* { box-sizing: border-box; }
html, body {
  margin: 0; padding: 0;
  background: var(--bg);
  color: var(--text);
  font: 12px/1.25 "IBM Plex Sans", "Segoe UI", sans-serif;
  height: 100%;
  overflow: hidden;
}
body {
  display: flex;
  flex-direction: column;
  height: 100vh;
  height: 100dvh;
}
header {
  flex: 0 0 auto;
  display: flex; align-items: center; justify-content: space-between;
  gap: 10px; padding: 6px 10px;
  border-bottom: 1px solid var(--line);
  background: var(--bg);
  min-height: 36px;
}
header h1 {
  margin: 0; font-size: 13px; font-weight: 600; letter-spacing: .02em;
  white-space: nowrap;
}
header .meta {
  color: var(--muted); display: flex; gap: 6px; flex-wrap: nowrap;
  align-items: center; min-width: 0; overflow: hidden;
}
header .pill {
  border: 1px solid var(--line); border-radius: 999px; padding: 2px 8px;
  color: var(--muted); font-size: 11px; white-space: nowrap;
}
header .pill.warn { color: var(--amber); border-color: #5a4520; }
header .pill.ok { color: var(--green); border-color: #25543a; }
header .pill.btn {
  cursor: pointer; user-select: none;
  color: var(--text); border-color: #3d5270; background: #1a2433;
}
header .pill.btn.on { color: var(--green); border-color: #25543a; }
header .pill.btn:hover { filter: brightness(1.08); }
header .range-group {
  display: inline-flex; gap: 0; border: 1px solid var(--line); border-radius: 999px;
  overflow: hidden; flex-shrink: 0;
}
header .range-group .pill {
  border: none; border-radius: 0; margin: 0;
  border-right: 1px solid var(--line);
}
header .range-group .pill:last-child { border-right: none; }
header .range-group .pill.on {
  color: var(--green); background: #1a2a22; border-color: transparent;
}
.toast {
  position: fixed; right: 10px; bottom: 10px; z-index: 20;
  max-width: min(360px, 42vw);
  background: #1a2433; border: 1px solid #3d5270; color: var(--text);
  border-radius: 8px; padding: 10px 12px; font-size: 12px;
  box-shadow: none; opacity: 0; pointer-events: none;
  transition: opacity .2s;
}
.toast.show { opacity: 1; }
.grid {
  flex: 1 1 auto;
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  grid-template-rows: repeat(3, minmax(0, 1fr));
  gap: 6px;
  padding: 6px;
  min-height: 0;
  overflow: hidden;
}
.tile {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  display: flex; flex-direction: column;
  min-width: 0; min-height: 0;
  overflow: hidden;
  position: relative;
}
.tile.impulse {
  background: #1a2433;
  border-color: #33455f;
  grid-column: span 2;
}
.tile.info { background: var(--panel-2); }
.tile.stack-host {
  background: transparent;
  border: none;
  border-radius: 0;
  gap: 4px;
  padding: 0;
  overflow: hidden;
}
.tile.stack-host > .stack-half {
  flex: 1 1 0;
  min-height: 0;
  display: flex;
  flex-direction: column;
  background: var(--panel-2);
  border: 1px solid var(--line);
  border-radius: 8px;
  overflow: hidden;
}
.tile.stack-host .info-body {
  gap: 3px;
  padding: 2px 8px 6px;
  justify-content: center;
}
.tile.stack-host .tile-head { padding: 4px 8px 0; }
.tile.stack-host .tile-head h2 { font-size: 10px; }
.perf-chart {
  flex: 1 1 auto;
  min-height: 0;
  display: flex;
  flex-direction: column;
  gap: 3px;
  overflow: hidden;
  padding: 2px 8px 4px;
}
.perf-axis {
  flex: 0 0 auto;
  display: flex; justify-content: space-between;
  font-size: 8px; color: var(--muted); padding: 0 0 1px;
  font-variant-numeric: tabular-nums;
}
.perf-bar-row {
  flex: 1 1 0;
  display: grid;
  grid-template-columns: minmax(3.2em, 28%) 1fr minmax(2.8em, 22%);
  gap: 4px;
  align-items: center;
  min-height: 0;
}
.perf-bar-row .n {
  font-size: 10px; font-weight: 600;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.perf-bar-row .val {
  font-size: 10px; font-variant-numeric: tabular-nums; font-weight: 650;
  text-align: right; white-space: nowrap;
}
.perf-bar-row .val.up { color: var(--green); }
.perf-bar-row .val.down { color: var(--red); }
.perf-bar-row .val.muted { color: var(--muted); }
.perf-track {
  position: relative;
  height: 10px;
  background: rgba(255,255,255,.04);
  border-radius: 2px;
  overflow: hidden;
}
.perf-track::before {
  content: "";
  position: absolute; left: 50%; top: 0; bottom: 0;
  width: 1px; background: #5a6575; transform: translateX(-50%);
  z-index: 1;
}
.perf-bar {
  display: block;
  position: absolute; top: 1px; bottom: 1px;
  border-radius: 1px; min-width: 2px;
}
.perf-bar.up {
  right: 50%;
  background: var(--green);
}
.perf-bar.down {
  left: 50%;
  background: var(--red);
}
.perf-empty {
  flex: 1; display: flex; align-items: center; justify-content: center;
  color: var(--muted); font-size: 11px;
}
.perf-sum {
  flex: 0 0 auto;
  display: flex; justify-content: space-between; gap: 8px;
  padding: 4px 8px 6px;
  border-top: 1px solid var(--line);
  font-size: 11px; font-variant-numeric: tabular-nums; font-weight: 650;
}
.perf-sum .up { color: var(--green); }
.perf-sum .down { color: var(--red); }
.perf-sum .muted { color: var(--muted); }
.tile-head .perf-unit {
  flex-shrink: 0;
  border: 1px solid #3d5270;
  border-radius: 999px;
  padding: 1px 8px;
  font-size: 10px;
  font-weight: 650;
  color: var(--text);
  background: #1a2433;
  cursor: pointer;
  user-select: none;
}
.tile-head .perf-unit:hover { filter: brightness(1.08); }
.tile-head {
  flex: 0 0 auto;
  display: flex; justify-content: space-between; gap: 6px;
  padding: 5px 8px 2px; align-items: flex-start;
}
.tile-head h2 {
  margin: 0; font-size: 11px; font-weight: 600;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  max-width: 11em;
}
.tile-head .wkn {
  color: var(--muted); font-size: 9px; margin-top: 1px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.price-block { text-align: right; flex-shrink: 0; }
.price { font-variant-numeric: tabular-nums; font-size: 13px; font-weight: 650; }
.chg { font-variant-numeric: tabular-nums; font-size: 10px; margin-top: 1px; }
.chg.up { color: var(--green); }
.chg.down { color: var(--red); }
.chg.flat { color: var(--muted); }
.chart {
  flex: 1 1 auto;
  min-height: 0;
  padding: 0 2px 2px;
}
.stats {
  flex: 0 0 auto;
  display: grid; grid-template-columns: repeat(4, 1fr);
  gap: 3px; padding: 0 6px 6px;
}
.stat {
  background: rgba(255,255,255,.03);
  border-radius: 4px; padding: 3px 4px;
  min-width: 0;
}
.stat .k {
  color: var(--muted); font-size: 8px; text-transform: uppercase;
  letter-spacing: .03em; white-space: nowrap; overflow: hidden;
}
.stat .v {
  font-variant-numeric: tabular-nums; font-size: 10px; margin-top: 1px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.badge {
  position: absolute; top: 4px; left: 50%; transform: translateX(-50%);
  font-size: 9px; padding: 1px 6px; border-radius: 999px;
  border: 1px solid var(--line); color: var(--muted); background: var(--bg);
  opacity: 0; transition: opacity .2s; pointer-events: none; z-index: 2;
}
.tile.updating .badge { opacity: 1; }
.tile.err { border-color: #6b3030; }
.impulse-body {
  flex: 1 1 auto;
  min-height: 0;
  padding: 2px 8px 6px;
  display: flex; flex-direction: column; gap: 4px;
  overflow: hidden;
}
.impulse-score {
  flex: 0 0 auto;
  display: flex; align-items: baseline; gap: 8px;
}
.impulse-score .big {
  font-size: 22px; font-weight: 700; font-variant-numeric: tabular-nums;
}
.impulse-score .big.good { color: var(--green); }
.impulse-score .big.mid { color: var(--amber); }
.impulse-score .big.bad { color: var(--red); }
.impulse-score div:last-child { min-width: 0; }
.impulse-score div:last-child > div:first-child {
  font-weight: 650; font-size: 12px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.impulse-score div:last-child > div:last-child {
  color: var(--muted); font-size: 10px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.impulse-list {
  flex: 1 1 auto;
  min-height: 0;
  display: flex; flex-direction: column; gap: 2px;
  overflow: hidden;
}
.rec {
  flex: 1 1 0;
  display: grid;
  grid-template-columns: 18px 10px minmax(0, 1.2fr) auto minmax(0, 1fr) auto;
  gap: 4px 5px; align-items: center;
  padding: 2px 6px; border-radius: 4px;
  background: rgba(255,255,255,.03); border: 1px solid transparent;
  min-height: 0;
}
.rec .shares {
  font-variant-numeric: tabular-nums; color: var(--muted); font-size: 10px;
  white-space: nowrap;
}
.rec .fill-btn {
  width: 16px; height: 16px; border-radius: 3px; border: 1px solid #3d5270;
  background: #1a2433; color: var(--muted); font-size: 11px; line-height: 1;
  cursor: pointer; padding: 0; display: flex; align-items: center; justify-content: center;
}
.rec .fill-btn:hover { color: var(--text); border-color: #6aa7ff; }
.rec .fill-btn.done { color: var(--green); border-color: #25543a; }
.rec.filled { border-color: #2a4a3a; background: rgba(61,190,125,.06); }
.modal-backdrop {
  position: fixed; inset: 0; z-index: 40; background: rgba(0,0,0,.55);
  display: none; align-items: center; justify-content: center; padding: 16px;
}
.modal-backdrop.show { display: flex; }
.modal {
  width: min(380px, 100%); background: var(--panel); border: 1px solid #3d5270;
  border-radius: 10px; padding: 14px 16px; color: var(--text);
}
.modal h3 { margin: 0 0 6px; font-size: 14px; }
.modal .sub { color: var(--muted); font-size: 11px; margin-bottom: 12px; }
.modal label {
  display: flex; flex-direction: column; gap: 3px; margin-bottom: 8px;
  font-size: 11px; color: var(--muted);
}
.modal input {
  background: var(--bg); border: 1px solid var(--line); border-radius: 6px;
  color: var(--text); padding: 6px 8px; font-size: 13px; font-variant-numeric: tabular-nums;
}
.modal .actions { display: flex; gap: 8px; justify-content: flex-end; margin-top: 12px; }
.modal button {
  border: 1px solid var(--line); border-radius: 6px; padding: 6px 10px;
  background: var(--panel-2); color: var(--text); cursor: pointer; font-size: 12px;
}
.modal button.primary { background: #1a2a22; border-color: #25543a; color: var(--green); }
.modal button.danger { color: var(--red); border-color: #5a3030; }
#inviteToken {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 12px;
  user-select: all;
}
.invite-hint {
  margin: 0;
  color: var(--muted);
  font-size: 11px;
  min-height: 1.2em;
}
.rec.buy, .rec.sell { border-color: #25543a; }
.rec.wait { border-color: #5a4520; }
.rec.skip { border-color: #5a3030; }
.dot { width: 6px; height: 6px; border-radius: 50%; flex-shrink: 0; }
.dot.buy, .dot.sell { background: var(--green); }
.dot.wait { background: var(--amber); }
.dot.skip { background: var(--red); }
.tile.side-sell { border-color: #4a3a55; }
.tile .side-tag {
  display: inline-block; font-size: 8px; font-weight: 700; letter-spacing: .04em;
  padding: 0 4px; border-radius: 3px; margin-left: 4px; vertical-align: middle;
  color: var(--green); border: 1px solid #25543a;
}
.tile.side-sell .side-tag { color: #c9a0e8; border-color: #5a3a70; }
.rec .name {
  font-weight: 600; font-size: 11px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.rec .detail { display: none; }
.rec .action {
  font-size: 9px; font-weight: 650; text-transform: uppercase;
  letter-spacing: .03em; white-space: nowrap;
}
.rec .action.buy, .rec .action.sell { color: var(--green); }
.rec .action.wait { color: var(--amber); }
.rec .action.skip { color: var(--red); }
.rec .qty {
  font-variant-numeric: tabular-nums; color: var(--muted); font-size: 10px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.info-body {
  flex: 1 1 auto; min-height: 0;
  padding: 4px 8px 8px;
  display: flex; flex-direction: column; gap: 5px;
  justify-content: center;
}
.info-body .line {
  display: flex; justify-content: space-between; gap: 6px;
  font-variant-numeric: tabular-nums; font-size: 11px;
}
.info-body .line span:last-child { color: var(--text); font-weight: 600; }
.info-body .line span:first-child { color: var(--muted); }
.bar {
  height: 6px; background: #243040; border-radius: 99px; overflow: hidden;
}
.bar > i {
  display: block; height: 100%; background: var(--blue); width: 0%;
  transition: width .4s ease;
}
.bar > i.good { background: var(--green); }
.bar > i.mid { background: var(--amber); }
.bar > i.bad { background: var(--red); }
.footnote { display: none; }
[title] { cursor: help; }
header .pill.btn { cursor: pointer; }
header a.pill.btn {
  text-decoration: none;
  color: inherit;
}

.auth-gate {
  position: fixed; inset: 0; z-index: 80;
  display: flex; align-items: center; justify-content: center;
  background: rgba(8, 10, 14, 0.92);
  padding: 20px;
}
.auth-gate[hidden] { display: none !important; }
.auth-card {
  width: min(380px, 100%);
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 20px 18px 18px;
  display: flex; flex-direction: column; gap: 12px;
}
.auth-card h2 { margin: 0; font-size: 16px; }
.auth-sub { margin: 0; color: var(--muted); font-size: 12px; }
.auth-tabs { display: flex; gap: 6px; }
.auth-card form { display: flex; flex-direction: column; gap: 10px; }
.auth-card label {
  display: flex; flex-direction: column; gap: 4px;
  color: var(--muted); font-size: 11px;
}
.auth-card input {
  background: var(--panel-2);
  border: 1px solid var(--line);
  color: var(--text);
  border-radius: 8px;
  padding: 8px 10px;
  font: inherit;
}
.auth-card button.primary {
  margin-top: 4px;
  background: #243a28;
  color: var(--green);
  border: 1px solid #2f5a3a;
  border-radius: 8px;
  padding: 9px 12px;
  font: inherit;
  font-weight: 650;
  cursor: pointer;
}
.auth-card button.primary:hover { filter: brightness(1.08); }
.auth-error { margin: 0; color: var(--red); font-size: 12px; }
body.auth-locked header .meta > :not(#langGroup) { opacity: 0.35; pointer-events: none; }
body.auth-locked header .meta #langGroup { pointer-events: auto; opacity: 1; }
