:root {
  --bg: #f6f7f9;
  --surface: #ffffff;
  --surface-2: #f0f2f5;
  --border: #e3e6ea;
  --text: #14171a;
  --muted: #6b7280;
  --accent: #2f6df6;
  --accent-weak: #e7effe;
  --up: #128a54;
  --down: #c23b3b;
  --sev3: #c23b3b;
  --sev2: #d98b1e;
  --sev1: #6b7280;
  --shadow: 0 1px 2px rgba(16,24,40,.06), 0 1px 3px rgba(16,24,40,.08);
  --radius: 12px;
  --ease: cubic-bezier(.2,.7,.3,1);
}
:root[data-theme="dark"] {
  --bg: #0e1116;
  --surface: #161b22;
  --surface-2: #1c232c;
  --border: #262d36;
  --text: #e6edf3;
  --muted: #8b949e;
  --accent: #4f8cff;
  --accent-weak: #16233d;
  --up: #3fb883;
  --down: #f0736b;
  --sev3: #f0736b;
  --sev2: #e0a23a;
  --sev1: #8b949e;
  --shadow: 0 1px 2px rgba(0,0,0,.3), 0 2px 8px rgba(0,0,0,.35);
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg:#0e1116; --surface:#161b22; --surface-2:#1c232c; --border:#262d36;
    --text:#e6edf3; --muted:#8b949e; --accent:#4f8cff; --accent-weak:#16233d;
    --up:#3fb883; --down:#f0736b; --sev3:#f0736b; --sev2:#e0a23a; --sev1:#8b949e;
    --shadow:0 1px 2px rgba(0,0,0,.3),0 2px 8px rgba(0,0,0,.35);
  }
}

* { box-sizing: border-box; }
body {
  margin: 0; background: var(--bg); color: var(--text);
  font: 14px/1.5 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Inter, sans-serif;
  -webkit-font-smoothing: antialiased;
}
h1,h2,h3 { margin: 0; font-weight: 650; letter-spacing: -.01em; }
.ic { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 2;
  stroke-linecap: round; stroke-linejoin: round; flex: none; }

.topbar {
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 24px; background: var(--surface); border-bottom: 1px solid var(--border);
  position: sticky; top: 0; z-index: 10;
}
.brand { display: flex; align-items: center; gap: 12px; }
.brand h1 { font-size: 17px; }
.brand .sub { margin: 0; color: var(--muted); font-size: 12px; }
.brand-mark { width: 30px; height: 30px; border-radius: 8px;
  background: linear-gradient(135deg, var(--accent), #7aa8ff); flex: none; }
.actions { display: flex; align-items: center; gap: 10px; }
.meta { color: var(--muted); font-size: 12px; }

.btn {
  display: inline-flex; align-items: center; gap: 7px; cursor: pointer;
  background: var(--surface); color: var(--text); border: 1px solid var(--border);
  border-radius: 9px; padding: 8px 12px; font-size: 13px; font-weight: 550;
  transition: background .15s var(--ease), border-color .15s var(--ease), transform .05s var(--ease);
}
.btn:hover { background: var(--surface-2); }
.btn:active { transform: translateY(1px); }
.btn.ghost { border-color: transparent; background: transparent; color: var(--muted); padding-left: 6px; }
.btn.ghost:hover { color: var(--text); }
.btn.icon-only { padding: 8px; }
.icon-only .moon { display: none; }
:root[data-theme="dark"] .icon-only .sun,
:root:not([data-theme="light"]) .icon-only .sun { display: none; }
:root[data-theme="dark"] .icon-only .moon,
:root:not([data-theme="light"]) .icon-only .moon { display: block; }
@media (prefers-color-scheme: light) { :root:not([data-theme]) .icon-only .moon { display:none; } :root:not([data-theme]) .icon-only .sun { display:block; } }

main { padding: 24px; max-width: 1280px; margin: 0 auto; }
.section-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 16px; }
.section-head h2 { font-size: 15px; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; font-size: 12px; }
.search { display: flex; align-items: center; gap: 8px; background: var(--surface);
  border: 1px solid var(--border); border-radius: 9px; padding: 7px 11px; width: 260px; color: var(--muted); }
.search input { border: none; background: transparent; color: var(--text); outline: none; width: 100%; font-size: 13px; }

.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 14px; }
.card {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 16px; box-shadow: var(--shadow); cursor: pointer;
  transition: transform .12s var(--ease), border-color .12s var(--ease);
}
.card:hover { transform: translateY(-2px); border-color: var(--accent); }
.card-top { display: flex; align-items: flex-start; justify-content: space-between; gap: 8px; }
.card-title { font-weight: 600; font-size: 14px; word-break: break-word; }
.card-perm { font-size: 11px; color: var(--muted); }
.kpis { display: flex; align-items: baseline; gap: 14px; margin: 12px 0 8px; }
.kpi-main { font-size: 26px; font-weight: 700; letter-spacing: -.02em; }
.kpi-label { font-size: 11px; color: var(--muted); }
.trend { display: inline-flex; align-items: center; gap: 4px; font-size: 12px; font-weight: 600; }
.trend.up { color: var(--up); }
.trend.down { color: var(--down); }
.trend.flat { color: var(--muted); }
.card-foot { display: flex; align-items: center; gap: 8px; margin-top: 10px; flex-wrap: wrap; }
.badge { display: inline-flex; align-items: center; gap: 5px; font-size: 11px; font-weight: 600;
  padding: 3px 8px; border-radius: 999px; background: var(--surface-2); color: var(--muted); }
