.auth-wrap {
  max-width: 640px;
  margin: 72px auto;
  padding: 0 20px;
}

.auth-card {
  max-width: 460px;
  margin: 0 auto;
  background: linear-gradient(180deg, var(--bg-surface-2), var(--bg-surface));
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 40px 36px;
  box-shadow: 0 30px 60px -30px rgba(0, 0, 0, 0.6);
}

.auth-card.wide {
  max-width: 640px;
}

.auth-title {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 26px;
  margin-bottom: 8px;
}

.auth-subtitle {
  color: var(--text-muted);
  font-size: 14.5px;
  margin-bottom: 30px;
}

.field-group {
  margin-bottom: 20px;
}

.field-group label {
  display: block;
  font-size: 13.5px;
  font-weight: 600;
  margin-bottom: 8px;
  color: var(--text);
}

.field-hint {
  font-size: 12.5px;
  color: var(--text-faint);
  margin-top: 6px;
}

.field-error {
  font-size: 12.5px;
  color: var(--red-orange);
  margin-top: 6px;
}

.field-input,
select.field-input,
textarea.field-input {
  width: 100%;
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 12px 15px;
  color: var(--text);
  font-family: var(--font-body);
  font-size: 14.5px;
  transition: border-color 0.2s ease;
}

.field-input:focus,
select.field-input:focus,
textarea.field-input:focus {
  outline: none;
  border-color: var(--blue);
}

.field-input::placeholder { color: var(--text-faint); }

textarea.field-input { resize: vertical; }

.form-errors {
  background: rgba(242, 73, 10, 0.1);
  border: 1px solid rgba(242, 73, 10, 0.35);
  color: #FFB199;
  border-radius: 10px;
  padding: 12px 16px;
  font-size: 13.5px;
  margin-bottom: 20px;
}

.auth-submit {
  width: 100%;
  border: none;
  cursor: pointer;
  margin-top: 6px;
}

.auth-footer {
  text-align: center;
  margin-top: 24px;
  font-size: 14px;
  color: var(--text-muted);
}

.auth-footer a {
  color: var(--blue);
  font-weight: 600;
}

/* ---------- Mon compte (dashboard) ---------- */
.compte-wrap {
  max-width: 760px;
  margin: 72px auto;
  padding: 0 20px;
}

.compte-header {
  margin-bottom: 40px;
}

.compte-header h1 {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 28px;
}

.compte-header p {
  color: var(--text-muted);
  margin-top: 8px;
}

.profil-cards {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 18px;
}

@media (max-width: 640px) {
  .profil-cards { grid-template-columns: 1fr; }
}

.profil-card {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 26px 24px;
}

.profil-card h3 {
  font-family: var(--font-display);
  font-size: 17px;
  margin-bottom: 6px;
}

.profil-card p {
  color: var(--text-muted);
  font-size: 13.5px;
  margin-bottom: 18px;
}

.profil-status {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-family: var(--font-mono);
  font-size: 11px;
  padding: 4px 10px;
  border-radius: 999px;
  margin-bottom: 16px;
}

.profil-status.en_attente {
  color: var(--orange);
  background: rgba(255, 149, 0, 0.12);
}
.profil-status.valide {
  color: var(--green);
  background: rgba(46, 189, 78, 0.12);
}
.profil-status.rejete {
  color: var(--red-orange);
  background: rgba(242, 73, 10, 0.12);
}
.profil-status .dot {
  width: 5px; height: 5px; border-radius: 50%;
  background: currentColor;
}

/* Toggle des champs entreprise (SIRET / raison sociale) */
.entreprise-fields {
  overflow: hidden;
  max-height: 0;
  transition: max-height 0.3s ease;
}
.entreprise-fields.is-open {
  max-height: 300px;
}

/* ---------- Champ fichier (upload de documents) ---------- */
.field-file {
  width: 100%;
  background: var(--bg-surface);
  border: 1px dashed var(--border);
  border-radius: 10px;
  padding: 14px 15px;
  color: var(--text-muted);
  font-family: var(--font-body);
  font-size: 13.5px;
}
.field-file::file-selector-button {
  background: linear-gradient(90deg, var(--blue), var(--deep-blue));
  color: #fff;
  border: none;
  border-radius: 8px;
  padding: 8px 14px;
  font-weight: 600;
  font-size: 13px;
  margin-right: 12px;
  cursor: pointer;
}

