/* ============================================================================
   SaaS-CIS — Design system « Workbench » aux couleurs Blue Soft Empower
   Base : template cisremed (esthétique dense Linear/Notion). Charte : reprise du
   gabarit Word des CR (Template_BSE.docx, thème « Blue Soft Word ») —
   marine #2D418D, orange #F29003, cyan #038DCC, gris #4F4E4F, lavande #CDD4EF,
   police Lato. Polices auto-hébergées (Lato : SIL OFL 1.1). Zéro dépendance externe.
   ========================================================================== */

/* ---------- Fonts (auto-hébergées, woff2 variable) ---------- */
/* Lato = police de la charte Blue Soft Empower (gabarit Word). */
@font-face {
  font-family: "Lato"; font-style: normal; font-weight: 400; font-display: swap;
  src: url("/assets/fonts/lato-400-latin.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: "Lato"; font-style: normal; font-weight: 400; font-display: swap;
  src: url("/assets/fonts/lato-400-latin-ext.woff2") format("woff2");
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C4, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
@font-face {
  font-family: "Lato"; font-style: normal; font-weight: 700; font-display: swap;
  src: url("/assets/fonts/lato-700-latin.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: "Lato"; font-style: normal; font-weight: 700; font-display: swap;
  src: url("/assets/fonts/lato-700-latin-ext.woff2") format("woff2");
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C4, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
@font-face {
  font-family: "Lato"; font-style: normal; font-weight: 900; font-display: swap;
  src: url("/assets/fonts/lato-900-latin.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: "Lato"; font-style: normal; font-weight: 900; font-display: swap;
  src: url("/assets/fonts/lato-900-latin-ext.woff2") format("woff2");
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C4, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
@font-face {
  font-family: "Inter"; font-style: normal; font-weight: 100 900; font-display: swap;
  src: url("/assets/fonts/inter-latin.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+2000-206F, U+2074, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: "Inter"; font-style: normal; font-weight: 100 900; font-display: swap;
  src: url("/assets/fonts/inter-latin-ext.woff2") format("woff2");
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
@font-face {
  font-family: "JetBrains Mono"; font-style: normal; font-weight: 100 800; font-display: swap;
  src: url("/assets/fonts/jetbrainsmono-latin.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+2000-206F, U+2074, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: "JetBrains Mono"; font-style: normal; font-weight: 100 800; font-display: swap;
  src: url("/assets/fonts/jetbrainsmono-latin-ext.woff2") format("woff2");
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}

/* ---------- Tokens ---------- */
:root {
  /* charte Blue Soft Empower (thème Word « Blue Soft Word » du gabarit CR) */
  --bse-navy:      #2D418D;
  --bse-navy-600:  #24367A;
  --bse-navy-800:  #1B2862;
  --bse-orange:    #F29003;
  --bse-orange-600:#D97F00;
  --bse-cyan:      #038DCC;
  --bse-lavender:  #CDD4EF;
  --bse-grey:      #4F4E4F;

  --brand:        var(--bse-navy);
  --brand-hover:  var(--bse-navy-600);
  --brand-ink:    #FFFFFF;
  --brand-bar:    var(--bse-navy);
  --accent:       var(--bse-orange);
  --heading:      var(--bse-navy);
  --link:         #1F5FA8;
  --th-bg:        #EEF1FA;
  --th-ink:       var(--bse-navy);

  /* surfaces (blancs légèrement bleutés, comme les pages du CR) */
  --bg-app:        #F4F6FB;
  --bg-panel:      #FFFFFF;
  --bg-row-hover:  #EEF1FA;
  --bg-row-sel:    #DEE4F6;
  --bg-toolbar:    #F7F8FC;
  --bg-detail:     #F8F9FD;
  --bg-dark:       oklch(22% 0.03 270);
  --bg-code:       #161B33;

  /* ink (gris de la charte, encre principale teintée marine) */
  --ink-1: #1F2433;
  --ink-2: #4F4E4F;
  --ink-3: #6E6D70;
  --ink-4: #9A99A0;
  --ink-5: #C8CBD6;

  /* lines */
  --rule:        #E2E6F0;
  --rule-strong: #CBD1E3;

  /* accents (sémantique de statut conservée) */
  --ok:   oklch(58% 0.11  150);
  --warn: oklch(66% 0.15   65);
  --bad:  oklch(55% 0.16   25);
  --info: #0B7DBF;
  --neut: oklch(60% 0.01 270);

  /* tinted status backgrounds */
  --ok-bg:   oklch(95% 0.035 150);
  --warn-bg: oklch(95% 0.05   70);
  --bad-bg:  oklch(95% 0.04   25);
  --info-bg: #E4F1FA;
  --neut-bg: #EEF0F5;
  --tol:     oklch(55% 0.12  300);
  --tol-bg:  oklch(95% 0.04  300);

  --font-ui:   "Lato", "Inter", system-ui, -apple-system, "Segoe UI", sans-serif;
  --font-mono: "JetBrains Mono", "SF Mono", "Menlo", "Consolas", monospace;

  --radius: 5px;
}

* { box-sizing: border-box; }

html, body {
  margin: 0; padding: 0;
  background: var(--bg-app);
  color: var(--ink-1);
  font-family: var(--font-ui);
  font-size: 13px;
  line-height: 1.45;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

a { color: var(--link); text-decoration: none; }
a:hover { text-decoration: underline; }

button { font-family: inherit; font-size: inherit; color: inherit; cursor: pointer; }
input, select, textarea { font-family: inherit; font-size: inherit; color: inherit; }

.mono, code, pre { font-family: var(--font-mono); }
.mono { font-feature-settings: "tnum" 1, "calt" 0; }

h1 { font-size: 20px; font-weight: 600; letter-spacing: -0.01em; margin: 0 0 4px; }
h2 { font-size: 14px; font-weight: 600; margin: 0 0 10px; letter-spacing: -0.005em; }
h3 { font-size: 10.5px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.08em; color: var(--ink-3); margin: 0 0 6px; }

/* ============================================================================
   Topbar
   ========================================================================== */
.topbar {
  display: flex; align-items: center; gap: 14px;
  height: 44px; padding: 0 18px;
  background: var(--bg-panel);
  border-bottom: 1px solid var(--rule);
  font-size: 12.5px;
  position: sticky; top: 0; z-index: 20;
}
.brand {
  display: inline-flex; align-items: center; gap: 8px;
  font-weight: 600; color: var(--ink-1); font-size: 13px;
}
.brand:hover { text-decoration: none; }
.brand::before {
  content: ""; width: 8px; height: 8px; border-radius: 1px;
  background: var(--ink-1);
}
.topbar-tag {
  font-size: 10.5px; color: var(--ink-4);
  padding: 2px 7px; border: 1px solid var(--rule); border-radius: 3px;
  background: var(--bg-app);
}
.topnav { margin-left: auto; display: inline-flex; align-items: center; gap: 14px; }
.topnav .who {
  font-family: var(--font-mono); font-size: 11px;
  color: var(--ink-3);
  padding: 3px 8px; border: 1px solid var(--rule); border-radius: 3px;
  background: var(--bg-app);
}
.topnav a { color: var(--ink-2); font-size: 12px; }

/* ============================================================================
   Layout shell
   ========================================================================== */
.container {
  max-width: 1240px;
  margin: 0 auto;
  padding: 22px 24px 60px;
}

.crumb {
  font-size: 12px; color: var(--ink-3);
  display: flex; align-items: center; gap: 6px; flex-wrap: wrap;
  margin: 0 0 14px;
}
.crumb a { color: var(--ink-2); }
.crumb a::after { content: "/"; color: var(--ink-4); margin-left: 6px; }
.crumb b { color: var(--ink-1); font-weight: 500; }

.page-head {
  display: flex; align-items: center; justify-content: space-between;
  gap: 16px; margin: 0 0 18px;
}
.page-head h1, .page-head h2 { margin: 0; }
.head-actions { display: inline-flex; align-items: center; gap: 8px; flex-wrap: wrap; }

.muted { color: var(--ink-3); }
.strike { text-decoration: line-through; color: var(--ink-4); }
.err { color: var(--bad); }
.lic-cover { font-family: var(--font-mono); font-size: 10px; color: var(--ink-4); white-space: nowrap; }

/* ============================================================================
   Buttons
   ========================================================================== */
.btn-primary, .btn-sm, .btn-danger,
button[type="submit"] {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  height: 28px; padding: 0 12px;
  border-radius: var(--radius);
  font-size: 12px; font-weight: 500; white-space: nowrap;
  border: 1px solid var(--rule-strong);
  background: var(--bg-panel);
  color: var(--ink-1);
  cursor: pointer;
  transition: background .12s ease;
}
.btn-sm:hover, button[type="submit"]:hover { background: var(--bg-row-hover); }
.btn-primary {
  background: var(--ink-1); color: var(--bg-panel); border-color: var(--ink-1);
}
.btn-primary:hover { background: oklch(30% 0.008 260); }
.btn-primary:disabled, button:disabled {
  background: var(--ink-5); border-color: var(--ink-5);
  color: var(--bg-panel); cursor: not-allowed;
}
.btn-danger { color: var(--bad); border-color: oklch(80% 0.06 25); background: var(--bad-bg); }
.btn-danger:hover { background: oklch(92% 0.05 25); }

/* ============================================================================
   Cards / panels
   ========================================================================== */
.card {
  background: var(--bg-panel);
  border: 1px solid var(--rule);
  border-radius: 6px;
  padding: 18px 20px;
  margin: 0 0 18px;
}
.card > h2:first-child, .card > h3:first-child { margin-top: 0; }

/* key/value lists */
ul.kv { list-style: none; margin: 0 0 4px; padding: 0; }
ul.kv li {
  display: grid; grid-template-columns: 180px 1fr;
  gap: 12px; padding: 6px 0;
  border-bottom: 1px solid var(--rule);
  font-size: 12.5px;
}
ul.kv li:last-child { border-bottom: 0; }
ul.kv li > span { color: var(--ink-3); font-size: 11.5px; }
ul.kv li > strong { color: var(--ink-1); font-weight: 500; word-break: break-word; }
ul.kv li > strong code { font-size: 11.5px; }

.note, .foot { color: var(--ink-3); font-size: 12px; }
.foot { margin-top: 26px; }

/* tags */
.tag {
  display: inline-block;
  font-family: var(--font-mono); font-size: 10px;
  padding: 1px 6px; border-radius: 3px;
  border: 1px solid var(--rule-strong);
  background: var(--bg-app); color: var(--ink-3);
  vertical-align: middle; letter-spacing: 0.02em;
}
.tag-override { border-color: oklch(80% 0.06 75); background: var(--warn-bg); color: oklch(48% 0.10 75); }

/* ============================================================================
   Tables
   ========================================================================== */
table.grid {
  width: 100%; border-collapse: collapse;
  font-size: 12.5px;
  background: var(--bg-panel);
  border: 1px solid var(--rule);
  border-radius: 6px;
  overflow: hidden;
}
table.grid thead th {
  text-align: left; font-weight: 500;
  font-size: 10.5px; text-transform: uppercase; letter-spacing: 0.06em;
  color: var(--ink-3);
  padding: 9px 12px;
  background: var(--bg-toolbar);
  border-bottom: 1px solid var(--rule);
  white-space: nowrap;
}
table.grid tbody td {
  padding: 0 12px; height: 38px;
  border-bottom: 1px solid var(--rule);
  color: var(--ink-1); vertical-align: middle;
}
table.grid tbody tr:last-child td { border-bottom: 0; }
table.grid tbody tr:hover { background: var(--bg-row-hover); }
table.grid td.muted { color: var(--ink-3); }
table.grid a { color: var(--ink-1); font-weight: 500; }
table.grid a:hover { color: var(--info); }

/* ============================================================================
   Status pill (dot + label) & severity
   ========================================================================== */
.status {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: 12px; color: var(--ink-1); white-space: nowrap;
}
.dot { width: 7px; height: 7px; border-radius: 50%; display: inline-block; flex: none; }
.dot.ok   { background: var(--ok); }
.dot.warn { background: var(--warn); }
.dot.bad  { background: var(--bad); }
.dot.na   { background: var(--ink-4); }
.dot.info { background: var(--info); }
.dot.tol  { background: var(--tol); }

/* tinted status badge (remplace les anciens badges pleins) */
.badge {
  display: inline-flex; align-items: center; gap: 5px;
  font-size: 11px; font-weight: 500;
  padding: 2px 8px; border-radius: 3px;
  background: var(--neut-bg); color: var(--ink-2);
  white-space: nowrap;
}
.badge::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; flex: none; }
.badge.ok   { background: var(--ok-bg);   color: oklch(45% 0.10 150); }
.badge.warn { background: var(--warn-bg); color: oklch(48% 0.11 75); }
.badge.bad  { background: var(--bad-bg);  color: oklch(48% 0.14 25); }
.badge.info { background: var(--info-bg); color: oklch(45% 0.10 250); }
.badge.na   { background: var(--neut-bg); color: var(--ink-3); }
.badge.tol  { background: var(--tol-bg);  color: oklch(45% 0.13 300); }

.sev { font-family: var(--font-mono); font-size: 10.5px; letter-spacing: 0.04em; font-weight: 500; }
.sev-crit { color: var(--bad); }
.sev-high { color: oklch(50% 0.13 35); }
.sev-medium { color: var(--warn); }
.sev-low { color: var(--ink-3); }
.sev-informational { color: var(--ink-4); }

/* ============================================================================
   Flashes / alerts
   ========================================================================== */
.flash, .alert {
  border-radius: var(--radius);
  padding: 10px 14px; margin: 0 0 16px;
  font-size: 12.5px;
  border: 1px solid var(--rule);
  display: flex; align-items: center; gap: 8px;
}
.flash-ok { background: var(--ok-bg); border-color: oklch(85% 0.05 150); color: oklch(40% 0.09 150); }
.flash-err, .alert { background: var(--bad-bg); border-color: oklch(82% 0.07 25); color: oklch(45% 0.13 25); }

.spinner {
  width: 12px; height: 12px; flex: none;
  border: 2px solid oklch(70% 0.05 150); border-top-color: transparent;
  border-radius: 50%; display: inline-block;
  animation: spin .7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* Suivi de progression d'un audit (fiche client) */
.audit-progress { margin: 0 0 16px; }
.audit-progress .ap-head { display: flex; align-items: center; gap: 8px; font-size: 13px; margin-bottom: 10px; }
.progress {
  position: relative; height: 18px; border-radius: 9px;
  background: var(--rule); overflow: hidden; border: 1px solid var(--rule-strong);
}
.progress-bar {
  height: 100%; background: var(--info); border-radius: 9px 0 0 9px;
  transition: width .4s ease; min-width: 2px;
}
.progress-pct {
  position: absolute; inset: 0; display: flex; align-items: center; justify-content: center;
  font-size: 10.5px; font-weight: 600; color: var(--ink-1); font-family: var(--font-mono);
}
.audit-progress .ap-current { font-size: 12px; color: var(--ink-2); margin-top: 10px; }
.audit-progress .ap-current code { font-size: 11.5px; }
.audit-progress .ap-warn { font-size: 12px; color: oklch(45% 0.13 25); margin-top: 8px; font-weight: 500; }
.audit-progress .ap-slow { margin-top: 10px; display: flex; flex-wrap: wrap; gap: 6px; align-items: center; font-size: 11.5px; }
.slow-chip {
  font-family: var(--font-mono); font-size: 10.5px; color: var(--ink-2);
  background: var(--bg-app); border: 1px solid var(--rule); border-radius: 3px; padding: 1px 6px;
}
.slow-chip.is-err { color: oklch(45% 0.13 25); border-color: oklch(82% 0.07 25); background: var(--bad-bg); }

/* ============================================================================
   Forms
   ========================================================================== */
.form-card { max-width: 640px; }
form label {
  display: block; margin: 0 0 14px;
  font-size: 11.5px; color: var(--ink-3); font-weight: 500;
}
form label.inline-check {
  display: flex; align-items: center; gap: 8px;
  color: var(--ink-1); font-size: 12.5px; font-weight: 400;
}
form input[type="text"], form input[type="email"], form input[type="password"],
form input[type="search"], form select, form textarea {
  display: block; width: 100%; margin-top: 5px;
  height: 32px; padding: 0 10px;
  background: var(--bg-app);
  border: 1px solid var(--rule-strong);
  border-radius: var(--radius);
  color: var(--ink-1); font-size: 13px;
  outline: none;
}
form textarea { height: auto; padding: 8px 10px; resize: vertical; line-height: 1.5; }
form input:focus, form select:focus, form textarea:focus { border-color: var(--info); }
form input::placeholder { color: var(--ink-4); }
.inline-check input[type="checkbox"] { width: auto; height: auto; margin: 0; }

.steps { margin: 4px 0 18px; padding-left: 20px; font-size: 12.5px; color: var(--ink-2); }
.steps li { margin: 6px 0; line-height: 1.5; }

.sched-form {
  display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
  margin: 8px 0 4px;
}
.sched-form input[type="text"], .sched-form select { width: auto; margin: 0; min-width: 200px; }
.sched-form .inline-check { margin: 0; }

pre {
  background: var(--bg-code); color: oklch(88% 0.005 260);
  border-radius: var(--radius); padding: 12px 14px; margin: 6px 0;
  font-size: 11.5px; line-height: 1.55; overflow: auto;
  white-space: pre-wrap; word-break: break-word;
}
code {
  font-size: 11.5px; background: var(--bg-app);
  border: 1px solid var(--rule); padding: 1px 5px; border-radius: 2px;
}
details summary { cursor: pointer; color: var(--info); font-size: 12px; margin: 4px 0; }
details[open] summary { margin-bottom: 4px; }

/* ============================================================================
   Login
   ========================================================================== */
.login-body {
  display: flex; align-items: center; justify-content: center;
  min-height: 100vh; background: var(--bg-app);
}
.login-card {
  width: 340px;
  background: var(--bg-panel);
  border: 1px solid var(--rule);
  border-radius: 8px;
  padding: 30px 28px;
  box-shadow: 0 1px 3px oklch(20% 0.01 260 / 0.05), 0 8px 30px oklch(20% 0.01 260 / 0.05);
}
.login-card h1 {
  display: flex; align-items: center; gap: 9px;
  font-size: 18px; margin: 0 0 2px;
}
.login-card h1::before { content: ""; width: 9px; height: 9px; border-radius: 2px; background: var(--ink-1); }
.login-card .sub { color: var(--ink-3); font-size: 12px; margin: 0 0 22px; }
.login-card button[type="submit"] {
  width: 100%; height: 36px; margin-top: 6px;
  background: var(--ink-1); color: var(--bg-panel); border-color: var(--ink-1);
}
.login-card button[type="submit"]:hover { background: oklch(30% 0.008 260); }

/* SSO (OIDC) sur la page de connexion */
.sso-sep { display: flex; align-items: center; gap: 10px; margin: 16px 0 12px; color: var(--ink-4); font-size: 11px; text-transform: uppercase; letter-spacing: .08em; }
.sso-sep::before, .sso-sep::after { content: ""; flex: 1; height: 1px; background: var(--rule); }
.btn-sso {
  display: flex; align-items: center; justify-content: center; gap: 8px;
  width: 100%; height: 36px; border-radius: var(--radius);
  border: 1px solid var(--rule-strong); background: var(--bg-app); color: var(--ink-1);
  font-size: 13px; font-weight: 500; text-decoration: none;
}
.btn-sso:hover { background: var(--bg-row-hover); text-decoration: none; }
.btn-sso::before { content: ""; width: 14px; height: 14px; background: linear-gradient(135deg,#f25022 0 50%,#7fba00 50% 100%),linear-gradient(135deg,#00a4ef 0 50%,#ffb900 50% 100%); background-size: 100% 50%; background-repeat: no-repeat; background-position: top, bottom; }

/* landing */
.wrap { max-width: 560px; margin: 70px auto; padding: 0 24px; }
.wrap h1 { font-size: 24px; }
.wrap .sub { color: var(--ink-3); margin: 0 0 26px; }

/* ============================================================================
   Report — dashboard
   ========================================================================== */
.dashboard {
  display: grid;
  grid-template-columns: minmax(220px, 280px) 1fr;
  grid-template-areas: "score counts" "score workload";
  gap: 16px 22px;
  background: var(--bg-panel);
  border: 1px solid var(--rule);
  border-radius: 8px;
  padding: 22px 24px;
  margin: 0 0 20px;
}
.score-card { grid-area: score; display: flex; flex-direction: column; align-items: center; gap: 12px; justify-content: center; border-right: 1px solid var(--rule); padding-right: 22px; }
.score-card .muted { text-align: center; font-size: 11.5px; line-height: 1.5; }

.score-ring {
  --p: 0; --c: var(--neut);
  width: 132px; height: 132px; border-radius: 50%;
  display: grid; place-items: center;
  background:
    radial-gradient(closest-side, var(--bg-panel) 79%, transparent 80% 100%),
    conic-gradient(var(--c) calc(var(--p) * 1%), var(--rule) 0);
}
.score-ring span { font-size: 26px; font-weight: 600; font-family: var(--font-mono); color: var(--ink-1); letter-spacing: -0.02em; }

.counts { grid-area: counts; display: flex; gap: 10px; flex-wrap: wrap; align-content: flex-start; }
.count-pill {
  --c: var(--neut);
  flex: 1; min-width: 84px;
  border: 1px solid var(--rule); border-left: 3px solid var(--c);
  border-radius: var(--radius);
  padding: 10px 12px; background: var(--bg-app);
}
.count-pill strong { display: block; font-family: var(--font-mono); font-size: 22px; font-weight: 600; color: var(--c); }
.count-pill span { font-size: 10.5px; text-transform: uppercase; letter-spacing: 0.05em; color: var(--ink-3); }

.by-workload { grid-area: workload; }
.bar-row { display: grid; grid-template-columns: 150px 1fr 120px; align-items: center; gap: 10px; padding: 4px 0; font-size: 11.5px; }
.bar-label { color: var(--ink-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.bar-track { height: 7px; background: var(--rule); border-radius: 4px; overflow: hidden; }
.bar-fill { display: block; height: 100%; border-radius: 4px; }
.bar-val { font-family: var(--font-mono); font-size: 11px; color: var(--ink-3); text-align: right; }

/* sparkline */
svg.sparkline { display: block; width: 100%; height: auto; }

/* ============================================================================
   Report — filters + controls table
   ========================================================================== */
.filters {
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
  margin: 0 0 12px;
}
.filters input[type="search"], .filters select {
  height: 30px; padding: 0 10px; margin: 0;
  background: var(--bg-panel);
  border: 1px solid var(--rule-strong); border-radius: var(--radius);
  font-size: 12px; outline: none; width: auto;
}
.filters input[type="search"] { flex: 1; max-width: 320px; min-width: 180px; }
.filters input:focus, .filters select:focus { border-color: var(--info); }
.filters #f-count { margin-left: auto; font-family: var(--font-mono); font-size: 11px; color: var(--ink-3); }

table.controls tbody tr.ctl-row { cursor: pointer; }
table.controls tbody tr.ctl-row td:first-child { font-family: var(--font-mono); font-size: 11.5px; color: var(--ink-2); }
table.controls tbody tr.ctl-row.ctl-overridden { background: var(--warn-bg); }
table.controls tbody tr.ctl-detail:hover { background: transparent; }
table.controls tbody tr.ctl-detail td { padding: 0; height: auto; background: var(--bg-detail); }

.detail { padding: 14px 18px; border-top: 1px solid var(--rule); }
.detail p { margin: 0 0 8px; font-size: 12.5px; max-width: 860px; line-height: 1.5; }
.detail p strong { color: var(--ink-2); font-weight: 600; }
.review-form {
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
  margin-top: 12px; padding-top: 12px; border-top: 1px solid var(--rule);
}
.review-form label { margin: 0; display: inline-flex; align-items: center; gap: 6px; color: var(--ink-2); }
.review-form select { width: auto; margin: 0; height: 30px; }
.review-form input[type="text"] { width: auto; margin: 0; height: 30px; flex: 1; min-width: 220px; }

/* ============================================================================
   Dropzone (cert/import)
   ========================================================================== */
.dropzone {
  border: 1px dashed var(--rule-strong); border-radius: var(--radius);
  background: var(--bg-app); padding: 30px 16px; text-align: center;
  color: var(--ink-3); font-size: 12.5px;
}

/* ============================================================================
   REPORT WORKBENCH — plein écran 3 colonnes (mire le template cisremed)
   Scopé sous .app pour ne pas affecter les pages multi-documents.
   ========================================================================== */
.app-screen { overflow: hidden; }
.app-flash {
  position: fixed; top: 10px; left: 50%; transform: translateX(-50%);
  z-index: 100; max-width: 860px; width: calc(100% - 40px);
  display: flex; align-items: center; gap: 12px;
  padding: 10px 14px; border-radius: 6px; font-size: 12.5px;
  box-shadow: 0 4px 20px oklch(20% 0.01 260 / 0.18);
  border: 1px solid var(--rule);
}
.app-flash.err { background: var(--bad-bg); border-color: oklch(82% 0.07 25); color: oklch(45% 0.13 25); }
.app-flash.ok  { background: var(--ok-bg); border-color: oklch(85% 0.05 150); color: oklch(40% 0.09 150); }
.app-flash span { flex: 1; }
.app-flash button { background: transparent; border: 0; font-size: 18px; line-height: 1; color: inherit; cursor: pointer; padding: 0 4px; }

.app {
  display: grid;
  grid-template-rows: 44px 1fr 24px;
  height: 100vh;
  min-width: 1100px;
}

/* topbar (override du global, en grille et non collant) */
.app > .topbar {
  position: static; height: 44px;
  display: flex; align-items: center; gap: 12px;
  padding: 0 16px; z-index: auto;
}
.app .crumb { margin: 0; font-size: 12px; }
.app .crumb a::after { content: "/"; }
.app .topbar-spacer { flex: 1; }
.app .topbar-pill {
  font-family: var(--font-mono); font-size: 11px;
  padding: 3px 8px; background: var(--bg-app);
  border: 1px solid var(--rule); border-radius: 3px; color: var(--ink-2);
}

/* menu Partager (dropdown <details>) */
.app .share-menu { position: relative; }
.app .share-menu > summary {
  list-style: none; cursor: pointer; display: inline-flex; align-items: center;
}
.app .share-menu > summary::-webkit-details-marker { display: none; }
.app .share-panel {
  position: absolute; right: 0; top: calc(100% + 6px); z-index: 50;
  width: 360px; padding: 12px; background: var(--bg-panel);
  border: 1px solid var(--rule-strong); border-radius: 6px;
  box-shadow: 0 8px 28px oklch(20% 0.02 260 / 0.18);
}
.app .share-create { display: flex; flex-direction: column; gap: 8px; }
.app .share-create label { font-size: 12px; color: var(--ink-2); display: flex; flex-direction: column; gap: 4px; }
.app .share-create select {
  height: 28px; padding: 0 8px; background: var(--bg-panel);
  border: 1px solid var(--rule-strong); border-radius: 4px; font-size: 12px; color: var(--ink-1);
}
.app .share-create .hint { margin: 2px 0 0; font-size: 11px; color: var(--ink-4); }

/* « Reprendre une revue » : liste filtrable de surcharges à cocher */
.app .import-panel { width: 440px; }
.app .import-toolbar { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.app .import-list { max-height: 320px; overflow: auto; display: flex; flex-direction: column; gap: 2px; border: 1px solid var(--rule); border-radius: 4px; padding: 4px; }
.app .import-list:empty { display: none; }
.app .import-item {
  display: flex; align-items: center; gap: 8px; padding: 4px 6px;
  font-size: 12px; color: var(--ink-2); border-radius: 3px; cursor: pointer;
}
.app .import-item:hover { background: var(--bg-row-hover); }
.app .import-item input[type="checkbox"] { margin: 0; width: auto; flex: none; }
.app .import-item .ii-id { font-size: 11px; color: var(--ink-3); flex: none; min-width: 46px; }
.app .import-item .ii-title { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; flex: 1; }
.app .import-item .ii-comment { flex: none; opacity: .7; }
.app .share-list { margin-top: 12px; border-top: 1px solid var(--rule); padding-top: 10px; }
.app .share-list-head { font-size: 10.5px; text-transform: uppercase; letter-spacing: .06em; color: var(--ink-3); margin-bottom: 6px; }
.app .share-item { display: flex; flex-direction: column; gap: 3px; padding: 6px 0; border-bottom: 1px solid var(--rule); }
.app .share-item .mono { font-family: var(--font-mono); font-size: 10.5px; color: var(--ink-2); word-break: break-all; }
.app .share-item .share-exp { font-size: 11px; color: var(--ink-4); }
.app .btn-sm.danger { color: var(--bad); border-color: var(--rule-strong); align-self: flex-start; }
#share-flash code { font-family: var(--font-mono); background: var(--bg-app); padding: 1px 5px; border-radius: 3px; border: 1px solid var(--rule); }

.app .ref-list { margin: 4px 0 0; padding-left: 16px; }
.app .ref-list li { margin: 0 0 4px; font-size: 12px; }
.app .ref-list a { word-break: break-word; }

/* 3-col body */
.app .body {
  display: grid;
  grid-template-columns: 264px 1fr 340px;
  min-height: 0;
}
.app .col { min-height: 0; display: flex; flex-direction: column; }
.app .col-left  { border-right: 1px solid var(--rule); background: var(--bg-panel); }
.app .col-mid   { background: var(--bg-app); min-width: 0; }
.app .col-right { border-left: 1px solid var(--rule); background: var(--bg-panel); }

/* left rail: sections */
.section-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 12px 14px 8px;
  font-size: 11px; color: var(--ink-3);
  text-transform: uppercase; letter-spacing: 0.06em; font-weight: 600;
}
.section-head .count { font-family: var(--font-mono); color: var(--ink-3); letter-spacing: 0; text-transform: none; }
.section-search {
  margin: 0 12px 8px; height: 28px; padding: 0 9px;
  background: var(--bg-app); border: 1px solid var(--rule); border-radius: 3px;
  font-size: 12px; color: var(--ink-1); outline: none; width: calc(100% - 24px);
}
.section-search:focus { border-color: var(--info); }
.section-search::placeholder { color: var(--ink-4); }
.section-list { flex: 1; overflow: auto; padding: 4px 0 8px; }
.section-row {
  display: grid; grid-template-columns: 1fr auto; align-items: center;
  gap: 8px; min-height: 30px; padding: 4px 14px;
  font-size: 12px; color: var(--ink-2); cursor: pointer;
  border-left: 2px solid transparent;
}
.section-row:hover { background: var(--bg-row-hover); }
.section-row.active { background: var(--bg-row-hover); color: var(--ink-1); border-left-color: var(--ink-1); font-weight: 500; }
.section-row .name { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.section-row .pct { font-family: var(--font-mono); font-size: 11px; color: var(--ink-3); }
.section-summary { border-top: 1px solid var(--rule); padding: 12px 14px; background: var(--bg-panel); font-size: 11.5px; color: var(--ink-2); }
.section-summary .row { display: flex; justify-content: space-between; padding: 3px 0; }
.section-summary .row .v { font-family: var(--font-mono); color: var(--ink-1); }
.section-summary .row.total { margin-top: 4px; padding-top: 8px; border-top: 1px solid var(--rule); }
.section-summary .row.total .v { font-size: 14px; font-weight: 600; }

/* center toolbar */
.mid-toolbar {
  display: flex; align-items: center; gap: 10px;
  height: 46px; padding: 0 14px;
  border-bottom: 1px solid var(--rule); background: var(--bg-toolbar);
}
.seg { display: inline-flex; border: 1px solid var(--rule-strong); border-radius: 4px; overflow: hidden; background: var(--bg-panel); }
.seg button {
  height: 28px; padding: 0 11px; background: transparent; border: 0;
  border-right: 1px solid var(--rule); color: var(--ink-2); font-size: 12px;
  display: inline-flex; align-items: center; gap: 6px; cursor: pointer;
}
.seg button:last-child { border-right: 0; }
.seg button .ct { font-family: var(--font-mono); font-size: 11px; color: var(--ink-3); }
.seg button.active { background: var(--ink-1); color: var(--bg-panel); }
.seg button.active .ct { color: oklch(85% 0.005 260); }
.app .search {
  flex: 1; max-width: 340px; height: 28px; padding: 0 9px;
  background: var(--bg-panel); border: 1px solid var(--rule-strong); border-radius: 4px;
  font-size: 12px; color: var(--ink-1); outline: none;
}
.app .search:focus { border-color: var(--info); }
.app .search::placeholder { color: var(--ink-4); }
.app .f-select {
  height: 28px; padding: 0 8px; max-width: 200px;
  background: var(--bg-panel); border: 1px solid var(--rule-strong); border-radius: 4px;
  font-size: 12px; color: var(--ink-1); cursor: pointer; outline: none;
}
.app .f-select:focus { border-color: var(--info); }

/* Filtres multi-sélection (dropdown de cases à cocher) */
.app .multi-filter { position: relative; display: inline-block; }
.app .multi-filter > summary {
  list-style: none; display: inline-flex; align-items: center; gap: 6px;
  user-select: none; max-width: none;
}
.app .multi-filter > summary::-webkit-details-marker { display: none; }
.app .multi-filter > summary::after { content: "▾"; color: var(--ink-4); font-size: 10px; }
.app .multi-filter.has-sel > summary { border-color: var(--info); color: var(--ink-1); font-weight: 500; }
.app .mf-badge {
  font-family: var(--font-mono); font-size: 10px; line-height: 16px;
  background: var(--ink-1); color: var(--bg-panel); border-radius: 8px;
  padding: 0 5px; min-width: 16px; text-align: center;
}
.app .mf-panel {
  position: absolute; top: calc(100% + 4px); left: 0; z-index: 40;
  min-width: 190px; max-height: 300px; overflow: auto;
  background: var(--bg-panel); border: 1px solid var(--rule-strong); border-radius: 6px;
  padding: 7px 9px; box-shadow: 0 8px 24px oklch(20% 0.02 260 / 0.18);
  display: flex; flex-direction: column; gap: 5px;
}
.app .mf-panel label {
  display: flex; align-items: center; gap: 7px; font-size: 12px;
  color: var(--ink-2); white-space: nowrap; cursor: pointer;
}
.app .mf-panel input[type="checkbox"] { margin: 0; width: auto; }

/* center body: table + detail (flex column = remplit toute la hauteur, sans trou) */
.mid-body { flex: 1; display: flex; flex-direction: column; min-height: 0; }
.table-wrap { flex: 1 1 0; overflow: auto; min-height: 80px; }
.app table.controls { width: 100%; border-collapse: collapse; font-size: 12.5px; border: 0; border-radius: 0; background: transparent; }
.app table.controls thead th {
  position: sticky; top: 0; background: var(--bg-panel);
  font-weight: 500; font-size: 10.5px; text-transform: uppercase; letter-spacing: 0.06em;
  color: var(--ink-3); text-align: left; padding: 8px 12px;
  border-bottom: 1px solid var(--rule); z-index: 1; white-space: nowrap;
}
.app table.controls tbody td { padding: 0 12px; height: 34px; border-bottom: 1px solid var(--rule); color: var(--ink-1); vertical-align: middle; white-space: nowrap; }
.app table.controls tbody td.c-title { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 0; }
.app table.controls tbody td.c-id { font-family: var(--font-mono); font-size: 11.5px; color: var(--ink-2); width: 60px; }
.app table.controls .c-wl { width: 110px; color: var(--ink-3); }
.app table.controls .c-sev { width: 64px; }
.app table.controls .c-lic { width: 84px; }
.app table.controls .c-status { width: 96px; }
.app table.controls tbody tr.ctl-row { cursor: pointer; }
.app table.controls tbody tr.ctl-row:hover { background: var(--bg-row-hover); }
.app table.controls tbody tr.ctl-row.selected { background: var(--bg-row-sel); }
.app table.controls tbody tr.ctl-row.selected td.c-title { color: var(--ink-1); font-weight: 500; }

/* center detail */
.app .detail {
  border-top: 1px solid var(--rule); background: var(--bg-detail);
  padding: 14px 18px 16px; margin: 0;
  flex: 0 0 auto; max-height: 45%; overflow: auto;
}
.app .detail .id-line { font-family: var(--font-mono); font-size: 11px; color: var(--ink-3); margin-bottom: 4px; }
.app .detail h2 { margin: 0 0 8px; font-size: 16px; font-weight: 600; color: var(--ink-1); letter-spacing: -0.005em; }
.app .detail .meta-line { font-size: 11.5px; color: var(--ink-3); margin-bottom: 14px; display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.app .detail .meta-line .sep { color: var(--ink-4); }
.app .detail h4 { margin: 12px 0 4px; font-size: 10.5px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.08em; color: var(--ink-3); }
.app .detail p { margin: 0 0 6px; font-size: 12.5px; color: var(--ink-1); max-width: 820px; line-height: 1.5; }
.app .detail pre { max-width: 820px; }

/* right rail */
.rail { display: flex; flex-direction: column; min-height: 0; height: 100%; }
.rail-scroll { flex: 1; overflow: auto; }
.rail-section { padding: 14px 16px; border-bottom: 1px solid var(--rule); }
.rail h4 { margin: 0 0 6px; font-size: 10.5px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.08em; color: var(--ink-3); }
.rail .ctrl-id { font-family: var(--font-mono); font-size: 13px; color: var(--ink-1); font-weight: 500; margin-bottom: 4px; }
.rail .ctrl-title { font-size: 12.5px; color: var(--ink-1); line-height: 1.45; margin-bottom: 10px; }
.rail .status-line { display: flex; align-items: center; gap: 8px; margin-bottom: 4px; }
.rail .metadata { font-size: 12px; }
.rail .metadata .row { display: grid; grid-template-columns: 96px 1fr; padding: 5px 0; border-bottom: 1px solid var(--rule); }
.rail .metadata .row:last-child { border-bottom: 0; }
.rail .metadata .k { color: var(--ink-3); font-size: 11.5px; }
.rail .metadata .v { color: var(--ink-1); font-family: var(--font-mono); font-size: 11.5px; word-break: break-word; }
.rail .codeblock { background: var(--bg-code); border-radius: 4px; padding: 12px 14px; margin: 4px 0; overflow: auto; }
.rail .codeblock pre { margin: 0; background: transparent; padding: 0; color: oklch(88% 0.005 260); font-size: 11.5px; line-height: 1.55; white-space: pre-wrap; word-break: break-word; }
.rail .rail-foot { padding: 12px 16px; border-top: 1px solid var(--rule); background: var(--bg-panel); }
.rail .review-form { display: block; margin: 0; padding: 0; border: 0; }
.rail .review-form label { display: block; margin: 0 0 8px; }
.rail .review-form select, .rail .review-form input[type="text"] { width: 100%; margin-top: 4px; height: 30px; }
.rail .review-form textarea {
    width: 100%; margin-top: 4px; min-height: 84px; resize: vertical;
    font: inherit; padding: 6px 8px; color: var(--ink-1);
    background: var(--bg-app); border: 1px solid var(--rule); border-radius: 6px;
}
.rail .review-form textarea:focus { outline: none; border-color: var(--info); }
.review-actions { display: flex; align-items: center; gap: 10px; margin-top: 4px; }
.review-actions button { flex: 1; margin-top: 0; }
.review-status { font-size: 11px; color: var(--ink-4); white-space: nowrap; }
.app .detail .review-trace { font-size: 11px; color: var(--ink-3); font-style: italic; margin-top: 2px; }
.review-status.ok { color: var(--ok); }
.review-status.err { color: var(--bad); }
.rail-empty { padding: 24px 16px; color: var(--ink-4); font-size: 12px; font-style: italic; text-align: center; }

/* statusbar */
.app .statusbar {
  display: flex; align-items: center; gap: 14px;
  padding: 0 14px; border-top: 1px solid var(--rule); background: var(--bg-panel);
  font-family: var(--font-mono); font-size: 10.5px; color: var(--ink-3);
}
.app .statusbar .sep { color: var(--ink-4); }
.app .statusbar .k { color: var(--ink-2); }
.app .statusbar .right { margin-left: auto; }

/* ============================================================================
   Responsive
   ========================================================================== */
@media (max-width: 760px) {
  .dashboard { grid-template-columns: 1fr; grid-template-areas: "score" "counts" "workload"; }
  .score-card { border-right: 0; border-bottom: 1px solid var(--rule); padding: 0 0 18px; }
  ul.kv li { grid-template-columns: 1fr; gap: 2px; }
  .bar-row { grid-template-columns: 110px 1fr 70px; }
}

/* Partage depuis la fiche client (layout document, hors .app) */
.row-actions { display: flex; align-items: center; justify-content: flex-end; gap: 6px; white-space: nowrap; }
.row-actions form { margin: 0; }
/* Le menu « Partager » déborde de la ligne : la table ne doit pas le rogner. */
table.grid#runs-table { overflow: visible; }
table.grid#runs-table thead th:first-child { border-top-left-radius: 6px; }
table.grid#runs-table thead th:last-child { border-top-right-radius: 6px; }
.share-mini { position: relative; display: inline-block; }
details.share-mini > summary.btn-sm { list-style: none; cursor: pointer; margin: 0; color: inherit; font-size: inherit; }
details.share-mini[open] > summary.btn-sm { background: var(--bg-row-hover); }
.share-mini > summary::-webkit-details-marker { display: none; }
.share-mini-panel {
  position: absolute; right: 0; top: calc(100% + 4px); z-index: 30;
  background: var(--bg-panel); border: 1px solid var(--rule-strong); border-radius: 6px;
  padding: 10px; width: 220px; box-shadow: 0 8px 24px oklch(20% 0.02 260 / 0.18);
  white-space: normal; text-align: left;
}
.share-mini-panel label select { width: 100%; }
.share-mini-panel label { display: flex; flex-direction: column; gap: 4px; font-size: 12px; color: var(--ink-2); margin-bottom: 8px; }
.share-mini-panel select { height: 28px; border: 1px solid var(--rule-strong); border-radius: 4px; font-size: 12px; padding: 0 6px; }
.btn-sm.danger { color: var(--bad); }

/* ---------- Comparaison d'évolution (modale + diff) ---------- */
.modal-overlay {
  position: fixed; inset: 0; z-index: 50;
  background: oklch(20% 0.02 260 / 0.45);
  display: flex; align-items: flex-start; justify-content: center;
  padding: 40px 16px; overflow-y: auto;
}
/* L'attribut HTML [hidden] doit primer sur display:flex ci-dessus. */
.modal-overlay[hidden] { display: none; }
.modal {
  background: var(--bg-panel); border: 1px solid var(--rule-strong);
  border-radius: 12px; width: 100%; max-width: 880px;
  box-shadow: 0 18px 50px oklch(20% 0.02 260 / 0.25);
}
.modal-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 16px 20px; border-bottom: 1px solid var(--rule);
}
.modal-head h2 { margin: 0; font-size: 16px; }
.modal-close {
  background: transparent; border: 0; font-size: 24px; line-height: 1;
  color: var(--ink-3); cursor: pointer; padding: 0 4px;
}
.modal-close:hover { color: var(--ink-1); }
.modal-body { padding: 18px 20px 24px; }

.cmp-exports { display: flex; flex-wrap: wrap; gap: 8px; justify-content: flex-end; margin-bottom: 14px; }
.cmp-email { border: 1px solid var(--rule); border-radius: var(--radius); padding: 12px; margin-bottom: 16px; background: var(--bg-app); }
.cmp-email-head { display: flex; align-items: center; gap: 8px; margin-bottom: 8px; font-size: 13px; }
.cmp-email-head .btn-sm { margin-left: auto; }
.cmp-email-text {
  width: 100%; box-sizing: border-box; resize: vertical;
  font-family: var(--font-mono); font-size: 12px; line-height: 1.5;
  color: var(--ink-1); background: var(--bg-panel);
  border: 1px solid var(--rule); border-radius: 4px; padding: 8px 10px;
}
.cmp-summary { display: flex; align-items: stretch; gap: 12px; margin-bottom: 16px; }
.cmp-card {
  flex: 1; border: 1px solid var(--rule); border-radius: 10px;
  padding: 12px 14px; text-align: center; background: var(--bg-app);
}
.cmp-arrow-card { flex: 0 0 150px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 8px; border-style: dashed; }
.cmp-lbl { font-size: 11.5px; color: var(--ink-3); margin-bottom: 6px; }
.cmp-scores { display: flex; justify-content: center; gap: 18px; margin-bottom: 6px; }
.cmp-sc { display: flex; flex-direction: column; align-items: center; }
.cmp-sc-lbl { font-size: 10.5px; text-transform: uppercase; letter-spacing: .04em; color: var(--ink-3); margin-bottom: 2px; }
.cmp-score { font-size: 24px; font-weight: 650; font-family: var(--font-mono); }
.cmp-delta-row { display: flex; align-items: center; gap: 6px; font-size: 12px; }
.cmp-delta-k { color: var(--ink-3); text-transform: uppercase; letter-spacing: .04em; font-size: 10.5px; }
.cmp-delta-pill { font-size: 15px; font-weight: 650; font-family: var(--font-mono); }
.cmp-stats { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 18px; }

.cmp-block { margin-bottom: 18px; }
.cmp-h { font-size: 13px; margin: 0 0 6px; display: flex; align-items: center; gap: 8px; }
.cmp-h.ok { color: oklch(45% 0.10 150); }
.cmp-h.bad { color: oklch(48% 0.14 25); }
.cmp-h.info { color: oklch(45% 0.10 250); }
.cmp-h.na { color: var(--ink-3); }
.cmp-n {
  font-family: var(--font-mono); font-size: 11px; font-weight: 600;
  background: var(--bg-app); border: 1px solid var(--rule); border-radius: 10px; padding: 1px 8px; color: var(--ink-2);
}
.cmp-empty { font-size: 12px; margin: 0; }
.cmp-table td { font-size: 12.5px; vertical-align: middle; }
.cmp-id { white-space: nowrap; color: var(--ink-2); }
.cmp-trans { white-space: nowrap; text-align: right; }
.cmp-arrow { color: var(--ink-4); }

/* Icône d'info (tooltip) à côté d'un libellé de score. */
.hint-i { color: var(--ink-4); font-size: 10px; cursor: help; vertical-align: super; }

/* ============================================================================
   TASK 9 — Splitter glissable (table de contrôles ↔ panneau détail)
   ========================================================================== */
.mid-splitter {
  flex: 0 0 auto; height: 6px; width: 100%;
  background: var(--bg-panel); border-top: 1px solid var(--rule);
  cursor: row-resize; position: relative; touch-action: none;
}
.mid-splitter::before {
  content: ""; position: absolute; left: 50%; top: 50%;
  width: 36px; height: 2px; margin: -1px 0 0 -18px;
  background: var(--ink-5); border-radius: 2px;
}
.mid-splitter:hover, .mid-splitter.dragging { background: var(--bg-row-hover); }
.mid-splitter:hover::before, .mid-splitter.dragging::before { background: var(--info); }

/* ============================================================================
   TASK 3 — Modale graphiques (anneau + barres)
   ========================================================================== */
.modal-body#charts-body { max-height: 78vh; overflow-y: auto; }
.chart-global { display: flex; align-items: center; gap: 22px; margin: 4px 0 18px; }
.chart-global .score-ring { width: 110px; height: 110px; flex: 0 0 auto; }
.chart-global .score-ring span { font-size: 22px; }
.chart-global-cap div:first-child { font-size: 13px; font-weight: 600; color: var(--ink-1); margin-bottom: 4px; }
.charts-lic-toggle { margin: 0 10px 0 auto; font-size: 12px; color: var(--ink-2); white-space: nowrap; }
.charts-lic-toggle input { margin: 0; }
.chart-h { margin: 16px 0 8px; }
.chart-bars { display: flex; flex-direction: column; gap: 2px; }
.chart-bar-row { display: grid; grid-template-columns: 220px 1fr 56px 44px; align-items: center; gap: 12px; padding: 3px 0; font-size: 12px; }
.chart-bar-label { color: var(--ink-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.chart-bar-track { height: 8px; background: var(--rule); border-radius: 4px; overflow: hidden; }
.chart-bar-fill { display: block; height: 100%; border-radius: 4px; min-width: 2px; }
.chart-bar-count { font-family: var(--font-mono); font-size: 11px; text-align: right; white-space: nowrap; color: var(--ink-3); }
.cb-ok { color: var(--ok); font-weight: 600; }
.cb-tot { color: var(--ink-2); font-weight: 600; }
.chart-bar-val { font-family: var(--font-mono); font-size: 11.5px; text-align: right; font-weight: 600; }
@media (max-width: 620px) {
  .chart-bar-row { grid-template-columns: 110px 1fr 50px 40px; }
}

/* ============================================================================
   TASK 10 — Bouton de bascule de thème
   ========================================================================== */
.theme-toggle {
  display: inline-flex; align-items: center; justify-content: center;
  width: 28px; height: 28px; padding: 0;
  border: 1px solid var(--rule-strong); border-radius: var(--radius);
  background: var(--bg-panel); font-size: 14px; line-height: 1; cursor: pointer;
}
.theme-toggle:hover { background: var(--bg-row-hover); }
.app .theme-toggle { background: var(--bg-app); }

/* ============================================================================
   TASK 10 — Thème SOMBRE (override des tokens). Surfaces oklch ~20-26 %, encre
   claire ~82-92 %, accents conservés mais légèrement éclaircis pour le contraste,
   fonds tintés assombris. Les codeblocks (--bg-code) restent sombres (inchangés).
   ========================================================================== */
:root[data-theme="dark"] {
  /* charte BSE en sombre : marine profond, accents éclaircis */
  --brand:        #5B70C9;
  --brand-hover:  #6E82D6;
  --brand-ink:    #FFFFFF;
  --brand-bar:    #18214A;
  --accent:       #F5A12E;
  --heading:      #B9C4F0;
  --link:         #7DB8F0;
  --th-bg:        #222A47;
  --th-ink:       #C3CCF2;

  /* surfaces (teintées marine) */
  --bg-app:        oklch(19% 0.018 272);
  --bg-panel:      oklch(22.5% 0.02 272);
  --bg-row-hover:  oklch(26.5% 0.025 272);
  --bg-row-sel:    oklch(30% 0.045 270);
  --bg-toolbar:    oklch(21% 0.018 272);
  --bg-detail:     oklch(20.5% 0.018 272);
  --bg-dark:       oklch(15% 0.015 272);
  --bg-code:       oklch(14% 0.015 272);

  /* ink (clair sur fond sombre) */
  --ink-1: oklch(93% 0.008 270);
  --ink-2: oklch(81% 0.01 270);
  --ink-3: oklch(67% 0.012 270);
  --ink-4: oklch(53% 0.012 270);
  --ink-5: oklch(40% 0.012 270);

  /* lines */
  --rule:        oklch(31% 0.022 272);
  --rule-strong: oklch(39% 0.028 272);

  /* accents (un peu plus clairs pour rester lisibles sur fond sombre) */
  --ok:   oklch(72% 0.14 150);
  --warn: oklch(77% 0.14  65);
  --bad:  oklch(69% 0.16  25);
  --info: oklch(72% 0.12 235);
  --neut: oklch(68% 0.01 270);

  /* fonds tintés assombris (basse luminance, chroma conservée) */
  --ok-bg:   oklch(30% 0.05 150);
  --warn-bg: oklch(31% 0.06  65);
  --bad-bg:  oklch(31% 0.07  25);
  --info-bg: oklch(30% 0.05 240);
  --neut-bg: oklch(28% 0.015 272);
  --tol:     oklch(72% 0.13 300);
  --tol-bg:  oklch(31% 0.06 300);
}
/* En sombre, le bouton primaire (encre foncée sur fond clair) s'inverse :
   on garde un fond clair lisible avec texte sombre. */
/* (bouton primaire sombre : géré par le bloc « Charte Blue Soft Empower » en fin de fichier) */

/* ---------- Signalements / feedback (widget global + écran admin) ---------- */
.topbar-version { text-decoration: none; }
.topbar-version:hover { color: var(--ink-1); border-color: var(--ink-4); }
.fb-btn {
    position: fixed; right: 18px; bottom: 18px; z-index: 900;
    padding: 8px 14px; border: 1px solid var(--rule-strong); border-radius: 999px;
    background: var(--bg-panel); color: var(--ink-2); font-size: 12.5px; font-weight: 600;
    cursor: pointer; box-shadow: 0 4px 14px oklch(20% 0.01 260 / 0.18);
}
.fb-btn:hover { background: var(--bg-row-hover); color: var(--ink-1); }
.fb-toast {
    position: fixed; right: 18px; bottom: 64px; z-index: 901;
    padding: 10px 14px; border-radius: 8px; font-size: 12.5px;
    background: var(--ok-bg); color: oklch(40% 0.09 150); border: 1px solid oklch(85% 0.05 150);
    box-shadow: 0 4px 14px oklch(20% 0.01 260 / 0.18);
}
.fb-toast-err { background: var(--bad-bg); color: oklch(48% 0.14 25); border-color: oklch(85% 0.06 25); }
/* Pastille « brouillon en cours » sur le bouton flottant. */
.fb-btn-draft::after {
    content: ""; display: inline-block; width: 8px; height: 8px; margin-left: 6px;
    border-radius: 50%; background: var(--warn); vertical-align: baseline;
}
/* Fenêtre FLOTTANTE non bloquante (pas d'overlay : la page reste utilisable). */
.fb-panel {
    position: fixed; right: 18px; bottom: 64px; z-index: 950;
    width: 380px; max-width: calc(100vw - 36px);
    background: var(--bg-panel); border: 1px solid var(--rule-strong); border-radius: 10px;
    box-shadow: 0 10px 32px oklch(20% 0.01 260 / 0.28);
    display: flex; flex-direction: column; overflow: hidden;
}
.fb-panel[hidden] { display: none; }
.fb-panel-head {
    display: flex; align-items: center; justify-content: space-between; gap: 8px;
    padding: 10px 14px; border-bottom: 1px solid var(--rule);
    background: var(--bg-app); cursor: move; user-select: none; touch-action: none;
}
.fb-panel-head b { font-size: 13px; color: var(--ink-1); }
.fb-panel-close {
    border: 0; background: none; color: var(--ink-3); font-size: 18px; line-height: 1;
    cursor: pointer; padding: 0 2px;
}
.fb-panel-close:hover { color: var(--ink-1); }
.fb-form { display: flex; flex-direction: column; gap: 12px; padding: 12px 14px 14px; }
.fb-form label { display: flex; flex-direction: column; gap: 4px; font-size: 12px; color: var(--ink-3); }
.fb-form select, .fb-form textarea {
    font: inherit; font-size: 13px; color: var(--ink-1);
    background: var(--bg-app); border: 1px solid var(--rule-strong); border-radius: 6px; padding: 7px 9px;
}
.fb-form textarea { resize: vertical; min-height: 110px; }
.fb-form .hint { margin: 0; font-size: 11px; color: var(--ink-4); }
.fb-filters { display: flex; flex-wrap: wrap; gap: 6px; margin: 0 0 14px; }
.fb-filters .btn-sm { text-decoration: none; }
.fb-filters .btn-sm.active { background: var(--info-bg); color: oklch(45% 0.10 250); border-color: oklch(75% 0.06 250); }
.fb-list { display: flex; flex-direction: column; gap: 12px; }
.fb-item { position: relative; }
.fb-item-head { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; font-size: 12.5px; margin-bottom: 8px; }
.fb-item-head .muted { font-size: 11.5px; }
.fb-page { font-size: 11px; text-decoration: none; max-width: 280px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.fb-message { margin: 0 0 10px; font-size: 13px; white-space: normal; }
.fb-manage { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.fb-manage select, .fb-manage input[type="text"] {
    font: inherit; font-size: 12.5px; color: var(--ink-1); width: auto; margin: 0;
    background: var(--bg-app); border: 1px solid var(--rule-strong); border-radius: 6px; padding: 5px 8px;
}
.fb-manage input[type="text"] { flex: 1; min-width: 220px; }
.fb-delete { position: absolute; top: 14px; right: 14px; margin: 0; }

/* ---------- Changelog / Nouveautés ---------- */
.changelog { display: flex; flex-direction: column; gap: 14px; max-width: 860px; }
.cl-head { display: flex; flex-wrap: wrap; align-items: baseline; gap: 10px; margin-bottom: 8px; }
.cl-head h2 { margin: 0; font-size: 15px; }
.cl-version {
    font-size: 12px; font-weight: 700; color: oklch(45% 0.10 250);
    background: var(--info-bg); border-radius: 6px; padding: 2px 8px;
}
.cl-date { font-size: 11.5px; margin-left: auto; }
.cl-items { margin: 0; padding-left: 20px; font-size: 13px; }
.cl-items li { margin: 4px 0; }

/* ---------- RGPD : case « Identités en clair » (topbar rapport + fiche client) ---------- */
.resolve-check {
    display: inline-flex; align-items: center; gap: 5px;
    font-size: 11.5px; color: var(--ink-3); white-space: nowrap; cursor: pointer;
}
.resolve-check input[type="checkbox"] { width: auto; height: auto; margin: 0; }
.resolve-status { font-family: var(--font-mono); font-size: 10.5px; border-radius: 3px; padding: 0 5px; }
.resolve-status:empty { display: none; }
.resolve-status.busy { color: var(--ink-3); }
.resolve-status.on { background: var(--accent); color: #fff; font-weight: 600; }
.resolve-status.err { background: var(--bad-bg); color: var(--bad); }
/* Nom résolu affiché EN CLAIR (temporaire) : en gras pour rappeler qu'il s'agit d'une donnée personnelle. */
.id-clear { font-weight: 700; color: inherit; background: none; }

/* ============================================================================
   Charte Blue Soft Empower — couche composants (après les règles de base).
   Topbar marine + logo blanc + filet orange (= page de garde du CR) ; titres
   marine ; en-têtes de tableaux lavande (= tableaux du CR) ; boutons primaires
   marine ; accents orange.
   ========================================================================== */
h1, h2 { color: var(--heading); font-weight: 700; }
h1 { font-weight: 900; letter-spacing: -0.005em; }
.card { border-radius: 8px; box-shadow: 0 1px 2px oklch(25% 0.05 270 / 0.04); }
.card > h2:first-child { display: flex; align-items: center; gap: 8px; }
.card > h2:first-child::before { content: ""; width: 3px; height: 14px; border-radius: 2px; background: var(--accent); flex: none; }

/* --- topbar marine --- */
.topbar {
  background: var(--brand-bar);
  border-bottom: 2px solid var(--accent);
  color: var(--brand-ink);
}
.brand { color: #fff; font-weight: 900; font-size: 14px; letter-spacing: .01em; gap: 10px; white-space: nowrap; flex: none; }
.brand::before {
  width: 58px; height: 28px; border-radius: 0;
  background: url("/assets/img/bse-logo-white.png") no-repeat center / contain;
}
.topbar-tag { color: rgba(255,255,255,.75); background: rgba(255,255,255,.08); border-color: rgba(255,255,255,.22); }
.topbar-version:hover { color: #fff; border-color: var(--accent); }
.topnav a { color: rgba(255,255,255,.85); }
.topnav a:hover { color: #fff; }
.topnav .who { color: #fff; background: rgba(255,255,255,.1); border-color: rgba(255,255,255,.22); }
.topbar .crumb, .app .topbar .crumb { color: rgba(255,255,255,.7); flex-wrap: nowrap; white-space: nowrap; min-width: 0; overflow: hidden; }
.topbar > .topbar-pill, .topbar > .btn-sm, .topbar > details > summary.btn-sm, .topbar > .resolve-check { white-space: nowrap; flex: none; }
/* workbench : topbar compacte (beaucoup d'actions) ; la date passe dans la barre d'état si l'écran est étroit */
.app > .topbar { gap: 8px; padding: 0 12px; }
.app .topbar > .btn-sm, .app .topbar > details > summary.btn-sm { padding: 0 9px; }
.app .statusbar .statusbar-date { display: none; }
@media (max-width: 1600px) {
  .app .topbar > .topbar-date { display: none; }
  .app .statusbar .statusbar-date { display: inline; }
}
.topbar .crumb a { color: rgba(255,255,255,.85); }
.topbar .crumb a::after { color: rgba(255,255,255,.45); }
.topbar .crumb b { color: #fff; font-weight: 700; }
.topbar > .resolve-check { color: rgba(255,255,255,.9); }
.topbar .theme-toggle, .app .topbar .theme-toggle { background: rgba(255,255,255,.1); border-color: rgba(255,255,255,.25); }
.topbar .theme-toggle:hover { background: rgba(255,255,255,.2); }
/* boutons de la topbar (enfants directs uniquement : les panneaux déroulants gardent le style clair) */
.topbar > .btn-sm, .topbar > details > summary.btn-sm {
  background: rgba(255,255,255,.1); color: #fff; border-color: rgba(255,255,255,.28);
}
.topbar > .btn-sm:hover, .topbar > details > summary.btn-sm:hover, .topbar > details[open] > summary.btn-sm {
  background: rgba(255,255,255,.2); text-decoration: none;
}
.app .topbar > .topbar-pill { background: var(--bg-panel); border-color: transparent; color: var(--ink-2); font-weight: 600; }
.app .share-panel, .app .mf-panel { color: var(--ink-1); }

/* --- boutons : primaire marine (y compris <button type=submit class=btn-primary>) --- */
.btn-primary, button.btn-primary[type="submit"] {
  background: var(--brand); color: var(--brand-ink); border-color: var(--brand); font-weight: 700;
}
.btn-primary:hover, button.btn-primary[type="submit"]:hover { background: var(--brand-hover); border-color: var(--brand-hover); text-decoration: none; }
button.btn-primary:disabled, .btn-primary:disabled { background: var(--ink-5); border-color: var(--ink-5); color: var(--bg-panel); }
.btn-sm:hover, a.btn-sm:hover { text-decoration: none; }
form input:focus, form select:focus, form textarea:focus,
.app .search:focus, .section-search:focus, .filters input:focus, .filters select:focus { border-color: var(--bse-cyan); box-shadow: 0 0 0 3px oklch(62% 0.13 235 / 0.15); }

/* --- tableaux : en-têtes lavande / marine (comme les tableaux du CR) --- */
table.grid thead th, .app table.controls thead th { background: var(--th-bg); color: var(--th-ink); font-weight: 700; }
table.grid a:hover { color: var(--link); }

/* --- workbench --- */
.seg button.active { background: var(--brand); color: var(--brand-ink); }
.seg button.active .ct { color: rgba(255,255,255,.8); }
.app .mf-badge { background: var(--accent); color: #fff; }
.app .multi-filter.has-sel > summary { border-color: var(--brand); }
.section-row.active { background: var(--bg-row-sel); border-left-color: var(--accent); color: var(--heading); font-weight: 700; }
.section-head { color: var(--heading); }
.app .detail h2 { color: var(--heading); }
.app .detail h4, .rail h4 { color: var(--heading); opacity: .85; }
.rail .ctrl-id { color: var(--heading); font-weight: 700; }
.mid-splitter:hover::before, .mid-splitter.dragging::before { background: var(--accent); }
.progress-bar { background: linear-gradient(90deg, var(--bse-cyan), var(--bse-navy)); }
.cl-version { color: var(--brand-ink); background: var(--brand); }
.fb-btn { background: var(--accent); color: #fff; border-color: var(--accent); }
.fb-btn:hover { background: var(--bse-orange-600); color: #fff; }
.fb-btn-draft::after { background: #fff; }
.fb-filters .btn-sm.active { background: var(--brand); color: var(--brand-ink); border-color: var(--brand); }

/* --- connexion / partage : fond marine pointillé (= couverture du CR) + logo couleur --- */
.login-body {
  background:
    radial-gradient(rgba(255,255,255,.16) 1px, transparent 1.4px) 0 0 / 22px 22px,
    linear-gradient(145deg, #3A3F95 0%, var(--bse-navy) 45%, #1B2862 100%);
}
.login-card { border: 0; border-top: 4px solid var(--accent); border-radius: 10px; box-shadow: 0 20px 60px rgba(10, 16, 48, .45); }
.login-card::before {
  content: ""; display: block; height: 64px; margin: 0 0 16px;
  background: url("/assets/img/bse-logo.png") no-repeat left center / contain;
}
.login-card h1::before { display: none; }
.login-card h1 { color: var(--heading); }
.login-card button[type="submit"] { background: var(--brand); color: var(--brand-ink); border-color: var(--brand); font-weight: 700; }
.login-card button[type="submit"]:hover { background: var(--brand-hover); }
:root[data-theme="dark"] .login-card::before { background-image: url("/assets/img/bse-logo-white.png"); }

/* --- état « identités en clair » actif : rappel visuel permanent (RGPD) --- */
html.ids-revealed .topbar { border-bottom-color: var(--bad); box-shadow: inset 0 -2px 0 var(--bad); }
html.ids-revealed .resolve-check { color: #fff; font-weight: 700; }
.mid-toolbar .topbar-pill { white-space: nowrap; }
/* sombre : badges tintés lisibles (texte = accent éclairci du thème) */
:root[data-theme="dark"] .badge.ok   { color: var(--ok); }
:root[data-theme="dark"] .badge.warn { color: var(--warn); }
:root[data-theme="dark"] .badge.bad  { color: var(--bad); }
:root[data-theme="dark"] .badge.info { color: var(--info); }
:root[data-theme="dark"] .badge.tol  { color: var(--tol); }

/* --- collecte déléguée one-shot (fiche client + page publique /collect) --- */
.delegated-box { margin-top: 18px; padding-top: 14px; border-top: 1px solid var(--rule); }
.delegated-box h3 { font-size: .9rem; margin: 0 0 6px; color: var(--heading); }
.delegated-box p { font-size: .82rem; margin: 0 0 8px; }
.delegated-link { width: min(100%, 420px); font-family: var(--font-mono); font-size: .75rem; }
.setup-step { font-size: .9rem; margin: 16px 0 6px; color: var(--heading); }
.device-code { font-family: var(--font-mono); font-size: 2rem; font-weight: 700; letter-spacing: .2em; text-align: center; margin: 10px 0 16px; }
.collect-card { max-width: 560px; }
.collect-points { font-size: .86rem; padding-left: 18px; margin: 10px 0 14px; }
.collect-points li { margin-bottom: 6px; }
.collect-scopes { font-size: .8rem; margin: 0 0 14px; }
.collect-scopes ul { max-height: 180px; overflow: auto; padding-left: 18px; margin: 6px 0 0; }

/* Collecte / onboarding : lien secondaire (code de connexion de secours) */
.collect-alt { margin-top: 10px; }
.collect-alt .link-btn { background: none; border: 0; padding: 0; color: var(--link, var(--ink-3)); text-decoration: underline; font-size: .82rem; cursor: pointer; box-shadow: none; }
