/* ============================================================
   Vision365 — couche d'apparence
   ============================================================
   Une seule feuille pour toutes les pages : elle donne au programme le
   langage visuel du CRM Scheidegger, dans l'esprit des interfaces Apple :
   coins arrondis, ombres douces, typographie Inter en graisses moyennes,
   or de la marque reserve aux accents.

   Elle se charge APRES le <style> de chaque page et gagne donc par ordre
   de cascade, sans qu'il faille toucher aux regles historiques. Les
   variables de couleur, elles, restent definies dans les pages : elles
   portent le theme clair/sombre et la couleur d'accent personnalisee.

   Aucune regle n'est copiee du CRM : c'est le meme vocabulaire visuel,
   ecrit pour ce depot. Les deux applications restent independantes.
   ============================================================ */

:root {
  /* Rayons : l'echelle Apple, du bouton a la boite de dialogue. */
  --r-xs: 6px;
  --r-sm: 8px;
  --r: 12px;
  --r-lg: 18px;
  --r-pill: 999px;

  /* Ombres : jamais plus d'un leger decollement du fond. */
  --o-sm: 0 1px 2px rgba(0, 0, 0, 0.04), 0 1px 3px rgba(0, 0, 0, 0.06);
  --o: 0 2px 8px rgba(0, 0, 0, 0.04), 0 4px 16px rgba(0, 0, 0, 0.06);
  --o-lg: 0 8px 30px rgba(0, 0, 0, 0.12);
  --o-survol: 0 4px 16px rgba(0, 0, 0, 0.08), 0 8px 32px rgba(0, 0, 0, 0.08);

  --t: 180ms cubic-bezier(0.4, 0, 0.2, 1);
}

[data-theme="dark"] {
  --o-sm: 0 1px 2px rgba(0, 0, 0, 0.3);
  --o: 0 2px 8px rgba(0, 0, 0, 0.4);
  --o-lg: 0 8px 30px rgba(0, 0, 0, 0.6);
  --o-survol: 0 4px 20px rgba(0, 0, 0, 0.5);
}

/* ---------- Palette ----------
   Definie ici pour toutes les pages : quatre d'entre elles n'avaient aucune
   variable et se retrouvaient sans couleur des que la couche d'apparence
   s'appliquait. Les pages qui declarent encore leur propre :root sont
   surchargees par celui-ci, ce qui met enfin tout le programme d'accord.
   Seule exception : la couleur d'accent choisie par l'utilisateur, injectee
   apres cette feuille par app.php. */

:root {
  --bg: #ffffff;
  --bg-soft: #f5f5f7;
  --bg-card: #ffffff;
  --bg-survol: #f0f0f3;
  --ink: #1d1d1f;
  --ink-soft: #6e6e73;
  --ink-mute: #8e8e93;
  --line: #e5e5ea;
  --line-forte: #d1d1d6;
  --accent: #b8975a;
  --accent-fonce: #9a7c42;
  --accent-soft: #d4b878;
  --accent-pale: #f6f1e7;
  --accent-doux: rgba(184, 151, 90, 0.12);
  --positive: #2a8a4f;
  --positive-pale: #e8f5ec;
  --negative: #d0402e;
  --negative-pale: #fdecea;
  --warning: #b87a2c;
  --highlight: #f6f1e7;
  --m-color: #2b6cb0; --m-soft: #e8f0f8;
  --f-color: #b0446e; --f-soft: #fae9f0;
}

[data-theme="dark"] {
  --bg: #161618;
  --bg-soft: #242426;
  --bg-card: #1c1c1e;
  --bg-survol: #2c2c2e;
  --ink: #f5f5f7;
  --ink-soft: #98989d;
  --ink-mute: #6e6e73;
  --line: #38383a;
  --line-forte: #48484a;
  --accent: #d4b072;
  --accent-fonce: #c19d5f;
  --accent-soft: #b8975a;
  --accent-pale: #2a2519;
  --accent-doux: rgba(212, 176, 114, 0.16);
  --positive: #4fd07a;
  --positive-pale: #10240f;
  --negative: #ff6b5e;
  --negative-pale: #3a1512;
  --warning: #d9a441;
  --highlight: #2a2519;
  --m-color: #6fa8dc; --m-soft: #16283a;
  --f-color: #e08aad; --f-soft: #351926;
}

body { background: var(--bg); color: var(--ink); }
/* ---------- Typographie ---------- */

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  font-weight: 400;
  line-height: 1.5;
  letter-spacing: -0.011em;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

h1, h2, h3, h4, h5 {
  font-family: inherit;
  letter-spacing: -0.02em;
  color: var(--ink);
}
h1 { font-size: 1.75rem; font-weight: 700; line-height: 1.2; }

/* Le titre de section n'est plus une etiquette en capitales : c'est un vrai
   titre, comme dans le CRM. La respiration vient de la marge, plus du filet. */
