:root {
    --tc-scale: 1;
}

html,
body {
    height: 100%;
    margin: 0;
    font-family: Segoe UI, Arial, sans-serif;
    font-size: calc(14px * var(--tc-scale, 1));
    overflow-x: hidden;
    width: 100%;
    max-width: 100vw;
    box-sizing: border-box;
}

body {
    display: flex;
    flex-direction: column;
}

.tool-bar {
    height: calc(40px * var(--tc-scale, 1));
    border-bottom: 1px solid #ccc;
    display: flex;
    align-items: center;
    padding: 0 calc(6px * var(--tc-scale, 1));
    box-sizing: border-box;
    width: 100%;
    max-width: 100vw;
    overflow-x: auto;
    overflow-y: hidden;
    white-space: nowrap;
    flex-shrink: 0;
    -webkit-overflow-scrolling: touch;
    touch-action: pan-x;
    scrollbar-width: thin;
}

.tool-bar::-webkit-scrollbar {
    height: 3px;
}

.tool-bar::-webkit-scrollbar-thumb {
    background: rgba(0, 0, 0, 0.2);
    border-radius: 2px;
}

.toolbar-button {
    width: calc(32px * var(--tc-scale, 1));
    height: calc(32px * var(--tc-scale, 1));
    min-width: calc(32px * var(--tc-scale, 1));
    aspect-ratio: 1 / 1;
    flex-shrink: 0;

    margin-right: calc(4px * var(--tc-scale, 1));
    padding: 0;

    display: flex;
    align-items: center;
    justify-content: center;

    border: 1px solid #c8c8c8;
    border-radius: 4px;
    background: #f5f5f5;

    font-size: calc(16px * var(--tc-scale, 1));
    cursor: pointer;
    user-select: none;
    outline: none;
    -webkit-tap-highlight-color: transparent;
    transition: background-color 0.15s ease, border-color 0.15s ease, box-shadow 0.15s ease, transform 0.1s ease;
}

.toolbar-button:focus:not(:focus-visible) {
    outline: none;
}

.toolbar-button:hover:not(:disabled):not(.active) {
    background: #e8e8e8;
    border-color: #b0b0b0;
}

.toolbar-button:active:not(:disabled) {
    background: #d4d4d4;
    transform: translateY(1px);
}

.toolbar-button.active {
    background: #b8d7ff;
    border-color: #0b57d0;
    box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.2), inset 0 -3px 0 #0b57d0;
    transform: translateY(1px);
}

.toolbar-button.active:hover:not(:disabled) {
    background: #a8cfff;
    border-color: #004bb5;
    box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.25), inset 0 -3px 0 #004bb5;
}

.toolbar-button:disabled {
    opacity: 0.35;
    cursor: default;
}

.tc-icon-svg {
    width: calc(18px * var(--tc-scale, 1));
    height: calc(18px * var(--tc-scale, 1));
    display: inline-block;
    vertical-align: middle;
    pointer-events: none;
}

.workspace {
    flex: 1;
    display: flex;
    overflow: hidden;
    max-width: 100vw;
    box-sizing: border-box;
    position: relative;
}

.tree-panel {
    width: 40%;
    min-width: 60px;
    max-width: calc(100% - 60px);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    box-sizing: border-box;
    flex-shrink: 0;
}

.resizer {
    width: 6px;
    background: #e0e0e0;
    cursor: col-resize;
    user-select: none;
    touch-action: none;
    flex-shrink: 0;
    position: relative;
    z-index: 10;
    transition: background-color 0.15s ease;
}

.resizer:hover,
.resizer.resizing {
    background: #4a90e2;
}

.resizer::after {
    content: "";
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 2px;
    height: 24px;
    background: #aaa;
    border-radius: 1px;
}

.resizer:hover::after,
.resizer.resizing::after {
    background: #fff;
}

.properties-panel {
    position: relative;
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    box-sizing: border-box;
    container-type: inline-size;
}

.panel-title {
    padding: calc(6px * var(--tc-scale, 1)) calc(10px * var(--tc-scale, 1));
    font-weight: bold;
    font-size: calc(14px * var(--tc-scale, 1));
    border-bottom: 1px solid #ddd;
    background: #f3f3f3;
    display: flex;
    align-items: center;
    justify-content: space-between;
    min-height: calc(24px * var(--tc-scale, 1));
    box-sizing: border-box;
    flex-wrap: wrap;
    gap: calc(4px * var(--tc-scale, 1));
}

.panel-title-text {
    display: flex;
    align-items: center;
    gap: 4px;
}

.panel-title-interactive {
    cursor: pointer;
    user-select: none;
    padding: 2px 4px;
    border-radius: 3px;
    transition: background-color 0.15s, color 0.15s;
}

.panel-title-interactive:hover {
    background-color: #e2ecf9;
    color: #0b57d0;
}

.modal-confirm-dialog {
    width: 420px;
    max-width: 90vw;
}

.modal-confirm-body {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 20px 24px;
}

.modal-confirm-icon {
    font-size: 32px;
    line-height: 1;
    flex-shrink: 0;
}

.modal-confirm-message {
    font-size: 15px;
    color: #222;
    line-height: 1.4;
}

.modal-confirm-highlight {
    font-weight: bold;
    color: #0b57d0;
    margin-top: 4px;
}

.panel-controls {
    display: flex;
    align-items: center;
    gap: 6px;
    font-weight: normal;
}

.data-lang-label {
    font-size: 15px;
    cursor: pointer;
    user-select: none;
}

.interface-lang-control {
    display: flex;
    align-items: center;
    gap: 4px;
    margin-left: 10px;
}

.interface-lang-label {
    font-size: 15px;
    cursor: pointer;
    user-select: none;
    filter: hue-rotate(280deg) saturate(2) brightness(0.65);
    display: inline-flex;
    align-items: center;
}

.panel-content {
    flex: 1;
    min-height: 0;
    padding: calc(10px * var(--tc-scale, 1));
    overflow: auto;
}

.properties-actions {
    display: flex;
    justify-content: flex-end;
    flex-wrap: wrap;
    gap: calc(8px * var(--tc-scale, 1));
    padding: calc(10px * var(--tc-scale, 1));
    border-top: 1px solid #ddd;
    box-sizing: border-box;
    max-width: 100%;
    overflow: hidden;
}

.properties-actions:empty {
    display: none;
}

.properties-actions button {
    padding: calc(5px * var(--tc-scale, 1)) calc(12px * var(--tc-scale, 1));
    font-size: calc(13px * var(--tc-scale, 1));
    cursor: pointer;
    white-space: nowrap;
    max-width: 100%;
    box-sizing: border-box;
}

.properties-actions button:disabled {
    cursor: default;
    opacity: 0.5;
}

@container (max-width: 130px) {
    .properties-actions {
        display: none !important;
    }
}

.status-bar {
    height: 28px;

    border-top: 1px solid #ccc;

    display: flex;
    align-items: center;

    padding: 0 10px;
    box-sizing: border-box;
    max-width: 100vw;
    overflow: hidden;
}

.tree {
    user-select: none;
    font-size: calc(14px * var(--tc-scale, 1));
}

.tree-row {
    min-height: calc(26px * var(--tc-scale, 1));
    padding: calc(3px * var(--tc-scale, 1)) calc(8px * var(--tc-scale, 1));
    box-sizing: border-box;
    cursor: pointer;
    border-radius: 4px;
    display: flex;
    align-items: center;
    gap: calc(4px * var(--tc-scale, 1));
    user-select: none;
}

.tree-row.selected {
    background: #cfe5ff;
}

.tree-row:hover {
    background: #e9f2ff;
}

.tree-row.tree-row-deleted {
    opacity: 0.55;
    color: #777;
}

.tree-row.tree-row-deleted .tree-label {
    text-decoration: line-through;
}

.tree-row.tree-row-deleted.selected {
    background: #e2eaf4;
}

.tree-row.tree-row-deleted:hover {
    background: #edf3fa;
}

.tree-panel-header {
    display: flex;
    align-items: center;
    justify-content: flex-start;
    gap: calc(8px * var(--tc-scale, 1));
    user-select: none;
    cursor: pointer;
    transition: background-color 0.15s;
}

.tree-panel-header:hover {
    background-color: #e2e8f0;
}

.tree-panel-header.selected {
    background-color: #cfe5ff;
    color: #0b5ed7;
    font-weight: 600;
}

.tree-select-all {
    cursor: pointer;
    margin: 0;
    width: calc(15px * var(--tc-scale, 1));
    height: calc(15px * var(--tc-scale, 1));
}

.tree-node-checkbox {
    cursor: pointer;
    margin: 0 calc(4px * var(--tc-scale, 1)) 0 calc(2px * var(--tc-scale, 1));
    width: calc(14px * var(--tc-scale, 1));
    height: calc(14px * var(--tc-scale, 1));
    flex-shrink: 0;
}

.tree-toggle {
    display: inline-flex;
    width: calc(20px * var(--tc-scale, 1));
    height: calc(20px * var(--tc-scale, 1));
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: calc(15px * var(--tc-scale, 1));
    line-height: 1;
    color: #555;
    flex-shrink: 0;
    border-radius: 3px;
}

.tree-toggle:hover {
    background: rgba(0, 0, 0, 0.08);
    color: #000;
}

.tree-toggle-empty {
    width: calc(20px * var(--tc-scale, 1));
    height: calc(20px * var(--tc-scale, 1));
    display: inline-block;
    flex-shrink: 0;
}

