/* Back office — thème « Atlas de presse » (#355).
   Les statuts se lisent comme une carte thématique : une rampe bleue séquentielle, une légende.
   Le bleu Malmoosk vif est réservé à l'élément actif ; la terre cuite aux erreurs et alertes.
   Redéfinit les variables de l'admin Django (clair, sombre, et sombre selon le système). */

@font-face {
    font-family: "Public Sans";
    font-style: normal;
    font-weight: 100 900;
    font-display: swap;
    src: url("fonts/public-sans-latin.woff2") format("woff2");
    unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
    font-family: "Public Sans";
    font-style: normal;
    font-weight: 100 900;
    font-display: swap;
    src: url("fonts/public-sans-latin-ext.woff2") format("woff2");
    unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C4, U+2113, U+2C60-2C7F, U+A720-A7FF;
}

/* ---------- Variables : clair ---------- */
html[data-theme="light"],
:root {
    --malmoosk: #098bd4;
    --actif: #0a74b1;            /* bleu plein portant du texte blanc (contraste AA) */
    --encre: #16324a;            /* rail et en-tête */
    --encre-texte: #d9e6f0;
    --encre-calme: #9db6c9;
    --encre-survol: #20425f;
    --fond: #eef2f5;
    --surface: #ffffff;
    --surface-2: #f6f8fa;
    --texte: #1c2b38;
    --texte-calme: #51606d;
    --filet: #dbe3ea;
    --bordure: #c5d1db;
    --alerte: #b8462f;
    --alerte-fond: #fbeae6;
    --ardoise: #8796a3;
    /* rampe séquentielle des statuts, du plus pâle au plus profond */
    --r1: #d3e6f4;
    --r2: #a9d0ed;
    --r3: #74b5e1;
    --r4: #3f93cc;
    --r5: #1e6aa3;
    --r6: #0d3f63;
    --ombre: 0 1px 2px rgba(22, 50, 74, .06), 0 2px 8px rgba(22, 50, 74, .05);

    --primary: var(--encre);
    --secondary: var(--encre);
    --accent: var(--malmoosk);
    --primary-fg: #fff;
    --body-fg: var(--texte);
    --body-bg: var(--surface);
    --body-quiet-color: var(--texte-calme);
    --body-medium-color: #34434f;
    --body-loud-color: #0d1a24;
    --header-color: var(--encre-texte);
    --header-branding-color: #fff;
    --header-bg: var(--encre);
    --header-link-color: #fff;
    --breadcrumbs-fg: var(--texte-calme);
    --breadcrumbs-link-fg: var(--actif);
    --breadcrumbs-bg: transparent;
    --link-fg: #0a6aa3;
    --link-hover-color: #07476e;
    --link-selected-fg: var(--actif);
    --hairline-color: var(--filet);
    --border-color: var(--bordure);
    --error-fg: var(--alerte);
    --message-info-bg: #e3f0fa;
    --message-success-bg: #e2f1ea;
    --message-warning-bg: #fbf1dc;
    --message-error-bg: var(--alerte-fond);
    --darkened-bg: var(--surface-2);
    --selected-bg: #e3eef7;
    --selected-row: #e8f2fa;
    --button-fg: #fff;
    --button-bg: var(--actif);
    --button-hover-bg: #085e90;
    --default-button-bg: var(--actif);
    --default-button-hover-bg: #085e90;
    --close-button-bg: #5d6d7a;
    --close-button-hover-bg: #3e4c57;
    --delete-button-bg: var(--alerte);
    --delete-button-hover-bg: #963622;
    --object-tools-fg: var(--actif);
    --object-tools-bg: var(--surface);
    --object-tools-hover-bg: #e3eef7;
    --font-family-primary: "Public Sans", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
    color-scheme: light;
}

