/* Portail d'audit — mise en page inspirée de TailAdmin (sidebar, header sticky, cartes arrondies) */
:root {
  --bg: #F9FAFB;
  --card: #FFFFFF;
  --sidebar: #FFFFFF;
  --border: #E4E7EC;
  --border-soft: #F2F4F7;
  --hover: #F2F4F7;
  --title: #1D2939;
  --text: #344054;
  --muted: #667085;
  --faint: #98A2B3;
  --input: #FFFFFF;
  --code: #F9FAFB;
  --brand: #465FFF;
  --brand-600: #3641F5;
  --brand-soft: #ECF3FF;
  --brand-text: #465FFF;
  --success-bg: #ECFDF3; --success: #039855; --success-solid: #12B76A;
  --warning-bg: #FFFAEB; --warning: #DC6803; --warning-solid: #F79009;
  --orange-bg: #FFF6ED;  --orange: #EC4A0A;  --orange-solid: #FB6514;
  --error-bg: #FEF3F2;   --error: #D92D20;   --error-solid: #F04438;
  --info-bg: #F0F9FF;    --info: #0086C9;    --info-solid: #0BA5EC;
  --gray-bg: #F2F4F7;
  --shadow-xs: 0 1px 2px rgba(16, 24, 40, .05);
  --shadow-lg: 0 12px 16px -4px rgba(16, 24, 40, .08), 0 4px 6px -2px rgba(16, 24, 40, .03);
  --focus: 0 0 0 4px rgba(70, 95, 255, .12);
  --font: "Outfit", ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, "Liberation Mono", monospace;
  --sidebar-w: 290px;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #101828; --card: #171F2F; --sidebar: #101828; --border: #1D2939; --border-soft: #1D2939; --hover: #1D2939;
    --title: #F2F4F7; --text: #D0D5DD; --muted: #98A2B3; --faint: #667085; --input: #101828; --code: #0C111D;
    --brand-soft: rgba(70, 95, 255, .14); --brand-text: #7592FF;
    --success-bg: rgba(18, 183, 106, .15); --success: #32D583;
    --warning-bg: rgba(247, 144, 9, .15);  --warning: #FDB022;
    --orange-bg: rgba(251, 101, 20, .15);  --orange: #FD853A;
    --error-bg: rgba(240, 68, 56, .15);    --error: #F97066;
    --info-bg: rgba(11, 165, 236, .15);    --info: #36BFFA;
    --gray-bg: rgba(255, 255, 255, .05);
    --shadow-lg: 0 12px 16px -4px rgba(0, 0, 0, .4);
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #101828; --card: #171F2F; --sidebar: #101828; --border: #1D2939; --border-soft: #1D2939; --hover: #1D2939;
  --title: #F2F4F7; --text: #D0D5DD; --muted: #98A2B3; --faint: #667085; --input: #101828; --code: #0C111D;
  --brand-soft: rgba(70, 95, 255, .14); --brand-text: #7592FF;
  --success-bg: rgba(18, 183, 106, .15); --success: #32D583;
  --warning-bg: rgba(247, 144, 9, .15);  --warning: #FDB022;
  --orange-bg: rgba(251, 101, 20, .15);  --orange: #FD853A;
  --error-bg: rgba(240, 68, 56, .15);    --error: #F97066;
  --info-bg: rgba(11, 165, 236, .15);    --info: #36BFFA;
  --gray-bg: rgba(255, 255, 255, .05);
  --shadow-lg: 0 12px 16px -4px rgba(0, 0, 0, .4);
  color-scheme: dark;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--text); font: 14px/1.6 var(--font); }