.tree-node-title {
    flex: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.tree-card-row {
    min-height: calc(70px * var(--tc-scale, 1));
    align-items: stretch;
    gap: calc(8px * var(--tc-scale, 1));
}

.tree-card-image {
    width: calc(60px * var(--tc-scale, 1));
    height: calc(60px * var(--tc-scale, 1));
    flex: 0 0 auto;
    object-fit: contain;
    border: 1px solid #d7dde5;
    border-radius: 4px;
    background: #fff;
}

.tree-card-image-placeholder {
    display: flex;
    align-items: center;
    justify-content: center;
    color: #a4afbd;
    font-size: calc(28px * var(--tc-scale, 1));
}

.tree-card-details {
    min-width: 0;
    flex: 1;
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: calc(4px * var(--tc-scale, 1));
}

.tree-card-details .tree-node-title {
    flex: none;
}

.tree-card-price {
    color: #0757b8;
    font-weight: 700;
    font-size: calc(15px * var(--tc-scale, 1));
}

/* ===== Верхнее меню ===== */

.menu-bar {
    border-bottom: 1px solid #ccc;

    position: relative;
    z-index: 1000;

    display: flex;
    flex-direction: row;
    align-items: center;
    justify-content: space-between;

    height: calc(35px * var(--tc-scale, 1));
    padding: 0 calc(10px * var(--tc-scale, 1));
    background: #fff;
    box-sizing: border-box;
    overflow: visible;
}

.admin-menu-bar {
    background: #c62828;
    border-bottom: 1px solid #b71c1c;
    color: #fff;
}

/* ===== Мобильная кнопка бургера и заголовок ===== */
.mobile-menu-toggle-btn {
    display: none;
    background: transparent;
    border: none;
    font-size: calc(20px * var(--tc-scale, 1));
    line-height: 1;
    color: inherit;
    padding: 0 calc(8px * var(--tc-scale, 1));
    height: 100%;
    cursor: pointer;
    user-select: none;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    -webkit-tap-highlight-color: transparent;
}

.mobile-app-title {
    display: none;
    font-weight: bold;
    font-size: calc(14px * var(--tc-scale, 1));
    color: inherit;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    margin-left: 4px;
    flex: 1;
}

/* ===== Мобильная шторка меню (Drawer) ===== */
.mobile-drawer-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(0, 0, 0, 0.45);
    backdrop-filter: blur(2px);
    z-index: 4000;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.25s ease, visibility 0.25s ease;
    touch-action: none;
}

.mobile-drawer-overlay.open {
    opacity: 1;
    visibility: visible;
}

.mobile-drawer {
    position: fixed;
    top: 0;
    left: 0;
    width: 300px;
    max-width: 85vw;
    height: 100%;
    background: #ffffff;
    z-index: 4001;
    display: flex;
    flex-direction: column;
    box-shadow: 4px 0 20px rgba(0, 0, 0, 0.25);
    transform: translateX(-100%);
    transition: transform 0.25s cubic-bezier(0.1, 0.9, 0.2, 1);
    box-sizing: border-box;
}

.mobile-drawer.open {
    transform: translateX(0);
}

.mobile-drawer-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 16px;
    height: 48px;
    background: #f5f5f5;
    border-bottom: 1px solid #ddd;
    flex-shrink: 0;
}

.admin-drawer .mobile-drawer-header {
    background: #c62828;
    color: #fff;
    border-bottom-color: #b71c1c;
}

.mobile-drawer-title {
    font-weight: bold;
    font-size: 15px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.mobile-drawer-close-btn {
    background: transparent;
    border: none;
    font-size: 20px;
    font-weight: bold;
    color: inherit;
    cursor: pointer;
    padding: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 4px;
}

.mobile-drawer-content {
    flex: 1;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    padding-bottom: 24px;
}

.mobile-drawer-section {
    border-bottom: 1px solid #eee;
    padding: 8px 0;
}

.mobile-drawer-section-title {
    padding: 6px 16px 4px 16px;
    font-size: 11px;
    font-weight: bold;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: #888;
}

.mobile-drawer-item {
    display: flex;
    align-items: center;
    padding: 10px 16px;
    font-size: 14px;
    color: #222;
    cursor: pointer;
    user-select: none;
    -webkit-tap-highlight-color: transparent;
    transition: background-color 0.15s;
    min-height: 40px;
    box-sizing: border-box;
}

.mobile-drawer-item:active {
    background: #e9f2ff;
}

.mobile-drawer-item.disabled {
    opacity: 0.4;
    cursor: not-allowed;
    pointer-events: none;
    color: #999;
}

.mobile-drawer-item-danger {
    color: #d32f2f;
    font-weight: 500;
}

.mobile-drawer-zoom {
    justify-content: space-between;
}

.admin-menu-bar .menu-item {
    color: #fff;
}

.admin-menu-bar .menu-item:hover,
.admin-menu-bar .menu-item.open {
    background: #b71c1c;
}

.admin-menu-bar .dropdown-menu {
    color: #333;
}

.admin-menu-bar .menu-lang-select {
    background: #b71c1c;
    border: 1px solid #ef9a9a;
    color: #fff;
}

.admin-menu-bar .menu-lang-select:hover {
    background: #a31515;
    border-color: #ffcdd2;
}

.admin-menu-bar .menu-lang-select option {
    background: #fff;
    color: #333;
}

.menu-bar-left {
    display: flex;
    flex-direction: row;
    align-items: center;
    height: 100%;
    flex: 1;
    min-width: 0;
    overflow-x: auto;
    overflow-y: hidden;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none; /* Firefox */
}

.menu-bar-left::-webkit-scrollbar {
    display: none; /* Chrome, Safari, Edge */
}

.menu-bar-right {
    display: flex;
    align-items: center;
    flex-shrink: 0;
    margin-left: calc(6px * var(--tc-scale, 1));
}

.menu-lang-select {
    padding: calc(3px * var(--tc-scale, 1)) calc(8px * var(--tc-scale, 1));
    border: 1px solid #c8c8c8;
    border-radius: 4px;
    background: #f8f8f8;
    font-size: calc(13px * var(--tc-scale, 1));
    font-family: inherit;
    color: #333;
    cursor: pointer;
    outline: none;
}

.menu-lang-select:hover {
    background: #eee;
    border-color: #aaa;
}

.menu-lang-select:focus {
    border-color: #0056d2;
}


/* ===== Пункты верхнего меню ===== */

.menu-item {
    position: relative;

    display: flex;
    align-items: center;

    height: calc(35px * var(--tc-scale, 1));
    padding: 0 calc(10px * var(--tc-scale, 1));
    font-size: calc(13px * var(--tc-scale, 1));

    white-space: nowrap;
    cursor: pointer;
    user-select: none;
}

.menu-item:hover,
.menu-item.open {
    background: #e9e9e9;
}


/* ===== Выпадающее меню ===== */

.dropdown-menu {
    display: none;

    position: absolute;
    top: calc(35px * var(--tc-scale, 1));
    left: 0;

    min-width: 260px;
    max-width: 90vw;

    background: white;
    border: 1px solid #bbb;
    box-shadow: 2px 2px 5px rgba(0, 0, 0, 0.15);

    z-index: 2000;
}

.menu-item:hover > .dropdown-menu,
.menu-item.open > .dropdown-menu {
    display: block;
}


/* ===== Пункты выпадающего меню ===== */

.menu-option {
    display: flex;
    align-items: center;
    width: 100%;
    box-sizing: border-box;
    padding: calc(7px * var(--tc-scale, 1)) calc(12px * var(--tc-scale, 1));
    font-size: calc(13px * var(--tc-scale, 1));
    cursor: pointer;
}

a.menu-option,
a.mobile-drawer-item,
a.toolbar-button {
    color: inherit;
    text-decoration: none;
}

.menu-option-zoom {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: calc(8px * var(--tc-scale, 1));
    cursor: default !important;
    user-select: none;
    padding: calc(5px * var(--tc-scale, 1)) calc(12px * var(--tc-scale, 1));
}

.menu-option-zoom:hover {
    background: transparent !important;
}

.zoom-controls {
    display: inline-flex;
    align-items: center;
    gap: calc(3px * var(--tc-scale, 1));
    background: #f0f4f9;
    border: 1px solid #d0d7de;
    border-radius: 4px;
    padding: calc(2px * var(--tc-scale, 1)) calc(4px * var(--tc-scale, 1));
}

.zoom-btn {
    width: calc(24px * var(--tc-scale, 1));
    height: calc(22px * var(--tc-scale, 1));
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: #ffffff;
    border: 1px solid #c2e7ff;
    border-radius: 3px;
    font-size: calc(14px * var(--tc-scale, 1));
    font-weight: bold;
    cursor: pointer;
    user-select: none;
    line-height: 1;
    color: #0b57d0;
    padding: 0;
    transition: background-color 0.15s, border-color 0.15s;
}

.zoom-btn:hover:not(:disabled) {
    background: #d3e3fd;
    border-color: #7cacf8;
}

.zoom-btn:active:not(:disabled) {
    background: #b8d7ff;
    transform: translateY(1px);
}

.zoom-btn:disabled {
    opacity: 0.35;
    cursor: default;
}

.zoom-value {
    font-size: calc(12px * var(--tc-scale, 1));
    font-weight: 600;
    color: #0b57d0;
    min-width: calc(40px * var(--tc-scale, 1));
    text-align: center;
    cursor: pointer;
    padding: calc(2px * var(--tc-scale, 1)) calc(4px * var(--tc-scale, 1));
    border-radius: 3px;
    transition: background-color 0.15s;
}

.zoom-value:hover {
    background-color: #d3e3fd;
    text-decoration: underline;
}

.menu-option:hover:not(.disabled):not(.menu-option-zoom) {
    background: #e9f2ff;
}

.menu-option.disabled {
    opacity: 0.45;
    cursor: not-allowed;
    pointer-events: none;
    color: #888;
}

.menu-check {
    display: inline-block;
    width: calc(20px * var(--tc-scale, 1));
    font-size: calc(14px * var(--tc-scale, 1));
    font-weight: bold;
    color: #0056d2;
    flex-shrink: 0;
}

.menu-text {
    flex: 1;
    font-size: inherit;
}


/* ===== Разделитель ===== */

.menu-separator {
    height: 1px;
    margin: calc(4px * var(--tc-scale, 1)) 0;
    background: #ddd;
}


/* ===== Горячие клавиши ===== */

.shortcut {
    margin-left: auto;
    padding-left: calc(20px * var(--tc-scale, 1));
    font-size: calc(12px * var(--tc-scale, 1));
    white-space: nowrap;
}


/* ===== Подменю ===== */

.has-submenu {
    position: relative;
    padding-right: 30px;
}

.has-submenu::after {
    content: "▶";

    position: absolute;
    right: 8px;

    font-size: 10px;
    color: #666;
}

.submenu {
    display: none;

    position: absolute;
    top: -1px;
    left: 100%;

    min-width: 180px;

    background: white;
    border: 1px solid #bbb;
    box-shadow: 2px 2px 5px rgba(0, 0, 0, 0.15);

    z-index: 3000;
}

.has-submenu:hover > .submenu {
    display: block;
}

.property {
    margin-bottom: calc(14px * var(--tc-scale, 1));
}

.property-label {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: calc(6px * var(--tc-scale, 1));
    margin-bottom: calc(4px * var(--tc-scale, 1));
    font-size: calc(13px * var(--tc-scale, 1));
    color: #666;
}

.property-label-left {
    display: flex;
    align-items: center;
    gap: calc(6px * var(--tc-scale, 1));
    flex-wrap: wrap;
}

.image-download-all-btn {
    display: inline-flex;
    align-items: center;
    gap: calc(4px * var(--tc-scale, 1));
    padding: calc(2px * var(--tc-scale, 1)) calc(8px * var(--tc-scale, 1));
    font-size: calc(11px * var(--tc-scale, 1));
    font-weight: 500;
    color: #0b57d0;
    background: #f0f4f9;
    border: 1px solid #c2e7ff;
    border-radius: 4px;
    cursor: pointer;
    line-height: calc(18px * var(--tc-scale, 1));
    transition: background 0.15s, border-color 0.15s;
    user-select: none;
    margin-left: auto;
}

.image-download-all-btn:hover {
    background: #d3e3fd;
    border-color: #7cacf8;
    color: #041e49;
}

.image-property-actions {
    display: inline-flex;
    align-items: center;
    gap: calc(6px * var(--tc-scale, 1));
    margin-left: auto;
}

.image-optimize-btn {
    display: inline-flex;
    align-items: center;
    gap: calc(4px * var(--tc-scale, 1));
    padding: calc(2px * var(--tc-scale, 1)) calc(8px * var(--tc-scale, 1));
    font-size: calc(11px * var(--tc-scale, 1));
    font-weight: 500;
    color: #176f42;
    background: #edf8f0;
    border: 1px solid #b8dfc4;
    border-radius: 4px;
    cursor: pointer;
    line-height: calc(18px * var(--tc-scale, 1));
    transition: background 0.15s, border-color 0.15s;
    white-space: nowrap;
}

.image-optimize-btn:hover {
    background: #d8f0df;
    border-color: #75bc8a;
    color: #0d542e;
}

.image-optimization-dialog {
    width: min(620px, 94vw);
}

.image-optimization-description {
    margin: 0 0 12px;
}

.image-optimization-progress,
.image-optimization-empty {
    padding: 12px;
    color: #666;
    text-align: center;
}

.image-optimization-list {
    max-height: min(46vh, 360px);
    overflow-y: auto;
    border: 1px solid #d8d8d8;
    border-radius: 5px;
}

.image-optimization-row {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr) auto;
    align-items: center;
    gap: 10px;
    padding: 9px 10px;
    cursor: pointer;
    border-bottom: 1px solid #ececec;
}