/* ---------- Variables : sombre ---------- */
@media (prefers-color-scheme: dark) {
    :root:not([data-theme="light"]) {
        --actif: #1186cc;
        --encre: #0a141d;
        --encre-texte: #c9d8e4;
        --encre-calme: #7f97aa;
        --encre-survol: #15283a;
        --fond: #0f1c27;
        --surface: #152634;
        --surface-2: #1a2e3e;
        --texte: #e2ebf2;
        --texte-calme: #9fb2c1;
        --filet: #223748;
        --bordure: #2f475a;
        --alerte: #e07a62;
        --alerte-fond: #3a1e18;
        --ardoise: #74879a;
        --r1: #2c5a80;
        --r2: #3570a0;
        --r3: #3f86c0;
        --r4: #3f8fc8;
        --r5: #6fb3e3;
        --r6: #a9d6f5;
        --ombre: 0 1px 2px rgba(0, 0, 0, .3);
        --body-medium-color: #cfdbe4;
        --body-loud-color: #fff;
        --link-fg: #7cc0ee;
        --link-hover-color: #b0dbf8;
        --breadcrumbs-link-fg: #7cc0ee;
        --message-info-bg: #18354d;
        --message-success-bg: #163a2b;
        --message-warning-bg: #3d3014;
        --selected-bg: #1d3a52;
        --selected-row: #1a3449;
        --button-hover-bg: #0a74b1;
        --default-button-hover-bg: #0a74b1;
        --close-button-bg: #3a4f60;
        --close-button-hover-bg: #4d6577;
        --object-tools-hover-bg: #1d3a52;
        color-scheme: dark;
    }
}

html[data-theme="dark"] {
    --actif: #1186cc;
    --encre: #0a141d;
    --encre-texte: #c9d8e4;
    --encre-calme: #7f97aa;
    --encre-survol: #15283a;
    --fond: #0f1c27;
    --surface: #152634;
    --surface-2: #1a2e3e;
    --texte: #e2ebf2;
    --texte-calme: #9fb2c1;
    --filet: #223748;
    --bordure: #2f475a;
    --alerte: #e07a62;
    --alerte-fond: #3a1e18;
    --ardoise: #74879a;
    --r1: #2c5a80;
    --r2: #3570a0;
    --r3: #3f86c0;
    --r4: #3f8fc8;
    --r5: #6fb3e3;
    --r6: #a9d6f5;
    --ombre: 0 1px 2px rgba(0, 0, 0, .3);
    --body-fg: var(--texte);
    --body-bg: var(--surface);
    --body-quiet-color: var(--texte-calme);
    --body-medium-color: #cfdbe4;
    --body-loud-color: #fff;
    --header-bg: var(--encre);
    --breadcrumbs-bg: transparent;
    --link-fg: #7cc0ee;
    --link-hover-color: #b0dbf8;
    --breadcrumbs-link-fg: #7cc0ee;
    --hairline-color: var(--filet);
    --border-color: var(--bordure);
    --error-fg: var(--alerte);
    --message-info-bg: #18354d;
    --message-success-bg: #163a2b;
    --message-warning-bg: #3d3014;
    --message-error-bg: var(--alerte-fond);
    --darkened-bg: var(--surface-2);
    --selected-bg: #1d3a52;
    --selected-row: #1a3449;
    --button-bg: var(--actif);
    --default-button-bg: var(--actif);
    --button-hover-bg: #0a74b1;
    --default-button-hover-bg: #0a74b1;
    --close-button-bg: #3a4f60;
    --close-button-hover-bg: #4d6577;
    --delete-button-bg: var(--alerte);
    --object-tools-bg: var(--surface);
    --object-tools-hover-bg: #1d3a52;
    color-scheme: dark;
}

/* ---------- Base ---------- */
html, body { background: var(--fond); }
body { font-size: 0.875rem; line-height: 1.5; font-variant-numeric: tabular-nums; }
::selection { background: var(--r2); color: var(--texte); }
:focus-visible { outline: 2px solid var(--malmoosk); outline-offset: 2px; }
a:link, a:visited { text-underline-offset: 0.18em; }
h1, h2, h3, h4 { text-wrap: balance; }
* { scrollbar-color: var(--bordure) transparent; }

/* ---------- En-tête ---------- */
#header {
    background: var(--encre);
    color: var(--encre-texte);
    padding: 10px 24px;
    min-height: 52px;
    flex-shrink: 0;
    border-bottom: 1px solid rgba(255, 255, 255, .06);
}
#branding h1, #site-name { font-size: 1rem; font-weight: 650; letter-spacing: 0; }
#site-name a { display: inline-flex; align-items: center; gap: 10px; color: #fff; }
#site-name a::before {
    content: "";
    width: 24px;
    height: 24px;
    flex: none;
    background: url("favicon.svg") center / contain no-repeat;
}
#user-tools { color: var(--encre-calme); font-size: 0.8125rem; letter-spacing: 0; text-transform: none; }
#user-tools a { border-bottom: 0; color: var(--encre-texte); }
#user-tools a:hover, #user-tools a:focus { color: #fff; text-decoration: underline; }
#logout-form button { color: var(--encre-texte); }
.theme-toggle svg.theme-icon-when-auto, .theme-toggle svg.theme-icon-when-dark,
.theme-toggle svg.theme-icon-when-light { fill: var(--encre-texte); color: var(--encre); }

