/* VexCloud — Panel anti-DDoS
   Design system aligné sur le site vexcloud.fr (app/globals.css + tailwind.config.js) :
   mêmes tokens "r g b" clair / sombre, Plus Jakarta Sans + JetBrains Mono,
   rayons 8/10/16 px, boutons pilule à dégradé, pastilles d'état sans animation.
   Adapté à un outil de supervision : densité, tableaux lisibles, chiffres tabulaires. */

:root {
  --bg: 245 248 255;
  --surface: 255 255 255;
  --surface-2: 236 242 253;
  --line: 222 229 243;
  --line-strong: 196 207 229;
  --ink: 12 20 44;
  --ink-2: 62 75 104;
  --ink-3: 96 109 138;
  --accent: 29 92 240;
  --accent-hover: 20 74 210;
  --accent-ink: 24 80 222;
  --accent-soft: 228 237 255;
  --brand-2: 6 182 212;
  --ok: 5 130 90;
  --ok-soft: 222 247 236;
  --warn: 146 92 0;
  --warn-soft: 255 244 220;
  --danger: 200 40 60;
  --danger-soft: 254 232 236;
  --shadow: 30 50 110;
  /* Séries de graphiques (contraste ≥ 3:1 sur la surface) */
  --series-in: 29 92 240;
  --series-out: 194 65 12;
  --series-drop: 200 40 60;
  --series-p95: 146 92 0;
  --font-sans: "Plus Jakarta Sans", system-ui, -apple-system, "Segoe UI", sans-serif;
  --font-mono: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, monospace;
  --radius: 8px;
  --radius-md: 10px;
  --radius-lg: 16px;
  --sidebar-w: 248px;
  --topbar-h: 64px;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: 7 11 24;
    --surface: 13 20 40;
    --surface-2: 19 29 56;
    --line: 32 44 76;
    --line-strong: 48 63 102;
    --ink: 238 243 255;
    --ink-2: 172 185 214;
    --ink-3: 134 149 182;
    --accent: 52 104 245;
    --accent-hover: 40 90 228;
    --accent-ink: 120 165 255;
    --accent-soft: 24 38 84;
    --brand-2: 34 211 238;
    --ok: 64 214 150;
    --ok-soft: 12 46 38;
    --warn: 240 184 76;
    --warn-soft: 48 36 12;
    --danger: 251 113 133;
    --danger-soft: 60 18 30;
    --shadow: 0 0 0;
    --series-in: 120 165 255;
    --series-out: 251 146 60;
    --series-drop: 251 113 133;
    --series-p95: 240 184 76;
    color-scheme: dark;
  }
}

:root[data-theme="dark"] {
  --bg: 7 11 24;
  --surface: 13 20 40;
  --surface-2: 19 29 56;
  --line: 32 44 76;
  --line-strong: 48 63 102;
  --ink: 238 243 255;
  --ink-2: 172 185 214;
  --ink-3: 134 149 182;
  --accent: 52 104 245;
  --accent-hover: 40 90 228;
  --accent-ink: 120 165 255;
  --accent-soft: 24 38 84;
  --brand-2: 34 211 238;
  --ok: 64 214 150;
  --ok-soft: 12 46 38;
  --warn: 240 184 76;
  --warn-soft: 48 36 12;
  --danger: 251 113 133;
  --danger-soft: 60 18 30;
  --shadow: 0 0 0;
  --series-in: 120 165 255;
  --series-out: 251 146 60;
  --series-drop: 251 113 133;
  --series-p95: 240 184 76;
  color-scheme: dark;
}

