/* Стили содержимого #program-page > main. */
#program-page {
    > main {
        grid-area: main;
        display: flex;
        min-width: 0;
        min-height: 0;
        overflow: visible;
        > .tab-window {
            display: none;
            flex: 1 1 0;
            min-width: 0;
            min-height: 0;
            padding: 0;
            overflow: visible;
            &.active {
                display: block;
            }
        }
    }
    .full-window, .elastic-window {
        display: flex;
        flex-direction: column;
        box-sizing: border-box;
        height: calc(100% - 24px);
        min-width: 0;
        min-height: 0;
        margin: 12px;
        overflow: visible;
        border: 1px solid #809bb1;
        border-radius: 8px;
        background: #fff;
        box-shadow: 0 3px 12px #203e5b26;
        outline: 1px solid #fff;
        outline-offset: 0;
        > .window-title-panel {
            position: relative;
            z-index: 1;
            border-radius: 7px 7px 0 0;
            display: flex;
            align-items: center;
            flex: 0 0 32px;
            min-width: 0;
            gap: 4px;
            padding: 1px 6px 1px 10px;
            border-bottom: 1px solid #405d73;
            background: #526f85;
            > .title-panel {
                min-width: 0;
                overflow: hidden;
                color: #fff;
                font-size: 12px;
                font-weight: 600;
                white-space: nowrap;
                text-overflow: ellipsis;
            }
            > .title-panel-fill-empty-space {
                flex: 1 1 0;
            }
            > .icon-button-toggle {
                position: relative;
                display: flex;
                align-items: center;
                justify-content: center;
                flex: 0 0 30px;
                width: 30px;
                height: 30px;
                margin: 0;
                padding: 3px;
                border: 1px solid transparent;
                border-radius: 4px;
                background: transparent;
                color: #edf3f8;
                font: inherit;
                cursor: pointer;
                transition: color .15s, background-color .15s, border-color .15s;
                > svg {
                    display: block;
                    width: 100%;
                    height: 100%;
                    fill: currentColor;
                    pointer-events: none;
                }
                > .toolip-view-help-info {
                    display: none;
                    position: absolute;
                    top: calc(100% + 6px);
                    right: calc(100% + 6px);
                    z-index: 3;
                    padding: 5px 8px;
                    border: 1px solid #cbd6e1;
                    border-radius: 4px;
                    background: #fff;
                    color: #34495e;
                    box-shadow: 0 2px 6px #203e5b20;
                    font: 12px/1.3 Arial, sans-serif;
                    white-space: nowrap;
                    pointer-events: none;
                }
                &:hover {
                    color: #fff;
                    background: #65859e;
                    border-color: #8ba5b9;
                    > .toolip-view-help-info {
                        display: block;
                    }
                }
                &:active {
                    background: #405d73;
                }
                &:focus-visible {
                    outline: 1px solid #fff;
                    outline-offset: 1px;
                }
            }
        }
        > .window-body {
            flex: 1 1 0;
            min-width: 0;
            min-height: 0;
            padding: 12px;
            overflow: auto;
            overscroll-behavior: contain;
        }
    }
    > main > .tab-window:has(> .elastic-window) {
        gap: 8px;
        padding: 12px;
        overflow-x: auto;
        overflow-y: hidden;
        &.active {
            display: flex;
        }
    }
    .elastic-window {
        flex: 1 1 125px;
        min-width: 125px;
        height: 100%;
        margin: 0;
        font: 12px Arial, sans-serif;
        transition: background-color .15s;
        &:hover {
            background: #e7edf3;
        }
        > .window-title-panel {
            gap: 1px;
            padding: 1px 4px 1px 8px;
            > .icon-button-toggle {
                display: none;
                flex: 0 0 24px;
                width: 24px;
                height: 26px;
                > .toolip-view-help-info {
                    border-color: #34495e;
                    background: #34495e;
                    color: #fff;
                }
            }
            &:hover > .icon-button-toggle {
                display: flex;
            }
        }
        &.goods {
            border-color: #829f94;
            > .window-title-panel {
                background: #59796d;
                border-bottom-color: #456357;
                > .icon-button-toggle {
                    &:hover {
                        background: #6d8d80;
                        border-color: #9bb5a9;
                    }
                    &:active {
                        background: #456357;
                    }
                }
            }
        }
        > .window-body {
            padding: 5px;
            overflow-x: hidden;
            fieldset {
                min-width: 0;
                margin: 0 0 5px;
                padding: 3px;
                border: 1px solid #cbd6e1;
                border-radius: 3px;
            }
            legend {
                max-width: 100%;
                padding: 0 3px;
                color: #52677d;
                font-weight: 600;
                overflow-wrap: anywhere;
                span {
                    font-size: 11px;
                }
            }
            label {
                display: block;
                min-width: 0;
                margin-bottom: 5px;
                &:last-child {
                    margin-bottom: 0;
                }
                > span {
                    display: block;
                    margin-top: 1px;
                    color: #738395;
                    font-size: 10px;
                    line-height: 1.2;
                    text-align: center;
                    white-space: nowrap;
                    overflow: hidden;
                    text-overflow: ellipsis;
                }
            }
            input {
                display: block;
                box-sizing: border-box;
                width: 100%;
                min-width: 0;
                height: 24px;
                padding: 2px 4px;
                border: 1px solid #8da6ba;
                border-radius: 3px;
                background: #fff;
                color: #246b9e;
                font: 600 13px Arial, sans-serif;
                text-align: right;
                &:hover {
                    border-color: #668aa6;
                }
                &:focus {
                    outline: 2px solid #6a9fc8;
                    outline-offset: -1px;
                }
            }
            fieldset.bad {
                input {
                    border-color: #c78680;
                    background: #fff5f4;
                    color: #a34f48;
                    &:hover {
                        border-color: #b45c56;
                    }
                    &:focus {
                        outline-color: #b45c56;
                        border-color: #b45c56;
                    }
                }
            }
            .window-status-note {
                margin: 0 4px 5px;
                color: #738395;
                background: #f1f5f8;
                box-shadow: inset 2px 0 #9bafbf;
                font-size: 11px;
                line-height: 1.3;
                text-indent: 6px;
                white-space: nowrap;
                overflow: hidden;
                text-overflow: ellipsis;
                &:empty {
                    display: none;
                }
            }
        }
    }
    .full-window > .window-body {
        font-family: "Times New Roman", serif;
        font-size: 12pt;
        line-height: 1;
        color: #000;
        article {
            max-width: 1000px;
            margin-inline: auto;
        }
        h1, h2, h3, h4, p, table {
            font: inherit;
            padding: 0;
        }
        p {
            margin: 0;
            text-indent: 1.25cm;
            text-align: justify;
            orphans: 3;
            widows: 3;
        }
        h1, h2, h3, h4, table, p.formula, p.calc {
            margin: 1em 0;
        }
        h1 {
            font-size: calc(1em + 2pt);
            font-weight: 700;
            text-align: center;
            text-indent: 0;
        }
        h2 {
            font-weight: 400;
            text-align: justify;
            text-indent: 1.25cm;
        }
        h3, h4 {
            font-weight: 700;
            text-align: left;
            text-indent: 1.25cm;
        }
        h1, h2, h3, h4 {
            break-after: avoid;
            page-break-after: avoid;
            break-inside: avoid;
            page-break-inside: avoid;
        }
        p.formula, p.calc {
            font-style: italic;
            text-indent: 0;
            text-align: center;
            break-inside: avoid;
            page-break-inside: avoid;
        }
        table {
            width: 100%;
            max-width: 100%;
            border-collapse: collapse;
            border-spacing: 0;
            table-layout: auto;
            break-inside: auto;
            page-break-inside: auto;
            caption {
                padding: 0 0 1em;
                font: inherit;
                font-weight: 700;
                text-align: center;
                text-indent: 0;
                caption-side: top;
                break-after: avoid;
                page-break-after: avoid;
            }
            thead {
                display: table-header-group;
            }
            tbody {
                display: table-row-group;
            }
            tr {
                break-inside: avoid;
                page-break-inside: avoid;
            }
            th, td {
                height: 8mm;
                padding: 2px 5px;
                border: 1px solid #000;
                font: inherit;
                vertical-align: middle;
                text-indent: 0;
                overflow-wrap: break-word;
                word-break: normal;
                min-width: 0;
            }
            th {
                background: #e8eff5;
                font-weight: 700;
                text-align: center;
            }
            thead > tr:last-child > th,
            thead > tr:last-child > td,
            tbody > tr:first-child:has(> th) > th,
            tbody > tr:first-child:has(> th) > td {
                border-bottom: 0.8mm double #000;
            }
            tr:hover > th, tr:hover > td {
                background: #e5eff8;
            }
            td.symbol {
                text-align: center;
                font-style: italic;
                white-space: nowrap;
            }
            td.number, th.number {
                text-align: center;
                font-variant-numeric: tabular-nums;
                white-space: nowrap;
            }
        }
    }
}

