:root {
  --text-xs: clamp(0.75rem, 0.7rem + 0.25vw, 0.8125rem);
  --text-sm: clamp(0.8125rem, 0.78rem + 0.2vw, 0.9375rem);
  --text-base: clamp(0.9375rem, 0.9rem + 0.2vw, 1rem);
  --text-lg: clamp(1.0625rem, 1rem + 0.4vw, 1.25rem);
  --text-xl: clamp(1.5rem, 1.25rem + 1vw, 2rem);

  --space-1: 0.25rem; --space-2: 0.5rem; --space-3: 0.75rem; --space-4: 1rem;
  --space-5: 1.25rem; --space-6: 1.5rem; --space-8: 2rem; --space-10: 2.5rem; --space-12: 3rem;

  --bg: #0c1012;
  --surface: #12181b;
  --surface-2: #172024;
  --surface-3: #1d282d;
  --border: #243137;
  --border-strong: #31424a;
  --text: #e3e9e7;
  --muted: #8d9b97;
  --faint: #5d6c69;

  --accent: #3fb8af;
  --accent-strong: #5fd1c7;
  --accent-soft: rgba(63, 184, 175, 0.14);

  --crit: #f06464;
  --crit-soft: rgba(240, 100, 100, 0.14);
  --warn: #e9a640;
  --warn-soft: rgba(233, 166, 64, 0.14);
  --ok: #52b97f;
  --ok-soft: rgba(82, 185, 127, 0.14);
  --info: #6ea8e2;
  --info-soft: rgba(110, 168, 226, 0.14);

  --radius-sm: 6px; --radius: 10px; --radius-lg: 14px;
  --font: 'Switzer', 'Helvetica Neue', system-ui, sans-serif;
  --mono: 'JetBrains Mono', ui-monospace, 'SF Mono', monospace;
  --ease: cubic-bezier(0.2, 0.8, 0.2, 1);
  --on-accent: #04211f;
  --topbar-bg: rgba(12, 16, 18, 0.88);
  --shadow: 0 12px 40px rgba(0,0,0,.45);
  color-scheme: dark;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--text);
  font-family: var(--font); font-size: var(--text-base); line-height: 1.5;
  font-variant-numeric: tabular-nums lining-nums;
  -webkit-font-smoothing: antialiased;
  min-height: 100dvh;
}
h1, h2, h3 { margin: 0; font-weight: 600; letter-spacing: -0.01em; }
button, input, select { font: inherit; color: inherit; }
button { cursor: pointer; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 4px; }
[hidden] { display: none !important; }
.skip { position: absolute; left: -999px; top: var(--space-2); background: var(--accent); color: #062; padding: var(--space-2) var(--space-3); z-index: 100; }
.skip:focus { left: var(--space-2); }
.mono { font-family: var(--mono); font-size: 0.92em; letter-spacing: -0.01em; }
small { color: var(--muted); font-weight: 400; }

/* ---------- Barre supérieure ---------- */
.topbar {
  position: sticky; top: 0; z-index: 20;
  display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: var(--space-6);
  padding: var(--space-3) clamp(var(--space-4), 3vw, var(--space-8));
  background: var(--topbar-bg); backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
}
.brand { display: flex; align-items: center; gap: var(--space-3); min-width: 0; }
.brand-mark { width: 30px; height: 30px; color: var(--accent); flex: none; }
.brand h1 { font-size: var(--text-lg); line-height: 1.2; }
.sub { margin: 0; color: var(--muted); font-size: var(--text-xs); }
.tabs { display: flex; gap: var(--space-1); justify-self: center; }
.tab {
  background: none; border: 0; padding: var(--space-2) var(--space-3); border-radius: var(--radius-sm);
  color: var(--muted); font-size: var(--text-sm); font-weight: 500; position: relative;
}
.tab:hover { color: var(--text); background: var(--surface-2); }
.tab[aria-selected="true"] { color: var(--text); }
.tab[aria-selected="true"]::after {
  content: ""; position: absolute; left: var(--space-3); right: var(--space-3); bottom: -13px;
  height: 2px; background: var(--accent); border-radius: 2px;
}
.actions { display: flex; align-items: center; gap: var(--space-2); }
.seg { display: inline-flex; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 2px; }
.seg button { border: 0; background: none; padding: 5px var(--space-3); border-radius: 4px; font-size: var(--text-xs); color: var(--muted); font-weight: 500; }
.seg button[aria-checked="true"] { background: var(--surface-3); color: var(--text); }
.icon-btn {
  display: inline-grid; place-items: center; width: 34px; height: 34px;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-sm); color: var(--muted);
}
.icon-btn:hover { color: var(--text); border-color: var(--border-strong); }
.icon-btn svg { width: 17px; height: 17px; }
.icon-btn.spin svg { animation: spin 0.9s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.btn {
  display: inline-flex; align-items: center; gap: var(--space-2);
  padding: 7px var(--space-4); border-radius: var(--radius-sm); font-size: var(--text-sm); font-weight: 500;
  background: var(--surface-2); border: 1px solid var(--border-strong); color: var(--text);
  transition: background 0.15s var(--ease), border-color 0.15s var(--ease);
}
.btn:hover { background: var(--surface-3); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--on-accent); font-weight: 600; }
.btn.primary:hover { background: var(--accent-strong); }
.btn.ghost { background: none; border-color: transparent; color: var(--accent); padding-inline: var(--space-2); }
.btn.ghost:hover { background: var(--accent-soft); }
.btn.danger { color: var(--crit); }
.btn:disabled { opacity: 0.55; cursor: progress; }