/* ─── Base ─────────────────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: rgb(var(--bg));
  color: rgb(var(--ink));
  font-family: var(--font-sans);
  font-size: 0.9375rem;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  overflow-x: clip;
}
::selection { background: rgb(var(--accent) / 0.22); }
:focus-visible { outline: 2px solid rgb(var(--accent)); outline-offset: 2px; border-radius: 4px; }
a { color: rgb(var(--accent-ink)); text-decoration: none; }
a:hover { text-decoration: underline; text-underline-offset: 2px; }
h1, h2, h3, h4 { margin: 0; color: rgb(var(--ink)); text-wrap: balance; }
h1 { font-size: 1.375rem; font-weight: 700; letter-spacing: -0.015em; line-height: 1.25; }
h2 { font-size: 1.0625rem; font-weight: 700; letter-spacing: -0.01em; }
h3 { font-size: 0.9375rem; font-weight: 700; }
p { margin: 0; text-wrap: pretty; }
code, .mono { font-family: var(--font-mono); font-size: 0.86em; font-weight: 500; }
code { background: rgb(var(--surface-2)); padding: 0.1em 0.4em; border-radius: 4px; }
.num { font-variant-numeric: tabular-nums; }
.muted { color: rgb(var(--ink-3)); }
.ink-2 { color: rgb(var(--ink-2)); }
.small { font-size: 0.8125rem; }
.tiny { font-size: 0.75rem; }
.nowrap { white-space: nowrap; }
.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0;
}
[hidden] { display: none !important; }
.skip-link {
  position: fixed; left: 1rem; top: -4rem; z-index: 200; padding: 0.5rem 1rem;
  background: rgb(var(--accent)); color: #fff; border-radius: var(--radius); font-weight: 600;
}
.skip-link:focus { top: 1rem; }

/* ─── Shell : barre latérale + contenu ─────────────────────────────────── */
.app { display: flex; min-height: 100vh; }
.sidebar {
  position: sticky; top: 0; height: 100vh; width: var(--sidebar-w); flex-shrink: 0;
  display: flex; flex-direction: column; gap: 0.25rem;
  background: rgb(var(--surface)); border-right: 1px solid rgb(var(--line));
  padding: 1rem 0.75rem; overflow-y: auto; z-index: 40;
}
.brand { display: flex; align-items: center; gap: 0.625rem; padding: 0.25rem 0.5rem 1rem; color: rgb(var(--ink)); }
.brand:hover { text-decoration: none; }
.brand img { height: 30px; width: auto; }
.brand-name { font-size: 1.0625rem; font-weight: 700; letter-spacing: -0.01em; line-height: 1.1; }
.brand-sub { display: block; font-size: 0.6875rem; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase; color: rgb(var(--accent-ink)); }
.nav-group { padding: 0.5rem 0 0.25rem; }
.nav-label {
  padding: 0.25rem 0.75rem 0.375rem; font-size: 0.6875rem; font-weight: 700;
  letter-spacing: 0.08em; text-transform: uppercase; color: rgb(var(--ink-3));
}
.nav-link {
  display: flex; align-items: center; gap: 0.625rem; height: 2.375rem; padding: 0 0.75rem;
  border-radius: var(--radius); color: rgb(var(--ink-2)); font-weight: 500; font-size: 0.9rem;
  border: 0; background: none; width: 100%; cursor: pointer; font-family: inherit; text-align: left;
}
.nav-link svg { width: 18px; height: 18px; flex-shrink: 0; }
.nav-link:hover { background: rgb(var(--surface-2)); color: rgb(var(--ink)); text-decoration: none; }
.nav-link[aria-current="page"] { background: rgb(var(--accent-soft)); color: rgb(var(--accent-ink)); font-weight: 600; }
.nav-count {
  margin-left: auto; min-width: 1.4rem; height: 1.25rem; padding: 0 0.4rem; border-radius: 999px;
  display: inline-flex; align-items: center; justify-content: center;
  font-size: 0.7rem; font-weight: 700; background: rgb(var(--danger)); color: #fff;
}
.sidebar-foot { margin-top: auto; border-top: 1px solid rgb(var(--line)); padding-top: 0.75rem; }
.user-chip { display: flex; align-items: center; gap: 0.625rem; padding: 0.5rem 0.75rem; min-width: 0; }
.avatar {
  width: 2rem; height: 2rem; border-radius: 999px; flex-shrink: 0; display: grid; place-items: center;
  background: linear-gradient(120deg, rgb(var(--accent)), rgb(8 145 178)); color: #fff; font-weight: 700; font-size: 0.8rem;
}
.user-chip b { display: block; font-size: 0.8125rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.user-chip span { font-size: 0.75rem; color: rgb(var(--ink-3)); }
.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.topbar {
  position: sticky; top: 0; z-index: 30; min-height: var(--topbar-h);
  display: flex; align-items: center; gap: 1rem; padding: 0.75rem 1.5rem;
  background: rgb(var(--bg) / 0.9); backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
  border-bottom: 1px solid rgb(var(--line));
}
.topbar-title { min-width: 0; flex: 1; }
.crumbs { font-size: 0.75rem; color: rgb(var(--ink-3)); display: flex; gap: 0.375rem; align-items: center; flex-wrap: wrap; }
.crumbs a { color: rgb(var(--ink-3)); }
.topbar-actions { display: flex; align-items: center; gap: 0.5rem; flex-wrap: wrap; justify-content: flex-end; }
.content { padding: 1.5rem; display: flex; flex-direction: column; gap: 1.25rem; max-width: 1600px; width: 100%; }
/* Vues regroupées (#list-view, #r-view, #adm…) : même espacement que la page,
   sinon leurs cartes se touchent. Conteneur vide (rempli plus tard en JS) :
   aucun espace fantôme. */
.content > div:not([class]), .stack-y { display: flex; flex-direction: column; gap: 1.25rem; min-width: 0; }
.content > :empty { display: none; }
.menu-btn { display: none; }
.backdrop { display: none; }

@media (max-width: 1024px) {
  .sidebar {
    position: fixed; left: 0; top: 0; bottom: 0; transform: translateX(-100%);
    transition: transform 0.18s ease; box-shadow: 0 12px 40px -12px rgb(var(--shadow) / 0.35);
  }
  body.nav-open .sidebar { transform: none; }
  body.nav-open .backdrop { display: block; position: fixed; inset: 0; background: rgb(var(--ink) / 0.35); z-index: 35; }
  .menu-btn { display: inline-flex; }
  .topbar { padding: 0.625rem 1rem; }
  .content { padding: 1rem; }
}
@media (max-width: 640px) {
  .topbar { flex-wrap: wrap; }
  /* Une seule ligne : l'état à gauche (peut se raccourcir), les boutons à droite */
  .topbar-actions { width: 100%; flex-wrap: nowrap; justify-content: flex-end; }
  .topbar-actions .status-pill { margin-right: auto; min-width: 0; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
  .hide-sm { display: none !important; }
  h1 { font-size: 1.2rem; }
}

/* ─── Composants ───────────────────────────────────────────────────────── */
.card {
  background: rgb(var(--surface)); border: 1px solid rgb(var(--line)); border-radius: var(--radius-lg);
  box-shadow: 0 1px 2px rgb(var(--shadow) / 0.05), 0 12px 32px -14px rgb(var(--shadow) / 0.18);
  min-width: 0;
}
.card-head {
  display: flex; align-items: center; justify-content: space-between; gap: 0.75rem; flex-wrap: wrap;
  padding: 1rem 1.25rem; border-bottom: 1px solid rgb(var(--line));
}
.card-head p { color: rgb(var(--ink-3)); font-size: 0.8125rem; margin-top: 0.125rem; }
.card-body { padding: 1.25rem; }
.card-foot { padding: 0.75rem 1.25rem; border-top: 1px solid rgb(var(--line)); display: flex; align-items: center; justify-content: space-between; gap: 0.75rem; flex-wrap: wrap; }
.card-tools { display: flex; align-items: center; gap: 0.5rem; flex-wrap: wrap; }
.eyebrow {
  display: inline-flex; align-items: center; gap: 0.4rem; padding: 0.2rem 0.65rem; border-radius: 999px;
  border: 1px solid rgb(var(--accent-ink) / 0.25); background: rgb(var(--accent-ink) / 0.1);
  color: rgb(var(--accent-ink)); font-size: 0.72rem; font-weight: 700; letter-spacing: 0.04em;
}

.grid { display: grid; gap: 1.25rem; }
.grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid-main { grid-template-columns: minmax(0, 2fr) minmax(0, 1fr); }
@media (max-width: 1200px) { .grid-main { grid-template-columns: minmax(0, 1fr); } }
@media (max-width: 900px) { .grid-2, .grid-3 { grid-template-columns: minmax(0, 1fr); } }

/* KPI */
.kpis { display: grid; gap: 1rem; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); }
.kpi { padding: 1rem 1.125rem; display: flex; flex-direction: column; gap: 0.25rem; position: relative; }
.kpi-label { font-size: 0.75rem; font-weight: 600; color: rgb(var(--ink-3)); display: flex; align-items: center; gap: 0.375rem; }
.kpi-value { font-size: 1.625rem; font-weight: 800; letter-spacing: -0.02em; line-height: 1.15; font-variant-numeric: tabular-nums; }
.kpi-value small { font-size: 0.875rem; font-weight: 600; color: rgb(var(--ink-3)); margin-left: 0.25rem; }
.kpi-sub { font-size: 0.78rem; color: rgb(var(--ink-3)); }
.kpi.is-danger .kpi-value { color: rgb(var(--danger)); }
.kpi.is-ok .kpi-value { color: rgb(var(--ok)); }
.kpi.is-warn .kpi-value { color: rgb(var(--warn)); }
.kpi.is-danger { border-color: rgb(var(--danger) / 0.35); background: linear-gradient(180deg, rgb(var(--danger-soft) / 0.6), rgb(var(--surface)) 70%); }

/* Info-bulle de définition */
.def {
  display: inline-grid; place-items: center; width: 1rem; height: 1rem; border-radius: 999px; border: 0; padding: 0;
  background: rgb(var(--surface-2)); color: rgb(var(--ink-3)); font-size: 0.65rem; font-weight: 700; cursor: help; position: relative;
}
.def:hover, .def:focus-visible { color: rgb(var(--accent-ink)); }
.def[data-tip]:hover::after, .def[data-tip]:focus-visible::after {
  content: attr(data-tip); position: absolute; left: 50%; top: calc(100% + 6px); transform: translateX(-50%);
  width: max-content; max-width: 280px; padding: 0.5rem 0.65rem; border-radius: var(--radius);
  background: rgb(var(--ink)); color: rgb(var(--bg)); font-size: 0.75rem; font-weight: 500; line-height: 1.4;
  text-align: left; white-space: normal; z-index: 60; box-shadow: 0 12px 40px -12px rgb(var(--shadow) / 0.35);
}

/* Boutons (pilule, comme le site) */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 0.45rem; white-space: nowrap;
  height: 2.375rem; padding: 0 1rem; border-radius: 999px; font: inherit; font-weight: 600; font-size: 0.875rem;
  border: 1px solid rgb(var(--line-strong)); background: rgb(var(--surface)); color: rgb(var(--ink));
  cursor: pointer; transition: border-color 0.15s, color 0.15s, background 0.15s, filter 0.15s;
}
.btn:hover { border-color: rgb(var(--accent) / 0.6); color: rgb(var(--accent-ink)); text-decoration: none; }
.btn svg { width: 16px; height: 16px; flex-shrink: 0; }
.btn:disabled, .btn[aria-disabled="true"] { opacity: 0.5; cursor: not-allowed; }
.btn-primary {
  border-color: transparent; color: #fff;
  background: linear-gradient(120deg, rgb(var(--accent)) 0%, rgb(8 145 178) 100%);
  box-shadow: 0 10px 30px -14px rgb(var(--accent) / 0.65);
}
.btn-primary:hover { color: #fff; filter: brightness(1.08); border-color: transparent; }
.btn-danger { border-color: rgb(var(--danger) / 0.4); color: rgb(var(--danger)); background: rgb(var(--danger-soft)); }
.btn-danger:hover { border-color: rgb(var(--danger)); color: rgb(var(--danger)); }
.btn-ghost { border-color: transparent; background: none; color: rgb(var(--ink-2)); }
.btn-ghost:hover { background: rgb(var(--surface-2)); color: rgb(var(--ink)); border-color: transparent; }
.btn-sm { height: 2rem; padding: 0 0.75rem; font-size: 0.8125rem; }
.btn-icon { width: 2.375rem; padding: 0; }
.btn-icon.btn-sm { width: 2rem; }
.btn.is-on { background: rgb(var(--accent-soft)); color: rgb(var(--accent-ink)); border-color: rgb(var(--accent) / 0.4); }

/* Contrôles segmentés (périodes, filtres) */
.seg {
  display: inline-flex; padding: 3px; gap: 2px; border-radius: 999px; background: rgb(var(--surface-2)); border: 1px solid rgb(var(--line));
  max-width: 100%; overflow-x: auto; scrollbar-width: none;
}
.seg::-webkit-scrollbar { display: none; }
.seg button {
  border: 0; background: none; font: inherit; font-size: 0.8125rem; font-weight: 600; color: rgb(var(--ink-2));
  height: 1.875rem; padding: 0 0.75rem; border-radius: 999px; cursor: pointer;
  white-space: nowrap; flex: none; /* « Avec trafic » ne se coupe plus sur deux lignes */
}
.seg button:hover { color: rgb(var(--ink)); }
.seg button[aria-pressed="true"] { background: rgb(var(--surface)); color: rgb(var(--accent-ink)); box-shadow: 0 1px 3px rgb(var(--shadow) / 0.15); }

/* Formulaires */
.field { display: flex; flex-direction: column; gap: 0.3rem; min-width: 0; }
.field > span, .field-label { font-size: 0.78rem; font-weight: 600; color: rgb(var(--ink-2)); }
.field small { color: rgb(var(--ink-3)); font-size: 0.75rem; }
.input, .select, textarea.input {
  height: 2.375rem; width: 100%; padding: 0 0.75rem; border-radius: var(--radius);
  border: 1px solid rgb(var(--line-strong)); background: rgb(var(--surface)); color: rgb(var(--ink));
  font: inherit; font-size: 0.875rem;
}
textarea.input { height: auto; padding: 0.6rem 0.75rem; font-family: var(--font-mono); resize: vertical; }
.select { padding-right: 2rem; appearance: none; -webkit-appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23606d8a' stroke-width='2'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 0.6rem center; background-size: 14px;
}
.input:focus, .select:focus { outline: none; border-color: rgb(var(--accent)); box-shadow: 0 0 0 3px rgb(var(--accent) / 0.18); }
.input-sm, .select.input-sm { height: 2rem; font-size: 0.8125rem; }
.check { display: inline-flex; align-items: center; gap: 0.5rem; font-size: 0.875rem; cursor: pointer; }
.check input { width: 1rem; height: 1rem; accent-color: rgb(var(--accent)); }
.form-grid { display: grid; gap: 0.875rem; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); align-items: end; }
.form-actions { display: flex; gap: 0.5rem; flex-wrap: wrap; align-items: center; }
.form-msg { font-size: 0.8125rem; }
.form-msg.is-error { color: rgb(var(--danger)); }
.form-msg.is-ok { color: rgb(var(--ok)); }
.toolbar { display: flex; gap: 0.75rem; flex-wrap: wrap; align-items: flex-end; padding: 1rem 1.25rem; border-bottom: 1px solid rgb(var(--line)); }
.toolbar .field { min-width: 150px; }
.toolbar .grow { flex: 1; min-width: 200px; }
@media (max-width: 640px) {
  /* Filtres et formulaires : un champ par ligne, pleine largeur */
  .toolbar .field, .toolbar .grow { flex: 1 1 100%; min-width: 0; }
  .toolbar .field .select, .toolbar .field .input { width: 100% !important; }
}

