/* =====================================================================
   CFTC CASTORAMA ISÈRE — adhesion.css
   Styles spécifiques au parcours d'adhésion en ligne (formulaire
   multi-étapes, mandat SEPA, signature). Consomme les tokens de
   assets/cftc.css : une seule source de vérité pour les couleurs.
   ===================================================================== */


  body {
    font-family: 'Inter', sans-serif;
    color: var(--ardoise);
    line-height: 1.6;
    background: var(--bleu-clair);
    min-height: 100vh;
  }

  h1, h2, h3 {
    font-family: 'Fraunces', serif;
    font-weight: 600;
    color: var(--bleu-cftc);
    line-height: 1.2;
  }

  a { color: var(--bleu-cftc); }

  .container {
    max-width: 760px;
    margin: 0 auto;
    padding: 24px;
  }

  /* HEADER */
  .top-bar {
    background: white;
    border-bottom: 1px solid var(--bordure);
    padding: 16px 24px;
  }

  .top-bar-inner {
    max-width: 760px;
    margin: 0 auto;
    display: flex;
    align-items: center;
    justify-content: space-between;
  }

  /* Le composant .cftc-logo vit dans assets/cftc.css (design system).
     Ici on ajuste seulement son gabarit pour la barre supérieure. */
  .top-bar-inner .cftc-logo__mark { width: 42px; height: 34px; }
  .top-bar-inner .cftc-logo__sigle { font-size: 1.2rem; }

  .back-link {
    font-size: 0.9rem;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 6px;
  }

  /* PAGE HEAD */
  .page-head {
    text-align: center;
    padding: 36px 0 8px;
  }

  .page-head h1 {
    font-size: clamp(1.7rem, 4vw, 2.3rem);
    margin-bottom: 10px;
  }

  .page-head p {
    color: var(--ardoise-clair);
    max-width: 480px;
    margin: 0 auto;
  }

  /* STEPPER */
  .stepper {
    display: flex;
    justify-content: space-between;
    margin: 32px 0 8px;
    position: relative;
  }

  .stepper::before {
    content: '';
    position: absolute;
    top: 14px;
    left: 5%;
    right: 5%;
    height: 2px;
    background: var(--bordure);
    z-index: 0;
  }

  .step {
    position: relative;
    z-index: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    flex: 1;
  }

  .step-circle {
    width: 30px;
    height: 30px;
    border-radius: 50%;
    background: white;
    border: 2px solid var(--bordure);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 0.85rem;
    color: var(--ardoise-clair);
    transition: all 0.25s;
  }

  .step.active .step-circle {
    border-color: var(--orange-casto);
    background: var(--orange-casto);
    color: white;
  }

  .step.done .step-circle {
    border-color: var(--vert);
    background: var(--vert);
    color: white;
  }

  .step-label {
    font-size: 0.72rem;
    text-align: center;
    color: var(--ardoise-clair);
    font-weight: 600;
    max-width: 80px;
    display: none;
  }

  .step.active .step-label { color: var(--orange-casto-fonce); display: block; }

  @media (min-width: 640px) {
    .step-label { display: block; }
  }

  /* FORM CARD */
  .form-card {
    background: white;
    border-radius: 20px;
    padding: 36px;
    margin: 24px 0 60px;
    box-shadow: 0 10px 40px rgba(0, 61, 124, 0.06);
  }

  .form-step { display: none; }
  .form-step.active {
    display: block;
    animation: fadeIn 0.35s ease;
  }

  @keyframes fadeIn {
    from { opacity: 0; transform: translateY(8px); }
    to { opacity: 1; transform: translateY(0); }
  }

  .form-step h2 {
    font-size: 1.5rem;
    margin-bottom: 6px;
  }

  .step-intro {
    color: var(--ardoise-clair);
    font-size: 0.96rem;
    margin-bottom: 28px;
  }

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

  .field-grid .full { grid-column: 1 / -1; }

  @media (max-width: 560px) {
    .field-grid { grid-template-columns: 1fr; }
  }

  .field {
    display: flex;
    flex-direction: column;
    gap: 6px;
  }

  .field label {
    font-size: 0.88rem;
    font-weight: 600;
    color: var(--ardoise);
  }

  .field label .opt {
    color: var(--ardoise-clair);
    font-weight: 400;
    font-style: italic;
  }

  .field label .req {
    color: var(--danger);
  }

  .field input, .field select {
    border: 1.5px solid var(--bordure);
    border-radius: 10px;
    padding: 12px 14px;
    font-size: 0.96rem;
    font-family: inherit;
    color: var(--ardoise);
    background: white;
    transition: border-color 0.15s, box-shadow 0.15s;
  }

  .field input:focus, .field select:focus {
    outline: none;
    border-color: var(--bleu-cftc);
    box-shadow: 0 0 0 3px rgba(0, 61, 124, 0.08);
  }

  .field .hint {
    font-size: 0.8rem;
    color: var(--ardoise-clair);
  }

  .field .hint a { font-weight: 600; }

  /* RADIO / CHOICE CARDS */
  .choice-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
    margin-bottom: 6px;
  }

  @media (max-width: 560px) {
    .choice-grid { grid-template-columns: 1fr; }
  }

  .choice-card {
    border: 1.5px solid var(--bordure);
    border-radius: 12px;
    padding: 14px 16px;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 12px;
    transition: border-color 0.15s, background 0.15s;
    position: relative;
  }

  .choice-card:hover {
    border-color: var(--bleu-cftc);
  }

  .choice-card input {
    position: absolute;
    opacity: 0;
  }

  .choice-card .radio-dot {
    width: 18px;
    height: 18px;
    border-radius: 50%;
    border: 2px solid var(--bordure);
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: border-color 0.15s;
  }

  .choice-card .radio-dot::after {
    content: '';
    width: 9px;
    height: 9px;
    border-radius: 50%;
    background: var(--bleu-cftc);
    transform: scale(0);
    transition: transform 0.15s;
  }

  .choice-card input:checked ~ .radio-dot {
    border-color: var(--bleu-cftc);
  }

  .choice-card input:checked ~ .radio-dot::after {
    transform: scale(1);
  }

  .choice-card:has(input:checked) {
    border-color: var(--bleu-cftc);
    background: var(--bleu-clair);
  }

  .choice-card .choice-text {
    font-size: 0.94rem;
    font-weight: 600;
  }

  .choice-card .choice-sub {
    font-size: 0.8rem;
    color: var(--ardoise-clair);
    font-weight: 400;
    display: block;
  }

  /* CONDITIONAL UPLOAD */
  .upload-box {
    display: none;
    border: 1.5px dashed var(--bordure);
    border-radius: 12px;
    padding: 18px;
    margin-top: 14px;
    background: var(--bleu-clair);
    font-size: 0.9rem;
  }

  .upload-box.visible { display: block; }

  .upload-box label {
    font-weight: 600;
    display: block;
    margin-bottom: 8px;
  }

  /* COTISATION TABLE */
  .cotis-options {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-bottom: 22px;
  }

  .cotis-card {
    border: 1.5px solid var(--bordure);
    border-radius: 12px;
    padding: 16px 18px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    cursor: pointer;
    transition: border-color 0.15s, background 0.15s;
    flex-wrap: wrap;
  }

  .cotis-card:has(input:checked) {
    border-color: var(--bleu-cftc);
    background: var(--bleu-clair);
  }

  .cotis-card input { position: absolute; opacity: 0; }

  .cotis-left {
    display: flex;
    align-items: center;
    gap: 12px;
  }

  .cotis-name {
    font-weight: 700;
    font-size: 0.96rem;
  }

  .cotis-detail {
    font-size: 0.82rem;
    color: var(--ardoise-clair);
  }

  .cotis-amount {
    text-align: right;
  }

  .cotis-amount strong {
    font-size: 1.15rem;
    color: var(--bleu-cftc);
  }

  .cotis-amount span {
    display: block;
    font-size: 0.78rem;
    color: var(--vert);
    font-weight: 600;
  }

  .periodicity-toggle {
    display: flex;
    background: var(--bleu-clair);
    border-radius: 100px;
    padding: 4px;
    margin-bottom: 24px;
    width: fit-content;
  }

  .periodicity-toggle button {
    border: none;
    background: transparent;
    padding: 9px 22px;
    border-radius: 100px;
    font-weight: 700;
    font-size: 0.88rem;
    font-family: inherit;
    color: var(--ardoise-clair);
    cursor: pointer;
    transition: all 0.2s;
  }

  .periodicity-toggle button.active {
    background: var(--bleu-cftc);
    color: white;
  }

  .summary-box {
    background: var(--bleu-clair);
    border-radius: 12px;
    padding: 18px 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 8px;
  }

  .summary-box .label {
    font-size: 0.85rem;
    color: var(--ardoise-clair);
    font-weight: 600;
  }

  .summary-box .value {
    font-family: 'Fraunces', serif;
    font-size: 1.7rem;
    color: var(--bleu-cftc);
    font-weight: 700;
  }

  .summary-box .deduction {
    font-size: 0.85rem;
    color: var(--vert);
    font-weight: 600;
  }

  /* CONSENT CHECKBOXES */
  .consent-block {
    display: flex;
    flex-direction: column;
    gap: 16px;
  }

  .consent-item {
    display: flex;
    gap: 12px;
    align-items: flex-start;
    padding: 16px;
    border: 1.5px solid var(--bordure);
    border-radius: 12px;
    background: #fafcff;
  }

  .consent-item input {
    margin-top: 3px;
    width: 18px;
    height: 18px;
    flex-shrink: 0;
    accent-color: var(--bleu-cftc);
  }

  .consent-item label {
    font-size: 0.9rem;
    color: var(--ardoise);
  }

  .consent-item label a { font-weight: 600; }

  /* SIGNATURE PAD */
  .signature-pad-wrap {
    border: 1.5px solid var(--bordure);
    border-radius: 12px;
    overflow: hidden;
    background: #fafcff;
  }

  .signature-pad-wrap canvas {
    width: 100%;
    height: 160px;
    display: block;
    cursor: crosshair;
    touch-action: none;
  }

  .signature-toolbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 14px;
    border-top: 1px solid var(--bordure);
    font-size: 0.82rem;
    color: var(--ardoise-clair);
  }

  .signature-toolbar button {
    border: none;
    background: none;
    font-weight: 700;
    color: var(--bleu-cftc);
    cursor: pointer;
    font-size: 0.82rem;
  }

  /* SUMMARY / RECAP */
  .recap-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
    margin-bottom: 24px;
  }

  @media (max-width: 560px) {
    .recap-grid { grid-template-columns: 1fr; }
  }

  .recap-block {
    border: 1.5px solid var(--bordure);
    border-radius: 12px;
    padding: 16px 18px;
  }

  .recap-block h3 {
    font-size: 0.95rem;
    margin-bottom: 10px;
    color: var(--bleu-cftc);
  }

  .recap-block dl {
    display: grid;
    grid-template-columns: auto 1fr;
    gap: 4px 12px;
    font-size: 0.86rem;
  }

  .recap-block dt {
    color: var(--ardoise-clair);
  }

  .recap-block dd {
    font-weight: 600;
    text-align: right;
  }

  /* NAV BUTTONS */
  .form-nav {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 32px;
    gap: 12px;
  }

  .btn-primary, .btn-secondary, .btn-ghost {
    font-family: inherit;
    font-weight: 700;
    font-size: 0.96rem;
    border-radius: 100px;
    padding: 13px 28px;
    cursor: pointer;
    border: none;
    transition: transform 0.15s, box-shadow 0.15s, background 0.2s;
    display: inline-flex;
    align-items: center;
    gap: 8px;
  }

  .btn-primary {
    background: var(--orange-casto);
    color: white;
  }

  .btn-primary:hover {
    background: var(--orange-casto-fonce);
    transform: translateY(-2px);
  }

  .btn-primary:disabled,
  .btn-ghost:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
  }

  .btn-secondary {
    background: white;
    color: var(--bleu-cftc);
    border: 2px solid var(--bordure);
  }

  .btn-secondary:hover {
    border-color: var(--bleu-cftc);
  }

  .btn-ghost {
    background: none;
    color: var(--ardoise-clair);
    padding: 13px 10px;
  }

  /* SAVE NOTICE */
  .save-notice {
    text-align: center;
    font-size: 0.82rem;
    color: var(--ardoise-clair);
    margin-top: 16px;
  }

  .save-notice strong { color: var(--vert); }

  /* TOOLTIP */
  .tooltip-wrap {
    position: relative;
    display: inline-flex;
    align-items: center;
    gap: 4px;
  }

  .tooltip-icon {
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: var(--bordure);
    color: var(--bleu-cftc);
    font-size: 0.72rem;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: help;
    flex-shrink: 0;
  }

  /* CONFIRMATION SCREEN */
  .confirm-screen {
    text-align: center;
    padding: 20px 0;
  }

  .confirm-icon {
    width: 72px;
    height: 72px;
    border-radius: 50%;
    background: var(--vert);
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 24px;
  }

  .confirm-screen h2 {
    margin-bottom: 12px;
  }

  .confirm-screen p {
    color: var(--ardoise-clair);
    max-width: 440px;
    margin: 0 auto 28px;
  }

  fieldset {
    border: none;
    padding: 0;
    margin: 0 0 24px 0;
  }

  legend {
    font-weight: 700;
    font-size: 1.02rem;
    color: var(--bleu-cftc);
    margin-bottom: 12px;
    padding: 0;
  }

  :focus-visible {
    outline: 3px solid var(--bleu-ciel);
    outline-offset: 2px;
  }
