* { box-sizing: border-box; }

html, body { overflow-x: hidden; }

body {
    margin: 0;
    font-family: BlinkMacSystemFont, -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
    font-size: 14px;
    line-height: 1.4;
    color: #221f1f;
    background: #fff;
}

a { color: #3e77aa; text-decoration: none; }
a:hover { color: #f84147; }

/* ---------- header ---------- */
.header { background: #221f1f; }
.header__inner {
    max-width: 1340px;
    margin: 0 auto;
    padding: 12px 16px;
    display: flex;
    align-items: center;
    gap: 16px;
}
.logo { color: #fff; font-size: 30px; font-weight: 700; letter-spacing: -1px; white-space: nowrap; }
.logo b { color: #00a046; }
.logo:hover { color: #fff; }

.catalog { position: relative; }
.catalog-btn {
    display: flex; align-items: center; gap: 8px;
    height: 40px; padding: 0 16px;
    background: rgba(255, 255, 255, .1); color: #fff;
    border: 0; border-radius: 8px; font-size: 16px; cursor: pointer;
}
.catalog-btn:hover { background: rgba(255, 255, 255, .2); }
.catalog-menu {
    display: none;
    position: absolute; top: 48px; left: 0; z-index: 20;
    width: 240px; background: #fff; border-radius: 8px;
    box-shadow: 0 4px 16px rgba(0, 0, 0, .2); padding: 8px 0;
}
.catalog-menu.is-open { display: block; }
.catalog-menu a { display: block; padding: 8px 16px; color: #221f1f; }
.catalog-menu a:hover { background: #f5f5f5; color: #221f1f; }

.search { flex: 1; display: flex; max-width: 720px; }
.search input {
    flex: 1; height: 40px; min-width: 0; padding: 0 12px;
    border: 2px solid #fff; border-radius: 8px 0 0 8px; font-size: 14px;
}
.search button {
    height: 40px; padding: 0 20px;
    background: #00a046; color: #fff; border: 0; border-radius: 0 8px 8px 0;
    font-size: 16px; cursor: pointer;
}
.search button:hover { background: #00bc52; }
.header__icons { display: flex; gap: 18px; margin-left: auto; }
.header__icons a { color: #fff; position: relative; display: inline-flex; align-items: center; min-height: 36px; }
.header__counter { position: absolute; top: -4px; right: -8px; min-width: 16px; border-radius: 10px; padding: 0 4px; background: #00a046; text-align: center; font-size: 10px; }

/* ---------- page ---------- */
.page { max-width: 1340px; margin: 0 auto; padding: 16px 16px 40px; }
.breadcrumbs { color: #797878; font-size: 12px; margin-bottom: 12px; }
.breadcrumbs span { margin: 0 4px; }
.page__title { font-size: 28px; font-weight: 400; margin: 0 0 16px; }
.page__count { display: block; color: #797878; font-size: 12px; margin-top: 4px; }

.catalog-layout { display: flex; gap: 24px; align-items: flex-start; }

.filters { width: 240px; flex-shrink: 0; }
.filters__group { border-bottom: 1px solid #e9e9e9; padding: 12px 0; }
.filters__title { font-weight: 700; margin-bottom: 8px; }
.filters label { display: flex; gap: 8px; align-items: center; padding: 4px 0; cursor: pointer; }
.filters input { accent-color: #00a046; }
.filters__submit { display: block; margin: 12px 0; padding: 8px 16px; border: 0; border-radius: 4px; background: #00a046; color: #fff; cursor: pointer; }

.tiles {
    flex: 1;
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    min-width: 0;
    border-top: 1px solid #e9e9e9;
    border-left: 1px solid #e9e9e9;
}
.tile {
    position: relative;
    padding: 16px;
    border-right: 1px solid #e9e9e9;
    border-bottom: 1px solid #e9e9e9;
    display: flex; flex-direction: column;
}
.tile:hover { box-shadow: 0 2px 12px rgba(0, 0, 0, .15); z-index: 1; }
.tile__badge {
    display: none;
    position: absolute; top: 12px; left: 12px;
    background: #f84147; color: #fff; font-size: 12px; font-weight: 700;
    padding: 2px 6px; border-radius: 4px;
}
.tile__img { display: block; height: 200px; margin-bottom: 12px; }
.tile__img img { width: 100%; height: 100%; object-fit: contain; }
.tile__title { color: #221f1f; min-height: 40px; margin-bottom: 6px; }
.tile__title:hover { color: #f84147; }
.tile__rating { display: flex; align-items: center; gap: 6px; margin-bottom: 8px; }
.tile__reviews { color: #797878; font-size: 12px; }
.tile__bottom { display: flex; justify-content: space-between; align-items: flex-end; margin-top: auto; }
.tile__old { color: #797878; font-size: 13px; text-decoration: line-through; }
.tile__price { font-size: 24px; }
.tile__price--red { color: #f84147; }
.tile__cart { color: #00a046; border: 0; padding: 6px; background: none; cursor: pointer; font-size: 24px; }
.tile__favorite { position: absolute; top: 5px; right: 8px; z-index: 2; margin: 0; }
.favorite-button { border: 0; background: #fff; border-radius: 50%; font-size: 28px; width: 38px; height: 38px; cursor: pointer; color: #626262; line-height: 1; }
.favorite-button.is-active { color: #e63652; }
.tile__cart:hover { color: #00bc52; }
.tile__status { color: #00a046; font-size: 12px; margin-top: 6px; }
.empty { padding: 24px; color: #797878; }

.stars {
    --rating: 5;
    display: inline-block; font-size: 14px; line-height: 1;
    font-family: Arial, sans-serif; letter-spacing: 1px;
}
.stars::before {
    content: "★★★★★";
    background: linear-gradient(90deg, #ffa900 calc(var(--rating) / 5 * 100%), #d2d2d2 calc(var(--rating) / 5 * 100%));
    -webkit-background-clip: text; background-clip: text;
    color: transparent;
}

/* ---------- product ---------- */
.product__title { font-size: 24px; font-weight: 400; margin: 0 0 8px; }
.product__meta { display: flex; gap: 16px; align-items: center; margin-bottom: 20px; font-size: 13px; }
.product__code { color: #797878; }

.product {
    display: grid;
    grid-template-columns: minmax(0, 1.4fr) minmax(300px, 1fr);
    gap: 32px;
}
.gallery { display: flex; gap: 12px; min-width: 0; }
.buy { min-width: 0; }
.gallery__thumbs { display: flex; flex-direction: column; gap: 8px; }
.thumb { width: 64px; height: 64px; padding: 2px; border: 1px solid #e9e9e9; border-radius: 4px; background: #fff; cursor: pointer; }
.thumb.is-active { border-color: #00a046; }
.thumb img { width: 100%; height: 100%; object-fit: contain; }
.gallery__main { flex: 1; min-width: 0; border: 1px solid #e9e9e9; border-radius: 8px; height: 480px; touch-action: pan-y; }
.gallery__main img { width: 100%; height: 100%; object-fit: contain; }

.buy__status { color: #00a046; margin-bottom: 8px; }
.buy__box { border: 1px solid #e9e9e9; border-radius: 8px; padding: 16px; margin-bottom: 16px; }
.buy__old { color: #797878; text-decoration: line-through; }
.buy__price { font-size: 36px; }
.buy__price--red { color: #f84147; }
.buy__hint { color: #797878; font-size: 12px; margin-top: 4px; }

.order { border: 1px solid #e9e9e9; border-radius: 8px; padding: 16px; margin-bottom: 16px; }
.order__title { font-size: 18px; margin-bottom: 12px; }
.order label { display: block; font-size: 12px; color: #797878; margin-bottom: 12px; }
.order input[type=text], .order input[type=number], .order input[type=tel] {
    display: block; width: 100%; height: 40px; margin-top: 4px; padding: 0 12px;
    border: 1px solid #d2d2d2; border-radius: 8px; font-size: 16px; color: #221f1f;
}
.order input:focus { border-color: #00a046; outline: none; }
.order__note { color: #797878; font-size: 12px; margin: 8px 0 0; }
.order__error { color: #b42318; padding: 10px; background: #fff0ee; border-radius: 4px; }
.btn-green:disabled { opacity: .65; cursor: wait; }

.btn-green {
    display: inline-block; width: 100%; height: 48px;
    background: #00a046; color: #fff; border: 0; border-radius: 8px;
    font-size: 18px; text-align: center; line-height: 48px; cursor: pointer;
}
.btn-green:hover { background: #00bc52; color: #fff; }

.buy__info { list-style: none; padding: 0; margin: 0; font-size: 13px; }
.buy__info li { padding: 10px 0; border-bottom: 1px solid #e9e9e9; }
.buy__info b { display: block; }

.about { margin-top: 32px; max-width: 860px; }
.about h2 { font-size: 20px; font-weight: 400; }

.button-secondary { display: inline-block; border: 1px solid #00a046; color: #087834; background: #fff; border-radius: 6px; padding: 10px 14px; font: inherit; text-align: center; cursor: pointer; }
.button-secondary:hover { color: #fff; background: #008b3d; }
.text-button { border: 0; padding: 8px 0; color: #3e77aa; background: none; font: inherit; cursor: pointer; text-decoration: underline; }
.product__actions { display: flex; flex-wrap: wrap; gap: 10px; margin-bottom: 14px; }
.product__actions form { margin: 0; }
.saved-tiles { margin-top: 24px; }
.empty-state { padding: 24px; border: 1px solid #e9e9e9; border-radius: 8px; margin: 24px 0; }
.empty-state h2 { font-size: 20px; font-weight: 400; }
.cart-list { display: grid; gap: 12px; margin: 24px 0; }
.cart-item { display: flex; align-items: center; gap: 24px; border: 1px solid #e9e9e9; border-radius: 8px; padding: 16px; }
.cart-item img { width: 120px; height: 120px; object-fit: contain; }
.cart-item__details { flex: 1; }
.cart-item h2 { margin: 0 0 8px; font-size: 20px; }
.cart-item__actions { display: flex; flex-direction: column; gap: 8px; }
.list-clear { margin-top: 16px; }
.help-page { max-width: 920px; }
.help-page section { padding-top: 20px; border-bottom: 1px solid #eee; padding-bottom: 18px; scroll-margin-top: 16px; }
.help-page li { margin: 8px 0; }
.help-nav { display: flex; flex-wrap: wrap; gap: 12px 24px; }
.reviews-section { max-width: 860px; margin-top: 32px; scroll-margin-top: 16px; }
.review { border-top: 1px solid #e9e9e9; padding: 16px 0; overflow-wrap: anywhere; }
.review__meta { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; }
.review__meta time, .muted { color: #6b6b6b; font-size: 13px; }
.review-form { border: 1px solid #e9e9e9; border-radius: 8px; padding: 20px; margin-top: 20px; }
.review-form h3 { margin-top: 0; }
.review-form label { display: block; margin: 14px 0; }
.review-form input, .review-form select, .review-form textarea { display: block; width: 100%; margin-top: 4px; border: 1px solid #ccc; border-radius: 6px; padding: 10px; font: inherit; font-size: 16px; }
.review-form textarea { resize: vertical; }
.form-message { color: #07602b; background: #e5f5ea; border-radius: 4px; padding: 12px; }
.form-message--error { color: #b42318; background: #fff0ee; }
:focus-visible { outline: 2px solid #00a046; outline-offset: 3px; }

.thanks { text-align: center; padding: 60px 16px; max-width: 520px; margin: 0 auto; }
.thanks h1 { font-weight: 400; font-size: 26px; }
.thanks .btn-green { width: auto; padding: 0 32px; }

/* ---------- footer ---------- */
.footer { background: #f5f5f5; border-top: 1px solid #e9e9e9; margin-top: 40px; }
.footer__inner { max-width: 1340px; margin: 0 auto; padding: 24px 16px; display: flex; gap: 60px; flex-wrap: wrap; }
.footer__inner a, .footer__inner span { display: block; color: #221f1f; font-size: 13px; margin-bottom: 6px; }
.footer__title { font-weight: 700; margin-bottom: 10px; }
.footer__copy { text-align: center; color: #797878; font-size: 12px; padding: 0 16px 20px; }

/* ---------- responsive ---------- */
@media (max-width: 1100px) {
    .tiles { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
@media (max-width: 800px) {
    .catalog-layout { flex-direction: column; gap: 16px; }
    .filters { width: 100%; display: grid; grid-template-columns: 1fr 1fr; gap: 8px 16px; align-items: start; }
    .filters__group { border-bottom: 0; padding: 0; }
    .filters__submit { margin: 0; }
    .tiles { width: 100%; }
    .tiles { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .header__icons { display: flex; gap: 12px; margin-left: 0; }
    .header__icons .header__crm { display: none; }
    .header__inner { flex-wrap: wrap; gap: 10px; }
    .search { order: 3; flex-basis: 100%; max-width: none; }
    .logo { font-size: 24px; }
    .catalog-btn span { display: none; }
    .catalog { margin-left: auto; }
    .catalog-btn { padding: 0 10px; font-size: 14px; gap: 5px; }
    .catalog-menu { left: auto; right: 0; width: 220px; }
    .product { grid-template-columns: minmax(0, 1fr); gap: 20px; }
    .gallery { flex-direction: column-reverse; }
    .gallery__thumbs { flex-direction: row; }
    .gallery__main { flex: auto; height: 320px; width: 100%; }
    .product__meta { flex-wrap: wrap; gap: 8px 16px; }
    .search input { font-size: 16px; }
    .footer__inner { gap: 24px; }
    .cart-item { gap: 12px; flex-wrap: wrap; }
    .cart-item img { width: 88px; height: 88px; }
    .cart-item__actions { width: 100%; }
    .review-form { padding: 16px; }
}
@media (max-width: 400px) {
    .tile { padding: 10px; }
    .tile__img { height: 150px; }
    .tile__price { font-size: 21px; }
    .page__title { font-size: 24px; }
}
