.constructor-page .workspace-stage .diagram-action-bar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 7px;
    height: auto;
    min-height: 0;
    padding: 7px 10px 0;
    border-bottom: 1px solid #51432e;
    background: #181a19;
    pointer-events: auto;
}

.constructor-page .diagram-action-bar .diagram-mode-switch {
    order: 1;
    border-color: #675b45;
    background: #242522;
}

.constructor-page .diagram-action-bar .diagram-mode-switch button {
    color: #ead7af;
}

.constructor-page .diagram-action-bar .diagram-mode-switch button.is-active,
.constructor-page .diagram-action-bar .diagram-mode-switch #diagram-mode-erase.is-active {
    color: #1a160f;
    background: #dfbc7b;
    box-shadow: none;
}

.constructor-page .diagram-action-bar .zoom-panel {
    order: 2;
    display: flex;
    flex: 0 0 auto;
    width: auto;
    grid-column: auto;
    grid-row: auto;
    gap: 0;
}

.constructor-page .diagram-action-bar .zoom-label,
.constructor-page .diagram-action-bar .protection-presets-toolbar-label,
.constructor-page .diagram-action-bar .protection-preset-number,
.constructor-page .diagram-action-bar .protection-preset-grid small {
    display: none;
}

.constructor-page .diagram-action-bar .zoom-controls {
    width: 177px;
    height: 36px;
    border: 1px solid #766449;
    border-radius: 5px;
    background: #252522;
    box-shadow: none;
}

.constructor-page .diagram-action-bar .zoom-controls button {
    width: 28px;
    color: #f1d397;
    background: transparent;
}

.constructor-page .diagram-action-bar .zoom-controls input[type="range"] {
    width: 63px;
    min-width: 0;
    margin: 0 3px;
    flex: 1 1 auto;
}

.constructor-page .diagram-action-bar .zoom-controls strong {
    min-width: 36px;
    color: #f1d397;
}

.constructor-page .diagram-action-bar #protection-presets {
    order: 3;
    display: block;
    flex: 1 1 360px;
    min-width: 0;
    width: auto;
    padding: 0;
    border: 0;
    border-radius: 0;
    background: none;
}

.constructor-page .diagram-action-bar .protection-preset-grid,
.constructor-page .diagram-action-bar .protection-preset-grid:has(button[data-selection-zone]) {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 5px;
}

.constructor-page .diagram-action-bar .protection-preset-grid:not(:has(button[data-selection-zone])) {
    grid-template-columns: repeat(3, minmax(0, 1fr));
}

.constructor-page .diagram-action-bar #protection-presets .protection-preset-grid button {
    min-height: 36px;
    max-width: none;
    padding: 5px 6px;
    justify-content: center;
    border-radius: 5px;
}

.constructor-page .diagram-action-bar .protection-preset-copy {
    text-align: center;
}

.constructor-page .diagram-action-bar #protection-presets strong {
    font-size: 11px;
    white-space: nowrap;
}

.constructor-page .diagram-action-bar .diagram-fit-button {
    order: 4;
    position: static;
    width: 36px;
    min-width: 36px;
    height: 36px;
    min-height: 36px;
    padding: 0;
    color: #f1d397;
    background: #302b22;
    border-color: #766449;
    font-size: 0;
    pointer-events: auto;
}

.constructor-page .diagram-action-bar .diagram-fit-button span {
    display: block;
    font-size: 20px;
    line-height: 1;
}

.constructor-page .diagram-toolbar-status {
    order: 5;
    flex: 1 0 100%;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    min-width: 0;
    min-height: 24px;
    border-top: 1px solid #3d3629;
}

.constructor-page .diagram-action-bar .diagram-toolbar-status p {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
}

.constructor-page .diagram-toolbar-status .diagram-caption,
.constructor-page .diagram-toolbar-status .diagram-measure-summary {
    min-width: 0;
    min-height: 23px;
    padding: 2px 0;
    border: 0;
    color: #ddd4c1;
    background: transparent;
    font-size: 10px;
}

.constructor-page .diagram-toolbar-status .diagram-caption {
    flex: 1 1 auto;
}

.constructor-page .diagram-toolbar-status .diagram-caption > span {
    width: 17px;
    height: 17px;
    flex-basis: 17px;
    font-size: 11px;
}

.constructor-page .diagram-toolbar-status .diagram-caption strong {
    min-width: 0;
    font-size: 10px;
}

.constructor-page .diagram-toolbar-status .diagram-measure-summary {
    flex: 0 0 auto;
    gap: 9px;
}

.constructor-page .diagram-toolbar-status .diagram-measure-summary small {
    display: none;
}

@media (min-width: 861px) {
    .constructor-page .workspace-stage,
    .constructor-page .selection-panel {
        grid-row: 1;
    }
}

@media (max-width: 1100px) {
    .constructor-page .diagram-action-bar #protection-presets {
        flex: 1 0 100%;
        order: 5;
    }

    .constructor-page .diagram-action-bar .diagram-toolbar-status {
        order: 6;
    }
}

@media (max-width: 860px) {
    .constructor-page .workspace-stage {
        display: block;
    }
}

@media (max-width: 700px) {
    .constructor-page .diagram-action-bar .diagram-mode-switch {
        display: inline-flex;
    }

    .constructor-page .diagram-action-bar .diagram-mode-switch button {
        width: 36px;
        min-width: 36px;
        min-height: 34px;
        padding: 3px;
        font-size: 0;
    }

    .constructor-page .diagram-action-bar .diagram-mode-switch button span {
        margin: 0;
        font-size: 18px;
    }

    .constructor-page .diagram-action-bar .zoom-controls {
        width: 150px;
    }

    .constructor-page .diagram-action-bar #protection-presets {
        flex-basis: 100%;
    }

    .constructor-page .diagram-action-bar .protection-preset-grid,
    .constructor-page .diagram-action-bar .protection-preset-grid:has(button[data-selection-zone]),
    .constructor-page .diagram-action-bar .protection-preset-grid:not(:has(button[data-selection-zone])) {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .constructor-page .diagram-action-bar #protection-presets .protection-preset-grid button {
        min-height: 35px;
        flex-direction: row;
    }

    .constructor-page .diagram-toolbar-status {
        flex-wrap: wrap;
        gap: 0 8px;
    }

    .constructor-page .diagram-toolbar-status .diagram-caption,
    .constructor-page .diagram-toolbar-status .diagram-measure-summary {
        flex: 1 0 100%;
    }
}

@media (max-width: 360px) {
    .constructor-page .diagram-action-bar .diagram-fit-button { order: 2; }
    .constructor-page .diagram-action-bar .zoom-panel { order: 3; }
}
