/* =====================================================
   Firma Contratto – Public Styles  v2.0
   ===================================================== */

/* ---- Custom properties ---- */
.fc-container {
  --fc-primary:      #4f46e5;
  --fc-primary-h:    #4338ca;
  --fc-primary-rgb:  79, 70, 229;
  --fc-success:      #059669;
  --fc-success-bg:   #ecfdf5;
  --fc-danger:       #dc2626;
  --fc-danger-bg:    #fef2f2;
  --fc-warning:      #d97706;
  --fc-gray-50:      #f8fafc;
  --fc-gray-100:     #f1f5f9;
  --fc-gray-200:     #e2e8f0;
  --fc-gray-300:     #cbd5e1;
  --fc-gray-400:     #94a3b8;
  --fc-gray-500:     #64748b;
  --fc-gray-600:     #475569;
  --fc-gray-700:     #334155;
  --fc-gray-900:     #0f172a;
  --fc-white:        #ffffff;
  --fc-radius-sm:    6px;
  --fc-radius:       12px;
  --fc-radius-lg:    16px;
  --fc-shadow-xs:    0 1px 2px rgba(0,0,0,.05);
  --fc-shadow:       0 1px 3px rgba(0,0,0,.07), 0 1px 2px rgba(0,0,0,.05);
  --fc-shadow-md:    0 4px 24px rgba(0,0,0,.08), 0 1px 4px rgba(0,0,0,.04);
  --fc-shadow-lg:    0 10px 40px rgba(0,0,0,.12), 0 2px 8px rgba(0,0,0,.06);
  --fc-font:         -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Inter', Roboto, sans-serif;
  --fc-input-h:      52px;
  --fc-transition:   .18s ease;
}

/* =====================================================
   CONTAINER
   ===================================================== */
.fc-container {
  font-family: var(--fc-font);
  max-width: 820px;
  margin: 0 auto;
  padding: 32px 16px 48px;
  color: var(--fc-gray-700);
  -webkit-font-smoothing: antialiased;
}

/* =====================================================
   STEP INDICATOR
   ===================================================== */
.fc-steps {
  display: flex;
  align-items: flex-start;
  justify-content: center;
  gap: 0;
  margin-bottom: 36px;
  padding: 0 8px;
}

.fc-step {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  position: relative;
  opacity: .38;
  transition: opacity .35s;
  min-width: 56px;
}
.fc-step.active, .fc-step.done { opacity: 1; }

.fc-step-icon {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: var(--fc-gray-200);
  color: var(--fc-gray-500);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 14px;
  transition: background .3s, color .3s, box-shadow .3s;
  position: relative;
  z-index: 1;
  flex-shrink: 0;
}
.fc-step.active .fc-step-icon {
  background: var(--fc-primary);
  color: #fff;
  box-shadow: 0 0 0 5px rgba(var(--fc-primary-rgb), .18);
}
.fc-step.done .fc-step-icon {
  background: var(--fc-success);
  color: #fff;
}
.fc-step.done .fc-step-icon::after {
  content: '✓';
}
.fc-step.done .fc-step-number { display: none; }

.fc-step-label {
  font-size: 11px;
  font-weight: 600;
  color: var(--fc-gray-500);
  white-space: nowrap;
  letter-spacing: .02em;
  text-transform: uppercase;
}
.fc-step.active .fc-step-label { color: var(--fc-primary); }
.fc-step.done  .fc-step-label { color: var(--fc-success); }

.fc-step-connector {
  flex: 1;
  height: 2px;
  background: var(--fc-gray-200);
  min-width: 24px;
  max-width: 80px;
  margin-top: 19px;  /* allineato al centro dell'icona */
  transition: background .3s;
}
.fc-step.done ~ .fc-step-connector { background: var(--fc-success); }

/* =====================================================
   ALERTS
   ===================================================== */
