/* =====================================================================
   UTILITAIRES
   ===================================================================== */

/* ── Composant dropzone (upload fichier) ──────────────────────────── */
.file-dropzone {
  border: 2px dashed var(--border-action-high-blue-france);
  border-radius: 0.25rem;
  padding: 2.5rem 1.5rem;
  text-align: center;
  cursor: pointer;
  transition: background-color 0.15s ease, border-color 0.15s ease;
  background-color: var(--background-alt-blue-france);
}
.file-dropzone:hover,
.file-dropzone.dragover {
  background-color: var(--background-contrast-blue-france);
  border-color: var(--border-active-blue-france);
}
.file-dropzone__icon {
  font-size: 2rem;
  color: var(--text-action-high-blue-france);
  display: block;
  margin-bottom: 0.75rem;
}
.file-dropzone--compact {
  padding: 1.25rem 1rem;
}
.file-dropzone--compact .file-dropzone__icon {
  font-size: 1.5rem;
  margin-bottom: 0.5rem;
}

/* Garantit que [hidden] fonctionne même quand DSFR force display sur un composant */
[hidden] { display: none !important; }

#logout-form { margin: 0; }
.docs-page-size-select { width: auto; min-width: 5rem; }

.text-mention    { color: var(--text-mention-grey); }
.text-mention-sm { color: var(--text-mention-grey); font-size: 0.875rem; }
.nowrap          { white-space: nowrap; }
.embed-textarea  { font-family: monospace; font-size: 0.8rem; resize: none; }
.embed-script-wrapper { position: relative; }
.slug-cell       { font-size: .85rem; word-break: break-all; }
.date-cell       { font-size: .8rem; }

/* Colonnes de tableaux — largeurs fixes */
.col-w-7  { width: 7%; }
.col-w-8  { width: 8%; }
.col-w-10 { width: 10%; }
.col-w-12 { width: 12%; }
.col-w-13 { width: 13%; }
.col-w-14 { width: 14%; }
.col-w-16 { width: 16%; }
.col-w-19 { width: 19%; }
.col-w-20 { width: 20%; }
.col-w-22 { width: 22%; }

/* Éléments initialement masqués, affichés via JS (element.style.display) */
#sfdImportStatus { display: none; }
#themeNavList { list-style: none; padding: 0; margin: 0; }

/*
 * Fix DSFR : les modales fermées utilisent visibility:hidden + opacity:0 plutôt que
 * display:none. Pendant l'animation de fermeture (300 ms), visibility est encore
 * « visible » bien qu'opacity soit 0 — la modale (position:fixed; inset:0; z-index:1750)
 * intercepte alors tous les clics et bloque les boutons de la page.
 * On désactive pointer-events tant que la modale n'est pas ouverte ; le backdrop
 * click-to-close reste fonctionnel car fr-modal--opened restaure auto.
 */
.fr-modal:not(.fr-modal--opened) {
  pointer-events: none;
}

/*
 * RGAA — empêche la fermeture des modales au clic sur le backdrop.
 * Le backdrop (fr-modal lui-même) ne reçoit plus d'événements souris ;
 * le contenu (enfants directs) reste entièrement interactif.
 */
.fr-modal[data-fr-concealment-prevented] {
  pointer-events: none;
}
.fr-modal[data-fr-concealment-prevented] > * {
  pointer-events: auto;
}

/* =====================================================================
   COMPOSANTS PARTAGÉS
   ===================================================================== */

/* Tables — responsivité
 * ≥ 768px : scroll horizontal si la table dépasse la largeur du conteneur.
 *           fr-table--layout-fixed désactivant le overflow:auto natif DSFR,
 *           on le remet sur le conteneur + min-width pour déclencher le scroll.
 * < 768px : layout en cartes — chaque ligne devient une carte avec les libellés
 *           de colonnes en préfixe (injectés via data-label par site-layout.js). */
.fr-table {
  overflow-x: auto;
}
.fr-table--layout-fixed > table {
  min-width: 640px;
}

@media (max-width: 767px) {
  .fr-table {
    overflow-x: unset;
  }
  .fr-table table {
    display: block !important;
    min-width: unset !important;
    width: 100% !important;
  }
  .fr-table thead {
    display: none;
  }
  .fr-table tbody,
  .fr-table tr {
    display: block;
    width: 100%;
  }
  .fr-table tr {
    border: 1px solid var(--border-default-grey);
    border-radius: 0.25rem;
    margin-bottom: 0.75rem;
    padding: 0.25rem 0;
  }
  .fr-table td {
    display: flex;
    gap: 0.75rem;
    align-items: flex-start;
    padding: 0.375rem 0.75rem;
    border-bottom: 1px solid var(--border-default-grey);
    min-width: 0;
    word-break: break-word;
  }
  .fr-table td:last-child {
    border-bottom: none;
  }
  .fr-table td::before {
    content: attr(data-label);
    font-weight: 700;
    min-width: 100px;
    flex-shrink: 0;
    font-size: 0.8125rem;
    color: var(--text-mention-grey);
  }
  .fr-table td[data-label=""]::before {
    display: none;
    min-width: 0;
  }
}

