/*
 * Мост между дизайном «Корпоративный сайт 3.0» и ядром 1С-Битрикс.
 * Подключается после template_styles.css и assets/css/site.css.
 * Здесь только подключение шрифта, служебные классы и минимальная
 * совместимость со старыми страницами движка (auth/account/favorites).
 */

body {
    font-family: 'Montserrat', sans-serif;
}

.icon {
    vertical-align: middle;
}

[hidden] {
    display: none !important;
}

.sr-only {
    position: absolute !important;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

:where(a, button, input, select, textarea, summary, [tabindex]):focus-visible {
    outline: 2px solid var(--primary, #0056D2);
    outline-offset: 2px;
}

/* В Битриксе каждая страница — отдельный документ, прятать .page-view не нужно. */
.page-view {
    display: block;
}

/* Плашка демонстрационных данных (38-ФЗ). */
.demo-badge {
    position: fixed;
    left: 12px;
    bottom: 12px;
    z-index: 1400;
    max-width: min(340px, calc(100vw - 24px));
    padding: 6px 10px;
    border-radius: 6px;
    background: #6B7280;
    color: #FFFFFF;
    font-size: 11px;
    font-weight: 500;
    line-height: 1.35;
    box-shadow: 0 4px 14px rgba(17, 24, 39, 0.22);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    pointer-events: none;
}

.skip-link {
    position: absolute;
    left: -9999px;
    top: 0;
    z-index: 2000;
    padding: 10px 16px;
    background: #FFFFFF;
    color: var(--text-main, #222222);
    border: 2px solid var(--primary, #0056D2);
    border-radius: 6px;
    font-size: 13px;
    font-weight: 600;
}

.skip-link:focus {
    left: 12px;
    top: 12px;
}

.cart-empty {
    margin: 6px 0;
    font-size: 13px;
    color: var(--text-muted, #5F6672);
}

/* Формы заявок: разметка использует те же поля, что и старые страницы. */
.field {
    margin-bottom: 14px;
}

.field label {
    display: block;
    margin-bottom: 6px;
    font-size: 12.5px;
    font-weight: 600;
    color: var(--text-main, #222222);
}

.field input,
.field select,
.field textarea {
    width: 100%;
    min-height: 44px;
    padding: 10px 14px;
    border: 1px solid var(--border, #E8EBEF);
    border-radius: 6px;
    background: #FFFFFF;
    font-size: 14px;
    color: var(--text-main, #222222);
}

.consent-field {
    display: flex;
    align-items: flex-start;
    gap: 8px;
    margin: 4px 0 16px;
    font-size: 11.5px;
    line-height: 1.45;
    color: var(--text-muted, #5F6672);
}

.consent-field input {
    margin-top: 2px;
    flex-shrink: 0;
}

.consent-field a {
    color: var(--primary, #0056D2);
    text-decoration: underline;
}

.hp-field {
    position: absolute;
    left: -9999px;
    width: 1px;
    height: 1px;
    overflow: hidden;
}

.form-message {
    margin-top: 12px;
    font-size: 13px;
}

.form-message.error {
    color: #B91C1C;
}

/* Нативные details для FAQ: работает без JavaScript. */
details.faq-item > summary {
    list-style: none;
    cursor: pointer;
}

details.faq-item > summary::-webkit-details-marker {
    display: none;
}

details.faq-item .faq-a {
    display: block;
}

details.faq-item:not([open]) .faq-a {
    display: none;
}

/* ===================================================================== */
/* Минимальные стили старых страниц движка (auth, account, favorites)    */
/* ===================================================================== */

.container {
    width: 100%;
    max-width: var(--container-max, 1860px);
    margin-left: auto;
    margin-right: auto;
    padding-left: var(--container-pad, 36px);
    padding-right: var(--container-pad, 36px);
}

.section-first {
    padding-top: 40px;
}

.page-heading {
    background: var(--bg-light, #F6F7F9);
    border-bottom: 1px solid var(--border, #E8EBEF);
    padding: 36px 0 32px;
}

.page-heading h1 {
    font-size: 34px;
    font-weight: 600;
    line-height: 1.2;
}

.page-subtitle {
    margin-top: 8px;
    font-size: 14.5px;
    color: var(--text-muted, #5F6672);
}

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 11px 22px;
    border: 1px solid transparent;
    border-radius: 6px;
    font-size: 13.5px;
    font-weight: 600;
    line-height: 1.2;
    cursor: pointer;
    transition: background-color 0.2s ease, border-color 0.2s ease, color 0.2s ease;
}

.btn-primary {
    background: var(--primary, #0056D2);
    color: #FFFFFF;
}

.btn-primary:hover {
    background: var(--primary-hover, #0044A8);
}

.btn-outline {
    background: #FFFFFF;
    color: var(--text-main, #222222);
    border-color: var(--border, #E8EBEF);
}

.btn-outline:hover {
    border-color: var(--primary, #0056D2);
    color: var(--primary, #0056D2);
}

.btn-wide {
    width: 100%;
}

.empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
    padding: 56px 20px;
    text-align: center;
    color: var(--text-muted, #5F6672);
}

.empty-state h2 {
    font-size: 22px;
    color: var(--text-main, #222222);
}

.property-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: var(--gutter, 24px);
}

.auth-layout {
    display: flex;
    justify-content: center;
    padding: 48px 16px 64px;
}

.auth-card {
    width: 100%;
    max-width: 460px;
    background: #FFFFFF;
    border: 1px solid var(--border, #E8EBEF);
    border-radius: var(--radius, 8px);
    box-shadow: var(--shadow-sm, 0 2px 10px rgba(17, 24, 39, 0.05));
    padding: 32px;
}

.auth-card h1 {
    margin-bottom: 20px;
    font-size: 24px;
}

.auth-links {
    display: flex;
    flex-wrap: wrap;
    gap: 16px;
    margin-top: 16px;
    font-size: 13px;
}

.auth-links a {
    color: var(--primary, #0056D2);
}

.account-layout {
    display: grid;
    grid-template-columns: 240px minmax(0, 1fr);
    gap: 24px;
    padding-top: 32px;
    padding-bottom: 56px;
}

.account-nav {
    display: flex;
    flex-direction: column;
    gap: 10px;
    align-self: start;
    background: #FFFFFF;
    border: 1px solid var(--border, #E8EBEF);
    border-radius: var(--radius, 8px);
    padding: 20px;
    font-size: 13.5px;
}

.account-nav a {
    color: var(--primary, #0056D2);
}

.account-avatar {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    background: var(--primary-soft, #EEF4FF);
    color: var(--primary, #0056D2);
    display: flex;
    align-items: center;
    justify-content: center;
}

.account-panel {
    background: #FFFFFF;
    border: 1px solid var(--border, #E8EBEF);
    border-radius: var(--radius, 8px);
    padding: 26px;
}

.prose p {
    margin-bottom: 14px;
    font-size: 14.5px;
    line-height: 1.7;
    color: var(--text-muted, #5F6672);
}

.prose h2 {
    margin: 24px 0 10px;
    font-size: 22px;
}

.prose a {
    color: var(--primary, #0056D2);
    text-decoration: underline;
}

@media (max-width: 1240px) {
    .property-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .account-layout {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 767px) {
    .property-grid {
        grid-template-columns: 1fr;
    }

    .demo-badge {
        left: 8px;
        bottom: 8px;
        max-width: calc(100vw - 16px);
        font-size: 10px;
    }
}
