:root {
  --bg: #0b0f16;
  --surface: #141b26;
  --surface-2: #1c2634;
  --surface-3: #232f40;
  --border-solid: #293346;
  --text: #e8eef6;
  --muted: #8695a8;
  --accent: #4c9aff;
  --accent-2: #7db4ff;
  --auth: #a371f7;
  --email: #3fb950;
  --warn: #e3b341;
  --error: #f85149;
  --ok: #3fb950;
  --radius: 12px;
  --radius-sm: 8px;
  --shadow: 0 1px 2px rgba(0,0,0,.3), 0 8px 24px rgba(0,0,0,.22);
  --shadow-sm: 0 1px 3px rgba(0,0,0,.28);
}
* { box-sizing: border-box; }
html { scrollbar-color: var(--surface-3) transparent; }
body {
  margin: 0;
  font-family: -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  color: var(--text);
  font-size: 14px;
  line-height: 1.55;
  background:
    radial-gradient(1100px 500px at 78% -8%, rgba(76,154,255,.10), transparent 60%),
    radial-gradient(900px 500px at 8% 0%, rgba(163,113,247,.08), transparent 55%),
    var(--bg);
  min-height: 100vh;
}
a { color: var(--accent); text-decoration: none; }
a:hover { color: var(--accent-2); text-decoration: underline; }
code { background: var(--surface-2); padding: 1px 6px; border-radius: 5px; font-size: .88em; border: 1px solid var(--border-solid); }
h1 { font-size: 1.55rem; margin: 0 0 1.1rem; letter-spacing: -.02em; }
h2 { font-size: 1.02rem; margin: 0 0 .85rem; letter-spacing: -.01em; }

::selection { background: rgba(76,154,255,.28); }
::-webkit-scrollbar { height: 10px; width: 10px; }
::-webkit-scrollbar-thumb { background: var(--surface-3); border-radius: 8px; }
::-webkit-scrollbar-thumb:hover { background: #33415a; }

/* topbar */
.topbar {
  display: flex; align-items: center; gap: 1.25rem;
  padding: 0 1.5rem; height: 58px;
  background: rgba(15,21,31,.82);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--border-solid);
  position: sticky; top: 0; z-index: 20;
}
.brand {
  font-weight: 800; font-size: 1.18rem; color: var(--text);
  display: inline-flex; align-items: center; gap: .5rem; letter-spacing: -.02em;
}
.brand::before {
  content: ""; width: 11px; height: 11px; border-radius: 50%;
  background: radial-gradient(circle at 30% 30%, var(--accent-2), var(--accent));
  box-shadow: 0 0 12px rgba(76,154,255,.75);
}
.topbar nav { display: flex; gap: .2rem; flex: 1; }
.topbar nav a { padding: .45rem .85rem; border-radius: 8px; color: var(--muted); font-weight: 500; transition: background .15s, color .15s; }
.topbar nav a:hover { background: var(--surface-2); color: var(--text); text-decoration: none; }
.topbar nav a.active { background: var(--surface-2); color: var(--text); box-shadow: inset 0 -2px 0 var(--accent); }
.topbar-right { display: flex; align-items: center; gap: .8rem; }
.user { color: var(--muted); font-size: .9rem; display: inline-flex; align-items: center; gap: .4rem; }
.user::before { content: "●"; color: var(--ok); font-size: .6rem; }

.container { max-width: 1240px; margin: 0 auto; padding: 1.6rem 1.5rem 3rem; }
.foot { text-align: center; color: var(--muted); padding: 2rem; font-size: .82rem; }

/* banners / flash */
.banner, .flash {
  padding: .75rem 1rem; border-radius: var(--radius-sm); margin-bottom: 1rem;
  border: 1px solid var(--border-solid); display: flex; align-items: center; gap: .5rem;
  animation: slidein .25s ease;
}
@keyframes slidein { from { opacity: 0; transform: translateY(-6px); } to { opacity: 1; transform: none; } }
.banner-warn, .flash-error { background: rgba(248,81,73,.12); border-color: rgba(248,81,73,.5); }
.flash-error::before { content: "✕"; color: var(--error); font-weight: 700; }
.flash-success { background: rgba(63,185,80,.12); border-color: rgba(63,185,80,.5); }
.flash-success::before { content: "✓"; color: var(--ok); font-weight: 700; }