/* ---------- Rail de navigation ---------- */
.main { background: var(--fond); }
#nav-sidebar {
    background: var(--encre);
    border-right: 0;
    border-top: 0;
    padding: 12px 10px 24px;
    flex-basis: 248px;
}
.toggle-nav-sidebar {
    background: var(--encre);
    border-right: 1px solid rgba(255, 255, 255, .06);
    color: var(--encre-calme);
}
.toggle-nav-sidebar:hover, .toggle-nav-sidebar:focus { background: var(--encre-survol); color: #fff; }
#nav-sidebar .module { background: transparent; box-shadow: none; margin-bottom: 14px; border: 0; }
#nav-sidebar .module caption,
#nav-sidebar .module caption a {
    background: transparent;
    color: var(--encre-calme);
    font-size: 0.6875rem;
    font-weight: 650;
    letter-spacing: .08em;
    text-transform: uppercase;
    padding: 10px 10px 4px;
}
#nav-sidebar .module th, #nav-sidebar .module td { border: 0; padding: 0; background: transparent; }
#nav-sidebar .module th a, #nav-sidebar .module td a {
    display: block;
    color: var(--encre-texte);
    padding: 7px 10px;
    border-radius: 6px;
    font-size: 0.875rem;
}
#nav-sidebar .module td a.addlink {
    padding: 7px 10px 7px 18px;
    font-size: 0.75rem;
    color: var(--encre-calme);
    background-position: 2px 50%;
    opacity: .8;
}
#nav-sidebar .module tr:hover th a, #nav-sidebar .module th a:focus { background: var(--encre-survol); color: #fff; }
#nav-sidebar .current-app .section:link, #nav-sidebar .current-app .section:visited { color: #fff; }
#nav-sidebar .current-model { background: transparent; }
#nav-sidebar .current-model th a { background: var(--actif); color: #fff; font-weight: 600; }
#nav-filter {
    background: var(--encre-survol);
    border: 1px solid rgba(255, 255, 255, .1);
    color: var(--encre-texte);
    border-radius: 6px;
    margin: 0 0 12px;
    width: 100%;
    padding: 7px 10px;
}
#nav-filter::placeholder { color: var(--encre-calme); }

/* ---------- Contenu ---------- */
#content { padding: 8px 40px 40px; max-width: 1400px; }
#content h1 { font-size: 1.375rem; font-weight: 650; color: var(--body-loud-color); margin: 6px 0 16px; }
#content h2 { font-size: 1rem; }
div.breadcrumbs {
    background: transparent;
    color: var(--texte-calme);
    padding: 14px 40px 0;
    font-size: 0.8125rem;
    border: 0;
}
div.breadcrumbs a { color: var(--breadcrumbs-link-fg); }

