:root {
  --brand: #0f5e9c;
  --brand-dark: #0b4673;
  --accent: #e8541e;
  --ink: #1d2733;
  --muted: #687584;
  --line: #e3e8ee;
  --bg: #f5f7fa;
  --card: #fff;
  --ok: #1e8e4e;
  --err: #c62828;
  --radius: 10px;
}
* { box-sizing: border-box; }
body { margin: 0; font-family: system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif; color: var(--ink); background: var(--bg); line-height: 1.5; }
a { color: var(--brand); }
img { max-width: 100%; display: block; }
.wrap { max-width: 1200px; margin: 0 auto; padding: 0 16px; }
h1 { font-size: 1.7rem; margin: .6em 0; }
h2 small { color: var(--muted); font-weight: 400; font-size: .8em; }

/* Header */
.topbar { background: var(--brand-dark); color: #dfe9f3; font-size: .85rem; }
.topbar .wrap { display: flex; justify-content: space-between; padding: 6px 16px; }
.topbar a { color: #fff; text-decoration: none; }
.site-header { background: var(--card); border-bottom: 1px solid var(--line); }
.header-main { display: flex; align-items: center; gap: 20px; padding: 14px 16px; }
.logo { display: flex; align-items: center; gap: 10px; text-decoration: none; color: var(--ink); }
.logo-mark { background: var(--brand); color: #fff; font-weight: 800; border-radius: 8px; width: 44px; height: 44px; display: grid; place-items: center; font-size: 1.1rem; }
.logo strong { display: block; font-size: 1.25rem; }
.logo small { display: block; color: var(--muted); font-size: .78rem; }
.search { flex: 1; display: flex; max-width: 520px; margin-left: auto; }
.search input { flex: 1; padding: 10px 12px; border: 1px solid var(--line); border-radius: var(--radius) 0 0 var(--radius); font-size: 1rem; }
.search button { border: 0; background: var(--brand); color: #fff; padding: 0 16px; border-radius: 0 var(--radius) var(--radius) 0; cursor: pointer; font-size: .95rem; }
.cart-link { text-decoration: none; font-weight: 600; white-space: nowrap; color: var(--ink); }
.badge { background: var(--accent); color: #fff; border-radius: 999px; padding: 1px 8px; font-size: .8rem; }
.catnav { border-top: 1px solid var(--line); }
.catnav .wrap { display: flex; gap: 4px; overflow-x: auto; padding: 0 16px; }
.catnav a { padding: 10px 12px; text-decoration: none; color: var(--ink); white-space: nowrap; border-bottom: 3px solid transparent; font-size: .95rem; }
.catnav a.active, .catnav a:hover { border-color: var(--brand); color: var(--brand); }
.catnav .promo-link { color: var(--accent); font-weight: 600; }

/* Hero */
.hero { margin: 20px 0; background: linear-gradient(120deg, var(--brand), #1b7fc4); color: #fff; border-radius: 14px; padding: 32px; display: grid; grid-template-columns: 2fr 1fr; gap: 24px; align-items: center; }
.hero h1 { margin-top: 0; font-size: 2rem; }
.hero p { opacity: .92; max-width: 560px; }
.hero .btn { background: var(--accent); }
.hero-points { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; }
.hero-points li { background: rgba(255,255,255,.14); padding: 10px 14px; border-radius: 8px; }

/* Buttons */
.btn { display: inline-block; background: var(--brand); color: #fff; border: 0; border-radius: var(--radius); padding: 10px 18px; font-size: 1rem; font-weight: 600; cursor: pointer; text-decoration: none; }
.btn:hover { filter: brightness(1.08); }
.btn-big { padding: 14px 26px; font-size: 1.08rem; }
.btn-ghost { background: transparent; color: var(--brand); border: 1px solid var(--brand); }
.link-btn { background: none; border: 0; color: var(--brand); cursor: pointer; padding: 0; font-size: inherit; }
.link-btn.danger { color: var(--err); }

/* List */
.list-head { display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 10px; }
.sort select { padding: 6px 8px; border-radius: 8px; border: 1px solid var(--line); }
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 18px; margin-bottom: 30px; }
.card { background: var(--card); border-radius: var(--radius); overflow: hidden; text-decoration: none; color: var(--ink); border: 1px solid var(--line); transition: box-shadow .15s, transform .15s; display: flex; flex-direction: column; }
.card:hover { box-shadow: 0 6px 22px rgba(20,40,70,.12); transform: translateY(-2px); }
.card-img { position: relative; aspect-ratio: 1; background: #fff; }
.card-img img { width: 100%; height: 100%; object-fit: contain; }
.card-body { padding: 12px 14px 16px; }
.card-body h3 { font-size: 1rem; margin: 2px 0 8px; font-weight: 600; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.card-cond { font-size: .78rem; color: var(--muted); }
.price .old { text-decoration: line-through; color: var(--muted); margin-right: 8px; font-size: .9em; }
.price .new { font-weight: 800; font-size: 1.15rem; color: var(--ink); }
.price .old + .new { color: var(--accent); }
.price.big .new { font-size: 1.8rem; }
.tag { position: absolute; top: 10px; left: 10px; padding: 3px 9px; border-radius: 6px; font-size: .82rem; font-weight: 700; color: #fff; }
.tag-promo { background: var(--accent); }
.tag-promo.big { font-size: 1.05rem; }
.tag-out { background: #555; left: auto; right: 10px; }
.empty { padding: 40px 0; text-align: center; color: var(--muted); }
.pager { display: flex; gap: 6px; justify-content: center; margin: 10px 0 30px; }
.pager a { padding: 6px 12px; border: 1px solid var(--line); border-radius: 6px; text-decoration: none; background: #fff; }
.pager a.active { background: var(--brand); color: #fff; }

/* Product */
.crumbs { font-size: .88rem; color: var(--muted); margin: 14px 0; }
.product { display: grid; grid-template-columns: 1.1fr 1fr; gap: 32px; background: var(--card); padding: 24px; border-radius: 14px; border: 1px solid var(--line); }
.gallery-main { position: relative; aspect-ratio: 1; background: #fff; border-radius: var(--radius); overflow: hidden; border: 1px solid var(--line); }
.gallery-main img { width: 100%; height: 100%; object-fit: contain; }
.thumbs { display: flex; gap: 8px; margin-top: 10px; flex-wrap: wrap; }
.thumb { width: 72px; height: 72px; border: 2px solid var(--line); border-radius: 8px; padding: 0; cursor: pointer; background: #fff; overflow: hidden; }
.thumb img { width: 100%; height: 100%; object-fit: cover; }
.thumb.active { border-color: var(--brand); }
.info h1 { margin-top: 0; }
.cond-badge { display: inline-block; background: #eaf3fb; color: var(--brand-dark); padding: 4px 10px; border-radius: 6px; font-size: .88rem; margin-bottom: 14px; }
.promo-until { color: var(--accent); font-size: .9rem; margin-top: 4px; }
.stock.in { color: var(--ok); font-weight: 600; }
.stock.out { color: var(--err); font-weight: 600; }
.add-form { display: flex; gap: 12px; align-items: end; margin: 16px 0 20px; flex-wrap: wrap; }
.add-form input { width: 80px; padding: 10px; border-radius: 8px; border: 1px solid var(--line); font-size: 1rem; display: block; }
.desc { margin: 18px 0; white-space: normal; }
.note-box { background: #f1f6fb; border-left: 4px solid var(--brand); padding: 10px 14px; border-radius: 6px; font-size: .92rem; margin: 12px 0; }
.related-h { margin-top: 34px; }

/* Cart & checkout */
.cart-table { width: 100%; background: #fff; border-collapse: collapse; border-radius: var(--radius); overflow: hidden; border: 1px solid var(--line); }
.cart-table th, .cart-table td { padding: 12px; border-bottom: 1px solid var(--line); text-align: left; }
.cart-table input { width: 70px; padding: 6px; }
.ct-img img { width: 64px; height: 64px; object-fit: contain; }
.cart-foot { display: flex; justify-content: space-between; align-items: center; margin: 16px 0; }
.cart-total { text-align: right; font-size: 1.2rem; }
.right { text-align: right; margin-bottom: 30px; }
.err-text { color: var(--err); }
.checkout { display: grid; grid-template-columns: 1.5fr 1fr; gap: 28px; align-items: start; margin-bottom: 30px; }
.form { background: #fff; padding: 22px; border-radius: 14px; border: 1px solid var(--line); }
.form label { display: block; margin-bottom: 14px; font-weight: 500; }
.form input:not([type=radio]):not([type=checkbox]), .form textarea, .form select { display: block; width: 100%; margin-top: 4px; padding: 10px 12px; border: 1px solid #cfd7e0; border-radius: 8px; font: inherit; }
.form fieldset { border: 1px solid var(--line); border-radius: 8px; margin: 0 0 14px; padding: 10px 14px; }
.form legend { font-weight: 600; padding: 0 4px; }
.form label.radio { font-weight: 400; display: flex; gap: 8px; align-items: center; margin-bottom: 6px; }
.field-err { display: block; color: var(--err); font-size: .85rem; font-weight: 400; }
.hp { position: absolute; left: -9999px; }
.summary { background: #fff; padding: 20px; border-radius: 14px; border: 1px solid var(--line); position: sticky; top: 16px; }
.summary h3 { margin-top: 0; }
.sum-line { display: flex; justify-content: space-between; gap: 10px; padding: 6px 0; border-bottom: 1px dashed var(--line); }
.sum-line.total { font-weight: 800; font-size: 1.15rem; border: 0; }
.thanks { text-align: center; background: #fff; padding: 40px 20px; border-radius: 14px; margin: 30px 0; border: 1px solid var(--line); }
.big-check { font-size: 3rem; color: var(--ok); }
.page { background: #fff; padding: 10px 28px 24px; border-radius: 14px; border: 1px solid var(--line); margin: 20px 0 30px; max-width: 820px; }

.flash { padding: 12px 16px; border-radius: 8px; margin: 16px 0; font-weight: 500; }
.flash-ok { background: #e6f4ec; color: #145c34; }
.flash-err { background: #fdecea; color: #8e1c1c; }

/* Footer */
.site-footer { background: #17212c; color: #c4ceda; margin-top: 40px; padding: 30px 0 10px; font-size: .92rem; }
.site-footer a { color: #fff; }
.site-footer h4 { color: #fff; margin-top: 0; }
.footer-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 24px; }
.copy { border-top: 1px solid #2b3846; margin-top: 16px; padding-top: 10px; font-size: .82rem; }

@media (max-width: 820px) {
  .header-main { flex-wrap: wrap; }
  .search { order: 3; max-width: none; flex-basis: 100%; }
  .cart-link { margin-left: auto; }
  .hero, .product, .checkout, .footer-grid { grid-template-columns: 1fr; }
  .hero { padding: 22px; }
  .hero h1 { font-size: 1.5rem; }
  .product { padding: 14px; }
  .hide-sm { display: none; }
  .grid { grid-template-columns: repeat(2, 1fr); gap: 10px; }
  .cart-table thead { display: none; }
  .cart-table tr { display: grid; grid-template-columns: 70px 1fr auto; }
  .cart-table td { border: 0; padding: 6px; }
  .cart-table td[data-label]::before { content: attr(data-label) ": "; color: var(--muted); }
}
@media (max-width: 520px) {
  .logo small, .hero-points { display: none; }
  .header-main { gap: 12px; }
  .cart-link { order: 2; }
}
