/* ============================================================
   TriCMS — Engine Styles (шаблон TriCMS)
   Универсальные компоненты, одинаковые для всех шаблонов:
   кабинет пользователя, аватар.
   ============================================================ */

/* ========================
   Header Avatar (кнопка + отображение)
   ======================== */
.header-avatar {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: var(--primary-light);
    color: var(--primary) !important;
    font-size: .9rem;
    transition: background .2s;
}

.header-avatar:hover {
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    color: #fff !important;
}

.header-avatar-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: none;
    border: none;
    padding: 0;
    cursor: pointer;
    border-radius: 50%;
    transition: transform .15s;
}

.header-avatar-btn:hover {
    transform: scale(1.08);
}

.header-avatar-btn .header-avatar {
    width: 40px;
    height: 40px;
}

.header-avatar-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 50%;
}

.header-avatar-initial {
    font-size: inherit;
    font-weight: 700;
    color: var(--primary);
    line-height: 1;
}

/* ============================================================
   CABINET MODAL (кабинет пользователя)
   ============================================================ */

/* Overlay */
.cabinet-overlay {
    position: fixed;
    inset: 0;
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(0, 0, 0, .55);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    opacity: 0;
    visibility: hidden;
    transition: opacity .3s, visibility .3s;
}

.cabinet-overlay.active {
    opacity: 1;
    visibility: visible;
}

/* Modal card */
.cabinet-modal {
    position: relative;
    width: 420px;
    max-width: 92vw;
    max-height: 90vh;
    border-radius: 20px;
    overflow: hidden;
    transform: scale(.92) translateY(20px);
    transition: transform .35s cubic-bezier(.4, 0, .2, 1);
    display: flex;
    flex-direction: column;
    box-shadow: 0 24px 64px rgba(0, 0, 0, .35);
}

.cabinet-overlay.active .cabinet-modal {
    transform: scale(1) translateY(0);
}

/* ========================
   Hero — тёмная шапка с фоновой картинкой
   ======================== */
.cabinet-hero {
    position: relative;
    background:
        linear-gradient(180deg, rgba(15, 23, 42, .75) 0%, rgba(15, 23, 42, .92) 100%),
        url('../images/cabinet-bg.jpg') center / cover no-repeat;
    background-color: #1e293b;
    padding: 24px 28px 28px;
    color: #fff;
}

.cabinet-hero-top {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 22px;
}

.cabinet-modal-title {
    font-size: 1.45rem;
    font-weight: 800;
    color: #fff;
    letter-spacing: -0.01em;
}

.cabinet-close {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    border: none;
    background: rgba(255, 255, 255, .1);
    font-size: 1.5rem;
    line-height: 1;
    color: rgba(255, 255, 255, .7);
    cursor: pointer;
    border-radius: 50%;
    transition: background .2s, color .2s;
}

.cabinet-close:hover {
    background: rgba(255, 255, 255, .2);
    color: #fff;
}

/* User info внутри hero */
.cabinet-hero-user {
    display: flex;
    align-items: center;
    gap: 16px;
}

.cabinet-avatar {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 56px;
    height: 56px;
    border-radius: 50%;
    background: rgba(255, 255, 255, .15);
    color: #fff;
    font-size: 1.4rem;
    flex-shrink: 0;
    overflow: hidden;
    border: 2px solid rgba(255, 255, 255, .2);
}

.cabinet-avatar .header-avatar-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 50%;
}

.cabinet-avatar .header-avatar-initial {
    font-size: 1.4rem;
    font-weight: 700;
    color: #fff;
}

.cabinet-user-text {
    min-width: 0;
}

.cabinet-username {
    font-size: 1.1rem;
    font-weight: 700;
    color: #fff;
    line-height: 1.3;
}

.cabinet-usergroup {
    font-size: .85rem;
    color: rgba(255, 255, 255, .6);
    margin-top: 2px;
}

/* ========================
   Menu — тёмная карточка
   ======================== */
.cabinet-menu {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 16px;
    margin: 16px;
    padding: 8px;
    display: flex;
    flex-direction: column;
    gap: 0;
}

.cabinet-menu-item {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 14px 18px;
    border-radius: 12px;
    font-size: 1rem;
    font-weight: 500;
    color: var(--text) !important;
    text-decoration: none !important;
    transition: background .15s;
    line-height: 1.3;
}

.cabinet-menu-item * {
    color: inherit !important;
    text-decoration: none !important;
}

.cabinet-menu-item:hover {
    background: var(--primary-light);
    color: var(--primary) !important;
}

.cabinet-menu-item i {
    width: 24px;
    text-align: center;
    font-size: 1.05rem;
    color: var(--text-muted) !important;
    flex-shrink: 0;
    transition: color .15s;
}

.cabinet-menu-item:hover i {
    color: var(--primary) !important;
}

.cabinet-menu-item span {
    color: var(--text) !important;
    flex: 1;
    display: inline-block;
}

.cabinet-menu-item:hover span {
    color: var(--primary) !important;
}

.cabinet-menu-item .cabinet-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 28px;
    height: 28px;
    padding: 0 9px;
    border-radius: 14px;
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    color: #fff !important;
    font-size: .8rem;
    font-weight: 700;
    margin-left: auto;
    flex-shrink: 0;
}

/* ========================
   Footer — кнопки
   ======================== */
.cabinet-footer {
    display: flex;
    gap: 12px;
    padding: 16px 28px 28px;
    background: var(--bg-card);
}

.cabinet-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 12px 24px;
    border-radius: 12px;
    font-size: .9rem;
    font-weight: 600;
    text-decoration: none;
    cursor: pointer;
    transition: opacity .2s, background .2s;
    border: none;
    font-family: var(--font);
    white-space: nowrap;
}

.cabinet-btn-settings {
    background: #ef4444;
    color: #fff !important;
}

.cabinet-btn-settings:hover {
    opacity: .88;
    color: #fff !important;
}

.cabinet-btn-logout-wrap {
    flex: 1;
}

.cabinet-btn-logout-wrap form {
    display: block !important;
    width: 100%;
    height: 100%;
}

.cabinet-btn-logout-wrap .btn-logout-link {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    width: 100%;
    height: 100%;
    padding: 12px 24px;
    border-radius: 12px;
    font-size: .9rem;
    font-weight: 600;
    background: var(--bg);
    color: var(--text-secondary) !important;
    border: 1px solid var(--border);
    cursor: pointer;
    font-family: var(--font);
    transition: background .2s, color .2s;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.cabinet-btn-logout-wrap .btn-logout-link::before {
    content: '\f2f5';
    font-family: 'Font Awesome 6 Free';
    font-weight: 900;
    font-size: .85rem;
}

.cabinet-btn-logout-wrap .btn-logout-link:hover {
    background: var(--primary-light);
    color: var(--primary) !important;
    border-color: var(--primary-dark);
}

/* ============================================================
   LOGIN MODAL (модалка авторизации)
   ============================================================ */

/* Overlay — общий с кабинетом */
.login-overlay {
    position: fixed;
    inset: 0;
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(0, 0, 0, .55);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    opacity: 0;
    visibility: hidden;
    transition: opacity .3s, visibility .3s;
}

.login-overlay.active {
    opacity: 1;
    visibility: visible;
}

.login-modal {
    position: relative;
    width: 440px;
    max-width: 92vw;
    max-height: 90vh;
    border-radius: 20px;
    overflow: hidden;
    overflow-y: auto;
    transform: scale(.92) translateY(20px);
    transition: transform .35s cubic-bezier(.4, 0, .2, 1);
    display: flex;
    flex-direction: column;
    box-shadow: 0 24px 64px rgba(0, 0, 0, .35);
}

.login-overlay.active .login-modal {
    transform: scale(1) translateY(0);
}

/* Переключаемые виды внутри модалки */
.login-view {
    display: none;
    animation: loginViewIn .3s ease;
}

.login-view.active {
    display: block;
}

@keyframes loginViewIn {
    from {
        opacity: 0;
        transform: translateX(12px);
    }

    to {
        opacity: 1;
        transform: translateX(0);
    }
}

/* Hero — шапка */
.login-hero {
    position: relative;
    background: var(--bg-card);
    padding: 28px 28px 20px;
}

.login-hero-top {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 16px;
}

.login-modal-title {
    font-size: 1.5rem;
    font-weight: 800;
    color: var(--text);
    letter-spacing: -0.01em;
    margin-bottom: 4px;
}

.login-modal-subtitle {
    font-size: .9rem;
    color: var(--text-muted);
    margin: 0;
}

.login-hero .cabinet-close {
    background: var(--primary-light);
    color: var(--text-muted);
}

.login-hero .cabinet-close:hover {
    background: var(--border);
    color: var(--text);
}

/* Body */
.login-body {
    background: var(--bg-card);
    padding: 4px 28px 28px;
}

/* Login error */
.login-error {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 16px;
    margin-bottom: 16px;
    background: var(--red-light);
    border: 1px solid rgba(220, 38, 38, .2);
    border-radius: 12px;
    color: var(--red);
    font-size: .88rem;
    font-weight: 500;
}

.login-error i {
    flex-shrink: 0;
}

.login-success {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 14px 18px;
    margin-bottom: 16px;
    background: var(--green-light);
    border: 1px solid rgba(22, 163, 74, .2);
    border-radius: 12px;
    color: var(--green);
    font-size: .9rem;
    font-weight: 500;
    line-height: 1.5;
}

.login-success i {
    flex-shrink: 0;
    font-size: 1.1rem;
}

/* Google OAuth button */
.login-btn-google {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    width: 100%;
    padding: 12px;
    border: 1px solid var(--border);
    border-radius: 12px;
    background: var(--bg);
    color: var(--text) !important;
    font-size: .9rem;
    font-weight: 600;
    font-family: var(--font);
    transition: background .2s, border-color .2s;
    text-decoration: none;
}

.login-btn-google:hover {
    background: var(--bg-card);
    border-color: var(--text-muted);
    color: var(--text) !important;
}

.login-divider {
    display: flex;
    align-items: center;
    gap: 14px;
    margin: 16px 0;
    color: var(--text-muted);
    font-size: .82rem;
}

.login-divider::before,
.login-divider::after {
    content: '';
    flex: 1;
    height: 1px;
    background: var(--border);
}

/* Input fields */
.login-field {
    margin-bottom: 14px;
}

.login-input {
    width: 100%;
    padding: 14px 18px;
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: 12px;
    color: var(--text);
    font-size: .95rem;
    font-family: var(--font);
    transition: border-color .2s, box-shadow .2s;
    outline: none;
}

.login-input::placeholder {
    color: var(--text-muted);
}


/* Remember + forgot row */
.login-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 20px;
    gap: 12px;
}