/* cards / layout */
.card {
  background: linear-gradient(180deg, var(--surface), var(--surface) 60%, #121a25);
  border: 1px solid var(--border-solid); border-radius: var(--radius);
  padding: 1.15rem 1.2rem; margin-bottom: 1.25rem; box-shadow: var(--shadow-sm);
}
.card > h2:first-child { padding-bottom: .55rem; border-bottom: 1px solid var(--border-solid); }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 1.25rem; }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1rem; }
@media (max-width: 820px) { .grid-2, .grid-3 { grid-template-columns: 1fr; } }

/* tiles (KPI) */
.tiles { display: grid; grid-template-columns: repeat(5, 1fr); gap: 1rem; margin-bottom: 1.4rem; }
@media (max-width: 820px) { .tiles { grid-template-columns: repeat(2, 1fr); } }
.tile {
  position: relative; overflow: hidden;
  background: linear-gradient(180deg, var(--surface-2), var(--surface));
  border: 1px solid var(--border-solid); border-radius: var(--radius);
  padding: 1.1rem 1.15rem; box-shadow: var(--shadow-sm);
  transition: transform .15s, border-color .15s, box-shadow .15s;
}
.tile:hover { transform: translateY(-3px); border-color: #34425c; box-shadow: var(--shadow); }
.tile::before { content: ""; position: absolute; inset: 0 auto 0 0; width: 4px; background: var(--accent); opacity: .9; }
.tile-auth::before { background: var(--auth); }
.tile-email::before { background: var(--email); }
.tile-warn::before { background: var(--warn); }
.tile-num { display: block; font-size: 2rem; font-weight: 800; letter-spacing: -.03em; line-height: 1.1; }
.tile-lbl { color: var(--muted); font-size: .82rem; text-transform: uppercase; letter-spacing: .05em; }
.tile-ic { position: absolute; top: .8rem; right: .9rem; font-size: 1.15rem; opacity: .55; }

/* tables */
.table { width: 100%; border-collapse: collapse; }
.table th, .table td { text-align: left; padding: .58rem .65rem; border-bottom: 1px solid var(--border-solid); }
.table thead th {
  color: var(--muted); font-weight: 600; font-size: .74rem; text-transform: uppercase; letter-spacing: .05em;
  position: sticky; top: 58px; background: var(--surface); z-index: 1;
}
.table tbody tr { transition: background .12s; }
.table tbody tr:hover { background: rgba(76,154,255,.06); }
.table.compact th, .table.compact td { padding: .38rem .5rem; }
.table.compact thead th { position: static; }
.table.kv th { width: 230px; color: var(--muted); font-weight: 600; }
.table.kv tbody tr:hover { background: transparent; }
.num { text-align: right; font-variant-numeric: tabular-nums; }
.muted { color: var(--muted); }
.ellipsis { max-width: 280px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.nowrap { white-space: nowrap; }
.table-scroll { overflow-x: auto; margin-bottom: 1.25rem; border-radius: var(--radius); }
.table-scroll .table { min-width: max-content; }

/* chips / tags */
.tag, .chip { display: inline-block; padding: .12rem .55rem; border-radius: 20px; font-size: .76rem; font-weight: 600; background: var(--surface-3); border: 1px solid var(--border-solid); white-space: nowrap; }
.tag-auth { background: rgba(163,113,247,.16); border-color: rgba(163,113,247,.55); color: #d0b7fb; }
.tag-email { background: rgba(63,185,80,.16); border-color: rgba(63,185,80,.55); color: #a6e5ac; }
.tag-ok { background: rgba(63,185,80,.16); border-color: rgba(63,185,80,.55); color: #a6e5ac; }
.chip-entity { background: rgba(76,154,255,.13); border-color: rgba(76,154,255,.5); color: var(--accent-2); }
.chip-mw { background: rgba(227,179,65,.14); border-color: rgba(227,179,65,.5); color: #f0d089; }
.chip-unmapped { background: rgba(248,81,73,.14); border-color: rgba(248,81,73,.55); color: #f7a19c; }
.badge-alert { color: #05121f; background: var(--warn); padding: .25rem .6rem; border-radius: 20px; font-weight: 700; font-size: .78rem; }
.badge-alert:hover { text-decoration: none; filter: brightness(1.08); }

/* mini-bar (top entités) */
.bar-cell { position: relative; min-width: 60px; }
.bar-cell .bar { position: absolute; left: 0; top: 50%; transform: translateY(-50%); height: 60%; background: linear-gradient(90deg, rgba(76,154,255,.35), rgba(76,154,255,.1)); border-radius: 4px; z-index: 0; }
.bar-cell .barnum { position: relative; z-index: 1; }

/* sparkline */
.spark { display: flex; align-items: flex-end; gap: 5px; height: 130px; padding-top: .5rem; }
.spark-col { flex: 1; display: flex; flex-direction: column; align-items: center; height: 100%; justify-content: flex-end; }
.spark-bar { width: 72%; min-height: 3px; border-radius: 4px 4px 0 0; background: linear-gradient(180deg, var(--accent-2), var(--accent)); transition: filter .12s, transform .12s; }
.spark-col:hover .spark-bar { filter: brightness(1.25); transform: scaleY(1.03); transform-origin: bottom; }
.spark-x { font-size: .64rem; color: var(--muted); margin-top: 4px; }

/* alerts */
.alert-line { padding: .5rem .6rem; border-radius: var(--radius-sm); margin-bottom: .4rem; font-size: .9rem; border-left: 3px solid var(--muted); background: var(--surface-2); }
.alert-error { border-left-color: var(--error); background: rgba(248,81,73,.08); }
.alert-warning { border-left-color: var(--warn); background: rgba(227,179,65,.08); }
.alert-ts { color: var(--muted); margin-right: .5rem; font-size: .8rem; }
.alert-mod { color: var(--accent-2); margin-right: .5rem; font-weight: 600; }
.inline-right { display: inline; float: right; }

/* forms */
.input { width: 100%; padding: .52rem .7rem; background: var(--surface-2); border: 1px solid var(--border-solid); border-radius: var(--radius-sm); color: var(--text); font-size: .95rem; transition: border-color .15s, box-shadow .15s; }
.input:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px rgba(76,154,255,.22); }
.input::placeholder { color: #5d6b7e; }
textarea.input { resize: vertical; font-family: inherit; }
textarea.mono, .search-form textarea.input { font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace; font-size: .85rem; }
label { display: block; margin-bottom: .8rem; color: var(--muted); font-size: .88rem; font-weight: 500; }
label .input { margin-top: .3rem; }
.check { display: flex; align-items: center; gap: .5rem; color: var(--text); }
.check input { width: auto; accent-color: var(--accent); }
.filters { display: flex; gap: .6rem; align-items: center; flex-wrap: wrap; }
.filters .input { width: auto; flex: 0 1 auto; }

/* buttons */
.btn { display: inline-flex; align-items: center; gap: .4rem; padding: .5rem .95rem; border-radius: var(--radius-sm); border: 1px solid var(--border-solid); background: var(--surface-2); color: var(--text); cursor: pointer; font-size: .9rem; font-weight: 600; transition: background .14s, border-color .14s, transform .08s; }
.btn:hover { background: var(--surface-3); border-color: #3a4863; text-decoration: none; }
.btn:active { transform: translateY(1px); }
.btn-primary { background: linear-gradient(180deg, var(--accent-2), var(--accent)); border-color: var(--accent); color: #04203f; }
.btn-primary:hover { filter: brightness(1.08); background: linear-gradient(180deg, var(--accent-2), var(--accent)); }
.btn-sm { padding: .32rem .65rem; font-size: .82rem; }
.btn-block { width: 100%; justify-content: center; }

/* recherche + réaffectation */
.search-actions { display: flex; gap: .6rem; align-items: center; margin-bottom: 1rem; flex-wrap: wrap; padding: .75rem 0; border-bottom: 1px solid var(--border-solid); }
.reassign { display: flex; gap: .6rem; align-items: flex-end; flex-wrap: wrap; }
.reassign label { margin-bottom: 0; }
.row-reassign { display: flex; gap: .4rem; align-items: center; }
.row-reassign .input { width: auto; min-width: 140px; padding: .3rem .5rem; }

/* admin cards */
.admin-card { display: block; color: var(--text); transition: border-color .15s, transform .15s, box-shadow .15s; }
.admin-card:hover { border-color: var(--accent); transform: translateY(-3px); box-shadow: var(--shadow); text-decoration: none; }
.admin-card h2 { color: var(--accent-2); border-bottom: none; }

/* copier */
.copy { cursor: pointer; border: 1px solid var(--border-solid); background: var(--surface-2); color: var(--muted); border-radius: 6px; padding: .05rem .4rem; font-size: .78rem; margin-left: .45rem; vertical-align: middle; transition: color .12s, border-color .12s; }
.copy:hover { color: var(--accent-2); border-color: var(--accent); }
.copy.copied { color: var(--ok); border-color: var(--ok); }
.mono-val { font-family: ui-monospace, Menlo, Consolas, monospace; font-size: .86em; word-break: break-all; }

/* tri de colonnes */
th.sort { cursor: pointer; user-select: none; }
th.sort:hover { color: var(--text); }
th.sort::after { content: "⇅"; opacity: .35; margin-left: .35rem; font-size: .8em; }
th.sort.sorted[data-dir="asc"]::after { content: "▲"; opacity: 1; color: var(--accent); }
th.sort.sorted[data-dir="desc"]::after { content: "▼"; opacity: 1; color: var(--accent); }

/* fiche détail */
.detail-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 1rem; flex-wrap: wrap; margin-bottom: 1rem; }
.detail-head h1 { margin: 0; word-break: break-all; }

/* logs */
.logbox { max-height: 65vh; overflow: auto; background: #070b11; border: 1px solid var(--border-solid); border-radius: var(--radius-sm); padding: .85rem; font-family: ui-monospace, monospace; font-size: .8rem; line-height: 1.5; white-space: pre; color: #c6d2e0; }

/* login */
.login-wrap { min-height: 78vh; display: flex; align-items: center; justify-content: center; }
.login-card { width: 350px; text-align: center; box-shadow: var(--shadow); }
.login-card h1 { margin-bottom: .3rem; display: inline-flex; align-items: center; gap: .5rem; }
.login-card label { text-align: left; }

/* Dans un conteneur défilant, c'est LUI le référentiel du sticky : le décalage
   de 58px (hauteur de la topbar, pensé pour le défilement de page) pousserait
   l'en-tête par-dessus les premières lignes. Concerne findings.html et
   admin_unmapped.html, dont les tables ne sont pas en .compact. */
.table-scroll .table thead th { top: 0; }

/* ── offensive.agency ─────────────────────────────────────────────────── */
.table-scroll thead th { position: sticky; top: 0; }
.pill { display: inline-block; padding: 1px 8px; border-radius: 999px; font-size: .78em; border: 1px solid var(--border-solid); background: var(--surface-2); margin-right: 4px; white-space: nowrap; }
.pill-tool { border-color: var(--accent); color: var(--accent-2); }
.pill-probable { opacity: .65; border-style: dashed; }
.pill-c2 { border-color: var(--error); color: var(--error); }
.pill-multi { border-color: var(--warn); color: var(--warn); }
.pill-cluster { border-color: var(--auth); color: var(--auth); }
.bars { border-collapse: collapse; }
.bars td { padding: 2px 8px 2px 0; }
.bar-label { white-space: nowrap; max-width: 260px; overflow: hidden; text-overflow: ellipsis; }
.bars .bar { display: inline-block; height: 10px; border-radius: 3px; background: var(--accent); vertical-align: middle; margin-right: 8px; }
.chart { width: 100%; height: auto; }
.chart .grid { stroke: var(--border-solid); stroke-width: 1; }
.chart .axis { fill: var(--muted); font-size: 11px; }
.legend span { margin-right: 16px; white-space: nowrap; }
.legend i { display: inline-block; width: 10px; height: 10px; border-radius: 2px; margin-right: 6px; }
.pager { margin-top: 12px; display: flex; gap: 12px; align-items: center; }
.kv { display: grid; grid-template-columns: max-content 1fr; gap: 4px 16px; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; }
.query { display: block; padding: 6px 10px; margin: 4px 0; overflow-x: auto; white-space: nowrap; }
.foot a { color: inherit; text-decoration: underline; }
.onyphe { border-left: 3px solid var(--accent); padding-left: 12px; }
.pill-cdn { border-color: var(--error); color: var(--error); font-weight: 600; }
.pill-cloud { border-color: var(--warn); color: var(--warn); }
.banner { display: block; }
