/* Plateforme d'audit : monochrome neutre, la couleur est réservée aux statuts de conformité.
   Arrondis : contrôles 8px, cartes 12px, panneaux et fenêtres 16px, étiquettes 6px.
   Thème : clair ou sombre selon le système (prefers-color-scheme). */
@font-face { font-family: "Geist"; src: url("/fonts/geist.woff2") format("woff2"); font-weight: 100 900; font-display: swap; }
@font-face { font-family: "Geist Mono"; src: url("/fonts/geist-mono.woff2") format("woff2"); font-weight: 100 900; font-display: swap; }

:root {
  color-scheme: light;
  /* surfaces : une seule famille de gris neutres */
  --canvas: #f1f1ef; --bg: #fafaf9; --panel: #fefefd; --soft: #efefed; --hover: #f5f5f3;
  --line: #e4e4e1; --line2: #d3d3cf;
  /* texte (contraste AA sur --bg et --panel) */
  --tx: #1c1c1a; --txm: #5f5f5a; --txl: #73736d;
  /* encre : boutons principaux, sélection */
  --ink: #1c1c1a; --ink-hover: #34342f; --on-ink: #fafaf9;
  --acc: var(--ink); --acc2: var(--ink); --accbg: #ececea; --accline: #c9c9c4;
  --side: var(--ink); --side2: var(--canvas); --sidetx: #45453f;
  /* statuts */
  --ok: #2e7d4f; --part: #d4931c; --nc: #d23f31; --nc-strong: #9e2a20; --na: #a19c93; --info: #3a64a8; --warn: #a86412;
  --ok-bg: #e8f2eb; --part-bg: #fbf0da; --nc-bg: #fbe8e5; --info-bg: #e7edf7; --na-bg: #ededeb;
  --ok-tx: #1f5c39; --part-tx: #7a4d0c; --nc-tx: #8f261d; --info-tx: #284a80; --na-tx: #55554f;
  --ok-line: #c3dccb; --part-line: #ecd5a2; --nc-line: #efc6bf; --info-line: #c8d6ec;
  /* seul accent : la marque */
  --signal: #e2551b;
  /* forme */
  --radius: 12px; --radius-sm: 8px; --radius-xs: 6px; --radius-lg: 16px;
  --shade: 28 28 26;
  --shadow: 0 1px 0 rgb(var(--shade) / .03);
  --shadow-pop: 0 1px 2px rgb(var(--shade) / .06), 0 12px 32px -8px rgb(var(--shade) / .2);
  --scrim: rgb(var(--shade) / .32);
  --font: "Geist", ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;
  --mono: "Geist Mono", ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  --ease-out: cubic-bezier(0.23, 1, 0.32, 1);
  --z-side: 50; --z-modal: 1000; --z-toast: 2000;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --canvas: #111110; --bg: #161615; --panel: #1c1c1a; --soft: #252523; --hover: #21211f;
    --line: #2d2d2a; --line2: #3c3c38;
    --tx: #ececea; --txm: #a6a6a0; --txl: #8e8e88;
    --ink: #ececea; --ink-hover: #d4d4cf; --on-ink: #161615;
    --accbg: #262624; --accline: #4a4a45; --sidetx: #b8b8b2;
    --ok: #4fae74; --part: #e0a63a; --nc: #ec5c4e; --nc-strong: #f07a6d; --na: #8e8e88; --info: #6d93d6; --warn: #e0a63a;
    --ok-bg: rgb(79 174 116 / .14); --part-bg: rgb(224 166 58 / .14); --nc-bg: rgb(236 92 78 / .14); --info-bg: rgb(109 147 214 / .15); --na-bg: #262624;
    --ok-tx: #8fd3a8; --part-tx: #f0c677; --nc-tx: #f59a90; --info-tx: #a9c2ee; --na-tx: #b8b8b2;
    --ok-line: rgb(79 174 116 / .35); --part-line: rgb(224 166 58 / .35); --nc-line: rgb(236 92 78 / .35); --info-line: rgb(109 147 214 / .35);
    --shade: 0 0 0;
    --shadow: 0 1px 0 rgb(0 0 0 / .2);
    --shadow-pop: 0 0 0 1px #2d2d2a, 0 16px 40px -8px rgb(0 0 0 / .6);
    --scrim: rgb(0 0 0 / .55);
  }
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body { font: 14px/1.55 var(--font); color: var(--tx); background: var(--canvas); -webkit-font-smoothing: antialiased; font-feature-settings: "ss01", "cv11"; }
::selection { background: var(--ink); color: var(--on-ink); }
a { color: var(--tx); text-decoration: underline; text-decoration-color: var(--line2); text-underline-offset: 3px; transition: text-decoration-color .15s ease; }
a:hover { text-decoration-color: currentColor; }
h1, h2, h3, h4 { margin: 0 0 .5em; line-height: 1.2; font-weight: 600; letter-spacing: -0.01em; text-wrap: balance; }
h1 { font-size: 1.75rem; letter-spacing: -0.035em; line-height: 1.1; }
h2 { font-size: 1.02rem; } h3 { font-size: .95rem; } h4 { font-size: .86rem; }
p { margin: 0 0 .7em; text-wrap: pretty; }
code, .mono { font-family: var(--mono); font-size: .84em; }
.muted { color: var(--txm); } .small { font-size: .82rem; } .tiny { font-size: .72rem; }
.nowrap { white-space: nowrap; } .right { text-align: right; } .center { text-align: center; }
.hidden { display: none !important; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
:focus-visible { outline: 2px solid var(--tx); outline-offset: 2px; border-radius: 4px; }
svg.i { flex-shrink: 0; display: inline-block; vertical-align: -0.2em; width: 1.15em; height: 1.15em; }
#side svg.i, #top svg.i { width: 18px; height: 18px; }
.btn svg.i { width: 16px; height: 16px; margin-left: -2px; color: inherit; }
.btn-sm svg.i { width: 14px; height: 14px; }
.btn-sm:has(> svg.i:only-child) { padding: 0 7px; }

/* ---------- coquille ---------- */
#app { display: grid; grid-template-columns: 248px minmax(0, 1fr); grid-template-rows: 60px minmax(0, 1fr); height: 100vh; height: 100dvh; }
#app.no-side { grid-template-columns: minmax(0, 1fr); }
#app.no-side #side, #app.no-side #top { display: none; }
#app.no-side #main { grid-column: 1; grid-row: 1 / -1; margin: 0; border: 0; border-radius: 0; padding: 0; background: var(--bg); }

#side { grid-row: 1 / -1; grid-column: 1; background: var(--canvas); color: var(--sidetx); overflow-y: auto; padding: 14px 12px 32px; scrollbar-width: thin; }
#side .brand { display: flex; align-items: center; gap: 10px; padding: 6px 8px 18px; color: var(--tx); text-decoration: none; font-weight: 600; letter-spacing: -0.01em; font-size: .95rem; }
.mark { width: 30px; height: 30px; flex-shrink: 0; background: url("/img/logo-64.png") center / contain no-repeat; }
#side .brand-n { min-width: 0; overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; line-height: 1.25; }
#side .grp { font-size: .72rem; color: var(--txl); margin: 20px 10px 6px; font-weight: 500; }
#side a.nav { display: flex; align-items: center; gap: 10px; padding: 6px 10px; min-height: 34px; border-radius: var(--radius-sm); color: var(--sidetx); font-size: .875rem; text-decoration: none; transition: background-color .15s ease, color .15s ease; }
#side a.nav svg.i { color: var(--txl); transition: color .15s ease; }
#side a.nav .nav-l { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
#side a.nav:hover { background: rgb(var(--shade) / .05); color: var(--tx); }
#side a.nav:hover svg.i { color: var(--tx); }
#side a.nav.on { background: var(--panel); color: var(--tx); font-weight: 550; box-shadow: 0 0 0 1px var(--line), 0 1px 2px rgb(var(--shade) / .05); }
#side a.nav.on svg.i { color: var(--tx); }
#side .count { margin-left: auto; font: 500 .72rem/1 var(--mono); color: var(--txl); font-variant-numeric: tabular-nums; }
#side .count.err { color: var(--nc); } #side .count.warn { color: var(--warn); }
#side .sub { padding-left: 14px; }

#top { grid-column: 2; grid-row: 1; display: flex; align-items: center; gap: 6px; padding: 0 16px 0 20px; background: var(--canvas); color: var(--tx); min-width: 0; }
#top .crumbs { flex: 1; min-width: 0; display: flex; align-items: center; gap: 8px; white-space: nowrap; overflow: hidden; font-size: .86rem; color: var(--txm); }
#top .crumbs a { text-decoration: none; color: var(--txm); }
#top .crumbs a:hover { color: var(--tx); }
#top .crumbs .crumb-cur { color: var(--tx); font-weight: 550; overflow: hidden; text-overflow: ellipsis; }
#top .crumbs .crumb-sep { color: var(--line2); }
#top .crumbs .crumb-meta { color: var(--txl); overflow: hidden; text-overflow: ellipsis; padding-left: 8px; border-left: 1px solid var(--line2); }
#top .tag { display: inline-flex; align-items: center; gap: 4px; font-size: .72rem; padding: 2px 7px; border-radius: var(--radius-xs); background: var(--panel); border: 1px solid var(--line); color: var(--txm); }
#top .tag svg.i { width: 12px; height: 12px; }
/* le point traduit un état réel (enregistrement) */
#top .sync { font-size: .76rem; color: var(--txm); white-space: nowrap; display: inline-flex; align-items: center; gap: 6px; margin-right: 8px; }
#top .sync::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: var(--line2); }
#top .sync.saving::before, #top .sync.pending::before { background: var(--part); animation: pulse 1.2s ease-in-out infinite; }
#top .sync.saved::before { background: var(--ok); }
#top .sync.offline::before { background: var(--nc); }
@keyframes pulse { 50% { opacity: .35; } }
#top .btn-top { display: inline-flex; align-items: center; gap: 7px; height: 34px; background: transparent; border: 0; color: var(--txm); border-radius: var(--radius-sm); padding: 0 10px; font: inherit; font-size: .82rem; font-weight: 500; cursor: pointer; text-decoration: none; transition: background-color .15s ease, color .15s ease, transform .16s var(--ease-out); }
#top .btn-top:hover { background: rgb(var(--shade) / .06); color: var(--tx); }
#top .btn-top:active { transform: scale(.97); }
#top .btn-top.icon-only { padding: 0 8px; }
#top .menu-btn { display: none; padding: 0 8px; margin-left: -8px; }
#top .avatar { width: 24px; height: 24px; border-radius: 7px; background: var(--ink); color: var(--on-ink); display: inline-grid; place-items: center; font-size: .66rem; font-weight: 600; letter-spacing: .02em; }
#top .user { color: var(--tx); }

#main { grid-column: 2; grid-row: 2; overflow-y: auto; min-width: 0; background: var(--bg); border: 1px solid var(--line); border-right: 0; border-bottom: 0; border-top-left-radius: var(--radius-lg); padding: 36px 44px 80px; scrollbar-gutter: stable; }
#main:focus { outline: none; }
.page-head { display: flex; align-items: flex-end; gap: 16px; margin-bottom: 28px; flex-wrap: wrap; }
.page-head .grow { flex: 1; min-width: 260px; }
.page-head h1 { margin: 0; }
.page-head .sub { color: var(--txm); margin-top: 8px; max-width: 68ch; font-size: .9rem; }

/* ---------- composants ---------- */
.card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); padding: 20px 22px; margin-bottom: 16px; }
.card > h2:first-child, .card > h3:first-child { margin-bottom: 14px; }
.card-head { display: flex; align-items: center; gap: 10px; margin-bottom: 14px; flex-wrap: wrap; }
.card-head h2, .card-head h3 { margin: 0; flex: 1; }
.grid { display: grid; gap: 16px; }
.grid-2 { grid-template-columns: repeat(auto-fit, minmax(min(100%, 340px), 1fr)); }
.grid-3 { grid-template-columns: repeat(auto-fit, minmax(min(100%, 280px), 1fr)); }
.grid-4 { grid-template-columns: repeat(auto-fit, minmax(min(100%, 180px), 1fr)); }
.row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.row.top { align-items: flex-start; }
.stack > * + * { margin-top: 12px; }
.sep { height: 1px; background: var(--line); margin: 16px 0; }