/* Badges et pastilles d'état (pas de clignotement : pas de fausse urgence) */
.badge {
  display: inline-flex; align-items: center; gap: 0.35rem; padding: 0.1rem 0.55rem; border-radius: 999px;
  border: 1px solid rgb(var(--line)); background: rgb(var(--surface-2)); color: rgb(var(--ink-2));
  font-size: 0.72rem; font-weight: 700; white-space: nowrap; line-height: 1.6;
}
.badge.ok { background: rgb(var(--ok-soft)); color: rgb(var(--ok)); border-color: rgb(var(--ok) / 0.25); }
.badge.warn { background: rgb(var(--warn-soft)); color: rgb(var(--warn)); border-color: rgb(var(--warn) / 0.25); }
.badge.danger { background: rgb(var(--danger-soft)); color: rgb(var(--danger)); border-color: rgb(var(--danger) / 0.25); }
.badge.accent { background: rgb(var(--accent-soft)); color: rgb(var(--accent-ink)); border-color: rgb(var(--accent) / 0.25); }
.dot { width: 8px; height: 8px; border-radius: 999px; display: inline-block; flex-shrink: 0; background: rgb(var(--ink-3)); }
.dot.ok { background: rgb(var(--ok)); }
.dot.warn { background: rgb(var(--warn)); }
.dot.danger { background: rgb(var(--danger)); }