.image-optimization-row:last-child {
    border-bottom: none;
}

.image-optimization-row:hover {
    background: #f7fbff;
}

.image-optimization-name {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.image-optimization-size {
    color: #176f42;
    font-size: 12px;
    white-space: nowrap;
}

.image-optimization-total {
    margin-top: 12px;
    font-weight: 600;
    text-align: right;
}

.image-optimization-warning {
    margin: 12px 0 0;
    color: #9c4d00;
    font-size: 12px;
}

@media (max-width: 520px) {
    .image-optimization-row {
        grid-template-columns: auto minmax(0, 1fr);
    }

    .image-optimization-size {
        grid-column: 2;
    }
}

.property-name {
    font-weight: normal;
    color: #555;
}

.property-type-badge {
    font-size: calc(11px * var(--tc-scale, 1));
    color: #888;
    background: #f0f0f0;
    border: 1px solid #e0e0e0;
    border-radius: 3px;
    padding: 0 calc(5px * var(--tc-scale, 1));
    line-height: calc(16px * var(--tc-scale, 1));
    font-weight: normal;
    user-select: none;
}

.property-conf-badge,
.property-localized-badge {
    font-size: calc(13px * var(--tc-scale, 1));
    margin: 0 calc(2px * var(--tc-scale, 1));
    cursor: default;
}

.property-value {
    min-height: calc(30px * var(--tc-scale, 1));
    max-height: calc(1.4em * 4 + 14px);
    padding: calc(5px * var(--tc-scale, 1)) calc(7px * var(--tc-scale, 1));
    border: 1px solid #d0d0d0;
    background: #fff;
    border-radius: 3px;
    box-sizing: border-box;
    white-space: pre-wrap;
    word-break: break-word;
    overflow-y: auto;
    font: inherit;
    font-size: calc(14px * var(--tc-scale, 1));
    line-height: 1.4;
}

.property-value-url {
    color: #0b57d0;
    text-decoration: underline;
    cursor: pointer;
    word-break: break-all;
    display: inline-flex;
    align-items: center;
    gap: 4px;
}

.property-value-url:hover {
    color: #0033a0;
}

.property-url-open-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: calc(3px * var(--tc-scale, 1)) calc(6px * var(--tc-scale, 1));
    background: #f1f3f4;
    border: 1px solid #ccc;
    border-radius: 3px;
    cursor: pointer;
    font-size: calc(12px * var(--tc-scale, 1));
    color: #333;
    transition: background 0.15s, border-color 0.15s;
    user-select: none;
    text-decoration: none;
}

.property-url-open-btn:hover {
    background: #e3f2fd;
    border-color: #0b57d0;
    color: #0b57d0;
}

.property-input {
    width: 100%;
    min-height: calc(30px * var(--tc-scale, 1));
    padding: calc(5px * var(--tc-scale, 1)) calc(7px * var(--tc-scale, 1));
    border: 1px solid #b8b8b8;
    background: #fff;
    border-radius: 3px;
    box-sizing: border-box;
    font: inherit;
    font-size: calc(14px * var(--tc-scale, 1));
    line-height: 1.4;
}

.property-input[type="date"],
.property-input[type="time"],
.property-input[type="datetime-local"] {
    height: calc(30px * var(--tc-scale, 1));
    padding-top: 0;
    padding-bottom: 0;
}

.property-textarea {
    width: 100%;
    min-height: calc(30px * var(--tc-scale, 1));
    box-sizing: border-box;
    padding: calc(5px * var(--tc-scale, 1)) calc(7px * var(--tc-scale, 1));
    border: 1px solid #b8b8b8;
    border-radius: 3px;
    resize: none;
    overflow-y: auto;
    font: inherit;
    font-size: calc(14px * var(--tc-scale, 1));
    line-height: 1.4;
}

.property-value-row {
    display: flex;
    align-items: stretch;
    gap: calc(4px * var(--tc-scale, 1));
}

.property-value-row .property-value {
    flex: 1;
    min-width: 0;
}

.property-copy-button {
    flex: 0 0 calc(30px * var(--tc-scale, 1));
    padding: 0;

    border: 1px solid #d0d0d0;
    border-radius: 3px;
    background: #f5f5f5;

    display: flex;
    align-items: center;
    justify-content: center;

    font-size: calc(15px * var(--tc-scale, 1));
    cursor: pointer;
}

.property-copy-button:hover {
    background: #e9e9e9;
}

.property-copy-button:active {
    background: #dcdcdc;
}

.property-input-confidential {
    -webkit-text-security: disc;
}

.instance-badge {
    font-size: 0.85em;
    color: #888;
    font-weight: normal;
    margin-left: 2px;
}

.property-instance-item {
    margin-bottom: calc(6px * var(--tc-scale, 1));
}

.property-instance-item:last-child {
    margin-bottom: 0;
}

.property-instance-delete-btn {
    flex: 0 0 calc(30px * var(--tc-scale, 1));
    height: calc(30px * var(--tc-scale, 1));
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: 1px solid #d9d9d9;
    background: #fff;
    color: #e03131;
    border-radius: 3px;
    font-size: calc(16px * var(--tc-scale, 1));
    font-weight: bold;
    cursor: pointer;
    line-height: 1;
    padding: 0;
    transition: background 0.15s, border-color 0.15s;
}

.property-instance-delete-btn:hover {
    background: #ffe3e3;
    border-color: #ffa8a8;
}

.property-instance-add-row {
    margin-top: calc(4px * var(--tc-scale, 1));
    margin-bottom: calc(4px * var(--tc-scale, 1));
}

.property-instance-add-btn {
    display: inline-flex;
    align-items: center;
    gap: calc(4px * var(--tc-scale, 1));
    padding: calc(4px * var(--tc-scale, 1)) calc(8px * var(--tc-scale, 1));
    font-size: calc(12px * var(--tc-scale, 1));
    border: 1px dashed #4dabf7;
    background: #e7f5ff;
    color: #1971c2;
    border-radius: 4px;
    cursor: pointer;
    transition: background 0.15s, border-color 0.15s;
}

.property-instance-add-btn:hover {
    background: #d0ebff;
    border-color: #339af0;
}

/* ===== Модальные окна ===== */

