.access-element-modal,
.sku-dialog {
    border: 0;
    border-radius: 14px;
    padding: 0;
    width: min(var(--modal-width, 480px), calc(100vw - 2rem));
    max-height: calc(100vh - 2rem);
    color: #10213f;
    box-shadow: 0 1rem 3rem rgb(16 33 63 / 28%);
    overflow: hidden;
}

.access-element-modal::backdrop,
.sku-dialog::backdrop {
    background: rgb(16 33 63 / 48%);
}

.access-element-modal form,
.sku-dialog form {
    display: flex;
    flex-direction: column;
    max-height: calc(100vh - 2rem);
    overflow: hidden;
}

.access-element-modal form {
    gap: 0;
}

.access-element-modal .modal-header,
.access-element-modal .modal-actions,
.sku-dialog .modal-header,
.sku-dialog .modal-actions {
    flex: 0 0 auto;
}

.access-element-modal .modal-fields,
.sku-dialog .modal-fields,
.sku-dialog .sku-create-review {
    flex: 1 1 auto;
    min-height: 0;
    overflow-y: auto;
}

.modal-header {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 20px 22px;
    border-bottom: 1px solid #e1e6ef;
}

.modal-header > div:last-child {
    min-width: 0;
    overflow-wrap: anywhere;
}

.modal-heading-icon {
    display: grid;
    flex: none;
    place-items: center;
    width: 40px;
    height: 40px;
    border-radius: 10px;
    color: var(--licensing-action);
    background: var(--licensing-action-soft);
}

.modal-heading-icon wa-icon {
    font-size: 18px;
}

.modal-header h2 {
    margin: 0;
    font-size: 17px;
    font-weight: 700;
}

.modal-header p {
    margin: 3px 0 0;
    color: #718096;
    font-size: 12px;
}

.modal-fields {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 17px 14px;
    padding: 22px;
}

.modal-field {
    display: flex;
    flex-direction: column;
    gap: 7px;
    min-width: 0;
}

.modal-field--full {
    grid-column: 1 / -1;
}

.modal-field label,
.status-field legend {
    color: #8491a5;
    font-family: var(--licensing-font-sans);
    font-size: .7rem;
    font-weight: 600;
    letter-spacing: .04em;
    line-height: 1.2;
    text-transform: uppercase;
}

.modal-field label > span:not(.required-indicator),
.status-field legend > span:not(.required-indicator) {
    color: #8d99aa;
    font-weight: 400;
    text-transform: none;
    letter-spacing: 0;
}

.required-indicator {
    color: #d92d20 !important;
    font-weight: 700 !important;
}

.modal-field input,
.modal-field select,
.modal-field textarea {
    box-sizing: border-box;
    width: 100%;
    min-height: 40px;
    padding: 9px 11px;
    border: 1px solid #d7deea;
    border-radius: 8px;
    background: #fff;
    color: #10213f;
    font: inherit;
    font-size: 13px;
    outline: none;
}

.modal-field input:focus,
.modal-field select:focus,
.modal-field textarea:focus {
    border-color: var(--licensing-action);
    box-shadow: 0 0 0 3px var(--licensing-action-ring);
}

.modal-field input.input-error {
    border-color: #ef4444;
    box-shadow: 0 0 0 1px #ef4444;
}

.modal-field input.input-error:focus {
    border-color: #ef4444;
    box-shadow: 0 0 0 3px rgb(239 68 68 / 14%);
}

.modal-field input:disabled,
.modal-field select:disabled {
    color: #9aa5b5;
    background: #f4f6f9;
}

.modal-field input:disabled {
    cursor: not-allowed;
}

.modal-field input::placeholder,
.modal-field textarea::placeholder {
    color: #8792a1;
}

.modal-field-help {
    color: #718096;
    font-size: 12px;
    line-height: 1.2;
}

.modal-field textarea {
    min-height: 70px;
    resize: vertical;
}

.status-field {
    min-width: 0;
    border: 0;
    margin: 0;
    padding: 0;
}

.status-field legend {
    padding: 0;
    margin-bottom: 7px;
}

.status-options {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
}

.status-option,
.modal-field label.status-option {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    min-height: 46px;
    box-sizing: border-box;
    border: 1px solid #d7deea;
    border-radius: 8px;
    color: #52627a;
    font-family: var(--licensing-font-sans);
    font-size: 13px;
    font-weight: 600;
    text-transform: none !important;
    cursor: pointer;
    user-select: none;
}

.status-option--active:has(input:checked) {
    border-color: #159447;
    background: #e4f5e9;
    color: #138643;
}

.status-option--inactive:has(input:checked) {
    border-color: #ef4444;
    background: #feeceb;
    color: #d92d20;
}

.status-option input {
    position: absolute;
    opacity: 0;
    pointer-events: none;
}

.status-radio {
    display: grid;
    place-items: center;
    width: 15px;
    height: 15px;
    border: 1px solid #aab6c7;
    border-radius: 50%;
    color: transparent;
    font-size: 10px;
    line-height: 1;
}

.status-option--active input:checked + .status-radio {
    border-color: #159447;
    background: #159447;
    color: #fff;
}

.status-option--inactive input:checked + .status-radio {
    border-color: #d92d20;
    background: #d92d20;
    color: #fff;
}

.modal-error {
    grid-column: 1 / -1;
    padding: 9px 11px;
    border-radius: 7px;
    background: #fff0f0;
    color: #b42318;
    font-size: 12px;
}

.duplicate-indicator {
    color: #d92d20;
    font-size: .7rem;
    font-weight: 700;
    letter-spacing: 0;
    text-transform: none !important;
}

.modal-actions {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    padding: 16px 22px;
    border-top: 1px solid #e1e6ef;
}

.modal-actions button {
    min-height: 36px;
    padding: 0 16px;
    border-radius: 8px;
    font-family: var(--licensing-font-sans);
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
}

.modal-actions .modal-back {
    margin-right: auto;
}

.modal-cancel {
    border: 1px solid #d7deea;
    background: white;
    color: #111827;
}

.modal-submit {
    border: 0;
    background: var(--licensing-action);
    color: white;
}

.modal-submit:disabled {
    background: color-mix(in srgb, var(--licensing-action) 45%, white);
    cursor: not-allowed;
}

.modal-submit span {
    margin-right: 5px;
}

.modal-spinner {
    display: inline-block;
    width: 12px;
    height: 12px;
    margin-right: 7px;
    border: 2px solid rgb(255 255 255 / 45%);
    border-top-color: #fff;
    border-radius: 50%;
    vertical-align: -2px;
    animation: modal-spin .7s linear infinite;
}

@keyframes modal-spin {
    to { transform: rotate(360deg); }
}

@media (max-width: 520px) {
    .modal-fields { grid-template-columns: 1fr; }
    .modal-field--full { grid-column: auto; }
}