body {
    margin-top: 3rem;
    overflow-y: scroll;
}

/* Prépare un gabarit neutre pour accueillir les visualisations D3 des fiches items. */
.item-visualization {
    position: relative;
    min-height: 320px;
}

.item-visualization svg {
    display: block;
    width: 100%;
    height: auto;
}

.mobile-accordion-toggle {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: transparent;
    border: 0;
    color: inherit;
    font-weight: 600;
    padding: 0.25rem 0;
    cursor: pointer;
}

.mobile-accordion-toggle .mobile-accordion-icon {
    transition: transform 0.2s ease-in-out;
}

.mobile-accordion-toggle:not(.collapsed) .mobile-accordion-icon {
    transform: rotate(180deg);
}

.automation-console {
    max-height: 260px;
}

.automation-console__body {
    max-height: 200px;
    overflow-y: auto;
}

.automation-console__entry {
    border-bottom: 1px solid rgba(0, 0, 0, 0.05);
    padding-bottom: 0.35rem;
}

.automation-console__entry:last-child {
    border-bottom: none;
    padding-bottom: 0;
}

/* Ensure diff tables remain readable by wrapping overflowing content inside cells. */
.diff-table__content {
    max-width: 0;
}

.diff-table__pre {
    max-width: 100%;
    white-space: pre-wrap;
    word-break: break-word;
    overflow-wrap: anywhere;
}

/* Harmonise le fond des éléments d'autocomplétion pour gagner en lisibilité. */
.ts-dropdown .option,
.ts-control .item {
    background-color: #e9ecef;
    color: inherit;
}

/* L'élément actif adopte un gris légèrement plus soutenu pour signaler le focus. */
.ts-dropdown .option.active,
.ts-dropdown .option.selected {
    background-color: #dee2e6;
}

/* Préserve le ratio des illustrations Wikipédia dans le panneau de prévisualisation. */
.encyclopedia-preview-image {
    width: 180px;
    max-width: 100%;
    max-height: 180px;
    height: auto;
    object-fit: contain;
}

