/* ================================================================ */
/* PBC-Fiches — feuille de style unique                           */
/* (fusion de utils/style.css + styles inline index/fiche/form)    */
/* ================================================================ */

:root {
    --pbc-blue: #315c7d;
    --pbc-blue-dark: #23445f;
    --pbc-blue-light: #eaf1f6;
    --page-bg: #f5f6f8;
    --card-bg: #ffffff;
    --border: #dce2e7;
    --text: #263238;
    --muted: #6c757d;
}

html,
body {
    width: 100%;
    max-width: 100%;
    overflow-x: hidden;
}

body {
    padding: 25px 0 75px;
    background-color: var(--page-bg)!important;
    color: var(--text);
}

h1,h2,h3,h4,h5 {
    color: #df5819!important;
}

a {
    color: #df5819!important;
}

*,
*::before,
*::after {
    box-sizing: border-box;
}

/* ================================================================ */
/* HEADER                                                           */
/* ================================================================ */

.pbc-header {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    padding: 8px 12px;
    box-sizing: border-box;
}

.pbc-header-left,
.pbc-header-center,
.pbc-header-right {
    flex: 1 1 0;
    min-width: 0;
    display: flex;
    align-items: center;
}

.pbc-header-left { justify-content: flex-start; }
.pbc-header-center { justify-content: center; }
.pbc-header-right { justify-content: flex-end; }

.pbc-header img {
    display: block;
    max-width: 100%;
    width: auto;
    height: auto;
    object-fit: contain;
}

.pbc-header-left img,
.pbc-header-center img { max-height: 90px; }
.pbc-header-right img { max-height: 105px; }

/* ================================================================ */
/* LISTE DES FICHES (home)                                          */
/* ================================================================ */

.page-container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 20px 15px;
}

.filter-card {
    border: 1px solid #dde2e6;
    border-radius: 8px;
}

.filter-card .card-header {
    background: #eef2f5;
    font-weight: 600;
}

.filter-group {
    border: 1px solid #eef1f4;
    border-radius: 8px;
    padding: 12px 14px 4px;
    background: #fafbfc;
}

.filter-group-label {
    font-size: 0.72rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: #6c757d;
    margin-bottom: 10px;
}

.filter-group select[disabled],
.filter-group .sort-select[disabled] {
    background-color: #e9ecef;
    opacity: 0.85;
}

.table-container {
    overflow-x: auto;
}

.table td,
.table th {
    vertical-align: middle;
}

.pagination-info {
    font-size: 0.9rem;
    color: #6c757d;
}

.pagination {
    margin-bottom: 0;
    flex-wrap: wrap;
}

.page-link {
    cursor: pointer;
}

.pagination-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 15px;
    flex-wrap: wrap;
    padding: 12px 0;
}

/* ================================================================ */
/* LISTING : LAYOUT 2 COLONNES (sidebar sticky)                     */
/* ================================================================ */

.listing-layout {
    align-items: flex-start;
}

.listing-sidebar {
    position: sticky;
    top: 20px;
}

.listing-sidebar .form-control {
    font-size: 0.85rem;
}

.listing-sidebar .filter-group-label {
    margin-bottom: 6px;
}

@media (max-width: 991.98px) {
    .listing-sidebar {
        position: static;
    }
}

/* ================================================================ */
/* FICHE (affichage)                                                */
/* ================================================================ */

.fiche-container {
    max-width: 1120px;
    margin: 0 auto;
    padding: 18px 15px 35px;
}

.fiche-hero {
    background: linear-gradient(135deg, var(--pbc-blue-dark), var(--pbc-blue));
    color: white;
    border-radius: 10px;
    padding: 18px 20px;
    margin-bottom: 14px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 15px;
}

.fiche-title-zone { min-width: 0; }

.fiche-id {
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    opacity: 0.75;
    margin-bottom: 2px;
}

.fiche-hero h1 {
    color: #fff!important;
    font-size: 1.55rem;
    margin: 0;
    font-weight: 600;
    overflow-wrap: anywhere;
}

.fiche-subtitle {
    margin-top: 4px;
    font-size: 0.88rem;
    opacity: 0.85;
}

.fiche-actions {
    display: flex;
    flex-shrink: 0;
    gap: 8px;
}

.action-button {
    width: 40px;
    height: 40px;
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.14);
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    transition: background 0.15s ease, transform 0.15s ease;
}