.badge.crit { background: color-mix(in srgb, var(--sev3) 15%, transparent); color: var(--sev3); }
.badge.pos { background: var(--accent-weak); color: var(--accent); }

/* détail site */
#site-detail { margin-top: 14px; }
.detail-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 4px; }
.detail-head h2 { font-size: 20px; }
.detail-head a { color: var(--accent); text-decoration: none; font-size: 13px; display: inline-flex; gap: 5px; align-items: center; }
.stat-row { display: flex; gap: 26px; margin: 14px 0 18px; flex-wrap: wrap; }
.stat .v { font-size: 22px; font-weight: 700; }
.stat .l { font-size: 11px; color: var(--muted); }
.panel { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 18px; box-shadow: var(--shadow); margin-bottom: 16px; }
.panel h3 { font-size: 13px; margin-bottom: 12px; }
.chart { width: 100%; height: 180px; overflow-x: auto; }
.two-col { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
@media (max-width: 860px) { .two-col { grid-template-columns: 1fr; } }

table { width: 100%; border-collapse: collapse; font-size: 13px; }
th, td { text-align: left; padding: 7px 8px; border-bottom: 1px solid var(--border); }
th { color: var(--muted); font-weight: 550; font-size: 11px; text-transform: uppercase; letter-spacing: .03em; }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; }

.insight { display: flex; gap: 12px; padding: 12px 0; border-bottom: 1px solid var(--border); }
.insight:last-child { border-bottom: none; }
.insight .dot { width: 8px; height: 8px; border-radius: 50%; margin-top: 6px; flex: none; }
.insight .dot.s3 { background: var(--sev3); }
.insight .dot.s2 { background: var(--sev2); }
.insight .dot.s1 { background: var(--sev1); }
.insight .msg { font-weight: 550; }
.insight .act { color: var(--muted); font-size: 13px; margin-top: 2px; }
.insight .type { font-size: 11px; color: var(--accent); font-weight: 600; text-transform: uppercase; letter-spacing: .03em; }

.toast { position: fixed; bottom: 20px; left: 50%; transform: translateX(-50%);
  background: var(--text); color: var(--bg); padding: 10px 16px; border-radius: 9px;
  font-size: 13px; box-shadow: var(--shadow); }
.empty { color: var(--muted); padding: 40px; text-align: center; }
.skeleton { background: var(--surface-2); border-radius: var(--radius); height: 150px; animation: pulse 1.2s var(--ease) infinite; }
@keyframes pulse { 50% { opacity: .5; } }
