/* ─────────────────────────────────────────────────────────
   🎨 Code couleur (le même partout : site, embeds Discord)
   🔵 messages   🟢 vocal   🟣 membres   🔴 départs   🟠 alertes
   ───────────────────────────────────────────────────────── */
:root {
  --bg: #0e1016;
  --bg-soft: #151821;
  --panel: #1a1e29;
  --line: #262b39;
  --text: #e8eaf2;
  --muted: #8a90a6;
  --msg: #5b8def;
  --voice: #3dbe8b;
  --join: #9b6bf2;
  --leave: #e5606b;
  --warn: #f0a35b;
  --radius: 14px;
  /* Polices du système : rien n'est chargé depuis Google (RGPD) */
  --font: "Segoe UI", system-ui, -apple-system, Roboto, sans-serif;
  --display: "Segoe UI Variable Display", "Segoe UI", system-ui, -apple-system, sans-serif;
}

@media (prefers-color-scheme: light) {
  :root {
    --bg: #f6f7fb;
    --bg-soft: #eef0f6;
    --panel: #ffffff;
    --line: #e2e5ee;
    --text: #171a24;
    --muted: #616781;
  }
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 15px/1.55 var(--font);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

a { color: inherit; }
h1, h2, h3 { font-family: var(--display); letter-spacing: -0.01em; margin: 0; }
.muted { color: var(--muted); }
.small { font-size: 13px; }

/* ── Barre du haut ───────────────────────────────────── */
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 14px 24px;
  border-bottom: 1px solid var(--line);
  background: var(--bg-soft);
  position: sticky;
  top: 0;
  z-index: 5;
}
.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  font: 700 18px var(--display);
  text-decoration: none;
}
.brand-mark { display: inline-flex; align-items: flex-end; gap: 3px; height: 20px; }
.brand-mark span { width: 5px; border-radius: 2px; }
.brand-mark span:nth-child(1) { height: 9px; background: var(--msg); }
.brand-mark span:nth-child(2) { height: 15px; background: var(--voice); }
.brand-mark span:nth-child(3) { height: 20px; background: var(--join); }

.nav { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; }
.nav > a { text-decoration: none; color: var(--muted); font-weight: 500; }
.nav > a:hover { color: var(--text); }
.nav-admin { color: var(--warn) !important; }

