.nexa-form {
    display: flex;
    flex-direction: column;
    gap: var(--nexa-space-4);
}

.nexa-form-row,
.nexa-form-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: var(--nexa-space-4);
}

.nexa-form-grid-spacious {
    gap: 22px 24px;
}

.nexa-form-field {
    min-width: 0;
}

.nexa-form-field-full {
    grid-column: 1/-1;
}

.nexa-form-field label,
.nexa-form-label {
    display: block;
    margin-bottom: var(--nexa-space-2);
    color: var(--nexa-text-secondary);
    font-size: var(--nexa-font-sm);
    font-weight: 700;
}

.nexa-required::after {
    content: " *";
    color: var(--nexa-danger);
}

.nexa-input,
.nexa-textarea,
.nexa-select {
    width: 100%;
    min-height: 42px;
    padding: 9px 13px;
    color: var(--nexa-text);
    background: var(--nexa-surface);
    border: 1px solid var(--nexa-border-strong);
    border-radius: var(--nexa-radius-sm);
    outline: none;
    transition:
        border-color var(--nexa-transition-fast),
        box-shadow var(--nexa-transition-fast),
        background-color var(--nexa-transition-fast);
}

.nexa-input:hover,
.nexa-textarea:hover,
.nexa-select:hover {
    border-color: #bfc6cf;
}

.nexa-input:focus,
.nexa-textarea:focus,
.nexa-select:focus {
    border-color: var(--nexa-primary);
    box-shadow: 0 0 0 3px rgba(184, 138, 22, 0.13);
}

.nexa-input:disabled,
.nexa-textarea:disabled,
.nexa-select:disabled {
    color: var(--nexa-text-muted);
    background: var(--nexa-bg-secondary);
    cursor: not-allowed;
}

.nexa-textarea {
    min-height: 90px;
    resize: vertical;
}

.nexa-number-input {
    direction: ltr;
    text-align: end;
    font-variant-numeric: tabular-nums;
}

.nexa-check-field {
    display: flex;
    align-items: center;
    gap: 10px;
    min-height: 42px;
    padding: 10px 12px;
    color: var(--nexa-text-secondary);
    background: var(--nexa-surface-secondary);
    border: 1px solid var(--nexa-border);
    border-radius: var(--nexa-radius-sm);
    font-weight: 700;
}

.nexa-check-field input {
    width: 18px;
    height: 18px;
    accent-color: var(--nexa-primary);
}

.nexa-form-actions {
    display: flex;
    align-items: center;
    justify-content: flex-start;
    gap: var(--nexa-space-2);
    margin-top: var(--nexa-space-2);
    direction: ltr;
}

.nexa-inline-actions {
    display: flex;
    align-items: center;
    gap: var(--nexa-space-2);
    flex-wrap: wrap;
}

.nexa-field-error,
.nexa-validation-text {
    display: block;
    margin-top: var(--nexa-space-1);
    color: var(--nexa-danger);
    font-size: var(--nexa-font-xs);
    font-weight: 700;
}

.nexa-field-invalid,
.nexa-invalid {
    border-color: var(--nexa-danger) !important;
    box-shadow: 0 0 0 3px rgba(207, 52, 52, 0.12) !important;
}

.nexa-action-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: var(--nexa-space-2);
    min-height: 40px;
    padding: 8px 15px;
    color: #fff;
    background: var(--nexa-primary);
    border: 0;
    border-radius: var(--nexa-radius-sm);
    font-weight: 700;
    cursor: pointer;
    transition:
        background-color var(--nexa-transition-fast),
        box-shadow var(--nexa-transition-fast),
        transform var(--nexa-transition-fast),
        opacity var(--nexa-transition-fast);
}

.nexa-action-button:hover:not(:disabled) {
    box-shadow: var(--nexa-shadow-sm);
    transform: translateY(-1px);
}

.nexa-action-button:disabled {
    opacity: 0.55;
    cursor: not-allowed;
}

.nexa-action-primary {
    background: var(--nexa-primary);
}

.nexa-action-primary:hover:not(:disabled) {
    background: var(--nexa-primary-hover);
}

.nexa-action-secondary {
    color: var(--nexa-text);
    background: var(--nexa-bg-secondary);
    border: 1px solid var(--nexa-border-strong);
}

