.roof-page {
    min-height: 70vh;
    padding: 32px 0 80px;
    color: #14231e;
    background: #f6f8f7;
}

.roof-shell {
    /* Соответствует центральной колонке col-xl-10 у «Ленточного фундамента». */
    max-width: 960px;
    margin: auto;
}

.roof-breadcrumbs {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    margin: 0 0 28px;
    color: #61706a;
    font-size: 0.9rem;
    line-height: 1.2;
    background: #edf4ef;
    border: 1px solid #d7e5dc;
    border-radius: 999px;
}

.roof-breadcrumbs a {
    color: #08724e;
    font-weight: 700;
    text-decoration: none;
}

.roof-breadcrumbs a:hover {
    color: #054d34;
    text-decoration: underline;
}

.roof-hero {
    max-width: 760px;
    margin-bottom: 36px;
}

.roof-eyebrow {
    margin: 0 0 8px;
    color: #08724e;
    font-size: 0.78rem;
    font-weight: 800;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.roof-hero h1 {
    margin: 0 0 14px;
    font-size: clamp(2rem, 5vw, 3.5rem);
    line-height: 1.06;
    letter-spacing: -0.045em;
}

.roof-hero p {
    margin: 0;
    color: #56675f;
    font-size: 1.1rem;
}

.roof-layout {
    display: grid;
    grid-template-columns: minmax(0, 1.15fr) minmax(320px, 0.85fr);
    gap: 24px;
    align-items: start;
}

.roof-card {
    padding: 28px;
    overflow: hidden;
    background: #fff;
    border: 1px solid #dce6e0;
    border-radius: 18px;
    box-shadow: 0 12px 32px rgb(16 40 32 / 7%);
}

.roof-form-section + .roof-form-section {
    padding-top: 28px;
    margin-top: 28px;
    border-top: 1px solid #dce6e0;
}

.roof-card h2 {
    margin: 0 0 20px;
    font-size: 1.25rem;
}

.roof-fields {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 16px;
}

.roof-field label {
    display: block;
    margin: 0 0 7px;
    color: #31423a;
    font-size: 0.9rem;
    font-weight: 700;
}

.roof-field input,
.roof-field select {
    width: 100%;
    min-height: 48px;
    padding: 10px 12px;
    color: #14231e;
    font: inherit;
    font-variant-numeric: tabular-nums;
    background: #fff;
    border: 1px solid #b8c9c0;
    border-radius: 10px;
    box-shadow: 0 1px 2px rgb(16 40 32 / 4%);
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.roof-field input:hover,
.roof-field select:hover {
    border-color: #7e9b8d;
}

.roof-field input:focus,
.roof-field select:focus {
    border-color: #14805c;
    outline: 0;
    box-shadow: 0 0 0 4px rgb(20 128 92 / 15%);
}

.roof-submit {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 54px;
    padding: 14px 22px;
    margin-top: 28px;
    color: #fff;
    font: inherit;
    font-size: 1rem;
    font-weight: 800;
    cursor: pointer;
    background: linear-gradient(135deg, #19a874, #08724e);
    border: 0;
    border-radius: 12px;
    box-shadow: 0 8px 18px rgb(8 114 78 / 25%);
    transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.roof-submit:hover,
.roof-submit:focus {
    color: #fff;
    box-shadow: 0 11px 24px rgb(8 114 78 / 31%);
    transform: translateY(-1px);
}

.roof-submit:active {
    transform: translateY(0);
}

.roof-result {
    position: sticky;
    top: 16px;
}

.roof-result dl {
    margin: 0;
}

.roof-result dl div {
    display: flex;
    justify-content: space-between;
    gap: 16px;
    padding: 12px 0;
    border-bottom: 1px solid #e5ebe7;
}

.roof-result dt {
    color: #61706a;
}

.roof-result dd {
    margin: 0;
    font-weight: 700;
    text-align: right;
}

.roof-total dt,
.roof-total dd {
    color: #08724e;
    font-weight: 800;
}

.roof-result > p {
    margin: 18px 0 0;
    color: #61706a;
    font-size: 0.85rem;
}

.roof-content {
    max-width: 820px;
    padding-top: 64px;
}

.roof-content-intro {
    max-width: 760px;
}

.roof-content h2 {
    margin: 0 0 16px;
    font-size: clamp(1.5rem, 3vw, 2rem);
}

.roof-content-intro > p:last-child {
    color: #52635b;
    font-size: 1.05rem;
}

.roof-benefits {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 16px;
    margin: 28px 0 48px;
}

.roof-benefits article {
    padding: 20px;
    background: #fff;
    border: 1px solid #dce6e0;
    border-radius: 14px;
}

.roof-benefits h3 {
    margin: 0 0 8px;
    font-size: 1rem;
}

.roof-benefits p {
    margin: 0;
    color: #61706a;
}

.roof-section,
.roof-faq {
    max-width: 820px;
    padding: 28px 0;
    border-top: 1px solid #dce6e0;
}

.roof-section ol {
    padding-left: 22px;
    margin: 0;
}

.roof-section li + li {
    margin-top: 10px;
}

.roof-warning {
    padding: 24px;
    margin: 10px 0 28px;
    background: #fff4d9;
    border: 1px solid #f1dcaa;
    border-radius: 14px;
}

.roof-warning h2,
.roof-warning p {
    margin-bottom: 0;
}

.roof-faq details {
    padding: 16px 0;
    border-top: 1px solid #dce6e0;
}

.roof-faq summary {
    font-weight: 700;
    cursor: pointer;
}

.roof-faq p {
    margin: 10px 0 0;
    color: #61706a;
}

.roof-diagrams {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 20px;
    margin: 0 0 28px;
}

.roof-diagram {
    padding: 14px;
    margin: 0;
    background: #fff;
    border: 1px solid #dce6e0;
    border-radius: 16px;
    box-shadow: 0 8px 22px rgb(16 40 32 / 5%);
}

.roof-diagram img {
    display: block;
    width: 100%;
    height: auto;
    background: #f8fbf9;
    border: 1px solid #e1e9e4;
    border-radius: 10px;
}

.roof-diagram figcaption {
    padding: 13px 4px 2px;
    color: #61706a;
    font-size: 0.88rem;
    line-height: 1.45;
}

.roof-live-drawing {
    padding: 28px;
    margin: 28px 0 0;
    background: linear-gradient(135deg, #f0f8f4, #fff 56%);
    border: 1px solid #cfe3d8;
    border-radius: 20px;
    box-shadow: 0 14px 32px rgb(16 40 32 / 7%);
}

.roof-live-drawing__heading {
    display: flex;
    align-items: end;
    justify-content: space-between;
    gap: 28px;
    margin-bottom: 20px;
}

.roof-live-drawing__heading h2 {
    margin: 0;
    font-size: clamp(1.45rem, 3vw, 2rem);
}

.roof-live-drawing__heading > p {
    max-width: 430px;
    margin: 0;
    color: #61706a;
    font-size: 0.94rem;
    line-height: 1.5;
}

.roof-live-drawing__figure {
    padding: 12px;
    margin: 0;
    background: #fff;
    border: 1px solid #dce6e0;
    border-radius: 16px;
}

.rafter-live-svg {
    display: block;
    width: 100%;
    height: auto;
    overflow: visible;
}

.rafter-live-svg__background {
    fill: #f7fbf8;
    stroke: #d8e8de;
    stroke-width: 2;
}

.rafter-live-svg__grid {
    fill: url(#rafterGrid);
    opacity: 0.9;
}

.rafter-live-svg__wall {
    fill: none;
    stroke: #5f756a;
    stroke-linecap: round;
    stroke-linejoin: round;
    stroke-width: 9;
}

.rafter-live-svg__roof-fill {
    fill: #d9efe2;
    opacity: 0.94;
}

.rafter-live-svg__roof-line {
    fill: none;
    stroke: #08724e;
    stroke-linecap: round;
    stroke-linejoin: round;
    stroke-width: 14;
}

.rafter-live-svg__ridge {
    stroke: #87a495;
    stroke-dasharray: 8 8;
    stroke-width: 4;
}

.rafter-live-svg__dimension {
    stroke: #14805c;
    stroke-width: 2.5;
}

.rafter-live-svg__extension {
    stroke: #8da79a;
    stroke-dasharray: 4 5;
    stroke-width: 2;
}

.rafter-live-svg__dimension-label,
.rafter-live-svg__angle-label,
.rafter-live-svg__rafter-label,
.rafter-live-svg__ridge-label {
    fill: #0a6848;
    font-family: system-ui, -apple-system, "Segoe UI", sans-serif;
    font-size: 19px;
    font-weight: 800;
    paint-order: stroke;
    stroke: #f7fbf8;
    stroke-linejoin: round;
    stroke-width: 9px;
}

.rafter-live-svg__angle-arc {
    fill: none;
    stroke: #efa734;
    stroke-width: 4;
}

.rafter-live-svg__angle-label {
    fill: #a96306;
}

.rafter-live-svg__rafter-label {
    fill: #084f38;
    font-size: 17px;
}

.rafter-live-svg__ridge-label {
    fill: #61706a;
    font-size: 16px;
}

.roof-live-drawing__figure figcaption {
    padding: 14px 4px 3px;
    color: #61706a;
    font-size: 0.88rem;
    line-height: 1.5;
}

.roof-live-drawing__actions {
    display: flex;
    gap: 14px;
    align-items: center;
    justify-content: space-between;
    padding: 16px 4px 0;
}

.roof-live-drawing__actions > span {
    max-width: 480px;
    color: #61706a;
    font-size: 0.84rem;
    line-height: 1.45;
}

.roof-drawing-download {
    display: inline-flex;
    flex: 0 0 auto;
    align-items: center;
    justify-content: center;
    min-height: 44px;
    padding: 10px 16px;
    color: #08724e;
    font: inherit;
    font-size: 0.88rem;
    font-weight: 800;
    cursor: pointer;
    background: #fff;
    border: 1px solid #9dc9b4;
    border-radius: 10px;
    transition: color .15s ease, background-color .15s ease, border-color .15s ease;
}

.roof-drawing-download:hover,
.roof-drawing-download:focus-visible {
    color: #fff;
    background: #08724e;
    border-color: #08724e;
    outline: 0;
}

.roof-live-drawing__metrics {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 12px;
    margin-top: 16px;
}

.roof-live-drawing__metrics div {
    padding: 14px 16px;
    background: #fff;
    border: 1px solid #dce6e0;
    border-radius: 12px;
}

.roof-live-drawing__metrics span,
.roof-live-drawing__metrics strong {
    display: block;
}

.roof-live-drawing__metrics span {
    margin-bottom: 5px;
    color: #61706a;
    font-size: 0.78rem;
    font-weight: 700;
}

.roof-live-drawing__metrics strong {
    color: #08724e;
    font-size: 1.05rem;
    font-variant-numeric: tabular-nums;
}

.roof-calculation-actions {
    padding: 28px;
    margin: 28px 0 0;
    background: #fff;
    border: 1px solid #dce6e0;
    border-radius: 20px;
    box-shadow: 0 12px 32px rgb(16 40 32 / 6%);
}

.roof-calculation-actions__heading {
    display: flex;
    gap: 28px;
    align-items: end;
    justify-content: space-between;
    margin-bottom: 22px;
}

.roof-calculation-actions__heading h2 {
    margin: 0;
    font-size: clamp(1.45rem, 3vw, 2rem);
}

.roof-calculation-actions__heading > p {
    max-width: 440px;
    margin: 0;
    color: #61706a;
    font-size: 0.94rem;
    line-height: 1.5;
}

.roof-calculation-actions__grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 14px;
}

.roof-action-button,
.roof-action-export {
    min-width: 0;
    min-height: 88px;
    padding: 16px;
    color: #14231e;
    font: inherit;
    text-align: left;
    background: #f8fbf9;
    border: 1px solid #d7e5dc;
    border-radius: 14px;
}

.roof-action-button {
    display: flex;
    gap: 13px;
    align-items: center;
    cursor: pointer;
    transition: border-color .15s ease, box-shadow .15s ease, transform .15s ease;
}

.roof-action-button:hover,
.roof-action-button:focus-visible {
    border-color: #80b69e;
    outline: 0;
    box-shadow: 0 8px 18px rgb(8 114 78 / 10%);
    transform: translateY(-1px);
}

.roof-action-button.is-saved {
    color: #075f42;
    background: #edf9f3;
    border-color: #52ad86;
}

.roof-action-button__icon {
    display: grid;
    flex: 0 0 auto;
    width: 38px;
    height: 38px;
    place-items: center;
    color: #08724e;
    font-size: 1.55rem;
    font-weight: 700;
    line-height: 1;
    background: #dff3e8;
    border-radius: 50%;
}

.roof-action-button > span:last-child,
.roof-action-button strong,
.roof-action-button small {
    display: block;
}

.roof-action-button strong {
    font-size: .94rem;
    line-height: 1.25;
}

.roof-action-button small {
    margin-top: 4px;
    color: #61706a;
    font-size: .76rem;
    line-height: 1.35;
}

.roof-action-export {
    display: grid;
    gap: 10px;
    cursor: default;
}

.roof-action-export__label {
    color: #31423a;
    font-size: .86rem;
    font-weight: 800;
}

.roof-action-export__controls {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 8px;
}

.roof-action-export select {
    width: 100%;
    min-width: 0;
    min-height: 38px;
    padding: 7px 9px;
    color: #14231e;
    font: inherit;
    font-size: .8rem;
    background: #fff;
    border: 1px solid #b8c9c0;
    border-radius: 8px;
}

.roof-action-export__button {
    min-height: 38px;
    padding: 7px 12px;
    color: #fff;
    font: inherit;
    font-size: .8rem;
    font-weight: 800;
    cursor: pointer;
    background: #08724e;
    border: 1px solid #08724e;
    border-radius: 8px;
}

.roof-action-export__button:hover,
.roof-action-export__button:focus-visible {
    background: #06563b;
    border-color: #06563b;
    outline: 0;
}

.roof-calculation-actions__notice {
    min-height: 1.5em;
    margin: 14px 0 0;
    color: #08724e;
    font-size: .86rem;
    font-weight: 700;
}

@media (max-width: 991px) {
    .roof-layout {
        grid-template-columns: 1fr;
    }

    .roof-result {
        position: static;
    }
}

@media (max-width: 767px) {
    .roof-page {
        padding: 24px 0 56px;
    }

    .roof-card {
        padding: 20px;
    }

    .roof-fields,
    .roof-benefits,
    .roof-diagrams {
        grid-template-columns: 1fr;
    }

    .roof-diagrams {
        gap: 14px;
    }

    .roof-diagram {
        padding: 10px;
    }

    .roof-live-drawing {
        padding: 20px;
    }

    .roof-live-drawing__heading {
        display: block;
        margin-bottom: 16px;
    }

    .roof-live-drawing__heading > p {
        margin-top: 12px;
    }

    .roof-live-drawing__figure {
        padding: 6px;
        overflow-x: auto;
    }

    .roof-live-drawing__actions {
        display: grid;
        justify-content: stretch;
    }

    .roof-drawing-download {
        width: 100%;
    }

    .roof-calculation-actions {
        padding: 20px;
    }

    .roof-calculation-actions__heading {
        display: block;
        margin-bottom: 18px;
    }

    .roof-calculation-actions__heading > p {
        margin-top: 12px;
    }

    .roof-calculation-actions__grid {
        grid-template-columns: 1fr;
    }

    .rafter-live-svg {
        min-width: 720px;
    }

    .roof-live-drawing__metrics {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .roof-submit {
        width: 100%;
    }

    .roof-content {
        padding-top: 44px;
    }
}

/* Защита от внешних стилей шаблона: схемы всегда две в ряд на десктопе. */
.roof-page .roof-diagrams {
    display: grid !important;
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
    gap: 20px;
}

.roof-page .roof-diagram {
    min-width: 0;
}

@media (max-width: 767px) {
    .roof-page .roof-diagrams {
        grid-template-columns: 1fr !important;
        gap: 14px;
    }
}
