/* MS Standart calculator — UI mirrored from safe.ru */

/* Play font is loaded globally from the layout */

#calculator.ms-calc-section {
    background: #fff;
    padding: 48px 0 72px;
}

#calculator.ms-calc-section .section-head {
    margin-bottom: 28px;
}

#calculator.ms-calc-section .section-eyebrow {
    display: none;
}

#calculator.ms-calc-section .section-title {
    font-family: Play, sans-serif;
    font-weight: 500;
    font-size: 28px;
    letter-spacing: 0.02em;
    text-transform: uppercase;
    color: #0b53b3;
    margin: 0 0 8px;
}

#calculator.ms-calc-section .section-desc {
    display: none;
}

.ms-calc {
    font-family: Play, sans-serif;
    color: #333;
    max-width: none;
    width: 100%;
    margin: 0;
}

.ms-calc * {
    box-sizing: border-box;
}

.ms-calc button {
    padding: 16px 32px;
    font-size: 16px;
    line-height: 18px;
    color: #fff;
    background: #f58214;
    border: 1px solid transparent;
    cursor: pointer;
    font-family: inherit;
}

.ms-calc button + button {
    margin-left: 16px;
}

.ms-calc button:hover {
    filter: brightness(1.05);
}

.ms-calc button.ms-btn-blue {
    background: #0b53b3;
    padding: 5px 16px;
    font-size: 14px;
    width: auto;
}

.ms-calc select {
    margin-top: 10px;
    width: 100%;
    padding: 10px;
    font: inherit;
    background: #fff;
    border: 1px solid #cecece;
    outline: none;
}

.ms-calc .ms-custom-radio,
.ms-calc .ms-custom-checkbox {
    display: block;
    margin-bottom: 16px;
    font-size: 14px;
    cursor: pointer;
}

.ms-calc .ms-custom-radio input,
.ms-calc .ms-custom-checkbox input {
    position: absolute;
    opacity: 0;
    pointer-events: none;
}

.ms-calc .ms-control {
    display: inline-block;
    vertical-align: text-bottom;
    margin-bottom: 2px;
    width: 16px;
    height: 16px;
    background: #fff;
    border: 2px solid #999;
}

.ms-calc .ms-custom-radio .ms-control {
    border-radius: 8px;
}

.ms-calc .ms-custom-radio input:checked ~ .ms-control:before,
.ms-calc .ms-custom-checkbox input:checked ~ .ms-control:before {
    content: "";
    display: block;
    margin: 3px;
    width: 6px;
    height: 6px;
    background: #999;
}

.ms-calc .ms-custom-radio input:checked ~ .ms-control:before {
    border-radius: 3px;
}

.ms-calc .ms-control-text {
    margin-left: 12px;
}

.ms-calc .ms-control-hint {
    display: block;
    margin-left: 32px;
    margin-top: 8px;
    margin-bottom: 8px;
    color: #a7a7a7;
}

.ms-calc .ms-tooltip {
    position: relative;
    display: inline-block;
    margin-left: 16px;
    margin-top: 2px;
    text-transform: none;
    font-size: 14px;
    font-family: Play, sans-serif;
    vertical-align: middle;
}

.ms-calc .ms-tooltip-info {
    display: block;
    width: 16px;
    height: 16px;
    line-height: 16px;
    font-size: 10px;
    font-weight: 700;
    text-align: center;
    color: #fff;
    background: #0b53b3;
    cursor: default;
}

.ms-calc .ms-tooltip-balloon {
    visibility: hidden;
    position: absolute;
    z-index: 100;
    left: 50%;
    bottom: 32px;
    padding: 16px;
    width: 260px;
    line-height: 1.15;
    font-size: 14px;
    font-weight: 400;
    text-align: center;
    color: #fff;
    background: #0b53b3;
    transform: translateX(-50%);
}

.ms-calc .ms-tooltip-balloon:after {
    content: "";
    position: absolute;
    left: 50%;
    bottom: -8px;
    margin-left: -8px;
    width: 16px;
    height: 16px;
    background: #0b53b3;
    transform: rotate(45deg);
}

.ms-calc .ms-tooltip:hover .ms-tooltip-balloon {
    visibility: visible;
}

/* Row */
.ms-row {
    margin-bottom: 40px;
}

.ms-row-head {
    display: flex;
    align-items: center;
    padding: 0 13px 0 24px;
    height: 50px;
    background: #f6f6f6;
    margin-bottom: 23px;
    flex-wrap: wrap;
    gap: 8px;
}

.ms-row-title {
    font-family: Play, sans-serif;
    font-size: 14px;
    font-weight: 500;
    text-transform: uppercase;
    line-height: 24px;
    color: #0b53b3;
}