/* Bandeau « Cette page gère… » */
.aide-page {
    margin: 12px 40px 4px;
    padding: 11px 16px;
    display: flex;
    align-items: center;
    gap: 24px;
    justify-content: space-between;
    background: color-mix(in srgb, var(--r1) 45%, var(--surface));
    border: 1px solid color-mix(in srgb, var(--r2) 70%, var(--surface));
    border-radius: 8px;
    color: var(--texte);
}
.aide-page p { margin: 0; padding: 0; font-size: 0.875rem; }
.aide-page a {
    flex: none;
    font-weight: 600;
    padding: 4px 12px;
    border-radius: 999px;
    border: 1px solid var(--actif);
    color: var(--actif);
}
.aide-page a:hover, .aide-page a:focus { background: var(--actif); color: #fff; text-decoration: none; }

/* Messages */
ul.messagelist { margin: 12px 40px 0; }
ul.messagelist li { border-radius: 8px; color: var(--texte); font-size: 0.875rem; padding: 12px 12px 12px 40px; }

/* Modules */
.module {
    background: var(--surface);
    border: 1px solid var(--filet);
    border-radius: 10px;
    box-shadow: var(--ombre);
    overflow: hidden;
}
.module h2, .module caption, .inline-group h2 {
    background: var(--surface);
    color: var(--body-loud-color);
    font-size: 0.8125rem;
    font-weight: 650;
    letter-spacing: 0;
    text-transform: none;
    padding: 12px 16px;
    border-bottom: 1px solid var(--filet);
}
.module h2 a, .module caption a { color: inherit; }
#content-related .module h2 { background: var(--surface); color: var(--body-loud-color); }

/* Tableaux */
table { border-color: var(--filet); }
thead th, tfoot td {
    background: var(--surface-2);
    color: var(--texte-calme);
    font-size: 0.75rem;
    font-weight: 650;
    letter-spacing: .02em;
    border-bottom: 1px solid var(--filet);
}
thead th a:link, thead th a:visited { color: var(--texte-calme); }
td, th { border-bottom: 1px solid var(--filet); padding: 9px 12px; vertical-align: middle; }
tr:nth-child(odd), .row-form-errors { background: var(--surface); }
tr:nth-child(even) { background: var(--surface); }
#changelist table tbody tr:hover { background: var(--selected-row); }
#changelist table tbody tr.selected { background: var(--selected-bg); }

/* Liste : barre d'outils, filtres, actions */
#changelist .changelist-form-container { gap: 24px; }
#changelist #toolbar {
    background: transparent;
    border: 0;
    padding: 0 0 12px;
}
#changelist #toolbar form input[type="text"], #searchbar {
    border-radius: 6px;
    border: 1px solid var(--bordure);
    background: var(--surface);
    padding: 7px 10px;
    min-width: 280px;
}
#changelist-filter {
    background: var(--surface);
    border: 1px solid var(--filet);
    border-radius: 10px;
    box-shadow: var(--ombre);
    padding-bottom: 8px;
}
#changelist-filter h2 {
    background: transparent;
    color: var(--body-loud-color);
    font-size: 0.8125rem;
    text-transform: none;
    letter-spacing: 0;
    border-bottom: 1px solid var(--filet);
}
#changelist-filter h3, #changelist-filter summary {
    color: var(--texte-calme);
    font-size: 0.6875rem;
    font-weight: 650;
    letter-spacing: .06em;
    text-transform: uppercase;
}
#changelist-filter li a { color: var(--texte); padding: 3px 0; }
#changelist-filter li.selected { border-left: 0; padding-left: 0; margin-left: 0; }
#changelist-filter li.selected a { color: var(--actif); font-weight: 650; }
#changelist-filter li a:hover, #changelist-filter li a:focus { color: var(--link-hover-color); }
#changelist-filter #changelist-filter-extra-actions h3 a { color: var(--actif); }
#changelist .actions {
    background: var(--surface-2);
    border-bottom: 1px solid var(--filet);
    color: var(--texte-calme);
    padding: 10px 12px;
}
#changelist .actions.selected { background: var(--selected-bg); }
#changelist .actions select, select {
    border-radius: 6px;
    border: 1px solid var(--bordure);
    background-color: var(--surface);
    padding: 5px 8px;
}
.paginator { color: var(--texte-calme); border-top: 0; background: transparent; padding: 12px; }
.paginator a:link, .paginator a:visited { background: var(--surface-2); color: var(--actif); border-radius: 6px; }
.paginator a:hover, .paginator a:focus { background: var(--actif); color: #fff; }
.paginator .this-page { color: var(--body-loud-color); font-weight: 650; }
p.datetime, .date-hierarchy { color: var(--texte-calme); }
.xfull, .changelist-form-container { width: 100%; }

/* Outils d'objet (Ajouter, Historique) */
.object-tools a:link, .object-tools a:visited {
    background: var(--surface);
    color: var(--actif);
    border: 1px solid var(--bordure);
    border-radius: 999px;
    font-size: 0.8125rem;
    font-weight: 600;
    letter-spacing: 0;
    text-transform: none;
    padding: 6px 14px;
}
.object-tools a:hover, .object-tools a:focus { background: var(--actif); border-color: var(--actif); color: #fff; }
.object-tools a.addlink { background-image: none; padding: 6px 14px; }

/* Boutons */
.button, input[type="submit"], input[type="button"], .submit-row input, a.button, button.button {
    border-radius: 6px;
    font-weight: 600;
    padding: 8px 16px;
    font-size: 0.8125rem;
    transition: background-color .15s ease-out;
}
.button.default, input[type="submit"].default, .submit-row input.default { font-weight: 650; }
.submit-row {
    background: var(--surface-2);
    border: 1px solid var(--filet);
    border-radius: 10px;
    padding: 12px 14px;
    gap: 10px;
}
.submit-row a.deletelink {
    border-radius: 6px;
    background: transparent;
    color: var(--alerte);
    border: 1px solid var(--alerte);
}
.submit-row a.deletelink:hover, .submit-row a.deletelink:focus { background: var(--alerte); color: #fff; }
a.button.cancel-link, .cancel-link { border-radius: 6px; }

/* Formulaires */
fieldset.module { margin-bottom: 20px; }
.form-row { border-bottom: 1px solid var(--filet); padding: 12px 16px; }
.aligned label { color: var(--body-medium-color); font-weight: 500; }
.required label, label.required { color: var(--body-loud-color); font-weight: 650; }
input[type="text"], input[type="password"], input[type="email"], input[type="url"], input[type="number"],
input[type="tel"], textarea, .vTextField, .vURLField, .vIntegerField {
    border: 1px solid var(--bordure);
    border-radius: 6px;
    background: var(--surface);
    color: var(--texte);
    padding: 7px 10px;
}
input:focus, textarea:focus, select:focus { border-color: var(--malmoosk); }
.help, p.help, form p.help, div.help { color: var(--texte-calme); font-size: 0.8125rem; }
.errornote, ul.errorlist { color: var(--alerte); }
.errornote { border: 1px solid var(--alerte); background: var(--alerte-fond); border-radius: 8px; }
.readonly { color: var(--texte); }
pre { background: var(--surface-2); border: 1px solid var(--filet); border-radius: 6px; padding: 10px 12px; }
.procedure-relance { white-space: pre-wrap; user-select: all; }

/* ---------- Pastilles de statut (légende) ---------- */
.statut {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    white-space: nowrap;
    color: var(--texte);
    font-weight: 500;
    --pastille: var(--ardoise);
}
.statut::before {
    content: "";
    width: 10px;
    height: 10px;
    border-radius: 3px;
    background: var(--pastille);
    box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--pastille) 70%, var(--texte));
    flex: none;
}
/* progression d'un document : la rampe */
.statut-decouvert { --pastille: var(--r1); }
.statut-telecharge { --pastille: var(--r2); }
.statut-envoye { --pastille: var(--r3); }
.statut-indexe { --pastille: var(--r4); }
.statut-classe { --pastille: var(--r6); }
/* en attente d'une décision : contour seul */
.statut-a-valider, .statut-a-produire, .statut-programmee, .statut-relance-demandee, .statut-inconnue {
    --pastille: transparent;
}
.statut-a-valider::before, .statut-a-produire::before, .statut-programmee::before,
.statut-relance-demandee::before, .statut-inconnue::before {
    box-shadow: inset 0 0 0 2px var(--r4);
}
/* en cours */
.statut-en-cours, .statut-en-production, .statut-relance-en-cours, .statut-retrait-en-cours { --pastille: var(--r3); }
/* abouti */
.statut-succes, .statut-validee, .statut-ok, .statut-produit, .statut-publiee, .statut-resolue { --pastille: var(--r6); }
/* écarté */
.statut-retire, .statut-rejetee, .statut-hors-sujet, .statut-vide, .statut-annulee, .statut-supprime,
.statut-retiree, .statut-interrompu, .statut-a-retirer, .statut-a-supprimer { --pastille: var(--ardoise); }
/* hors rampe : ce qui demande une intervention */
.statut-erreur, .statut-echec, .statut-ouverte, .statut-expiree { --pastille: var(--alerte); color: var(--alerte); font-weight: 600; }

/* ---------- Accueil ---------- */
.accueil { display: grid; gap: 28px; }
.accueil h2 { font-size: 0.9375rem; font-weight: 650; color: var(--body-loud-color); margin: 0 0 12px; }
.accueil-compteurs { display: flex; flex-wrap: wrap; gap: 12px; margin: 0; padding: 0; list-style: none; }
.accueil-compteurs li { margin: 0; padding: 0; list-style: none; }
.accueil-compteurs a {
    display: flex;
    align-items: baseline;
    gap: 12px;
    min-width: 230px;
    padding: 14px 18px;
    background: var(--surface);
    border: 1px solid var(--filet);
    border-radius: 10px;
    box-shadow: var(--ombre);
    color: var(--texte);
    transition: border-color .15s ease-out;
}
.accueil-compteurs a { align-items: center; }
.accueil-compteurs a::after { content: ""; margin-left: auto; width: 18px; height: 18px; flex: none; background: var(--actif); -webkit-mask: var(--icone-fleche) center / contain no-repeat; mask: var(--icone-fleche) center / contain no-repeat; }
.accueil-compteurs a:hover, .accueil-compteurs a:focus { border-color: var(--actif); text-decoration: none; }
.accueil-compteurs strong { font-size: 1.75rem; line-height: 1; font-weight: 650; color: var(--body-loud-color); }
.accueil-compteurs a.accueil-alerte strong { color: var(--alerte); }
.accueil-compteurs a.accueil-alerte::after { background: var(--alerte); }
.accueil-rien { color: var(--texte-calme); margin: 0; }
.accueil-colonnes { display: grid; grid-template-columns: minmax(0, 1.25fr) minmax(0, 1fr); gap: 24px; align-items: start; }
.accueil-carte {
    background: var(--surface);
    border: 1px solid var(--filet);
    border-radius: 10px;
    box-shadow: var(--ombre);
    padding: 18px 20px;
}
.accueil-carte h2 { display: flex; justify-content: space-between; align-items: baseline; }
.accueil-carte h2 small { color: var(--texte-calme); font-weight: 500; font-size: 0.8125rem; }
.legende-barre { display: flex; gap: 2px; height: 16px; border-radius: 4px; overflow: hidden; margin: 4px 0 14px; }
.legende-barre span { min-width: 4px; background: var(--pastille); box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--pastille) 70%, var(--texte)); }
.legende { columns: 2; column-gap: 28px; margin: 0; padding: 0; list-style: none; }
.legende li { list-style: none; padding: 0; margin: 0; break-inside: avoid; }
.legende a { display: flex; align-items: center; padding: 5px 0; color: var(--texte); border-bottom: 1px solid var(--filet); }
.legende a:hover, .legende a:focus { color: var(--link-hover-color); text-decoration: none; }
.legende a strong { margin-left: auto; font-weight: 600; }
.accueil-etat { margin: 0; display: grid; grid-template-columns: max-content 1fr; }
.accueil-etat dt, .accueil-etat dd { margin: 0; padding: 8px 0; border-bottom: 1px solid var(--filet); }
.accueil-etat dt { color: var(--texte-calme); padding-right: 20px; }
.accueil-etat dd { text-align: right; }
.accueil-carte h3 { font-size: 0.8125rem; color: var(--texte-calme); margin: 18px 0 6px; font-weight: 650; }
.accueil-prochaines { margin: 0; padding: 0; list-style: none; }
.accueil-prochaines li { list-style: none; display: flex; gap: 12px; padding: 6px 0; border-bottom: 1px solid var(--filet); }
.accueil-prochaines time { color: var(--texte-calme); flex: none; }
.accueil-ecrans { margin-top: 4px; }
.accueil-ecrans h2 { margin-bottom: 12px; }
.accueil-ecrans #content-main { float: none; width: auto; display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 16px; }
.accueil-ecrans .module { margin: 0; }