.demo-banner {
  margin: var(--space-4) clamp(var(--space-4), 3vw, var(--space-8)) 0;
  padding: var(--space-2) var(--space-4); border-radius: var(--radius-sm);
  background: var(--info-soft); color: var(--info); font-size: var(--text-xs); border: 1px solid rgba(110,168,226,.25);
}

main { padding: var(--space-6) clamp(var(--space-4), 3vw, var(--space-8)) var(--space-12); max-width: 1680px; margin: 0 auto; }

/* ---------- KPI ---------- */
.kpis { display: grid; grid-template-columns: repeat(var(--kpi-n, 6), minmax(0, 1fr)); gap: var(--space-3); margin-bottom: var(--space-6); }
.kpi {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  padding: var(--space-4) var(--space-5); display: flex; flex-direction: column; gap: var(--space-1); min-width: 0;
  position: relative; overflow: hidden;
}
.kpi::before { content: ""; position: absolute; inset: 0 auto 0 0; width: 3px; background: var(--tone, var(--border)); }
.kpi .lbl { font-size: var(--text-xs); color: var(--muted); font-weight: 500; }
.kpi .val { font-size: var(--text-xl); font-weight: 600; line-height: 1.15; letter-spacing: -0.02em; }
.kpi .val .of { color: var(--faint); font-weight: 500; font-size: 0.6em; }
.kpi .meta { font-size: var(--text-xs); color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tone-crit { --tone: var(--crit); } .tone-warn { --tone: var(--warn); } .tone-ok { --tone: var(--ok); } .tone-info { --tone: var(--info); }
.tone-crit .val { color: var(--crit); } .tone-warn .val { color: var(--warn); }

/* ---------- Panneaux ---------- */
.panel { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); padding: var(--space-5); min-width: 0; }
.panel-h { display: flex; align-items: baseline; justify-content: space-between; gap: var(--space-3); margin-bottom: var(--space-4); }
.panel-h.bare { margin-bottom: var(--space-3); }
.panel-h h2 { font-size: var(--text-base); }
.hint { font-size: var(--text-xs); color: var(--faint); }
.count { font-size: var(--text-xs); color: var(--muted); background: var(--surface-3); padding: 1px var(--space-2); border-radius: 99px; }

.overview-grid { display: grid; grid-template-columns: minmax(280px, 360px) 1fr; gap: var(--space-6); align-items: start; }
.alerts-panel { position: sticky; top: 84px; max-height: calc(100dvh - 104px); display: flex; flex-direction: column; }
.alert-list { list-style: none; margin: 0; padding: 0; overflow-y: auto; overscroll-behavior: contain; display: flex; flex-direction: column; gap: var(--space-2); }
.alert {
  display: grid; grid-template-columns: auto 1fr; gap: var(--space-3); align-items: start;
  padding: var(--space-3); border-radius: var(--radius); background: var(--surface-2); border: 1px solid transparent;
  cursor: pointer; text-align: left; width: 100%; color: inherit;
}
.alert:hover { border-color: var(--border-strong); }
.alert .ic { width: 22px; height: 22px; border-radius: 6px; display: grid; place-items: center; font-size: 12px; font-weight: 700; }
.alert.critical .ic { background: var(--crit-soft); color: var(--crit); }
.alert.warning .ic { background: var(--warn-soft); color: var(--warn); }
.alert.info .ic { background: var(--info-soft); color: var(--info); }
.alert .site { font-size: var(--text-xs); color: var(--muted); font-weight: 500; }
.alert .txt { font-size: var(--text-sm); line-height: 1.35; }
.empty { color: var(--muted); font-size: var(--text-sm); padding: var(--space-6) var(--space-3); text-align: center; }
.empty .big { display: block; font-size: var(--text-lg); color: var(--ok); margin-bottom: var(--space-1); font-weight: 600; }

