:root {
  color-scheme: dark;
  --bg: #080b12; --surface: #0e1420; --surface-2: #131b2a; --surface-3: #1a2335;
  --border: rgba(255, 255, 255, .08); --border-strong: rgba(255, 255, 255, .15);
  --text: #eef1f7; --text-2: #aab3c5; --muted: #7b859a; --accent: #5e9cff;
  --grid: #1b2433; --axis: #2c384c;
  /* palette catégorielle validée (palette_validate : fond #0e1420, mode sombre) */
  --s1: #3987e5; --s2: #d95926; --s3: #199e70; --s4: #c98500;
  /* états (toujours avec icône + libellé) */
  --good: #0ca30c; --warn: #fab219; --serious: #ec835a; --crit: #d03b3b;
  --font: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--text); font-family: var(--font); -webkit-font-smoothing: antialiased; }
body { min-height: 100vh; background: radial-gradient(1100px 520px at 75% -8%, rgba(94, 156, 255, .09), transparent 60%), var(--bg); font-size: 14px; line-height: 1.45; }
a { color: inherit; }
.muted { color: var(--muted); } .pad { padding: 24px; }
[hidden] { display: none !important; }

/* ───── connexion ───── */
body.gate { display: grid; place-items: center; padding: 24px; }
.gate-card { width: min(380px, 100%); text-align: center; background: var(--surface); border: 1px solid var(--border); border-radius: 18px; padding: 36px 28px 30px; }
.gate-logo { border-radius: 16px; margin-bottom: 14px; }
.gate-card h1 { margin: 0 0 4px; font-size: 24px; font-weight: 600; letter-spacing: -.01em; }
.gate-sub { margin: 0 0 24px; color: var(--text-2); }
.gate-note { margin: 16px 0 0; color: var(--muted); font-size: 12px; }
.btn-discord, .btn-ghost { display: inline-flex; align-items: center; justify-content: center; gap: 10px; width: 100%; padding: 12px 16px; border-radius: 12px; font-weight: 600; text-decoration: none; }
.btn-discord { background: #5865f2; color: #fff; } .btn-discord:hover { background: #4752c4; }
.btn-ghost { border: 1px solid var(--border-strong); color: var(--text); } .btn-ghost:hover { background: var(--surface-2); }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 6px; }

/* ───── en-tête ───── */
.top { position: sticky; top: 0; z-index: 20; background: rgba(8, 11, 18, .82); backdrop-filter: blur(10px); border-bottom: 1px solid var(--border); }
.top-in { max-width: 1280px; margin: 0 auto; padding: 10px 20px; display: flex; align-items: center; gap: 22px; flex-wrap: wrap; }
.brand { display: flex; align-items: center; gap: 10px; text-decoration: none; font-weight: 600; letter-spacing: -.01em; }
.brand img { border-radius: 8px; }
.tabs { display: flex; gap: 4px; }
.tabs a { padding: 7px 13px; border-radius: 9px; text-decoration: none; color: var(--text-2); }
.tabs a:hover { background: var(--surface-2); color: var(--text); }
.tabs a[aria-current="page"] { background: var(--surface-3); color: var(--text); }
.top-right { margin-left: auto; display: flex; align-items: center; gap: 14px; flex-wrap: wrap; }
.upd { color: var(--muted); font-size: 12px; min-width: 96px; text-align: right; }
.seg { display: inline-flex; border: 1px solid var(--border-strong); border-radius: 10px; overflow: hidden; }
.seg button { background: transparent; color: var(--text-2); border: 0; padding: 6px 12px; font: inherit; cursor: pointer; }
.seg button:hover { background: var(--surface-2); }
.seg button[aria-pressed="true"] { background: var(--surface-3); color: var(--text); font-weight: 600; }
.linkbtn { background: none; border: 0; color: var(--muted); font: inherit; cursor: pointer; text-decoration: underline; text-underline-offset: 3px; padding: 4px; }
.linkbtn:hover { color: var(--text); }
form { margin: 0; }

/* ───── mise en page ───── */
.wrap { max-width: 1280px; margin: 0 auto; padding: 20px 20px 60px; transition: opacity .2s; }
.wrap[aria-busy="true"] .page { opacity: .55; }
.page > * + * { margin-top: 16px; }
.h2 { margin: 28px 0 4px; font-size: 13px; font-weight: 600; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); }
.row { display: grid; gap: 16px; }
.c2 { grid-template-columns: repeat(2, minmax(0, 1fr)); } .c3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.tiles { display: grid; gap: 12px; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); }
@media (max-width: 900px) { .c2, .c3 { grid-template-columns: 1fr; } }
.card { background: var(--surface); border: 1px solid var(--border); border-radius: 16px; padding: 16px 18px 18px; min-width: 0; }
.card > h3 { margin: 0 0 2px; font-size: 14px; font-weight: 600; }
.card .sub { margin: 0 0 12px; color: var(--muted); font-size: 12px; }
.note { color: var(--muted); font-size: 12px; margin: 8px 0 0; }
.empty { color: var(--muted); padding: 28px 0; text-align: center; font-size: 13px; }

