/************************************
	Rapport projet imprimable (-> PDF via l'impression navigateur).
	Largeur de colonne fixe = largeur utile d'une page A4, pour que
	l'apercu ecran corresponde exactement au rendu imprime.
************************************/

:root {
    --r-ink: #1e293b;
    --r-muted: #64748b;
    --r-line: #e2e8f0;
    --r-line-strong: #cbd5e1;
    --r-primary: #2563eb;
    --r-ok: #16a34a;
    --r-warn: #d97706;
    --r-bad: #dc2626;
    --r-bg-soft: #f8fafc;
    --r-page: 760px;
}

* { box-sizing: border-box; }

body.report-body {
    margin: 0;
    background: #eef2f7;
    color: var(--r-ink);
    font-family: Inter, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    font-size: 13px;
    line-height: 1.5;
    -webkit-print-color-adjust: exact;
    print-color-adjust: exact;
}

.report {
    max-width: var(--r-page);
    margin: 0 auto;
    padding: 28px 0 80px;
}

/* ---- Barre d'actions (jamais imprimee) ---- */
.report-toolbar {
    position: sticky;
    top: 0;
    z-index: 10;
    max-width: var(--r-page);
    margin: 0 auto 18px;
    display: flex;
    gap: 10px;
    align-items: center;
    padding: 10px 0;
}
.report-toolbar .grow { flex: 1; }
.r-btn {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    border: 1px solid var(--r-line-strong);
    background: #fff;
    color: var(--r-ink);
    border-radius: 8px;
    padding: 8px 14px;
    font: inherit;
    font-weight: 600;
    text-decoration: none;
    cursor: pointer;
    box-shadow: 0 1px 2px rgba(15, 23, 42, .06);
}
.r-btn--primary { background: var(--r-primary); border-color: var(--r-primary); color: #fff; }
.r-btn:hover { filter: brightness(.97); }

/* ---- Surface « feuille » ---- */
.report-sheet {
    background: #fff;
    border-radius: 10px;
    box-shadow: 0 6px 24px rgba(15, 23, 42, .08);
    padding: 40px 46px;
}

/* ---- Page de garde ---- */
.report-cover { padding: 40px 0 26px; border-bottom: 3px solid var(--r-ink); margin-bottom: 8px; }
.report-cover .kicker {
    text-transform: uppercase; letter-spacing: .14em; font-size: 11px;
    font-weight: 700; color: var(--r-primary); margin: 0 0 12px;
}
.report-cover h1 { font-size: 32px; font-weight: 800; margin: 0 0 10px; line-height: 1.15; }
.report-cover .desc { font-size: 14px; color: var(--r-muted); margin: 0 0 22px; max-width: 90%; }
.report-cover .meta { display: flex; gap: 26px; flex-wrap: wrap; font-size: 12px; color: var(--r-muted); }
.report-cover .meta b { color: var(--r-ink); font-weight: 600; }

/* ---- Sections ---- */
.report-section { margin-top: 30px; }
.report-section > h2 {
    font-size: 18px; font-weight: 750; margin: 0 0 4px;
    display: flex; align-items: center; gap: 9px;
}
.report-section > h2 .fa { color: var(--r-primary); font-size: 16px; }
.report-section .lead { color: var(--r-muted); margin: 0 0 14px; font-size: 12.5px; }
.report-subhead {
    font-size: 14px; font-weight: 700; margin: 22px 0 8px;
    padding-bottom: 5px; border-bottom: 1px solid var(--r-line);
}
.report-subhead .tag { color: var(--r-muted); font-weight: 500; font-size: 12px; }
.report-muted { color: var(--r-muted); font-style: italic; }

/* ---- KPI ---- */
.kpi-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; margin-top: 6px; }
.kpi {
    border: 1px solid var(--r-line); border-radius: 9px; padding: 14px 16px; background: var(--r-bg-soft);
}
.kpi .v { font-size: 24px; font-weight: 800; line-height: 1; }
.kpi .l { font-size: 11.5px; color: var(--r-muted); margin-top: 6px; text-transform: uppercase; letter-spacing: .04em; }
.kpi.is-ok .v { color: var(--r-ok); }
.kpi.is-warn .v { color: var(--r-warn); }
.kpi.is-bad .v { color: var(--r-bad); }