.action-button:hover {
    background: rgba(255, 255, 255, 0.25);
    transform: translateY(-1px);
}

.action-button img {
    max-width: 23px;
    max-height: 23px;
}

.pdf-type {
    position: absolute;
    right: -4px;
    bottom: -4px;
    min-width: 17px;
    height: 17px;
    padding: 0 4px;
    border-radius: 9px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.61rem;
    font-weight: 700;
    line-height: 1;
    color: white;
    border: 2px solid var(--pbc-blue-dark);
}

.pdf-recensement .pdf-type { background: #2878ad; }
.pdf-evacuation .pdf-type { background: #c53b3b; }

/* Variante listing : boutons d'action sur fond clair du tableau */
.table .action-button {
    display: inline-flex;
    background: #eef3f8;
    border: 1px solid #d8e0ea;
}

.table .action-button:hover {
    background: #dce7f1;
}

.table .action-button + .action-button {
    margin-left: 6px;
}

.fiche-card {
    background: var(--card-bg);
    border: 1px solid var(--border);
    border-radius: 9px;
    margin-bottom: 12px;
    overflow: hidden;
    box-shadow: 0 1px 3px rgba(0,0,0,0.035);
}

.section-header {
    min-height: 38px;
    display: flex;
    align-items: center;
    padding: 7px 13px;
    background: var(--pbc-blue-light);
    border-bottom: 1px solid var(--border);
    color: var(--pbc-blue-dark);
    font-size: 0.94rem;
    font-weight: 600;
}

.section-body {
    padding: 12px 14px;
}

.info-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 8px;
}

.info-box {
    background: #f8f9fa;
    border: 1px solid #e5e8eb;
    border-radius: 6px;
    padding: 7px 9px;
    min-width: 0;
}

.info-box.wide { grid-column: span 2; }

.info-label {
    display: block;
    color: var(--muted);
    font-size: 0.72rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.025em;
    margin-bottom: 2px;
}

.info-value {
    font-size: 0.9rem;
    font-weight: 500;
    overflow-wrap: anywhere;
}

.pbc-badge {
    display: inline-block;
    border-radius: 4px;
    padding: 3px 7px;
    font-size: 0.8rem;
    font-weight: 600;
    line-height: 1.25;
}

.importance-a { background: #f8d7da; color: #842029; }
.importance-b { background: #fff3cd; color: #664d03; }
.importance-c { background: #cff4fc; color: #055160; }
.priority-badge { background: #e2e3e5; color: #41464b; }
.type-badge { background: #dbeafe; color: #1e4f7a; }
.yes-badge { background: #d1e7dd; color: #0f5132; }
.no-badge { background: #e9ecef; color: #6c757d; }

.description-short {
    font-size: 1rem;
    font-weight: 600;
    color: var(--pbc-blue-dark);
    margin-bottom: 8px;
}

.text-block {
    margin-bottom: 10px;
    font-size: 0.91rem;
    line-height: 1.48;
    overflow-wrap: anywhere;
}

.text-block:last-child { margin-bottom: 0; }

.text-block-label {
    font-size: 0.77rem;
    font-weight: 600;
    color: var(--muted);
    text-transform: uppercase;
    display: block;
    margin-bottom: 3px;
}

.image-panel {
    background: #f1f3f5;
    border: 1px solid #e0e4e7;
    border-radius: 7px;
    margin-top: 12px;
    padding: 10px;
    display: flex;
    justify-content: center;
    align-items: center;
    width: 100%;
}

.fiche-image {
    display: block;
    max-width: 100%;
    max-height: 440px;
    width: auto;
    height: auto;
    object-fit: contain;
    margin: 0 auto;
    border-radius: 5px;
}

.image-caption {
    font-size: 0.76rem;
    color: var(--muted);
    margin-top: 5px;
    text-align: center;
}

.two-columns {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    gap: 12px;
}

.mini-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 7px;
}

.danger-grid {
    display: flex;
    justify-content: center;
    flex-wrap: wrap;
    gap: 8px;
}

.danger-box {
    width: 105px;
    padding: 8px 5px;
    border: 1px solid #e1e4e7;
    border-radius: 7px;
    background: #fafafa;
    text-align: center;
}

.danger-box img {
    display: block;
    max-width: 44px;
    max-height: 44px;
    width: auto;
    height: auto;
    margin: 4px auto 0;
}

.danger-name {
    font-size: 0.78rem;
    font-weight: 600;
}

.empty-message {
    color: var(--muted);
    font-size: 0.9rem;
    text-align: center;
    padding: 5px;
}

.measure-banner {
    border-left: 4px solid var(--pbc-blue);
    background: #f6f9fb;
    padding: 7px 10px;
    margin-bottom: 10px;
    border-radius: 0 5px 5px 0;
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--pbc-blue-dark);
}

.measure-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
}

.measure-box {
    background: #fafbfc;
    border: 1px solid #e5e8eb;
    border-radius: 6px;
    padding: 8px 10px;
    font-size: 0.89rem;
    overflow-wrap: anywhere;
}

.measure-box.full { grid-column: 1 / -1; }

.measure-label {
    display: block;
    color: var(--muted);
    font-size: 0.72rem;
    font-weight: 600;
    text-transform: uppercase;
    margin-bottom: 3px;
}

.tracking {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
    font-size: 0.84rem;
}

.bottom-actions {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 5px;
}

/* ================================================================ */
/* FORMULAIRE (création / édition)                                  */
/* ================================================================ */

.form-page {
    width: 100%;
    max-width: 1180px;
    margin: 0 auto;
    padding: 18px 15px 25px;
}

.page-hero {
    background: linear-gradient(135deg, var(--pbc-blue-dark), var(--pbc-blue));
    color: white;
    padding: 20px 22px;
    border-radius: 10px;
    margin-bottom: 16px;
}

.page-hero h1 {
    color: #fff!important;
    margin: 0;
    font-size: 1.7rem;
    font-weight: 600;
}

.page-hero p {
    margin: 5px 0 0;
    font-size: 0.9rem;
    opacity: 0.85;
}

.contexte-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    flex-wrap: wrap;
    padding: 12px 16px;
    margin-bottom: 16px;
    background: var(--pbc-blue-light);
    border: 1px solid var(--border);
    border-left: 4px solid var(--pbc-blue);
    border-radius: 6px;
}

.contexte-bar-info strong {
    display: block;
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.4px;
    color: var(--muted);
    margin-bottom: 2px;
}

.contexte-bar-info span {
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--text);
}

.contexte-bar-reset {
    margin: 0;
}

.contexte-image-note {
    display: block;
    margin-top: 6px;
    font-size: 0.8rem;
    color: var(--muted);
    word-break: break-all;
}

.form-section {
    background: white;
    border: 1px solid var(--border);
    border-radius: 9px;
    margin-bottom: 16px;
    overflow: hidden;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.05);
}

.form-section .section-header {
    display: block;
    background: var(--pbc-blue-light);
    color: var(--pbc-blue-dark);
    border-bottom: 1px solid var(--border);
    padding: 11px 14px;
    min-height: auto;
}

.form-section .section-header h2 {
    color: var(--pbc-blue-dark)!important;
    margin: 0;
    font-size: 1rem;
    font-weight: 600;
}

.form-section .section-header small {
    display: block;
    margin-top: 3px;
    color: var(--muted);
    font-size: 0.78rem;
}

.form-section .section-body {
    padding: 18px;
}

.section-body .row {
    margin-left: -7px;
    margin-right: -7px;
}

.section-body .row > [class*="col-"] {
    padding-left: 7px;
    padding-right: 7px;
}

label {
    margin-bottom: 5px;
    color: #39434b;
    font-size: 0.86rem;
    font-weight: 600;
}

.required {
    color: #b02a37;
}

.form-group {
    margin-bottom: 18px;
}

.form-control {
    border: 1px solid #ced4da;
    border-radius: 5px;
    min-height: 38px;
}

.form-control:focus {
    border-color: #7397b3;
    box-shadow: 0 0 0 0.15rem rgba(49, 92, 125, 0.15);
}

textarea.form-control {
    min-height: auto;
    resize: vertical;
}

.field-help {
    display: block;
    margin-top: 4px;
    color: var(--muted);
    font-size: 0.75rem;
}

/* ---- Bouton d'aide (i) et popover d'information ---- */

.field-help-btn {
    position: relative;
    display: inline-block;
    width: 16px;
    height: 16px;
    margin-left: 5px;
    vertical-align: 1px;
    border-radius: 50%;
    background: #7397b3;
    color: #fff;
    font-size: 0.65rem;
    font-weight: 700;
    line-height: 16px;
    text-align: center;
    cursor: help;
    user-select: none;
    white-space: normal;
}

.field-help-glyph {
    font-style: normal;
    pointer-events: none;
}

.field-help-pop {
    display: block;
    visibility: hidden;
    opacity: 0;
    position: fixed;
    top: var(--pop-top, 0);
    left: var(--pop-left, 0);
    transform: translateX(-50%);
    width: 260px;
    max-width: 90vw;
    padding: 9px 11px;
    background: #fff;
    color: #2b353d;
    border: 1px solid #d5dde3;
    border-radius: 6px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.14);
    font-size: 0.76rem;
    font-weight: 400;
    line-height: 1.42;
    text-align: left;
    z-index: 1060;
    transition: opacity 0.12s ease, visibility 0.12s ease;
    pointer-events: none;
}

.field-help-btn.open .field-help-pop {
    visibility: visible;
    opacity: 1;
    pointer-events: auto;
}

.field-help-info {
    display: block;
    margin-bottom: 4px;
}

.field-help-exemples {
    display: block;
    color: #5b6b78;
    font-size: 0.73rem;
}

.form-check-label .field-help-btn,
.validation-choice label .field-help-btn,
.measure-choice label .field-help-btn {
    vertical-align: 1px;
}

.inventory-box {
    background: #f8f9fa;
    border: 1px solid #e4e7ea;
    border-radius: 7px;
    padding: 12px;
    margin-top: 2px;
    margin-bottom: 18px;
}

.inventory-box .form-check { margin-bottom: 12px; }
.inventory-box .form-group { margin-bottom: 0; }

.upload-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 14px;
}