.lang-switch { display: flex; border: 1px solid var(--line); border-radius: 8px; overflow: hidden; }
.lang-switch a { padding: 3px 9px; font-size: 12px; font-weight: 600; text-decoration: none; color: var(--muted); }
.lang-switch a.on { background: var(--msg); color: #fff; }

.user-chip {
  display: flex; align-items: center; gap: 8px; padding: 3px 10px 3px 3px;
  border: 1px solid var(--line); border-radius: 999px; text-decoration: none;
}
.user-chip img { border-radius: 50%; }

/* ── Boutons ─────────────────────────────────────────── */
.btn {
  display: inline-block;
  padding: 11px 20px;
  border-radius: 10px;
  background: var(--msg);
  color: #fff;
  font-weight: 600;
  text-decoration: none;
  border: 1px solid transparent;
}
.btn:hover { filter: brightness(1.1); }
.btn-ghost { background: transparent; border-color: var(--line); color: var(--text); }
.btn-small { padding: 6px 12px; font-size: 14px; }

/* ── Mise en page ────────────────────────────────────── */
.page { width: 100%; max-width: 1180px; margin: 0 auto; padding: 32px 24px 48px; flex: 1; }
.page-head { margin-bottom: 24px; }
.page-head h1 { font-size: 30px; }

.hero { padding: 48px 0 40px; max-width: 760px; }
.hero-small { padding-top: 24px; }
.hero h1 { font-size: clamp(32px, 5vw, 50px); line-height: 1.08; }
.eyebrow { color: var(--voice); font-weight: 600; text-transform: uppercase; letter-spacing: .08em; font-size: 13px; margin: 0 0 12px; }
.lead { color: var(--muted); font-size: 18px; margin: 18px 0 28px; }
.hero-actions { display: flex; gap: 12px; flex-wrap: wrap; }

.features { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 16px; }
.feature { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 20px; border-top: 3px solid var(--accent, var(--line)); }
.feature h3 { font-size: 17px; margin-bottom: 8px; }
.feature p { margin: 0; color: var(--muted); }

/* Couleurs par type */
.c-msg { --accent: var(--msg); }
.c-voice { --accent: var(--voice); }
.c-join { --accent: var(--join); }
.c-leave { --accent: var(--leave); }
.c-warn { --accent: var(--warn); }

.notice { padding: 12px 16px; border-radius: 10px; margin: 0 0 20px; }
.notice-warn { background: color-mix(in srgb, var(--warn) 15%, transparent); border: 1px solid color-mix(in srgb, var(--warn) 45%, transparent); }

/* ── Tableau de bord ─────────────────────────────────── */
.guild-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 14px; }
.guild-card {
  display: flex; flex-direction: column; align-items: center; gap: 8px; text-align: center;
  padding: 22px 14px; background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius);
  text-decoration: none; transition: transform .15s, border-color .15s;
}
.guild-card:hover { transform: translateY(-2px); border-color: var(--msg); }
.guild-card img, .guild-icon { border-radius: 16px; }
.guild-initial {
  width: 56px; height: 56px; border-radius: 16px; display: grid; place-items: center;
  background: var(--bg-soft); font: 700 22px var(--display);
}
.guild-name { font-weight: 600; }
.empty { padding: 32px; text-align: center; background: var(--panel); border: 1px dashed var(--line); border-radius: var(--radius); }
.add-more { margin-top: 20px; }