/* ---------- Cartes de site ---------- */
.site-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: var(--space-3); }
.site {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg);
  padding: var(--space-4) var(--space-5) var(--space-4); text-align: left; color: inherit; width: 100%;
  display: flex; flex-direction: column; gap: var(--space-3);
  transition: border-color 0.15s var(--ease), transform 0.15s var(--ease), background 0.15s var(--ease);
}
.site:hover { border-color: var(--border-strong); background: var(--surface-2); transform: translateY(-1px); }
.site.off { opacity: 0.55; }
.site-top { display: flex; justify-content: space-between; align-items: flex-start; gap: var(--space-2); }
.site-name { font-weight: 600; font-size: var(--text-base); line-height: 1.25; }
.site-isp { font-size: var(--text-xs); color: var(--muted); }
.status { display: inline-flex; align-items: center; gap: 6px; font-size: var(--text-xs); font-weight: 600; padding: 2px var(--space-2); border-radius: 99px; white-space: nowrap; }
.status::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.status.ok { color: var(--ok); background: var(--ok-soft); }
.status.warning { color: var(--warn); background: var(--warn-soft); }
.status.critical { color: var(--crit); background: var(--crit-soft); }
.status.muted { color: var(--muted); background: var(--surface-3); }
.site-stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: var(--space-2); }
.stat { display: flex; flex-direction: column; }
.stat b { font-size: var(--text-lg); font-weight: 600; line-height: 1.2; }
.stat span { font-size: var(--text-xs); color: var(--muted); }
.stat.bad b { color: var(--crit); } .stat.warn b { color: var(--warn); }
.site-speed { display: grid; grid-template-columns: 1fr auto; gap: var(--space-3); align-items: end; padding-top: var(--space-3); border-top: 1px solid var(--border); }
.speed-nums { display: flex; gap: var(--space-4); font-size: var(--text-xs); color: var(--muted); flex-wrap: wrap; }
.speed-nums b { color: var(--text); font-size: var(--text-sm); font-weight: 600; }
.speed-nums .below b { color: var(--warn); }
.spark { width: 96px; height: 30px; }
.spark path.line { fill: none; stroke: var(--accent); stroke-width: 1.6; }
.spark path.area { fill: var(--accent-soft); stroke: none; }
.spark line.thr { stroke: var(--warn); stroke-dasharray: 3 3; stroke-width: 1; }
.spark circle { fill: var(--warn); }
.chips { display: flex; flex-wrap: wrap; gap: var(--space-1); }
.chip { font-size: var(--text-xs); padding: 1px var(--space-2); border-radius: 99px; background: var(--surface-3); color: var(--muted); }
.chip.crit { background: var(--crit-soft); color: var(--crit); }
.chip.warn { background: var(--warn-soft); color: var(--warn); }
.chip.info { background: var(--info-soft); color: var(--info); }
.chip.acc { background: var(--accent-soft); color: var(--accent); }

/* ---------- Tiroir détail ---------- */
.scrim { position: fixed; inset: 0; background: rgba(0,0,0,.5); z-index: 40; animation: fade .2s var(--ease); }
.drawer {
  position: fixed; top: 0; right: 0; bottom: 0; width: min(880px, 100vw); z-index: 41;
  background: var(--bg); border-left: 1px solid var(--border); display: flex; flex-direction: column;
  animation: slide .28s var(--ease);
}
@keyframes slide { from { transform: translateX(40px); opacity: 0; } }
@keyframes fade { from { opacity: 0; } }
.drawer-h { display: flex; justify-content: space-between; align-items: flex-start; gap: var(--space-4); padding: var(--space-5) var(--space-6); border-bottom: 1px solid var(--border); }
.drawer-h h2 { font-size: var(--text-xl); }
.drawer-body { overflow-y: auto; overscroll-behavior: contain; padding: var(--space-6); display: flex; flex-direction: column; gap: var(--space-5); }
.d-kpis { display: grid; grid-template-columns: repeat(4, 1fr); gap: var(--space-3); }
.d-kpis .kpi { padding: var(--space-3) var(--space-4); }
.d-kpis .kpi .val { font-size: var(--text-lg); }
.chart-box { position: relative; height: 220px; }
.chart-box.small { height: 160px; }
.legend { display: flex; gap: var(--space-4); font-size: var(--text-xs); color: var(--muted); flex-wrap: wrap; }
.legend i { display: inline-block; width: 10px; height: 3px; border-radius: 2px; margin-right: 6px; vertical-align: middle; }
.thr-edit { display: grid; grid-template-columns: repeat(5, minmax(0,1fr)); gap: var(--space-3); }

/* ---------- Tableaux ---------- */
.table-wrap { overflow-x: auto; overscroll-behavior: contain; margin: 0 calc(-1 * var(--space-5)); padding: 0 var(--space-5); }
.tbl { width: 100%; border-collapse: collapse; font-size: var(--text-sm); }
.tbl th { text-align: left; font-weight: 500; font-size: var(--text-xs); color: var(--muted); padding: var(--space-2) var(--space-3); border-bottom: 1px solid var(--border); line-height: 1.25; vertical-align: bottom; white-space: nowrap; }
.tbl td { padding: var(--space-2) var(--space-3); border-bottom: 1px solid var(--border); vertical-align: middle; }
.tbl tr:last-child td { border-bottom: 0; }
.tbl td.num, .tbl th.num { text-align: right; }
.tbl input[type="number"] { width: 88px; }
.tbl .site-cell { font-weight: 500; white-space: nowrap; }
.dev-name { font-weight: 500; }
.dev-mac { color: var(--faint); font-size: var(--text-xs); }
.bar { height: 6px; border-radius: 3px; background: var(--surface-3); overflow: hidden; min-width: 60px; }
.bar i { display: block; height: 100%; background: var(--warn); border-radius: 3px; }
.bar.ok i { background: var(--faint); }
.row-actions { display: flex; gap: var(--space-1); justify-content: flex-end; }
.tog {
  border: 1px solid var(--border); background: none; color: var(--muted); border-radius: 99px;
  font-size: var(--text-xs); padding: 2px var(--space-2); white-space: nowrap;
}
.tog:hover { color: var(--text); border-color: var(--border-strong); }
.tog[aria-pressed="true"].w { background: var(--accent-soft); color: var(--accent); border-color: transparent; }
.tog[aria-pressed="true"].i { background: var(--surface-3); color: var(--text); border-color: transparent; }

