/* ============================================================
   OptimalCut — дополнение к app.css и guest.css

   Файл только ДОБАВЛЯЕТ классы: панель кнопок вместо сворачиваемых блоков,
   широкие модальные окна и график сложности расчёта.
   Ни один селектор из app.css здесь не переопределяется.

   Цвета берутся из переменных app.css с запасными значениями.
   ============================================================ */

/* ---------- Панель кнопок вместо сворачиваемых блоков ---------- */

.panelbar {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 12px;
    margin-bottom: 18px;
}

.panelbtn {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 3px;
    text-align: left;
    padding: 13px 16px;
    border: 1px solid var(--line, #e7e5e0);
    border-radius: var(--radius, 10px);
    background: var(--paper, #fff);
    color: var(--ink, #0b0b0b);
    font: inherit;
    cursor: pointer;
    transition: border-color .14s, box-shadow .14s, transform .06s;
}

.panelbtn:hover {
    border-color: var(--ink, #0b0b0b);
}

.panelbtn:active {
    transform: translateY(1px);
}

.panelbtn:focus-visible {
    outline: 2px solid var(--ink, #0b0b0b);
    outline-offset: 2px;
}

.panelbtn__title {
    font-size: 14px;
    font-weight: 650;
    letter-spacing: -.01em;
}

.panelbtn__sub {
    font-size: 12px;
    color: var(--muted-2, #a5a099);
    line-height: 1.35;
}

.panelbtn.is-empty {
    border-style: dashed;
}

.panelbtn.is-empty .panelbtn__sub {
    color: var(--bad, #b3352c);
}

/* ---------- Широкое модальное окно для панелей ---------- */

.modal__win--panel {
    width: 940px;
    max-width: 94vw;
}

.panelhost {
    max-height: 68vh;
    overflow-y: auto;
    margin: 0 -22px;
    padding: 0 22px;
}

/* ---------- Постоянный контейнер результата ---------- */

.resultbox {
    background: var(--paper, #fff);
    border: 1px solid var(--line, #e7e5e0);
    border-radius: var(--radius, 10px);
    padding: 18px;
}

.resultbox__head {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
    margin-bottom: 4px;
}

.resultbox__title {
    font-size: 14.5px;
    font-weight: 650;
}

.resultbox__sub {
    font-size: 12.5px;
    color: var(--muted-2, #a5a099);
    margin-left: auto;
}

/* ---------- Анимация ожидания расчёта ---------- */

.cwait {
    border: 1px solid var(--line, #e7e5e0);
    border-radius: var(--radius-s, 7px);
    background: var(--paper, #fff);
    padding: 14px 16px 13px;
    margin: 14px 0 4px;
}

.cwait__row {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 11px;
}

.cwait__spin {
    width: 15px;
    height: 15px;
    flex: none;
    border: 2px solid var(--line, #e7e5e0);
    border-top-color: var(--ink, #0b0b0b);
    border-radius: 50%;
    animation: cwait-spin .7s linear infinite;
}

@keyframes cwait-spin {
    to { transform: rotate(360deg); }
}

.cwait__text {
    font-size: 13px;
    font-weight: 600;
}

.cwait__timer {
    margin-left: auto;
    font-size: 12px;
    color: var(--muted, #78746c);
    font-variant-numeric: tabular-nums;
}

.cwait__bar {
    height: 3px;
    border-radius: 2px;
    background: var(--line-soft, #f0eeea);
    overflow: hidden;
}

.cwait__bar i {
    display: block;
    height: 100%;
    width: 34%;
    border-radius: 2px;
    background: var(--ink, #0b0b0b);
    animation: cwait-run 1.25s ease-in-out infinite;
}

@keyframes cwait-run {
    0%   { transform: translateX(-100%); }
    100% { transform: translateX(295%); }
}

.cwait__hint {
    font-size: 11.5px;
    color: var(--muted-2, #a5a099);
    line-height: 1.5;
    margin-top: 9px;
}

/* ---------- Профиль ресурсов после расчёта ---------- */

.cprof {
    border: 1px solid var(--line, #e7e5e0);
    border-radius: var(--radius-s, 7px);
    background: var(--paper, #fff);
    margin: 14px 0 4px;
}

.cprof__sum {
    padding: 11px 15px;
    font-size: 12.5px;
    color: var(--muted, #78746c);
    cursor: pointer;
    list-style: none;
}

.cprof__sum::-webkit-details-marker {
    display: none;
}

.cprof__sum::before {
    content: "▸";
    display: inline-block;
    margin-right: 7px;
    color: var(--muted-2, #a5a099);
    transition: transform .15s;
}

.cprof[open] .cprof__sum::before {
    transform: rotate(90deg);
}

.cprof__sum b {
    color: var(--ink, #0b0b0b);
    font-weight: 650;
    font-variant-numeric: tabular-nums;
}

.cprof__body {
    padding: 4px 15px 14px;
    border-top: 1px solid var(--line-soft, #f0eeea);
}

.cprof__head,
.cprof__row {
    display: grid;
    grid-template-columns: 190px 1fr 66px 42px 92px;
    align-items: center;
    gap: 10px;
}

.cprof__head {
    font-size: 10.5px;
    text-transform: uppercase;
    letter-spacing: .04em;
    color: var(--muted-2, #a5a099);
    padding: 9px 0 6px;
}

.cprof__head span:nth-child(n+3) {
    text-align: right;
}

.cprof__row {
    padding: 4px 0;
    font-size: 12px;
}

.cprof__name {
    color: var(--ink, #0b0b0b);
}

.cprof__track {
    height: 8px;
    border-radius: 4px;
    background: var(--line-soft, #f0eeea);
    overflow: hidden;
}

.cprof__bar {
    display: block;
    height: 100%;
    border-radius: 4px;
    background: var(--ink, #0b0b0b);
    animation: cprof-grow .45s ease-out;
}

@keyframes cprof-grow {
    from { width: 0 !important; }
}

.cprof--cg        { background: #3d5a7a; }
.cprof--construct { background: #4a7a55; }
.cprof--lns       { background: #0b0b0b; }
.cprof--harmonize { background: #8a6a3d; }
.cprof--start,
.cprof--report    { background: #a5a099; }

.cprof__ms,
.cprof__share,
.cprof__nodes {
    text-align: right;
    font-variant-numeric: tabular-nums;
    color: var(--muted, #78746c);
}

.cprof__ms {
    color: var(--ink, #0b0b0b);
    font-weight: 600;
}

.cprof__foot {
    margin-top: 11px;
    padding-top: 10px;
    border-top: 1px solid var(--line-soft, #f0eeea);
    font-size: 11.5px;
    color: var(--muted-2, #a5a099);
    line-height: 1.6;
}

.cprof__foot b {
    color: var(--muted, #78746c);
    font-variant-numeric: tabular-nums;
}

/* ---------- Подсказка в шапке таблицы ---------- */

.th-hint {
    font-weight: 400;
    text-transform: none;
    letter-spacing: 0;
    color: var(--muted-2, #a5a099);
}

/* ---------- Ссылка «забыли пароль» ---------- */

.linkbtn {
    background: none;
    border: 0;
    padding: 0;
    font: inherit;
    font-size: 12.5px;
    color: var(--muted, #78746c);
    cursor: pointer;
    text-decoration: underline;
    text-underline-offset: 2px;
}

.linkbtn:hover {
    color: var(--ink, #0b0b0b);
}

@media print {
    .panelbar,
    .cwait,
    .cprof {
        display: none !important;
    }

    .resultbox {
        border: 0;
        padding: 0;
    }

    .resultbox__head {
        display: none !important;
    }
}

@media (max-width: 900px) {
    .panelbar {
        grid-template-columns: 1fr;
    }
}