: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 var(--f-body); }
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; }

/* processeur et mémoire vive en temps réel */
.res { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 12px; }
.res-card { background: var(--panel); border: 1px solid var(--line); border-radius: 10px; padding: 12px 14px; display: flex; flex-direction: column; gap: 8px; }
.res-head { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; color: var(--muted); font-size: 12px; }
.res-head b { color: var(--text); font-size: 24px; font-weight: 600; font-variant-numeric: tabular-nums; }
.res-card p { margin: 0; font-variant-numeric: tabular-nums; }
.meter { height: 8px; border-radius: 4px; background: color-mix(in srgb, var(--text) 10%, transparent); overflow: hidden; }
.meter i { display: block; height: 100%; width: 0; border-radius: 4px; transition: width .4s; }
.meter i.s1 { background: var(--series-1); }
.meter i.s2 { background: var(--series-2); }
.meter i.hot { background: var(--bad); }
.spark svg { display: block; width: 100%; height: 56px; }
.spark .grid-line { stroke: var(--grid); stroke-width: 1; }
.spark .hover-line { stroke: var(--muted); stroke-width: 1; }
h3.sub { font-size: 13px; margin: 16px 0 8px; }
.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; }
.site-card { margin-top: 16px; background: var(--panel); border: 1px solid var(--line); border-radius: 10px; padding: 12px 14px;
  display: flex; flex-wrap: wrap; gap: 12px 24px; align-items: center; justify-content: space-between; }
.site-now { display: flex; flex-direction: column; gap: 4px; }
.site-row { display: flex; align-items: center; gap: 8px; }
.site-row code { font-size: 18px; font-weight: 600; padding: 3px 10px; border-radius: 6px; background: var(--bg); border: 1px solid var(--line); }
.site-row button[hidden] { display: none; }
#site-pw { min-width: 260px; }
.ghost-link { color: var(--text); text-decoration: none; border: 1px solid var(--line); border-radius: 6px; padding: 5px 10px; font-size: 13px; }
.ghost-link:hover { border-color: var(--accent); }
.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 label.new { border-color: var(--accent); }
.fixed label .remove { background: transparent; color: var(--muted); padding: 0 6px; font-size: 15px; line-height: 1; }
.fixed label .remove:hover { color: var(--bad); }
.fixed label .remove:disabled { visibility: hidden; }
.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; }

/* ---------- play2k : pages de connexion (mot de passe du site et du tableau de bord) ---------- */
body.login { background: radial-gradient(ellipse at 50% 20%, color-mix(in srgb, var(--acc) 26%, transparent), transparent 55%), var(--bg); }
.login-brand { display: flex; flex-direction: column; align-items: center; gap: 12px; }
.login-brand .brand-name { font-size: 30px; }
.login-sub { margin: 0; text-align: center; color: var(--muted); }
.login h1 { font-family: var(--f-display); }
.top h1 { font-family: var(--f-display); font-size: 16px; color: var(--muted); }
.top .brand img { width: 30px; height: 30px; }
.top .brand-name { font-size: 18px; }
/* pages de connexion : le mot play2k garde son espacement d'origine (2 plus grand et plus aéré) ; ailleurs, il est resserré */
.login .brand-name .two { margin: 0 -0.04em 0 -0.02em; }