.ms-row-capacity {
    display: flex;
    align-items: center;
    margin-left: 25px;
    padding-left: 27px;
    height: 100%;
    font-size: 14px;
    border-left: 1px solid #ddd;
}

.ms-row-capacity-title {
    margin-right: 13px;
    font-weight: 700;
    text-transform: uppercase;
}

.ms-row-capacity-values {
    margin-right: 27px;
    line-height: 1.25;
}

.ms-row-copy {
    display: flex;
    align-items: center;
    margin-left: auto;
    font-size: 14px;
}

.ms-row-copy input {
    margin: 0 16px;
    padding: 4px 0;
    width: 48px;
    font-size: 16px;
    text-align: center;
    background: #fff;
    border: 1px solid #cecece;
    outline: none;
}

.ms-row-remove {
    display: inline-block;
    margin-left: 31px;
    width: 24px;
    height: 24px;
    background: #0b53b3;
    mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath fill='black' d='M18.3 5.71 12 12l6.3 6.29-1.41 1.42L10.59 13.4 4.3 19.71 2.89 18.3 9.17 12 2.89 5.71 4.3 4.29l6.29 6.3 6.3-6.3z'/%3E%3C/svg%3E") center/16px no-repeat;
    -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath fill='black' d='M18.3 5.71 12 12l6.3 6.29-1.41 1.42L10.59 13.4 4.3 19.71 2.89 18.3 9.17 12 2.89 5.71 4.3 4.29l6.29 6.3 6.3-6.3z'/%3E%3C/svg%3E") center/16px no-repeat;
    border: none;
    padding: 0;
    cursor: pointer;
}

.ms-row-main {
    display: flex;
    flex-grow: 1;
    align-items: stretch;
}

.ms-row-form,
.ms-row-detail {
    padding: 32px;
    width: 264px;
    min-width: 264px;
    background: #f6f6f6;
    margin-right: 30px;
    font-size: 14px;
}

.ms-row-form-title,
.ms-row-detail-title {
    font-family: Play, sans-serif;
    font-weight: 500;
    font-size: 16px;
    text-transform: uppercase;
    color: #a7a7a7;
}

.ms-row-legend {
    margin-top: 32px;
    font-size: 14px;
    font-weight: 700;
    text-transform: uppercase;
}

.ms-row-field {
    margin: 22px 0 30px;
}

.ms-row-detail-params {
    margin: 16px 0;
    padding: 0;
    list-style: none;
    font-size: 14px;
    font-weight: 700;
}

.ms-row-detail-params li {
    margin: 8px 0;
}

.ms-row-detail-params_gray {
    color: #a7a7a7;
}

.ms-row-detail-divider {
    margin: 24px 0;
    border-top: 1px solid #ddd;
}

.ms-row-price-label {
    font-weight: 700;
    font-size: 18px;
    text-transform: uppercase;
}

.ms-row-price {
    margin-bottom: 16px;
    font-weight: 700;
    font-size: 30px;
}

.ms-row-calc-link {
    display: inline-block;
    padding: 8px 36px 8px 16px;
    color: #fff;
    text-decoration: none;
    background: #0b53b3;
}

.ms-row-hint {
    margin-top: 16px;
    color: #a7a7a7;
    font-size: 13px;
}

.ms-row-body {
    display: flex;
    flex-grow: 1;
    min-width: 0;
}

.ms-sections {
    position: relative;
    display: flex;
    flex-direction: column;
    margin-right: 23px;
    flex: 1;
    min-width: 0;
}

.ms-sections-ruler {
    margin-bottom: 16px;
    height: 24px;
    border-left: 1px solid #333;
    border-right: 1px solid #333;
}

.ms-sections-ruler-value {
    position: relative;
    bottom: 4px;
    line-height: 16px;
    font-size: 14px;
    font-weight: 500;
    text-align: center;
    border-bottom: 1px solid #333;
}

.ms-sections-area {
    overflow: auto hidden;
    position: relative;
    max-width: none;
    width: 100%;
    flex: 1;
}

.ms-sections-list {
    display: flex;
    min-height: 420px;
    border-left: 1px solid #ddd;
}

.ms-section {
    display: flex;
    flex-direction: column;
    flex-shrink: 0;
    padding: 0 16px;
    border-right: 1px solid #ddd;
    width: 192px;
    position: relative;
}

.ms-section-head {
    margin-bottom: 24px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    position: relative;
    z-index: 2;
}

.ms-section-number {
    margin-right: 8px;
    width: 34px;
    height: 34px;
    line-height: 34px;
    text-align: center;
    font-size: 18px;
    color: #0a53b3;
    background: #f6f6f6;
    font-family: Play, sans-serif;
    font-weight: 500;
    flex-shrink: 0;
}