/* Tables */
td { vertical-align: middle; }
@media (min-width: 768px) {
  #needs-table-wrap > table {
    display: table;
    overflow: visible;
  }
}

/* Colonnes triables */
th.sortable-col {
  cursor: pointer;
  user-select: none;
  white-space: nowrap;
}
th.sortable-col::after {
  content: ' ⇅';
  opacity: 0.35;
  font-size: 0.75em;
}
th.sortable-col[aria-sort="ascending"]::after  { content: ' ▲'; opacity: 1; }
th.sortable-col[aria-sort="descending"]::after { content: ' ▼'; opacity: 1; }
th.sortable-col:hover { background-color: var(--background-contrast-grey); }

/* Tags (thèmes, profils…) */
.tag {
  display: inline-block;
  padding: 0.15rem 0.45rem;
  border-radius: 999px;
  background-color: var(--background-contrast-grey);
  color: var(--text-default-grey);
  font-size: 0.8rem;
  margin: 0.1rem;
}

.tag-list {
  display: flex;
  flex-wrap: wrap;
  gap: 0.15rem;
}

/* Liste à cocher dans les modales */
.checkbox-list {
  border: 1px solid #ddd;
  padding: 0.75rem 1rem;
  border-radius: 0.5rem;
}

/* Message d'erreur inline (formulaires "ajouter thème/profil") */
.inline-error {
  display: none;
  color: var(--text-default-error);
  font-size: 0.875rem;
  margin-top: 0.25rem;
}
.inline-error.visible { display: block; }

/* Boutons d'action dans le pied de modale DSFR (sticky en bas du corps) */
.fr-modal__footer .fr-btns-group {
  flex-wrap: wrap;
}

/* Pagination */
.pagination-info {
  font-size: 0.875rem;
  color: var(--text-mention-grey);
}

/* Colonnes triables */
th[data-col] {
  cursor: pointer;
  user-select: none;
  white-space: nowrap;
}

th[data-col]:hover { background: var(--background-alt-blue-france); }

th[data-col]::after {
  content: ' ↕';
  font-size: 0.75rem;
  opacity: 0.4;
}

th[aria-sort="ascending"]::after  { content: ' ↑'; opacity: 1; }
th[aria-sort="descending"]::after { content: ' ↓'; opacity: 1; }

/* =====================================================================
   EASYMDE (éditeur Markdown — documents.html & pages.html)
   ===================================================================== */

.EasyMDEContainer .CodeMirror {
  border: 1px solid #929292;
  border-radius: 0 0 0.25rem 0.25rem;
  font-size: 0.9375rem;
  min-height: 250px;
}

.EasyMDEContainer .editor-toolbar {
  border: 1px solid #929292;
  border-bottom: none;
  border-radius: 0.25rem 0.25rem 0 0;
}

