:root {
  --bg: #0f1419;
  --surface: #1a2332;
  --border: #2d3a4d;
  --text: #e7ecf3;
  --muted: #8b9cb3;
  --accent: #3d8bfd;
  --win: #3ecf8e;
  --loss: #f07178;
  --pending: #e5c07b;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: "JetBrains Mono", "SF Mono", ui-monospace, monospace;
  font-size: 14px;
  line-height: 1.45;
  color: var(--text);
  background: var(--bg);
  min-height: 100vh;
}

a {
  color: var(--accent);
}

.header {
  padding: 1.5rem 1.5rem 0.5rem;
  max-width: 1400px;
  margin: 0 auto;
}

.header h1 {
  margin: 0 0 0.35rem;
  font-size: 1.35rem;
  font-weight: 600;
  letter-spacing: -0.02em;
}

.sub {
  margin: 0;
  color: var(--muted);
  max-width: 52rem;
}

.controls {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: 0.75rem 1rem;
  padding: 1rem 1.5rem;
  max-width: 1400px;
  margin: 0 auto;
}

.field {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  font-size: 12px;
  color: var(--muted);
}

.field input,
.field select {
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--text);
  padding: 0.45rem 0.6rem;
  border-radius: 6px;
  width: 11rem;
  font: inherit;
}

.field select {
  cursor: pointer;
}

.btn {
  background: var(--accent);
  color: #fff;
  border: none;
  padding: 0.5rem 1rem;
  border-radius: 6px;
  font: inherit;
  cursor: pointer;
}

.btn.secondary {
  background: var(--surface);
  color: var(--text);
  border: 1px solid var(--border);
}

.btn:hover {
  filter: brightness(1.08);
}

.status {
  color: var(--muted);
  font-size: 12px;
  align-self: center;
}

.cards {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(11rem, 1fr));
  gap: 0.75rem;
  padding: 0 1.5rem 1rem;
  max-width: 1400px;
  margin: 0 auto;
}

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 0.85rem 1rem;
}

.card-label {
  font-size: 11px;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  margin-bottom: 0.35rem;
}

.card-value {
  font-size: 1.35rem;
  font-weight: 600;
}

.card-value.small {
  font-size: 1rem;
}

.end-sort-hint {
  max-width: 1400px;
  margin: 0 auto;
  padding: 0 1.5rem 0.5rem;
  font-size: 12px;
  color: var(--muted);
}

.table-wrap {
  padding: 0 1.5rem 2rem;
  max-width: 1400px;
  margin: 0 auto;
  overflow-x: auto;
}

table.bets {
  width: 100%;
  border-collapse: collapse;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  overflow: hidden;
}

table.bets th,
table.bets td {
  text-align: left;
  padding: 0.55rem 0.65rem;
  border-bottom: 1px solid var(--border);
  vertical-align: top;
}

table.bets th {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--muted);
  background: rgba(0, 0, 0, 0.2);
}

table.bets th .th-sort {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  margin: 0;
  padding: 0;
  border: none;
  background: none;
  font: inherit;
  font-size: inherit;
  text-transform: inherit;
  letter-spacing: inherit;
  color: inherit;
  cursor: pointer;
  text-align: left;
  max-width: 100%;
}

table.bets th .th-sort:hover {
  color: var(--text);
}

table.bets th .th-sort .sort-ind {
  font-size: 0.65rem;
  opacity: 0.9;
  min-width: 0.65rem;
}

table.bets th .th-sort.is-active {
  color: var(--accent);
}

table.bets th .th-sort.is-active .sort-ind {
  opacity: 1;
}

table.bets tr:last-child td {
  border-bottom: none;
}

.cell-title {
  font-weight: 500;
  max-width: 22rem;
}

.cell-muted {
  color: var(--muted);
  font-size: 12px;
  margin-top: 0.2rem;
}

.tag-list {
  font-size: 12px;
  color: var(--muted);
}

.st-won {
  color: var(--win);
}

.st-lost {
  color: var(--loss);
}

.st-open {
  color: var(--pending);
}

.st-unknown {
  color: var(--muted);
}

.pnl-pos {
  color: var(--win);
}

.pnl-neg {
  color: var(--loss);
}