.nexa-modal-backdrop {
    position: fixed;
    inset: 0;
    z-index: 2000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 28px;
    background: rgba(20, 24, 31, 0.42);
    backdrop-filter: blur(2px);
}

.nexa-modal {
    display: flex;
    flex-direction: column;
    width: min(760px, 100%);
    max-height: calc(100vh - 56px);
    overflow: hidden;
    background: var(--nexa-surface);
    border: 1px solid var(--nexa-border);
    border-radius: 18px;
    box-shadow: 0 24px 70px rgba(15, 23, 42, 0.24);
}

.nexa-modal-xl {
    width: min(1100px, 100%);
}

.nexa-modal-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 24px;
    padding: 22px 26px 18px;
    background: linear-gradient(180deg, #fffdf8, #faf7ef);
    border-bottom: 1px solid var(--nexa-border);
}

.nexa-modal-header h4 {
    margin: 0 0 5px;
    color: var(--nexa-text);
    font-size: 1.18rem;
}

.nexa-modal-header p {
    margin: 0;
    color: var(--nexa-text-muted);
    font-size: 0.87rem;
}

.nexa-modal-close {
    display: flex;
    align-items: center;
    justify-content: center;
    flex: 0 0 34px;
    width: 34px;
    height: 34px;
    padding: 0;
    color: #5d6470;
    background: #fff;
    border: 1px solid var(--nexa-border);
    border-radius: 10px;
    font-size: 1.45rem;
    line-height: 1;
    cursor: pointer;
}

.nexa-modal-body {
    flex: 1;
    min-height: 0;
    overflow: auto;
    padding: 26px;
}

.nexa-modal-footer {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 10px;
    padding: 10px;
    background: #fafafa;
    border-top: 1px solid var(--nexa-border);
    direction: ltr;
}

.nexa-detail-tabs {
    display: flex;
    gap: 4px;
    padding: 10px 24px 0;
    background: #fff;
    border-bottom: 1px solid var(--nexa-border);
}

.nexa-detail-tabs button {
    min-height: 42px;
    padding: 8px 16px;
    color: var(--nexa-text-muted);
    background: transparent;
    border: 0;
    border-bottom: 3px solid transparent;
    font-weight: 800;
    cursor: pointer;
}

.nexa-detail-tabs button.active {
    color: #755509;
    border-bottom-color: var(--nexa-primary);
}

.nexa-detail-tabs button:disabled {
    opacity: 0.45;
    cursor: not-allowed;
}

.nexa-detail-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 18px;
}

.nexa-detail-toolbar h5 {
    margin: 0;
}

.nexa-detail-editor {
    margin-bottom: 22px;
    padding: 22px;
    background: #fbfaf7;
    border: 1px solid #eadfca;
    border-radius: 14px;
}

.nexa-detail-table-wrap {
    overflow: auto;
    border: 1px solid var(--nexa-border);
    border-radius: 12px;
}

.nexa-simple-empty {
    height: 110px;
    color: var(--nexa-text-muted);
    text-align: center !important;
    vertical-align: middle !important;
    font-weight: 700;
}

.dxbl-spin-edit .dxbl-btn-group {
    display: none !important;
}

.dxbl-text-edit,
.dxbl-spin-edit,
.dxbl-combobox,
.dxbl-date-edit {
    min-height: 42px;
    font-family: var(--nexa-font-family) !important;
    border-radius: var(--nexa-radius-sm) !important;
}

@media (max-width: 768px) {
    .nexa-form-row,
    .nexa-form-grid {
        grid-template-columns: 1fr;
    }

    .nexa-form-actions {
        align-items: stretch;
        flex-direction: column-reverse;
    }

    .nexa-form-actions > * {
        width: 100%;
    }

    .nexa-modal-backdrop {
        align-items: flex-end;
        padding: 0;
    }

    .nexa-modal,
    .nexa-modal-xl {
        width: 100%;
        max-height: 94vh;
        border-radius: 18px 18px 0 0;
    }

    .nexa-modal-header,
    .nexa-modal-body,
    .nexa-modal-footer {
        padding-left: 18px;
        padding-right: 18px;
    }

    .nexa-detail-tabs {
        overflow-x: auto;
        padding-left: 14px;
        padding-right: 14px;
    }
}
