:root {
  /* couleurs du thème choisi (bouton 🎨 ; themes.css = thèmes de timskiduh.ca) */
  --text: var(--txt); --muted: var(--mut); --accent: var(--acc); --warn: #faa61a; --grid: var(--line);
  --series-1: #3987e5; --series-2: #d95926; /* courbes : palette validée sur fond sombre */
}
:root[data-scheme=light] { --series-1: #2a78d6; --series-2: #eb6834; } /* et sur fond clair */
* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); color: var(--text); font: 14px/1.45 system-ui, -apple-system, "Segoe UI", sans-serif; }
h1 { font-size: 18px; font-weight: 600; margin: 0; }
h2 { font-size: 15px; margin: 28px 0 10px; }
.muted { color: var(--muted); }
.small { font-size: 12px; }
button { font: inherit; border: 0; border-radius: 6px; padding: 6px 12px; cursor: pointer; background: var(--accent); color: #fff; }
button.ghost, button.theme-btn { background: transparent; color: var(--muted); border: 1px solid var(--line); }
button.danger { background: var(--bad); }
button.small { padding: 2px 8px; font-size: 12px; }
button:hover { filter: brightness(1.1); }
input { font: inherit; background: var(--bg); color: var(--text); border: 1px solid var(--line); border-radius: 6px; padding: 6px 10px; min-width: 0; }

.top { display: flex; align-items: center; gap: 12px; padding: 12px 20px; background: var(--panel); border-bottom: 1px solid var(--line); flex-wrap: wrap; }
.top .theme-btn { font-size: 16px; padding: 4px 10px; }
.top h1 { flex: 1; }
.status { font-size: 12px; color: var(--muted); }
.status.ok::before { content: "● "; color: var(--good); }
.status.bad::before { content: "● "; color: var(--bad); }
main { padding: 8px 20px 40px; max-width: 1400px; margin: 0 auto; }

.tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 10px; margin-top: 16px; }
.tile { background: var(--panel); border: 1px solid var(--line); border-radius: 10px; padding: 12px 14px; }
.tile span { display: block; color: var(--muted); font-size: 12px; }
.tile b { font-size: 22px; font-weight: 600; font-variant-numeric: tabular-nums; }

.channel { background: var(--panel); border: 1px solid var(--line); border-radius: 10px; margin-bottom: 12px; overflow: hidden; }
.channel-head { display: flex; align-items: baseline; gap: 10px; padding: 10px 14px; flex-wrap: wrap; border-bottom: 1px solid var(--line); }
.channel-head b { font-size: 16px; }
.badge { font-size: 11px; font-weight: 700; padding: 1px 6px; border-radius: 4px; background: var(--line); color: var(--muted); }
.badge.live { background: var(--bad); color: #fff; }
.channel-head .meta { color: var(--muted); font-size: 12px; }
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-variant-numeric: tabular-nums; }
th, td { text-align: left; padding: 6px 10px; border-bottom: 1px solid var(--line); white-space: nowrap; font-size: 13px; }
th { color: var(--muted); font-weight: 500; font-size: 12px; }
tr:last-child td { border-bottom: 0; }
tr.host td { background: rgba(88, 101, 242, .08); }
td.ip { font-family: ui-monospace, Consolas, monospace; }
.good { color: var(--good); }
.warn { color: var(--warn); }
.bad { color: var(--bad); }
.actions { display: flex; gap: 6px; }