.EasyMDEContainer .editor-preview {
  background: var(--background-default-grey, #fff);
}

.EasyMDEContainer .editor-preview h1,
.EasyMDEContainer .editor-preview h2,
.EasyMDEContainer .editor-preview h3,
.EasyMDEContainer .editor-preview h4 {
  font-weight: bold;
  margin-top: 1rem;
  margin-bottom: 0.5rem;
}

.EasyMDEContainer .editor-preview p { margin-bottom: 0.75rem; }

.EasyMDEContainer .editor-preview ul,
.EasyMDEContainer .editor-preview ol {
  padding-left: 1.5rem;
  margin-bottom: 0.75rem;
}

.EasyMDEContainer .editor-preview table {
  border-collapse: collapse;
  width: 100%;
  margin-bottom: 0.75rem;
}

.EasyMDEContainer .editor-preview th,
.EasyMDEContainer .editor-preview td {
  border: 1px solid #ddd;
  padding: 0.4rem 0.75rem;
}

.EasyMDEContainer .editor-preview th { background: #f0f0f0; }

.EasyMDEContainer .editor-preview a { color: #000091; text-decoration: underline; }

.EasyMDEContainer .editor-preview blockquote {
  border-left: 4px solid #ccc;
  padding-left: 1rem;
  color: #555;
}

/* Indicateur de robustesse du mot de passe */
.pwd-criteria {
  list-style: none;
  padding: 0;
  margin: 0.5rem 0 0;
  font-size: 0.8125rem;
}

.pwd-criteria li {
  color: var(--text-mention-grey);
  padding: 0.1rem 0;
}

.pwd-criteria li::before {
  content: '○ ';
}

.pwd-criteria li.pwd-ok {
  color: var(--text-default-success, #18753c);
}

.pwd-criteria li.pwd-ok::before {
  content: '✓ ';
}

/* =====================================================================
   APPLICATIONS (applications.html)
   ===================================================================== */

#appsTable td:last-child { white-space: nowrap; }

/* =====================================================================
   DOCUMENTS (documents.html)
   ===================================================================== */

.title-row {
  display: flex;
  gap: 0.5rem;
  margin-bottom: 0.75rem;
}

.title-row input { flex: 1; }

#bulkToolbar {
  background: var(--background-alt-blue-france);
  border-left: 4px solid var(--border-active-blue-france);
  padding: 0.65rem 1rem;
  border-radius: 0.25rem;
}

th.col-check, td.col-check {
  width: 2.5rem;
  text-align: center;
  padding: 0.5rem 0.25rem;
}

input.doc-check {
  width: 1.125rem;
  height: 1.125rem;
  cursor: pointer;
  accent-color: var(--background-active-blue-france);
}

/* =====================================================================
   PAGES (pages.html)
   ===================================================================== */

/* L'éditeur est masqué par défaut ; JS le bascule en display:block */
#editor-section { display: none; }

.status-badge-published {
  background: #18753c;
  color: #fff;
  padding: .1rem .5rem;
  border-radius: .25rem;
  font-size: .75rem;
  white-space: nowrap;
}

.status-badge-draft {
  background: #b60000;
  color: #fff;
  padding: .1rem .5rem;
  border-radius: .25rem;
  font-size: .75rem;
  white-space: nowrap;
}

/* Éditeur de page plus haut que l'éditeur de document */
#editor-section .EasyMDEContainer .CodeMirror { min-height: 320px; }

/* =====================================================================
   ACCUEIL PUBLIC (accueil.html)
   ===================================================================== */

.hero {
  background: var(--background-alt-blue-france);
  padding: 3rem 0;
}

.hero__title {
  font-size: 2rem;
  font-weight: 700;
  margin-bottom: 0.5rem;
}

.hero__subtitle {
  font-size: 1.125rem;
  color: var(--text-mention-grey);
}

.apps-grid { margin-top: 2.5rem; }

.app-card { height: 100%; }

.app-card .fr-card__img {
  display: flex;
  align-items: center;
  justify-content: center;
}

.app-card .fr-card__img img {
  max-width: 100%;
  max-height: 120px;
  width: auto;
  height: auto;
  object-fit: contain;
  padding: 0.5rem;
}

.app-card__img-placeholder {
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--background-alt-blue-france);
  height: 120px;
  font-size: 2.5rem;
  font-weight: 700;
  color: var(--text-action-high-blue-france);
  letter-spacing: 0.05em;
}

.card-loading {
  text-align: center;
  padding: 3rem 0;
  color: var(--text-mention-grey);
}

/* =====================================================================
   INDEX ADMIN — Tuiles enrichies (index.html)
   ===================================================================== */

/* Conteneur tuile */
.app-tile {
  height: 100%;
  display: flex;
  flex-direction: column;
  gap: 0;
  background: var(--background-default-grey);
  border: 1px solid var(--border-default-grey);
  border-radius: 0.25rem;
  padding: 1.25rem;
  border-left-width: 4px;
  transition: box-shadow 0.15s ease;
}

.app-tile:hover {
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.08);
}

/* États visuels — bordure gauche colorée */
.app-tile--ok {
  border-left-color: var(--border-default-grey);
}

.app-tile--warning {
  border-left-color: var(--border-plain-warning-425-moon, #b34000);
}

.app-tile--action-required {
  border-left-color: var(--border-plain-error, #ce0500);
}

/* En-tête */
.app-tile__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  margin-bottom: 0.875rem;
}

.app-tile__name {
  font-size: 1rem;
  font-weight: 700;
  margin: 0;
  flex: 1;
  min-width: 0;
  word-break: break-word;
}

/* Icone application */
.app-tile__icon {
  flex-shrink: 0;
  width: 2.5rem;
  height: 2.5rem;
  border-radius: 0.25rem;
  object-fit: contain;
}

.app-tile__icon--initials {
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--background-alt-blue-france);
  color: var(--text-action-high-blue-france);
  font-size: 0.875rem;
  font-weight: 700;
  letter-spacing: 0.03em;
  border-radius: 0.25rem;
}

/* Blocs internes */
.app-tile__section {
  padding-top: 0.75rem;
  margin-top: 0.75rem;
  border-top: 1px solid var(--border-default-grey);
}

.app-tile__section-title {
  font-size: 0.6875rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-mention-grey);
  margin: 0 0 0.5rem;
}

/* Stats compactes */
.app-tile__stats {
  display: flex;
  flex-wrap: wrap;
  gap: 0.25rem 1.25rem;
  padding-top: 0.75rem;
  margin-top: 0.75rem;
  border-top: 1px solid var(--border-default-grey);
}

.app-tile__stat {
  display: flex;
  flex-direction: column;
  font-size: 0.8125rem;
}

.app-tile__stat-value {
  font-weight: 700;
  font-size: 1rem;
  line-height: 1.2;
  color: var(--text-default-grey);
}