.ms-section-actions {
    display: flex;
    align-items: center;
    gap: 4px;
    margin-left: auto;
}

/* Higher specificity: beat `.ms-calc button` padding/color/background */
.ms-calc button.ms-section-action {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    min-width: 32px;
    margin: 0;
    padding: 0;
    border: none;
    border-radius: 8px;
    background: #E4E8ED;
    color: #2f363e;
    box-shadow: none;
    font-weight: 400;
    line-height: 1;
    transition: color .15s ease, background-color .15s ease;
}

.ms-calc button.ms-section-action + button.ms-section-action {
    margin-left: 0;
}

.ms-calc button.ms-section-action svg {
    display: block;
    width: 16px;
    height: 16px;
    flex-shrink: 0;
}

.ms-calc button.ms-section-action:hover {
    color: #0084C2;
    background: #E3F2FA;
    transform: none;
    box-shadow: none;
    filter: none;
}

.ms-calc button.ms-section-action.is-danger:hover {
    color: #C0392B;
    background: #FDF0EF;
}

.ms-section.is-applied {
    padding-bottom: 16px;
}

.ms-section-preview {
    display: flex;
    align-items: flex-end;
    justify-content: center;
    flex: 1;
    min-height: 360px;
    margin: 0 0 18px;
    padding: 8px 0 0;
}

.ms-section-svg--applied {
    position: static !important;
    left: auto;
    top: auto;
    display: block;
    max-width: 100%;
    margin: 0 auto;
    opacity: 1;
    z-index: 1;
    /* height is set inline from row.height so all sections in a row match */
}

.ms-section-params--applied {
    margin-top: auto;
}

.ms-section.is-applied .ms-section-params--applied {
    color: #8a9099;
}

.ms-section-params {
    margin: 0;
    padding: 0;
    list-style: none;
    font-size: 14px;
    color: #a7a7a7;
}

.ms-section-params li {
    margin-bottom: 8px;
}

.ms-section-field {
    margin: 22px 0 30px;
}

.ms-section-submit {
    padding: 16px;
    width: 146px;
    max-width: 100%;
}

.ms-section-svg {
    position: absolute;
    left: 1px;
    top: 60px;
    pointer-events: none;
    opacity: 0.95;
    z-index: 0;
}

.ms-section-form {
    position: relative;
    z-index: 1;
    background: rgba(255, 255, 255, 0.92);
    flex-grow: 1;
}

.ms-new-section {
    display: flex;
    flex-direction: column;
    justify-content: center;
    padding: 16px 24px 32px;
    width: 98px;
    background: #f6f6f6;
    cursor: pointer;
    border: none;
    flex-shrink: 0;
}

.ms-new-section-icon {
    display: inline-block;
    margin: 0 auto 15px;
    width: 50px;
    height: 50px;
    border-radius: 2px;
    background: #f58214;
    position: relative;
}

.ms-new-section-icon:before,
.ms-new-section-icon:after {
    content: "";
    position: absolute;
    background: #fff;
    left: 50%;
    top: 50%;
    transform: translate(-50%, -50%);
}

.ms-new-section-icon:before {
    width: 22px;
    height: 3px;
}

.ms-new-section-icon:after {
    width: 3px;
    height: 22px;
}

.ms-add-row {
    padding: 13px 24px;
    background: #f6f6f6;
    margin-bottom: 40px;
}

