:root {
  --bg: #0d101e;
  --bg-grad-1: #0d101e;
  --bg-grad-2: #0c1630;
  --card: #111633;
  --muted: #8ea0c7;
  --text: #e7ecff;
  --accent: #6aa5ff;
  --accent-2: #4ee1a0;
  --border: #20274a;
}
* {
  box-sizing: border-box;
}
html,
body {
  margin: 0;
  padding: 0;
  background: linear-gradient(180deg, var(--bg-grad-1), var(--bg-grad-2));
  color: var(--text);
  font-family: ui-sans-serif, system-ui, -apple-system, Segoe UI, Roboto, Ubuntu,
    Cantarell, Noto Sans, Arial, "Apple Color Emoji", "Segoe UI Emoji";
}
.topbar {
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  backdrop-filter: blur(4px);
  position: sticky;
  top: 0;
  z-index: 5;
}
.brand {
  display: flex;
  align-items: center;
  gap: 12px;
}
.brand .logo {
  width: 28px;
  height: 28px;
  background: radial-gradient(
    circle at 30% 30%,
    var(--accent),
    var(--accent-2)
  );
  border-radius: 8px;
  box-shadow: 0 0 0 2px #0b1430 inset;
}
.topbar h1 {
  margin: 0;
  font-size: 18px;
  font-weight: 700;
  letter-spacing: 0.2px;
}
.nav a {
  color: var(--text);
  text-decoration: none;
  margin-left: 14px;
  padding: 8px 12px;
  border-radius: 8px;
  border: 1px solid transparent;
}
.nav a:hover {
  border-color: #31407a;
  background: #0f1734;
}
.nav a.active {
  background: #15214a;
  border-color: #2d3a73;
  box-shadow: 0 0 0 1px #2d3a73 inset;
}
.kpis {
  display: flex;
  gap: 16px;
  margin: 16px 0;
}
.kpi {
  background: var(--card);
  padding: 12px 16px;
  border-radius: 8px;
  min-width: 140px;
}
.kpi-label {
  color: var(--muted);
  font-size: 12px;
}
.kpi-value {
  font-size: 22px;
  font-weight: 700;
  margin-top: 4px;
}
.container {
  max-width: 1200px;
  margin: 20px auto;
  padding: 0 16px;
  display: grid;
  grid-template-columns: 1fr;
  gap: 20px;
}
.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 16px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
}
.card h2 {
  margin: 0 0 12px;
  font-size: 18px;
}
.card-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  margin-bottom: 8px;
}
.chart {
  position: relative;
  overflow: hidden;
}
.chart canvas {
  width: 100%;
  height: auto;
  image-rendering: -webkit-optimize-contrast;
}
.chart-legend,
.donut-legend {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 8px;
  margin-top: 12px;
}
.legend-item {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  color: var(--muted);
}
.legend-dot {
  width: 10px;
  height: 10px;
  border-radius: 2px;
  box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.06) inset;
}
.donut-wrap {
  display: grid;
  grid-template-columns: 340px 1fr;
  align-items: center;
  gap: 12px;
}
@media (max-width: 900px) {
  .donut-wrap {
    grid-template-columns: 1fr;
    justify-items: center;
  }
}
.row {
  display: flex;
  gap: 8px;
  margin-bottom: 10px;
}
.row.wrap {
  flex-wrap: wrap;
}
input[type="text"] {
  flex: 1;
  padding: 10px 12px;
  border-radius: 8px;
  border: 1px solid #2a355f;
  background: #0e1324;
  color: var(--text);
  outline: none;
}
input[type="datetime-local"] {
  padding: 10px 12px;
  border-radius: 8px;
  border: 1px solid #2a355f;
  background: #0e1324;
  color: var(--text);
  outline: none;
}
select {
  padding: 10px 12px;
  border-radius: 8px;
  border: 1px solid #2a355f;
  background: #0e1324;
  color: var(--text);
  outline: none;
}
button {
  padding: 10px 14px;
  background: var(--accent);
  color: #081021;
  border: none;
  border-radius: 8px;
  font-weight: 700;
  cursor: pointer;
}
button:hover {
  filter: brightness(1.1);
}
.list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 8px;
}
.list li {
  padding: 10px 12px;
  border: 1px solid #263160;
  border-radius: 8px;
  background: #0e1324;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.groups {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 10px;
}
.group {
  background: #0e1324;
  border-radius: 8px;
  border: 1px solid #263160;
  padding: 10px;
}
.group .name {
  color: var(--muted);
  font-size: 12px;
}
.group .value {
  font-size: 18px;
  font-weight: 700;
  margin-top: 4px;
}
.table {
  width: 100%;
  border-collapse: collapse;
}
.table th,
.table td {
  text-align: left;
  padding: 8px 6px;
  border-bottom: 1px solid #25305e;
  font-size: 14px;
}
.muted {
  color: var(--muted);
}
.tag {
  background: #1b2346;
  color: #9db4ff;
  padding: 2px 6px;
  border-radius: 999px;
  font-size: 12px;
  border: 1px solid #2e3a6f;
}
.views .view.hidden {
  display: none;
}
.grid-2 {
  display: grid;
  grid-template-columns: 1fr;
  gap: 20px;
}
@media (min-width: 980px) {
  .grid-2 {
    grid-template-columns: 1fr 1fr;
  }
}

/* Ranking */
.rank-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 12px;
  margin-bottom: 14px;
}
.rank-card {
  background: #0e1324;
  border: 1px solid #263160;
  border-radius: 10px;
  padding: 12px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.rank-left {
  display: flex;
  align-items: center;
  gap: 10px;
}
.rank-pos {
  width: 26px;
  height: 26px;
  background: #15214a;
  border: 1px solid #2e3a6f;
  color: #9db4ff;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 6px;
  font-weight: 700;
}
.rank-name {
  font-weight: 700;
}
.pill {
  padding: 4px 8px;
  border-radius: 999px;
  font-size: 12px;
  border: 1px solid #2e3a6f;
}
.pill-gold {
  background: linear-gradient(135deg, #ffd36a, #ffb33d);
  color: #4b3200;
  border: none;
  box-shadow: 0 1px 0 rgba(0, 0, 0, 0.25) inset;
}

/* Chips & segments */
.chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.chip {
  padding: 6px 10px;
  border-radius: 999px;
  border: 1px solid #2e3a6f;
  background: #0e1324;
  color: #c9d6ff;
  cursor: pointer;
  font-size: 13px;
}
.chip:hover {
  filter: brightness(1.1);
}
.chip.active {
  background: #15214a;
  color: #fff;
  border-color: #3a4a86;
}
.seg {
  color: var(--muted);
  font-size: 13px;
  min-width: 90px;
  padding: 8px 0;
}

/* Medal history */
.medal-fail {
  color: #ff6a88;
  font-weight: 700;
}