.upload-box {
    min-width: 0;
    padding: 14px;
    background: #fafbfc;
    border: 1px dashed #9daab3;
    border-radius: 8px;
}

.upload-box.primary {
    background: #f4f8fb;
    border-color: #7397b3;
}

.upload-title {
    margin-bottom: 4px;
    color: var(--pbc-blue-dark);
    font-size: 0.9rem;
    font-weight: 600;
}

.upload-description {
    margin-bottom: 10px;
    color: var(--muted);
    font-size: 0.76rem;
    line-height: 1.4;
}

.image-preview {
    display: none;
    width: auto;
    height: auto;
    max-width: 100%;
    max-height: 250px;
    margin: 12px auto 0;
    object-fit: contain;
    border-radius: 6px;
}

.danger-choice-grid,
.danger-grid {
    display: grid;
    grid-template-columns: repeat(5, minmax(0, 1fr));
    gap: 10px;
}

.danger-choice {
    position: relative;
}

.danger-choice input {
    position: absolute;
    opacity: 0;
    pointer-events: none;
}

.danger-choice label {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 7px;
    min-height: 100px;
    margin: 0;
    padding: 10px 6px;
    background: #fafafa;
    border: 1px solid #d9dee2;
    border-radius: 8px;
    cursor: pointer;
    text-align: center;
    font-size: 0.8rem;
    transition: background 0.15s, border 0.15s, transform 0.15s, box-shadow 0.15s;
}