.ms-add-row-btn {
    font-family: Play, sans-serif;
    font-size: 14px;
    font-weight: 500;
    text-decoration: none;
    text-transform: uppercase;
    line-height: 24px;
    color: #0b53b3;
    background: none;
    border: none;
    padding: 0;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.ms-add-row-icon {
    width: 24px;
    height: 24px;
    background: #f58214;
    position: relative;
    display: inline-block;
}

.ms-add-row-icon:before,
.ms-add-row-icon:after {
    content: "";
    position: absolute;
    background: #fff;
    left: 50%;
    top: 50%;
    transform: translate(-50%, -50%);
}

.ms-add-row-icon:before {
    width: 12px;
    height: 2px;
}

.ms-add-row-icon:after {
    width: 2px;
    height: 12px;
}

/* BOM table */
.ms-bom {
    display: flex;
    flex-wrap: wrap;
    gap: 30px;
    margin-top: 20px;
}

.ms-bom-table-wrap {
    flex: 1;
    min-width: 320px;
    overflow-x: auto;
}

.ms-bom-table {
    width: 100%;
    min-width: 558px;
    font-size: 14px;
    border-collapse: collapse;
    table-layout: fixed;
}

.ms-bom-table th {
    padding: 14px;
    white-space: nowrap;
    text-align: left;
    font-weight: 400;
    background: #f6f6f6;
}

.ms-bom-table td {
    padding: 8px 14px;
}

.ms-bom-table tr:nth-child(odd) td {
    background: #f6f6f6;
}

.ms-bom-num {
    margin: 16px 14px 13px;
    font-weight: 700;
    text-transform: uppercase;
    color: #a7a7a7;
}

.ms-bom-summary {
    margin: 16px 0 40px;
    padding: 16px 14px;
    background: #f6f6f6;
}

.ms-bom-summary-price {
    float: right;
}

.ms-bom-side {
    width: 320px;
}

.ms-lead-form {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.ms-lead-field {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.ms-lead-field label {
    font-size: 12px;
    font-weight: 600;
    letter-spacing: 0.02em;
    color: #5F6368;
}

.ms-lead-field input {
    width: 100%;
    height: 44px;
    padding: 0 14px;
    border: 1px solid #E2E4E8;
    border-radius: 10px;
    background: #FFFFFF;
    color: #111111;
    font: inherit;
    font-size: 14px;
    outline: none;
    transition: border-color .2s ease, box-shadow .2s ease;
}

.ms-lead-field input::placeholder {
    color: #A0A5AD;
}

.ms-lead-field input:hover,
.ms-lead-field input:focus {
    border-color: rgba(0, 132, 194, 0.55);
    box-shadow: 0 0 0 3px rgba(0, 132, 194, 0.08);
}

.ms-lead-consent {
    display: grid;
    grid-template-columns: 18px minmax(0, 1fr);
    gap: 10px;
    align-items: start;
    margin: 2px 0 2px;
    cursor: pointer;
    color: #5F6368;
    font-size: 12px;
    line-height: 1.35;
}

.ms-lead-consent input {
    width: 18px;
    height: 18px;
    margin: 1px 0 0;
    accent-color: #0084C2;
    cursor: pointer;
}

.ms-lead-consent a {
    color: #0084C2;
    text-decoration: underline;
    text-underline-offset: 2px;
}

.ms-lead-message {
    padding: 10px 12px;
    border-radius: 10px;
    font-size: 13px;
    line-height: 1.35;
}

.ms-lead-message.is-success {
    color: #1B7A3D;
    background: #ECF8F0;
}

.ms-lead-message.is-error {
    color: #B42318;
    background: #FEF3F2;
}

.ms-lead-submit {
    width: 100%;
    min-height: 48px;
    margin: 0 !important;
    padding: 0 16px !important;
    border-radius: 12px !important;
    border: 1px solid #0084C2 !important;
    background: #0084C2 !important;
    color: #FFFFFF !important;
    font-size: 14px !important;
    font-weight: 700 !important;
    box-shadow: 0 10px 24px rgba(0, 132, 194, 0.18);
}

.ms-bom-price-label {
    font-weight: 700;
    font-size: 18px;
    text-transform: uppercase;
}

.ms-bom-price {
    margin-bottom: 24px;
    font-weight: 700;
    font-size: 30px;
}

.ms-bom-actions {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.ms-bom-actions button {
    padding: 10px 14px;
    font-size: 13px;
    background: #0b53b3;
}

/* Modal */
.ms-modal {
    position: fixed;
    z-index: 1100;
    inset: 0;
    overflow: auto;
    display: none;
    background: rgba(0, 0, 0, 0.8);
}

.ms-modal.is-open {
    display: flex;
}

.ms-modal-dialog {
    position: relative;
    margin: auto;
    padding: 48px 56px;
    background: #fff;
    border-bottom: 3px solid #f58214;
    max-width: 720px;
    width: calc(100% - 32px);
}

.ms-modal-close {
    position: absolute;
    right: 0;
    top: 0;
    width: 42px;
    height: 42px;
    border: none;
    background: transparent;
    cursor: pointer;
    font-size: 28px;
    line-height: 42px;
    color: #999;
}

.ms-modal-title {
    margin-bottom: 31px;
    font-size: 28px;
    font-family: Play, sans-serif;
    text-align: center;
    text-transform: uppercase;
    color: #0b53b3;
}

.ms-capacity-box {
    display: flex;
    margin-bottom: 32px;
    padding-bottom: 32px;
    border-bottom: 1px solid #ddd;
    font-size: 14px;
}

.ms-capacity-box-label {
    margin-right: 17px;
    font-weight: 700;
    text-transform: uppercase;
}

.ms-modal .ms-control-list {
    margin-bottom: 16px;
}

/* Premium visual refresh — structure and element positions stay unchanged */
#calculator.ms-calc-section {
    padding: 88px 0 104px;
    background: #ffffff;
}

#calculator.ms-calc-section .section-head {
    margin-bottom: 32px;
}

#calculator.ms-calc-section .section-title {
    margin: 0;
    font-family: Play, sans-serif;
    font-size: 34px;
    font-weight: 800;
    line-height: 1.1;
    letter-spacing: -1.1px;
    text-transform: none;
    color: #111111;
}

.ms-calc {
    font-family: Play, sans-serif;
    color: #27292d;
    max-width: none;
    width: 100%;
}

.ms-calc button {
    border-radius: 12px;
    background: #0084C2;
    border-color: #0084C2;
    font-weight: 700;
    box-shadow: 0 8px 20px rgba(0, 132, 194, 0.16);
    transition: transform .2s ease, box-shadow .2s ease, background-color .2s ease;
}

.ms-calc button:hover {
    filter: none;
    background: #0070A8;
    transform: translateY(-1px);
    box-shadow: 0 12px 26px rgba(0, 132, 194, 0.22);
}

.ms-calc button:focus-visible,
.ms-calc select:focus-visible,
.ms-calc input:focus-visible {
    outline: 3px solid rgba(0, 132, 194, 0.16);
    outline-offset: 2px;
}

.ms-calc button.ms-btn-blue {
    padding: 8px 17px;
    border-radius: 10px;
    background: #0084C2;
    border-color: #0084C2;
    font-size: 13px;
}

.ms-calc select {
    min-height: 44px;
    padding: 0 38px 0 13px;
    border: 1px solid #E2E4E8;
    border-radius: 10px;
    color: #27292d;
    background-color: #fff;
    transition: border-color .2s ease, box-shadow .2s ease;
}

.ms-calc select:hover,
.ms-calc select:focus {
    border-color: rgba(0, 132, 194, 0.55);
    box-shadow: 0 0 0 3px rgba(0, 132, 194, 0.08);
}

.ms-calc .ms-control {
    width: 18px;
    height: 18px;
    border-color: #B8BDC6;
    border-radius: 5px;
    transition: border-color .2s ease, background-color .2s ease;
}

.ms-calc .ms-custom-radio .ms-control {
    border-radius: 50%;
}

.ms-calc .ms-custom-radio input:checked ~ .ms-control,
.ms-calc .ms-custom-checkbox input:checked ~ .ms-control {
    border-color: #0084C2;
}

.ms-calc .ms-custom-radio input:checked ~ .ms-control:before,
.ms-calc .ms-custom-checkbox input:checked ~ .ms-control:before {
    margin: 3px;
    width: 8px;
    height: 8px;
    background: #0084C2;
}

.ms-calc .ms-tooltip {
    margin-left: 10px;
}

.ms-calc .ms-tooltip-info {
    border-radius: 50%;
    background: #0084C2;
}

.ms-calc .ms-tooltip-balloon,
.ms-calc .ms-tooltip-balloon:after {
    background: #27292d;
}

.ms-row {
    margin-bottom: 40px;
}

.ms-row-head {
    height: 62px;
    padding: 0 18px 0 24px;
    margin-bottom: 22px;
    border: 1px solid #ECEEF1;
    border-radius: 16px;
    background: #FFFFFF;
    box-shadow: 0 10px 30px rgba(17, 17, 17, 0.05);
}

.ms-row-title {
    font-family: Play, sans-serif;
    font-size: 14px;
    font-weight: 800;
    letter-spacing: .02em;
    color: #0084C2;
}

.ms-row-capacity {
    border-left-color: #ECEEF1;
    color: #5F6368;
}

.ms-row-capacity-title {
    color: #27292d;
}

.ms-row-copy {
    color: #5F6368;
}

.ms-row-copy input {
    height: 38px;
    padding: 0;
    border: 1px solid #E2E4E8;
    border-radius: 9px;
    color: #111111;
}

.ms-row-remove {
    margin-left: 24px;
    border-radius: 50%;
    background-color: #B6BAC1;
    transition: background-color .2s ease, transform .2s ease;
}

.ms-row-remove:hover {
    background-color: #0084C2;
    transform: rotate(90deg);
}

.ms-row-form,
.ms-row-detail {
    padding: 32px;
    border: 1px solid #ECEEF1;
    border-radius: 18px;
    background: #FFFFFF;
    box-shadow: 0 14px 38px rgba(17, 17, 17, 0.055);
}

.ms-row-form-title,
.ms-row-detail-title {
    font-family: Play, sans-serif;
    font-size: 13px;
    font-weight: 700;
    letter-spacing: .08em;
    color: #9A9FA8;
}

.ms-row-legend {
    color: #27292d;
}

.ms-row-detail-divider {
    border-top-color: #ECEEF1;
}

.ms-row-price,
.ms-bom-price {
    letter-spacing: -1px;
    color: #111111;
}

.ms-row-calc-link {
    border-radius: 10px;
    background: #0084C2;
}

.ms-sections {
    border-radius: 18px;
    background: linear-gradient(180deg, rgba(248, 249, 251, .75), rgba(255, 255, 255, 0));
}

.ms-sections-ruler,
.ms-sections-ruler-value {
    border-color: #C9CDD3;
}

.ms-sections-list,
.ms-section {
    border-color: #E5E7EA;
}

.ms-section-number {
    border-radius: 9px;
    color: #0084C2;
    background: #F8F9FB;
}

.ms-section-form {
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.94);
}

