.ads-landing {
    --ads-bg: #0f2538;
    --ads-panel: rgba(255, 255, 255, 0.9);
    --ads-text: #f5f7fa;
    --ads-text-dark: #13263a;
    --ads-muted: rgba(245, 247, 250, 0.84);
    --ads-accent: #c8a97f;
    --ads-border: rgba(19, 38, 58, 0.12);
    color: var(--ads-text);
    background: radial-gradient(circle at 10% 20%, rgba(200, 169, 127, 0.14), transparent 30%), #0a1a28;
}

.ads-hero {
    min-height: 92vh;
    position: relative;
    overflow: hidden;
    display: flex;
    align-items: flex-end;
    isolation: isolate;
}

.ads-hero::before {
    content: "";
    position: absolute;
    inset: 0;
    z-index: -2;
    background-image: var(--ads-hero-image);
    background-size: cover;
    background-position: center;
    transform: translateY(var(--ads-hero-shift, 0px)) scale(1.04);
}

.ads-hero::after {
    content: "";
    position: absolute;
    inset: 0;
    z-index: -1;
    background:
        linear-gradient(180deg, rgba(7, 18, 29, 0.2) 0%, rgba(7, 18, 29, 0.75) 68%, rgba(7, 18, 29, 0.95) 100%),
        radial-gradient(circle at 25% 20%, rgba(200, 169, 127, 0.4), transparent 44%);
}

.ads-container {
    width: min(1320px, calc(100% - 48px));
    margin: 0 auto;
}

.ads-hero__inner {
    padding: 120px 0 74px;
}

.ads-hero__head {
    max-width: 720px;
}

.ads-kicker {
    text-transform: uppercase;
    letter-spacing: 0.16em;
    font-size: 12px;
    margin: 0 0 18px;
    color: rgba(245, 247, 250, 0.66);
}

.ads-title {
    margin: 0;
    font-family: "SangBleu Sunrise", serif;
    font-weight: 400;
    font-size: clamp(22px, 5vw, 50px);
    line-height: 1.05;
}

.ads-subtitle {
    margin: 24px 0 0;
    max-width: 620px;
    font-size: clamp(16px, 1.9vw, 23px);
    line-height: 1.5;
    color: var(--ads-muted);
}

.ads-main {
    margin-top: 5px;
    padding-bottom: 70px;
}

/* Слева подборка квартир (шире), справа текст — порядок колонок как в DOM */
.ads-content-grid {
    display: grid;
    grid-template-columns: minmax(320px, 1.12fr) minmax(280px, 1fr);
    gap: 22px;
    align-items: stretch;
}

.ads-content-grid--single {
    grid-template-columns: 1fr;
}

.ads-detail-col {
    min-width: 0;
}

.ads-detail-card {
    background: var(--ads-panel);
    border: 1px solid var(--ads-border);
    border-radius: 28px;
    padding: 28px 30px 32px;
    height: 100%;
}

.ads-detail-heading {
    margin: 0 0 22px;
    padding-bottom: 18px;
    border-bottom: 1px solid rgba(19, 38, 58, 0.1);
    font-family: "SangBleu Sunrise", serif;
    font-weight: 400;
    font-size: clamp(26px, 2.6vw, 36px);
    line-height: 1.18;
    letter-spacing: -0.03em;
    color: #0f2538;
}

.ads-detail-text {
    font-size: clamp(18px, 1.45vw, 21px);
    line-height: 1.72;
    letter-spacing: 0.01em;
    color: #2a3a4a;
    max-width: 42em;
    font-weight: 400;
    -webkit-font-smoothing: antialiased;
}

.ads-detail-text--html {
    max-width: 48em;
}

.ads-detail-text p {
    margin: 0 0 1em;
}

.ads-detail-text p:last-child {
    margin-bottom: 0;
}

.ads-detail-text ul,
.ads-detail-text ol {
    margin: 0 0 1.1em;
    padding-left: 1.35em;
}

.ads-detail-text li {
    margin-bottom: 0.55em;
    padding-left: 0.15em;
}