.danger-picto {
    display: block;
    width: 42px;
    height: 42px;
    margin: 0 auto;
    object-fit: contain;
}

.danger-choice input:checked + label {
    background: #fff3cd;
    border-color: #d8a72e;
    color: #664d03;
    font-weight: 600;
    box-shadow: 0 0 0 2px rgba(216, 167, 46, 0.12);
}

.danger-choice label:hover {
    border-color: #adb5bd;
    box-shadow: 0 3px 8px rgba(0, 0, 0, 0.12);
}

.measure-choice-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
    margin-bottom: 14px;
}

.measure-choice {
    position: relative;
}

.measure-choice input {
    position: absolute;
    opacity: 0;
    pointer-events: none;
}

.measure-choice label {
    display: block;
    height: 100%;
    margin: 0;
    padding: 13px 14px;
    background: #fafafa;
    border: 2px solid #dce1e5;
    border-radius: 8px;
    cursor: pointer;
    transition: border-color 0.15s, background 0.15s;
}

.measure-choice strong {
    display: block;
    margin-bottom: 3px;
    color: var(--pbc-blue-dark);
    font-size: 0.95rem;
}

.measure-choice span {
    display: block;
    color: var(--muted);
    font-size: 0.76rem;
}

.measure-choice input:checked + label {
    background: var(--pbc-blue-light);
    border-color: var(--pbc-blue);
}