/* ---------- Sélecteur de type de compte (onglets radio) ---------- */
.type-compte-selector {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
  margin-bottom: 30px;
}
@media (max-width: 640px) {
  .type-compte-selector { grid-template-columns: repeat(2, 1fr); }
}

.type-compte-option {
  position: relative;
}
.type-compte-option input[type="radio"] {
  position: absolute;
  opacity: 0;
  width: 100%;
  height: 100%;
  margin: 0;
  cursor: pointer;
}
.type-compte-option label {
  display: block;
  border: 1.5px solid var(--border);
  border-radius: 12px;
  padding: 16px 14px;
  cursor: pointer;
  transition: border-color 0.2s ease, background 0.2s ease;
  font-size: 13.5px;
  font-weight: 600;
  color: var(--text);
}
.type-compte-option label .subtitle {
  display: block;
  font-weight: 400;
  font-size: 11.5px;
  color: var(--text-muted);
  margin-top: 3px;
}
.type-compte-option input[type="radio"]:checked + label {
  border-color: var(--green);
  background: var(--green-light-bg);
}
.type-compte-option input[type="radio"]:focus-visible + label {
  outline: 2px solid var(--blue);
  outline-offset: 1px;
}

/* ---------- Indicateur de progression (wizard) ---------- */
.wizard-steps {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  margin-bottom: 36px;
  flex-wrap: wrap;
}

.wizard-step {
  display: flex;
  align-items: center;
  gap: 8px;
}

.wizard-step .dot {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-mono);
  font-size: 12px;
  font-weight: 600;
  background: var(--bg-surface-2);
  color: var(--text-faint);
  border: 1.5px solid var(--border);
}
.wizard-step.done .dot { background: var(--green); color: #fff; border-color: var(--green); }
.wizard-step.active .dot { background: var(--green-light-bg); color: var(--green); border-color: var(--green); }

.wizard-step .label {
  font-size: 12.5px;
  color: var(--text-faint);
  font-weight: 500;
}
.wizard-step.active .label { color: var(--text); font-weight: 700; }
.wizard-step.done .label { color: var(--text-muted); }

.wizard-connector {
  width: 24px;
  height: 1.5px;
  background: var(--border);
}
@media (max-width: 640px) {
  .wizard-step .label { display: none; }
  .wizard-connector { width: 14px; }
}

/* ---------- Boutons sociaux (Google / Microsoft) ---------- */
.social-buttons {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin: 20px 0;
}

.btn-social {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  border: 1px solid var(--border);
  background: var(--bg-surface);
  border-radius: 10px;
  padding: 12px;
  font-size: 14px;
  font-weight: 500;
  color: var(--text);
  cursor: pointer;
  transition: border-color 0.2s ease, background 0.2s ease;
}
.btn-social:hover { border-color: var(--text-faint); background: var(--bg-surface-2); }
.btn-social img, .btn-social svg { width: 18px; height: 18px; }
.btn-social:disabled { opacity: 0.5; cursor: not-allowed; }

.divider-or {
  display: flex;
  align-items: center;
  gap: 14px;
  margin: 24px 0;
  color: var(--text-faint);
  font-size: 13px;
}
.divider-or::before, .divider-or::after {
  content: "";
  flex: 1;
  height: 1px;
  background: var(--border);
}

/* ---------- Ligne "Se souvenir de moi" / "Mot de passe oublié" ---------- */
.login-options-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 24px;
  font-size: 13.5px;
  flex-wrap: wrap;
  gap: 10px;
}
.login-options-row label {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--text-muted);
  cursor: pointer;
  margin-bottom: 0;
}
.login-options-row input[type="checkbox"] {
  width: 16px;
  height: 16px;
  accent-color: var(--green);
}
.login-options-row a { color: var(--green); font-weight: 600; }

/* ---------- Cartes représentant (étape 2) ---------- */
.representant-card {
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 22px;
  margin-bottom: 16px;
  background: var(--bg-surface);
}
.representant-card .representant-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 18px;
  gap: 10px;
}
.representant-card .representant-title { flex: 1; }