.ms-new-section {
    border: 1px solid #ECEEF1;
    border-radius: 16px;
    background: #F8F9FB;
    transition: background-color .2s ease, transform .2s ease;
}

.ms-new-section:hover {
    background: #FFFFFF;
    transform: translateY(-2px);
}

.ms-new-section-icon {
    border-radius: 14px;
    background: #0084C2;
    box-shadow: 0 10px 24px rgba(0, 132, 194, .2);
}

.ms-add-row {
    padding: 13px 16px;
    border: 1px solid #ECEEF1;
    border-radius: 16px;
    background: #FFFFFF;
    box-shadow: 0 10px 30px rgba(17, 17, 17, 0.04);
}

.ms-add-row-btn {
    min-height: 44px;
    padding: 0 18px !important;
    border-radius: 11px !important;
    font-family: Play, sans-serif;
    font-size: 13px;
    font-weight: 800;
    letter-spacing: .02em;
    color: #FFFFFF;
    background: #0084C2 !important;
}

.ms-add-row-icon {
    width: 20px;
    height: 20px;
    border-radius: 6px;
    background: rgba(255, 255, 255, .18);
}

.ms-bom {
    align-items: flex-start;
}

.ms-bom-table-wrap {
    padding: 10px;
    border: 1px solid #ECEEF1;
    border-radius: 18px;
    background: #FFFFFF;
    box-shadow: 0 14px 38px rgba(17, 17, 17, 0.05);
}

