:root {
    --brand: #443063;
    --brand-dark: #33244a;
    --link: #0fa0da;
    /* Личный кабинет выделен оранжевым по просьбе клиента. */
    --account: #f97316;
    --price: #1b1b1f;
    --price-size: 1.25rem;
    --price-weight: 700;
    --border: #e6e6ea;
    --muted: #6f6f7a;
}

body {
    font-family: 'Rubik', system-ui, sans-serif;
    color: #1b1b1f;
    background: #fff;
}

a {
    color: var(--link);
    text-decoration: none;
}

a:hover {
    text-decoration: underline;
}

.btn-brand {
    background: var(--brand);
    border-color: var(--brand);
    color: #fff;
    font-weight: 500;
}

.btn-brand:hover,
.btn-brand:focus {
    background: var(--brand-dark);
    border-color: var(--brand-dark);
    color: #fff;
}

/* ---------- Шапка ---------- */

.site-header {
    border-bottom: 1px solid var(--border);
    background: #fff;
    position: sticky;
    top: 0;
    z-index: 1030;
}

.header-row {
    display: flex;
    align-items: center;
    /* Равномерные отступы между логотипом, «Каталогом» и поиском. */
    gap: 1.75rem;
    padding: 0.85rem 0;
}

.brand {
    display: flex;
    align-items: center;
    flex-shrink: 0;
}

.brand-text {
    font-weight: 700;
    font-size: 1.4rem;
    letter-spacing: 0.06em;
    color: var(--brand);
}

.brand:hover {
    text-decoration: none;
}

/* Поиск уменьшен примерно на треть и больше не растягивается на всю строку. */
.header-search {
    width: 100%;
    max-width: 340px;
    margin-right: auto;
}

.header-actions {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    flex-shrink: 0;
}

.btn-account {
    background: var(--account);
    border-color: var(--account);
    color: #fff;
    font-weight: 500;
}

.btn-account:hover {
    background: #ea6a08;
    border-color: #ea6a08;
    color: #fff;
}

.account-menu {
    min-width: 250px;
    padding: 0.75rem 0;
    border: 0;
    border-radius: 0.75rem;
    box-shadow: 0 12px 32px rgba(20, 20, 40, 0.16);
}

.account-menu-name {
    padding: 0.25rem 1.25rem 0.75rem;
    font-weight: 600;
}

.account-menu .dropdown-item {
    padding: 0.5rem 1.25rem;
}