.representant-remove {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  border: 1px solid var(--border);
  background: var(--bg-surface);
  color: var(--text-faint);
  font-size: 13px;
  line-height: 1;
  cursor: pointer;
  flex-shrink: 0;
  transition: border-color 0.2s ease, color 0.2s ease;
}
.representant-remove:hover { border-color: var(--red-orange); color: var(--red-orange); }
.representant-card .representant-title {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 15px;
}
.representant-card .badge-tag {
  font-family: var(--font-mono);
  font-size: 10.5px;
  padding: 3px 9px;
  border-radius: 999px;
}
.badge-tag.obligatoire { color: var(--green); background: var(--green-light-bg); }
.badge-tag.facultatif { color: var(--text-faint); background: var(--bg-surface-2); }

.field-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}
@media (max-width: 640px) {
  .field-row { grid-template-columns: 1fr; }
}

.phone-field-group {
  display: flex;
  gap: 8px;
}
.phone-field-group select { flex: 0 0 auto; width: 110px; }
.phone-field-group input { flex: 1; }

/* ---------- Récapitulatif (étape 4) ---------- */
.recap-icon {
  width: 64px;
  height: 64px;
  border-radius: 50%;
  background: var(--green-light-bg);
  color: var(--green);
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 20px;
  font-size: 30px;
}
.recap-list {
  text-align: left;
  background: var(--bg-surface-2);
  border-radius: 12px;
  padding: 18px 22px;
  margin: 24px 0;
}
.recap-list .recap-item {
  display: flex;
  justify-content: space-between;
  padding: 8px 0;
  font-size: 13.5px;
  border-bottom: 1px solid var(--border);
}
.recap-list .recap-item:last-child { border-bottom: none; }
.recap-list .recap-item .ok { color: var(--green); font-weight: 600; }
.recap-list .recap-item .manquant { color: var(--orange); font-weight: 600; }

/* ---------- Champ mot de passe avec bouton afficher/masquer ---------- */
.password-field-wrapper {
  position: relative;
}
.password-field-wrapper .field-input {
  padding-right: 44px;
}
.password-toggle {
  position: absolute;
  top: 50%;
  right: 12px;
  transform: translateY(-50%);
  background: none;
  border: none;
  padding: 4px;
  cursor: pointer;
  color: var(--text-faint);
  display: flex;
  align-items: center;
  justify-content: center;
}
.password-toggle:hover { color: var(--text-muted); }
.password-toggle svg { width: 19px; height: 19px; }
.password-toggle .icon-eye-off { display: none; }
.password-toggle.is-visible .icon-eye { display: none; }
.password-toggle.is-visible .icon-eye-off { display: block; }

/* =====================================================================
   Parcours d'inscription en étapes (wizard)
   ===================================================================== */

.wizard-wrap { max-width: 1000px; margin: 40px auto 72px; padding: 0 20px; }
.wizard-wrap.narrow { max-width: 560px; }

.wizard-card {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 34px 38px;
  box-shadow: 0 24px 60px -34px rgba(10, 15, 44, 0.25);
}
@media (max-width: 640px) { .wizard-card { padding: 24px 18px; } }

.wizard-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 20px;
  flex-wrap: wrap;
  margin-bottom: 26px;
}
.wizard-head .auth-title { margin-bottom: 6px; }
.wizard-head .auth-subtitle { margin-bottom: 0; }

.security-badge {
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--green-light-bg);
  color: var(--green);
  border-radius: 10px;
  padding: 10px 14px;
  font-size: 12.5px;
  font-weight: 500;
  max-width: 270px;
}
.security-badge svg { flex-shrink: 0; }

.wizard-section-title {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 22px;
  margin: 8px 0 6px;
}
.wizard-section-sub { color: var(--text-muted); font-size: 14px; margin-bottom: 22px; }

.wizard-actions {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  margin-top: 28px;
}
.wizard-actions .right { display: flex; gap: 12px; flex-wrap: wrap; }