h2 {
  font-size: 1.2rem;
  font-weight: 600;
  text-transform: none;
  letter-spacing: -0.02em;
  color: var(--ink);
  border-bottom: none;
  padding-bottom: 0;
  margin: 2.5rem 0 0.9rem;
}
section:first-of-type > h2, .card > h2:first-child { margin-top: 0; }

h3 { font-size: 1.05rem; font-weight: 600; margin: 1.5rem 0 0.6rem; }

h4.sub-block-title {
  font-size: 0.95rem;
  font-weight: 600;
  text-transform: none;
  letter-spacing: -0.01em;
  color: var(--ink);
  margin: 1.5rem 0 0.75rem;
  padding-bottom: 0.5rem;
  border-bottom: 1px solid var(--line);
}
h4.sub-block-title:first-of-type { margin-top: 0; }

.help {
  font-size: 0.8rem;
  font-style: normal;
  color: var(--ink-mute);
  line-height: 1.45;
}

/* ---------- Surfaces ---------- */

.card,
.person-card,
.chart-container,
.chart-full,
.dossiers-list,
.scenarios-table,
.box {
  background: var(--bg-card);
  border: 1px solid var(--line);
  border-radius: var(--r);
  box-shadow: var(--o-sm);
}

.card { padding: 1.5rem; margin-bottom: 1.25rem; }
.person-card { padding: 1.5rem; }
.chart-container, .chart-full { padding: 1.25rem; }
.dossiers-list, .scenarios-table { overflow: hidden; }

/* Le liseré de couleur qui distingue Monsieur de Madame suit l'arrondi. */
.person-card.m-card { border-top: 3px solid var(--m-color); }
.person-card.f-card { border-top: 3px solid var(--f-color); }

/* ---------- Champs ---------- */

label {
  display: block;
  font-size: 0.82rem;
  font-weight: 550;
  text-transform: none;
  letter-spacing: 0;
  color: var(--ink-soft);
  margin-bottom: 0.35rem;
}

input[type="text"], input[type="email"], input[type="password"], input[type="number"],
input[type="date"], input[type="search"], input[type="tel"], input[type="url"],
select, textarea {
  padding: 0.6rem 0.8rem;
  font-size: 0.9rem;
  font-weight: 400;
  border: 1px solid var(--line-forte);
  border-radius: var(--r-sm);
  background: var(--bg-card);
  color: var(--ink);
  transition: border-color var(--t), box-shadow var(--t);
  -webkit-appearance: none;
  appearance: none;
}
input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-doux);
}
input::placeholder, textarea::placeholder { color: var(--ink-mute); }
textarea { min-height: 72px; resize: vertical; border-radius: var(--r-sm); }

/* Chevron dessine, pour que le select ait la meme allure sur tous les systemes. */
select {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%238e8e93' stroke-width='2'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 0.7rem center;
  padding-right: 2rem;
}

input[type="checkbox"], input[type="radio"] { width: auto; -webkit-appearance: auto; appearance: auto; }

input.calculated { background: var(--bg-soft); color: var(--ink-soft); border-color: var(--line); }
input.ai-filled { background: var(--bg-card); border-left: 3px solid var(--positive); }
input.ai-uncertain { background: var(--bg-card); border-left: 3px solid var(--warning); }

/* ---------- Boutons ---------- */

.btn, button.btn, a.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.45rem;
  padding: 0.6rem 1.1rem;
  border-radius: var(--r-sm);
  font-family: inherit;
  font-size: 0.9rem;
  font-weight: 550;
  letter-spacing: 0;
  text-transform: none;
  cursor: pointer;
  white-space: nowrap;
  transition: background var(--t), border-color var(--t), color var(--t), box-shadow var(--t), transform var(--t);
}

/* Action principale : l'or de la marque, comme dans le CRM. */
.btn, .btn-plein {
  background: var(--accent);
  border: 1px solid var(--accent);
  color: #fff;
  box-shadow: var(--o-sm);
}
.btn:hover, .btn-plein:hover {
  background: var(--accent-fonce);
  border-color: var(--accent-fonce);
  color: #fff;
  box-shadow: var(--o);
}
.btn:active, .btn-plein:active { transform: translateY(1px); box-shadow: var(--o-sm); }

/* Actions secondaires : contour neutre. */
.btn-secondary, button.btn-secondary {
  background: var(--bg-card);
  border: 1px solid var(--line-forte);
  color: var(--ink);
  box-shadow: none;
  border-radius: var(--r-sm);
  font-weight: 550;
  text-transform: none;
  letter-spacing: 0;
}
.btn-secondary:hover, button.btn-secondary:hover {
  background: var(--bg-survol);
  border-color: var(--ink-mute);
  color: var(--ink);
}

