.container {
    max-width: 1200px;
    margin: 0 auto;
}

.project-header {
    border-radius: 12px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.06);
    padding: 24px;
    margin-bottom: 24px;
}

.flex-row {
    display: flex;
    flex-wrap: wrap;
    margin: 0 -12px;
}

.flex-item {
    padding: 0 12px;
}

.align-center {
    align-items: center;
}

.justify-end {
    justify-content: flex-end;
}

.metadata-item {
    margin-bottom: 12px;
    padding: 16px;
    border-radius: 8px;
    transition: all 0.3s ease;
    border: 1px solid #edf2f7;
    display: flex;
    align-items: center;
    cursor: pointer;
}

.metadata-item:hover {
    background-color: white;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.06);
    transform: translateY(-2px);
}

.description-container {
    max-height: 120px;
    overflow: hidden;
    position: relative;
    border-radius: 8px;
    padding: 16px;
    border: 1px solid #edf2f7;
}

.description-container.expanded {
    max-height: none;
}

.read-more-btn {
    position: absolute;
    bottom: 0;
    right: 0;
    padding-left: 30px;
    padding-right: 10px;
    cursor: pointer;
    border: none;
    font-weight: 500;
    font-size: 14px;
}

.icon-wrapper {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-right: 12px;
}

.budget-highlight {
    border-left: 3px solid #1abc9c;
}

.timeline-highlight {
    border-left: 3px solid #4fc6e1;
}


/* A4 portrait, marges confort */
@page {
    size: A4;
    margin: 16mm;
}