.ads-detail-text li:last-child {
    margin-bottom: 0;
}

.ads-detail-text ul li::marker {
    color: rgba(15, 37, 56, 0.45);
}

.ads-detail-text strong,
.ads-detail-text b {
    font-weight: 600;
    color: #13263a;
}

.ads-detail-text a {
    color: #0f2538;
    text-decoration: underline;
    text-underline-offset: 3px;
}

.ads-detail-text a:hover {
    opacity: 0.85;
}

/* Галерея видов (upload/photos_barkli) */
.ads-views-gallery {
    margin-top: 28px;
}

.ads-views-gallery__title {
    margin: 0 0 22px;
    font-family: "SangBleu Sunrise", serif;
    font-weight: 400;
    font-size: clamp(26px, 3.2vw, 42px);
    line-height: 1.12;
    text-align: center;
    color: var(--ads-text);
}

.ads-views-gallery__grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 14px;
}

.ads-views-gallery__cell {
    display: block;
    border-radius: 18px;
    overflow: hidden;
    aspect-ratio: 4 / 3;
    border: 1px solid rgba(255, 255, 255, 0.14);
    background: rgba(0, 0, 0, 0.2);
    cursor: zoom-in;
    outline: none;
}

.ads-views-gallery__cell:focus-visible {
    box-shadow: 0 0 0 3px rgba(200, 169, 127, 0.45);
}

.ads-views-gallery__cell img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

@media (max-width: 900px) {
    .ads-views-gallery__grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

.ads-lots-col {
    min-width: 0;
    display: flex;
    flex-direction: column;
}

.ads-lots-panel {
    background: var(--ads-panel);
    border: 1px solid var(--ads-border);
    border-radius: 28px;
    padding: 18px;
    color: var(--ads-text-dark);
    display: flex;
    flex-direction: column;
    min-height: 0;
}

.ads-lots-heading {
    margin: 0 0 14px;
    font-family: "SangBleu Sunrise", serif;
    font-weight: 400;
    font-size: clamp(22px, 2.4vw, 30px);
    line-height: 1.15;
    color: var(--ads-text-dark);
}

.ads-lots-scroll {
    max-height: 540px;
    overflow-y: auto;
    overflow-x: hidden;
    padding-right: 6px;
    margin-top: 4px;
    -webkit-overflow-scrolling: touch;
}

.ads-filter--hidden {
    display: none !important;
}

.ads-panel {
    background: var(--ads-panel);
    border: 1px solid var(--ads-border);
    border-radius: 28px;
    padding: 18px;
    color: var(--ads-text-dark);
}

.ads-filter {
    display: flex;
    flex-wrap: nowrap;
    align-items: flex-end;
    gap: 8px;
    overflow-x: auto;
    padding-bottom: 2px;
    -webkit-overflow-scrolling: touch;
}

.ads-field {
    display: grid;
    gap: 4px;
    flex: 0 1 auto;
    min-width: 0;
}

.ads-field--compact {
    max-width: 104px;
}

.ads-field--sort {
    flex: 1 1 200px;
    min-width: min(260px, 100%);
    max-width: 280px;
}

.ads-field--double {
    grid-column: span 2;
}

.ads-field label {
    font-size: 10px;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    color: #5e6872;
    white-space: nowrap;
}

.ads-field input,
.ads-field select {
    height: 36px;
    min-width: 0;
    max-width: 100%;
    border-radius: 10px;
    border: 1px solid #d0d7df;
    padding: 0 8px;
    font-size: 13px;
    background: #fff;
}

.ads-field input[type="number"] {
    max-width: 108px;
}

/* Таблица лендинга: на всю ширину панели, fr забирает остаток (иначе «дыра» справа) */
.ads-landing .realty-table {
    width: 100%;
    min-width: 0;
}

.ads-landing .realty-table__header,
.ads-landing .realty-table__row {
    width: 100%;
    max-width: 100%;
    min-width: 0;
    box-sizing: border-box;
    grid-template-columns: 52px 44px minmax(150px, 1.2fr) 64px 92px minmax(140px, 1.45fr) minmax(118px, 1.1fr);
    gap: 8px;
}

/* Одна сетка колонок у шапки и строк (перебиваем padding из realty.css) */
.ads-landing .realty-table__header {
    padding: 0 0 10px;
}

.ads-landing .realty-table__row {
    padding: 14px 16px;
}

.ads-landing .realty-table__row > div,
.ads-landing .realty-table__header > div {
    min-width: 0;
}

/* Десктоп / планшет: колонку «За м²» скрываем; последняя колонка — гибкая 1fr на всю оставшуюся ширину */
@media (min-width: 769px) {
    .ads-landing .realty-table__header > div:nth-child(7),
    .ads-landing .realty-table__row > div:nth-child(7) {
        display: none !important;
    }

    .ads-landing .realty-table__header,
    .ads-landing .realty-table__row {
        grid-template-columns: 64px 56px minmax(0, 1.25fr) 72px 96px minmax(0, 1fr);
    }
}

.ads-chess-heading {
    margin: 0 0 8px;
    font-size: 20px;
    font-weight: 700;
    letter-spacing: -0.02em;
    color: var(--realty-text);
}

/* Модалка квартиры: читаемый текст на белом (не наследовать светлый цвет от .ads-landing) */
#adsApartmentModal .realty-modal__dialog {
    color: #121826;
}