.btn-danger, button.btn-danger {
  background: transparent;
  border: 1px solid var(--negative);
  color: var(--negative);
  box-shadow: none;
}
.btn-danger:hover { background: var(--negative); border-color: var(--negative); color: #fff; }

.btn-small, .btn-sm { padding: 0.38rem 0.8rem; font-size: 0.82rem; }

.btn:disabled, button:disabled {
  background: var(--bg-soft);
  border-color: var(--line);
  color: var(--ink-mute);
  cursor: not-allowed;
  box-shadow: none;
  transform: none;
}

.actions { display: flex; gap: 0.65rem; margin: 1.75rem 0; flex-wrap: wrap; align-items: center; }

/* ---------- Sélecteur de situation : commande segmentée ---------- */

.situation-selector {
  display: flex;
  gap: 4px;
  padding: 4px;
  background: var(--bg-soft);
  border: 1px solid var(--line);
  border-radius: var(--r);
  overflow: visible;
}
.situation-selector label {
  flex: 1;
  padding: 0.65rem 0.75rem;
  border: none;
  border-radius: var(--r-sm);
  background: transparent;
  color: var(--ink-soft);
  font-size: 0.88rem;
  font-weight: 500;
  text-align: center;
  cursor: pointer;
  transition: background var(--t), color var(--t), box-shadow var(--t);
}
.situation-selector label:hover { color: var(--ink); }
.situation-selector label:has(input:checked) {
  background: var(--bg-card);
  color: var(--ink);
  font-weight: 600;
  box-shadow: var(--o-sm);
}
.situation-selector label:has(input:checked) .sit-icon { color: var(--accent); }

/* ---------- Barre supérieure ---------- */

.topbar {
  background: color-mix(in srgb, var(--bg-card) 80%, transparent);
  -webkit-backdrop-filter: saturate(180%) blur(20px);
  backdrop-filter: saturate(180%) blur(20px);
  border-bottom: 1px solid var(--line);
  padding: 0.8rem 2rem;
}
.topbar-nav a {
  text-transform: none;
  letter-spacing: 0;
  font-size: 0.9rem;
  font-weight: 500;
  padding: 0.35rem 0.7rem;
  border-radius: var(--r-sm);
  border-bottom: none;
  transition: background var(--t), color var(--t);
}
.topbar-nav a:hover { background: var(--bg-survol); color: var(--ink); border-bottom: none; }
.topbar-nav a.active {
  background: var(--accent-doux);
  color: var(--accent-fonce);
  font-weight: 600;
  border-bottom: none;
}

/* ---------- Chiffres clés ---------- */

.summary-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1rem;
  border: none;
  margin-bottom: 1.75rem;
}
.summary-cell {
  background: var(--bg-card);
  border: 1px solid var(--line);
  border-radius: var(--r);
  box-shadow: var(--o-sm);
  padding: 1.35rem 1.4rem;
  text-align: left;
  transition: transform var(--t), box-shadow var(--t), border-color var(--t);
}
.summary-cell:hover { transform: translateY(-2px); box-shadow: var(--o-survol); border-color: var(--line-forte); }
.summary-cell .label {
  font-size: 0.85rem;
  font-weight: 500;
  text-transform: none;
  letter-spacing: 0;
  color: var(--ink-soft);
  margin-bottom: 0.35rem;
}
.summary-cell .value { font-size: 2rem; font-weight: 700; letter-spacing: -0.03em; line-height: 1.05; }
.summary-cell .sub { font-size: 0.82rem; color: var(--ink-mute); margin-top: 0.4rem; }

/* ---------- Tableaux ---------- */

table { font-size: 0.9rem; }
th {
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  color: var(--ink-mute);
  padding: 0.6rem 0.85rem;
}
td { padding: 0.7rem 0.85rem; }
tr.total { border-top: 1px solid var(--line-forte); font-weight: 600; }
tr.total td { border-bottom: none; }

/* ---------- Encarts ---------- */

.lacune-box, .recommendation, .ai-status, .alert, .flash, .info, .err {
  border-radius: var(--r);
}
.lacune-box {
  padding: 1rem 1.15rem;
  border-left: 3px solid var(--accent);
  font-size: 0.9rem;
  line-height: 1.55;
}
.recommendation {
  padding: 1.1rem 1.25rem;
  background: var(--bg-card);
  border: 1px solid var(--line);
  border-left: 3px solid var(--accent);
  box-shadow: var(--o-sm);
}
.recommendation .rec-title {
  font-style: normal;
  font-weight: 600;
  font-size: 0.98rem;
  color: var(--ink);
  letter-spacing: -0.01em;
  margin-bottom: 0.35rem;
}
.recommendation .rec-title::before {
  content: '';
  display: inline-block;
  width: 6px; height: 6px;
  border-radius: 50%;
  background: var(--accent);
  margin-right: 0.5rem;
  vertical-align: 0.15em;
}

/* ---------- Pastilles ---------- */

