:root{
  --bg:#0d1420; --bg2:#131c2b; --card:#182335; --line:#24334a;
  --txt:#e8eef7; --muted:#9bb0c9; --accent:#f5b301; --accent2:#4fd1c5;
  --ok:#3ddc97; --warn:#ffb020; --bad:#ff6b6b; --radius:14px;
  --dur:220ms; --font:system-ui,-apple-system,"Segoe UI",Roboto,Ubuntu,sans-serif;
  --mono:ui-monospace,SFMono-Regular,Menlo,Consolas,monospace;
}
*{box-sizing:border-box}
html,body{margin:0;padding:0}
body{background:radial-gradient(1200px 600px at 20% -10%,#1b2740 0%,var(--bg) 55%) fixed;
  color:var(--txt);font-family:var(--font);line-height:1.55;font-size:16px}
a{color:var(--accent2)}
h1{font-size:1.85rem;margin:.2rem 0 1rem;letter-spacing:-.02em}
h2{font-size:1.05rem;margin:.2rem 0 .6rem;color:var(--accent);text-transform:uppercase;letter-spacing:.06em}
code,pre{font-family:var(--mono);font-size:.85rem}
pre{background:#0a111c;border:1px solid var(--line);border-radius:10px;padding:.8rem;overflow:auto}
.muted{color:var(--muted)}
.lead{color:var(--muted);max-width:70ch}
.center{text-align:center}
.strong{font-weight:600}
.skip{position:absolute;left:-9999px}
.skip:focus{left:1rem;top:1rem;background:var(--accent);color:#111;padding:.5rem 1rem;border-radius:8px;z-index:99}

/* barre */
.topbar{display:flex;align-items:center;gap:1.2rem;flex-wrap:wrap;
  padding:.8rem 1.4rem;background:rgba(10,17,28,.85);backdrop-filter:blur(8px);
  border-bottom:1px solid var(--line);position:sticky;top:0;z-index:10}
.brand{display:flex;align-items:center;gap:.55rem;font-weight:700;letter-spacing:-.01em}
.brand .muted{font-weight:400}
.logo{width:26px;height:26px;color:var(--accent)}
.logo.big{width:56px;height:56px;margin:0 auto .6rem;display:block}
.topnav{display:flex;gap:.15rem;flex-wrap:wrap;font-size:.9rem}
.topnav a{padding:.4rem .6rem;border-radius:9px;text-decoration:none;color:var(--txt)}
.topnav a:hover{background:#1f2c42}
.topactions{margin-left:auto;display:flex;gap:.5rem;align-items:center}
.pill{background:var(--bad);color:#111;border-radius:999px;padding:0 .4rem;font-size:.75rem;font-weight:700}

.wrap{max-width:1180px;margin:0 auto;padding:1.6rem 1.2rem 3rem}
.foot{max-width:1180px;margin:0 auto;padding:1.2rem;display:flex;justify-content:space-between;
  border-top:1px solid var(--line);font-size:.82rem;color:var(--muted)}

/* cartes */
.grid{display:grid;gap:1rem;grid-template-columns:repeat(auto-fit,minmax(270px,1fr))}
.card{background:linear-gradient(180deg,#1a2537,#16202f);border:1px solid var(--line);
  border-radius:var(--radius);padding:1.1rem 1.2rem;box-shadow:0 8px 24px rgba(0,0,0,.25)}
.card.wide{grid-column:1/-1;margin-top:1rem}

/* boutons */
.btn{display:inline-flex;align-items:center;gap:.4rem;border:1px solid var(--line);
  background:#1e2b40;color:var(--txt);padding:.55rem .95rem;border-radius:10px;
  font:inherit;font-size:.92rem;cursor:pointer;text-decoration:none;transition:background var(--dur),transform var(--dur)}
.btn:hover{background:#26364f}
.btn:active{transform:translateY(1px)}
.btn-primary{background:linear-gradient(180deg,#ffc72c,#e6a400);color:#241a00;border-color:#c98f00;font-weight:700}
.btn-primary:hover{background:linear-gradient(180deg,#ffd35c,#f0ad00)}
.btn-danger{background:#5b1f24;border-color:#8e3038;color:#ffd7d7}
.btn-danger:hover{background:#72262d}
.btn-ok{background:#14432f;border-color:#2b7a55;color:#c9ffe6}
.btn-ghost{background:transparent}
.btn-block{width:100%;justify-content:center;padding:.8rem}
.btn.small{padding:.25rem .55rem;font-size:.8rem}
.inline{display:inline}

/* formulaires */
.form{display:flex;flex-direction:column;gap:.55rem}
.form label{font-size:.9rem;color:var(--muted)}
input,select{width:100%;padding:.6rem .7rem;border-radius:10px;border:1px solid var(--line);
  background:#0e1725;color:var(--txt);font:inherit}
input:focus,select:focus,button:focus-visible,a:focus-visible{
  outline:3px solid var(--accent);outline-offset:2px}
.with-action{display:flex;gap:.4rem}
.row{display:flex;gap:.6rem;flex-wrap:wrap;align-items:flex-end}
.row label{display:flex;flex-direction:column;gap:.3rem}
.hint{color:var(--muted);font-size:.82rem;margin:.1rem 0 .4rem}
.check{display:flex;gap:.5rem;align-items:center;color:var(--txt)}
.check input{width:auto}
.radios{display:flex;flex-direction:column;gap:.45rem}
.radios label{display:flex;gap:.5rem;align-items:center;color:var(--txt)}

/* alertes */
.alert{border-radius:12px;padding:.8rem 1rem;margin:.8rem 0;border:1px solid}
.alert-error{background:#3a1518;border-color:#8e3038;color:#ffd9d9}
.alert-warn{background:#3a2c10;border-color:#8c6a1d;color:#ffe9bd}
.alert-ok{background:#10301f;border-color:#2b7a55;color:#c8ffe2}
.alert-info{background:#122738;border-color:#2b5c7a;color:#d3ecff}
.flashes .flash{border-radius:10px;padding:.6rem .9rem;margin:.4rem 0}
.flash.ok{background:#10301f;border:1px solid #2b7a55}
.flash.error{background:#3a1518;border:1px solid #8e3038}

/* listes et tableaux */
.list{list-style:none;padding:0;margin:.3rem 0}
.list li{display:flex;align-items:center;gap:.5rem;padding:.25rem 0;border-bottom:1px dashed #223047}
.list li:last-child{border-bottom:0}
table{width:100%;border-collapse:collapse;font-size:.9rem}
th,td{text-align:left;padding:.5rem .6rem;border-bottom:1px solid var(--line);vertical-align:top}
th{color:var(--muted);font-weight:600;font-size:.8rem;text-transform:uppercase;letter-spacing:.05em}
.dot{width:9px;height:9px;border-radius:50%;display:inline-block;flex:0 0 auto}
.dot.ok{background:var(--ok);box-shadow:0 0 8px var(--ok)}
.dot.bad{background:var(--bad);box-shadow:0 0 8px var(--bad)}
.dot.warn{background:#d9a300;box-shadow:0 0 8px #d9a300}
.badge{display:inline-block;font-size:.74rem;padding:.12rem .45rem;border-radius:999px;
  background:#22314a;border:1px solid var(--line)}
.sev-critical{background:#5b1f24;border-color:#8e3038}
.sev-high{background:#5a2a12;border-color:#8f4a1d}
.sev-medium{background:#4d3d12;border-color:#8c6a1d}
.sev-low{background:#17324a}
.st-ok{background:#10331f;border-color:#2b7a55}
.st-failed,.st-aborted{background:#5b1f24;border-color:#8e3038}
.st-running{background:#17324a;border-color:#2b5c7a}

/* jauge */
.gauge{position:relative;width:150px;height:150px;margin:.4rem auto}
.gauge svg{width:100%;height:100%;transform:rotate(-90deg)}
.ring{fill:none;stroke:#22314a;stroke-width:10}
.arc{fill:none;stroke:var(--ok);stroke-width:10;stroke-linecap:round;transition:stroke-dasharray 800ms ease}
.gauge-value{position:absolute;inset:0;display:grid;place-items:center;font-size:2.1rem;font-weight:700}

/* niveau bouclier */
.level{font-weight:700;padding:.5rem .8rem;border-radius:10px;display:inline-block}
.level-1{background:#10331f;color:#c8ffe2;border:1px solid #2b7a55}
.level-2{background:#3a2c10;color:#ffe9bd;border:1px solid #8c6a1d}
.level-3{background:#3a1518;color:#ffd9d9;border:1px solid #8e3038}

/* agents */
.agent{text-align:center}
.avatar{width:64px;height:64px;margin:0 auto .6rem;border-radius:18px;display:grid;place-items:center;
  font-size:1.6rem;font-weight:800;color:#10161f;
  background:linear-gradient(145deg,#ffd35c,#e6a400);box-shadow:0 8px 20px rgba(245,179,1,.25)}
.avatar-analyste{background:linear-gradient(145deg,#7fd4ff,#3a8fd1);color:#08131d}
.avatar-executant{background:linear-gradient(145deg,#8cf0c0,#33b57c);color:#072014}
.avatar-gardien{background:linear-gradient(145deg,#ffb3b3,#e05f5f);color:#2a0b0b}
.avatar-nettoyeur{background:linear-gradient(145deg,#c9b8ff,#7b61ff);color:#100a24}
.avatar-rapporteur{background:linear-gradient(145deg,#ffe08f,#f0a500);color:#2a1e00}
.avatar-directeur{background:linear-gradient(145deg,#9be7e0,#2f9d94);color:#052220}
.chain{display:flex;gap:.5rem;flex-wrap:wrap;list-style:none;padding:0}
.chain li{background:#1e2b40;border:1px solid var(--line);border-radius:999px;padding:.4rem .9rem}
.chain li+li::before{content:"→";margin-right:.6rem;color:var(--muted)}

/* frise */
.timeline{list-style:none;padding:0;border-left:2px solid var(--line);margin-left:.6rem}
.timeline li{position:relative;padding:.5rem 0 .8rem 1.1rem}
.timeline li::before{content:"";position:absolute;left:-7px;top:.95rem;width:12px;height:12px;
  border-radius:50%;background:var(--accent)}

/* connexion */
.login-card{max-width:430px;margin:6vh auto;background:var(--card);border:1px solid var(--line);
  border-radius:18px;padding:2rem;box-shadow:0 20px 60px rgba(0,0,0,.45)}
.login-card h1{text-align:center;font-size:1.5rem}
.login-card .muted{text-align:center;margin-top:-.4rem}
.help{margin-top:.6rem;color:var(--muted);font-size:.9rem}
.help summary{cursor:pointer;color:var(--accent2)}

/* QR code de la double authentification */
.qr{background:#fff;padding:.8rem;border-radius:12px;width:max-content;margin:.6rem auto}
.qr svg{display:block;width:200px;height:200px}
.pill.warn{background:var(--warn);color:#241a00}

@media (max-width:820px){
  .topnav{order:3;width:100%;overflow-x:auto;flex-wrap:nowrap;padding-bottom:.3rem}
  .topactions{margin-left:0}
  .wrap{padding:1rem .8rem 2.5rem}
  h1{font-size:1.45rem}
}
@media (prefers-reduced-motion:reduce){
  *{animation-duration:0.001ms!important;transition-duration:0.001ms!important}
}
/* Diagnostic messagerie */
.mail-summary{display:flex;flex-wrap:wrap;gap:.4rem;align-items:center}
.mail-advice{margin:.9rem 0;line-height:1.65}
.row-actions{display:flex;gap:.5rem;flex-wrap:wrap;margin-top:.4rem}
.st{display:inline-block;padding:2px 10px;border-radius:999px;font-size:.75rem;font-weight:600}
.st-ok{background:#e7f6ec;color:#11693a}
.st-warn{background:#fff4e0;color:#8a5300}
.st-fail{background:#fdecec;color:#a11b1b}
.st-info{background:#e8f0fe;color:#1f4f9e}
.chk{border-top:1px solid var(--line);padding:.95rem 0}
.chk:first-of-type{border-top:0;padding-top:0}
.chk-head{display:flex;justify-content:space-between;align-items:center;gap:.6rem}
.chk-obs{font-family:ui-monospace,SFMono-Regular,Consolas,monospace;font-size:.82rem;
  color:var(--muted);margin:.35rem 0;word-break:break-word}
.chk-why{margin:.3rem 0;font-size:.93rem;line-height:1.55}
.chk-act{margin:.3rem 0 0;font-size:.93rem;line-height:1.55}
.dkim{white-space:pre-wrap;word-break:break-all;font-size:.78rem;line-height:1.5}
.test-result{margin-top:.9rem;border-top:1px solid var(--line);padding-top:.8rem}
.test-list{list-style:none;padding:0;margin:.4rem 0;line-height:1.9}

@media print{
  .topbar,.topactions,.foot,.skip{display:none}
  body{background:#fff;color:#000}
  .card{border:1px solid #999;box-shadow:none;background:#fff;color:#000}
  a::after{content:" (" attr(href) ")";font-size:.8em}
}