.charts { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
@media (max-width: 900px) { .charts { grid-template-columns: 1fr; } }
.chart-card { margin: 0; background: var(--panel); border: 1px solid var(--line); border-radius: 10px; padding: 12px 14px 8px; min-width: 0; }
.chart-card figcaption { font-weight: 600; margin-bottom: 4px; }
.legend { display: flex; gap: 14px; font-size: 12px; color: var(--muted); margin-bottom: 6px; flex-wrap: wrap; }
.legend span { display: flex; align-items: center; gap: 6px; }
.key { display: inline-block; width: 14px; height: 2px; border-radius: 1px; }
.key.s1 { background: var(--series-1); }
.key.s2 { background: var(--series-2); }
.chart { position: relative; height: 200px; }
.chart svg { display: block; width: 100%; height: 100%; overflow: visible; }
.chart .grid line { stroke: var(--grid); stroke-width: 1; }
.chart .axis text { fill: var(--muted); font-size: 11px; font-variant-numeric: tabular-nums; }
.chart .line { fill: none; stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; }
.chart .area { opacity: .1; }
.chart .cross { stroke: var(--muted); stroke-width: 1; }
.chart .dot { stroke: var(--panel); stroke-width: 2; }
.chart .end-label { fill: var(--text); font-size: 11px; font-weight: 600; }
.chart .empty { fill: var(--muted); font-size: 13px; }
.tip { position: absolute; pointer-events: none; background: var(--bg); border: 1px solid var(--line); border-radius: 8px; padding: 6px 10px; font-size: 12px;
  box-shadow: 0 4px 14px rgba(0, 0, 0, .4); white-space: nowrap; z-index: 2; }
.tip .t { color: var(--muted); margin-bottom: 2px; }
.tip div { display: flex; align-items: center; gap: 6px; }
.tip b { font-variant-numeric: tabular-nums; }
.values { margin-top: 10px; font-size: 13px; }
.values summary { cursor: pointer; color: var(--muted); }
.values table { margin-top: 8px; }
.sessions { background: var(--panel); border: 1px solid var(--line); border-radius: 10px; max-height: 360px; overflow-y: auto; }
.sessions .list { border: 0; }
.cols { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
@media (max-width: 900px) { .cols { grid-template-columns: 1fr; } }
.cols section { min-width: 0; }
.list { background: var(--panel); border: 1px solid var(--line); border-radius: 10px; overflow: hidden; display: table; }
.block-form { display: flex; gap: 8px; margin-bottom: 8px; flex-wrap: wrap; }
.block-form input { flex: 1 1 160px; }
.msg { margin: 0 0 8px; font-size: 13px; }
.fixed-form { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
.fixed { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 8px; width: 100%; }
.fixed label { display: flex; align-items: center; gap: 6px; background: var(--panel); border: 1px solid var(--line); border-radius: 8px; padding: 6px 8px; font-size: 12px; color: var(--muted); }
.fixed label input { flex: 1; }
.fixed label.on { border-color: var(--bad); }
.fixed-form .msg { margin: 0; }
.events { background: var(--panel); border: 1px solid var(--line); border-radius: 10px; max-height: 420px; overflow-y: auto; font-size: 12px; }
.events div { padding: 4px 10px; border-bottom: 1px solid var(--line); display: flex; gap: 8px; }
.events time { color: var(--muted); font-variant-numeric: tabular-nums; }
.events .ip { font-family: ui-monospace, Consolas, monospace; color: var(--muted); margin-left: auto; }
.events .bloquée, .events .refusée { color: var(--bad); }
.events .pin, .events .admin { color: var(--warn); }

.login { display: grid; place-items: center; min-height: 100vh; }
.login form { background: var(--panel); border: 1px solid var(--line); border-radius: 12px; padding: 28px; width: min(340px, 92vw); display: grid; gap: 14px; justify-items: center; }
.login label { display: grid; gap: 6px; width: 100%; color: var(--muted); font-size: 13px; }
.login button { width: 100%; padding: 9px; }
.error { color: var(--bad); margin: 0; font-size: 13px; }
.login label.remember { display: flex; align-items: center; gap: 8px; color: var(--text); }
.login label.remember input { width: auto; }
.login .pw { display: flex; gap: 4px; }
.login .pw input { flex: 1; min-width: 0; }
.login .pw-btn { width: auto; padding: 6px 8px; background: transparent; border: 1px solid var(--line); color: var(--text); }
#site-pw { width: min(280px, 100%); }
#admin-pw-form input { width: min(220px, 100%); }
.attempts-bar { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; margin-bottom: 8px; }
.attempts-bar select { font: inherit; background: var(--bg); color: var(--text); border: 1px solid var(--line); border-radius: 6px; padding: 5px 8px; }
.attempts { max-height: 420px; overflow-y: auto; }
.attempts .typed { font-family: ui-monospace, Consolas, monospace; word-break: break-all; }
