/* KlassIA — thème clair, couleur principale #168BCD */
:root {
  --theme: #168bcd;
  --bg: #ffffff;
  --surface: #f8fafc;
  --surface-elevated: #ffffff;
  --border: #e2e8f0;
  --text: #0f172a;
  --muted: #64748b;
  --accent: var(--theme);
  --accent-hover: #1278b5;
  /* Fond formulaires : 20 % #168BCD + 80 % blanc */
  --form-surface: #d0e8f5;
  /* En-têtes de tableaux Mes documents : thème + 80 % blanc */
  --documents-thead-bg: color-mix(in srgb, var(--theme) 20%, var(--bg) 80%);
  --form-border: #b8d9f0;
  --brand-doc: var(--theme);
  --brand-ia: #d97706;
  --brand-doc-hover: #1278b5;
  --brand-ia-hover: #b45309;
  --success: #16a34a;
  --danger: #dc2626;
  --radius: 10px;
  --font: system-ui, "Segoe UI", Roboto, sans-serif;
  --header-bg: #ffffff;
  --shadow-sm: 0 1px 2px rgba(15, 23, 42, 0.06);
  /* Fond zone principale (tableau de bord, Mes documents, paramètres…) — gris-bleu un peu plus marqué que les cartes blanches */
  --dashboard-main-bg: #d8dee8;
  /* Marge extérieure page (haut : 0 pour coller le menu au bord et éviter le saut du sticky) */
  --page-outer-margin: 20px;
  /* Pleine largeur avec marges latérales fluides */
  --page-padding: clamp(1rem, 4vw, 3rem);
  /* Hauteur du menu sticky ; renseignée par documents_table_hscroll_script (Mes documents) */
  --docia-app-sticky-top: 0px;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  /* Pas de marge latérale : pleine largeur : feuille sous le menu et le pied de page */
  padding: 0 0 var(--page-outer-margin);
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  line-height: 1.5;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  -webkit-font-smoothing: antialiased;
  box-sizing: border-box;
}

/* Même police que le corps : les navigateurs appliquent souvent une autre font aux champs natifs */
button,
input,
select,
textarea {
  font-family: var(--font);
}

.container {
  width: 100%;
  max-width: 100%;
  margin-left: auto;
  margin-right: auto;
  /* Même retrait latéral léger que la zone principale app */
  padding-left: 1rem;
  padding-right: 1rem;
  box-sizing: border-box;
}

.site-header {
  position: sticky;
  top: 0;
  z-index: 200;
  background: var(--header-bg);
  border-bottom: 1px solid var(--border);
  padding: 0.75rem 0;
  box-shadow: var(--shadow-sm);
  /* Réduit les micro-décalages au scroll (couche de composition dédiée) */
  isolation: isolate;
  -webkit-backface-visibility: hidden;
  backface-visibility: hidden;
}

.header-inner {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  flex-wrap: wrap;
  gap: 1rem;
}

.header-inner .logo {
  flex-shrink: 0;
}

/* Liens principaux centrés dans l’espace entre logo et bloc compte */
.header-inner-fill {
  flex: 1 1 auto;
  display: flex;
  justify-content: center;
  align-items: center;
  min-width: 0;
}

.header-inner-user {
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.5rem 0.85rem;
}

.logo {
  font-weight: 700;
  font-size: 1.35rem;
  text-decoration: none;
  letter-spacing: -0.04em;
  display: inline-flex;
  align-items: center;
  line-height: 0;
}

.logo-img {
  height: 60px;
  width: auto;
  max-width: min(300px, 50vw);
  object-fit: contain;
  display: block;
}

.logo--has-image:hover .logo-img {
  opacity: 0.88;
}

.logo-img--hero {
  height: auto;
  max-height: 4.875rem;
  max-width: min(420px, 85vw);
  vertical-align: middle;
}

.hero-heading .hero-brand {
  display: inline-block;
  vertical-align: middle;
}

.logo-img--footer {
  height: 1.35rem;
  max-width: 120px;
  vertical-align: text-bottom;
  margin-right: 0.15rem;
}

.footer-brand-line {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;
  gap: 0.35rem 0.5rem;
  width: 100%;
}

.logo-brand {
  display: inline;
  white-space: nowrap;
}

.logo-doc {
  color: var(--brand-doc);
}

.logo-ia {
  color: var(--brand-ia);
}

.logo:hover .logo-doc {
  color: var(--brand-doc-hover);
}

.logo:hover .logo-ia {
  color: var(--brand-ia-hover);
}

/* Même marque hors lien (titres, pied de page) */
h1 .logo-doc,
.site-footer .logo-doc {
  color: var(--brand-doc);
}

h1 .logo-ia,
.site-footer .logo-ia {
  color: var(--brand-ia);
}

.nav {
  display: flex;
  align-items: center;
  gap: 1rem;
  flex-wrap: wrap;
}

.nav a {
  color: var(--muted);
  text-decoration: none;
  font-size: 1.05rem;
}

.nav a:hover {
  color: var(--text);
}

.nav > a.is-active,
.nav > a[aria-current="page"] {
  color: var(--theme);
  font-weight: 700;
  text-decoration: underline;
  text-decoration-thickness: 2px;
  text-underline-offset: 0.28em;
  text-decoration-skip-ink: auto;
}

.nav .nav-dropdown__summary.is-active {
  color: var(--theme);
  font-weight: 700;
  text-decoration: underline;
  text-decoration-thickness: 2px;
  text-underline-offset: 0.28em;
  text-decoration-skip-ink: auto;
}

.nav .nav-dropdown__list a.is-active,
.nav .nav-dropdown__list a[aria-current="page"] {
  color: var(--theme);
  font-weight: 700;
  background: rgba(22, 139, 205, 0.09);
  text-decoration: underline;
  text-decoration-thickness: 2px;
  text-underline-offset: 0.2em;
  text-decoration-skip-ink: auto;
}

/* Visiteur : Connexion + Créer un compte */
.nav-guest {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  flex-wrap: wrap;
  padding: 0.2rem;
  margin: -0.2rem;
}

.nav-guest .nav-link-login {
  display: inline-flex;
  align-items: center;
  font-size: 1.03rem;
  font-weight: 500;
  color: var(--text);
  text-decoration: none;
  padding: 0.55rem 1rem;
  border-radius: 8px;
  border: 1px solid transparent;
  transition: background 0.15s ease, color 0.15s ease, border-color 0.15s ease;
}

.nav-guest .nav-link-login:hover {
  background: var(--surface);
  color: var(--accent);
  border-color: var(--border);
}

.nav-guest .btn-nav-signup {
  padding: 0.55rem 1.15rem;
  font-size: 1.03rem;
  font-weight: 600;
  border-radius: 8px;
  box-shadow: 0 1px 3px rgba(22, 139, 205, 0.28);
  white-space: nowrap;
}

.nav-guest .btn-nav-signup:hover {
  box-shadow: 0 2px 8px rgba(22, 139, 205, 0.4);
}

.user-name {
  font-size: 0.95rem;
  color: var(--muted);
}

.user-name--link {
  text-decoration: none;
  color: var(--text);
}

.user-name--link:hover {
  color: var(--theme);
}

.site-header .nav .btn {
  font-size: 1.05rem;
}

.main {
  flex: 1;
  width: 100%;
  max-width: 100%;
  padding: 2rem 0;
  box-sizing: border-box;
}

.site-footer {
  border-top: 1px solid var(--border);
  padding: 1.5rem 0;
  color: var(--muted);
  font-size: 0.875rem;
  width: 100%;
  box-sizing: border-box;
}

.site-footer .container {
  text-align: center;
}

.site-footer p {
  margin: 0;
}

h1 {
  font-size: 1.75rem;
  font-weight: 600;
  margin: 0 0 0.5rem;
}

.lead {
  color: var(--muted);
  margin: 0 auto 2rem;
  max-width: min(52ch, 100%);
  box-sizing: border-box;
}