/* ---------- Formulaires ---------- */
input[type="number"], input[type="text"], input[type="time"], input[type="password"], input[type="url"], input[type="email"], textarea, select {
  background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--radius-sm);
  padding: 6px var(--space-3); font-size: var(--text-sm); min-width: 0;
}
input::placeholder { color: var(--faint); }
input:focus, select:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
input.changed { border-color: var(--warn); }
.form-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: var(--space-4); }
.field { display: flex; flex-direction: column; gap: var(--space-1); font-size: var(--text-xs); color: var(--muted); font-weight: 500; }
.field input { width: 100%; color: var(--text); }
.inline { display: flex; gap: var(--space-2); }
.switch { display: inline-flex; align-items: center; gap: var(--space-2); cursor: pointer; font-size: var(--text-sm); color: var(--text); font-weight: 400; }
.switch input { appearance: none; width: 34px; height: 20px; border-radius: 99px; background: var(--surface-3); border: 1px solid var(--border-strong); position: relative; margin: 0; cursor: pointer; transition: background .15s; flex: none; }
.switch input::after { content: ""; position: absolute; top: 2px; left: 2px; width: 14px; height: 14px; border-radius: 50%; background: var(--muted); transition: transform .18s var(--ease), background .15s; }
.switch input:checked { background: var(--accent); border-color: var(--accent); }
.switch input:checked::after { transform: translateX(14px); background: var(--on-accent); }
.settings-grid { display: grid; grid-template-columns: 1.6fr 1fr; gap: var(--space-5); align-items: start; }
.span-2 { grid-column: 1 / -1; }
.sched { display: flex; flex-direction: column; gap: var(--space-5); }
.kv { display: grid; grid-template-columns: auto 1fr; gap: var(--space-2) var(--space-4); margin: 0; font-size: var(--text-sm); }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; }
.dev-list { list-style: none; margin: 0 0 var(--space-3); padding: 0; display: flex; flex-direction: column; }
.dev-list li { display: flex; justify-content: space-between; align-items: center; gap: var(--space-3); padding: var(--space-2) 0; border-bottom: 1px solid var(--border); }
.dev-list li:last-child { border-bottom: 0; }
.dev-list .empty { padding: var(--space-3) 0; text-align: left; }

.savebar {
  position: fixed; left: 50%; bottom: var(--space-5); transform: translateX(-50%); z-index: 30;
  display: flex; align-items: center; gap: var(--space-6); padding: var(--space-2) var(--space-2) var(--space-2) var(--space-5);
  background: var(--surface-3); border: 1px solid var(--border-strong); border-radius: var(--radius-lg);
  box-shadow: var(--shadow); font-size: var(--text-sm); animation: rise .25s var(--ease);
}
.savebar > div { display: flex; gap: var(--space-2); }
@keyframes rise { from { transform: translate(-50%, 12px); opacity: 0; } }

.modal-scrim { position: fixed; inset: 0; z-index: 60; background: rgba(0,0,0,.6); display: grid; place-items: center; padding: var(--space-4); animation: fade .15s; }
.modal { background: var(--surface); border: 1px solid var(--border-strong); border-radius: var(--radius-lg); padding: var(--space-6); width: min(560px, 100%); max-height: 85dvh; display: flex; flex-direction: column; gap: var(--space-4); }
.modal h2 { font-size: var(--text-lg); }
#modal-body { overflow-y: auto; overscroll-behavior: contain; font-size: var(--text-sm); color: var(--muted); }
#modal-body pre { white-space: pre-wrap; font-family: var(--mono); font-size: var(--text-xs); color: var(--text); background: var(--surface-2); padding: var(--space-3); border-radius: var(--radius-sm); margin: 0; }
.modal-actions { display: flex; justify-content: flex-end; gap: var(--space-2); }
.picker { display: flex; flex-direction: column; gap: var(--space-3); color: var(--text); }
.picker-list { list-style: none; margin: 0; padding: 0; max-height: 300px; overflow-y: auto; overscroll-behavior: contain; border: 1px solid var(--border); border-radius: var(--radius-sm); }
.picker-list li button { width: 100%; text-align: left; background: none; border: 0; border-bottom: 1px solid var(--border); padding: var(--space-2) var(--space-3); display: flex; justify-content: space-between; gap: var(--space-3); }
.picker-list li button:hover { background: var(--surface-2); }
.picker-list li:last-child button { border-bottom: 0; }

.toast {
  position: fixed; right: var(--space-5); bottom: var(--space-5); z-index: 70; max-width: 420px;
  background: var(--surface-3); border: 1px solid var(--border-strong); border-left: 3px solid var(--accent);
  padding: var(--space-3) var(--space-4); border-radius: var(--radius); font-size: var(--text-sm); box-shadow: 0 12px 40px rgba(0,0,0,.4);
  animation: rise2 .25s var(--ease);
}
.toast.err { border-left-color: var(--crit); }
@keyframes rise2 { from { transform: translateY(10px); opacity: 0; } }

/* Squelettes */
.skel { background: linear-gradient(90deg, var(--surface) 25%, var(--surface-2) 50%, var(--surface) 75%); background-size: 200% 100%; animation: shimmer 1.4s infinite; border-radius: var(--radius-lg); border: 1px solid var(--border); }
@keyframes shimmer { 0% { background-position: 200% 0; } 100% { background-position: -200% 0; } }