#adsApartmentModal .realty-modal-title,
#adsApartmentModal .realty-modal-price {
    color: #121826;
}

#adsApartmentModal .realty-modal-meta {
    color: var(--realty-text-soft, #697285);
}

#adsApartmentModal .realty-modal-stat span {
    color: var(--realty-text-soft, #697285);
}

#adsApartmentModal .realty-modal-stat strong {
    color: #121826;
}

#adsApartmentModal .realty-btn-pdf {
    color: var(--realty-text, #121826);
    white-space: normal;
    text-align: center;
    line-height: 1.25;
}

/* Мобилка: модалка над шапкой (z-index), отступ от верха — margin, не padding */
@media (max-width: 768px) {
    #adsApartmentModal.realty-modal {
        z-index: 220;
        align-items: flex-start;
        justify-content: center;
        padding: 0 12px 16px;
    }

    #adsApartmentModal .realty-modal__dialog {
        margin-top: calc(68px + env(safe-area-inset-top, 0px) + 20px);
        max-height: calc(100vh - 68px - env(safe-area-inset-top, 0px) - 20px - 24px);
        width: min(1080px, calc(100vw - 24px));
    }

    #adsApartmentModal .realty-modal__close {
        top: 14px;
        right: 12px;
        width: 44px;
        height: 44px;
        min-width: 44px;
        min-height: 44px;
        aspect-ratio: 1;
        padding: 0;
        display: inline-flex;
        align-items: center;
        justify-content: center;
        line-height: 1;
        font-size: 26px;
        flex-shrink: 0;
        box-sizing: border-box;
    }
}


.ads-modal-actions {
    flex-direction: column;
    align-items: stretch;
    gap: 12px;
}

.ads-modal-actions .realty-btn-pdf {
    justify-content: center;
}