.app-tile__stat-value--alert { color: var(--text-default-error, #ce0500); }
.app-tile__stat-value--warn  { color: var(--text-default-warning, #b34000); }

.app-tile__stat-label {
  color: var(--text-mention-grey);
}

/* Items "À traiter" */
.app-tile__todo-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 0.25rem;
}

.app-tile__todo-ok {
  display: flex;
  align-items: center;
  gap: 0.375rem;
  font-size: 0.875rem;
  color: var(--text-default-success, #18753c);
  margin: 0;
}

/* Insight textuel */
.app-tile__insight {
  font-size: 0.8125rem;
  font-style: italic;
  color: var(--text-mention-grey);
  margin: 0.5rem 0 0;
}

/* Actions rapides */
.app-tile__actions {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
  margin-top: auto;
  padding-top: 0.875rem;
  border-top: 1px solid var(--border-default-grey);
}

/* ── Synthèse globale ── */
.global-summary {
  display: flex;
  flex-wrap: wrap;
  gap: 0.25rem 1.5rem;
  padding: 0.625rem 1rem;
  background: var(--background-alt-grey);
  border-radius: 0.25rem;
  font-size: 0.875rem;
  color: var(--text-default-grey);
  border-left: 3px solid var(--border-default-grey);
}

.global-summary__item {
  display: inline-flex;
  align-items: baseline;
  gap: 0.3rem;
  white-space: nowrap;
}

.global-summary__item--alert .global-summary__value {
  color: var(--text-default-error, #ce0500);
}

.global-summary__value {
  font-weight: 700;
}

/* ── Aperçu icône application (admin.html) ── */
.icon-preview-wrap {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-top: 0.5rem;
}

.icon-preview {
  width: 48px;
  height: 48px;
  object-fit: contain;
  border: 1px solid var(--border-default-grey);
  border-radius: 0.25rem;
  background: var(--background-alt-grey);
}

/* =====================================================================
   RESSOURCES PUBLIQUES (ressources.html)
   ===================================================================== */

.resources-layout {
  display: flex;
  gap: 2rem;
  align-items: flex-start;
}

.resources-sidebar {
  flex: 0 0 240px;
  position: sticky;
  top: 1.5rem;
}

.resources-main {
  flex: 1 1 0;
  min-width: 0;
}

@media (max-width: 991px) {
  .resources-layout {
    flex-direction: column;
  }
  .resources-sidebar {
    position: static;
    flex: none;
    width: 100%;
  }
}

.theme-nav__link {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.625rem 1rem;
  font-size: 0.9375rem;
  color: var(--text-action-high-blue-france);
  text-decoration: none;
  border-radius: 0.25rem;
  gap: 0.5rem;
}

.theme-nav__link:hover,
.theme-nav__link:focus {
  background: var(--background-alt-blue-france);
  text-decoration: underline;
}

.theme-nav__link--active {
  font-weight: 700;
  background: var(--background-alt-blue-france);
}

.theme-nav__count {
  flex-shrink: 0;
  font-size: 0.8125rem;
  color: var(--text-mention-grey);
}

.theme-section { margin-bottom: 3rem; }

.theme-section__title {
  padding-bottom: 0.75rem;
  border-bottom: 2px solid var(--border-default-grey);
  margin-bottom: 1.5rem;
}

.article-badge {
  display: inline-block;
  font-size: 0.75rem;
  padding: 0.15rem 0.5rem;
  border-radius: 0.875rem;
  background: var(--background-alt-blue-cumulus);
  color: var(--text-action-high-blue-cumulus);
  font-weight: 600;
  vertical-align: middle;
  margin-left: 0.5rem;
}

.article-content {
  padding: 1rem 0;
  line-height: 1.7;
}

.article-content h1, .article-content h2, .article-content h3,
.article-content h4, .article-content h5 {
  font-weight: 700;
  margin-top: 1.25rem;
  margin-bottom: 0.5rem;
}

.article-content h1 { font-size: 1.375rem; }
.article-content h2 { font-size: 1.125rem; }
.article-content h3 { font-size: 1rem; }

.article-content p { margin-bottom: 0.75rem; }

.article-content ul, .article-content ol {
  padding-left: 1.5rem;
  margin-bottom: 0.75rem;
}

.article-content li { margin-bottom: 0.25rem; }

.article-content strong { font-weight: 700; }
.article-content em { font-style: italic; }

.article-content code {
  background: var(--background-alt-grey);
  padding: 0.1em 0.3em;
  border-radius: 0.2em;
  font-family: monospace;
  font-size: 0.9em;
}

.page-status {
  text-align: center;
  padding: 4rem 0;
  color: var(--text-mention-grey);
}

/* =====================================================================
   CENTRE D'AIDE (aide.html, aide-theme.html)
   ===================================================================== */

/* En-tête application avec icône optionnelle */
.help-app-header {
  display: flex;
  align-items: flex-start;
  gap: 1.25rem;
}

.help-app-icon {
  width: 56px;
  height: 56px;
  object-fit: contain;
  border-radius: 0.25rem;
  flex-shrink: 0;
}

/* Barre d'outils thèmes (titre + toggle grille/liste) */
.help-themes-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
  margin-bottom: 1.5rem;
}

.help-view-toggle {
  display: flex;
  gap: 0.25rem;
}

.help-view-toggle .fr-btn {
  padding: 0.375rem 0.625rem;
}

/* Tuile de thème — pictogramme (icône DSFR ou initiales) */
.theme-tile .fr-tile__header {
  padding: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.theme-tile__pictogram {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 4rem;
  height: 4rem;
  border-radius: 50%;
  background: var(--background-action-low-blue-france);
  flex-shrink: 0;
}

.theme-tile__icon {
  font-size: 1.75rem;
  color: var(--text-action-high-blue-france);
  line-height: 1;
}

.theme-tile__initials {
  font-size: 1.125rem;
  font-weight: 700;
  color: var(--text-action-high-blue-france);
  line-height: 1;
}

/* En mode liste (fr-col-12), la tuile prend toute la largeur naturellement */
.fr-col-12.theme-card-col .theme-tile .fr-tile__pictogram {
  width: 4.5rem;
  height: 4.5rem;
}

/* Comptage de documents dans la tuile */
.theme-tile .fr-tile__detail {
  font-size: 0.875rem;
  color: var(--text-mention-grey);
  margin-top: 0.5rem;
  display: flex;
  align-items: center;
  gap: 0.375rem;
}

/* Tuile d'article (aide-theme.html) */
.article-tile + .article-tile {
  margin-top: 0.75rem;
}

.article-tile .fr-tile__header {
  padding: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.article-tile__pictogram {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 3.5rem;
  height: 3.5rem;
  border-radius: 50%;
  background: var(--background-action-low-blue-france);
  flex-shrink: 0;
}

.article-tile__icon {
  font-size: 1.5rem;
  color: var(--text-action-high-blue-france);
  line-height: 1;
}

/* Page article (article.html) */
.article-page__back {
  border-top: 1px solid var(--border-default-grey);
}

/* Résultats de recherche */
.search-result-card__footer {
  display: flex;
  justify-content: flex-end;
  padding-top: 0.5rem;
}

/* Barre latérale thèmes (aide-theme.html, article.html) */
@media (min-width: 48em) {
  .help-sidemenu {
    position: sticky;
    top: 1.5rem;
  }
}

/* Résultats de recherche */
.search-result-card .fr-card__body { padding: 1rem; }
.search-result-excerpt {
  overflow: hidden;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  font-size: 0.875rem;
  color: var(--text-mention-grey);
  margin-top: 0.25rem;
}

/* Séparateur de sections dans aide-theme.html */
.help-section-title {
  padding-bottom: 0.75rem;
  border-bottom: 2px solid var(--border-default-grey);
  margin-bottom: 1.5rem;
  margin-top: 3rem;
}

#articlesSection .help-section-title,
#faqSection .help-section-title {
  margin-top: 0;
}

#faqSection { margin-top: 3rem; }

/* Article individuel */
.help-article { }
.help-article .fr-hr { border-color: var(--border-default-grey); }

/* =====================================================================
   MODALE EXPIRATION DE SESSION
   ===================================================================== */

.session-warning {
  position: fixed;
  inset: 0;
  z-index: 2000;
  background: rgba(0, 0, 0, 0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
}

.session-warning[hidden] { display: none; }

.session-warning__inner {
  background: var(--background-default-grey);
  max-width: 560px;
  width: 100%;
  border-radius: 4px;
  box-shadow: 0 16px 48px rgba(0, 0, 0, 0.3);
}

/* Bloc temps restant */
.session-warning__time {
  background: var(--background-alt-blue-france);
  border-radius: 4px;
  padding: 1rem 1.25rem 1.25rem;
}

.session-warning__countdown {
  font-size: 1.875rem;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  color: var(--text-action-high-blue-france);
  margin: 0 0 0.875rem;
  line-height: 1.2;
}

/* Barre de progression décroissante */
.session-warning__progress {
  display: block;
  width: 100%;
  height: 6px;
  border: none;
  border-radius: 3px;
  background: var(--background-contrast-blue-france);
  overflow: hidden;
}

.session-warning__progress::-webkit-progress-bar {
  background: var(--background-contrast-blue-france);
  border-radius: 3px;
}

.session-warning__progress::-webkit-progress-value {
  background: var(--text-action-high-blue-france);
  border-radius: 3px;
  transition: width 1s linear;
}

.session-warning__progress::-moz-progress-bar {
  background: var(--text-action-high-blue-france);
  border-radius: 3px;
  transition: width 1s linear;
}

/* Responsive : boutons empilés sur petit écran */
@media (max-width: 36em) {
  .session-warning__inner { padding: 1.5rem; }
  .session-warning .fr-btns-group--inline { flex-direction: column-reverse; align-items: stretch; }
  .session-warning .fr-btns-group--inline li { width: 100%; }
  .session-warning .fr-btns-group--inline li .fr-btn { width: 100%; justify-content: center; }
}

/* =====================================================================
   THÈMES ADMIN — liste éditable
   ===================================================================== */

.themes-list {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.theme-row {
  display: flex;
  align-items: flex-start;
  gap: 0.5rem;
  padding: 0.75rem;
  background: var(--background-alt-grey);
  border-radius: 4px;
  flex-wrap: wrap;
}

.theme-row .theme-label-input {
  flex: 1 1 140px;
  min-width: 120px;
  height: 2rem;
  font-size: 0.875rem;
}

.theme-row .theme-desc-input {
  flex: 2 1 200px;
  min-width: 150px;
  height: 2rem;
  font-size: 0.875rem;
}

.theme-row .fr-checkbox-group {
  flex-shrink: 0;
  align-self: center;
}

.theme-icon-pick {
  flex-shrink: 0;
  align-self: center;
}

.theme-row .theme-actions {
  display: flex;
  gap: 0.25rem;
  align-self: center;
  flex-shrink: 0;
}

/* =====================================================================
   SÉLECTEUR D'ICÔNES — dialog natif (showModal, hors DSFR JS)
   ===================================================================== */

dialog.icon-picker-dialog {
  padding: 0;
  border: none;
  border-radius: 4px;
  box-shadow: 0 16px 48px rgba(0, 0, 0, 0.3);
  max-width: 720px;
  width: 95vw;
  max-height: 85vh;
  display: none;
  flex-direction: column;
  overflow: hidden;
  background: var(--background-default-grey);
}

dialog.icon-picker-dialog[open] {
  display: flex;
}

dialog.icon-picker-dialog::backdrop {
  background: rgba(0, 0, 0, 0.5);
}

.icon-picker-dialog__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1rem 1.5rem;
  border-bottom: 1px solid var(--border-default-grey);
  flex-shrink: 0;
}

.icon-picker-dialog__search {
  padding: 1rem 1.5rem;
  border-bottom: 1px solid var(--border-default-grey);
  flex-shrink: 0;
}

.icon-picker-dialog__body {
  flex: 1;
  overflow-y: auto;
  padding: 1rem 1.5rem;
  min-height: 0;
}

.icon-picker-dialog__footer {
  display: flex;
  gap: 0.5rem;
  padding: 0.75rem 1.5rem;
  border-top: 1px solid var(--border-default-grey);
  flex-shrink: 0;
}

.icon-picker-grid {
  padding-right: 0.25rem;
}

.icon-picker-category {
  margin-bottom: 1.5rem;
}

.icon-picker-category-title {
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-mention-grey);
  margin-bottom: 0.5rem;
}

.icon-picker-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.375rem;
}

.icon-picker-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  width: 5rem;
  min-height: 4.25rem;
  padding: 0.5rem 0.25rem;
  background: var(--background-default-grey);
  border: 1px solid var(--border-default-grey);
  border-radius: 4px;
  cursor: pointer;
  gap: 0.25rem;
  transition: background 0.1s, border-color 0.1s;
}

.icon-picker-item:hover,
.icon-picker-item:focus {
  background: var(--background-action-low-blue-france);
  border-color: var(--border-action-high-blue-france);
  outline: none;
}

.icon-picker-item[aria-pressed="true"] {
  background: var(--background-active-blue-france);
  border-color: var(--border-action-high-blue-france);
  color: var(--text-inverted-blue-france);
}

.icon-picker-label {
  font-size: 0.625rem;
  text-align: center;
  line-height: 1.2;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--text-mention-grey);
}

/* ===== Drawer qualité documentaire ===== */

.quality-drawer-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.4);
  z-index: 1000;
}