.modal-backdrop {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(0, 0, 0, 0.4);
    z-index: 2000;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* ===== Всплывающая подсказка для тач-устройств (Touch Tooltip) ===== */

.touch-tooltip {
    position: fixed;
    z-index: 10000;
    background: rgba(30, 30, 30, 0.92);
    color: #ffffff;
    font-size: 13px;
    line-height: 1.3;
    padding: 6px 12px;
    border-radius: 6px;
    box-shadow: 0 4px 14px rgba(0, 0, 0, 0.28);
    pointer-events: none;
    user-select: none;
    max-width: 250px;
    text-align: center;
    white-space: normal;
    word-wrap: break-word;
    opacity: 0;
    transform: translateY(4px);
    transition: opacity 0.2s ease, transform 0.2s ease;
}

.touch-tooltip.visible {
    opacity: 1;
    transform: translateY(0);
}

.param-lang-icon {
    cursor: pointer;
}

.modal-dialog {
    position: relative;
    background: #fff;
    border-radius: 4px;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.2);
    width: 380px;
    max-width: 90vw;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.modal-header {
    padding: 10px 14px;
    border-bottom: 1px solid #ddd;
    background: #f3f3f3;
    display: flex;
    align-items: center;
    justify-content: space-between;
    font-weight: bold;
    font-size: 14px;
}

.modal-title-wrap {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

.admin-badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 2px 8px;
    font-size: 12px;
    font-weight: 600;
    color: #9a3b00;
    background: #fff4e5;
    border: 1px solid #ffd8a8;
    border-radius: 12px;
    user-select: none;
    white-space: nowrap;
}

.admin-badge-icon {
    font-size: 13px;
    line-height: 1;
}

.modal-close {
    background: none;
    border: none;
    font-size: 20px;
    line-height: 1;
    cursor: pointer;
    color: #666;
    padding: 0 4px;
}

.modal-close:hover {
    color: #000;
}

.modal-body {
    padding: 12px;
}

#template-list {
    width: 100%;
    font: inherit;
    font-size: 14px;
    border: 1px solid #ccc;
    border-radius: 3px;
    outline: none;
}

#template-list:focus {
    border-color: #8ab4e8;
}

#template-list option.template-option-deleted {
    color: #777;
    opacity: 0.6;
    text-decoration: line-through;
}

.template-select-table-wrapper {
    width: 100%;
    max-height: 240px;
    min-height: 180px;
    overflow-y: auto;
    border: 1px solid #ccc;
    border-radius: 4px;
    background: #fff;
    outline: none;
}

.template-select-table-wrapper:focus {
    border-color: #8ab4e8;
    box-shadow: 0 0 0 2px rgba(13, 110, 253, 0.15);
}

.template-select-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 14px;
    table-layout: fixed;
}

.template-select-table th {
    position: sticky;
    top: 0;
    background: #f1f3f4;
    padding: 8px 12px;
    border-bottom: 1px solid #ccc;
    font-weight: 600;
    color: #333;
    z-index: 2;
    user-select: none;
}

.template-select-table td {
    padding: 6px 12px;
    border-bottom: 1px solid #eee;
    vertical-align: middle;
}

.template-select-row {
    cursor: pointer;
    user-select: none;
    transition: background 0.1s ease;
}

.template-select-row:hover {
    background: #f0f7ff;
}

.template-select-row.selected {
    background: #cfe2ff !important;
    color: #084298;
    font-weight: 500;
}

.template-select-row.template-option-deleted td {
    color: #777;
    opacity: 0.6;
}

.template-select-row.template-option-deleted .template-name-text {
    text-decoration: line-through;
}

.col-template-name {
    width: auto;
    text-align: left;
}

.col-template-node-count {
    width: 150px;
    text-align: right;
}

.template-user-created {
    font-weight: 700;
}

.template-name-cell {
    display: flex;
    align-items: center;
    gap: 8px;
    overflow: hidden;
    white-space: nowrap;
    text-overflow: ellipsis;
}

.template-name-text {
    overflow: hidden;
    white-space: nowrap;
    text-overflow: ellipsis;
}

.template-custom-cell {
    text-align: center;
}

.template-custom-check {
    color: #198754;
    font-weight: bold;
    font-size: 16px;
    display: inline-block;
    line-height: 1;
}

.template-select-icon-img {
    width: 18px;
    height: 18px;
    object-fit: contain;
    flex-shrink: 0;
}

.template-select-icon-emoji {
    font-size: 16px;
    flex-shrink: 0;
    line-height: 1;
}

.modal-footer {
    padding: 10px 14px;
    border-top: 1px solid #ddd;
    display: flex;
    justify-content: flex-end;
    gap: 8px;
    background: #fafafa;
}

.modal-footer-left {
    justify-content: flex-start;
}

.modal-footer .btn {
    padding: 5px 14px;
    border: 1px solid #ccc;
    border-radius: 3px;
    background: #f5f5f5;
    cursor: pointer;
    font: inherit;
    font-size: 13px;
}

.modal-footer .btn:hover:not(:disabled) {
    background: #e9e9e9;
}

.modal-footer .btn:disabled {
    opacity: 0.5;
    cursor: default;
}

.modal-footer .btn-primary {
    background: #cfe5ff;
    border-color: #8ab4e8;
    color: #000;
}

.modal-footer .btn-primary:hover:not(:disabled) {
    background: #b8d4f8;
}

.modal-footer .btn-danger-outline {
    background: transparent;
    border-color: #e53935;
    color: #e53935;
    font-size: 12px;
}

.modal-footer .btn-danger-outline:hover:not(:disabled) {
    background: #ffeaea;
    border-color: #c62828;
    color: #c62828;
}

.modal-footer .btn-danger-outline:disabled {
    opacity: 0.4;
    cursor: default;
}

.modal-footer-spacer {
    flex: 1;
}

/* ===== Окно редактирования шаблона элемента ===== */

.modal-dialog-large {
    width: 700px;
    max-width: 95vw;
}

.template-editor-top-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 15px;
    margin-bottom: 15px;
    padding-bottom: 12px;
    border-bottom: 1px solid #eee;
}

.template-editor-name-group {
    display: flex;
    align-items: center;
    gap: 8px;
    flex: 1;
}

.template-editor-label {
    font-weight: 600;
    font-size: 13px;
    white-space: nowrap;
    color: #333;
}

.template-editor-input {
    flex: 1;
    padding: 5px 8px;
    border: 1px solid #ccc;
    border-radius: 3px;
    font: inherit;
    font-size: 14px;
    outline: none;
}

.template-editor-input:focus {
    border-color: #8ab4e8;
}

.template-editor-lang-group {
    display: flex;
    align-items: center;
}

.template-editor-showcase-label {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 12px;
    color: #444;
    cursor: pointer;
    user-select: none;
    white-space: nowrap;
}

.template-editor-showcase-label input {
    cursor: pointer;
    margin: 0;
}

.template-editor-lang-label {
    font-size: 13px;
    font-weight: 500;
    color: #444;
    white-space: nowrap;
    margin-right: 6px;
    user-select: none;
}

.lang-badge {
    display: inline-block;
    font-size: 11px;
    font-weight: 700;
    color: #1565c0;
    background: #e3f2fd;
    padding: 1px 5px;
    border-radius: 3px;
    margin-left: 2px;
    vertical-align: baseline;
    border: 1px solid #bbdefb;
}

.template-editor-section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin: 10px 0 8px;
}

.template-editor-section-title {
    font-weight: 600;
    font-size: 14px;
    color: #333;
}

.template-editor-show-deleted-label {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 12px;
    color: #666;
    cursor: pointer;
    user-select: none;
}

.template-editor-show-deleted-label input {
    cursor: pointer;
    margin: 0;
}

.template-editor-table-container {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    margin-bottom: 12px;
}

.template-editor-params-header {
    display: grid;
    grid-template-columns: 24px minmax(110px, 1fr) 95px 95px 38px 42px 30px 30px 30px 28px;
    gap: 8px;
    padding: 0 4px 6px;
    font-size: 12px;
    font-weight: 600;
    color: #666;
    border-bottom: 1px solid #e0e0e0;
    align-items: center;
    min-width: 550px;
}

.template-editor-params-header span {
    user-select: none;
}

.template-editor-params-header .col-drag {
    width: 24px;
}

.template-editor-params-header .col-actions {
    width: 28px;
}

.template-editor-params-header .header-center {
    text-align: center;
    cursor: help;
}

.template-editor-params-list {
    max-height: 280px;
    overflow-y: auto;
    overflow-x: hidden;
    padding: 8px 0;
    display: flex;
    flex-direction: column;
    gap: 8px;
    min-width: 550px;
}

.template-editor-param-row {
    display: grid;
    grid-template-columns: 24px minmax(110px, 1fr) 95px 95px 38px 42px 30px 30px 30px 28px;
    gap: 8px;
    align-items: center;
    transition: background 0.15s;
    min-width: 550px;
}

.param-drag-handle {
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: grab;
    color: #aaa;
    font-size: 16px;
    user-select: none;
    line-height: 1;
}

.param-drag-handle:hover {
    color: #444;
}

.param-drag-handle:active {
    cursor: grabbing;
}

.template-editor-param-row.dragging {
    opacity: 0.4;
    background: #e3f2fd;
    border-radius: 4px;
}

.template-editor-param-row .param-name-input {
    width: 100%;
    padding: 5px 8px;
    border: 1px solid #ccc;
    border-radius: 3px;
    font: inherit;
    font-size: 13px;
    outline: none;
    box-sizing: border-box;
}

.template-editor-param-row .param-name-input:focus {
    border-color: #8ab4e8;
}

.template-editor-param-row .param-type-select,
.template-editor-param-row .param-subtype-select {
    width: 100%;
    padding: 5px 4px;
    border: 1px solid #ccc;
    border-radius: 3px;
    background: #fff;
    font: inherit;
    font-size: 13px;
    outline: none;
    cursor: pointer;
    box-sizing: border-box;
}

.template-editor-param-row .param-type-select:focus,
.template-editor-param-row .param-subtype-select:focus {
    border-color: #8ab4e8;
}

.template-editor-param-row .param-subtype-select:disabled {
    background: #f0f0f0;
    opacity: 0.5;
    cursor: not-allowed;
}

.template-editor-param-row .param-num-input {
    width: 100%;
    padding: 5px 2px;
    text-align: center;
    border: 1px solid #ccc;
    border-radius: 3px;
    font: inherit;
    font-size: 13px;
    outline: none;
    box-sizing: border-box;
}

.template-editor-param-row .param-num-input:focus {
    border-color: #8ab4e8;
}

.template-editor-param-row .param-num-input:disabled {
    background: #f0f0f0;
    opacity: 0.5;
    cursor: not-allowed;
}

.template-editor-param-row .param-checkbox-cell {
    display: flex;
    justify-content: center;
    align-items: center;
}