/* ---------- Responsive ---------- */
@media (max-width: 1180px) {
  .kpis { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .overview-grid { grid-template-columns: 1fr; }
  .alerts-panel { position: static; max-height: 420px; }
  .settings-grid { grid-template-columns: 1fr; }
}
@media (max-width: 860px) {
  .topbar { grid-template-columns: 1fr auto; gap: var(--space-3); }
  .tabs { grid-column: 1 / -1; grid-row: 2; justify-self: stretch; }
  .tab { flex: 1; }
  .tab[aria-selected="true"]::after { bottom: -6px; }
  .d-kpis { grid-template-columns: repeat(2, 1fr); }
  .thr-edit { grid-template-columns: repeat(2, minmax(0,1fr)); }
}
@media (max-width: 560px) {
  .kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .kpis .kpi:last-child:nth-child(odd) { grid-column: 1 / -1; }
  .actions .btn.primary { padding-inline: var(--space-3); }
  .actions .btn.primary .long { display: none; }
  .brand .sub { display: none; }
  .site-grid { grid-template-columns: 1fr; }
  .drawer-body, .drawer-h { padding: var(--space-4); }
  .savebar { left: var(--space-3); right: var(--space-3); transform: none; justify-content: space-between; gap: var(--space-3); }
  @keyframes rise { from { transform: translateY(12px); opacity: 0; } }
}
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation: none !important; transition: none !important; } }

/* ---------- Équipements importants ---------- */
.dev-layout { display: grid; grid-template-columns: 260px 1fr; gap: var(--space-5); align-items: start; }
.site-pick { position: sticky; top: 84px; padding: var(--space-4); }
.site-pick-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 2px; }
.site-pick-list button {
  width: 100%; display: flex; justify-content: space-between; align-items: center; gap: var(--space-2);
  background: none; border: 0; border-radius: var(--radius-sm); padding: var(--space-2) var(--space-3); text-align: left; font-size: var(--text-sm); color: var(--muted);
}
.site-pick-list button:hover { background: var(--surface-2); color: var(--text); }
.site-pick-list button[aria-current="true"] { background: var(--accent-soft); color: var(--text); }
.site-pick-list .n { font-size: var(--text-xs); color: var(--faint); white-space: nowrap; }
.site-pick-list .n b { color: var(--accent); font-weight: 600; }
.dev-panel .panel-h { align-items: flex-start; }
.dev-tools { display: flex; gap: var(--space-2); margin-bottom: var(--space-3); flex-wrap: wrap; }
.dev-tools input[type="search"] { flex: 1 1 260px; background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 7px var(--space-3); font-size: var(--text-sm); }
.dev-table-wrap { max-height: calc(100dvh - 300px); overflow: auto; }
.dev-tbl thead th { position: sticky; top: 0; background: var(--surface); z-index: 1; }
.dev-tbl tr.is-imp td { background: rgba(63,184,175,.05); }
.dev-tbl td.chk, .dev-tbl th.chk { width: 1%; text-align: center; }
.star {
  width: 30px; height: 30px; border-radius: 8px; border: 1px solid var(--border); background: none; color: var(--faint);
  display: inline-grid; place-items: center; transition: all .15s var(--ease);
}
.star svg { width: 16px; height: 16px; }
.star:hover { color: var(--accent); border-color: var(--accent); }
.star[aria-pressed="true"] { background: var(--accent); border-color: var(--accent); color: var(--on-accent); }
.star.pop { animation: pop .3s var(--ease); }
@keyframes pop { 50% { transform: scale(1.18); } }
.presence { display: inline-flex; align-items: center; gap: 6px; font-size: var(--text-xs); font-weight: 600; white-space: nowrap; }
.presence::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.presence.up { color: var(--ok); } .presence.down { color: var(--crit); } .presence.unk { color: var(--muted); }
.presence.down.soft { color: var(--faint); }
.suggest-tag { font-size: 11px; color: var(--accent); margin-left: var(--space-2); font-weight: 500; }
.chk-mini { width: 16px; height: 16px; accent-color: var(--accent); }
.net-line { display: flex; align-items: center; gap: var(--space-2); font-size: var(--text-sm); }
.net-line .since { color: var(--muted); font-size: var(--text-xs); }
.fresh { font-size: var(--text-xs); color: var(--faint); display: flex; justify-content: space-between; gap: var(--space-2); }
.fresh.stale { color: var(--warn); }
.dsec h3 { font-size: var(--text-base); margin-bottom: var(--space-3); display: flex; align-items: center; gap: var(--space-2); }
.dsec h3 .chip { font-weight: 500; }
.dsec-head { display: flex; justify-content: space-between; align-items: baseline; gap: var(--space-3); }
.big-net { display: flex; align-items: center; gap: var(--space-4); padding: var(--space-4); background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); }
.big-net .dot { width: 14px; height: 14px; border-radius: 50%; flex: none; box-shadow: 0 0 0 5px var(--ok-soft); background: var(--ok); }
.big-net.down .dot { background: var(--crit); box-shadow: 0 0 0 5px var(--crit-soft); }
.big-net.unknown .dot { background: var(--muted); box-shadow: 0 0 0 5px var(--surface-3); }
.big-net b { font-size: var(--text-lg); }
@media (max-width: 1180px) { .kpis { grid-template-columns: repeat(3, minmax(0, 1fr)); } .dev-layout { grid-template-columns: 1fr; } .site-pick { position: static; } .site-pick-list { flex-direction: row; flex-wrap: wrap; } .site-pick-list button { width: auto; } }
@media (max-width: 560px) { .kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); } .kpis .kpi:last-child { grid-column: auto; } .dev-table-wrap { max-height: none; } }