/* Écran: rien ne change. Impression: mise au propre */
@media print {
    /* Pleine largeur, pas d'arrondis/ombres inutiles */
    .container-fluid { max-width: none !important; padding: 0 !important; }
    .card, .shadow-sm, .rounded-4, .rounded-3 { box-shadow: none !important; border-radius: 0 !important; }
    .card-header, .card-body, .p-3, .mb-3, .mb-4, .g-3, .g-2 { break-inside: avoid; }

    /* Masquer l’UI non utile à l’impression */
    .navbar, .sidebar, .action-bar, .btn-print, .breadcrumb, .nav, .nav-pills,
    [data-bs-toggle="tooltip"], [data-bs-toggle="tab"] { display: none !important; }

    /* Forcer fond blanc et texte noir lisible */
    body, .card, .card-header, .card-body { background: #fff !important; color: #000 !important; }

    /* Graphiques, cartes, listes: éviter coupures mal placées */
    canvas, .list-group, #sn-map, .stakeholder-card, .metadata-item { break-inside: avoid; }

    /* Tableaux et progress bar: lignes fines à l’impression */
    .progress { background: #e9ecef !important; }
    .progress-bar { -webkit-print-color-adjust: exact; print-color-adjust: exact; }

    /* En-têtes de section plus compacts */
    h5, h6 { margin: 0 0 6px 0 !important; }
    .small, .text-muted { color: #333 !important; }

    /* Gestion des sauts de page optionnels */
    .page-break { page-break-before: always; }
    .page-avoid { page-break-inside: avoid; }
}

/* Utilitaire écran pour zone de contenu centrée A4-like (optionnel) */
@media screen {
    .a4-page {
        max-width: 980px; /* proche A4 à 96dpi */
        margin: 0 auto;
    }
}

/* 2 colonnes stables en print */
.print-two-cols { display: block !important; }
.print-two-cols > .row { display: block !important; }
.print-two-cols [class*="col-"] {
    display: inline-block !important;
    vertical-align: top !important;
    width: 48% !important;      /* deux colonnes */
    max-width: 48% !important;
    margin-right: 2% !important; /* gouttière */
    margin-bottom: 8mm !important;
    float: none !important;
    flex: none !important;
    break-inside: avoid;
}
.print-two-cols [class*="col-"]:nth-child(2n) { margin-right: 0 !important; }

/* --- A4 layout (screen + print) --- */
:root {
    --gap: 10px;
    --fg-muted: #6c757d;
    --fg-strong: #323a46;
}
@page { size: A4; margin: 12mm; }
@media print {
    .no-print { display: none !important; }
    .sheet-A4 { box-shadow: none !important; }
    /* Print only the A4 sheet */
    body * { visibility: hidden !important; }
    .sheet-A4, .sheet-A4 * { visibility: visible !important; }
    /* Optional: explicitly hide common chrome */
    nav, aside, header, footer, .sidebar, .breadcrumb, .action-bar { display: none !important; }
}
.sheet-A4 {
    width: 210mm;
    /* Removed min-height to allow multi-page flow */
    margin: 0 auto; background: #fff;
    box-shadow: 0 2px 8px rgba(0,0,0,.06);
    padding: 12mm; border-radius: 8px;
}
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.grid-3 { display: grid; grid-template-columns: repeat(3,1fr); gap: 8px; }
.kpi-box { border:1px solid #e9ecef; border-radius: 8px; padding: 8px 10px; display:flex; align-items:center; gap:8px; }
.kpi-box .icon { padding:6px; background:#f5f7fb; color:#4a81d4;}
.kpi-box .label { font-size:11px; color: var(--fg-muted); }
.kpi-box .value { font-weight:600; color: var(--fg-strong); }
.section { margin-top: 10px; }
.section > .section-title { font-size: 12px; font-weight: bolder; letter-spacing:.4px; text-transform:uppercase; color: var(--fg-muted); margin-bottom:6px; display:flex; align-items:center; gap:6px; }
.hr { height:1px; background:#eef0f4; margin:6px 0 8px; }
.progress.slim { height:8px; }
.list-v { margin:0; padding:0; list-style:none; display:grid; gap:6px; }
.list-v li { display:flex; gap:8px; }
.list-v li i { color:#10b981; }
.desc { font-size: 12px; color: #4f5b66; }
.truncate-8 { display:-webkit-box; -webkit-line-clamp:8; -webkit-box-orient:vertical; overflow:hidden; }
.tiny { font-size: 11px; color: var(--fg-muted); }
.badge-chip { border:1px solid #e9ecef; background:#f8f9fb; }
.card-soft { border:1px solid #eef0f4; border-radius: 10px; }
.doc-row { display:flex; align-items:center; gap:8px; border:1px solid #eef0f4; border-radius:8px; padding:6px 8px; }
.doc-row .name { flex:1; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
.stake-grid { display:grid; grid-template-columns: repeat(2,1fr); gap:8px; }
.avoid-break { break-inside: avoid; }
.mini { font-size: 12px; }
.actions-stick { position: sticky; bottom: 0; background: #fff; padding-top: 8px; }
.page-break { break-after: page; }
/* --- Table-driven layout for readability --- */
.part-title { font-size: 14px; font-weight: 700; text-transform: uppercase; letter-spacing: .5px; margin: 8px 0 6px; color:#323a46; display:flex; align-items:center; gap:8px; }
.part-title .num { display:inline-flex; width:22px; height:22px; border-radius:50%; align-items:center; justify-content:center; font-size:12px; background:#e9f0ff; color:#3366cc; }
.table-simple { width:100%; border-collapse: collapse; }
.table-simple th, .table-simple td { border:1px solid #e9ecef; padding:6px 8px; font-size:12px; vertical-align: top; }
.table-simple th { background:#f7f9fc; text-align:left; color:#495057; font-weight:600; }
.table-simple tr:nth-child(even) td { background:#fcfdff; }
.table-compact td, .table-compact th { padding:5px 6px; font-size:11.5px; }
.caption-mini { font-size:11px; color:#6c757d; margin:4px 0 6px; }
/* Tone down card visuals when present */
.card-soft { border-color:#f1f3f5; background:#fff; }
/* Hide heavy grids in this view */
.grid-2, .grid-3 { display:block; }
/* Floating print button */
.print-btn {
    position: fixed;
    bottom: 25px;
    right: 25px;
    z-index: 1050;
    background-color: #4a81d4;
    color: white;
    border: none;
    border-radius: 50%;
    width: 50px;
    height: 50px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    box-shadow: 0 3px 10px rgba(0,0,0,0.2);
    cursor: pointer;
    transition: all 0.2s ease-in-out;
}
.print-btn:hover {
    background-color: #2d5ca4;
    transform: scale(1.05);
}
@media print {
    .print-btn { display: none !important; }
}