.sfb-form-wrapper {
    max-width: 860px;
    margin: 32px auto;
    direction: rtl;
    font-family: inherit;
}

.sfb-form-error {
    color: #ef4444;
}

.sfb-form {
    position: relative;
    background: #fff;
    border: 1px solid #e2e8f0;
    border-radius: 16px;
    padding: 32px 28px;
    box-shadow: 0 4px 24px rgba(0, 0, 0, .07);
}

.sfb-form-title {
    margin: 0 0 8px;
    font-size: 1.35rem;
    font-weight: 700;
    color: #1e293b;
}

.sfb-form-description {
    color: #64748b;
    font-size: .93rem;
    margin-bottom: 24px;
    line-height: 1.7;
}

.sfb-honeypot {
    position: absolute;
    left: -9999px;
    top: -9999px;
    opacity: 0;
    pointer-events: none;
}

.sfb-fields {
    display: flex;
    flex-wrap: wrap;
    margin: 0 -8px;
}

.sfb-field {
    width: 100%;
    padding: 0 8px;
    margin-bottom: 18px;
    box-sizing: border-box;
}

.sfb-field label {
    display: block;
    font-size: .88rem;
    font-weight: 600;
    color: #374151;
    margin-bottom: 6px;
}

.sfb-field label span {
    color: #ef4444;
    margin-right: 2px;
}

.sfb-form.sfb-ab-pending .sfb-submit {
    opacity: .5;
    pointer-events: none;
}

.sfb-field input[type=text],
.sfb-field input[type=email],
.sfb-field input[type=tel],
.sfb-field input[type=number],
.sfb-field input[type=date],
.sfb-field input[type=time],
.sfb-field input[type=url],
.sfb-field input[type=password],
.sfb-jalali-input,
.sfb-captcha-input,
.sfb-field select,
.sfb-field textarea {
    width: 100%;
    padding: 11px 14px;
    border: 1.5px solid #e2e8f0;
    border-radius: 10px;
    font-size: .95rem;
    color: #1e293b;
    background: #f8fafc;
    box-sizing: border-box;
    transition: border .2s, box-shadow .2s, background .2s;
    direction: rtl;
    text-align: right;
    font-family: inherit;
}

.sfb-field input:focus,
.sfb-field select:focus,
.sfb-field textarea:focus {
    outline: none;
    border-color: #5b6ef5;
    background: #fff;
    box-shadow: 0 0 0 3px rgba(91, 110, 245, .13);
}

.sfb-field textarea {
    min-height: 110px;
    resize: vertical;
}

.sfb-submit {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 12px 28px;
    border: none;
    border-radius: 10px;
    font-size: 1rem;
    font-weight: 700;
    cursor: pointer;
    width: 100%;
    margin-top: 6px;
    transition: opacity .2s, transform .1s;
    font-family: inherit;
}

.sfb-submit:hover {
    opacity: .9;
}

.sfb-submit:active {
    transform: scale(.98);
}

.sfb-submit.loading {
    opacity: .7;
    pointer-events: none;
}

.sfb-msg {
    display: none;
    padding: 12px 16px;
    border-radius: 10px;
    font-size: .9rem;
    font-weight: 600;
    margin-top: 14px;
    text-align: center;
}

.sfb-msg.success {
    background: #dcfce7;
    color: #16a34a;
    display: block;
}

.sfb-msg.error {
    background: #fee2e2;
    color: #dc2626;
    display: block;
}