.login-remember {
    display: flex;
    align-items: center;
    gap: 10px;
    cursor: pointer;
    font-size: .88rem;
    color: var(--text-secondary);
    user-select: none;
}

.login-remember input[type="checkbox"] {
    display: none;
}

.login-toggle {
    position: relative;
    width: 44px;
    height: 24px;
    background: var(--border);
    border-radius: 12px;
    transition: background .25s;
    flex-shrink: 0;
}

.login-toggle::after {
    content: '';
    position: absolute;
    top: 3px;
    left: 3px;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: #fff;
    box-shadow: 0 1px 3px rgba(0, 0, 0, .15);
    transition: transform .25s;
}

.login-remember input:checked~.login-toggle {
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
}

.login-remember input:checked~.login-toggle::after {
    transform: translateX(20px);
}

.login-forgot {
    font-size: .85rem;
    color: var(--primary) !important;
    white-space: nowrap;
}

.login-forgot:hover {
    text-decoration: underline;
}

/* Submit button */
.login-submit {
    width: 100%;
    padding: 14px;
    border: none;
    border-radius: 12px;
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    color: #fff;
    font-size: 1rem;
    font-weight: 700;
    font-family: var(--font);
    cursor: pointer;
    transition: opacity .2s;
}

.login-submit:hover {
    opacity: .9;
}

/* Footer text */
.login-footer-text {
    text-align: center;
    font-size: .9rem;
    color: var(--text-muted);
    margin-top: 10px;
}

.login-footer-text a {
    color: var(--primary) !important;
    font-weight: 600;
}

.login-footer-text a:hover {
    text-decoration: underline;
}

/* ========================
   Страница регистрации
   ======================== */
.reg-page {
    width: 100%;
    padding: 10px 0 40px;
}

.reg-header {
    margin-bottom: 28px;
}

.reg-title {
    font-size: 1.8rem;
    font-weight: 800;
    color: var(--text);
    letter-spacing: -0.02em;
    margin-bottom: 6px;
}

.reg-subtitle {
    font-size: .95rem;
    color: var(--text-muted);
}

.reg-form-wrap {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 16px;
    padding: 28px;
}

.reg-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0 14px;
}

.reg-field {
    margin-bottom: 16px;
}

.reg-label {
    display: block;
    font-size: .82rem;
    font-weight: 600;
    color: var(--text-secondary);
    margin-bottom: 6px;
}

.reg-submit-wrap {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 14px;
    margin-top: 50px;
    flex-wrap: wrap;
}

.reg-submit-wrap .reg-submit-btn-add {
    margin-left: 0;
}

.profile-seo-section {
    margin-top: 24px;
    padding-top: 24px;
    border-top: 1px solid var(--border, #e9ecef);
}

.profile-seo-section:first-child {
    margin-top: 0;
    padding-top: 0;
    border-top: none;
}

.profile-seo-title {
    font-size: 1rem;
    margin-bottom: 8px;
}

.profile-seo-hint {
    font-size: 0.9rem;
    color: var(--text-muted);
    margin-bottom: 16px;
}

/* Кнопка «Сохранить» во вкладке Метатеги — компактнее */
#tab-seo .reg-submit-wrap .reg-submit,
#tab-seo .login-submit {
    padding: 8px 18px;
    font-size: 0.9rem;
    max-width: none;
}

/* ========================
   Addnews / Profile Add
   ======================== */
.addnews-page {
    max-width: 720px;
    margin: 0 auto;
    padding: 24px 0 48px;
}

.addnews-card {
    background: var(--bg-card);
    border-radius: var(--radius, 12px);
    box-shadow: var(--shadow-lg);
    padding: 28px 32px;
    border: 1px solid var(--border);
}

.addnews-header {
    margin-bottom: 24px;
}

.addnews-header h1 {
    font-size: 1.5rem;
    margin-bottom: 6px;
    display: flex;
    align-items: center;
    gap: 10px;
}

.addnews-header h1 i {
    color: var(--primary);
}

.addnews-subtitle {
    font-size: 0.95rem;
    color: var(--text-secondary);
}

.addnews-form .form-group {
    margin-bottom: 18px;
}

.addnews-form .form-label {
    display: block;
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--text-secondary);
    margin-bottom: 6px;
}

.addnews-form .form-label .required {
    color: var(--red);
}

.addnews-form .form-control {
    width: 100%;
    padding: 10px 14px;
    font-size: 1rem;
    border: 1px solid var(--border);
    border-radius: 10px;
    background: var(--bg);
    color: var(--text);
    transition: border-color .2s, box-shadow .2s;
}

.addnews-form .form-control:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px var(--primary-light);
}

.addnews-form textarea.form-control {
    min-height: 100px;
    resize: vertical;
}

.addnews-options {
    margin-bottom: 20px;
}

.addnews-options .form-check {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    font-size: 0.95rem;
}

.addnews-options .form-check input {
    cursor: pointer;
}

.addnews-actions {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
    margin-bottom: 16px;
}

.addnews-note {
    font-size: 0.88rem;
    color: var(--text-muted);
}

.addnews-note i {
    margin-right: 6px;
    color: var(--primary);
}

.addnews-denied {
    text-align: center;
    padding: 32px 24px;
}

.addnews-denied .denied-icon {
    font-size: 3rem;
    color: var(--text-muted);
    margin-bottom: 16px;
}

.addnews-denied h2 {
    font-size: 1.25rem;
    margin-bottom: 8px;
}

.addnews-denied p {
    color: var(--text-secondary);
    margin-bottom: 20px;
}

.reg-submit-wrap .login-field {
    flex: 1;
    margin-bottom: 0;
}

.reg-submit {
    max-width: 280px;
    flex-shrink: 0;
}

.reg-footer {
    text-align: center;
    margin-top: 20px;
    font-size: .9rem;
    color: var(--text-muted);
}

.reg-footer a {
    color: var(--primary) !important;
    font-weight: 600;
}

.reg-footer a:hover {
    text-decoration: underline;
}

/* Select стилизация */
.login-select {
    appearance: none;
    -webkit-appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8'%3E%3Cpath d='M1 1l5 5 5-5' stroke='%2394a3b8' stroke-width='1.5' fill='none' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 16px center;
    padding-right: 40px;
    cursor: pointer;
}

.login-select.is-invalid {
    border-color: var(--red);
    box-shadow: 0 0 0 3px var(--red-light);
}

/* Блок правил сайта */
.reg-rules-box {
    margin-bottom: 14px;
    padding: 14px 16px;
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: 12px;
    max-height: 140px;
    overflow-y: auto;
}

.reg-rules-text {
    font-size: .82rem;
    line-height: 1.6;
    color: var(--text-secondary);
}

/* Чекбокс «Я принимаю правила» — как toggle */
.reg-rules-check {
    display: flex;
    align-items: center;
    gap: 10px;
    cursor: pointer;
    font-size: .88rem;
    color: var(--text-secondary);
    user-select: none;
    margin-bottom: 20px;
}

.reg-rules-check input[type="checkbox"] {
    display: none;
}

.reg-rules-check input:checked~.login-toggle {
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
}

.reg-rules-check input:checked~.login-toggle::after {
    transform: translateX(20px);
}


/* ========================
   Страница профиля
   ======================== */
.profile-page {
    width: 100%;
    max-width: none;
    margin: -20px 0 0;
}

/* Cover */
.profile-cover {
    position: relative;
    height: 220px;
    border-radius: 16px 16px 0 0;
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    background-size: cover;
    background-position: center;
}

.profile-cover-btn {
    position: absolute;
    top: 16px;
    right: 16px;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 8px 16px;
    background: rgba(0, 0, 0, .45);
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
    color: #fff;
    border-radius: 10px;
    font-size: .82rem;
    font-weight: 600;
    cursor: pointer;
    transition: background .2s;
}

.profile-cover-btn:hover {
    background: rgba(0, 0, 0, .65);
}

/* Head — avatar + info + stats */
.profile-head {
    display: flex;
    align-items: flex-end;
    gap: 24px;
    padding: 0 28px 24px;
    margin-top: -50px;
    position: relative;
    z-index: 2;
    flex-wrap: wrap;
}

.profile-avatar-wrap {
    position: relative;
    width: 110px;
    height: 110px;
    border-radius: 50%;
    border: 4px solid var(--bg-card);
    background: var(--bg-card);
    flex-shrink: 0;
    overflow: visible;
    box-shadow: 0 4px 16px rgba(0, 0, 0, .12);
}

.profile-online-dot {
    position: absolute;
    bottom: 2px;
    right: 2px;
    width: 14px;
    height: 14px;
    border-radius: 50%;
    background: #22c55e;
    border: 2px solid #fff;
    box-sizing: border-box;
    z-index: 3;
    display: block;
    box-shadow: 0 0 0 1px rgba(0, 0, 0, .1);
}

.profile-online-badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    color: #16a34a;
    font-size: .8rem;
    font-weight: 600;
    margin-left: 6px;
}

.profile-online-badge i.fa-circle {
    font-size: 6px;
    color: #22c55e;
}

.profile-avatar-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 50%;
}

