.modal-backdrop {
    z-index: 1040 !important;
}

.modal {
    z-index: 1050 !important;
}

.modal-content {
    z-index: 1051;
}

.acl-tree-page {
    --acl-tree-ink: #08312a;
    --acl-tree-accent: #007b55;
    --acl-tree-accent-soft: #00e47c;
    --acl-tree-base-surface: rgba(255, 255, 255, 0.98);
    --acl-tree-surface: #f5fbf8;
    --acl-tree-surface-strong: #edf7f2;
    --acl-tree-soft-accent: #e7f3ef;
    --acl-tree-border: rgba(8, 49, 42, 0.12);
    --acl-tree-border-strong: rgba(8, 49, 42, 0.2);
    --acl-tree-hover: rgba(8, 49, 42, 0.07);
    --acl-tree-hover-border: rgba(8, 49, 42, 0.16);
    --acl-tree-shadow: rgba(8, 49, 42, 0.08);
    --acl-tree-chip-bg: rgba(255, 255, 255, 0.86);
}

[data-bs-theme="dark"] .acl-tree-page {
    --acl-tree-ink: #e8fff4;
    --acl-tree-accent: #00e47c;
    --acl-tree-accent-soft: #00e47c;
    --acl-tree-base-surface: rgba(24, 34, 30, 0.96);
    --acl-tree-surface: rgba(24, 34, 30, 0.96);
    --acl-tree-surface-strong: rgba(27, 41, 35, 0.98);
    --acl-tree-soft-accent: rgba(0, 228, 124, 0.12);
    --acl-tree-border: rgba(0, 228, 124, 0.18);
    --acl-tree-border-strong: rgba(0, 228, 124, 0.28);
    --acl-tree-hover: rgba(0, 228, 124, 0.1);
    --acl-tree-hover-border: rgba(0, 228, 124, 0.2);
    --acl-tree-shadow: rgba(0, 228, 124, 0.09);
    --acl-tree-chip-bg: rgba(24, 34, 30, 0.88);
}

.acl-tree-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    margin-bottom: 0.875rem;
}

.acl-tree-title {
    font-size: 1.35rem;
    line-height: 1.15;
    color: var(--acl-tree-ink);
}

.acl-tree-header-actions {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.acl-tree-toolbar,
.acl-tree-overview,
.acl-tree-selection {
    border: 1px solid var(--acl-tree-border);
    border-radius: 0.875rem;
    background: linear-gradient(180deg, var(--acl-tree-base-surface), var(--acl-tree-soft-accent));
    box-shadow: 0 0.25rem 0.7rem rgba(15, 23, 42, 0.03);
}

.acl-tree-toolbar {
    display: grid;
    grid-template-columns: minmax(18rem, 1.4fr) auto;
    gap: 0.75rem 1rem;
    align-items: end;
    margin-bottom: 0.75rem;
    padding: 0.75rem 0.875rem;
}

.acl-tree-search-panel {
    min-width: 0;
}

.acl-tree-search-label,
.acl-tree-selection-label {
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--acl-tree-ink);
}

.acl-tree-search-panel .input-group-text,
.acl-tree-search-panel .form-control {
    border-color: var(--acl-tree-border);
}

.acl-tree-search-icon {
    color: var(--acl-tree-accent);
    background: rgba(0, 228, 124, 0.12);
}

.acl-tree-search-input {
    min-height: 2.15rem;
}

.acl-tree-search-input:focus,
.acl-tree-search-panel .form-control:focus {
    border-color: rgba(0, 123, 85, 0.4);
    box-shadow: 0 0 0 0.16rem rgba(0, 123, 85, 0.12);
}

.acl-tree-search-status {
    margin-top: 0.35rem;
    font-size: 0.84rem;
    color: var(--bs-secondary-color);
}

.acl-tree-toolbar-actions {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    flex-wrap: wrap;
    gap: 0.45rem;
}