.person-badge, .badge, .id-badge, .pastille {
  border-radius: var(--r-pill);
  padding: 0.2rem 0.65rem;
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: none;
  letter-spacing: 0;
  display: inline-flex;
  align-items: center;
}
.person-badge.m { background: var(--m-soft); color: var(--m-color); }
.person-badge.f { background: var(--f-soft); color: var(--f-color); }

/* ---------- Listes de dossiers ---------- */

.dossier-row { padding: 1rem 1.35rem; transition: background var(--t); }
.dossier-nom { font-size: 1.05rem; font-weight: 600; letter-spacing: -0.01em; }
.dossier-meta { font-size: 0.82rem; }

/* ---------- Scénarios de risque ---------- */

.scenario-header {
  text-transform: uppercase;
  letter-spacing: 0.03em;
  font-size: 0.75rem;
  font-weight: 600;
  padding: 0.65rem 1.35rem;
}
.scenario-summary { padding: 1rem 1.35rem; }
.scenario-summary .scenario-label { font-size: 1rem; font-weight: 600; letter-spacing: -0.01em; }
.scenario-detail { padding: 0 1.35rem 1.35rem; }
.scenario-detail table { border-radius: var(--r-sm); overflow: hidden; }

/* ---------- Dépôt de fichiers ---------- */

.dropzone {
  border: 1.5px dashed var(--line-forte);
  border-radius: var(--r);
  padding: 1.75rem;
  transition: border-color var(--t), background var(--t);
}
.dropzone:hover, .dropzone.drag-over { border-color: var(--accent); background: var(--accent-doux); }
.dropzone-text { font-style: normal; font-size: 0.95rem; }
.dropzone-hint { text-transform: none; letter-spacing: 0; font-size: 0.8rem; }

/* ---------- Enfants ---------- */

.enfant-row { border-radius: var(--r-sm); border-left: 3px solid var(--accent); }

/* ---------- Notifications ---------- */

.toast { border-radius: var(--r); box-shadow: var(--o-lg); }

/* ---------- Pages d'authentification ---------- */

.box {
  border-radius: var(--r-lg);
  box-shadow: var(--o);
  padding: 2.5rem 2rem;
}

/* ---------- Pied de page ---------- */

.footer-note { font-style: normal; font-size: 0.78rem; line-height: 1.65; }

/* ---------- Mode présentation ---------- */

[data-presentation="on"] .card,
[data-presentation="on"] .person-card { box-shadow: var(--o); border-radius: var(--r-lg); }

/* ---------- Tablette et mobile ---------- */

@media (max-width: 1024px) {
  .container { padding: 0 1.25rem; }
  .summary-grid { grid-template-columns: repeat(3, 1fr); gap: 0.75rem; }
  .summary-cell { padding: 1.1rem; }
  .summary-cell .value { font-size: 1.7rem; }
  .charts-grid { gap: 1.25rem; }
}

@media (max-width: 820px) {
  .couple-grid { grid-template-columns: 1fr; }
  .summary-grid { grid-template-columns: 1fr 1fr; }
  .charts-grid { grid-template-columns: 1fr; }
  .topbar { padding: 0.7rem 1rem; }
  h2 { font-size: 1.1rem; margin-top: 2rem; }
  .card, .person-card { padding: 1.15rem; }
}

@media (max-width: 560px) {
  .summary-grid { grid-template-columns: 1fr; }
  .situation-selector { flex-wrap: wrap; }
  .situation-selector label { flex: 1 1 45%; }
  .actions .btn, .actions .btn-secondary { flex: 1 1 auto; }
}

/* Sur écran tactile, une cible de moins de 44 points se rate. */
@media (pointer: coarse) {
  .btn, .btn-secondary, .btn-danger { min-height: 44px; }
  .btn-small, .btn-sm { min-height: 36px; }
  input, select, textarea { min-height: 44px; }
  .situation-selector label { min-height: 48px; display: flex; flex-direction: column; align-items: center; justify-content: center; }
}

/* ---------- Corrections de mise en page ---------- */

/* Les fiches Monsieur et Madame alignaient leurs champs sur des rangees de
   88 pixels EXACTEMENT. Une cellule plus haute que ca — la zone de depot du
   certificat, celle de l'extrait CI — debordait et son texte se superposait
   au champ suivant. La rangee garde sa hauteur minimale et grandit au besoin. */
.person-card .form-grid { grid-auto-rows: minmax(88px, auto); align-items: start; }
.person-card .form-grid > div { min-width: 0; }

/* L'en-tete prenait 350 pixels avant le premier champ, soit un ecran entier
   sur un portable. Meme identite, deux fois moins de hauteur. */
header.app-header { padding: 2rem 0 1.5rem; margin-bottom: 2rem; }
.app-logo { height: 52px; margin-bottom: 0.75rem; }
.app-tagline { font-size: 0.7rem; letter-spacing: 0.18em; }
header.app-header h1 { font-size: 1.6rem; margin: 0.35rem 0 0.25rem; }
.app-sub { font-size: 0.85rem; }