.alert .a-site { display: block; font-size: var(--text-xs); color: var(--muted); font-weight: 500; margin-bottom: 2px; }
.alert .txt { display: block; }
#send-now { gap: 0; }
.net-line { flex-wrap: wrap; row-gap: 0; }
.test-meta { font-size: var(--text-xs); color: var(--faint); margin-top: 2px; }
.site .fresh { margin-top: calc(-1 * var(--space-1)); }
.fresh span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.count { white-space: nowrap; }
.brand h1 { white-space: nowrap; }
@media (max-width: 560px) {
  .topbar { grid-template-columns: 1fr; }
  .actions { grid-row: 2; justify-content: space-between; }
  .actions .seg { flex: 1; }
  .actions .seg button { flex: 1; }
  .tabs { grid-row: 3; }
  .tab { font-size: var(--text-xs); padding: var(--space-2) var(--space-1); }
  .dev-panel .panel-h { flex-direction: column; }
}
.drawer-body > * { flex-shrink: 0; }
.kpi .meta { white-space: normal; overflow: visible; text-overflow: clip; line-height: 1.35; }
.speed-nums { flex-wrap: nowrap; gap: var(--space-3); white-space: nowrap; }
.site-speed { margin-top: auto; grid-template-columns: minmax(0, 1fr) auto; }
.spark { width: 84px; }
.test-meta { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* ---------- Thème clair ---------- */
[data-theme="light"] {
  --bg: #f3f5f4; --surface: #ffffff; --surface-2: #f2f5f4; --surface-3: #e7ecea;
  --border: #dfe5e3; --border-strong: #c7d1ce; --text: #142321; --muted: #556663; --faint: #879591;
  --accent: #0e8a82; --accent-strong: #0a7069; --accent-soft: rgba(14, 138, 130, 0.11);
  --crit: #cc3333; --crit-soft: rgba(204, 51, 51, 0.10); --warn: #b26b00; --warn-soft: rgba(178, 107, 0, 0.11);
  --ok: #24855a; --ok-soft: rgba(36, 133, 90, 0.11); --info: #2468ad; --info-soft: rgba(36, 104, 173, 0.10);
  --on-accent: #ffffff; --topbar-bg: rgba(255, 255, 255, 0.9); --shadow: 0 12px 32px rgba(20, 35, 33, .14);
  color-scheme: light;
}
[data-theme="light"] .kpi, [data-theme="light"] .panel, [data-theme="light"] .site { box-shadow: 0 1px 2px rgba(20,35,33,.04); }
[data-theme="light"] .scrim { background: rgba(20,35,33,.28); }
[data-theme="light"] .modal-scrim { background: rgba(20,35,33,.35); }
[data-theme="light"] .demo-banner { border-color: rgba(36,104,173,.25); }
.i-sun, [data-theme="light"] .i-moon { display: none; }
[data-theme="light"] .i-sun { display: block; }

/* ---------- Connexion ---------- */
.auth { min-height: 100dvh; display: grid; place-items: center; padding: var(--space-6); background:
  radial-gradient(1200px 600px at 20% -10%, var(--accent-soft), transparent 60%), var(--bg); }
.auth-card { width: min(400px, 100%); background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg);
  padding: var(--space-8); display: flex; flex-direction: column; gap: var(--space-4); box-shadow: var(--shadow); }
.auth-card h1 { font-size: var(--text-xl); }
.brand-mark.lg { width: 44px; height: 44px; color: var(--accent); }
.auth-err { color: var(--crit); font-size: var(--text-sm); margin: 0; min-height: 1.2em; }
.btn.block { width: 100%; justify-content: center; padding-block: 10px; }
#auth-fields { display: flex; flex-direction: column; gap: var(--space-3); }

