:root {
  --bg:#f4f5f7;
  --panel:#ffffff;
  --text:#1d232a;
  --muted:#68717d;
  --line:#dfe3e8;
  --accent:#b5121b;
  --accent-dark:#8d0d14;
  --soft:#f7f8fa;
  --shadow:0 10px 28px rgba(16,24,40,.09);
  font-family:Arial,Helvetica,sans-serif;
  color-scheme:light;
}
*{box-sizing:border-box}
html,body{margin:0;min-height:100%;background:var(--bg);color:var(--text)}
body{min-width:320px}
a{color:inherit}
button,select,input{font:inherit}
button{cursor:pointer}
.topbar{display:flex;justify-content:space-between;gap:24px;align-items:flex-start;padding:20px clamp(16px,3vw,42px);background:#fff;border-bottom:1px solid var(--line)}
.brand{display:inline-block;color:var(--accent);font-weight:800;text-decoration:none;margin-bottom:5px}
.topbar h1{font-size:clamp(22px,3vw,34px);line-height:1.1;margin:0 0 7px}
.topbar p{margin:0;color:var(--muted);max-width:850px;line-height:1.45}
.shop-home{white-space:nowrap;text-decoration:none;background:var(--accent);color:#fff;border-radius:8px;padding:11px 15px;font-weight:700}
.shop-home:hover{background:var(--accent-dark)}
.layout{display:grid;grid-template-columns:minmax(0,1.25fr) minmax(360px,.75fr);gap:18px;padding:18px clamp(12px,2vw,28px);max-width:1680px;margin:0 auto}
.viewer-panel,.catalog-panel{background:var(--panel);border:1px solid var(--line);border-radius:12px;box-shadow:var(--shadow);overflow:hidden}
.viewer-toolbar{min-height:52px;padding:9px 12px;display:flex;gap:8px;align-items:center;border-bottom:1px solid var(--line);background:var(--soft)}
.viewer-toolbar button,.color-row button{border:1px solid #cfd5dc;background:#fff;border-radius:7px;padding:8px 11px;font-weight:700;color:#343b44}
.viewer-toolbar button:hover,.color-row button:hover{border-color:#8d98a6}
.status{margin-left:auto;font-size:13px;color:var(--muted);text-align:right}
.status.error{color:#a30b16;font-weight:700}
.viewer-wrap{position:relative;height:min(68vh,720px);min-height:470px;background:linear-gradient(180deg,#fbfcfd 0%,#eceff2 100%);touch-action:none}
#viewer{display:block;width:100%;height:100%;outline:none}
.viewer-hint{position:absolute;left:50%;bottom:14px;transform:translateX(-50%);background:rgba(255,255,255,.9);border:1px solid var(--line);border-radius:999px;padding:6px 11px;font-size:12px;color:var(--muted);pointer-events:none}
.mobile-group-row{display:none;padding:12px;border-top:1px solid var(--line);background:#fff}
.mobile-group-row label{font-weight:700;margin-right:8px}
.mobile-group-row select{width:100%;margin-top:6px;padding:10px;border:1px solid #cfd5dc;border-radius:7px;background:#fff}
.catalog-panel{display:flex;flex-direction:column;max-height:calc(100vh - 145px);min-height:640px}
.catalog-head{display:flex;justify-content:space-between;align-items:center;padding:16px 16px 10px;border-bottom:1px solid var(--line)}
.eyebrow{text-transform:uppercase;letter-spacing:.08em;font-size:11px;color:var(--muted);font-weight:700}
.catalog-head h2{font-size:22px;margin:3px 0 0}
.count{display:inline-flex;align-items:center;justify-content:center;min-width:36px;height:30px;border-radius:999px;background:#eef1f4;font-weight:800;color:#4f5965;padding:0 9px}
.group-buttons{display:flex;flex-wrap:wrap;gap:7px;padding:12px 14px;border-bottom:1px solid var(--line);max-height:154px;overflow:auto}
.group-buttons button{border:1px solid #d7dce2;background:#fff;border-radius:999px;padding:7px 10px;font-size:13px}
.group-buttons button:hover{border-color:#9aa4af}
.group-buttons button.active{background:var(--accent);border-color:var(--accent);color:#fff;font-weight:700}
.color-tools{padding:10px 14px;border-bottom:1px solid var(--line);background:#fafbfc}
.color-tools label{display:block;font-size:12px;font-weight:700;margin-bottom:6px;color:#505966}
.color-row{display:flex;gap:8px;align-items:center}
.color-row input[type=color]{width:52px;height:37px;padding:2px;border:1px solid #cfd5dc;border-radius:7px;background:#fff}
.products{padding:12px;overflow:auto;display:grid;grid-template-columns:1fr;gap:10px;align-content:start}
.product-card{display:grid;grid-template-columns:104px 1fr;gap:11px;border:1px solid var(--line);border-radius:10px;background:#fff;padding:9px;transition:border-color .15s,box-shadow .15s}
.product-card:hover{border-color:#adb6c0;box-shadow:0 4px 14px rgba(16,24,40,.07)}
.product-card.selected{border-color:var(--accent);box-shadow:0 0 0 1px var(--accent)}
.product-img{width:104px;height:88px;object-fit:contain;background:#f6f7f8;border-radius:7px;border:1px solid #eceff2}
.product-img.placeholder{display:flex;align-items:center;justify-content:center;font-size:11px;color:#8b949e;text-align:center;padding:8px}
.product-body{min-width:0}
.product-title{margin:0 0 4px;font-size:14px;line-height:1.3;font-weight:700}
.product-meta{display:flex;gap:7px;flex-wrap:wrap;color:var(--muted);font-size:12px;margin-bottom:7px}
.color-chip{display:inline-flex;align-items:center;gap:5px}
.color-dot{width:13px;height:13px;border-radius:50%;border:1px solid rgba(0,0,0,.2);display:inline-block}
.product-actions{display:flex;gap:7px;flex-wrap:wrap}
.product-actions button,.product-actions a{border-radius:6px;padding:6px 8px;font-size:12px;font-weight:700;text-decoration:none}
.product-actions button{border:1px solid #cfd5dc;background:#fff;color:#343b44}
.product-actions button:hover{border-color:#8d98a6}
.product-actions a{background:var(--accent);color:#fff;border:1px solid var(--accent)}
.product-actions a:hover{background:var(--accent-dark)}
.empty{padding:24px 14px;text-align:center;color:var(--muted);line-height:1.5}
footer{max-width:1680px;margin:0 auto;padding:0 28px 20px;color:var(--muted);font-size:12px}
@media(max-width:980px){
  .topbar{align-items:stretch}.shop-home{align-self:flex-start}
  .layout{grid-template-columns:1fr}.catalog-panel{max-height:none;min-height:0}.viewer-wrap{height:55vh;min-height:410px}
  .group-buttons{display:none}.mobile-group-row{display:block}.products{max-height:none;overflow:visible}.catalog-panel{overflow:visible}
}
@media(max-width:620px){
  .topbar{display:block;padding:14px 14px 12px}.topbar h1{font-size:23px}.topbar p{font-size:13px}.shop-home{display:inline-block;margin-top:10px;padding:9px 11px;font-size:13px}
  .layout{padding:10px;gap:10px}.viewer-panel,.catalog-panel{border-radius:9px}
  .viewer-toolbar{flex-wrap:wrap}.viewer-toolbar button{padding:7px 9px;font-size:12px}.status{width:100%;margin-left:0;text-align:left}
  .viewer-wrap{height:47vh;min-height:340px}.viewer-hint{bottom:8px;font-size:11px}
  .catalog-head{padding:12px}.catalog-head h2{font-size:19px}.products{padding:9px;gap:8px}.product-card{grid-template-columns:86px 1fr}.product-img{width:86px;height:78px}
  footer{padding:0 12px 14px}
}
