.valve-sizing {
    --valve-case-min: #b5dee8;
    --valve-case-norm: #cac7f7;
    --valve-case-max: #fac7c7;
}

.valve-sizing textarea {
    resize: vertical;
}

.valve-sizing .valve-primary,
.valve-sizing .rated-coefficient {
    background-color: #ff9400;
    color: #fff;
}

.valve-sizing .valve-primary:hover,
.valve-sizing .valve-primary:focus-visible {
    background-color: #ffad2e;
}

.valve-sizing .valve-toolbar .btn:not(:disabled) {
    display: inline-flex;
    align-items: center;
    align-self: center;
    min-block-size: 2.375rem;
    padding-block: .375rem;
    line-height: 1.5;
    white-space: nowrap;
}

.valve-sizing :is(#btnReset, #btnPdf, #btnSaveCalculationToolbar):disabled {
    display: none;
}

.valve-sizing .calculator-inputs {
    width: 100%;
    table-layout: fixed;
}

.valve-sizing .table-edit {
    width: 100%;
    min-width: 46rem;
    table-layout: fixed;
}

.valve-sizing .valve-process-conditions [data-case="min"],
.valve-sizing :is(.compare-matrix, .valve-performance-table) tr[data-case="min"] > *,
.valve-sizing #checksCard .table > :is(thead, tbody) > tr > :nth-child(2) {
    --bs-table-bg: var(--valve-case-min);
}

.valve-sizing .valve-process-conditions [data-case="norm"],
.valve-sizing :is(.compare-matrix, .valve-performance-table) tr[data-case="norm"] > *,
.valve-sizing #checksCard .table > :is(thead, tbody) > tr > :nth-child(3) {
    --bs-table-bg: var(--valve-case-norm);
}

.valve-sizing .valve-process-conditions [data-case="max"],
.valve-sizing :is(.compare-matrix, .valve-performance-table) tr[data-case="max"] > *,
.valve-sizing #checksCard .table > :is(thead, tbody) > tr > :nth-child(4) {
    --bs-table-bg: var(--valve-case-max);
}

.valve-sizing .valve-process-conditions .matrix-error:not(:empty) {
    background-color: #fff;
    margin-top: .25rem;
    padding: .125rem .25rem;
}

.valve-sizing #checksCard tr > :first-child {
    text-align: left;
}

.valve-sizing #checksCard tr > :not(:first-child) {
    text-align: center;
}

.valve-sizing .matrix-error {
    display: block;
    font-size: .75rem;
    overflow-wrap: anywhere;
    color: #b42318;
}

.valve-sizing .table-edit .is-invalid {
    border-color: #b42318;
}

.valve-sizing .valve-unit-fields {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 1rem;
}

.valve-sizing .valve-unit-fields.is-base {
    grid-template-columns: minmax(0, 1fr);
}

.valve-sizing .valve-unit-fields .input-group[hidden] {
    display: none;
}

.valve-sizing .valve-base-value {
    display: flex;
    align-items: center;
    min-width: 0;
    min-height: var(--calculator-control-height);
    background-color: #e9ecef;
    text-align: left;
    overflow: hidden;
}

.valve-sizing .valve-unit-fields .input-group > input,
.valve-sizing .valve-unit-fields .input-group > .valve-unit-select {
    flex: 1 1 0;
    width: auto;
    min-width: 0;
}

.valve-sizing .valve-result-units {
    display: flex;
    flex-wrap: wrap;
    gap: .75rem;
}

.valve-sizing .valve-result-units label {
    flex: 1 1 10rem;
    font-size: .875rem;
    font-weight: 700;
}

.valve-sizing th,
.valve-sizing td {
    text-align: left;
    vertical-align: middle;
}

.valve-sizing .kpi {
    padding: .65rem .75rem;
    border: 1px solid var(--site-line);
    border-radius: .625rem;
    background-color: var(--site-background);
}

.valve-sizing .kpi b {
    display: block;
    font-weight: 700;
    overflow-wrap: anywhere;
}

.valve-sizing .case-head,
.valve-sizing .chart-title {
    font-weight: 700;
}

.valve-sizing .chart-sub {
    color: var(--site-muted);
    font-size: .875rem;
}

.valve-sizing .calculator-chart canvas {
    max-width: 100%;
}