/* ---------- Utilisateur ---------- */
.user-menu { position: relative; }
.user-btn { display: inline-flex; align-items: center; gap: var(--space-2); background: none; border: 1px solid var(--border); border-radius: 99px; padding: 3px var(--space-3) 3px 3px; }
.user-btn:hover { border-color: var(--border-strong); }
.avatar { width: 28px; height: 28px; border-radius: 50%; background: var(--accent-soft); color: var(--accent); display: grid; place-items: center; font-size: var(--text-xs); font-weight: 700; }
.uname { font-size: var(--text-sm); max-width: 120px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.menu { position: absolute; right: 0; top: calc(100% + 6px); min-width: 210px; background: var(--surface); border: 1px solid var(--border-strong); border-radius: var(--radius); box-shadow: var(--shadow); padding: var(--space-2); z-index: 50; display: flex; flex-direction: column; }
.menu-h { padding: var(--space-2) var(--space-3); display: flex; flex-direction: column; border-bottom: 1px solid var(--border); margin-bottom: var(--space-1); }
.menu-h span { font-size: var(--text-xs); color: var(--muted); }
.menu button { background: none; border: 0; text-align: left; padding: var(--space-2) var(--space-3); border-radius: var(--radius-sm); font-size: var(--text-sm); }
.menu button:hover { background: var(--surface-2); }
.ro-banner { margin: var(--space-4) clamp(var(--space-4), 3vw, var(--space-8)) 0; padding: var(--space-2) var(--space-4); border-radius: var(--radius-sm); background: var(--surface-2); color: var(--muted); font-size: var(--text-xs); border: 1px solid var(--border); }
body.ro .admin-only { display: none !important; }
body.ro .star { pointer-events: none; }
body.ro .star[aria-pressed="false"] { opacity: .35; }

/* ---------- Rapports ---------- */
.reports-head { display: flex; justify-content: space-between; align-items: flex-end; gap: var(--space-4); margin-bottom: var(--space-4); flex-wrap: wrap; }
.reports-head h2 { font-size: var(--text-lg); }
.rep-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(380px, 1fr)); gap: var(--space-4); }
.rep { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); padding: var(--space-5); display: flex; flex-direction: column; gap: var(--space-3); }
.rep.off { opacity: .6; }
.rep-top { display: flex; justify-content: space-between; align-items: flex-start; gap: var(--space-3); }
.rep-name { font-weight: 600; font-size: var(--text-base); line-height: 1.3; }
.rep dl { display: grid; grid-template-columns: 92px 1fr; gap: var(--space-2) var(--space-3); margin: 0; font-size: var(--text-sm); }
.rep dt { color: var(--muted); font-size: var(--text-xs); padding-top: 2px; }
.rep dd { margin: 0; min-width: 0; }
.rep-foot { display: flex; justify-content: space-between; align-items: center; gap: var(--space-2); padding-top: var(--space-3); border-top: 1px solid var(--border); flex-wrap: wrap; }
.rep-last { font-size: var(--text-xs); color: var(--muted); }
.rep-last.err { color: var(--crit); }
.rep-actions { display: flex; gap: var(--space-1); flex-wrap: wrap; }
.btn.sm { padding: 4px var(--space-3); font-size: var(--text-xs); }
.chips.wrap { gap: 4px; }
.teams-add { display: grid; grid-template-columns: 1fr 2fr auto; gap: var(--space-2); }
.help { background: var(--surface-2); border-radius: var(--radius); padding: var(--space-3) var(--space-5); margin-bottom: var(--space-4); font-size: var(--text-sm); color: var(--muted); }
.help ol { margin: 0; padding-left: var(--space-4); display: flex; flex-direction: column; gap: var(--space-1); }
.help b { color: var(--text); font-weight: 600; }
.modal.wide { width: min(760px, 100%); }
.form { display: flex; flex-direction: column; gap: var(--space-5); color: var(--text); }
.form .row { display: grid; grid-template-columns: 1fr 1fr; gap: var(--space-4); }
.form fieldset { border: 0; margin: 0; padding: 0; display: flex; flex-direction: column; gap: var(--space-2); min-width: 0; }
.form legend { font-size: var(--text-xs); color: var(--muted); font-weight: 500; margin-bottom: var(--space-2); padding: 0; }
.checks { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: var(--space-1) var(--space-3); }
.checks label { display: flex; align-items: center; gap: var(--space-2); font-size: var(--text-sm); padding: 3px 0; cursor: pointer; }
.checks input { accent-color: var(--accent); width: 15px; height: 15px; }
.radios { display: flex; gap: var(--space-4); flex-wrap: wrap; }
.radios label { display: flex; align-items: center; gap: var(--space-2); font-size: var(--text-sm); cursor: pointer; }
.radios input { accent-color: var(--accent); }
.days { display: flex; gap: 4px; flex-wrap: wrap; }
.days button { width: 40px; height: 34px; border-radius: var(--radius-sm); border: 1px solid var(--border); background: none; font-size: var(--text-xs); font-weight: 600; color: var(--muted); }
.days button[aria-pressed="true"] { background: var(--accent); border-color: var(--accent); color: var(--on-accent); }
.times { display: flex; gap: var(--space-2); flex-wrap: wrap; align-items: center; }
.time-chip { display: inline-flex; align-items: center; gap: 2px; background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--radius-sm); padding-right: 2px; }
.time-chip input { border: 0; background: none; padding: 5px var(--space-2); }
.time-chip button { border: 0; background: none; color: var(--faint); width: 24px; height: 24px; border-radius: 4px; font-size: 16px; line-height: 1; }
.time-chip button:hover { color: var(--crit); background: var(--crit-soft); }
.form textarea { background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: var(--space-2) var(--space-3); font: inherit; font-size: var(--text-sm); color: var(--text); resize: vertical; min-height: 64px; }
.form textarea:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.form .err { color: var(--crit); font-size: var(--text-sm); margin: 0; }
.form input[type="text"], .form input[type="password"], .form select { width: 100%; color: var(--text); }
.h3 { font-size: var(--text-sm); margin: var(--space-5) 0 var(--space-3); color: var(--muted); font-weight: 600; }
.seg-lg button { padding: 7px var(--space-4); font-size: var(--text-sm); }
.pw-form { display: grid; grid-template-columns: 1fr 1fr auto; gap: var(--space-3); align-items: end; }
.access-urls { display: flex; flex-direction: column; gap: var(--space-1); margin: var(--space-2) 0 var(--space-3); }
.access-urls code { font-family: var(--mono); font-size: var(--text-sm); background: var(--surface-2); padding: 4px var(--space-2); border-radius: 4px; width: fit-content; }
.muted { color: var(--muted); font-size: var(--text-sm); }
.muted code { font-family: var(--mono); font-size: .92em; background: var(--surface-2); padding: 1px 6px; border-radius: 4px; color: var(--text); }
.tabs { flex-wrap: wrap; }
@media (max-width: 1280px) { .tab { padding-inline: var(--space-2); } }
@media (max-width: 860px) { .rep-grid { grid-template-columns: 1fr; } .teams-add, .pw-form, .form .row { grid-template-columns: 1fr; } .uname { display: none; } .user-btn { padding: 3px; } }
body.ro .tog, body.ro [data-pick-site], body.ro #dev-suggest, body.ro .thr-edit, body.ro .savebar { display: none !important; }
@media (max-width: 720px) {
  .tabs { flex-wrap: nowrap; overflow-x: auto; justify-content: flex-start; scrollbar-width: none; }
  .tabs::-webkit-scrollbar { display: none; }
  .tab { white-space: nowrap; flex: none; }
}

