/* ==========================================================================
   Générateur d'ordre de virement — GHRIZA
   Identité : parchemin, bleu nuit, or.
   ========================================================================== */

:root {
  /* Couleurs de marque */
  --parchemin: #F7F4EC;
  --parchemin-fonce: #EFEADC;
  --navy: #1C2541;
  --navy-clair: #2E3A5C;
  --navy-pale: #E7EAF1;
  --or: #A9812F;
  --or-clair: #C9A253;
  --or-pale: #F7EFDD;

  /* Neutres */
  --blanc: #FFFFFF;
  --encre: #1B1B1B;
  --encre-doux: #5C5A54;
  --encre-pale: #928F86;
  --bord: #E3DED0;
  --bord-fort: #D2CBB8;

  /* Rôles */
  --danger: #A03A2B;
  --danger-pale: #F8EAE7;

  --ombre-carte: 0 1px 2px rgba(28, 37, 65, 0.04), 0 4px 16px rgba(28, 37, 65, 0.06);
  --ombre-modale: 0 24px 64px rgba(28, 37, 65, 0.28);
  --rayon: 10px;
  --rayon-sm: 7px;
  --transition: 0.16s ease;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  background: var(--parchemin);
  color: var(--encre);
  font-size: 14px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

::selection { background: var(--or-pale); }

/* ---- En-tête ------------------------------------------------------------ */

.app-header {
  background: var(--navy);
  color: var(--blanc);
  padding: 0 32px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
  min-height: 62px;
  box-shadow: 0 1px 0 rgba(0, 0, 0, 0.15);
}

.app-header h1 {
  margin: 0;
  font-size: 17px;
  font-weight: 600;
  letter-spacing: 0.01em;
  color: rgba(255, 255, 255, 0.82);
}

.app-header .accent {
  color: var(--blanc);
  font-weight: 700;
  letter-spacing: 0.06em;
}

.tabs {
  display: flex;
  gap: 4px;
  align-self: stretch;
  align-items: center;
}

.tab-btn {
  position: relative;
  background: transparent;
  border: none;
  color: rgba(255, 255, 255, 0.62);
  padding: 10px 18px;
  border-radius: var(--rayon-sm);
  cursor: pointer;
  font-size: 14px;
  font-family: inherit;
  font-weight: 500;
  transition: color var(--transition), background var(--transition);
}

.tab-btn:hover {
  color: var(--blanc);
  background: rgba(255, 255, 255, 0.07);
}

.tab-btn.active {
  color: var(--blanc);
  font-weight: 600;
  background: rgba(255, 255, 255, 0.1);
}

.tab-btn.active::after {
  content: "";
  position: absolute;
  left: 18px;
  right: 18px;
  bottom: -1px;
  height: 2px;
  border-radius: 2px;
  background: var(--or-clair);
}

main {
  padding: 28px 32px 56px;
  max-width: 1320px;
  margin: 0 auto;
}

.tab-panel { display: none; }
.tab-panel.active { display: block; animation: apparition 0.18s ease both; }

@keyframes apparition {
  from { opacity: 0; transform: translateY(4px); }
  to { opacity: 1; transform: none; }
}

h2 {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.11em;
  color: var(--encre-doux);
  margin: 0 0 18px;
  font-weight: 700;
}

/* ---- Cartes ------------------------------------------------------------- */

.form-panel,
.fournisseurs-panel {
  background: var(--blanc);
  border: 1px solid var(--bord);
  border-radius: var(--rayon);
  padding: 26px;
  box-shadow: var(--ombre-carte);
}

.workspace {
  display: grid;
  grid-template-columns: 400px 1fr;
  gap: 28px;
  align-items: start;
}

/* ---- Champs ------------------------------------------------------------- */

.field {
  margin-bottom: 18px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.field label,
.filter label {
  font-size: 12.5px;
  font-weight: 600;
  color: var(--encre);
}

.field .optional,
.filter .optional {
  font-weight: 400;
  color: var(--encre-pale);
  font-size: 12px;
}

.field input,
.field select,
.filter input,
.filter select {
  padding: 10px 12px;
  border: 1px solid var(--bord-fort);
  border-radius: var(--rayon-sm);
  font-size: 14px;
  font-family: inherit;
  background: var(--blanc);
  color: var(--encre);
  transition: border-color var(--transition), box-shadow var(--transition);
}

.field select,
.filter select {
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath fill='%235C5A54' d='M1.4 0 6 4.6 10.6 0 12 1.4 6 7.4 0 1.4z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  padding-right: 32px;
  cursor: pointer;
}

.field input:focus,
.field select:focus,
.filter input:focus,
.filter select:focus {
  outline: none;
  border-color: var(--or);
  box-shadow: 0 0 0 3px var(--or-pale);
}

.field input[readonly] {
  background: var(--parchemin);
  color: var(--encre-doux);
  border-style: dashed;
  cursor: default;
}

.field input::placeholder { color: var(--encre-pale); }

.field-hint {
  margin: 0;
  font-size: 12px;
  color: var(--encre-pale);
  line-height: 1.45;
}

/* ---- Boutons ------------------------------------------------------------ */

.btn-primary {
  width: 100%;
  background: var(--navy);
  color: var(--blanc);
  border: 1px solid var(--navy);
  padding: 12px 18px;
  border-radius: var(--rayon-sm);
  font-size: 14px;
  font-family: inherit;
  font-weight: 600;
  cursor: pointer;
  margin-top: 6px;
  transition: background var(--transition), transform var(--transition), box-shadow var(--transition);
}

.btn-primary:hover:not(:disabled) {
  background: var(--navy-clair);
  box-shadow: 0 4px 14px rgba(28, 37, 65, 0.22);
}

.btn-primary:active:not(:disabled) { transform: translateY(1px); }

.btn-primary:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.btn-secondary {
  background: var(--blanc);
  color: var(--navy);
  border: 1px solid var(--bord-fort);
  padding: 9px 15px;
  border-radius: var(--rayon-sm);
  font-size: 13px;
  font-family: inherit;
  font-weight: 600;
  cursor: pointer;
  transition: border-color var(--transition), background var(--transition);
}

.btn-secondary:hover {
  border-color: var(--or);
  background: var(--or-pale);
}

.btn-ghost {
  background: none;
  border: none;
  color: var(--encre-doux);
  font-size: 13px;
  font-family: inherit;
  cursor: pointer;
  padding: 6px 4px;
  border-radius: 4px;
  transition: color var(--transition);
}

.btn-ghost:hover { color: var(--or); text-decoration: underline; }

.link-btn {
  font-size: 13px;
  color: var(--navy);
  text-decoration: none;
  border-bottom: 1px solid var(--bord-fort);
  transition: color var(--transition), border-color var(--transition);
}

.link-btn:hover { color: var(--or); border-color: var(--or); }

/* ---- Messages ----------------------------------------------------------- */

.form-note {
  font-size: 13px;
  min-height: 18px;
  margin: 12px 0 0;
  color: var(--encre-doux);
}

.form-note.success { color: #2E6647; font-weight: 600; }
.form-note.error { color: var(--danger); font-weight: 600; }

/* ---- Bloc après génération ---------------------------------------------- */

.post-generation {
  margin-top: 22px;
  padding: 18px;
  border: 1px solid var(--or-clair);
  border-left: 3px solid var(--or);
  border-radius: var(--rayon-sm);
  background: var(--or-pale);
}

.pg-title { margin: 0 0 4px; font-size: 14px; }
.pg-sub { margin: 0 0 14px; font-size: 13px; color: var(--encre-doux); }

.pg-actions {
  display: flex;
  align-items: center;
  gap: 12px;
}

/* ---- Aperçu du document ------------------------------------------------- */

/* Aligne le titre de l'aperçu sur celui de la carte de gauche, qui est
   décalé par le padding de la carte. */
.preview-panel { padding-top: 26px; }

.preview-wrapper {
  display: flex;
  justify-content: center;
}

.page {
  background: var(--blanc);
  width: 100%;
  max-width: 640px;
  aspect-ratio: 215.9 / 279.4;
  border: 1px solid var(--bord);
  border-radius: 3px;
  box-shadow: 0 2px 6px rgba(28, 37, 65, 0.07), 0 12px 40px rgba(28, 37, 65, 0.1);
  padding: 8.5% 8.9%;
  font-family: Calibri, "Segoe UI", Helvetica, Arial, sans-serif;
  font-size: 12px;
  line-height: 1.5;
  color: #000;
  overflow: hidden;
}

.doc-logo {
  width: 100%;
  height: auto;
  display: block;
  margin-bottom: 18px;
}

.doc-right { text-align: right; margin: 4px 0; }
.doc-objet { margin: 16px 0 10px; }
.doc-body { margin: 10px 0; }
.doc-bullet { margin: 14px 0 4px; }
.doc-rib { margin: 4px 0 14px 12.7mm; }

.underline { text-decoration: underline; }
.bold { font-weight: 700; }

.doc-signature { margin-top: 40px; text-align: right; }

.sig-line {
  width: 45mm;
  border-bottom: 1px solid #000;
  margin-left: auto;
}

.sig-name {
  margin-top: 6px;
  text-align: center;
  width: 45mm;
  margin-left: auto;
}

/* ---- Barre d'outils ----------------------------------------------------- */

.fournisseurs-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
}

.fournisseurs-toolbar h2 { margin-bottom: 0; }

.toolbar-actions {
  display: flex;
  gap: 10px;
}

.file-btn { cursor: pointer; display: inline-flex; align-items: center; }

/* ---- Filtres ------------------------------------------------------------ */

.filters {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: 14px;
  margin: 20px 0 0;
  padding: 16px;
  background: var(--parchemin);
  border: 1px solid var(--bord);
  border-radius: var(--rayon-sm);
}

.filter {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.filter label {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: var(--encre-doux);
}

.filter input[type="search"] { min-width: 230px; }

/* Les champs date natifs sont plus hauts que les selects : on aligne tout. */
.filter input,
.filter select {
  height: 40px;
  padding-top: 0;
  padding-bottom: 0;
}

/* ---- Bandeau de statistiques -------------------------------------------- */

.stats-strip {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 12px;
  padding: 20px 0 4px;
}

.stat {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 14px 16px;
  background: var(--blanc);
  border: 1px solid var(--bord);
  border-radius: var(--rayon-sm);
  border-left: 3px solid var(--bord-fort);
}

.stat.ok { border-left-color: var(--navy); }
.stat.warn { border-left-color: var(--or); }

.stat-value {
  font-size: 21px;
  font-weight: 700;
  line-height: 1.15;
  color: var(--navy);
  letter-spacing: -0.01em;
}

.stat.warn .stat-value { color: var(--or); }

.stat-label {
  font-size: 11px;
  color: var(--encre-pale);
  text-transform: uppercase;
  letter-spacing: 0.07em;
  font-weight: 600;
}

/* ---- Tableaux ----------------------------------------------------------- */

.fournisseurs-table {
  width: 100%;
  border-collapse: collapse;
  margin-top: 20px;
  font-size: 14px;
}

.fournisseurs-table th {
  text-align: left;
  padding: 10px 14px;
  border-bottom: 1px solid var(--bord-fort);
  color: var(--encre-pale);
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  white-space: nowrap;
}

.fournisseurs-table th.num { text-align: right; }

.fournisseurs-table td {
  padding: 13px 14px;
  border-bottom: 1px solid var(--bord);
  vertical-align: middle;
}

.fournisseurs-table tbody tr { transition: background var(--transition); }
.fournisseurs-table tbody tr:hover td { background: var(--parchemin); }
.fournisseurs-table tbody tr:last-child td { border-bottom: none; }

.row-actions {
  display: flex;
  gap: 10px;
  align-items: center;
  justify-content: flex-end;
}

.row-actions button {
  background: none;
  border: none;
  cursor: pointer;
  font-size: 13px;
  font-family: inherit;
  color: var(--navy);
  padding: 4px 2px;
  border-radius: 4px;
  border-bottom: 1px solid transparent;
  transition: color var(--transition), border-color var(--transition);
}

.row-actions button:hover {
  color: var(--or);
  border-bottom-color: var(--or);
}

.row-actions button.danger { color: var(--encre-pale); }
.row-actions button.danger:hover { color: var(--danger); border-bottom-color: var(--danger); }

.empty-row td {
  text-align: center;
  color: var(--encre-pale);
  padding: 40px 24px;
  font-style: italic;
}

.mono {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 12.5px;
  color: var(--encre-doux);
  white-space: nowrap;
}

.muted { color: var(--encre-pale); }
.num { text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums; }

/* ---- Badges et pastilles ------------------------------------------------ */

.badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 11px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 600;
  white-space: nowrap;
  border: 1px solid transparent;
}

.badge::before {
  content: "";
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: currentColor;
  flex: none;
}

.badge.ok { background: var(--navy-pale); color: var(--navy); border-color: #CFD6E5; }
.badge.warn { background: var(--or-pale); color: #7E5F1E; border-color: var(--or-clair); }
.badge.neutre { background: var(--parchemin); color: var(--encre-pale); border-color: var(--bord); }

.badge.statut-emis { background: var(--parchemin); color: var(--encre-doux); border-color: var(--bord-fort); }
.badge.statut-paye { background: #E8F1EB; color: #2E6647; border-color: #BFD8C8; }
.badge.statut-annule { background: var(--blanc); color: var(--encre-pale); border-color: var(--bord); text-decoration: line-through; }

.chip {
  display: inline-block;
  padding: 3px 9px;
  border-radius: 5px;
  font-size: 12px;
  background: var(--parchemin);
  color: var(--encre-doux);
  border: 1px solid var(--bord);
  white-space: nowrap;
}

.chip.manque {
  background: var(--or-pale);
  color: #7E5F1E;
  border-color: var(--or-clair);
  font-weight: 600;
}

/* ---- Modales ------------------------------------------------------------ */

.modal-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(19, 25, 45, 0.5);
  backdrop-filter: blur(3px);
  align-items: center;
  justify-content: center;
  z-index: 50;
  padding: 24px;
}

.modal-overlay.active { display: flex; animation: fondu 0.15s ease both; }

@keyframes fondu { from { opacity: 0; } to { opacity: 1; } }

.modal {
  background: var(--blanc);
  border-radius: 14px;
  padding: 26px;
  width: 100%;
  max-width: 400px;
  border: 1px solid var(--bord);
  box-shadow: var(--ombre-modale);
  animation: montee 0.2s cubic-bezier(0.2, 0.8, 0.3, 1) both;
}

@keyframes montee {
  from { opacity: 0; transform: translateY(12px) scale(0.985); }
  to { opacity: 1; transform: none; }
}

.modal h3 {
  margin: 0 0 18px;
  color: var(--navy);
  font-size: 17px;
  font-weight: 700;
  padding-right: 32px;
}

.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 20px;
}

.modal-actions .btn-primary { width: auto; margin-top: 0; padding: 10px 20px; }

.modal-lg {
  max-width: 880px;
  max-height: 88vh;
  overflow-y: auto;
  position: relative;
}

.modal-close {
  position: absolute;
  top: 18px;
  right: 20px;
  width: 30px;
  height: 30px;
  background: none;
  border: none;
  font-size: 22px;
  line-height: 1;
  cursor: pointer;
  color: var(--encre-pale);
  border-radius: 50%;
  transition: background var(--transition), color var(--transition);
}

.modal-close:hover { background: var(--parchemin); color: var(--encre); }

.modal-sub {
  margin: -12px 0 20px;
  font-size: 13px;
  color: var(--encre-doux);
  padding-right: 32px;
}

.section-title {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.11em;
  color: var(--encre-doux);
  margin: 26px 0 6px;
  font-weight: 700;
}

/* ---- État du dossier ---------------------------------------------------- */

.dossier-state {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 13px 16px;
  border-radius: var(--rayon-sm);
  font-size: 13.5px;
  font-weight: 600;
  margin-bottom: 22px;
  border: 1px solid transparent;
}

.dossier-state::before {
  content: "";
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: currentColor;
  flex: none;
}

.dossier-state.ok { background: var(--navy-pale); color: var(--navy); border-color: #CFD6E5; }
.dossier-state.warn { background: var(--or-pale); color: #7E5F1E; border-color: var(--or-clair); }
.dossier-state.neutre { background: var(--parchemin); color: var(--encre-doux); border-color: var(--bord); }

.ordre-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: 12px;
}

.field.inline { margin-bottom: 0; min-width: 160px; }
.field.inline.grow { flex: 1; min-width: 200px; }

/* ---- Liste des pièces --------------------------------------------------- */

.pieces-list {
  list-style: none;
  margin: 0;
  padding: 0;
}

.pieces-list .piece {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 13px 14px;
  border: 1px solid var(--bord);
  border-radius: var(--rayon-sm);
  margin-top: 8px;
  background: var(--blanc);
  transition: border-color var(--transition), background var(--transition);
}

.pieces-list .piece:hover { border-color: var(--bord-fort); background: var(--parchemin); }

.pieces-list .empty-row {
  padding: 26px 0;
  text-align: center;
  color: var(--encre-pale);
  font-size: 13px;
  font-style: italic;
  border: 1px dashed var(--bord-fort);
  border-radius: var(--rayon-sm);
  margin-top: 8px;
}

.piece-main {
  display: flex;
  flex-direction: column;
  gap: 3px;
  min-width: 0;
}

.piece-type {
  font-size: 10.5px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--or);
}

.piece-nom {
  font-size: 14px;
  font-weight: 500;
  color: var(--navy);
  text-decoration: none;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.piece-nom:hover { text-decoration: underline; }

.piece-meta {
  font-size: 12px;
  color: var(--encre-pale);
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}

.piece-ordre_pdf .piece-type { color: var(--encre-pale); }

/* ---- Dépôt d'une pièce -------------------------------------------------- */

.upload-form {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: 14px;
  margin-top: 22px;
  padding: 18px;
  background: var(--parchemin);
  border: 1px solid var(--bord);
  border-radius: var(--rayon-sm);
}

.upload-form .btn-primary {
  width: auto;
  margin-top: 0;
  padding: 10px 22px;
}

.upload-form input[type="file"] {
  padding: 8px 12px;
  background: var(--blanc);
  cursor: pointer;
  font-size: 13px;
}

.upload-form input[type="file"]::file-selector-button {
  border: 1px solid var(--bord-fort);
  background: var(--blanc);
  color: var(--navy);
  padding: 6px 12px;
  border-radius: 5px;
  font-family: inherit;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  margin-right: 12px;
  transition: border-color var(--transition), background var(--transition);
}

.upload-form input[type="file"]::file-selector-button:hover {
  border-color: var(--or);
  background: var(--or-pale);
}

.dossier-table { margin-top: 10px; }

/* ---- Notifications ------------------------------------------------------ */

.toast-zone {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 90;
  display: flex;
  flex-direction: column;
  gap: 10px;
  max-width: min(380px, calc(100vw - 48px));
}

.toast {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 13px 16px;
  border-radius: var(--rayon-sm);
  background: var(--navy);
  color: var(--blanc);
  font-size: 13.5px;
  font-weight: 500;
  box-shadow: 0 10px 30px rgba(28, 37, 65, 0.28);
  border-left: 3px solid var(--or-clair);
  animation: toast-entree 0.22s cubic-bezier(0.2, 0.8, 0.3, 1) both;
}

.toast.sortie { animation: toast-sortie 0.2s ease both; }
.toast.succes { border-left-color: #6FCF97; }
.toast.erreur { border-left-color: #E88A7D; }

@keyframes toast-entree {
  from { opacity: 0; transform: translateX(16px); }
  to { opacity: 1; transform: none; }
}

@keyframes toast-sortie {
  from { opacity: 1; }
  to { opacity: 0; transform: translateX(16px); }
}

/* ---- Confirmation ------------------------------------------------------- */

.confirm-modal { max-width: 420px; }

.confirm-modal p {
  margin: 0 0 4px;
  font-size: 14px;
  color: var(--encre-doux);
  line-height: 1.55;
}

.btn-danger {
  background: var(--danger);
  color: var(--blanc);
  border: 1px solid var(--danger);
  padding: 10px 20px;
  border-radius: var(--rayon-sm);
  font-size: 13px;
  font-family: inherit;
  font-weight: 600;
  cursor: pointer;
  transition: opacity var(--transition);
}

.btn-danger:hover { opacity: 0.88; }

/* ---- Responsive --------------------------------------------------------- */

@media (max-width: 1080px) {
  .workspace { grid-template-columns: 1fr; }
  .preview-wrapper { justify-content: flex-start; }
}

@media (max-width: 760px) {
  .app-header { padding: 12px 18px; }
  main { padding: 20px 18px 40px; }
  .form-panel, .fournisseurs-panel { padding: 18px; }
  .modal-lg { max-width: 100%; }
  .fournisseurs-table { font-size: 13px; }
  .fournisseurs-table th, .fournisseurs-table td { padding: 10px 8px; }
  .toast-zone { left: 16px; right: 16px; bottom: 16px; max-width: none; }
}

/* ==========================================================================
   Barre d'outils de l'historique (recherche + état du dossier)
   ========================================================================== */

.search-input,
.filter-select {
  padding: 9px 13px;
  height: 38px;
  border: 1px solid var(--bord-fort);
  border-radius: var(--rayon-sm);
  font-size: 13.5px;
  font-family: inherit;
  background: var(--blanc);
  color: var(--encre);
  transition: border-color var(--transition), box-shadow var(--transition);
}

.search-input { min-width: 320px; }

.filter-select {
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath fill='%235C5A54' d='M1.4 0 6 4.6 10.6 0 12 1.4 6 7.4 0 1.4z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  padding-right: 34px;
  cursor: pointer;
}

.search-input:focus,
.filter-select:focus {
  outline: none;
  border-color: var(--or);
  box-shadow: 0 0 0 3px var(--or-pale);
}

/* ==========================================================================
   Checklist des documents du dossier
   ========================================================================== */

.checklist {
  list-style: none;
  margin: 0;
  padding: 0;
  border: 1px solid var(--bord);
  border-radius: var(--rayon-sm);
  overflow: hidden;
}

.check-item {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 15px 18px;
  border-bottom: 1px solid var(--bord);
  transition: background var(--transition);
}

.check-item:last-child { border-bottom: none; }
.check-item.present { background: var(--blanc); }
.check-item.manquant { background: var(--or-pale); }

/* Pastille d'état : pleine et bleu nuit si le document est là,
   creuse et dorée s'il manque. */
.check-puce {
  flex: none;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  position: relative;
}

.check-item.present .check-puce { background: var(--navy); }

.check-item.present .check-puce::after {
  content: "";
  position: absolute;
  left: 6px;
  top: 3px;
  width: 4px;
  height: 8px;
  border: solid var(--blanc);
  border-width: 0 2px 2px 0;
  transform: rotate(45deg);
}

.check-item.manquant .check-puce {
  border: 2px dashed var(--or);
  background: transparent;
}

.check-main {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.check-libelle {
  font-size: 14px;
  font-weight: 600;
  color: var(--encre);
}

.check-item.manquant .check-libelle { color: #7E5F1E; }

.check-fichier {
  font-size: 13px;
  color: var(--navy);
  text-decoration: none;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.check-fichier:hover { text-decoration: underline; }

.check-etat {
  font-size: 12px;
  color: var(--encre-pale);
}

.check-montant {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 6px;
}

.check-montant label {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--encre-pale);
}

.input-montant {
  width: 130px;
  padding: 5px 9px;
  border: 1px solid var(--bord-fort);
  border-radius: 5px;
  font-family: inherit;
  font-size: 13px;
  background: var(--blanc);
  color: var(--encre);
}

.input-montant:focus {
  outline: none;
  border-color: var(--or);
  box-shadow: 0 0 0 3px var(--or-pale);
}

.btn-ajouter { flex: none; }

/* ==========================================================================
   Pied de la fiche : autre pièce + statut
   ========================================================================== */

.ordre-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 14px;
  margin-top: 24px;
  padding-top: 20px;
  border-top: 1px solid var(--bord);
}

.footer-statut {
  display: flex;
  align-items: center;
  gap: 10px;
}

.footer-statut label {
  font-size: 12.5px;
  font-weight: 600;
  color: var(--encre);
}

.footer-statut select {
  padding: 9px 32px 9px 12px;
  border: 1px solid var(--bord-fort);
  border-radius: var(--rayon-sm);
  font-size: 13.5px;
  font-family: inherit;
  background: var(--blanc);
  color: var(--encre);
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath fill='%235C5A54' d='M1.4 0 6 4.6 10.6 0 12 1.4 6 7.4 0 1.4z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  cursor: pointer;
}

.footer-statut select:focus {
  outline: none;
  border-color: var(--or);
  box-shadow: 0 0 0 3px var(--or-pale);
}

@media (max-width: 760px) {
  .search-input { min-width: 0; width: 100%; }
  .toolbar-actions { width: 100%; flex-wrap: wrap; }
  .check-item { flex-wrap: wrap; }
}


/* ---- Sociétés émettrices ------------------------------------------------ */

/* Le sélecteur de société et la colonne de l'historique n'apparaissent qu'à
   partir de deux sociétés : avec une seule, ils n'apprendraient rien. */
#field-societe { display: none; }
body.multi-societes #field-societe { display: flex; }

.fournisseurs-table th.col-societe,
.fournisseurs-table td.col-societe { display: none; }
body.multi-societes .fournisseurs-table th.col-societe,
body.multi-societes .fournisseurs-table td.col-societe { display: table-cell; }

.logo-cellule {
  height: 24px;
  max-width: 130px;
  object-fit: contain;
  object-position: left center;
  display: block;
}

.logo-vide {
  font-size: 12px;
  color: var(--encre-pale);
  font-style: italic;
}

.logo-actuel {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-top: 4px;
}

.logo-actuel img {
  height: 36px;
  max-width: 210px;
  object-fit: contain;
  background: var(--blanc);
  border: 1px solid var(--bord);
  border-radius: var(--rayon-sm);
  padding: 4px 6px;
}

.checkbox-field label {
  flex-direction: row;
  align-items: center;
  gap: 9px;
  display: flex;
  font-weight: 500;
  color: var(--encre-doux);
  cursor: pointer;
}

.checkbox-field input[type="checkbox"] {
  width: 16px;
  height: 16px;
  accent-color: var(--navy);
  cursor: pointer;
}

.badge.defaut {
  background: var(--or-pale);
  color: #7E5F1E;
  border-color: var(--or-clair);
}


/* ---- Modèle de courrier par société ------------------------------------- */

.deux-colonnes {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}

.field textarea {
  padding: 10px 12px;
  border: 1px solid var(--bord-fort);
  border-radius: var(--rayon-sm);
  font-size: 13.5px;
  font-family: inherit;
  line-height: 1.5;
  background: var(--blanc);
  color: var(--encre);
  resize: vertical;
  transition: border-color var(--transition), box-shadow var(--transition);
}

.field textarea:focus {
  outline: none;
  border-color: var(--or);
  box-shadow: 0 0 0 3px var(--or-pale);
}

.field code {
  background: var(--parchemin-fonce);
  border-radius: 3px;
  padding: 1px 4px;
  font-size: 11.5px;
}

/* ---- En-tête texte de l'aperçu ------------------------------------------ */

.doc-entete {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 16px;
  margin-bottom: 6px;
}

.doc-entete-titre {
  margin: 0;
  font-size: 22px;
  font-weight: 700;
  line-height: 1.15;
  white-space: pre-line;
}

.doc-entete-sous-titre {
  margin: 3px 0 0;
  font-size: 9.5px;
  line-height: 1.35;
  white-space: pre-line;
}

.doc-entete-droite {
  margin: 0;
  font-size: 8.5px;
  line-height: 1.45;
  text-align: right;
  white-space: pre-line;
  color: var(--encre-doux);
}

.doc-filet {
  border: none;
  border-top: 2.5px solid var(--encre);
  margin: 6px 0 14px;
}

.doc-pied {
  margin-top: 26px;
  font-size: 9.5px;
  line-height: 1.4;
  white-space: pre-line;
}

.doc-signatures {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  gap: 20px;
  margin-top: 40px;
}

.sig-bloc { text-align: center; min-width: 45mm; }
.sig-bloc.gauche { text-align: left; }
.sig-nom { margin: 6px 0 0; font-size: 11px; white-space: pre-line; }

/* Le document prend la police de la société. */
.page.serif { font-family: "Times New Roman", Times, Georgia, serif; }


.sous-titre-bloc {
  margin: 20px 0 10px;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: var(--or);
  border-bottom: 1px solid var(--bord);
  padding-bottom: 5px;
}

.badge.type-salaire { background: var(--navy-pale); color: var(--navy); border-color: #CFD6E5; }


/* Récapitulatif par société émettrice, en tête du dossier d'un bénéficiaire. */
.recap-societes {
  margin-bottom: 22px;
  background: var(--parchemin);
  border-radius: var(--rayon-sm);
}

.recap-societes th,
.recap-societes td { padding-left: 12px; padding-right: 12px; }
.recap-societes tbody tr:hover td { background: transparent; }


/* ==========================================================================
   En-tête de l'application
   ========================================================================== */

.app-header {
  background: var(--navy);
  color: #fff;
  padding: 0 40px;
  display: block;
  min-height: 0;
  gap: 0;
  box-shadow: 0 2px 20px rgba(28, 37, 65, 0.18);
  position: relative;
}

.app-header::after {
  content: "";
  position: absolute;
  left: 0; right: 0; bottom: 0;
  height: 3px;
  background: linear-gradient(90deg, var(--or) 0%, var(--or-clair) 45%, transparent 100%);
}

.header-haut {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 24px;
  padding: 22px 0 18px;
}

.marque-eyebrow {
  display: block;
  font-size: 10.5px;
  font-weight: 600;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: rgba(255, 255, 255, 0.55);
  margin-bottom: 7px;
}

.app-header h1 {
  margin: 0;
  font-size: 30px;
  font-weight: 300;
  letter-spacing: 0.02em;
  line-height: 1.05;
  color: #fff;
}

.app-header h1 .accent {
  color: var(--or-clair);
  font-weight: 700;
}

.compte {
  display: flex;
  align-items: center;
  gap: 16px;
  padding-bottom: 4px;
}

.compte-nom {
  font-size: 13px;
  color: rgba(255, 255, 255, 0.85);
  display: flex;
  align-items: center;
  gap: 8px;
}

.compte-nom::before {
  content: "";
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #6FCF97;
}

.btn-entete {
  background: none;
  border: none;
  border-bottom: 1px solid transparent;
  color: rgba(255, 255, 255, 0.6);
  font-family: inherit;
  font-size: 12.5px;
  padding: 2px 0;
  cursor: pointer;
  transition: color var(--transition), border-color var(--transition);
}

.btn-entete:hover {
  color: var(--or-clair);
  border-bottom-color: var(--or-clair);
}

/* Les onglets prennent leur propre ligne, sous la marque. */
.app-header .tabs {
  display: flex;
  gap: 4px;
  margin: 0;
}

.app-header .tab-btn {
  border-radius: var(--rayon-sm) var(--rayon-sm) 0 0;
  padding: 11px 20px;
}

@media (max-width: 760px) {
  .app-header { padding: 0 18px; }
  .header-haut { flex-direction: column; align-items: flex-start; gap: 12px; padding-bottom: 14px; }
  .app-header h1 { font-size: 23px; }
  .app-header .tabs { overflow-x: auto; }
}

/* ==========================================================================
   Page de connexion
   ========================================================================== */

.page-connexion {
  min-height: 100vh;
  display: flex;
  background:
    radial-gradient(1100px 620px at 12% -10%, rgba(169, 129, 47, 0.13), transparent 60%),
    var(--navy);
}

.connexion {
  margin: auto;
  padding: 32px 20px;
  width: 100%;
  max-width: 430px;
}

.connexion-carte {
  background: var(--blanc);
  border-radius: var(--rayon);
  padding: 34px 32px 28px;
  box-shadow: var(--ombre-modale);
}

.connexion-marque {
  padding-bottom: 22px;
  margin-bottom: 24px;
  border-bottom: 1px solid var(--bord);
}

.connexion-marque .marque-eyebrow { color: var(--encre-pale); }

.connexion-marque h1 {
  margin: 0;
  font-size: 26px;
  font-weight: 300;
  color: var(--navy);
  line-height: 1.1;
}

.connexion-marque h1 .accent { color: var(--or); font-weight: 700; }

.connexion-pied {
  margin: 22px 0 0;
  padding-top: 18px;
  border-top: 1px solid var(--bord);
  font-size: 12px;
  line-height: 1.5;
  color: var(--encre-pale);
}

/* ==========================================================================
   Totaux par société dans l'historique
   ========================================================================== */

.totaux-societes {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(215px, 1fr));
  gap: 10px;
  margin-bottom: 26px;
}

.totaux-societes .carte-societe {
  background: var(--blanc);
  border: 1px solid var(--bord);
  border-left: 3px solid var(--navy);
  border-radius: var(--rayon-sm);
  padding: 12px 14px;
}

.totaux-societes .carte-societe.incomplet { border-left-color: var(--or); }

.carte-societe-nom {
  display: block;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--encre-pale);
  margin-bottom: 6px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.carte-societe-total {
  display: block;
  font-size: 18px;
  font-weight: 700;
  color: var(--navy);
  font-variant-numeric: tabular-nums;
}

.carte-societe-detail {
  display: block;
  margin-top: 4px;
  font-size: 11.5px;
  color: var(--encre-doux);
}

.carte-societe-detail .manque { color: var(--or); font-weight: 600; }

/* Modales : quelques ajustements d'alignement. */
.modal-actions.pleine-largeur { grid-column: 1 / -1; justify-content: flex-start; }
.pieces-list .utilisateur { justify-content: space-between; }


/* ==========================================================================
   AMÉLIORATIONS — typographie, structure des fenêtres, défilement
   Ce bloc vient en fin de feuille : il affine les règles précédentes sans
   les remplacer, pour ne pas casser ce qui fonctionne déjà.
   ========================================================================== */

:root {
  /* Pas de police téléchargée : l'application doit fonctionner sans Internet.
     On prend la meilleure police disponible sur le poste, dans l'ordre. */
  --police: "Segoe UI Variable Text", "Segoe UI", system-ui, -apple-system,
            Inter, "Helvetica Neue", Arial, sans-serif;
  --police-titre: "Segoe UI Variable Display", "Segoe UI Semibold", "Segoe UI",
                  system-ui, -apple-system, Inter, "Helvetica Neue", Arial, sans-serif;

  /* Échelle typographique : sept niveaux, pas un de plus. */
  --t-micro: 10.5px;   /* étiquettes majuscules */
  --t-xs: 12px;        /* information secondaire */
  --t-sm: 13px;        /* aides, méta */
  --t-base: 14px;      /* texte courant */
  --t-md: 15.5px;      /* information principale */
  --t-lg: 20px;        /* titres de fenêtre */
  --t-xl: 26px;        /* chiffres clés */
}

body {
  font-family: var(--police);
  font-size: var(--t-base);
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  font-feature-settings: "kern" 1, "liga" 1;
}

h1, h2, h3, h4 { font-family: var(--police-titre); }

/* ---- En-tête : le nom du groupe porte la marque ------------------------- */

.app-header h1 {
  font-family: var(--police-titre);
  letter-spacing: -0.015em;
}

.marque-eyebrow { font-size: var(--t-micro); letter-spacing: 0.2em; }

/* ---- Titres de panneau -------------------------------------------------- */

.form-panel h2,
.fournisseurs-panel h2,
.preview-panel h2 {
  font-size: var(--t-micro);
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--encre-pale);
}

/* ==========================================================================
   Fenêtres : en-tête figé, corps qui défile, pied d'actions figé
   ========================================================================== */

.modal-overlay {
  align-items: flex-start;
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: 28px 24px 36px;
}

.modal {
  margin: auto;
  padding: 0;
  display: flex;
  flex-direction: column;
  /* Bornée à la fenêtre : plus rien ne peut être coupé en bas. dvh suit la
     barre d'adresse mobile, vh sert de repli aux navigateurs plus anciens. */
  max-height: calc(100vh - 64px);
  max-height: calc(100dvh - 64px);
  overflow: hidden;
}

.modal-lg { max-width: 880px; max-height: calc(100dvh - 64px); overflow: hidden; }

.modal-entete {
  flex: none;
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 20px 26px 16px;
  border-bottom: 1px solid var(--bord);
}

.modal-entete .modal-titres { flex: 1; min-width: 0; }

.modal-entete h3 {
  margin: 0;
  padding: 0;
  font-size: var(--t-lg);
  font-weight: 600;
  letter-spacing: -0.01em;
  line-height: 1.25;
  color: var(--navy);
}

.modal-entete .modal-sub {
  margin: 5px 0 0;
  padding: 0;
  font-size: var(--t-sm);
  line-height: 1.45;
  color: var(--encre-pale);
}

/* Flèche de retour : on revient d'où l'on vient, sans perdre sa saisie. */
.modal-retour {
  flex: none;
  width: 32px;
  height: 32px;
  margin: -3px 0 0 -6px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: none;
  border: none;
  border-radius: 50%;
  color: var(--encre-doux);
  font-size: 19px;
  line-height: 1;
  cursor: pointer;
  transition: background var(--transition), color var(--transition);
}

.modal-retour:hover { background: var(--parchemin); color: var(--navy); }

.modal-corps {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: 22px 26px;
}

.modal-pied {
  flex: none;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  padding: 15px 26px;
  border-top: 1px solid var(--bord);
  background: var(--parchemin);
}

.modal-pied .pied-info {
  margin-right: auto;
  font-size: var(--t-xs);
  color: var(--encre-pale);
  line-height: 1.4;
}

.modal-pied .btn-primary,
.modal-pied .btn-secondary,
.modal-pied .btn-danger { width: auto; margin: 0; padding: 10px 20px; }

/* La croix reste pour les fenêtres de consultation, où il n'y a rien à
   enregistrer : une seule façon de fermer par contexte. */
.modal-entete .modal-close { position: static; flex: none; margin: -2px -6px 0 0; }

/* Le pied collant garde les actions visibles quand le corps défile. */
.modal-corps > :first-child { margin-top: 0; }
.modal-corps > .section-title:first-child { margin-top: 0; }

@media (max-width: 760px) {
  .modal-overlay { padding: 12px 12px 24px; }
  .modal { max-height: calc(100dvh - 32px); }
  .modal-entete, .modal-corps, .modal-pied { padding-left: 18px; padding-right: 18px; }
  .modal-pied { flex-wrap: wrap; }
}

/* ==========================================================================
   Hiérarchie des textes
   ========================================================================== */

.section-title {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: var(--t-micro);
  letter-spacing: 0.13em;
  color: var(--encre-pale);
  margin: 28px 0 14px;
}

.section-title::after {
  content: "";
  flex: 1;
  height: 1px;
  background: var(--bord);
}

.field label, .filter label { font-size: var(--t-xs); font-weight: 600; letter-spacing: 0.01em; }
.field-hint { font-size: var(--t-xs); color: var(--encre-pale); }
.field input, .field select, .field textarea { font-size: var(--t-base); }

.btn-primary, .btn-secondary, .btn-danger { font-size: var(--t-base); font-weight: 600; letter-spacing: 0.01em; }
.btn-ghost { font-size: var(--t-xs); }

.fournisseurs-table th { font-size: var(--t-micro); letter-spacing: 0.1em; }
.fournisseurs-table td { font-size: 13.5px; }
.num, .mono { font-variant-numeric: tabular-nums; }

.stat-value { font-size: var(--t-xl); font-weight: 700; letter-spacing: -0.02em; font-variant-numeric: tabular-nums; }
.stat-label { font-size: var(--t-micro); letter-spacing: 0.11em; }

.carte-societe-total { font-size: 19px; letter-spacing: -0.015em; }
.carte-societe-nom { font-size: var(--t-micro); letter-spacing: 0.09em; }
.carte-societe-detail { font-size: var(--t-xs); }

.badge { font-size: 11.5px; font-weight: 600; }
.chip { font-size: 11.5px; }

/* Couple étiquette / valeur : on lit la donnée, pas une phrase à rallonge. */
.meta-grille {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(145px, 1fr));
  gap: 15px 24px;
  margin: 0 0 22px;
  padding: 16px 18px;
  background: var(--parchemin);
  border: 1px solid var(--bord);
  border-radius: var(--rayon-sm);
}

.meta-grille > div { min-width: 0; }

.meta-cle {
  display: block;
  font-size: var(--t-micro);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.09em;
  color: var(--encre-pale);
  margin-bottom: 4px;
}

.meta-valeur {
  display: block;
  font-size: var(--t-md);
  font-weight: 600;
  color: var(--encre);
  line-height: 1.3;
  overflow-wrap: anywhere;
}

.meta-valeur.discret { font-size: var(--t-base); font-weight: 500; color: var(--encre-doux); }

/* ==========================================================================
   Notifications
   ========================================================================== */

.toast {
  align-items: center;
  gap: 12px;
  padding: 13px 15px;
  font-size: 13.5px;
  line-height: 1.45;
  border-left-width: 3px;
  cursor: pointer;
}

.toast-icone {
  flex: none;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: 700;
  background: rgba(255, 255, 255, 0.14);
  color: #fff;
}

.toast.succes .toast-icone { background: #6FCF97; color: #12341F; }
.toast.erreur .toast-icone { background: #E88A7D; color: #4A1710; }
.toast.avertissement .toast-icone { background: var(--or-clair); color: #3A2A08; }
.toast.avertissement { border-left-color: var(--or-clair); }

.toast-texte { flex: 1; min-width: 0; }

/* ==========================================================================
   États de chargement
   ========================================================================== */

.btn-primary:disabled,
.btn-secondary:disabled,
.btn-danger:disabled { opacity: 0.55; cursor: progress; }

.en-cours { position: relative; pointer-events: none; }

/* Le formulaire est un maillon de la chaîne flex entre la fenêtre et son
   corps : sans cela, le corps ne peut pas défiler. */
.modal-formulaire {
  display: flex;
  flex-direction: column;
  flex: 1 1 auto;
  min-height: 0;
}

/* Une grille dont les colonnes valent « 1fr » ne peut pas descendre sous la
   largeur naturelle de son contenu : un champ y provoquait un débordement
   horizontal. minmax(0,…) et min-width:0 lèvent cette contrainte, et les
   colonnes se replient d'elles-mêmes dans une fenêtre étroite. */
.deux-colonnes { grid-template-columns: repeat(auto-fit, minmax(175px, 1fr)); }
.deux-colonnes > * { min-width: 0; }

.field input,
.field select,
.field textarea { min-width: 0; max-width: 100%; }

.modal-corps { overflow-x: hidden; }

/* « Mon compte » porte une liste et deux formulaires : un peu plus large. */
#compte-overlay .modal { max-width: 560px; }

/* Pied de la fiche d'un ordre : l'action secondaire à gauche, le statut et
   son enregistrement à droite. */
.modal-pied #btn-autre { margin-right: auto; }

.modal-pied .footer-statut {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 0;
  padding: 0;
  border: none;
}

.modal-pied .footer-statut label {
  font-size: var(--t-micro);
  font-weight: 700;
  letter-spacing: 0.09em;
  text-transform: uppercase;
  color: var(--encre-pale);
}

.modal-pied .footer-statut select { min-width: 120px; }


/* ---- Œil d'affichage des mots de passe ---------------------------------- */

.champ-mdp { position: relative; display: block; }

/* La place du bouton est réservée dans le champ, le texte ne passe pas dessous. */
.champ-mdp input { width: 100%; padding-right: 44px; }

.oeil {
  position: absolute;
  top: 50%;
  right: 4px;
  transform: translateY(-50%);
  width: 34px;
  height: 34px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: none;
  border: none;
  border-radius: 50%;
  color: var(--encre-pale);
  cursor: pointer;
  transition: color var(--transition), background var(--transition);
}

.oeil:hover { color: var(--navy); background: var(--parchemin); }
.oeil.actif { color: var(--or); }

/* ---------------------------------------------------------------------------
   Rôles
   Un compte « utilisateur » émet des virements et complète les dossiers ; il
   ne gère ni les comptes, ni les sociétés émettrices, et ne supprime rien
   définitivement. Ces règles ne font que masquer : le serveur refuse ces
   mêmes actions de son côté, un affichage n'est jamais une autorisation.
--------------------------------------------------------------------------- */

body:not(.role-admin) #btn-add-societe,
body:not(.role-admin) .edit-societe-btn,
body:not(.role-admin) .del-societe-btn,
body:not(.role-admin) .del-ordre-btn,
body:not(.role-admin) .del-piece-btn,
body:not(.role-admin) .delete-btn,
body:not(.role-admin) .edit-ordre-btn {
  display: none;
}

/* Liste des comptes : le sélecteur de rôle doit tenir sur la même ligne que
   les boutons sans les écraser. */
.utilisateur .row-actions {
  gap: 8px;
  flex-wrap: wrap;
}

.utilisateur .role-util {
  padding: 6px 10px;
  font-size: 0.85rem;
  border: 1px solid var(--bordure, #d7dbe0);
  border-radius: 8px;
  background: #fff;
}

/* Journal d'audit : dense et lisible, on en affiche cent lignes d'affilée. */
#liste-journal {
  max-height: 340px;
  overflow-y: auto;
}

#liste-journal .piece-meta {
  font-size: 0.78rem;
  opacity: 0.75;
}

/* Un <a> utilisé comme bouton d'action : mêmes dimensions et même alignement
   que les <button> voisins, sans le soulignement du lien. */
.lien-bouton {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  text-decoration: none;
  text-align: center;
  white-space: nowrap;
}

/* ---------------------------------------------------------------------------
   Nature du bénéficiaire
   Un fournisseur et un salarié ne se règlent pas de la même façon ; la
   pastille les distingue d'un coup d'œil dans la liste.
--------------------------------------------------------------------------- */

.badge.nature-fournisseur {
  background: #eef2f7;
  color: #3d4d63;
  border: 1px solid #d4dde8;
}

.badge.nature-salarie {
  background: #f3edff;
  color: #5b3fa0;
  border: 1px solid #ded0f7;
}

/* Les sélecteurs de la barre d'outils s'alignent sur la hauteur des boutons. */
.toolbar-actions select {
  padding: 9px 12px;
  font-size: 0.88rem;
  font-family: inherit;
  border: 1px solid var(--bordure, #d7dbe0);
  border-radius: 9px;
  background: #fff;
  color: inherit;
  cursor: pointer;
}

/* Aide sous un champ de formulaire. */
.champ-aide {
  margin: 6px 0 0;
  font-size: 0.78rem;
  line-height: 1.4;
  opacity: 0.7;
}