.conditional-block {
    display: none;
    margin-top: 16px;
    padding-top: 16px;
    border-top: 1px solid var(--border);
}

.conditional-title {
    margin-bottom: 14px;
    color: var(--pbc-blue-dark);
    font-size: 1rem;
    font-weight: 600;
}

.form-actions {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    margin-top: 18px;
}

.submit-button {
    min-width: 180px;
    font-weight: 600;
}

/* --- Validation (édition admin) --- */

.validation-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
}

.validation-choice {
    position: relative;
}

.validation-choice input {
    position: absolute;
    opacity: 0;
    pointer-events: none;
}

.validation-choice label {
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: 4px;
    min-height: 78px;
    margin: 0;
    padding: 12px 16px;
    background: #fafafa;
    border: 1px solid #d9dee2;
    border-radius: 8px;
    cursor: pointer;
    font-weight: 600;
    transition: background 0.15s, border 0.15s, transform 0.15s, box-shadow 0.15s;
}

.validation-hint {
    display: block;
    font-weight: 400;
    font-size: 0.78rem;
    color: var(--muted);
}

.validation-choice input:checked + label {
    background: #d4edda;
    border-color: #28a745;
    color: #155724;
    box-shadow: 0 0 0 2px rgba(40, 167, 69, 0.12);
}

.validation-choice label:hover {
    border-color: #adb5bd;
    box-shadow: 0 3px 8px rgba(0, 0, 0, 0.12);
}

.val-status {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.val-row {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    white-space: nowrap;
}

.val-chip {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    flex: 0 0 auto;
}

.val-row.is-valid .val-chip {
    background: #e6f4ea;
    border: 1px solid #28a745;
}

.val-row.is-invalid .val-chip {
    background: #fde8e8;
    border: 1px solid #dc3545;
}

.val-chip svg {
    width: 10px;
    height: 10px;
    vertical-align: middle;
    stroke-width: 2.5;
    fill: none;
}

.val-row.is-valid .val-chip svg { stroke: #28a745; }
.val-row.is-invalid .val-chip svg { stroke: #dc3545; }

.val-name {
    font-size: 0.74rem;
    font-weight: 600;
    line-height: 1.2;
}

.val-row.is-valid .val-name { color: #1e7e34; }
.val-row.is-invalid .val-name { color: #b02a37; }

#fichesTable td.cell-validation.cell-both {
    background: #f0faf3 !important;
}

#fichesTable tr:hover td.cell-validation.cell-both {
    background: #e0f6e6 !important;
}

#fichesTable td.cell-validation.cell-partial {
    background: #fffbe6 !important;
}

#fichesTable tr:hover td.cell-validation.cell-partial {
    background: #fff6cd !important;
}

/* ================================================================ */
/* AUTH / ERREURS                                                    */
/* ================================================================ */

.auth-page {
    max-width: 400px;
    margin: 40px auto;
    padding: 0 15px;
}

.auth-card {
    background: white;
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 28px;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.05);
}

.auth-logo {
    text-align: center;
    margin-bottom: 20px;
}

.auth-logo img {
    max-height: 80px;
}

.error-page {
    max-width: 560px;
    margin: 60px auto;
    padding: 0 15px;
    text-align: center;
}

.error-page .display-4 {
    font-weight: 700;
}

/* ================================================================ */
/* RESPONSIVE                                                        */
/* ================================================================ */

@media (max-width: 991px) {
    .info-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .danger-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}

