.system__modal-backdrop {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    z-index: 1;
}

.system__modal {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 100%;
    max-width: 800px;
    box-shadow: 0 0 7px 1px rgba(0, 0, 0, .5);
    z-index: 2;
    border-radius: 10px 10px 0 0;
}

.system__modal_title {
    padding: 10px;
    background: #EDF2F7;
    border-bottom: 1px solid #BFBFBF;
    border-radius: 10px 10px 0 0;
    text-align: center;
    font-weight: bold;
    font-size: 16px !important;
    color: #003681;
    text-wrap: nowrap;
    text-overflow: ellipsis;
}

.system__modal_body {
    padding: 10px 10px 10px 10px;
    background: white;
    max-height: 80vh;
    overflow-y: auto;
}

.system__modal_footer {
    border-top: 1px solid #BFBFBF;
    padding: 5px;
    background: #EDF2F7;
    display: flex;
    justify-content: space-between;
}

.system__modal_footer-button {
    border: 1px solid #BFBFBF;
    padding: 7px;
    text-align: center;
    min-width: 100px;
    font-weight: bold;
    background: #f1f1f1;
}

.system__modal_footer-link {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
}

.text-wrapper {
    max-width: 25rem; /* Adjust as needed */
    overflow: hidden;
    display: flex;
    align-items: center;
}

.text-wrapper .text-container {
    overflow: hidden;
    white-space: nowrap;
    text-overflow: ellipsis;
    flex: 1;
}

.text-wrapper .more-link {
    display: none;
}

.text-wrapper .text-container.expanded {
    white-space: normal;
    overflow: visible;
    text-overflow: clip;
}

/* Родитель, у которого есть прямой потомок .tgx-attach-action-buttons */
*:has(> .tgx-attach-action-buttons) {
    position: relative;
}

/* Скрываем все прямые кнопки */
*:has(> .tgx-attach-action-buttons) > .tgx-attach-action-buttons {
    opacity: 0;
    filter: blur(5px);
    visibility: hidden;
    pointer-events: none;
    transition: opacity 0.3s ease, filter 0.3s ease, visibility 0s linear 0.3s;
}

*:has(> .tgx-attach-action-buttons:hover > :not(:empty)):hover {
    outline: 1px dotted #2761a1;
}

/* Показываем кнопки только при наведении на родителя */
*:has(> .tgx-attach-action-buttons):hover > .tgx-attach-action-buttons,
*:has(> .tgx-attach-action-buttons):focus-within > .tgx-attach-action-buttons {
    opacity: 0.75;
    filter: blur(0);
    visibility: visible;
    pointer-events: auto;
    transition: opacity 0.3s ease, filter 0.3s ease, visibility 0s linear;
}

*:has(> .tgx-attach-action-buttons):hover > .tgx-attach-action-buttons:hover {
    opacity: 1;
}


/* По умолчанию: ширина 100% */
#srv-admin-panel {
    width: 100%;
}

/* На экранах от 768px и больше: высота 100% */
@media (min-width: 768px) {
    #srv-admin-panel {
        width: auto;
        height: 100%;
    }
}

.render-markdown-header a {
    display: none;
}

.render-markdown-header:hover a {
    display: inline;
}

*:has(> *:only-child) > *:only-child > .tgx-attach-action-buttons > .btn-delete {
    display: none !important;
}

*:has(> *:only-child) > *:only-child > .tgx-attach-action-buttons > .btn-move {
    display: none !important;
}

.ql-container {
    font-size: unset !important;
}

.ql-container .ql-editor [style*="font-size"],
.ql-container .ql-editor [style*="font-family"],
.ql-container .ql-editor [style*="color"],
.ql-container .ql-editor [style*="background-color"] {
    all: unset !important;
    font-size: inherit !important;
    font-family: inherit !important;
    color: inherit !important;
    background-color: transparent !important;
}

.ql-editor {
    padding: 0 !important;
}

.ql-toolbar {
    width: 100%;
}

.tree {
    font-size: 0.95rem;
}

.tree ul {
    list-style: none;
    margin: 0;
    padding-left: 1rem;
    border-left: 1px dashed #ccc;
}

.tree li {
    margin: 0.4rem 0;
    position: relative;
}


.tree li > .action {
    opacity: 0;
    transition: opacity 0.3s ease;
}

.tree li:hover > .action {
    opacity: 1;
}

.tree li::before {
    content: "";
    position: absolute;
    left: -1rem;
    top: 0.7rem;
    width: 0.8rem;
    height: 1px;
}

.tree button {
    background: none;
    border: none;
    padding: 0;
    font-weight: 500;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 0.4rem;
}

.tree button:hover {
    text-decoration: underline;
}

.tree .icon-toggle {
    transition: transform 0.2s ease;
}

.tree button[aria-expanded="true"] .icon-toggle {
    transform: rotate(90deg);
}

.tree .add-page {
    cursor: pointer;
}

.tree .add-page:hover {
    text-decoration: underline;
}

.btn-move {
    cursor: grab;
}