/* ───── tuiles chiffrées ───── */
.tile { background: var(--surface); border: 1px solid var(--border); border-radius: 16px; padding: 14px 16px 12px; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.tile .l { color: var(--text-2); font-size: 12.5px; }
.tile .v { font-size: 28px; font-weight: 600; letter-spacing: -.02em; line-height: 1.15; margin-top: 2px; }
.tile .v.sm { font-size: 20px; padding: 5px 0 4px; }
.tile .d { font-size: 12px; color: var(--muted); min-height: 17px; }
.tile svg { margin-top: 4px; display: block; }
.up { color: var(--good); } .down { color: var(--serious); } .flat { color: var(--muted); }
.good { color: var(--good); } .warnc { color: var(--warn); } .crit { color: var(--crit); }

/* ───── graphiques ───── */
.chart { position: relative; }
.legend { display: flex; flex-wrap: wrap; gap: 14px; margin: 0 0 8px; font-size: 12px; color: var(--text-2); }
.legend i { display: inline-block; width: 14px; height: 0; border-top: 2px solid; border-radius: 2px; margin-right: 6px; vertical-align: middle; }
.legend i.box { height: 10px; width: 10px; border-top: 0; border-radius: 3px; }
.plot { width: 100%; }
.plot svg { display: block; width: 100%; height: 100%; overflow: visible; }
.plot text { fill: var(--muted); font: 11px var(--font); }
.plot .hit { fill: transparent; }
.tbtn { position: absolute; top: -4px; right: 0; background: none; border: 1px solid var(--border); color: var(--muted); border-radius: 8px; padding: 3px 9px; font: 12px var(--font); cursor: pointer; }
.tbtn:hover { color: var(--text); border-color: var(--border-strong); }
.tview { margin-top: 10px; max-height: 260px; overflow: auto; }
.tip { position: fixed; z-index: 50; pointer-events: none; background: var(--surface-3); border: 1px solid var(--border-strong); border-radius: 10px; padding: 8px 11px; font-size: 12px; box-shadow: 0 8px 28px rgba(0, 0, 0, .45); max-width: 280px; }
.tip .t { color: var(--text-2); margin-bottom: 4px; }
.tip .r { display: flex; align-items: center; gap: 8px; }
.tip .r i { width: 12px; border-top: 2px solid; border-radius: 2px; }
.tip .r b { font-size: 13px; font-weight: 600; }
.tip .r span { color: var(--text-2); }

/* ───── barres horizontales, jauges ───── */
.hb { display: grid; gap: 8px; }
.hb .it { display: grid; grid-template-columns: minmax(70px, 34%) 1fr auto; gap: 10px; align-items: center; }
.hb .lb { color: var(--text-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-size: 13px; }
.hb .tr { height: 12px; }
.hb .fl { height: 12px; border-radius: 0 4px 4px 0; min-width: 2px; transition: opacity .15s; }
.hb .it:hover .fl { opacity: .8; }
.hb .vl { color: var(--text); font-size: 13px; font-variant-numeric: tabular-nums; min-width: 38px; text-align: right; }
.hb .vl small { color: var(--muted); margin-left: 6px; font-size: 11.5px; }
.meter { margin: 10px 0 14px; }
.meter .mh { display: flex; justify-content: space-between; font-size: 13px; margin-bottom: 6px; }
.meter .mh span:last-child { color: var(--text-2); font-variant-numeric: tabular-nums; }
.meter .mt { height: 10px; background: rgba(57, 135, 229, .16); border-radius: 5px; overflow: hidden; }
.meter .mf { height: 10px; border-radius: 5px; }

/* ───── tableaux ───── */
table.tbl { width: 100%; border-collapse: collapse; font-size: 13px; }
.tbl th { text-align: left; color: var(--muted); font-weight: 500; font-size: 12px; padding: 6px 10px 6px 0; border-bottom: 1px solid var(--border); white-space: nowrap; }
.tbl td { padding: 7px 10px 7px 0; border-bottom: 1px solid var(--border); color: var(--text-2); }
.tbl td:first-child { color: var(--text); }
.tbl .num { text-align: right; font-variant-numeric: tabular-nums; }
.tbl tr:last-child td { border-bottom: 0; }
.st { white-space: nowrap; font-weight: 500; }
.pre { font: 12px/1.5 ui-monospace, "SF Mono", Consolas, monospace; color: var(--text-2); background: var(--surface-2); border-radius: 10px; padding: 10px 12px; overflow: auto; max-height: 220px; white-space: pre-wrap; word-break: break-word; }
.list { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.list li { display: flex; gap: 10px; align-items: baseline; color: var(--text-2); }
.list li b { color: var(--text); font-weight: 600; }
.list .ic { width: 16px; flex: none; text-align: center; }
.btn { background: var(--surface-3); border: 1px solid var(--border-strong); color: var(--text); border-radius: 10px; padding: 7px 14px; font: inherit; cursor: pointer; }
.btn:hover { background: #222d44; } .btn[disabled] { opacity: .6; cursor: progress; }
.banner { background: rgba(236, 131, 90, .12); border: 1px solid rgba(236, 131, 90, .35); color: var(--serious); border-radius: 12px; padding: 10px 14px; }
@media (max-width: 640px) { .top-in { gap: 10px; } .tabs { order: 3; width: 100%; overflow-x: auto; } .hb .it { grid-template-columns: minmax(60px, 38%) 1fr auto; } }
@media (prefers-reduced-motion: reduce) { * { transition: none !important; } }