/* Zones de depot : moins hautes, elles n'ecrasent plus la saisie. */
.dropzone { padding: 1.1rem; }
.dropzone-icon { font-size: 1.15rem; margin-bottom: 0.25rem; }
.dropzone-text { font-size: 0.88rem; }

/* ---------- Barre d'ancres ---------- */

.ancres {
  position: sticky;
  top: 60px;
  z-index: 50;
  display: flex;
  gap: 0.25rem;
  overflow-x: auto;
  padding: 0.5rem 0.6rem;
  margin: 0 0 1.5rem;
  background: color-mix(in srgb, var(--bg-card) 85%, transparent);
  -webkit-backdrop-filter: saturate(180%) blur(20px);
  backdrop-filter: saturate(180%) blur(20px);
  border: 1px solid var(--line);
  border-radius: var(--r);
  box-shadow: var(--o-sm);
  scrollbar-width: thin;
}
.ancres a {
  flex: 0 0 auto;
  padding: 0.4rem 0.8rem;
  border-radius: var(--r-sm);
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--ink-soft);
  text-decoration: none;
  white-space: nowrap;
  transition: background var(--t), color var(--t);
}
.ancres a:hover { background: var(--bg-survol); color: var(--ink); }
.ancres a.actif { background: var(--accent-doux); color: var(--accent-fonce); font-weight: 600; }

/* ---------- Bandeau des modifications non enregistrées ---------- */

.bandeau-modif {
  position: fixed;
  left: 50%;
  bottom: 1.25rem;
  transform: translateX(-50%);
  z-index: 200;
  display: flex;
  align-items: center;
  gap: 0.85rem;
  padding: 0.6rem 0.7rem 0.6rem 1.1rem;
  background: var(--ink);
  color: var(--bg);
  border-radius: var(--r-pill);
  box-shadow: var(--o-lg);
  font-size: 0.88rem;
  font-weight: 500;
  animation: bandeau-entree 220ms cubic-bezier(0.2, 0.8, 0.2, 1);
}
.bandeau-modif .btn { padding: 0.3rem 0.85rem; font-size: 0.82rem; }
@keyframes bandeau-entree {
  from { opacity: 0; transform: translateX(-50%) translateY(10px); }
  to { opacity: 1; transform: translateX(-50%) translateY(0); }
}

/* ---------- Contrôle de cohérence ---------- */

.lacune-box.danger {
  background: var(--negative-pale);
  border-left-color: var(--negative);
}
.lacune-box ul { margin: 0.5rem 0 0 1.1rem; padding: 0; }
.lacune-box li { margin-bottom: 0.3rem; }

@media (max-width: 820px) {
  .ancres { top: 54px; }
}
/* ---------- Modules masqués par le type d'analyse ---------- */

/* Un dossier ne montre que ce que son type réclame : le reste disparaît de
   la saisie comme des résultats, sans être supprimé. */
.module-off { display: none !important; }

/* ---------- Parcours guidé ---------- */

/* Une étape à la fois. Le formulaire compte plus de cent champs : présentés
   d'un bloc, ils font un mur. Rien n'est supprimé, seulement différé. */
.etape-off { display: none !important; }

.parcours-barre {
  position: sticky;
  top: 58px;
  z-index: 60;
  background: color-mix(in srgb, var(--bg-card) 92%, transparent);
  -webkit-backdrop-filter: saturate(180%) blur(20px);
  backdrop-filter: saturate(180%) blur(20px);
  border: 1px solid var(--line);
  border-radius: var(--r);
  box-shadow: var(--o-sm);
  padding: 0;
  margin-bottom: 1.5rem;
  overflow: hidden;
}
.parcours-jauge { height: 3px; background: var(--bg-soft); }
.parcours-jauge-remplie {
  height: 100%;
  background: var(--accent);
  transition: width 320ms cubic-bezier(0.4, 0, 0.2, 1);
}
.parcours-entete {
  display: flex; align-items: flex-start; justify-content: space-between;
  gap: 1rem; padding: 1rem 1.25rem 0.75rem;
}
.parcours-compteur {
  font-size: 0.75rem; font-weight: 600; text-transform: uppercase;
  letter-spacing: 0.04em; color: var(--accent-fonce); margin-bottom: 0.25rem;
}
.parcours-titre { font-size: 1.35rem; font-weight: 600; margin: 0 0 0.25rem; letter-spacing: -0.02em; }

