:root {
  --bg: #0e0b1d;
  --panel: #1a1630;
  --panel-2: #241e3d;
  --text: #e8e4f5;
  --muted: #9b93b8;
  --gold: #d4af37;
  --gold-soft: #f0d98a;
  --line: #322b52;
  --error: #ff7a7a;
  --radius: 14px;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: radial-gradient(1200px 800px at 70% -10%, #241a45 0%, var(--bg) 55%);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC",
    "Microsoft YaHei", sans-serif;
  min-height: 100vh;
}

.muted { color: var(--muted); }
.small { font-size: 12px; }
.error { color: var(--error); font-size: 13px; }

/* Login */
.login {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
}
.login-card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 32px;
  width: 100%;
  max-width: 360px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}
.login-card h1 { font-size: 20px; margin: 0; }
#token-input {
  background: var(--panel-2);
  border: 1px solid var(--line);
  color: var(--text);
  border-radius: 10px;
  padding: 12px 14px;
  font-size: 15px;
}

/* Buttons */
.btn-gold {
  background: var(--gold);
  color: #1a1405;
  border: none;
  border-radius: 10px;
  padding: 12px 16px;
  font-weight: 600;
  cursor: pointer;
}
.btn-ghost {
  background: transparent;
  color: var(--muted);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 8px 14px;
  cursor: pointer;
}
.btn-ghost:hover { color: var(--text); }

/* Dashboard layout */
.dashboard { max-width: 1100px; margin: 0 auto; padding: 24px 20px 60px; }
.topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 22px;
  flex-wrap: wrap;
  gap: 12px;
}
.topbar h1 { font-size: 20px; margin: 0 0 4px; }
.topbar-actions { display: flex; gap: 10px; align-items: center; }
select {
  background: var(--panel-2);
  color: var(--text);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 8px 12px;
}

.cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 16px;
  margin-bottom: 22px;
}
.card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 18px;
}
.card .label { color: var(--muted); font-size: 13px; }
.card .value { font-size: 28px; font-weight: 700; margin-top: 6px; }

.panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 20px;
  margin-bottom: 22px;
}
.panel h2 { font-size: 15px; margin: 0 0 16px; color: var(--gold-soft); }

.grid-2 {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 22px;
}
.grid-2 .panel { margin-bottom: 0; }

/* Chart */
.chart { width: 100%; overflow-x: auto; }
.chart svg { display: block; min-width: 480px; }

/* Table */
.table { width: 100%; border-collapse: collapse; font-size: 14px; }
.table th, .table td {
  text-align: right;
  padding: 10px 8px;
  border-bottom: 1px solid var(--line);
}
.table th:first-child, .table td:first-child { text-align: left; }
.table th { color: var(--muted); font-weight: 600; font-size: 12px; }

/* Bars */
.bars { display: flex; flex-direction: column; gap: 12px; }
.bar-row { display: grid; grid-template-columns: 1fr auto; gap: 6px 12px; align-items: center; }
.bar-row .name { font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bar-row .count { font-size: 13px; color: var(--muted); }
.bar-track { grid-column: 1 / -1; height: 8px; background: var(--panel-2); border-radius: 6px; overflow: hidden; }
.bar-fill { height: 100%; background: linear-gradient(90deg, var(--gold), var(--gold-soft)); border-radius: 6px; }

.empty { color: var(--muted); font-size: 13px; }