.quality-drawer {
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  width: min(520px, 100vw);
  background: var(--background-default-grey);
  box-shadow: -4px 0 24px rgba(0, 0, 0, 0.18);
  z-index: 1001;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.quality-drawer__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1rem 1.5rem;
  border-bottom: 1px solid var(--border-default-grey);
  flex-shrink: 0;
  background: var(--background-alt-grey);
}

.quality-drawer__body {
  flex: 1;
  overflow-y: auto;
  padding: 1.5rem;
}

/* Score coloré selon le statut */
.quality-score-value {
  font-size: 3rem;
  font-weight: 700;
  line-height: 1;
}
.quality-score-value.score-ok   { color: var(--text-default-success); }
.quality-score-value.score-warn { color: var(--artwork-minor-warning); }
.quality-score-value.score-bad  { color: var(--text-default-error); }
.quality-score-value.score-off  { color: var(--text-disabled-grey); }

/* Cellule qualité dans le tableau documents */
.quality-cell {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  font-size: 0.875rem;
  font-weight: 600;
  white-space: nowrap;
}
.quality-cell--ok   { color: var(--text-default-success); }
.quality-cell--warn { color: var(--artwork-minor-warning); }
.quality-cell--bad  { color: var(--text-default-error); }
.quality-cell--off  { color: var(--text-disabled-grey); }