/* Grilles de champs : minmax(0, 1fr) pour qu'aucune colonne ne déborde */
.field-row { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.field-row-3 {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
}
@media (max-width: 760px) { .field-row-3 { grid-template-columns: 1fr; } }

/* Institution / organisation : Fonction + Direction côte à côte, téléphone sur toute la largeur
   (indicatif + numéro ont besoin de place) */
.field-row-3.avec-direction { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.field-row-3.avec-direction > .field-group:has(.phone-field-group) { grid-column: 1 / -1; }
@media (max-width: 760px) { .field-row-3.avec-direction { grid-template-columns: 1fr; } }

/* Le champ du numéro ne doit jamais s'écraser */
.phone-field-group input { min-width: 0; }

/* Onglets de type de compte avec icône */
.type-compte-option label,
.type-compte-option .tab-label {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  border: 1.5px solid var(--border);
  border-radius: 12px;
  padding: 16px 14px;
  font-size: 13.5px;
  font-weight: 600;
  color: var(--text);
  transition: border-color 0.2s ease, background 0.2s ease;
}
.type-compte-option .tab-label { cursor: default; }
.type-compte-option .tab-icon { flex-shrink: 0; width: 26px; height: 26px; margin-top: 2px; }
.type-compte-option .tab-text { display: block; min-width: 0; }
.type-compte-option .subtitle { display: block; font-weight: 400; font-size: 11.5px; color: var(--text-muted); margin-top: 3px; }
.type-compte-option input[type="radio"]:checked + label,
.type-compte-option.is-active .tab-label {
  border-color: var(--green);
  background: var(--green-light-bg);
}
.type-compte-option input[type="radio"]:checked + label .tab-icon,
.type-compte-option.is-active .tab-icon { color: var(--green); }

/* Cartes de représentants : bouton Supprimer et case cachée */
.representant-delete-flag { display: none; }
.representant-remove {
  width: auto;
  height: auto;
  border-radius: 999px;
  padding: 4px 12px;
  font-size: 12px;
  font-weight: 600;
}

/* Documents (étape 3) */
.document-group {
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 20px;
  margin-bottom: 18px;
}
.document-group h3 { font-family: var(--font-display); font-size: 16px; margin-bottom: 14px; }

.document-card {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) minmax(210px, 290px);
  gap: 16px;
  align-items: center;
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 14px 16px;
  margin-bottom: 12px;
  background: var(--bg-surface);
}
.document-card:last-child { margin-bottom: 0; }
@media (max-width: 760px) { .document-card { grid-template-columns: auto minmax(0, 1fr); } .document-card .document-upload { grid-column: 1 / -1; } }

.document-icon {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: var(--bg-surface-2);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text);
}
.document-info strong { font-size: 14.5px; }
.document-info p { font-size: 12.5px; color: var(--text-muted); margin-top: 3px; }
.document-info .badge-tag { margin-left: 6px; }

.document-upload {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  gap: 2px;
  min-height: 64px;
  padding: 12px;
  border: 1.5px dashed var(--blue);
  border-radius: 10px;
  color: var(--text);
  cursor: pointer;
  transition: background 0.2s ease;
}
.document-upload:hover { background: var(--bg-surface-2); }
.document-upload input[type="file"] {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  opacity: 0;
  cursor: pointer;
}
.document-upload-label { font-size: 13px; font-weight: 600; word-break: break-all; }
.document-upload-hint { font-size: 11px; color: var(--text-faint); }
.document-upload.is-done { border-color: var(--green); background: var(--green-light-bg); }

/* Encadrés d'information */
.info-box { border-radius: 12px; padding: 16px 18px; font-size: 13px; line-height: 1.5; margin-bottom: 14px; color: var(--text-muted); }
.info-box strong { display: block; font-size: 14.5px; margin-bottom: 4px; color: var(--text); }
.info-box.info { background: #EAF2FE; }

/* Récapitulatif (étape 4) */
.recap-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.6fr) minmax(0, 1fr);
  gap: 22px;
  align-items: start;
}
@media (max-width: 860px) { .recap-layout { grid-template-columns: 1fr; } }

.recap-card { border: 1px solid var(--border); border-radius: 14px; padding: 20px 22px; margin-bottom: 16px; }
.recap-card-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 12px; }
.recap-card-head h3 { font-family: var(--font-display); font-size: 16px; }
.recap-card-head a { color: var(--blue); font-size: 13px; font-weight: 600; }

.recap-table { width: 100%; font-size: 13.5px; border-collapse: collapse; }
.recap-table td { padding: 5px 0; vertical-align: top; }
.recap-table td:first-child { color: var(--text-muted); width: 46%; padding-right: 12px; }
.recap-table td:last-child { font-weight: 500; word-break: break-word; }

.recap-docs { list-style: none; }
.recap-docs li { display: flex; justify-content: space-between; gap: 12px; padding: 6px 0; font-size: 13.5px; }
.recap-docs .ok { color: var(--green); font-weight: 600; }
.recap-docs .manquant { color: var(--orange); font-weight: 600; }
.recap-docs .neutre { color: var(--text-faint); }

