:root {
  --bg: #0b0e11;
  --card-bg: #161a1e;
  --card-border: #23272e;
  --text: #eaecef;
  --text-dim: #848e9c;
  --text-faint: #5e6673;
  --green: #0ecb81;
  --red: #f6465d;
  --short-orange: #ff6b4a;
  --chip-green: #0ecb81;
  --chip-blue: #3b82f6;
  --chip-yellow: #f0b90b;
  --chip-orange: #ff9142;
  --chip-purple: #a855f7;
  --track-bg: #23272e;
  --accent: #f0b90b;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  -webkit-font-smoothing: antialiased;
  padding-bottom: 72px; /* clears the bottom nav */
}

a { color: inherit; text-decoration: none; }

header.topbar {
  position: sticky;
  top: 0;
  z-index: 10;
  background: var(--bg);
  border-bottom: 1px solid var(--card-border);
  padding: 16px 16px 12px;
}

header.topbar h1 {
  margin: 0;
  font-size: 20px;
  font-weight: 700;
}

header.topbar p {
  margin: 4px 0 0;
  font-size: 13px;
  color: var(--text-dim);
}

main {
  padding: 12px;
  max-width: 720px;
  margin: 0 auto;
}

nav.bottom-nav {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  display: flex;
  background: var(--card-bg);
  border-top: 1px solid var(--card-border);
  z-index: 10;
}

nav.bottom-nav a {
  flex: 1;
  text-align: center;
  padding: 16px 0 calc(16px + env(safe-area-inset-bottom, 0px));
  font-size: 13px;
  font-weight: 600;
  color: var(--text-dim);
}

nav.bottom-nav a.active {
  color: var(--accent);
}

.empty-state {
  text-align: center;
  color: var(--text-dim);
  padding: 48px 16px;
  font-size: 14px;
}

/* -- Cards -- */

.card {
  background: var(--card-bg);
  border: 1px solid var(--card-border);
  border-radius: 14px;
  padding: 14px 16px;
  margin-bottom: 12px;
}

.card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.card-title-group {
  display: flex;
  align-items: baseline;
  gap: 8px;
  min-width: 0;
}

.card-title {
  font-size: 17px;
  font-weight: 700;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.address-mono {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 12px;
  color: var(--text-faint);
}

.trust-pill {
  font-size: 11px;
  font-weight: 700;
  padding: 3px 9px;
  border-radius: 999px;
  background: var(--track-bg);
  color: var(--text-dim);
  white-space: nowrap;
}

/* -- Trust Score gauge -- */

.trust-score {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 10px 0;
}

.trust-score-number {
  font-size: 32px;
  font-weight: 800;
  line-height: 1;
  min-width: 62px;
}

.trust-score-bar {
  flex: 1;
  height: 8px;
  border-radius: 999px;
  background: var(--track-bg);
  overflow: hidden;
}

.trust-score-bar-fill {
  height: 100%;
  border-radius: 999px;
}

/* score color scale: red (low) -> yellow (mid) -> green (high) */
.score-low { color: var(--red); }
.score-mid { color: var(--chip-yellow); }
.score-high { color: var(--green); }
.score-low .trust-score-bar-fill { background: var(--red); }
.score-mid .trust-score-bar-fill { background: var(--chip-yellow); }
.score-high .trust-score-bar-fill { background: var(--green); }

/* -- Score Breakdown Chips (4.3) -- fixed color per metric across every card */

.chip-row {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 8px;
}

.chip {
  display: flex;
  flex-direction: column;
  gap: 3px;
  padding: 5px 9px;
  border-radius: 10px;
  background: var(--track-bg);
  min-width: 68px;
}

.chip-label-row {
  display: flex;
  align-items: center;
  gap: 4px;
  font-size: 10px;
  font-weight: 700;
  color: var(--text-dim);
  text-transform: uppercase;
  letter-spacing: 0.02em;
}

.chip-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  flex-shrink: 0;
}

.chip-value {
  font-size: 13px;
  font-weight: 700;
}