.card {
  background: var(--surface-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.5rem;
  margin-bottom: 1.5rem;
  box-shadow: var(--shadow-sm);
}

.card h2 {
  margin: 0 0 1rem;
  font-size: 1.15rem;
}

.card-text-muted {
  color: var(--muted);
  margin: 0;
  line-height: 1.6;
}

/* Pages connexion / inscription : bloc centré */
.page-auth {
  display: flex;
  flex-direction: column;
  align-items: center;
  width: 100%;
  max-width: 100%;
  box-sizing: border-box;
}

.page-auth > h1,
.page-auth > .lead {
  text-align: center;
  width: 100%;
}

.page-auth > .lead {
  margin-left: auto;
  margin-right: auto;
}

.page-auth .alert {
  width: 100%;
  max-width: min(420px, 100%);
  box-sizing: border-box;
}

.page-auth--wide .alert {
  max-width: min(480px, 100%);
}

.page-auth .card--auth {
  width: 100%;
  max-width: min(420px, 100%);
  box-sizing: border-box;
}

.page-auth--wide .card--auth {
  max-width: min(480px, 100%);
  box-shadow: 0 2px 12px rgba(22, 139, 205, 0.1);
}

/* Cartes contenant un formulaire : fond thème + 80 % blanc */
.card--auth,
.card:has(> form) {
  background: var(--form-surface);
  border-color: var(--form-border);
}

.page-auth .card--auth form {
  text-align: left;
}

.auth-footer-link {
  margin: 1rem 0 0;
  font-size: 0.9rem;
  color: var(--muted);
  text-align: center;
}

.auth-footer-link a {
  color: var(--accent);
}

.auth-help-db {
  margin: 1rem 0 0;
  padding-top: 1rem;
  border-top: 1px solid var(--border);
  font-size: 0.85rem;
  text-align: center;
  color: var(--muted);
}

.auth-help-db a {
  color: var(--accent);
  font-weight: 500;
}

.auth-help-db-hint {
  display: inline;
}

.auth-success-actions {
  text-align: center;
  margin: 1rem 0 0;
}

.btn--block {
  width: 100%;
  text-align: center;
}

/* Accueil public : sections éditoriales sans panneaux (variante landing du partial À propos) */
.home-landing-apropos {
  margin-top: 0.5rem;
  margin-bottom: 2.5rem;
  width: 100%;
}

.home-landing-apropos .home-land-block {
  background: transparent;
  border: none;
  box-shadow: none;
  padding: 0;
  margin: 0 0 2.75rem;
  overflow: visible;
}

.home-landing-apropos .home-land-block__header {
  text-align: center;
  max-width: 40rem;
  margin: 0 auto 1.85rem;
  padding: 0 0.35rem;
}

.home-landing-apropos .home-land-eyebrow {
  display: block;
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  color: var(--theme);
  margin: 0 0 0.45rem;
}

.home-landing-apropos .home-land-heading {
  font-size: clamp(1.4rem, 3.8vw, 1.95rem);
  font-weight: 800;
  letter-spacing: -0.035em;
  line-height: 1.18;
  color: var(--text);
  margin: 0;
}

.home-landing-apropos .home-land-heading::after {
  content: '';
  display: block;
  width: 3rem;
  height: 3px;
  margin: 0.85rem auto 0;
  border-radius: 999px;
  background: linear-gradient(90deg, var(--theme), color-mix(in srgb, var(--brand-ia) 78%, var(--theme) 22%));
}

@supports not (background: color-mix(in srgb, red 1%, blue)) {
  .home-landing-apropos .home-land-heading::after {
    background: linear-gradient(90deg, var(--theme), #e8956b);
  }
}

.home-landing-apropos .home-land-lead {
  margin: 0.85rem auto 0;
  max-width: 34rem;
  font-size: 0.98rem;
  line-height: 1.55;
  color: var(--muted);
}

.home-landing-apropos .home-land-block__body {
  padding: 0;
}

.home-landing-apropos .home-land-block__body.info-prose {
  padding: 0;
  font-size: 0.97rem;
}

.home-landing-apropos .home-land-intro {
  border: none;
  box-shadow: none;
  padding: 0;
  margin: 0;
  background: transparent;
}

.home-landing-apropos .home-land-intro .apropos-intro__masthead {
  justify-content: center;
  gap: 1.35rem 1.75rem;
}

.home-landing-apropos .home-land-intro .apropos-intro__brand {
  box-shadow: 0 4px 18px color-mix(in srgb, var(--theme) 12%, transparent);
}

@supports not (color: color-mix(in srgb, red 1%, blue)) {
  .home-landing-apropos .home-land-intro .apropos-intro__brand {
    box-shadow: 0 4px 18px rgba(22, 139, 205, 0.12);
  }
}

.home-landing-apropos .home-land-intro .apropos-intro__copy {
  text-align: left;
}

@media (min-width: 720px) {
  .home-landing-apropos .home-land-intro .apropos-intro__copy {
    font-size: 0.98rem;
  }
}

/* Bloc « Découvrir » + bloc « Sécurité » : même enveloppe (dégradé, bordure arrondie) */
.home-landing-apropos .home-land-block--intro,
.home-landing-apropos .home-land-block--trust {
  margin-bottom: 2.5rem;
  padding: 2.15rem 1rem 1.85rem;
  border-radius: 16px;
  border: 1px solid color-mix(in srgb, var(--theme) 18%, var(--border));
  background: linear-gradient(
    168deg,
    color-mix(in srgb, var(--theme) 9%, var(--surface)) 0%,
    var(--bg) 38%,
    color-mix(in srgb, var(--brand-ia) 7%, var(--surface)) 100%
  );
  box-shadow: 0 1px 0 rgba(255, 255, 255, 0.65) inset;
}

.home-landing-apropos .home-land-block--intro {
  margin-top: 0.35rem;
}

.home-landing-apropos .home-land-block--trust {
  margin-top: 0.5rem;
}

@supports not (background: color-mix(in srgb, red 1%, blue)) {
  .home-landing-apropos .home-land-block--intro,
  .home-landing-apropos .home-land-block--trust {
    border-color: #b8d9f0;
    background: linear-gradient(168deg, #e8f4fb 0%, #fff 40%, #faf6f0 100%);
  }
}

.home-landing-apropos .home-land-block--intro .home-land-block__header,
.home-landing-apropos .home-land-block--trust .home-land-block__header {
  margin-bottom: 1.35rem;
}

.home-landing-apropos .home-land-trust-grid {
  padding: 0.35rem 0 0;
  gap: 1.1rem;
}

@media (min-width: 860px) {
  .home-landing-apropos .home-land-trust-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

.home-landing-apropos .home-land-trust-grid .apropos-trust-card {
  border-radius: 14px;
  border: 1px solid color-mix(in srgb, var(--border) 85%, var(--trust-accent, var(--theme)) 15%);
  box-shadow: 0 2px 10px rgba(15, 23, 42, 0.05);
  transition:
    box-shadow 0.18s ease,
    transform 0.18s ease,
    border-color 0.18s ease;
}

@supports not (border-color: color-mix(in srgb, red 1%, blue)) {
  .home-landing-apropos .home-land-trust-grid .apropos-trust-card {
    border-color: var(--form-border);
  }
}

.home-landing-apropos .home-land-trust-grid .apropos-trust-card:hover {
  transform: translateY(-2px);
  box-shadow:
    0 4px 16px rgba(15, 23, 42, 0.07),
    0 0 0 1px color-mix(in srgb, var(--trust-accent, var(--theme)) 22%, transparent);
}

@supports not (color: color-mix(in srgb, red 1%, blue)) {
  .home-landing-apropos .home-land-trust-grid .apropos-trust-card:hover {
    box-shadow: 0 4px 16px rgba(15, 23, 42, 0.08);
  }
}

.home-landing-apropos .home-land-block--real {
  margin-bottom: 1.5rem;
}

.home-landing-apropos .home-land-real {
  border: 1px solid var(--form-border);
  border-left-width: 4px;
  border-left-color: color-mix(in srgb, var(--brand-ia) 45%, var(--theme));
  border-radius: 14px;
  padding: 1.35rem 1.3rem 1.4rem;
  background: linear-gradient(165deg, var(--form-surface) 0%, var(--bg) 52%, color-mix(in srgb, var(--brand-ia) 5%, var(--bg) 95%) 100%);
  box-shadow: var(--shadow-sm);
}

@supports not (background: color-mix(in srgb, red 1%, blue)) {
  .home-landing-apropos .home-land-real {
    border-left-color: #168bcd;
    background: linear-gradient(165deg, var(--form-surface) 0%, #fff 50%, #fff9f4 100%);
  }
}

/* Titres « Réalisation » intégrés dans la carte Antibia (accueil) */
.home-landing-apropos .home-land-real__head {
  text-align: center;
  margin: 0 0 1.35rem;
  padding: 0 0.25rem;
}

.home-landing-apropos .home-land-real__head .home-land-eyebrow {
  margin-bottom: 0.42rem;
}

.home-landing-apropos .home-land-real__head .home-land-heading::after {
  margin-top: 0.7rem;
}

.home-landing-apropos .info-version--landing {
  margin-top: 1.75rem;
  padding-top: 1rem;
  border-top: 1px dashed var(--border);
}

.grid {
  display: grid;
  gap: clamp(1rem, 2vw, 1.75rem);
  width: 100%;
}

@media (min-width: 640px) {
  .grid-2 {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

.form-group {
  margin-bottom: 1rem;
}

.form-group label {
  display: block;
  font-size: 0.875rem;
  color: var(--muted);
  margin-bottom: 0.35rem;
}

.form-group input,
.form-group select,
.form-group textarea {
  width: 100%;
  padding: 0.65rem 0.85rem;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #ffffff;
  color: var(--text);
  font-family: var(--font);
  font-size: 1rem;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
  outline: none;
  border-color: var(--theme);
  box-shadow: 0 0 0 3px rgba(22, 139, 205, 0.22);
}

.btn {
  display: inline-block;
  padding: 0.6rem 1.1rem;
  border-radius: 8px;
  font-size: 0.95rem;
  font-weight: 500;
  text-decoration: none;
  border: none;
  cursor: pointer;
  font-family: inherit;
}

.btn-primary,
button.btn-primary,
a.btn-primary {
  background: var(--theme);
  background: var(--accent);
  color: #fff;
}

.btn-primary:hover,
button.btn-primary:hover,
a.btn-primary:hover {
  background: var(--accent-hover);
  color: #fff;
}

.btn-primary:disabled,
button.btn-primary:disabled,
a.btn-primary:disabled {
  background: var(--muted);
  color: rgba(255, 255, 255, 0.85);
  cursor: not-allowed;
  opacity: 0.65;
}

.btn-primary:disabled:hover,
button.btn-primary:disabled:hover,
a.btn-primary:disabled:hover {
  background: var(--muted);
  color: rgba(255, 255, 255, 0.85);
}

.btn-ghost {
  background: transparent;
  color: var(--muted);
  border: 1px solid var(--border);
}

.btn-ghost:hover {
  color: var(--text);
  border-color: var(--muted);
}

.alert {
  padding: 0.85rem 1rem;
  border-radius: 8px;
  margin-bottom: 1rem;
  font-size: 0.95rem;
}

.alert-error {
  background: #fef2f2;
  border: 1px solid #fecaca;
  color: #991b1b;
}

.alert-success {
  background: #f0fdf4;
  border: 1px solid #bbf7d0;
  color: #166534;
}

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

/* Supervision : en-têtes de tableau triables */
.supervision-users-table thead th.supervision-th--sortable {
  cursor: pointer;
  user-select: none;
  white-space: nowrap;
}

.supervision-users-table thead th.supervision-th--sortable:hover,
.supervision-users-table thead th.supervision-th--sortable:focus-visible {
  color: var(--text);
  outline: none;
}

.supervision-users-table thead th[aria-sort="ascending"]::after {
  content: " \2191";
  font-size: 0.85em;
  opacity: 0.75;
}

.supervision-users-table thead th[aria-sort="descending"]::after {
  content: " \2193";
  font-size: 0.85em;
  opacity: 0.75;
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9rem;
}

th,
td {
  text-align: left;
  padding: 0.65rem 0.75rem;
  border-bottom: 1px solid var(--border);
}

th {
  color: var(--muted);
  font-weight: 500;
}

.hero {
  text-align: center;
  padding: 3rem 0 2rem;
  width: 100%;
  max-width: 100%;
  box-sizing: border-box;
}

.hero h1 {
  font-size: clamp(1.5rem, 3vw, 2.25rem);
  line-height: 1.25;
  padding: 0 0.25rem;
}

.hero .lead {
  padding: 0;
  max-width: min(52ch, 100%);
}

.hero p:not(.lead) {
  display: flex;
  justify-content: center;
  flex-wrap: wrap;
  gap: 0.75rem;
  width: 100%;
}

.badge {
  display: inline-block;
  padding: 0.2rem 0.5rem;
  border-radius: 6px;
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
}

.badge-admin {
  background: #fee2e2;
  color: #b91c1c;
}

.badge-superviseur {
  background: #fef9c3;
  color: #a16207;
}

.badge-standard {
  background: var(--form-surface);
  color: #0c4a6e;
}

.dropzone {
  border: 2px dashed var(--border);
  border-radius: var(--radius);
  padding: 2rem;
  text-align: center;
  color: var(--muted);
}

.dropzone strong {
  color: var(--text);
}

/* Sauvegarde (code + données) */
.sauvegarde-layout {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.25rem;
  align-items: start;
  margin-top: 1.25rem;
}

@media (max-width: 768px) {
  .sauvegarde-layout {
    grid-template-columns: 1fr;
  }
}

.sauvegarde-panel h2 {
  margin-top: 0;
  font-size: 1.05rem;
}

.sauvegarde-hint {
  font-size: 0.88rem;
  color: var(--muted);
  line-height: 1.45;
  margin-bottom: 1rem;
}

.sauvegarde-panel form {
  margin-top: 0.5rem;
}

/* Pages admin (diagnostic, structure, données) */
.admin-diagnostics .card h2 {
  margin-top: 0;
  font-size: 1.05rem;
}

table.admin-kv th {
  width: 38%;
  vertical-align: top;
  color: var(--muted);
  font-weight: 500;
}

table.admin-kv th,
table.admin-kv td {
  word-break: break-word;
}

.admin-details {
  margin-top: 1rem;
}

.admin-details summary {
  cursor: pointer;
  color: var(--accent);
  font-size: 0.9rem;
}

.admin-sql {
  margin: 0.75rem 0 0;
  padding: 1rem;
  background: var(--surface);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 8px;
  overflow-x: auto;
  font-size: 0.75rem;
  line-height: 1.45;
  white-space: pre-wrap;
  word-break: break-word;
}

.admin-note {
  margin-top: 1.5rem;
  font-size: 0.875rem;
  color: var(--muted);
}

.admin-cout-ia-lead {
  margin: 0 0 0.65rem;
  font-size: 0.88rem;
  color: var(--muted);
}

.admin-cout-ia-summary {
  margin: 0 0 0.5rem;
  font-size: 0.88rem;
  color: var(--text);
}

.admin-cout-ia__table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.82rem;
}

.admin-cout-ia__table th,
.admin-cout-ia__table td {
  padding: 0.35rem 0.45rem;
  border-bottom: 1px solid var(--border);
  text-align: left;
  vertical-align: top;
}

.admin-cout-ia__table thead th {
  background: var(--form-surface, #e2e8f0);
  font-weight: 600;
}

.admin-cout-ia__table tfoot th,
.admin-cout-ia__table tfoot td {
  background: #f1f5f9;
  border-top: 2px solid var(--border);
}

.admin-cout-ia__num {
  text-align: right;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

/* Page « Données des tables » : titre + filtres centrés */
.admin-data-toolbar {
  text-align: center;
  margin-bottom: 2rem;
  width: 100%;
  max-width: 100%;
}

.admin-data-toolbar h1 {
  margin-bottom: 0.5rem;
}

.admin-data-toolbar .lead {
  margin-left: auto;
  margin-right: auto;
}

.admin-filter-form {
  max-width: 420px;
  margin-left: auto;
  margin-right: auto;
  text-align: left;
}

.admin-filter-form .admin-filter-submit {
  display: block;
  width: 100%;
  max-width: 220px;
  margin: 0.75rem auto 0;
}

.admin-page-messages {
  max-width: min(520px, 100%);
  margin: 0 auto 1.25rem;
  text-align: center;
}

.admin-page-messages .alert {
  text-align: left;
}

/* Hub Paramètres (admin) */
.dashboard-app-grid--parametres {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 1rem;
  max-width: 720px;
  margin: 0 auto;
}

/* Page Paramètres admin : tableaux référentiels */
.parametres-page-toolbar {
  max-width: min(1400px, 100%);
  margin-left: auto;
  margin-right: auto;
}

.parametres-page-toolbar--plain {
  text-align: left;
}

.parametres-page-toolbar--plain .lead {
  margin-left: 0;
  margin-right: 0;
  max-width: 48rem;
}

.parametres-subnav {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem 0.75rem;
  margin-top: 1rem;
  padding: 0;
}

.parametres-subnav__link {
  display: inline-flex;
  align-items: center;
  padding: 0.4rem 0.85rem;
  font-size: 0.9rem;
  font-weight: 600;
  text-decoration: none;
  color: var(--muted);
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface-elevated);
  transition:
    background 0.15s ease,
    border-color 0.15s ease,
    color 0.15s ease;
}

.parametres-subnav__link:hover {
  color: var(--text);
  border-color: #94a3b8;
}

.parametres-subnav__link.is-active {
  color: #fff;
  background: var(--theme);
  border-color: var(--theme);
}

.parametres-subnav--tabs {
  gap: 0.5rem;
}

.parametres-subnav--tabs .parametres-subnav__link {
  padding: 0.5rem 1rem;
  font-size: 0.95rem;
  border-radius: 10px;
}

.parametres-ref-reorder-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.75rem 1.25rem;
  margin-top: 1rem;
  padding: 0.75rem 1rem;
  background: var(--surface-elevated, #f8fafc);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}

.parametres-ref-reorder-form {
  margin: 0;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.parametres-ref-reorder-hint {
  margin: 0;
  font-size: 0.88rem;
  color: var(--muted);
  flex: 1;
  min-width: 12rem;
}

.admin-ref-table-col-drag {
  width: 2.25rem;
  min-width: 2.25rem;
  padding-left: 0.35rem !important;
  padding-right: 0.35rem !important;
  text-align: center;
}

.admin-ref-table-drag-cell {
  width: 2.25rem;
  min-width: 2.25rem;
  vertical-align: middle;
  text-align: center;
  padding: 0.35rem !important;
  background: #f8fafc;
}

.admin-ref-drag-handle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.75rem;
  height: 1.75rem;
  font-size: 1rem;
  line-height: 1;
  color: var(--muted);
  cursor: grab;
  user-select: none;
  border-radius: 4px;
  letter-spacing: -0.08em;
}

.admin-ref-drag-handle:active {
  cursor: grabbing;
}

.admin-ref-drag-handle:focus-visible {
  outline: 2px solid var(--theme);
  outline-offset: 2px;
}

.admin-ref-table-row-draggable.admin-ref-table-row--dragging {
  opacity: 0.65;
}

.admin-ref-table-row-draggable.admin-ref-table-row--drop-target {
  outline: 2px dashed var(--theme);
  outline-offset: -2px;
}

.admin-ref-drag-muted {
  color: var(--muted);
  display: inline-block;
  min-width: 1.25rem;
  text-align: center;
}

.admin-ref-table-readonly-label {
  font-weight: 600;
}

.admin-ref-table-muted-note {
  display: block;
  font-size: 0.8rem;
  color: var(--muted);
  margin-top: 0.2rem;
}

tr.admin-ref-table-row--reorder-locked .admin-ref-table-drag-cell {
  cursor: default;
}

.admin-ref-sort-btn {
  display: inline;
  margin: 0;
  padding: 0;
  font: inherit;
  font-weight: 600;
  color: inherit;
  background: none;
  border: none;
  cursor: pointer;
  text-align: left;
  text-decoration: underline;
  text-decoration-style: dotted;
  text-underline-offset: 0.2em;
}

.admin-ref-sort-btn:hover {
  color: var(--theme, #2563eb);
}

.admin-ref-sort-btn.is-sorted-asc::after,
.admin-ref-sort-btn.is-sorted-desc::after {
  display: inline-block;
  margin-left: 0.25rem;
  font-size: 0.75em;
  text-decoration: none;
}

.admin-ref-sort-btn.is-sorted-asc::after {
  content: '▲';
}

.admin-ref-sort-btn.is-sorted-desc::after {
  content: '▼';
}

.admin-ref-sort-btn--static {
  display: inline;
  font-weight: 600;
  cursor: default;
  text-decoration: none;
  color: inherit;
}

.admin-page-messages--parametres {
  max-width: min(1400px, 100%);
  margin-left: auto;
  margin-right: auto;
  text-align: left;
}

/* Paramètres : blocs en pleine largeur (sans plafond 1400px) */
main.main--dashboard.main--parametres .parametres-page-toolbar {
  max-width: none;
  width: 100%;
  margin-left: 0;
  margin-right: 0;
}

main.main--dashboard.main--parametres .parametres-ref-page {
  max-width: none;
  width: 100%;
  margin-left: 0;
  margin-right: 0;
  padding-left: 0;
  padding-right: 0;
}

main.main--dashboard.main--parametres .admin-page-messages--parametres {
  max-width: none;
  width: 100%;
  margin-left: 0;
  margin-right: 0;
}

/* Paramètres : mêmes panneaux qu’À propos — cadres explicites (fond zone centrale gris) */
.info-page.parametres-info-page {
  max-width: none;
  width: 100%;
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

@media (max-width: 900px) {
  main.main--dashboard.main--parametres .apropos-page.parametres-apropos-wrap {
    width: 100%;
    max-width: 100%;
    margin-left: 0;
    margin-right: 0;
  }
}

/* Paramètres : occuper la hauteur utile sous le header (tableau qui s’étire) */
main.main--dashboard.main--parametres .dashboard-app {
  min-height: calc(100vh - 5rem);
  align-items: stretch;
}

@media (min-width: 960px) {
  main.main--dashboard.main--parametres .dashboard-app {
    min-height: calc(100vh - 4.25rem);
  }
}

main.main--dashboard.main--parametres .dashboard-main {
  display: flex;
  flex-direction: column;
  min-height: 0;
  flex: 1 1 auto;
}

main.main--dashboard.main--parametres .apropos-page.parametres-apropos-wrap {
  flex: 1 1 auto;
  display: flex;
  flex-direction: column;
  min-height: 0;
  width: 100%;
  max-width: min(1200px, 100%);
  margin-left: auto;
  margin-right: auto;
}

main.main--dashboard.main--parametres .info-page.parametres-info-page {
  flex: 1 1 auto;
  display: flex;
  flex-direction: column;
  min-height: 0;
}

main.main--dashboard.main--parametres .parametres-ref-section--fill {
  flex: 1 1 auto;
  min-height: 0;
  display: flex;
  flex-direction: column;
}

main.main--dashboard.main--parametres .parametres-ref-panel--fill {
  flex: 1 1 auto;
  min-height: 0;
  display: flex;
  flex-direction: column;
}

.parametres-ref-lead--tab {
  margin: 0 0 0.65rem;
  flex-shrink: 0;
}

.parametres-unified-body {
  flex: 1 1 auto;
  min-height: 0;
  display: flex;
  flex-direction: column;
}

.parametres-migration-inner {
  flex-shrink: 0;
}

main.main--dashboard.main--parametres .admin-page-messages--parametres {
  flex-shrink: 0;
  padding: 0 1.35rem;
  margin-top: 0.15rem;
}

.parametres-panel-intro .parametres-subnav--tabs {
  margin-bottom: 0;
}

.parametres-panel-intro {
  padding-bottom: 0.85rem;
}

.parametres-ref-lead {
  margin: 0 0 1rem;
  font-size: 0.92rem;
  line-height: 1.55;
  color: var(--text);
}

.parametres-ref-lead--muted {
  margin-top: -0.35rem;
  font-size: 0.88rem;
  color: var(--muted);
}

tr[data-ref-row-id] .admin-ref-table-drag-cell {
  cursor: grab;
}

tr[data-ref-row-id] .admin-ref-table-drag-cell:active {
  cursor: grabbing;
}

.info-page.parametres-info-page .panel {
  background: #fff;
  border: 1px solid var(--border, #e2e8f0);
  border-radius: var(--radius);
  padding: 0;
  box-shadow: var(--shadow-sm);
  margin-bottom: 1.25rem;
  overflow: hidden;
}

.info-page.parametres-info-page .panel__head {
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: #64748b;
  padding: 0.85rem 1.35rem;
  border-bottom: 1px solid var(--border, #e2e8f0);
  background: #f8fafc;
}

.parametres-migration-footnote {
  font-size: 0.88rem;
  color: var(--muted);
  line-height: 1.55;
  margin-bottom: 0 !important;
}

.parametres-migration-pre {
  margin: 0.5rem 0 0;
  padding: 0.75rem;
  background: var(--form-surface);
  border-radius: var(--radius);
  overflow: auto;
  font-size: 0.85rem;
  line-height: 1.45;
}

.parametres-ref-page {
  max-width: min(1400px, 100%);
  margin: 0 auto;
  padding: 0 0.25rem;
  box-sizing: border-box;
}

/* Entités | Types de document : deux colonnes côte à côte (tableaux) */
.parametres-ref-two-col {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 1.25rem 1.5rem;
  align-items: start;
  width: 100%;
}

@media (max-width: 1024px) {
  .parametres-ref-two-col {
    grid-template-columns: 1fr;
  }
}

.parametres-top-strip {
  margin-bottom: 0.75rem;
}

.parametres-merged-panel {
  display: flex;
  flex-direction: column;
  min-height: 0;
}

main.main--dashboard.main--parametres .parametres-merged-panel.parametres-ref-panel--fill {
  flex: 1 1 auto;
  max-height: none;
}

.parametres-merged-body {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-height: 0;
  padding: 0 1.35rem 1rem;
  box-sizing: border-box;
}

.parametres-merged-toolbar {
  flex-shrink: 0;
  margin-top: 0.75rem;
}

.parametres-merged-table-scroll {
  flex: 1 1 auto;
  min-height: 14rem;
  overflow: auto;
  -webkit-overflow-scrolling: touch;
  border: 1px solid var(--border, #e2e8f0);
  border-radius: var(--radius);
  background: #fff;
  margin-top: 0.65rem;
}

main.main--dashboard.main--parametres .parametres-ref-panel--fill .parametres-merged-table-scroll {
  flex: 1 1 auto;
  min-height: 220px;
  max-height: none;
}

.parametres-merged-table-scroll .admin-ref-table thead th {
  position: sticky;
  top: 0;
  z-index: 3;
  box-shadow: 0 1px 0 #334155;
}

.admin-ref-section-row td {
  background: #e2e8f0;
  color: #334155;
  font-weight: 700;
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  padding: 0.4rem 0.5rem;
  border-bottom: 1px solid var(--border, #cbd5e1);
}

.admin-ref-table-col-nature {
  width: 5.5rem;
  white-space: nowrap;
}

.admin-ref-table-cell-nature {
  vertical-align: middle;
}

.admin-ref-nature-badge {
  display: inline-block;
  font-size: 0.68rem;
  font-weight: 700;
  padding: 0.1rem 0.35rem;
  border-radius: 4px;
  line-height: 1.2;
  white-space: nowrap;
}

.admin-ref-nature-badge--entite {
  background: #dbeafe;
  color: #1e40af;
}

.admin-ref-nature-badge--type {
  background: #ede9fe;
  color: #5b21b6;
}

.parametres-ref-section {
  margin: 0;
  min-width: 0;
}

.parametres-ref-section-title {
  margin: 0 0 0.65rem;
  font-size: 1.125rem;
  font-weight: 700;
  color: var(--text, #0f172a);
  border-bottom: 2px solid var(--border, #e2e8f0);
  padding-bottom: 0.35rem;
}

.parametres-ref-missing {
  margin: 0;
  font-size: 0.9rem;
  color: var(--muted);
}

.admin-ref-table-scroll {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  border: 1px solid var(--border, #e2e8f0);
  border-radius: var(--radius);
  background: #fff;
}

.admin-ref-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.875rem;
  line-height: 1.35;
}

.admin-ref-table thead th {
  text-align: left;
  padding: 0.4rem 0.5rem;
  background: #475569;
  color: #fff;
  font-weight: 600;
  border-bottom: 1px solid #334155;
  white-space: nowrap;
}

.admin-ref-table thead .admin-ref-sort-btn {
  color: #fff;
}

.admin-ref-table thead .admin-ref-sort-btn:hover {
  color: #e2e8f0;
}

.admin-ref-table thead .admin-ref-sort-btn--static {
  color: #fff;
}

.admin-ref-table-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem 0.75rem;
  margin-bottom: 0.65rem;
}

.admin-ref-filter-label {
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--text, #0f172a);
}

.admin-ref-filter-input {
  min-width: 12rem;
  max-width: 24rem;
  flex: 1;
  padding: 0.35rem 0.6rem;
  font: inherit;
  border: 1px solid var(--form-border, #cbd5e1);
  border-radius: var(--radius, 6px);
  background: #fff;
}

.admin-ref-table tbody td {
  padding: 0.3rem 0.5rem;
  border-bottom: 1px solid var(--border, #e2e8f0);
  vertical-align: middle;
}

.admin-ref-table tbody tr:last-child td {
  border-bottom: none;
}

.admin-ref-table-row-add {
  background: #f8fafc;
}

.admin-ref-table-row-add td {
  border-bottom: 1px solid #cbd5e1;
}

.admin-ref-table-input {
  width: 100%;
  min-width: 7rem;
  max-width: 100%;
  box-sizing: border-box;
  padding: 0.28rem 0.45rem;
  font: inherit;
  border: 1px solid var(--form-border, #cbd5e1);
  border-radius: 4px;
  background: #fff;
}

.admin-ref-table-input--num {
  min-width: 4rem;
  max-width: 5.5rem;
}

.admin-ref-table-col-narrow {
  width: 5.5rem;
}

.admin-ref-table-col-actions {
  width: 1%;
  white-space: nowrap;
}

.admin-ref-table-cell-muted {
  color: var(--muted);
  text-align: center;
}

.admin-ref-table-cell-center {
  text-align: center;
}

.admin-ref-table-check-label {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  margin: 0;
  line-height: 1;
}

.admin-ref-table-check-label input[type="checkbox"]:not(.documents-doc-check) {
  margin: 0;
  width: 1.05rem;
  height: 1.05rem;
}

.admin-ref-table-empty {
  text-align: center;
  color: var(--muted);
  font-style: italic;
  padding: 0.65rem 0.5rem !important;
}

.admin-ref-table-actions {
  display: flex;
  flex-direction: row;
  flex-wrap: nowrap;
  align-items: center;
  justify-content: flex-start;
  gap: 0.35rem;
  white-space: nowrap;
}

.admin-ref-table-inline-form {
  display: block;
  flex: 0 0 auto;
  margin: 0;
}

.admin-ref-btn-danger {
  color: #b91c1c !important;
}

.param-card-link {
  display: block;
  text-decoration: none;
  color: inherit;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.param-card-link:hover {
  border-color: var(--primary, #2563eb);
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.07);
}

.param-card-title {
  margin: 0 0 0.5rem;
  font-size: 1.1rem;
}

.param-card-cta {
  display: inline-block;
  margin-top: 0.75rem;
  font-size: 0.9rem;
  color: var(--accent, #2563eb);
  font-weight: 600;
}

/* Admin — utilisateurs : liste + fiche (bandes) */
.admin-users-toolbar {
  text-align: left;
  max-width: 1200px;
  margin-left: auto;
  margin-right: auto;
}

.admin-users-toolbar .lead {
  margin-left: 0;
  max-width: 40rem;
}

.admin-page-messages--users {
  max-width: 1200px;
  margin-left: auto;
  margin-right: auto;
  text-align: left;
}

.admin-users-split {
  display: grid;
  grid-template-columns: minmax(240px, 320px) 1fr;
  gap: 1.5rem;
  align-items: start;
  max-width: 1200px;
  margin: 0 auto;
  min-height: min(70vh, 720px);
}

@media (max-width: 900px) {
  .admin-users-split {
    grid-template-columns: 1fr;
  }
}

.admin-users-list-panel {
  position: sticky;
  top: 0.75rem;
  border: 1px solid var(--border, #e2e8f0);
  border-radius: var(--radius);
  background: #fff;
  padding: 0.75rem;
  max-height: min(75vh, 640px);
  display: flex;
  flex-direction: column;
  min-height: 0;
}

.admin-users-btn-new {
  width: 100%;
  margin-bottom: 0.65rem;
}

.admin-users-list {
  list-style: none;
  margin: 0;
  padding: 0;
  overflow-y: auto;
  flex: 1;
}

.admin-users-list li {
  margin: 0;
  padding: 0;
}

.admin-users-list-item {
  display: block;
  width: 100%;
  text-align: left;
  padding: 0.55rem 0.6rem;
  margin: 0 0 0.35rem;
  border: 1px solid transparent;
  border-radius: 6px;
  background: #f8fafc;
  font: inherit;
  cursor: pointer;
  color: inherit;
  transition: background 0.12s ease, border-color 0.12s ease;
}

.admin-users-list-item:hover {
  background: #f1f5f9;
  border-color: #cbd5e1;
}

.admin-users-list-item[aria-current="true"] {
  background: #eff6ff;
  border-color: #93c5fd;
  box-shadow: 0 0 0 1px #bfdbfe;
}

.admin-users-list-item-name {
  display: block;
  font-weight: 600;
  font-size: 0.9rem;
}

.admin-users-list-item-email {
  display: block;
  font-size: 0.78rem;
  color: var(--muted);
  word-break: break-all;
}

.admin-users-list-item-role {
  display: block;
  font-size: 0.72rem;
  color: #64748b;
  margin-top: 0.15rem;
}

.admin-users-detail-panel {
  border: 1px solid var(--border, #e2e8f0);
  border-radius: var(--radius);
  background: #fff;
  padding: 1rem 1.15rem 1.25rem;
  min-width: 0;
}

.admin-users-detail-heading {
  margin: 0 0 0.35rem;
  font-size: 1.2rem;
  font-weight: 700;
}

.admin-users-detail-hint {
  margin: 0 0 1rem;
  font-size: 0.88rem;
  color: var(--muted);
}

.admin-user-bands {
  border: 1px solid var(--border, #e2e8f0);
  border-radius: var(--radius);
  overflow: hidden;
  margin-bottom: 1rem;
}

/* display:grid sur .admin-user-band masquait l’attribut HTML hidden (les deux paires mots de passe s’affichaient). */
.admin-user-band[hidden] {
  display: none !important;
}

.admin-user-band {
  display: grid;
  grid-template-columns: minmax(7rem, 11rem) 1fr;
  align-items: center;
  gap: 0.75rem 1rem;
  padding: 0.6rem 0.85rem;
  border-bottom: 1px solid var(--border, #e2e8f0);
}

.admin-user-band:last-child {
  border-bottom: none;
}

.admin-user-band:nth-child(odd) {
  background: #f8fafc;
}

.admin-user-band:nth-child(even) {
  background: #fff;
}

.admin-user-band label {
  margin: 0;
  font-size: 0.85rem;
  font-weight: 600;
  color: #475569;
}

.admin-user-band input[type="text"],
.admin-user-band input[type="email"],
.admin-user-band input[type="password"],
.admin-user-band select {
  width: 100%;
  max-width: 100%;
  box-sizing: border-box;
  padding: 0.4rem 0.55rem;
  font: inherit;
  border: 1px solid var(--form-border, #cbd5e1);
  border-radius: 4px;
  background: #fff;
}

.admin-user-band--muted .admin-user-band-field input {
  background: #fafafa;
}

.admin-user-band-field {
  min-width: 0;
}

.admin-user-band--actif .admin-user-band-field {
  justify-self: start;
}

.admin-users-form-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.admin-users-form-actions--split {
  align-items: center;
  justify-content: flex-start;
}

.admin-users-impersonate-form {
  margin-top: 0.75rem;
}

.docia-impersonation-banner {
  margin: 0;
  padding: 0.55rem 1rem;
  background: linear-gradient(90deg, #7c5e10 0%, #a67c00 100%);
  color: #fffbeb;
  border-bottom: 1px solid rgba(0, 0, 0, 0.12);
}

.docia-impersonation-banner__inner {
  margin: 0;
  max-width: min(1200px, 100%);
  margin-inline: auto;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.65rem 1rem;
  font-size: 0.9rem;
  line-height: 1.35;
}

.docia-impersonation-banner__text {
  flex: 1 1 12rem;
}

.docia-impersonation-banner__revert {
  flex-shrink: 0;
  background: #fff;
  color: #713f12;
  border-color: rgba(255, 255, 255, 0.85);
}

.docia-impersonation-banner__revert:hover {
  background: #fffef5;
  color: #422006;
}

@media (max-width: 560px) {
  .admin-user-band {
    grid-template-columns: 1fr;
    gap: 0.35rem;
  }
}

.admin-create-user-card {
  max-width: min(480px, 100%);
  margin: 0 auto 2rem;
  text-align: center;
  background: var(--form-surface);
  border-color: var(--form-border);
}

.admin-create-user-card h2 {
  margin-top: 0;
}

.admin-create-user-form {
  text-align: left;
  margin-top: 1rem;
}

.admin-data-wrap {
  max-height: min(70vh, 560px);
  overflow: auto;
}

.admin-data-wrap th,
.admin-data-wrap td {
  font-size: 0.8rem;
  max-width: 280px;
}

.null-cell {
  color: var(--muted);
  font-style: normal;
}

/* ——— Style type Zeendoc : en-tête app + tableau de bord ——— */
.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.site-header--app {
  padding: 0.65rem 0;
}

.site-header--app .logo-img {
  height: 54px;
  max-width: min(280px, 52vw);
}

.header-app {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 1rem 1.5rem;
}

.header-app-left {
  display: flex;
  align-items: center;
  gap: 1rem;
  flex-wrap: wrap;
}

.header-context-select {
  min-width: 14rem;
  max-width: min(22rem, 92vw);
  padding: 0.45rem 2rem 0.45rem 0.65rem;
  font-size: 0.98rem;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface);
  color: var(--text);
  cursor: pointer;
}

.header-app-right {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.65rem 1rem;
}

.nav-app-links {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem 1rem;
}

.nav-app-links a {
  color: var(--muted);
  text-decoration: none;
  font-size: 1rem;
}

.nav-app-links a:hover {
  color: var(--theme);
}

.nav-app-links > a.is-active,
.nav-app-links > a[aria-current="page"] {
  color: var(--theme);
  font-weight: 700;
  text-decoration: underline;
  text-decoration-thickness: 2px;
  text-underline-offset: 0.28em;
  text-decoration-skip-ink: auto;
}

.nav-dropdown--app .nav-dropdown__summary.is-active {
  color: var(--theme);
  font-weight: 700;
  text-decoration: underline;
  text-decoration-thickness: 2px;
  text-underline-offset: 0.28em;
  text-decoration-skip-ink: auto;
}

.nav-dropdown--app[open] > .nav-dropdown__summary.is-active {
  color: var(--theme);
}

.nav-dropdown--app .nav-dropdown__list a.is-active,
.nav-dropdown--app .nav-dropdown__list a[aria-current="page"] {
  color: var(--theme);
  font-weight: 700;
  background: rgba(22, 139, 205, 0.09);
  text-decoration: underline;
  text-decoration-thickness: 2px;
  text-underline-offset: 0.2em;
  text-decoration-skip-ink: auto;
}

/* Sous-menu Admin (header app + nav par défaut) */
.nav-dropdown {
  position: relative;
  align-self: center;
}

.nav-dropdown__summary {
  list-style: none;
  cursor: pointer;
  color: var(--muted);
  font-size: 1rem;
  font-weight: 700;
  user-select: none;
}

.nav-dropdown__summary::-webkit-details-marker {
  display: none;
}

.nav-dropdown__summary::marker {
  content: "";
}

.nav-dropdown__summary:hover {
  color: var(--theme);
}

.nav-dropdown[open] > .nav-dropdown__summary {
  color: var(--theme);
}

.nav-dropdown__list {
  position: absolute;
  right: 0;
  top: calc(100% + 0.35rem);
  min-width: 12rem;
  margin: 0;
  padding: 0.35rem 0;
  list-style: none;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.1);
  z-index: 50;
}

.nav-dropdown__list li {
  margin: 0;
}

.nav-dropdown__list a {
  display: block;
  padding: 0.45rem 0.85rem;
  color: var(--text);
  text-decoration: none;
  font-size: 1rem;
}

.nav-dropdown__list a:hover {
  background: rgba(0, 0, 0, 0.04);
  color: var(--theme);
}

.nav .nav-dropdown__summary {
  font-size: 1.05rem;
  font-weight: 700;
}

.nav .nav-dropdown__list a {
  font-size: 1.05rem;
}

.header-app-icon-link {
  font-size: 1rem;
  color: var(--muted);
  text-decoration: none;
  white-space: nowrap;
}

.header-app-icon-link:hover {
  color: var(--theme);
}

.header-app-icon-link--muted {
  cursor: default;
  opacity: 0.75;
}

.header-app-icon-text {
  margin-left: 0.15rem;
}

.header-ia-dropdown {
  position: relative;
  align-self: center;
}

.header-ia-dropdown__summary {
  list-style: none;
  cursor: pointer;
  font-size: 1rem;
  color: var(--muted);
  padding: 0.25rem 0.55rem;
  border-radius: var(--radius);
  user-select: none;
}

.header-ia-dropdown__summary::-webkit-details-marker {
  display: none;
}

.header-ia-dropdown__summary:hover {
  color: var(--theme);
}

.header-ia-dropdown[open] > .header-ia-dropdown__summary {
  color: var(--theme);
}

.header-ia-dropdown__panel {
  position: absolute;
  right: 0;
  top: calc(100% + 0.35rem);
  z-index: 200;
  width: min(18.5rem, 92vw);
  padding: 1rem;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-md);
}

.header-ia-form__group {
  margin-bottom: 0.75rem;
}

.header-ia-form__group label {
  display: block;
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--muted);
  margin-bottom: 0.35rem;
}

.header-ia-form__input,
.header-ia-form__select {
  width: 100%;
  font-size: 0.85rem;
  box-sizing: border-box;
}

.header-ia-form__hint {
  font-size: 0.78rem;
  color: var(--muted);
  margin: 0.35rem 0 0;
  line-height: 1.4;
}

.header-ia-form__clear {
  font-size: 0.78rem;
  display: block;
  margin-top: 0.45rem;
}

.header-ia-form__actions {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex-wrap: wrap;
  margin-top: 0.25rem;
}

.header-ia-form__more {
  font-size: 0.8rem;
}

.ia-page-head {
  margin-bottom: 1.25rem;
}

/* Page complète Analyse IA */
.ia-page {
  max-width: min(1100px, 100%);
  margin: 0 auto;
  padding: 0 0.5rem 1rem;
  box-sizing: border-box;
}

/* Page IA : pleine largeur utile */
.ia-page.ia-page--wide {
  max-width: 100%;
  width: 100%;
  margin: 0;
  padding: 0 12px 1rem;
  box-sizing: border-box;
}

main.main--dashboard.main--ia-page .ia-page.ia-page--wide {
  padding-left: 0;
  padding-right: 0;
}

.ia-page-title {
  margin: 0;
  font-size: 1.35rem;
  font-weight: 700;
}

.ia-page-status {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 0.45rem 0.65rem;
  background: #f8fafc;
}

.ia-page-status--ok {
  border-color: #86efac;
  background: #f0fdf4;
}

.ia-page-status--warn {
  border-color: #fcd34d;
  background: #fffbeb;
}

.ia-page-status-label {
  display: block;
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: #64748b;
  margin-bottom: 0.25rem;
}

.ia-page-status-value {
  display: block;
  font-weight: 700;
  font-size: 1.05rem;
}

.ia-page-status-detail {
  display: block;
  margin-top: 0.25rem;
  font-size: 0.75rem;
  color: var(--muted);
  line-height: 1.35;
}

.ia-page-migrate {
  margin-bottom: 1rem;
}

.ia-page-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(240px, 320px);
  gap: 1rem;
  align-items: start;
}

@media (max-width: 900px) {
  .ia-page-grid {
    grid-template-columns: 1fr;
  }
}

.ia-page-panel {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: #fff;
  padding: 0.65rem 0.75rem;
  min-width: 0;
}

.ia-page-panel--solo {
  max-width: 100%;
}

.ia-page-section-title {
  margin: 0 0 0.5rem;
  font-size: 1rem;
  font-weight: 700;
  padding-bottom: 0.3rem;
  border-bottom: 1px solid var(--border);
}

.ia-band {
  display: grid;
  grid-template-columns: minmax(6rem, 9rem) 1fr;
  gap: 0.5rem 0.75rem;
  align-items: start;
  padding: 0.35rem 0;
  border-bottom: 1px solid var(--border);
}

.ia-band:last-of-type {
  border-bottom: none;
}

/* Bloc « Modèle » : libellé au-dessus du select + tableau (évite le chevauchement grille 2 colonnes) */
.ia-band--stack {
  grid-template-columns: 1fr;
}

.ia-band--stack .ia-band-label {
  padding-top: 0;
}

.ia-band-hint--before-table {
  margin-bottom: 0.35rem;
}

.ia-band-hint--model-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem 0.75rem;
}

.ia-model-picker-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.65rem 1rem;
  margin-bottom: 0.75rem;
}

.ia-model-picker-label {
  font-size: 0.9rem;
  font-weight: 600;
  color: #334155;
  margin: 0;
}

.ia-model-select {
  flex: 1 1 16rem;
  min-width: 12rem;
  max-width: 100%;
  box-sizing: border-box;
  padding: 0.5rem 0.6rem;
  font: inherit;
  border: 1px solid var(--form-border);
  border-radius: 6px;
  background: #fff;
}

.ia-model-table-only {
  min-width: 0;
}

.ia-model-table-scroll--form {
  margin-top: 0;
}

/* Tableau catalogue : pleine largeur utile du panneau (dashboard-card / ancien .ia-page-panel) */
.ia-page--wide .ia-page-card .ia-model-table-scroll--wide {
  width: calc(100% + 2.7rem);
  margin-left: -1.35rem;
  margin-right: -1.35rem;
  padding-left: 12px;
  padding-right: 12px;
  box-sizing: border-box;
}

.ia-model-active-banner {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  margin-bottom: 0.85rem;
  padding: 0.75rem 1rem;
  border-radius: 8px;
  border: 1px solid rgba(22, 139, 205, 0.45);
  border-left-width: 5px;
  border-left-color: var(--theme, #168bcd);
  background: linear-gradient(135deg, rgba(22, 139, 205, 0.14) 0%, rgba(22, 139, 205, 0.04) 100%);
  box-shadow: 0 1px 3px rgba(15, 23, 42, 0.08);
}

.ia-model-active-banner__title {
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--theme, #0f6aa3);
}

.ia-model-active-banner__detail {
  font-size: 1.02rem;
  line-height: 1.5;
  color: #0f172a;
  font-weight: 500;
}

.ia-model-active-banner__detail code {
  font-size: 0.88em;
  padding: 0.12em 0.35em;
  border-radius: 4px;
  background: rgba(255, 255, 255, 0.75);
  border: 1px solid rgba(22, 139, 205, 0.25);
}

@media (max-width: 560px) {
  .ia-band {
    grid-template-columns: 1fr;
  }
}

.ia-band-label {
  margin: 0;
  padding-top: 0.35rem;
  font-size: 0.88rem;
  font-weight: 600;
  color: #475569;
}

.ia-band-input {
  width: 100%;
  max-width: 100%;
  box-sizing: border-box;
  padding: 0.45rem 0.55rem;
  font: inherit;
  border: 1px solid var(--form-border);
  border-radius: 4px;
}

.ia-band-hint {
  margin: 0.4rem 0 0;
  font-size: 0.8rem;
  color: var(--muted);
}

.ia-band-check {
  display: flex;
  align-items: flex-start;
  gap: 0.4rem;
  margin-top: 0.5rem;
  font-size: 0.85rem;
  cursor: pointer;
}

.ia-form-actions {
  margin-top: 0.65rem;
  padding-top: 0.35rem;
}

.ia-info-list {
  margin: 0;
  padding-left: 1.15rem;
  font-size: 0.88rem;
  line-height: 1.55;
  color: var(--text);
}

.ia-info-list li {
  margin-bottom: 0.65rem;
}

.ia-info-list li:last-child {
  margin-bottom: 0;
}

.ia-model-table-wrap {
  margin-top: 1.25rem;
  padding-top: 1rem;
  border-top: 1px solid var(--border);
}

.ia-model-table-title {
  margin: 0 0 0.35rem;
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--text);
}

.ia-model-table-note {
  margin: 0 0 0.65rem;
  font-size: 0.78rem;
  color: var(--muted);
  line-height: 1.45;
}

.ia-model-table-scroll {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--surface, #f8fafc);
}

.ia-model-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.78rem;
  line-height: 1.35;
}

.ia-model-table th,
.ia-model-table td {
  padding: 0.3rem 0.4rem;
  text-align: left;
  border-bottom: 1px solid var(--border);
  vertical-align: top;
}

.ia-model-table thead th {
  background: var(--form-surface, #e2e8f0);
  font-weight: 700;
  color: #334155;
  white-space: nowrap;
  vertical-align: bottom;
  padding: 0.35rem 0.4rem;
}

.ia-model-table thead th.ia-model-table__th-sort {
  white-space: normal;
}

.ia-model-table__th-sort--narrow {
  max-width: 5rem;
}

.ia-model-table__th-sort--rate {
  min-width: 5.25rem;
  max-width: 7.5rem;
}

.ia-model-table__sort-btn {
  display: inline-flex;
  align-items: baseline;
  gap: 0.2rem;
  flex-wrap: wrap;
  width: 100%;
  margin: 0;
  padding: 0.4rem 0.45rem;
  font: inherit;
  font-weight: 700;
  font-size: inherit;
  color: inherit;
  text-align: left;
  border: none;
  border-radius: 6px;
  background: transparent;
  cursor: pointer;
  line-height: 1.3;
  box-sizing: border-box;
}

.ia-model-table__sort-btn:hover {
  background: rgba(15, 23, 42, 0.07);
  color: var(--theme, #168bcd);
}

.ia-model-table__sort-btn:focus-visible {
  outline: 2px solid var(--theme, #168bcd);
  outline-offset: 2px;
}

.ia-model-table__sort-ind {
  display: inline-block;
  min-width: 0.7rem;
  font-size: 0.72rem;
  font-weight: 800;
  color: var(--theme, #168bcd);
}

.ia-model-table tbody tr:last-child td {
  border-bottom: none;
}

.ia-model-table__row--ok {
  background: rgba(22, 139, 205, 0.06);
}

.ia-model-table__row--picked {
  outline: 2px solid var(--theme, #168bcd);
  outline-offset: -2px;
  background: linear-gradient(
    90deg,
    rgba(22, 139, 205, 0.28) 0%,
    rgba(22, 139, 205, 0.14) 100%
  ) !important;
  box-shadow:
    inset 5px 0 0 var(--theme, #168bcd),
    0 1px 0 rgba(15, 23, 42, 0.06);
}

.ia-model-table__row--picked td:nth-child(2),
.ia-model-table__row--picked td:nth-child(3),
.ia-model-table__row--picked td:nth-child(4) {
  font-weight: 600;
  color: #0f172a;
}

.ia-model-table__body-row--pickable {
  cursor: pointer;
}

.ia-model-table__body-row--pickable:hover {
  filter: brightness(0.98);
}

.ia-model-table__col-sel {
  width: 8.5rem;
  min-width: 7.25rem;
  text-align: left;
  vertical-align: middle;
}

.ia-model-table thead th.ia-model-table__col-sel {
  white-space: normal;
  line-height: 1.25;
  max-width: 6rem;
}

.ia-model-table__sel-badge {
  display: inline-flex;
  align-items: center;
  justify-content: flex-start;
  gap: 0.4rem;
  max-width: 100%;
  padding: 0.42rem 0.65rem;
  border-radius: 999px;
  font-size: 0.68rem;
  line-height: 1.2;
  letter-spacing: 0.02em;
  border: 1px solid transparent;
  box-sizing: border-box;
}

.ia-model-table__sel-badge-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.15rem;
  height: 1.15rem;
  flex-shrink: 0;
  border-radius: 50%;
  font-size: 0.62rem;
  font-weight: 800;
  line-height: 1;
  color: #fff;
  background: var(--theme, #168bcd);
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.2);
}

.ia-model-table__sel-badge-text {
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.ia-model-table__sel-badge-text--muted {
  font-weight: 600;
  text-transform: none;
  letter-spacing: 0.02em;
  color: #64748b;
}

.ia-model-table__sel-badge--active {
  color: #0c4a6e;
  background: linear-gradient(135deg, #e0f2fe 0%, #bae6fd 100%);
  border-color: rgba(14, 165, 233, 0.55);
  box-shadow: 0 1px 3px rgba(14, 165, 233, 0.25);
}

.ia-model-table__sel-badge--active .ia-model-table__sel-badge-text {
  color: #075985;
}

.ia-model-table__sel-badge--idle {
  background: rgba(241, 245, 249, 0.95);
  border-color: rgba(148, 163, 184, 0.45);
}

.ia-model-table__sel-badge--na {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 1.85rem;
  padding: 0.35rem 0.5rem;
  color: var(--muted);
  font-weight: 600;
}

.ia-model-table__num {
  text-align: right;
  white-space: nowrap;
}

.ia-model-table__col-key {
  min-width: 10rem;
  vertical-align: middle;
}

.ia-model-table thead th.ia-model-table__col-key {
  white-space: normal;
}

.ia-model-table__col-test {
  width: 9.5rem;
  min-width: 8rem;
}

.ia-model-table__test-cell {
  vertical-align: top;
  padding: 0.5rem 0.45rem;
}

.ia-model-table__test-cell .ia-model-test-btn {
  width: 100%;
  max-width: 7.5rem;
}

.ia-model-test-result {
  display: block;
  margin-top: 0.35rem;
  font-size: 0.68rem;
  line-height: 1.35;
  word-break: break-word;
}

.ia-model-test-result--ok {
  color: #15803d;
  font-weight: 600;
}

.ia-model-test-result--err {
  color: #b91c1c;
}

.ia-model-test-result--pending {
  color: var(--muted);
}

.ia-model-table__test-na {
  color: var(--muted);
  text-align: center;
}

.ia-model-table__th-sub {
  display: block;
  max-width: 9rem;
  margin-top: 0.2rem;
  font-size: 0.65rem;
  font-weight: 500;
  line-height: 1.25;
  color: #64748b;
  white-space: normal;
}

.ia-model-table__key-cell {
  background: var(--surface, #f8fafc);
  border-left: 1px solid var(--border);
  width: 14rem;
  min-width: 11rem;
  max-width: min(24rem, 36vw);
  vertical-align: top;
}

.ia-model-table__key-label {
  display: block;
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  color: #475569;
  margin-bottom: 0.35rem;
}

.ia-model-table__key-input {
  width: 100%;
  max-width: 100%;
  box-sizing: border-box;
  padding: 0.45rem 0.5rem;
  font: inherit;
  font-size: 0.88rem;
  border: 1px solid var(--form-border);
  border-radius: 4px;
}

.ia-model-table__key-hint {
  margin: 0.4rem 0 0;
  font-size: 0.72rem;
  color: var(--muted);
  line-height: 1.35;
}

/* Indicateur visuel : clé déjà en base (placeholder = points — pas la vraie clé) */
.ia-model-table__key-input--has-stored::placeholder {
  color: #475569;
  opacity: 1;
  letter-spacing: 0.12em;
  font-size: 0.9rem;
}

.ia-key-clear {
  display: flex;
  align-items: flex-start;
  gap: 0.4rem;
  margin-top: 0.4rem;
  font-size: 0.72rem;
  color: var(--muted);
  line-height: 1.35;
  cursor: pointer;
}

.ia-key-clear input {
  margin-top: 0.12rem;
  flex-shrink: 0;
}

.ia-model-table__key-bridge {
  margin: 0.55rem 0 0;
  font-size: 0.72rem;
  line-height: 1.4;
  color: var(--muted);
}

.ia-model-table__key-cell--anthropic {
  background: rgba(15, 23, 42, 0.03);
}

.ia-model-table__key-cell--gemini {
  background: rgba(22, 139, 205, 0.1);
}

.ia-model-table__key-na {
  display: block;
  font-weight: 600;
  color: var(--muted);
  text-align: center;
}

.ia-model-table__key-na-hint {
  margin: 0.4rem 0 0;
  font-size: 0.72rem;
  line-height: 1.35;
  color: var(--muted);
}

.ia-model-table code {
  font-size: 0.72rem;
}

.header-user-chip {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
  padding-left: 0.5rem;
  border-left: 1px solid var(--border);
  margin-left: 0.25rem;
}

.header-user-chip-main {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  max-width: 100%;
  text-decoration: none;
  color: inherit;
  border-radius: var(--radius);
  padding: 0.15rem 0.35rem 0.15rem 0;
  margin: -0.15rem 0;
}

.header-user-chip-main:hover .header-user-name {
  color: var(--theme);
}

.header-user-chip-main:focus-visible {
  outline: 2px solid var(--theme);
  outline-offset: 2px;
}

.header-user-avatar {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2.25rem;
  height: 2.25rem;
  border-radius: 50%;
  background: var(--theme);
  color: #fff;
  font-size: 0.88rem;
  font-weight: 700;
}

.header-user-name {
  font-size: 0.95rem;
  color: var(--text);
  max-width: 12rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.header-app-logout {
  font-size: 0.92rem;
  color: var(--muted);
}

button.header-app-logout {
  background: none;
  border: none;
  padding: 0;
  margin: 0;
  font: inherit;
  text-align: inherit;
  cursor: pointer;
  -webkit-appearance: none;
  appearance: none;
}

.header-app-logout:hover {
  color: var(--theme);
}

.main--dashboard {
  padding: 0;
  max-width: 100%;
}

/* App connecté : rail gauche pleine hauteur (logo + classeurs) | colonne droite (bandeau + main) */
body:has(.app-shell) {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

.app-shell {
  display: flex;
  flex-direction: row;
  align-items: stretch;
  flex: 1 1 0;
  min-height: 0;
  width: 100%;
  max-width: 100%;
  --dashboard-sidebar-width: 320px;
  /* Même rendu logo rail gauche ↔ bandeau (rail replié) */
  --app-sidebar-logo-img-height: 52px;
}

#dashboard-sidebar.app-sidebar-rail {
  display: flex;
  flex-direction: column;
  min-height: 0;
  min-width: 0;
  flex: 0 0 var(--dashboard-sidebar-width, 320px);
  width: var(--dashboard-sidebar-width, 320px);
  max-width: 100%;
  align-self: stretch;
  border-right: 1px solid #334155;
  box-sizing: border-box;
}

.app-sidebar-rail > .sidebar-search-form--classeurs {
  flex: 1 1 0%;
  min-height: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.app-sidebar-rail__brand {
  flex-shrink: 0;
  padding: 0.75rem 0.85rem 1rem;
  border-bottom: 1px solid #334155;
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 0.65rem;
}

.app-sidebar-rail__brand .logo--in-sidebar {
  justify-content: center;
}

.app-sidebar-rail__brand .logo--in-sidebar .logo-img {
  height: var(--app-sidebar-logo-img-height, 52px);
  max-width: 100%;
}

.header-context-select--in-sidebar {
  width: 100%;
  max-width: none;
  background: #0f172a;
  border-color: #475569;
  color: #e2e8f0;
}

.app-shell__column {
  flex: 1 1 0%;
  min-width: 0;
  min-height: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.app-shell__column > .site-header--app-tray {
  flex-shrink: 0;
}

.app-shell__column > main.main--dashboard {
  flex: 1 1 0%;
  min-height: 0;
  min-width: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.header-app--tray {
  justify-content: flex-start;
  width: 100%;
}

.header-app-nav-center {
  flex: 1 1 auto;
  display: flex;
  justify-content: center;
  align-items: center;
  min-width: 0;
}

.header-app-tray-end {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  gap: 0.65rem 1rem;
}

/* Logo : dans le rail gauche si visible ; dans le bandeau uniquement si le rail est replié (desktop). */
.logo--when-rail-hidden {
  display: none;
  flex-shrink: 0;
}

.app-shell.documents-dashboard--sidebar-hidden .logo--when-rail-hidden {
  display: inline-flex;
}

.site-header--app-tray .logo--when-rail-hidden .logo-img {
  height: var(--app-sidebar-logo-img-height, 52px);
  max-width: min(280px, 52vw);
  object-fit: contain;
}


.site-header--app-tray {
  border-bottom: 1px solid var(--border);
}

.app-shell.documents-dashboard--sidebar-hidden #dashboard-sidebar {
  display: none !important;
}

/* Rail replié : conserver la colonne du bouton pour rouvrir (sinon la flèche disparaissait avec tout le wrap). */
.app-shell.documents-dashboard--sidebar-hidden #dashboard-sidebar-resizer-wrap > .documents-layout-resizer {
  display: none !important;
}

.app-shell.documents-dashboard--sidebar-hidden #dashboard-sidebar-resizer-wrap {
  flex: 0 0 22px;
  width: 22px;
  min-width: 22px;
}

@media (max-width: 959px) {
  .app-shell {
    flex-direction: column;
  }

  #dashboard-sidebar.app-sidebar-rail {
    flex: 0 0 auto;
    width: 100%;
    max-width: none;
    border-right: none;
    border-bottom: 1px solid #334155;
  }

  .app-shell__column {
    flex: 1 1 auto;
    min-height: 0;
  }
}

.dashboard-app {
  display: flex;
  flex-direction: column;
  gap: 0;
  min-height: calc(100vh - 8rem);
}

@media (min-width: 960px) {
  .dashboard-app {
    flex-direction: row;
    align-items: stretch;
    min-height: min(70vh, 720px);
  }
}

.dashboard-sidebar {
  flex: 0 0 auto;
  display: flex;
  flex-direction: column;
  min-height: 0;
  width: 100%;
  max-width: 100%;
  background: var(--form-surface);
  border-bottom: 1px solid var(--form-border);
  padding: 1rem var(--page-padding);
}

@media (min-width: 960px) {
  .dashboard-sidebar {
    width: 320px;
    max-width: 320px;
    border-bottom: none;
    border-right: 1px solid var(--form-border);
    padding: 1.25rem 1rem;
    align-self: stretch;
  }

}

/* Panneau Classeurs : pas d’écart sous le menu (padding haut géré par la règle desktop si besoin) */
.dashboard-sidebar.dashboard-sidebar--classeurs {
  padding-top: 0;
}

.sidebar-tabs {
  display: flex;
  gap: 0;
  border-bottom: 1px solid var(--border);
  margin-bottom: 1rem;
}

.sidebar-tab {
  flex: 1;
  padding: 0.5rem 0.75rem;
  font-size: 0.9rem;
  font-weight: 500;
  border: none;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  border-bottom: 3px solid transparent;
  margin-bottom: -1px;
  font-family: inherit;
}

.sidebar-tab:hover {
  color: var(--text);
}

.sidebar-tab--active {
  color: var(--theme);
  border-bottom-color: var(--theme);
}

.sidebar-search-form .sidebar-tab--active {
  color: #b91c1c;
  border-bottom-color: #b91c1c;
  font-weight: 600;
}

.sidebar-intro {
  font-size: 0.85rem;
  color: var(--muted);
  margin: 0 0 0.75rem;
  line-height: 1.35;
}

.sidebar-search-form {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-height: 0;
  height: 100%;
}

.sidebar-scroll {
  flex: 1;
  overflow-y: auto;
  min-height: 0;
  padding-bottom: 0.5rem;
}

.sidebar-accordion {
  border: 1px solid var(--form-border);
  border-radius: 6px;
  margin-bottom: 0.65rem;
  background: var(--panel-bg, #fff);
}

.sidebar-accordion-summary {
  list-style: none;
  cursor: pointer;
  padding: 0.55rem 0.65rem;
  font-size: 0.8rem;
  font-weight: 700;
  color: #0a1a4a;
  background: rgba(22, 139, 205, 0.08);
  border-radius: 6px 6px 0 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.sidebar-accordion-summary::-webkit-details-marker {
  display: none;
}

.sidebar-accordion-summary::after {
  content: "▼";
  font-size: 0.55rem;
  opacity: 0.6;
}

.sidebar-accordion[open] .sidebar-accordion-summary::after {
  content: "▲";
}

.sidebar-accordion-body {
  padding: 0.5rem 0.65rem 0.65rem;
}

.sidebar-accordion-body .form-group:last-child {
  margin-bottom: 0;
}

.form-label-block {
  display: block;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 0.35rem;
}

.sidebar-statut-checks {
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
  margin-top: 0.25rem;
}

.sidebar-statut-checks__row {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.88rem;
  line-height: 1.3;
  cursor: pointer;
}

.sidebar-statut-checks__row input {
  flex-shrink: 0;
}

.sidebar-statut-checks-hint {
  margin: 0.45rem 0 0;
  font-size: 0.76rem;
  color: var(--muted);
  line-height: 1.35;
}

/*
 * Select « Type » : fond neutre + bandeau gauche par type.
 * (Un fond pastel sur tout le <select> teinte aussi la liste native sous Windows.)
 */
.sidebar-select-type-document {
  width: 100%;
  max-width: 100%;
  font-family: inherit;
  font-size: 0.9rem;
  font-weight: 600;
  padding: 0.45rem 0.6rem;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--surface-elevated);
  color: var(--text);
  box-sizing: border-box;
  cursor: pointer;
  transition:
    background 0.15s ease,
    border-color 0.15s ease,
    color 0.15s ease;
}

.sidebar-select-type-document:focus {
  outline: 2px solid var(--theme);
  outline-offset: 2px;
}

select.sidebar-select-type-document option {
  background-color: var(--surface-elevated, #fff);
  color: var(--text);
  font-weight: 500;
}

.sidebar-select-type-document--facture {
  color: #991b1b;
  border-color: #fecaca;
  border-left: 4px solid #ef4444;
}

.sidebar-select-type-document--facture:focus {
  outline-color: #ef4444;
}

.sidebar-select-type-document--courrier {
  color: #1e40af;
  border-color: #bfdbfe;
  border-left: 4px solid #3b82f6;
}

.sidebar-select-type-document--courrier:focus {
  outline-color: #3b82f6;
}

.sidebar-select-type-document--recu {
  color: #166534;
  border-color: #bbf7d0;
  border-left: 4px solid #22c55e;
}

.sidebar-select-type-document--recu:focus {
  outline-color: #22c55e;
}

.sidebar-select-type-document--avoir {
  color: #c2410c;
  border-color: #fed7aa;
  border-left: 4px solid #f97316;
}

.sidebar-select-type-document--avoir:focus {
  outline-color: #f97316;
}

.sidebar-select-type-document--devis {
  color: #a16207;
  border-color: #fde68a;
  border-left: 4px solid #eab308;
}

.sidebar-select-type-document--devis:focus {
  outline-color: #ca8a04;
}

.sidebar-select-type-document--particulier {
  color: #0369a1;
  border-color: #bae6fd;
  border-left: 4px solid #0ea5e9;
}

.sidebar-select-type-document--particulier:focus {
  outline-color: #0ea5e9;
}

.sidebar-select-type-document--bon_commande {
  color: #5b21b6;
  border-color: #ddd6fe;
  border-left: 4px solid #8b5cf6;
}

.sidebar-select-type-document--bon_commande:focus {
  outline-color: #8b5cf6;
}

.sidebar-select-type-document--autre {
  color: #475569;
  border-color: #cbd5e1;
  border-left: 4px solid #64748b;
}

.sidebar-select-type-document--autre:focus {
  outline-color: #64748b;
}

.sidebar-select-type-document--default {
  color: var(--text);
  border-color: var(--border);
  border-left: 4px solid #94a3b8;
  font-weight: 500;
}

.sidebar-select-type-document--default:focus {
  outline-color: var(--theme);
}

/* Infos document : même rendu (classes --* communes au filtre Recherche) */
.sidebar-doc-field--typedoc select.sidebar-doc-field-input.sidebar-select-type-document {
  font-weight: 600;
  padding: 0.45rem 0.6rem;
  border-radius: 8px;
  font-size: 0.9rem;
  cursor: pointer;
  transition:
    background 0.15s ease,
    border-color 0.15s ease,
    color 0.15s ease;
}

/* Liste déroulante personnalisée « Type document » (couleurs par type — le <select> natif ne le permet pas sous Windows) */
.docia-typedoc-combobox {
  position: relative;
  width: 100%;
}

.docia-typedoc-combobox__trigger {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  text-align: left;
  font-family: inherit;
  cursor: pointer;
  appearance: none;
  -webkit-appearance: none;
  margin: 0;
}

.docia-typedoc-combobox__trigger::after {
  content: '▼';
  font-size: 0.55rem;
  opacity: 0.65;
  flex-shrink: 0;
  line-height: 1;
}

.docia-typedoc-combobox__list {
  position: fixed;
  z-index: 6000;
  margin: 0;
  padding: 0.3rem 0;
  list-style: none;
  background: var(--surface-elevated, #fff);
  border: 1px solid var(--border);
  border-radius: 10px;
  box-shadow: 0 12px 40px rgba(15, 23, 42, 0.18);
  box-sizing: border-box;
  /* Hauteur max affinée en JS selon l’espace sous le champ (évite coupure par overflow du layout) */
  max-height: min(340px, calc(100vh - 1.25rem));
  min-height: 0;
  overflow-x: hidden;
  overflow-y: auto;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
  touch-action: pan-y;
}

.docia-typedoc-combobox__option {
  cursor: pointer;
  padding: 0.45rem 0.65rem;
  margin: 0.1rem 0.35rem;
  border-radius: 6px;
  font-size: 0.9rem;
  font-weight: 600;
  line-height: 1.3;
}

.docia-typedoc-combobox__option:hover,
.docia-typedoc-combobox__option:focus {
  outline: none;
  filter: brightness(0.96);
  box-shadow: inset 0 0 0 2px rgba(15, 23, 42, 0.12);
}

.docia-typedoc-combobox__option--facture {
  background: #fee2e2;
  color: #b91c1c;
}

.docia-typedoc-combobox__option--courrier {
  background: #dbeafe;
  color: #1d4ed8;
}

.docia-typedoc-combobox__option--recu {
  background: #dcfce7;
  color: #15803d;
}

.docia-typedoc-combobox__option--avoir {
  background: #ffedd5;
  color: #c2410c;
}

.docia-typedoc-combobox__option--devis {
  background: #fef3c7;
  color: #b45309;
}

.docia-typedoc-combobox__option--particulier {
  background: #e0f2fe;
  color: #0369a1;
}

.docia-typedoc-combobox__option--bon_commande {
  background: #ede9fe;
  color: #5b21b6;
}

.docia-typedoc-combobox__option--autre {
  background: #f1f5f9;
  color: #475569;
  border: 1px solid #e2e8f0;
}

.docia-typedoc-combobox__option--default {
  background: var(--surface);
  color: var(--text);
  border: 1px solid var(--border);
  font-weight: 500;
}

.sidebar-type-doc-hint {
  margin: 0.35rem 0 0;
  font-size: 0.76rem;
  color: var(--muted);
  line-height: 1.35;
}

.label-small {
  font-size: 0.75rem;
  font-weight: 500;
  color: var(--muted);
}

.form-row-dates {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.5rem;
}

.form-row-dates input.sidebar-date-input {
  width: 100%;
  font-family: inherit;
  font-size: 1rem;
  color: var(--text);
  min-height: 2.25rem;
  padding: 0.35rem 0.5rem;
  border-radius: 6px;
  border: 1px solid var(--border);
  background: var(--surface-elevated);
  box-sizing: border-box;
}

.form-row-dates input.sidebar-date-input:focus {
  outline: 2px solid var(--theme);
  outline-offset: 2px;
}

.sidebar-doc-document-fields .sidebar-doc-field-input.sidebar-date-text,
.sidebar-doc-detail-champs .sidebar-doc-field-input.sidebar-date-text {
  width: 100%;
  font-family: inherit;
  font-size: 1rem;
  color: var(--text);
  -webkit-appearance: none;
  appearance: none;
}

.sidebar-doc-document-fields .sidebar-doc-field-input.sidebar-date-text::placeholder,
.sidebar-doc-detail-champs .sidebar-doc-field-input.sidebar-date-text::placeholder {
  color: var(--muted);
  opacity: 1;
}

.sidebar-doc-document-fields .sidebar-doc-field-input.sidebar-date-native,
.sidebar-doc-detail-champs .sidebar-doc-field-input.sidebar-date-native {
  width: 100%;
  max-width: 100%;
  min-height: 2.35rem;
  font-family: inherit;
  font-size: 0.95rem;
  color: var(--text);
  box-sizing: border-box;
}

.sidebar-doc-field-hint {
  margin: 0.25rem 0 0;
  font-size: 0.75rem;
  font-weight: 500;
  color: var(--muted);
}

.form-group--with-icon .input-with-icon {
  position: relative;
}

.form-group--with-icon .input-with-icon input {
  width: 100%;
  padding-right: 2.25rem;
}

.input-with-icon--left input {
  padding-left: 2rem;
  padding-right: 0.65rem;
}

.input-icon {
  position: absolute;
  right: 0.55rem;
  top: 50%;
  transform: translateY(-50%);
  font-size: 0.9rem;
  color: var(--theme);
  pointer-events: none;
  line-height: 1;
}

.input-icon--left {
  left: 0.5rem;
  right: auto;
}

.sidebar-section {
  margin-bottom: 1rem;
}

.sidebar-section-title {
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--muted);
  margin: 0 0 0.5rem;
}

.dashboard-sidebar-form .form-group {
  margin-bottom: 0.75rem;
}

.sidebar-search-btn {
  margin-top: 0.5rem;
}

.sidebar-search-icon {
  margin-right: 0.35rem;
}

.sidebar-expert-hint {
  font-size: 0.85rem;
  color: var(--muted);
  margin: 0 0 1rem;
  line-height: 1.45;
}

.sidebar-expert-hint code {
  font-size: 0.88em;
  word-break: break-word;
}

.sidebar-panel--hidden {
  display: none;
}

.dashboard-main {
  flex: 1;
  min-width: 0;
  /* Un peu plus foncé que slate-100 pour mieux faire ressortir les cadres blancs */
  background: var(--dashboard-main-bg, #d8dee8);
  /* Contenu : léger retrait latéral seulement (plus de double marge page + zone) */
  padding: 1.25rem 1rem 2rem;
}

main.main--dashboard.main--parametres .dashboard-main,
main.main--dashboard.main--dashboard-home .dashboard-main {
  padding: 10px;
  box-sizing: border-box;
}

/* Mes documents : liste au centre + aperçu PDF à droite (pas de modale) */
main.main--documents-page {
  flex: 1 1 auto;
  min-height: 0;
  display: flex;
  flex-direction: column;
}

/* À partir de 960 px, le scroll est dans la colonne centrale (pas le viewport) : le sticky thead se cale en haut de cette zone, pas sous le menu. */
@media (min-width: 960px) {
  main.main--documents-page {
    --docia-app-sticky-top: 0px;
  }
}

main.main--documents-page .dashboard-main {
  display: flex;
  flex-direction: column;
  min-height: 0;
  padding: 10px;
  box-sizing: border-box;
}

/* Mes documents : colonne liste = même principe que Paramètres (fond blanc, bordure, ombre légère) */
main.main--dashboard.main--documents-page .documents-app-layout__center {
  background: #fff;
  border: 1px solid var(--border, #e2e8f0);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  padding: 1rem 1.35rem 1.35rem;
  box-sizing: border-box;
}

/* Éviter cadre sur cadre : le bloc centre porte le cadre, pas les .card des équivalences liste / grille / détail */
main.main--dashboard.main--documents-page .documents-app-layout__center .documents-results .card {
  background: transparent;
  border: none;
  box-shadow: none;
  padding: 0;
  margin: 0;
}

/* Mes documents : défilement indépendant sidebar | liste | aperçu (desktop) */
main.main--documents-page .dashboard-app {
  --dashboard-sidebar-width: 320px;
}

/*
 * Rail Classeurs (toutes largeurs) : ascenseur vertical discret, tons ardoise sur fond sombre.
 * Remplace la barre grise par défaut du système.
 */
#dashboard-sidebar.dashboard-sidebar--classeurs .sidebar-scroll {
  scrollbar-width: thin;
  scrollbar-color: rgba(148, 163, 184, 0.42) transparent;
}

#dashboard-sidebar.dashboard-sidebar--classeurs .sidebar-scroll::-webkit-scrollbar {
  width: 8px;
}

#dashboard-sidebar.dashboard-sidebar--classeurs .sidebar-scroll::-webkit-scrollbar-track {
  background: rgba(15, 23, 42, 0.35);
  border-radius: 999px;
  margin: 4px 0;
}

#dashboard-sidebar.dashboard-sidebar--classeurs .sidebar-scroll::-webkit-scrollbar-thumb {
  background: rgba(148, 163, 184, 0.38);
  border-radius: 999px;
  border: 2px solid rgba(15, 23, 42, 0.2);
  background-clip: padding-box;
  min-height: 2.5rem;
}

#dashboard-sidebar.dashboard-sidebar--classeurs .sidebar-scroll::-webkit-scrollbar-thumb:hover {
  background: rgba(203, 213, 225, 0.5);
  border: 2px solid rgba(15, 23, 42, 0.15);
  background-clip: padding-box;
}

#dashboard-sidebar.dashboard-sidebar--classeurs .sidebar-scroll::-webkit-scrollbar-thumb:active {
  background: rgba(226, 232, 240, 0.45);
}

@media (min-width: 960px) {
  /* Vue fixe : pas de scroll sur la page, un ascenseur par colonne (recherche / liste / aperçu) */
  body:has(main.main--documents-page) {
    height: 100vh;
    max-height: 100vh;
    overflow: hidden;
    padding-bottom: 0;
  }

  main.main--documents-page {
    flex: 1 1 0%;
    min-height: 0;
    overflow: hidden;
    padding-top: 0;
    padding-bottom: 0;
  }

  main.main--documents-page .dashboard-main {
    flex: 1 1 0%;
    min-height: 0;
    overflow: hidden;
  }

  main.main--documents-page .documents-app-layout {
    flex: 1 1 0%;
    min-height: 0;
    overflow: hidden;
  }

  main.main--documents-page .dashboard-app {
    flex: 1 1 0%;
    min-height: 0;
    max-height: none;
    height: 100%;
    overflow: hidden;
    align-items: stretch;
  }

  main.main--documents-page .dashboard-sidebar {
    flex: 0 0 var(--dashboard-sidebar-width, 320px);
    width: var(--dashboard-sidebar-width, 320px);
    max-width: none;
    min-width: 0;
    min-height: 0;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    align-self: stretch;
  }

  main.main--documents-page #dashboard-sidebar-resizer-wrap {
    display: block;
  }

  main.main--documents-page .dashboard-app.documents-dashboard--sidebar-hidden .dashboard-sidebar {
    display: none !important;
  }

  main.main--documents-page .sidebar-search-form {
    flex: 1 1 0%;
    min-height: 0;
    display: flex;
    flex-direction: column;
    overflow: hidden;
  }

  main.main--documents-page .sidebar-tabs {
    flex-shrink: 0;
  }

  main.main--documents-page .sidebar-scroll {
    flex: 1 1 0%;
    min-height: 0;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    overscroll-behavior: contain;
  }

  /* Colonne gauche « Classeurs » (Documents + tableau de bord, etc.) */
  main.main--documents-page .dashboard-sidebar--classeurs,
  main.main--dashboard:not(.main--documents-page) .dashboard-sidebar--classeurs,
  .app-shell #dashboard-sidebar.dashboard-sidebar--classeurs {
    background: linear-gradient(180deg, #0f172a 0%, #1e293b 100%);
    border-right-color: #334155;
    color: #e2e8f0;
    padding: 0 0.85rem 1rem;
    align-self: stretch;
    min-height: 0;
  }

  .app-shell #dashboard-sidebar-resizer-wrap {
    display: block;
  }

  .app-shell #dashboard-sidebar .sidebar-search-form {
    flex: 1 1 0%;
    min-height: 0;
    display: flex;
    flex-direction: column;
    overflow: hidden;
  }

  .app-shell #dashboard-sidebar .sidebar-tabs {
    flex-shrink: 0;
  }

  .app-shell #dashboard-sidebar .sidebar-scroll {
    flex: 1 1 0%;
    min-height: 0;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    overscroll-behavior: contain;
  }

  .sidebar-search-form--classeurs .sidebar-tabs--classeurs {
    border-bottom: none;
    margin-bottom: 0.75rem;
    padding: 4px;
    gap: 4px;
    background: rgba(15, 23, 42, 0.65);
    border-radius: 10px;
    border: 1px solid #334155;
  }

  .sidebar-search-form--classeurs .sidebar-tab {
    color: #94a3b8;
    border-bottom: none;
    margin-bottom: 0;
    border-radius: 8px;
    transition: background 0.15s ease, color 0.15s ease;
  }

  .sidebar-search-form--classeurs .sidebar-tab:hover {
    color: #e2e8f0;
    background: rgba(148, 163, 184, 0.12);
  }

  .sidebar-search-form--classeurs .sidebar-tab--active {
    color: #fff !important;
    border-bottom: none !important;
    background: rgba(59, 130, 246, 0.35) !important;
    box-shadow: inset 0 0 0 1px rgba(96, 165, 250, 0.45);
    font-weight: 600;
  }

  .sidebar-classeurs-head {
    margin-bottom: 0.25rem;
  }

  .sidebar-classeurs-title {
    font-size: 0.95rem;
    font-weight: 700;
    margin: 0 0 0.875rem;
    display: flex;
    align-items: center;
    gap: 0.4rem;
    color: #f8fafc;
  }

  .sidebar-classeurs-title-icon {
    font-size: 1.1rem;
    line-height: 1;
  }

  .sidebar-classeurs-search-wrap {
    position: relative;
    margin-bottom: 1rem;
  }

  .sidebar-classeurs-search-icon {
    position: absolute;
    left: 0.65rem;
    top: 50%;
    transform: translateY(-50%);
    opacity: 0.45;
    pointer-events: none;
    line-height: 1;
  }

  .sidebar-classeurs-search {
    width: 100%;
    box-sizing: border-box;
    padding: 0.5rem 0.65rem 0.5rem 2.15rem;
    border-radius: 8px;
    border: 1px solid #475569;
    background: #0f172a;
    color: #f1f5f9;
    font-size: 0.875rem;
    font-family: inherit;
  }

  .sidebar-classeurs-search:focus {
    outline: none;
    border-color: #3b82f6;
    box-shadow: 0 0 0 1px #3b82f6;
  }

  .sidebar-classeurs-search::placeholder {
    color: #64748b;
  }

  .sidebar-classeurs-list {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 0.2rem;
  }

  .sidebar-classeurs-link {
    display: flex;
    align-items: center;
    gap: 0.45rem;
    padding: 0.5rem 0.65rem;
    border-radius: 8px;
    text-decoration: none;
    color: #cbd5e1;
    font-size: 0.875rem;
    line-height: 1.35;
  }

  .sidebar-classeurs-link:hover {
    background: rgba(148, 163, 184, 0.14);
    color: #f8fafc;
  }

  .sidebar-classeurs-link.is-active {
    background: #2563eb;
    color: #fff;
  }

  .sidebar-classeurs-link.is-active .sidebar-classeurs-link-count {
    opacity: 0.95;
    color: #fff;
  }

  .sidebar-classeurs-link-icon {
    flex-shrink: 0;
    opacity: 0.88;
    font-size: 0.95rem;
    line-height: 1;
  }

  .sidebar-classeurs-link-text {
    flex: 1;
    min-width: 0;
  }

  .sidebar-classeurs-link-count {
    flex-shrink: 0;
    opacity: 0.72;
    font-variant-numeric: tabular-nums;
    font-size: 0.8125rem;
  }

  .sidebar-classeurs-add {
    margin: 1.15rem 0 0;
    padding-top: 0.75rem;
    border-top: 1px solid #334155;
  }

  .sidebar-classeurs-add-btn {
    font-weight: 600;
  }

  .sidebar-classeurs-hint {
    font-size: 0.8125rem;
    color: #94a3b8;
    line-height: 1.45;
    margin: 0 0 0.75rem;
  }

  .sidebar-classeurs-hint--warn {
    color: #fcd34d;
  }

  .sidebar-classeurs-hint--info {
    color: #bae6fd;
    font-size: 0.82rem;
    line-height: 1.45;
  }

  .sidebar-classeurs-hint--info strong {
    color: #e0f2fe;
  }

  .sidebar-rail-scope-hint {
    font-size: 0.76rem;
    color: #bae6fd;
    line-height: 1.45;
    margin: 0 0 0.85rem;
    padding: 0.45rem 0.55rem;
    background: rgba(14, 165, 233, 0.12);
    border: 1px solid rgba(56, 189, 248, 0.35);
    border-radius: 8px;
  }

  .sidebar-rail-scope-hint strong {
    color: #f0f9ff;
    font-weight: 600;
  }

  .sidebar-activity-stack {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    margin-bottom: 0.25rem;
  }

  .sidebar-activity-group {
    background: rgba(15, 23, 42, 0.45);
    border: 1px solid rgba(51, 65, 85, 0.9);
    border-radius: 10px;
    padding: 0.55rem 0.5rem 0.65rem;
    border-left: 3px solid #475569;
  }

  .sidebar-activity-group--statuts {
    border-left-color: #38bdf8;
  }

  .sidebar-activity-group--tampon {
    border-left-color: #a78bfa;
  }

  .sidebar-activity-group .sidebar-activity-section {
    margin-bottom: 0;
  }

  .sidebar-activity-group .sidebar-activity-footnote {
    margin: 0;
  }

  .sidebar-activity-link--tone-wait {
    border-left: 3px solid #f59e0b;
    margin-left: 0;
    padding-left: 0.4rem;
  }

  .sidebar-activity-link--tone-err {
    border-left: 3px solid #f87171;
    margin-left: 0;
    padding-left: 0.4rem;
  }

  .sidebar-activity-link--tone-ok {
    border-left: 3px solid #34d399;
    margin-left: 0;
    padding-left: 0.4rem;
  }

  .sidebar-activity-link--tone-empty {
    border-left: 3px solid #94a3b8;
    margin-left: 0;
    padding-left: 0.4rem;
  }

  .sidebar-activity-link--tone-filled {
    border-left: 3px solid #818cf8;
    margin-left: 0;
    padding-left: 0.4rem;
  }

  .sidebar-pme-section {
    border-left-width: 3px;
    border-left-style: solid;
    border-left-color: #64748b;
    padding-left: 0.45rem;
    margin-left: 0;
  }

  .sidebar-pme-section--achats {
    border-left-color: #22c55e;
    background: rgba(34, 197, 94, 0.06);
  }

  .sidebar-pme-section--risques {
    border-left-color: #f97316;
    background: rgba(249, 115, 22, 0.07);
  }

  .sidebar-pme-section--treso {
    border-left-color: #eab308;
    background: rgba(234, 179, 8, 0.08);
  }

  .sidebar-pme-section--compta {
    border-left-color: #60a5fa;
    background: rgba(96, 165, 250, 0.08);
  }

  .sidebar-pme-section--qualite {
    border-left-color: #c084fc;
    background: rgba(192, 132, 252, 0.07);
  }

  .sidebar-pme-section--misc {
    border-left-color: #94a3b8;
  }

  .sidebar-activity {
    margin: 0 0 1rem;
    padding: 0 0 1rem;
    border-bottom: none;
  }

  .sidebar-activity-title {
    font-size: 0.95rem;
    font-weight: 700;
    margin: 0 0 0.45rem;
    display: flex;
    align-items: center;
    gap: 0.35rem;
    color: #f8fafc;
  }

  .sidebar-activity-title-icon {
    font-size: 1.05rem;
    line-height: 1;
  }

  .sidebar-activity-hint {
    font-size: 0.8rem;
    color: #94a3b8;
    line-height: 1.45;
    margin: 0 0 0.85rem;
  }

  .sidebar-activity-section {
    margin: 0 0 0.85rem;
  }

  .sidebar-activity-section:last-of-type {
    margin-bottom: 0;
  }

  .sidebar-activity-section-title {
    font-size: 0.72rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: #94a3b8;
    margin: 0 0 0.4rem;
  }

  .sidebar-activity-list {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 0.15rem;
  }

  .sidebar-activity-link {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 0.5rem;
    padding: 0.4rem 0.55rem;
    border-radius: 8px;
    text-decoration: none;
    color: #cbd5e1;
    font-size: 0.84rem;
    line-height: 1.35;
  }

  .sidebar-activity-link:hover {
    background: rgba(148, 163, 184, 0.14);
    color: #f8fafc;
  }

  .sidebar-activity-link-label {
    flex: 1;
    min-width: 0;
  }

  .sidebar-activity-link-count {
    flex-shrink: 0;
    opacity: 0.75;
    font-variant-numeric: tabular-nums;
    font-size: 0.8rem;
  }

  .sidebar-activity-link.is-active {
    background: #2563eb;
    color: #fff;
  }

  .sidebar-activity-link.is-active .sidebar-activity-link-count {
    opacity: 0.95;
    color: #fff;
  }

  .sidebar-pme-blocks {
    margin-top: 1rem;
    padding-top: 0.9rem;
    border-top: 1px solid #334155;
  }

  .sidebar-pme-blocks__main-heading {
    margin-top: 0;
    margin-bottom: 0.35rem;
  }

  .sidebar-pme-blocks__intro {
    margin-bottom: 0.75rem;
  }

  .sidebar-activity-footnote {
    font-size: 0.75rem;
    color: #64748b;
    margin: 0;
    line-height: 1.4;
  }

  .sidebar-activity-footnote code {
    font-size: 0.7rem;
    color: #94a3b8;
  }

  .dashboard-sidebar--classeurs .sidebar-doc-placeholder-text,
  .dashboard-sidebar--classeurs .sidebar-doc-selected-kicker,
  .dashboard-sidebar--classeurs .sidebar-doc-user-note-hint {
    color: #94a3b8;
  }

  .dashboard-sidebar--classeurs .sidebar-doc-file-name {
    color: #f8fafc;
  }

  .dashboard-sidebar--classeurs .sidebar-doc-detail .form-group label {
    color: #cbd5e1;
  }

  .dashboard-sidebar--classeurs .sidebar-doc-field-input,
  .dashboard-sidebar--classeurs .sidebar-doc-field-textarea {
    background: #0f172a;
    border-color: #475569;
    color: #f1f5f9;
  }

  .dashboard-sidebar--classeurs .sidebar-doc-field-input:focus,
  .dashboard-sidebar--classeurs .sidebar-doc-field-textarea:focus {
    border-color: #3b82f6;
    outline: none;
  }

  /* Tableau de bord, profil, paramètres IA, etc. : comme Mes documents — ascenseur sidebar | ascenseur zone centrale */
  body:has(main.main--dashboard:not(.main--documents-page)) {
    height: 100vh;
    max-height: 100vh;
    overflow: hidden;
    padding-bottom: 0;
  }

  main.main--dashboard:not(.main--documents-page) {
    flex: 1 1 0%;
    min-height: 0;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    padding-top: 0;
    padding-bottom: 0;
  }

  main.main--dashboard:not(.main--documents-page) .dashboard-app {
    --dashboard-sidebar-width: 320px;
    flex: 1 1 0%;
    min-height: 0;
    max-height: none;
    height: auto;
    overflow: hidden;
    align-items: stretch;
    gap: 0;
  }

  main.main--dashboard:not(.main--documents-page) .dashboard-sidebar {
    flex: 0 0 var(--dashboard-sidebar-width, 320px);
    width: var(--dashboard-sidebar-width, 320px);
    max-width: none;
    min-width: 0;
    min-height: 0;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    align-self: stretch;
  }

  main.main--dashboard:not(.main--documents-page) #dashboard-sidebar-resizer-wrap {
    display: block;
  }

  main.main--dashboard:not(.main--documents-page)
    .dashboard-app.documents-dashboard--sidebar-hidden
    .dashboard-sidebar {
    display: none !important;
  }

  main.main--dashboard:not(.main--documents-page) .sidebar-search-form {
    flex: 1 1 0%;
    min-height: 0;
    display: flex;
    flex-direction: column;
    overflow: hidden;
  }

  main.main--dashboard:not(.main--documents-page) .sidebar-tabs {
    flex-shrink: 0;
  }

  main.main--dashboard:not(.main--documents-page) .sidebar-scroll {
    flex: 1 1 0%;
    min-height: 0;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    overscroll-behavior: contain;
  }

  main.main--dashboard:not(.main--documents-page) .dashboard-main {
    flex: 1 1 0%;
    min-height: 0;
    min-width: 0;
    overflow-y: auto;
    overflow-x: hidden;
    -webkit-overflow-scrolling: touch;
    overscroll-behavior: contain;
  }
}

.documents-app-layout {
  --documents-preview-flex-basis: 44%;
  display: flex;
  flex-direction: column;
  flex: 1 1 auto;
  min-height: 0;
  width: 100%;
  gap: 0;
}

.documents-layout-resizer {
  display: none;
  flex: 0 0 8px;
  width: 8px;
  min-width: 8px;
  margin: 0;
  padding: 0;
  border: none;
  cursor: col-resize;
  align-self: stretch;
  background: transparent;
  border-radius: 6px;
  touch-action: none;
  position: relative;
  z-index: 2;
}

.documents-layout-resizer::before {
  content: '';
  position: absolute;
  left: 50%;
  top: 0;
  bottom: 0;
  width: 3px;
  transform: translateX(-50%);
  background: var(--border);
  border-radius: 2px;
  transition: background 0.15s ease;
}

.documents-layout-resizer:hover::before,
.documents-layout-resizer:focus-visible::before {
  background: var(--theme);
}

.documents-layout-resizer--dragging::before {
  background: var(--theme);
}

.documents-layout-resizer:focus-visible {
  outline: 2px solid var(--theme);
  outline-offset: 2px;
}

body.documents-layout-resizer-active {
  cursor: col-resize !important;
}

/* Colonne contenant le séparateur + bouton masquer/afficher (largeur > pastille pour éviter le clip overflow) */
.documents-layout-resizer-wrap {
  display: none;
  position: relative;
  flex: 0 0 22px;
  width: 22px;
  min-width: 22px;
  align-self: stretch;
  flex-shrink: 0;
  overflow: visible;
}

.documents-layout-resizer-wrap > .documents-layout-resizer {
  display: block;
  position: absolute;
  left: 0;
  right: 0;
  top: 0;
  bottom: 0;
  width: auto;
  flex: none;
  min-width: 0;
  z-index: 2;
}

.documents-layout-resizer__toggle {
  position: absolute;
  left: 50%;
  top: 50%;
  z-index: 4;
  transform: translate(-50%, -50%);
  box-sizing: border-box;
  width: 18px;
  min-width: 18px;
  height: 44px;
  padding: 0;
  margin: 0;
  border: 1px solid #e2e8f0;
  border-radius: 9px;
  background: #fff;
  box-shadow: 0 1px 4px rgba(15, 23, 42, 0.12);
  cursor: pointer;
  color: var(--theme, #2563eb);
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: inherit;
  pointer-events: auto;
}

.documents-layout-resizer__toggle .documents-layout-resizer__chev {
  display: block;
  flex-shrink: 0;
  pointer-events: none;
}

.documents-layout-resizer__toggle:hover {
  border-color: var(--theme, #2563eb);
  background: #f8fafc;
  color: var(--theme, #2563eb);
}

.documents-layout-resizer__toggle:focus-visible {
  outline: 2px solid var(--theme, #2563eb);
  outline-offset: 2px;
}

.documents-app-layout__center {
  flex: 1 1 auto;
  min-width: 0;
  min-height: 0;
}

@media (min-width: 960px) and (max-width: 1099px) {
  main.main--documents-page .documents-app-layout {
    flex: 1 1 0%;
    min-height: 0;
    overflow: hidden;
  }

  main.main--documents-page .documents-app-layout__center {
    flex: 1 1 0%;
    min-height: 0;
    overflow: hidden;
    display: flex;
    flex-direction: column;
  }

  main.main--documents-page .documents-preview-panel {
    flex: 0 1 auto;
    min-height: 200px;
    max-height: 45vh;
    overflow-y: auto;
    overscroll-behavior: contain;
  }
}

.documents-preview-panel {
  display: flex;
  flex-direction: column;
  flex: 0 0 auto;
  min-height: 280px;
  max-height: 45vh;
  margin-top: 1rem;
  background: var(--surface-elevated, #fff);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.06);
}

/* Bandeau aligné sur À propos / modale Colonnes (dégradé thème) */
.documents-preview-panel__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  flex-wrap: wrap;
  padding: 0.65rem 1rem;
  flex-shrink: 0;
  color: rgba(255, 255, 255, 0.96);
  text-shadow: 0 1px 1px rgba(15, 23, 42, 0.18);
  border-bottom: 1px solid color-mix(in srgb, var(--theme) 55%, #0c1929 45%);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.14);
  background: linear-gradient(
    165deg,
    color-mix(in srgb, var(--accent-hover) 35%, #0a3d5c) 0%,
    var(--theme) 42%,
    color-mix(in srgb, var(--theme) 58%, #164e7d) 100%
  );
}

@supports not (background: color-mix(in srgb, red 1%, blue)) {
  .documents-preview-panel__header {
    border-bottom: 1px solid #0d4d73;
    background: linear-gradient(165deg, #0c5a85 0%, #168bcd 45%, #1270a8 100%);
  }
}

.documents-preview-panel__title {
  margin: 0;
  font-size: 0.8rem;
  font-weight: 700;
  line-height: 1.35;
  letter-spacing: 0.02em;
  flex: 1 1 auto;
  min-width: 0;
  word-break: break-word;
  color: rgba(255, 255, 255, 0.98);
}

main.main--documents-page .documents-preview-panel__header .documents-preview-panel__new-tab {
  flex: 0 0 auto;
  color: rgba(255, 255, 255, 0.95);
  border-color: rgba(255, 255, 255, 0.45);
  background: rgba(255, 255, 255, 0.12);
}

main.main--documents-page .documents-preview-panel__header .documents-preview-panel__new-tab:hover,
main.main--documents-page .documents-preview-panel__header .documents-preview-panel__new-tab:focus-visible {
  color: #fff;
  border-color: rgba(255, 255, 255, 0.65);
  background: rgba(255, 255, 255, 0.22);
  outline: none;
}

.documents-preview-panel__body {
  position: relative;
  flex: 1 1 auto;
  min-height: 220px;
  background: #e2e8f0;
}

/* L’attribut HTML [hidden] doit gagner sur display:flex des classes ci‑dessous (sinon le fallback recouvre l’iframe). */
.documents-preview-panel__placeholder[hidden],
.documents-preview-panel__fallback[hidden],
.documents-preview-panel__iframe[hidden] {
  display: none !important;
}

.documents-preview-panel__placeholder {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem 1.25rem;
  text-align: center;
}

.documents-preview-panel__placeholder-text {
  margin: 0;
  font-size: 0.82rem;
  line-height: 1.5;
  color: var(--muted);
  max-width: 28ch;
}

.documents-preview-panel__iframe {
  position: absolute;
  inset: 0;
  z-index: 1;
  width: 100%;
  height: 100%;
  border: 0;
  background: #fff;
}

.documents-preview-panel__iframe:not([hidden]) {
  display: block;
}

.documents-preview-panel__fallback {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.75rem;
  padding: 1rem;
  text-align: center;
  background: var(--surface-elevated, #fff);
}

.documents-preview-panel__fallback-text {
  margin: 0;
  font-size: 0.85rem;
  line-height: 1.45;
  color: var(--text);
}

@media (min-width: 1100px) {
  .documents-app-layout {
    flex-direction: row;
    align-items: stretch;
    gap: 1rem;
    margin: 0;
    flex: 1 1 0%;
    min-height: 0;
    max-height: none;
    overflow: hidden;
  }

  #documents-layout-resizer-wrap {
    display: block;
  }

  .documents-app-layout.documents-app-layout--preview-hidden .documents-preview-panel {
    display: none !important;
  }

  .documents-app-layout__center {
    flex: 1 1 0%;
    min-width: 0;
    min-height: 0;
    overflow: hidden;
    display: flex;
    flex-direction: column;
  }

  .documents-preview-panel {
    flex: 0 0 var(--documents-preview-flex-basis, 44%);
    min-width: 260px;
    margin-top: 0;
    max-height: none;
    align-self: stretch;
    min-height: 0;
    overflow-y: auto;
    overflow-x: hidden;
    overscroll-behavior: contain;
  }
}

/*
 * Mes documents (≥960px) : le titre / compteur / alertes restent visibles ;
 * seul le contenu liste · grille · détail défile dans sa zone.
 */
@media (min-width: 960px) {
  main.main--documents-page .documents-app-layout__center > .alert {
    flex-shrink: 0;
  }

  main.main--documents-page .documents-app-layout__center > .documents-page-head {
    flex-shrink: 0;
  }

  /*
   * overflow: visible sur les enveloppes entre .documents-results et .documents-table-hscroll__body :
   * un ancêtre en overflow:hidden casse position:sticky sur l’entête du tableau quand le scroll vertical est dans __body.
   */
  main.main--documents-page .documents-results {
    flex: 1 1 0%;
    min-height: 0;
    overflow: visible;
    display: flex;
    flex-direction: column;
  }

  main.main--documents-page .documents-pagination-bar {
    flex-shrink: 0;
  }

  /* Chaque mode d’affichage seul : ne pas utiliser de sélecteur « nu » sous main — ça battait display:none (liste vs grille vs détail). */

  main.main--documents-page .documents-results--list .documents-table-wrap {
    flex: 1 1 0%;
    min-height: 0;
    overflow: visible;
    display: flex;
    flex-direction: column;
  }

  main.main--documents-page .documents-results--list .documents-table-wrap .documents-table-hscroll {
    flex: 1 1 0%;
    min-height: 0;
    overflow: visible;
  }

  main.main--documents-page .documents-results--list .documents-table-hscroll__body,
  main.main--documents-page .documents-results--detail .documents-table-hscroll__body {
    flex: 1 1 0%;
    min-height: 0;
    overflow-x: auto;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    overscroll-behavior: contain;
  }

  /* Scroll dans __body : colle l’en-tête au haut de cette zone (pas le décalage « page entière » ci‑dessous). */
  main.main--documents-page .documents-results--list .documents-table-wrap table thead th {
    top: 0;
  }

  main.main--documents-page .documents-results--grid .documents-grid-wrap {
    flex: 1 1 0%;
    min-height: 0;
    overflow: hidden;
    display: flex;
    flex-direction: column;
  }

  main.main--documents-page .documents-results--grid .documents-grid-card {
    flex: 1 1 0%;
    min-height: 0;
    overflow-y: auto;
    overflow-x: hidden;
    -webkit-overflow-scrolling: touch;
    overscroll-behavior: contain;
  }

  main.main--documents-page .documents-results--detail .documents-detail-wrap {
    flex: 1 1 0%;
    min-height: 0;
    overflow: visible;
    display: flex;
    flex-direction: column;
  }

  main.main--documents-page .documents-results--detail .documents-detail-card {
    flex: 1 1 0%;
    min-height: 0;
    overflow: visible;
    display: flex;
    flex-direction: column;
  }

  main.main--documents-page .documents-results--detail .documents-detail-scroll.documents-table-hscroll {
    flex: 1 1 0%;
    min-height: 0;
    overflow: visible;
  }

  main.main--documents-page .documents-results--detail .documents-detail-table thead th {
    top: 0;
  }
}

.dashboard-main > .alert,
.dashboard-home-frame > .alert {
  margin-bottom: 1rem;
}

/* Tableau de bord : grille 3×2 pleine — synthèse | titre | dépôt / accès rapide | filtre | derniers imports */
main.main--dashboard.main--dashboard-home .dashboard-home-stack {
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}

@media (min-width: 900px) {
  main.main--dashboard.main--dashboard-home .dashboard-home-stack.dashboard-home-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    grid-template-rows: auto auto;
    gap: 1.25rem;
    align-items: stretch;
    grid-template-areas:
      'synthese hero depot'
      'quick hint imports';
  }

  main.main--dashboard.main--dashboard-home .dashboard-home-frame--synthese {
    grid-area: synthese;
  }

  main.main--dashboard.main--dashboard-home .dashboard-home-frame--hero {
    grid-area: hero;
  }

  main.main--dashboard.main--dashboard-home .dashboard-home-frame--depot {
    grid-area: depot;
  }

  main.main--dashboard.main--dashboard-home .dashboard-home-frame--quick {
    grid-area: quick;
  }

  main.main--dashboard.main--dashboard-home .dashboard-home-frame--hint {
    grid-area: hint;
  }

  main.main--dashboard.main--dashboard-home .dashboard-home-frame--imports {
    grid-area: imports;
  }

  /* 3 miniatures sur une ligne dans le panneau ~33 % */
  main.main--dashboard.main--dashboard-home .dashboard-home-frame--imports .dashboard-recent-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

main.main--dashboard.main--dashboard-home .dashboard-home-frame {
  background: #fff;
  border: 1px solid var(--border, #e2e8f0);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  padding: 1rem 1.35rem 1.35rem;
  box-sizing: border-box;
  overflow: hidden;
}

main.main--dashboard.main--dashboard-home .dashboard-home-frame--hero {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  justify-content: center;
}

main.main--dashboard.main--dashboard-home .dashboard-home-frame--hero .dashboard-title {
  margin: 0;
}

main.main--dashboard.main--dashboard-home .dashboard-hero-meta {
  margin: 0;
  font-size: 1rem;
  color: var(--text);
  font-weight: 500;
}

main.main--dashboard.main--dashboard-home .dashboard-hero-sub {
  margin: 0;
  font-size: 0.9rem;
  color: var(--muted);
}

main.main--dashboard.main--dashboard-home .dashboard-hero-sub--classeur {
  color: var(--text);
  font-size: 0.92rem;
  line-height: 1.45;
}

main.main--dashboard.main--dashboard-home .dashboard-home-frame--synthese {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

/* Titres de blocs : même bandeau dégradé que la page À propos (.panel__head) */
main.main--dashboard.main--dashboard-home .dashboard-home-frame--synthese > h2.dashboard-card-title,
main.main--dashboard.main--dashboard-home .dashboard-home-frame--quick > h2.dashboard-card-title,
main.main--dashboard.main--dashboard-home .dashboard-home-frame--hint > h2.dashboard-card-title {
  margin: -1rem -1.35rem 0.75rem;
  padding: 0.85rem 1.35rem;
  border-radius: var(--radius) var(--radius) 0 0;
}

main.main--dashboard.main--dashboard-home .dashboard-home-frame > section > h2.dashboard-card-title:first-child {
  margin: -1rem -1.35rem 0.75rem;
  padding: 0.85rem 1.35rem;
  border-radius: var(--radius) var(--radius) 0 0;
}

main.main--dashboard.main--dashboard-home .dashboard-home-frame .dashboard-card > h2.dashboard-card-title:first-child {
  margin: -1.25rem -1.35rem 0.75rem;
  padding: 0.85rem 1.35rem;
  border-radius: var(--radius) var(--radius) 0 0;
}

main.main--dashboard.main--dashboard-home .dashboard-home-frame .dashboard-card-title .dashboard-card-title__meta {
  font-weight: 600;
  color: rgba(255, 255, 255, 0.84);
  font-size: 0.88em;
  white-space: nowrap;
}

main.main--dashboard.main--dashboard-home .dashboard-summary-lines-wrap {
  display: flex;
  flex-direction: column;
  border: 1px solid color-mix(in srgb, var(--theme) 45%, var(--border));
  border-radius: var(--radius);
  overflow: hidden;
}

main.main--dashboard.main--dashboard-home .dashboard-summary-lines-head {
  margin: 0;
  flex-shrink: 0;
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: rgba(255, 255, 255, 0.98);
  padding: 0.65rem 1rem;
  border-bottom: 1px solid color-mix(in srgb, var(--theme) 55%, #0c1929 45%);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.14);
  text-shadow: 0 1px 1px rgba(15, 23, 42, 0.18);
  background: linear-gradient(
    165deg,
    color-mix(in srgb, var(--accent-hover) 35%, #0a3d5c) 0%,
    var(--theme) 42%,
    color-mix(in srgb, var(--theme) 58%, #164e7d) 100%
  );
}

main.main--dashboard.main--dashboard-home .dashboard-summary-lines {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 0;
  border: none;
  border-radius: 0;
  overflow: visible;
}

@supports not (border-color: color-mix(in srgb, red 1%, blue)) {
  main.main--dashboard.main--dashboard-home .dashboard-summary-lines-wrap {
    border-color: var(--border);
  }

  main.main--dashboard.main--dashboard-home .dashboard-summary-lines-head {
    border-bottom: 1px solid #0d4d73;
  }
}

@supports not (background: color-mix(in srgb, red 1%, blue)) {
  main.main--dashboard.main--dashboard-home .dashboard-summary-lines-head {
    background: linear-gradient(165deg, #0c5a85 0%, #168bcd 45%, #1270a8 100%);
  }
}

main.main--dashboard.main--dashboard-home .dashboard-summary-lines li {
  margin: 0;
  border-bottom: 1px solid var(--border, #e2e8f0);
}

main.main--dashboard.main--dashboard-home .dashboard-summary-lines li:last-child {
  border-bottom: none;
}

main.main--dashboard.main--dashboard-home .dashboard-summary-lines__row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 0.65rem 0.85rem;
  text-decoration: none;
  color: inherit;
  font-size: 0.9rem;
  line-height: 1.35;
  background: #fff;
  transition: background 0.12s ease;
}

main.main--dashboard.main--dashboard-home .dashboard-summary-lines__row:hover {
  background: #f8fafc;
}

/* Teintes alignées sur les cartes « Confiance, sécurité » (À propos) */
main.main--dashboard.main--dashboard-home .dashboard-summary-lines__row--amber {
  background: color-mix(in srgb, #ffedd5 52%, #fff);
  border-left: 4px solid #d97706;
}

main.main--dashboard.main--dashboard-home .dashboard-summary-lines__row--amber:hover {
  background: color-mix(in srgb, #ffedd5 72%, #fff);
}

main.main--dashboard.main--dashboard-home .dashboard-summary-lines__row--amber .dashboard-summary-lines__value {
  color: #c2410c;
}

main.main--dashboard.main--dashboard-home .dashboard-summary-lines__row--green {
  background: color-mix(in srgb, #dcfce7 55%, #fff);
  border-left: 4px solid #16a34a;
}

main.main--dashboard.main--dashboard-home .dashboard-summary-lines__row--green:hover {
  background: color-mix(in srgb, #dcfce7 78%, #fff);
}

main.main--dashboard.main--dashboard-home .dashboard-summary-lines__row--green .dashboard-summary-lines__value {
  color: #15803d;
}

main.main--dashboard.main--dashboard-home .dashboard-summary-lines__row--rose {
  background: color-mix(in srgb, #ffe4e6 50%, #fff);
  border-left: 4px solid #9f1239;
}

main.main--dashboard.main--dashboard-home .dashboard-summary-lines__row--rose:hover {
  background: color-mix(in srgb, #ffe4e6 72%, #fff);
}

main.main--dashboard.main--dashboard-home .dashboard-summary-lines__row--rose .dashboard-summary-lines__value {
  color: #9f1239;
}

main.main--dashboard.main--dashboard-home .dashboard-summary-lines__row--purple {
  background: color-mix(in srgb, #ede9fe 52%, #fff);
  border-left: 4px solid #7c3aed;
}

main.main--dashboard.main--dashboard-home .dashboard-summary-lines__row--purple:hover {
  background: color-mix(in srgb, #ede9fe 75%, #fff);
}

main.main--dashboard.main--dashboard-home .dashboard-summary-lines__row--purple .dashboard-summary-lines__value {
  color: #6d28d9;
}

@supports not (background: color-mix(in srgb, red 1%, blue)) {
  main.main--dashboard.main--dashboard-home .dashboard-summary-lines__row--amber {
    background: #fff7ed;
  }

  main.main--dashboard.main--dashboard-home .dashboard-summary-lines__row--amber:hover {
    background: #ffedd5;
  }

  main.main--dashboard.main--dashboard-home .dashboard-summary-lines__row--green {
    background: #f0fdf4;
  }

  main.main--dashboard.main--dashboard-home .dashboard-summary-lines__row--green:hover {
    background: #dcfce7;
  }

  main.main--dashboard.main--dashboard-home .dashboard-summary-lines__row--rose {
    background: #fff1f2;
  }

  main.main--dashboard.main--dashboard-home .dashboard-summary-lines__row--rose:hover {
    background: #ffe4e6;
  }

  main.main--dashboard.main--dashboard-home .dashboard-summary-lines__row--purple {
    background: #faf5ff;
  }

  main.main--dashboard.main--dashboard-home .dashboard-summary-lines__row--purple:hover {
    background: #ede9fe;
  }
}

main.main--dashboard.main--dashboard-home .dashboard-summary-lines__label {
  flex: 1;
  min-width: 0;
}

main.main--dashboard.main--dashboard-home .dashboard-summary-lines__value {
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  color: var(--theme, #2563eb);
}

main.main--dashboard.main--dashboard-home .dashboard-home-frame--quick,
main.main--dashboard.main--dashboard-home .dashboard-home-frame--hint {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  justify-content: flex-start;
}

main.main--dashboard.main--dashboard-home .dashboard-minilink-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

main.main--dashboard.main--dashboard-home .dashboard-minilink-list a {
  font-size: 0.9rem;
  font-weight: 500;
  color: var(--theme, #2563eb);
  text-decoration: none;
}

main.main--dashboard.main--dashboard-home .dashboard-minilink-list a:hover {
  text-decoration: underline;
}

main.main--dashboard.main--dashboard-home .dashboard-hint-text {
  margin: 0;
  font-size: 0.9rem;
  color: var(--muted);
  line-height: 1.5;
}

main.main--dashboard.main--dashboard-home .dashboard-home-frame--depot {
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}

/* Un seul cadre (le .dashboard-home-frame) : pas de .dashboard-card interne sur le dépôt */
main.main--dashboard.main--dashboard-home .dashboard-depot-section {
  margin: 0;
  padding: 0;
  background: transparent;
  border: none;
  box-shadow: none;
}

main.main--dashboard.main--dashboard-home .dashboard-home-section {
  min-width: 0;
}

#depot-rapide {
  scroll-margin-top: 1.25rem;
}

.dashboard-main-head {
  margin-bottom: 1.25rem;
}

.dashboard-title {
  font-size: 1.5rem;
  font-weight: 600;
  margin: 0 0 0.35rem;
}

.dashboard-doc-count {
  font-weight: 500;
  color: var(--muted);
  font-size: 1rem;
}

.dashboard-lead {
  margin: 0;
  color: var(--muted);
  font-size: 0.95rem;
}

.dashboard-grid {
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}

.dashboard-col-main {
  display: flex;
  flex-direction: column;
  gap: 1.75rem;
}

@media (min-width: 900px) {
  .dashboard-grid {
    flex-direction: row;
    align-items: flex-start;
  }

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

  .dashboard-col-side {
    flex: 0 0 320px;
    max-width: 100%;
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
  }
}

.dashboard-stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 1rem;
}

.dashboard-stat-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.35rem;
  padding: 1.25rem 1rem;
  border-radius: var(--radius);
  background: #fff;
  border: 1px solid var(--border);
  box-shadow: var(--shadow-sm);
  text-decoration: none;
  color: inherit;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.dashboard-stat-card:hover {
  border-color: var(--theme);
  box-shadow: 0 4px 12px rgba(15, 23, 42, 0.08);
}

.dashboard-stat-card--warn .dashboard-stat-value {
  color: #ca8a04;
}

.dashboard-stat-card--ok .dashboard-stat-value {
  color: #16a34a;
}

.dashboard-stat-card--err .dashboard-stat-value {
  color: #dc2626;
}

.dashboard-stat-card--muted .dashboard-stat-value {
  color: var(--muted);
}

.dashboard-stat-value {
  font-size: 2rem;
  font-weight: 700;
  line-height: 1;
}

.dashboard-stat-label {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--muted);
  text-align: center;
}

.dashboard-recent-grid {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(148px, 1fr));
  gap: 1rem;
}

.dashboard-recent-item {
  min-width: 0;
}

.dashboard-recent-card {
  position: relative;
  display: flex;
  flex-direction: column;
  height: 100%;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  background: var(--surface);
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.dashboard-recent-card:hover {
  border-color: var(--theme);
  box-shadow: var(--shadow-sm);
}

.dashboard-recent-preview {
  aspect-ratio: 3 / 4;
  background: var(--form-surface);
  position: relative;
  overflow: hidden;
}

.dashboard-recent-preview img {
  width: 100%;
  height: 100%;
  border: none;
  display: block;
  pointer-events: none;
  object-fit: cover;
}

.dashboard-recent-preview img.dashboard-recent-thumb {
  object-fit: contain;
  background: #f1f5f9;
}

/* Aperçu 1re page PDF (visionneuse intégrée du navigateur dans la vignette) */
.dashboard-recent-frame {
  width: 100%;
  height: 100%;
  border: none;
  display: block;
  pointer-events: none;
  background: #525659;
}

.dashboard-recent-fallback {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 100%;
  font-size: 2.25rem;
  line-height: 1;
  opacity: 0.8;
}

.dashboard-recent-card-body {
  padding: 0.55rem 0.65rem 0.7rem;
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
  border-top: 1px solid var(--border);
  pointer-events: none;
}

.dashboard-recent-name {
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--text);
  word-break: break-word;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  line-height: 1.3;
}

.dashboard-recent-badge {
  display: inline-block;
  align-self: flex-start;
  font-size: 0.65rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  padding: 0.12rem 0.4rem;
  border-radius: 4px;
}

.dashboard-recent-badge--muted {
  background: var(--surface);
  color: var(--muted);
}

.dashboard-recent-badge--ok {
  background: #dcfce7;
  color: #166534;
}

.dashboard-recent-badge--warn {
  background: #fef9c3;
  color: #a16207;
}

.dashboard-recent-badge--err {
  background: #fee2e2;
  color: #b91c1c;
}

.dashboard-recent-meta {
  font-size: 0.72rem;
  color: var(--muted);
}

.dashboard-recent-overlay {
  position: absolute;
  inset: 0;
  z-index: 2;
  text-decoration: none;
}

.dashboard-recent-overlay:focus-visible {
  outline: 2px solid var(--theme);
  outline-offset: 2px;
}

.dashboard-recent-footer {
  margin: 1.25rem 0 0;
}

/* Mon compte : bandeau titre = même bloc que À propos (.panel__head sur carte .panel) */
main.main--dashboard.main--profil-page .profil-page .info-page--profil-banner {
  max-width: none;
  margin: 0 0 1.25rem;
}

main.main--dashboard.main--profil-page .info-page .panel__head:is(h1) {
  margin: 0;
}

main.main--dashboard.main--profil-page .profil-page-intro .profil-page-lead {
  color: var(--muted);
  font-size: 0.92rem;
  line-height: 1.45;
  max-width: 44rem;
}

/* Paramètres IA : bandeau pleine largeur (langage Mes documents / ancien profil) */
main.main--dashboard.main--ia-page .dashboard-main > .ia-page-head {
  margin-left: -1rem;
  margin-right: -1rem;
  margin-top: -1.25rem;
  margin-bottom: 1.25rem;
  padding: 0.85rem 1rem 1rem;
  border-radius: 0;
  border-bottom: 1px solid color-mix(in srgb, var(--theme) 55%, #0c1929 45%);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.14);
  background: linear-gradient(
    165deg,
    color-mix(in srgb, var(--accent-hover) 35%, #0a3d5c) 0%,
    var(--theme) 42%,
    color-mix(in srgb, var(--theme) 58%, #164e7d) 100%
  );
}

@supports not (background: color-mix(in srgb, red 1%, blue)) {
  main.main--dashboard.main--ia-page .dashboard-main > .ia-page-head {
    border-bottom: 1px solid #0d4d73;
    background: linear-gradient(165deg, #0c5a85 0%, #168bcd 45%, #1270a8 100%);
  }
}

main.main--dashboard.main--ia-page .ia-page-head__row {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem 1.25rem;
}

main.main--dashboard.main--ia-page .ia-page-head-main {
  flex: 1 1 12rem;
  min-width: 0;
}

main.main--dashboard.main--ia-page .ia-page-head .ia-page-title {
  margin: 0;
  font-size: clamp(1.2rem, 2.5vw, 1.45rem);
  font-weight: 700;
  line-height: 1.25;
  color: rgba(255, 255, 255, 0.98);
  text-shadow: 0 1px 1px rgba(15, 23, 42, 0.18);
}

main.main--dashboard.main--ia-page .ia-page-head .ia-page-lead {
  margin: 0.4rem 0 0;
  font-size: 0.92rem;
  line-height: 1.45;
  color: rgba(255, 255, 255, 0.82);
  max-width: 44rem;
}

main.main--dashboard.main--ia-page .ia-page-head .ia-page-status {
  flex: 0 1 auto;
  min-width: min(100%, 15.5rem);
  max-width: 26rem;
  border-radius: var(--radius);
  border: 1px solid rgba(255, 255, 255, 0.38);
  background: rgba(255, 255, 255, 0.12);
  box-shadow: 0 2px 10px rgba(15, 23, 42, 0.12);
  padding: 0.55rem 0.75rem;
}

main.main--dashboard.main--ia-page .ia-page-head .ia-page-status--ok {
  border-color: rgba(134, 239, 172, 0.55);
  background: rgba(240, 253, 244, 0.2);
}

main.main--dashboard.main--ia-page .ia-page-head .ia-page-status--warn {
  border-color: rgba(253, 224, 71, 0.65);
  background: rgba(255, 251, 235, 0.18);
}

main.main--dashboard.main--ia-page .ia-page-head .ia-page-status-label {
  color: rgba(255, 255, 255, 0.78);
}

main.main--dashboard.main--ia-page .ia-page-head .ia-page-status-value {
  color: rgba(255, 255, 255, 0.98);
  text-shadow: 0 1px 1px rgba(15, 23, 42, 0.12);
}

main.main--dashboard.main--ia-page .ia-page-head .ia-page-status-detail {
  color: rgba(255, 255, 255, 0.85);
}

/* Supervision : même squelette que À propos (.apropos-page / .panel / .panel__head) */
.info-page--supervision-wide {
  max-width: min(100%, 72rem);
}

.apropos-page.supervision-layout .supervision-intro-actions {
  margin-bottom: 0;
}

.apropos-page.supervision-layout .supervision-table-shell {
  padding: 0 1.35rem 1.25rem;
}

@media (max-width: 640px) {
  .apropos-page.supervision-layout .supervision-table-shell {
    padding-left: 1rem;
    padding-right: 1rem;
  }
}

.apropos-page.supervision-layout .supervision-th--actions,
.apropos-page.supervision-layout .supervision-td--actions {
  width: 1%;
  white-space: nowrap;
}

.apropos-page.supervision-layout .supervision-user-edit-link {
  font-weight: 600;
  color: var(--accent, #168bcd);
  text-decoration: underline;
  text-underline-offset: 0.12em;
}

.apropos-page-head {
  margin-bottom: 1.25rem;
}

.info-page {
  max-width: 42rem;
  margin: 0 auto;
}

.info-page--apropos-wide {
  max-width: 52rem;
}

.info-logo-wrap {
  text-align: center;
  margin: 0 0 1.75rem;
}

.info-logo {
  max-width: 100%;
  height: auto;
  vertical-align: middle;
}

.apropos-antibia-logo-wrap {
  text-align: center;
  margin: 0 0 1.1rem;
}

.apropos-antibia-logo {
  max-width: min(100%, 280px);
  height: auto;
  vertical-align: middle;
  display: inline-block;
}

/* À propos — encarts intro + réalisation (cadre, dégradé, barre thème) */
.apropos-intro,
.apropos-realisation {
  margin: 0 0 0.35rem;
  padding: 1.15rem 1.2rem 1.25rem 1.15rem;
  border-radius: 12px;
  border: 1px solid var(--form-border);
  border-left: 4px solid var(--theme);
  background: linear-gradient(
    160deg,
    var(--form-surface) 0%,
    var(--bg) 42%,
    color-mix(in srgb, var(--brand-ia) 8%, var(--bg) 92%) 100%
  );
  box-shadow: var(--shadow-sm);
}

@supports not (background: color-mix(in srgb, red 1%, blue)) {
  .apropos-intro,
  .apropos-realisation {
    background: linear-gradient(160deg, var(--form-surface) 0%, #fff 50%, #fff8f0 100%);
  }
}

.apropos-intro__masthead {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  gap: 1rem 1.35rem;
}

.apropos-intro__brand {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0.45rem 0.65rem;
  min-height: 3.25rem;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.88);
  border: 1px solid color-mix(in srgb, var(--theme) 18%, var(--border));
  box-shadow: 0 1px 0 rgba(255, 255, 255, 0.9) inset;
}

@supports not (border-color: color-mix(in srgb, red 1%, blue)) {
  .apropos-intro__brand {
    border-color: var(--form-border);
  }
}

.apropos-intro__logo-img {
  height: 50px;
  width: auto;
  max-width: 148px;
  object-fit: contain;
  display: block;
}

.apropos-intro__brand .logo-brand {
  font-size: clamp(1.45rem, 4vw, 1.9rem);
  font-weight: 800;
  letter-spacing: -0.04em;
  line-height: 1.05;
  white-space: nowrap;
}

.apropos-intro__copy {
  flex: 1 1 18rem;
  min-width: min(100%, 12rem);
}

.info-prose .apropos-intro__copy > p {
  margin: 0 0 0.95rem;
}

.info-prose .apropos-intro__copy > p:last-child {
  margin-bottom: 0;
}

.apropos-intro__lead strong {
  color: var(--theme);
  font-weight: 800;
}

.apropos-intro__accent {
  color: var(--theme);
  font-weight: 700;
}

.apropos-intro__closing {
  margin-top: 0.15rem;
  padding-top: 1rem;
  border-top: 1px dashed color-mix(in srgb, var(--theme) 28%, var(--border));
}

@supports not (border-color: color-mix(in srgb, red 1%, blue)) {
  .apropos-intro__closing {
    border-top-color: #b8d9f0;
  }
}

.apropos-intro__closing strong {
  color: var(--theme);
  font-weight: 800;
}

.info-prose p.apropos-contact-lead {
  margin-top: 1.5rem;
}

.info-page .panel {
  background: #fff;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 0;
  box-shadow: var(--shadow-sm);
  margin-bottom: 1.25rem;
  overflow: hidden;
}

.info-page .panel__head {
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: #64748b;
  padding: 0.85rem 1.35rem;
  border-bottom: 1px solid var(--border);
  background: #f8fafc;
}

/* À propos + Mon compte + tableau de bord accueil — bandeaux titres (dégradé bleu) */
.apropos-page .info-page .panel__head,
main.main--dashboard.main--profil-page .info-page .panel__head,
main.main--dashboard.main--dashboard-home .dashboard-home-frame .dashboard-card-title {
  color: rgba(255, 255, 255, 0.96);
  text-shadow: 0 1px 1px rgba(15, 23, 42, 0.18);
  border-bottom: 1px solid color-mix(in srgb, var(--theme) 55%, #0c1929 45%);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.14);
  background: linear-gradient(
    165deg,
    color-mix(in srgb, var(--accent-hover) 35%, #0a3d5c) 0%,
    var(--theme) 42%,
    color-mix(in srgb, var(--theme) 58%, #164e7d) 100%
  );
}

@supports not (background: color-mix(in srgb, red 1%, blue)) {
  .apropos-page .info-page .panel__head,
  main.main--dashboard.main--profil-page .info-page .panel__head,
  main.main--dashboard.main--dashboard-home .dashboard-home-frame .dashboard-card-title {
    border-bottom: 1px solid #0d4d73;
    background: linear-gradient(165deg, #0c5a85 0%, #168bcd 45%, #1270a8 100%);
  }
}

.info-prose {
  padding: 1.25rem 1.35rem;
  font-size: 0.95rem;
  line-height: 1.55;
  color: var(--text);
}

.info-prose p {
  margin: 0 0 1rem;
}

.info-prose p:last-child {
  margin-bottom: 0;
}

/* À propos — cartes confiance / sécurité */
.apropos-trust-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1rem;
  padding: 1.25rem 1.35rem 1.35rem;
}

@media (max-width: 640px) {
  .apropos-trust-grid {
    grid-template-columns: 1fr;
  }
}

/* Même esprit que .apropos-intro : cadre, dégradé, barre latérale teintée */
.apropos-trust-card {
  --trust-accent: var(--theme);
  border: 1px solid var(--form-border);
  border-radius: 12px;
  border-left: 4px solid var(--trust-accent);
  background: linear-gradient(
    160deg,
    color-mix(in srgb, var(--trust-accent) 11%, var(--form-surface)) 0%,
    var(--bg) 42%,
    color-mix(in srgb, var(--brand-ia) 8%, var(--bg) 92%) 100%
  );
  padding: 1rem 1.05rem 1.05rem;
  display: flex;
  flex-direction: column;
  min-height: 100%;
  box-sizing: border-box;
  box-shadow: var(--shadow-sm);
  transition: box-shadow 0.15s ease;
}

@supports not (background: color-mix(in srgb, red 1%, blue)) {
  .apropos-trust-card {
    background: linear-gradient(160deg, var(--form-surface) 0%, #fff 42%, #fff8f0 100%);
  }

  .apropos-trust-card--blue {
    background: linear-gradient(160deg, #dceafc 0%, #fff 42%, #fff5eb 100%);
  }

  .apropos-trust-card--green {
    background: linear-gradient(160deg, #dff5e8 0%, #fff 42%, #fff6ed 100%);
  }

  .apropos-trust-card--amber {
    background: linear-gradient(160deg, #fcefd9 0%, #fff 42%, #fff4e8 100%);
  }

  .apropos-trust-card--purple {
    background: linear-gradient(160deg, #ece8fc 0%, #fff 42%, #fff5f0 100%);
  }

  .apropos-trust-card--rose {
    background: linear-gradient(160deg, #fce8ec 0%, #fff 42%, #fff3ed 100%);
  }
}

.apropos-trust-card--blue {
  --trust-accent: #2563eb;
}

.apropos-trust-card--green {
  --trust-accent: #16a34a;
}

.apropos-trust-card--amber {
  --trust-accent: #d97706;
}

.apropos-trust-card--purple {
  --trust-accent: #7c3aed;
}

.apropos-trust-card--rose {
  --trust-accent: #9f1239;
}

.apropos-trust-card:hover {
  box-shadow:
    var(--shadow-sm),
    0 8px 22px color-mix(in srgb, var(--trust-accent) 12%, transparent);
}

@supports not (color: color-mix(in srgb, red 1%, blue)) {
  .apropos-trust-card:hover {
    box-shadow: var(--shadow-sm), 0 8px 22px rgba(15, 23, 42, 0.08);
  }
}

.apropos-trust-card__icon-wrap {
  width: 2.6rem;
  height: 2.6rem;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 0.75rem;
  flex-shrink: 0;
}

.apropos-trust-card__svg {
  display: block;
}

.apropos-trust-card--blue .apropos-trust-card__icon-wrap {
  background: #dbeafe;
  color: #2563eb;
}

.apropos-trust-card--green .apropos-trust-card__icon-wrap {
  background: #dcfce7;
  color: #16a34a;
}

.apropos-trust-card--amber .apropos-trust-card__icon-wrap {
  background: #ffedd5;
  color: #d97706;
}

.apropos-trust-card--purple .apropos-trust-card__icon-wrap {
  background: #ede9fe;
  color: #7c3aed;
}

.apropos-trust-card--rose .apropos-trust-card__icon-wrap {
  background: #ffe4e6;
  color: #9f1239;
}

.apropos-trust-card__title {
  margin: 0 0 0.45rem;
  font-size: 1rem;
  font-weight: 700;
  line-height: 1.3;
  color: var(--text);
}

.apropos-trust-card__desc {
  margin: 0 0 1rem;
  font-size: 0.88rem;
  line-height: 1.55;
  color: #475569;
  flex: 1;
}

.apropos-trust-card__tag {
  display: inline-block;
  align-self: flex-start;
  padding: 0.28rem 0.75rem;
  border-radius: 999px;
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.02em;
}

.apropos-trust-card--blue .apropos-trust-card__tag {
  background: #dbeafe;
  color: #1d4ed8;
}

.apropos-trust-card--green .apropos-trust-card__tag {
  background: #dcfce7;
  color: #15803d;
}

.apropos-trust-card--amber .apropos-trust-card__tag {
  background: #ffedd5;
  color: #c2410c;
}

.apropos-trust-card--purple .apropos-trust-card__tag {
  background: #ede9fe;
  color: #6d28d9;
}

.apropos-trust-card--rose .apropos-trust-card__tag {
  background: #ffe4e6;
  color: #9f1239;
}

.document-preuve-page .document-preuve-dl {
  display: grid;
  grid-template-columns: minmax(10rem, 14rem) 1fr;
  gap: 0.4rem 1.25rem;
  margin: 1rem 0 0;
}

.document-preuve-page .document-preuve-dl dt {
  font-weight: 600;
  color: #64748b;
  margin: 0;
}

.document-preuve-page .document-preuve-dl dd {
  margin: 0;
}

.document-preuve-mono {
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  font-size: 0.82rem;
  word-break: break-all;
}

.document-preuve-actions {
  margin-top: 1.25rem;
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem 0.75rem;
}

/* Tampon visuel fiche de preuve (inspiré tampon circulaire type GED) */
.docia-preuve-stamp-block {
  margin: 0 0 1.35rem;
  max-width: 26rem;
}

.docia-preuve-stamp-filename {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  margin: 0 0 0.7rem;
  font-size: 0.9rem;
  line-height: 1.3;
}

.docia-preuve-stamp-filename__icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 2.1rem;
  height: 1.4rem;
  padding: 0 0.35rem;
  font-size: 0.58rem;
  font-weight: 800;
  color: #fff;
  background: #dc2626;
  border-radius: 3px;
  letter-spacing: 0.04em;
}

.docia-preuve-stamp-filename__text {
  color: #dc2626;
  font-weight: 600;
  word-break: break-word;
}

.docia-preuve-stamp-layout {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  gap: 1rem 1.5rem;
}

.docia-preuve-stamp {
  flex: 0 0 auto;
}

/* Tampon image + texte centré */
.docia-preuve-stamp__frame {
  position: relative;
  width: 9.5rem;
  height: 9.5rem;
  flex-shrink: 0;
}

.docia-preuve-stamp__png {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.docia-preuve-stamp__overlay {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 0.45rem 0.6rem;
  box-sizing: border-box;
  color: #2e5dcb;
  pointer-events: none;
  line-height: 1.22;
}

/* Cercle CSS (repli si pas de tampon.png) */
.docia-preuve-stamp__outer--fallback {
  position: relative;
  width: 9.5rem;
  height: 9.5rem;
  border-radius: 50%;
  border: 3px solid #2e5dcb;
  box-sizing: border-box;
  display: flex;
  align-items: center;
  justify-content: center;
  background: color-mix(in srgb, #2e5dcb 6%, transparent);
}

@supports not (background: color-mix(in srgb, red 1%, blue)) {
  .docia-preuve-stamp__outer--fallback {
    background: rgba(46, 93, 203, 0.06);
  }
}

.docia-preuve-stamp__outer--fallback::after {
  content: '';
  position: absolute;
  inset: 10%;
  border: 1.5px solid #2e5dcb;
  border-radius: 50%;
  pointer-events: none;
}

.docia-preuve-stamp__outer--fallback .docia-preuve-stamp__label {
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
  font-size: 0.52rem;
  font-weight: 800;
  letter-spacing: 0.14em;
  color: #2e5dcb;
  text-transform: uppercase;
  white-space: nowrap;
}

.docia-preuve-stamp__label--top {
  top: 0.55rem;
}

.docia-preuve-stamp__label--bottom {
  bottom: 0.48rem;
}

.docia-preuve-stamp__outer--fallback .docia-preuve-stamp__inner {
  position: relative;
  z-index: 1;
  text-align: center;
  line-height: 1.22;
  padding: 0 0.45rem;
  color: #2e5dcb;
}

.docia-preuve-stamp__archive {
  display: block;
  font-size: 0.56rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.docia-preuve-stamp__date {
  display: block;
  font-size: 0.92rem;
  font-weight: 800;
  margin: 0.18rem 0 0;
}

.docia-preuve-stamp__time {
  font-size: 0.82rem;
  font-weight: 700;
}

.docia-preuve-stamp-aside {
  flex: 1 1 8rem;
  min-width: 6rem;
  font-size: 0.86rem;
  color: var(--text);
  padding-top: 0.15rem;
}

.docia-preuve-stamp-meta {
  margin: 0;
  line-height: 1.45;
}

.docia-preuve-stamp-footer {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: baseline;
  gap: 0.35rem 1rem;
  margin-top: 0.45rem;
  max-width: 22rem;
  font-size: 0.88rem;
}

.docia-preuve-stamp-par {
  margin: 0;
  color: #2e5dcb;
  font-weight: 600;
}

.docia-preuve-stamp-par--empty {
  min-width: 0;
}

.docia-preuve-stamp-docid {
  margin: 0 0 0 auto;
  color: #2e5dcb;
  font-weight: 600;
}

.info-tagline {
  text-align: center;
  font-weight: 700;
  font-style: normal;
  color: var(--theme);
  margin-bottom: 0 !important;
}

.info-tagline a {
  color: inherit;
  text-decoration: none;
  font-weight: 700;
}

.info-tagline a:hover {
  text-decoration: underline;
}

.info-tagline--contact {
  margin-top: 0.35rem !important;
  line-height: 1.5;
}

.info-tagline__sep {
  font-weight: 700;
  color: inherit;
  white-space: pre;
}

.info-tagline__num {
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.02em;
}

.info-version {
  font-size: 0.8rem;
  color: var(--muted);
  text-align: center;
  margin: 0.5rem 0 0;
}

.info-version-badge {
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.04em;
  color: var(--text);
  font-weight: 700;
}

.profil-layout {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1.25rem;
  align-items: start;
  max-width: none;
}

@media (min-width: 900px) {
  main.main--dashboard.main--profil-page .profil-layout {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

/* Cartes profil : hauteur homogène quand les deux colonnes sont côte à côte */
@media (min-width: 900px) {
  main.main--dashboard.main--profil-page .profil-layout .profil-card {
    height: 100%;
    display: flex;
    flex-direction: column;
  }
}

.profil-card .profil-form {
  margin-top: 1rem;
}

.profil-hint {
  margin: 0 0 1rem;
  font-size: 0.9rem;
  color: var(--muted);
  line-height: 1.45;
}

.profil-readonly {
  margin: 0;
  display: grid;
  gap: 0.75rem;
}

.profil-readonly dt {
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--muted);
  margin: 0 0 0.2rem;
}

.profil-readonly dd {
  margin: 0;
  font-size: 0.95rem;
}

.dashboard-card {
  background: #fff;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.25rem 1.35rem;
  box-shadow: var(--shadow-sm);
}

.dashboard-card-title {
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: #64748b;
  margin: 0 0 0.5rem;
}

.dashboard-card-intro {
  margin: 0 0 1rem;
  font-size: 0.88rem;
  color: var(--muted);
  line-height: 1.45;
}

.dashboard-card--tip {
  background: #fffbeb;
  border-color: #fde68a;
}

.dashboard-tip-text {
  margin: 0;
  font-size: 0.9rem;
  color: var(--text);
  line-height: 1.5;
}

.dashboard-list-links {
  list-style: none;
  margin: 0;
  padding: 0;
}

.dashboard-list-links li {
  margin: 0;
  border-bottom: 1px solid var(--border);
}

.dashboard-list-links li:last-child {
  border-bottom: none;
}

.dashboard-list-links a {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.75rem 0;
  text-decoration: none;
  color: var(--text);
}

.dashboard-list-links a:hover .dashboard-list-label {
  color: var(--theme);
}

.dashboard-list-badge {
  font-weight: 700;
  font-size: 0.95rem;
  min-width: 2rem;
  text-align: center;
}

.dashboard-list-badge--warn {
  color: #ca8a04;
}

.dashboard-list-badge--ok {
  color: #16a34a;
}

.dashboard-list-badge--err {
  color: #dc2626;
}

.dashboard-dropzone {
  display: block;
  text-align: center;
  text-decoration: none;
  color: inherit;
  padding: 1.25rem 1rem;
  border: 2px dashed var(--form-border);
  border-radius: var(--radius);
  background: var(--surface);
  transition: border-color 0.15s ease, background 0.15s ease;
  cursor: pointer;
}

.dashboard-quick-upload-form {
  margin: 0;
}

.dashboard-dropzone:hover {
  border-color: var(--theme);
  background: var(--form-surface);
}

.dashboard-dropzone--drag {
  border-color: var(--theme);
  background: var(--form-surface);
  box-shadow: 0 0 0 2px rgba(22, 139, 205, 0.25);
}

.dashboard-dropzone--busy {
  cursor: wait;
  opacity: 0.9;
  pointer-events: none;
}

.dashboard-upload-status:not(.visually-hidden) {
  display: block;
  margin-top: 0.5rem;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--theme, #168bcd);
}

.dashboard-dropzone-text {
  display: block;
  font-size: 0.9rem;
  color: var(--muted);
}

.dashboard-mini-docs {
  list-style: none;
  margin: 0;
  padding: 0;
}

.dashboard-mini-docs li {
  padding: 0.6rem 0;
  border-bottom: 1px solid var(--border);
  font-size: 0.88rem;
}

.dashboard-mini-docs li:last-child {
  border-bottom: none;
}

.dashboard-mini-name {
  display: block;
  font-weight: 500;
  word-break: break-word;
}

.dashboard-mini-meta {
  display: block;
  font-size: 0.8rem;
  color: var(--muted);
  margin-top: 0.2rem;
}

.dashboard-empty {
  margin: 0 0 0.75rem;
  color: var(--muted);
  font-size: 0.9rem;
}

/* Page Mes documents : titre + filtres / tri / vues sur une même ligne (bloc droit aligné à droite) */
.documents-page-head {
  display: block;
  margin-bottom: 1.25rem;
}

.documents-page-head-main {
  width: 100%;
  min-width: 0;
  max-width: 100%;
}

.documents-page-head--empty {
  margin-bottom: 1rem;
}

/* Mes documents — bandeau titre (Mes documents, v1.x, compteur, boutons vues) : dégradé comme À propos */
main.main--dashboard.main--documents-page .documents-app-layout__center > .documents-page-head {
  margin-left: -1.35rem;
  margin-right: -1.35rem;
  margin-bottom: 1.25rem;
  margin-top: -1rem;
  padding: 0.85rem 1.35rem 1rem;
  border-radius: var(--radius) var(--radius) 0 0;
  border-bottom: 1px solid color-mix(in srgb, var(--theme) 55%, #0c1929 45%);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.14);
  background: linear-gradient(
    165deg,
    color-mix(in srgb, var(--accent-hover) 35%, #0a3d5c) 0%,
    var(--theme) 42%,
    color-mix(in srgb, var(--theme) 58%, #164e7d) 100%
  );
}

main.main--dashboard.main--documents-page .documents-app-layout__center > .alert ~ .documents-page-head {
  margin-top: 0.75rem;
}

main.main--dashboard.main--documents-page .documents-app-layout__center > .documents-page-head.documents-page-head--empty {
  margin-bottom: 1rem;
}

@supports not (background: color-mix(in srgb, red 1%, blue)) {
  main.main--dashboard.main--documents-page .documents-app-layout__center > .documents-page-head {
    border-bottom: 1px solid #0d4d73;
    background: linear-gradient(165deg, #0c5a85 0%, #168bcd 45%, #1270a8 100%);
  }
}

main.main--dashboard.main--documents-page .documents-app-layout__center > .documents-page-head .documents-page-title-row h1,
main.main--dashboard.main--documents-page .documents-app-layout__center > .documents-page-head .documents-page-title-with-version {
  color: rgba(255, 255, 255, 0.98);
  text-shadow: 0 1px 1px rgba(15, 23, 42, 0.18);
}

main.main--dashboard.main--documents-page .documents-app-layout__center > .documents-page-head .documents-page-doc-count {
  color: rgba(255, 255, 255, 0.82);
}

main.main--dashboard.main--documents-page .documents-app-layout__center > .documents-page-head .documents-page-title-version {
  background: rgba(255, 255, 255, 0.22);
  color: #fff;
  border: 1px solid rgba(255, 255, 255, 0.38);
  box-shadow: none;
}

main.main--dashboard.main--documents-page .documents-app-layout__center > .documents-page-head .documents-page-view-badge {
  color: rgba(255, 255, 255, 0.95);
  background: rgba(255, 255, 255, 0.15);
  border-color: rgba(255, 255, 255, 0.35);
}

main.main--dashboard.main--documents-page .documents-app-layout__center > .documents-page-head .documents-bulk-actions-trigger {
  background: rgba(255, 255, 255, 0.96);
  border-color: rgba(255, 255, 255, 0.55);
  color: var(--text);
}

main.main--dashboard.main--documents-page .documents-app-layout__center > .documents-page-head .documents-view-toggle {
  background: rgba(255, 255, 255, 0.12);
  border-color: rgba(255, 255, 255, 0.28);
  box-shadow: none;
}

main.main--dashboard.main--documents-page .documents-app-layout__center > .documents-page-head .documents-view-btn {
  color: rgba(255, 255, 255, 0.88);
}

main.main--dashboard.main--documents-page .documents-app-layout__center > .documents-page-head .documents-view-btn + .documents-view-btn {
  border-left-color: rgba(255, 255, 255, 0.22);
}

main.main--dashboard.main--documents-page .documents-app-layout__center > .documents-page-head .documents-view-btn:hover {
  color: #fff;
  background: rgba(255, 255, 255, 0.14);
}

main.main--dashboard.main--documents-page .documents-app-layout__center > .documents-page-head .documents-view-btn.is-active {
  background: rgba(255, 255, 255, 0.95);
  color: var(--theme);
}

main.main--dashboard.main--documents-page .documents-app-layout__center > .documents-page-head .documents-view-btn.is-active:hover {
  background: #fff;
  color: var(--accent-hover);
}

main.main--dashboard.main--documents-page .documents-app-layout__center > .documents-page-head .btn.btn-ghost {
  color: rgba(255, 255, 255, 0.96);
  border-color: rgba(255, 255, 255, 0.45);
  background: rgba(255, 255, 255, 0.08);
}

main.main--dashboard.main--documents-page .documents-app-layout__center > .documents-page-head .btn.btn-ghost:hover,
main.main--dashboard.main--documents-page .documents-app-layout__center > .documents-page-head .btn.btn-ghost:focus-visible {
  color: #fff;
  background: rgba(255, 255, 255, 0.18);
  border-color: rgba(255, 255, 255, 0.6);
}

.documents-page-title-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.65rem 1rem;
  margin-bottom: 0.65rem;
  width: 100%;
  min-width: 0;
  min-height: 2.75rem;
}

.documents-page-title-row h1 {
  margin: 0;
  flex: 0 1 auto;
  min-width: 0;
}

.documents-page-title-with-version {
  display: inline-flex;
  align-items: baseline;
  flex-wrap: wrap;
  gap: 0.35rem 0.65rem;
}

.documents-page-title-version {
  display: inline-block;
  margin-left: 0.35rem;
  padding: 0.12em 0.42em 0.14em;
  font-size: 0.45em;
  font-weight: 600;
  line-height: 1.2;
  letter-spacing: 0.03em;
  color: #fff;
  background: var(--accent);
  border-radius: 999px;
  vertical-align: 0.12em;
  cursor: default;
  user-select: none;
  pointer-events: none;
  box-shadow: 0 1px 2px color-mix(in srgb, var(--theme) 35%, transparent);
}

.documents-list-more-bar {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.65rem 1rem;
  padding: 0.65rem 1rem;
  border-top: 1px solid rgba(15, 23, 42, 0.08);
  background: rgba(248, 250, 252, 0.9);
}

.documents-list-more-status {
  font-size: 0.85rem;
  color: var(--muted);
}

.documents-page-doc-count {
  font-size: 0.58em;
  font-weight: 600;
  color: var(--muted);
  margin: 0;
  line-height: 1.35;
  white-space: nowrap;
  letter-spacing: 0.02em;
}

.documents-page-view-badge {
  font-size: 0.52em;
  font-weight: 600;
  letter-spacing: 0.02em;
  color: var(--text);
  margin: 0;
  padding: 0.22rem 0.55rem;
  border-radius: 6px;
  background: rgba(37, 99, 235, 0.09);
  border: 1px solid rgba(37, 99, 235, 0.22);
  line-height: 1.3;
  white-space: nowrap;
  vertical-align: baseline;
}

/* Même ligne que la pastille « Liste simplifiée » : pas de align-self:center (décale vers le haut par rapport aux badges). */
.documents-bulk-actions {
  position: relative;
  display: inline-flex;
  vertical-align: baseline;
  max-width: min(100%, 20rem);
  min-width: 0;
}

.documents-bulk-actions-trigger {
  display: flex;
  align-items: center;
  min-width: 0;
  font-size: 0.52em;
  font-weight: 600;
  letter-spacing: 0.02em;
  margin: 0;
  padding: 0.2rem 1.85rem 0.2rem 0.5rem;
  border-radius: 6px;
  border: 1px solid var(--border);
  background-color: var(--surface-elevated);
  color: var(--text);
  width: 100%;
  line-height: 1.35;
  cursor: pointer;
  text-align: left;
  font-family: inherit;
}

.documents-bulk-actions-trigger-label {
  flex: 1 1 auto;
  min-width: 0;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}

.documents-bulk-actions-trigger:focus {
  outline: 2px solid var(--theme);
  outline-offset: 1px;
}

.documents-bulk-actions-trigger:disabled {
  opacity: 0.65;
  cursor: not-allowed;
}

.documents-bulk-actions-panel {
  position: absolute;
  top: calc(100% + 8px);
  left: 0;
  min-width: max(100%, 20rem);
  max-width: min(26rem, calc(100vw - 1.5rem));
  max-height: min(70vh, 24rem);
  overflow-y: auto;
  z-index: 400;
  padding: 0.2rem 0;
  margin: 0;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface-elevated);
  box-shadow: 0 10px 28px rgba(15, 23, 42, 0.14);
}

.documents-bulk-actions-panel[hidden] {
  display: none !important;
}

/* Pagination pied de liste (client : filtres + pages) */
[data-documents-results] [data-doc-row].documents-pagination--off {
  display: none !important;
}

.documents-pagination-bar {
  display: flex;
  flex-direction: row;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 0.5rem 1rem;
  padding: 0.55rem 0.35rem 0.35rem;
  margin-top: 0.35rem;
  border-top: 1px solid color-mix(in srgb, var(--border) 75%, transparent);
  background: var(--surface, #fff);
  font-size: 0.88rem;
  color: #64748b;
}

.documents-pagination-bar__right {
  display: flex;
  flex-direction: row;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.45rem 0.65rem;
  margin-left: auto;
}

.documents-pagination-bar__select {
  padding: 0.2rem 1.75rem 0.2rem 0.45rem;
  font-size: 0.88rem;
  font-family: inherit;
  color: #64748b;
  border: 1px solid #cbd5e1;
  border-radius: 6px;
  background: var(--surface, #fff);
  cursor: pointer;
  min-width: 3.25rem;
}

.documents-pagination-bar__nav {
  display: inline-flex;
  align-items: center;
  gap: 2px;
}

.documents-pagination-bar__btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.65rem;
  height: 1.65rem;
  margin: 0;
  padding: 0;
  border: none;
  border-radius: 4px;
  background: transparent;
  color: #64748b;
  font: inherit;
  font-size: 1rem;
  line-height: 1;
  cursor: pointer;
}

.documents-pagination-bar__btn:hover:not(:disabled) {
  color: var(--theme, #2563eb);
  background: color-mix(in srgb, var(--theme, #2563eb) 8%, transparent);
}

.documents-pagination-bar__btn:disabled {
  opacity: 0.38;
  cursor: default;
}

.documents-bulk-actions-row {
  display: flex;
  align-items: stretch;
  flex-direction: row;
  border-bottom: 1px solid color-mix(in srgb, var(--border) 65%, transparent);
}

.documents-bulk-actions-row:last-child {
  border-bottom: none;
}

.documents-bulk-actions-row .documents-bulk-actions-item {
  flex: 1 1 auto;
  min-width: 0;
  border-radius: 0;
}

.documents-bulk-actions-item {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  width: 100%;
  margin: 0;
  padding: 0.42rem 0.65rem;
  border: 0;
  background: transparent;
  color: var(--text);
  font: inherit;
  font-size: 0.9rem;
  font-weight: 500;
  line-height: 1.35;
  text-align: left;
  cursor: pointer;
  border-radius: 0;
}

.documents-bulk-actions-item:hover:not(:disabled),
.documents-bulk-actions-item:focus-visible:not(:disabled) {
  background: rgba(37, 99, 235, 0.09);
  outline: none;
}

.documents-bulk-actions-item:disabled {
  opacity: 0.48;
  cursor: not-allowed;
}

.documents-bulk-actions-item-glyph {
  flex: 0 0 1.85rem;
  width: 1.85rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 1.05em;
  line-height: 1;
}

.documents-bulk-actions-item-label {
  flex: 1 1 auto;
  min-width: 0;
}

.documents-page-head-right {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: flex-end;
  gap: 0.5rem 0.75rem;
  flex: 1 1 auto;
  min-width: 0;
}

.documents-col-hidden {
  display: none !important;
}

.documents-cols-toolbar {
  position: relative;
}

/* Modale « Colonnes » (Mes documents) — rendue sous body en JS pour éviter clip/z-index des ancêtres */
.documents-cols-modal[hidden] {
  display: none !important;
}

.documents-cols-modal.documents-cols-modal--open {
  display: flex !important;
}

.documents-cols-modal {
  position: fixed;
  inset: 0;
  /* Au-dessus de toutes les modales / en-têtes de l’app (aperçu ~1000, toasts ~10050) */
  z-index: 999999;
  isolation: isolate;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  box-sizing: border-box;
}

.documents-cols-modal__backdrop {
  position: absolute;
  inset: 0;
  background: rgba(15, 23, 42, 0.45);
  cursor: pointer;
}

.documents-cols-modal__dialog {
  position: relative;
  z-index: 1;
  width: min(900px, calc(100vw - 2rem));
  height: min(600px, calc(100vh - 2rem));
  max-width: 900px;
  max-height: 600px;
  display: flex;
  flex-direction: column;
  background: var(--surface-elevated, #fff);
  border: 1px solid var(--border);
  border-radius: var(--radius, 10px);
  box-shadow: 0 20px 50px rgba(15, 23, 42, 0.2);
  overflow: hidden;
}

.documents-cols-modal__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 0.85rem 1.35rem;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}

/* Même bandeau dégradé que À propos (.apropos-page .info-page .panel__head) */
.documents-cols-modal__head--band {
  color: rgba(255, 255, 255, 0.96);
  text-shadow: 0 1px 1px rgba(15, 23, 42, 0.18);
  border-bottom: 1px solid color-mix(in srgb, var(--theme) 55%, #0c1929 45%);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.14);
  background: linear-gradient(
    165deg,
    color-mix(in srgb, var(--accent-hover) 35%, #0a3d5c) 0%,
    var(--theme) 42%,
    color-mix(in srgb, var(--theme) 58%, #164e7d) 100%
  );
}

@supports not (background: color-mix(in srgb, red 1%, blue)) {
  .documents-cols-modal__head--band {
    border-bottom: 1px solid #0d4d73;
    background: linear-gradient(165deg, #0c5a85 0%, #168bcd 45%, #1270a8 100%);
  }
}

.documents-cols-modal__head--band .documents-cols-modal__title {
  color: rgba(255, 255, 255, 0.98);
  font-size: 0.78rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  line-height: 1.35;
}

.documents-cols-modal__head--band .documents-cols-modal__close {
  color: rgba(255, 255, 255, 0.92);
  opacity: 1;
}

.documents-cols-modal__head--band .documents-cols-modal__close:hover,
.documents-cols-modal__head--band .documents-cols-modal__close:focus-visible {
  color: #fff;
  background: rgba(255, 255, 255, 0.16);
  outline: none;
}

.documents-cols-modal__title {
  margin: 0;
  font-size: 1.1rem;
  font-weight: 700;
}

.documents-cols-modal__close {
  appearance: none;
  border: none;
  background: transparent;
  font-size: 1.5rem;
  line-height: 1;
  padding: 0.15rem 0.4rem;
  cursor: pointer;
  color: var(--muted);
  border-radius: 4px;
}

.documents-cols-modal__close:hover,
.documents-cols-modal__close:focus-visible {
  color: var(--text);
  background: var(--surface, #f1f5f9);
  outline: none;
}

.documents-cols-modal__body {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  padding: 0.75rem 1rem 1rem;
  -webkit-overflow-scrolling: touch;
}

.documents-cols-modal__section {
  margin-bottom: 1.25rem;
}

.documents-cols-modal__section:last-of-type {
  margin-bottom: 0;
}

.documents-cols-modal__section--context {
  outline: 2px solid var(--accent-strong, #2563eb);
  outline-offset: 4px;
  border-radius: 10px;
}

.documents-cols-modal__section-title {
  margin: 0 0 0.5rem;
  font-size: 0.78rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--muted);
}

.documents-cols-modal__section-tools {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.45rem 0.65rem;
  margin-bottom: 0.55rem;
}

.documents-cols-modal__section-tools--row {
  justify-content: space-between;
  align-items: flex-end;
  gap: 0.65rem 1rem;
}

.documents-cols-modal__search-cluster {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.45rem 0.65rem;
  flex: 1 1 auto;
  min-width: min(100%, 12rem);
}

.documents-cols-modal__section-tools--row .documents-cols-preset-btn {
  flex: 0 0 auto;
  white-space: nowrap;
}

.documents-cols-modal__search-label {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text);
}

.documents-cols-modal__search-input {
  min-width: 10rem;
  flex: 1 1 12rem;
  max-width: 22rem;
  padding: 0.35rem 0.55rem;
  font: inherit;
  font-size: 0.84rem;
  border: 1px solid var(--form-border, #cbd5e1);
  border-radius: var(--radius, 6px);
  background: #fff;
}

.documents-cols-modal__table-wrap {
  border: 1px solid var(--border);
  border-radius: 8px;
  overflow: auto;
  max-height: min(22rem, 42vh);
}

.documents-cols-modal__table-wrap--scroll {
  -webkit-overflow-scrolling: touch;
}

.documents-cols-modal__table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.84rem;
}

.documents-cols-modal__table th,
.documents-cols-modal__table td {
  padding: 0.4rem 0.65rem;
  text-align: left;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}

.documents-cols-modal__table thead th {
  background: var(--surface, #f8fafc);
  font-weight: 600;
  position: sticky;
  top: 0;
  z-index: 1;
}

.documents-cols-modal__table--documents-like thead th {
  background: var(--documents-thead-bg);
  color: var(--text);
  box-shadow: 0 1px 0 var(--border);
  border-bottom: 1px solid var(--border);
}

.documents-cols-modal__table tbody tr:last-child td {
  border-bottom: none;
}

.documents-cols-modal__col-check {
  width: 6rem;
  text-align: center !important;
  white-space: nowrap;
}

.documents-cols-modal__col-check .documents-doc-check {
  vertical-align: middle;
}

.documents-cols-modal__col-check .documents-doc-check.documents-cols-check--locked:disabled {
  opacity: 1;
  cursor: not-allowed;
}

.documents-cols-modal__footer {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: flex-end;
  gap: 0.5rem;
  padding: 0.85rem 1rem;
  border-top: 1px solid var(--border);
  flex-shrink: 0;
  background: var(--surface, #f8fafc);
}

.documents-cols-modal__footer-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-left: auto;
}

.documents-cols-dropdown {
  position: relative;
}

.documents-cols-summary {
  list-style: none;
  cursor: pointer;
  user-select: none;
}

.documents-cols-summary::-webkit-details-marker {
  display: none;
}

.documents-cols-summary::marker {
  content: "";
}

.documents-cols-panel {
  position: absolute;
  right: 0;
  top: calc(100% + 0.35rem);
  z-index: 80;
  width: min(22rem, 92vw);
  max-height: min(85vh, 36rem);
  overflow-y: auto;
  padding: 0.85rem 1rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.12);
}

.documents-cols-panel-intro {
  font-size: 0.82rem;
  color: var(--muted);
  margin: 0 0 0.75rem;
  line-height: 1.45;
}

.documents-cols-panel-current {
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--text);
  margin: 0 0 0.65rem;
  line-height: 1.35;
}

/* Un seul bloc de cases : selon le mode Liste / Aperçu / Détail (classe posée par JS) */
.documents-cols-panel .documents-cols-fieldset[data-documents-cols-panel-view] {
  display: none !important;
}

.documents-cols-panel.documents-cols-panel--view-list .documents-cols-fieldset[data-documents-cols-panel-view="list"],
.documents-cols-panel.documents-cols-panel--view-grid .documents-cols-fieldset[data-documents-cols-panel-view="grid"],
.documents-cols-panel.documents-cols-panel--view-detail .documents-cols-fieldset[data-documents-cols-panel-view="detail"] {
  display: block !important;
}

.documents-cols-migration-hint {
  font-size: 0.8rem;
  color: #991b1b;
  margin: 0 0 0.5rem;
}

.documents-cols-fieldset {
  border: none;
  margin: 0 0 0.75rem;
  padding: 0;
}

.documents-cols-fieldset legend {
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--muted);
  margin: 0 0 0.35rem;
  padding: 0;
}

.documents-cols-checklist {
  list-style: none;
  margin: 0;
  padding: 0;
}

.documents-cols-checklist li {
  margin: 0.2rem 0;
}

.documents-cols-label {
  display: flex;
  align-items: flex-start;
  gap: 0.4rem;
  font-size: 0.875rem;
  cursor: pointer;
}

.documents-cols-empty-fields {
  font-size: 0.82rem;
  color: var(--muted);
  margin: 0;
}

.documents-page-lead {
  margin: 0.35rem 0 0;
  max-width: 100%;
  color: var(--muted);
  font-size: 0.95rem;
  line-height: 1.45;
}

.documents-view-toggle {
  display: inline-flex;
  flex-shrink: 0;
  border: 1px solid var(--border);
  border-radius: 8px;
  overflow: hidden;
  background: var(--surface-elevated);
  box-shadow: var(--shadow-sm);
}

.documents-view-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 2.75rem;
  min-height: 2.5rem;
  padding: 0.4rem 0.75rem;
  border: none;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  font-family: inherit;
  font-size: 1.1rem;
  line-height: 1;
  transition: background 0.15s ease, color 0.15s ease;
}

.documents-view-btn + .documents-view-btn {
  border-left: 1px solid var(--border);
}

.documents-view-btn:hover {
  color: var(--text);
  background: var(--surface);
}

.documents-view-btn.is-active {
  background: var(--theme);
  color: #fff;
}

.documents-view-btn.is-active:hover {
  background: var(--accent-hover);
  color: #fff;
}

.documents-results--list .documents-grid-wrap,
.documents-results--list .documents-detail-wrap {
  display: none;
}

.documents-results--grid .documents-table-wrap,
.documents-results--grid .documents-detail-wrap {
  display: none;
}

.documents-results--detail .documents-table-wrap,
.documents-results--detail .documents-grid-wrap {
  display: none;
}

.documents-detail-card {
  padding: 0;
  overflow: visible;
}

.documents-detail-card .documents-detail-sort-hint {
  margin: 0.75rem 1rem 0.65rem;
}

/* Défilement horizontal uniquement dans __body (une barre, en bas du bloc scrollable). */
.documents-table-hscroll {
  display: flex;
  flex-direction: column;
  max-width: 100%;
  min-width: 0;
}

.documents-table-hscroll.table-wrap,
.card.documents-table-hscroll.table-wrap {
  overflow-x: visible;
  overflow-y: visible;
}

.documents-detail-scroll.documents-table-hscroll {
  overflow: visible;
  max-width: 100%;
}

.documents-table-hscroll__body {
  overflow-x: auto;
  overflow-y: visible;
  max-width: 100%;
  min-width: 0;
  -webkit-overflow-scrolling: touch;
}

.documents-detail-scroll {
  -webkit-overflow-scrolling: touch;
}

/* Pas hériter de `table { width: 100% }` : sinon élargir une colonne compresse les autres au lieu de faire défiler horizontalement */
.documents-table-wrap table {
  width: max-content;
  min-width: 100%;
  table-layout: fixed;
  box-sizing: border-box;
  /* separate : collapse casse position:sticky sur thead dans plusieurs navigateurs */
  border-collapse: separate;
  border-spacing: 0;
}

.documents-detail-table {
  width: max-content;
  min-width: 100%;
  table-layout: fixed;
  box-sizing: border-box;
  border-collapse: separate;
  border-spacing: 0;
  font-size: 0.8125rem;
}

.documents-detail-table th,
.documents-detail-table td {
  border-bottom: 1px solid var(--border);
  padding: 0.45rem 0.65rem;
  vertical-align: top;
  text-align: left;
  white-space: nowrap;
}

.documents-table-wrap table thead th {
  position: sticky;
  top: var(--docia-app-sticky-top, 0px);
  z-index: 8;
  background: var(--form-surface);
  background: var(--documents-thead-bg);
  box-shadow: 0 1px 0 var(--border);
  color: var(--text);
  font-weight: 600;
}

/* Ligne de totaux (liste + détail) — reste visible en bas de la zone scrollable */
.documents-table-wrap table tfoot.documents-table-foot td,
.documents-detail-table tfoot.documents-table-foot td {
  position: sticky;
  bottom: 0;
  z-index: 2;
  background: var(--surface, #f8fafc);
  background: var(--documents-thead-bg, var(--form-surface));
  box-shadow: 0 -1px 0 var(--border);
  font-weight: 600;
  border-top: 2px solid var(--border);
  vertical-align: middle;
}

.documents-table-foot__num {
  text-align: right;
  font-variant-numeric: tabular-nums;
}

.documents-foot-sum-sign {
  display: inline-block;
  font-size: 1.2em;
  font-weight: 800;
  line-height: 1;
  letter-spacing: 0;
}

.documents-detail-table thead th {
  position: sticky;
  top: var(--docia-app-sticky-top, 0px);
  z-index: 8;
  background: var(--form-surface);
  background: var(--documents-thead-bg);
  box-shadow: 0 1px 0 var(--border);
  font-weight: 600;
  color: var(--text);
}

.documents-detail-table tbody tr:nth-child(even) {
  background: rgba(0, 80, 180, 0.04);
}

.documents-detail-table tbody tr:hover {
  background: rgba(0, 80, 180, 0.08);
}

.documents-detail-th--field,
.documents-detail-td--field {
  min-width: 5.5rem;
}

.documents-detail-email {
  white-space: nowrap;
}

.documents-detail-email-link {
  color: var(--accent, #2563eb);
  text-decoration: none;
}

.documents-detail-email-link:hover,
.documents-detail-email-link:focus-visible {
  text-decoration: underline;
}

.documents-detail-td--tampon .documents-tampon-text {
  white-space: nowrap;
}

.documents-detail-td--analyse {
  white-space: nowrap;
}

.documents-detail-td--analyse .doc-analyze-cell {
  flex-wrap: nowrap;
}

.documents-grid-card {
  padding: 1rem;
}

.documents-grid {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 1rem;
}

.documents-grid-item {
  display: flex;
  flex-direction: column;
  padding: 0;
  overflow: hidden;
  align-items: stretch;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.documents-grid-item:hover {
  border-color: var(--theme);
  box-shadow: var(--shadow-sm);
}

.documents-grid-item-inner {
  display: flex;
  flex-direction: column;
  height: 100%;
  min-width: 0;
  position: relative;
}

.documents-grid-select-wrap {
  position: absolute;
  top: 0.35rem;
  left: 0.35rem;
  z-index: 2;
  padding: 0.1rem;
  background: rgba(255, 255, 255, 0.92);
  border-radius: 4px;
  line-height: 0;
}

.documents-grid-select-wrap .documents-doc-check {
  display: block;
}

.documents-grid-preview {
  aspect-ratio: 3 / 4;
  background: var(--form-surface);
  position: relative;
  overflow: hidden;
}

.documents-grid-preview img {
  width: 100%;
  height: 100%;
  border: none;
  display: block;
  pointer-events: none;
  object-fit: cover;
}

.documents-grid-preview img.documents-grid-preview-thumb {
  object-fit: contain;
  background: #f1f5f9;
}

.documents-grid-preview-frame {
  width: 100%;
  height: 100%;
  border: none;
  display: block;
  pointer-events: none;
  background: #525659;
}

.documents-grid-preview-fallback {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 100%;
  font-size: 2.25rem;
  line-height: 1;
  opacity: 0.8;
}

.documents-grid-body {
  min-width: 0;
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  padding: 0.65rem 0.75rem 0.75rem;
  border-top: 1px solid var(--border);
}

.documents-classeur-form {
  margin: 0;
}

/* Flèche native remplacée : rendu aligné au thème KlassIA */
.documents-classeur-select {
  appearance: none;
  -webkit-appearance: none;
  -moz-appearance: none;
  margin: 0;
  display: block;
  max-width: 14rem;
  width: 100%;
  font-size: 0.8125rem;
  line-height: 1.35;
  font-family: inherit;
  font-weight: 500;
  color: var(--text);
  background-color: var(--surface-elevated);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%2364748b' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 0.5rem center;
  background-size: 0.75rem;
  border: 1px solid var(--form-border);
  border-radius: 6px;
  padding: 0.4rem 1.75rem 0.4rem 0.55rem;
  cursor: pointer;
  transition: border-color 0.15s ease, box-shadow 0.15s ease, background-color 0.15s ease;
}

.documents-classeur-select:hover {
  border-color: var(--theme);
  background-color: var(--bg);
}

.documents-classeur-select:focus {
  outline: none;
}

.documents-classeur-select:focus-visible {
  border-color: var(--theme);
  box-shadow: 0 0 0 2px rgba(22, 139, 205, 0.28);
}

td.documents-col-classeur,
.documents-detail-td.documents-col-classeur {
  vertical-align: middle;
}

.documents-col-classeur .documents-classeur-select,
.documents-detail-td.documents-col-classeur .documents-classeur-select {
  max-width: 13rem;
}

.documents-classeur-select--grid {
  max-width: 100%;
  font-size: 0.8rem;
  padding-top: 0.35rem;
  padding-bottom: 0.35rem;
}

.documents-grid-classeur-wrap {
  min-width: 0;
}

.documents-grid-name {
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--text);
  word-break: break-word;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

button.documents-grid-name {
  -webkit-appearance: none;
  appearance: none;
  border: none;
  background: none;
  padding: 0;
  margin: 0;
  text-align: left;
  cursor: pointer;
  font: inherit;
  color: inherit;
}

button.documents-grid-name:hover,
button.documents-grid-name:focus-visible {
  color: var(--accent, #2563eb);
  text-decoration: underline;
  outline: none;
}

.documents-grid-badge {
  display: inline-block;
  align-self: flex-start;
  font-size: 0.7rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  padding: 0.15rem 0.45rem;
  border-radius: 4px;
}

.documents-grid-badge--muted {
  background: var(--surface);
  color: var(--muted);
}

.documents-grid-badge--ok {
  background: #dcfce7;
  color: #166534;
}

.documents-grid-badge--warn {
  background: #fef9c3;
  color: #a16207;
}

.documents-grid-badge--err {
  background: #fee2e2;
  color: #b91c1c;
}

.documents-grid-meta {
  font-size: 0.78rem;
  color: var(--muted);
}

.documents-sort-active-hint {
  margin: 0 0 0.65rem;
  padding: 0.45rem 0.75rem;
  font-size: 0.88rem;
  color: var(--text);
  background: var(--form-surface);
  border-radius: var(--radius);
  border: 1px solid var(--border);
}

.documents-sort-active-hint__label {
  margin-right: 0.35rem;
  color: var(--muted);
  font-weight: 500;
}

.documents-sort-active-hint__sep {
  margin: 0 0.4rem;
  opacity: 0.55;
}

.doc-sort-toast {
  position: fixed;
  bottom: 1.25rem;
  left: 50%;
  z-index: 10050;
  max-width: min(92vw, 28rem);
  padding: 0.65rem 1.1rem;
  font-size: 0.92rem;
  line-height: 1.4;
  text-align: center;
  color: #fff;
  background: rgba(15, 23, 42, 0.92);
  border-radius: 999px;
  box-shadow: 0 6px 24px rgba(0, 0, 0, 0.2);
  transform: translate(-50%, 130%);
  opacity: 0;
  transition: transform 0.28s ease, opacity 0.28s ease;
  pointer-events: none;
}

.doc-sort-toast.is-visible {
  transform: translate(-50%, 0);
  opacity: 1;
}

.documents-th-sort {
  display: inline-flex;
  align-items: center;
  gap: 0.2rem;
  color: var(--text);
  text-decoration: none;
  font-weight: 600;
  border-radius: 4px;
  margin: 0;
  padding: 0.15rem 0.25rem;
}

body.documents-col-resize--dragging {
  user-select: none;
  cursor: col-resize;
}

/*
 * Ne pas mettre position: relative sur ces <th> : ça écrase position: sticky (cf. .documents-table-wrap table thead th)
 * et fait disparaître l’en-tête au scroll. Un <th> en sticky sert déjà de bloc d’ancrage aux .documents-th-resize-handle (absolute).
 */

.documents-th-resize-handle {
  position: absolute;
  top: 0;
  right: 0;
  width: 8px;
  height: 100%;
  min-height: 2rem;
  padding: 0;
  margin: 0;
  border: none;
  background: transparent;
  cursor: col-resize;
  z-index: 4;
  touch-action: none;
  border-radius: 0 4px 4px 0;
  box-sizing: border-box;
}

.documents-th-resize-handle:hover,
.documents-th-resize-handle:focus-visible {
  background: color-mix(in srgb, var(--theme, #168bcd) 20%, transparent);
}

.documents-th-resize-handle:focus-visible {
  outline: 2px solid var(--theme, #168bcd);
  outline-offset: -2px;
}

/* En-têtes triables : pas de :has() (navigateurs / polyfills) — classe .documents-th--sortable sur le <th> */
/* Ne jamais mettre display:flex sur <th> : ça casse display:table-cell et effondre le tableau en une colonne. */
.documents-table-wrap thead th.documents-th--sortable,
.documents-detail-table thead th.documents-th--sortable {
  padding: 0;
  padding-bottom: 0.35rem;
  vertical-align: top;
  cursor: pointer;
  box-sizing: border-box;
}

/* Contenu interne : flex OK dans un bloc à l’intérieur du <th> */
.documents-table-wrap thead th .documents-th-inner,
.documents-detail-table thead th .documents-th-inner {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  box-sizing: border-box;
  min-height: 4.5rem;
  height: 100%;
}

.documents-table-wrap thead th.documents-th--sortable .documents-th-inner .documents-col-filter-input,
.documents-detail-table thead th.documents-th--sortable .documents-th-inner .documents-col-filter-input {
  margin-top: auto;
  margin-bottom: 0;
  margin-left: 0.35rem;
  margin-right: 0.35rem;
}

.documents-col-filter-input {
  display: block;
  width: calc(100% - 0.7rem);
  max-width: 100%;
  box-sizing: border-box;
  font-size: 0.72rem;
  line-height: 1.2;
  padding: 0.2rem 0.35rem;
  margin: 0 0.35rem 0.4rem;
  border: 1px solid var(--border, #d1d5db);
  border-radius: 4px;
  background: var(--card, #fff);
  color: var(--text);
}

.documents-col-filter-input::placeholder {
  color: var(--muted, #6b7280);
  opacity: 1;
}

.documents-col-filter-input--right {
  text-align: right;
}

.documents-detail-table thead th.documents-detail-th--field {
  vertical-align: top;
  min-width: 5.5rem;
  box-sizing: border-box;
  padding: 0;
  padding-bottom: 0.35rem;
}

.documents-detail-table thead th.documents-detail-th--field .documents-th-inner .documents-col-filter-input {
  margin-top: auto;
  margin-bottom: 0;
  margin-left: 0.35rem;
  margin-right: 0.35rem;
}

.documents-table-wrap thead th.documents-th--sortable .documents-th-inner > a.documents-th-sort,
.documents-detail-table thead th.documents-th--sortable .documents-th-inner > a.documents-th-sort {
  flex-shrink: 0;
  min-height: 2.75rem;
  padding: 0.65rem 0.75rem;
  box-sizing: border-box;
  width: 100%;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  justify-content: center;
}

.documents-th-sort:hover,
.documents-th-sort:focus-visible {
  color: var(--accent, #2563eb);
  text-decoration: underline;
  outline: none;
}

.documents-th-sort--right {
  justify-content: center;
  width: 100%;
}

.documents-th-sort-icon {
  font-size: 0.75em;
  opacity: 0.85;
  font-variant-numeric: tabular-nums;
}

/* En-tête colonne fixe non triable (ex. Entité) : même hauteur que les liens de tri */
.documents-table-wrap thead th.documents-col-entite,
.documents-detail-table thead th.documents-col-entite {
  padding: 0;
  padding-bottom: 0.35rem;
  vertical-align: top;
  box-sizing: border-box;
}

.documents-table-wrap thead th.documents-col-entite .documents-th-inner > .documents-th-label-static,
.documents-detail-table thead th.documents-col-entite .documents-th-inner > .documents-th-label-static {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  min-height: 2.75rem;
  padding: 0.65rem 0.75rem;
  box-sizing: border-box;
  width: 100%;
  font-weight: 600;
  font-size: 0.8rem;
  line-height: 1.25;
  color: var(--text);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.documents-table-wrap thead th.documents-col-entite .documents-th-inner .documents-col-filter-input,
.documents-detail-table thead th.documents-col-entite .documents-th-inner .documents-col-filter-input {
  margin-top: auto;
  margin-bottom: 0;
  margin-left: 0.35rem;
  margin-right: 0.35rem;
}

/* Réordonnancement : pas de rangée de poignées ; tout retrait JS éventuel est complété ici. */
table[data-doc-col-reorder='1'] thead .documents-col-drag-handle /* legacy */
{
  display: none !important;
}

/* Réordonnancement : glisser depuis le libellé de colonne (plus de rangée ⋮⋮) */
table[data-doc-col-reorder='1'] thead th[data-doc-col-id]:not([data-doc-col-id='select']) .documents-th-sort,
table[data-doc-col-reorder='1'] thead th[data-doc-col-id]:not([data-doc-col-id='select']) .documents-th-label-static {
  cursor: grab;
  user-select: none;
}

table[data-doc-col-reorder='1'] thead th.documents-th--dragging .documents-th-sort,
table[data-doc-col-reorder='1'] thead th.documents-th--dragging .documents-th-label-static {
  cursor: grabbing;
}

.documents-th--dragging {
  opacity: 0.88;
}

.documents-col-taille {
  text-align: right;
  font-variant-numeric: tabular-nums;
}

.documents-table-wrap table tbody .documents-col-taille,
.documents-detail-table tbody .documents-col-taille {
  white-space: normal;
}

.documents-col-statut {
  font-size: 0.84rem;
  max-width: 8.5rem;
}

.documents-table-wrap table tbody .documents-col-statut,
.documents-detail-table tbody .documents-col-statut {
  white-space: normal;
}

.documents-col-type {
  max-width: 11rem;
  font-size: 0.85rem;
  color: var(--text);
  vertical-align: top;
  text-align: center;
}

.documents-col-client {
  max-width: 14rem;
  font-size: 0.85rem;
  vertical-align: top;
  word-break: break-word;
}

/* Champs IA additionnels en liste simplifiée (préférences Colonnes) */
.documents-table-wrap .documents-list-th--field {
  vertical-align: top;
  font-weight: 600;
  font-size: 0.8rem;
  max-width: 10rem;
  color: var(--text);
}

.documents-table-wrap thead th.documents-list-th--field {
  box-sizing: border-box;
  padding: 0;
  padding-bottom: 0.35rem;
}

.documents-table-wrap thead th.documents-list-th--field .documents-th-inner .documents-col-filter-input {
  margin-top: auto;
  margin-bottom: 0;
  margin-left: 0.35rem;
  margin-right: 0.35rem;
}

.documents-table-wrap .documents-list-ia-field-head.documents-th-head-primary,
.documents-detail-table .documents-detail-field-head.documents-th-head-primary {
  display: block;
  flex-shrink: 0;
  min-height: 2.75rem;
  padding: 0.65rem 0.75rem 0;
  box-sizing: border-box;
  line-height: 1.25;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 100%;
}

.documents-table-wrap .documents-list-ia-field-head {
  line-height: 1.25;
  flex-shrink: 0;
}

.documents-table-wrap .documents-list-td--field {
  font-size: 0.8rem;
  max-width: 11rem;
  min-width: 4rem;
  vertical-align: top;
  word-break: break-word;
  white-space: normal;
}

.documents-col-montant-paye {
  text-align: right;
  font-size: 0.85rem;
  font-variant-numeric: tabular-nums;
}

.documents-table-wrap table tbody .documents-col-montant-paye,
.documents-detail-table tbody .documents-col-montant-paye {
  white-space: normal;
}

.documents-grid-client,
.documents-grid-montant-paye {
  display: block;
  font-size: 0.76rem;
  line-height: 1.35;
  color: var(--muted);
  margin-top: 0.15rem;
  word-break: break-word;
}

.documents-grid-montant-paye {
  font-variant-numeric: tabular-nums;
  color: var(--text);
}

/* Pastilles type de document (liste / grille / onglet Infos) */
.documents-type-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  max-width: 100%;
  padding: 0.22rem 0.55rem;
  border-radius: 999px;
  font-size: 0.7rem;
  font-weight: 600;
  line-height: 1.25;
  letter-spacing: 0.01em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  box-sizing: border-box;
  vertical-align: middle;
}

.documents-type-badge--facture {
  background: #fee2e2;
  color: #b91c1c;
}

.documents-type-badge--courrier {
  background: #dbeafe;
  color: #1d4ed8;
}

.documents-type-badge--recu {
  background: #dcfce7;
  color: #15803d;
}

.documents-type-badge--avoir {
  background: #ffedd5;
  color: #c2410c;
}

.documents-type-badge--devis {
  background: #fef3c7;
  color: #b45309;
}

.documents-type-badge--particulier {
  background: #e0f2fe;
  color: #0369a1;
}

.documents-type-badge--bon_commande {
  background: #ede9fe;
  color: #5b21b6;
}

.documents-type-badge--autre {
  background: #f1f5f9;
  color: #475569;
  border: 1px solid #e2e8f0;
}

.documents-type-badge--default {
  background: var(--surface);
  color: var(--muted);
  border: 1px solid var(--border);
  font-weight: 500;
}

.documents-grid-type-badge {
  margin-top: 0.25rem;
}

.documents-type-muted {
  color: var(--muted);
}

.documents-grid-type {
  display: block;
  font-size: 0.78rem;
  font-weight: 500;
  color: var(--text);
  margin-top: 0.2rem;
  line-height: 1.3;
  word-break: break-word;
}

.documents-grid-type--empty {
  color: var(--muted);
  opacity: 0.75;
}

.sidebar-doc-field--typedoc .documents-type-badge {
  margin-bottom: 0.4rem;
}

.documents-col-tampon {
  max-width: 14rem;
  font-size: 0.85rem;
  color: var(--text);
  vertical-align: top;
}

.documents-tampon-text {
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  word-break: break-word;
  line-height: 1.35;
}

.documents-tampon-muted {
  color: var(--muted);
}

.documents-grid-tampon {
  display: block;
  font-size: 0.78rem;
  color: var(--muted);
  line-height: 1.35;
  margin-top: 0.15rem;
  word-break: break-word;
}

.documents-grid-tampon--empty {
  opacity: 0.6;
}

.documents-col-select {
  width: 1%;
  white-space: nowrap;
  text-align: center;
  vertical-align: middle;
}

/* Cases à cocher sélection documents — style personnalisé */
.documents-doc-check,
.documents-select-all-input {
  appearance: none;
  -webkit-appearance: none;
  width: 1.2rem;
  height: 1.2rem;
  margin: 0;
  cursor: pointer;
  vertical-align: middle;
  flex-shrink: 0;
  border: 2px solid #cbd5e1;
  border-radius: 6px;
  background: var(--surface-elevated);
  box-shadow: inset 0 1px 2px rgba(15, 23, 42, 0.06);
  transition:
    border-color 0.18s ease,
    background 0.18s ease,
    box-shadow 0.18s ease,
    transform 0.12s ease;
}

.documents-doc-check:hover,
.documents-select-all-input:hover {
  border-color: var(--theme);
  box-shadow:
    inset 0 1px 2px rgba(15, 23, 42, 0.06),
    0 0 0 3px color-mix(in srgb, var(--theme) 28%, transparent);
}

.documents-doc-check:active,
.documents-select-all-input:active {
  transform: scale(0.94);
}

.documents-doc-check:focus-visible,
.documents-select-all-input:focus-visible {
  outline: none;
  border-color: var(--theme);
  box-shadow:
    inset 0 1px 2px rgba(15, 23, 42, 0.06),
    0 0 0 3px color-mix(in srgb, var(--theme) 45%, transparent);
}

.documents-doc-check:checked,
.documents-select-all-input:checked {
  border-color: var(--accent-hover);
  background-image:
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 12' fill='none'%3E%3Cpath stroke='%23fff' stroke-width='2' stroke-linecap='round' stroke-linejoin='round' d='M2.5 6l2.5 2.5L9.5 3'/%3E%3C/svg%3E"),
    linear-gradient(155deg, #4fc3f7 0%, var(--theme) 50%, var(--accent-hover) 100%);
  background-size: 0.7rem, 100% 100%;
  background-position: center, center;
  background-repeat: no-repeat, no-repeat;
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.28),
    0 1px 3px color-mix(in srgb, var(--accent-hover) 45%, transparent);
}

.documents-select-all-input:indeterminate {
  border-color: var(--accent-hover);
  background-image:
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 12'%3E%3Crect x='2' y='5.25' width='8' height='1.5' rx='0.5' fill='%23fff'/%3E%3C/svg%3E"),
    linear-gradient(155deg, #4fc3f7 0%, var(--theme) 50%, var(--accent-hover) 100%);
  background-size: 0.65rem, 100% 100%;
  background-position: center, center;
  background-repeat: no-repeat, no-repeat;
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.22),
    0 1px 3px color-mix(in srgb, var(--accent-hover) 40%, transparent);
}

.documents-col-delete {
  width: 1%;
  white-space: nowrap;
  text-align: center;
  vertical-align: middle;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--muted);
}

.documents-doc-delete-btn.btn {
  color: #b91c1c;
  font-size: 0.75rem;
  padding: 0.25rem 0.5rem;
}

.documents-doc-delete-btn.btn:hover:not(:disabled) {
  color: #991b1b;
  background: rgba(185, 28, 28, 0.08);
}

.documents-grid-delete-row {
  margin-top: 0.35rem;
  padding-top: 0.4rem;
  border-top: 1px solid var(--border);
  display: flex;
  justify-content: flex-end;
}

.documents-col-analyse {
  width: 1%;
  white-space: nowrap;
  text-align: center;
  vertical-align: middle;
}

.documents-col-analyse .documents-th-sort {
  justify-content: center;
  width: 100%;
}

.documents-col-analyse .doc-analyze-btn {
  padding: 0.3rem 0.55rem;
  font-size: 0.8rem;
}

.doc-analyze-cell {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.45rem;
  flex-wrap: wrap;
}

.doc-analyze-cell--pending {
  gap: 0.35rem;
}

.doc-analyze-mark--ok {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.35rem;
  height: 1.35rem;
  border-radius: 50%;
  background: #dcfce7;
  color: #15803d;
  font-size: 0.85rem;
  font-weight: 700;
  line-height: 1;
  flex-shrink: 0;
}

button.doc-analyze-mark--ok {
  border: none;
  padding: 0;
  margin: 0;
  font: inherit;
  cursor: pointer;
  appearance: none;
  -webkit-appearance: none;
}

button.doc-analyze-mark--ok:hover {
  filter: brightness(0.97);
}

button.doc-analyze-mark--ok:focus-visible {
  outline: 2px solid #15803d;
  outline-offset: 2px;
}

.doc-analyze-mark--err {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.35rem;
  height: 1.35rem;
  border-radius: 50%;
  background: #fee2e2;
  color: #b91c1c;
  font-size: 0.8rem;
  font-weight: 700;
  line-height: 1;
  flex-shrink: 0;
}

.doc-analyze-icon-wrap {
  display: inline-flex;
  color: #2563eb;
  flex-shrink: 0;
}

.doc-analyze-icon--pending {
  display: block;
}

.doc-analyze-btn--secondary {
  font-size: 0.75rem;
  opacity: 0.95;
}

.doc-analyze-btn--retry {
  border-color: rgba(185, 28, 28, 0.35);
}

.documents-grid-actions .doc-analyze-cell {
  justify-content: flex-start;
}

.documents-analyse-muted {
  color: var(--muted);
  font-size: 0.85rem;
}

.documents-grid-actions {
  margin-top: 0.5rem;
  padding-top: 0.45rem;
  border-top: 1px solid var(--border);
}

.documents-grid-actions .doc-analyze-btn {
  padding: 0.3rem 0.55rem;
  font-size: 0.8rem;
}

.btn--sm {
  padding: 0.3rem 0.55rem;
  font-size: 0.8rem;
}

/* Contenu texte / badge : max 2 lignes puis ellipse (…), jamais plus haut */
.documents-cell-clamp {
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
  overflow: hidden;
  word-break: break-word;
  overflow-wrap: anywhere;
  line-height: 1.35;
  min-width: 0;
}

.documents-table-wrap table tbody td,
.documents-detail-table tbody td {
  vertical-align: top;
}

.documents-table-wrap table tbody td.documents-col-select,
.documents-table-wrap table tbody td.documents-col-file,
.documents-table-wrap table tbody td.documents-col-analyse,
.documents-table-wrap table tbody td.documents-col-delete,
.documents-table-wrap table tbody td.documents-col-classeur,
.documents-detail-table tbody td.documents-col-select,
.documents-detail-table tbody td.documents-col-lien,
.documents-detail-table tbody td.documents-detail-td--analyse,
.documents-detail-table tbody td.documents-col-delete,
.documents-detail-table tbody td.documents-col-classeur {
  vertical-align: middle;
}

.documents-table-wrap tbody .documents-type-badge,
.documents-detail-table tbody .documents-type-badge {
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
  overflow: hidden;
  white-space: normal;
  word-break: break-word;
  align-items: unset;
  justify-content: unset;
  text-align: center;
  line-height: 1.25;
  max-width: 100%;
}

.documents-row {
  cursor: pointer;
}

.documents-row:hover {
  background: rgba(22, 139, 205, 0.06);
}

.documents-row:focus {
  outline: 2px solid var(--theme);
  outline-offset: -2px;
}

.documents-grid-item--open {
  cursor: pointer;
}

.documents-grid-item--open:focus {
  outline: 2px solid var(--theme);
  outline-offset: 2px;
}

.documents-grid-item.is-selected {
  box-shadow: 0 0 0 2px var(--theme, #168bcd);
}

/* Colonne compacte : icône / bouton d’aperçu (liste + détail) */
.documents-col-lien {
  max-width: 0;
  width: 1%;
  white-space: nowrap;
  text-align: center;
  vertical-align: middle;
}

.documents-col-nom-fichier {
  max-width: 20rem;
  vertical-align: middle;
}

.documents-nom-fichier-with-preview {
  display: flex;
  align-items: flex-start;
  gap: 0.35rem;
}

.documents-file-link--inline {
  flex-shrink: 0;
  text-decoration: none;
}

.documents-nom-fichier-with-preview .documents-nom-fichier-text {
  flex: 1;
  min-width: 0;
}

.documents-nom-fichier-text {
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
  overflow: hidden;
  word-break: break-word;
  overflow-wrap: anywhere;
  white-space: normal;
  line-height: 1.35;
}

.documents-detail-table .documents-col-nom-fichier {
  max-width: 28rem;
}

.documents-detail-table .documents-nom-fichier-text {
  white-space: normal;
  word-break: break-word;
}

.documents-file-link {
  -webkit-appearance: none;
  appearance: none;
  border: none;
  background: none;
  padding: 0;
  margin: 0;
  font: inherit;
  color: var(--accent, #2563eb);
  text-decoration: underline;
  cursor: pointer;
  text-align: left;
  max-width: 100%;
}

.documents-file-link:hover,
.documents-file-link:focus-visible {
  text-decoration: underline;
  outline: none;
}

.documents-preview-type-icon {
  display: inline-block;
  vertical-align: middle;
  max-height: 1.5rem;
  width: auto;
  height: auto;
  object-fit: contain;
}

.documents-file-link:has(.documents-preview-type-icon),
button.documents-grid-name:has(.documents-preview-type-icon) {
  text-decoration: none;
}

button.documents-grid-name:has(.documents-preview-type-icon) {
  display: block;
  -webkit-line-clamp: unset;
  overflow: visible;
}

.documents-row.is-selected {
  background: rgba(22, 139, 205, 0.12);
}

.sidebar-doc-placeholder {
  margin: 0 0 1rem;
  padding: 0.75rem;
  border-radius: var(--radius);
  background: var(--surface);
  border: 1px dashed var(--border);
}

.sidebar-doc-placeholder-text {
  margin: 0;
  font-size: 0.85rem;
  color: var(--muted);
  line-height: 1.45;
}

.sidebar-doc-detail {
  margin: 0 0 1rem;
  padding: 0.75rem;
  border-radius: var(--radius);
  background: var(--surface);
  border: 1px solid var(--border);
}

.sidebar-doc-document-head {
  margin: 0 0 0.85rem;
}

.sidebar-doc-user-note-wrap {
  margin-top: 1rem;
  padding-top: 1rem;
  border-top: 1px solid var(--border);
}

.sidebar-doc-user-note-hint {
  margin: 0 0 0.5rem;
  font-size: 0.82rem;
  line-height: 1.45;
  color: var(--muted);
}

.sidebar-doc-note-actions {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex-wrap: wrap;
  margin-top: 0.5rem;
}

.sidebar-doc-selected-kicker {
  margin: 0 0 0.2rem;
  font-size: 0.68rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted);
}

.sidebar-doc-file-name {
  margin: 0;
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--text);
  word-break: break-word;
  line-height: 1.35;
}

.sidebar-doc-document-block {
  margin-bottom: 0.75rem;
  padding: 0.65rem 0.75rem;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: rgba(22, 139, 205, 0.06);
}

.sidebar-doc-document-title {
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  color: var(--muted);
  margin: 0 0 0.55rem;
}

.sidebar-doc-document-fields {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.sidebar-doc-detail-champs {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  font-size: 0.82rem;
}

.sidebar-doc-detail-champs > .sidebar-doc-sidebar-accordion {
  margin-bottom: 0;
}

.sidebar-doc-detail-champs .sidebar-accordion-body .sidebar-doc-field:last-child,
.sidebar-doc-detail-champs .sidebar-accordion-body .sidebar-doc-group:last-child {
  margin-bottom: 0;
}

.sidebar-doc-group {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  padding: 0.5rem 0;
  border-top: 1px solid var(--border);
}

.sidebar-doc-group:first-child {
  border-top: none;
  padding-top: 0;
}

.sidebar-doc-group-title {
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--muted);
  margin: 0.15rem 0 0.1rem;
}

.sidebar-doc-array-item {
  padding: 0.45rem 0.5rem;
  margin: 0.25rem 0;
  border-radius: 6px;
  background: rgba(22, 139, 205, 0.06);
  border: 1px solid var(--border);
}

.sidebar-doc-field {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  min-width: 0;
}

/* HT / TTC / TVA / ET : libellé à gauche, champ à droite (Infos) */
.sidebar-doc-field--amount-row {
  flex-direction: row;
  align-items: center;
  flex-wrap: nowrap;
  gap: 0.5rem 0.75rem;
}

.sidebar-doc-field--amount-row .sidebar-doc-field-label {
  flex: 0 0 auto;
  min-width: 2.75rem;
  max-width: 40%;
  margin: 0;
}

.sidebar-doc-field--amount-row .sidebar-doc-field-input {
  flex: 1 1 auto;
  width: auto;
  min-width: 0;
}

.sidebar-doc-field--checkbox {
  flex-direction: row;
  align-items: center;
}

.sidebar-doc-field-label {
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--text);
  line-height: 1.3;
}

.sidebar-doc-field-label--inline {
  font-weight: 500;
  cursor: pointer;
}

.sidebar-doc-checkbox-row {
  display: flex;
  align-items: flex-start;
  gap: 0.45rem;
}

.sidebar-doc-field-checkbox {
  width: 1.1rem;
  height: 1.1rem;
  margin-top: 0.15rem;
  flex-shrink: 0;
}

.sidebar-doc-field-input {
  width: 100%;
  box-sizing: border-box;
  padding: 0.35rem 0.45rem;
  font-size: 0.82rem;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--surface-elevated, #fff);
  color: var(--text);
}

.sidebar-doc-field-input:focus {
  outline: 2px solid rgba(22, 139, 205, 0.35);
  outline-offset: 0;
  border-color: var(--theme, #168bcd);
}

.sidebar-doc-field-textarea {
  min-height: 3rem;
  resize: vertical;
  font-family: inherit;
  line-height: 1.4;
}

.sidebar-doc-save-wrap {
  margin-top: 0.75rem;
  padding-top: 0.75rem;
  border-top: 1px solid var(--border);
}

.sidebar-doc-save-btn {
  width: 100%;
  font-size: 0.85rem;
}

.sidebar-doc-save-status {
  margin: 0.4rem 0 0;
  font-size: 0.78rem;
  color: var(--muted);
  min-height: 1.2em;
}

.sidebar-doc-empty {
  margin: 0;
  color: var(--muted);
}

.sidebar-doc-champ-block {
  padding: 0.5rem 0;
  border-top: 1px solid var(--border);
}

.sidebar-doc-champ-block:first-child {
  border-top: none;
  padding-top: 0;
}

.sidebar-doc-champ-block-title {
  font-weight: 600;
  margin-bottom: 0.35rem;
  font-size: 0.78rem;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.sidebar-doc-champ-row {
  display: grid;
  grid-template-columns: minmax(0, 38%) minmax(0, 1fr);
  gap: 0.5rem;
  align-items: start;
  padding: 0.2rem 0;
}

.sidebar-doc-label {
  font-weight: 600;
  color: var(--text);
  word-break: break-word;
}

.sidebar-doc-val {
  color: var(--muted);
  white-space: pre-wrap;
  word-break: break-word;
}

/* Modale aperçu document (PDF / image dans iframe) */
.doc-preview-modal {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  box-sizing: border-box;
}

.doc-preview-modal[hidden] {
  display: none !important;
}

.doc-preview-modal__backdrop {
  position: absolute;
  inset: 0;
  background: rgba(15, 23, 42, 0.55);
  cursor: pointer;
}

.doc-preview-modal__dialog {
  position: relative;
  z-index: 1;
  width: min(960px, 100%);
  max-height: min(92vh, 900px);
  background: var(--surface-elevated);
  border-radius: var(--radius);
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.22);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.doc-preview-modal__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.65rem 1rem;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}

.doc-preview-modal__title {
  margin: 0;
  font-size: 0.95rem;
  font-weight: 600;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: min(60ch, 75vw);
}

.doc-preview-modal__close {
  flex-shrink: 0;
  width: 2.25rem;
  height: 2.25rem;
  padding: 0;
  border: none;
  border-radius: 8px;
  background: transparent;
  color: var(--muted);
  font-size: 1.5rem;
  line-height: 1;
  cursor: pointer;
  font-family: inherit;
}

.doc-preview-modal__close:hover {
  background: var(--surface);
  color: var(--text);
}

/* Même bandeau dégradé qu’À propos / modale Colonnes / panneau aperçu */
.doc-preview-modal__header--band {
  color: rgba(255, 255, 255, 0.96);
  text-shadow: 0 1px 1px rgba(15, 23, 42, 0.18);
  border-bottom: 1px solid color-mix(in srgb, var(--theme) 55%, #0c1929 45%);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.14);
  background: linear-gradient(
    165deg,
    color-mix(in srgb, var(--accent-hover) 35%, #0a3d5c) 0%,
    var(--theme) 42%,
    color-mix(in srgb, var(--theme) 58%, #164e7d) 100%
  );
}

@supports not (background: color-mix(in srgb, red 1%, blue)) {
  .doc-preview-modal__header--band {
    border-bottom: 1px solid #0d4d73;
    background: linear-gradient(165deg, #0c5a85 0%, #168bcd 45%, #1270a8 100%);
  }
}

.doc-preview-modal__header--band .doc-preview-modal__title {
  color: rgba(255, 255, 255, 0.98);
  font-weight: 700;
}

.doc-preview-modal__header--band .doc-preview-modal__close {
  color: rgba(255, 255, 255, 0.92);
  opacity: 1;
}

.doc-preview-modal__header--band .doc-preview-modal__close:hover,
.doc-preview-modal__header--band .doc-preview-modal__close:focus-visible {
  color: #fff;
  background: rgba(255, 255, 255, 0.16);
  outline: none;
}

.doc-preview-modal__body {
  flex: 1;
  min-height: 0;
  position: relative;
  background: #525659;
}

.doc-preview-modal__iframe {
  width: 100%;
  height: min(72vh, 720px);
  min-height: 320px;
  border: none;
  display: block;
  vertical-align: top;
}

.doc-preview-modal__iframe[hidden] {
  display: none !important;
}

/* Aperçu PDF / image plein écran : 90 % du viewport (les autres modales .doc-preview-modal--* gardent leur taille). */
#doc-preview-modal.doc-preview-modal {
  padding: 0;
}

#doc-preview-modal .doc-preview-modal__dialog {
  width: 90vw;
  max-width: 90vw;
  height: 90vh;
  max-height: 90vh;
}

#doc-preview-modal .doc-preview-modal__title {
  max-width: min(75ch, calc(90vw - 5rem));
}

#doc-preview-modal .doc-preview-modal__body {
  display: flex;
  flex-direction: column;
  flex: 1 1 auto;
  min-height: 0;
}

#doc-preview-modal .doc-preview-modal__iframe {
  flex: 1 1 auto;
  min-height: 0;
  height: auto;
}

.doc-preview-modal__fallback {
  padding: 2rem 1.5rem;
  background: var(--surface-elevated);
  text-align: center;
}

.doc-preview-modal__fallback-text {
  margin: 0 0 1rem;
  color: var(--text);
  line-height: 1.5;
  max-width: 42ch;
  margin-left: auto;
  margin-right: auto;
}

/* Fiche document plein écran (double-clic liste) — champs | aperçu | actions ; nœud déplacé sous body en JS */
/* Fiche de preuve — modale (au-dessus de la fiche document) */
.doc-preuve-modal {
  position: fixed;
  inset: 0;
  z-index: 1000000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  box-sizing: border-box;
}

.doc-preuve-modal[hidden] {
  display: none !important;
}

.doc-preuve-modal__backdrop {
  position: absolute;
  inset: 0;
  background: rgba(15, 23, 42, 0.52);
  backdrop-filter: blur(3px);
  cursor: pointer;
}

@supports not (backdrop-filter: blur(2px)) {
  .doc-preuve-modal__backdrop {
    background: rgba(15, 23, 42, 0.58);
  }
}

.doc-preuve-modal__dialog {
  position: relative;
  z-index: 1;
  width: 100%;
  max-width: 32rem;
  max-height: min(92vh, 46rem);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  background: #f1f5f9;
  border-radius: 14px;
  border: 1px solid rgba(15, 23, 42, 0.08);
  box-shadow:
    0 4px 6px -1px rgba(15, 23, 42, 0.06),
    0 24px 48px -12px rgba(15, 23, 42, 0.18);
}

.doc-preuve-modal__header {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 1rem 1.15rem 1rem 1.2rem;
  background: linear-gradient(180deg, #ffffff 0%, #f8fafc 100%);
  border-bottom: 1px solid #e2e8f0;
}

.doc-preuve-modal__header-text {
  min-width: 0;
}

.doc-preuve-modal__title {
  margin: 0;
  font-size: 1.08rem;
  font-weight: 800;
  line-height: 1.25;
  letter-spacing: -0.025em;
  color: #0f172a;
}

.doc-preuve-modal__subtitle {
  margin: 0.28rem 0 0;
  font-size: 0.78rem;
  color: #64748b;
  line-height: 1.35;
  font-weight: 500;
}

.doc-preuve-modal__close {
  flex-shrink: 0;
  width: 2.4rem;
  height: 2.4rem;
  padding: 0;
  border: 1px solid transparent;
  border-radius: 10px;
  background: #f1f5f9;
  color: #64748b;
  font-size: 1.45rem;
  line-height: 1;
  cursor: pointer;
  font-family: inherit;
  transition: background 0.12s ease, color 0.12s ease, border-color 0.12s ease;
}

.doc-preuve-modal__close:hover {
  background: #e2e8f0;
  color: #0f172a;
  border-color: #cbd5e1;
}

.doc-preuve-modal__body {
  padding: 0;
  flex: 1;
  min-height: 0;
  overflow: auto;
  -webkit-overflow-scrolling: touch;
}

.doc-preuve-modal__loading {
  margin: 0;
  padding: 1.25rem 1.2rem;
  color: #64748b;
  font-size: 0.9rem;
}

.doc-preuve-modal__error {
  margin: 0;
  padding: 1rem 1.2rem;
  color: #b91c1c;
  font-weight: 600;
  font-size: 0.9rem;
}

.doc-preuve-modal__content {
  padding: 1.05rem 1.15rem 1.2rem;
  display: flex;
  flex-direction: column;
  gap: 0.95rem;
}

.doc-preuve-modal__card {
  background: #fff;
  border-radius: 12px;
  border: 1px solid #e2e8f0;
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.04);
}

.doc-preuve-modal__card-label {
  margin: 0;
  padding: 0.65rem 1rem 0;
  font-size: 0.65rem;
  font-weight: 800;
  letter-spacing: 0.09em;
  text-transform: uppercase;
  color: #64748b;
}

.doc-preuve-modal__card--stamp {
  border-color: #c7d2fe;
  box-shadow:
    0 1px 2px rgba(37, 99, 235, 0.05),
    0 8px 24px -8px rgba(37, 99, 235, 0.18);
  overflow: hidden;
}

.doc-preuve-modal__stamp-inner.docia-preuve-stamp-block {
  margin: 0;
  max-width: none;
  padding: 0.35rem 1rem 1rem;
}

.doc-preuve-modal__card--stamp .docia-preuve-stamp__outer--fallback {
  width: 10rem;
  height: 10rem;
  filter: drop-shadow(0 2px 4px rgba(46, 93, 203, 0.14));
}

.doc-preuve-modal__card--stamp .docia-preuve-stamp__frame {
  width: 10rem;
  height: 10rem;
  filter: drop-shadow(0 2px 4px rgba(46, 93, 203, 0.14));
}

.doc-preuve-modal__details-title {
  margin: 0;
  padding: 0.85rem 1rem 0.65rem;
  font-size: 0.65rem;
  font-weight: 800;
  letter-spacing: 0.09em;
  text-transform: uppercase;
  color: #64748b;
  border-bottom: 1px solid #f1f5f9;
}

.doc-preuve-modal__card--details {
  padding-bottom: 0.15rem;
}

.doc-preuve-modal__dl {
  margin: 0;
  padding: 0.15rem 0 0.35rem;
}

.doc-preuve-modal__row {
  display: grid;
  grid-template-columns: minmax(6.5rem, 8.5rem) 1fr;
  gap: 0.35rem 0.85rem;
  align-items: baseline;
  padding: 0.48rem 1rem;
  border-bottom: 1px solid #f1f5f9;
}

.doc-preuve-modal__row:last-child {
  border-bottom: none;
}

.doc-preuve-modal__row--wide {
  grid-template-columns: 1fr;
  gap: 0.35rem;
}

.doc-preuve-modal__row--wide dt {
  margin-bottom: 0.1rem;
}

.doc-preuve-modal__row--wide dd {
  margin: 0;
}

.doc-preuve-modal__dl dt {
  margin: 0;
  font-size: 0.72rem;
  font-weight: 600;
  color: #94a3b8;
  line-height: 1.35;
}

.doc-preuve-modal__dl dd {
  margin: 0;
  font-size: 0.86rem;
  font-weight: 500;
  color: #0f172a;
  line-height: 1.45;
  word-break: break-word;
}

.doc-preuve-modal__hash {
  display: block;
  font-family: ui-monospace, 'Cascadia Code', 'SF Mono', Menlo, monospace;
  font-size: 0.74rem !important;
  font-weight: 500;
  line-height: 1.45;
  letter-spacing: -0.02em;
  color: #334155;
  background: #f8fafc;
  padding: 0.55rem 0.65rem;
  border-radius: 8px;
  border: 1px solid #e2e8f0;
}

.doc-preuve-modal__note-wrap {
  word-break: break-word;
}

.doc-preuve-modal__note {
  white-space: pre-wrap;
}

.doc-preuve-modal__actions {
  margin: 0.15rem 0 0;
  padding-top: 1rem;
  border-top: 1px solid #e2e8f0;
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem 0.65rem;
}

.doc-preuve-modal__actions .btn-primary {
  box-shadow: 0 2px 6px rgba(37, 99, 235, 0.22);
}

@media (max-width: 380px) {
  .doc-preuve-modal__row {
    grid-template-columns: 1fr;
  }

  .doc-preuve-modal__dialog {
    max-height: min(94vh, 100%);
    border-radius: 12px;
  }
}

@media print {
  /* Uniquement quand l’utilisateur a lancé l’impression depuis la fiche preuve (classe posée en JS) */
  html.doc-preuve-printing-preuve body * {
    visibility: hidden;
  }

  html.doc-preuve-printing-preuve #doc-preuve-modal,
  html.doc-preuve-printing-preuve #doc-preuve-modal * {
    visibility: visible;
  }

  html.doc-preuve-printing-preuve #doc-preuve-modal {
    position: absolute !important;
    left: 0;
    top: 0;
    width: 100%;
    inset: auto !important;
    padding: 0 !important;
    display: block !important;
    z-index: auto !important;
  }

  html.doc-preuve-printing-preuve .doc-preuve-modal__backdrop {
    display: none !important;
  }

  html.doc-preuve-printing-preuve .doc-preuve-modal__dialog {
    max-height: none;
    box-shadow: none;
  }

  html.doc-preuve-printing-preuve .doc-preuve-modal__close,
  html.doc-preuve-printing-preuve .doc-preuve-modal__actions {
    display: none !important;
  }
}

.doc-quick-view-modal {
  position: fixed;
  inset: 0;
  z-index: 999999;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  box-sizing: border-box;
}

.doc-quick-view-modal[hidden] {
  display: none !important;
}

.doc-quick-view-modal__backdrop {
  position: absolute;
  inset: 0;
  background: rgba(15, 23, 42, 0.52);
  cursor: pointer;
}

.doc-quick-view-modal__dialog {
  position: relative;
  z-index: 1;
  width: 95vw;
  max-width: 95vw;
  height: 95vh;
  max-height: 95vh;
  background: var(--surface-elevated, #fff);
  border-radius: var(--radius, 10px);
  box-shadow: 0 24px 64px rgba(0, 0, 0, 0.22);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

/* Bandeau titre : même langage visuel que .documents-page-head (Mes documents / tableau de bord) */
.doc-quick-view-modal__header {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.65rem 1.1rem 0.75rem;
  border-bottom: 1px solid color-mix(in srgb, var(--theme) 55%, #0c1929 45%);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.14);
  background: linear-gradient(
    165deg,
    color-mix(in srgb, var(--accent-hover) 35%, #0a3d5c) 0%,
    var(--theme) 42%,
    color-mix(in srgb, var(--theme) 58%, #164e7d) 100%
  );
}

@supports not (background: color-mix(in srgb, red 1%, blue)) {
  .doc-quick-view-modal__header {
    border-bottom: 1px solid #0d4d73;
    background: linear-gradient(165deg, #0c5a85 0%, #168bcd 45%, #1270a8 100%);
  }
}

.doc-quick-view-modal__head-text {
  min-width: 0;
}

.doc-quick-view-modal__title {
  margin: 0;
  font-size: 1.15rem;
  font-weight: 700;
  line-height: 1.3;
  word-break: break-word;
  color: rgba(255, 255, 255, 0.98);
  text-shadow: 0 1px 1px rgba(15, 23, 42, 0.18);
}

.doc-quick-view-modal__close {
  flex-shrink: 0;
  width: 2.35rem;
  height: 2.35rem;
  padding: 0;
  border: 1px solid rgba(255, 255, 255, 0.45);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.08);
  color: rgba(255, 255, 255, 0.92);
  font-size: 1.5rem;
  line-height: 1;
  cursor: pointer;
  font-family: inherit;
}

.doc-quick-view-modal__close:hover {
  background: rgba(255, 255, 255, 0.16);
  color: #fff;
}

.doc-quick-view-modal__close:focus-visible {
  outline: 2px solid rgba(255, 255, 255, 0.85);
  outline-offset: 2px;
}

/* Modale confirmation déconnexion — bandeau = vue rapide document / prévisualisation */
.docia-logout-modal {
  position: fixed;
  inset: 0;
  z-index: 999998;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  box-sizing: border-box;
}

.docia-logout-modal[hidden] {
  display: none !important;
}

.docia-logout-modal__backdrop {
  position: absolute;
  inset: 0;
  background: rgba(15, 23, 42, 0.52);
  cursor: pointer;
}

.docia-logout-modal__dialog {
  position: relative;
  z-index: 1;
  width: 100%;
  max-width: 26rem;
  background: var(--surface-elevated, #fff);
  border-radius: var(--radius, 10px);
  box-shadow: 0 24px 64px rgba(0, 0, 0, 0.22);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.docia-logout-modal__header {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.65rem 1.1rem 0.75rem;
  border-bottom: 1px solid color-mix(in srgb, var(--theme) 55%, #0c1929 45%);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.14);
  background: linear-gradient(
    165deg,
    color-mix(in srgb, var(--accent-hover) 35%, #0a3d5c) 0%,
    var(--theme) 42%,
    color-mix(in srgb, var(--theme) 58%, #164e7d) 100%
  );
}

@supports not (background: color-mix(in srgb, red 1%, blue)) {
  .docia-logout-modal__header {
    border-bottom: 1px solid #0d4d73;
    background: linear-gradient(165deg, #0c5a85 0%, #168bcd 45%, #1270a8 100%);
  }
}

.docia-logout-modal__head-text {
  min-width: 0;
}

.docia-logout-modal__title {
  margin: 0;
  font-size: 1.15rem;
  font-weight: 700;
  line-height: 1.3;
  word-break: break-word;
  color: rgba(255, 255, 255, 0.98);
  text-shadow: 0 1px 1px rgba(15, 23, 42, 0.18);
}

.docia-logout-modal__close {
  flex-shrink: 0;
  padding: 0;
  border: 1px solid rgba(255, 255, 255, 0.45);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.08);
  color: rgba(255, 255, 255, 0.92);
  cursor: pointer;
  font-family: inherit;
}

.docia-logout-modal__close:hover {
  background: rgba(255, 255, 255, 0.16);
  color: #fff;
}

.docia-logout-modal__close:focus-visible {
  outline: 2px solid rgba(255, 255, 255, 0.85);
  outline-offset: 2px;
}

.docia-logout-modal__body {
  padding: 1.25rem 1.35rem 1.35rem;
}

.docia-logout-modal__text {
  margin: 0;
  font-size: 0.95rem;
  line-height: 1.5;
  color: var(--text);
}

.docia-logout-modal__actions {
  margin-top: 1.25rem;
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 0.5rem 0.65rem;
}

/*
 * Boutons × (fermer) des en-têtes de modales : taille compacte, centrage flex,
 * léger translateY pour compenser les métriques du glyphe ×.
 */
.doc-preview-modal__close,
.doc-preuve-modal__close,
.doc-quick-view-modal__close,
.docia-logout-modal__close,
.documents-cols-modal__close {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.875rem;
  height: 1.875rem;
  min-width: 1.875rem;
  min-height: 1.875rem;
  padding: 0;
  box-sizing: border-box;
  font-size: 1.2rem;
  line-height: 0;
  transform: translateY(-0.06rem);
}

.doc-quick-view__grid {
  display: grid;
  grid-template-columns: minmax(200px, 24%) minmax(0, 1fr) minmax(168px, 20%);
  grid-template-rows: minmax(0, 1fr);
  gap: 0;
  flex: 1;
  min-height: 0;
}

.doc-quick-view__col-title {
  margin: 0 0 0.65rem;
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.doc-quick-view__col--fields {
  overflow: hidden;
  padding: 0.85rem 1rem 1rem;
  border-right: 1px solid var(--border);
  /* Fond gris neutre (~30 % gris / 70 % blanc), sans teinte thème */
  background: color-mix(in srgb, #808080 30%, #ffffff 70%);
  min-height: 0;
  display: flex;
  flex-direction: column;
}

.doc-quick-view__col--fields > .doc-quick-view__col-title {
  flex-shrink: 0;
}

.doc-quick-view__fields {
  flex: 1 1 0;
  min-height: 0;
  overflow-y: auto;
  overscroll-behavior: contain;
  padding-right: 0.15rem;
}

.doc-quick-view__field {
  margin-bottom: 0.75rem;
}

.doc-quick-view__field-label {
  font-size: 0.68rem;
  font-weight: 600;
  color: var(--muted);
  letter-spacing: 0.02em;
}

.doc-quick-view__field-value {
  font-size: 0.84rem;
  margin-top: 0.2rem;
  line-height: 1.4;
  word-break: break-word;
  color: var(--text);
}

.doc-quick-view__field-input,
.doc-quick-view__field-textarea {
  width: 100%;
  max-width: 100%;
  box-sizing: border-box;
  margin-top: 0.25rem;
  padding: 0.35rem 0.5rem;
  font-size: 0.84rem;
  line-height: 1.35;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--card, #fff);
  color: var(--text);
  font-family: inherit;
}

.doc-quick-view__field-textarea {
  min-height: 4.5rem;
  resize: vertical;
}

.doc-quick-view__fields-footer {
  flex-shrink: 0;
  padding-top: 0.85rem;
  border-top: 1px solid var(--border);
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem;
  background: color-mix(in srgb, #808080 30%, #ffffff 70%);
}

.doc-quick-view__save-status {
  font-size: 0.78rem;
  color: var(--muted);
}

.doc-quick-view__empty {
  margin: 0;
  font-size: 0.84rem;
  color: var(--muted);
  line-height: 1.45;
}

.doc-quick-view__col--preview {
  display: flex;
  flex-direction: column;
  min-height: 0;
  height: 100%;
  align-self: stretch;
  min-width: 0;
  background: #525659;
  position: relative;
}

.doc-quick-view__preview-stack {
  flex: 1 1 0;
  min-height: 0;
  position: relative;
  display: flex;
  flex-direction: column;
}

.doc-quick-view__iframe {
  /* flex-basis: 0 — un seul enfant visible occupe toute la hauteur de la colonne */
  flex: 1 1 0;
  min-height: 0;
  width: 100%;
  height: 100%;
  border: none;
  display: block;
}

/* Ne pas laisser display:flex du bloc écraser l’attribut hidden (sinon iframe + repli se partagent 50/50 la hauteur). */
.doc-quick-view__iframe[hidden],
.doc-quick-view__preview-fallback[hidden] {
  display: none !important;
}

.doc-quick-view__preview-fallback {
  flex: 1 1 0;
  min-height: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 1rem;
  padding: 1.25rem;
  background: var(--surface-elevated);
  text-align: center;
}

.doc-quick-view__preview-fallback-text {
  margin: 0;
  font-size: 0.88rem;
  line-height: 1.5;
  color: var(--text);
  max-width: 36ch;
}

.doc-quick-view__postit {
  position: absolute;
  z-index: 6;
  right: clamp(0.45rem, 2vw, 1.1rem);
  bottom: clamp(0.45rem, 2vw, 1.1rem);
  width: min(22rem, calc(100% - 0.9rem));
  max-height: min(52vh, 19rem);
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  padding: 0.55rem 0.65rem 0.65rem;
  background: linear-gradient(160deg, #fffef6 0%, #fff4bf 48%, #ffeaa5 100%);
  border: 1px solid rgba(180, 140, 60, 0.42);
  border-radius: 6px;
  box-shadow:
    0 6px 22px rgba(0, 0, 0, 0.35),
    0 1px 0 rgba(255, 255, 255, 0.55) inset;
  box-sizing: border-box;
  text-align: left;
}

.doc-quick-view__postit[hidden] {
  display: none !important;
}

.doc-quick-view__postit-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.35rem;
}

.doc-quick-view__postit-title {
  font-size: 0.78rem;
  font-weight: 700;
  color: #5c4a12;
  letter-spacing: 0.02em;
}

.doc-quick-view__postit-close {
  flex-shrink: 0;
  width: 1.85rem;
  height: 1.85rem;
  padding: 0;
  border: none;
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.45);
  color: #5c4a12;
  font-size: 1.25rem;
  line-height: 1;
  cursor: pointer;
  font-family: inherit;
}

.doc-quick-view__postit-close:hover {
  background: rgba(255, 255, 255, 0.75);
}

.doc-quick-view__postit-hint {
  margin: 0;
  font-size: 0.68rem;
  line-height: 1.3;
  color: #7a6828;
}

.doc-quick-view__postit-textarea {
  flex: 1 1 auto;
  min-height: 5rem;
  max-height: min(32vh, 11rem);
  width: 100%;
  box-sizing: border-box;
  padding: 0.4rem 0.5rem;
  font-size: 0.84rem;
  line-height: 1.35;
  border: 1px solid rgba(140, 110, 40, 0.35);
  border-radius: 4px;
  background: rgba(255, 255, 255, 0.88);
  color: var(--text);
  font-family: inherit;
  resize: vertical;
}

.doc-quick-view__postit-footer {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.45rem;
  padding-top: 0.1rem;
}

.doc-quick-view__stamps {
  position: absolute;
  inset: 0;
  z-index: 4;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: clamp(0.45rem, 2vmin, 1rem);
  pointer-events: none;
}

.doc-quick-view__stamps[hidden] {
  display: none !important;
}

.doc-quick-view__stamp {
  font-size: clamp(2.35rem, 8.5vmin, 4.25rem);
  font-weight: 800;
  line-height: 1;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  padding: 0.12em 0.42em;
  border-radius: 0.06em;
  background: rgba(255, 255, 255, 0.22);
  box-shadow:
    0 2px 0 rgba(255, 255, 255, 0.45) inset,
    0 8px 28px rgba(0, 0, 0, 0.22);
  text-shadow: 0 1px 0 rgba(255, 255, 255, 0.35);
}

.doc-quick-view__stamp[hidden] {
  display: none !important;
}

.doc-quick-view__stamp--validee {
  color: #15803d;
  border: 0.1em solid rgba(21, 128, 61, 0.92);
  transform: rotate(-12deg);
}

.doc-quick-view__stamp--payee {
  color: #b45309;
  border: 0.1em solid rgba(180, 83, 9, 0.92);
  transform: rotate(10deg);
}

.doc-quick-view__stamp--litige {
  color: #dc2626;
  border: 0.1em solid rgba(220, 38, 38, 0.92);
  transform: rotate(-8deg);
}

.doc-quick-view__col--actions {
  overflow-y: auto;
  padding: 0.75rem 0.65rem 1rem;
  border-left: 1px solid var(--border);
  background: color-mix(in srgb, #808080 30%, #ffffff 70%);
  min-height: 0;
}

@supports not (background: color-mix(in srgb, red 1%, blue)) {
  .doc-quick-view__col--fields,
  .doc-quick-view__fields-footer,
  .doc-quick-view__col--actions {
    background: #d9d9d9;
  }
}

.doc-quick-view__actions-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}

.doc-quick-view__actions-divider {
  list-style: none;
  height: 1px;
  margin: 0.35rem 0;
  padding: 0;
  background: var(--border);
  border: none;
}

.doc-quick-view__action {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 0.55rem;
  padding: 0.5rem 0.6rem;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: #fff;
  cursor: pointer;
  text-align: left;
  font-family: inherit;
  font-size: 0.78rem;
  line-height: 1.25;
  color: var(--text);
  transition:
    background 0.12s ease,
    border-color 0.12s ease,
    box-shadow 0.12s ease;
  box-sizing: border-box;
}

.doc-quick-view__action:hover {
  border-color: color-mix(in srgb, var(--theme, #2563eb) 45%, var(--border));
  background: color-mix(in srgb, var(--theme, #2563eb) 6%, #fff);
  box-shadow: 0 1px 3px rgba(15, 23, 42, 0.06);
}

.doc-quick-view__action:focus-visible {
  outline: 2px solid var(--theme, #2563eb);
  outline-offset: 2px;
}

.doc-quick-view__action-icon {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--theme, #2563eb);
}

.doc-quick-view__action-icon svg {
  display: block;
}

.doc-quick-view__action-icon--emoji {
  font-size: 1.15rem;
  line-height: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 1.25rem;
}

.doc-quick-view__action-label {
  flex: 1;
  min-width: 0;
}

.doc-quick-view__action--tag.doc-quick-view__action--tag-ok .doc-quick-view__action-icon {
  color: #15803d;
}

.doc-quick-view__action--tag.doc-quick-view__action--tag-warn .doc-quick-view__action-icon {
  color: #b45309;
}

.doc-quick-view__action--tag.doc-quick-view__action--tag-danger .doc-quick-view__action-icon {
  color: #dc2626;
}

.doc-quick-view__action--danger .doc-quick-view__action-icon {
  color: #dc2626;
}

.doc-quick-view__action--danger:hover {
  border-color: #fecaca;
  background: #fef2f2;
  box-shadow: none;
}

@media (max-width: 900px) {
  .doc-quick-view__grid {
    grid-template-columns: 1fr;
    grid-template-rows: minmax(100px, auto) minmax(220px, 42vh) auto;
  }

  .doc-quick-view__col--fields {
    border-right: none;
    border-bottom: 1px solid var(--border);
    max-height: 32vh;
  }

  .doc-quick-view__col--actions {
    border-left: none;
    border-top: 1px solid var(--border);
  }
}

/* Modale message (remplace alert() — ex. erreur analyse IA) */
.upload-duplicate-list {
  margin: 0.5rem 0 0;
  padding-left: 1.25rem;
  font-size: 0.88rem;
  line-height: 1.45;
  color: var(--text);
  max-height: 14rem;
  overflow-y: auto;
}

.upload-duplicate-list li {
  margin-bottom: 0.25rem;
  word-break: break-word;
}

.upload-duplicate-modal__body.doc-feedback-modal__body {
  padding-top: 0.5rem;
}

.upload-duplicate-modal__split {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem 1.25rem;
  margin-top: 0.75rem;
}

@media (max-width: 540px) {
  .upload-duplicate-modal__split {
    grid-template-columns: 1fr;
  }
}

.upload-duplicate-modal__col {
  min-width: 0;
  padding: 0.65rem 0.75rem;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--surface);
}

.upload-duplicate-modal__col--dup {
  border-color: #fecaca;
  background: #fffbeb;
}

.upload-duplicate-modal__col-title {
  margin: 0;
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.upload-duplicate-modal__col--dup .upload-duplicate-modal__col-title {
  color: #b45309;
}

.upload-duplicate-modal__empty {
  margin: 0.5rem 0 0;
  font-size: 0.85rem;
  color: var(--muted);
  font-style: italic;
}

.doc-preview-modal--feedback {
  z-index: 1001;
}

.doc-preview-modal--feedback .doc-preview-modal__dialog {
  width: min(28rem, 100%);
  max-height: min(85vh, 560px);
}

.upload-duplicate-modal.doc-preview-modal--feedback .doc-preview-modal__dialog {
  width: min(44rem, calc(100vw - 2rem));
  max-width: calc(100vw - 2rem);
  max-height: min(88vh, 620px);
}

.upload-flow-modal.upload-confirm-modal {
  z-index: 1001;
}

/* Plus spécifique que .doc-preview-modal--feedback .doc-preview-modal__dialog (28rem) */
.upload-confirm-modal .upload-confirm-modal__dialog {
  width: max(50vw, min(96vw, 1400px));
  max-width: calc(100vw - 1.5rem);
  max-height: min(92vh, 900px);
}

.upload-confirm-modal__body {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  max-height: min(80vh, 760px);
}

.upload-confirm-split {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.25rem;
  align-items: stretch;
  min-height: min(42vh, 420px);
}

@media (max-width: 640px) {
  .upload-confirm-split {
    grid-template-columns: 1fr;
  }
}

.upload-confirm-col {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  min-height: 0;
  min-width: 0;
}

.upload-confirm-col-title {
  margin: 0;
  font-size: 0.85rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--muted);
}

.upload-confirm-dupe-empty {
  margin: 0;
  padding: 0.5rem 0.65rem;
  font-size: 0.82rem;
  color: var(--muted);
  font-style: italic;
  border: 1px dashed var(--border);
  border-radius: var(--radius);
}

.upload-confirm-file-list--muted {
  opacity: 0.92;
  border-style: dashed;
}

.upload-confirm-lead {
  margin: 0;
  font-size: 1.02rem;
  line-height: 1.5;
  color: var(--text);
}

.upload-confirm-note {
  margin: 0;
  font-size: 0.82rem;
  color: var(--muted);
  line-height: 1.45;
}

.upload-confirm-subtitle {
  margin: 0 0 0.35rem;
  font-size: 0.78rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--muted);
}

.upload-confirm-list-wrap {
  flex: 1 1 auto;
  min-height: 0;
  display: flex;
  flex-direction: column;
}

.upload-confirm-file-list {
  margin: 0;
  padding: 0.75rem 0.85rem;
  list-style: none;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--form-surface);
  font-size: 0.95rem;
  line-height: 1.5;
  overflow-y: auto;
  flex: 1 1 auto;
  min-height: 12rem;
  max-height: min(52vh, 520px);
}

.upload-confirm-loading {
  color: var(--muted);
  font-style: italic;
}

.upload-confirm-file-list li {
  padding: 0.45rem 0;
  border-bottom: 1px solid var(--border);
  word-break: break-word;
}

.upload-confirm-file-list li:last-child {
  border-bottom: none;
}

.upload-flow-modal.upload-progress-modal {
  z-index: 1002;
}

.upload-progress-modal .upload-progress-modal__dialog {
  width: max(50vw, min(96vw, 720px));
  max-width: calc(100vw - 1.5rem);
  max-height: min(92vh, 720px);
}

.upload-progress-modal__body {
  padding: 0.65rem 1rem 1rem;
  background: var(--surface-elevated);
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.upload-progress-bar {
  width: 100%;
  height: 0.65rem;
  border-radius: 999px;
  overflow: hidden;
  border: 1px solid var(--border);
  background: var(--form-surface);
  accent-color: var(--primary, #2563eb);
}

.upload-progress-bar::-webkit-progress-bar {
  background: var(--form-surface);
  border-radius: 999px;
}

.upload-progress-bar::-webkit-progress-value {
  background: linear-gradient(90deg, var(--primary, #2563eb), var(--primary-hover, #1d4ed8));
  border-radius: 999px;
}

.upload-progress-bar::-moz-progress-bar {
  background: linear-gradient(90deg, var(--primary, #2563eb), var(--primary-hover, #1d4ed8));
  border-radius: 999px;
}

.upload-progress-status {
  margin: 0;
  font-size: 0.92rem;
  line-height: 1.5;
  color: var(--text);
}

.upload-progress-detail {
  margin: 0;
  font-size: 0.82rem;
  line-height: 1.45;
  color: var(--muted);
  min-height: 1.5em;
}

.doc-feedback-modal__body {
  padding: 1rem 1rem 0.25rem;
  background: var(--surface-elevated);
}

.doc-feedback-modal__message {
  margin: 0;
  font-size: 0.92rem;
  line-height: 1.55;
  color: var(--text);
  white-space: pre-wrap;
  word-break: break-word;
}

.doc-feedback-modal__footer {
  display: flex;
  justify-content: flex-end;
  gap: 0.5rem;
  padding: 0.75rem 1rem 1rem;
  background: var(--surface-elevated);
  border-top: 1px solid var(--border);
}

.doc-delete-confirm-modal {
  z-index: 1001;
}

.doc-delete-confirm-filename {
  margin: 0 0 0.75rem;
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--text);
  word-break: break-word;
  line-height: 1.45;
}

.doc-bulk-move-classeur-modal {
  z-index: 1001;
}

.doc-bulk-move-classeur-modal .doc-bulk-move-count {
  margin: 0.5rem 0 0;
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--text);
}

.doc-bulk-move-classeur-modal .doc-bulk-move-form-group {
  margin-top: 0.85rem;
  margin-bottom: 0;
}

.doc-bulk-move-classeur-modal .doc-bulk-move-classeur-select {
  width: 100%;
  max-width: 100%;
  box-sizing: border-box;
}

.doc-bulk-move-classeur-modal .doc-bulk-move-err {
  margin: 0.75rem 0 0;
  font-size: 0.88rem;
  line-height: 1.45;
  color: #b91c1c;
}

.doc-delete-confirm-modal .doc-delete-confirm-ok.btn-primary {
  background: var(--danger);
}

.doc-delete-confirm-modal .doc-delete-confirm-ok.btn-primary:hover {
  background: #b91c1c;
  color: #fff;
}

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

/* Bouton Analyse : spinner au lieu de « … » */
.doc-analyze-btn {
  position: relative;
  min-width: 5.25rem;
}

.doc-analyze-btn.is-loading .doc-analyze-btn-label {
  visibility: hidden;
}

.doc-analyze-btn.is-loading .doc-analyze-btn-spinner {
  display: block;
}

.doc-analyze-btn-spinner {
  display: none;
  position: absolute;
  left: 50%;
  top: 50%;
  width: 1.1rem;
  height: 1.1rem;
  margin: -0.55rem 0 0 -0.55rem;
  border: 2px solid var(--border);
  border-top-color: var(--theme, #2563eb);
  border-radius: 50%;
  animation: docia-spin 0.65s linear infinite;
  box-sizing: border-box;
}

/* Colonne Analyse IA : chargement en ligne (sans modale) */
.doc-analyze-cell--busy {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  min-height: 1.75rem;
  box-sizing: border-box;
}

.doc-analyze-spinner {
  display: block;
  width: 1.15rem;
  height: 1.15rem;
  border: 2px solid var(--border);
  border-top-color: var(--theme, #2563eb);
  border-radius: 50%;
  animation: docia-spin 0.65s linear infinite;
  box-sizing: border-box;
  flex-shrink: 0;
}

.doc-analyze-row-await {
  opacity: 0.85;
}

/* Modale progression analyse IA */
.doc-preview-modal--analyze-progress {
  z-index: 1002;
}

.doc-analyze-progress-body {
  padding: 0.5rem 1rem 1rem;
  background: var(--surface-elevated);
  max-height: min(70vh, 520px);
  overflow-y: auto;
}

.doc-analyze-progress-bar-section {
  margin-bottom: 0.85rem;
  padding-bottom: 0.85rem;
  border-bottom: 1px solid var(--border);
}

.doc-analyze-progress-bar-meta {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.75rem;
  margin-bottom: 0.45rem;
  font-size: 0.82rem;
}

#doc-analyze-progress-bar-status {
  color: var(--text);
  font-weight: 500;
  line-height: 1.35;
}

.doc-analyze-progress-bar-pct {
  flex-shrink: 0;
  font-variant-numeric: tabular-nums;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--muted);
}

.doc-analyze-progress-bar-track {
  height: 0.55rem;
  border-radius: 999px;
  background: var(--surface);
  border: 1px solid var(--border);
  overflow: hidden;
  box-sizing: border-box;
}

.doc-analyze-progress-bar-track.is-error {
  border-color: rgba(185, 28, 28, 0.35);
}

.doc-analyze-progress-bar-fill {
  height: 100%;
  width: 0%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--theme, #168bcd), #38bdf8);
  transition: width 0.35s ease, background 0.25s ease;
}

.doc-analyze-progress-bar-fill.is-complete {
  background: linear-gradient(90deg, #16a34a, #22c55e);
}

.doc-analyze-progress-bar-fill.is-error {
  background: linear-gradient(90deg, #b91c1c, #ef4444);
}

.doc-analyze-step--hint .doc-analyze-step-title {
  font-size: 0.82rem;
  color: var(--muted);
  font-style: italic;
}

.doc-analyze-steps {
  list-style: none;
  margin: 0;
  padding: 0;
}

.doc-analyze-step {
  display: flex;
  gap: 0.65rem;
  align-items: flex-start;
  padding: 0.55rem 0;
  border-bottom: 1px solid var(--border);
}

.doc-analyze-step:last-child {
  border-bottom: none;
}

.doc-analyze-step-icon {
  flex-shrink: 0;
  width: 1.35rem;
  height: 1.35rem;
  margin-top: 0.1rem;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
}

.doc-analyze-step.is-pending .doc-analyze-step-icon::after {
  content: '';
  width: 0.65rem;
  height: 0.65rem;
  border: 2px solid var(--border);
  border-radius: 50%;
  opacity: 0.65;
}

.doc-analyze-step.is-active .doc-analyze-step-icon::after {
  content: '';
  width: 1.05rem;
  height: 1.05rem;
  margin: 0;
  border: 2px solid var(--border);
  border-top-color: var(--theme, #2563eb);
  border-radius: 50%;
  animation: docia-spin 0.65s linear infinite;
  box-sizing: border-box;
}

.doc-analyze-step.is-done .doc-analyze-step-icon::after {
  content: '✓';
  font-size: 0.95rem;
  line-height: 1;
  color: #15803d;
  border: none;
  animation: none;
}

.doc-analyze-step.is-error .doc-analyze-step-icon::after {
  content: '✕';
  font-size: 0.85rem;
  line-height: 1;
  color: #b91c1c;
  border: none;
  animation: none;
}

.doc-analyze-step-text-wrap {
  flex: 1;
  min-width: 0;
}

.doc-analyze-step-title {
  font-size: 0.9rem;
  line-height: 1.4;
}

.doc-analyze-step-detail {
  margin: 0.35rem 0 0;
  padding: 0.5rem 0.6rem;
  font-size: 0.72rem;
  line-height: 1.4;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  white-space: pre-wrap;
  word-break: break-word;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 6px;
  max-height: 14rem;
  overflow: auto;
}

.doc-analyze-step-at {
  display: block;
  margin-top: 0.25rem;
  font-size: 0.68rem;
  color: var(--muted);
}

.doc-analyze-step-debug-line {
  display: block;
  margin-top: 0.25rem;
  font-size: 0.72rem;
  line-height: 1.35;
  color: var(--muted);
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  word-break: break-word;
}

.doc-analyze-debug-log {
  margin: 0.75rem 0 0;
  padding: 0.65rem 0.75rem;
  font-size: 0.7rem;
  line-height: 1.45;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  max-height: min(70vh, 30rem);
  overflow: auto;
  white-space: pre-wrap;
  word-break: break-word;
}

/* Au-dessus des panneaux latéraux / aperçu Mes documents */
#doc-analyze-progress-modal.doc-preview-modal {
  z-index: 10050;
}

.doc-analyze-progress-err {
  margin: 0.75rem 0 0;
  font-size: 0.88rem;
  line-height: 1.45;
  color: #b91c1c;
}

.doc-analyze-progress-dialog .doc-preview-modal__header {
  border-bottom: 1px solid var(--border);
}

@media (max-width: 959px) {
  .header-app--tray {
    flex-direction: column;
    align-items: stretch;
  }

  .header-app-nav-center {
    width: 100%;
    justify-content: center;
  }

  .header-app-tray-end {
    width: 100%;
    justify-content: flex-start;
  }

  .header-user-chip {
    border-left: none;
    padding-left: 0;
    margin-left: 0;
    width: 100%;
  }
}

/* =============================================================================
   Bandeau menu connecté — styles 1–10 via data-docia-header-theme (défaut : 1, défini sur <html> dans header.php)
   ============================================================================= */

.header-app-top-wrap {
  display: flex;
  flex-direction: column;
  gap: 0;
  width: 100%;
}

.header-theme-picker {
  border-top: 1px solid color-mix(in srgb, var(--border) 85%, transparent);
  background: color-mix(in srgb, var(--surface) 88%, var(--bg));
}

.header-theme-picker__summary {
  list-style: none;
  cursor: pointer;
  padding: 0.35rem 0 0.45rem;
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 0.35rem 1rem;
  font-size: 0.78rem;
  color: var(--muted);
  user-select: none;
}

.header-theme-picker__summary::-webkit-details-marker {
  display: none;
}

.header-theme-picker__summary::marker {
  content: '';
}

.header-theme-picker__summary:hover {
  color: var(--theme);
}

.header-theme-picker__summary-label {
  font-weight: 700;
  letter-spacing: 0.02em;
}

.header-theme-picker__summary-hint {
  font-weight: 500;
  opacity: 0.92;
}

.header-theme-picker__panel {
  padding: 0 0 0.65rem;
}

.header-theme-picker__desc {
  margin: 0 0 0.5rem;
  font-size: 0.75rem;
  line-height: 1.45;
  color: var(--muted);
  max-width: 52rem;
}

.header-theme-picker__grid {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
  align-items: center;
}

.header-theme-swatch {
  width: 2.25rem;
  height: 2.25rem;
  border-radius: 50%;
  border: 2px solid rgba(15, 23, 42, 0.12);
  cursor: pointer;
  padding: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 1px 3px rgba(15, 23, 42, 0.08);
  transition:
    transform 0.12s ease,
    box-shadow 0.12s ease,
    border-color 0.12s ease;
}

.header-theme-swatch:hover {
  transform: scale(1.08);
  box-shadow: 0 2px 8px rgba(15, 23, 42, 0.12);
}

.header-theme-swatch:focus-visible {
  outline: 2px solid var(--theme);
  outline-offset: 2px;
}

.header-theme-swatch[aria-pressed='true'] {
  border-color: var(--theme);
  box-shadow:
    0 0 0 2px #fff,
    0 0 0 4px var(--theme);
}

.header-theme-swatch__num {
  font-size: 0.62rem;
  font-weight: 800;
  color: rgba(15, 23, 42, 0.55);
  text-shadow: 0 1px 0 rgba(255, 255, 255, 0.9);
  pointer-events: none;
}

html[data-docia-header-theme='6'] .header-theme-swatch--6 .header-theme-swatch__num,
html[data-docia-header-theme='4'] .header-theme-swatch--4 .header-theme-swatch__num,
html[data-docia-header-theme='9'] .header-theme-swatch--9 .header-theme-swatch__num,
html[data-docia-header-theme='10'] .header-theme-swatch--10 .header-theme-swatch__num,
html[data-docia-header-theme='2'] .header-theme-swatch--2 .header-theme-swatch__num {
  color: rgba(255, 255, 255, 0.95);
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.35);
}

/* Aperçus sur les boutons (même esprit que les thèmes pleins) */
.header-theme-swatch--1 {
  background: #ffffff;
}
.header-theme-swatch--2 {
  background: linear-gradient(165deg, #0c5a85 0%, #168bcd 45%, #1270a8 100%);
}
.header-theme-swatch--3 {
  background: linear-gradient(180deg, #dbeafe 0%, #e0f2fe 100%);
}
.header-theme-swatch--4 {
  background: linear-gradient(180deg, #1e293b 0%, #0f172a 100%);
}
.header-theme-swatch--5 {
  background: linear-gradient(180deg, #168bcd 0%, #168bcd 12%, #ffffff 12%, #ffffff 100%);
}
.header-theme-swatch--6 {
  background: linear-gradient(135deg, #6366f1 0%, #0ea5e9 100%);
}
.header-theme-swatch--7 {
  background: linear-gradient(135deg, rgba(255, 255, 255, 0.95) 0%, rgba(226, 232, 240, 0.85) 100%);
}
.header-theme-swatch--8 {
  background: linear-gradient(180deg, #fffbeb 0%, #fef3c7 100%);
}
.header-theme-swatch--9 {
  background: linear-gradient(180deg, #475569 0%, #334155 100%);
}
.header-theme-swatch--10 {
  background: linear-gradient(165deg, #0e7490 0%, #155e75 55%, #164e63 100%);
}

/* --- Thème 1 : blanc (référence actuelle) --- */
html[data-docia-header-theme='1'] .site-header.site-header--app {
  background: #ffffff;
  border-bottom-color: var(--border);
  box-shadow: var(--shadow-sm);
}

/* --- Thème 2 : dégradé KlassIA (liens clairs) --- */
html[data-docia-header-theme='2'] .site-header.site-header--app {
  background: linear-gradient(
    165deg,
    color-mix(in srgb, var(--accent-hover) 35%, #0a3d5c) 0%,
    var(--theme) 42%,
    color-mix(in srgb, var(--theme) 58%, #164e7d) 100%
  );
  border-bottom: 1px solid color-mix(in srgb, var(--theme) 55%, #0c1929 45%);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.14);
}

@supports not (background: color-mix(in srgb, red 1%, blue)) {
  html[data-docia-header-theme='2'] .site-header.site-header--app {
    border-bottom: 1px solid #0d4d73;
    background: linear-gradient(165deg, #0c5a85 0%, #168bcd 45%, #1270a8 100%);
  }
}

/* --- Thème 3 : bleu glacier --- */
html[data-docia-header-theme='3'] .site-header.site-header--app {
  background: linear-gradient(180deg, #dbeafe 0%, #e8f4fc 55%, #f0f9ff 100%);
  border-bottom-color: color-mix(in srgb, var(--theme) 28%, var(--border));
}

/* --- Thème 4 : ardoise sombre --- */
html[data-docia-header-theme='4'] .site-header.site-header--app {
  background: linear-gradient(180deg, #1e293b 0%, #0f172a 100%);
  border-bottom: 1px solid #0c1222;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.12);
}

/* --- Thème 5 : blanc + liseré --- */
html[data-docia-header-theme='5'] .site-header.site-header--app {
  background: #ffffff;
  border-bottom: 1px solid var(--border);
  border-top: 3px solid var(--theme);
  box-shadow: var(--shadow-sm);
}

/* --- Thème 6 : ciel & indigo --- */
html[data-docia-header-theme='6'] .site-header.site-header--app {
  background: linear-gradient(125deg, #6366f1 0%, #4f46e5 38%, #0ea5e9 100%);
  border-bottom: 1px solid rgba(30, 27, 75, 0.35);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.12);
}

/* --- Thème 7 : verre dépoli --- */
html[data-docia-header-theme='7'] .site-header.site-header--app {
  background: rgba(255, 255, 255, 0.72);
  border-bottom: 1px solid rgba(226, 232, 240, 0.95);
  -webkit-backdrop-filter: blur(14px);
  backdrop-filter: blur(14px);
  box-shadow: 0 1px 0 rgba(255, 255, 255, 0.6) inset;
}

/* --- Thème 8 : sable chaud --- */
html[data-docia-header-theme='8'] .site-header.site-header--app {
  background: linear-gradient(180deg, #fffbeb 0%, #fef9c3 45%, #fffbeb 100%);
  border-bottom: 1px solid rgba(245, 158, 11, 0.28);
  box-shadow: var(--shadow-sm);
}

/* --- Thème 9 : anthracite --- */
html[data-docia-header-theme='9'] .site-header.site-header--app {
  background: linear-gradient(180deg, #475569 0%, #334155 100%);
  border-bottom: 1px solid #1e293b;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.08);
}

/* --- Thème 10 : océan profond --- */
html[data-docia-header-theme='10'] .site-header.site-header--app {
  background: linear-gradient(165deg, #0e7490 0%, #155e75 50%, #164e63 100%);
  border-bottom: 1px solid #0c4a6e;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.1);
}

/* Navigation / texte : en-têtes foncés (2, 4, 6, 9, 10) */
html[data-docia-header-theme='2'] .site-header--app .nav-app-links a,
html[data-docia-header-theme='2'] .site-header--app .nav-dropdown--app .nav-dropdown__summary,
html[data-docia-header-theme='4'] .site-header--app .nav-app-links a,
html[data-docia-header-theme='4'] .site-header--app .nav-dropdown--app .nav-dropdown__summary,
html[data-docia-header-theme='6'] .site-header--app .nav-app-links a,
html[data-docia-header-theme='6'] .site-header--app .nav-dropdown--app .nav-dropdown__summary,
html[data-docia-header-theme='9'] .site-header--app .nav-app-links a,
html[data-docia-header-theme='9'] .site-header--app .nav-dropdown--app .nav-dropdown__summary,
html[data-docia-header-theme='10'] .site-header--app .nav-app-links a,
html[data-docia-header-theme='10'] .site-header--app .nav-dropdown--app .nav-dropdown__summary {
  color: rgba(255, 255, 255, 0.88);
}

html[data-docia-header-theme='2'] .site-header--app .nav-app-links a:hover,
html[data-docia-header-theme='2'] .site-header--app .nav-app-links > a.is-active,
html[data-docia-header-theme='2'] .site-header--app .nav-app-links > a[aria-current='page'],
html[data-docia-header-theme='2'] .site-header--app .nav-dropdown--app .nav-dropdown__summary:hover,
html[data-docia-header-theme='4'] .site-header--app .nav-app-links a:hover,
html[data-docia-header-theme='4'] .site-header--app .nav-app-links > a.is-active,
html[data-docia-header-theme='4'] .site-header--app .nav-app-links > a[aria-current='page'],
html[data-docia-header-theme='4'] .site-header--app .nav-dropdown--app .nav-dropdown__summary:hover,
html[data-docia-header-theme='6'] .site-header--app .nav-app-links a:hover,
html[data-docia-header-theme='6'] .site-header--app .nav-app-links > a.is-active,
html[data-docia-header-theme='6'] .site-header--app .nav-app-links > a[aria-current='page'],
html[data-docia-header-theme='6'] .site-header--app .nav-dropdown--app .nav-dropdown__summary:hover,
html[data-docia-header-theme='9'] .site-header--app .nav-app-links a:hover,
html[data-docia-header-theme='9'] .site-header--app .nav-app-links > a.is-active,
html[data-docia-header-theme='9'] .site-header--app .nav-app-links > a[aria-current='page'],
html[data-docia-header-theme='9'] .site-header--app .nav-dropdown--app .nav-dropdown__summary:hover,
html[data-docia-header-theme='10'] .site-header--app .nav-app-links a:hover,
html[data-docia-header-theme='10'] .site-header--app .nav-app-links > a.is-active,
html[data-docia-header-theme='10'] .site-header--app .nav-app-links > a[aria-current='page'],
html[data-docia-header-theme='10'] .site-header--app .nav-dropdown--app .nav-dropdown__summary:hover {
  color: #ffffff;
}

html[data-docia-header-theme='2'] .site-header--app .nav-app-links > a.is-active,
html[data-docia-header-theme='2'] .site-header--app .nav-app-links > a[aria-current='page'],
html[data-docia-header-theme='4'] .site-header--app .nav-app-links > a.is-active,
html[data-docia-header-theme='4'] .site-header--app .nav-app-links > a[aria-current='page'],
html[data-docia-header-theme='6'] .site-header--app .nav-app-links > a.is-active,
html[data-docia-header-theme='6'] .site-header--app .nav-app-links > a[aria-current='page'],
html[data-docia-header-theme='9'] .site-header--app .nav-app-links > a.is-active,
html[data-docia-header-theme='9'] .site-header--app .nav-app-links > a[aria-current='page'],
html[data-docia-header-theme='10'] .site-header--app .nav-app-links > a.is-active,
html[data-docia-header-theme='10'] .site-header--app .nav-app-links > a[aria-current='page'] {
  text-decoration-color: rgba(255, 255, 255, 0.95);
}

html[data-docia-header-theme='2'] .site-header--app .nav-dropdown--app[open] > .nav-dropdown__summary,
html[data-docia-header-theme='4'] .site-header--app .nav-dropdown--app[open] > .nav-dropdown__summary,
html[data-docia-header-theme='6'] .site-header--app .nav-dropdown--app[open] > .nav-dropdown__summary,
html[data-docia-header-theme='9'] .site-header--app .nav-dropdown--app[open] > .nav-dropdown__summary,
html[data-docia-header-theme='10'] .site-header--app .nav-dropdown--app[open] > .nav-dropdown__summary {
  color: #ffffff;
}

html[data-docia-header-theme='2'] .site-header--app .nav-dropdown--app .nav-dropdown__summary.is-active,
html[data-docia-header-theme='4'] .site-header--app .nav-dropdown--app .nav-dropdown__summary.is-active,
html[data-docia-header-theme='6'] .site-header--app .nav-dropdown--app .nav-dropdown__summary.is-active,
html[data-docia-header-theme='9'] .site-header--app .nav-dropdown--app .nav-dropdown__summary.is-active,
html[data-docia-header-theme='10'] .site-header--app .nav-dropdown--app .nav-dropdown__summary.is-active {
  color: #ffffff;
}

html[data-docia-header-theme='2'] .site-header--app .header-user-name,
html[data-docia-header-theme='4'] .site-header--app .header-user-name,
html[data-docia-header-theme='6'] .site-header--app .header-user-name,
html[data-docia-header-theme='9'] .site-header--app .header-user-name,
html[data-docia-header-theme='10'] .site-header--app .header-user-name {
  color: rgba(255, 255, 255, 0.95);
}

html[data-docia-header-theme='2'] .site-header--app .header-app-logout,
html[data-docia-header-theme='4'] .site-header--app .header-app-logout,
html[data-docia-header-theme='6'] .site-header--app .header-app-logout,
html[data-docia-header-theme='9'] .site-header--app .header-app-logout,
html[data-docia-header-theme='10'] .site-header--app .header-app-logout {
  color: rgba(255, 255, 255, 0.78);
}

html[data-docia-header-theme='2'] .site-header--app .header-app-logout:hover,
html[data-docia-header-theme='4'] .site-header--app .header-app-logout:hover,
html[data-docia-header-theme='6'] .site-header--app .header-app-logout:hover,
html[data-docia-header-theme='9'] .site-header--app .header-app-logout:hover,
html[data-docia-header-theme='10'] .site-header--app .header-app-logout:hover {
  color: #ffffff;
}

html[data-docia-header-theme='2'] .site-header--app .header-user-avatar,
html[data-docia-header-theme='4'] .site-header--app .header-user-avatar,
html[data-docia-header-theme='6'] .site-header--app .header-user-avatar,
html[data-docia-header-theme='9'] .site-header--app .header-user-avatar,
html[data-docia-header-theme='10'] .site-header--app .header-user-avatar {
  background: rgba(255, 255, 255, 0.95);
  color: var(--theme);
}

html[data-docia-header-theme='2'] .site-header--app .header-context-select,
html[data-docia-header-theme='4'] .site-header--app .header-context-select,
html[data-docia-header-theme='6'] .site-header--app .header-context-select,
html[data-docia-header-theme='9'] .site-header--app .header-context-select,
html[data-docia-header-theme='10'] .site-header--app .header-context-select {
  background: rgba(255, 255, 255, 0.96);
  border-color: rgba(255, 255, 255, 0.45);
  color: var(--text);
}

html[data-docia-header-theme='7'] .site-header--app .header-context-select {
  background: rgba(255, 255, 255, 0.9);
  border-color: color-mix(in srgb, var(--border) 70%, transparent);
}

@media print {
  .header-theme-picker {
    display: none !important;
  }
}