.fc-alert {
  padding: 13px 16px;
  border-radius: var(--fc-radius-sm);
  margin-bottom: 18px;
  font-size: 14px;
  font-weight: 500;
  display: flex;
  align-items: flex-start;
  gap: 10px;
  line-height: 1.5;
  animation: fc-fade-in .2s ease;
}
.fc-alert-error {
  background: var(--fc-danger-bg);
  color: var(--fc-danger);
  border: 1px solid #fecaca;
}
.fc-alert-info {
  background: #eff6ff;
  color: #1d4ed8;
  border: 1px solid #bfdbfe;
}

@keyframes fc-fade-in {
  from { opacity:0; transform:translateY(-4px); }
  to   { opacity:1; transform:translateY(0); }
}

/* =====================================================
   PANEL (carta)
   ===================================================== */
.fc-panel {
  background: var(--fc-white);
  border: 1px solid var(--fc-gray-200);
  border-radius: var(--fc-radius-lg);
  box-shadow: var(--fc-shadow-md);
  overflow: hidden;
  animation: fc-fade-in .25s ease;
}

.fc-panel-header {
  padding: 28px 32px 0;
}
.fc-panel-title {
  font-size: 20px;
  font-weight: 700;
  color: var(--fc-gray-900);
  margin: 0 0 4px;
  line-height: 1.3;
}
.fc-panel-subtitle {
  font-size: 13px;
  color: var(--fc-gray-500);
  margin: 0 0 24px;
}
.fc-panel-divider {
  height: 1px;
  background: var(--fc-gray-100);
  margin: 0 32px;
}

.fc-panel-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 32px;
  gap: 12px;
}
.fc-panel-footer > *:only-child { margin-left: auto; }

/* =====================================================
   FORM FIELDS  –  label colonna sinistra, input colonna destra
   Layout: griglia 2 colonne; radio / gruppi a scelta = riga intera (non affiancati).
   ===================================================== */
.fc-data-form { padding: 28px 32px 8px; }

@media (min-width: 681px) {
  .fc-cf7-content,
  .fc-fields-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    column-gap: 20px;
    row-gap: 0;
    align-items: stretch;
  }
  .fc-cf7-content > *:not(.fc-field-wrap) {
    grid-column: 1 / -1;
  }
  /* Gruppi radio (e qualsiasi wrap con .fc-radio-group): non spezzare in 2 col — stesso “blocco” */
  .fc-cf7-content .fc-field-wrap.fc-wrap-radio,
  .fc-fields-grid .fc-field-wrap.fc-wrap-radio,
  .fc-cf7-content .fc-field-wrap:has(.fc-radio-group) {
    grid-column: 1 / -1;
  }

  /* Riga a 3 colonne: CAP, email, telefono (wrapper .fc-inline-fields-row da form-wrapper) */
  .fc-cf7-content > .fc-inline-fields-row {
    grid-column: 1 / -1;
    display: grid;
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    column-gap: 20px;
    row-gap: 0;
    align-items: start;
    border-bottom: 1px solid var(--fc-gray-100);
  }
  .fc-cf7-content > .fc-inline-fields-row .fc-field-wrap {
    grid-template-columns: 1fr;
    border-bottom: none;
    padding: 16px 0;
  }
  .fc-cf7-content > .fc-inline-fields-row .fc-label {
    padding-top: 0;
  }
  .fc-cf7-content > .fc-inline-fields-row .fc-field-input-col {
    min-width: 0;
  }
}

/* Ignora classi di larghezza: ogni campo occupa sempre tutta la riga */
.fc-col-full,
.fc-col-half,
.fc-col-third { flex: 0 0 100%; }

/* --------------------------------------------------------
   Riga campo: griglia a 2 colonne
   Colonna sinistra = label (larghezza fissa identica)
   Colonna destra   = input (resto dello spazio)
   -------------------------------------------------------- */
.fc-field-wrap {
  display: grid;
  grid-template-columns: 180px 1fr;
  column-gap: 20px;
  align-items: start;
  padding: 16px 0;
  border-bottom: 1px solid var(--fc-gray-100);
  position: relative;
}
.fc-field-wrap:last-child {
  border-bottom: none;
}