.sfb-radio-group,
.sfb-checkbox-group {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.sfb-option-label {
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    font-size: .92rem;
    color: #374151;
    padding: 8px 12px;
    border: 1.5px solid #e2e8f0;
    border-radius: 8px;
    background: #f8fafc;
}

.sfb-option-label:hover {
    border-color: #5b6ef5;
    background: #f0f2ff;
}

.sfb-option-label input {
    cursor: pointer;
}

.sfb-range-wrap {
    display: flex;
    align-items: center;
    gap: 12px;
}

.sfb-range {
    flex: 1;
    cursor: pointer;
    accent-color: #5b6ef5;
}

.sfb-range-val {
    font-weight: 700;
    color: #5b6ef5;
    min-width: 32px;
    text-align: center;
}

.sfb-color-input {
    width: 60px !important;
    height: 40px;
    border-radius: 8px;
    border: 1.5px solid #e2e8f0;
    cursor: pointer;
    padding: 2px;
}

.sfb-field select {
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24'%3E%3Cpath fill='%2364748b' d='M7 10l5 5 5-5z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: left 12px center;
    padding-left: 36px;
}

.sfb-field input[type=file] {
    padding: 8px;
    background: #f8fafc;
    cursor: pointer;
}

.sfb-file-hint,
.sfb-date-hint {
    font-size: .78rem;
    color: #94a3b8;
    margin-top: 5px;
}

.sfb-captcha-wrap {
    display: flex;
    align-items: center;
    gap: 12px;
}

.sfb-captcha-q {
    flex-shrink: 0;
    padding: 10px 16px;
    background: #f1f5f9;
    border: 1.5px solid #e2e8f0;
    border-radius: 10px;
    font-size: 1.05rem;
    font-weight: 700;
    color: #1e293b;
    letter-spacing: 1px;
    user-select: none;
    white-space: nowrap;
}

.sfb-captcha-input {
    flex: 1;
    min-width: 0;
    width: auto;
}

.sfb-captcha-error {
    font-size: .8rem;
    color: #ef4444;
    margin-top: 6px;
}

.sfb-captcha-retry {
    background: #ef4444;
    color: #fff;
    border: none;
    padding: 4px 14px;
    border-radius: 6px;
    cursor: pointer;
    font-size: .8rem;
    font-weight: 600;
    margin-right: 6px;
}

.sfb-captcha-retry:hover {
    opacity: .9;
}

.sfb-jalali-wrap {
    position: relative;
}

.sfb-jalali-input {
    cursor: pointer !important;
}

.sfb-jalali-cal {
    display: none;
    position: absolute;
    right: 0;
    top: calc(100% + 4px);
    background: #fff;
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, .12);
    padding: 12px;
    z-index: 9999;
    min-width: 280px;
    direction: rtl;
    user-select: none;
}

.sfb-cal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 10px;
}

.sfb-cal-nav {
    background: none;
    border: none;
    cursor: pointer;
    font-size: 1.1rem;
    padding: 4px 8px;
    color: #475569;
    border-radius: 6px;
}

.sfb-cal-nav:hover {
    background: #f1f5f9;
}

.sfb-cal-title {
    background: none;
    border: none;
    cursor: pointer;
    font-size: .95rem;
    font-weight: 700;
    color: #1e293b;
    padding: 4px 10px;
    border-radius: 6px;
}

.sfb-cal-title:hover {
    background: #f1f5f9;
}

.sfb-cal-grid {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 3px;
    text-align: center;
}

.sfb-cal-dow {
    font-size: .75rem;
    font-weight: 700;
    color: #94a3b8;
    padding: 4px 0;
}

.sfb-cal-day {
    padding: 5px 0;
    border-radius: 6px;
    cursor: pointer;
    font-size: .88rem;
}

.sfb-cal-day:hover {
    background: #eef2ff;
    color: #5b6ef5;
}

.sfb-cal-day.sfb-cal-today {
    background: #eef2ff;
    color: #5b6ef5;
    font-weight: 700;
}

.sfb-cal-day.sfb-cal-sel {
    background: #5b6ef5;
    color: #fff;
}

.sfb-cal-months-grid,
.sfb-cal-years-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 6px;
    text-align: center;
}

.sfb-cal-month,
.sfb-cal-year {
    padding: 10px 4px;
    border-radius: 8px;
    cursor: pointer;
    font-size: .85rem;
    color: #334155;
    background: #f8fafc;
    border: 1px solid #e2e8f0;
}

.sfb-cal-month:hover,
.sfb-cal-year:hover {
    background: #eef2ff;
    color: #5b6ef5;
    border-color: #c7d2fe;
}

.sfb-cal-month.sfb-cal-sel,
.sfb-cal-year.sfb-cal-sel {
    background: #5b6ef5;
    color: #fff;
    border-color: #5b6ef5;
}

@media (max-width: 640px) {
    .sfb-form-wrapper {
        margin: 16px;
    }

    .sfb-form {
        padding: 20px 16px;
    }

    .sfb-field {
        width: 100% !important;
    }
}