/* ── Page d'un serveur ───────────────────────────────── */
.guild-head { display: flex; align-items: center; gap: 16px; flex-wrap: wrap; }
.guild-head > div { flex: 1; min-width: 200px; }
.guild-head p { margin: 4px 0 0; }
.period-switch { display: flex; background: var(--panel); border: 1px solid var(--line); border-radius: 10px; padding: 3px; }
.period-switch button {
  border: 0; background: transparent; color: var(--muted); font: 600 14px var(--font);
  padding: 7px 14px; border-radius: 8px; cursor: pointer;
}
.period-switch button.on { background: var(--msg); color: #fff; }

.kpis { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 12px; margin-bottom: 20px; }
.kpi {
  background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 14px 16px; display: flex; flex-direction: column; gap: 2px;
  border-left: 4px solid var(--accent, var(--line));
}
.kpi-label { color: var(--muted); font-size: 13px; }
.kpi strong { font: 700 26px var(--display); }
.evo, .sub { font-size: 13px; color: var(--muted); }
.evo.up { color: var(--voice); }
.evo.down { color: var(--leave); }

.charts, .tops { display: grid; grid-template-columns: repeat(auto-fit, minmax(420px, 1fr)); gap: 16px; margin-bottom: 16px; }
.panel { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px; margin-bottom: 16px; }
.charts .panel, .tops .panel { margin-bottom: 0; min-width: 0; }
.panel h2 { font-size: 16px; margin-bottom: 14px; display: flex; align-items: center; gap: 8px; }
.dot { width: 10px; height: 10px; border-radius: 50%; background: var(--accent); display: inline-block; }
.chart-box { position: relative; min-height: 268px; }
.chart-box svg { display: block; width: 100%; height: auto; }
.chart-legend { display: flex; flex-wrap: wrap; gap: 14px; font-size: 12px; color: var(--muted); margin-bottom: 6px; }
.chart-legend i, .chart-tip i { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: 6px; vertical-align: -1px; }
.chart-tip {
  position: absolute; top: 34px; pointer-events: none; z-index: 2;
  background: var(--bg-soft); border: 1px solid var(--line); border-radius: 8px;
  padding: 8px 10px; font-size: 12px; display: flex; flex-direction: column; gap: 3px;
  box-shadow: 0 6px 18px rgba(0,0,0,.25); white-space: nowrap;
}
.chart-tip[hidden] { display: none; }
.chart-tip em { color: var(--warn); font-style: normal; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip { padding: 4px 10px; border-radius: 99px; background: var(--bg-soft); border: 1px solid var(--line); font-size: 13px; }
.avatar-ph { width: 26px; height: 26px; border-radius: 50%; background: var(--bg-soft); display: grid; place-items: center; font-size: 12px; font-weight: 700; }
code { font-family: ui-monospace, Consolas, monospace; font-size: 13px; background: var(--bg-soft); padding: 1px 6px; border-radius: 5px; }
.demo-banner { background: var(--warn); color: #1b1206; text-align: center; font-weight: 600; font-size: 14px; padding: 6px 12px; }

/* Carte de chaleur : jours × heures */
.heatmap { display: grid; grid-template-columns: 34px repeat(24, minmax(0, 1fr)); gap: 2px; font-size: 11px; }
.heatmap .hm-label { color: var(--muted); display: flex; align-items: center; }
.heatmap .hm-hour { color: var(--muted); text-align: center; }
.heatmap .hm-cell { aspect-ratio: 1; border-radius: 3px; background: var(--bg-soft); }

/* Classements */
.rank { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.rank li { display: flex; align-items: center; gap: 10px; }
.rank .pos { width: 22px; color: var(--muted); font-weight: 600; text-align: right; }
.rank img { width: 26px; height: 26px; border-radius: 50%; }
.rank .name { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rank .bar { flex: 1.3; height: 8px; background: var(--bg-soft); border-radius: 99px; overflow: hidden; }
.rank .bar i { display: block; height: 100%; background: var(--accent, var(--msg)); border-radius: 99px; }
.rank .val { min-width: 64px; text-align: right; font-variant-numeric: tabular-nums; }

/* ── Panel admin ─────────────────────────────────────── */
.table-wrap { overflow-x: auto; }
.table { width: 100%; border-collapse: collapse; font-size: 14px; }
.table th { text-align: left; color: var(--muted); font-weight: 600; padding: 8px 10px; border-bottom: 1px solid var(--line); }
.table td { padding: 9px 10px; border-bottom: 1px solid var(--line); }
.table .num { text-align: right; font-variant-numeric: tabular-nums; }
.table tr.inactive { opacity: .5; }
.cell-guild { display: flex; align-items: center; gap: 8px; text-decoration: none; }
.cell-guild img { border-radius: 6px; }
.pill { font-size: 12px; font-weight: 600; padding: 2px 8px; border-radius: 99px; }
.pill-ok { background: color-mix(in srgb, var(--voice) 20%, transparent); color: var(--voice); }
.pill-off { background: color-mix(in srgb, var(--leave) 20%, transparent); color: var(--leave); }

/* ── Pages légales ───────────────────────────────────── */
.legal { max-width: 760px; }
.legal h1 { font-size: 32px; margin-bottom: 4px; }
.legal h2 { font-size: 19px; margin: 28px 0 8px; }
.legal p, .legal li { color: var(--text); }
.legal ul { padding-left: 20px; }
.legal a { color: var(--msg); }

/* ── Bas de page ─────────────────────────────────────── */
.footer {
  display: flex; justify-content: space-between; gap: 16px; flex-wrap: wrap;
  padding: 18px 24px; border-top: 1px solid var(--line); color: var(--muted); font-size: 13px;
}
.footer-links { display: flex; gap: 16px; }

/* ── Téléphone ───────────────────────────────────────── */
@media (max-width: 640px) {
  .topbar { padding: 12px 16px; }
  .page { padding: 20px 16px 40px; }
  .charts, .tops { grid-template-columns: 1fr; }
  .user-chip span { display: none; }
  .heatmap { font-size: 9px; gap: 1px; grid-template-columns: 26px repeat(24, minmax(0, 1fr)); }
  .heatmap .hm-hour { overflow: visible; }
}