.status-pill {
  display: inline-flex; align-items: center; gap: 0.5rem; height: 2.125rem; padding: 0 0.85rem; border-radius: 999px;
  border: 1px solid rgb(var(--line)); background: rgb(var(--surface)); font-size: 0.8125rem; font-weight: 600; color: rgb(var(--ink-2));
  cursor: default;
}
.status-pill.ok { border-color: rgb(var(--ok) / 0.3); }
.status-pill.warn { border-color: rgb(var(--warn) / 0.4); background: rgb(var(--warn-soft)); color: rgb(var(--warn)); }
.status-pill.danger { border-color: rgb(var(--danger) / 0.4); background: rgb(var(--danger-soft)); color: rgb(var(--danger)); }

/* Bandeau d'état de la protection */
.banner { display: flex; align-items: flex-start; gap: 1rem; padding: 1rem 1.25rem; border-radius: var(--radius-lg); border: 1px solid rgb(var(--line)); background: rgb(var(--surface)); }
.banner-icon { width: 2.5rem; height: 2.5rem; border-radius: 12px; display: grid; place-items: center; flex-shrink: 0; }
.banner-icon svg { width: 22px; height: 22px; }
.banner.ok .banner-icon { background: rgb(var(--ok-soft)); color: rgb(var(--ok)); }
.banner.warn { border-color: rgb(var(--warn) / 0.35); }
.banner.warn .banner-icon { background: rgb(var(--warn-soft)); color: rgb(var(--warn)); }
.banner.danger { border-color: rgb(var(--danger) / 0.35); }
.banner.danger .banner-icon { background: rgb(var(--danger-soft)); color: rgb(var(--danger)); }
.banner h2 { font-size: 1rem; }
.banner p { color: rgb(var(--ink-2)); font-size: 0.875rem; margin-top: 0.125rem; }
.banner-meta { margin-left: auto; display: flex; gap: 1.25rem; flex-wrap: wrap; font-size: 0.8125rem; color: rgb(var(--ink-3)); }
.banner-meta b { display: block; color: rgb(var(--ink)); font-size: 0.875rem; }
@media (max-width: 760px) { .banner { flex-wrap: wrap; } .banner-meta { margin-left: 0; width: 100%; } }

