/* 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; margin-bottom:6px; }
.tk-req{ color:#dc2626; }
.tk-form input[type=text],
.tk-form input[type=email],
.tk-form input[type=tel],
.tk-form input[type=url],
.tk-form input[type=number],
.tk-form input[type=date],
.tk-form select,
.tk-form textarea{
    width:100%;
    padding:11px 14px;
    border:1px solid var(--tkf-border);
    border-radius:var(--tkf-radius);
    font-size:15px;
    background:#fff;
    color:#111827;
    line-height:1.4;
}
.tk-form textarea{ resize:vertical; min-height:120px; }
.tk-form input:focus,
.tk-form select:focus,
.tk-form textarea:focus{
    outline:0;
    border-color:var(--tkf-accent);
    box-shadow:0 0 0 3px var(--tkf-focus);
}
.tk-form .tk-field-error input,
.tk-form .tk-field-error select,
.tk-form .tk-field-error textarea{
    border-color:#dc2626;
    box-shadow:0 0 0 3px rgba(220,38,38,.12);
}
.tk-field-err-msg{ color:#dc2626; font-size:13px; font-weight:600; margin-top:5px; }
.tk-form-choices{ display:flex; flex-direction:column; gap:8px; }
.tk-form-choice,.tk-form-consent{ display:flex; align-items:flex-start; gap:8px; font-size:14px; font-weight:400; cursor:pointer; }
.tk-form-choice input,.tk-form-consent input{ margin-top:3px; }
.tk-form-heading{ margin:6px 0 0; font-size:18px; }
.tk-form-paragraph{ font-size:14px; 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; }
.tk-form-actions{ margin-top:18px; }
.tk-form-submit{
    background:var(--tkf-accent);
    color:var(--tkf-btn-text);
    border:0;
    border-radius:var(--tkf-radius);
    padding:13px 30px;
    font-size:15px;
    font-weight:700;
    cursor:pointer;
    transition:background .15s;
}
.tk-form-submit:hover{ background:var(--tkf-accent-d); }
.tk-form-submit:disabled{ opacity:.6; cursor:default; }
.tk-form-message{
    margin-top:16px;
    padding:14px 18px;
    border-radius:var(--tkf-radius);
    font-size:14px;
    font-weight:600;
}
.tk-form-message.is-ok{ background:#dcfce7; color:#166534; border:1px solid #86efac; }
.tk-form-message.is-err{ background:#fee2e2; color:#991b1b; border:1px solid #fca5a5; }
@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%; }
}
