/* =============================================================================
   Styles de l'espace (mêmes couleurs que l'admin, clair / sombre automatique)
   ============================================================================= */

:root {
  --fond: #f8f4f6;
  --surface: #ffffff;
  --surface-2: #f2eaef;
  --texte: #22121f;
  --doux: #7b6576;
  --bord: #ecdfe6;
  --accent: #5b2a5e;
  --accent-doux: #f4e3ee;
  --ombre: 0 1px 2px rgba(40, 15, 35, .06), 0 4px 16px rgba(40, 15, 35, .05);
  --rayon: 12px;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --fond: #1a1219;
    --surface: #241a23;
    --surface-2: #2e222d;
    --texte: #f3e9ef;
    --doux: #b29fad;
    --bord: #3b2c39;
    --accent: #c58fc8;
    --accent-doux: #3a2438;
    --ombre: 0 1px 2px rgba(0, 0, 0, .3), 0 4px 16px rgba(0, 0, 0, .25);
    color-scheme: dark;
  }
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  background: var(--fond);
  color: var(--texte);
  font: 15px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  -webkit-font-smoothing: antialiased;
}
[hidden] { display: none !important; }
main { padding: 28px clamp(16px, 3vw, 32px) 80px; max-width: 1200px; margin: 0 auto; outline: none; }

/* ---------- En-tête ---------- */
.entete {
  position: sticky; top: 0; z-index: 20;
  display: flex; align-items: center; gap: 16px;
  padding: 0 clamp(16px, 3vw, 32px); height: 58px;
  background: var(--surface); border-bottom: 1px solid var(--bord);
}
.marque { display: flex; align-items: center; gap: 10px; font-weight: 700; color: var(--texte); text-decoration: none; white-space: nowrap; }
.marque .sous { color: var(--doux); font-weight: 400; }
.logo { width: 26px; height: 26px; border-radius: 7px; background: url(/espace/marque.svg) center / cover; display: inline-block; }
.compte { margin-left: auto; display: flex; align-items: center; gap: 12px; color: var(--doux); font-size: .9rem; min-width: 0; }
.compte .nom { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.compte a { color: var(--doux); text-decoration: none; padding: 6px 10px; border-radius: 8px; white-space: nowrap; }
.compte a:hover { background: var(--surface-2); color: var(--texte); }

/* ---------- Titre et recherche ---------- */
.titre { display: flex; align-items: center; gap: 16px; flex-wrap: wrap; margin-bottom: 24px; }
.titre h1 { font-size: 1.5rem; margin: 0; line-height: 1.2; }
.titre input {
  margin-left: auto; width: min(320px, 100%); font: inherit; color: var(--texte);
  background: var(--surface); border: 1px solid var(--bord); border-radius: 8px; padding: 8px 12px;
}
.titre input:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-doux); }

/* ---------- Dossiers ---------- */
.dossier { background: var(--surface); border: 1px solid var(--bord); border-radius: var(--rayon); box-shadow: var(--ombre); }
.dossier + .dossier { margin-top: 14px; }
.dossier > summary {
  display: flex; align-items: center; gap: 10px; padding: 14px 18px;
  cursor: pointer; list-style: none; font-weight: 650; user-select: none; border-radius: var(--rayon);
}
.dossier > summary::-webkit-details-marker { display: none; }
.dossier > summary:hover { background: var(--surface-2); }
.dossier > summary:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; }
.dossier > summary .fleche { width: 18px; color: var(--doux); transition: transform .15s; flex-shrink: 0; text-align: center; }
.dossier[open] > summary .fleche { transform: rotate(90deg); }
.dossier > summary .icone { font-size: 1.15rem; }
.dossier > summary .nombre { margin-left: auto; color: var(--doux); font-weight: 500; font-size: .82rem; background: var(--surface-2); padding: 1px 9px; border-radius: 999px; }
.dossier .corps { padding: 4px 18px 18px; }

/* Sous-dossiers : plus discrets, sans ombre */
.dossier .dossier { box-shadow: none; background: var(--fond); }
.dossier .dossier + .dossier { margin-top: 10px; }
.dossier .dossier > summary { padding: 10px 14px; font-weight: 600; font-size: .95rem; }
.dossier .dossier .corps { padding: 2px 14px 14px; }
.tuiles + .dossier, .dossier + .tuiles { margin-top: 12px; }
.vide { color: var(--doux); font-size: .9rem; margin: 4px 0 0; }