.btn { display: inline-flex; align-items: center; justify-content: center; gap: 7px; height: 34px; border: 1px solid var(--line2); background: var(--panel); color: var(--tx); border-radius: var(--radius-sm); padding: 0 13px; font: inherit; font-size: .84rem; font-weight: 500; cursor: pointer; white-space: nowrap; text-decoration: none; box-shadow: 0 1px 1px rgb(var(--shade) / .04);
  transition: background-color .15s ease, border-color .15s ease, color .15s ease, transform .16s var(--ease-out); }
.btn:hover { background: var(--hover); border-color: var(--accline); text-decoration: none; }
.btn:active:not(:disabled) { transform: scale(.97); }
.btn:disabled { opacity: .45; cursor: not-allowed; }
.btn-primary { background: var(--ink); border-color: var(--ink); color: var(--on-ink); box-shadow: 0 1px 2px rgb(var(--shade) / .2); }
.btn-primary:hover { background: var(--ink-hover); border-color: var(--ink-hover); color: var(--on-ink); }
.btn-danger { background: var(--panel); border-color: var(--nc-line); color: var(--nc-tx); }
.btn-danger:hover { background: var(--nc-bg); border-color: var(--nc); color: var(--nc-tx); }
.btn-sm { height: 28px; padding: 0 10px; font-size: .78rem; }
.btn-ghost { border-color: transparent; background: transparent; box-shadow: none; }
.btn-ghost:hover { background: rgb(var(--shade) / .05); border-color: transparent; }
.icon-btn { border: none; background: transparent; cursor: pointer; font-size: 1rem; color: var(--txm); padding: 4px 7px; border-radius: var(--radius-xs); transition: background-color .15s ease, color .15s ease; }
.icon-btn:hover { background: var(--soft); color: var(--tx); }

