.diagram-action-bar {
    display: flex;
    align-items: center;
    gap: 14px;
    min-height: 58px;
    padding: 9px 15px;
    border-bottom: 1px solid #d8e1df;
    color: #253a35;
    background: #f8fbfa;
}

.diagram-mode-switch {
    display: inline-flex;
    flex: 0 0 auto;
    gap: 3px;
    padding: 3px;
    border: 1px solid #d5e1dd;
    border-radius: 8px;
    background: #edf3f1;
}

.diagram-mode-switch button {
    min-height: 34px;
    padding: 5px 11px;
    border: 0;
    border-radius: 5px;
    color: #435a54;
    background: transparent;
    font: inherit;
    font-size: 12px;
    font-weight: 700;
    white-space: nowrap;
    cursor: pointer;
}

.diagram-mode-switch button span { margin-right: 4px; font-size: 16px; line-height: 0; }
.diagram-mode-switch button:hover { color: #0b6b4c; background: #e1eeea; }
.diagram-mode-switch button.is-active { color: #fff; background: #087c55; box-shadow: 0 1px 4px #087c5526; }
.diagram-mode-switch #diagram-mode-erase.is-active { background: #b4532d; box-shadow: 0 1px 4px #b4532d33; }
.diagram-mode-switch button:focus-visible,
.diagram-fit-button:focus-visible { outline: 2px solid #087c55; outline-offset: 2px; }

.diagram-action-bar p {
    flex: 1 1 auto;
    min-width: 0;
    margin: 0;
    color: #526760;
    font-size: 12px;
    line-height: 1.35;
}

.diagram-fit-button {
    flex: 0 0 auto;
    min-height: 36px;
    padding: 7px 11px;
    border: 1px solid #b5d8c7;
    border-radius: 6px;
    color: #086444;
    background: #eef8f2;
    font: inherit;
    font-size: 12px;
    font-weight: 700;
    cursor: pointer;
}
.diagram-fit-button:hover { background: #d9f1e3; }
.diagram-fit-button span { display: none; }

.constructor-page .diagram-scroll { overflow: hidden; touch-action: auto; overscroll-behavior: auto; }
.diagram-scroll.is-panning,
.diagram-scroll.is-panning .detail-hit { cursor: grab; }
.diagram-scroll.is-panning:active,
.diagram-scroll.is-panning:active .detail-hit { cursor: grabbing; }
.diagram-scroll.is-panning .detail-hit:hover { fill: rgba(255, 107, 44, 0.001); filter: none; }
.diagram-scroll.is-panning .detail-hit.selected:hover { fill: rgba(18, 183, 106, .46); }
.diagram-scroll.is-erasing .detail-hit:not(.selected) { pointer-events: none; }
.diagram-scroll.is-erasing .detail-hit.selected { cursor: cell; }

.constructor-page .checkout-dialog {
    width: min(540px, calc(100% - 28px));
    max-height: calc(100dvh - 24px);
    border-radius: 10px;
}
.constructor-page .checkout-form {
    display: grid;
    gap: 14px;
    padding: 22px;
}
.constructor-page .checkout-form .dialog-head { align-items: center; gap: 12px; }
.constructor-page .checkout-form .dialog-head h2 { margin: 0; font-size: 22px; line-height: 1.2; letter-spacing: 0; }
.constructor-page .checkout-form .dialog-close { flex: 0 0 34px; width: 34px; height: 34px; border-radius: 7px; }
.constructor-page .checkout-form .film-choice[hidden],
.constructor-page .checkout-form .form-error[hidden],
.constructor-page .checkout-form .checkout-site-panel[hidden],
.constructor-page .checkout-form .checkout-telegram-panel[hidden] { display: none; }
.constructor-page .checkout-form .order-review {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 8px 14px;
    margin: 0;
    padding: 0 0 12px;
    border: 0;
    border-bottom: 1px solid #394145;
    border-radius: 0;
    color: #e7eae5;
    background: none;
    font-size: 12px;
    font-weight: 650;
}
.constructor-page .checkout-form .order-review span { min-width: 0; overflow-wrap: anywhere; }
.constructor-page .checkout-form .order-review strong { flex: 0 0 auto; color: #e8c283; font-size: 14px; white-space: nowrap; }
.checkout-channel-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 7px; }
.checkout-channel {
    display: grid;
    align-content: center;
    justify-items: center;
    min-width: 0;
    min-height: 58px;
    padding: 7px 5px;
    border: 1px solid #526060;
    border-radius: 7px;
    color: #e8eeeb;
    background: #243034;
    font: inherit;
    text-align: center;
    cursor: pointer;
}
.checkout-channel strong { font-size: 12px; line-height: 1.2; }
.checkout-channel small { margin-top: 3px; color: #b6c3be; font-size: 10px; line-height: 1.2; }
.checkout-channel:not(:disabled):hover,
.checkout-channel:not(:disabled):focus-visible { border-color: #e2b976; outline: none; background: #303936; }
.checkout-channel.is-active { border-color: #e2b976; color: #f6d59b; background: #382f22; box-shadow: inset 0 0 0 1px rgba(226, 185, 118, .25); }
.checkout-channel.is-active small { color: #e6d2b0; }
.checkout-channel:disabled { cursor: not-allowed; opacity: .68; }
.checkout-channel-ozon strong { color: #8cbbff; }
.checkout-channel-wb strong { color: #cfb3f4; }
.constructor-page .checkout-form .checkout-site-panel,
.constructor-page .checkout-form .checkout-telegram-panel { display: grid; gap: 11px; }
.constructor-page .checkout-form .form-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.constructor-page .checkout-form .form-grid label { gap: 4px; }
.constructor-page .checkout-form .form-grid label > span { font-size: 12px; }
.constructor-page .checkout-form .form-grid input { min-height: 45px; font-size: 16px; }
.constructor-page .checkout-form .button-large { min-height: 47px; font-size: 14px; }
.constructor-page .checkout-form .checkout-consent-note { margin: 0; font-size: 10px; line-height: 1.35; }
.constructor-page .checkout-form .checkout-telegram-button {
    display: grid;
    place-items: center;
    min-height: 47px;
    border: 1px solid #0ea472;
    border-radius: 7px;
    color: #fff;
    background: #087c55;
    font-size: 14px;
    font-weight: 750;
    text-decoration: none;
}
.constructor-page .checkout-form .checkout-telegram-button:hover { background: #0b9467; }
.constructor-page .checkout-form .checkout-telegram-panel p { margin: 0; color: #aebcbb; font-size: 11px; text-align: center; }
.constructor-page .checkout-form .checkout-telegram-channel { color: #e8c283; font-size: 11px; text-align: center; text-underline-offset: 2px; }

.constructor-page .selection-footer .purchase-actions { display: grid; gap: 7px; }
.constructor-page .selection-footer .purchase-direct { min-height: 42px; font-size: 13px; }
.constructor-page .selection-footer .purchase-marketplaces {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 7px;
}
.constructor-page .selection-footer .purchase-marketplace {
    display: flex;
    align-items: center;
    justify-content: space-between;
    min-width: 0;
    min-height: 36px;
    padding: 6px 10px;
    border: 1px solid #526060;
    border-radius: 6px;
    color: #e8eeeb;
    background: #243034;
    font: inherit;
    text-align: left;
    cursor: not-allowed;
}
.constructor-page .selection-footer .purchase-marketplace strong { font-size: 12px; }
.constructor-page .selection-footer .purchase-marketplace small { color: #b6c3be; font-size: 10px; }
.constructor-page .selection-footer .purchase-marketplace:disabled { opacity: .8; }

@media (max-width: 620px) {
    .constructor-page .checkout-form { gap: 12px; padding: 18px; }
    .constructor-page .checkout-form .order-review { flex-wrap: wrap; }
    .constructor-page .checkout-form .form-grid { grid-template-columns: 1fr; }
    .checkout-channel-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .checkout-channel { min-height: 51px; }
}

.workspace-top,
.workspace-stage { display: contents; }

@media (min-width: 861px) {
    .constructor-page .constructor-layout {
        grid-template-columns: minmax(0, 1fr) clamp(300px, 27%, 370px);
        column-gap: 14px;
        row-gap: 10px;
    }
    .constructor-page .workspace-card { display: contents; }
    .constructor-page .workspace-top {
        grid-column: 1 / -1;
        grid-row: 1;
        display: grid;
        grid-template-columns: minmax(0, 1fr) auto;
        overflow: hidden;
        border: 1px solid #394145;
        border-radius: 8px;
        background: #171e22;
    }
    .constructor-page .workspace-stage {
        grid-column: 1;
        grid-row: 2;
        display: block;
        min-width: 0;
        overflow: hidden;
        border: 1px solid #394145;
        border-radius: 8px;
        background: #171e22;
    }
    .constructor-page .selection-panel {
        grid-column: 2;
        grid-row: 2;
        min-width: 0;
        border-radius: 8px;
    }
    .constructor-page .workspace-toolbar {
        grid-column: 1 / -1;
        display: flex;
        align-items: center;
        min-height: 0;
        padding: 8px 12px;
        gap: 12px;
    }
    .constructor-page .instruction,
    .constructor-page .zoom-panel,
    .constructor-page .protection-presets-toolbar {
        grid-column: auto;
        grid-row: auto;
    }
    .constructor-page .instruction { flex: 0 0 auto; gap: 8px; }
    .constructor-page .instruction strong { font-size: 12px; }
    .constructor-page .instruction small { display: block; font-size: 11px; }
    .constructor-page .pulse-dot { width: 7px; height: 7px; box-shadow: 0 0 0 4px rgba(18, 163, 109, .1); }
    .constructor-page .zoom-panel { flex: 0 0 auto; justify-self: auto; gap: 6px; }
    .constructor-page .zoom-label { display: none; }
    .constructor-page .zoom-controls { height: 34px; border-radius: 6px; }
    .constructor-page .zoom-controls button { width: 28px; }
    .constructor-page .zoom-controls input[type="range"] { width: 85px; }
    .constructor-page .protection-presets-toolbar,
    .lekala-theme.constructor-page .workspace-top .protection-presets-toolbar {
        flex: 1 1 auto;
        width: auto;
        min-width: 0;
        padding: 0;
        gap: 0;
        flex-direction: row;
        border: 0;
        border-radius: 0;
        background: transparent;
    }
    .constructor-page .protection-presets-toolbar-label { display: none; }
    .constructor-page .protection-preset-grid,
    .constructor-page .protection-preset-grid:has(button[data-selection-zone]) {
        display: flex;
        justify-content: flex-end;
        gap: 6px;
    }
    .constructor-page .protection-preset-grid button {
        flex: 1 1 auto;
        max-width: 126px;
        min-height: 34px;
        padding: 5px 9px;
        justify-content: center;
        border-radius: 6px;
    }
    .constructor-page .protection-preset-number,
    .constructor-page .protection-preset-grid small { display: none; }
    .constructor-page .protection-preset-copy { text-align: center; }
    .constructor-page .protection-preset-grid strong { font-size: 11px; line-height: 1.2; }
    .lekala-theme.constructor-page .workspace-top .protection-preset-grid button {
        border-color: #806b48;
        color: #e8c283;
        background: #302b22;
    }
    .lekala-theme.constructor-page .workspace-top .protection-preset-grid button:hover,
    .lekala-theme.constructor-page .workspace-top .protection-preset-grid button:focus-visible { border-color: #e2b976; background: #403728; }
    .lekala-theme.constructor-page .workspace-top .protection-preset-grid button.is-active { border-color: #e2b976; color: #1d1c18; background: #e2b976; }
    .constructor-page .diagram-caption,
    .constructor-page .diagram-measure-summary { min-height: 28px; padding: 4px 12px; font-size: 10px; }
    .constructor-page .diagram-caption { grid-column: 1; }
    .constructor-page .diagram-caption > span { width: 17px; height: 17px; flex-basis: 17px; font-size: 11px; }
    .constructor-page .diagram-measure-summary { grid-column: 2; gap: 9px; }
    .constructor-page .diagram-measure-summary small { display: none; }
    .constructor-page .workspace-stage .diagram-action-bar {
        min-height: 42px;
        padding: 4px 10px;
        gap: 8px;
        border-color: #394145;
        color: #dce5df;
        background: #1c2729;
    }
    .constructor-page .workspace-stage .diagram-mode-switch { border-color: #4a5957; background: #253332; }
    .constructor-page .workspace-stage .diagram-mode-switch button { min-height: 30px; padding: 4px 8px; color: #c4d1cc; font-size: 11px; }
    .constructor-page .workspace-stage .diagram-mode-switch button.is-active { color: #fff; background: #087c55; }
    .constructor-page .workspace-stage .diagram-action-bar p { display: none; }
    .constructor-page .workspace-stage .diagram-fit-button {
        width: 32px;
        min-height: 32px;
        padding: 0;
        border-color: #6e6654;
        color: #e8c283;
        background: #302b22;
        font-size: 0;
    }
    .constructor-page .workspace-stage .diagram-fit-button span { display: block; font-size: 20px; }
}

@media (min-width: 861px) and (max-width: 1100px) {
    .constructor-page .workspace-toolbar {
        display: grid;
        grid-template-columns: minmax(0, 1fr) auto;
        gap: 6px 10px;
        padding-block: 6px;
    }
    .constructor-page .instruction { grid-column: 1; grid-row: 1; }
    .constructor-page .zoom-panel { grid-column: 2; grid-row: 1; }
    .constructor-page .protection-presets-toolbar { grid-column: 1 / -1; grid-row: 2; }
    .constructor-page .protection-preset-grid { justify-content: flex-start; }
}

@media (max-width: 700px) {
    .constructor-page .checkout-form { padding: 18px; }
}

@media (max-width: 700px) {
    .constructor-page .constructor-header:not(.is-mobile-relocated) { display: none; }
    .constructor-page .constructor-header.is-mobile-relocated { margin-top: 18px; min-height: 0; }
    .constructor-page .constructor-layout { padding-top: 10px; }
    .constructor-page .zoom-panel { display: none; }
    .protection-preset-grid,
    .protection-preset-grid:has(button[data-selection-zone]) {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 7px;
    }
    .protection-presets-toolbar { padding: 9px; }
    .protection-preset-grid button {
        min-height: 52px;
        padding: 6px 8px;
        flex-direction: row;
        justify-content: flex-start;
        gap: 7px;
        touch-action: manipulation;
    }
    .protection-preset-number { width: 23px; height: 23px; flex-basis: 23px; }
    .protection-preset-copy { text-align: left; }
    .protection-preset-grid strong { font-size: 12px; line-height: 1.15; }
    .protection-preset-grid small { font-size: 10px; line-height: 1.2; }
    .diagram-action-bar { position: relative; z-index: 3; display: block; height: 0; min-height: 0; padding: 0; border: 0; background: transparent; pointer-events: none; }
    .diagram-mode-switch { display: none; }
    .diagram-fit-button {
        position: absolute;
        top: 12px;
        right: 12px;
        display: flex;
        align-items: center;
        justify-content: center;
        width: 44px;
        min-width: 44px;
        min-height: 44px;
        padding: 0;
        border: 1px solid #6e8684;
        border-radius: 7px;
        background: rgba(28, 43, 46, .93);
        color: #e1ebe8;
        font-size: 0;
        box-shadow: none;
        touch-action: manipulation;
        pointer-events: auto;
    }
    .diagram-fit-button span { display: block; color: inherit; font-size: 22px; line-height: 1; }
    .diagram-fit-button:hover { color: #fff; background: #34464a; }
    .diagram-action-bar p { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; }
    .constructor-page .diagram-scroll { cursor: default; }
    .constructor-page .diagram { transition: none; }
}

@media (max-width: 360px) {
    .protection-preset-grid button { padding-inline: 5px; gap: 4px; }
    .protection-preset-number { width: 20px; height: 20px; flex-basis: 20px; }
    .protection-preset-grid strong { font-size: 10px; }
    .protection-preset-grid small { font-size: 9px; }
}
/* Keep price bindings out of the layout and give preset labels their own contrast. */
.constructor-page #live-estimate[hidden] { display: none; }
.constructor-page #protection-presets .protection-preset-grid button {
    min-height: 40px;
    border: 1px solid #92805f;
    background: #252728;
    color: #faf7f0;
    box-shadow: none;
}
.constructor-page #protection-presets .protection-preset-copy {
    background: transparent;
    color: inherit;
}
.constructor-page #protection-presets strong { font-size: 13px; font-weight: 700; line-height: 1.25; color: inherit; text-decoration: none; }
.constructor-page #protection-presets small { color: #c8c9c7; }
.constructor-page #protection-presets .protection-preset-number { background: #3c372e; color: #f5d597; }
.constructor-page #protection-presets button:hover:not(:disabled) { background: #353635; border-color: #edc384; }
.constructor-page #protection-presets button:focus-visible { outline: 2px solid #f4d599; outline-offset: 2px; }
.constructor-page #protection-presets button.is-active,
.constructor-page #protection-presets button.is-active:hover { background: #e6bf7c; color: #19150f; border-color: #ffdf9f; }
.constructor-page #protection-presets button.is-active small { color: #393226; }
.constructor-page #protection-presets button.is-active .protection-preset-number { background: #28251e; color: #ffe4af; }