/* ---------- Tuiles ---------- */
.tuiles { display: grid; gap: 10px; grid-template-columns: repeat(auto-fill, minmax(min(250px, 100%), 1fr)); }
.tuile {
  display: flex; align-items: flex-start; gap: 12px; padding: 12px 14px; min-width: 0;
  background: var(--surface); border: 1px solid var(--bord); border-radius: 10px;
  color: var(--texte); text-decoration: none; transition: border-color .15s, transform .15s, box-shadow .15s;
}
.tuile:hover { border-color: var(--accent); box-shadow: var(--ombre); transform: translateY(-1px); }
.tuile:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.tuile .icone {
  width: 38px; height: 38px; border-radius: 9px; background: var(--accent-doux);
  display: grid; place-items: center; font-size: 1.2rem; flex-shrink: 0;
}
.tuile .textes { min-width: 0; }
.tuile strong { display: block; font-weight: 600; line-height: 1.3; }
.tuile strong .externe { color: var(--doux); font-weight: 400; font-size: .8rem; margin-left: 4px; }
.tuile span.description { display: block; color: var(--doux); font-size: .84rem; line-height: 1.35; margin-top: 2px; }

.message { text-align: center; color: var(--doux); padding: 48px 16px; }
.message.erreur { color: #b42318; }

@media (max-width: 600px) {
  .marque .sous { display: none; }
  .compte .nom { display: none; }
  .titre input { margin-left: 0; width: 100%; }
}

/* Portail d'un client */
.logo.initiale { background: var(--accent); color: #fff; display: inline-flex; align-items: center; justify-content: center; font-weight: 700; font-size: 14px; border-radius: 50%; }
.bandeau-client { background: var(--accent); color: #fff; border-radius: var(--rayon); padding: 16px 20px; margin-bottom: 18px; }
.bandeau-client p { margin: 0; }
.bandeau-client a { color: #fff; font-weight: 600; }
.bandeau-client .brouillon { margin-top: 6px; opacity: .9; font-size: 14px; }
.carte-client { background: var(--surface); border: 1px solid var(--bord); border-radius: var(--rayon); padding: 20px; margin-top: 18px; box-shadow: var(--ombre); }
.carte-client h2 { margin: 0 0 8px; font-size: 18px; }
.carte-client textarea { width: 100%; font: inherit; padding: 10px; border: 1px solid var(--bord); border-radius: 10px; background: var(--fond); color: var(--texte); margin: 8px 0; }
.carte-client .infos { display: grid; grid-template-columns: max-content 1fr; gap: 8px 16px; margin: 12px 0 18px; }
.carte-client .infos dt { color: var(--doux); }
.carte-client .infos dd { margin: 0; font-weight: 600; }
.bouton { display: inline-block; background: var(--accent); color: #fff; border: 0; border-radius: 10px; padding: 10px 16px; font: inherit; font-weight: 600; text-decoration: none; cursor: pointer; }
.carte-client a:not(.bouton), .message a { color: var(--accent); }

/* Connexion des clients (compte.html) */
.page-compte { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 16px;
  background: linear-gradient(135deg, #5b2a5e, #3b1a3e); }
.carte-compte { width: 100%; max-width: 400px; background: var(--surface); color: var(--texte); border-radius: 16px; padding: 32px 28px; box-shadow: 0 20px 60px rgba(0,0,0,.25); text-align: center; }
.carte-compte img { border-radius: 14px; }
.carte-compte h1 { margin: 10px 0 4px; font-size: 26px; color: var(--accent); }
.carte-compte .description { color: var(--doux); margin: 0 0 18px; }
.carte-compte form { display: flex; flex-direction: column; gap: 12px; text-align: left; }
.champ-compte { display: flex; flex-direction: column; gap: 4px; font-weight: 600; font-size: 14px; }
.champ-compte input { font: inherit; padding: 11px 12px; border: 1px solid var(--bord); border-radius: 10px; background: var(--fond); color: var(--texte); }
.carte-compte .bouton { width: 100%; margin-top: 6px; }
.carte-compte .retour { min-height: 1.2em; margin: 12px 0 0; }
.carte-compte .retour.erreur { color: #b42318; }
.carte-compte .retour.succes { color: #1f8a4c; }
.carte-compte .liens a { color: var(--accent); }
.carte-client .mot-de-passe { display: flex; flex-direction: column; gap: 8px; max-width: 380px; margin: 8px 0 16px; }
.carte-client .mot-de-passe input { font: inherit; padding: 10px; border: 1px solid var(--bord); border-radius: 10px; background: var(--fond); color: var(--texte); }
.carte-client .mot-de-passe h3 { margin: 0; font-size: 15px; }
