/* tk-forms — frontend */
.tk-form {
    --tkf-accent:#7c3aed;
    --tkf-accent-d:#6d28d9;
    --tkf-btn-text:#ffffff;
    --tkf-border:#d1d5db;
    --tkf-radius:8px;
    --tkf-focus:rgba(124,58,237,.25);
    max-width:100%;
    margin:0 auto 1.5em;
}
.tk-form *{ box-sizing:border-box; }
.tk-form-grid{ display:flex; flex-wrap:wrap; gap:16px; }
.tk-field{ flex:1 1 100%; min-width:0; }
.tk-field-half{ flex:1 1 calc(50% - 8px); }
.tk-field-third{ flex:1 1 calc(33.333% - 11px); }
.tk-field-fourth{ flex:1 1 calc(25% - 12px); }
.tk-field-fifth{ flex:1 1 calc(20% - 13px); }
.tk-field-sixth{ flex:1 1 calc(16.666% - 14px); }
.tk-form-label{ display:block; font-weight:600; font-size:14px; letter-spacing:.01em; line-height:1.35; margin:0 0 8px; color:var(--tkf-text,inherit); }
.tk-form ::placeholder{ color:var(--tkf-placeholder,#9ca3af); opacity:1; }
.tk-req{ color:#dc2626; font-weight:700; margin-left:1px; }
/* Campi: doppio selettore .tk-form .tk-field per battere gli stili dei temi sugli input */
.tk-form .tk-field input[type=text],
.tk-form .tk-field input[type=email],
.tk-form .tk-field input[type=tel],
.tk-form .tk-field input[type=url],
.tk-form .tk-field input[type=number],
.tk-form .tk-field input[type=date],
:is(.tk-form,#tkf-x) .tk-field select,
.tk-form .tk-field textarea{
    display:block;
    width:100%;
    max-width:100%;
    height:auto;
    min-height:52px;
    margin:0;
    padding:14px 16px;
    border:1.5px solid var(--tkf-border);
    border-radius:var(--tkf-radius);
    font-family:inherit;
    font-size:15px;
    font-weight:400;
    background-color:var(--tkf-field-bg,#fff);
    color:var(--tkf-field-text,#111827);
    line-height:1.4;
    box-shadow:0 1px 2px rgba(15,23,42,.05);
    transition:border-color .18s ease, box-shadow .18s ease, background-color .18s ease;
    -webkit-appearance:none;
    appearance:none;
}
.tk-form .tk-field textarea{ resize:vertical; min-height:150px; }
.tk-form .tk-field input:hover,
:is(.tk-form,#tkf-x) .tk-field select:hover,
.tk-form .tk-field textarea:hover{ border-color:var(--tkf-border-h,#9ca3af); }
.tk-form .tk-field input:focus,
:is(.tk-form,#tkf-x) .tk-field select:focus,
.tk-form .tk-field textarea:focus{
    outline:0;
    border-color:var(--tkf-accent);
    box-shadow:0 0 0 4px var(--tkf-focus);
}
/* :is(.tk-form,#tkf-x) vale come un id: queste regole vincono anche sui CSS dei temi
   con selettori lunghi e !important (icone, frecce, errori, caselle). */
/* Icone nei campi più comuni (nome, cognome, email, telefono, messaggio) */
:is(.tk-form,#tkf-x) .tk-field-type-email input[type=email],
:is(.tk-form,#tkf-x) .tk-field-type-tel input[type=tel],
:is(.tk-form,#tkf-x) .tk-field-type-url input[type=url],
:is(.tk-form,#tkf-x) [data-tkf-name^="nome"] input[type=text],
:is(.tk-form,#tkf-x) [data-tkf-name^="cognome"] input[type=text],
:is(.tk-form,#tkf-x) [data-tkf-name^="name"] input[type=text],
:is(.tk-form,#tkf-x) [data-tkf-name="first_name"] input[type=text],
:is(.tk-form,#tkf-x) [data-tkf-name="last_name"] input[type=text],
:is(.tk-form,#tkf-x) [data-tkf-name*="azienda"] input[type=text],
:is(.tk-form,#tkf-x) [data-tkf-name*="citta"] input[type=text],
:is(.tk-form,#tkf-x) [data-tkf-name*="oggetto"] input[type=text]{
    padding-left:46px !important;
    background-repeat:no-repeat !important;
    background-position:16px 50% !important;
    background-size:18px 18px !important;
}
:is(.tk-form,#tkf-x) [data-tkf-name^="nome"] input[type=text],
:is(.tk-form,#tkf-x) [data-tkf-name^="cognome"] input[type=text],
:is(.tk-form,#tkf-x) [data-tkf-name^="name"] input[type=text],
:is(.tk-form,#tkf-x) [data-tkf-name="first_name"] input[type=text],
:is(.tk-form,#tkf-x) [data-tkf-name="last_name"] input[type=text]{
    background-image:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%239ca3af' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='12' cy='8' r='4'/%3E%3Cpath d='M4 21c0-4.4 3.6-7 8-7s8 2.6 8 7'/%3E%3C/svg%3E") !important;
}
:is(.tk-form,#tkf-x) .tk-field-type-email input[type=email]{
    background-image:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%239ca3af' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'%3E%3Crect x='3' y='5' width='18' height='14' rx='2.5'/%3E%3Cpath d='m4 7 8 6 8-6'/%3E%3C/svg%3E") !important;
}
:is(.tk-form,#tkf-x) .tk-field-type-tel input[type=tel]{
    background-image:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%239ca3af' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M5 4h3.5l1.8 4.5-2.3 1.4a11 11 0 0 0 6.1 6.1l1.4-2.3L20 15.5V19a2 2 0 0 1-2 2A16 16 0 0 1 3 6a2 2 0 0 1 2-2z'/%3E%3C/svg%3E") !important;
}
:is(.tk-form,#tkf-x) .tk-field-type-url input[type=url]{
    background-image:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%239ca3af' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='12' cy='12' r='9'/%3E%3Cpath d='M3 12h18M12 3a14 14 0 0 1 0 18M12 3a14 14 0 0 0 0 18'/%3E%3C/svg%3E") !important;
}
:is(.tk-form,#tkf-x) [data-tkf-name*="azienda"] input[type=text]{
    background-image:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%239ca3af' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'%3E%3Crect x='4' y='3' width='16' height='18' rx='2'/%3E%3Cpath d='M9 7h2M13 7h2M9 11h2M13 11h2M10 21v-4h4v4'/%3E%3C/svg%3E") !important;
}
:is(.tk-form,#tkf-x) [data-tkf-name*="citta"] input[type=text]{
    background-image:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%239ca3af' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M12 21s-7-6.2-7-11.5a7 7 0 0 1 14 0C19 14.8 12 21 12 21z'/%3E%3Ccircle cx='12' cy='9.5' r='2.5'/%3E%3C/svg%3E") !important;
}
:is(.tk-form,#tkf-x) [data-tkf-name*="oggetto"] input[type=text]{
    background-image:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%239ca3af' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M20 12.5 12.5 20a2 2 0 0 1-2.8 0L4 14.3V4h10.3l5.7 5.7a2 2 0 0 1 0 2.8z'/%3E%3Ccircle cx='8.5' cy='8.5' r='1.3'/%3E%3C/svg%3E") !important;
}
/* Tendina con freccia propria */
:is(.tk-form,#tkf-x) .tk-field select{
    padding-right:44px !important;
    cursor:pointer;
    background-image:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%236b7280' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E") !important;
    background-repeat:no-repeat !important;
    background-position:right 16px center !important;
    background-size:18px 18px !important;
}
:is(.tk-form,#tkf-x) .tk-field select::-ms-expand{ display:none; }
/* Errori */
:is(.tk-form,#tkf-x) .tk-field.tk-field-error input,
:is(.tk-form,#tkf-x) .tk-field.tk-field-error select,
:is(.tk-form,#tkf-x) .tk-field.tk-field-error textarea{
    border-color:#dc2626 !important;
    box-shadow:0 0 0 4px rgba(220,38,38,.12) !important;
}
.tk-field-err-msg{ display:flex; align-items:center; gap:6px; color:#dc2626; font-size:13px; font-weight:600; line-height:1.3; margin-top:7px; animation:tkfErrIn .2s ease; }
.tk-field-err-msg::before{
    content:""; flex:0 0 15px; width:15px; height:15px;
    background:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23dc2626' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='12' cy='12' r='9.5'/%3E%3Cpath d='M12 7.5v5.5M12 16.5h.01'/%3E%3C/svg%3E") no-repeat center/15px 15px;
}
@keyframes tkfErrIn{ from{ opacity:0; transform:translateY(-3px); } to{ opacity:1; transform:none; } }
/* Scelte, caselle e consenso */
.tk-form-choices{ display:flex; flex-direction:column; gap:10px; }
.tk-form-choice,.tk-form-consent{ color:var(--tkf-text,inherit); display:flex; align-items:flex-start; gap:10px; font-size:14px; font-weight:400; line-height:1.5; cursor:pointer; margin:0; }
.tk-form-consent{ padding-top:2px; }
.tk-form-consent a{ color:var(--tkf-accent); font-weight:600; text-decoration:underline; text-underline-offset:2px; text-decoration-thickness:1px; }
.tk-form-consent a:hover{ color:var(--tkf-accent-d); }
:is(.tk-form,#tkf-x) .tk-form-choice input[type=checkbox],
:is(.tk-form,#tkf-x) .tk-form-choice input[type=radio],
:is(.tk-form,#tkf-x) .tk-form-consent input[type=checkbox]{
    -webkit-appearance:none; appearance:none;
    flex:0 0 20px; width:20px; height:20px; min-height:0; margin:1px 0 0; padding:0;
    border:1.5px solid var(--tkf-border-h,#9ca3af); border-radius:6px;
    background:var(--tkf-field-bg,#fff) no-repeat center/14px 14px;
    cursor:pointer; position:static; opacity:1;
    transition:background-color .15s ease, border-color .15s ease, box-shadow .15s ease;
}
:is(.tk-form,#tkf-x) .tk-form-choice input[type=radio]{ border-radius:50%; }
:is(.tk-form,#tkf-x) .tk-form-choice input:hover,
:is(.tk-form,#tkf-x) .tk-form-consent input:hover{ border-color:var(--tkf-accent); }
:is(.tk-form,#tkf-x) .tk-form-choice input:focus-visible,
:is(.tk-form,#tkf-x) .tk-form-consent input:focus-visible{ outline:0; box-shadow:0 0 0 4px var(--tkf-focus); }
:is(.tk-form,#tkf-x) .tk-form-choice input[type=checkbox]:checked,
:is(.tk-form,#tkf-x) .tk-form-consent input[type=checkbox]:checked{
    background-color:var(--tkf-accent); border-color:var(--tkf-accent);
    background-image:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='white' stroke-width='3.2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m5 12.5 4.5 4.5L19 7.5'/%3E%3C/svg%3E");
}
:is(.tk-form,#tkf-x) .tk-form-choice input[type=radio]:checked{
    border-color:var(--tkf-accent); background-color:var(--tkf-field-bg,#fff);
    box-shadow:inset 0 0 0 4px var(--tkf-field-bg,#fff), inset 0 0 0 10px var(--tkf-accent);
}
:is(.tk-form,#tkf-x) .tk-field-error .tk-form-choice input,
:is(.tk-form,#tkf-x) .tk-field-error .tk-form-consent input{ border-color:#dc2626; }
.tk-form-heading{ margin:10px 0 0; font-size:19px; font-weight:700; line-height:1.3; }
.tk-form-paragraph{ font-size:14px; line-height:1.6; color:#4b5563; }
.tk-form-html{ font-size:14px; }
/* Caricamento file / immagine */
.tk-form input[type=file]{
    width:100%; font-size:14px; color:#374151; cursor:pointer;
    border:1px dashed var(--tkf-border); border-radius:var(--tkf-radius);
    background:#fafafa; padding:10px 12px;
}
.tk-form input[type=file]:focus{ outline:0; border-color:var(--tkf-accent); box-shadow:0 0 0 3px var(--tkf-focus); }
.tk-form input[type=file]::file-selector-button{
    margin-right:12px; border:0; border-radius:6px; cursor:pointer;
    background:var(--tkf-accent); color:var(--tkf-btn-text);
    font-weight:600; font-size:13px; padding:8px 16px;
}
.tk-form input[type=file]::file-selector-button:hover{ background:var(--tkf-accent-d); }
.tk-form-filehint{ display:block; margin-top:6px; font-size:12px; color:#6b7280; }
.tk-field-error input[type=file]{ border-color:#dc2626; box-shadow:0 0 0 3px rgba(220,38,38,.12); }
/* Caricamento file "moderno" (PRO): dropzone + lista con anteprima */
.tkf-upload input.tkf-native{ position:absolute; width:1px; height:1px; padding:0; margin:-1px; border:0; overflow:hidden; clip:rect(0 0 0 0); opacity:0; }
.tkf-upload{ width:100%; box-sizing:border-box; }
.tkf-drop{
    display:flex; flex-direction:column; align-items:center; gap:6px; text-align:center;
    border:2px dashed var(--tkf-border); border-radius:var(--tkf-radius);
    background:#fafafa; padding:22px 18px; cursor:pointer; transition:border-color .15s, background .15s;
    width:100%; box-sizing:border-box; margin:0;
}
.tkf-drop:hover{ border-color:var(--tkf-accent); background:#f5f8ff; }
.tkf-drop.tkf-over{ border-color:var(--tkf-accent); background:var(--tkf-focus); border-style:solid; }
.tkf-drop.tkf-full{ opacity:.55; cursor:default; }
.tkf-drop.tkf-full:hover{ border-color:var(--tkf-border); background:#fafafa; }
.tkf-drop-icon{ font-size:26px; line-height:1; }
.tkf-drop-text{ font-size:14px; color:#374151; }
.tkf-drop-sub{ font-size:12px; color:#6b7280; }
.tkf-browse{
    background:none; border:0; padding:0; cursor:pointer;
    color:var(--tkf-accent); font-weight:700; font-size:14px; text-decoration:underline;
}
.tkf-upload .tkf-list{
    list-style:none !important; margin:12px 0 0 !important; padding:0 !important;
    display:flex; flex-direction:column; gap:8px;
    width:100%; box-sizing:border-box;
}
.tkf-upload .tkf-list li.tkf-item{
    display:flex; align-items:center; gap:12px;
    border:1px solid var(--tkf-border); border-radius:var(--tkf-radius);
    background:#fff; padding:8px 10px;
    margin:0 !important; width:100%; box-sizing:border-box; list-style:none !important;
}
.tkf-upload .tkf-list li.tkf-item::before{ content:none !important; }
.tkf-upload .tkf-list li.tkf-item::marker{ content:none; }
.tkf-thumb{ flex:0 0 auto; width:40px; height:40px; border-radius:6px; overflow:hidden; display:flex; align-items:center; justify-content:center; background:#f3f4f6; font-size:20px; }
.tkf-thumb img{ width:100%; height:100%; object-fit:cover; display:block; }
.tkf-meta{ flex:1 1 auto; min-width:0; display:flex; flex-direction:column; }
.tkf-name{ font-size:13px; font-weight:600; color:#374151; white-space:nowrap; overflow:hidden; text-overflow:ellipsis; }
.tkf-size{ font-size:11px; color:#6b7280; }
.tkf-remove{
    flex:0 0 auto; width:26px; height:26px; border:0; border-radius:50%;
    background:#f3f4f6; color:#6b7280; cursor:pointer; font-size:13px; line-height:1;
    transition:background .15s, color .15s;
}
.tkf-remove:hover{ background:#fee2e2; color:#991b1b; }
.tkf-warn{ display:none; margin-top:8px; font-size:12px; font-weight:600; color:#92400e; }
.tk-field-error .tkf-drop{ border-color:#dc2626; box-shadow:0 0 0 3px rgba(220,38,38,.12); }

.tk-sign{ display:block; }
.tk-sign-canvas{ width:100%; max-width:500px; height:auto; aspect-ratio:500/180; border:1px solid var(--tkf-border); border-radius:var(--tkf-radius); background:#fff; touch-action:none; cursor:crosshair; display:block; }
.tk-sign-clear{ margin-top:8px; background:#f3f4f6; border:1px solid var(--tkf-border); border-radius:6px; padding:6px 14px; font-size:13px; cursor:pointer; }
.tk-sign-clear:hover{ background:#e5e7eb; }
.tk-field-error .tk-sign-canvas{ border-color:#dc2626; box-shadow:0 0 0 3px rgba(220,38,38,.12); }
.tk-form-hp{ position:absolute !important; left:-9999px !important; height:0; overflow:hidden; }
.tk-recaptcha{ margin:6px 0; container-type:inline-size; }
/* il riquadro di Google e' largo 304px fissi: nelle colonne strette (telefoni,
   moduli dentro una scheda) usciva dal modulo. Si rimpicciolisce a scalini. */
@container (max-width:303px){ .tk-recaptcha > div{ transform:scale(.9); transform-origin:0 0; } }
@container (max-width:273px){ .tk-recaptcha > div{ transform:scale(.8); } }
@container (max-width:243px){ .tk-recaptcha > div{ transform:scale(.7); } }
.tk-form-actions{ margin-top:24px; }
.tk-form .tk-form-submit{
    background:var(--tkf-accent);
    color:var(--tkf-btn-text);
    border:0;
    border-radius:var(--tkf-radius);
    padding:15px 34px;
    margin:0;
    font-family:inherit;
    font-size:15px;
    font-weight:700;
    letter-spacing:.02em;
    text-transform:none;
    cursor:pointer;
    box-shadow:0 8px 20px -8px var(--tkf-accent), 0 2px 4px rgba(15,23,42,.08);
    transition:background-color .18s ease, transform .18s ease, box-shadow .18s ease;
    /* i temi impongono line-height/altezza ai button: il testo scendeva in basso */
    display:inline-flex;
    align-items:center;
    justify-content:center;
    gap:10px;
    line-height:1.2 !important;
    height:auto;
    min-height:52px;
    min-width:200px;
}
.tk-form .tk-form-submit::after{
    content:""; width:18px; height:18px; flex:0 0 18px;
    background:currentColor;
    -webkit-mask:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M4 12h15M13 6l6 6-6 6'/%3E%3C/svg%3E") no-repeat center/contain;
    mask:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M4 12h15M13 6l6 6-6 6'/%3E%3C/svg%3E") no-repeat center/contain;
    transition:transform .18s ease;
}
.tk-form .tk-form-submit:hover{ background:var(--tkf-accent-d); color:var(--tkf-btn-text); transform:translateY(-1px); box-shadow:0 12px 24px -8px var(--tkf-accent), 0 3px 6px rgba(15,23,42,.1); }
.tk-form .tk-form-submit:hover::after{ transform:translateX(3px); }
.tk-form .tk-form-submit:active{ transform:none; }
.tk-form .tk-form-submit:focus-visible{ outline:0; box-shadow:0 0 0 4px var(--tkf-focus); }
.tk-form .tk-form-submit:disabled{ opacity:.75; cursor:default; transform:none; }
/* invio in corso: la freccia diventa una rotellina */
.tk-form .tk-form-submit.is-loading::after{
    -webkit-mask:none; mask:none; background:none;
    width:16px; height:16px; flex-basis:16px; box-sizing:border-box;
    border:2.5px solid currentColor; border-right-color:transparent; border-radius:50%;
    animation:tkfSpin .7s linear infinite;
}
@keyframes tkfSpin{ to{ transform:rotate(360deg); } }
.tk-form-message{
    display:flex;
    align-items:flex-start;
    gap:12px;
    margin-top:18px;
    padding:15px 18px;
    border-radius:var(--tkf-radius);
    font-size:14.5px;
    font-weight:600;
    line-height:1.5;
    animation:tkfErrIn .25s ease;
}
.tk-form-message::before{ content:""; flex:0 0 22px; width:22px; height:22px; background:no-repeat center/22px 22px; }
.tk-form-message.is-ok{ background:#f0fdf4; color:#166534; border:1px solid #bbf7d0; }
.tk-form-message.is-ok::before{ background-image:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Ccircle cx='12' cy='12' r='11' fill='%2316a34a'/%3E%3Cpath d='m7 12.5 3.2 3.2L17 9' fill='none' stroke='white' stroke-width='2.4' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E"); }
.tk-form-message.is-err{ background:#fef2f2; color:#991b1b; border:1px solid #fecaca; }
.tk-form-message.is-err::before{ background-image:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Ccircle cx='12' cy='12' r='11' fill='%23dc2626'/%3E%3Cpath d='M12 7v6M12 16.8h.01' fill='none' stroke='white' stroke-width='2.4' stroke-linecap='round'/%3E%3C/svg%3E"); }
/* invio riuscito: il messaggio prende il posto del modulo, più grande e centrato */
.tk-form.is-sent .tk-form-message.is-ok{ flex-direction:column; align-items:center; text-align:center; gap:14px; margin-top:0; padding:36px 24px; font-size:16px; }
.tk-form.is-sent .tk-form-message.is-ok::before{ width:56px; height:56px; flex-basis:56px; background-size:56px 56px; animation:tkfPop .45s cubic-bezier(.2,1.4,.4,1); }
@keyframes tkfPop{ from{ transform:scale(.4); opacity:0; } to{ transform:none; opacity:1; } }
@media (max-width:600px){
    .tk-form .tk-form-submit{ width:100%; }
}
@media (prefers-reduced-motion:reduce){
    .tk-form *, .tk-form *::before, .tk-form *::after{ animation:none !important; transition:none !important; }
}
@media (max-width:782px){
    .tk-field-fourth,.tk-field-fifth,.tk-field-sixth{ flex:1 1 calc(50% - 8px); }
}
@media (max-width:600px){
    .tk-field-half,.tk-field-third,.tk-field-fourth,.tk-field-fifth,.tk-field-sixth{ flex:1 1 100%; }
}

/* ── Calendario TK (campi data) ─────────────────────────────── */
.tkf-date{ position:relative; }
.tk-form input.tkf-date-native{ position:absolute !important; opacity:0 !important; pointer-events:none !important; width:1px !important; height:1px !important; padding:0 !important; border:0 !important; left:12px; bottom:0; }
.tkf-date-btn{ display:flex; align-items:center; gap:10px; width:100%; box-sizing:border-box; text-align:left; cursor:pointer;
    background:#fff; border:1px solid var(--tkf-border); border-radius:var(--tkf-radius); padding:11px 14px; font:inherit; font-size:15px; color:#9ca3af; transition:border-color .15s, box-shadow .15s; }
.tkf-date-btn svg{ flex:0 0 auto; color:var(--tkf-accent); }
.tkf-date-btn.is-set{ color:#111827; font-weight:500; }
.tkf-date-btn:hover{ border-color:var(--tkf-accent); }
.tkf-date-btn:focus-visible,.tkf-date-btn[aria-expanded="true"]{ outline:0; border-color:var(--tkf-accent); box-shadow:0 0 0 3px var(--tkf-focus); }
.tk-field-error .tkf-date-btn{ border-color:#dc2626; box-shadow:0 0 0 3px rgba(220,38,38,.12); }
.tkf-cal{ position:absolute; z-index:2147483000; top:calc(100% + 8px); left:0; width:320px; max-width:calc(100vw - 32px); box-sizing:border-box;
    background:#fff; border:1px solid #e5e7eb; border-radius:16px; padding:16px; box-shadow:0 24px 60px rgba(15,23,42,.22); font-size:14px; color:#111827;
    animation:tkfCalIn .16s ease; }
@keyframes tkfCalIn{ from{ opacity:0; transform:translateY(-6px); } to{ opacity:1; transform:none; } }
.tkf-cal-head{ display:flex; align-items:center; justify-content:space-between; margin-bottom:10px; }
.tkf-cal-title{ font-weight:700; font-size:15px; text-transform:capitalize; }
.tkf-cal-nav{ width:36px; height:36px; border-radius:10px; border:1px solid #e5e7eb; background:#fff; font-size:22px; line-height:1; cursor:pointer; color:#374151; padding:0; }
.tkf-cal-nav:hover{ border-color:var(--tkf-accent); color:var(--tkf-accent); }
.tkf-cal-hint{ background:var(--tkf-focus); color:var(--tkf-accent-d); font-size:12.5px; font-weight:600; border-radius:8px; padding:7px 10px; margin-bottom:10px; text-align:center; }
.tkf-cal-grid{ display:grid; grid-template-columns:repeat(7,1fr); gap:3px; }
.tkf-cal-wd{ text-align:center; font-size:11px; font-weight:700; text-transform:uppercase; letter-spacing:.04em; color:#9ca3af; padding:4px 0 6px; }
.tkf-cal-day{ aspect-ratio:1; border:0; background:transparent; border-radius:10px; font:inherit; font-size:14px; font-weight:500; color:#111827; cursor:pointer; padding:0; transition:background .12s, color .12s; }
.tkf-cal-day:hover:not(:disabled){ background:var(--tkf-focus); color:var(--tkf-accent-d); }
.tkf-cal-day.is-today{ box-shadow:inset 0 0 0 1.5px var(--tkf-accent); }
.tkf-cal-day.in-range{ background:var(--tkf-focus); border-radius:4px; }
.tkf-cal-day.is-sel,.tkf-cal-day.is-edge{ background:var(--tkf-accent) !important; color:#fff !important; font-weight:700; }
.tkf-cal-day:disabled{ color:#d1d5db; cursor:not-allowed; text-decoration:line-through; }
.tkf-cal-foot{ display:flex; justify-content:space-between; margin-top:12px; padding-top:10px; border-top:1px solid #f1f5f9; }
.tkf-cal-foot button{ background:none; border:0; font:inherit; font-size:13px; font-weight:600; color:#6b7280; cursor:pointer; padding:6px 4px; }
.tkf-cal-foot .tkf-cal-close{ color:var(--tkf-accent); }
@media (max-width:600px){
    /* sul telefono il calendario sale dal basso a tutta larghezza */
    .tkf-cal{ position:fixed; top:auto; bottom:0; left:0; right:0; width:auto; max-width:none; border-radius:20px 20px 0 0; padding:18px 18px calc(18px + env(safe-area-inset-bottom)); box-shadow:0 -20px 60px rgba(15,23,42,.3); animation:tkfCalUp .2s ease; }
    @keyframes tkfCalUp{ from{ transform:translateY(100%); } to{ transform:none; } }
    .tkf-cal-day{ font-size:15px; }
}

/* ── Scelte a pulsante ("Mostra le scelte come pulsanti") ─────── */
.tk-choices-pills{ flex-direction:row; flex-wrap:wrap; gap:8px; }
.tk-choices-pills .tk-form-choice{ position:relative; align-items:center; gap:0; margin:0; padding:10px 16px; border:1px solid var(--tkf-border); border-radius:999px;
    background:#fff; font-size:14px; font-weight:500; line-height:1.2; transition:border-color .15s, background .15s, color .15s, box-shadow .15s; user-select:none; }
.tk-choices-pills .tk-form-choice input{ position:absolute; opacity:0; width:1px; height:1px; margin:0; pointer-events:none; }
.tk-choices-pills .tk-form-choice:hover{ border-color:var(--tkf-accent); }
.tk-choices-pills .tk-form-choice:has(input:checked){ background:var(--tkf-accent); border-color:var(--tkf-accent); color:#fff; box-shadow:0 6px 16px var(--tkf-focus); }
.tk-choices-pills .tk-form-choice:has(input:focus-visible){ box-shadow:0 0 0 3px var(--tkf-focus); }
.tk-field-error .tk-choices-pills .tk-form-choice{ border-color:#fca5a5; }
.tk-form .tk-choices-pills .tk-form-choice{ width:auto !important; max-width:100%; flex:0 0 auto; box-sizing:border-box; }

/* nelle scelte a pulsante l'input resta nascosto: la regola delle caselle ha priorità alta */
:is(.tk-form,#tkf-x) .tk-choices-pills .tk-form-choice input[type=radio],
:is(.tk-form,#tkf-x) .tk-choices-pills .tk-form-choice input[type=checkbox]{
    position:absolute; opacity:0; width:1px; height:1px; flex:0 0 1px; margin:0; border:0; box-shadow:none; pointer-events:none;
}
.tk-form .tk-choices-pills .tk-form-choice{ min-height:44px; padding:10px 18px; }

/* ── Pulsanti interni del modulo blindati contro gli stili globali dei temi su "button"
   (es. temi che colorano ogni pulsante): campo data, calendario, carica file, firma. ── */
:is(.tk-form,#tkf-x) .tkf-date-btn{
    background:var(--tkf-field-bg,#fff) !important; color:var(--tkf-placeholder,#9ca3af) !important;
    border:1.5px solid var(--tkf-border) !important; border-radius:var(--tkf-radius) !important;
    padding:14px 16px !important; min-height:52px; margin:0 !important; width:100% !important;
    font-family:inherit !important; font-size:15px !important; font-weight:400 !important; line-height:1.4 !important;
    text-transform:none !important; letter-spacing:normal !important; text-align:left !important; justify-content:flex-start !important;
    box-shadow:0 1px 2px rgba(15,23,42,.05) !important; transform:none !important;
}
:is(.tk-form,#tkf-x) .tkf-date-btn.is-set{ color:var(--tkf-field-text,#111827) !important; font-weight:500 !important; }
:is(.tk-form,#tkf-x) .tkf-date-btn:hover{ border-color:var(--tkf-accent) !important; }
:is(.tk-form,#tkf-x) .tkf-date-btn:focus-visible,
:is(.tk-form,#tkf-x) .tkf-date-btn[aria-expanded="true"]{ border-color:var(--tkf-accent) !important; box-shadow:0 0 0 4px var(--tkf-focus) !important; }
:is(.tk-form,#tkf-x) .tk-field-error .tkf-date-btn{ border-color:#dc2626 !important; box-shadow:0 0 0 4px rgba(220,38,38,.12) !important; }
:is(.tk-form,#tkf-x) .tkf-browse{
    background:none !important; border:0 !important; padding:0 !important; margin:0 !important; min-height:0 !important; box-shadow:none !important;
    color:var(--tkf-accent) !important; font-weight:700 !important; font-size:14px !important; text-transform:none !important; text-decoration:underline !important;
}
:is(.tk-form,#tkf-x) .tkf-remove{ background:#f3f4f6 !important; color:#6b7280 !important; border:0 !important; padding:0 !important; min-height:0 !important; box-shadow:none !important; }
:is(.tk-form,#tkf-x) .tkf-remove:hover{ background:#fee2e2 !important; color:#991b1b !important; }
:is(.tk-form,#tkf-x) .tk-sign-clear{ background:#f3f4f6 !important; color:#374151 !important; border:1px solid var(--tkf-border) !important; padding:6px 14px !important; min-height:0 !important; box-shadow:none !important; text-transform:none !important; font-size:13px !important; }
:is(.tkf-cal,#tkf-x) button{ text-transform:none !important; letter-spacing:normal !important; box-shadow:none !important; min-height:0 !important; transform:none !important; font-family:inherit !important; }
:is(.tkf-cal,#tkf-x) .tkf-cal-nav{ background:#fff !important; color:#374151 !important; border:1px solid #e5e7eb !important; padding:0 !important; }
:is(.tkf-cal,#tkf-x) .tkf-cal-nav:hover{ border-color:var(--tkf-accent) !important; color:var(--tkf-accent) !important; }
:is(.tkf-cal,#tkf-x) .tkf-cal-day{ background:transparent !important; color:#111827 !important; border:0 !important; padding:0 !important; }
:is(.tkf-cal,#tkf-x) .tkf-cal-day:hover:not(:disabled),
:is(.tkf-cal,#tkf-x) .tkf-cal-day.in-range{ background:var(--tkf-focus) !important; color:var(--tkf-accent-d) !important; }
:is(.tkf-cal,#tkf-x) .tkf-cal-day.is-today{ box-shadow:inset 0 0 0 1.5px var(--tkf-accent) !important; }
:is(.tkf-cal,#tkf-x) .tkf-cal-day.is-sel,
:is(.tkf-cal,#tkf-x) .tkf-cal-day.is-edge{ background:var(--tkf-accent) !important; color:#fff !important; }
:is(.tkf-cal,#tkf-x) .tkf-cal-day:disabled{ color:#d1d5db !important; background:transparent !important; }
:is(.tkf-cal,#tkf-x) .tkf-cal-foot button{ background:none !important; border:0 !important; color:#6b7280 !important; padding:6px 4px !important; }
:is(.tkf-cal,#tkf-x) .tkf-cal-foot .tkf-cal-close{ color:var(--tkf-accent) !important; }