.quality-cell__score { font-variant-numeric: tabular-nums; }
.quality-cell__max   { font-size: 0.75rem; font-weight: 400; opacity: 0.7; }
.quality-cell__obsolete { color: var(--artwork-minor-warning); margin-left: 0.2rem; }

/* Séparateur de section */
.quality-section-title {
  font-size: 0.875rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-mention-grey);
  margin: 1.5rem 0 0.75rem;
  padding-bottom: 0.25rem;
  border-bottom: 1px solid var(--border-default-grey);
}

/* Liste d'événements */
.quality-event-item {
  display: flex;
  gap: 0.75rem;
  padding: 0.625rem 0;
  border-bottom: 1px solid var(--border-default-grey);
  align-items: flex-start;
}
.quality-event-item:last-child { border-bottom: none; }

/* =====================================================================
   ADMIN — MENU LATÉRAL
   ===================================================================== */

/* Layout principal : sidebar + contenu */
.admin-layout {
  display: flex;
  align-items: flex-start;
  gap: 0;
  min-height: 70vh;
  padding-bottom: 4rem;
}

/* ── Sidebar ────────────────────────────────────────────────────────── */
.admin-sidenav {
  width: 220px;
  min-width: 220px;
  flex-shrink: 0;
  border-right: 1px solid var(--border-default-grey);
  padding: 1rem 0 2rem;
  position: sticky;
  top: 0;
  max-height: 100vh;
  overflow-y: auto;
  transition: width 0.2s ease, min-width 0.2s ease;
}

