:root{--bg:#fafafa;--fg:#1a1a1a;--muted:#666;--accent:#8a6a3b;--radius:12px;--max:1280px}
*{box-sizing:border-box;margin:0;padding:0}
body{font:16px/1.5 system-ui,-apple-system,"Segoe UI",Roboto,sans-serif;background:var(--bg);color:var(--fg)}
a{color:inherit;text-decoration:none}
.container{max-width:var(--max);margin:0 auto;padding:24px}
.site-header{display:flex;align-items:center;justify-content:space-between;padding:16px 24px;background:#fff;border-bottom:1px solid #eee;position:sticky;top:0;z-index:50}
.logo{font-weight:700;font-size:20px;letter-spacing:.5px}
.logo span{color:var(--accent);font-weight:400}
.nav{display:flex;gap:20px;align-items:center}
.nav a:hover{color:var(--accent)}
.cart-link{background:var(--accent);color:#fff;padding:8px 14px;border-radius:999px;font-size:14px}
.site-footer{padding:24px;text-align:center;color:var(--muted);border-top:1px solid #eee;margin-top:40px}
@media(max-width:600px){.nav{gap:12px;font-size:14px}.container{padding:16px}}

/* --- Плитки разделов и брендов --- */
.block { margin: 40px 0; }
.block h2 { font-size: 24px; margin-bottom: 20px; border-bottom: 2px solid var(--accent); padding-bottom: 10px; }
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 16px; }
.card { display: flex; align-items: center; justify-content: center; text-align: center; padding: 24px 16px; background: #fff; border: 1px solid #eee; border-radius: var(--radius); font-weight: 500; transition: all 0.2s; min-height: 100px; }
.card:hover { border-color: var(--accent); box-shadow: 0 4px 12px rgba(138,106,59,0.1); color: var(--accent); transform: translateY(-2px); }
.card.brand { background: var(--fg); color: #fff; }
.card.brand:hover { background: var(--accent); color: #fff; }

/* --- Хлебные крошки --- */
.breadcrumbs { font-size: 14px; color: var(--muted); margin-bottom: 20px; }
.breadcrumbs a { color: var(--accent); }

/* --- Макет с сайдбаром --- */
.layout-sidebar { display: grid; grid-template-columns: 240px 1fr; gap: 30px; align-items: start; }
.sidebar { background: #fff; padding: 20px; border-radius: var(--radius); border: 1px solid #eee; position: sticky; top: 80px; }
.sidebar h3 { margin-bottom: 15px; font-size: 18px; }
.brand-list { list-style: none; }
.brand-list li { margin-bottom: 8px; }
.brand-list a { display: block; padding: 4px 0; color: var(--fg); font-size: 14px; }
.brand-list a:hover, .brand-list a.active { color: var(--accent); font-weight: 600; }

/* --- Сетка товаров --- */
.product-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 20px; }
.product-card { background: #fff; border-radius: var(--radius); overflow: hidden; border: 1px solid #eee; display: flex; flex-direction: column; transition: box-shadow 0.2s; }
.product-card:hover { box-shadow: 0 6px 20px rgba(0,0,0,0.06); }
.product-img { display: flex; align-items: center; justify-content: center; height: 180px; background: #f5f5f5; font-size: 14px; color: var(--muted); text-align: center; padding: 10px; }
.product-info { padding: 15px; display: flex; flex-direction: column; gap: 6px; flex: 1; }
.product-brand { font-size: 12px; text-transform: uppercase; color: var(--muted); }
.product-title { font-weight: 500; line-height: 1.3; }
.product-title:hover { color: var(--accent); }
.product-price { font-weight: 700; font-size: 18px; margin-top: auto; }
.btn-add { background: var(--accent); color: #fff; border: none; padding: 10px; border-radius: 8px; cursor: pointer; font-weight: 600; margin-top: 10px; transition: background 0.2s; }
.btn-add:hover { background: #6e532d; }
.empty { color: var(--muted); padding: 20px; background: #fff; border-radius: var(--radius); text-align: center; }

@media (max-width: 768px) {
    .layout-sidebar { grid-template-columns: 1fr; }
    .sidebar { position: static; }
}

/* --- Карточка товара --- */
.product-page { display: grid; grid-template-columns: 1fr 1fr; gap: 40px; }
.product-gallery .main-img { background: #f5f5f5; border-radius: var(--radius); height: 400px; display: flex; align-items: center; justify-content: center; overflow: hidden; }
.product-gallery img { max-width: 100%; max-height: 100%; object-fit: contain; }
.no-img { color: var(--muted); }
.product-brand-link { text-transform: uppercase; font-size: 13px; color: var(--muted); margin-bottom: 8px; }
.product-brand-link a:hover { color: var(--accent); }
.product-details h1 { font-size: 28px; margin-bottom: 16px; }
.product-price-big { font-size: 32px; font-weight: 700; color: var(--accent); margin-bottom: 20px; }
.product-actions { display: flex; gap: 12px; margin-bottom: 20px; flex-wrap: wrap; }
.product-actions button, .btn-buy { border: none; padding: 12px 20px; border-radius: 8px; cursor: pointer; font-weight: 600; }
.btn-buy { background: var(--accent); color: #fff; }
.btn-buy:hover { background: #6e532d; }
.btn-compare { background: #fff; border: 1px solid #ddd; }
.short-desc { margin: 20px 0; color: var(--muted); }
.attrs-table { width: 100%; border-collapse: collapse; margin: 20px 0; }
.attrs-table th, .attrs-table td { padding: 8px; border-bottom: 1px solid #eee; text-align: left; font-size: 14px; }
.attrs-table th { color: var(--muted); font-weight: 500; width: 40%; }
.product-desc { line-height: 1.7; margin-top: 20px; }

/* --- Модалка --- */
.modal { position: fixed; inset: 0; background: rgba(0,0,0,0.5); display: flex; align-items: center; justify-content: center; z-index: 100; padding: 20px; }
.modal[hidden] { display: none; }
.modal-box { background: #fff; padding: 30px; border-radius: var(--radius); max-width: 420px; width: 100%; position: relative; }
.modal-box h3 { margin-bottom: 12px; }
.modal-box input { display: block; width: 100%; padding: 10px; margin: 10px 0; border: 1px solid #ddd; border-radius: 8px; font-size: 15px; }
.modal-close { position: absolute; top: 10px; right: 14px; background: none; border: none; font-size: 24px; cursor: pointer; color: var(--muted); }

/* --- Корзина --- */
.cart-table { width: 100%; border-collapse: collapse; background: #fff; border-radius: var(--radius); overflow: hidden; }
.cart-table th, .cart-table td { padding: 14px; border-bottom: 1px solid #eee; text-align: left; }
.cart-table th { background: #f9f9f9; font-size: 13px; text-transform: uppercase; color: var(--muted); }
.btn-remove { background: none; border: 1px solid #ddd; border-radius: 6px; width: 32px; height: 32px; cursor: pointer; color: #c00; }
.cart-actions { margin-top: 20px; text-align: right; }

@media (max-width: 768px) {
    .product-page { grid-template-columns: 1fr; }
    .cart-table th:nth-child(2), .cart-table td:nth-child(2) { display: none; }
}

/* --- Карточка товара --- */
.product-page { display: grid; grid-template-columns: 1fr 1fr; gap: 40px; }
.product-gallery .no-img { background: #f5f5f5; border-radius: var(--radius); height: 400px; display: flex; align-items: center; justify-content: center; color: var(--muted); }
.product-brand-link { text-transform: uppercase; font-size: 13px; color: var(--muted); margin-bottom: 8px; }
.product-brand-link a:hover { color: var(--accent); }
.product-details h1 { font-size: 28px; margin-bottom: 16px; }
.product-price-big { font-size: 32px; font-weight: 700; color: var(--accent); margin-bottom: 20px; }
.product-actions { display: flex; gap: 12px; margin-bottom: 20px; flex-wrap: wrap; }
.product-actions button, .btn-buy { border: none; padding: 12px 20px; border-radius: 8px; cursor: pointer; font-weight: 600; }
.btn-buy { background: var(--accent); color: #fff; }
.btn-buy:hover { background: #6e532d; }
.btn-compare { background: #fff; border: 1px solid #ddd; }
.short-desc { margin: 20px 0; color: var(--muted); }
.attrs-table { width: 100%; border-collapse: collapse; margin: 20px 0; }
.attrs-table th, .attrs-table td { padding: 8px; border-bottom: 1px solid #eee; text-align: left; font-size: 14px; }
.attrs-table th { color: var(--muted); font-weight: 500; width: 40%; }
.product-desc { line-height: 1.7; margin-top: 20px; }

/* --- Модалка --- */
.modal { position: fixed; inset: 0; background: rgba(0,0,0,0.5); display: flex; align-items: center; justify-content: center; z-index: 100; padding: 20px; }
.modal[hidden] { display: none; }
.modal-box { background: #fff; padding: 30px; border-radius: var(--radius); max-width: 420px; width: 100%; position: relative; }
.modal-box h3 { margin-bottom: 12px; }
.modal-box input { display: block; width: 100%; padding: 10px; margin: 10px 0; border: 1px solid #ddd; border-radius: 8px; font-size: 15px; }
.modal-close { position: absolute; top: 10px; right: 14px; background: none; border: none; font-size: 24px; cursor: pointer; color: var(--muted); }

/* --- Корзина --- */
.cart-table { width: 100%; border-collapse: collapse; background: #fff; border-radius: var(--radius); overflow: hidden; }
.cart-table th, .cart-table td { padding: 14px; border-bottom: 1px solid #eee; text-align: left; }
.cart-table th { background: #f9f9f9; font-size: 13px; text-transform: uppercase; color: var(--muted); }
.btn-remove { background: none; border: 1px solid #ddd; border-radius: 6px; width: 32px; height: 32px; cursor: pointer; color: #c00; }
.cart-actions { margin-top: 20px; text-align: right; }

@media (max-width: 768px) {
    .product-page { grid-template-columns: 1fr; }
    .cart-table th:nth-child(2), .cart-table td:nth-child(2) { display: none; }
}

/* --- Боковой фильтр --- */
.mt-20 { margin-top: 20px; }
.brand-hover .has-collections { position: relative; }
.brand-hover .brand-name { display: block; padding: 4px 0; font-size: 14px; color: var(--fg); cursor: default; }
.brand-hover .collections-popup {
    display: none;
    position: absolute;
    left: 100%;
    top: 0;
    background: #fff;
    border: 1px solid #eee;
    border-radius: 8px;
    padding: 8px 12px;
    min-width: 160px;
    box-shadow: 0 4px 16px rgba(0,0,0,0.08);
    list-style: none;
    z-index: 20;
}
.brand-hover .collections-popup li {
    font-size: 13px;
    color: var(--muted);
    padding: 3px 0;
    white-space: nowrap;
}
.brand-hover .has-collections:hover .collections-popup { display: block; }

/* --- Плитки разделов (компактные) --- */
.card {
    min-height: calc(2 * 1.5em); /* 2 × высота строки */
    padding: 0.75em 1em;
    font-size: 1em;
    font-weight: 500;
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
}

/* ===== Модалки ===== */
.modal[hidden]{display:none !important}
.modal{position:fixed;inset:0;background:rgba(0,0,0,.45);display:flex;align-items:center;justify-content:center;z-index:1000;padding:16px}
.modal-box{background:#fff;border-radius:12px;padding:24px;max-width:420px;width:100%;position:relative;box-shadow:0 10px 40px rgba(0,0,0,.2)}
.modal-box h3{margin:0 0 8px}
.modal-sub{color:var(--muted);margin:0 0 16px}
.modal-note{font-size:12px;color:var(--muted);margin-top:10px}
.modal-box form{display:flex;flex-direction:column;gap:10px}
.modal-box input{padding:10px 12px;border:1px solid #ddd;border-radius:8px;font-size:14px}
.modal-close{position:absolute;top:8px;right:10px;background:none;border:none;font-size:24px;cursor:pointer;color:#999;line-height:1}
.modal-close:hover{color:#000}

/* ===== Toast ===== */
.toast-wrap{position:fixed;top:16px;right:16px;z-index:1100;display:flex;flex-direction:column;gap:8px}
.toast{background:#222;color:#fff;padding:10px 16px;border-radius:8px;font-size:14px;box-shadow:0 4px 16px rgba(0,0,0,.2);animation:toast-in .2s ease}
@keyframes toast-in{from{opacity:0;transform:translateY(-6px)}to{opacity:1;transform:none}}

/* ===== Кнопки карточки ===== */
.product-actions{display:flex;gap:6px;flex-wrap:wrap;margin-top:8px}
.btn-compare{background:#f4f4f4;border:1px solid #ddd;border-radius:8px;padding:8px 10px;cursor:pointer;font-size:14px}
.btn-compare.active{background:#111;color:#fff;border-color:#111}

/* ===== Калькулятор ===== */
.calc{margin:20px 0;padding:16px;background:#f8f8f8;border-radius:12px}
.calc h3{margin:0 0 12px;font-size:16px}
.calc label{display:block;margin-bottom:8px;font-size:14px}
.calc input{padding:6px 8px;border:1px solid #ddd;border-radius:6px;width:80px;margin-left:6px}
.calc-result{margin-top:6px;font-size:14px}
.calc-result strong{color:#111}

/* ===== Сравнение ===== */
.compare-table{width:100%;border-collapse:collapse;margin-top:16px;font-size:14px}
.compare-table th,.compare-table td{border:1px solid #eee;padding:10px;text-align:left;vertical-align:top}
.compare-table thead th{background:#fafafa}
.btn-clear-compare{margin-top:16px;padding:8px 14px;border:1px solid #ddd;background:#fff;border-radius:8px;cursor:pointer}

/* ===== Мобильный сайдбар ===== */
@media (max-width: 860px){
  .layout-sidebar{grid-template-columns:1fr !important}
  .brand-hover .collections-popup{position:static;box-shadow:none;border:none;padding:4px 0 4px 16px;display:none}
  .brand-hover .has-collections:hover .collections-popup{display:none}
  .brand-hover .has-collections.open .collections-popup{display:block}
  .brand-name.toggle{cursor:pointer;user-select:none}
}

/* ссылки брендов/коллекций в сайдбаре */
.brand-hover .brand-name{display:flex;justify-content:space-between;align-items:center;padding:4px 0;font-size:14px;color:var(--fg);text-decoration:none}
.brand-hover .brand-name:hover{color:#000;text-decoration:underline}
.brand-hover .brand-name .toggle-mark{color:#bbb;font-style:normal;transition:transform .15s}
.brand-hover .has-collections:hover .brand-name .toggle-mark{transform:translateX(2px);color:#000}
.brand-hover .collections-popup a{color:var(--muted);text-decoration:none;font-size:13px}
.brand-hover .collections-popup a:hover{color:#000;text-decoration:underline}
.sidebar .brand-list a.active{font-weight:600;color:#000}
.filter-active{margin:0 0 12px;font-size:13px;color:var(--muted)}
.filter-active .clear-filter{margin-left:8px;color:#c00;text-decoration:none}
.filter-hint{font-size:12px;color:#aaa;margin-top:10px}

.pagination { display: flex; gap: 6px; justify-content: center; margin: 24px 0; flex-wrap: wrap; }
.pagination a { padding: 6px 12px; border: 1px solid #ddd; border-radius: 6px; text-decoration: none; color: #333; }
.pagination a.active { background: #8b6f3d; color: #fff; border-color: #8b6f3d; }
.pagination a:hover { background: #f5f5f5; }