.notice { display: flex; gap: 0.75rem; padding: 0.875rem 1rem; border-radius: var(--radius-md); border: 1px solid rgb(var(--line)); background: rgb(var(--surface-2)); color: rgb(var(--ink-2)); font-size: 0.8125rem; }
.notice svg { width: 16px; height: 16px; flex-shrink: 0; margin-top: 0.15rem; color: rgb(var(--ink-3)); }
.notice.warn { border-color: rgb(var(--warn) / 0.3); background: rgb(var(--warn-soft)); }
.notice.warn svg { color: rgb(var(--warn)); }
.notice.accent { border-color: rgb(var(--accent) / 0.25); background: rgb(var(--accent-soft)); }
.notice.accent svg { color: rgb(var(--accent-ink)); }
.notice.danger { border-color: rgb(var(--danger) / 0.3); background: rgb(var(--danger-soft)); color: rgb(var(--ink)); }
.notice.danger svg { color: rgb(var(--danger)); }
.notice strong { color: rgb(var(--ink)); }

/* Tableaux */
.table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
.table { width: 100%; border-collapse: collapse; font-size: 0.85rem; }
.table th {
  position: sticky; top: 0; z-index: 1; text-align: left; white-space: nowrap;
  padding: 0.65rem 0.875rem; background: rgb(var(--surface)); border-bottom: 1px solid rgb(var(--line));
  font-size: 0.7rem; font-weight: 700; letter-spacing: 0.06em; text-transform: uppercase; color: rgb(var(--ink-3));
}
.table td { padding: 0.65rem 0.875rem; border-bottom: 1px solid rgb(var(--line)); vertical-align: middle; }
.table tbody tr:last-child td { border-bottom: 0; }
.table tbody tr:hover td { background: rgb(var(--surface-2) / 0.55); }
.table tr.is-link { cursor: pointer; }
.table tr.is-selected td { background: rgb(var(--accent-soft) / 0.6); }
.table .r, .table th.r { text-align: right; }
.table td.num, .table td .num { font-variant-numeric: tabular-nums; }
.table th button.sort {
  all: unset; cursor: pointer; display: inline-flex; align-items: center; gap: 0.25rem;
}
.table th button.sort:focus-visible { outline: 2px solid rgb(var(--accent)); outline-offset: 2px; }
.table th[aria-sort="ascending"] button.sort::after { content: "▲"; font-size: 0.6rem; }
.table th[aria-sort="descending"] button.sort::after { content: "▼"; font-size: 0.6rem; }
.table th[aria-sort] { color: rgb(var(--accent-ink)); }
.cell-main { font-weight: 600; color: rgb(var(--ink)); }
.cell-sub { font-size: 0.75rem; color: rgb(var(--ink-3)); }
.table .actions { display: flex; gap: 0.375rem; justify-content: flex-end; }
@media (max-width: 760px) {
  .table.stack thead { display: none; }
  .table.stack, .table.stack tbody, .table.stack tr, .table.stack td { display: block; width: 100%; }
  .table.stack tr { border-bottom: 1px solid rgb(var(--line)); padding: 0.5rem 0; }
  .table.stack td { border: 0; padding: 0.3rem 1rem; display: flex; justify-content: space-between; gap: 1rem; text-align: right; }
  .table.stack td::before { content: attr(data-label); font-size: 0.72rem; font-weight: 700; letter-spacing: 0.04em; text-transform: uppercase; color: rgb(var(--ink-3)); text-align: left; }
  .table.stack td.r { text-align: right; }
  .table.stack .actions { justify-content: flex-end; }
  /* Ligne « vide » / chargement (une seule cellule) : centrée, sans étiquette */
  .table.stack td[colspan] { display: block; text-align: center; }
  .table.stack td[colspan]::before { content: none; }
}