button.acl-tree-toolbar-button,
button.acl-tree-filter-pill,
button.acl-tree-action-button {
    border: 1px solid var(--acl-tree-border);
    background: var(--acl-tree-chip-bg);
    color: var(--acl-tree-ink);
    font-weight: 600;
    box-shadow: none;
}

button.acl-tree-toolbar-button:hover,
button.acl-tree-filter-pill:hover,
button.acl-tree-action-button:hover {
    background: var(--acl-tree-hover);
    border-color: var(--acl-tree-hover-border);
}

button.acl-tree-toolbar-button {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    min-height: 2rem;
    padding: 0.36rem 0.7rem;
    border-radius: 999px;
    font-size: 0.82rem;
}

button.acl-tree-toolbar-button:disabled {
    cursor: not-allowed;
    opacity: 0.5;
}

button.acl-tree-toolbar-button.is-active {
    border-color: var(--acl-tree-accent);
    background: var(--acl-tree-accent);
    color: #ffffff;
}

.acl-tree-overview {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem 1rem;
    flex-wrap: wrap;
    margin-bottom: 0.75rem;
    padding: 0.65rem 0.875rem;
}

.acl-tree-filter-group,
.acl-tree-stat-group,
.acl-tree-selection-actions {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 0.45rem;
}

button.acl-tree-filter-pill {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    min-height: 2rem;
    padding: 0.34rem 0.7rem;
    border-radius: 999px;
    font-size: 0.84rem;
}

button.acl-tree-filter-pill strong {
    min-width: 1.45rem;
    padding: 0.08rem 0.35rem;
    border-radius: 999px;
    background: rgba(8, 49, 42, 0.08);
    font-size: 0.78rem;
    text-align: center;
}

button.acl-tree-filter-pill.is-active {
    border-color: var(--acl-tree-accent);
    background: var(--acl-tree-accent);
    color: #ffffff;
}

button.acl-tree-filter-pill.is-active strong {
    background: rgba(255, 255, 255, 0.18);
    color: #ffffff;
}

.acl-tree-stat {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.18rem 0;
    color: var(--bs-body-color);
    font-size: 0.84rem;
}

.acl-tree-stat i {
    color: var(--acl-tree-accent);
    font-size: 0.95rem;
}

.acl-tree-stat strong {
    font-size: 0.92rem;
    color: var(--acl-tree-ink);
}

.acl-tree-selection {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem 1rem;
    margin-bottom: 0.75rem;
    padding: 0.75rem 0.875rem;
    background:
        linear-gradient(180deg, var(--acl-tree-base-surface), var(--acl-tree-surface-strong));
}

.acl-tree-selection-copy {
    min-width: 0;
}

.acl-tree-selection-title {
    margin-top: 0.15rem;
    font-size: 1rem;
    font-weight: 700;
    color: var(--acl-tree-ink);
}

.acl-tree-selection-meta,
.acl-tree-selection-hint {
    margin-top: 0.18rem;
    font-size: 0.84rem;
    color: var(--bs-secondary-color);
}

button.acl-tree-action-button {
    display: inline-flex;
    align-items: center;
    gap: 0.45rem;
    min-height: 2rem;
    padding: 0.34rem 0.72rem;
    border-radius: 999px;
    font-size: 0.84rem;
}

button.acl-tree-action-button i {
    font-size: 0.92rem;
}

button.acl-tree-action-button--danger {
    color: var(--bs-danger-text-emphasis);
    border-color: rgba(var(--bs-danger-rgb), 0.22);
    background: rgba(var(--bs-danger-rgb), 0.08);
}

button.acl-tree-action-button--danger:hover {
    background: rgba(var(--bs-danger-rgb), 0.12);
    border-color: rgba(var(--bs-danger-rgb), 0.28);
}

.acl-tree-shell {
    position: relative;
}