a { color: var(--brand-text); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3, h4 { color: var(--title); line-height: 1.3; margin: 0 0 .6em; font-weight: 600; }
p { margin: 0 0 .9em; }
button { font: inherit; color: inherit; }
svg { flex: none; }
.noscript { padding: 24px; }

/* ------------------------------------------------------------------ boutons, badges */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; padding: 10px 16px; border-radius: 8px; border: 1px solid var(--brand); background: var(--brand); color: #fff; font-size: 14px; font-weight: 500; cursor: pointer; box-shadow: var(--shadow-xs); white-space: nowrap; }
.btn:hover { background: var(--brand-600); border-color: var(--brand-600); text-decoration: none; }
.btn:focus-visible { outline: none; box-shadow: var(--focus); }
.btn.outline { background: var(--card); border-color: var(--border); color: var(--text); }
.btn.outline:hover { background: var(--hover); color: var(--title); }
.btn.sm { padding: 7px 12px; font-size: 13px; }
.btn.block { width: 100%; }
.icon-btn { display: inline-grid; place-items: center; width: 44px; height: 44px; border-radius: 50%; border: 1px solid var(--border); background: var(--card); color: var(--muted); cursor: pointer; }
.icon-btn:hover { background: var(--hover); color: var(--title); }
.icon-btn.square { border-radius: 8px; }

.badge { display: inline-flex; align-items: center; gap: 4px; padding: 2px 10px; border-radius: 999px; font-size: 12px; font-weight: 500; line-height: 18px; white-space: nowrap; background: var(--gray-bg); color: var(--text); }
.badge-success { background: var(--success-bg); color: var(--success); }
.badge-warning { background: var(--warning-bg); color: var(--warning); }
.badge-orange { background: var(--orange-bg); color: var(--orange); }
.badge-error { background: var(--error-bg); color: var(--error); }
.badge-info { background: var(--info-bg); color: var(--info); }
.badge-brand { background: var(--brand-soft); color: var(--brand-text); }
.badge-crit { background: var(--error-solid); color: #fff; }
.badge.lg { font-size: 14px; padding: 4px 14px; }
.tag { margin-left: 6px; padding: 0 8px; font-size: 11px; }

.note { display: inline-grid; place-items: center; width: 32px; height: 32px; border-radius: 8px; font-weight: 700; font-size: 14px; }
.note.big { width: 72px; height: 72px; border-radius: 16px; font-size: 32px; }
.note-a { background: var(--success-bg); color: var(--success); }
.note-b { background: var(--warning-bg); color: var(--warning); }
.note-c { background: var(--orange-bg); color: var(--orange); }
.note-d, .note-e { background: var(--error-bg); color: var(--error); }
.note-x { background: var(--gray-bg); color: var(--muted); }
a.note:hover { text-decoration: none; filter: brightness(.95); }
.bg-a { background: var(--success-solid); }
.bg-b { background: var(--warning-solid); }
.bg-c { background: var(--orange-solid); }
.bg-d, .bg-e { background: var(--error-solid); }
.bg-crit { background: #B42318; }
.bg-high { background: var(--error-solid); }
.bg-med { background: var(--warning-solid); }
.bg-low { background: var(--info-solid); }
.bg-other { background: var(--faint); }
.up { color: var(--success); }
.down { color: var(--error); }
.trend { font-size: 11px; margin-left: 3px; }

/* ------------------------------------------------------------------ mise en page */
.app { display: flex; min-height: 100vh; }
.sidebar { position: fixed; inset: 0 auto 0 0; z-index: 40; width: var(--sidebar-w); display: flex; flex-direction: column; background: var(--sidebar); border-right: 1px solid var(--border); padding: 0 20px; transition: width .2s, transform .2s; }
.main { flex: 1; min-width: 0; margin-left: var(--sidebar-w); transition: margin .2s; display: flex; flex-direction: column; }
.overlay { display: none; }

.logo { display: flex; align-items: center; gap: 10px; height: 76px; padding-top: 8px; color: var(--title); font-weight: 600; }
.logo:hover { text-decoration: none; }
.logo-mark { display: grid; place-items: center; width: 40px; height: 40px; border-radius: 10px; background: var(--brand); }
.logo-mark img { width: 28px; height: auto; }
.logo b { display: block; font-size: 17px; letter-spacing: .04em; line-height: 1.1; }
.logo small { display: block; color: var(--muted); font-size: 12px; font-weight: 400; }

.nav { flex: 1; overflow-y: auto; margin: 0 -8px; padding: 8px 8px 16px; scrollbar-width: thin; }
.nav-group { margin-bottom: 20px; }
.nav-title { display: flex; justify-content: space-between; color: var(--faint); font-size: 12px; text-transform: uppercase; letter-spacing: .02em; margin: 0 0 10px; line-height: 20px; }
.nav-item { display: flex; align-items: center; gap: 12px; padding: 8px 12px; border-radius: 8px; color: var(--text); font-weight: 500; margin-bottom: 4px; }
.nav-item:hover { background: var(--hover); text-decoration: none; color: var(--title); }
.nav-item svg { color: var(--muted); }
.nav-item.active { background: var(--brand-soft); color: var(--brand-text); }
.nav-item.active svg { color: var(--brand-text); }
.nav-item .label { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.nav-item .note { width: 24px; height: 24px; font-size: 12px; border-radius: 6px; }
.nav-item .count { font-size: 12px; color: var(--faint); }

.side-box { margin: 0 0 20px; padding: 16px; border-radius: 16px; background: var(--bg); border: 1px solid var(--border-soft); }
.side-box h4 { font-size: 14px; margin-bottom: 4px; }
.side-box p { color: var(--muted); font-size: 12px; margin-bottom: 12px; overflow-wrap: anywhere; }
.side-box .row { display: flex; gap: 8px; }
.side-box .btn { flex: 1; }

.header { position: sticky; top: 0; z-index: 30; display: flex; align-items: center; gap: 16px; min-height: 76px; padding: 12px 24px; background: var(--card); border-bottom: 1px solid var(--border); }
.header .spacer { flex: 1; }
.search { position: relative; width: 100%; max-width: 430px; }
.search > svg { position: absolute; left: 16px; top: 50%; transform: translateY(-50%); color: var(--muted); pointer-events: none; }
.search input { width: 100%; height: 44px; padding: 0 64px 0 46px; border: 1px solid var(--border); border-radius: 8px; background: transparent; color: var(--title); font: inherit; box-shadow: var(--shadow-xs); }
.search input::placeholder { color: var(--faint); }
.search input:focus { outline: none; border-color: #9CB9FF; box-shadow: var(--focus); }
.search kbd { position: absolute; right: 10px; top: 50%; transform: translateY(-50%); padding: 2px 7px; border: 1px solid var(--border); border-radius: 8px; background: var(--bg); color: var(--muted); font: 12px var(--font); }
.results { position: absolute; left: 0; right: 0; top: calc(100% + 6px); background: var(--card); border: 1px solid var(--border); border-radius: 12px; box-shadow: var(--shadow-lg); padding: 6px; max-height: 360px; overflow-y: auto; }
.results a { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: 8px; color: var(--text); }
.results a:hover, .results a.sel { background: var(--hover); text-decoration: none; }
.results .note { width: 26px; height: 26px; font-size: 12px; border-radius: 6px; }
.results .empty { padding: 10px; color: var(--muted); }
.client-name { flex: none; color: var(--title); font-size: 16px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 45%; }
.header .search { min-width: 0; }
.side-box .icon-btn { width: 34px; height: 34px; border-radius: 8px; }

.content { flex: 1; width: 100%; max-width: 1536px; margin: 0 auto; padding: 24px; }
.page-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 24px; }
.page-head h1 { font-size: 20px; margin: 0; }
.crumbs { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; font-size: 14px; color: var(--muted); }
.crumbs a { color: var(--muted); }
.crumbs a:hover { color: var(--brand-text); text-decoration: none; }
.crumbs span:last-child { color: var(--title); }

.grid { display: grid; grid-template-columns: repeat(12, minmax(0, 1fr)); gap: 24px; }
.col-12 { grid-column: span 12; }
.col-7 { grid-column: span 7; }
.col-5 { grid-column: span 5; }
.col-6 { grid-column: span 6; }
.col-3 { grid-column: span 3; }

.card { background: var(--card); border: 1px solid var(--border); border-radius: 16px; }
.card-pad { padding: 24px; }
.card-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px; padding: 20px 24px 0; }
.card-head h3 { font-size: 18px; margin: 0; }
.card-head p { margin: 2px 0 0; color: var(--muted); font-size: 14px; }
.card-body { padding: 20px 24px 24px; }

/* Indicateurs */
.metric { padding: 24px; }
.metric-icon { display: grid; place-items: center; width: 48px; height: 48px; border-radius: 12px; background: var(--gray-bg); color: var(--title); }
.metric-row { display: flex; align-items: flex-end; justify-content: space-between; gap: 8px; margin-top: 20px; }
.metric-label { color: var(--muted); font-size: 14px; }
.metric-value { color: var(--title); font-size: 30px; font-weight: 700; line-height: 1.2; margin-top: 8px; }
.metric-value .badge { vertical-align: middle; }
.metric-sub { color: var(--muted); font-size: 13px; margin-top: 2px; }

.stack { display: flex; height: 8px; gap: 3px; margin: 14px 0 6px; border-radius: 999px; overflow: hidden; }
.stack span { display: block; min-width: 4px; }
.bars { display: grid; gap: 18px; }
.bar-row { display: flex; align-items: center; gap: 14px; }
.bar-row .name { flex: 1; min-width: 0; }
.bar-row .name b { display: block; color: var(--title); font-weight: 500; }
.bar-row .name small { color: var(--muted); font-size: 13px; }
.bar-row .meter { width: 45%; display: flex; align-items: center; gap: 10px; }
.track { flex: 1; height: 8px; border-radius: 999px; background: var(--gray-bg); overflow: hidden; }
.track span { display: block; height: 100%; border-radius: 999px; }
.bar-row .pct { width: 40px; text-align: right; color: var(--title); font-weight: 500; font-size: 14px; }

/* Tableaux */
.table-wrap { overflow-x: auto; margin: 0 0 20px; border: 1px solid var(--border); border-radius: 12px; }
.card > .table-wrap { margin: 0; border: 0; border-top: 1px solid var(--border-soft); border-radius: 0 0 16px 16px; }
table { width: 100%; border-collapse: collapse; font-size: 14px; }
th, td { padding: 12px 16px; text-align: left; vertical-align: top; border-bottom: 1px solid var(--border-soft); }
th { color: var(--muted); font-size: 12px; font-weight: 500; white-space: nowrap; background: transparent; }
thead tr { border-bottom: 1px solid var(--border-soft); }
tbody tr:last-child td { border-bottom: 0; }
tbody tr:hover td { background: var(--bg); }
tr.changed td:first-child { box-shadow: inset 3px 0 0 var(--brand); }
td.id { font-family: var(--mono); color: var(--title); white-space: nowrap; font-size: 13px; }
.matrix td, .matrix th { text-align: center; vertical-align: middle; }
.matrix td:first-child, .matrix th:first-child { text-align: left; white-space: nowrap; }
.matrix .note { width: 28px; height: 28px; font-size: 13px; }
.targets td { vertical-align: middle; }
.t-cell { display: flex; align-items: center; gap: 12px; }
.t-cell b { color: var(--title); font-weight: 500; display: block; word-break: break-all; }
.t-cell small { color: var(--muted); font-size: 12px; }
.muted { color: var(--muted); }

.filters { display: flex; flex-wrap: wrap; gap: 6px; }
.chip { padding: 6px 12px; border-radius: 8px; border: 1px solid var(--border); background: var(--card); color: var(--text); font-size: 13px; font-weight: 500; cursor: pointer; }
.chip:hover { background: var(--hover); }
.chip.on { background: var(--brand-soft); border-color: transparent; color: var(--brand-text); }

/* Contenu des rapports */
.report { color: var(--text); }
.report > :first-child { margin-top: 0; }
.report h2 { font-size: 18px; margin: 32px 0 14px; padding-bottom: 10px; border-bottom: 1px solid var(--border-soft); }
.report h3 { font-size: 16px; margin: 24px 0 10px; color: var(--brand-text); }
.report h4 { font-size: 14px; margin: 20px 0 8px; }
.report ul { padding-left: 20px; margin: 0 0 1em; }
.report li { margin-bottom: 4px; }
.report li::marker { color: var(--brand-text); }
.report p a { word-break: break-all; }
pre { background: var(--code); border: 1px solid var(--border); border-radius: 12px; padding: 14px 16px; overflow-x: auto; font: 13px/1.55 var(--mono); color: var(--title); margin: 0 0 1em; }

/* Campagnes */
.timeline { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 12px; padding: 20px 24px 0; }
.tl-item { display: block; padding: 14px 16px; border-radius: 12px; border: 1px solid var(--border); color: var(--text); }
.tl-item:hover { text-decoration: none; border-color: #9CB9FF; }
.tl-item.active { border-color: var(--brand); background: var(--brand-soft); }
.tl-item b { display: block; color: var(--title); font-weight: 600; }
.tl-item small { color: var(--muted); font-size: 12px; }

/* Documents */
.docs { list-style: none; margin: 0; padding: 0; }
.docs li { display: flex; align-items: center; gap: 14px; padding: 14px 0; border-bottom: 1px solid var(--border-soft); }
.docs li:last-child { border-bottom: 0; padding-bottom: 0; }
.docs li:first-child { padding-top: 0; }
.file-icon { display: grid; place-items: center; width: 40px; height: 40px; border-radius: 10px; background: var(--error-bg); color: var(--error); font: 700 10px var(--mono); }
.docs .name { flex: 1; min-width: 0; }
.docs .name b { display: block; color: var(--title); font-weight: 500; word-break: break-all; }
.docs .name small { color: var(--muted); font-size: 12px; overflow-wrap: anywhere; }

/* Périmètre */
.profile { display: flex; flex-wrap: wrap; align-items: center; gap: 20px; padding: 24px; }
.profile .who { flex: 1; min-width: 220px; }
.profile h2 { font-size: 20px; margin: 0 0 6px; word-break: break-all; }
.facts { display: flex; flex-wrap: wrap; gap: 6px 14px; color: var(--muted); font-size: 14px; }
.facts .sep { width: 1px; background: var(--border); }
.facts b { color: var(--title); font-weight: 500; }
.hist { display: flex; flex-wrap: wrap; gap: 20px; }
.hist-item { text-align: center; color: var(--text); }
.hist-item:hover { text-decoration: none; }
.hist-item small { display: block; color: var(--muted); font-size: 12px; margin-top: 4px; }
.pager { display: flex; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-top: 24px; }
.footer { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 8px; padding: 0 24px 24px; color: var(--faint); font-size: 13px; max-width: 1536px; width: 100%; margin: 0 auto; }

/* ------------------------------------------------------------------ chargement du fichier */
.auth { display: flex; min-height: 100vh; background: var(--card); }
.auth-form { flex: 1; display: flex; flex-direction: column; padding: 24px; }
.auth-form .inner { width: 100%; max-width: 480px; margin: auto; padding: 32px 0; }
.auth-form h1 { font-size: 30px; margin-bottom: 8px; }
.auth-form .lead { color: var(--muted); margin-bottom: 28px; }
.dropzone { display: block; padding: 40px 24px; border: 1px dashed #D0D5DD; border-radius: 12px; background: var(--bg); text-align: center; cursor: pointer; transition: border-color .15s, background .15s; }
.dropzone:hover, .dropzone.drag { border-color: var(--brand); background: var(--brand-soft); }
.dropzone:focus-visible { outline: none; box-shadow: var(--focus); }
.dropzone .dz-icon { display: inline-grid; place-items: center; width: 68px; height: 68px; border-radius: 50%; background: var(--card); color: var(--title); margin-bottom: 18px; border: 1px solid var(--border); }
.dropzone h4 { font-size: 18px; margin-bottom: 6px; }
.dropzone p { color: var(--muted); font-size: 14px; margin: 0 0 6px; }
.dropzone u { color: var(--brand-text); font-weight: 500; }
.privacy { display: flex; gap: 12px; margin-top: 20px; padding: 14px 16px; border-radius: 12px; background: var(--success-bg); color: var(--success); font-size: 13px; }
.privacy b { display: block; }
.alert { display: flex; gap: 10px; margin-top: 16px; padding: 14px 16px; border-radius: 12px; border: 1px solid var(--error); background: var(--error-bg); color: var(--error); font-size: 14px; white-space: pre-wrap; word-break: break-word; }
.loading { margin-top: 16px; color: var(--muted); }
.auth-side { position: relative; flex: 1; display: grid; place-items: center; background: #161950; overflow: hidden; color: #fff; }
.auth-side::before { content: ""; position: absolute; inset: 0; background-image: linear-gradient(rgba(255, 255, 255, .06) 1px, transparent 1px), linear-gradient(90deg, rgba(255, 255, 255, .06) 1px, transparent 1px); background-size: 56px 56px; mask-image: radial-gradient(circle at 70% 20%, #000, transparent 70%); -webkit-mask-image: radial-gradient(circle at 70% 20%, #000, transparent 70%); }
.auth-side .inner { position: relative; text-align: center; max-width: 380px; padding: 24px; }
.auth-side img { width: 96px; margin-bottom: 20px; }
.auth-side b { display: block; font-size: 22px; letter-spacing: .18em; }
.auth-side p { color: #98A2B3; margin-top: 10px; }
.auth .top-actions { display: flex; justify-content: space-between; align-items: center; }

/* ------------------------------------------------------------------ responsive */
.app.collapsed { --sidebar-w: 90px; }
.app.collapsed .logo-text, .app.collapsed .nav-item .label, .app.collapsed .nav-item .count, .app.collapsed .nav-item .note,
.app.collapsed .nav-title span, .app.collapsed .side-box { display: none; }
.app.collapsed .nav-title { justify-content: center; }
.app.collapsed .nav-item, .app.collapsed .logo { justify-content: center; }

@media (max-width: 1279px) {
  .col-3 { grid-column: span 6; }
  .col-7, .col-6, .col-5 { grid-column: span 12; }
}
@media (max-width: 1023px) {
  .sidebar { transform: translateX(-100%); width: 290px; box-shadow: var(--shadow-lg); }
  .main, .app.collapsed .main { margin-left: 0; }
  .app.sidebar-open .sidebar { transform: none; }
  .app.sidebar-open .overlay { display: block; position: fixed; inset: 0; z-index: 35; background: rgba(16, 24, 40, .5); }
  .app.collapsed .logo-text, .app.collapsed .nav-item .label, .app.collapsed .nav-item .count, .app.collapsed .nav-item .note, .app.collapsed .side-box { display: revert; }
  .auth-side { display: none; }
}
@media (max-width: 767px) {
  .header { padding: 12px 16px; gap: 10px; }
  .search kbd { display: none; }
  .client-name { font-size: 14px; }
  .content { padding: 16px; }
  .grid { gap: 16px; }
  .col-3 { grid-column: span 12; }
  .card-pad, .metric, .profile { padding: 20px; }
  .card-head { padding: 16px 20px 0; }
  .card-body { padding: 16px 20px 20px; }
  .timeline { padding: 16px 20px 0; }
  .bar-row .meter { width: 50%; }
  .docs li { flex-wrap: wrap; }
  .docs .name { flex-basis: calc(100% - 54px); }
  .footer { padding: 0 16px 16px; }
}
/* ------------------------------------------------------------------ impression */
.print-only { display: none; }

@page {
  size: A4;
  margin: 16mm 14mm 18mm;
  @bottom-left { content: "Dipole Security — Confidentiel"; font: 8pt "Outfit", Arial, sans-serif; color: #667085; }
  @bottom-right { content: "Page " counter(page) " / " counter(pages); font: 8pt "Outfit", Arial, sans-serif; color: #667085; }
}

@media print {
  /* Toujours imprimer en clair, quel que soit le thème affiché */
  :root:root:root {
    --bg: #FFFFFF; --card: #FFFFFF; --border: #D0D5DD; --border-soft: #E4E7EC; --hover: #F2F4F7;
    --title: #101828; --text: #344054; --muted: #667085; --faint: #98A2B3; --code: #F9FAFB;
    --brand-soft: #ECF3FF; --brand-text: #3641F5;
    --success-bg: #ECFDF3; --success: #027A48; --warning-bg: #FFFAEB; --warning: #B54708;
    --orange-bg: #FFF6ED; --orange: #C4320A; --error-bg: #FEF3F2; --error: #B42318;
    --info-bg: #F0F9FF; --info: #026AA2; --gray-bg: #F2F4F7;
    color-scheme: light;
  }
  * { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
  body { background: #fff; font-size: 9.5pt; line-height: 1.5; }

  /* Impression générique d'une page du portail */
  .sidebar, .header, .overlay, .pager, .filters, .footer, .page-head .btn { display: none !important; }
  .main { margin: 0 !important; }
  .content { padding: 0; }
  .card { break-inside: avoid; }

  /* Synthèse de périmètre : seul le document dédié est imprimé */
  body.print-doc #app { display: none !important; }
  body.print-doc #print { display: block; }

  .pd-head { display: flex; justify-content: space-between; align-items: center; padding-bottom: 10px; border-bottom: 2px solid #465FFF; }
  .pd-brand { display: flex; align-items: center; gap: 10px; color: #101828; }
  .pd-brand .logo-mark { width: 34px; height: 34px; border-radius: 8px; }
  .pd-brand .logo-mark img { width: 24px; }
  .pd-brand b { display: block; font-size: 10pt; }
  .pd-brand small, .pd-conf small { display: block; color: #667085; font-size: 7.5pt; }
  .pd-conf { text-align: right; }
  .pd-conf b { color: #B42318; font-size: 8.5pt; }

  .pd-title { display: flex; justify-content: space-between; align-items: center; gap: 16px; margin: 18px 0 14px; }
  .pd-eyebrow { color: #465FFF; font-size: 8.5pt; font-weight: 600; }
  .pd-title h1 { font-size: 20pt; margin: 2px 0 0; word-break: break-all; }
  .pd-title p { margin: 0; color: #667085; }
  .pd-note { text-align: center; }
  .pd-note small { display: block; color: #667085; font-size: 8pt; margin-top: 4px; }
  .pd-note .note.big { width: 60px; height: 60px; font-size: 26pt; border-radius: 12px; }

  .pd-grid { display: grid; grid-template-columns: 1.4fr 1fr; gap: 14px; break-inside: avoid; }
  .pd-facts { border: 1px solid #E4E7EC; border-radius: 8px; border-collapse: separate; border-spacing: 0; font-size: 9pt; }
  .pd-facts th, .pd-facts td { padding: 5px 10px; border-bottom: 1px solid #E4E7EC; }
  .pd-facts tr:last-child th, .pd-facts tr:last-child td { border-bottom: 0; }
  .pd-facts th { width: 42%; color: #667085; font-size: 8.5pt; text-transform: none; white-space: normal; }
  .pd-facts td { color: #101828; font-weight: 500; }
  .pd-kpis { display: grid; grid-template-columns: repeat(2, 1fr); gap: 8px; align-content: start; }
  .pd-kpi { border: 1px solid #E4E7EC; border-radius: 8px; padding: 6px 10px; }
  .pd-kpi:first-child { grid-column: span 2; background: #ECF3FF; border-color: #C2D6FF; }
  .pd-kpi b { display: block; font-size: 15pt; color: #101828; line-height: 1.2; }
  .pd-kpi small { color: #667085; font-size: 8pt; }
  .pd-kpi.crit b, .pd-kpi.high b { color: #B42318; }
  .pd-kpi.med b { color: #B54708; }
  .pd-kpi.low b { color: #026AA2; }

  .pd-hist { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; margin-top: 12px; padding: 8px 10px; border: 1px solid #E4E7EC; border-radius: 8px; break-inside: avoid; }
  .pd-label { color: #667085; font-size: 8pt; font-weight: 600; margin-right: 4px; }
  .pd-hist-item { display: inline-flex; align-items: center; gap: 5px; }
  .pd-hist-item .note { width: 22px; height: 22px; font-size: 9pt; border-radius: 5px; }
  .pd-hist-item small { color: #667085; font-size: 8pt; }

  .pd-body { margin-top: 6px; }
  .report h2 { font-size: 13pt; margin: 20px 0 8px; padding-bottom: 4px; break-after: avoid; }
  .report h3 { font-size: 11pt; margin: 14px 0 6px; break-after: avoid; }
  .report h4 { font-size: 10pt; margin: 12px 0 6px; break-after: avoid; }
  .report p, .report li { orphans: 3; widows: 3; }
  .table-wrap { overflow: visible; border-radius: 6px; margin-bottom: 12px; }
  table { font-size: 8.5pt; }
  th, td { padding: 5px 8px; word-break: break-word; }
  th { background: #F2F4F7; color: #344054; white-space: normal; }
  thead { display: table-header-group; }
  tr { break-inside: avoid; }
  tbody tr:hover td { background: none; }
  .badge { font-size: 7.5pt; padding: 0 7px; line-height: 15px; }
  .note { width: 24px; height: 24px; font-size: 9pt; border-radius: 5px; }
  pre { white-space: pre-wrap; word-break: break-all; font-size: 7.5pt; padding: 8px 10px; break-inside: avoid; }
  a { color: inherit; }
  .pd-end { margin-top: 18px; padding-top: 8px; border-top: 1px solid #E4E7EC; color: #98A2B3; font-size: 7.5pt; text-align: center; }
}

/* Comparaison */
.cmp-pick-head { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: flex-start; gap: 12px; margin-bottom: 16px; }
.cmp-pick-head h3 { font-size: 18px; margin: 0; }
.cmp-pick-head p { margin: 2px 0 0; font-size: 14px; }
.picks { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 10px; }
.pick { display: flex; align-items: center; gap: 12px; padding: 12px 14px; border: 1px solid var(--border); border-radius: 12px; background: var(--card); text-align: left; cursor: pointer; }
.pick:hover { border-color: #9CB9FF; }
.pick:focus-visible { outline: none; box-shadow: var(--focus); }
.pick .box { display: grid; place-items: center; width: 20px; height: 20px; flex: none; border: 1px solid var(--border); border-radius: 6px; color: transparent; }
.pick b { display: block; color: var(--title); font-weight: 500; }
.pick small { display: block; color: var(--muted); font-size: 12px; overflow-wrap: anywhere; }
.pick.on { border-color: var(--brand); background: var(--brand-soft); }
.pick.on .box { background: var(--brand); border-color: var(--brand); color: #fff; }
.th-sub { display: block; font-size: 11px; color: var(--faint); font-weight: 400; }
.matrix .cnt { margin-left: 6px; color: var(--muted); font-size: 12px; }
.cmp-constats td:nth-child(3), .cmp-constats th:nth-child(3) { text-align: left; min-width: 260px; }
.stacks { display: grid; gap: 14px; margin-bottom: 18px; }
.stack-row { display: flex; align-items: center; gap: 12px; }
.stack-label { width: 140px; flex: none; color: var(--title); font-weight: 500; font-size: 14px; }
.stack-label small { display: block; color: var(--muted); font-weight: 400; font-size: 11px; overflow-wrap: anywhere; }
.stack.lg { flex: 1; height: 14px; margin: 0; border-radius: 4px; }
.legend { display: flex; flex-wrap: wrap; gap: 6px 16px; color: var(--muted); font-size: 13px; }
.legend i { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: 6px; vertical-align: -1px; }
.stack-total { width: 28px; text-align: right; color: var(--title); font-weight: 500; }
.empty-state { text-align: center; padding: 48px 24px; color: var(--muted); }
.empty-state svg { color: var(--brand-text); margin-bottom: 12px; }
.empty-state p { max-width: 480px; margin: 0 auto 20px; }
.page-head .crumbs { margin-top: 4px; }