/* Подсказка под пунктом, как в текущем кабинете. */
.account-menu-hint {
    display: block;
    color: var(--muted, #8a8a94);
    font-size: 0.85rem;
}

.btn-cart {
    position: relative;
    border: 1px solid var(--border);
    color: var(--brand);
    font-size: 1.15rem;
    transition: border-color 0.15s ease, color 0.15s ease;
}

.btn-cart:hover {
    border-color: var(--brand);
    color: var(--brand-dark);
}

/* Количество меняется только кнопками «−» и «+». */
input[type='number']::-webkit-outer-spin-button,
input[type='number']::-webkit-inner-spin-button {
    -webkit-appearance: none;
    appearance: none;
    margin: 0;
}

input[type='number'] {
    -moz-appearance: textfield;
    appearance: textfield;
}

.pickup-info {
    padding: 0.85rem 1rem;
    background: #f7f6fa;
    border: 1px solid var(--border, #e5e5ea);
    border-radius: 0.5rem;
    font-size: 0.95rem;
}

/* Колонки корзины не должны менять ширину при пересчёте суммы. */
.cart-table {
    table-layout: fixed;
}

.cart-table td,
.cart-table th {
    overflow-wrap: anywhere;
}

/* Цифры одинаковой ширины: сумма меняется, а колонка стоит на месте. */
.cart-table td:nth-last-child(2),
.cart-table td:nth-last-child(3) {
    font-variant-numeric: tabular-nums;
}

.cart-badge {
    position: absolute;
    top: -6px;
    right: -6px;
    background: var(--account);
    color: #fff;
    border-radius: 999px;
    font-size: 0.7rem;
    line-height: 1;
    padding: 0.25rem 0.4rem;
}

.client-switch {
    border-top: 1px solid var(--border);
    background: #faf9fc;
    padding: 0.5rem 0;
}

/* ---------- Меню каталога ---------- */

.catalog-menu {
    position: relative;
    flex-shrink: 0;
}

.catalog-dropdown {
    display: none;
    position: absolute;
    top: calc(100% + 0.5rem);
    left: 0;
    min-width: 320px;
    background: #fff;
    border: 1px solid var(--border);
    border-radius: 0.5rem;
    box-shadow: 0 12px 32px rgba(20, 12, 40, 0.14);
    z-index: 1040;
}

.catalog-menu:hover .catalog-dropdown,
.catalog-menu.open .catalog-dropdown {
    display: block;
}

/*
 * Невидимый мостик закрывает зазор между кнопкой и списком:
 * без него курсор «проваливается» и меню закрывается на полпути.
 */
.catalog-dropdown::before {
    content: '';
    position: absolute;
    top: -0.6rem;
    left: 0;
    right: 0;
    height: 0.6rem;
}

.catalog-groups {
    list-style: none;
    margin: 0;
    padding: 0.4rem 0;
}

.catalog-group > a {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    padding: 0.55rem 1rem;
    color: #1b1b1f;
    font-size: 0.92rem;
    transition: background 0.12s ease, color 0.12s ease;
}

.catalog-group > a:hover {
    background: #f4f1f9;
    color: var(--brand);
    text-decoration: none;
}

/* Поп-ап со скрытыми категориями группы. */
.catalog-subpanel {
    display: none;
    position: absolute;
    top: 0;
    left: 100%;
    min-width: 320px;
    max-height: 70vh;
    overflow-y: auto;
    padding: 0.75rem 0;
    background: #fff;
    border: 1px solid var(--border);
    border-radius: 0 0.5rem 0.5rem 0;
    box-shadow: 0 12px 32px rgba(20, 12, 40, 0.14);
}

.catalog-group:hover .catalog-subpanel,
.catalog-group.open .catalog-subpanel {
    display: block;
}

/* Мостик к подменю: курсор проходит по диагонали, не теряя наведение. */
.catalog-subpanel::before {
    content: '';
    position: absolute;
    top: 0;
    bottom: 0;
    left: -0.75rem;
    width: 0.75rem;
}

.catalog-subpanel-title {
    font-weight: 600;
    font-size: 0.8rem;
    text-transform: uppercase;
    color: var(--muted);
    padding: 0 1rem 0.5rem;
}

.catalog-subpanel ul {
    list-style: none;
    margin: 0;
    padding: 0;
}

.catalog-subpanel a {
    display: block;
    padding: 0.4rem 1rem;
    color: #1b1b1f;
    font-size: 0.9rem;
}

.catalog-subpanel a:hover {
    background: #f4f1f9;
    color: var(--brand);
    text-decoration: none;
}

/* ---------- Баннер ---------- */

/* Баннер занимает всю ширину страницы, высота сохранена. */
.banner-full {
    width: 100vw;
    margin-left: calc(50% - 50vw);
    margin-bottom: 2rem;
}

.banner-full img {
    width: 100%;
    height: 260px;
    object-fit: cover;
    display: block;
}

/* ---------- Плитка групп ---------- */

.group-tile {
    display: block;
    border: 1px solid var(--border);
    border-radius: 0.5rem;
    overflow: hidden;
    background: #fff;
    height: 100%;
    transition: transform 0.15s ease, box-shadow 0.15s ease, border-color 0.15s ease;
}

.group-tile:hover {
    transform: translateY(-3px);
    border-color: var(--brand);
    box-shadow: 0 10px 24px rgba(20, 12, 40, 0.12);
    text-decoration: none;
}

.group-tile-media {
    aspect-ratio: 1 / 1;
    background: #f2f2f5;
}

/* Логотип вписывается в плитку целиком, фон остаётся подложкой. */
.group-tile-media img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    padding: 0.75rem;
}

.group-tile-title {
    padding: 0.85rem 0.75rem;
    text-align: center;
    font-weight: 600;
    font-size: 0.85rem;
    text-transform: uppercase;
    color: #1b1b1f;
}

/* ---------- Карточка товара в списке ---------- */

.product-card {
    border: 1px solid var(--border);
    border-radius: 0.5rem;
    background: #fff;
    height: 100%;
    display: flex;
    flex-direction: column;
    transition: box-shadow 0.15s ease, border-color 0.15s ease;
}

.product-card:hover {
    border-color: var(--brand);
    box-shadow: 0 8px 20px rgba(20, 12, 40, 0.1);
}

/* Фото товара квадратное, а не вытянутое. */
.product-media {
    aspect-ratio: 1 / 1;
    background: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    border-bottom: 1px solid var(--border);
}

.product-media img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    padding: 0.5rem;
}

