/* Shared form treatment across staff, client and authentication surfaces.
   Keep component-specific calendar, clock and rich-editor controls intact. */
:root {
    --form-border: #cbd8ea;
    --form-text: #102044;
    --form-muted: #64799b;
    --form-focus: #1458f5;
    --form-error: #dc3545;
}

:is(.content-wrapper, .modal) form .form-label,
:is(.content-wrapper, .modal) form label:not(.form-check-label),
.auth-card form .form-label,
.auth-card form .auth-label {
    color: var(--form-text);
    font-size: .875rem;
    font-weight: 650;
    line-height: 1.35;
    margin-bottom: .45rem;
}

:is(.content-wrapper, .modal) form .form-control:not(.form-control-sm):not(.form-control-lg),
:is(.content-wrapper, .modal) form .form-select:not(.form-select-sm):not(.form-select-lg),
.auth-card form .form-control:not(.form-control-sm):not(.form-control-lg) {
    min-height: 44px;
    border: 1px solid var(--form-border);
    border-radius: 10px;
    padding: .55rem .8rem;
    color: var(--form-text);
    background-color: #fff;
    transition: border-color .15s ease, box-shadow .15s ease, background-color .15s ease;
}

.content-wrapper .ui-page-form form textarea.form-control,
.modal form textarea.form-control,
.auth-card form textarea.form-control {
    min-height: 112px;
    resize: vertical;
}

:is(.content-wrapper, .modal) form .form-control::placeholder,
.auth-card form .form-control::placeholder {
    color: #8798b2;
    opacity: 1;
}

:is(.content-wrapper, .modal) form .form-control:focus,
:is(.content-wrapper, .modal) form .form-select:focus,
.auth-card form .form-control:focus,
:is(.content-wrapper, .modal) form .form-check-input:focus,
.auth-card form .form-check-input:focus {
    border-color: var(--form-focus);
    box-shadow: 0 0 0 3px rgba(20, 88, 245, .14);
    outline: 0;
}

:is(.content-wrapper, .modal) form .form-control:disabled,
:is(.content-wrapper, .modal) form .form-select:disabled,
.auth-card form .form-control:disabled {
    background-color: #f1f5fb;
    color: var(--form-muted);
    cursor: not-allowed;
    opacity: 1;
}

:is(.content-wrapper, .modal) form .form-control[readonly],
.auth-card form .form-control[readonly] {
    background-color: #f8fafd;
    color: #526783;
}

:is(.content-wrapper, .modal) form .input-group-text,
.auth-card form .input-group-text {
    border-color: var(--form-border);
    background-color: #f6f9fe;
    color: var(--form-muted);
}

:is(.content-wrapper, .modal) form .select2-container--bootstrap-5 .select2-selection--single,
:is(.content-wrapper, .modal) form .select2-container--default .select2-selection--single {
    min-height: 44px;
    border: 1px solid var(--form-border);
    border-radius: 10px;
}

:is(.content-wrapper, .modal) form .select2-container--bootstrap-5.select2-container--focus .select2-selection,
:is(.content-wrapper, .modal) form .select2-container--default.select2-container--focus .select2-selection {
    border-color: var(--form-focus);
    box-shadow: 0 0 0 3px rgba(20, 88, 245, .14);
}

:is(.content-wrapper, .modal) form .form-text,
.auth-card form .form-text {
    color: var(--form-muted);
    line-height: 1.45;
}

:is(.content-wrapper, .modal) form .form-control.is-invalid,
:is(.content-wrapper, .modal) form .form-select.is-invalid,
.auth-card form .form-control.is-invalid {
    border-color: var(--form-error);
}

:is(.content-wrapper, .modal) form .invalid-feedback,
.auth-card form .invalid-feedback {
    color: #b42332;
    font-size: .8rem;
    line-height: 1.4;
    margin-top: .35rem;
}

:is(.content-wrapper, .modal) form .select2-selection.is-invalid {
    border-color: var(--form-error) !important;
}

.content-wrapper .ui-page-form form .btn:not(.btn-sm):not(.btn-lg),
.modal form .btn:not(.btn-sm):not(.btn-lg),
.auth-card form .btn:not(.btn-sm):not(.btn-lg) {
    min-height: 42px;
}

:is(.content-wrapper, .modal) form .btn:disabled,
.auth-card form .btn:disabled {
    cursor: not-allowed;
    box-shadow: none;
}

/* Opt-in section cards for multi-section forms; specialty workflows stay unchanged. */
.content-wrapper .ui-form-section > .ui-form-section-header {
    display: flex;
    align-items: center;
    gap: .85rem;
    padding: 1rem 1.25rem;
    background: var(--ui-surface, #fff);
    border-bottom: 1px solid var(--ui-card-border, #e0e8f4);
    text-transform: none;
    letter-spacing: 0;
}

.ui-form-section-header h5 {
    color: var(--form-text);
    font-size: 1rem;
    font-weight: 750;
    line-height: 1.4;
}

.ui-form-section-header p {
    color: var(--form-muted);
    font-size: .8rem;
    font-weight: 400;
    line-height: 1.4;
    margin-top: .2rem;
}

.ui-form-section-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex: 0 0 40px;
    width: 40px;
    height: 40px;
    border-radius: 12px;
    background: #edf3ff;
    color: var(--form-focus);
    font-size: 1.15rem;
}

.content-wrapper .ui-form-section .row.g-3 > [class*="col-"] {
    min-width: 0;
    margin-bottom: 0 !important;
}

.content-wrapper .ui-form-section .select2-container {
    width: 100% !important;
    max-width: 100%;
    min-width: 0;
}

.content-wrapper .ui-form-section .select2-selection--multiple {
    min-height: 44px;
    border: 1px solid var(--form-border);
    border-radius: 10px;
    color: var(--form-text);
}

.content-wrapper .ui-form-section .select2-selection__choice {
    max-width: 100%;
    white-space: normal;
    overflow-wrap: anywhere;
}

.content-wrapper .ui-form-actions {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 1rem;
    padding: 1rem 1.25rem;
    border: 1px solid var(--ui-card-border, #e0e8f4);
    border-radius: var(--ui-card-radius, 16px);
    background: var(--ui-surface, #fff);
    box-shadow: var(--ui-card-shadow);
}

@media (max-width: 700px) {
    .content-wrapper .ui-form-actions .ui-page-actions {
        justify-content: flex-end;
    }
}

@media (max-width: 575.98px) {
    .content-wrapper .ui-form-section > .ui-form-section-header,
    .content-wrapper .ui-form-section > .card-body,
    .content-wrapper .ui-form-actions {
        padding: 1rem;
    }

    .content-wrapper .ui-form-actions .ui-page-actions > .btn {
        flex: 1 1 auto;
    }

    :is(.content-wrapper, .modal) form .row > [class*="col-"] {
        min-width: 0;
    }

    :is(.content-wrapper, .modal) form .form-control,
    :is(.content-wrapper, .modal) form .form-select,
    .auth-card form .form-control {
        max-width: 100%;
    }
}
