.app--public {
    grid-template-rows: var(--toolbar-h) 1fr;
    --sidebar-w: 340px;
    --chips-h: 0px;
}

/* Без строки chips метка map-wrap должна быть во 2-й строке, не в 3-й */
.app--public .map-wrap {
    grid-row: 2;
    grid-column: 1;
}

.app--public .toolbar {
    grid-row: 1;
    grid-column: 1;
}

.app--public .toolbar-stats--public {
    display: flex;
    margin-left: auto;
}

.app--public .stat-pill--main {
    font-size: 0.78rem;
    padding: 6px 12px;
}

.app--public .stat-pill--main strong {
    font-size: 1rem;
}

@media (min-width: 900px) {
    .app--public {
        grid-template-columns: var(--sidebar-w) 1fr;
        grid-template-rows: var(--toolbar-h) 1fr;
    }

    .app--public .toolbar {
        grid-column: 1 / -1;
        grid-row: 1;
    }

    .app--public .sidebar {
        grid-row: 2;
        grid-column: 1;
    }

    .app--public .map-wrap {
        grid-row: 2;
        grid-column: 2;
    }
}

.detail-loading {
    color: var(--muted);
    font-size: 0.85rem;
    text-align: center;
    padding: 24px 8px;
}

.detail-sections {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.detail-section {
    border: 1px solid var(--border);
    border-radius: 10px;
    overflow: hidden;
    background: #fafbff;
}

.detail-section summary {
    cursor: pointer;
    padding: 10px 12px;
    font-size: 0.82rem;
    font-weight: 700;
    color: var(--text);
    list-style: none;
    display: flex;
    align-items: center;
    gap: 8px;
}

.detail-section summary::-webkit-details-marker {
    display: none;
}

.detail-section summary::after {
    content: '▾';
    margin-left: auto;
    color: var(--muted);
    font-size: 0.75rem;
}

.detail-section[open] summary::after {
    transform: rotate(180deg);
}

.detail-section__body {
    padding: 0 12px 12px;
    font-size: 0.8rem;
}

.detail-section__body .detail-rows {
    margin-bottom: 0;
}

.detail-section__body--description {
    padding-top: 4px;
}

.detail-ad-text {
    font-size: 0.9rem;
    line-height: 1.65;
    color: #1e293b;
    background: #fff;
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 14px 16px;
    max-height: min(48vh, 420px);
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
}

.detail-ad-text__p {
    margin: 0 0 14px;
}

.detail-ad-text__p:last-child {
    margin-bottom: 0;
}

.detail-ad-text__block {
    margin-bottom: 14px;
}

.detail-ad-text__block:last-child {
    margin-bottom: 0;
}

.detail-ad-text__lead {
    margin: 0 0 6px;
    font-weight: 700;
    font-size: 0.92rem;
    line-height: 1.45;
    color: var(--text);
}

.detail-ad-text__block .detail-ad-text__p {
    margin-bottom: 0;
}

.detail-photos {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(110px, 1fr));
    gap: 8px;
}

.detail-photo {
    display: block;
    border-radius: 8px;
    overflow: hidden;
    border: 1px solid var(--border);
    background: #fff;
    color: inherit;
    cursor: pointer;
    padding: 0;
    width: 100%;
    text-align: left;
    font: inherit;
}

.detail-photo img {
    display: block;
    width: 100%;
    aspect-ratio: 4 / 3;
    object-fit: cover;
}

.detail-photo span {
    display: block;
    padding: 4px 6px;
    font-size: 0.65rem;
    color: var(--muted);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.detail-muted {
    color: var(--gray);
    font-size: 0.8rem;
}

.detail-photo:focus-visible {
    outline: 2px solid var(--primary);
    outline-offset: 2px;
}

.photo-lightbox {
    position: fixed;
    inset: 0;
    z-index: 200;
    background: rgba(15, 22, 46, 0.94);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 12px;
    padding-top: calc(12px + var(--safe-top));
    padding-bottom: calc(12px + var(--safe-bottom));
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.2s ease, visibility 0.2s ease;
}

.photo-lightbox.is-open {
    opacity: 1;
    visibility: visible;
}

.photo-lightbox__stage {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    min-height: 0;
    touch-action: pan-y pinch-zoom;
}

.photo-lightbox__stage img {
    max-width: 100%;
    max-height: min(78vh, 900px);
    object-fit: contain;
    border-radius: 8px;
    box-shadow: 0 8px 40px rgba(0, 0, 0, 0.45);
    user-select: none;
}

.photo-lightbox__meta {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    margin-top: 10px;
    color: #e2e8f0;
    font-size: 0.85rem;
    text-align: center;
    max-width: 90vw;
}

#photoLightboxCaption {
    opacity: 0.85;
    font-size: 0.78rem;
}