.pager { display: flex; align-items: center; gap: 0.5rem; flex-wrap: wrap; }

/* États : chargement, vide, erreur */
.state { padding: 2.5rem 1.25rem; text-align: center; color: rgb(var(--ink-3)); display: flex; flex-direction: column; align-items: center; gap: 0.5rem; }
.state svg { width: 28px; height: 28px; color: rgb(var(--ink-3)); }
.state b { color: rgb(var(--ink)); font-size: 0.9375rem; }
.state.is-error svg { color: rgb(var(--danger)); }
.skeleton { border-radius: 6px; background: linear-gradient(90deg, rgb(var(--surface-2)) 0%, rgb(var(--line) / 0.7) 50%, rgb(var(--surface-2)) 100%); background-size: 200% 100%; animation: shimmer 1.4s linear infinite; min-height: 0.9rem; }
@keyframes shimmer { from { background-position: 200% 0; } to { background-position: -200% 0; } }
.kpi .skeleton { height: 1.6rem; width: 60%; }

/* Graphiques */
.chart { position: relative; width: 100%; height: 260px; user-select: none; -webkit-user-select: none; touch-action: pan-y; }
.chart.sm { height: 190px; }
.chart.lg { height: 320px; }
.chart canvas { display: block; width: 100%; height: 100%; }
.chart-tip {
  position: absolute; pointer-events: none; z-index: 5; min-width: 170px; max-width: 260px;
  padding: 0.55rem 0.7rem; border-radius: var(--radius); background: rgb(var(--surface));
  border: 1px solid rgb(var(--line-strong)); box-shadow: 0 12px 40px -12px rgb(var(--shadow) / 0.35);
  font-size: 0.78rem; line-height: 1.45;
}
.chart-tip .t { color: rgb(var(--ink-3)); font-size: 0.72rem; margin-bottom: 0.25rem; }
.chart-tip .row { display: flex; align-items: center; gap: 0.4rem; justify-content: space-between; }
.chart-tip .row span:first-child { display: inline-flex; align-items: center; gap: 0.35rem; color: rgb(var(--ink-2)); }
.chart-tip .row b { font-variant-numeric: tabular-nums; }
.chart-tip .sw { width: 8px; height: 8px; border-radius: 2px; display: inline-block; }
.chart-tip .note { color: rgb(var(--ink-3)); font-size: 0.7rem; margin-top: 0.25rem; }
.chart-legend { display: flex; gap: 1rem; flex-wrap: wrap; font-size: 0.78rem; color: rgb(var(--ink-2)); }
.chart-legend span { display: inline-flex; align-items: center; gap: 0.4rem; }
.chart-legend i { width: 12px; height: 3px; border-radius: 2px; display: inline-block; }
.chart-legend i.band { height: 10px; width: 12px; border-radius: 2px; }
.chart-legend i.dash { background: repeating-linear-gradient(90deg, currentColor 0 4px, transparent 4px 7px) !important; height: 2px; }
.chart-meta { display: flex; justify-content: space-between; gap: 0.75rem; flex-wrap: wrap; font-size: 0.75rem; color: rgb(var(--ink-3)); margin-top: 0.5rem; }
.chart-empty { position: absolute; inset: 0; display: grid; place-items: center; text-align: center; color: rgb(var(--ink-3)); font-size: 0.875rem; padding: 1rem; }
.spark { width: 120px; height: 32px; display: block; }