.valve-sizing .chart-note {
    padding: 1rem;
    border: 1px dashed var(--site-line);
    border-radius: .625rem;
    color: var(--site-muted);
}

.valve-sizing #compareCard[hidden] {
    display: none;
}

.valve-sizing .valve-candidates {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(min(100%, 12rem), 1fr));
    gap: .75rem;
}

.valve-sizing .valve-candidate {
    display: flex;
    align-items: flex-start;
    gap: .6rem;
    padding: .65rem .75rem;
    border: 1px solid var(--site-line);
    border-radius: .625rem;
    cursor: pointer;
}

.valve-sizing .valve-candidate:has(input:checked) {
    border-color: #175cd3;
    background-color: #eff6ff;
}

.valve-sizing .compare-case {
    --bs-btn-color: #fff;
    --bs-btn-bg: var(--case-color);
    --bs-btn-border-color: var(--case-color);
    --bs-btn-hover-color: var(--bs-btn-color);
    --bs-btn-hover-bg: var(--case-color);
    --bs-btn-hover-border-color: var(--case-color);
    --bs-btn-active-color: var(--bs-btn-color);
    --bs-btn-active-bg: var(--case-color);
    --bs-btn-active-border-color: var(--case-color);
}

.valve-sizing .compare-case[data-case="all"] {
    --case-color: #ff9400;
}

.valve-sizing .compare-case.active {
    box-shadow: inset 0 0 0 2px currentColor;
}

.valve-sizing .compare-case:focus-visible {
    outline: 2px solid var(--bs-body-color);
    outline-offset: 2px;
}

.valve-sizing .compare-travel {
    display: grid;
    gap: .75rem;
}

.valve-sizing .compare-track {
    position: relative;
    height: .65rem;
    margin: 1.4rem 2.5rem calc(.25rem + var(--label-rows) * 1.1rem);
    border-radius: 1rem;
    background: linear-gradient(to right, #e5e7eb var(--open-min), #bbf7d0 var(--open-min) var(--open-max), #e5e7eb var(--open-max));
}

.valve-sizing .compare-limit,
.valve-sizing .compare-marker {
    position: absolute;
    left: var(--position);
}

.valve-sizing .compare-limit {
    bottom: 100%;
    color: var(--bs-secondary-color);
    font-size: .75rem;
    transform: translateX(-50%);
}

.valve-sizing .compare-limit::after {
    position: absolute;
    top: 100%;
    left: 50%;
    height: .65rem;
    border-left: 1px solid currentColor;
    content: "";
}

.valve-sizing .compare-marker {
    top: 50%;
}

.valve-sizing .compare-point {
    position: absolute;
    width: .8rem;
    height: .8rem;
    border: 1px solid white;
    border-radius: 50%;
    background: var(--point-color);
    transform: translate(-50%, -50%);
}

.valve-sizing .compare-point-label {
    position: absolute;
    top: calc(.5rem + var(--label-lane) * 1.1rem);
    border-bottom: 2px solid var(--point-color);
    font-size: .75rem;
    line-height: 1rem;
    white-space: nowrap;
    transform: translateX(-50%);
}

.valve-sizing .compare-matrix :is(th, td) {
    white-space: nowrap;
}

.valve-sizing .compare-matrix tr[data-case] > :is(th, td) {
    --bs-table-color: #fff;
}

.valve-sizing .compare-matrix thead th,
.valve-sizing .compare-matrix th:first-child:not([colspan]) {
    max-width: 10rem;
    font-size: .8rem;
    white-space: normal;
    overflow-wrap: anywhere;
}

.valve-sizing .compare-rating-0 { color: #166534; }
.valve-sizing .compare-rating-1 { color: #92400e; }
.valve-sizing .compare-rating-2 { color: #b42318; }

.valve-sizing .status-ok {
    color: #166534;
}

.valve-sizing .error-text,
.valve-sizing .status-choked {
    color: #991b1b;
}

.valve-sizing .status-cavitation {
    color: #92400e;
}

.valve-sizing .valve-case-field-label {
    display: none;
}

.valve-sizing .calculator-results output.form-control {
    min-height: var(--calculator-control-height);
    height: auto;
    overflow-wrap: anywhere;
    background-color: #f8fafc;
}

@media (max-width: 767.98px) {
    .valve-sizing .valve-unit-fields {
        grid-template-columns: minmax(0, 1fr);
        gap: .5rem;
    }

}