/* ---- Tables ---- */
.r-table { width: 100%; border-collapse: collapse; margin-top: 6px; font-size: 12px; }
.r-table th {
    text-align: left; background: var(--r-bg-soft); color: var(--r-muted);
    font-weight: 600; text-transform: uppercase; letter-spacing: .03em; font-size: 10.5px;
    padding: 7px 9px; border-bottom: 1.5px solid var(--r-line-strong);
}
.r-table td { padding: 7px 9px; border-bottom: 1px solid var(--r-line); vertical-align: top; }
.r-table tr:nth-child(even) td { background: #fcfdfe; }
.r-table .rid { font-family: "JetBrains Mono", ui-monospace, monospace; font-size: 11px; white-space: nowrap; color: var(--r-primary); font-weight: 600; }
.r-table .num { text-align: center; white-space: nowrap; }

/* Pastilles de statut */
.pill {
    display: inline-block; padding: 1px 8px; border-radius: 999px;
    font-size: 10.5px; font-weight: 600; white-space: nowrap;
    background: #eef2f7; color: #475569;
}
.pill.ok { background: #dcfce7; color: #166534; }
.pill.warn { background: #fef3c7; color: #92400e; }
.pill.bad { background: #fee2e2; color: #991b1b; }
.pill.info { background: #dbeafe; color: #1e40af; }

/* ---- Liste des « problemes » ---- */
.problems { list-style: none; margin: 6px 0 0; padding: 0; }
.problems li {
    display: flex; align-items: flex-start; gap: 9px;
    padding: 8px 12px; border: 1px solid var(--r-line); border-radius: 8px; margin-bottom: 7px;
    font-size: 12.5px;
}
.problems li .fa { margin-top: 2px; }
.problems li.ok   { background: #f0fdf4; border-color: #bbf7d0; }
.problems li.ok   .fa { color: var(--r-ok); }
.problems li.warn { background: #fffbeb; border-color: #fde68a; }
.problems li.warn .fa { color: var(--r-warn); }
.problems li.bad  { background: #fef2f2; border-color: #fecaca; }
.problems li.bad  .fa { color: var(--r-bad); }

/* ---- Matrice ---- */
.matrix-tests { margin: 0; padding-left: 16px; }
.matrix-tests li { margin: 2px 0; }
.cov-yes { color: var(--r-ok); font-weight: 700; }
.cov-no  { color: var(--r-bad); font-weight: 700; }

/* ---- Diagrammes ---- */
.diagram-block { margin-bottom: 22px; }
.diagram-frame {
    border: 1px solid var(--r-line); border-radius: 9px; background:
        linear-gradient(#f1f5f9 1px, transparent 1px) 0 0 / 100% 22px,
        linear-gradient(90deg, #f1f5f9 1px, transparent 1px) 0 0 / 22px 100%,
        #fbfdff;
    overflow: hidden;
    min-height: 70px;
    display: flex;
    justify-content: center;
    align-items: center;
}
.diagram-frame .joint-paper { margin: 0 auto; }

/* ============ IMPRESSION ============ */
@media print {
    @page { size: A4; margin: 14mm 12mm; }
    body.report-body { background: #fff; font-size: 11.5px; }
    .report { max-width: none; padding: 0; }
    .no-print { display: none !important; }
    .report-sheet { box-shadow: none; border-radius: 0; padding: 0; }
    .report-cover { padding-top: 0; }

    /* Sauts de page entre grands chapitres ; on evite de couper tables/diagrammes */
    .page-break { break-before: page; }
    .report-section { break-inside: auto; }
    .report-subhead { break-after: avoid; }
    .r-table { break-inside: auto; }
    .r-table tr { break-inside: avoid; }
    .diagram-block, .kpi, .problems li { break-inside: avoid; }
    .kpi-grid { gap: 8px; }
}