/* ---------- Choix du site ---------- */
.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; }
.site-switch { display: flex; align-items: center; gap: var(--space-2); margin-top: 3px; min-width: 0; }
.site-switch select {
  appearance: none; -webkit-appearance: none;
  background: var(--surface-2) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6' viewBox='0 0 10 6'%3E%3Cpath d='M1 1l4 4 4-4' fill='none' stroke='%238a96a3' stroke-width='1.5' stroke-linecap='round'/%3E%3C/svg%3E") no-repeat right 9px center;
  border: 1px solid var(--border); border-radius: var(--radius-sm);
  padding: 3px 26px 3px var(--space-2); font-size: var(--text-xs); font-weight: 600; color: var(--text);
  max-width: 220px; min-width: 0; text-overflow: ellipsis; cursor: pointer;
}
.site-switch select:hover { border-color: var(--border-strong); }
.site-switch.filtered select { border-color: var(--accent); color: var(--accent); background-color: var(--accent-soft, var(--surface-2)); }
.site-switch .sub { white-space: nowrap; }
@media (max-width: 560px) { .brand .site-switch .sub { display: none; } .site-switch select { max-width: 180px; } }

/* ---------- Détail d'un site sur la page d'accueil ---------- */
.site-detail { margin-top: var(--space-5); }
.sd-head { display: flex; justify-content: space-between; align-items: flex-end; gap: var(--space-3); margin-bottom: var(--space-4); flex-wrap: wrap; }
.sd-head h2 { font-size: var(--text-xl, 1.35rem); display: flex; align-items: center; gap: var(--space-3); }
.sd-head h2 .status { font-size: var(--text-xs); }
.sd-body { display: grid; grid-template-columns: minmax(0, 1fr); gap: var(--space-4); align-items: start; }
.sd-body > .big-net, .sd-body > .alert-list, .sd-body > .dsec-perf { grid-column: 1 / -1; }
.sd-body > .alert-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: var(--space-2); }
.sd-body > .dsec { margin: 0; }
@media (max-width: 1000px) { .sd-body { grid-template-columns: 1fr; } }
body.ro [data-remove] { display: none !important; }
body.ro #view-settings input:disabled, body.ro #view-settings select:disabled { opacity: .7; cursor: default; }
body.ro .switch input:disabled { cursor: default; }

.overview-grid.no-alerts { grid-template-columns: 1fr; }
.kpis[hidden] { display: none; }
.rights { border-collapse: collapse; width: 100%; }
.rights th { text-align: left; font-weight: 500; padding: 6px var(--space-3) 6px 0; white-space: nowrap; }
.rights td { padding: 6px var(--space-3); }
.rights tr + tr th, .rights tr + tr td { border-top: 1px solid var(--border); }
.rights label { display: inline-flex; gap: 6px; align-items: center; cursor: pointer; white-space: nowrap; }
@media (max-width: 560px) { .rights th { white-space: normal; } .rights td { padding-inline: var(--space-2); } }

/* ---------- Évolution du débit (vue d'ensemble) ---------- */
.trend-panel { margin-bottom: var(--space-6); }
.trend-panel .panel-h { flex-wrap: wrap; gap: var(--space-3); }
.trend-box { height: 300px; }
@media (max-width: 560px) { .trend-box { height: 260px; } }
.site-switch select:disabled { cursor: default; opacity: 1; background-image: none; padding-right: var(--space-2); }

/* Lignes avec plus d'une déconnexion : rouge clair */
.tbl tr.row-flap > td, .dev-table tr.row-flap > td { background: rgba(240, 100, 100, 0.12); }
.tbl tr.row-flap:hover > td, .dev-table tr.row-flap:hover > td { background: rgba(240, 100, 100, 0.18); }
.tbl tr.row-flap td.num, .dev-table tr.row-flap td.num { color: var(--crit); font-weight: 600; }
[data-theme="light"] .tbl tr.row-flap > td, [data-theme="light"] .dev-table tr.row-flap > td { background: #fde8e8; }
[data-theme="light"] .tbl tr.row-flap:hover > td, [data-theme="light"] .dev-table tr.row-flap:hover > td { background: #fbdcdc; }
[data-theme="light"] .tbl tr.row-flap td.num, [data-theme="light"] .dev-table tr.row-flap td.num { color: #c0392b; }

/* Page d'un site : le graphique d'évolution remplace celui de la rubrique Performances */
.site-detail .trend-panel { margin-bottom: var(--space-4); }
.site-detail.has-trend .dsec-perf .chart-box, .site-detail.has-trend .dsec-perf .legend { display: none; }