.product-card-body {
    padding: 0.75rem;
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
    flex-grow: 1;
}

.product-name {
    font-size: 0.9rem;
    font-weight: 500;
    color: #1b1b1f;
    line-height: 1.35;
}

.product-name:hover {
    color: var(--brand);
    text-decoration: none;
}

.product-meta {
    font-size: 0.78rem;
    color: var(--muted);
}

.product-price {
    color: var(--price);
    font-size: var(--price-size);
    font-weight: var(--price-weight);
}

.product-price-hidden {
    font-size: 0.85rem;
    color: var(--muted);
}

.availability-in {
    color: #1a9d5a;
    font-size: 0.78rem;
    font-weight: 500;
}

.availability-order {
    color: #c07a00;
    font-size: 0.78rem;
    font-weight: 500;
}

.availability-none {
    color: var(--muted);
    font-size: 0.78rem;
}

.multiply-hint {
    font-size: 0.75rem;
    color: var(--muted);
}

/* ---------- Карточка товара ---------- */

.gallery-main {
    aspect-ratio: 1 / 1;
    border: 1px solid var(--border);
    border-radius: 0.5rem;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    background: #fff;
}

.gallery-main img,
.gallery-main video {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

/* Миниатюры расположены под основным фото. */
.gallery-thumbs {
    display: flex;
    gap: 0.5rem;
    margin-top: 0.75rem;
    flex-wrap: wrap;
}

.gallery-thumb {
    width: 68px;
    height: 68px;
    border: 1px solid var(--border);
    border-radius: 0.35rem;
    padding: 0.2rem;
    background: #fff;
    cursor: pointer;
    transition: border-color 0.15s ease;
}

.gallery-thumb img {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

.gallery-thumb:hover,
.gallery-thumb.active {
    border-color: var(--brand);
}

.taplink-btn {
    border: 1px solid var(--brand);
    color: var(--brand);
    background: #fff;
    transition: background 0.15s ease, color 0.15s ease;
}

.taplink-btn:hover {
    background: var(--brand);
    color: #fff;
}

.spec-table th {
    width: 45%;
    font-weight: 500;
    color: var(--muted);
    font-size: 0.88rem;
}

.spec-table td {
    font-size: 0.88rem;
}

/* ---------- Футер ---------- */

.site-footer {
    border-top: 1px solid var(--border);
    padding: 2.5rem 0;
    margin-top: 3rem;
    background: #fafafc;
}

.footer-brand {
    font-weight: 700;
    font-size: 1.2rem;
    color: var(--brand);
    margin-bottom: 0.75rem;
}

.footer-text {
    font-size: 0.9rem;
    color: var(--muted);
    margin-bottom: 0.5rem;
}

.footer-links {
    list-style: none;
    margin: 0;
    padding: 0;
}

.footer-links li {
    margin-bottom: 0.4rem;
}

.footer-links a,
.footer-feedback {
    font-size: 0.9rem;
    color: var(--muted);
    text-decoration: none;
}

.footer-links a:hover,
.footer-feedback:hover {
    color: var(--brand);
}

.footer-socials a {
    font-size: 1.35rem;
    margin-right: 0.75rem;
    color: var(--brand);
}

@media (max-width: 991px) {
    .header-row {
        flex-wrap: wrap;
        gap: 0.75rem;
    }

    .header-search {
        max-width: none;
        order: 5;
    }

    .banner-full img {
        height: 160px;
    }
}