.chip-sub {
  font-size: 10px;
  font-weight: 600;
  color: var(--text-faint);
}

.chip-fill-track {
  height: 3px;
  border-radius: 999px;
  background: rgba(255,255,255,0.08);
  overflow: hidden;
}

.chip-fill {
  height: 100%;
  border-radius: 999px;
}

.chip-return_multiple .chip-dot, .chip-return_multiple .chip-fill { background: var(--chip-purple); }
.chip-profit_factor .chip-dot, .chip-profit_factor .chip-fill { background: var(--chip-green); }
.chip-win_rate .chip-dot, .chip-win_rate .chip-fill { background: var(--chip-blue); }
.chip-tenure .chip-dot, .chip-tenure .chip-fill { background: var(--chip-yellow); }
.chip-trades .chip-dot, .chip-trades .chip-fill { background: var(--chip-orange); }

/* -- Position cards -- */

/* Position/closed-trade rows became <a> elements so a trade can be tapped
   through to its trade page -- reset the link defaults so they still read as
   rows, not as blue underlined text. */
.row-link {
  text-decoration: none;
  color: inherit;
  cursor: pointer;
}
.row-link:active { background: var(--track-bg); }

.position-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 0;
  border-top: 1px solid var(--card-border);
}

.position-row:first-of-type { border-top: none; padding-top: 4px; }

.coin-badge-group {
  display: flex;
  align-items: center;
  gap: 8px;
}

.coin-symbol {
  font-size: 16px;
  font-weight: 700;
}

.side-badge {
  font-size: 11px;
  font-weight: 800;
  padding: 2px 8px;
  border-radius: 6px;
  color: #0b0e11;
}

.side-badge.long { background: var(--green); }
.side-badge.short { background: var(--short-orange); }

.position-detail {
  font-size: 12px;
  color: var(--text-dim);
  margin-top: 2px;
}

.position-numbers {
  text-align: right;
}

.position-usd {
  font-size: 15px;
  font-weight: 700;
}

.position-pnl {
  font-size: 12px;
  font-weight: 600;
  margin-top: 2px;
}

.pnl-pos { color: var(--green); }
.pnl-neg { color: var(--red); }

/* -- My Positions page (6b) -- */

.exit-signal-banner {
  background: rgba(246, 70, 93, 0.12);
  border: 1px solid var(--red);
  border-radius: 10px;
  padding: 10px 12px;
  margin-top: 10px;
  font-size: 13px;
  font-weight: 700;
  color: var(--red);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.my-position-actions {
  display: flex;
  gap: 8px;
  margin-top: 10px;
}

.btn-secondary {
  background: var(--track-bg);
  color: var(--text-dim);
  border: 1px solid var(--card-border);
  border-radius: 8px;
  padding: 7px 14px;
  font-size: 13px;
  font-weight: 700;
}

.exit-mode-tag {
  font-size: 10px;
  color: var(--text-faint);
  text-transform: uppercase;
  letter-spacing: 0.02em;
}

/* -- Candidates / leaderboard page -- */

.candidate-card {
  display: flex;
  gap: 12px;
  align-items: flex-start;
}

.rank-badge {
  font-size: 15px;
  font-weight: 800;
  color: var(--text-faint);
  min-width: 26px;
  padding-top: 2px;
}

.candidate-body { flex: 1; min-width: 0; }

.promote-form {
  margin-top: 10px;
  display: flex;
  gap: 8px;
  align-items: center;
}

.promote-form select {
  background: var(--track-bg);
  color: var(--text);
  border: 1px solid var(--card-border);
  border-radius: 8px;
  padding: 6px 8px;
  font-size: 13px;
}

.promote-btn {
  background: var(--accent);
  color: #0b0e11;
  border: none;
  border-radius: 8px;
  padding: 7px 14px;
  font-size: 13px;
  font-weight: 700;
}

.promote-btn:active { opacity: 0.8; }

.promoted-tag {
  font-size: 11px;
  font-weight: 700;
  color: var(--green);
  margin-top: 10px;
}
