:root {
    --brand: #3850ff;
    --brand-dark: #0705ac;
    --ink: #1a1a1a;
    --muted: #555;
    --bg: #f3f4f7;
    --panel: #a9b9ff;
    --white: #fff;
    --line: #d7dbe8;
    --max: 1120px;
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
    margin: 0;
    font-family: "Segoe UI", Cantarell, Verdana, sans-serif;
    color: var(--ink);
    background: var(--bg);
    line-height: 1.5;
}

a { color: var(--brand-dark); text-decoration: none; }
a:hover { text-decoration: underline; }

img { max-width: 100%; height: auto; }

.container {
    width: min(100% - 2rem, var(--max));
    margin-inline: auto;
}

.site-header {
    background: var(--white);
    border-bottom: 1px solid var(--line);
}

.site-header__inner {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 1rem 1.5rem;
    padding: 0.75rem 0;
}

.brand {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    min-width: 0;
}

.brand img { display: block; }

.brand__title {
    font-size: 0.95rem;
    color: var(--ink);
    max-width: 16rem;
}

.header-phone {
    margin-left: auto;
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--brand-dark);
    white-space: nowrap;
}

.nav {
    background: linear-gradient(#f7f7f7, #e9e9e9);
    border-bottom: 1px solid var(--line);
    box-shadow: 0 2px 6px rgba(0,0,0,.08);
}

.nav__list {
    display: flex;
    flex-wrap: wrap;
    gap: 0.25rem 0.5rem;
    list-style: none;
    margin: 0;
    padding: 0.4rem 0;
}

.nav__list > li { position: relative; }

.nav__list > li > a {
    display: inline-block;
    padding: 0.55rem 0.85rem;
    color: var(--ink);
    font-weight: 600;
}

.nav__list > li > a:hover,
.nav__list > li > a.is-active {
    color: var(--brand);
    text-decoration: none;
}

.nav__list ul {
    display: none;
    position: absolute;
    left: 0;
    top: 100%;
    min-width: 220px;
    margin: 0;
    padding: 0.35rem 0;
    list-style: none;
    background: var(--white);
    border: 1px solid var(--line);
    box-shadow: 0 8px 20px rgba(0,0,0,.08);
    z-index: 20;
}

.nav__list > li:hover > ul { display: block; }

.nav__list ul a {
    display: block;
    padding: 0.45rem 0.85rem;
    color: var(--ink);
    font-size: 0.95rem;
}

.nav__list ul a:hover {
    background: #eef1ff;
    text-decoration: none;
}

.site-main {
    padding: 1.5rem 0 3rem;
}

.stats {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 0.75rem;
    margin-bottom: 1.5rem;
}

.stat {
    background: #9eb0ff;
    color: var(--white);
    text-align: center;
    padding: 1rem 0.75rem;
    min-height: 7.5rem;
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.stat__num {
    font-size: 2rem;
    font-weight: 800;
    line-height: 1.1;
}

.stat__label {
    margin-top: 0.35rem;
    font-size: 0.92rem;
}

.section-title {
    font-size: 1.5rem;
    margin: 0 0 1rem;
    color: var(--brand-dark);
}

.cards {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 1rem;
}

.card {
    background: var(--white);
    border: 1px solid var(--line);
    padding: 1rem;
    cursor: pointer;
    transition: box-shadow .2s ease, transform .2s ease;
}

.card:hover {
    box-shadow: 0 10px 24px rgba(56,80,255,.12);
    transform: translateY(-2px);
}

.card h3 {
    margin: 0 0 0.75rem;
    color: var(--brand-dark);
}

.card__body {
    display: grid;
    grid-template-columns: 1.4fr 1fr;
    gap: 0.75rem;
    align-items: start;
}

.card p, .card li { color: var(--muted); font-size: 0.95rem; }
.card ul { margin: 0; padding-left: 1.1rem; }

.about {
    margin-top: 2rem;
    display: grid;
    grid-template-columns: 1fr 1.2fr;
    gap: 1rem;
    background: var(--white);
    border: 1px solid var(--line);
    padding: 1rem;
}

.prose {
    background: var(--white);
    border: 1px solid var(--line);
    padding: 1.25rem;
}

.prose h1, .prose .text_h1, .prose .tx_h1 {
    margin-top: 0;
    color: var(--brand-dark);
    font-size: 1.6rem;
}

.prose h2, .prose .text_h2, .prose .tx_h2 {
    color: var(--brand);
    font-size: 1.2rem;
}

.prose .left_img { float: left; margin: 0 1rem 1rem 0; max-width: 45%; }
.prose .right_img { float: right; margin: 0 0 1rem 1rem; max-width: 45%; }
.prose::after { content: ""; display: block; clear: both; }

.site-footer {
    background: var(--panel);
    padding: 2rem 0;
    margin-top: 2rem;
}

.footer-grid {
    display: grid;
    grid-template-columns: 1fr 1.2fr 1.2fr 1.4fr;
    gap: 1rem;
}

.footer-grid h3 { margin-top: 0; }
.footer-grid ul { list-style: none; margin: 0; padding: 0; }
.footer-grid li { margin: 0.35rem 0; }

.btn {
    display: inline-block;
    border: 0;
    background: var(--brand);
    color: var(--white);
    padding: 0.7rem 1rem;
    border-radius: 6px;
    cursor: pointer;
    font-weight: 600;
}

.btn:hover { filter: brightness(1.05); text-decoration: none; color: var(--white); }

.modal {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,.45);
    z-index: 50;
    padding: 1rem;
}

.modal.is-open { display: grid; place-items: center; }

.modal__panel {
    width: min(100%, 480px);
    background: var(--white);
    border-radius: 10px;
    padding: 1.25rem;
}

.modal__close {
    float: right;
    border: 0;
    background: transparent;
    font-size: 1.5rem;
    cursor: pointer;
}

.form-group { margin-bottom: 0.85rem; }
.form-group label { display: block; margin-bottom: 0.25rem; font-weight: 600; }
.form-group input,
.form-group textarea {
    width: 100%;
    padding: 0.65rem 0.75rem;
    border: 1px solid var(--line);
    border-radius: 6px;
}

.status {
    display: none;
    padding: 0.65rem 0.75rem;
    border-radius: 6px;
    margin-bottom: 0.75rem;
}
.status.success { display: block; background: #d4edda; color: #155724; }
.status.error { display: block; background: #f8d7da; color: #721c24; }

.contacts-grid {
    display: grid;
    grid-template-columns: 1fr 1.4fr;
    gap: 1rem;
}

#map {
    width: 100%;
    min-height: 420px;
    background: #dde3ff;
}

.project-filters {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr)) auto;
    gap: 0.75rem;
    align-items: end;
    margin: 1rem 0 1.25rem;
    padding: 0.85rem;
    background: #f7f8fc;
    border: 1px solid var(--line);
}