.ms-bom-table {
    color: #4A4D52;
}

.ms-bom-table th {
    padding: 15px 14px;
    border-radius: 8px;
    font-weight: 600;
    color: #5F6368;
    background: #F8F9FB;
}

.ms-bom-table td {
    padding: 11px 14px;
    border-bottom: 1px solid #F0F1F3;
}

.ms-bom-table tr:nth-child(odd) td {
    background: #FCFCFD;
}

.ms-bom-summary {
    margin: 10px 0 0;
    padding: 16px 14px;
    border-radius: 10px;
    color: #5F6368;
    background: #F8F9FB;
}

.ms-bom-summary-price {
    color: #111111;
}

.ms-bom-side {
    width: 340px;
    padding: 24px;
    border: 1px solid #ECEEF1;
    border-radius: 18px;
    background: #FFFFFF;
    box-shadow: 0 14px 38px rgba(17, 17, 17, 0.05);
}

.ms-bom-side .ms-bom-price {
    margin-bottom: 18px;
}

.ms-bom-price-label {
    font-size: 14px;
    letter-spacing: .08em;
    color: #8C919A;
}

.ms-bom-price {
    margin-top: 5px;
    margin-bottom: 22px;
    font-size: 32px;
}

.ms-bom-actions button {
    min-height: 44px;
    padding: 0 18px;
    background: #0084C2;
}

.ms-modal {
    background: rgba(17, 17, 17, 0.42);
    backdrop-filter: blur(10px);
}

.ms-modal-dialog {
    width: min(860px, calc(100% - 40px));
    max-width: 860px;
    padding: 46px 50px 42px;
    border: 1px solid rgba(255, 255, 255, .8);
    border-bottom: none;
    border-radius: 22px;
    box-shadow: 0 30px 90px rgba(17, 17, 17, .2);
}

.ms-modal-close {
    top: 14px;
    right: 14px;
    width: 38px;
    height: 38px;
    border-radius: 50%;
    color: #8C919A;
    background: #F4F5F7;
    font-size: 24px;
    line-height: 36px;
    transition: color .2s ease, background-color .2s ease, transform .2s ease;
}

.ms-modal-close:hover {
    color: #0084C2;
    background: #FDEDEC;
    transform: rotate(90deg);
}

.ms-modal-title {
    margin: 0 0 28px;
    font-family: Play, sans-serif;
    font-size: 30px;
    font-weight: 800;
    line-height: 1.15;
    letter-spacing: -0.6px;
    text-align: left;
    text-transform: none;
    color: #111111;
}