.template-editor-param-row .param-checkbox {
    width: 16px;
    height: 16px;
    cursor: pointer;
    margin: 0;
}

.template-editor-param-row .param-delete-btn {
    width: 28px;
    height: 28px;
    background: none;
    border: none;
    cursor: pointer;
    font-size: 14px;
    color: #999;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 4px;
    transition: color 0.15s, background 0.15s;
    padding: 0;
}

.template-editor-param-row .param-delete-btn:hover {
    color: #d32f2f;
    background: #ffebee;
}

.template-editor-add-param-btn {
    width: 100%;
    padding: 7px 12px;
    margin-top: 8px;
    border: 1px dashed #90caf9;
    border-radius: 4px;
    background: #f8fafc;
    color: #1976d2;
    font: inherit;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    transition: background 0.15s, border-color 0.15s, color 0.15s;
}

.template-editor-add-param-btn:hover {
    background: #e3f2fd;
    border-color: #42a5f5;
    color: #1565c0;
}

.template-editor-param-row.param-row-deleted {
    opacity: 0.6;
    background: #fbfbfb;
    border-radius: 4px;
}

.template-editor-param-row.param-row-deleted .param-name-input {
    text-decoration: line-through;
    color: #888;
}

.template-editor-param-row .param-restore-btn {
    width: 28px;
    height: 28px;
    background: none;
    border: none;
    cursor: pointer;
    font-size: 14px;
    color: #2e7d32;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 4px;
    transition: color 0.15s, background 0.15s;
    padding: 0;
}

.template-editor-param-row .param-restore-btn:hover {
    color: #1b5e20;
    background: #e8f5e9;
}

.template-editor-empty-params {
    padding: 15px;
    text-align: center;
    color: #888;
    font-size: 13px;
}

.template-editor-loading-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(255, 255, 255, 0.88);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 16px;
    z-index: 100;
    border-radius: 8px;
}

.template-editor-loading-spinner {
    width: 40px;
    height: 40px;
    border: 4px solid #e0e0e0;
    border-top: 4px solid #1976d2;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.template-editor-loading-text {
    font-size: 14px;
    font-weight: 500;
    color: #333;
}

.modal-header-danger {
    background: #ffebee;
    border-bottom: 1px solid #ffcdd2;
    color: #c62828;
}

.clear-collection-warning-box {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    background: #fff8e1;
    border: 1px solid #ffe082;
    border-radius: 4px;
    padding: 12px;
    margin-bottom: 16px;
}

.clear-collection-warning-icon {
    font-size: 24px;
    line-height: 1;
}

.clear-collection-warning-text {
    font-size: 13px;
    line-height: 1.4;
    color: #b71c1c;
    font-weight: 500;
}

.clear-collection-instruction {
    font-size: 13px;
    color: #333;
    margin-bottom: 8px;
}

.clear-collection-badge {
    display: inline-block;
    background: #ffebee;
    color: #c62828;
    padding: 2px 6px;
    border-radius: 4px;
    border: 1px solid #ffcdd2;
    letter-spacing: 0.5px;
}

.clear-collection-input {
    width: 100%;
    padding: 8px 10px;
    border: 1px solid #ccc;
    border-radius: 4px;
    font-size: 14px;
    box-sizing: border-box;
    text-transform: uppercase;
    transition: border-color 0.2s, box-shadow 0.2s;
}

.clear-collection-input:focus {
    border-color: #d32f2f;
    outline: none;
    box-shadow: 0 0 0 2px rgba(211, 47, 47, 0.2);
}

.modal-footer .btn-danger,
.btn-danger {
    background: #ff5252;
    color: #000;
    border: 1px solid #d32f2f;
    font-weight: 500;
    opacity: 1;
}

.modal-footer .btn-danger:hover:not(:disabled),
.btn-danger:hover:not(:disabled) {
    background: #ff1744;
    color: #000;
}

.modal-footer .btn-danger:disabled,
.btn-danger:disabled {
    background: #f5f5f5;
    color: #aaa;
    border: 1px solid #ddd;
    opacity: 0.6;
    cursor: not-allowed;
}

.user-details-body {
    display: flex;
    flex-direction: column;
    gap: 16px;
    padding: 16px 20px;
}

.user-details-section {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.user-details-section-title {
    color: #444;
    font-size: 13px;
    font-weight: 700;
}

.user-details-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid #f0f0f0;
    padding-bottom: 8px;
    gap: 16px;
}

.user-details-section .user-details-row:last-child {
    border-bottom: none;
    padding-bottom: 0;
}

.user-details-label {
    font-size: 13px;
    color: #666;
    font-weight: 500;
}

.user-details-value {
    font-size: 14px;
    font-weight: 600;
    color: #222;
    text-align: right;
    word-break: break-all;
}

.user-details-auth-row {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    border: 1px solid transparent;
    border-left: 3px solid transparent;
    border-radius: 4px;
    padding: 8px;
}

.user-details-auth-row-current {
    background: #eef6ff;
    border-color: #d7e8fb;
    border-left-color: #0b57d0;
}

.user-details-auth-content {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 6px;
    width: 100%;
}

.user-details-current-badge {
    align-self: flex-start;
    background: #d7e8fb;
    border-radius: 10px;
    color: #0757b8;
    font-size: 11px;
    font-weight: 600;
    margin-bottom: 4px;
    padding: 2px 6px;
    white-space: nowrap;
}

.admin-users-dialog {
    width: 1400px;
    max-width: 96vw;
    max-height: 90vh;
}

.admin-users-body {
    overflow: auto;
}

.admin-users-table-wrap {
    overflow: auto;
}

.admin-users-table {
    width: 100%;
    min-width: 1180px;
    border-collapse: collapse;
    font-size: 13px;
}

.admin-users-table th,
.admin-users-table td {
    padding: 9px 10px;
    border-bottom: 1px solid #e5e7eb;
    text-align: left;
    vertical-align: top;
}

.admin-users-table th {
    position: sticky;
    top: 0;
    background: #f8fafc;
    white-space: nowrap;
}

.admin-users-sort {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    margin: 0;
    padding: 0;
    border: 0;
    color: inherit;
    background: transparent;
    font: inherit;
    font-weight: 600;
    cursor: pointer;
}

.admin-users-sort::after {
    width: 12px;
    color: #6b7280;
    content: "↕";
    font-size: 12px;
}

.admin-users-table th[aria-sort="ascending"] .admin-users-sort::after {
    color: #0757b8;
    content: "↑";
}

.admin-users-table th[aria-sort="descending"] .admin-users-sort::after {
    color: #0757b8;
    content: "↓";
}

.admin-users-sort:hover,
.admin-users-sort:focus-visible {
    color: #0757b8;
}

.admin-users-sort:focus-visible {
    outline: 2px solid #0757b8;
    outline-offset: 3px;
}

.tree-row-shared-node {
    color: #0757b8;
}

.tree-row-share-link-unavailable {
    color: #8b8b8b;
    font-style: italic;
}

.tree-share-link-owner {
    margin-left: 6px;
    padding: 1px 6px;
    border-radius: 9px;
    background: #dcecff;
    color: #0757b8;
    font-size: 11px;
    font-weight: 600;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 150px;
}

/* ===== Адаптивность для мобильных экранов ===== */

/* ===== Настройки (Settings Modal) ===== */
.settings-group {
    margin-bottom: 16px;
}

.settings-label {
    display: block;
    font-weight: 600;
    margin-bottom: 8px;
    font-size: 14px;
    color: #333;
}

.settings-options {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.radio-label {
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    font-size: 14px;
    user-select: none;
}

.settings-select-wrapper {
    width: 100%;
}

.settings-select {
    width: 100%;
    padding: 8px 12px;
    font-size: 14px;
    border: 1px solid #ccc;
    border-radius: 4px;
    background-color: #fff;
    color: #333;
    outline: none;
    cursor: pointer;
    box-sizing: border-box;
}

.settings-select:focus {
    border-color: #0b57d0;
    box-shadow: 0 0 0 2px rgba(11, 87, 208, 0.2);
}

.settings-group-security {
    margin-top: 20px;
    padding-top: 16px;
    border-top: 1px solid #eee;
}

.btn-logout-all-devices {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 8px 16px;
    font-size: 14px;
    font-weight: 500;
    color: #d93025;
    background-color: #fff;
    border: 1px solid #f28b82;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s ease;
    user-select: none;
}

.btn-logout-all-devices:hover {
    background-color: #fce8e6;
    border-color: #d93025;
}

.btn-logout-all-devices:active {
    background-color: #fad2cf;
    transform: scale(0.98);
}

.btn-logout-all-icon {
    font-size: 16px;
    line-height: 1;
}

/* ===== Окно поиска (Search Modal) ===== */
.modal-dialog-search {
    width: 750px;
    max-width: 95vw;
    max-height: 85vh;
    display: flex;
    flex-direction: column;
}

.search-modal-body {
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 10px;
    overflow: hidden;
    flex: 1;
}

.search-form-row {
    display: flex;
    align-items: center;
    gap: 12px;
}

.search-form-label {
    min-width: 140px;
    font-size: 14px;
    font-weight: 500;
    color: #333;
    user-select: none;
}

.search-select,
.search-input {
    flex: 1;
    min-width: 0;
    padding: 6px 10px;
    border: 1px solid #ccc;
    border-radius: 4px;
    font-size: 14px;
    font-family: inherit;
    height: 34px;
    box-sizing: border-box;
    background: #fff;
}

.search-select:disabled {
    background: #f5f5f5;
    color: #888;
    cursor: not-allowed;
}

.search-select:focus,
.search-input:focus {
    border-color: #0b57d0;
    outline: none;
    box-shadow: 0 0 0 2px rgba(11, 87, 208, 0.2);
}

.search-results-wrapper {
    flex: 1;
    min-height: 220px;
    max-height: 380px;
    overflow-y: auto;
    border: 1px solid #ccc;
    border-radius: 4px;
    background: #fff;
    margin-top: 4px;
}

.search-results-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
    table-layout: fixed;
}