.project-filters label {
    display: grid;
    gap: 0.3rem;
    font-size: 0.85rem;
    font-weight: 600;
}

.project-filters select {
    width: 100%;
    padding: 0.55rem 0.65rem;
    border: 1px solid var(--line);
    border-radius: 6px;
    font: inherit;
    font-weight: 400;
    background: var(--white);
}

.project-filters__actions {
    display: flex;
    gap: 0.65rem;
    align-items: center;
}

.project-filters__reset {
    font-size: 0.92rem;
    white-space: nowrap;
}

.project-empty {
    margin-top: 1rem;
    color: var(--muted);
}

.projects-map {
    width: 100%;
    height: 560px;
    margin: 1rem 0 1.5rem;
    border: 1px solid var(--line);
    background: #dde3ff;
}

.project-list {
    display: grid;
    gap: 0.75rem;
}

.project-item {
    border-top: 1px solid var(--line);
    padding-top: 0.75rem;
}

.project-item h3 {
    margin: 0 0 0.35rem;
    font-size: 1.05rem;
}

.project-item__meta {
    display: flex;
    flex-wrap: wrap;
    gap: 0.35rem 0.75rem;
    color: var(--muted);
    font-size: 0.9rem;
    margin: 0 0 0.35rem;
}

.calc-layout {
    display: grid;
    grid-template-columns: 280px 1fr;
    gap: 1rem;
    align-items: start;
}