/* Bouton réduire/développer */
.admin-sidenav__toggle {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  width: 100%;
  padding: 0.25rem 0.75rem 0.75rem;
  background: none;
  border: none;
  cursor: pointer;
  color: var(--text-mention-grey);
}
.admin-sidenav__toggle:hover { color: var(--text-action-high-blue-france); }
.admin-sidenav__toggle .fr-icon-arrow-left-s-line {
  transition: transform 0.2s ease;
  font-size: 1.25rem;
}

/* Liste principale */
.admin-sidenav__list,
.admin-sidenav__sublist {
  list-style: none;
  padding: 0;
  margin: 0;
}

/* Item de navigation */
.admin-sidenav__item {
  display: flex;
  align-items: center;
  gap: 0.625rem;
  width: 100%;
  padding: 0.625rem 1rem;
  background: none;
  border: none;
  cursor: pointer;
  text-align: left;
  font-size: 0.875rem;
  color: var(--text-label-grey);
  border-left: 3px solid transparent;
  transition: background 0.15s, color 0.15s, border-color 0.15s;
  line-height: 1.3;
}
.admin-sidenav__item:hover {
  background: var(--background-contrast-grey);
  color: var(--text-label-grey);
}
.admin-sidenav__item--active {
  color: var(--text-action-high-blue-france);
  border-left-color: var(--border-action-high-blue-france);
  background: var(--background-contrast-blue-france);
  font-weight: 500;
}
.admin-sidenav__item--sub {
  padding-left: 1rem;
  font-size: 0.8125rem;
}

/* Icône */
.admin-sidenav__icon {
  font-size: 1.125rem;
  flex-shrink: 0;
}