.parcours-pastilles { display: flex; gap: 0.3rem; padding: 0 1.25rem 1rem; flex-wrap: wrap; }
.parcours-pastille {
  width: 26px; height: 26px; border-radius: 50%;
  border: 1px solid var(--line-forte); background: var(--bg-card);
  color: var(--ink-mute); font-size: 0.75rem; font-weight: 600;
  cursor: pointer; transition: all var(--t); font-family: inherit;
  display: inline-flex; align-items: center; justify-content: center;
}
.parcours-pastille:hover { border-color: var(--accent); color: var(--ink); }
.parcours-pastille.faite { background: var(--accent-doux); border-color: transparent; color: var(--accent-fonce); }
.parcours-pastille.actif { background: var(--accent); border-color: var(--accent); color: #fff; }

.parcours-pied {
  display: flex; align-items: center; gap: 1rem;
  padding: 1rem 0 0; margin-top: 1.5rem;
  border-top: 1px solid var(--line);
}
.parcours-pied .btn { min-width: 130px; }
.parcours-manques {
  flex: 1; font-size: 0.85rem; color: var(--negative);
  opacity: 0; transition: opacity var(--t);
}
.parcours-manques.visible { opacity: 1; }

.champ-manquant {
  border-color: var(--negative) !important;
  box-shadow: 0 0 0 3px rgba(208, 64, 46, 0.12) !important;
}

/* ---------- Choix du type, en cartes ---------- */

.cartes-type {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
  gap: 0.75rem;
}
.carte-type {
  text-align: left; cursor: pointer; font-family: inherit;
  background: var(--bg-card); border: 1px solid var(--line-forte);
  border-radius: var(--r); padding: 1rem 1.1rem;
  transition: all var(--t);
  display: flex; flex-direction: column; gap: 0.35rem;
}
.carte-type:hover { border-color: var(--accent-soft); box-shadow: var(--o-sm); transform: translateY(-1px); }
.carte-type.actif {
  border-color: var(--accent);
  background: var(--accent-doux);
  box-shadow: 0 0 0 1px var(--accent);
}
.carte-type-titre { font-size: 0.98rem; font-weight: 600; color: var(--ink); letter-spacing: -0.01em; }
.carte-type-resume { font-size: 0.82rem; color: var(--ink-soft); line-height: 1.4; }
.carte-type-quand { font-size: 0.78rem; color: var(--ink-mute); font-style: italic; line-height: 1.35; }

@media (max-width: 820px) {
  .parcours-barre { top: 54px; }
  .parcours-entete { flex-direction: column; gap: 0.5rem; }
  .parcours-pied { flex-wrap: wrap; }
  .parcours-pied .btn { flex: 1 1 auto; }
  .parcours-manques { order: 3; flex-basis: 100%; }
}

/* ---------- Questionnaire d'entrée ---------- */

/* Des cases à cocher lisibles à deux, écran tourné vers le client. */
.cartes-choix {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 0.6rem;
  margin-bottom: 1.25rem;
}
.cartes-choix.compact { grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); }

.carte-choix {
  display: flex; align-items: flex-start; gap: 0.7rem;
  text-align: left; cursor: pointer; font-family: inherit;
  background: var(--bg-card); border: 1px solid var(--line-forte);
  border-radius: var(--r); padding: 0.85rem 1rem;
  transition: all var(--t);
}
.carte-choix:hover { border-color: var(--accent-soft); box-shadow: var(--o-sm); }
.carte-choix.actif { border-color: var(--accent); background: var(--accent-doux); }

.carte-choix-coche {
  flex: 0 0 auto; width: 20px; height: 20px; margin-top: 1px;
  border-radius: 6px; border: 1.5px solid var(--line-forte);
  display: inline-flex; align-items: center; justify-content: center;
  font-size: 0.75rem; color: #fff; transition: all var(--t);
}
.carte-choix.actif .carte-choix-coche { background: var(--accent); border-color: var(--accent); }

.carte-choix-titre { display: block; font-size: 0.92rem; font-weight: 550; color: var(--ink); }
.carte-choix-detail { display: block; font-size: 0.8rem; color: var(--ink-soft); line-height: 1.4; margin-top: 0.15rem; }

@media (max-width: 560px) {
  .cartes-choix, .cartes-choix.compact { grid-template-columns: 1fr; }
}

/* ------------------------------------------------------------------
   AJUSTER LES SUJETS TRAITÉS
   Replié par défaut : les combinaisons toutes faites suffisent presque
   toujours, et un écran de départ court se lit mieux qu'un écran complet.
   ------------------------------------------------------------------ */
.modules-ajuster {
  margin: 0 0 1.25rem;
  border: 1px solid var(--line);
  border-radius: var(--r);
  background: var(--bg-soft);
  padding: 0.6rem 1rem;
}
.modules-ajuster > summary {
  cursor: pointer; font-size: 0.88rem; font-weight: 550; color: var(--ink-soft);
  list-style: none; padding: 0.15rem 0;
}
.modules-ajuster > summary::-webkit-details-marker { display: none; }
.modules-ajuster > summary::before { content: '+ '; color: var(--accent); font-weight: 600; }
.modules-ajuster[open] > summary::before { content: '- '; }
.modules-ajuster > summary:hover { color: var(--ink); }
.modules-ajuster .cartes-choix { margin-bottom: 0.5rem; }