.input, select.input, textarea.input { width: 100%; border: 1px solid var(--line2); border-radius: var(--radius-sm); padding: 7px 11px; min-height: 36px; font: inherit; font-size: .875rem; color: var(--tx); background: var(--panel); transition: border-color .15s ease, box-shadow .15s ease; }
.input::placeholder { color: var(--txl); }
select.input { appearance: none; padding-right: 30px; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 256 256' fill='%2373736d'%3E%3Cpath d='M213.66,101.66l-80,80a8,8,0,0,1-11.32,0l-80-80A8,8,0,0,1,53.66,90.34L128,164.69l74.34-74.35a8,8,0,0,1,11.32,11.32Z'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 10px center; }
select.input[multiple] { background-image: none; padding-right: 11px; }
textarea.input { resize: vertical; min-height: 76px; line-height: 1.5; }
.input:hover { border-color: var(--accline); }
.input:focus { outline: none; border-color: var(--tx); box-shadow: 0 0 0 3px rgb(var(--shade) / .1); }
.input[readonly], .input:disabled { background: var(--soft); color: var(--txm); }
input[type=checkbox], input[type=radio] { accent-color: var(--ink); width: 15px; height: 15px; }
.lbl { display: block; font-size: .78rem; font-weight: 500; color: var(--txm); margin: 0 0 6px; }
.field { margin-bottom: 16px; }
.help { font-size: .76rem; color: var(--txl); margin-top: 5px; }
.check { display: inline-flex; gap: 8px; align-items: center; cursor: pointer; font-size: .86rem; }

.badge { display: inline-flex; align-items: center; gap: 4px; padding: 2px 7px; border-radius: var(--radius-xs); font-size: .72rem; font-weight: 500; background: var(--soft); color: var(--txm); white-space: nowrap; line-height: 1.45; }
.badge.ok { background: var(--ok-bg); color: var(--ok-tx); } .badge.part { background: var(--part-bg); color: var(--part-tx); }
.badge.nc { background: var(--nc-bg); color: var(--nc-tx); } .badge.na { background: var(--na-bg); color: var(--na-tx); }
.badge.acc { background: var(--ink); color: var(--on-ink); } .badge.info { background: var(--info-bg); color: var(--info-tx); }
.badge.err { background: var(--nc); color: #fff; } .badge.warn { background: var(--part); color: #fff; }
.pill { display: inline-block; padding: 2px 8px; border-radius: var(--radius-xs); font-size: .74rem; font-weight: 500; color: #fff; }
.chip { display: inline-flex; align-items: center; gap: 6px; padding: 2px 9px; border: 1px solid var(--line2); border-radius: var(--radius-xs); font-size: .78rem; background: var(--panel); max-width: 100%; }
.chip .x { cursor: pointer; color: var(--txl); border: 0; background: none; padding: 0 2px; font-size: .9rem; }
.chip .x:hover { color: var(--nc); }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }

.table-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: var(--radius); background: var(--panel); }
table.tbl { width: 100%; border-collapse: collapse; font-size: .84rem; font-variant-numeric: tabular-nums; }
.tbl th { text-align: left; background: var(--panel); color: var(--txm); font-size: .74rem; font-weight: 500; padding: 10px 12px; position: sticky; top: 0; z-index: 1; white-space: nowrap; border-bottom: 1px solid var(--line); }
.tbl td { padding: 10px 12px; border-top: 1px solid var(--line); vertical-align: top; }
.tbl tr:first-child td { border-top: 0; }
.tbl tr.clickable { cursor: pointer; } .tbl tr.clickable:hover td { background: var(--hover); }
.tbl tr.sel td { background: var(--accbg); }
.tbl input.input, .tbl select.input { padding: 4px 8px; min-height: 30px; font-size: .82rem; }

.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 0; margin-bottom: 24px; background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
.kpi { background: var(--panel); padding: 16px 20px 18px; box-shadow: -1px 0 0 var(--line), 0 -1px 0 var(--line); min-width: 0; }
.kpi a { text-decoration: none; color: inherit; display: block; }
.kpi a:hover .v { text-decoration: underline; text-decoration-thickness: 1px; text-underline-offset: 4px; }
.kpi .v { font-size: 1.85rem; font-weight: 500; line-height: 1.1; letter-spacing: -0.035em; font-variant-numeric: tabular-nums; }
.kpi .l { font-size: .78rem; color: var(--txm); margin-top: 6px; }
.grid > .kpi, .grid-4 > .kpi { border: 1px solid var(--line); border-radius: var(--radius); box-shadow: none; }
.bar { height: 6px; background: var(--soft); border-radius: 3px; overflow: hidden; display: flex; gap: 1px; }
.bar > span { display: block; height: 100%; }
.progress { height: 4px; background: var(--soft); border-radius: 2px; overflow: hidden; }
.progress > span { display: block; height: 100%; background: var(--ink); border-radius: 2px; }

.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); margin-bottom: 20px; flex-wrap: wrap; }
.tab { padding: 9px 12px; font-weight: 500; font-size: .86rem; color: var(--txm); cursor: pointer; border-bottom: 2px solid transparent; margin-bottom: -1px; background: none; border-top: 0; border-left: 0; border-right: 0; font-family: inherit; transition: color .15s ease, border-color .15s ease; }
.tab:hover { color: var(--tx); }
.tab.on { color: var(--tx); border-bottom-color: var(--tx); }
.seg { display: inline-flex; padding: 3px; gap: 2px; background: var(--soft); border-radius: 10px; }
.seg button { border: 0; background: transparent; padding: 4px 10px; height: 28px; font: inherit; font-size: .8rem; font-weight: 500; cursor: pointer; color: var(--txm); border-radius: var(--radius-xs); transition: background-color .15s ease, color .15s ease; }
.seg button:hover { color: var(--tx); }
.seg button.on { background: var(--panel); color: var(--tx); box-shadow: 0 1px 2px rgb(var(--shade) / .1), 0 0 0 1px var(--line); }