.profile-avatar-placeholder {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2.4rem;
    font-weight: 800;
    color: #fff;
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    border-radius: 50%;
}

.profile-avatar-edit {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(0, 0, 0, .45);
    color: #fff;
    font-size: 1.3rem;
    border-radius: 50%;
    opacity: 0;
    cursor: pointer;
    transition: opacity .25s;
}

.profile-avatar-wrap:hover .profile-avatar-edit {
    opacity: 1;
}

/* Info */
.profile-head-info {
    flex: 1;
    min-width: 180px;
    padding-bottom: 6px;
}

.profile-name {
    font-size: 1.6rem;
    font-weight: 800;
    color: var(--text);
    letter-spacing: -0.02em;
    margin-bottom: 4px;
}

.profile-meta {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}

.profile-login {
    font-size: .9rem;
    color: var(--text-muted);
}

.profile-role {
    display: inline-block;
    padding: 3px 10px;
    border-radius: 8px;
    font-size: .75rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .04em;
}

.badge-primary {
    background: var(--primary-light);
    color: var(--primary);
}

.badge-danger {
    background: var(--red-light);
    color: var(--red);
}

.badge-warning {
    background: rgba(245, 158, 11, .1);
    color: var(--orange);
}

.badge-info {
    background: rgba(59, 130, 246, .1);
    color: #3b82f6;
}

.badge-success {
    background: var(--green-light);
    color: var(--green);
}

/* Stats */
.profile-stats {
    display: flex;
    gap: 24px;
    margin-left: auto;
    padding-bottom: 6px;
}

.profile-stat {
    text-align: center;
}

.profile-stat-value {
    font-size: 1rem;
    font-weight: 700;
    color: var(--text);
}

.profile-stat-label {
    font-size: .75rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: .03em;
}

/* Tabs */
.profile-tabs {
    display: flex;
    gap: 4px;
    margin-bottom: 20px;
    border-bottom: 2px solid var(--border);
    padding-bottom: 0;
}

.profile-tab {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 12px 20px;
    border: none;
    background: none;
    font-size: .92rem;
    font-weight: 600;
    font-family: var(--font);
    color: var(--text-muted);
    cursor: pointer;
    position: relative;
    transition: color .2s;
    border-bottom: 2px solid transparent;
    margin-bottom: -2px;
}

.profile-tab i {
    font-size: .9rem;
}

.profile-tab:hover {
    color: var(--text);
}

.profile-tab.active {
    color: var(--primary);
    border-bottom-color: var(--primary);
}

.profile-tab .profile-badge {
    font-size: .7rem;
    padding: 1px 8px;
}

/* Tab panels */
.profile-tab-panel {
    display: none;
    animation: loginViewIn .3s ease;
}

.profile-tab-panel.active {
    display: block;
}

/* Sections */
.profile-section {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 16px;
    padding: 28px;
    margin-bottom: 20px;
}

.profile-section-title {
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--text);
    margin-bottom: 20px;
    display: flex;
    align-items: center;
    gap: 10px;
}

.profile-section-title i {
    color: var(--primary);
}

/* Публикации пользователя на странице профиля — грид 4 колонки */
.profile-user-posts {
    padding: 0 28px 24px;
}

.profile-posts-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 1.25rem;
    margin-top: 1rem;
}

.profile-posts-pagination {
    margin-top: 1.5rem;
    display: flex;
    justify-content: center;
}

/* Таблица «Мои заказы» в профиле */
.profile-orders-table-wrap {
    overflow-x: auto;
    margin: 0 -4px;
}

.profile-orders-table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    font-size: 0.95rem;
}

.profile-orders-table th,
.profile-orders-table td {
    padding: 12px 16px;
    text-align: left;
    vertical-align: middle;
    border-bottom: 1px solid var(--border, #e9ecef);
}

.profile-orders-table th {
    font-weight: 600;
    color: var(--text-muted, #6c757d);
    font-size: 0.85rem;
    text-transform: uppercase;
    letter-spacing: 0.02em;
}

.profile-orders-table tbody tr:hover {
    background: var(--hover-bg, rgba(0, 0, 0, .02));
}

.profile-orders-table td:first-child {
    font-weight: 600;
}

.profile-orders-table td:nth-child(4) {
    white-space: nowrap;
}

.profile-orders-table td:last-child {
    text-align: right;
    white-space: nowrap;
    padding-right: 8px;
}

.profile-orders-table .btn {
    min-width: 100px;
}

.profile-badge {
    font-size: .75rem;
    font-weight: 700;
    padding: 2px 10px;
    border-radius: 8px;
    background: var(--primary-light);
    color: var(--primary);
}

.profile-badge-warning {
    background: rgba(245, 158, 11, .1);
    color: var(--orange);
}

/* Remove avatar toggle */
.profile-remove-avatar {
    display: flex;
    align-items: center;
    gap: 10px;
    cursor: pointer;
    font-size: .88rem;
    color: var(--text-secondary);
    user-select: none;
    margin-bottom: 16px;
}

.profile-remove-avatar input[type="checkbox"] {
    display: none;
}

.profile-remove-avatar input:checked~.login-toggle {
    background: var(--red);
}

.profile-remove-avatar input:checked~.login-toggle::after {
    transform: translateX(20px);
}

/* Hint text */
.reg-hint {
    display: block;
    margin-top: 6px;
    font-size: .78rem;
    color: var(--text-muted);
}

/* Favorites list */
.favorites-list {
    list-style: none;
}

.favorites-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 0;
    border-bottom: 1px solid var(--border);
    transition: opacity .3s;
}

.favorites-item:last-child {
    border-bottom: none;
}

.favorites-link {
    flex: 1;
    color: var(--text) !important;
    font-weight: 500;
}

.favorites-link:hover {
    color: var(--primary) !important;
}

.favorites-date {
    font-size: .8rem;
    color: var(--text-muted);
    white-space: nowrap;
}

.favorites-remove {
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: none;
    border-radius: 8px;
    background: var(--red-light);
    color: var(--red);
    cursor: pointer;
    font-size: .85rem;
    transition: background .2s;
}

.favorites-remove:hover {
    background: var(--red);
    color: #fff;
}

.profile-empty {
    color: var(--text-muted);
    font-size: .9rem;
}

/* Pending list */
.pending-list {
    list-style: none;
}

.pending-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 0;
    border-bottom: 1px solid var(--border);
}

.pending-item:last-child {
    border-bottom: none;
}

.pending-link {
    flex: 1;
    font-weight: 500;
    color: var(--text);
}

.pending-date {
    font-size: .8rem;
    color: var(--text-muted);
    white-space: nowrap;
}

/* Guest avatar icon */
.header-avatar-guest {
    background: var(--primary-light);
    color: var(--primary) !important;
}

.header-avatar-guest i {
    font-size: .95rem;
}

/* ========================
   Профиль — адаптив
   ======================== */
@media (max-width: 768px) {
    .profile-cover {
        height: 160px;
        border-radius: 0;
    }

    .profile-head {
        flex-direction: column;
        align-items: center;
        text-align: center;
        gap: 16px;
        padding: 0 16px 20px;
        margin-top: -40px;
    }

    .profile-head-info {
        min-width: auto;
    }

    .profile-meta {
        justify-content: center;
    }

    .profile-stats {
        margin-left: 0;
        justify-content: center;
    }

    .profile-tabs {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }

    .profile-tab {
        padding: 10px 14px;
        font-size: .84rem;
        white-space: nowrap;
    }

    .profile-section {
        padding: 20px;
        border-radius: 12px;
    }

    .profile-posts-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .profile-avatar-wrap {
        width: 90px;
        height: 90px;
    }
}

@media (max-width: 420px) {
    .profile-cover {
        height: 120px;
    }

    .profile-posts-grid {
        grid-template-columns: 1fr;
    }

    .profile-stats {
        gap: 16px;
    }

    .profile-cover-btn span {
        display: none;
    }
}

/* ========================
   Cabinet — адаптив
   ======================== */
@media (max-width: 420px) {
    .cabinet-modal {
        width: 100%;
        max-width: 100vw;
        max-height: 100vh;
        border-radius: 0;
    }

    .cabinet-hero {
        padding: 20px 20px 24px;
    }

    .cabinet-menu {
        margin: 12px;
    }

    .cabinet-footer {
        padding: 14px 20px 22px;
        flex-direction: column;
    }

    .login-modal {
        width: 100%;
        max-width: 100vw;
        max-height: 100vh;
        border-radius: 0;
    }

    .login-hero {
        padding: 22px 20px 16px;
    }

    .login-body {
        padding: 4px 20px 24px;
    }

    .reg-form-wrap {
        padding: 20px;
        border-radius: 12px;
    }

    .reg-row {
        grid-template-columns: 1fr;
    }

    .reg-submit {
        max-width: 100%;
    }
}

/* ========================
   Burger button (mobile menu trigger)
   ======================== */
.burger-btn {
    display: none;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    gap: 6px;
    width: 44px;
    height: 44px;
    padding: 0;
    border: none;
    background: var(--bg);
    border-radius: var(--radius);
    cursor: pointer;
    transition: background .2s;
}

.burger-btn:hover {
    background: var(--border);
}

.burger-line {
    display: block;
    width: 20px;
    height: 2px;
    background: var(--text);
    border-radius: 1px;
    transition: transform .3s, opacity .3s;
}

.burger-btn.active .burger-line:nth-child(1) {
    transform: translateY(7.5px) rotate(45deg);
}

.burger-btn.active .burger-line:nth-child(2) {
    opacity: 0;
}

.burger-btn.active .burger-line:nth-child(3) {
    transform: translateY(-7.5px) rotate(-45deg);
}

/* ========================
   Mobile Menu Overlay + Drawer
   ======================== */
.mobile-menu-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, .45);
    z-index: 999;
    opacity: 0;
    transition: opacity .3s;
}

.mobile-menu-overlay.open {
    display: block;
    opacity: 1;
}