.cgu-box { border: 1px solid var(--border); border-radius: 12px; padding: 16px 18px; margin-bottom: 16px; }
.cgu-box h4 { font-family: var(--font-display); font-size: 15px; margin-bottom: 12px; }
.checkbox-line { display: flex; gap: 10px; align-items: flex-start; font-size: 13px; margin-bottom: 12px; cursor: pointer; color: var(--text); }
.checkbox-line input[type="checkbox"] { margin-top: 3px; width: 16px; height: 16px; flex-shrink: 0; accent-color: var(--green); }
.checkbox-line a { color: var(--blue); font-weight: 500; }

/* =====================================================================
   Colonne latérale et éléments propres aux institutions / organisations
   ===================================================================== */

.wizard-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.8fr) minmax(0, 1fr);
  gap: 28px;
  align-items: start;
}
.wizard-grid.no-aside { grid-template-columns: minmax(0, 1fr); }
.wizard-grid.no-aside .wizard-aside { display: none; }
.wizard-main { min-width: 0; }
@media (max-width: 900px) { .wizard-grid { grid-template-columns: 1fr; } }

.aside-box {
  border-radius: 12px;
  padding: 16px 18px;
  margin-bottom: 14px;
  font-size: 13px;
  line-height: 1.5;
  color: var(--text-muted);
}
.aside-box h4 { font-family: var(--font-display); font-size: 14.5px; color: var(--text); margin-bottom: 6px; }
.aside-box ul { list-style: none; margin-top: 8px; }
.aside-box li { position: relative; padding-left: 22px; margin-bottom: 6px; }
.aside-box li::before { content: "✓"; position: absolute; left: 0; top: 0; font-weight: 700; color: var(--green); }
.aside-info { background: #EAF2FE; }
.aside-success { background: var(--green-light-bg); }
.aside-warning { background: #FFF6E5; }
.aside-warning li::before { content: "!"; color: var(--orange); }

textarea.field-input { resize: vertical; min-height: 110px; font-family: inherit; }
.char-counter { text-align: right; font-size: 12px; color: var(--text-faint); margin-top: 4px; }

/* Cases à cocher en grille (domaines d'activité) */
.field-group .checkbox-grid > div {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px 14px;
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 14px;
  background: var(--bg-surface);
}
.field-group .checkbox-grid label {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 0;
  font-size: 13.5px;
  font-weight: 500;
  cursor: pointer;
}
.checkbox-grid input[type="checkbox"] { width: 16px; height: 16px; flex-shrink: 0; accent-color: var(--green); }
@media (max-width: 640px) { .field-group .checkbox-grid > div { grid-template-columns: 1fr; } }

/* Tableau des représentants (récapitulatif) */
.table-scroll { overflow-x: auto; }
.recap-grid { width: 100%; border-collapse: collapse; font-size: 13px; }
.recap-grid th { text-align: left; background: var(--bg-surface-2); padding: 8px 10px; font-weight: 600; white-space: nowrap; }
.recap-grid td { padding: 8px 10px; border-top: 1px solid var(--border); vertical-align: top; }


/* ---------- Mon compte : informations et représentants ---------- */
.compte-actions { display: flex; gap: 10px; flex-wrap: wrap; margin: 4px 0 22px; }
.compte-form .field-group { margin-bottom: 16px; }

.rep-liste { display: flex; flex-direction: column; gap: 12px; margin-bottom: 18px; }
.rep-item {
  display: flex; justify-content: space-between; align-items: center; gap: 16px; flex-wrap: wrap;
  border: 1px solid var(--border); border-radius: 14px; padding: 16px 20px; background: var(--bg-surface);
}
.rep-infos h3 { font-family: var(--font-display); font-size: 16px; margin: 0 0 4px; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.rep-infos p { margin: 0; font-size: 13.5px; color: var(--text-muted); word-break: break-word; }
.rep-actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.rep-actions form { margin: 0; }
.btn-danger-ghost { color: #B42318; }
.btn-danger-ghost:hover { border-color: #B42318; }

/* Règles de mot de passe (liste fournie par Django) */
.password-rules ul { margin: 6px 0 0; padding-left: 18px; }
.password-rules li { margin: 2px 0; }
