:root {
    --primary: #174E9E;
    --primary-hover: #133d7a;
    --accent: #ff4500;
    --accent-hover: #e63900;
    --success: #1BC5BD;
    --warning: #FFA800;
    --danger: #F64E60;
    --text-primary: #3F4254;
    --text-secondary: #6A6A6A;
    --text-muted: #818181;
    --bg-body: #F3F6F9;
    --bg-white: #FFFFFF;
    --border-color: #E4E6EF;
    --font-family: Roboto, Arial, Helvetica, sans-serif;
    --border-radius: 2px;
}

*, *::before, *::after { margin: 0; padding: 0; box-sizing: border-box; }

html { font-size: 16px; -webkit-text-size-adjust: 100%; }

body {
    font-family: var(--font-family);
    background: var(--bg-body);
    color: var(--text-primary);
    line-height: 1.4;
}

.body--menu-open { overflow: hidden; }

/* ШАПКА */
.header {
    background: #E1E8F2;
    border-bottom: 1px solid var(--border-color);
}

.header__top {
    max-width: 1280px;
    margin: 0 auto;
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    padding: 0 24px;
    gap: 20px;
}

.header__logo {
    display: block;
    width: 190px;
    height: 70px;
}

.header__logo img {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

.header__icons {
    display: flex;
    align-items: center;
    gap: 8px;
}

/* Живые мячики (Яндекс, 2ГИС, ВК) */
.header__icon--bounce {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    text-decoration: none;
}

.header__icon--bounce svg {
    width: 40px;
    height: 40px;
}

/* Телефон с выпадашкой */
.header__phone-icon {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: #D0D8E4;
    cursor: pointer;
    transition: background 0.3s ease, transform 0.15s ease;
    text-decoration: none;
    flex-shrink: 0;
}

.header__phone-icon:hover {
    background: #C5CFDE;
    transform: scale(1.08);
}

.header__phone-icon svg {
    width: 18px;
    height: 18px;
    stroke: #3F4254;
    transition: stroke 0.3s ease;
}

.header__phone-icon:hover svg {
    stroke: #174E9E;
}

.header__phone-dropdown {
    display: none;
    position: fixed;
    width: 320px;
    background: #FFFFFF;
    border-radius: 8px;
    box-shadow: 0 8px 24px rgba(0,0,0,0.12);
    padding: 16px;
    z-index: 99999;
    flex-direction: column;
    gap: 0;
}

.header__phone-dropdown--visible {
    display: flex;
}

.header__phone-icon:hover .header__phone-dropdown {
    display: flex;
}

.header__phone-item {
    display: flex;
    align-items: baseline;
    gap: 12px;
    padding: 8px 0;
    text-decoration: none;
    border-bottom: 1px solid var(--border-color);
    font-size: 13px;
}

.header__phone-item:last-child {
    border-bottom: none;
}

.header__phone-item span:first-child {
    font-weight: 600;
    color: var(--primary);
    min-width: 70px;
    white-space: nowrap;
}

.header__phone-item span:last-child {
    color: var(--text-secondary);
}

.header__phone-item:hover span:first-child {
    color: var(--primary-hover);
}

/* ПОДВАЛ */
.footer {
    background: var(--bg-white);
    border-top: 1px solid var(--border-color);
    margin-top: 0;
}

.footer__wrapper {
    max-width: 1400px;
    margin: 0 auto;
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    padding: 20px 24px 12px;
}

.footer__inner {
    justify-content: space-between;
    display: flex;
    gap: 30px;
    flex: 0.9;
    width: 80%;
}

.footer__col {
    font-size: 13px;
    color: var(--text-secondary);
    line-height: 1.6;
}

.footer__brand { font-weight: 600; color: var(--text-primary); }
.footer__years { color: var(--text-muted); font-size: 12px; }
.footer__group { color: var(--text-secondary); }

.footer__link {
    display: block;
    color: var(--primary);
    text-decoration: none;
    margin-bottom: 4px;
}

.footer__link:hover { text-decoration: underline; }

.footer__address { color: var(--text-primary); font-weight: 500; }

.footer__phone {
    display: block;
    color: var(--text-primary);
    text-decoration: none;
    font-weight: 500;
}

.footer__phone:hover { color: var(--primary); }

.footer__email {
    display: block;
    color: var(--primary);
    text-decoration: none;
}

.footer__email:hover { text-decoration: underline; }

.footer__dev {
    text-align: right;
    font-size: 11px;
    color: var(--text-muted);
    white-space: nowrap;
}

/* КАТАЛОГ */
.layout {
    display: flex;
    min-height: calc(100vh - 140px);
}

.category-tree__link.category-tree__link--active:hover {
    background: #133d7a;
    color: #FFFFFF;
}

/* САЙДБАР */
.sidebar {
    width: auto;
    min-width: auto;
    max-width: 400px;
    background: var(--bg-white);
    border-right: 1px solid var(--border-color);
    position: sticky; top: 0;
    height: 100vh; overflow-y: auto;
    z-index: 100;
    padding-right: 12px;
}

.sidebar__shop {
    padding: 12px 14px;
    border-bottom: 1px solid var(--border-color);
}

.sidebar__shop-label {
    display: block;
    font-size: 11px; font-weight: 500;
    color: var(--text-muted);
    text-transform: uppercase; letter-spacing: 0.3px;
    margin-bottom: 5px;
}

.shop-select {
    width: 100%;
    padding: 7px 8px;
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    background: var(--bg-white);
    font-size: 13px; font-family: inherit;
    color: var(--text-primary);
    cursor: pointer;
}

.shop-select:focus {
    outline: 2px solid var(--primary);
    outline-offset: -2px;
}

.sidebar__title {
    font-size: 12px; font-weight: 500;
    color: var(--text-muted);
    text-transform: uppercase; letter-spacing: 0.5px;
    padding: 14px 16px 8px;
}

.category-tree { list-style: none; }

.category-tree__link {
    display: flex; justify-content: space-between; align-items: center;
    padding: 8px 16px;
    text-decoration: none;
    color: var(--text-primary);
    font-size: 13px; line-height: 1.3;
    border-left: 3px solid transparent;
    cursor: pointer;
    transition: background 0.1s;
}

.category-tree__link:hover { background: #F5F7FA; }

.category-tree__link--active {
    background: var(--primary);
    color: #FFFFFF;
    border-left-color: var(--accent);
    font-weight: 500;
}

.category-tree__badge {
    background: #E4E6EF;
    color: var(--text-muted);
    padding: 1px 7px; border-radius: 10px;
    font-size: 11px; font-weight: 500;
    min-width: 22px; text-align: center;
}

.category-tree__link--active .category-tree__badge {
    background: rgba(255,255,255,0.2);
    color: #FFFFFF;
}

.sidebar-overlay { display: none; }
.mobile-topbar { display: none; }

/* ОСНОВНОЙ КОНТЕНТ */
.main { flex: 1; padding: 20px 24px; min-width: 0; }

.breadcrumbs {
    font-size: 12px; color: var(--text-muted);
    margin-bottom: 6px;
}

.breadcrumbs a { color: var(--primary); text-decoration: none; }
.breadcrumbs a:hover { text-decoration: underline; }
.breadcrumbs__sep { margin: 0 6px; }
.breadcrumbs__current { color: var(--text-secondary); }

.page-title { font-size: 22px; font-weight: 700; margin-bottom: 16px; }

/* ПОИСК */
.search-bar {
    display: flex; gap: 0;
    margin-bottom: 16px;
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    overflow: hidden;
    background: var(--bg-white);
}

.search-bar__input {
    flex: 1;
    padding: 10px 14px;
    border: none;
    font-size: 14px; font-family: inherit;
    color: var(--text-primary);
    background: transparent;
    outline: none;
}

.search-bar__input::placeholder { color: var(--text-muted); }

.search-bar__btn {
    padding: 10px 20px;
    background: var(--primary);
    color: #FFFFFF;
    border: none;
    font-size: 14px; font-family: inherit;
    font-weight: 500;
    cursor: pointer;
    white-space: nowrap;
}

.search-bar__btn:hover { background: var(--primary-hover); }

.search-info {
    font-size: 13px; color: var(--text-secondary);
    margin-bottom: 14px;
}

.search-info strong { color: var(--text-primary); }

.search-info__reset {
    color: var(--danger); text-decoration: none;
    margin-left: 10px; font-weight: 500;
}

/* ТУЛБАР */
.toolbar {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 14px;
    flex-wrap: wrap;
}

.sort-bar {
    display: flex; gap: 0;
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    overflow: hidden;
}

.sort-bar__btn {
    padding: 7px 14px;
    border: none;
    background: var(--bg-white);
    color: var(--text-secondary);
    font-size: 13px; font-family: inherit;
    cursor: pointer;
    border-right: 1px solid var(--border-color);
    white-space: nowrap;
}

.sort-bar__btn:last-child { border-right: none; }
.sort-bar__btn:hover { background: #F5F7FA; color: var(--primary); }
.sort-bar__btn--active { background: var(--primary); color: #FFF; font-weight: 500; }
.sort-bar__btn--active:hover { background: var(--primary-hover); color: #FFF; }

.filter-btn {
    padding: 7px 14px;
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    background: var(--bg-white);
    color: var(--text-secondary);
    font-size: 13px; font-family: inherit;
    cursor: pointer;
    transition: background 0.1s, color 0.1s, border-color 0.1s;
}

.filter-btn:hover { background: #F5F7FA; color: var(--primary); }
.filter-btn--active { background: var(--primary); color: #FFF; font-weight: 500; border-color: var(--primary); }

/* ТАБЛИЦА ТОВАРОВ */
.product-list {
    display: table;
    width: 100%;
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    overflow: hidden;
    border-collapse: collapse;
}

.product-item {
    display: table-row;
    background: var(--bg-white);
    transition: background 0.1s;
    height: 70px;
}

.product-item:hover { background: #FAFBFC; }

.product-item + .product-item {
    border-top: 2px solid #F3F6F9;
}

.product-item__image {
    display: table-cell;
    width: 70px;
    min-width: 70px;
    padding: 10px 0 10px 6px;
    vertical-align: middle;
    cursor: pointer;
}

.product-item__image img {
    width: 50px;
    height: 50px;
    object-fit: contain;
}

.product-item__image-placeholder { font-size: 1.8em; color: #CCC; }

.product-item__code {
    display: table-cell;
    width: 130px;
    min-width: 130px;
    padding: 10px 6px;
    vertical-align: middle;
    font-size: 12px;
    color: var(--text-muted);
    white-space: nowrap;
}

.product-item__name {
    display: table-cell;
    padding: 10px 0px;
    vertical-align: middle;
    font-size: 13px;
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 0;
    cursor: pointer;
    transition: color 0.15s;
    text-decoration: none;
}

.product-item__name:hover { color: var(--primary); }

.product-item__warehouse-cell {
    display: table-cell;
    width: 160px;
    min-width: 160px;
    padding: 10px 0px;
    vertical-align: middle;
    white-space: nowrap;
}

.product-item__warehouse-label {
    font-size: 12px;
    color: var(--text-muted);
}

.product-item__warehouse {
    font-size: 12px;
    color: var(--primary);
    text-decoration: none;
    cursor: pointer;
}

.product-item__warehouse:hover {
    color: var(--primary-hover);
    text-decoration: underline;
}

.product-item__stock {
    display: table-cell;
    width: 100px;
    min-width: 100px;
    padding: 10px 0px;
    vertical-align: middle;
    font-size: 12px;
    font-weight: 500;
    white-space: nowrap;
}

.product-item__stock--in { color: var(--success); }
.product-item__stock--low { color: var(--warning); }
.product-item__stock--out { color: var(--danger); }

.product-item__price {
    display: table-cell;
    width: 70px;
    min-width: 70px;
    padding: 10px 10px 10px 0px;
    vertical-align: middle;
    font-size: 15px;
    font-weight: 700;
    color: var(--text-primary);
    white-space: nowrap;
    text-align: right;
}

/* ПАГИНАЦИЯ */
.pagination {
    display: flex; justify-content: center; align-items: center;
    gap: 4px; margin-top: 20px;
    flex-wrap: wrap;
}

.pagination__btn {
    display: inline-flex; align-items: center; justify-content: center;
    min-width: 36px; height: 36px;
    padding: 0 8px;
    border-radius: var(--border-radius);
    border: 1px solid var(--border-color);
    background: var(--bg-white);
    color: var(--primary);
    font-size: 13px; font-family: inherit;
    cursor: pointer;
}

.pagination__btn:hover { background: #F5F7FA; border-color: var(--primary); }
.pagination__btn--active { background: var(--primary); color: #FFF; border-color: var(--primary); font-weight: 600; }
.pagination__btn:disabled { opacity: 0.4; cursor: default; pointer-events: none; }

.pagination__dots {
    display: inline-flex;
    align-items: center; justify-content: center;
    min-width: 36px; height: 36px;
    font-size: 13px;
    color: var(--text-muted);
    letter-spacing: 1px;
}

.stats { text-align: center; color: var(--text-muted); font-size: 12px; margin-top: 8px; }
.empty { text-align: center; padding: 60px 20px; color: var(--text-muted); font-size: 15px; }
.loader { text-align: center; padding: 40px; color: var(--text-muted); display: none; }
.loader--visible { display: block; }

/* ПОПАП */
.popup {
    display: none;
    position: fixed; inset: 0;
    z-index: 200;
    align-items: center; justify-content: center;
}

.popup--visible { display: flex; }

.popup__overlay {
    position: absolute; inset: 0;
    background: rgba(0,0,0,0.5);
}

.popup__content {
    position: relative;
    background: var(--bg-white);
    border-radius: var(--border-radius);
    max-width: 750px;
    width: 95%;
    max-height: 85vh;
    overflow-y: auto;
    z-index: 1;
}

.popup__close {
    position: absolute;
    top: 10px; right: 14px;
    background: none; border: none;
    font-size: 20px; cursor: pointer;
    color: var(--text-muted);
    padding: 4px 8px; line-height: 1;
    z-index: 2;
}

.popup__close:hover { color: var(--text-primary); }

/* ПОПАП КАРТОЧКИ */
.card-popup { display: flex; gap: 20px; padding: 20px; }
.card-popup__gallery { width: 280px; min-width: 280px; flex-shrink: 0; }

.card-popup__main-image {
    width: 100%; height: 280px;
    background: #FAFBFC;
    display: flex; align-items: center; justify-content: center;
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    margin-bottom: 8px;
}

.card-popup__main-image img { max-width: 100%; max-height: 100%; object-fit: contain; padding: 8px; }
.card-popup__thumbs { display: flex; gap: 6px; flex-wrap: wrap; }

.card-popup__thumb {
    width: 52px; height: 52px;
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    cursor: pointer;
    display: flex; align-items: center; justify-content: center;
    background: #FAFBFC;
    transition: border-color 0.15s;
}

.card-popup__thumb:hover { border-color: var(--primary); }
.card-popup__thumb--active { border-color: var(--primary); border-width: 2px; }
.card-popup__thumb img { max-width: 100%; max-height: 100%; object-fit: contain; padding: 2px; }
.card-popup__info { flex: 1; min-width: 0; }
.card-popup__articul { font-size: 12px; color: var(--text-muted); margin-bottom: 4px; }
.card-popup__name { font-size: 18px; font-weight: 600; color: var(--text-primary); margin-bottom: 10px; line-height: 1.3; }
.card-popup__price { font-size: 20px; font-weight: 700; color: var(--text-primary); margin-bottom: 6px; }
.card-popup__stock { font-size: 13px; font-weight: 500; margin-bottom: 6px; }
.card-popup__stock--in { color: var(--success); }
.card-popup__stock--low { color: var(--warning); }
.card-popup__stock--out { color: var(--danger); }
.card-popup__meta { font-size: 12px; color: var(--text-muted); margin-bottom: 14px; line-height: 1.5; }
.card-popup__desc-title { font-size: 13px; font-weight: 600; color: var(--text-primary); margin-bottom: 6px; }
.card-popup__desc-text { font-size: 13px; line-height: 1.6; color: var(--text-secondary); white-space: pre-line; }

/* ПОПАП СКЛАДА */
.warehouse-popup { padding: 30px; text-align: center; }
.warehouse-popup__name { font-size: 20px; font-weight: 600; color: var(--text-primary); margin-bottom: 8px; }
.warehouse-popup__shop { font-size: 14px; color: var(--text-secondary); }

/* ПОПАП ФИЛЬТРОВ */
.filter-popup { padding: 24px; }
.filter-popup__title { font-size: 16px; font-weight: 600; color: var(--text-primary); margin-bottom: 16px; }
.filter-popup__group { margin-bottom: 14px; }

.filter-popup__label {
    display: flex; align-items: center; gap: 8px;
    font-size: 13px; color: var(--text-secondary);
    cursor: pointer; margin-bottom: 8px;
}

.filter-popup__label input[type="checkbox"] { width: 16px; height: 16px; accent-color: var(--primary); cursor: pointer; }
.filter-popup__price-row { display: flex; align-items: center; gap: 8px; }
.filter-popup__price-row span { font-size: 13px; color: var(--text-muted); }

.filter-popup__price-input {
    width: 110px; padding: 6px 10px;
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    font-size: 13px; font-family: inherit;
    color: var(--text-primary); background: var(--bg-white);
    outline: none;
}

.filter-popup__price-input:focus { border-color: var(--primary); }
.filter-popup__actions { display: flex; gap: 8px; margin-top: 20px; }

.filter-popup__apply {
    padding: 8px 20px; background: var(--primary); color: #FFF;
    border: none; border-radius: var(--border-radius);
    font-size: 13px; font-family: inherit; font-weight: 500; cursor: pointer;
}

.filter-popup__apply:hover { background: var(--primary-hover); }

.filter-popup__reset {
    padding: 8px 20px; background: none; color: var(--text-muted);
    border: 1px solid var(--border-color); border-radius: var(--border-radius);
    font-size: 13px; font-family: inherit; cursor: pointer;
}

.filter-popup__reset:hover { background: #F5F7FA; }

/* ПРЕВЬЮ КАРТИНКИ */
.product-item__preview {
    display: none;
    position: fixed;
    z-index: 300;
    pointer-events: none;
}

.product-item__preview img {
    max-width: 300px; max-height: 300px;
    object-fit: contain;
    background: var(--bg-white);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    box-shadow: 0 4px 16px rgba(0,0,0,0.12);
    padding: 6px;
}

.product-item__preview--visible { display: block; }