.mobile-menu {
    position: fixed;
    top: 0;
    left: 0;
    width: 300px;
    max-width: 85vw;
    height: 100%;
    background: var(--bg-card);
    z-index: 1000;
    transform: translateX(-100%);
    transition: transform .3s cubic-bezier(.4, 0, .2, 1);
    display: flex;
    flex-direction: column;
    box-shadow: 4px 0 24px rgba(0, 0, 0, .15);
    overflow: hidden;
}

.mobile-menu.open {
    transform: translateX(0);
}

.mobile-menu-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 20px;
    border-bottom: 1px solid var(--border);
    flex-shrink: 0;
}

.mobile-menu-title {
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--text);
}

.mobile-menu-close {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    border: none;
    background: var(--bg);
    border-radius: 50%;
    cursor: pointer;
    color: var(--text);
    font-size: 1.1rem;
    transition: background .15s;
}

.mobile-menu-close:hover {
    background: var(--border);
}

.mobile-menu-search {
    padding: 12px 16px;
    border-bottom: 1px solid var(--border);
    flex-shrink: 0;
}

.mobile-search-input {
    width: 100%;
    padding: 10px 14px;
    border: 1px solid var(--border);
    border-radius: 10px;
    background: var(--bg);
    color: var(--text);
    font-size: .92rem;
    outline: none;
    transition: border-color .2s;
}

.mobile-search-input:focus {
    border-color: var(--primary);
}

.mobile-menu-body {
    flex: 1;
    overflow-y: auto;
    padding: 8px 0;
    -webkit-overflow-scrolling: touch;
}