/* Checkbox e radio occupano tutta la riga (label dentro l'input) */
.fc-field-wrap.fc-wrap-checkbox,
.fc-field-wrap.fc-wrap-radio {
  grid-template-columns: 1fr;
}

/* Label – colonna sinistra */
.fc-label {
  font-size: 14px;
  font-weight: 600;
  color: var(--fc-gray-600);
  padding-top: 13px;   /* allineato verticalmente con l'input */
  line-height: 1.4;
  transition: color var(--fc-transition);
}
/* Testo e asterisco obbligatorio sulla stessa riga (no a capo del *) */
label.fc-label--with-text,
label.fc-label.fc-label--with-text {
  display: inline-flex;
  flex-direction: row;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 0.2em 0.35em;
  max-width: 100%;
}
.fc-label--with-text .fc-label-text {
  min-width: 0;
}
.fc-label--with-text .fc-asterisk {
  flex-shrink: 0;
  white-space: nowrap;
  margin-left: 0;
}
.fc-field-wrap:focus-within .fc-label { color: var(--fc-primary); }
.fc-asterisk { color: var(--fc-danger); margin-left: 2px; }
.fc-label--with-text .fc-asterisk { margin-left: 0; }

/* Colonna destra: input + errore */
.fc-field-input-col {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

/* Input, select, textarea */
.fc-input {
  width: 100%;
  height: 44px;
  padding: 0 14px;
  border: 1.5px solid var(--fc-gray-300);
  border-radius: var(--fc-radius-sm);
  font-size: 13px;
  color: var(--fc-gray-900);
  background: var(--fc-white);
  transition: border-color var(--fc-transition), box-shadow var(--fc-transition), background var(--fc-transition);
  box-sizing: border-box;
  font-family: var(--fc-font);
  outline: none;
  -webkit-appearance: none;
  appearance: none;
}
.fc-input:hover:not(:focus) { border-color: var(--fc-gray-400); }
.fc-input:focus {
  border-color: var(--fc-primary);
  box-shadow: 0 0 0 3px rgba(var(--fc-primary-rgb), .12);
  background: #fafbff;
}
.fc-input::placeholder { color: var(--fc-gray-400); }
.fc-input.fc-error {
  border-color: var(--fc-danger);
  box-shadow: 0 0 0 3px rgba(220,38,38,.1);
}

textarea.fc-input {
  height: auto;
  min-height: 96px;
  padding: 10px 14px;
  resize: vertical;
  line-height: 1.6;
  font-size: 13px;
}

.fc-select {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='9' viewBox='0 0 14 9'%3E%3Cpath d='M1 1l6 6 6-6' stroke='%2394a3b8' stroke-width='1.8' fill='none' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  padding-right: 36px;
  cursor: pointer;
}
.fc-select:focus {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='9' viewBox='0 0 14 9'%3E%3Cpath d='M1 1l6 6 6-6' stroke='%234f46e5' stroke-width='1.8' fill='none' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
}

/* Radio */
.fc-radio-group {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.fc-radio-label {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 13px;
  cursor: pointer;
  padding: 10px 13px;
  border: 1.5px solid var(--fc-gray-200);
  border-radius: var(--fc-radius-sm);
  transition: border-color var(--fc-transition), background var(--fc-transition);
}
.fc-radio-label:hover { border-color: var(--fc-gray-400); background: var(--fc-gray-50); }
.fc-radio-label input[type=radio] { accent-color: var(--fc-primary); width:15px; height:15px; flex-shrink:0; }
.fc-radio-label:has(input:checked) {
  border-color: var(--fc-primary);
  background: #eff6ff;
  color: var(--fc-primary);
  font-weight: 500;
}

/* Checkbox */
.fc-checkbox-label {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  font-size: 13px;
  cursor: pointer;
  padding: 13px;
  border: 1.5px solid var(--fc-gray-200);
  border-radius: var(--fc-radius-sm);
  line-height: 1.5;
  transition: border-color var(--fc-transition), background var(--fc-transition);
  width: 100%;
  box-sizing: border-box;
}
.fc-checkbox-label:hover { border-color: var(--fc-gray-400); }
.fc-checkbox-label input[type=checkbox] { accent-color: var(--fc-primary); width:17px; height:17px; flex-shrink:0; margin-top:1px; }
.fc-checkbox-label:has(input:checked) { border-color: var(--fc-primary); background: #eff6ff; }

/* Errore campo */
.fc-field-error {
  font-size: 11.5px;
  color: var(--fc-danger);
  min-height: 0;
  display: flex;
  align-items: center;
  gap: 4px;
  line-height: 1.3;
}
.fc-field-error:not(:empty)::before { content: '⚠ '; }

/* Nasconde le righe hidden */
.fc-wrap-hidden { display: none; }

/* Empty form */
.fc-empty-form {
  text-align: center;
  color: var(--fc-gray-400);
  font-size: 13px;
  padding: 24px 0;
  grid-column: 1 / -1;
}

/* =====================================================
   BUTTONS
   ===================================================== */
.fc-btn-next,
.fc-btn-sign {
  background: var(--fc-primary);
  color: #fff;
  border: none;
  padding: 0 28px;
  height: 48px;
  border-radius: var(--fc-radius-sm);
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  transition: background var(--fc-transition), transform var(--fc-transition), box-shadow var(--fc-transition);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font-family: var(--fc-font);
  letter-spacing: .01em;
  box-shadow: 0 1px 3px rgba(var(--fc-primary-rgb), .35), 0 4px 12px rgba(var(--fc-primary-rgb), .2);
  white-space: nowrap;
}
.fc-btn-next:hover,
.fc-btn-sign:hover {
  background: var(--fc-primary-h);
  box-shadow: 0 2px 6px rgba(var(--fc-primary-rgb), .4), 0 6px 20px rgba(var(--fc-primary-rgb), .25);
  transform: translateY(-1px);
}
.fc-btn-next:active,  .fc-btn-sign:active  { transform: translateY(0) scale(.98); box-shadow: none; }
.fc-btn-next:disabled,.fc-btn-sign:disabled { background: var(--fc-gray-300); color: var(--fc-gray-500); box-shadow: none; cursor: not-allowed; transform: none; }

.fc-arrow { transition: transform var(--fc-transition); }
.fc-btn-next:hover .fc-arrow { transform: translateX(3px); }

.fc-btn-back {
  background: transparent;
  color: var(--fc-gray-600);
  border: 1.5px solid var(--fc-gray-200);
  padding: 0 22px;
  height: 48px;
  border-radius: var(--fc-radius-sm);
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: all var(--fc-transition);
  font-family: var(--fc-font);
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.fc-btn-back:hover {
  background: var(--fc-gray-100);
  border-color: var(--fc-gray-400);
  color: var(--fc-gray-900);
}

.fc-btn-download {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  background: var(--fc-success);
  color: #fff;
  padding: 0 32px;
  height: 52px;
  border-radius: var(--fc-radius-sm);
  font-size: 15px;
  font-weight: 600;
  text-decoration: none;
  transition: all var(--fc-transition);
  box-shadow: 0 2px 8px rgba(5,150,105,.3);
}
.fc-btn-download:hover {
  background: #047857;
  color: #fff;
  transform: translateY(-1px);
  box-shadow: 0 4px 16px rgba(5,150,105,.35);
}

/* =====================================================
   CONTRACT PREVIEW  (step 2)
   ===================================================== */
.fc-contract-scroll {
  margin: 0 32px;
  max-height: 420px;
  overflow-y: auto;
  border: 1px solid var(--fc-gray-200);
  border-radius: var(--fc-radius-sm);
  background: var(--fc-gray-50);
  scrollbar-width: thin;
  scrollbar-color: var(--fc-gray-300) transparent;
}
.fc-contract-scroll::-webkit-scrollbar { width:5px; }
.fc-contract-scroll::-webkit-scrollbar-track { background: transparent; }
.fc-contract-scroll::-webkit-scrollbar-thumb { background: var(--fc-gray-300); border-radius: 99px; }
.fc-contract-body {
  padding: 28px 32px;
  font-size: 14px;
  line-height: 1.7;
  color: var(--fc-gray-700);
  white-space: pre-wrap;   /* rispetta \n nel testo plain-text del template */
  word-break: break-word;
}
/* Se il template ha HTML (es. <p>, <br>), disabilita pre-wrap */
.fc-contract-body p,
.fc-contract-body br,
.fc-contract-body h1,
.fc-contract-body h2,
.fc-contract-body h3 { white-space: normal; }
.fc-contract-body h1 { font-size: 17px; }
.fc-contract-body h2 { font-size: 15px; }
.fc-contract-body h3 { font-size: 14px; }
.fc-contract-body h1,.fc-contract-body h2,.fc-contract-body h3 { color:var(--fc-gray-900); margin-top:1.2em; }
.fc-contract-body p { margin-bottom:.8em; }

.fc-accept-notice {
  margin: 16px 32px 0;
  font-size: 13px;
  color: var(--fc-gray-500);
  text-align: center;
}

/* =====================================================
   SIGNATURE STEP  (step 3)
   ===================================================== */
.fc-sign-tabs {
  display: flex;
  gap: 10px;
  padding: 0 32px 20px;
}
.fc-sign-tab {
  flex: 1;
  padding: 12px 16px;
  border: 2px solid var(--fc-gray-200);
  border-radius: var(--fc-radius-sm);
  background: var(--fc-white);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: all var(--fc-transition);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font-family: var(--fc-font);
  text-align: center;
  color: var(--fc-gray-600);
}
.fc-sign-tab:hover { border-color: var(--fc-gray-400); background: var(--fc-gray-50); color: var(--fc-gray-900); }
.fc-sign-tab.active {
  background: linear-gradient(135deg, #4f46e5, #7c3aed);
  border-color: transparent;
  color: #fff;
  box-shadow: 0 2px 10px rgba(var(--fc-primary-rgb),.35);
}

.fc-sign-panel { padding: 0 32px 20px; }
.fc-sign-label {
  font-size: 12px;
  font-weight: 600;
  color: var(--fc-gray-500);
  text-transform: uppercase;
  letter-spacing: .04em;
  margin-bottom: 10px;
  display: block;
}
.fc-sign-desc { font-size: 13px; color: var(--fc-gray-500); margin-bottom: 14px; line-height: 1.5; }

/* Canvas firma */
.fc-canvas-container {
  position: relative;
  width: 100%;
  border-radius: var(--fc-radius-sm);
  overflow: hidden;
}
.fc-signature-canvas {
  display: block;
  width: 100%;
  height: 180px;
  cursor: crosshair;
  touch-action: none;
  background: var(--fc-gray-50);
  border: 2px dashed var(--fc-gray-300);
  border-radius: var(--fc-radius-sm);
  transition: border-color var(--fc-transition), background var(--fc-transition);
}
.fc-signature-canvas:hover { border-color: var(--fc-gray-400); }
.fc-signature-canvas.has-sig {
  border-color: var(--fc-primary);
  border-style: solid;
  background: #fff;
}
.fc-canvas-hint {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  pointer-events: none;
  font-size: 13px;
  color: var(--fc-gray-400);
  gap: 8px;
  transition: opacity .2s;
}
.fc-signature-canvas.has-sig ~ .fc-canvas-hint { opacity: 0; }

.fc-clear-signature {
  position: absolute;
  top: 8px;
  right: 8px;
  background: rgba(255,255,255,.95);
  border: 1px solid var(--fc-gray-200);
  border-radius: var(--fc-radius-sm);
  padding: 5px 12px;
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  transition: all var(--fc-transition);
  backdrop-filter: blur(4px);
}
.fc-clear-signature:hover {
  background: var(--fc-danger-bg);
  color: var(--fc-danger);
  border-color: #fca5a5;
}

/* OTP */
.fc-otp-form { margin-top: 4px; }

.fc-otp-contact-row {
  display: flex;
  gap: 10px;
  align-items: flex-end;
  margin-bottom: 18px;
}
.fc-otp-contact-row .fc-input {
  flex: 1;
  max-width: none;
}

.fc-btn-send-otp,
.fc-btn-verify-otp,
.fc-btn-resend-otp {
  height: var(--fc-input-h);
  padding: 0 20px;
  border-radius: var(--fc-radius-sm);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  font-family: var(--fc-font);
  transition: all var(--fc-transition);
  white-space: nowrap;
  border: none;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.fc-btn-send-otp,
.fc-btn-verify-otp {
  background: var(--fc-primary);
  color: #fff;
  box-shadow: 0 1px 4px rgba(var(--fc-primary-rgb),.3);
}
.fc-btn-send-otp:hover,
.fc-btn-verify-otp:hover { background: var(--fc-primary-h); }

.fc-btn-resend-otp {
  background: transparent;
  border: 1.5px solid var(--fc-gray-200);
  color: var(--fc-gray-600);
}
.fc-btn-resend-otp:hover { background: var(--fc-gray-100); border-color: var(--fc-gray-400); }

.fc-otp-verify-row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
}
.fc-otp-code {
  max-width: 180px;
  letter-spacing: 6px;
  font-size: 20px;
  font-weight: 700;
  text-align: center;
  height: var(--fc-input-h);
}
.fc-otp-sent-msg {
  font-size: 13px;
  color: var(--fc-success);
  width: 100%;
  margin: 0 0 8px;
  display: flex;
  align-items: center;
  gap: 6px;
  font-weight: 500;
}
.fc-success-msg {
  color: var(--fc-success);
  font-weight: 600;
  font-size: 14px;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 12px 14px;
  background: var(--fc-success-bg);
  border-radius: var(--fc-radius-sm);
  border: 1px solid #a7f3d0;
  width: 100%;
}

/* =====================================================
   SUCCESS SCREEN  (step 4)
   ===================================================== */
.fc-success-screen {
  text-align: center;
  padding: 52px 32px 44px;
}
.fc-success-icon {
  font-size: 64px;
  margin-bottom: 20px;
  display: block;
  animation: fc-pop .4s cubic-bezier(.34,1.56,.64,1);
}
@keyframes fc-pop {
  from { transform: scale(.4); opacity:0; }
  to   { transform: scale(1);  opacity:1; }
}
.fc-success-screen h2 {
  font-size: 24px;
  font-weight: 700;
  color: var(--fc-gray-900);
  margin: 0 0 12px;
}
.fc-success-text {
  font-size: 15px;
  color: var(--fc-gray-600);
  margin-bottom: 32px;
  line-height: 1.6;
  max-width: 360px;
  margin-left: auto;
  margin-right: auto;
}
.fc-success-actions { display: flex; justify-content: center; gap: 12px; flex-wrap: wrap; }

/* =====================================================
   LOADING SPINNER
   ===================================================== */
.fc-loading-spinner {
  width: 36px;
  height: 36px;
  border: 3px solid var(--fc-gray-200);
  border-top-color: var(--fc-primary);
  border-radius: 50%;
  animation: fc-spin .7s linear infinite;
  margin: 48px auto;
}
@keyframes fc-spin { to { transform: rotate(360deg); } }

/* =====================================================
   CF7 WRAPPER
   ===================================================== */
.fc-cf7-wrapper { padding: 8px 32px 16px; }

/* Contenuto HTML libero del template CF7 */
.fc-cf7-content {
  font-size: 14px;
  line-height: 1.7;
  color: var(--fc-gray-700);
}
.fc-cf7-content p,
.fc-data-form p {
  font-size: 14px;
  line-height: 1.7;
}
.fc-cf7-content h2, .fc-cf7-content h3, .fc-cf7-content h5 {
  color: var(--fc-gray-900);
  margin: 16px 0 8px;
}
.fc-cf7-content h2 { font-size: 14px; }
.fc-cf7-content h3 { font-size: 23px; }
.fc-cf7-content h5 { font-size: 18px; }
.fc-cf7-content hr { border: none; border-top: 1px solid var(--fc-gray-200); margin: 20px 0; }
/* margin solo sui div di contenuto libero, non sui .fc-field-wrap (griglia step 1) */
.fc-cf7-content div:not(.fc-field-wrap) { margin-bottom: 12px; }
.fc-cf7-content > .fc-field-wrap { margin-bottom: 0; }
.fc-cf7-content center { text-align: center; }

/* Sezioni con bordo rosso (template CF7): 97% e centrate (backup: lo stile inline in PHP ha !important) */
.fc-cf7-content .fc-cf7-box-red,
.fc-cf7-content div[style*='1px solid red'] {
  width: 97% !important;
  max-width: 97% !important;
  min-width: 0 !important;
  box-sizing: border-box !important;
  margin-left: auto !important;
  margin-right: auto !important;
}

.fc-cf7-note {
  font-size: 12px;
  color: var(--fc-gray-400);
  text-align: center;
  margin-top: 16px;
  line-height: 1.5;
}

/* =====================================================
   RESPONSIVE  –  mobile first
   ===================================================== */
@media (max-width: 680px) {
  .fc-container { padding: 20px 12px 40px; }

  /* Step bar: compatta */
  .fc-step-label { display: none; }
  .fc-step-connector { min-width: 16px; max-width: 40px; }
  .fc-step-icon { width: 34px; height: 34px; font-size: 13px; }

  /* Pannello */
  .fc-panel { border-radius: var(--fc-radius); }
  .fc-panel-header { padding: 20px 16px 0; }
  .fc-panel-title { font-size: 17px; }
  .fc-panel-divider { margin: 0 16px; }
  .fc-panel-footer {
    flex-direction: column-reverse;
    padding: 16px;
  }
  .fc-panel-footer > * { width: 100%; }
  .fc-btn-next, .fc-btn-sign, .fc-btn-back {
    width: 100%;
    justify-content: center;
  }

  /* Form: niente 2+3 griglia, una colonna */
  .fc-fields-grid,
  .fc-cf7-content {
    display: block;
  }
  .fc-cf7-content > *:not(.fc-field-wrap) { grid-column: unset; }

  .fc-cf7-content > .fc-inline-fields-row {
    display: block;
    border-bottom: none;
  }
  .fc-cf7-content > .fc-inline-fields-row .fc-field-wrap {
    border-bottom: 1px solid var(--fc-gray-100);
  }

  /* Form: su mobile label sopra, input sotto (colonna singola) */
  .fc-data-form { padding: 12px 16px 4px; }
  .fc-field-wrap {
    grid-template-columns: 1fr;     /* label e input impilati */
    padding: 14px 0;
  }
  .fc-label { padding-top: 0; margin-bottom: 6px; font-size: 14px; }

  /* Sign */
  .fc-sign-tabs { flex-direction: column; padding: 0 16px 16px; }
  .fc-sign-panel { padding: 0 16px 16px; }
  .fc-contract-scroll { margin: 0 16px; }
  .fc-contract-body { padding: 16px; }
  .fc-accept-notice { margin: 10px 16px 0; }

  /* OTP */
  .fc-otp-contact-row { flex-direction: column; align-items: stretch; }
  .fc-btn-send-otp { width: 100%; justify-content: center; }
  .fc-otp-verify-row { flex-direction: column; align-items: stretch; }
  .fc-otp-code { max-width: 100%; }
  .fc-btn-verify-otp, .fc-btn-resend-otp { width: 100%; justify-content: center; }

  /* CF7 */
  .fc-cf7-wrapper { padding: 8px 16px 16px; }

  /* Success */
  .fc-success-screen { padding: 40px 16px 32px; }
  .fc-success-screen h2 { font-size: 20px; }
}

@media (min-width: 681px) and (max-width: 820px) {
  .fc-container { padding: 28px 20px 48px; }
  .fc-field-wrap { grid-template-columns: 160px 1fr; }
}