/* ---------- Aide ---------- */
.notice { display: grid; grid-template-columns: 240px minmax(0, 1fr); gap: 40px; align-items: start; }
.notice-sommaire {
    position: sticky;
    top: 16px;
    max-height: calc(100vh - 32px);
    overflow: auto;
    font-size: 0.8125rem;
}
.notice-sommaire h2 { font-size: 0.6875rem; letter-spacing: .08em; text-transform: uppercase; color: var(--texte-calme); margin: 0 0 8px; }
.notice-sommaire ul { margin: 0; padding: 0 0 0 12px; list-style: none; }
.notice-sommaire > div > ul { padding: 0; }
.notice-sommaire li { list-style: none; padding: 2px 0; }
.notice-sommaire a { color: var(--texte); }
.notice-corps {
    background: var(--surface);
    border: 1px solid var(--filet);
    border-radius: 10px;
    padding: 28px 36px 36px;
    max-width: 78ch;
    font-size: 0.9375rem;
    line-height: 1.6;
}
.notice-corps h1 { font-size: 1.5rem; margin-top: 0; }
.notice-corps h2 { font-size: 1.125rem; margin: 2.2em 0 .6em; padding-top: 1.2em; border-top: 1px solid var(--filet); scroll-margin-top: 16px; }
.notice-corps h3 { font-size: 1rem; margin: 1.8em 0 .5em; scroll-margin-top: 16px; }
.notice-corps h2:target, .notice-corps h3:target { color: var(--actif); }
.notice-corps ul, .notice-corps ol { padding-left: 1.3em; }
.notice-corps li { list-style: disc; padding: 2px 0; }
.notice-corps ol li { list-style: decimal; }
.notice-corps table { margin: 10px 0 14px; border: 1px solid var(--filet); border-radius: 8px; }
.notice-corps code { background: var(--surface-2); padding: 1px 5px; border-radius: 4px; font-size: .875em; }