@media (max-width: 576px) {
    body { padding: 0; }

    .pbc-header {
        gap: 5px;
        padding: 6px;
    }

    .pbc-header-left img,
    .pbc-header-center img { max-height: 48px; }
    .pbc-header-right img { max-height: 56px; }

    .container,
    .container-fluid {
        width: 100%;
        max-width: 100%;
        margin-left: auto;
        margin-right: auto;
        padding-left: 10px !important;
        padding-right: 10px !important;
    }

    .page-container,
    .fiche-container,
    .form-page {
        width: 100%;
        max-width: 100%;
        margin-left: auto;
        margin-right: auto;
        padding: 10px 8px;
    }

    .row {
        margin-left: -5px;
        margin-right: -5px;
    }

    .row > [class*="col-"] {
        padding-left: 5px;
        padding-right: 5px;
    }

    h1 { font-size: 1.45rem; }
    .page-hero h1 { font-size: 1.3rem; }
    .page-hero p { font-size: 0.8rem; }

    .pagination-bar { flex-direction: column; align-items: stretch; }
    .pagination { justify-content: center; }
    .pagination-info { text-align: center; }

    .fiche-container { padding: 8px 8px 25px; }

    .fiche-hero {
        padding: 13px;
        border-radius: 7px;
        align-items: flex-start;
    }

    .fiche-hero h1 { font-size: 1.25rem; }
    .fiche-subtitle { font-size: 0.78rem; }
    .fiche-actions { gap: 6px; }
    .action-button { width: 35px; height: 35px; }
    .action-button img { max-width: 20px; max-height: 20px; }
    .pdf-type { min-width: 16px; height: 16px; font-size: 0.57rem; }

    .fiche-card { margin-bottom: 8px; border-radius: 7px; }
    .section-header { min-height: 34px; padding: 6px 10px; font-size: 0.88rem; }
    .section-body { padding: 9px; }

    .info-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 6px; }
    .info-box { padding: 6px 7px; }
    .info-box.wide { grid-column: 1 / -1; }
    .info-label { font-size: 0.67rem; }
    .info-value { font-size: 0.84rem; }

    .two-columns { grid-template-columns: 1fr; gap: 8px; }
    .measure-grid { grid-template-columns: 1fr; }
    .measure-box.full { grid-column: auto; }
    .tracking { grid-template-columns: 1fr; gap: 4px; }
    .danger-grid { gap: 6px; grid-template-columns: repeat(2, minmax(0, 1fr)); }

    .danger-box {
        width: calc(33.333% - 5px);
        min-width: 86px;
        padding: 6px 3px;
    }

    .danger-box img { max-width: 38px; max-height: 38px; }
    .fiche-image { max-height: 340px; }
    .image-panel { padding: 6px; }

    .form-page { margin: 0; }
    .page-hero { margin-bottom: 10px; padding: 14px; border-radius: 7px; }
    .form-section { margin-bottom: 10px; border-radius: 7px; }
    .form-section .section-header { padding: 10px 12px; }
    .form-section .section-body { padding: 16px 12px 2px; }
    .form-section .section-body .row { margin-left: -5px; margin-right: -5px; }
    .form-section .section-body .row > [class*="col-"] { padding-left: 5px; padding-right: 5px; }
    .form-section .section-body .form-group,
    .form-section .section-body .form-group.mb-0,
    .form-section .section-body .form-group.mb-md-0 { margin-bottom: 18px !important; }

    .inventory-box { margin-top: 0; margin-bottom: 18px; padding: 12px; }
    .inventory-box .form-check { margin-bottom: 12px; }
    .inventory-box .form-group { margin-bottom: 0 !important; }

    .upload-grid { grid-template-columns: 1fr; gap: 12px; }
    .measure-choice-grid { grid-template-columns: 1fr; }
    .danger-choice label { min-height: 90px; }
    .danger-picto { width: 36px; height: 36px; }
    .validation-grid { grid-template-columns: 1fr; }

    .form-actions { flex-direction: column-reverse; align-items: stretch; }
    .form-actions .btn { width: 100%; }
}

/* ================================================================ */
/* SUPPRESSION GROUPÉE (index, admin)                                */
/* ================================================================ */

.selection-bar {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 8px 12px;
    margin-bottom: 10px;
    border: 1px solid #f5c6cb;
    border-radius: 8px;
    background: #fdf2f2;
}

.selection-count {
    font-weight: 600;
    color: #6c757d;
}

.col-bulk-check {
    width: 38px;
    text-align: center;
    vertical-align: middle;
}

.col-bulk-check input[type="checkbox"] {
    cursor: pointer;
}

/* ================================================================ */
/* VALIDATION RAPIDE (page fiche, admin)                              */
/* ================================================================ */

.validation-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 10px;
}

.validation-actions .btn {
    font-size: 0.75rem;
    padding: 2px 10px;
}

/* ================================================================ */
/* PAGE LOGS (historique des actions)                                */
/* ================================================================ */

.log-summary {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-bottom: 14px;
}