.search-results-table th {
    position: sticky;
    top: 0;
    background: #f1f3f4;
    padding: 8px 10px;
    border-bottom: 1px solid #ccc;
    text-align: left;
    font-weight: 600;
    color: #333;
    z-index: 1;
}

.search-results-table td {
    padding: 6px 10px;
    border-bottom: 1px solid #eee;
    vertical-align: middle;
}

.search-result-row {
    cursor: pointer;
    transition: background 0.1s;
}

.search-result-row:hover {
    background: #f0f7ff;
}

.search-result-row.selected {
    background: #cfe2ff !important;
    color: #084298;
    font-weight: 500;
}

.col-search-num {
    width: 40px;
    text-align: center;
    color: #888;
}

.col-search-node {
    width: 32%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.col-search-param {
    width: 28%;
    color: #555;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.col-search-value {
    width: 35%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.search-result-icon {
    display: inline-block;
    margin-right: 4px;
}

.search-empty-state {
    padding: 40px 20px;
    text-align: center;
    color: #888;
    font-style: italic;
    font-size: 14px;
}

.search-status-bar {
    font-size: 12px;
    color: #666;
    min-height: 16px;
}

.search-modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: 8px;
    padding: 10px 16px;
}

/* ===== Контейнеры изображений в свойствах ===== */
.image-container {
    width: 100%;
    box-sizing: border-box;
    padding: 6px;
    background: #fafafa;
    border: 1px solid #e0e0e0;
    border-radius: 4px;
    min-height: 80px;
    transition: border-color 0.2s, box-shadow 0.2s;
}

.image-container.active-target,
.image-container:focus-within {
    border-color: #0b57d0;
    box-shadow: 0 0 0 2px rgba(11, 87, 208, 0.2);
    background: #fcfdff;
}

/* Режим ленты (Row) */
.image-container.gallery-row {
    display: flex;
    flex-direction: row;
    align-items: center;
    gap: 4px;
    overflow-x: auto;
    overflow-y: hidden;
    padding-bottom: 8px;
}

/* Режим сетки (Grid) */
.image-container.gallery-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, 86px);
    gap: 4px;
    max-height: 260px;
    overflow-y: auto;
}

/* Карточка миниатюры */
.image-card {
    position: relative;
    width: 86px;
    height: 86px;
    flex-shrink: 0;
    border-radius: 4px;
    overflow: hidden;
    background: #fff;
    border: 1px solid #ccc;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.image-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 3px 6px rgba(0,0,0,0.15);
    border-color: #0b57d0;
}

.image-card.image-card-staged {
    border: 2px solid #111;
}

.image-card-thumb {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    -webkit-touch-callout: none;
    -webkit-user-select: none;
    user-select: none;
    pointer-events: none;
}

.image-card-size {
    position: absolute;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 1;
    padding: 2px 1px;
    background: rgba(0, 0, 0, 0.68);
    color: #fff;
    font-size: 9px;
    line-height: 1;
    text-align: center;
    white-space: nowrap;
}

/* Отключение мобильного контекстного меню на карточках */
.image-card,
.image-upload-box {
    -webkit-touch-callout: none;
    -webkit-user-select: none;
    user-select: none;
}

/* Кнопка скачивания в правом верхнем углу (вплотную к краю) */
.image-card-btn-download-top {
    position: absolute;
    top: 0;
    right: 0;
    width: 22px;
    height: 22px;
    border-radius: 0 0 0 4px;
    background: rgba(0, 0, 0, 0.65);
    color: #fff;
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 11px;
    padding: 0;
    transition: background 0.15s;
    z-index: 2;
}

.image-card-btn-download-top:hover {
    background: rgba(0, 0, 0, 0.9);
}

/* Кнопка удаления в правом верхнем углу (вплотную к краю) */
.image-card-btn-delete-top {
    position: absolute;
    top: 0;
    right: 0;
    width: 22px;
    height: 22px;
    border-radius: 0 0 0 4px;
    background: rgba(220, 53, 69, 0.85);
    color: #fff;
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 13px;
    font-weight: bold;
    line-height: 1;
    padding: 0;
    transition: background 0.15s;
    z-index: 2;
}

.image-card-btn-delete-top:hover {
    background: #c82333;
}

/* Стили перетаскивания (Drag & Drop Reordering) */
.image-card[draggable="true"] {
    cursor: grab;
}

.image-card[draggable="true"]:active {
    cursor: grabbing;
}

.image-card.dragging {
    opacity: 0.35;
    border: 1px dashed #0b57d0;
}

/* Маркеры вставки слева и справа (без изменения размеров и отступов) */
.image-card.drag-over-left {
    border-left: 5px solid #0b57d0 !important;
}

.image-card.drag-over-right {
    border-right: 5px solid #0b57d0 !important;
}

/* Зона загрузки (Upload Drop-box) */
.image-upload-box {
    width: 86px;
    height: 86px;
    flex-shrink: 0;
    border: 2px dashed #90caf9;
    border-radius: 4px;
    background: #f0f7ff;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    color: #1976d2;
    font-size: 11px;
    text-align: center;
    padding: 4px;
    box-sizing: border-box;
    user-select: none;
    transition: background 0.15s, border-color 0.15s;
}

.image-upload-box:hover,
.image-upload-box.drag-over {
    background: #e3f2fd;
    border-color: #0b57d0;
    border-style: solid;
}

.image-upload-icon {
    font-size: 18px;
    margin-bottom: 2px;
}

.image-upload-paste-btn {
    margin-top: 3px;
    padding: 1px 4px;
    font-size: 10px;
    border-radius: 3px;
    background: #fff;
    border: 1px solid #90caf9;
    color: #0b57d0;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 2px;
    transition: background 0.15s, border-color 0.15s;
}

.image-upload-paste-btn:hover {
    background: #e3f2fd;
    border-color: #0b57d0;
}

.image-storage-mode-control {
    display: flex;
    justify-content: flex-end;
    margin: -2px 0 4px;
    color: #5f6368;
    font-size: 12px;
}

.image-storage-mode-control label {
    display: inline-flex;
    align-items: center;
    gap: 5px;
}

.image-storage-mode-select {
    padding: 2px 5px;
    border: 1px solid #c9cdd2;
    border-radius: 3px;
    background: #fff;
    color: #303030;
    font: inherit;
}

/* ===== Контейнер файлов (FILE) ===== */
.file-container {
    width: 100%;
    min-height: 52px;
    padding: 6px 8px;
    border: 1px solid #d0d0d0;
    background: #fafafa;
    border-radius: 4px;
    box-sizing: border-box;
    transition: border-color 0.2s, box-shadow 0.2s;
}

.file-container:focus,
.file-container:focus-within {
    border-color: #0b57d0;
    box-shadow: 0 0 0 2px rgba(11, 87, 208, 0.2);
    background: #fcfdff;
}

/* Режим ленты (Row) */
.file-container.gallery-row {
    display: flex;
    flex-direction: row;
    align-items: center;
    gap: 6px;
    overflow-x: auto;
    overflow-y: hidden;
    padding-bottom: 6px;
}

/* Режим сетки (Grid) */
.file-container.gallery-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 6px;
    max-height: 260px;
    overflow-y: auto;
}

/* Карточка файла */
.file-card {
    position: relative;
    display: flex;
    align-items: center;
    gap: 8px;
    height: 44px;
    min-width: 170px;
    padding: 4px 8px;
    background: #fff;
    border: 1px solid #dcdcdc;
    border-radius: 6px;
    box-shadow: 0 1px 2px rgba(0,0,0,0.06);
    box-sizing: border-box;
    cursor: pointer;
    flex-shrink: 0;
    user-select: none;
    transition: transform 0.15s ease, box-shadow 0.15s ease, border-color 0.15s ease;
}

.file-card:hover {
    transform: translateY(-1px);
    box-shadow: 0 2px 5px rgba(0,0,0,0.12);
    border-color: #0b57d0;
}