.calc-preview {
    position: sticky;
    top: 1rem;
    background: #f7f8fc;
    border: 1px solid var(--line);
    padding: 0.75rem;
    text-align: center;
}

.calc-preview img {
    width: 100%;
    max-width: 280px;
    height: auto;
    object-fit: contain;
}

.calc-form fieldset {
    border: 1px solid var(--line);
    margin: 0 0 1rem;
    padding: 0.75rem;
}

.calc-form legend {
    padding: 0 0.35rem;
    font-weight: 700;
    color: var(--brand-dark);
}

.calc-row {
    display: grid;
    grid-template-columns: 1fr 5.5rem 7rem;
    gap: 0.5rem;
    align-items: center;
    margin-bottom: 0.45rem;
    font-size: 0.95rem;
}

.calc-row__check {
    display: flex;
    gap: 0.45rem;
    align-items: center;
}

.calc-row input[type="number"] {
    width: 100%;
    padding: 0.35rem 0.45rem;
    border: 1px solid var(--line);
    border-radius: 4px;
}

.calc-row__sum,
.calc-row__qty {
    text-align: right;
    font-variant-numeric: tabular-nums;
    color: var(--muted);
}

.calc-work-row.is-hidden,
.calc-works-empty.is-hidden {
    display: none;
}

.calc-works-empty {
    color: var(--muted);
    font-size: 0.92rem;
    margin-bottom: 0.5rem;
}

button.linkish {
    border: 0;
    padding: 0;
    background: transparent;
    color: var(--brand-dark);
    font: inherit;
    cursor: pointer;
    text-decoration: underline;
}

.calc-optional {
    display: inline-block;
    margin-left: 0.35rem;
    font-style: normal;
    font-size: 0.78rem;
    color: var(--brand);
    font-weight: 600;
}

.calc-hint {
    display: block;
    color: var(--muted);
    font-size: 0.8rem;
    font-weight: 400;
}

.calc-actions {
    display: grid;
    gap: 0.75rem;
    margin-top: 1rem;
}

.calc-customer {
    display: grid;
    gap: 0.35rem;
    font-weight: 600;
}

.calc-customer input {
    width: 100%;
    padding: 0.65rem 0.75rem;
    border: 1px solid var(--line);
    border-radius: 6px;
    font: inherit;
    font-weight: 400;
}

.calc-totals {
    display: grid;
    gap: 0.5rem;
    padding: 0.85rem;
    background: #eef1ff;
    border: 1px solid var(--line);
}

.calc-totals > div {
    display: flex;
    justify-content: space-between;
    gap: 1rem;
}

.calc-totals__full {
    font-size: 1.15rem;
    font-weight: 700;
    color: var(--brand-dark);
    border-top: 1px solid var(--line);
    padding-top: 0.5rem;
}

.calc-note {
    margin-top: 0.85rem;
    color: var(--muted);
    font-size: 0.92rem;
}

@media (max-width: 900px) {
    .stats { grid-template-columns: repeat(2, 1fr); }
    .cards, .about, .footer-grid, .contacts-grid, .card__body, .calc-layout, .project-filters {
        grid-template-columns: 1fr;
    }
    .projects-map { height: 420px; }
    .calc-preview { position: static; }
    .header-phone { margin-left: 0; font-size: 1.25rem; }
    .prose .left_img, .prose .right_img {
        float: none;
        display: block;
        margin: 0 0 1rem;
        max-width: 100%;
    }
}