/* ---------- évaluation ---------- */
.audit-layout { display: grid; grid-template-columns: minmax(300px, 420px) minmax(0, 1fr); gap: 20px; align-items: start; }
.req-list { max-height: calc(100vh - 230px); overflow-y: auto; background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); scrollbar-width: thin; }
.req-sec { padding: 9px 14px; background: color-mix(in srgb, var(--bg) 92%, transparent); backdrop-filter: blur(6px); font-weight: 500; font-size: .76rem; color: var(--txm); position: sticky; top: 0; z-index: 1; border-top: 1px solid var(--line); display: flex; gap: 8px; align-items: center; cursor: pointer; }
.req-sec:first-child { border-top: 0; }
.req-item { display: flex; gap: 10px; align-items: flex-start; padding: 10px 14px; border-top: 1px solid var(--line); cursor: pointer; font-size: .84rem; transition: background-color .12s ease; }
.req-item:hover { background: var(--hover); }
.req-item.on { background: var(--accbg); box-shadow: inset 2px 0 0 var(--tx); }
.req-item .ref { font-family: var(--mono); font-size: .74rem; color: var(--txm); min-width: 54px; padding-top: 1px; }
.req-item .t { flex: 1; min-width: 0; }
.req-item .t .d { color: var(--txm); font-size: .76rem; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
/* pastille = résultat réel de l'exigence */
.dotr { width: 9px; height: 9px; border-radius: 50%; margin-top: 5px; flex-shrink: 0; border: 1.5px solid transparent; }
.detail { position: sticky; top: 0; }
.req-text { white-space: pre-wrap; background: var(--soft); border-radius: var(--radius-sm); padding: 12px 14px; font-size: .86rem; line-height: 1.6; max-height: 280px; overflow-y: auto; }
.res-btns { display: flex; gap: 6px; flex-wrap: wrap; }
.res-btn { border: 1px solid var(--line2); background: var(--panel); border-radius: var(--radius-sm); padding: 0 12px; height: 34px; font: inherit; font-weight: 500; font-size: .82rem; cursor: pointer; color: var(--txm); transition: background-color .15s ease, border-color .15s ease, color .15s ease, transform .16s var(--ease-out); }
.res-btn:hover { border-color: var(--txm); color: var(--tx); }
.res-btn:active { transform: scale(.97); }
.res-btn.on { color: #fff; }
.res-btn[data-v=compliant].on { background: var(--ok); border-color: var(--ok); }
.res-btn[data-v=partially_compliant].on { background: var(--part); border-color: var(--part); }
.res-btn[data-v=non_compliant].on { background: var(--nc); border-color: var(--nc); }
.res-btn[data-v=not_applicable].on { background: var(--na); border-color: var(--na); }
.score-btns { display: flex; gap: 4px; flex-wrap: wrap; }
.score-btn { min-width: 34px; height: 30px; border: 1px solid var(--line2); background: var(--panel); color: var(--tx); border-radius: var(--radius-sm); padding: 0 8px; font: inherit; font-family: var(--mono); font-size: .8rem; font-weight: 500; cursor: pointer; transition: background-color .15s ease, color .15s ease, transform .16s var(--ease-out); }
.score-btn:hover { border-color: var(--txm); }
.score-btn:active { transform: scale(.95); }
.score-btn.on { background: var(--ink); color: var(--on-ink); border-color: var(--ink); }
.chk-row { display: flex; gap: 10px; align-items: flex-start; padding: 9px 0; border-top: 1px solid var(--line); font-size: .84rem; }
.chk-row:first-child { border-top: 0; }
.chk-row .t { flex: 1; }
.chk-btns { display: flex; gap: 3px; flex-shrink: 0; }
.chk-btns button { border: 1px solid var(--line2); background: var(--panel); border-radius: var(--radius-xs); font: inherit; font-size: .7rem; font-weight: 500; padding: 2px 7px; cursor: pointer; color: var(--txm); transition: background-color .12s ease, color .12s ease; }
.chk-btns button:hover { color: var(--tx); border-color: var(--txm); }
.chk-btns button.on[data-v=ok] { background: var(--ok); color: #fff; border-color: var(--ok); }
.chk-btns button.on[data-v=partial] { background: var(--part); color: #fff; border-color: var(--part); }
.chk-btns button.on[data-v=missing] { background: var(--nc); color: #fff; border-color: var(--nc); }
.chk-btns button.on[data-v=na] { background: var(--na); color: #fff; border-color: var(--na); }
.hint { background: var(--soft); border-left: 2px solid var(--tx); border-radius: 0 var(--radius-sm) var(--radius-sm) 0; padding: 10px 14px; font-size: .82rem; }
.notice { border-radius: var(--radius-sm); padding: 10px 14px; font-size: .84rem; border: 1px solid; }
.notice.warn { background: var(--part-bg); border-color: var(--part-line); color: var(--part-tx); }
.notice.err { background: var(--nc-bg); border-color: var(--nc-line); color: var(--nc-tx); }
.notice.info { background: var(--info-bg); border-color: var(--info-line); color: var(--info-tx); }
.notice.ok { background: var(--ok-bg); border-color: var(--ok-line); color: var(--ok-tx); }
.notice a { color: inherit; }
details.more > summary { cursor: pointer; font-weight: 500; font-size: .82rem; color: var(--txm); margin: 8px 0; }
details.more > summary:hover { color: var(--tx); }
ul.compact { margin: 4px 0; padding-left: 18px; } ul.compact li { margin: 3px 0; }

/* ---------- entretien (mode flash) ---------- */
.flash { max-width: 920px; margin: 0 auto; }
.flash .card { padding: 32px 36px; }
.flash .big-ref { font-family: var(--mono); color: var(--txm); font-weight: 500; }
.flash h2 { font-size: 1.6rem; font-weight: 600; letter-spacing: -0.03em; line-height: 1.2; }
.kbd { display: inline-block; border: 1px solid var(--line2); border-bottom-width: 2px; border-radius: 5px; padding: 0 5px; font-size: .72rem; font-family: var(--mono); background: var(--panel); color: var(--txm); }

/* ---------- kanban ---------- */
.kanban { display: grid; grid-template-columns: repeat(5, minmax(210px, 1fr)); gap: 12px; overflow-x: auto; }
.kcol { background: var(--soft); border-radius: var(--radius); padding: 10px; min-height: 220px; }
.kcol h4 { display: flex; justify-content: space-between; margin: 2px 4px 10px; font-weight: 500; color: var(--txm); }
.kcol.drop { outline: 1.5px dashed var(--tx); outline-offset: -2px; }
.kcard { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 10px 12px; margin-bottom: 8px; cursor: grab; font-size: .82rem; box-shadow: 0 1px 2px rgb(var(--shade) / .04); transition: box-shadow .15s ease; }
.kcard:hover { box-shadow: 0 2px 8px rgb(var(--shade) / .1); }
.kcard:active { cursor: grabbing; }

/* ---------- risques ---------- */
.heat { border-collapse: separate; border-spacing: 3px; }
.heat td { width: 46px; height: 38px; text-align: center; font-weight: 600; border-radius: var(--radius-xs); color: #1c1c1a; font-size: .84rem; font-variant-numeric: tabular-nums; }
.heat th { font-size: .68rem; color: var(--txm); font-weight: 500; padding: 2px 4px; max-width: 90px; }

/* ---------- connexion ---------- */
.auth-wrap { min-height: 100vh; min-height: 100dvh; display: grid; grid-template-columns: minmax(0, 1.15fr) minmax(380px, .85fr); background: var(--bg); }
.auth-aside { background: var(--canvas); border-right: 1px solid var(--line); padding: 40px 56px 48px; display: flex; flex-direction: column; justify-content: space-between; gap: 40px; }
.auth-aside .brand { display: flex; align-items: center; gap: 12px; font-weight: 600; font-size: 1.05rem; color: var(--tx); }
.auth-aside .brand .mark { width: 52px; height: 52px; background-image: url("/img/logo-192.png"); }
.auth-aside .statement { font-size: clamp(2.4rem, 4.2vw, 3.6rem); font-weight: 600; line-height: 1.04; letter-spacing: -0.045em; margin: 0; max-width: 11ch; color: var(--tx); }
.auth-aside .statement span { color: var(--txl); }
.auth-aside .lede { color: var(--txm); max-width: 44ch; margin: 18px 0 0; font-size: .95rem; }
.auth-main { display: flex; align-items: center; justify-content: center; padding: 40px 24px; }
.auth-card { width: 100%; max-width: 360px; }
.auth-card h1 { font-size: 1.6rem; margin-bottom: 6px; }
.auth-card .lead { color: var(--txm); margin-bottom: 28px; }
.auth-card .btn-primary { height: 42px; font-size: .9rem; }
.auth-card .input { min-height: 42px; }

/* ---------- modales & toasts ---------- */
.modal-backdrop { position: fixed; inset: 0; background: var(--scrim); backdrop-filter: blur(3px); z-index: var(--z-modal); display: flex; align-items: flex-start; justify-content: center; padding: 8vh 16px; overflow-y: auto; animation: fade .18s ease-out; }
.modal { background: var(--panel); border-radius: var(--radius-lg); width: 100%; max-width: 560px; box-shadow: var(--shadow-pop), 0 0 0 1px rgb(var(--shade) / .06); animation: modal-in .22s var(--ease-out); }
.modal-wide { max-width: 980px; }
.modal-head { display: flex; align-items: center; padding: 18px 22px 6px; }
.modal-head h3 { flex: 1; margin: 0; font-size: 1.05rem; }
.modal-body { padding: 12px 22px 18px; max-height: 70vh; overflow-y: auto; }
.modal-foot { display: flex; justify-content: flex-end; gap: 8px; padding: 14px 22px; border-top: 1px solid var(--line); background: var(--bg); border-radius: 0 0 var(--radius-lg) var(--radius-lg); }
@keyframes fade { from { opacity: 0; } }
@keyframes modal-in { from { opacity: 0; transform: translateY(6px) scale(.98); } }
#toasts { position: fixed; right: 20px; bottom: 20px; z-index: var(--z-toast); display: flex; flex-direction: column; gap: 8px; max-width: 420px; }
.toast { background: var(--ink); color: var(--on-ink); padding: 11px 16px 11px 14px; border-radius: var(--radius-sm); box-shadow: var(--shadow-pop); font-size: .85rem; display: flex; align-items: center; gap: 10px; transition: opacity .2s ease, transform .2s ease; animation: toast-in .3s var(--ease-out); }
/* le point indique le type de message (erreur / succès) */
.toast-error::before, .toast-ok::before { content: ""; width: 7px; height: 7px; border-radius: 50%; flex-shrink: 0; }
.toast-error::before { background: var(--nc); } .toast-ok::before { background: var(--ok); }
.toast.out { opacity: 0; transform: translateY(4px); }
@keyframes toast-in { from { opacity: 0; transform: translateY(10px); } }

.empty { text-align: center; color: var(--txm); padding: 48px 16px; }
.loading { color: var(--txm); padding: 20px; }
.spinner { display: inline-block; width: 14px; height: 14px; border: 1.5px solid var(--line2); border-top-color: var(--tx); border-radius: 50%; animation: spin .6s linear infinite; vertical-align: -2px; }
@keyframes spin { to { transform: rotate(360deg); } }
svg text { font-family: var(--font); }

/* ---------- missions ---------- */
.m-card { position: relative; display: flex; flex-direction: column; gap: 16px; height: 100%; margin: 0; padding: 20px 22px; transition: border-color .15s ease, box-shadow .2s ease; }
.m-card:hover { border-color: var(--line2); box-shadow: 0 4px 16px -6px rgb(var(--shade) / .12); }
.m-card .m-title { font-size: 1.02rem; font-weight: 600; letter-spacing: -0.015em; margin: 0; }
.m-card .m-title a { text-decoration: none; }
.m-card .m-title a::after { content: ""; position: absolute; inset: 0; }
.m-card .btn { position: relative; z-index: 1; }
.m-card .m-foot { margin-top: auto; display: flex; justify-content: space-between; align-items: center; gap: 10px; padding-top: 14px; border-top: 1px solid var(--line); font-size: .76rem; color: var(--txl); }
.fw-line { display: flex; justify-content: space-between; gap: 10px; font-size: .8rem; margin-bottom: 6px; }
.fw-line .n { font-family: var(--mono); font-size: .74rem; color: var(--txm); }
.toolbar { display: flex; gap: 8px; align-items: center; margin-bottom: 20px; flex-wrap: wrap; }
.search { position: relative; flex: 0 1 340px; }
.search svg.i { position: absolute; left: 11px; top: 50%; transform: translateY(-50%); color: var(--txl); width: 16px; height: 16px; pointer-events: none; }
.search .input { padding-left: 34px; }

/* ---------- graphiques (svg.js) ---------- */
.ch-track { stroke: var(--soft); }
.ch-grid { stroke: var(--line); }
.ch-tx { fill: var(--tx); }
.ch-txm { fill: var(--txm); }

/* ---------- impression (rapport) : toujours en clair ---------- */
.print-only { display: none; }
@media print {
  :root { color-scheme: light; --canvas: #fff; --bg: #fff; --panel: #fff; --soft: #efefed; --line: #e4e4e1; --line2: #d3d3cf; --tx: #1c1c1a; --txm: #5f5f5a; --txl: #73736d; --ink: #1c1c1a; --on-ink: #fff; }
  #top, #side, .no-print, #toasts { display: none !important; }
  #app { display: block; height: auto; }
  #main { overflow: visible; padding: 0; border: 0; background: #fff; }
  body { background: #fff; font-size: 11pt; }
  .card { box-shadow: none; break-inside: avoid; }
  .print-only { display: block; }
  .page-break { break-before: page; }
  .tbl th { position: static; }
}

@media (hover: none) { .m-card:hover { box-shadow: var(--shadow); } }
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; }
}
@media (max-width: 1100px) { #main { padding: 28px 28px 64px; } }
@media (max-width: 900px) {
  #app { grid-template-columns: minmax(0, 1fr); }
  #top { grid-column: 1; padding: 0 12px; gap: 2px; }
  #top .menu-btn { display: inline-flex; }
  #top .hide-sm { display: none; }
  #top .crumbs .crumb-root, #top .crumbs .crumb-sep, #top .crumbs .crumb-meta { display: none; }
  #side { display: none; }
  #app.side-open #side { display: block; position: fixed; top: 0; bottom: 0; left: 0; width: 272px; z-index: var(--z-side); box-shadow: var(--shadow-pop); animation: side-in .22s var(--ease-out); }
  #main { grid-column: 1; border-left: 0; border-radius: var(--radius-lg) var(--radius-lg) 0 0; padding: 22px 16px 56px; }
  h1 { font-size: 1.5rem; }
  .audit-layout { grid-template-columns: 1fr; }
  .req-list { max-height: 45vh; }
  .auth-wrap { grid-template-columns: 1fr; }
  .auth-aside { padding: 24px 20px 28px; gap: 24px; border-right: 0; border-bottom: 1px solid var(--line); }
  .auth-aside .statement { font-size: 2.1rem; }
  .auth-aside .lede { display: none; }
}
@keyframes side-in { from { transform: translateX(-12px); opacity: 0; } }