.ms-capacity-box {
    align-items: flex-start;
    margin: 0 0 28px;
    padding: 18px 20px;
    border: 1px solid #ECEEF1;
    border-radius: 14px;
    background: #F8F9FB;
    color: #5F6368;
}

.ms-capacity-box-label {
    min-width: 96px;
    color: #111111;
}

.ms-modal-dialog > p {
    margin: 0 0 14px;
    color: #27292D;
    font-size: 15px;
    line-height: 1.45;
}

.ms-modal .ms-control-list {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 10px;
    margin: 0 0 24px;
}

.ms-modal #ms-fasteners-list {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    margin-top: 4px;
    padding-top: 22px;
    border-top: 1px solid #ECEEF1;
}

.ms-modal #ms-fasteners-list::before {
    content: "Тип крепежа";
    grid-column: 1 / -1;
    margin-bottom: 2px;
    color: #27292D;
    font-size: 14px;
    font-weight: 800;
}

.ms-modal .ms-custom-checkbox,
.ms-modal .ms-custom-radio {
    display: grid;
    grid-template-columns: 20px minmax(0, 1fr);
    align-items: start;
    gap: 11px;
    min-height: 72px;
    margin: 0;
    padding: 14px;
    border: 1px solid #E8EAED;
    border-radius: 13px;
    background: #FFFFFF;
    color: #33363B;
    transition: border-color .2s ease, background-color .2s ease, box-shadow .2s ease;
}

.ms-modal .ms-custom-checkbox:hover,
.ms-modal .ms-custom-radio:hover {
    border-color: rgba(0, 132, 194, .42);
    background: #FFFDFD;
    box-shadow: 0 8px 22px rgba(17, 17, 17, .045);
}

.ms-modal .ms-custom-checkbox:has(input:checked),
.ms-modal .ms-custom-radio:has(input:checked) {
    border-color: rgba(0, 132, 194, .62);
    background: #FFF8F8;
    box-shadow: 0 0 0 3px rgba(0, 132, 194, .07);
}

.ms-modal .ms-control {
    grid-column: 1;
    margin: 1px 0 0;
}

.ms-modal .ms-control-text {
    grid-column: 2;
    margin: 0;
    font-size: 13px;
    font-weight: 650;
    line-height: 1.35;
}

.ms-modal .ms-control-hint {
    margin: 5px 0 0;
    color: #8A8F98;
    font-size: 11px;
    font-weight: 400;
    line-height: 1.4;
}

.ms-modal-actions {
    display: flex;
    align-items: center;
    gap: 12px;
    padding-top: 4px;
}

.ms-modal-actions button {
    min-width: 140px;
    min-height: 48px;
    padding: 0 22px;
    border-radius: 12px;
    border: 1px solid #0084C2;
    color: #FFFFFF;
    background: #0084C2;
    font-family: Play, sans-serif;
    font-size: 14px;
    font-weight: 750;
    cursor: pointer;
    box-shadow: 0 10px 24px rgba(0, 132, 194, .18);
    transition: transform .2s ease, box-shadow .2s ease, background-color .2s ease;
}

.ms-modal-actions button:hover {
    transform: translateY(-1px);
    box-shadow: 0 13px 28px rgba(0, 132, 194, .23);
}

.ms-modal-actions .ms-btn-outline {
    color: #0084C2;
    background: #FFFFFF;
    box-shadow: none;
}

.ms-modal-actions .ms-btn-outline:hover {
    background: #FFF6F5;
    box-shadow: none;
}

@media (max-width: 960px) {
    .ms-row-main,
    .ms-row-body {
        flex-direction: column;
    }

    .ms-row-form,
    .ms-row-detail {
        width: 100%;
        min-width: 0;
        margin-right: 0;
        margin-bottom: 16px;
    }

    .ms-row-capacity {
        border-left: none;
        padding-left: 0;
        margin-left: 0;
    }

    .ms-row-copy {
        margin-left: 0;
        width: 100%;
    }

    .ms-bom-side {
        width: 100%;
    }
}