.mobile-menu-body>* {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.mobile-menu-body a {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 20px;
    color: var(--text) !important;
    font-size: .95rem;
    font-weight: 500;
    text-decoration: none !important;
    transition: background .15s;
}

.mobile-menu-body a:hover,
.mobile-menu-body a:active {
    background: var(--bg);
}

.mobile-menu-body a i.fa-solid {
    width: 20px;
    text-align: center;
    color: var(--text-muted);
    font-size: .9rem;
}

/* ========================
   Post Rating — Likes
   ======================== */
.post-rating-likes {
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.post-vote-btn {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 6px 14px;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: var(--bg-card);
    color: var(--text-secondary);
    font-size: .88rem;
    cursor: pointer;
    transition: all .2s;
}

.post-vote-btn:hover {
    border-color: var(--primary);
    color: var(--primary);
}

.post-vote-btn.vote-dislike:hover {
    border-color: var(--red);
    color: var(--red);
}

.post-vote-count {
    font-weight: 600;
}

/* ========================
   Post Rating — Stars (SVG sprite: rating.svg)
   Sprite layout (17×51): gray 0, orange -17px, gold -34px
   ======================== */
.post-rating-stars {
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.post-stars-input {
    display: inline-flex;
    gap: 2px;
}

.post-star-btn {
    background: none;
    border: none;
    padding: 2px;
    cursor: pointer;
    transition: transform .15s;
    line-height: 0;
}

.star-icon {
    display: inline-block;
    width: 17px;
    height: 17px;
    background: url('../images/rating.svg') no-repeat 0 0;
    background-size: 17px 51px;
}

.post-star-btn.active .star-icon {
    background-position: 0 -34px;
}

.post-star-btn:hover {
    transform: scale(1.2);
}

.post-stars-input:hover .star-icon {
    background-position: 0 -17px;
}

.post-stars-input .post-star-btn:hover~.post-star-btn .star-icon {
    background-position: 0 0;
}

.post-star-btn.hovered .star-icon {
    background-position: 0 -17px;
}

.post-stars-info {
    font-size: .85rem;
    color: var(--text-muted);
    font-weight: 500;
}

.post-stars-avg {
    font-weight: 700;
    color: var(--text);
}

.post-rating-stars .post-stars-label {
    font-size: .85rem;
    color: var(--text-muted);
}

/* Full page — bigger stars */
.post-rating-stars--full .star-icon {
    width: 22px;
    height: 22px;
    background-size: 22px 66px;
}

.post-rating-stars--full .post-star-btn.active .star-icon {
    background-position: 0 -44px;
}

.post-rating-stars--full .post-stars-input:hover .star-icon {
    background-position: 0 -22px;
}

.post-rating-stars--full .post-stars-input .post-star-btn:hover~.post-star-btn .star-icon {
    background-position: 0 0;
}

.post-rating-stars--full .post-star-btn.hovered .star-icon {
    background-position: 0 -22px;
}

/* ========================
   Search page (search.tpl)
   ======================== */
.search-page {
    width: 100%;
    margin: 0 auto;
    padding: 24px 0;
}

.search-header {
    margin-bottom: 24px;
}

.search-header h1 {
    font-size: 1.75rem;
    font-weight: 700;
    color: var(--text-heading, var(--text, #1a1a1a));
    display: flex;
    align-items: center;
    gap: 10px;
}

.search-header h1 i {
    color: var(--primary, var(--accent, #0d9488));
}

.search-form {
    margin-bottom: 28px;
}

.search-input-wrap {
    display: flex;
    align-items: stretch;
    gap: 0;
    border-radius: 10px;
    overflow: hidden;
    border: 1px solid var(--border, var(--border-color, #e0e0e0));
    background: var(--bg, var(--bg-card, #fff));
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.06);
}

.search-input {
    flex: 1;
    min-width: 0;
    padding: 12px 16px;
    border: none;
    background: transparent;
    color: var(--text, #1a1a1a);
    font-size: 1rem;
    outline: none;
}

.search-input::placeholder {
    color: var(--text-muted, #888);
}

.search-input-wrap:focus-within {
    border-color: var(--primary, var(--accent, #0d9488));
    box-shadow: 0 0 0 2px rgba(13, 148, 136, 0.15);
}

.search-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 12px 20px;
    background: var(--primary, var(--accent, #0d9488));
    color: #fff;
    border: none;
    font-size: 0.95rem;
    font-weight: 600;
    cursor: pointer;
    transition: background .2s, opacity .2s;
}

.search-btn:hover {
    opacity: 0.92;
    background: var(--primary-dark, #0f766e);
}

.search-results-info {
    display: flex;
    flex-wrap: nowrap;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 16px;
    font-size: 0.95rem;
    color: var(--text-secondary, #555);
}

.search-results-info>span:first-child {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.search-count {
    color: var(--text-muted, #666);
}

.search-results {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 20px;
    margin-bottom: 24px;
}

@media (max-width: 992px) {
    .search-results {
        grid-template-columns: repeat(3, 1fr);
    }
}

@media (max-width: 640px) {
    .search-results {
        grid-template-columns: repeat(2, 1fr);
        gap: 12px;
    }
}

@media (max-width: 400px) {
    .search-results {
        grid-template-columns: 1fr;
    }
}

.search-pagination {
    margin-top: 20px;
}

.search-empty {
    text-align: center;
    padding: 40px 20px;
    color: var(--text-secondary, #555);
}

.search-empty-icon {
    font-size: 3rem;
    color: var(--text-muted, #999);
    margin-bottom: 12px;
}

.search-empty h2 {
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--text, #1a1a1a);
    margin-bottom: 8px;
}

/* ========================
   Post Review Summary (блок рейтинга отзывов)
   addcomments-review.tpl → [has_review_rating] {post_review_rating_summary}
   ======================== */
.post-review-summary {
    margin-bottom: 24px;
    padding: 20px;
    background: var(--bg-card, #fff);
    border: 1px solid var(--border);
    border-radius: var(--radius, 8px);
}

.post-review-summary-title {
    font-size: 1.15rem;
    font-weight: 700;
    margin: 0 0 14px 0;
    color: var(--text);
}

.post-review-summary-top {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 12px;
    margin-bottom: 16px;
}

.post-review-summary-num {
    font-size: 1.75rem;
    font-weight: 700;
    color: var(--text);
}

.post-review-summary-stars {
    display: inline-flex;
    gap: 2px;
    color: #f59e0b;
    font-size: 1.25rem;
}

.post-review-summary-stars .fa-star-half-stroke {
    margin-left: -2px;
}

.post-review-summary-votes {
    font-size: 0.9rem;
    color: var(--text-muted);
}

.post-review-summary-bars {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.post-review-bar-row {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 0.85rem;
}

.post-review-bar-label {
    flex: 0 0 1.2em;
    font-weight: 600;
    color: var(--text);
}

.post-review-bar-track {
    flex: 1;
    height: 10px;
    background: var(--border);
    border-radius: 5px;
    overflow: hidden;
    min-width: 60px;
}

.post-review-bar-fill {
    height: 100%;
    border-radius: 5px;
    transition: width 0.2s ease;
}

.post-review-bar-5 {
    background: #22c55e;
}

.post-review-bar-4 {
    background: #84cc16;
}

.post-review-bar-3 {
    background: #eab308;
}

.post-review-bar-2 {
    background: #f97316;
}

.post-review-bar-1 {
    background: #ef4444;
}

.post-review-bar-votes {
    flex: 0 0 auto;
    color: var(--text-muted);
    white-space: nowrap;
}

/* Обёртка рейтинга в двухколоночном режиме отзывов */
.comments-layout--review .comments-review-summary-wrap {
    margin-bottom: 24px;
}

/* ========================
   Language Dropdown
   ======================== */
.lang-dropdown {
    position: relative;
}

.lang-toggle {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 10px;
    border: 1px solid var(--border);
    border-radius: 10px;
    background: var(--bg-card);
    color: var(--text-secondary);
    font-size: .82rem;
    font-weight: 600;
    letter-spacing: .04em;
    cursor: pointer;
    transition: border-color .2s, color .2s, background .2s;
    line-height: 1;
}

.lang-toggle:hover {
    border-color: var(--text-muted);
    color: var(--text);
    background: transparent;
}

.lang-toggle .lang-flag {
    width: 20px;
    height: 14px;
    border-radius: 2px;
    object-fit: cover;
    flex-shrink: 0;
}

.lang-dropdown-menu {
    display: none;
    position: absolute;
    top: calc(100% + 8px);
    right: 0;
    min-width: 160px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 12px;
    box-shadow: var(--shadow-lg);
    z-index: 300;
    padding: 6px;
    opacity: 0;
    transform: translateY(-6px);
    transition: opacity .2s, transform .2s;
}

.lang-dropdown-menu.show {
    display: block;
    opacity: 1;
    transform: translateY(0);
}

.lang-dropdown-item {
    display: flex;
    align-items: center;
    gap: 10px;
    width: 100%;
    padding: 9px 12px;
    border: none;
    background: none;
    color: var(--text) !important;
    font-size: .88rem;
    font-weight: 500;
    border-radius: 8px;
    cursor: pointer;
    transition: background .15s, color .15s;
    text-decoration: none !important;
    line-height: 1.3;
}

.lang-dropdown-item:hover {
    background: var(--bg);
    color: var(--text) !important;
}

.lang-dropdown-item-active {
    color: var(--text-muted) !important;
    cursor: default;
}

.lang-dropdown-item .lang-flag {
    width: 20px;
    height: 14px;
    border-radius: 2px;
    object-fit: cover;
    flex-shrink: 0;
}

.lang-code-sm {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 28px;
    height: 20px;
    font-size: .7rem;
    font-weight: 700;
    background: var(--bg);
    border-radius: 5px;
    color: var(--text-muted);
    letter-spacing: .04em;
    flex-shrink: 0;
}

.lang-name {
    flex: 1;
}

.lang-check {
    font-size: .7rem;
    color: var(--text-secondary);
    margin-left: auto;
}

.lang-dropdown.names-only .lang-toggle .lang-flag {
    display: none;
}

.lang-dropdown.flags-only .lang-code {
    display: none;
}

.lang-dropdown.flags-only .lang-name {
    display: none;
}

/* ========================
   Header — Phone
   ======================== */
.header-phone {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 8px 16px;
    border-radius: 24px;
    background: var(--bg);
    border: 1px solid var(--border);
    color: var(--text) !important;
    font-size: .9rem;
    font-weight: 600;
    white-space: nowrap;
    transition: border-color .2s, background .2s;
    text-decoration: none !important;
}

.header-phone i {
    color: var(--text-muted);
    font-size: .85rem;
}

.header-phone:hover {
    border-color: var(--text-muted);
    background: var(--bg-card);
}

/* ========================
   Sort — выпадающий список при наведении (постоянный стиль шаблона)
   ======================== */
.posts-sort {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: .9rem;
    flex-shrink: 0;
    padding: 10px 0;
}

.posts-sort .sort-label {
    color: var(--text-muted);
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.posts-sort .sort-label-icon {
    font-size: .95em;
    color: var(--text-muted);
    flex-shrink: 0;
}

.posts-sort .sort-dropdown {
    display: inline-flex;
    align-items: center;
    gap: 12px;
}

.posts-sort .sort-dropdown-inner {
    position: relative;
}

.posts-sort .sort-dropdown-trigger {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    color: var(--text-muted);
    font-weight: 500;
    cursor: default;
    padding: 4px 8px 4px 0;
}

.posts-sort .sort-dropdown-arrow {
    font-size: .65em;
    opacity: .8;
    transition: transform .2s;
}

.posts-sort .sort-dropdown-inner:hover .sort-dropdown-arrow {
    transform: rotate(180deg);
}

.posts-sort .sort-dropdown-menu {
    position: absolute;
    top: 100%;
    left: 0;
    min-width: 100%;
    margin-top: 0;
    padding: 8px 0 6px;
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow-lg);
    z-index: 50;
    display: none;
    flex-direction: column;
}

.posts-sort .sort-dropdown-inner:hover .sort-dropdown-menu {
    display: flex;
}

.posts-sort .sort-dropdown-item {
    display: block;
    padding: 8px 14px;
    font-size: .9rem;
    color: var(--text-secondary);
    text-decoration: none;
    white-space: nowrap;
    transition: background .15s, color .15s;
}

.posts-sort .sort-dropdown-item:hover {
    background: var(--primary-light);
    color: var(--primary);
}

.posts-sort .sort-dropdown-item--active {
    color: var(--primary);
    font-weight: 600;
}

/* ========================
   Listing toolbar: sort + filter button
   ======================== */
.listing-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    flex-wrap: wrap;
}

.listing-toolbar__sort {
    flex: 1 1 auto;
    min-width: 0;
}

.listing-toolbar__filter {
    flex-shrink: 0;
}

.filter-trigger-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 8px 14px;
    font-size: .9rem;
    font-weight: 500;
    color: var(--text-secondary);
    background: var(--bg-card);
    border: none;
    border-radius: var(--radius);
    cursor: pointer;
    transition: background .2s, color .2s;
}

.filter-trigger-btn:hover {
    color: var(--primary);
}

.filter-trigger-btn i {
    font-size: 1em;
}

.filter-trigger-btn__label {
    white-space: nowrap;
}

/* Контейнер листинга для AJAX-фильтра */
#listing-ajax-container {
    position: relative;
}

#listing-ajax-container.listing-ajax-loading {
    min-height: 100px;
    pointer-events: none;
}

#listing-ajax-container.listing-ajax-loading .content-grid,
#listing-ajax-container.listing-ajax-loading #listing-pagination-wrap {
    opacity: 0.5;
    transition: opacity .2s;
}

/* ========================
   Filter block — раскрывается под кнопкой, свайп вниз чтобы закрыть
   ======================== */
.filter-drawer {
    margin-top: 0;
    margin-bottom: 20px;
}

.filter-drawer__panel {
    display: flex;
    flex-direction: column;
    overflow: hidden;
    max-height: 0;
    transition: max-height .3s cubic-bezier(0.4, 0, 0.2, 1);
}

.filter-drawer.is-open .filter-drawer__panel {
    max-height: 80vh;
}

.filter-drawer__handle {
    flex-shrink: 0;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: grab;
    touch-action: none;
}

.filter-drawer__handle::before {
    content: '';
    width: 40px;
    height: 4px;
    background: var(--border);
    border-radius: 2px;
    transition: background .2s;
}

.filter-drawer__handle:hover::before,
.filter-drawer__handle:active::before {
    background: var(--text-muted);
}

.filter-drawer__body {
    min-height: 0;
}

.filter-drawer__header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 20px 16px;
    border-bottom: 1px solid var(--border);
    flex-shrink: 0;
    background: var(--bg);
}

.filter-drawer__title {
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--text);
    display: inline-flex;
    align-items: center;
    gap: 10px;
}

.filter-drawer__title i {
    color: var(--primary);
    font-size: 1rem;
}

.filter-drawer__close {
    width: 40px;
    height: 40px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    border: none;
    background: transparent;
    color: var(--text-muted);
    border-radius: 10px;
    cursor: pointer;
    transition: background .15s, color .15s;
}

.filter-drawer__close:hover {
    background: var(--bg-card);
    color: var(--text);
}

.filter-drawer__body {
    flex: 1;
    overflow-y: auto;
    padding: 24px 20px;
    -webkit-overflow-scrolling: touch;
}

.filter-drawer__body .filter-form,
.filter-drawer__body .filter-sheet .filter-form {
    margin: 0;
    padding: 0;
    border: none;
    background: transparent;
}

.filter-drawer__body .filter-widget,
.filter-drawer__body .filter-sheet .filter-widget {
    padding: 0;
}

.filter-drawer__body .filter-widget__header {
    display: none;
}

.filter-drawer__body .filter-widget--collapsible .filter-widget__header {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 10px 14px;
    margin-bottom: 16px;
    padding-bottom: 12px;
    border-bottom: 1px solid var(--border);
}

.filter-drawer__body .filter-widget--collapsible .filter-widget__title {
    font-size: 1rem;
    font-weight: 600;
    color: var(--text);
}

.filter-drawer__body .filter-widget__clear {
    margin-left: auto;
    font-size: .9rem;
    color: var(--text-muted);
    text-decoration: none;
    padding: 6px 10px;
    border-radius: 8px;
    transition: color .2s, background .2s;
}

.filter-drawer__body .filter-widget__clear:hover {
    color: var(--primary);
    background: var(--primary-light, rgba(0,0,0,.04));
}

.filter-drawer__body .filter-widget__toggle {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 10px;
    font-size: .9rem;
    color: var(--text-muted);
    background: transparent;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    transition: color .2s, background .2s;
}

.filter-drawer__body .filter-widget__toggle:hover {
    color: var(--primary);
    background: var(--primary-light, rgba(0,0,0,.04));
}

.filter-drawer__body .filter-widget--collapsible.is-collapsed .filter-widget__body {
    display: none;
}

/* Кастомна форма фільтра: .filter .filter__col .filter__cell (main-filter-2.tpl тощо) */
.filter-drawer__body .filter-sheet .filter.d-flex,
.filter-drawer__body .filter.d-flex {
    display: flex;
    flex-wrap: wrap;
    gap: 16px 20px;
    align-items: flex-start;
}

.filter-drawer__body .filter__col {
    display: flex;
    flex-wrap: wrap;
    gap: 12px 16px;
    align-items: flex-start;
    min-width: 0;
}

.filter-drawer__body .filter__col--ranges {
    flex: 1 1 100%;
}

.filter-drawer__body .filter__col--submit {
    flex: 1 1 100%;
    margin-top: 8px;
    padding-top: 12px;
    border-top: 1px solid var(--border);
}

.filter-drawer__body .filter__cell {
    min-width: 0;
    flex: 1 1 140px;
}

/* Плитки розмірів (filter_field variant="buttons") — клас filter__cell--size-chips лише в розмітці; не додавати flex:100% на клітинку, інакше зламаються 2 колонки */
.filter-size-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 6px 8px;
    width: 100%;
}

.filter-size-chips__item {
    position: relative;
    cursor: pointer;
    margin: 0;
}

.filter-size-chips__input {
    position: absolute;
    opacity: 0;
    width: 1px;
    height: 1px;
    margin: 0;
    pointer-events: none;
}

.filter-size-chips__face {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 32px;
    min-height: 32px;
    padding: 0 8px;
    box-sizing: border-box;
    font-size: 12px;
    font-weight: 500;
    color: var(--text, #1e293b);
    background: #fff;
    border: 1px solid var(--border, #e2e8f0);
    border-radius: 6px;
    transition: border-color 0.2s, box-shadow 0.2s, color 0.2s;
}

.filter-size-chips__item:hover .filter-size-chips__face {
    border-color: var(--text-muted, #94a3b8);
}

.filter-size-chips__input:focus-visible + .filter-size-chips__face {
    outline: 2px solid var(--primary, #7495a8);
    outline-offset: 2px;
}

.filter-size-chips__input:checked + .filter-size-chips__face {
    border-color: var(--primary, #7495a8);
    box-shadow: 0 0 0 1px var(--primary, #7495a8);
    color: var(--primary-dark, #5a7a8c);
}

.filter-sheet .filter-size-chips,
.filter-drawer__body .filter-size-chips {
    width: 100%;
}

.filter-drawer__body .filter__cell--submit {
    display: flex;
    flex-direction: column;
    gap: 10px;
    flex: 0 1 auto;
}

.filter-drawer__body .filter__cell--clear,
.filter-sheet .filter__cell--clear {
    display: flex;
    justify-content: center;
    align-items: center;
    flex: 1 1 100%;
}

/* Кілька дій у рядку: Очистити + Згорнути */
.filter-drawer__body .filter__cell--actions,
.filter-sheet .filter__cell--actions {
    flex-wrap: wrap;
    gap: 10px 12px;
}

.filter-drawer__body .filter-drawer-collapse-btn,
.filter-sheet .filter-drawer-collapse-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    min-height: 40px;
    padding: 8px 16px;
    font-size: 0.95rem;
    cursor: pointer;
}

.filter-drawer__body .filter-drawer-collapse-btn__icon,
.filter-sheet .filter-drawer-collapse-btn__icon {
    font-size: 0.85em;
    opacity: 0.9;
}

.filter-clear-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 12px;
    font-size: 0.85rem;
    text-decoration: none;
    border-radius: 8px;
    border: 1px solid var(--border, #ddd);
    background: #fff;
    color: var(--text-secondary, #555);
    transition: background .2s, color .2s, border-color .2s;
}

.filter-clear-btn:hover {
    color: var(--primary, #444);
}

.filter-clear-btn .filter-clear-icon {
    font-size: 0.9em;
    opacity: 0.9;
}

.filter-drawer__body .filter__label {
    display: block;
    font-size: .8rem;
    font-weight: 600;
    color: var(--text);
    margin-bottom: 6px;
    letter-spacing: 0.02em;
}

.filter-drawer__body .filter__cell .filter-select-input,
.filter-drawer__body .filter__cell .filter-text-input,
.filter-drawer__body .filter__cell .filter-range__inputs,
.filter-drawer__body .filter__cell .filter-date-range,
.filter-drawer__body .filter__cell .filter-colors {
    width: 100%;
    min-width: 0;
}

.filter-drawer__body .filter__cell .filter-widget__clear {
    display: inline-block;
    padding: 10px 16px;
    text-align: center;
    border-radius: 10px;
    text-decoration: none;
    font-size: .95rem;
    transition: background .2s, color .2s;
}

.filter-drawer__body .filter__cell .filter-widget__submit,
.filter-drawer__body .filter__cell input[type="submit"] {
    padding: 12px 20px;
    font-size: 1rem;
    font-weight: 600;
    border-radius: 10px;
    cursor: pointer;
    border: none;
    width: 100%;
    max-width: 200px;
}

.filter-drawer__body .filter-group,
.filter-drawer__body .filter-form .filter-group {
    margin-bottom: 24px;
}

.filter-drawer__body .filter-group:last-of-type {
    margin-bottom: 20px;
}

.filter-drawer__body .filter-group__title,
.filter-drawer__body .filter-form .filter-group__title {
    font-size: .8rem;
    font-weight: 600;
    color: var(--text);
    margin-bottom: 10px;
    display: block;
    letter-spacing: 0.02em;
}

.filter-drawer__body .filter-group__body {
    display: flex;
    flex-wrap: wrap;
    gap: 8px 12px;
}

/* Поля цены (числа) */
.filter-drawer__body .filter-range__inputs {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 12px;
}

.filter-drawer__body .filter-range__input {
    flex: 1;
    min-width: 0;
}

/* Единый стиль всех полей фильтра — как выпадающий список (светлый фон, скругление) */
.filter-drawer__body .filter-select-input,
.filter-drawer__body .filter-text-input,
.filter-drawer__body .filter-range__input,
.filter-drawer__body .filter-date__input,
.filter-drawer__body .filter-sort-select,
.filter-sheet .filter-select-input,
.filter-sheet .filter-text-input,
.filter-sheet .filter-range__input,
.filter-sheet .filter-date__input,
.filter-sheet .filter-sort-select {
    width: 100%;
    min-width: 0;
    padding: 10px 14px;
    font-size: .95rem;
    color: var(--text, #333);
    border: none;
    border-radius: 10px;
    transition: background .2s, box-shadow .2s;
    box-sizing: border-box;
}

.filter-drawer__body .filter-text-input:focus,
.filter-drawer__body .filter-range__input:focus,
.filter-drawer__body .filter-date__input:focus,
.filter-sheet .filter-text-input:focus,
.filter-sheet .filter-range__input:focus,
.filter-sheet .filter-date__input:focus {
    outline: none;
    background: #eeede8;
    box-shadow: 0 0 0 2px rgba(0, 0, 0, 0.06);
}

.filter-drawer__body .filter-select-input:focus:not([multiple]),
.filter-drawer__body .filter-sort-select:focus,
.filter-sheet .filter-select-input:focus:not([multiple]),
.filter-sheet .filter-sort-select:focus {
    outline: none;
    background: #eeede8;
    box-shadow: 0 0 0 2px rgba(0, 0, 0, 0.06);
}

/* Выпадающие списки — стрелка справа */
.filter-drawer__body .filter-select-input,
.filter-drawer__body .filter-sort-select,
.filter-sheet .filter-select-input,
.filter-sheet .filter-sort-select {
    cursor: pointer;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%23555' d='M6 8L1 3h10z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
    padding-right: 36px;
}

/* Пункти одиночного select (не multiple) — світлий фон */
.filter-drawer__body .filter-select-input:not([multiple]) option,
.filter-drawer__body .filter-sort-select option,
.filter-sheet .filter-select-input:not([multiple]) option,
.filter-sheet .filter-sort-select option {
    background: #f5f4f0;
    color: #333;
}
.filter-drawer__body .filter-select-input:not([multiple]) option:hover,
.filter-drawer__body .filter-sort-select option:hover,
.filter-sheet .filter-select-input:not([multiple]) option:hover,
.filter-sheet .filter-sort-select option:hover {
    background: var(--primary-light, #e8e6f0) !important;
    color: var(--primary, #444) !important;
}
.filter-drawer__body .filter-select-input:not([multiple]) option:checked,
.filter-drawer__body .filter-sort-select option:checked,
.filter-sheet .filter-select-input:not([multiple]) option:checked,
.filter-sheet .filter-sort-select option:checked {
    background: var(--primary-light, #e8e6f0) !important;
    color: var(--primary, #555) !important;
}

/* Бренд (main-filter-2): рамка, без бежевого фону в select / option */
.filter-drawer__body .filter__cell--brand .filter-select-input,
.filter-sheet .filter__cell--brand .filter-select-input,
.filter.d-flex .filter__cell--brand .filter-select-input {
    background-color: #fff;
    border: 1px solid var(--border, #e2e8f0);
    transition: border-color 0.2s, box-shadow 0.2s;
}

.filter-drawer__body .filter__cell--brand .filter-select-input:focus:not([multiple]),
.filter-sheet .filter__cell--brand .filter-select-input:focus:not([multiple]),
.filter.d-flex .filter__cell--brand .filter-select-input:focus:not([multiple]) {
    outline: none;
    background-color: #fff;
    border-color: var(--primary, #7495a8);
    box-shadow: 0 0 0 2px rgba(116, 149, 168, 0.2);
}

.filter-drawer__body .filter__cell--brand .filter-select-input:not([multiple]) option,
.filter-sheet .filter__cell--brand .filter-select-input:not([multiple]) option,
.filter.d-flex .filter__cell--brand .filter-select-input:not([multiple]) option {
    background: #fff !important;
    color: var(--text, #333) !important;
}

.filter-drawer__body .filter__cell--brand .filter-select-input:not([multiple]) option:hover,
.filter-sheet .filter__cell--brand .filter-select-input:not([multiple]) option:hover,
.filter.d-flex .filter__cell--brand .filter-select-input:not([multiple]) option:hover {
    background: rgba(116, 149, 168, 0.1) !important;
    color: var(--text, #1e293b) !important;
}

.filter-drawer__body .filter__cell--brand .filter-select-input:not([multiple]) option:checked,
.filter-sheet .filter__cell--brand .filter-select-input:not([multiple]) option:checked,
.filter.d-flex .filter__cell--brand .filter-select-input:not([multiple]) option:checked {
    background: rgba(116, 149, 168, 0.15) !important;
    color: var(--primary-dark, #5a7a8c) !important;
}

/* <select multiple> — рамка замість бежевої заливки; пункти білі з розділювачем */
.filter-drawer__body .filter-select-input[multiple],
.filter-sheet .filter-select-input[multiple],
.filter.d-flex .filter-select-input[multiple] {
    appearance: auto;
    -webkit-appearance: listbox;
    background-color: #fff;
    background-image: none;
    border: 1px solid var(--border, #e2e8f0);
    padding: 8px 10px;
    padding-right: 10px;
    cursor: default;
    min-height: 7.5rem;
    max-height: 12rem;
    overflow-y: auto;
    overflow-x: hidden;
    line-height: 1.45;
    scrollbar-width: thin;
    scrollbar-color: rgba(0, 0, 0, 0.22) transparent;
    transition: border-color 0.2s, box-shadow 0.2s;
}

.filter-drawer__body .filter-select-input[multiple]:focus,
.filter-sheet .filter-select-input[multiple]:focus,
.filter.d-flex .filter-select-input[multiple]:focus {
    outline: none;
    background-color: #fff;
    border-color: var(--primary, #7495a8);
    box-shadow: 0 0 0 2px rgba(116, 149, 168, 0.2);
}

.filter-drawer__body .filter-select-input[multiple] option,
.filter-sheet .filter-select-input[multiple] option,
.filter.d-flex .filter-select-input[multiple] option {
    padding: 8px 10px;
    margin: 0;
    background: #fff !important;
    color: var(--text, #333) !important;
    border-bottom: 1px solid var(--border, #ececec);
    border-radius: 0;
}

.filter-drawer__body .filter-select-input[multiple] option:last-child,
.filter-sheet .filter-select-input[multiple] option:last-child,
.filter.d-flex .filter-select-input[multiple] option:last-child {
    border-bottom: none;
}

.filter-drawer__body .filter-select-input[multiple] option:hover,
.filter-sheet .filter-select-input[multiple] option:hover,
.filter.d-flex .filter-select-input[multiple] option:hover {
    background: rgba(116, 149, 168, 0.08) !important;
    color: var(--text, #1e293b) !important;
}

.filter-drawer__body .filter-select-input[multiple] option:checked,
.filter-sheet .filter-select-input[multiple] option:checked,
.filter.d-flex .filter-select-input[multiple] option:checked {
    background: rgba(116, 149, 168, 0.12) !important;
    color: var(--primary-dark, #5a7a8c) !important;
    font-weight: 600;
}

.filter-drawer__body .filter-select-input[multiple]::-webkit-scrollbar,
.filter-sheet .filter-select-input[multiple]::-webkit-scrollbar,
.filter.d-flex .filter-select-input[multiple]::-webkit-scrollbar {
    width: 8px;
}

.filter-drawer__body .filter-select-input[multiple]::-webkit-scrollbar-thumb,
.filter-sheet .filter-select-input[multiple]::-webkit-scrollbar-thumb,
.filter.d-flex .filter-select-input[multiple]::-webkit-scrollbar-thumb {
    background: rgba(0, 0, 0, 0.2);
    border-radius: 4px;
}

.filter-drawer__body .filter-select-input[multiple]::-webkit-scrollbar-track,
.filter-sheet .filter-select-input[multiple]::-webkit-scrollbar-track,
.filter.d-flex .filter-select-input[multiple]::-webkit-scrollbar-track {
    background: transparent;
}

.filter-drawer__body .filter-text-input,
.filter-drawer__body .filter-range__input,
.filter-drawer__body .filter-date__input {
    padding-right: 14px;
}

/* Кастомний випадаючий список — свій ховер замість синього браузера */
.custom-select-wrap {
    position: relative;
    width: 100%;
    min-width: 0;
}
.custom-select-trigger {
    width: 100%;
    padding: 10px 36px 10px 14px;
    font-size: .95rem;
    color: var(--text, #333);
    background: #f5f4f0;
    border: none;
    border-radius: 10px;
    cursor: pointer;
    text-align: left;
    position: relative;
    transition: background .2s, box-shadow .2s;
}
.custom-select-trigger::after {
    content: '';
    position: absolute;
    right: 12px;
    top: 50%;
    margin-top: -3px;
    width: 0;
    height: 0;
    border-left: 5px solid transparent;
    border-right: 5px solid transparent;
    border-top: 6px solid #555;
}
.custom-select-trigger:hover,
.custom-select-trigger.is-open {
    background: #eeede8;
    box-shadow: 0 0 0 2px rgba(0, 0, 0, 0.06);
}
.custom-select-dropdown {
    position: absolute;
    left: 0;
    right: 0;
    top: 100%;
    margin: 4px 0 0;
    padding: 6px 0;
    background: #f5f4f0;
    border-radius: 10px;
    box-shadow: 0 8px 24px rgba(0,0,0,0.12);
    list-style: none;
    max-height: 260px;
    overflow-y: auto;
    display: none;
    z-index: 100;
}
.custom-select-dropdown.is-open {
    display: block;
}
.custom-select-dropdown li {
    padding: 10px 14px;
    cursor: pointer;
    transition: background .15s, color .15s;
    color: var(--text, #333);
}
.custom-select-dropdown li:hover {
    background: var(--primary-light, #e8e6f0);
    color: var(--primary, #444);
}
.custom-select-dropdown li.selected {
    background: var(--primary-light, #e0dfda);
    color: var(--primary, #555);
    font-weight: 500;
}

.filter-drawer__body .filter-range__sep {
    color: var(--text-muted);
    font-size: .9rem;
}

/* Двойной range slider */
.filter-drawer__body .filter-range__slider {
    position: relative;
    height: 24px;
    margin-top: 4px;
}

.filter-drawer__body .filter-slider {
    position: absolute;
    left: 0;
    right: 0;
    width: 100%;
    height: 6px;
    margin: 0;
    -webkit-appearance: none;
    appearance: none;
    background: transparent;
    pointer-events: none;
}

.filter-drawer__body .filter-slider--min { z-index: 2; }
.filter-drawer__body .filter-slider--max { z-index: 1; }

.filter-drawer__body .filter-slider::-webkit-slider-runnable-track {
    height: 6px;
    background: var(--border);
    border-radius: 3px;
}

.filter-drawer__body .filter-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: var(--primary);
    border: 3px solid var(--bg);
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.15);
    cursor: pointer;
    pointer-events: auto;
    margin-top: -7px;
    transition: transform .15s, box-shadow .15s;
}

.filter-drawer__body .filter-slider::-webkit-slider-thumb:hover {
    transform: scale(1.08);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
}

.filter-drawer__body .filter-slider::-moz-range-track {
    height: 6px;
    background: var(--border);
    border-radius: 3px;
}

.filter-drawer__body .filter-slider::-moz-range-thumb {
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: var(--primary);
    border: 3px solid var(--bg);
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.15);
    cursor: pointer;
    pointer-events: auto;
}

.filter-drawer__body .filter-slider::-moz-range-thumb:hover {
    transform: scale(1.08);
}

/* Фільтр ціни: як на макеті — поля «від–до», грн між ними, смуга + шкала */
.filter-drawer__body .filter-range--price .filter-range__inputs,
.filter-sheet .filter-range--price .filter-range__inputs {
    gap: 8px 10px;
    margin-bottom: 14px;
}

.filter-drawer__body .filter-range--price .filter-range__input,
.filter-sheet .filter-range--price .filter-range__input {
    flex: 1 1 0;
    min-width: 0;
    padding: 10px 12px;
    font-size: 0.95rem;
    background: #fff;
    border: 1px solid var(--border, #e2e8f0);
    border-radius: 8px;
    box-shadow: none;
}

.filter-drawer__body .filter-range--price .filter-range__input:focus,
.filter-sheet .filter-range--price .filter-range__input:focus {
    background: #fff;
    box-shadow: 0 0 0 2px rgba(0, 0, 0, 0.06);
}

.filter-drawer__body .filter-range__sep--currency,
.filter-sheet .filter-range__sep--currency {
    flex-shrink: 0;
    font-size: 0.85rem;
    font-weight: 500;
    color: var(--text-secondary, #64748b);
    padding: 0 2px;
}

/* Висота рядка слайдера; сам input на 100% — тоді трек і ручка по центру лінії (WebKit / Firefox) */
.filter-drawer__body .filter-range--price .filter-range__slider,
.filter-sheet .filter-range--price .filter-range__slider {
    --filter-price-track-h: 6px;
    --filter-price-thumb: 22px;
    position: relative;
    height: 30px;
    margin-top: 6px;
    margin-bottom: 4px;
}

.filter-drawer__body .filter-range--price .filter-range__track,
.filter-sheet .filter-range--price .filter-range__track {
    position: absolute;
    left: 0;
    right: 0;
    top: 50%;
    transform: translateY(-50%);
    height: 6px;
    z-index: 0;
    pointer-events: none;
}

.filter-drawer__body .filter-range--price .filter-range__track-bg,
.filter-sheet .filter-range--price .filter-range__track-bg {
    position: absolute;
    inset: 0;
    background: #ebe8e4;
    border-radius: 3px;
}

.filter-drawer__body .filter-range--price .filter-range__track-fill,
.filter-sheet .filter-range--price .filter-range__track-fill {
    position: absolute;
    top: 0;
    left: 0;
    height: 100%;
    width: 0;
    background: #3a3a3a;
    border-radius: 3px;
    z-index: 1;
}

/* Перекриваємо глобальне .filter-slider { height: 6px } — інакше ручка обрізається / з’їжджає */
.filter-drawer__body .filter-range--price .filter-slider,
.filter-sheet .filter-range--price .filter-slider {
    z-index: 2;
    top: 0;
    height: 100%;
    min-height: 30px;
}

.filter-drawer__body .filter-range--price .filter-slider--max,
.filter-sheet .filter-range--price .filter-slider--max {
    z-index: 3;
}

.filter-drawer__body .filter-range--price .filter-slider::-webkit-slider-runnable-track,
.filter-sheet .filter-range--price .filter-slider::-webkit-slider-runnable-track {
    height: 6px;
    background: transparent;
    border-radius: 3px;
}

.filter-drawer__body .filter-range--price .filter-slider::-moz-range-track,
.filter-sheet .filter-range--price .filter-slider::-moz-range-track {
    height: 6px;
    background: transparent;
    border-radius: 3px;
}

/* Центр ручки на центрі треку: (track - thumb) / 2 */
.filter-drawer__body .filter-range--price .filter-slider::-webkit-slider-thumb,
.filter-sheet .filter-range--price .filter-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 22px;
    height: 22px;
    margin-top: calc((var(--filter-price-track-h, 6px) - var(--filter-price-thumb, 22px)) / 2);
    box-sizing: border-box;
    background: radial-gradient(circle at center, #5c5c5c 2px, #fff 2px);
    border: 1px solid #d1d1d1;
    border-radius: 50%;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.12);
    cursor: pointer;
    pointer-events: auto;
}

.filter-drawer__body .filter-range--price .filter-slider::-moz-range-thumb,
.filter-sheet .filter-range--price .filter-slider::-moz-range-thumb {
    width: 22px;
    height: 22px;
    box-sizing: border-box;
    background: radial-gradient(circle at center, #5c5c5c 2px, #fff 2px);
    border: 1px solid #d1d1d1;
    border-radius: 50%;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.12);
    cursor: pointer;
    pointer-events: auto;
}

.filter-drawer__body .filter-range__scale,
.filter-sheet .filter-range__scale {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    width: 100%;
    margin-top: 8px;
    padding: 0 4px 0 2px;
    box-sizing: border-box;
}

.filter-drawer__body .filter-range__scale-item,
.filter-sheet .filter-range__scale-item {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    min-width: 0;
}

.filter-drawer__body .filter-range__scale-tick,
.filter-sheet .filter-range__scale-tick {
    width: 1px;
    height: 5px;
    background: #c5c5c5;
    border-radius: 1px;
}

.filter-drawer__body .filter-range__scale-item:first-child .filter-range__scale-tick,
.filter-drawer__body .filter-range__scale-item:last-child .filter-range__scale-tick,
.filter-sheet .filter-range__scale-item:first-child .filter-range__scale-tick,
.filter-sheet .filter-range__scale-item:last-child .filter-range__scale-tick {
    height: 8px;
}

.filter-drawer__body .filter-range__scale-value,
.filter-sheet .filter-range__scale-value {
    margin-top: 5px;
    font-size: 11px;
    line-height: 1.2;
    color: var(--text-muted, #94a3b8);
    text-align: center;
    white-space: nowrap;
}

/* Чекбоксы */
.filter-drawer__body .filter-checkbox {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    padding: 8px 12px;
    border-radius: 10px;
    cursor: pointer;
    transition: background .15s;
}

.filter-drawer__body .filter-checkbox:hover {
    background: var(--bg-card);
}

.filter-drawer__body .filter-checkbox input {
    width: 18px;
    height: 18px;
    accent-color: var(--primary);
    cursor: pointer;
}

.filter-drawer__body .filter-checkbox span {
    font-size: .9rem;
    color: var(--text-secondary);
}

/* Кнопка Застосувати */
.filter-drawer__body .filter-widget__submit,
.filter-drawer__body .filter-form .filter-widget__submit {
    margin-top: 24px;
    width: 100%;
    padding: 14px 20px;
    font-size: 1rem;
    font-weight: 600;
    color: #fff !important;
    background: var(--primary) !important;
    border: none !important;
    border-radius: 12px;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    transition: background .2s, transform .15s;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}

.filter-drawer__body .filter-widget__submit:hover {
    background: var(--primary-dark, var(--primary));
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.12);
}

.filter-drawer__body .filter-widget__submit:active {
    transform: translateY(0);
}

.filter-drawer__body .filter-widget__reset {
    margin-left: 0;
    margin-top: 12px;
    display: inline-block;
    font-size: .9rem;
    color: var(--text-muted);
    text-decoration: none;
    padding: 6px 0;
    transition: color .2s;
}

.filter-drawer__body .filter-widget__reset:hover {
    color: var(--primary);
}

.filter-drawer__body .filter-colors {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.filter-drawer__body .filter-color {
    display: inline-flex;
    cursor: pointer;
    border-radius: 50%;
    padding: 2px;
    border: 2px solid transparent;
    transition: border-color .2s, transform .15s;
}

.filter-drawer__body .filter-color:hover,
.filter-drawer__body .filter-color:has(input:checked) {
    border-color: var(--primary);
    transform: scale(1.1);
}

.filter-drawer__body .filter-color__circle {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    display: block;
    box-shadow: 0 1px 3px rgba(0,0,0,0.15);
}

.filter-drawer__body .filter-date__input {
    /* стиль наследуется из общего блока полей фильтра */
}

.filter-drawer__body .filter-date-range {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}

/* ========================
   Filter sheet — сетка полей и блок кнопок
   ======================== */
.filter-sheet {
    display: block;
}

.filter-sheet .filter-form {
    margin: 0;
    padding: 0;
    border: none;
    background: transparent;
}

.filter-sheet .filter-widget {
    display: flex;
    flex-wrap: wrap;
    gap: 20px 24px;
    align-items: flex-start;
}

.filter-sheet .filter-widget--collapsible .filter-widget__header {
    flex: 1 1 100%;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 10px 14px;
    margin-bottom: 8px;
    padding-bottom: 10px;
    border-bottom: 1px solid var(--border);
}

.filter-sheet .filter-widget--collapsible .filter-widget__body {
    flex: 1 1 100%;
    display: flex;
    flex-wrap: wrap;
    gap: 20px 24px;
    align-items: flex-end;
}

.filter-sheet .filter-widget--collapsible.is-collapsed .filter-widget__body {
    display: none;
}

.filter-sheet .filter-group {
    margin-bottom: 0;
    min-width: 0;
    flex: 1 1 180px;
}

.filter-sheet .filter-group__title {
    font-size: .8rem;
    font-weight: 600;
    color: var(--text-muted);
    margin-bottom: 6px;
    display: block;
}

.filter-sheet .filter-group__body {
    display: flex;
    flex-wrap: wrap;
    gap: 6px 10px;
}

.filter-sheet .filter-widget__submit,
.filter-sheet .filter-widget__reset {
    flex: 1 1 100%;
    margin-top: 8px;
    margin-bottom: 0;
}

.filter-sheet .filter-widget__submit {
    min-width: 140px;
}

.filter-sheet .filter-actions {
    flex: 1 1 100%;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 12px;
    margin-top: 16px;
    padding-top: 16px;
    border-top: 1px solid var(--border);
}

.filter-sheet .filter-actions .filter-widget__submit {
    margin-top: 0;
}

.filter-sheet .filter-actions .filter-widget__reset {
    margin-top: 0;
}

/* ========================
   Speedbar (хлібні крихти)
   ======================== */
.speedbar {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 6px 4px;
    padding: 12px 0 16px;
    font-size: 13px;
    color: var(--text-muted, #666);
    line-height: 1.4;
}

.speedbar a {
    color: var(--text-muted, #666);
    text-decoration: none;
    transition: color .2s;
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.speedbar a:hover {
    color: var(--primary, #0066cc);
}

/* Іконка дому тільки для першого посилання (головна) */
.speedbar > a:first-of-type::before {
    font-family: "Font Awesome 6 Free";
    font-weight: 900;
    content: "\f015"; /* fa-house */
    font-size: 1em;
    opacity: .9;
}

.speedbar > a:first-of-type:hover::before {
    opacity: 1;
}

/* Роздільник " » " між елементами — стилізуємо текстовий вузол через загальний вигляд */
.speedbar {
    letter-spacing: .02em;
}




/* Головна: коло-категорії замість стрічки брендів */

.category-circles-sect .sect__content.category-circles-wrap {
    padding-top: 0;
    padding-bottom: 0;
}

.category-circles-sect .sect__header {
    margin-bottom: 0.5rem;
}

/* Marquee: стилі спільні з .brands-carousel у style.css (mask, overflow) */

.category-circles {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    align-items: flex-start;
    gap: 0.75rem 1rem;
    padding: 0.35rem 0 0.15rem;
}

/* Менше вертикальний зазор між колом і підписом */
.category-circle {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.25rem;
    max-width: 104px;
    text-decoration: none;
    color: var(--text, #0f172a);
}

.category-circle:hover {
    color: var(--primary-hover);
}

.category-circle:focus-visible {
    outline: 2px solid var(--primary, #8b5dad);
    outline-offset: 4px;
    border-radius: 12px;
}

.category-circle__img-wrap {
    width: 96px;
    height: 96px;
    border-radius: 50%;
    overflow: hidden;
    flex-shrink: 0;
    background: var(--bg, #f8fafc);
    border: 2px solid rgba(15, 23, 42, 0.08);
    box-shadow: 0 6px 20px rgba(15, 23, 42, 0.08);
}

.category-circle__img {
    display: block;
    width: 100%;
    height: 100%;
    max-width: none;
    max-height: none;
    object-fit: cover;
}

/* Поверх стилів брендів у спільній обгортці .brands-carousel */
.brands-carousel.category-circles-marquee .category-circle__img {
    filter: none;
}

.category-circle__fallback {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 100%;
    font-size: 1.75rem;
    font-weight: 700;
    letter-spacing: -0.02em;
    color: #fff;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.15);
}

.category-circle__name {
    font-size: 0.8125rem;
    font-weight: 600;
    line-height: 1.2;
    text-align: center;
    hyphens: auto;
    margin: 0;
    padding: 0 2px;
}

/* Компактніше за замовчуванням .brands-carousel (24px) */
.brands-carousel.category-circles-marquee {
    padding: 4px 0 8px;
}

.brands-carousel.category-circles-marquee.category-circles-marquee--no-fade .swiper {
    mask-image: none;
    -webkit-mask-image: none;
}

@media (max-width: 480px) {
    .category-circles {
        gap: 0.65rem 0.85rem;
    }

    .category-circle__img-wrap {
        width: 80px;
        height: 80px;
    }

    .category-circle__fallback {
        font-size: 1.5rem;
    }

    .category-circle {
        max-width: 88px;
    }
}
