/* Pages de monitoring /stats/ (tableaux de bord) et /stats/log/ (journal) : style commun */
/* Couleurs des graphiques, validées (contraste, daltonisme) sur chaque fond : dataviz validate_palette */
:root { --c1: #26a58f; --c2: #7c6cff; --grid: rgb(255 255 255 / .07); }
@media (prefers-color-scheme: light) {
  :root:not([data-theme="dark"]) { --c1: #0f8f79; --c2: #5b4ce0; --grid: rgb(0 0 0 / .07); }
}
.wrap { max-width: 1100px; }
h1 { margin: 0 0 4px; font-size: 1.6rem; }
h2 { font-size: 1.15rem; margin: 32px 0 12px; }
.sub { color: var(--muted); margin: 0 0 16px; font-size: .9rem; }
.bar-row { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-bottom: 16px; }
.chip {
  appearance: none; border: 1px solid var(--surface-2); background: var(--surface); color: var(--text);
  font: inherit; font-size: .9rem; font-weight: 600; min-height: 44px; padding: 0 14px; border-radius: 99px; cursor: pointer;
}
.chip[aria-pressed="true"] { background: var(--accent); border-color: var(--accent); color: #fff; }
select, .log-filters input { min-height: 44px; }

/* Chiffres clés */
.tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; }
.tile { background: var(--surface); border-radius: var(--radius); padding: 12px 14px; }
.tile .k { font-size: .78rem; color: var(--muted); }
.tile .v { font-size: 1.6rem; font-weight: 800; line-height: 1.2; }
.tile .d { font-size: .75rem; color: var(--muted); }

/* Graphiques */
.charts { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 12px; }
.chart { background: var(--surface); border-radius: var(--radius); padding: 12px 14px 8px; position: relative; min-width: 0; }
.chart h3 { margin: 0; font-size: .95rem; }
.chart .note { font-size: .75rem; color: var(--muted); margin: 2px 0 6px; }
.chart svg { width: 100%; height: auto; display: block; touch-action: pan-y; }
.axis text { fill: var(--muted); font-size: 11px; }
.gridline { stroke: var(--grid); }
.mark-bar { fill: var(--c1); }
.mark-bar.alt { fill: var(--c2); }
.mark-bar:hover, .mark-bar.on { filter: brightness(1.25); }
.mark-line { fill: none; stroke: var(--c1); stroke-width: 2; stroke-linejoin: round; }
.mark-area { fill: var(--c1); opacity: .15; }
.cross { stroke: var(--muted); stroke-width: 1; }
.dot { fill: var(--c1); stroke: var(--surface); stroke-width: 2; }
.hbar-label { fill: var(--text); font-size: 12px; }
.hbar-val { fill: var(--muted); font-size: 11px; }
details.data { margin-top: 6px; font-size: .8rem; }
details.data summary { cursor: pointer; color: var(--muted); min-height: 32px; display: flex; align-items: center; }
.tip {
  position: fixed; z-index: 20; pointer-events: none; background: var(--surface-2); color: var(--text);
  border-radius: 8px; padding: 6px 9px; font-size: .8rem; box-shadow: 0 4px 16px rgb(0 0 0 / .35); display: none; max-width: 240px;
}
.tip b { font-size: .95rem; }
.tip .k { display: inline-block; width: 10px; height: 2px; background: var(--c1); vertical-align: middle; margin-right: 6px; }

/* Tableaux */
.scroll { overflow-x: auto; -webkit-overflow-scrolling: touch; background: var(--surface); border-radius: var(--radius); }
table { width: 100%; border-collapse: collapse; font-size: .85rem; }
th, td { text-align: left; padding: 8px 10px; border-bottom: 1px solid var(--surface-2); white-space: nowrap; }
th { color: var(--muted); font-weight: 600; font-size: .78rem; position: sticky; top: 0; background: var(--surface); }
td.n, th.n { text-align: right; font-variant-numeric: tabular-nums; }
.ranks { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 12px; }
.ranks h3 { font-size: .95rem; margin: 0 0 6px; }
.empty { color: var(--muted); padding: 12px; font-size: .85rem; }

/* Log */
.log-filters { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 8px; margin-bottom: 10px; }
.log-filters input, .log-filters select { width: 100%; }
.log td.det { white-space: normal; min-width: 220px; max-width: 420px; font-family: ui-monospace, Consolas, monospace; font-size: .75rem; color: var(--muted); word-break: break-word; }
.actor { font-size: .72rem; font-weight: 700; padding: 2px 7px; border-radius: 99px; background: var(--surface-2); }
.gate { background: var(--surface); border-radius: var(--radius); padding: 20px; }
.btn.more { margin: 12px auto 0; display: block; }
.muted { color: var(--muted); }
/* Onglets entre les deux pages */
.tabs { display: flex; gap: 2px; border-bottom: 1px solid var(--surface-2); margin: 4px 0 16px; overflow-x: auto; scrollbar-width: none; }
.tabs a {
  display: inline-flex; align-items: center; min-height: 44px; padding: 0 12px; color: var(--muted); white-space: nowrap; flex: none;
  text-decoration: none; font-weight: 600; border-bottom: 3px solid transparent; margin-bottom: -1px;
}
.tabs a[aria-current="page"] { color: var(--text); border-bottom-color: var(--accent); }
@media (hover: hover) { .tabs a:hover { color: var(--text); } }
/* Totaux par événement : hauteur limitée, le journal reste visible juste en dessous */
.events-box { max-height: 320px; overflow-y: auto; }
/* Onglet Classements : un bloc par jeu, ancre pour « Aller au jeu » */
.game-ranks { scroll-margin-top: 12px; }
.game-ranks h2 { display: flex; align-items: baseline; gap: 8px; }
@media (max-width: 400px) { .tabs a { padding: 0 8px; font-size: .9rem; } }