.acl-tree-container {
    --acl-tree-row-min-height: 2.35rem;
    min-height: 27rem;
    padding: 0.75rem 0.875rem !important;
    background:
        radial-gradient(circle at top right, rgba(0, 228, 124, 0.1), transparent 36%),
        linear-gradient(180deg, var(--acl-tree-base-surface) 0%, var(--acl-tree-surface) 100%);
    border: 1px solid var(--acl-tree-border) !important;
    border-radius: 0.875rem !important;
    box-shadow:
        inset 0 1px 0 rgba(255, 255, 255, 0.25),
        0 0.35rem 1rem rgba(15, 23, 42, 0.04);
}

#profession-specialty-tree .jstree-node {
    min-height: var(--acl-tree-row-min-height);
    line-height: normal;
    margin-bottom: 0;
}

#profession-specialty-tree .jstree-anchor {
    display: inline-flex;
    align-items: flex-start;
    gap: 0.42rem;
    box-sizing: border-box;
    max-width: 100%;
    min-height: var(--acl-tree-row-min-height);
    height: auto;
    padding: 0.35rem 0.42rem 0.35rem 0.1rem;
    border-radius: 0.75rem;
    line-height: 1.25;
    color: var(--bs-body-color);
    text-decoration: none;
    transition:
        background-color 0.16s ease,
        box-shadow 0.16s ease;
}

#profession-specialty-tree .jstree-ocl,
#profession-specialty-tree .jstree-ocl:empty {
    height: 24px;
    line-height: 24px;
    vertical-align: middle;
}

#profession-specialty-tree .jstree-anchor:hover,
#profession-specialty-tree .jstree-hovered,
#profession-specialty-tree .jstree-clicked {
    color: var(--bs-body-color);
    background: var(--acl-tree-hover);
    box-shadow: inset 0 0 0 1px var(--acl-tree-hover-border);
}

#profession-specialty-tree .jstree-themeicon {
    color: var(--acl-tree-accent);
    font-size: 1rem;
    margin-top: 0.08rem;
}

#profession-specialty-tree:not(.acl-tree-bulk-mode) .jstree-checkbox {
    display: none;
}

#profession-specialty-tree.acl-tree-bulk-mode .jstree-node:not(.acl-tree-node--profession):not(.acl-tree-node--specialty) > .jstree-anchor .jstree-checkbox {
    display: none;
}

#profession-specialty-tree.acl-tree-bulk-mode .acl-tree-node--profession > .jstree-anchor .jstree-checkbox,
#profession-specialty-tree.acl-tree-bulk-mode .acl-tree-node--specialty > .jstree-anchor .jstree-checkbox {
    margin-top: 0.03rem;
}

.acl-tree-node-content {
    display: inline-flex;
    align-items: center;
    gap: 0.55rem;
    flex-wrap: wrap;
    min-width: 0;
}

.acl-tree-node-label {
    font-weight: 600;
    line-height: 1.25;
}

.acl-tree-node-label-empty {
    font-style: italic;
    font-weight: 500;
    color: var(--bs-secondary-color);
}

.acl-tree-node-meta {
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    flex-wrap: wrap;
}

.acl-tree-count,
.acl-tree-status {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    height: 1.5rem;
    border-radius: 999px;
    border: 1px solid var(--acl-tree-border);
    background: var(--acl-tree-chip-bg);
    color: var(--acl-tree-ink);
    box-shadow: 0 1px 2px var(--acl-tree-shadow);
}

.acl-tree-count {
    gap: 0.2rem;
    padding: 0 0.45rem;
    font-size: 0.75rem;
    font-weight: 600;
}

.acl-tree-count--count {
    background: var(--acl-tree-soft-accent);
}

.acl-tree-count--visible {
    color: #08312a;
    background: rgba(0, 123, 85, 0.14);
    border-color: rgba(0, 123, 85, 0.24);
}

.acl-tree-count--hidden {
    color: #103b33;
    background: rgba(8, 49, 42, 0.08);
    border-color: rgba(8, 49, 42, 0.16);
}