.ads-modal-consult-btn {
    align-self: center;
    min-width: min(280px, 100%);
    min-height: 48px;
    padding: 0 28px;
    border-radius: 16px;
    border: 0;
    background: linear-gradient(135deg, #0f2538, #173f61);
    color: #fff;
    font-size: 15px;
    font-weight: 700;
    cursor: pointer;
    font-family: inherit;
}

.ads-modal-consult-btn:hover {
    opacity: 0.92;
}

.ads-consult-fancy {
    max-width: 420px;
}

.ads-filter__meta {
    margin-top: 10px;
    color: #5e6872;
    font-size: 13px;
}

.ads-view-tabs {
    margin-top: 16px;
    display: flex;
    gap: 10px;
}

.ads-view-tab {
    min-height: 42px;
    padding: 0 20px;
    border-radius: 999px;
    border: 1px solid #ced7e0;
    background: #fff;
    color: #5a6773;
    font-weight: 600;
    cursor: pointer;
}

.ads-view-tab.is-active {
    color: #fff;
    border-color: transparent;
    background: #0f2538;
}

.ads-view {
    margin-top: 20px;
}

.ads-view.is-hidden {
    display: none;
}

.ads-table {
    display: grid;
    gap: 10px;
}

.ads-table__head,
.ads-table__row {
    display: grid;
    grid-template-columns: 88px 72px 1.2fr 90px 120px 160px 140px 140px;
    gap: 10px;
    align-items: center;
}

.ads-table__head {
    padding: 0 14px;
    font-size: 12px;
    color: #667486;
    text-transform: uppercase;
}

.ads-table__row {
    padding: 14px;
    border-radius: 16px;
    border: 1px solid #dde5ee;
    background: rgba(255, 255, 255, 0.9);
}

.ads-table__plan {
    display: flex;
    align-items: center;
    gap: 10px;
}

.ads-table__plan img {
    width: 54px;
    height: 54px;
    border-radius: 10px;
    object-fit: cover;
}

.ads-status {
    display: inline-flex;
    min-height: 32px;
    border-radius: 999px;
    align-items: center;
    justify-content: center;
    padding: 0 10px;
    font-size: 12px;
    font-weight: 700;
}

.ads-status--free {
    color: #217047;
    background: rgba(33, 112, 71, 0.12);
}

.ads-status--reserved {
    color: #fff;
    background: #1a5c35;
}

.ads-status--sold {
    color: #fff;
    background: #243347;
}

.ads-plan-groups {
    display: grid;
    gap: 16px;
}

.ads-plan-group {
    border: 1px solid #dde5ee;
    border-radius: 20px;
    overflow: hidden;
}

.ads-plan-group__head {
    background: #f2f6fb;
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    gap: 10px;
    padding: 14px 16px;
    font-size: 13px;
}

.ads-plan-group__body {
    padding: 16px;
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 14px;
}

.ads-plan-card {
    border-radius: 16px;
    border: 1px solid #e1e8f0;
    overflow: hidden;
    background: #fff;
    text-decoration: none;
    color: inherit;
}

.ads-plan-card img {
    width: 100%;
    height: 190px;
    object-fit: cover;
}

.ads-plan-card__body {
    padding: 12px;
    display: grid;
    gap: 8px;
}

.ads-plan-card__price {
    font-weight: 700;
    font-size: 16px;
}

.ads-chess {
    display: grid;
    gap: 24px;
}

.ads-chess-corpus__title {
    margin: 0 0 10px;
    font-size: 21px;
}

.ads-chess-floor {
    display: grid;
    grid-template-columns: 54px 1fr;
    gap: 12px;
    align-items: start;
    margin-bottom: 10px;
}

.ads-chess-floor__num {
    height: 52px;
    border-radius: 14px;
    background: #f2f6fb;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
}

.ads-chess-floor__grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
    gap: 10px;
}

.ads-chess-card {
    border-radius: 14px;
    border: 1px solid #d7e1eb;
    padding: 12px;
    background: #fff;
    display: grid;
    gap: 8px;
}

.ads-chess-card__price {
    font-weight: 700;
}

.ads-bottom {
    margin-top: 32px;
    display: grid;
    grid-template-columns: 1.1fr 0.9fr;
    gap: 22px;
}

.ads-story {
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 24px;
    padding: 26px;
}

.ads-story h2 {
    margin: 0 0 14px;
    font-family: "SangBleu Sunrise", serif;
    font-size: clamp(26px, 3vw, 38px);
    font-weight: 400;
}

.ads-story p {
    margin: 0 0 18px;
    color: var(--ads-muted);
    line-height: 1.7;
}

.ads-story__gallery {
    margin: 4px 0 8px;
}

.ads-story__gallery-title {
    margin: 0 0 12px;
    font-family: "SangBleu Sunrise", serif;
    font-weight: 400;
    font-size: clamp(20px, 2.2vw, 28px);
    line-height: 1.2;
    letter-spacing: -0.02em;
    color: rgba(245, 247, 250, 0.96);
}