/* Listes / fiches */
.dl { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 0.875rem 1.25rem; margin: 0; }
.dl div { min-width: 0; }
.dl dt { font-size: 0.72rem; font-weight: 700; letter-spacing: 0.05em; text-transform: uppercase; color: rgb(var(--ink-3)); }
.dl dd { margin: 0.15rem 0 0; font-weight: 600; font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
.list { list-style: none; margin: 0; padding: 0; }
.list li { display: flex; gap: 0.75rem; align-items: flex-start; padding: 0.7rem 1.25rem; border-bottom: 1px solid rgb(var(--line)); }
.list li:last-child { border-bottom: 0; }
.list .when { margin-left: auto; color: rgb(var(--ink-3)); font-size: 0.75rem; white-space: nowrap; }

.attack-card { display: grid; grid-template-columns: minmax(0, 1.6fr) repeat(3, minmax(0, 1fr)) auto; gap: 1rem; align-items: center; padding: 0.875rem 1.25rem; border-bottom: 1px solid rgb(var(--line)); color: inherit; }
.attack-card:last-child { border-bottom: 0; }
.attack-card:hover { background: rgb(var(--danger-soft) / 0.35); text-decoration: none; }
.attack-card .v { font-weight: 700; font-variant-numeric: tabular-nums; }
.attack-card .l { font-size: 0.72rem; color: rgb(var(--ink-3)); }
@media (max-width: 760px) { .attack-card { grid-template-columns: 1fr 1fr; } }

.flag { width: 18px; height: 13px; border-radius: 2px; object-fit: cover; vertical-align: -2px; margin-right: 0.35rem; }
.bar { height: 6px; border-radius: 999px; background: rgb(var(--surface-2)); overflow: hidden; min-width: 60px; }
.bar i { display: block; height: 100%; background: rgb(var(--accent)); border-radius: 999px; }

.tabs { display: flex; gap: 0.25rem; border-bottom: 1px solid rgb(var(--line)); overflow-x: auto; }
.tabs button {
  border: 0; background: none; font: inherit; font-weight: 600; font-size: 0.875rem; color: rgb(var(--ink-2));
  padding: 0.65rem 0.9rem; border-bottom: 2px solid transparent; cursor: pointer; white-space: nowrap;
}
.tabs button[aria-selected="true"] { color: rgb(var(--accent-ink)); border-bottom-color: rgb(var(--accent)); }

/* Fenêtres modales (élément <dialog>) */
dialog.modal {
  border: 1px solid rgb(var(--line)); border-radius: var(--radius-lg); padding: 0; width: min(520px, calc(100vw - 2rem));
  background: rgb(var(--surface)); color: rgb(var(--ink)); box-shadow: 0 24px 64px -16px rgb(var(--shadow) / 0.45);
}
dialog.modal::backdrop { background: rgb(7 11 24 / 0.5); }
.modal-head { padding: 1.125rem 1.25rem 0.5rem; }
.modal-body { padding: 0.25rem 1.25rem 1rem; color: rgb(var(--ink-2)); font-size: 0.875rem; display: flex; flex-direction: column; gap: 0.75rem; }
.modal-foot { padding: 0.875rem 1.25rem; border-top: 1px solid rgb(var(--line)); display: flex; justify-content: flex-end; gap: 0.5rem; }

/* Notifications discrètes */
.toasts { position: fixed; right: 1rem; bottom: 1rem; z-index: 300; display: flex; flex-direction: column; gap: 0.5rem; max-width: min(380px, calc(100vw - 2rem)); }
.toast {
  display: flex; gap: 0.6rem; align-items: flex-start; padding: 0.75rem 0.9rem; border-radius: var(--radius-md);
  background: rgb(var(--surface)); border: 1px solid rgb(var(--line-strong)); box-shadow: 0 12px 40px -12px rgb(var(--shadow) / 0.35);
  font-size: 0.85rem; animation: toast-in 0.18s ease-out;
}
.toast .dot { margin-top: 0.4rem; }
.toast a { font-weight: 600; }
.toast button { margin-left: auto; border: 0; background: none; color: rgb(var(--ink-3)); cursor: pointer; font-size: 1rem; line-height: 1; padding: 0 0.15rem; }
@keyframes toast-in { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }

/* Palette de recherche */
.palette-list { max-height: 50vh; overflow-y: auto; padding: 0.25rem 0.5rem 0.75rem; }
.palette-group { padding: 0.5rem 0.75rem 0.25rem; font-size: 0.68rem; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase; color: rgb(var(--ink-3)); }
.palette-item { display: flex; gap: 0.75rem; justify-content: space-between; width: 100%; border: 0; background: none; font: inherit; color: inherit; text-align: left; padding: 0.55rem 0.75rem; border-radius: var(--radius); cursor: pointer; }
.palette-item em { font-style: normal; color: rgb(var(--ink-3)); font-size: 0.8rem; }
.palette-item[aria-selected="true"], .palette-item:hover { background: rgb(var(--accent-soft)); }
kbd { font-family: var(--font-mono); font-size: 0.7rem; padding: 0.1rem 0.35rem; border-radius: 4px; border: 1px solid rgb(var(--line-strong)); color: rgb(var(--ink-3)); background: rgb(var(--surface-2)); }

/* Page de connexion */
.login {
  min-height: 100vh; display: grid; place-items: center; padding: 1.5rem;
  background:
    radial-gradient(40rem 26rem at 85% 10%, rgb(var(--brand-2) / 0.16), transparent 70%),
    radial-gradient(36rem 24rem at 10% 0%, rgb(var(--accent) / 0.18), transparent 70%),
    rgb(var(--bg));
}
.login-card { width: min(420px, 100%); padding: 2rem; display: flex; flex-direction: column; gap: 1.25rem; }
.login-card .brand { padding: 0; }

/* Guide */
.prose { color: rgb(var(--ink-2)); max-width: 80ch; }
.prose h2 { margin: 1.75rem 0 0.75rem; font-size: 1.125rem; }
.prose h3 { margin: 1.25rem 0 0.5rem; }
.prose p, .prose ul { margin: 0 0 0.875rem; }
.prose ul { padding-left: 1.25rem; }
.prose strong { color: rgb(var(--ink)); }
.mode-grid { display: grid; gap: 1rem; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); margin: 0.75rem 0 1.5rem; }
.mode-card { padding: 1rem 1.125rem; }
.mode-card p { font-size: 0.85rem; color: rgb(var(--ink-2)); margin-top: 0.5rem; }
pre.code { margin: 0; padding: 1rem; border-radius: var(--radius-md); background: rgb(var(--surface-2)); border: 1px solid rgb(var(--line)); overflow-x: auto; font-family: var(--font-mono); font-size: 0.78rem; line-height: 1.6; color: rgb(var(--ink)); }
details.more summary { cursor: pointer; font-weight: 600; color: rgb(var(--accent-ink)); font-size: 0.875rem; }
details.more[open] summary { margin-bottom: 0.75rem; }