@media (max-width: 480px) {
    #program-page > main {
        padding: 10px;
    }
}

/* Математические матрицы и векторы внутри отчёта. */
#program-page .full-window > .window-body .formula:has(> table.matrix, > table.vector) {
    margin: 1em 0;
    text-align: center;
    text-indent: 0;
    font-style: italic;
}

#program-page .full-window > .window-body table.matrix,
#program-page .full-window > .window-body table.vector {
    --math-accent: #476f91;
    --math-surface: #eef5fa;
    position: relative;
    display: inline-block;
    width: auto;
    max-width: 100%;
    margin: 0 0.3em;
    padding: 0.2em 0.65em;
    border: 0;
    border-collapse: separate;
    border-spacing: 0.45em 0.16em;
    background: var(--math-surface);
    color: #203f59;
    vertical-align: middle;
    line-height: 1.15;
    box-shadow: inset 0 0 0 1px #ffffffa6;
}

#program-page .full-window > .window-body table.vector {
    --math-accent: #4f7c69;
    --math-surface: #eef7f2;
}

#program-page .full-window > .window-body table.matrix::before,
#program-page .full-window > .window-body table.matrix::after,
#program-page .full-window > .window-body table.vector::before,
#program-page .full-window > .window-body table.vector::after {
    content: "";
    position: absolute;
    top: 0;
    bottom: 0;
    width: 0.42em;
    pointer-events: none;
}

#program-page .full-window > .window-body table.matrix::before,
#program-page .full-window > .window-body table.vector::before {
    left: 0;
    border-left: 1px solid var(--math-accent);
    border-radius: 50% 0 0 50%;
}

#program-page .full-window > .window-body table.matrix::after,
#program-page .full-window > .window-body table.vector::after {
    right: 0;
    border-right: 1px solid var(--math-accent);
    border-radius: 0 50% 50% 0;
}

#program-page .full-window > .window-body table.matrix tr,
#program-page .full-window > .window-body table.vector tr {
    background: transparent;
}

#program-page .full-window > .window-body table.matrix td,
#program-page .full-window > .window-body table.vector td,
#program-page .full-window > .window-body table.matrix tr:hover > td,
#program-page .full-window > .window-body table.vector tr:hover > td {
    min-width: 1.8em;
    height: auto;
    padding: 0.12em 0.22em;
    border: 0;
    background: transparent;
    color: inherit;
    text-align: center;
    vertical-align: middle;
    white-space: nowrap;
    font: inherit;
    font-variant-numeric: tabular-nums;
}

