/* ── Reset & Base ──────────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --bg: #0d1117;
  --surface: #161b22;
  --surface2: #1c2333;
  --border: #30363d;
  --text: #e6edf3;
  --text-dim: #8b949e;
  --green: #3fb950;
  --red: #f85149;
  --yellow: #d29922;
  --blue: #58a6ff;
  --purple: #bc8cff;
  --radius: 8px;
  --font: 'SF Mono', 'Cascadia Code', 'Fira Code', 'Consolas', monospace;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Helvetica, Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.5;
  min-height: 100vh;
}

/* ── Layout ────────────────────────────────────────────────────────────── */
.container { max-width: 1400px; margin: 0 auto; padding: 20px; }

header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px 0;
  border-bottom: 1px solid var(--border);
  margin-bottom: 24px;
}

header h1 {
  font-size: 1.3rem;
  display: flex;
  align-items: center;
  gap: 8px;
}

header .status {
  font-size: 0.8rem;
  color: var(--text-dim);
  display: flex;
  align-items: center;
  gap: 6px;
}

header .status .dot {
  width: 8px; height: 8px;
  border-radius: 50%;
  background: var(--green);
  animation: pulse 2s infinite;
}

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.4; }
}

/* ── Navigation ────────────────────────────────────────────────────────── */
nav {
  display: flex;
  gap: 4px;
  margin-bottom: 24px;
  border-bottom: 1px solid var(--border);
  padding-bottom: 0;
}

nav button {
  background: none;
  border: none;
  color: var(--text-dim);
  padding: 10px 16px;
  cursor: pointer;
  font-size: 0.9rem;
  border-bottom: 2px solid transparent;
  transition: color 0.2s, border-color 0.2s;
}

nav button:hover { color: var(--text); }
nav button.active {
  color: var(--blue);
  border-bottom-color: var(--blue);
}

/* ── Cards ─────────────────────────────────────────────────────────────── */
.cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 16px;
  margin-bottom: 24px;
}

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

.card .label {
  font-size: 0.75rem;
  color: var(--text-dim);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 4px;
}

.card .value {
  font-size: 1.5rem;
  font-weight: 600;
  font-family: var(--font);
}

.card .value.positive { color: var(--green); }
.card .value.negative { color: var(--red); }
.card .value.neutral { color: var(--text); }

.card .sub {
  font-size: 0.75rem;
  color: var(--text-dim);
  margin-top: 4px;
}

/* ── Tables ────────────────────────────────────────────────────────────── */
.table-wrap {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow-x: auto;
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.85rem;
}

th {
  text-align: left;
  padding: 10px 12px;
  font-weight: 600;
  color: var(--text-dim);
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  border-bottom: 1px solid var(--border);
  background: var(--surface2);
  position: sticky;
  top: 0;
}

td {
  padding: 8px 12px;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}

tr:last-child td { border-bottom: none; }
tr:hover td { background: rgba(88, 166, 255, 0.04); }

/* ── Tags & Badges ─────────────────────────────────────────────────────── */
.badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 12px;
  font-size: 0.72rem;
  font-weight: 600;
  font-family: var(--font);
}

.badge.score-high { background: rgba(63, 185, 80, 0.15); color: var(--green); }
.badge.score-mid  { background: rgba(210, 153, 34, 0.15); color: var(--yellow); }
.badge.score-low  { background: rgba(248, 81, 73, 0.15); color: var(--red); }
.badge.buy  { background: rgba(63, 185, 80, 0.15); color: var(--green); }
.badge.sell { background: rgba(248, 81, 73, 0.15); color: var(--red); }
.badge.open { background: rgba(88, 166, 255, 0.15); color: var(--blue); }
.badge.closed { background: rgba(139, 148, 158, 0.15); color: var(--text-dim); }

.pnl-positive { color: var(--green); }
.pnl-negative { color: var(--red); }

/* ── Section ───────────────────────────────────────────────────────────── */
.section {
  display: none;
  animation: fadeIn 0.2s ease;
}

.section.active { display: block; }

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(4px); }
  to { opacity: 1; transform: translateY(0); }
}

.section h2 {
  font-size: 1.1rem;
  margin-bottom: 16px;
  color: var(--text);
}

/* ── Pagination ────────────────────────────────────────────────────────── */
.pagination {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 0;
  font-size: 0.8rem;
  color: var(--text-dim);
}

.pagination button {
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--text);
  padding: 6px 12px;
  border-radius: var(--radius);
  cursor: pointer;
  font-size: 0.8rem;
}

.pagination button:hover { border-color: var(--blue); }
.pagination button:disabled { opacity: 0.3; cursor: not-allowed; }

/* ── Token link ────────────────────────────────────────────────────────── */
a.token-link {
  color: var(--blue);
  text-decoration: none;
}
a.token-link:hover { text-decoration: underline; }

/* ── Empty State ───────────────────────────────────────────────────────── */
.empty {
  text-align: center;
  padding: 40px 20px;
  color: var(--text-dim);
}

.empty .icon { font-size: 2rem; margin-bottom: 8px; }

/* ── Footer ────────────────────────────────────────────────────────────── */
footer {
  text-align: center;
  padding: 20px 0;
  font-size: 0.75rem;
  color: var(--text-dim);
  border-top: 1px solid var(--border);
  margin-top: 40px;
}

/* ── Responsive ────────────────────────────────────────────────────────── */
@media (max-width: 768px) {
  .cards { grid-template-columns: repeat(2, 1fr); }
  .container { padding: 12px; }
  table { font-size: 0.78rem; }
  th, td { padding: 6px 8px; }
}
