:root {
  --bg: #f4f6f9;
  --surface: #ffffff;
  --border: #dde2eb;
  --border-doux: #eef1f5;
  --text: #1b2333;
  --muted: #5a6478;
  --accent: #2457d6;
  --accent-dark: #1a3f9e;
  --accent-pale: #e8eefc;
  --nuit: #14213d;
  --rayon: 12px;
  --error: #c1121f;
  --success: #1a7f37;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: Inter, "Segoe UI", -apple-system, BlinkMacSystemFont, Roboto, "Helvetica Neue", sans-serif;
  font-size: 15px;
  line-height: 1.45;
  background: var(--bg);
  color: var(--text);
}

/* --- Barre du haut (thème A : bleu nuit) --- */
.topbar { background: var(--nuit); color: #fff; }
.topbar-int { max-width: 1240px; margin: 0 auto; padding: 0 1.5rem; min-height: 64px;
  display: flex; flex-wrap: wrap; align-items: center; gap: 0.5rem 1.5rem; }
.brand-box { display: flex; align-items: center; gap: 0.75rem; padding: 0.6rem 0; text-decoration: none; color: #fff; }
.brand-logo { width: 36px; height: 36px; border-radius: 8px; background: var(--accent); color: #fff;
  display: flex; align-items: center; justify-content: center; flex: none; }
.brand-texte { display: flex; flex-direction: column; line-height: 1.2; }
.topbar .brand { font-weight: 600; font-size: 0.98rem; color: #fff; }
.topbar .brand-user { font-size: 0.78rem; color: #b9c3d9; white-space: nowrap; }
.topbar nav { display: flex; flex-wrap: wrap; align-items: center; gap: 0.25rem; flex: 1 1 auto; }
.topbar nav a, .topbar .nav-menu summary { color: #d5dceb; text-decoration: none; font-size: 0.92rem;
  padding: 0.55rem 0.75rem; border-radius: 8px; display: inline-block; }
.topbar nav a:hover, .topbar .nav-menu summary:hover, .topbar .nav-menu[open] summary { color: #fff; background: rgba(255,255,255,0.08); }
.topbar nav a.actif, .topbar .nav-menu summary.actif { color: #fff; background: rgba(255,255,255,0.14); font-weight: 500; }
.user-box { display: flex; gap: 0.9rem; align-items: center; font-size: 0.9rem; margin-left: auto; }
.user-box .compte-ico { display: inline-flex; width: 36px; height: 36px; align-items: center; justify-content: center; border-radius: 8px; }
.user-box .compte-ico:hover { background: rgba(255,255,255,0.08); }
.user-box a { color: #d5dceb; text-decoration: none; }
.user-box a:hover { color: #fff; text-decoration: underline; }

.content { max-width: 1240px; margin: 0 auto; padding: 2rem 1.5rem 4rem; }

h1 { font-size: 1.75rem; font-weight: 700; letter-spacing: -0.01em; margin: 0 0 0.3rem; }
a { color: var(--accent); }
.hint { color: var(--muted); font-size: 0.92rem; }

.login-wrap { display: flex; justify-content: center; padding-top: 4rem; }
.login-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 2rem;
  width: 320px;
  display: flex;
  flex-direction: column;
  gap: 0.9rem;
}
.login-card label { display: flex; flex-direction: column; gap: 0.3rem; font-size: 0.9rem; color: var(--muted); }
.login-card input {
  padding: 0.55rem 0.6rem;
  border: 1px solid var(--border);
  border-radius: 6px;
  font-size: 0.95rem;
}
.login-card button, .drop-card button, .new-user-form button {
  background: var(--accent);
  color: white;
  border: none;
  border-radius: 6px;
  padding: 0.6rem 1rem;
  font-size: 0.95rem;
  cursor: pointer;
}
.login-card button:hover, .drop-card button:hover, .new-user-form button:hover { background: var(--accent-dark); }
.error { color: var(--error); font-size: 0.88rem; }
.notice { color: var(--accent-dark); font-size: 0.88rem; }

.card-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 1rem; margin-top: 1.5rem; }
.tile {
  display: block;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 1.2rem;
  text-decoration: none;
  color: var(--text);
}
.tile:hover { border-color: var(--accent); }
.tile h2 { margin: 0 0 0.4rem; font-size: 1.05rem; }
.tile p { margin: 0; color: var(--muted); font-size: 0.9rem; }

.drop-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 1.5rem; margin-top: 1.5rem; }
.drop-card { background: var(--surface); border: 1px solid var(--border); border-radius: 10px; padding: 1.3rem; }
.drop-card h2 { font-size: 1.05rem; margin-top: 0; }

.client-field { display: flex; flex-direction: column; gap: 0.3rem; font-size: 0.85rem; color: var(--muted); margin-bottom: 0.8rem; }
.client-field input { padding: 0.5rem; border: 1px solid var(--border); border-radius: 6px; }

.dropzone {
  border: 2px dashed var(--border);
  border-radius: 10px;
  padding: 2rem 1rem;
  text-align: center;
  color: var(--muted);
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s;
}
.dropzone span { font-size: 0.82rem; }
.dropzone.dragover { border-color: var(--accent); background: #eef3fe; color: var(--accent-dark); }

.file-list { list-style: none; padding: 0; margin: 1rem 0 0; display: flex; flex-direction: column; gap: 0.5rem; }
.file-list li {
  display: flex;
  justify-content: space-between;
  gap: 0.5rem;
  padding: 0.5rem 0.7rem;
  border: 1px solid var(--border);
  border-radius: 6px;
  font-size: 0.85rem;
}
.file-list .status-en-cours { color: var(--muted); }
.file-list .status-ok { color: var(--success); }
.file-list .status-erreur { color: var(--error); }

.placeholder-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--rayon); padding: 1.5rem; margin-top: 1.5rem; }

.breadcrumb { display: flex; align-items: center; gap: 0.4rem; margin: 1rem 0 0.5rem; font-size: 0.9rem; flex-wrap: wrap; }
.breadcrumb a { color: var(--accent); text-decoration: none; }
.breadcrumb a:hover { text-decoration: underline; }
.breadcrumb-sep { color: var(--muted); }
.breadcrumb-current { color: var(--muted); }

.folder-list { list-style: none; padding: 0; margin: 1rem 0 0; display: flex; flex-direction: column; gap: 0.4rem; }
.folder-entry {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.8rem;
  padding: 0.6rem 0.8rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 0.9rem;
}
.folder-entry-name { display: flex; align-items: center; gap: 0.5rem; color: var(--text); text-decoration: none; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.folder-entry-name.is-dir { color: var(--text); font-weight: 500; }
.folder-entry-name.is-dir:hover { color: var(--accent); }
.folder-entry-icon { flex: none; }
.folder-entry-meta { display: flex; align-items: center; gap: 0.9rem; flex: none; color: var(--muted); font-size: 0.82rem; }

.users-table { width: 100%; border-collapse: separate; border-spacing: 0; margin-top: 1rem; background: var(--surface); border: 1px solid var(--border); border-radius: var(--rayon); overflow: hidden; }
.users-table th, .users-table td { text-align: left; padding: 0.7rem 0.9rem; border-bottom: 1px solid var(--border-doux); font-size: 0.9rem; }
.users-table th { background: #f8f9fb; color: var(--muted); font-size: 0.75rem; font-weight: 600; text-transform: uppercase; letter-spacing: 0.04em; }
.users-table tr:last-child td { border-bottom: none; }
.link-btn { background: none; border: none; color: var(--accent); cursor: pointer; font-size: 0.85rem; padding: 0; }

.new-user-form { display: flex; flex-wrap: wrap; gap: 0.8rem; align-items: end; margin-top: 1rem; background: var(--surface); border: 1px solid var(--border); border-radius: 8px; padding: 1rem; }
.new-user-form label { display: flex; flex-direction: column; gap: 0.3rem; font-size: 0.85rem; color: var(--muted); }
.new-user-form input[type=text] { padding: 0.5rem; border: 1px solid var(--border); border-radius: 6px; }
.new-user-form .checkbox { flex-direction: row; align-items: center; gap: 0.4rem; }

.permissions-fieldset { border: 1px solid var(--border); border-radius: 8px; padding: 0.8rem 1rem; margin: 0.2rem 0; display: flex; flex-direction: column; gap: 0.5rem; width: 100%; }
.permissions-fieldset legend { font-size: 0.82rem; color: var(--muted); padding: 0 0.3rem; }

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #15171c;
    --surface: #1d2026;
    --border: #2c303a;
    --text: #e8eaed;
    --muted: #9aa0ab;
    --accent: #5b8bff;
    --accent-dark: #7fa3ff;
  }
  .dropzone.dragover { background: #202a44; }
  :root { --border-doux: #262a33; --accent-pale: #1f2a47; --nuit: #0e1526; }
  .users-table th, .tableau th { background: #22262e; }
}

.delete-form { display: inline; margin: 0; }
.link-danger { color: var(--error); }
.link-danger:hover { text-decoration: underline; }

.client-search { display: flex; gap: 0.5rem; margin: 1rem 0 0.8rem; }
.client-search input {
  flex: 1; max-width: 520px; padding: 0.6rem 0.8rem; font-size: 1rem;
  border: 1px solid var(--border); border-radius: 8px; background: var(--surface); color: var(--text);
}
.client-search input:focus { outline: 2px solid var(--accent); outline-offset: -1px; }
.client-search button {
  background: var(--accent); color: #fff; border: none; border-radius: 8px;
  padding: 0.6rem 1rem; font-size: 0.95rem; cursor: pointer;
}
.client-search button:hover { background: var(--accent-dark); }

/* --- Archives (contrats résiliés) --- */
.archive-entry { align-items: flex-start; }
.archive-main { display: flex; flex-direction: column; gap: 0.2rem; min-width: 0; }
.archive-main .folder-entry-name { white-space: normal; }
.archive-details { color: var(--muted); font-size: 0.82rem; }
.archive-details strong { color: var(--text); font-weight: 600; }
.badge { display: inline-block; padding: 0.05rem 0.45rem; border-radius: 999px; font-size: 0.72rem; font-weight: 600; }
.badge-warn { background: #fff4d6; color: #8a5a00; border: 1px solid #f0d58a; }
@media (prefers-color-scheme: dark) {
  .badge-warn { background: #3a2f12; color: #f3cf6d; border-color: #5c4a1a; }
}

/* --- Fiches clients (CRM) --- */
.badge-statut { margin-left: 0.5rem; vertical-align: middle; border: 1px solid var(--border); }
.statut-client { background: #e3f5e8; color: #1a7f37; border-color: #b6e2c3; }
.statut-prospect { background: #e8efff; color: #1a3f9e; border-color: #c4d4fb; }
.statut-ancien_client { background: #f1f1f4; color: #555b66; }
.statut-a_qualifier { background: #fff4d6; color: #8a5a00; border-color: #f0d58a; }
.fiche-entete h1 { display: flex; align-items: center; gap: 0.3rem; flex-wrap: wrap; }
.fiche-grille { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 1rem; }
.fiche-bloc { margin-top: 1rem; }
.fiche-bloc h2, .fiche-section h2 { font-size: 1.05rem; margin: 0 0 0.6rem; }
.fiche-dl { display: grid; grid-template-columns: max-content 1fr; gap: 0.35rem 1rem; margin: 0; font-size: 0.9rem; }
.fiche-dl dt { color: var(--muted); }
.fiche-dl dd { margin: 0; }
.fiche-notes { white-space: pre-line; margin-top: 0.8rem; }
.fiche-section { margin-top: 2rem; }
.fiche-section .users-table td { vertical-align: top; }
@media (prefers-color-scheme: dark) {
  .statut-client { background: #16301f; color: #7ad58f; border-color: #285236; }
  .statut-prospect { background: #1b2540; color: #9db8ff; border-color: #2e3d66; }
  .statut-ancien_client { background: #25272d; color: #aab0bb; }
  .statut-a_qualifier { background: #3a2f12; color: #f3cf6d; border-color: #5c4a1a; }
}

/* --- CRM étape 6 : modifier, valider, fusionner --- */
.notice-ok { background: #e6f6ea; color: #1d6b34; border: 1px solid #b6e2c2; border-radius: 6px; padding: 0.5rem 0.75rem; font-size: 0.9rem; }
.notice-warn { background: #fff4d6; color: #8a5a00; border: 1px solid #f0d58a; border-radius: 6px; padding: 0.5rem 0.75rem; font-size: 0.9rem; }
@media (prefers-color-scheme: dark) {
  .notice-ok { background: #13321d; color: #8fdca6; border-color: #22553a; }
  .notice-warn { background: #3a2f12; color: #f3cf6d; border-color: #5c4a1a; }
}
.fiche-actions { display: flex; flex-wrap: wrap; gap: 0.75rem; align-items: center; margin-top: 0.5rem; }
.fiche-actions .link-btn, .valider-carte .link-btn { font-size: 0.9rem; }
.fiche-form { flex-direction: column; align-items: stretch; max-width: 640px; gap: 0.75rem; }
.fiche-form input[type=date], .fiche-form select, .fiche-form textarea { padding: 0.5rem; border: 1px solid var(--border); border-radius: 6px; font: inherit; background: inherit; color: inherit; }
.fiche-form-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 0.75rem; }
@media (max-width: 600px) { .fiche-form-2 { grid-template-columns: 1fr; } }
.ligne-docs td { padding-top: 0; border-top: none; }
.ligne-docs summary { cursor: pointer; color: var(--accent); font-size: 0.85rem; }
.docs-contrat { margin: 0.3rem 0 0.2rem 1.2rem; padding: 0; font-size: 0.85rem; color: var(--muted); }
.valider-carte { margin-bottom: 0.9rem; }
.valider-carte p { margin: 0.25rem 0; }
.valider-actions { display: flex; flex-wrap: wrap; gap: 0.5rem; align-items: center; margin-top: 0.4rem; }
.valider-actions input[type=text], .valider-couple input[type=text] { padding: 0.4rem; border: 1px solid var(--border); border-radius: 6px; }
.valider-couple { display: grid; grid-template-columns: auto 1fr 1fr; gap: 0.4rem 0.5rem; align-items: center; max-width: 560px; margin-top: 0.4rem; }
.valider-couple button { grid-column: 1 / -1; justify-self: start; }
.valider-autre { margin-top: 0.5rem; font-size: 0.88rem; }
.valider-autre summary { cursor: pointer; color: var(--muted); }
.btn-secondaire { background: transparent !important; color: var(--accent) !important; border: 1px solid var(--accent) !important; }
.valider-carte button, .fiche-actions button { background: var(--accent); color: #fff; border: none; border-radius: 6px; padding: 0.5rem 0.9rem; font-size: 0.9rem; cursor: pointer; }

/* --- Fiche : clic sur un contrat = aperçu du scan ou dossier --- */
tr.cliquable { cursor: pointer; }
tr.cliquable:hover td { background: color-mix(in srgb, var(--accent) 7%, transparent); }
.ico-contrat { margin-right: 0.35rem; }
.fichiers-contrat { margin: 0.2rem 0 0.3rem 1.2rem; }
.apercu-dialog { width: min(1000px, 94vw); height: 90vh; padding: 0; border: 1px solid var(--border); border-radius: 10px; display: none; flex-direction: column; overflow: hidden; }
.apercu-dialog[open] { display: flex; }
.apercu-dialog::backdrop { background: rgba(0, 0, 0, 0.55); }
.apercu-barre { display: flex; flex-wrap: wrap; gap: 0.6rem; align-items: center; padding: 0.55rem 0.8rem; border-bottom: 1px solid var(--border); font-size: 0.9rem; }
.apercu-barre strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 45%; }
.apercu-actions { margin-left: auto; display: flex; gap: 0.8rem; align-items: center; }
.apercu-fermer { background: none; border: none; font-size: 1.1rem; cursor: pointer; color: inherit; }
.apercu-num { border: 1px solid var(--border); background: none; border-radius: 4px; padding: 0.1rem 0.45rem; cursor: pointer; color: inherit; }
.apercu-num.actif { background: var(--accent); color: #fff; border-color: var(--accent); }
#apercu-cadre { flex: 1; width: 100%; border: none; background: #525659; }

/* --- RGPD (étape 7) --- */
.btn-danger { background: #c0392b !important; color: #fff !important; border: none; border-radius: 6px; padding: 0.5rem 0.9rem; cursor: pointer; }
.btn-petit { padding: 0.3rem 0.7rem !important; font-size: 0.85rem; }
.rgpd-courrier { width: 100%; max-width: 760px; font: inherit; font-size: 0.92rem; padding: 0.75rem; border: 1px solid var(--border); border-radius: 6px; background: inherit; color: inherit; }
.rgpd-examiner { margin-top: 1.5rem; }
.rgpd-examiner summary { cursor: pointer; }
h2.inline { display: inline; font-size: 1.1rem; }
.link-rgpd { color: var(--muted) !important; }
.rgpd-niveaux label.checkbox { display: flex; gap: 0.5rem; align-items: flex-start; margin: 0.35rem 0; color: inherit; font-size: 0.9rem; }
.rgpd-niveaux input[type=radio] { margin-top: 0.2rem; }
.purge-form { display: flex; gap: 0.4rem; align-items: center; }
.purge-form select { padding: 0.25rem; border: 1px solid var(--border); border-radius: 6px; font-size: 0.85rem; background: inherit; color: inherit; }

/* --- Barre du haut : nom + rôle sous le titre, menu Administration --- */
.nav-menu { position: relative; }
.nav-menu summary::-webkit-details-marker { display: none; }
.nav-menu summary::after { content: " ▾"; font-size: 0.75rem; }
.nav-menu-liste { position: absolute; top: calc(100% + 0.5rem); left: -0.6rem; z-index: 20; min-width: 170px; display: flex; flex-direction: column;
  background: var(--surface); border: 1px solid var(--border); border-radius: 8px; box-shadow: 0 6px 18px rgba(0,0,0,0.12); padding: 0.35rem 0; }
.nav-menu summary { list-style: none; cursor: pointer; }
.topbar .nav-menu-liste a { display: block; padding: 0.55rem 1rem; color: var(--text); border-radius: 0; }
.topbar .nav-menu-liste a:hover { color: var(--accent); }
.nav-menu-liste a:hover { background: color-mix(in srgb, var(--accent) 8%, transparent); }

/* --- Notes de la fiche --- */
.btn-note { margin-left: 0.8rem; font-size: 0.85rem; font-weight: normal; background: var(--accent); color: #fff; border: none; border-radius: 6px; padding: 0.3rem 0.7rem; cursor: pointer; vertical-align: middle; }
.notes-journal { white-space: pre-wrap; background: var(--surface); border: 1px solid var(--border); border-radius: 8px; padding: 0.8rem 1rem; font-size: 0.9rem; max-height: 320px; overflow: auto; line-height: 1.45; }
.note-dialog { width: min(620px, 94vw); border: 1px solid var(--border); border-radius: 10px; padding: 1.2rem; }
.note-dialog::backdrop { background: rgba(0, 0, 0, 0.45); }
.note-dialog h3 { margin: 0 0 0.6rem; }
.note-dialog textarea { width: 100%; box-sizing: border-box; font: inherit; padding: 0.6rem; border: 1px solid var(--border); border-radius: 6px; background: inherit; color: inherit; }
.note-dialog .fiche-actions button { background: var(--accent); color: #fff; border: none; border-radius: 6px; padding: 0.5rem 0.9rem; cursor: pointer; }

/* --- Aperçu d'un document dans la page (Dossiers clients, Archives) --- */
.apercu { margin-top: 0.9rem; border: 1px solid var(--border); border-radius: 10px; overflow: hidden; background: var(--surface); }
.apercu-barre { display: flex; flex-wrap: wrap; align-items: center; gap: 0.6rem; padding: 0.5rem 0.8rem; border-bottom: 1px solid var(--border); font-size: 0.9rem; }
.apercu-barre strong { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.apercu-zoom { display: inline-flex; gap: 0.25rem; }
.apercu-zoom[hidden] { display: none; }
.apercu-zoom button { border: 1px solid var(--border); background: none; color: inherit; border-radius: 6px; padding: 0.15rem 0.55rem; cursor: pointer; font: inherit; }
.apercu .apercu-fermer { border: none; background: none; color: inherit; font-size: 1rem; cursor: pointer; padding: 0.15rem 0.4rem; }
.apercu-corps { max-height: 80vh; overflow: auto; background: #525659; text-align: center; }
.apercu-corps img { display: inline-block; vertical-align: top; cursor: zoom-in; background: #fff; }
.apercu-corps iframe { display: block; width: 100%; height: 75vh; border: none; background: #fff; }
.voir-apercu.actif { font-weight: 700; }
.apercu .apercu-original { border: 1px solid var(--accent); background: none; color: var(--accent); border-radius: 6px; padding: 0.15rem 0.6rem; cursor: pointer; font: inherit; font-size: 0.85rem; }
.apercu .apercu-original[hidden] { display: none; }
#apercu-info { font-size: 0.8rem; }
.apercu-dialog-corps { flex: 1; overflow: auto; background: #525659; text-align: center; }
.apercu-dialog-corps iframe { display: block; width: 100%; height: 100%; border: none; background: #fff; }
.apercu-dialog-corps .apercu-img { max-width: 100%; background: #fff; cursor: zoom-in; vertical-align: top; }
.apercu-dialog-corps .apercu-img.reelle { max-width: none; cursor: zoom-out; }
.apercu-dialog .apercu-original { border: 1px solid var(--accent); background: none; color: var(--accent); border-radius: 6px; padding: 0.15rem 0.6rem; cursor: pointer; font: inherit; font-size: 0.85rem; }
.apercu-dialog .apercu-original[hidden] { display: none; }
.apercu-dialog-corps .apercu-img.mini { width: 50%; margin: 1rem 0; box-shadow: 0 2px 10px rgba(0,0,0,.35); }
.apercu-corps img { box-shadow: 0 2px 10px rgba(0,0,0,.35); margin: 0.8rem 0; }


/* =====================================================================
   Thème A « sobre et professionnel » — composants communs
   ===================================================================== */
.visuellement-cache { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.fort { font-weight: 600; }
.coupe { overflow-wrap: anywhere; }
.carte { background: var(--surface); border: 1px solid var(--border); border-radius: var(--rayon); padding: 1.35rem 1.4rem; }
.carte h2 { font-size: 1.02rem; font-weight: 600; margin: 0 0 0.9rem; }
.carte-tete { display: flex; align-items: center; justify-content: space-between; gap: 0.5rem; margin-bottom: 0.9rem; }
.carte-tete h2 { margin: 0; }
.carte-table { padding: 0; }
.table-boite { overflow-x: auto; }
.tableau { width: 100%; border-collapse: collapse; font-size: 0.9rem; }
.tableau th { text-align: left; background: #f8f9fb; color: var(--muted); font-size: 0.74rem; font-weight: 600; text-transform: uppercase; letter-spacing: 0.04em; padding: 0.7rem 1rem; }
.tableau td { padding: 0.75rem 1rem; border-top: 1px solid var(--border-doux); vertical-align: middle; }
.carte:not(.carte-table) .tableau th { background: none; padding-left: 0; }
.carte:not(.carte-table) .tableau td { padding-left: 0; }
.tableau a { text-decoration: none; }
.tableau a:hover { text-decoration: underline; }

.btn { display: inline-flex; align-items: center; justify-content: center; gap: 0.4rem; min-height: 42px; padding: 0 1rem;
  border: 1px solid #c9d0dc; background: var(--surface); color: var(--text); border-radius: 8px;
  font: inherit; font-size: 0.9rem; font-weight: 500; text-decoration: none; cursor: pointer; white-space: nowrap; }
.btn:hover { border-color: var(--accent); color: var(--accent); }
.btn-primaire { background: var(--accent); border-color: var(--accent); color: #fff; font-weight: 600; }
.btn-primaire:hover { background: var(--accent-dark); border-color: var(--accent-dark); color: #fff; }
.lien-bouton { background: none; border: none; color: var(--accent); font: inherit; font-size: 0.9rem; font-weight: 500; cursor: pointer; padding: 0.3rem 0; }
.lien-bouton:hover { text-decoration: underline; }

.pastille { display: inline-block; min-width: 1.6rem; text-align: center; padding: 0.15rem 0.55rem; border-radius: 999px; font-size: 0.8rem; font-weight: 600; background: var(--accent-pale); color: var(--accent-dark); }
.pastille-orange { background: #fff1de; color: #8a4b00; }
.pastille-grise { background: var(--border-doux); color: var(--muted); }
.pastille[hidden] { display: none; }
.badge-statut { margin-left: 0; font-size: 0.74rem; padding: 0.15rem 0.6rem; }

/* --- Accueil --- */
.accueil-tete { display: flex; flex-direction: column; gap: 1.2rem; margin-bottom: 1.8rem; }
.accueil-tete h1 { margin: 0; }
.accueil-tete .hint { margin: 0.3rem 0 0; }
.recherche-globale { display: flex; flex-wrap: wrap; gap: 0.6rem; background: var(--surface); border: 1px solid var(--border); border-radius: var(--rayon); padding: 0.55rem; }
.recherche-globale:focus-within { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-pale); }
.recherche-globale input { flex: 1 1 280px; min-width: 0; border: 0; outline: none; background: transparent; color: var(--text); font: inherit; font-size: 1rem; padding: 0.6rem 0.8rem; }
.tuiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); gap: 1rem; margin-bottom: 1.8rem; }
.tuile { display: flex; flex-direction: column; gap: 0.75rem; background: var(--surface); border: 1px solid var(--border); border-radius: var(--rayon);
  padding: 1.35rem; color: var(--text); text-decoration: none; transition: border-color .15s, box-shadow .15s; }
.tuile:hover { border-color: var(--accent); box-shadow: 0 4px 14px rgba(20, 33, 61, 0.08); }
.tuile-ico { width: 40px; height: 40px; border-radius: 10px; background: var(--accent-pale); color: var(--accent); display: flex; align-items: center; justify-content: center; }
.tuile-titre { font-weight: 600; font-size: 1rem; }
.tuile-texte { color: var(--muted); font-size: 0.88rem; }
.accueil-bas { display: flex; flex-wrap: wrap; gap: 1.5rem; align-items: flex-start; }
.accueil-afaire { flex: 1 1 340px; min-width: 0; }
.accueil-recents { flex: 1.5 1 440px; min-width: 0; }
.ligne-lien { display: flex; align-items: center; justify-content: space-between; gap: 0.8rem; padding: 0.85rem 0; border-top: 1px solid var(--border-doux); color: var(--text); text-decoration: none; }
.ligne-lien:hover { color: var(--accent); }
.fleche { color: var(--muted); font-size: 1.2rem; line-height: 1; }

/* --- Fiche client --- */
.breadcrumb { margin: 0 0 1rem; }
.fiche-tete { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 1.2rem; margin-bottom: 1.5rem; }
.fiche-identite { display: flex; align-items: center; gap: 1.1rem; min-width: 0; }
.avatar { width: 56px; height: 56px; flex: none; border-radius: 50%; background: var(--accent-pale); color: var(--accent); display: flex; align-items: center; justify-content: center; font-weight: 700; font-size: 1.2rem; }
.fiche-titre { min-width: 0; }
.fiche-titre-ligne { display: flex; flex-wrap: wrap; align-items: center; gap: 0.6rem; }
.fiche-titre h1 { margin: 0; font-size: 1.6rem; }
.fiche-titre .hint { margin: 0.3rem 0 0; }
.fiche-boutons { display: flex; flex-wrap: wrap; gap: 0.6rem; align-items: center; }
.menu-actions { position: relative; }
.menu-actions summary { list-style: none; }
.menu-actions summary::-webkit-details-marker { display: none; }
.menu-actions summary::after { content: "▾"; font-size: 0.75rem; margin-left: 0.15rem; }
.menu-actions-liste { position: absolute; right: 0; top: calc(100% + 0.4rem); z-index: 20; min-width: 250px; display: flex; flex-direction: column;
  background: var(--surface); border: 1px solid var(--border); border-radius: 10px; box-shadow: 0 8px 24px rgba(20,33,61,0.14); padding: 0.35rem 0; }
.menu-actions-liste a { padding: 0.65rem 1rem; color: var(--text); text-decoration: none; font-size: 0.9rem; }
.menu-actions-liste a:hover { background: var(--accent-pale); }
.menu-actions-liste a.danger { color: #b42318; }
.fiche-corps { display: flex; flex-wrap: wrap; gap: 1.5rem; align-items: flex-start; }
.fiche-cote { flex: 1 1 300px; min-width: 0; display: flex; flex-direction: column; gap: 1.5rem; }
.fiche-principal { flex: 999 1 560px; min-width: 0; display: flex; flex-direction: column; gap: 1.2rem; }
.fiche-dl { grid-template-columns: 105px minmax(0, 1fr); gap: 0.55rem 0.8rem; }
.dossier-lien { display: flex; align-items: center; gap: 0.6rem; padding: 0.75rem; border: 1px solid var(--border); border-radius: 8px; color: var(--text); text-decoration: none; margin-top: 0.5rem; }
.dossier-lien:first-of-type { margin-top: 0; }
.dossier-lien svg { color: var(--muted); flex: none; }
.dossier-lien span:nth-child(2) { font-weight: 500; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dossier-lien .fleche { margin-left: auto; }
.dossier-lien:hover { border-color: var(--accent); color: var(--accent); }
.notes-journal { border: none; padding: 0; background: none; max-height: 360px; }
.onglets { display: flex; flex-wrap: wrap; gap: 0.15rem; border-bottom: 1px solid var(--border); }
.onglets a { padding: 0.75rem 0.9rem; color: var(--muted); text-decoration: none; font-size: 0.92rem; border-bottom: 2px solid transparent; margin-bottom: -1px; }
.onglets a:hover { color: var(--text); }
.onglets a.actif { color: var(--accent); font-weight: 600; border-bottom-color: var(--accent); }
.onglets .compte { font-size: 0.78rem; background: var(--border-doux); color: var(--muted); border-radius: 999px; padding: 0.05rem 0.45rem; margin-left: 0.2rem; font-weight: 500; }
.onglets a.actif .compte { background: var(--accent-pale); color: var(--accent-dark); }
.panneau-titre { font-size: 1.02rem; font-weight: 600; margin: 0.4rem 0 0.8rem; }
body.avec-onglets .panneau-titre { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
.onglet-panneau[hidden] { display: none; }
.ligne-docs td { border-top: none; padding-top: 0; }
tr.cliquable:hover td { background: #f6f8fd; }

/* --- Vignettes : miniature + agrandissement au survol --- */
.vignettes { display: inline-flex; align-items: center; gap: 0.35rem; }
.vignette { display: inline-flex; width: 42px; height: 56px; border: 1px solid var(--border); border-radius: 4px; overflow: hidden; background: #f8f9fb; flex: none; }
.vignette img { width: 100%; height: 100%; object-fit: cover; object-position: top; display: block; }
.vignette:hover, .vignette:focus-visible { border-color: var(--accent); box-shadow: 0 0 0 2px var(--accent-pale); }
.vignette-ko::after { content: attr(data-ext); margin: auto; font-size: 0.65rem; color: var(--muted); font-weight: 600; }
.vignette-plus { font-size: 0.8rem; color: var(--muted); }
.vignette-zoom { position: fixed; z-index: 50; pointer-events: none; opacity: 0; transform: scale(0.96); transition: opacity .12s, transform .12s;
  background: #fff; border: 1px solid var(--border); border-radius: 6px; box-shadow: 0 12px 32px rgba(20,33,61,0.25); overflow: hidden; }
.vignette-zoom.visible { opacity: 1; transform: none; }
.vignette-zoom img { display: block; width: 100%; height: auto; }

/* --- Boutons existants harmonisés --- */
.client-search input { border-radius: 10px; padding: 0.7rem 0.9rem; }
.client-search button, .login-card button, .drop-card button, .new-user-form button,
.valider-carte button, .fiche-actions button { border-radius: 8px; min-height: 42px; font-weight: 600; }
.folder-entry { border-radius: 10px; padding: 0.75rem 0.95rem; }
.folder-entry:hover { border-color: #c4cde0; }
.drop-card, .tile, .login-card, .new-user-form, .permissions-fieldset { border-radius: var(--rayon); }
.liens-secondaires { margin: 0.4rem 0 0; font-size: 0.9rem; }
@media (max-width: 640px) {
  .topbar-int { padding: 0 1rem; }
  .content { padding: 1.4rem 1rem 3rem; }
  .fiche-boutons { width: 100%; }
}

/* E-mail sur toute la largeur, sous son intitulé */
.fiche-dl .pleine { grid-column: 1 / -1; }
.fiche-dl dd.pleine { margin-top: -0.35rem; }
/* Listes de fichiers : vignette devant le nom */
.folder-entry-name .vignette { width: 34px; height: 44px; margin-right: 0.35rem; }
.folder-entry-name .nom-fichier { color: var(--text); text-decoration: none; overflow: hidden; text-overflow: ellipsis; }
.folder-entry-name .nom-fichier:hover { color: var(--accent); text-decoration: underline; }
.folder-entry-meta .vignette { width: 34px; height: 44px; }

/* Bandeau sur une seule ligne sur un écran d'ordinateur */
.topbar nav a, .topbar .nav-menu summary { white-space: nowrap; }
.user-box { gap: 0.25rem; }
@media (min-width: 1180px) {
  .topbar-int { flex-wrap: nowrap; gap: 1.25rem; }
  .topbar nav { flex-wrap: nowrap; gap: 0.1rem; }
  .topbar nav a, .topbar .nav-menu summary { font-size: clamp(0.82rem, 0.95vw, 0.92rem); padding: 0.55rem clamp(0.45rem, 0.8vw, 0.75rem); }
}
.user-box .deconnexion { display: inline-flex; align-items: center; gap: 0.4rem; padding: 0.55rem 0.6rem; border-radius: 8px; white-space: nowrap; font-size: clamp(0.82rem, 0.95vw, 0.92rem); }
.user-box .deconnexion:hover { background: rgba(255,255,255,0.08); text-decoration: none; }
@media (min-width: 1180px) {
  .topbar-int { gap: clamp(0.5rem, 1.2vw, 1.25rem); padding: 0 clamp(0.75rem, 1.6vw, 1.5rem); }
  .topbar nav a, .topbar .nav-menu summary { font-size: clamp(0.78rem, 0.9vw, 0.92rem); padding: 0.55rem clamp(0.35rem, 0.65vw, 0.75rem); }
  .brand-logo { width: 32px; height: 32px; }
}
/* Écran plus étroit : nom + boutons sur la 1re ligne, menu sur la 2e */
@media (max-width: 1179px) {
  .topbar-int { padding-bottom: 0.4rem; }
  .user-box { order: 2; }
  .topbar nav { order: 3; flex-basis: 100%; }
}

/* Fiche : informations à vérifier, pièce expirée */
.badge-danger { background: #fdecea; color: #a1261b; border: 1px solid #f5c2bd; }
.a-verifier { border-color: #f0d58a; background: #fffbef; margin-bottom: 1.5rem; }
.a-verifier ul { margin: 0.4rem 0 0; padding-left: 1.2rem; font-size: 0.9rem; }
.a-verifier li { margin: 0.2rem 0; }
@media (prefers-color-scheme: dark) {
  .a-verifier { background: #2b2412; border-color: #5c4a1a; }
  .badge-danger { background: #3b1715; color: #f3a29b; border-color: #6b2620; }
}

/* À traiter */
.actions-ligne { white-space: nowrap; }
.actions-ligne .btn, .form-ligne .btn { min-height: 36px; padding: 0 0.8rem; }
.form-ligne { display: inline-flex; gap: 0.4rem; align-items: center; margin: 0 0 0 0.3rem; }
.champ-court { width: 9.5rem; padding: 0.45rem 0.6rem; border: 1px solid var(--border); border-radius: 8px; font: inherit; background: var(--surface); color: var(--text); }
.folder-entry[hidden] { display: none; }
/* Fiche : pièces du dossier */
.pastille-verte { background: #e3f4ea; color: #1d6b3f; }
.liste-pieces { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 0.5rem; font-size: 0.9rem; }
.liste-pieces li { display: flex; gap: 0.6rem; align-items: baseline; }
.liste-pieces .puce { width: 1.3rem; height: 1.3rem; flex: none; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center; font-size: 0.75rem; font-weight: 700; }
.liste-pieces .ok .puce { background: #e3f4ea; color: #1d6b3f; }
.liste-pieces .manque .puce { background: #fff1de; color: #8a4b00; }

/* Recherche dans le bandeau */
.recherche-menu summary.compte-ico { color: #d5dceb; padding: 0; }
.recherche-menu summary.compte-ico::after { content: none; }
.recherche-menu .recherche-pop { left: auto; right: 0; flex-direction: row; gap: 0.4rem; padding: 0.5rem; min-width: 320px; }
.recherche-pop input { flex: 1; min-width: 0; padding: 0.55rem 0.7rem; border: 1px solid var(--border); border-radius: 8px; font: inherit; background: var(--surface); color: var(--text); }
.recherche-pop .btn { min-height: 38px; }

/* Filtre par intermédiaire */
.choix-inter { display: flex; flex-wrap: wrap; align-items: center; gap: 0.5rem; margin: 0 0 1rem; font-size: 0.9rem; }
.choix-inter label { color: var(--muted); }
.choix-inter select { padding: 0.5rem 0.6rem; border: 1px solid var(--border); border-radius: 8px; font: inherit; background: var(--surface); color: var(--text); max-width: 100%; }
.filtre-inter { background: #fff1de; color: #6b3a00; border-bottom: 1px solid #f0d58a; padding: 0.55rem 1.5rem; display: flex; flex-wrap: wrap; gap: 0.4rem 1rem; justify-content: center; font-size: 0.9rem; }
.filtre-inter a { color: #6b3a00; font-weight: 600; }
@media (prefers-color-scheme: dark) { .filtre-inter { background: #3a2b12; color: #f3c27a; border-color: #5c4a1a; } .filtre-inter a { color: #f3c27a; } }
.sans-inter { margin-top: 1.2rem; }
.sans-inter summary { cursor: pointer; color: var(--muted); margin-bottom: 0.6rem; }

/* Loupe du bandeau : alignée sur les autres icônes */
.user-box .recherche-menu { display: inline-flex; align-items: center; }
.user-box .recherche-menu summary.compte-ico { display: inline-flex; align-items: center; justify-content: center; width: 36px; height: 36px; padding: 0; }

/* ===================== Téléphone et tablette (l'affichage sur ordinateur ne change pas) ===================== */
.menu-bouton { display: none; }
.btn-photo { display: none; }
@media (hover: none) and (pointer: coarse) {
  .btn-photo { display: inline-flex; width: 100%; margin-top: 0.7rem; min-height: 48px; }
}
@media (max-width: 760px) {
  .topbar-int { gap: 0.3rem 0.4rem; padding: 0 0.6rem; }
  .brand-box { gap: 0.5rem; min-width: 0; flex: 1 1 0; }
  .brand-texte { min-width: 0; }
  .topbar .brand-user { overflow: hidden; text-overflow: ellipsis; }
  .user-box { gap: 0; }
  .menu-bouton { display: inline-flex; order: 2; align-items: center; justify-content: center; width: 44px; height: 44px;
    background: none; border: 1px solid rgba(255,255,255,0.25); border-radius: 8px; color: #fff; cursor: pointer; }
  .user-box { order: 1; margin-left: 0; }
  .user-box .deconnexion span { display: none; }
  .topbar nav { display: none; order: 3; flex-basis: 100%; flex-direction: column; align-items: stretch; gap: 0; padding-bottom: 0.6rem; }
  .topbar.menu-ouvert nav { display: flex; }
  .topbar nav a, .topbar .nav-menu summary { font-size: 1rem; padding: 0.8rem 0.75rem; }
  .topbar .nav-menu-liste { position: static; box-shadow: none; margin: 0 0 0.4rem 0.8rem; }
  .user-box .recherche-pop { position: fixed; left: 0.5rem; right: 0.5rem; top: 64px; min-width: 0; }
  .filtre-inter { padding: 0.55rem 1rem; }
  .btn, .client-search button, .fiche-actions button, .valider-carte button { min-height: 46px; }
  .link-btn { padding: 0.45rem 0; display: inline-block; }
  .folder-entry { flex-wrap: wrap; }
  .folder-entry-meta { flex-wrap: wrap; gap: 0.6rem 1rem; }
  .fiche-boutons .btn, .fiche-boutons .menu-actions { flex: 1 1 auto; }
  .menu-actions-liste { left: 0; right: auto; }
  .onglets { overflow-x: auto; flex-wrap: nowrap; }
  .onglets a { white-space: nowrap; }
  .choix-inter select { width: 100%; }
  h1 { font-size: 1.45rem; }
}
/* Tableaux en cartes empilées sur téléphone */
@media (max-width: 640px) {
  .table-boite { overflow: visible; }
  .tableau, .users-table { min-width: 0 !important; border-collapse: collapse; }
  .tableau thead, .users-table tr:has(> th) { display: none; }
  .tableau tbody, .tableau tr, .tableau td, .users-table tbody, .users-table tr, .users-table td { display: block; width: 100%; box-sizing: border-box; }
  .tableau tr, .users-table tr { padding: 0.7rem 1rem; border-top: 1px solid var(--border-doux); }
  .tableau td, .users-table td { border: none; padding: 0.2rem 0 0.2rem 7.8rem; position: relative; min-height: 1.4rem; }
  .tableau td[data-label]::before, .users-table td[data-label]::before { content: attr(data-label); position: absolute; left: 0; top: 0.3rem; width: 7.2rem; color: var(--muted); font-size: 0.78rem; }
  .tableau td[data-label=""], .users-table td[data-label=""], .tableau td:not([data-label]), .users-table td:not([data-label]) { padding-left: 0; }
  .tableau td[data-label=""]::before, .users-table td[data-label=""]::before { content: none; }
  .ligne-docs td { padding-left: 0; }
  .actions-ligne { white-space: normal; flex-wrap: wrap; }
  .form-ligne { margin: 0.3rem 0 0; flex-wrap: wrap; }
  .carte:not(.carte-table) .tableau tr { padding-left: 0; padding-right: 0; }
}

/* Rattacher un contrat à un intermédiaire */
.modif-inter { margin-top: 0.3rem; font-size: 0.85rem; }
.modif-inter summary { cursor: pointer; color: var(--accent); list-style: none; }
.modif-inter summary::-webkit-details-marker { display: none; }
.modif-inter form { display: flex; flex-direction: column; gap: 0.4rem; margin-top: 0.4rem; min-width: 14rem; }
.modif-inter select, .modif-inter input { padding: 0.4rem 0.5rem; border: 1px solid var(--border); border-radius: 6px; font: inherit; background: var(--surface); color: var(--text); }
.modif-inter .inter-autre { display: flex; flex-direction: column; gap: 0.4rem; }
.modif-inter .inter-autre[hidden] { display: none; }
.modif-inter .btn { min-height: 34px; align-self: flex-start; }

/* Fiche client : documents indexés (type modifiable, actions) */
.doc-type { display: inline; margin: 0; }
.doc-type select { font: inherit; font-weight: 600; width: auto; max-width: 11.5rem; padding: 0.15rem 0.3rem; }
.doc-date { white-space: nowrap; }
.doc-a-confirmer { background: rgba(240, 213, 138, 0.18); }
.doc-actions { white-space: nowrap; }
.doc-actions form { display: inline; margin: 0; }

/* Fiche client : liens entre fiches */
.liste-liens { list-style: none; margin: 0; padding: 0; }
.liste-liens li { display: flex; flex-wrap: wrap; align-items: baseline; gap: 0.35rem 0.5rem; padding: 0.45rem 0; border-bottom: 1px solid var(--border); }
.liste-liens li:last-child { border-bottom: none; }
.lien-role { font-size: 0.78rem; color: var(--muted, #6b7280); min-width: 7.5rem; }
.lien-fiche { font-weight: 600; }
.lien-note { flex-basis: 100%; padding-left: 8rem; font-size: 0.8rem; }
.lien-suppr { margin: 0 0 0 auto; }
#dlg-lien label { display: block; margin: 0.7rem 0 0.25rem; font-weight: 600; font-size: 0.9rem; }
#dlg-lien input[type=search], #dlg-lien input[type=text], #dlg-lien select { width: 100%; box-sizing: border-box; font: inherit; padding: 0.4rem 0.5rem; }
.lien-suggestions { list-style: none; margin: 0.25rem 0 0; padding: 0; max-height: 14rem; overflow: auto; }
.lien-suggestions button { width: 100%; text-align: left; background: none; border: none; border-bottom: 1px solid var(--border); padding: 0.4rem 0.3rem; cursor: pointer; font: inherit; color: inherit; }
.lien-suggestions button:hover, .lien-suggestions button:focus { background: rgba(37, 99, 235, 0.08); }
.lien-choisi { margin: 0.4rem 0 0; font-weight: 600; color: var(--accent); }
@media (max-width: 600px) { .lien-note { padding-left: 0; } .lien-role { min-width: 0; } }

/* Onglet « Contrôles » de la page À traiter */
#controles h3 { font-size: 0.98rem; font-weight: 600; margin: 1.6rem 0 0.3rem; display: flex; align-items: center; gap: 0.5rem; }
#controles h3:first-of-type { margin-top: 0.4rem; }
#controles h3 .compte { font-size: 0.78rem; font-weight: 500; border-radius: 999px; padding: 0.05rem 0.5rem; background: #fff4d6; color: #8a5a00; }
#controles h3 .compte-gris { background: var(--border-doux); color: var(--muted); }
@media (prefers-color-scheme: dark) { #controles h3 .compte:not(.compte-gris) { background: #3a2f12; color: #f3cf6d; } }

/* Fiche : bouton « Valider » du changement de type d'un document */
.doc-type .doc-type-valider { margin-left: 0.4rem; padding: 0.15rem 0.6rem; font-size: 0.85rem; vertical-align: middle; }
.doc-type .doc-type-valider[hidden] { display: none; }

.doc-modif { font-weight: 400; }
.doc-modif .hint { font-size: 0.8rem; }
.champ-fiche { width: 16rem; padding: 0.45rem 0.6rem; border: 1px solid var(--border); border-radius: 8px; font: inherit; background: var(--surface); color: var(--text); }

/* Fiches clients : actions à réaliser, en boutons côte à côte */
.actions-fiches { display: flex; flex-wrap: wrap; gap: 0.6rem; margin: 0.4rem 0 1rem; }
.actions-fiches .btn-action { font-weight: 600; text-decoration: none; background: var(--surface); }
.actions-fiches .btn-action .pastille { margin-left: 0.2rem; }
.actions-fiches .pastille[hidden] { display: none; }

/* --- Dépôt de documents depuis la fiche client (bandeau) --- */
.fiche-tete .depot-fiche { flex: 1 1 100%; background: none; border: 0; border-top: 1px solid var(--border); border-radius: 0; padding: 0.9rem 0 0; }
.depot-fiche-titre { margin: 0 0 0.6rem; font-size: 0.9rem; font-weight: 600; }
.depot-fiche-titre .hint { font-weight: 400; }
.depot-mini-grille { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 0.6rem; }
.dropzone.depot-mini { display: flex; align-items: center; gap: 0.6rem; min-height: 0; padding: 0.6rem 0.8rem; text-align: left; cursor: pointer; }
.depot-mini svg { flex: none; color: var(--accent); }
.depot-mini-texte { display: flex; flex-direction: column; line-height: 1.25; }
.depot-mini-texte strong { font-size: 0.88rem; color: var(--text); }
.depot-mini-texte span { font-size: 0.76rem; }
.dropzone.depot-mini:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.depot-fiche .file-list { margin-top: 0.6rem; }
.depot-fiche .file-list:empty { display: none; }

/* --- Messages après une action sur la fiche --- */
.message-fiche { margin: -0.6rem 0 1.2rem; }
tr.doc-cible > td { background: #f2f7ff; }
.bulle-doc { position: relative; display: flex; align-items: flex-start; gap: 0.5rem; margin-top: 0.55rem; max-width: 34rem;
  padding: 0.45rem 0.6rem; border-radius: 8px; font-size: 0.84rem; line-height: 1.35; white-space: normal; }
.bulle-doc::before { content: ""; position: absolute; top: -6px; left: 14px; width: 10px; height: 10px; transform: rotate(45deg);
  background: inherit; border-left: 1px solid; border-top: 1px solid; border-color: inherit; }
.bulle-ok { background: #e6f6ea; color: #1d6b34; border: 1px solid #b6e2c2; }
.bulle-erreur { background: #fdecec; color: #a12a2a; border: 1px solid #f2c0c0; }
.bulle-doc span { flex: 1; overflow-wrap: anywhere; }
.bulle-fermer { background: none; border: 0; color: inherit; font-size: 1.1rem; line-height: 1; cursor: pointer; padding: 0 0.1rem; opacity: 0.7; }
.bulle-fermer:hover { opacity: 1; }
@media (prefers-color-scheme: dark) {
  tr.doc-cible > td { background: #1b2540; }
  .bulle-ok { background: #13321d; color: #8fdca6; border-color: #22553a; }
  .bulle-erreur { background: #3a1717; color: #f3a5a5; border-color: #5e2626; }
}

/* --- Indexer des fichiers déjà présents dans le dossier du client --- */
.onglets { align-items: center; }
.onglets-action { margin-left: auto; background: none; border: 1px solid var(--border); border-radius: 999px; padding: 0.35rem 0.8rem;
  font: inherit; font-size: 0.85rem; color: var(--accent); cursor: pointer; white-space: nowrap; }
.onglets-action:hover { border-color: var(--accent); background: var(--accent-pale); }
.dlg-dossier { width: min(760px, 94vw); }
.dossier-liste { max-height: 55vh; overflow: auto; margin: 0.6rem 0 1rem; }
.dossier-liste ul { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 0.35rem; }
.dossier-liste li { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 0.3rem 1rem; padding: 0.5rem 0.65rem; border: 1px solid var(--border); border-radius: 8px; }
.dossier-liste label { display: flex; align-items: center; gap: 0.5rem; cursor: pointer; font-size: 0.9rem; overflow-wrap: anywhere; }
.dossier-liste input { width: 1.05rem; height: 1.05rem; flex: none; }
.dossier-etat { font-size: 0.82rem; }
.dossier-etat.status-ok { color: var(--success); }
.dossier-etat.status-erreur { color: var(--error); }
.dlg-dossier .fiche-actions { display: flex; align-items: center; gap: 1rem; }
.dlg-dossier .fiche-actions button:disabled { opacity: 0.5; cursor: default; }
.dlg-dossier .fiche-actions .link-btn { background: none; color: var(--accent); padding: 0; }

/* v2 : bouton juste après « Documents », miniatures dans la liste */
.onglets-action { margin-left: 0.4rem; }
.dossier-liste li { flex-wrap: nowrap; align-items: center; justify-content: flex-start; gap: 0.75rem; }
.dossier-corps { flex: 1; display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 0.3rem 1rem; min-width: 0; }

/* --- Résiliation des contrats --- */
.menu-resilier { margin-top: 0.3rem; }
.menu-resilier summary { color: var(--error); }
.form-resilier { display: flex; flex-direction: column; gap: 0.45rem; margin-top: 0.45rem; min-width: 15rem; }
.form-resilier label { display: flex; flex-direction: column; gap: 0.2rem; font-size: 0.82rem; color: var(--muted); }
.form-resilier input { padding: 0.4rem 0.5rem; border: 1px solid var(--border); border-radius: 6px; font: inherit; background: var(--surface); color: var(--text); }
.badge-resilie { background: #fdecec; color: #a12a2a; border: 1px solid #f2c0c0; }
.annuler-resiliation { margin-top: 0.3rem; }
.lien-discret { font-size: 0.82rem; font-weight: 400; margin-left: 0.8rem; color: var(--accent); }
@media (prefers-color-scheme: dark) { .badge-resilie { background: #3a1717; color: #f3a5a5; border-color: #5e2626; } }
.filtres-resilies { display: flex; flex-wrap: wrap; gap: 0.6rem; align-items: flex-end; margin: 1rem 0; }
.filtres-resilies label { display: flex; flex-direction: column; gap: 0.2rem; font-size: 0.8rem; color: var(--muted); }
.filtres-resilies input, .filtres-resilies select { padding: 0.45rem 0.55rem; border: 1px solid var(--border); border-radius: 8px; font: inherit; background: var(--surface); color: var(--text); }
.filtres-resilies input[type=search] { min-width: 16rem; }

.form-resilier-boutons { display: flex; align-items: center; gap: 0.8rem; flex-wrap: wrap; }
.form-resilier .link-btn { font-size: 0.85rem; }
.menu-remettre { margin-top: 0.35rem; }
.menu-remettre summary { color: var(--success); font-size: 0.85rem; }
.annuler-resiliation .link-btn { font-size: 0.78rem; color: var(--muted); }
.historique-contrat { font-size: 0.76rem; color: var(--muted); }
