/* CertiGate — application & notifications (aucun élément flottant permanent). */
:root{--cgapp-bg:#fff;--cgapp-ink:#0E2A3A;--cgapp-muted:#4B5E69;--cgapp-line:#E3DED0;--cgapp-soft:#F7F4EC;--cgapp-gold:#C9A227;--cgapp-gold-ink:#7A5F0C;--cgapp-ok:#1F7A4D;--cgapp-ok-soft:#E7F4EC;--cgapp-shadow:0 24px 70px rgba(5,22,34,.28)}
html[data-theme="dark"]{--cgapp-bg:#122D3D;--cgapp-ink:#F3EEE2;--cgapp-muted:#AFC0C9;--cgapp-line:#284556;--cgapp-soft:#0E2533;--cgapp-gold:#D9B441;--cgapp-gold-ink:#E6C766;--cgapp-ok:#7FD1A4;--cgapp-ok-soft:#163A2B;--cgapp-shadow:0 24px 70px rgba(0,0,0,.55)}

/* ---------- Boutons ---------- */
.cg-app-btn{display:inline-flex;align-items:center;justify-content:center;gap:8px;min-height:44px;padding:0 18px;border-radius:12px;border:1px solid transparent;font:600 15px/1.2 system-ui,-apple-system,"Segoe UI",sans-serif;cursor:pointer;text-decoration:none;white-space:nowrap;transition:background .15s,border-color .15s,opacity .15s}
.cg-app-btn svg{width:18px;height:18px;flex:none;fill:none;stroke:currentColor;stroke-width:1.9;stroke-linecap:round;stroke-linejoin:round}
.cg-app-btn--gold{background:var(--cgapp-gold);color:#0E2A3A}
.cg-app-btn--gold:hover{background:#B8921F}
.cg-app-btn--ghost{background:transparent;border-color:var(--cgapp-line);color:var(--cgapp-ink)}
.cg-app-btn--ghost:hover{border-color:var(--cgapp-gold)}
.cg-app-btn--quiet{background:transparent;color:var(--cgapp-muted);padding:0 12px}
.cg-app-btn--quiet:hover{color:var(--cgapp-ink)}
.cg-app-btn[disabled]{opacity:.55;cursor:default}
.cg-app-btn:focus-visible,.cg-app-entry:focus-visible,.cg-app-top:focus-visible,.cg-app-x:focus-visible,.cg-app-pref input:focus-visible+i{outline:3px solid var(--cgapp-gold);outline-offset:3px}

/* ---------- Fenêtre ---------- */
html body dialog#cg-app-sheet{box-sizing:border-box;position:fixed;inset:0;margin:auto;width:min(480px,calc(100vw - 32px));height:fit-content;max-height:calc(100dvh - 48px);overflow:auto;overscroll-behavior:contain;padding:0;border:1px solid var(--cgapp-line);border-radius:22px;background:var(--cgapp-bg);color:var(--cgapp-ink);box-shadow:var(--cgapp-shadow);font:15px/1.55 system-ui,-apple-system,"Segoe UI",sans-serif;transform:none;z-index:2147483000}
html body dialog#cg-app-sheet:not([open]){display:none}
dialog#cg-app-sheet::backdrop{background:rgba(5,22,34,.62);backdrop-filter:blur(2px)}
#cg-app-sheet *{box-sizing:border-box}
#cg-app-sheet .cg-app-sheet__grip{display:none}
#cg-app-sheet .cg-app-sheet__head{display:flex;align-items:center;gap:14px;padding:22px 22px 6px}
#cg-app-sheet .cg-app-sheet__head img{width:44px;height:44px;border-radius:12px;flex:none}
#cg-app-sheet .cg-app-sheet__head h2{margin:0;font:700 19px/1.25 system-ui,-apple-system,"Segoe UI",sans-serif;color:inherit;letter-spacing:0}
#cg-app-sheet .cg-app-sheet__head p{margin:2px 0 0;color:var(--cgapp-muted);font-size:13px}
#cg-app-sheet .cg-app-sheet__head>div{flex:1;min-width:0}
#cg-app-sheet .cg-app-x{display:grid;place-items:center;width:44px;height:44px;margin:-6px -8px 0 0;border:0;border-radius:12px;background:transparent;color:var(--cgapp-muted);cursor:pointer}
#cg-app-sheet .cg-app-x:hover{background:var(--cgapp-soft);color:var(--cgapp-ink)}
#cg-app-sheet .cg-app-x svg{width:22px;height:22px;fill:none;stroke:currentColor;stroke-width:2;stroke-linecap:round}
#cg-app-sheet .cg-app-sheet__body{padding:8px 22px 22px}
#cg-app-sheet .cg-app-sec{padding:18px 0;border-top:1px solid var(--cgapp-line)}
#cg-app-sheet .cg-app-sec:first-child{border-top:0;padding-top:10px}
#cg-app-sheet .cg-app-sec[hidden]{display:none}
#cg-app-sheet .cg-app-sec[hidden]+.cg-app-sec{border-top:0;padding-top:10px}
#cg-app-sheet h3{display:flex;align-items:center;gap:9px;margin:0 0 8px;font:700 16px/1.3 system-ui,-apple-system,"Segoe UI",sans-serif;color:inherit}
#cg-app-sheet h3 svg{width:20px;height:20px;flex:none;fill:none;stroke:var(--cgapp-gold);stroke-width:1.9;stroke-linecap:round;stroke-linejoin:round}
#cg-app-sheet p{margin:0 0 14px;color:var(--cgapp-muted)}
#cg-app-sheet .cg-app-note{padding:12px 14px;border-radius:12px;background:var(--cgapp-soft);color:var(--cgapp-ink);font-size:14.5px}
#cg-app-sheet .cg-app-fine{font-size:13px;margin:10px 0 0}
#cg-app-sheet .cg-app-ok{display:flex;align-items:center;gap:8px;margin:0;padding:10px 12px;border-radius:12px;background:var(--cgapp-ok-soft);color:var(--cgapp-ok);font-weight:600}
#cg-app-sheet .cg-app-ok svg{width:20px;height:20px;flex:none;fill:none;stroke:currentColor;stroke-width:2;stroke-linecap:round;stroke-linejoin:round}
#cg-app-sheet .cg-app-steps{margin:4px 0 14px;padding:0;list-style:none;counter-reset:cgstep}
#cg-app-sheet .cg-app-steps li{position:relative;margin:0 0 10px;padding:2px 0 0 40px;counter-increment:cgstep;color:var(--cgapp-ink)}
#cg-app-sheet .cg-app-steps li::before{content:counter(cgstep);position:absolute;left:0;top:0;display:grid;place-items:center;width:28px;height:28px;border-radius:50%;background:var(--cgapp-soft);border:1px solid var(--cgapp-line);font:700 13px/1 system-ui;color:var(--cgapp-gold-ink)}
#cg-app-sheet .cg-app-inline{display:inline-block;width:20px;height:20px;vertical-align:-4px;margin:0 2px;fill:none;stroke:#1D7BF0;stroke-width:1.9;stroke-linecap:round;stroke-linejoin:round}
#cg-app-sheet .cg-app-btn{width:100%}
#cg-app-sheet .cg-app-row{display:flex;gap:10px;flex-wrap:wrap;margin-top:16px}
#cg-app-sheet .cg-app-row .cg-app-btn{width:auto;flex:1 1 180px}
#cg-app-sheet .cg-app-prefs{margin:16px 0 0;padding:0;border:0}
#cg-app-sheet .cg-app-prefs legend{padding:0;margin:0 0 6px;font-weight:700;font-size:14.5px;color:var(--cgapp-ink)}
#cg-app-sheet .cg-app-pref{display:flex;align-items:center;justify-content:space-between;gap:14px;padding:11px 0;border-bottom:1px solid var(--cgapp-line);cursor:pointer}
#cg-app-sheet .cg-app-pref:last-of-type{border-bottom:0}
#cg-app-sheet .cg-app-pref span{display:flex;flex-direction:column;min-width:0}
#cg-app-sheet .cg-app-pref strong{font-weight:600;font-size:14.5px;color:var(--cgapp-ink)}
#cg-app-sheet .cg-app-pref small{font-size:13px;color:var(--cgapp-muted);line-height:1.4}
#cg-app-sheet .cg-app-pref input{position:absolute;opacity:0;width:1px;height:1px;margin:0}
#cg-app-sheet .cg-app-pref i{position:relative;flex:none;width:46px;height:28px;border-radius:999px;background:var(--cgapp-line);transition:background .15s}
#cg-app-sheet .cg-app-pref i::after{content:"";position:absolute;top:3px;left:3px;width:22px;height:22px;border-radius:50%;background:#fff;box-shadow:0 1px 3px rgba(0,0,0,.25);transition:transform .15s}
#cg-app-sheet .cg-app-pref input:checked+i{background:var(--cgapp-gold)}
#cg-app-sheet .cg-app-pref input:checked+i::after{transform:translateX(18px)}
#cg-app-sheet .cg-app-status{margin:4px 0 0;min-height:0;font-size:13.5px;font-weight:600;color:var(--cgapp-ink)}
#cg-app-sheet .cg-app-status:empty{display:none}
@media (max-width:640px){
  html body dialog#cg-app-sheet{inset:auto 0 0 0;margin:0;width:100%;max-width:100%;max-height:92dvh;border-radius:22px 22px 0 0;border-bottom:0;padding-bottom:env(safe-area-inset-bottom,0px)}
  #cg-app-sheet .cg-app-sheet__grip{display:block;width:40px;height:5px;margin:10px auto 0;border-radius:3px;background:var(--cgapp-line)}
  #cg-app-sheet .cg-app-sheet__head{padding:12px 18px 4px}
  #cg-app-sheet .cg-app-sheet__body{padding:6px 18px 20px}
}

/* ---------- Points d’entrée ---------- */
.site-header .site-tools .cg-app-entry{display:none}
@media (min-width:1181px){
  .site-header .site-tools .cg-app-entry{display:inline-flex;align-items:center;gap:7px;min-height:40px;padding:0 12px;border:1px solid transparent;border-radius:999px;background:transparent;color:inherit;font:600 14px/1 inherit;font-family:inherit;cursor:pointer;opacity:.88;white-space:nowrap}
  .site-header .site-tools .cg-app-entry:hover{opacity:1;border-color:currentColor}
  .site-header .site-tools .cg-app-entry svg{width:18px;height:18px;flex:none;fill:none;stroke:currentColor;stroke-width:1.8;stroke-linecap:round}
}
@media (min-width:1181px) and (max-width:1279px){
  .site-header .site-tools .cg-app-entry{width:40px;padding:0;justify-content:center}
  .site-header .site-tools .cg-app-entry span{position:absolute;width:1px;height:1px;overflow:hidden;clip:rect(0 0 0 0);white-space:nowrap}
}
.mnav .mnav__links .cg-app-mnav svg{width:22px;height:22px;fill:none;stroke:currentColor;stroke-width:1.8;stroke-linecap:round}
.cg-app-top{display:inline-grid;place-items:center;width:40px;height:40px;flex:none;border-radius:12px;border:1px solid var(--line,var(--cgapp-line));background:var(--surface,transparent);color:var(--ink-2,var(--cgapp-muted));cursor:pointer}
.cg-app-top:hover{color:var(--ink,var(--cgapp-ink));border-color:var(--gold,var(--cgapp-gold))}
.cg-app-top svg{width:19px;height:19px;fill:none;stroke:currentColor;stroke-width:1.8;stroke-linecap:round}
@media (max-width:1023px){.cg-app-top{display:none}}

/* ---------- Invitation unique ---------- */
.cg-app-invite{position:fixed;right:24px;bottom:24px;z-index:9000;display:grid;grid-template-columns:40px 1fr;gap:10px 12px;align-items:center;width:min(390px,calc(100vw - 24px));padding:14px 14px 12px 16px;border:1px solid var(--cgapp-line);border-radius:18px;background:var(--cgapp-bg);color:var(--cgapp-ink);box-shadow:0 14px 40px rgba(5,22,34,.22);font:14px/1.45 system-ui,-apple-system,"Segoe UI",sans-serif;opacity:0;transform:translateY(14px);transition:opacity .22s,transform .22s}
.cg-app-invite.is-in{opacity:1;transform:none}
.cg-app-invite img{width:40px;height:40px;border-radius:10px}
.cg-app-invite__txt{display:flex;flex-direction:column;min-width:0}
.cg-app-invite__txt strong{font-weight:700;font-size:15px}
.cg-app-invite__txt span{color:var(--cgapp-muted);font-size:13.5px}
.cg-app-invite__acts{grid-column:1/-1;display:flex;justify-content:flex-end;gap:6px}
.cg-app-invite__acts .cg-app-btn{min-height:40px;font-size:14px;padding:0 14px}
@media (max-width:640px){.cg-app-invite{left:12px;right:12px;width:auto;bottom:calc(var(--cg-app-bottom,12px) + env(safe-area-inset-bottom,0px))}}
@media (display-mode:standalone){.cg-app-invite[data-kind="install"]{display:none}}
@media (prefers-reduced-motion:reduce){.cg-app-invite{transition:none}}

/* ---------- Carte de la page Notifications ---------- */
.cg-app-inbox{display:flex;align-items:center;gap:14px;flex-wrap:wrap;margin:0 0 20px;padding:16px 18px;border:1px solid var(--line,var(--cgapp-line));border-radius:16px;background:var(--surface,var(--cgapp-bg));color:var(--ink,var(--cgapp-ink))}
.cg-app-inbox__ico{display:grid;place-items:center;width:42px;height:42px;flex:none;border-radius:12px;background:var(--cgapp-soft);color:var(--cgapp-gold-ink)}
.cg-app-inbox__ico svg{width:21px;height:21px;fill:none;stroke:currentColor;stroke-width:1.9;stroke-linecap:round;stroke-linejoin:round}
.cg-app-inbox>div:nth-child(2){flex:1 1 260px;min-width:0}
.cg-app-inbox strong{display:block;font-weight:700;font-size:15px}
.cg-app-inbox p{margin:2px 0 0;font-size:14px;color:var(--ink-2,var(--cgapp-muted))}
.cg-app-inbox__acts{display:flex;gap:8px;flex-wrap:wrap}
.cg-app-inbox .cg-app-btn{min-height:42px;font-size:14px}