.acl-tree-count--invalid {
    color: var(--bs-danger-text-emphasis);
    background: rgba(var(--bs-danger-rgb), 0.1);
    border-color: rgba(var(--bs-danger-rgb), 0.22);
}

.acl-tree-count--unassigned {
    color: #9a5b00;
    background: rgba(255, 193, 7, 0.16);
    border-color: rgba(255, 193, 7, 0.3);
}

[data-bs-theme="dark"] .acl-tree-count--unassigned {
    color: #ffd76a;
}

.acl-tree-status {
    width: 1.5rem;
}

.acl-tree-count i,
.acl-tree-status i {
    font-size: 0.82rem;
}

.acl-tree-status--visible {
    color: #08312a;
    background: rgba(0, 123, 85, 0.14);
    border-color: rgba(0, 123, 85, 0.24);
}

.acl-tree-status--hidden {
    color: #103b33;
    background: rgba(8, 49, 42, 0.08);
    border-color: rgba(8, 49, 42, 0.16);
}

.acl-tree-status--valid {
    color: #08312a;
    background: rgba(0, 228, 124, 0.16);
    border-color: rgba(0, 228, 124, 0.28);
}

.acl-tree-status--invalid {
    color: var(--bs-danger-text-emphasis);
    background: rgba(var(--bs-danger-rgb), 0.12);
    border-color: rgba(var(--bs-danger-rgb), 0.22);
}

.acl-tree-empty-state {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1rem;
    border-radius: 0.875rem;
    background: rgba(255, 255, 255, 0.78);
    backdrop-filter: blur(3px);
}

[data-bs-theme="dark"] .acl-tree-empty-state {
    background: rgba(18, 26, 23, 0.78);
}

.acl-tree-empty-state-inner {
    max-width: 24rem;
    text-align: center;
    color: var(--acl-tree-ink);
}

.acl-tree-empty-state-inner i {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 2.5rem;
    height: 2.5rem;
    margin-bottom: 0.65rem;
    border-radius: 999px;
    background: var(--acl-tree-soft-accent);
    color: var(--acl-tree-accent);
    font-size: 1.2rem;
}

.acl-tree-empty-title {
    margin-bottom: 0.35rem;
    font-size: 1rem;
    font-weight: 700;
}

.acl-tree-empty-copy {
    margin-bottom: 0;
    color: var(--bs-secondary-color);
    font-size: 0.9rem;
}

.acl-tree-bulk-modal-summary {
    display: inline-flex;
    align-items: center;
    gap: 0.45rem;
    padding: 0.45rem 0.65rem;
    border: 1px solid var(--acl-tree-border);
    border-radius: 0.65rem;
    background: var(--acl-tree-soft-accent);
    color: var(--acl-tree-ink);
    font-size: 0.88rem;
    font-weight: 600;
}

.acl-tree-bulk-modal-summary i {
    color: var(--acl-tree-accent);
    font-size: 1rem;
}

@media (max-width: 991.98px) {
    .acl-tree-toolbar {
        grid-template-columns: 1fr;
        align-items: stretch;
    }

    .acl-tree-toolbar-actions {
        justify-content: flex-start;
    }

    .acl-tree-overview,
    .acl-tree-selection {
        align-items: flex-start;
    }
}

@media (max-width: 767.98px) {
    .acl-tree-header {
        flex-direction: column;
        align-items: stretch;
    }

    .acl-tree-header-actions {
        justify-content: flex-start;
    }

    .acl-tree-header .btn {
        align-self: flex-start;
    }

    .acl-tree-toolbar,
    .acl-tree-overview,
    .acl-tree-selection {
        padding: 0.65rem 0.75rem;
    }

    .acl-tree-container {
        min-height: 23rem;
        padding: 0.65rem 0.75rem !important;
    }

    .acl-tree-node-content {
        gap: 0.45rem;
    }

    .acl-tree-node-meta {
        gap: 0.25rem;
    }
}