/* Une valeur deduite plutot que saisie : l'aide le dit sans crier. */
.help.a-confirmer { color: var(--avert, #8a6100); }

/* Une date refusee se voit, au lieu de disparaitre sans un mot. */
input.date-invalide {
  border-color: var(--danger, #b3261e);
  background: var(--danger-doux, #fdf3f2);
}

/* ------------------------------------------------------------------
   ÉTAT DU DOSSIER
   Une pastille courte, et une barre qui dit ce qui se passe et ce
   qu'il reste à faire. Les couleurs suivent l'urgence : ce qui attend
   le courtier ressort, ce qui est classé s'efface.
   ------------------------------------------------------------------ */
.pastille-etat {
  display: inline-block; vertical-align: middle;
  font-size: 0.72rem; font-weight: 600; letter-spacing: 0.01em;
  padding: 0.15rem 0.55rem; border-radius: 999px; margin-left: 0.4rem;
  background: var(--bg-soft); color: var(--ink-soft); border: 1px solid var(--line);
}
.pastille-etat.etat-envoye_client { background: #eef4fb; color: #2b5d99; border-color: #cfe0f3; }
.pastille-etat.etat-correction_demandee { background: #fdf3e6; color: #8a5200; border-color: #f1ddb8; }
.pastille-etat.etat-valide_client { background: #eaf6ee; color: #1f6b3c; border-color: #c9e7d3; }
.pastille-etat.etat-classe { background: var(--bg-soft); color: var(--ink-mute); }

.barre-etat {
  display: flex; flex-wrap: wrap; align-items: center; gap: 0.6rem 1rem;
  margin: 0 0 1rem; padding: 0.8rem 1rem;
  border: 1px solid var(--line); border-radius: var(--r); background: var(--bg-card);
}
.barre-etat.etat-valide_client { border-color: #c9e7d3; background: #f5fbf7; }
.barre-etat.etat-correction_demandee { border-color: #f1ddb8; background: #fffaf2; }
.barre-etat-texte { flex: 1 1 22rem; display: flex; align-items: center; gap: 0.5rem; font-size: 0.9rem; }
.barre-etat-texte .pastille-etat { margin-left: 0; }
.barre-etat-boutons { display: flex; flex-wrap: wrap; gap: 0.5rem; }
.barre-etat-message { flex-basis: 100%; font-style: italic; color: var(--ink-soft); }
.barre-etat .help { flex-basis: 100%; margin: 0; }
.barre-etat-correction { flex-basis: 100%; }
.barre-etat-correction textarea { width: 100%; margin: 0.3rem 0 0.5rem; }

.compteurs-dossiers { display: flex; flex-wrap: wrap; gap: 0.4rem; align-items: center; margin: -0.4rem 0 0.9rem; }
.compteurs-dossiers .pastille-etat { margin-left: 0; }
.dossier-row.etat-valide_client { box-shadow: inset 3px 0 0 #2a8a4f; }
.dossier-row.etat-correction_demandee { box-shadow: inset 3px 0 0 #c7851a; }
.dossier-row.etat-classe .dossier-nom { color: var(--ink-soft); }
#vue-dossiers { max-width: 14rem; }
/* ------------------------------------------------------------------
   LIENS CLIENT, CÔTÉ CONSEILLER
   ------------------------------------------------------------------ */
.preparation-distance { margin-top: 1.2rem; }
.preparation-distance table.odj { width: 100%; max-width: 28rem; margin-bottom: 0.8rem; }
.lien-creation { display: grid; grid-template-columns: 1fr auto; gap: 0.4rem 0.8rem; align-items: end; margin-top: 0.8rem; }
.lien-creation label { grid-column: 1 / -1; margin: 0.3rem 0 0; }
.lien-creation input, .lien-creation select { width: 100%; }
.lien-creation .btn { grid-column: 1 / -1; justify-self: start; }
.lien-cree, .barre-etat-lien {
  flex-basis: 100%; margin-top: 0.8rem; padding: 0.9rem 1rem;
  border: 1px solid var(--line); border-radius: var(--r); background: var(--bg-soft);
}
.lien-cree label { display: block; margin: 0.4rem 0 0.25rem; font-weight: 550; }
.lien-cree-ligne { display: flex; gap: 0.5rem; }
.lien-cree-ligne input { flex: 1; font-family: ui-monospace, monospace; font-size: 0.82rem; }
.lien-cree textarea { width: 100%; font-size: 0.85rem; margin-bottom: 0.4rem; }
.liens-recus { display: grid; gap: 0.4rem; margin: 0.6rem 0; }
.lien-recu {
  display: flex; justify-content: space-between; align-items: center; gap: 0.8rem; flex-wrap: wrap;
  padding: 0.6rem 0.8rem; border: 1px solid #c9e7d3; border-radius: var(--r); background: #f5fbf7;
}
.lien-recu .help { display: block; margin: 0; }

/* ------------------------------------------------------------------
   LA PAGE CLIENT (client.php)
   Pensée d'abord pour un téléphone : une colonne, de grandes cibles,
   aucun JavaScript nécessaire.
   ------------------------------------------------------------------ */
body.page-client { background: #f5f5f7; color: #1d1d1f; margin: 0; }
.client { max-width: 40rem; margin: 0 auto; padding: 1rem 0.9rem 3rem; }
.client-carte { background: #fff; border-radius: 18px; padding: 1.4rem 1.2rem; box-shadow: 0 1px 3px rgba(0,0,0,0.06); }
.client h1 { font-size: 1.55rem; line-height: 1.2; margin: 0 0 0.6rem; letter-spacing: -0.01em; }
.client h2 { font-size: 1.05rem; margin: 1.6rem 0 0.4rem; }
.client-aide { color: #6e6e73; font-size: 0.92rem; line-height: 1.5; margin: 0.3rem 0 0.8rem; }
.client-champ { display: block; margin: 0.55rem 0; }
.client-champ > span { display: block; font-size: 0.88rem; font-weight: 550; margin-bottom: 0.25rem; }
.client input[type="text"], .client select, .client textarea {
  width: 100%; box-sizing: border-box; font: inherit; font-size: 16px;
  padding: 0.7rem 0.8rem; border: 1px solid #d1d1d6; border-radius: 12px; background: #fff; min-height: 44px;
}
.client-grille { display: grid; gap: 0 0.8rem; }
@media (min-width: 560px) { .client-grille { grid-template-columns: 1fr 1fr; } }
.client-choix { display: grid; gap: 0.5rem; }
.client-carte-choix {
  display: flex; gap: 0.7rem; align-items: flex-start; cursor: pointer;
  padding: 0.85rem 0.9rem; border: 1px solid #d1d1d6; border-radius: 14px; background: #fff; min-height: 44px;
}
.client-carte-choix input { width: 1.25rem; height: 1.25rem; margin-top: 0.1rem; flex: 0 0 auto; accent-color: #1d1d1f; }
.client-carte-choix strong { display: block; font-size: 0.95rem; }
.client-carte-choix small { display: block; color: #6e6e73; font-size: 0.82rem; line-height: 1.4; margin-top: 0.15rem; }
.client-carte-choix:has(input:checked) { border-color: #1d1d1f; box-shadow: inset 0 0 0 1px #1d1d1f; }
/* Le second niveau d'un motif ne se déplie que si le motif est coché. */
.client-questions { margin: 0.2rem 0 0.6rem 2.6rem; }
.client-motif:has(> .client-carte-choix input:not(:checked)) > .client-questions { display: none; }
.client-case { display: flex; gap: 0.6rem; align-items: flex-start; margin: 0.9rem 0; font-size: 0.95rem; cursor: pointer; }
.client-case input { width: 1.25rem; height: 1.25rem; flex: 0 0 auto; accent-color: #1d1d1f; }
.client-conjoint, .client-correction { margin: 1rem 0; }
.client-conjoint summary, .client-correction summary { cursor: pointer; font-weight: 550; padding: 0.4rem 0; }
.client-bouton {
  display: block; width: 100%; margin-top: 1.2rem; padding: 0.95rem 1rem; min-height: 48px;
  font: inherit; font-size: 1rem; font-weight: 600; color: #fff; background: #1d1d1f;
  border: 0; border-radius: 14px; cursor: pointer;
}
.client-bouton.secondaire { background: #fff; color: #1d1d1f; border: 1px solid #d1d1d6; }
.client-erreurs { background: #fdecea; color: #a3301f; border-radius: 12px; padding: 0.6rem 0.9rem; margin: 0.8rem 0; }
.client-erreurs ul { margin: 0; padding-left: 1.1rem; }
.client-chiffres { display: grid; gap: 0.5rem; margin: 0.5rem 0; }
.client-chiffres div { display: flex; justify-content: space-between; gap: 1rem; padding: 0.7rem 0.9rem; background: #f5f5f7; border-radius: 12px; }
.client-chiffres dt { font-size: 0.9rem; color: #3a3a3c; }
.client-chiffres dd { margin: 0; text-align: right; font-weight: 600; }
.client-chiffres dd small { display: block; font-weight: 400; color: #8e8e93; font-size: 0.78rem; }
.client-recos { padding-left: 1.2rem; line-height: 1.6; }
.client-pied { text-align: center; color: #8e8e93; font-size: 0.82rem; margin-top: 1.2rem; }
.client-pied a { color: inherit; }
.client-case span { color: #1d1d1f; font-weight: 500; }