/* ---------- Statistiques ---------- */
.stats-bloc { margin-bottom: 2rem; }
.stats-bloc table { margin-top: .5rem; }
.stats-erreur { color: var(--error-fg); font-weight: bold; }
.stats-releve { color: var(--body-quiet-color); font-size: .85em; }
.stats-chiffres { display: flex; flex-wrap: wrap; gap: 2rem; margin: .5rem 0; }
.stats-chiffres strong { display: block; font-size: 1.6em; }
.stats-barre { display: inline-block; height: .8em; background: var(--r4); border-radius: 2px; vertical-align: middle; }
.stats-colonne-barre { width: 50%; }

/* ---------- Connexion ---------- */
body.login { background: var(--fond); }
.login #container {
    background: var(--surface);
    border: 1px solid var(--filet);
    border-radius: 12px;
    box-shadow: 0 8px 28px rgba(22, 50, 74, .12);
    overflow: hidden;
    margin-top: 12vh;
}
.login #header { padding: 18px 24px; }
.login #header h1 { font-size: 1rem; }
.login #content { padding: 24px; }
.login .submit-row { background: transparent; border: 0; padding: 12px 0 0; }
.login .submit-row input { width: 100%; }

/* ---------- Petits écrans ---------- */
@media (max-width: 1024px) {
    #content { padding: 8px 16px 32px; }
    div.breadcrumbs { padding: 12px 16px 0; }
    .aide-page, ul.messagelist { margin-left: 16px; margin-right: 16px; }
    .accueil-colonnes, .notice { grid-template-columns: minmax(0, 1fr); }
    .notice-sommaire { position: static; max-height: none; }
    .notice-corps { padding: 20px; }
}
@media (max-width: 767px) {
    #header { padding: 10px 16px; }
    .aide-page { flex-direction: column; align-items: flex-start; gap: 8px; }
    .accueil-compteurs a { min-width: 0; flex: 1 1 100%; }
    .legende { columns: 1; }
    #changelist #toolbar form input[type="text"], #searchbar { min-width: 0; width: 100%; }
}

