:root {
  --bg-app: #0f1216;
  --bg-panel: #161a20;
  --bg-panel-raised: #1c2129;
  --bg-hover: #212733;
  --border-subtle: #262c36;
  --border-strong: #343c49;

  --accent: #3d7fff;
  --accent-dim: #2a5bc7;
  --accent-wash: rgba(61, 127, 255, 0.12);

  --live: #ff4d4d;
  --live-wash: rgba(255, 77, 77, 0.12);
  --positive: #35c98f;

  --text-primary: #eef1f5;
  --text-secondary: #9aa3b2;
  --text-tertiary: #626a78;

  --font-display: 'Space Grotesk', 'Inter', system-ui, sans-serif;
  --font-body: 'Inter', system-ui, sans-serif;
  --font-mono: 'JetBrains Mono', ui-monospace, monospace;

  --rail-width: 76px;
  --live-col-width: 320px;
  --radius-sm: 6px;
  --radius-md: 10px;
  --header-height: 60px;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg-app);
  color: var(--text-primary);
  font-family: var(--font-body);
  -webkit-font-smoothing: antialiased;
}

a { color: inherit; text-decoration: none; }
button { font-family: inherit; cursor: pointer; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-thumb { background: var(--border-strong); border-radius: 8px; }
::-webkit-scrollbar-track { background: transparent; }

@media (prefers-reduced-motion: reduce) {
  * { animation-duration: 0.001ms !important; transition-duration: 0.001ms !important; }
}

/* ---------- Structure ---------- */
.app-shell { display: flex; min-height: 100vh; }

.sidebar {
  width: var(--rail-width);
  flex-shrink: 0;
  background: var(--bg-panel);
  border-right: 1px solid var(--border-subtle);
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 16px 0;
  position: sticky;
  top: 0;
  height: 100vh;
}

.sidebar-logo {
  width: 36px; height: 36px;
  border-radius: var(--radius-sm);
  background: linear-gradient(135deg, var(--accent), var(--accent-dim));
  display: flex; align-items: center; justify-content: center;
  font-family: var(--font-display); font-weight: 700; font-size: 15px;
  color: #fff; margin-bottom: 28px;
}

.sidebar-nav { display: flex; flex-direction: column; gap: 6px; width: 100%; align-items: center; }

.sidebar-link {
  width: 48px; height: 48px;
  border-radius: var(--radius-md);
  display: flex; align-items: center; justify-content: center;
  color: var(--text-tertiary);
  transition: background 0.15s ease, color 0.15s ease;
}
.sidebar-link:hover { background: var(--bg-hover); color: var(--text-primary); }
.sidebar-link.active { background: var(--accent-wash); color: var(--accent); }
.sidebar-link svg { width: 20px; height: 20px; }

.app-main { flex: 1; display: flex; flex-direction: column; min-width: 0; }

.topbar {
  height: var(--header-height);
  border-bottom: 1px solid var(--border-subtle);
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 24px; flex-shrink: 0;
  background: var(--bg-app);
  position: sticky; top: 0; z-index: 10;
}

.topbar-title { font-family: var(--font-display); font-weight: 600; font-size: 16px; letter-spacing: -0.01em; }

.circuit-toggle {
  display: flex; background: var(--bg-panel);
  border: 1px solid var(--border-subtle);
  border-radius: 999px; padding: 3px; gap: 2px;
}
.circuit-toggle button {
  border: none; background: transparent; color: var(--text-secondary);
  font-size: 13px; font-weight: 500; padding: 6px 16px; border-radius: 999px;
  transition: background 0.15s ease, color 0.15s ease;
}
.circuit-toggle button.active { background: var(--accent); color: #fff; }

.app-body { display: flex; flex: 1; min-height: 0; }
.app-content { flex: 1; min-width: 0; padding: 24px; overflow-y: auto; }

.live-column {
  width: var(--live-col-width); flex-shrink: 0;
  border-left: 1px solid var(--border-subtle);
  background: var(--bg-panel); padding: 20px 16px; overflow-y: auto;
}
.live-column-header { display: flex; align-items: center; gap: 8px; margin-bottom: 16px; }
.live-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--live); box-shadow: 0 0 0 3px var(--live-wash); }
.live-column-title { font-family: var(--font-display); font-weight: 600; font-size: 13px; text-transform: uppercase; letter-spacing: 0.06em; color: var(--text-secondary); }

.live-match-card { background: var(--bg-panel-raised); border: 1px solid var(--border-subtle); border-radius: var(--radius-md); padding: 12px 14px; margin-bottom: 10px; }
.live-match-tournoi { font-size: 11px; color: var(--text-tertiary); margin-bottom: 8px; text-transform: uppercase; letter-spacing: 0.03em; }
.live-match-row { display: flex; justify-content: space-between; font-size: 13px; padding: 3px 0; }
.live-match-score { font-family: var(--font-mono); color: var(--accent); font-size: 12px; }

.empty-state { color: var(--text-tertiary); font-size: 13px; padding: 20px 0; text-align: center; }

.panel { background: var(--bg-panel); border: 1px solid var(--border-subtle); border-radius: var(--radius-md); padding: 20px; }
.panel + .panel { margin-top: 20px; }
.panel-title { font-family: var(--font-display); font-weight: 600; font-size: 15px; margin: 0 0 16px 0; }

.data-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.data-table th { text-align: left; color: var(--text-tertiary); font-weight: 500; font-size: 11px; text-transform: uppercase; letter-spacing: 0.04em; padding: 8px 10px; border-bottom: 1px solid var(--border-subtle); }
.data-table td { padding: 10px; border-bottom: 1px solid var(--border-subtle); }
.data-table tr:last-child td { border-bottom: none; }
.data-table tr:hover td { background: var(--bg-hover); }
.rank-pill { font-family: var(--font-mono); color: var(--text-tertiary); font-size: 12px; }

.dashboard-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 16px; margin-bottom: 20px; }
.stat-card { background: var(--bg-panel); border: 1px solid var(--border-subtle); border-radius: var(--radius-md); padding: 18px; }
.stat-card-label { color: var(--text-tertiary); font-size: 12px; text-transform: uppercase; letter-spacing: 0.04em; margin-bottom: 8px; }
.stat-card-value { font-family: var(--font-display); font-size: 26px; font-weight: 600; }

.notice { background: var(--accent-wash); border: 1px solid var(--accent-dim); color: var(--text-secondary); border-radius: var(--radius-sm); padding: 10px 14px; font-size: 12px; margin-bottom: 20px; }

@media (max-width: 960px) { .live-column { display: none; } }
@media (max-width: 640px) { .sidebar { width: 56px; } .app-content { padding: 16px; } }

/* ---------- Graphiques ---------- */
.chart-wrap {
  position: relative;
  height: 280px;
  width: 100%;
}

.chart-wrap-sm {
  height: 320px;
  max-width: 480px;
  margin: 0 auto;
}

.comparateur-controls {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 16px;
}

.comparateur-controls select {
  flex: 1;
  background: var(--bg-panel-raised);
  border: 1px solid var(--border-subtle);
  color: var(--text-primary);
  border-radius: var(--radius-sm);
  padding: 8px 10px;
  font-size: 13px;
  font-family: inherit;
}

.vs-label {
  color: var(--text-tertiary);
  font-family: var(--font-mono);
  font-size: 12px;
}