.log-summary-card {
    flex: 0 0 auto;
    min-width: 120px;
    padding: 8px 12px;
    border-radius: 8px;
    border: 1px solid #dee2e6;
    background: #ffffff;
    font-size: 0.8rem;
    line-height: 1.25;
}

.log-summary-count {
    display: block;
    font-size: 1.15rem;
    font-weight: 700;
    line-height: 1.2;
}

.log-summary-card.log-summary-total {
    background: #f8f9fa;
}

.log-details details {
    margin: 0;
}

.log-details summary {
    cursor: pointer;
    color: #495057;
    font-size: 0.78rem;
    -webkit-user-select: none;
    user-select: none;
}

.log-details table {
    margin-top: 6px;
    font-size: 0.78rem;
    border-collapse: collapse;
}

.log-details table th,
.log-details table td {
    padding: 2px 8px;
    border: 1px solid #dee2e6;
    vertical-align: top;
    text-align: left;
}

.log-details table th {
    background: #f1f3f5;
    font-weight: 600;
    white-space: nowrap;
}

.log-field-from {
    color: #adb5bd;
    text-decoration: line-through;
}

.log-field-to {
    color: #155724;
    font-weight: 600;
}

/* ----------------------------------------------------------------
 * EXPORT DE MASSE : spinner + message d'erreur inline
 * ---------------------------------------------------------------- */

.bulk-error {
    flex: 1 1 100%;
    color: #842029;
    background: #fdecec;
    border: 1px solid #f2b8b5;
    border-radius: 4px;
    padding: 4px 10px;
    font-size: 0.85rem;
}

.spinner {
    display: inline-block;
    width: 12px;
    height: 12px;
    margin-right: 6px;
    vertical-align: -1px;
    border: 2px solid currentColor;
    border-right-color: transparent;
    border-radius: 50%;
    animation: pbc-spin .7s linear infinite;
}

@keyframes pbc-spin {
    to { transform: rotate(360deg); }
}


/* ----------------------------------------------------------------
 * SUIVI DES COMMUNES (admin)
 * ---------------------------------------------------------------- */

.suivi-rapports {
    background: #f8f9fa;
    border: 1px solid #e2e6ea;
    border-radius: 6px;
    padding: 14px 16px;
    margin-bottom: 18px;
}

.suivi-add-row {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
}

.suivi-add-date {
    flex: 0 0 170px;
}

.suivi-add-fait,
.suivi-add-reste {
    flex: 1 1 280px;
}

.suivi-add-form textarea {
    resize: vertical;
}

.suivi-timeline {
    margin-top: 14px;
}

.suivi-entry {
    background: #fff;
    border: 1px solid #dee2e6;
    border-left: 4px solid #0275d8;
    border-radius: 5px;
    padding: 10px 14px;
    margin-bottom: 10px;
}

.suivi-entry-head {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
    margin-bottom: 8px;
}

.suivi-auteur {
    font-weight: 600;
}

.suivi-saisi {
    font-size: 0.8rem;
}

.suivi-delete-form {
    margin-left: auto;
}

.suivi-entry-cols {
    display: flex;
    flex-wrap: wrap;
    gap: 14px;
}

.suivi-col {
    flex: 1 1 320px;
}

.suivi-col h6 {
    font-size: 0.78rem;
    text-transform: uppercase;
    letter-spacing: .04em;
    color: #6c757d;
    margin-bottom: 4px;
}

.suivi-col p {
    margin: 0;
    white-space: normal;
}

.suivi-fait {
    border-right: 1px dashed #dee2e6;
    padding-right: 14px;
}

.cell-contact {
    max-width: 340px;
    font-size: 0.9rem;
}

.contact-admin {
    font-weight: 600;
}

.contact-meta {
    margin-top: 4px;
}

/* Deux colonnes : rapports de suivi | panorama des communes */
.suivi-layout {
    display: flex;
    align-items: flex-start;
    gap: 22px;
}

.suivi-col-left {
    flex: 0 0 460px;
    min-width: 0;
}

.suivi-col-right {
    flex: 1 1 auto;
    min-width: 0;
}

@media (max-width: 1100px) {
    .suivi-layout {
        flex-direction: column;
    }

    .suivi-col-left {
        flex: 1 1 auto;
        width: 100%;
    }

    .suivi-col-right {
        width: 100%;
    }
}


/* Après une action, la commune mise à jour reste visible (ancre) */
#suiviTable tr[id] {
    scroll-margin-top: 140px;
}