/* Mise en forme globale de la visualisation hiérarchique de l'administration centrale. */
.central-admin-page {
    /* Un fond discret garantit la continuité avec le reste du back-office en pleine largeur. */
    background-color: var(--bs-body-bg, #ffffff);
}

.central-admin-graph-wrapper {
    /* Hauteur accrue pour laisser davantage de place à la répartition radiale des entités. */
    min-height: 640px;
}

.central-admin-ministry-link {
    /* Liste compacte rappelant les puces colorées du graphe pour faciliter la lecture. */
    display: flex;
    align-items: flex-start;
    gap: 0.75rem;
}

.central-admin-ministry-link__dot {
    flex: 0 0 0.875rem;
    width: 0.875rem;
    height: 0.875rem;
    margin-top: 0.25rem;
    border-radius: 9999px;
    background: var(--ministry-color, #6c757d);
    box-shadow: inset 0 0 0 2px rgba(255, 255, 255, 0.9);
}

.central-admin-graph {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    min-height: 520px;
}

/* Le contenu principal juxtapose la scène SVG et le panneau d'informations. */
.central-admin-graph__content {
    display: flex;
    gap: 1rem;
    flex: 1 1 auto;
    align-items: stretch;
}

/* La scène occupe toute la largeur disponible et conserve un fond neutre. */
.central-admin-graph__stage {
    position: relative;
    flex: 1 1 auto;
    min-height: 560px;
    background-color: var(--bs-body-bg, #ffffff);
    border-radius: var(--bs-border-radius-lg, 1rem);
    box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.05);
    overflow: hidden;
}

/* Lorsque la visualisation passe en plein écran, on force l'occupation totale de la surface disponible. */
.central-admin-graph--fullscreen,
.central-admin-graph:fullscreen {
    background-color: var(--bs-body-bg, #ffffff);
    padding: 1rem;
}

.central-admin-graph--fullscreen .central-admin-graph__content,
.central-admin-graph:fullscreen .central-admin-graph__content {
    height: 100%;
}

.central-admin-graph--fullscreen .central-admin-graph__stage,
.central-admin-graph:fullscreen .central-admin-graph__stage {
    min-height: auto;
}

/* Le SVG s'adapte à la taille de son conteneur. */
.central-admin-graph__svg {
    display: block;
    width: 100%;
    height: 100%;
}

/* Message centré affiché pendant le chargement ou en l'absence de données. */
.central-admin-graph__placeholder {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    margin: 0;
    text-align: center;
    color: #6c757d;
    pointer-events: none;
}

/* Le panneau d'informations reste léger et lisible. */
.central-admin-graph__info {
    flex: 0 0 280px;
    max-width: 100%;
    background-color: rgba(255, 255, 255, 0.85);
    border-radius: var(--bs-border-radius-lg, 1rem);
    padding: 1rem;
    overflow-y: auto;
    box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.05);
}

/* Les bulles se déplacent au survol pour indiquer qu'elles sont interactives. */
.central-admin-graph__node {
    cursor: grab;
}

.central-admin-graph__node:active {
    cursor: grabbing;
}

/* Mise en évidence des modifications apportées aux projets de réponse juridiques. */
.legal-diff {
    background-color: #f8f9fa;
    padding: 0.75rem;
    border-radius: var(--bs-border-radius, 0.375rem);
    border: 1px solid rgba(0, 0, 0, 0.05);
    font-size: 0.95rem;
}

.legal-diff mark.legal-diff-added {
    padding: 0.1rem 0.2rem;
    border-radius: 0.2rem;
}

.legal-diff .legal-diff-removed {
    padding: 0.1rem 0.2rem;
    border-radius: 0.2rem;
    background-color: rgba(220, 53, 69, 0.1);
}

.legal-diff .legal-diff-removed del {
    text-decoration-thickness: 2px;
}

/* Palette de couleurs attribuée dynamiquement selon l'utilisateur ayant rédigé la révision. */
.legal-diff-user-a { background-color: rgba(13, 110, 253, 0.15); color: #0d6efd; }
.legal-diff-user-b { background-color: rgba(32, 201, 151, 0.15); color: #198754; }
.legal-diff-user-c { background-color: rgba(255, 193, 7, 0.2); color: #fd7e14; }
.legal-diff-user-d { background-color: rgba(220, 53, 69, 0.15); color: #dc3545; }
.legal-diff-user-e { background-color: rgba(111, 66, 193, 0.15); color: #6f42c1; }
.legal-diff-user-f { background-color: rgba(23, 162, 184, 0.15); color: #17a2b8; }

.legal-diff mark.legal-diff-added.legal-diff-user-a { background-color: rgba(13, 110, 253, 0.2); }
.legal-diff mark.legal-diff-added.legal-diff-user-b { background-color: rgba(32, 201, 151, 0.25); }
.legal-diff mark.legal-diff-added.legal-diff-user-c { background-color: rgba(255, 193, 7, 0.35); }
.legal-diff mark.legal-diff-added.legal-diff-user-d { background-color: rgba(220, 53, 69, 0.25); }
.legal-diff mark.legal-diff-added.legal-diff-user-e { background-color: rgba(111, 66, 193, 0.3); }
.legal-diff mark.legal-diff-added.legal-diff-user-f { background-color: rgba(23, 162, 184, 0.3); }

.legal-diff .legal-diff-removed.legal-diff-user-a { background-color: rgba(13, 110, 253, 0.12); }
.legal-diff .legal-diff-removed.legal-diff-user-b { background-color: rgba(32, 201, 151, 0.12); }
.legal-diff .legal-diff-removed.legal-diff-user-c { background-color: rgba(255, 193, 7, 0.2); }
.legal-diff .legal-diff-removed.legal-diff-user-d { background-color: rgba(220, 53, 69, 0.2); }
.legal-diff .legal-diff-removed.legal-diff-user-e { background-color: rgba(111, 66, 193, 0.2); }
.legal-diff .legal-diff-removed.legal-diff-user-f { background-color: rgba(23, 162, 184, 0.2); }

.central-admin-graph__node circle {
    stroke: rgba(255, 255, 255, 0.85);
    stroke-width: 2px;
}

/* Les ministères restent interactifs mais leur bulle est masquée pour laisser place à l'enveloppe globale. */
.central-admin-graph__node-circle--ministry {
    fill: transparent !important;
    stroke: transparent !important;
    pointer-events: all;
}

/* Les libellés sont centrés dans chaque bulle. */
.central-admin-graph__node-label {
    fill: #ffffff;
    font-weight: 600;
    font-size: 0.8rem;
    pointer-events: none;
    text-shadow: 0 1px 3px rgba(0, 0, 0, 0.45);
}

/* Les sigles sont légèrement agrandis pour servir de point de repère visuel. */
.central-admin-graph__node-label-abbr {
    font-size: 0.9rem;
    letter-spacing: 0.08em;
}

/* Les liens hiérarchiques restent discrets pour ne pas surcharger la scène. */
.central-admin-graph__link {
    stroke: rgba(33, 37, 41, 0.3);
    pointer-events: none;
}

.central-admin-graph__link--dashed {
    stroke-dasharray: 6 4;
}

/* Les enveloppes ministérielles utilisent une teinte transparente. */
.central-admin-graph__group {
    pointer-events: none;
}

.central-admin-graph__group-label {
    font-size: 0.75rem;
    font-weight: 600;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    fill: rgba(33, 37, 41, 0.65);
}

.central-admin-graph__group-label textPath {
    dominant-baseline: middle;
}

/* Mise en page responsive : le panneau passe sous la scène sur écran étroit. */
@media (max-width: 992px) {
    .central-admin-graph__content {
        flex-direction: column;
    }

    .central-admin-graph__info {
        flex: 0 0 auto;
    }
}