/* Phone / narrow tablet: full vertical stack, no overflow traps */
@media (max-width: 760px) {
    #calculator.ms-calc-section,
    .cat-ms-calc #calculator.ms-calc-section {
        padding: 24px 0 32px;
        max-width: 100%;
        overflow-x: clip;
        overflow-y: visible;
        touch-action: pan-y;
    }

    #calculator.ms-calc-section .container,
    .cat-ms-calc #calculator.ms-calc-section .container {
        padding-left: 16px;
        padding-right: 16px;
    }

    #calculator.ms-calc-section .section-title {
        font-size: clamp(22px, 6vw, 28px);
        letter-spacing: -0.4px;
    }

    .ms-calc {
        max-width: 100%;
        overflow: visible;
        touch-action: pan-y;
    }

    .ms-calc button + button {
        margin-left: 0;
    }

    .ms-row {
        margin-bottom: 28px;
    }

    .ms-row-head {
        height: auto;
        min-height: 0;
        padding: 14px 16px;
        flex-direction: column;
        align-items: stretch;
        gap: 12px;
    }

    .ms-row-capacity {
        flex-wrap: wrap;
        gap: 8px 12px;
        width: 100%;
    }

    .ms-row-capacity .ms-btn-blue {
        margin-left: auto;
    }

    .ms-row-copy {
        display: flex;
        flex-wrap: wrap;
        align-items: center;
        gap: 10px;
    }

    .ms-row-copy input {
        width: 56px;
        min-height: 44px;
        font-size: 16px;
    }

    .ms-calc button.ms-btn-blue {
        min-height: 44px;
        padding: 10px 16px;
    }

    .ms-row-remove {
        width: 44px;
        height: 44px;
        margin-left: auto;
        flex-shrink: 0;
    }

    .ms-row-main,
    .ms-row-body,
    .ms-sections,
    .ms-sections-area,
    .ms-row-form,
    .ms-row-detail {
        overflow: visible;
        overscroll-behavior: auto;
        -webkit-overflow-scrolling: auto;
        touch-action: pan-y;
    }

    .ms-row-form,
    .ms-row-detail {
        padding: 20px 16px;
    }

    .ms-calc button[data-action="create-row"],
    .ms-section-submit {
        width: 100%;
        min-height: 48px;
    }

    .ms-sections {
        margin-right: 0;
        width: 100%;
    }

    /* Horizontal section strip scrolls inside its own box — page scroll stays free */
    .ms-sections-area {
        overflow-x: auto;
        overflow-y: visible;
        -webkit-overflow-scrolling: touch;
        touch-action: pan-x pan-y;
        max-width: 100%;
    }

    .ms-sections-list {
        min-height: 0;
    }

    .ms-section {
        width: min(192px, 78vw) !important;
        max-width: 78vw;
    }

    .ms-section-preview {
        min-height: 220px;
    }

    /* Edit-mode SVG was absolute — overlapped form controls on narrow screens */
    .ms-section.is-edit {
        display: flex;
        flex-direction: column;
        gap: 8px;
        padding-bottom: 16px;
    }

    .ms-section.is-edit .ms-section-svg {
        position: static;
        left: auto;
        top: auto;
        display: block;
        max-width: 100%;
        height: auto !important;
        margin: 0 auto 4px;
        opacity: 1;
    }

    .ms-section-form {
        position: relative;
        z-index: 1;
        width: 100%;
    }

    .ms-calc button.ms-section-action {
        width: 44px;
        height: 44px;
        min-width: 44px;
    }

    .ms-new-section {
        width: 100%;
        max-width: none;
        margin-top: 12px;
        padding: 16px;
        flex-direction: row;
        align-items: center;
        justify-content: center;
        gap: 12px;
        min-height: 56px;
    }

    .ms-new-section-icon {
        margin: 0;
        width: 44px;
        height: 44px;
    }

    .ms-add-row {
        margin-bottom: 24px;
        padding: 12px 14px;
    }

    .ms-add-row-btn {
        width: 100%;
        justify-content: center;
        min-height: 48px;
    }

    .ms-bom {
        flex-direction: column;
        gap: 20px;
    }

    .ms-bom-table-wrap {
        min-width: 0;
        width: 100%;
        padding: 8px;
    }

    .ms-bom-table {
        min-width: 480px;
    }

    .ms-bom-side {
        width: 100%;
        padding: 20px 16px;
    }

    .ms-lead-field input {
        font-size: 16px;
    }

    .ms-lead-submit {
        width: 100%;
    }

    /* Keep catalog edge FABs from covering calculator controls */
    body.ms-calc-in-view .cat-mobile-fabs {
        opacity: 0;
        visibility: hidden;
        pointer-events: none;
    }

    .ms-modal-dialog {
        padding: 38px 22px 28px;
    }

    .ms-modal-title {
        padding-right: 36px;
        font-size: 24px;
    }

    .ms-modal .ms-control-list,
    .ms-modal #ms-fasteners-list {
        grid-template-columns: 1fr;
    }

    .ms-modal-actions {
        flex-direction: column;
    }

    .ms-modal-actions button {
        flex: 1;
        min-width: 0;
        width: 100%;
    }
}