@media (prefers-reduced-motion: reduce) {
    * { transition: none !important; }
}

/* ---------- Corrections après revue des captures ---------- */
/* Liens d'interface sans soulignement (souligné au survol) ; le texte courant de la notice garde le sien. */
.accueil a, .legende a, #changelist-filter a, .aide-page a, div.breadcrumbs a, .paginator a,
#changelist table tbody a, #user-tools a, .module caption a, #content-related a {
    text-decoration: none;
}
.accueil a:hover, .legende a:hover, #changelist-filter a:hover, div.breadcrumbs a:hover,
#changelist table tbody a:hover, #content-related a:hover { text-decoration: underline; }
.accueil-compteurs a:hover { text-decoration: none; }
#site-name a:link, #site-name a:visited { color: #fff; }
.module caption a.section:link, .module caption a.section:visited { color: var(--body-loud-color); }
#nav-sidebar .module caption a.section:link, #nav-sidebar .module caption a.section:visited { color: var(--encre-calme); }
#nav-sidebar tr, #nav-sidebar tr:nth-child(odd), #nav-sidebar tr:nth-child(even) { background: transparent; }
#nav-sidebar .current-app .section:link, #nav-sidebar .current-app .section:visited { color: #fff; }
#changelist-filter li.selected { border-left: 0; padding-left: 0; margin-left: 0; }
.dashboard #content { width: auto; }
.dashboard .accueil-ecrans .module table th { width: auto; }
.dashboard .accueil-ecrans td, .dashboard .accueil-ecrans th { word-break: normal; }
/* La règle de soulignement de l'admin porte un sélecteur d'id : on la contre depuis #container. */
#container .accueil a[href], #container .legende a[href], #container #changelist-filter a[href], #container .aide-page a[href],
#container div.breadcrumbs a[href], #container .paginator a[href], #container #changelist table tbody a[href],
#container #user-tools a[href], #container .module caption a[href] { text-decoration: none; }
#container .accueil-ecrans a[href]:hover, #container .legende a[href]:hover, #container #changelist-filter a[href]:hover,
#container div.breadcrumbs a[href]:hover, #container #changelist table tbody a[href]:hover { text-decoration: underline; }
#nav-sidebar .module caption { border-bottom: 1px solid rgba(255, 255, 255, .08); }
#changelist-filter h2 { text-transform: none; }
.field-nom textarea, .field-url_documents textarea { height: 2.75em; min-height: 2.75em; resize: vertical; }
.theme-toggle { background: transparent; border: 0; color: var(--encre-texte); }
.theme-toggle:hover, .theme-toggle:focus-visible { color: #fff; }
.notice-corps > h1:first-child { display: none; }
.notice-corps > h1:first-child + p { margin-top: 0; }
#content .notice-sommaire h2 { font-size: 0.6875rem; letter-spacing: .08em; text-transform: uppercase; color: var(--texte-calme); margin: 4px 0 8px; }
#container .notice-sommaire a[href] { text-decoration: none; }
#container .notice-sommaire a[href]:hover { text-decoration: underline; }
@media (max-width: 767px) {
    #user-tools { white-space: normal; line-height: 1.6; overflow: visible; }
}
/* Groupes de champs des fiches (Informations personnelles, Permissions, Règles par défaut…) */
fieldset.module h2, fieldset .fieldset-heading, fieldset.module summary h2, .collapse summary {
    background: var(--surface-2);
    color: var(--body-loud-color);
    font-size: 0.8125rem;
    font-weight: 650;
    text-transform: none;
    letter-spacing: 0;
    border-bottom: 1px solid var(--filet);
}
.inline-group .tabular tr.add-row td, .inline-related h3 { background: var(--surface-2); color: var(--texte); }
input[type="submit"], input[type="button"], .button, button.button { text-transform: none; letter-spacing: 0; }
@media (max-width: 767px) {
    #header { align-items: flex-start; gap: 6px; }
    #user-tools { display: flex; flex-wrap: wrap; align-items: center; gap: 0 4px; }
}

/* ---------- Icônes dessinées (remplacent les icônes vertes et jaunes de l'admin) ---------- */
:root {
    --icone-plus: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M12 5v14M5 12h14'/%3E%3C/svg%3E");
    --icone-crayon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M4 20h4L19 9l-4-4L4 16v4z'/%3E%3C/svg%3E");
    --icone-oeil: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M2 12s4-7 10-7 10 7 10 7-4 7-10 7S2 12 2 12z'/%3E%3Ccircle cx='12' cy='12' r='3'/%3E%3C/svg%3E");
    --icone-fleche: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M5 12h14M13 6l6 6-6 6'/%3E%3C/svg%3E");
}
a.addlink, a.changelink, a.inlinechangelink, a.viewlink, a.inlineviewlink {
    background-image: none;
    padding-left: 0;
    display: inline-flex;
    align-items: center;
    gap: 5px;
}
a.addlink::before, a.changelink::before, a.inlinechangelink::before, a.viewlink::before, a.inlineviewlink::before {
    content: "";
    width: 13px;
    height: 13px;
    flex: none;
    background: currentColor;
    -webkit-mask: var(--icone) center / contain no-repeat;
    mask: var(--icone) center / contain no-repeat;
}
a.addlink { --icone: var(--icone-plus); }
a.changelink, a.inlinechangelink { --icone: var(--icone-crayon); }
a.viewlink, a.inlineviewlink { --icone: var(--icone-oeil); }
#nav-sidebar .module td a.addlink { display: inline-flex; padding-left: 10px; background-image: none; }
.object-tools a.addlink { display: inline-flex; padding: 6px 14px; }

/* Groupes de champs : aucune bordure encre */
fieldset .fieldset-heading, fieldset .inline-heading, fieldset.module h2 { border: 0; border-bottom: 1px solid var(--filet); box-shadow: none; }

/* Erreurs courtes des listes : une ligne, tronquée */
#changelist td.field-erreur_courte { white-space: nowrap; max-width: 260px; overflow: hidden; text-overflow: ellipsis; }

/* Accueil : le rail est présent */
@media (min-width: 1025px) { .accueil-colonnes { grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr); } }
.accueil-ecrans { display: none; }
@media (max-width: 767px) { .accueil-ecrans { display: block; } }
/* Entrée « Tableau de bord » du rail */
#nav-sidebar a.nav-accueil {
    display: block;
    margin: 0 0 10px;
    padding: 7px 10px;
    border-radius: 6px;
    color: var(--encre-texte);
    font-weight: 600;
    text-decoration: none;
}
#nav-sidebar a.nav-accueil:hover, #nav-sidebar a.nav-accueil:focus-visible { background: var(--encre-survol); color: #fff; }
#nav-sidebar a.nav-accueil.actif { background: var(--actif); color: #fff; }
/* Listes : titres sur deux lignes au plus, valeur d'exécution d'un seul tenant */
#changelist .field-nom_affiche { min-width: 220px; }
#changelist .field-langue { white-space: nowrap; }
.accueil-ligne { white-space: nowrap; }
#logout-form button { text-transform: none; letter-spacing: 0; }