.rule-row { display: flex; align-items: center; gap: 1rem; padding: 0.7rem 1.25rem; border-bottom: 1px solid rgb(var(--line)); }
.rule-row:last-child { border-bottom: 0; }
.rule-row.is-off .cell-main { color: rgb(var(--ink-3)); text-decoration: line-through; }
.rule-row .actions { margin-left: auto; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.01ms !important; animation-iteration-count: 1 !important; transition-duration: 0.01ms !important; }
}
@media print {
  .sidebar, .topbar-actions, .menu-btn, .toasts { display: none !important; }
  .card { box-shadow: none; }
}
@media (max-width: 640px) {
  .kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0.75rem; }
  .kpi-value { font-size: 1.3rem; }
}

/* Bouton d'action discret, présenté comme un lien */
button.link { background: none; border: 0; padding: 0; color: rgb(var(--accent-ink)); cursor: pointer; font: inherit; text-decoration: underline; text-underline-offset: 2px; }
button.link:hover { color: rgb(var(--accent)); }

/* Page attaque : « Ce qui était visé » */
.h-icon { display: flex; align-items: center; gap: 0.5rem; }
.h-icon svg { width: 1.15rem; height: 1.15rem; color: rgb(var(--ink-3)); flex: none; }
.targets { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 0.75rem; }
.target { border: 1px solid rgb(var(--line)); border-radius: 12px; padding: 0.9rem 1rem; background: rgb(var(--surface-2) / 0.35); }
.target-row { display: flex; align-items: center; flex-wrap: wrap; gap: 0.5rem 0.65rem; }
.target-port { font-size: 1.05rem; font-weight: 700; min-width: 3.5rem; }
.target-what { display: inline-flex; align-items: center; flex-wrap: wrap; gap: 0.5rem; min-width: 0; }
.target-svc { font-weight: 600; min-width: 0; }
.target-share { margin-left: auto; font-weight: 700; color: rgb(var(--ink-2)); }
.target-bar { height: 4px; border-radius: 999px; background: rgb(var(--line)); margin: 0.6rem 0 0.5rem; overflow: hidden; }
.target-bar i { display: block; height: 100%; border-radius: inherit; background: rgb(var(--series-drop)); }
.target-impact { margin: 0; color: rgb(var(--ink-2)); font-size: 0.875rem; line-height: 1.5; }
.targets-note { margin: 0.9rem 0 0; }
@media (max-width: 640px) {
  .target-what { order: 2; flex: 1 1 100%; }
}
.link-btn { background: none; border: 0; padding: 0; font: inherit; color: rgb(var(--accent-ink)); cursor: pointer; text-decoration: underline; text-underline-offset: 2px; }