.ads-views-gallery__grid--in-story {
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 10px;
}

@media (max-width: 640px) {
    .ads-views-gallery__grid--in-story {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

.ads-story .ads-views-gallery__cell {
    border-color: rgba(255, 255, 255, 0.22);
    background: rgba(0, 0, 0, 0.25);
}

.ads-story__actions {
    margin-top: 20px;
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.ads-link-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 44px;
    border-radius: 999px;
    padding: 0 20px;
    text-decoration: none;
}

.ads-link-btn--main {
    background: #fff;
    color: #10273c;
}

.ads-link-btn--ghost {
    border: 1px solid rgba(255, 255, 255, 0.35);
    color: #fff;
}

.ads-form {
    background: #fff;
    border-radius: 24px;
    padding: 24px;
    color: #1b2d3e;
}

.ads-form h3 {
    margin: 0 0 8px;
    font-size: 26px;
}

.ads-form p {
    margin: 0 0 16px;
    color: #5e6872;
}

.ads-form__h4 {
    line-height: 1.55;
}

.ads-form__grid {
    display: grid;
    gap: 10px;
}

.ads-form input,
.ads-form textarea {
    width: 100%;
    border: 1px solid #d2dae3;
    border-radius: 12px;
    padding: 12px;
    font-size: 14px;
    font-family: inherit;
}

.ads-form textarea {
    min-height: 94px;
    resize: vertical;
}

.ads-form button {
    min-height: 46px;
    border: 0;
    border-radius: 12px;
    cursor: pointer;
    color: #fff;
    background: linear-gradient(135deg, #0f2538, #173f61);
    font-weight: 700;
}

.ads-form__message {
    font-size: 13px;
    min-height: 18px;
}

.ads-empty {
    text-align: center;
    padding: 30px 10px;
    color: #5e6872;
}

.ads-reveal {
    opacity: 0;
    transform: translateY(14px);
    transition: opacity 0.7s ease, transform 0.7s ease;
}

.ads-reveal.is-in {
    opacity: 1;
    transform: translateY(0);
}

/* Мобилка: без reveal у блока с подборкой квартир (стабильнее при скролле/IO) */
@media (max-width: 768px) {
    .ads-content-grid.ads-reveal {
        opacity: 1;
        transform: none;
        transition: none;
    }
}

@media (max-width: 1180px) {
    .ads-content-grid:not(.ads-content-grid--single) {
        grid-template-columns: 1fr;
    }

    .ads-landing .realty-plan-group__content {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

/* Планшет: горизонтальный скролл только если контент реально шире (без принудительного min-width таблицы) */
@media (max-width: 1024px) and (min-width: 769px) {
    .ads-landing .ads-lots-scroll {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }
}

/* Мобилка: строка заголовков скрыта, строки — карточки с подписями */
@media (max-width: 768px) {
    /* Цепочка min-width: 0 — иначе grid/flex не сжимает карточку и её режет overflow родителя */
    .ads-landing .ads-content-grid {
        min-width: 0;
    }

    .ads-landing .ads-lots-col {
        min-width: 0;
        max-width: 100%;
    }

    .ads-landing .ads-lots-panel {
        min-width: 0;
        max-width: 100%;
        padding-left: 14px;
        padding-right: 14px;
        box-sizing: border-box;
    }

    .ads-landing .realty-table {
        gap: 14px;
        min-width: 0;
        max-width: 100%;
    }

    .ads-landing .realty-table__header {
        display: none !important;
    }

    .ads-landing .realty-table__row {
        display: grid;
        grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
        grid-template-areas:
            "korpus floor"
            "plan plan"
            "rooms sq"
            "price ppm";
        gap: 12px 14px;
        padding: 16px 14px 18px;
        border-radius: 18px;
        box-shadow: 0 10px 32px rgba(15, 23, 42, 0.1);
        align-items: start;
        min-width: 0;
        max-width: 100%;
        box-sizing: border-box;
    }

    .ads-landing .realty-table__row > div:nth-child(1) {
        grid-area: korpus;
    }

    .ads-landing .realty-table__row > div:nth-child(2) {
        grid-area: floor;
        justify-self: end;
        text-align: right;
    }

    .ads-landing .realty-table__row > div:nth-child(3) {
        grid-area: plan;
        padding-top: 4px;
        border-top: 1px solid rgba(19, 38, 58, 0.1);
        margin: 0;
        padding-left: 0;
        padding-right: 0;
    }

    .ads-landing .realty-table__row > div:nth-child(4) {
        grid-area: rooms;
    }

    .ads-landing .realty-table__row > div:nth-child(5) {
        grid-area: sq;
    }

    .ads-landing .realty-table__row > div:nth-child(6) {
        grid-area: price;
    }

    .ads-landing .realty-table__row > div:nth-child(7) {
        grid-area: ppm;
    }

    .ads-landing .realty-table__row > div:nth-child(1)::before,
    .ads-landing .realty-table__row > div:nth-child(2)::before,
    .ads-landing .realty-table__row > div:nth-child(3)::before,
    .ads-landing .realty-table__row > div:nth-child(4)::before,
    .ads-landing .realty-table__row > div:nth-child(5)::before,
    .ads-landing .realty-table__row > div:nth-child(6)::before,
    .ads-landing .realty-table__row > div:nth-child(7)::before {
        display: block;
        font-size: 10px;
        font-weight: 700;
        letter-spacing: 0.07em;
        text-transform: uppercase;
        color: #7a8796;
        margin-bottom: 5px;
    }

    .ads-landing .realty-table__row > div:nth-child(1)::before {
        content: "Корпус";
    }

    .ads-landing .realty-table__row > div:nth-child(2)::before {
        content: "Этаж";
    }

    .ads-landing .realty-table__row > div:nth-child(3)::before {
        content: "Квартира";
    }

    .ads-landing .realty-table__row > div {
        min-width: 0;
        overflow-wrap: break-word;
    }

    .ads-landing .realty-table__row > div:nth-child(4)::before {
        content: "Комнат";
    }

    .ads-landing .realty-table__row > div:nth-child(5)::before {
        content: "S общая";
    }

    .ads-landing .realty-table__row > div:nth-child(6)::before {
        content: "Цена";
    }

    .ads-landing .realty-table__row > div:nth-child(7)::before {
        content: "За м²";
    }

    .ads-landing .realty-table__row > div:not(:nth-child(3)) {
        font-size: 15px;
        font-weight: 600;
        color: #13263a;
    }

    .ads-landing .realty-table__row > div:nth-child(2) {
        font-variant-numeric: tabular-nums;
    }

    .ads-landing .realty-table__plan {
        width: 100%;
        min-width: 0;
        max-width: 100%;
        box-sizing: border-box;
    }

    .ads-landing .realty-table__plan strong {
        font-size: 17px;
        overflow-wrap: break-word;
    }

    .ads-lots-scroll {
        max-height: none;
        overflow-x: visible;
        overflow-y: visible;
        padding-right: 0;
    }

    /* Планировки: заголовок группы — колонками вниз, без узких ячеек сетки */
    .ads-landing .realty-plan-group__head {
        display: grid;
        grid-template-columns: 1fr;
        gap: 10px;
        padding: 14px 16px;
        align-items: start;
    }

    .ads-landing .realty-plan-group__head strong {
        font-size: 17px;
        line-height: 1.3;
    }

    .ads-landing .realty-plan-group__head > span {
        display: block;
        font-size: 14px;
        line-height: 1.45;
        color: #4a5565;
        word-break: normal;
        overflow-wrap: break-word;
    }

    .ads-landing .realty-plan-group__content {
        grid-template-columns: 1fr;
        padding: 0 16px 16px;
        gap: 14px;
    }
}

@media (max-width: 760px) {
    .ads-container {
        width: calc(100% - 24px);
    }

    .ads-hero__inner {
        padding-bottom: 42px;
    }

    .ads-filter {
        flex-wrap: wrap;
    }

    .ads-bottom {
        grid-template-columns: 1fr;
    }
}