/* Значок расширения файла */
.file-badge {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    border-radius: 4px;
    font-size: 10px;
    font-weight: 700;
    color: #fff;
    background: #757575;
    flex-shrink: 0;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.file-badge.ext-pdf { background: #d93025; }
.file-badge.ext-doc, .file-badge.ext-docx, .file-badge.ext-rtf { background: #1a73e8; }
.file-badge.ext-xls, .file-badge.ext-xlsx, .file-badge.ext-csv { background: #188038; }
.file-badge.ext-ppt, .file-badge.ext-pptx { background: #e37400; }
.file-badge.ext-zip, .file-badge.ext-rar, .file-badge.ext-7z, .file-badge.ext-tar, .file-badge.ext-gz { background: #f29900; }
.file-badge.ext-txt, .file-badge.ext-log, .file-badge.ext-json, .file-badge.ext-xml { background: #5f6368; }
.file-badge.ext-exe, .file-badge.ext-msi, .file-badge.ext-bat, .file-badge.ext-sh { background: #673ab7; }
.file-badge.ext-mp3, .file-badge.ext-wav, .file-badge.ext-flac { background: #e91e63; }
.file-badge.ext-mp4, .file-badge.ext-avi, .file-badge.ext-mkv { background: #9c27b0; }

/* Информация о файле (имя и размер) */
.file-info {
    display: flex;
    flex-direction: column;
    justify-content: center;
    overflow: hidden;
    flex: 1;
    min-width: 0;
}

.file-name {
    font-size: 12px;
    font-weight: 500;
    color: #202124;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.file-size {
    font-size: 10px;
    color: #70757a;
    margin-top: 1px;
}

/* Кнопка удаления файла ✕ */
.file-card-btn-delete {
    position: absolute;
    top: 2px;
    right: 3px;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: rgba(220, 53, 69, 0.85);
    color: #fff;
    border: none;
    cursor: pointer;
    display: none;
    align-items: center;
    justify-content: center;
    font-size: 11px;
    line-height: 1;
    padding: 0;
    z-index: 2;
}

.file-card:hover .file-card-btn-delete {
    display: flex;
}

.file-card-btn-delete:hover {
    background: #c82333;
}

/* Зона загрузки файлов */
.file-upload-box {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    height: 44px;
    min-width: 140px;
    padding: 4px 12px;
    border: 2px dashed #90caf9;
    border-radius: 6px;
    background: #f0f7ff;
    cursor: pointer;
    color: #1976d2;
    font-size: 11px;
    font-weight: 500;
    box-sizing: border-box;
    flex-shrink: 0;
    user-select: none;
    transition: background 0.15s, border-color 0.15s;
}

.file-upload-box:hover,
.file-upload-box.drag-over {
    background: #e3f2fd;
    border-color: #0b57d0;
    border-style: solid;
}

.file-download-all-btn {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 2px 8px;
    font-size: 11px;
    font-weight: 500;
    color: #0b57d0;
    background: #f0f4f9;
    border: 1px solid #c2e7ff;
    border-radius: 4px;
    cursor: pointer;
    line-height: 18px;
    transition: background 0.15s, border-color 0.15s;
    user-select: none;
    margin-left: auto;
}

.file-download-all-btn:hover {
    background: #d3e3fd;
    border-color: #7cacf8;
    color: #041e49;
}

/* ===== Модальный просмотрщик изображений (Lightbox Viewer) ===== */
.image-viewer-backdrop {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.88);
    z-index: 5000;
    display: flex;
    flex-direction: column;
    user-select: none;
    backdrop-filter: blur(3px);
}

.image-viewer-toolbar {
    height: 48px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 16px;
    background: rgba(0, 0, 0, 0.6);
    color: #fff;
    flex-shrink: 0;
    z-index: 10;
}

.image-viewer-info {
    font-size: 14px;
    font-weight: 500;
    color: #e0e0e0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    max-width: 50%;
}

.image-viewer-actions {
    display: flex;
    align-items: center;
    gap: 8px;
}

.image-viewer-btn {
    width: 34px;
    height: 34px;
    border-radius: 4px;
    background: rgba(255, 255, 255, 0.15);
    border: 1px solid rgba(255, 255, 255, 0.25);
    color: #fff;
    cursor: pointer;
    font-size: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    transition: background 0.15s, transform 0.1s;
}

.image-viewer-btn:hover {
    background: rgba(255, 255, 255, 0.3);
}

.image-viewer-btn-close {
    background: rgba(255, 255, 255, 0.15);
    border-color: rgba(255, 255, 255, 0.25);
    font-size: 20px;
}

.image-viewer-btn-close:hover {
    background: rgba(255, 255, 255, 0.35);
}

.image-viewer-content {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    position: relative;
    cursor: grab;
}

.image-viewer-content.dragging {
    cursor: grabbing;
}

.image-viewer-content img {
    max-width: 95vw;
    max-height: 85vh;
    object-fit: contain;
    transition: transform 0.1s ease-out;
    box-shadow: 0 5px 25px rgba(0, 0, 0, 0.5);
    border-radius: 2px;
}

.mobile-back-to-tree-btn {
    display: none;
}

@media (max-width: 768px), (max-height: 550px) {
    .status-bar {
        display: none !important;
    }

    .mobile-menu-toggle-btn {
        display: flex !important;
    }

    .mobile-app-title {
        display: block !important;
    }

    .menu-bar-left {
        display: none !important;
    }
}

@media (max-width: 768px) {
    .workspace.mobile-fullscreen-mode {
        position: relative;
        overflow: hidden;
    }

    .workspace.mobile-fullscreen-mode .tree-panel {
        width: 100% !important;
        flex: 1 1 100% !important;
        min-width: 100% !important;
        max-width: 100% !important;
        display: flex !important;
    }

    .workspace.mobile-fullscreen-mode .properties-panel {
        width: 100% !important;
        flex: 1 1 100% !important;
        min-width: 100% !important;
        max-width: 100% !important;
        display: none !important;
    }

    .workspace.mobile-fullscreen-mode .resizer {
        display: none !important;
    }

    /* Когда на мобильном открыта панель свойств */
    .workspace.mobile-fullscreen-mode.mobile-show-properties .tree-panel {
        display: none !important;
    }

    .workspace.mobile-fullscreen-mode.mobile-show-properties .properties-panel {
        display: flex !important;
    }

    .workspace.mobile-fullscreen-mode .mobile-back-to-tree-btn {
        display: inline-flex !important;
        align-items: center;
        gap: calc(4px * var(--tc-scale, 1));
        background: #e8f0fe;
        color: #0b57d0;
        border: 1px solid #c2e7ff;
        font-size: calc(13px * var(--tc-scale, 1));
        font-weight: 600;
        line-height: 1;
        cursor: pointer;
        padding: calc(4px * var(--tc-scale, 1)) calc(8px * var(--tc-scale, 1));
        margin-right: calc(8px * var(--tc-scale, 1));
        border-radius: 6px;
        user-select: none;
        box-shadow: 0 1px 2px rgba(0, 0, 0, 0.08);
        transition: background-color 0.15s ease, transform 0.1s ease;
        flex-shrink: 0;
    }

    .workspace:not(.mobile-fullscreen-mode) .mobile-back-to-tree-btn {
        display: none !important;
    }

    .mobile-back-to-tree-btn:hover {
        background: #d3e3fd;
    }

    .mobile-back-to-tree-btn:active {
        background-color: #c2e7ff;
        transform: scale(0.96);
    }

    .mobile-back-icon {
        font-size: calc(18px * var(--tc-scale, 1));
        font-weight: bold;
        line-height: 0.9;
        margin-top: -1px;
    }
}

@media (max-width: 600px) {
    .menu-bar {
        padding: 0 calc(4px * var(--tc-scale, 1));
        height: calc(32px * var(--tc-scale, 1));
    }

    .menu-item {
        height: calc(32px * var(--tc-scale, 1));
        padding: 0 calc(5px * var(--tc-scale, 1));
        font-size: calc(13px * var(--tc-scale, 1));
    }

    .interface-lang-control {
        margin-left: calc(4px * var(--tc-scale, 1));
        gap: calc(2px * var(--tc-scale, 1));
    }

    .interface-lang-label {
        font-size: calc(13px * var(--tc-scale, 1));
    }

    .menu-lang-select {
        padding: calc(2px * var(--tc-scale, 1)) calc(4px * var(--tc-scale, 1));
        font-size: calc(12px * var(--tc-scale, 1));
    }

    .tool-bar {
        height: calc(36px * var(--tc-scale, 1));
        padding: 0 calc(4px * var(--tc-scale, 1));
    }

    .toolbar-button {
        width: calc(28px * var(--tc-scale, 1));
        height: calc(28px * var(--tc-scale, 1));
        min-width: calc(28px * var(--tc-scale, 1));
        aspect-ratio: 1 / 1;
        flex-shrink: 0;
        margin-right: calc(3px * var(--tc-scale, 1));
        font-size: calc(14px * var(--tc-scale, 1));
    }

    .toolbar-button.active {
        box-shadow: inset 0 2px 3px rgba(0, 0, 0, 0.25), inset 0 -2px 0 #0b57d0;
    }
}

/* В split-режиме на телефоне обе панели видны одновременно, поэтому уплотняем их отдельно. */
@media (max-width: 768px) {
    .workspace:not(.mobile-fullscreen-mode) .panel-title,
    .workspace:not(.mobile-fullscreen-mode) .tree-panel-header {
        padding: calc(4px * var(--tc-scale, 1)) calc(5px * var(--tc-scale, 1));
        min-height: calc(24px * var(--tc-scale, 1));
    }

    .workspace:not(.mobile-fullscreen-mode) .panel-content {
        padding: calc(4px * var(--tc-scale, 1)) calc(5px * var(--tc-scale, 1));
    }

    .workspace:not(.mobile-fullscreen-mode) .tree-row {
        min-height: calc(24px * var(--tc-scale, 1));
        padding-top: calc(2px * var(--tc-scale, 1));
        padding-bottom: calc(2px * var(--tc-scale, 1));
        padding-right: calc(3px * var(--tc-scale, 1));
        gap: calc(3px * var(--tc-scale, 1));
    }

    .workspace:not(.mobile-fullscreen-mode) .tree-card-row {
        min-height: calc(54px * var(--tc-scale, 1));
        gap: calc(4px * var(--tc-scale, 1));
    }

    .workspace:not(.mobile-fullscreen-mode) .tree-card-image {
        width: calc(46px * var(--tc-scale, 1));
        height: calc(46px * var(--tc-scale, 1));
    }

    .workspace:not(.mobile-fullscreen-mode) .tree-card-details {
        gap: calc(2px * var(--tc-scale, 1));
    }

    .workspace:not(.mobile-fullscreen-mode) .tree-card-price {
        font-size: calc(14px * var(--tc-scale, 1));
    }

    .workspace:not(.mobile-fullscreen-mode) .property {
        margin-bottom: calc(8px * var(--tc-scale, 1));
    }

    .workspace:not(.mobile-fullscreen-mode) .property-label {
        margin-bottom: calc(2px * var(--tc-scale, 1));
    }

    .workspace:not(.mobile-fullscreen-mode) .property-value,
    .workspace:not(.mobile-fullscreen-mode) .property-input,
    .workspace:not(.mobile-fullscreen-mode) .property-textarea {
        min-height: calc(28px * var(--tc-scale, 1));
        padding: calc(3px * var(--tc-scale, 1)) calc(5px * var(--tc-scale, 1));
    }

    .workspace:not(.mobile-fullscreen-mode) .property-input[type="date"],
    .workspace:not(.mobile-fullscreen-mode) .property-input[type="time"],
    .workspace:not(.mobile-fullscreen-mode) .property-input[type="datetime-local"] {
        height: calc(28px * var(--tc-scale, 1));
    }

    .workspace:not(.mobile-fullscreen-mode) .property-copy-button {
        flex-basis: calc(28px * var(--tc-scale, 1));
    }

    .workspace:not(.mobile-fullscreen-mode) .properties-actions {
        padding: calc(4px * var(--tc-scale, 1)) calc(5px * var(--tc-scale, 1));
        gap: calc(4px * var(--tc-scale, 1));
    }
}

@media (max-height: 550px) {
    .menu-bar {
        height: calc(28px * var(--tc-scale, 1)) !important;
        padding: 0 calc(6px * var(--tc-scale, 1)) !important;
    }

    .menu-item {
        height: calc(28px * var(--tc-scale, 1)) !important;
        padding: 0 calc(5px * var(--tc-scale, 1)) !important;
        font-size: calc(12px * var(--tc-scale, 1)) !important;
    }

    .interface-lang-control {
        margin-left: calc(6px * var(--tc-scale, 1)) !important;
    }

    .interface-lang-label {
        font-size: calc(13px * var(--tc-scale, 1)) !important;
    }

    .menu-lang-select {
        padding: calc(1px * var(--tc-scale, 1)) calc(4px * var(--tc-scale, 1)) !important;
        font-size: calc(11px * var(--tc-scale, 1)) !important;
    }

    .tool-bar {
        height: calc(32px * var(--tc-scale, 1)) !important;
        padding: 0 calc(4px * var(--tc-scale, 1)) !important;
    }

    .toolbar-button {
        width: calc(26px * var(--tc-scale, 1)) !important;
        height: calc(26px * var(--tc-scale, 1)) !important;
        min-width: calc(26px * var(--tc-scale, 1)) !important;
        aspect-ratio: 1 / 1 !important;
        flex-shrink: 0 !important;
        font-size: calc(13px * var(--tc-scale, 1)) !important;
        margin-right: calc(2px * var(--tc-scale, 1)) !important;
    }

    .panel-title,
    .tree-panel-header {
        padding: calc(3px * var(--tc-scale, 1)) calc(6px * var(--tc-scale, 1)) !important;
        min-height: calc(22px * var(--tc-scale, 1)) !important;
        font-size: calc(13px * var(--tc-scale, 1)) !important;
    }

    .panel-controls {
        gap: calc(4px * var(--tc-scale, 1)) !important;
    }

    .data-lang-label {
        font-size: calc(13px * var(--tc-scale, 1)) !important;
    }

    .panel-lang-select {
        padding: calc(1px * var(--tc-scale, 1)) calc(4px * var(--tc-scale, 1)) !important;
        font-size: calc(11px * var(--tc-scale, 1)) !important;
    }

    .panel-content {
        padding: calc(4px * var(--tc-scale, 1)) calc(6px * var(--tc-scale, 1)) !important;
    }

    .tree-row {
        min-height: calc(22px * var(--tc-scale, 1)) !important;
        padding: calc(2px * var(--tc-scale, 1)) calc(4px * var(--tc-scale, 1)) !important;
        font-size: calc(13px * var(--tc-scale, 1)) !important;
        gap: calc(3px * var(--tc-scale, 1)) !important;
    }

    .property {
        margin-bottom: calc(6px * var(--tc-scale, 1)) !important;
    }

    .property-label {
        font-size: calc(12px * var(--tc-scale, 1)) !important;
        margin-bottom: calc(2px * var(--tc-scale, 1)) !important;
    }

    .property-value,
    .property-input,
    .property-textarea {
        min-height: calc(26px * var(--tc-scale, 1)) !important;
        padding: calc(3px * var(--tc-scale, 1)) calc(5px * var(--tc-scale, 1)) !important;
        font-size: calc(13px * var(--tc-scale, 1)) !important;
    }

    .property-input[type="date"],
    .property-input[type="time"],
    .property-input[type="datetime-local"] {
        height: calc(26px * var(--tc-scale, 1)) !important;
    }

    .property-copy-button {
        flex: 0 0 calc(26px * var(--tc-scale, 1)) !important;
        font-size: calc(14px * var(--tc-scale, 1)) !important;
    }

    .properties-actions {
        padding: calc(4px * var(--tc-scale, 1)) calc(8px * var(--tc-scale, 1)) !important;
        gap: calc(6px * var(--tc-scale, 1)) !important;
    }

    .properties-actions button {
        padding: calc(3px * var(--tc-scale, 1)) calc(8px * var(--tc-scale, 1)) !important;
        font-size: calc(12px * var(--tc-scale, 1)) !important;
    }
}

/* ===== Оверлей прогресса сохранения / загрузки файлов ===== */
.save-progress-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(255, 255, 255, 0.85);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 2000;
    backdrop-filter: blur(2px);
    padding: 16px;
    box-sizing: border-box;
}

.save-progress-card {
    background: #ffffff;
    border: 1px solid #d0d7de;
    border-radius: 8px;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.15);
    padding: 18px 22px;
    width: 100%;
    max-width: 380px;
    box-sizing: border-box;
}

.save-progress-header {
    display: flex;
    align-items: center;
    gap: 12px;
}

.save-progress-spinner {
    width: 24px;
    height: 24px;
    border: 3px solid #e0e0e0;
    border-top: 3px solid #0b57d0;
    border-radius: 50%;
    animation: save-spinner-spin 0.8s linear infinite;
    flex-shrink: 0;
}

@keyframes save-spinner-spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.save-progress-title-wrap {
    flex: 1;
    min-width: 0;
}

.save-progress-title {
    font-size: 13px;
    font-weight: 600;
    color: #1f1f1f;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.save-progress-subtitle {
    font-size: 11px;
    color: #5f6368;
    margin-top: 2px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.save-progress-bar {
    width: 100%;
    height: 8px;
    background: #e8eaed;
    border-radius: 4px;
    overflow: hidden;
    margin-top: 12px;
}

.save-progress-fill {
    height: 100%;
    background: #0b57d0;
    width: 0%;
    border-radius: 4px;
    transition: width 0.15s ease;
}

.save-progress-details {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 11px;
    color: #5f6368;
    margin-top: 6px;
}

/* Template editor icon button */
.template-editor-icon-group {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
}

.template-editor-icon-btn {
    width: 38px;
    height: 38px;
    border: 1px solid #ccc;
    background: #fff;
    border-radius: 4px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    padding: 2px;
    transition: border-color 0.15s, background-color 0.15s;
}

.template-editor-icon-btn:hover {
    border-color: #0b57d0;
    background-color: #f0f4f9;
}

.template-editor-icon-img {
    width: 24px;
    height: 24px;
    object-fit: contain;
    display: block;
}

/* Icon picker modal dialog */
.icon-picker-dialog {
    max-width: 520px;
    width: 100%;
}

.icon-picker-tabs {
    display: flex;
    border-bottom: 2px solid #e0e0e0;
    margin-bottom: 12px;
}

.icon-picker-tab {
    flex: 1;
    padding: 8px 16px;
    background: transparent;
    border: none;
    border-bottom: 2px solid transparent;
    margin-bottom: -2px;
    font-size: 13px;
    font-weight: 600;
    color: #666;
    cursor: pointer;
    transition: all 0.2s;
}

.icon-picker-tab.active {
    color: #0b57d0;
    border-bottom-color: #0b57d0;
}

.emoji-search-bar {
    display: flex;
    gap: 6px;
    margin-bottom: 10px;
}

.emoji-custom-input {
    flex: 1;
    padding: 6px 10px;
    border: 1px solid #ccc;
    border-radius: 4px;
    font-size: 13px;
    outline: none;
}

.emoji-custom-input:focus {
    border-color: #0b57d0;
}

.emoji-categories {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    margin-bottom: 10px;
}

.emoji-cat-btn {
    padding: 3px 8px;
    font-size: 11px;
    background: #f1f3f4;
    border: 1px solid transparent;
    border-radius: 12px;
    cursor: pointer;
    color: #333;
}

.emoji-cat-btn.active, .emoji-cat-btn:hover {
    background: #e8f0fe;
    color: #0b57d0;
    border-color: #c2e7ff;
}

.emoji-grid {
    display: grid;
    grid-template-columns: repeat(9, 1fr);
    gap: 6px;
    max-height: 270px;
    overflow-y: auto;
    padding: 6px;
    border: 1px solid #eee;
    border-radius: 4px;
    background: #fafafa;
}

.emoji-item {
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 22px;
    height: 36px;
    cursor: pointer;
    border-radius: 4px;
    transition: background 0.1s, transform 0.1s;
    user-select: none;
}

.emoji-item:hover {
    background: #e2e7ec;
    transform: scale(1.2);
}

.icon-file-dropzone {
    border: 2px dashed #cbd5e1;
    border-radius: 8px;
    padding: 30px 20px;
    text-align: center;
    background: #f8fafc;
    cursor: pointer;
    transition: border-color 0.2s, background-color 0.2s;
}

.icon-file-dropzone:hover, .icon-file-dropzone.dragover {
    border-color: #0b57d0;
    background: #f0f7ff;
}

.icon-file-dropzone-icon {
    font-size: 32px;
    margin-bottom: 6px;
}

.icon-file-dropzone-text {
    font-size: 13px;
    font-weight: 500;
    color: #1e293b;
}

.icon-file-dropzone-sub {
    font-size: 11px;
    color: #64748b;
    margin-top: 4px;
}

.icon-file-preview-area {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
    padding: 20px;
}

.icon-preview-box {
    width: 64px;
    height: 64px;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #fff;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}

.icon-preview-box img {
    max-width: 48px;
    max-height: 48px;
    object-fit: contain;
}

.btn-danger-outline {
    background: transparent;
    border: 1px solid #dc3545;
    color: #dc3545;
    font-size: 12px;
    padding: 5px 12px;
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.15s;
}

.btn-danger-outline:hover {
    background: #dc3545;
    color: #fff;
}

/* Tree node icons */
.tree-node-icon-img {
    width: 16px;
    height: 16px;
    object-fit: contain;
    margin-right: 5px;
    vertical-align: middle;
    flex-shrink: 0;
}

.tree-node-icon-emoji {
    font-size: 15px;
    margin-right: 5px;
    line-height: 1;
    display: inline-flex;
    align-items: center;
    vertical-align: middle;
    flex-shrink: 0;
}

/* Export & Import Modals */
.modal-export .modal-content,
.modal-import .modal-content {
    border-radius: 8px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
}

.export-target-box,
.import-target-box {
    background: #f1f3f4;
    border: 1px solid #dadce0;
    border-radius: 6px;
    padding: 9px 12px;
    font-size: 13.5px;
    color: #202124;
    word-break: break-word;
}