/* Groupe */
.admin-sidenav__group {
  margin-top: 0.5rem;
}
.admin-sidenav__group-header {
  display: flex;
  align-items: center;
  gap: 0.625rem;
  padding: 0.5rem 1rem 0.25rem;
  color: var(--text-mention-grey);
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

/* ── Mode réduit (icônes seules) ────────────────────────────────────── */
.admin-sidenav--collapsed {
  width: 52px;
  min-width: 52px;
}
.admin-sidenav--collapsed .admin-sidenav__toggle {
  justify-content: center;
  padding-right: 0;
}
.admin-sidenav--collapsed .admin-sidenav__toggle .fr-icon-arrow-left-s-line {
  transform: rotate(180deg);
}
/* Masquage visuel uniquement — les labels restent lus par les AT */
.admin-sidenav--collapsed .admin-sidenav__label,
.admin-sidenav--collapsed .admin-sidenav__group-title {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}
.admin-sidenav--collapsed .admin-sidenav__item {
  justify-content: center;
  padding-left: 0;
  padding-right: 0;
  border-left: none;
  border-bottom: 3px solid transparent;
}
.admin-sidenav--collapsed .admin-sidenav__item--active {
  border-bottom-color: var(--border-action-high-blue-france);
}
.admin-sidenav--collapsed .admin-sidenav__group-header {
  justify-content: center;
  padding-left: 0;
  padding-right: 0;
}
.admin-sidenav--collapsed .admin-sidenav__item--sub {
  padding-left: 0;
}

/* Tooltip au survol en mode réduit — rendu via JS (position: fixed) */
.admin-sidenav-tooltip {
  position: fixed;
  background: var(--background-overlap-grey);
  color: var(--text-label-grey);
  padding: 0.25rem 0.5rem;
  border-radius: 4px;
  font-size: 0.8125rem;
  white-space: nowrap;
  z-index: 1000;
  box-shadow: 0 2px 6px rgba(0,0,0,0.15);
  pointer-events: none;
  transform: translateY(-50%);
}

/* ── Contenu ────────────────────────────────────────────────────────── */
.admin-content {
  flex: 1;
  min-width: 0;
  padding: 1.5rem 0 1.5rem 2rem;
}

/* ── Responsive ─────────────────────────────────────────────────────── */

/* Tablette (< 992px) : réduit par défaut via JS, pas de surcharge CSS forcée */

/* Mobile (< 768px) : sidebar en haut, contenu en dessous */
@media (max-width: 767px) {
  .admin-layout {
    flex-direction: column;
  }
  .admin-sidenav {
    width: 100% !important;
    min-width: 0 !important;
    max-height: none;
    position: static;
    border-right: none;
    border-bottom: 1px solid var(--border-default-grey);
    padding-bottom: 0.5rem;
  }
  .admin-sidenav__toggle { display: none; }
  .admin-sidenav__label,
  .admin-sidenav__group-title { display: inline !important; }
  .admin-sidenav__item {
    border-left: none !important;
    border-bottom: 3px solid transparent !important;
    justify-content: flex-start;
    padding-left: 1rem !important;
  }
  .admin-sidenav__item--active {
    border-bottom-color: var(--border-action-high-blue-france) !important;
  }
  .admin-sidenav__list {
    display: flex;
    flex-wrap: wrap;
    gap: 0.25rem;
  }
  .admin-sidenav__group { width: 100%; }
  .admin-sidenav__sublist { display: flex; flex-wrap: wrap; gap: 0.25rem; }
  .admin-content {
    padding: 1rem 0;
  }
}

/* ── Mon espace — panneau de compte (disclosure widget) ─────────────────── */
.fr-header__tools-links ul {
  position: relative;
}

.mon-espace-panel {
  position: absolute;
  top: calc(100% + 6px);
  right: 0;
  min-width: 300px;
  max-width: 380px;
  background-color: #fff;
  border: 1px solid var(--border-default-grey, #ddd);
  border-radius: 4px;
  box-shadow: 0 6px 24px rgba(0, 0, 0, .18);
  z-index: 1100;
  overflow: hidden;
}

[data-fr-theme="dark"] .mon-espace-panel {
  background-color: #2a2a2a;
}

.mon-espace-panel__identity {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 1rem 1rem 0.75rem;
}

.mon-espace-panel__avatar {
  flex-shrink: 0;
  width: 2.5rem;
  height: 2.5rem;
  border-radius: 50%;
  background: var(--background-action-high-blue-france);
  color: var(--text-inverted-blue-france);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.125rem;
  font-weight: 700;
  line-height: 1;
  text-transform: uppercase;
  user-select: none;
}

.mon-espace-panel__identity-info {
  min-width: 0;
}

.mon-espace-panel__name {
  font-size: 0.875rem;
  font-weight: 700;
  color: var(--text-title-grey);
  margin: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.mon-espace-panel__email {
  font-size: 0.75rem;
  color: var(--text-mention-grey);
  margin: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.mon-espace-panel__workspace {
  margin: 0 1rem 0.75rem;
  padding: 0.5rem 0.75rem;
  background: var(--background-alt-blue-france);
  border-radius: 4px;
  border-left: 3px solid var(--border-action-high-blue-france);
}

.mon-espace-panel__workspace-label {
  font-size: 0.6875rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-mention-grey);
  margin: 0 0 0.25rem;
}

.mon-espace-panel__workspace-row {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.mon-espace-panel__workspace-name {
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--text-title-grey);
  margin: 0;
}

.mon-espace-panel__workspace-actions {
  margin-top: 0.5rem;
}

.mon-espace-panel__divider {
  margin: 0;
  border: none;
  border-top: 1px solid var(--border-default-grey);
}

.mon-espace-panel__actions {
  padding: 0.25rem 0.5rem;
  list-style: none;
  margin: 0;
}

.mon-espace-panel__actions li {
  margin: 0;
}

.mon-espace-panel__actions .fr-btn,
.mon-espace-panel__logout .fr-btn {
  width: 100%;
  justify-content: flex-start !important;
}

.mon-espace-panel__logout {
  padding: 0.25rem 0.5rem 0.5rem;
}

.mon-espace-panel__logout form {
  margin: 0;
}

.mon-espace-notifs {
  padding: 0 0.75rem 0.5rem;
}

.mon-espace-panel__notifs {
  padding: 0 0.75rem 0;
}

/* Wrapper positionné pour ancrer la bulle */
.mon-espace-btn-wrapper {
  position: relative;
  display: inline-flex;
  align-items: center;
}

/* Bulle rouge de notifications non lues */
.mon-espace-notif-badge {
  position: absolute;
  top: -4px;
  right: -6px;
  min-width: 1.125rem;
  height: 1.125rem;
  padding: 0 0.25rem;
  border-radius: 999px;
  background: var(--background-action-high-error, #CE0500);
  color: #fff;
  font-size: 0.6875rem;
  font-weight: 700;
  line-height: 1.125rem;
  text-align: center;
  pointer-events: none;
}

/* ── Tuiles de sélection d'espace ────────────────────────────────────────── */
.workspace-tiles {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.workspace-tile__btn {
  width: 100%;
  display: flex;
  align-items: center;
  padding: 0.75rem 1rem;
  background: var(--background-default-grey);
  border: 1px solid var(--border-default-grey);
  border-radius: 4px;
  cursor: pointer;
  text-align: left;
  transition: background 0.15s, border-color 0.15s;
}

.workspace-tile__btn:hover {
  background: var(--background-contrast-grey);
  border-color: var(--border-action-high-blue-france);
}

.workspace-tile--active .workspace-tile__btn {
  border-color: var(--border-action-high-blue-france);
  background: var(--background-contrast-blue-france);
}

.workspace-tile__label {
  font-weight: 500;
}
}