.photo-lightbox__close,
.photo-lightbox__nav {
    position: absolute;
    border: none;
    background: rgba(255, 255, 255, 0.12);
    color: #fff;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    backdrop-filter: blur(6px);
    transition: background 0.15s ease;
}

.photo-lightbox__close:hover,
.photo-lightbox__nav:hover {
    background: rgba(255, 255, 255, 0.22);
}

.photo-lightbox__close {
    top: calc(10px + var(--safe-top));
    right: 10px;
    width: 44px;
    height: 44px;
    border-radius: 50%;
    font-size: 1.1rem;
    z-index: 2;
}

.photo-lightbox__nav {
    top: 50%;
    transform: translateY(-50%);
    width: 48px;
    height: 48px;
    border-radius: 50%;
    font-size: 1rem;
    z-index: 2;
}

.photo-lightbox__nav--prev {
    left: 10px;
}

.photo-lightbox__nav--next {
    right: 10px;
}

body.lightbox-open {
    overflow: hidden;
}

@media (max-width: 600px) {
    .photo-lightbox__nav {
        width: 40px;
        height: 40px;
    }

    .photo-lightbox__nav--prev {
        left: 4px;
    }

    .photo-lightbox__nav--next {
        right: 4px;
    }
}

/* ── Телефон в тулбаре ── */
.toolbar-phone {
    margin-left: auto;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 14px;
    border-radius: 10px;
    background: var(--primary);
    color: #fff;
    text-decoration: none;
    font-weight: 700;
    font-size: 0.82rem;
    white-space: nowrap;
    transition: background 0.15s ease;
    flex-shrink: 0;
}
.toolbar-phone:hover {
    background: var(--primary-dark);
}
.toolbar-phone i {
    font-size: 0.75rem;
}
.toolbar-phone__num {
    letter-spacing: 0.02em;
}

/* На узких экранах скрываем номер, оставляем только иконку */
@media (max-width: 480px) {
    .toolbar-phone {
        padding: 0;
        width: 38px;
        height: 38px;
        justify-content: center;
        border-radius: 10px;
    }
    .toolbar-phone__num {
        display: none;
    }
    .toolbar-phone i {
        font-size: 0.9rem;
    }
}

/* ── Плавающая кнопка звонка (FAB) ── */
.fab-phone {
    position: absolute;
    bottom: 52px;
    right: 16px;
    z-index: 20;
    width: 56px;
    height: 56px;
    border-radius: 50%;
    background: var(--primary);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    text-decoration: none;
    box-shadow: 0 4px 16px rgba(91, 109, 255, 0.45);
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    font-size: 1.3rem;
}
.fab-phone:hover {
    transform: scale(1.08);
    box-shadow: 0 6px 22px rgba(91, 109, 255, 0.6);
}
.fab-phone:active {
    transform: scale(0.96);
}

/* На десктопе (широкий экран с sidebar) двигаем FAB левее */
@media (min-width: 900px) {
    .fab-phone {
        bottom: 32px;
        right: 28px;
    }
}

/* ── Кнопка "Подробнее" в сайдбаре карты ── */
.detail-link {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 14px;
    margin: 8px 0 12px;
    border-radius: 8px;
    background: #EEF2FF;
    color: var(--primary);
    font-weight: 700;
    font-size: 0.8rem;
    text-decoration: none;
    transition: background 0.15s ease, transform 0.12s ease;
}
.detail-link:hover {
    background: #DDE4FF;
    transform: translateX(2px);
}
.detail-link:active {
    transform: scale(0.97);
}
.detail-link i {
    font-size: 0.7rem;
}
