/* ===== Gорчит Shop design tokens — White / Red ===== */
:root{
  --bg:#FFFFFF;
  --surface:#F7F7F7;
  --surface-2:#F1F2F4;
  --primary:#F52B32;
  --primary-pressed:#D91F26;
  --primary-tint:#FDEDEE;
  --text:#15171A;
  --text-secondary:#6E737B;
  --text-tertiary:#9BA0A8;
  --border:#E8E9EB;
  --success:#168A55;
  --success-tint:#E9F6EF;
  --warning:#D98200;
  --error:#D92D35;

  --radius-sm:8px;
  --radius-input:10px;
  --radius-btn:10px;
  --radius-card:12px;
  --radius-lg:16px;
  --radius-pill:999px;

  --sp-1:4px; --sp-2:8px; --sp-3:12px; --sp-4:16px; --sp-5:20px; --sp-6:24px; --sp-8:32px; --sp-10:40px;

  --ease:cubic-bezier(0.2,0.8,0.2,1);
  --t-press:120ms; --t-micro:180ms; --t-nav:240ms; --t-sheet:280ms;

  --tg-safe-top: env(safe-area-inset-top, 0px);
  --tg-safe-bottom: env(safe-area-inset-bottom, 0px);
  /* Отступ под собственные кнопки Telegram (закрыть/меню) в полноэкранном режиме —
     задаётся из JS через tg.contentSafeAreaInset, см. applyTelegramContentInset в app.js.
     0px по умолчанию вне Telegram. */
  --tg-content-safe-top: 0px;
  --tg-content-safe-bottom: 0px;
}

*,*::before,*::after{box-sizing:border-box;}
html,body{margin:0;padding:0;height:100%;background:var(--bg);overflow:hidden;overscroll-behavior:none;}
body{
  font-family:'Inter',sans-serif;
  color:var(--text);
  -webkit-font-smoothing:antialiased;
  overscroll-behavior-y:none;
  position:fixed;
  inset:0;
}
a{color:var(--primary);text-decoration:none;}
a:hover{color:var(--primary-pressed);}
button{font-family:inherit;background:none;border:none;padding:0;margin:0;color:inherit;font-size:inherit;cursor:pointer;-webkit-tap-highlight-color:transparent;}
button:active{transform:scale(0.98);transition:transform var(--t-press) var(--ease);}
input,select{font-family:inherit;}
img{max-width:100%;display:block;}
::-webkit-scrollbar{display:none;}

/* #app height synced from JS to Telegram's real viewport (см. applyViewportHeight в app.js) */
#app{
  height:100vh;
  height:100dvh;
  height:var(--tg-viewport-height, 100dvh);
  overflow:hidden;
  display:flex;flex-direction:column;position:relative;background:var(--bg);max-width:560px;margin:0 auto;
}

/* ===== layout shells ===== */
.tg-header{
  display:flex;align-items:center;justify-content:space-between;gap:10px;
  min-height:56px;padding:0 var(--sp-4);
  background:var(--bg);
  border-bottom:1px solid var(--border);
  flex-shrink:0;
  padding-top:calc(var(--tg-safe-top) + var(--tg-content-safe-top));
}
.tg-header .left{display:flex;align-items:center;gap:var(--sp-2);min-width:0;}
.tg-header .brand{display:flex;align-items:center;gap:8px;}
.tg-header .brand-mark{width:28px;height:28px;border-radius:8px;background:var(--primary);display:flex;align-items:center;justify-content:center;font-weight:800;font-size:14px;color:#fff;flex-shrink:0;}
.tg-header .brand-name{font-weight:800;font-size:15px;letter-spacing:0.2px;color:var(--text);line-height:1.1;}
.tg-header .brand-sub{font-size:9px;color:var(--text-tertiary);font-weight:600;letter-spacing:0.4px;}
.tg-header .title{font-size:17px;font-weight:700;color:var(--text);overflow:hidden;text-overflow:ellipsis;white-space:nowrap;}
.icon-btn{position:relative;width:44px;height:44px;display:flex;align-items:center;justify-content:center;flex-shrink:0;background:none;border:none;color:var(--text);cursor:pointer;padding:0;border-radius:var(--radius-btn);}
.icon-btn:active{background:var(--surface);}

.content{flex:1;min-height:0;overflow-y:auto;-webkit-overflow-scrolling:touch;display:flex;flex-direction:column;}

/* ===== bottom nav — exactly 5 items ===== */
.bottom-nav{
  display:flex;border-top:1px solid var(--border);background:var(--bg);flex-shrink:0;
  padding-bottom:calc(var(--tg-safe-bottom) + var(--tg-content-safe-bottom));
}
.bottom-nav-row{display:flex;padding:8px 4px;width:100%;min-height:56px;}
.nav-item{
  flex:1;display:flex;flex-direction:column;align-items:center;justify-content:center;gap:3px;
  color:var(--text-tertiary);background:none;border:none;font-family:inherit;cursor:pointer;position:relative;padding:6px 0;
}
.nav-item.active{color:var(--primary);}
.nav-item span{font-size:10px;font-weight:600;}
.nav-item.active span{font-weight:700;}
.nav-badge{position:absolute;top:0;right:22%;min-width:15px;height:15px;padding:0 3px;border-radius:999px;background:var(--primary);color:#fff;font-size:9px;font-weight:800;display:flex;align-items:center;justify-content:center;}

.sticky-bar{
  border-top:1px solid var(--border);background:var(--bg);flex-shrink:0;
  padding:var(--sp-3) var(--sp-4);
  padding-bottom:calc(var(--sp-3) + var(--tg-safe-bottom));
  display:flex;align-items:center;gap:var(--sp-4);
  box-shadow:0 -4px 16px rgba(21,23,26,0.05);
}

.icon{stroke:currentColor;fill:none;stroke-width:1.9;stroke-linecap:round;stroke-linejoin:round;}

/* ===== typography ===== */
.display{font-size:28px;line-height:32px;font-weight:700;color:var(--text);}
.h1{font-size:24px;line-height:29px;font-weight:700;color:var(--text);}
.h2{font-size:20px;line-height:24px;font-weight:700;color:var(--text);}
.h3{font-size:17px;line-height:22px;font-weight:600;color:var(--text);}
.eyebrow{font-size:12px;letter-spacing:0.3px;text-transform:uppercase;color:var(--text-tertiary);font-weight:700;}
.price{color:var(--text);font-weight:700;font-size:18px;line-height:22px;}
.price-lg{color:var(--text);font-weight:700;font-size:22px;line-height:26px;}
.price-old{color:var(--text-tertiary);text-decoration:line-through;font-size:13px;font-weight:400;}

/* ===== buttons ===== */
.btn{
  display:flex;align-items:center;justify-content:center;gap:8px;
  height:48px;padding:0 20px;border-radius:var(--radius-btn);font-weight:600;font-size:15px;border:none;cursor:pointer;font-family:inherit;
  -webkit-tap-highlight-color:transparent;transition:opacity var(--t-press) var(--ease), transform var(--t-press) var(--ease);
}
.btn-primary{background:var(--primary);color:#fff;}
.btn-primary:active{background:var(--primary-pressed);}
.btn-primary:disabled{background:var(--surface-2);color:var(--text-tertiary);}
.btn-secondary{background:var(--surface-2);border:1px solid var(--border);color:var(--text);}
.btn-secondary:active{background:var(--border);}
.btn-ghost{background:transparent;color:var(--text-secondary);}
.btn-block{width:100%;}
.btn-sm{height:40px;padding:0 16px;font-size:13px;border-radius:10px;}

/* ===== inputs & search ===== */
.input{
  width:100%;height:46px;background:var(--surface);border:1px solid var(--border);border-radius:var(--radius-input);
  padding:0 14px;color:var(--text);font-size:15px;font-family:inherit;
}
.input::placeholder{color:var(--text-tertiary);}
.input:focus{outline:none;border-color:var(--primary);box-shadow:0 0 0 3px var(--primary-tint);}
textarea.input{height:auto;min-height:88px;padding:12px 14px;resize:vertical;line-height:1.5;}

/* ===== admin: управление товарами ===== */
.admin-row{display:flex;align-items:center;gap:12px;padding:12px var(--sp-4);border-bottom:1px solid var(--border);}
.admin-row .thumb{width:48px;height:48px;border-radius:10px;background:var(--surface);flex-shrink:0;display:flex;align-items:center;justify-content:center;overflow:hidden;}
.admin-row .thumb img{width:100%;height:100%;object-fit:contain;}
.chip-select{display:flex;gap:8px;flex-wrap:wrap;}
.upload-btn{display:inline-flex;align-items:center;gap:6px;padding:10px 14px;border-radius:var(--radius-btn);background:var(--surface);border:1px solid var(--border);font-size:13px;font-weight:600;color:var(--text);cursor:pointer;}
.search-field{
  display:flex;align-items:center;gap:12px;height:60px;border-radius:var(--radius-lg);
  background:var(--surface);border:1px solid var(--border);padding:0 18px;flex:1;min-width:0;
  color:var(--text-tertiary);
}
.search-field input{flex:1;min-width:0;background:none;border:none;color:var(--text);font-size:16px;font-family:inherit;}
.search-field input:focus{outline:none;}
.search-field input::placeholder{color:var(--text-tertiary);}
.search-field .clear-btn{color:var(--text-tertiary);flex-shrink:0;}

/* ===== chips & badges ===== */
.chip{padding:10px 14px;border-radius:var(--radius-pill);background:var(--bg);border:1px solid var(--border);color:var(--text-secondary);font-size:13px;font-weight:500;white-space:nowrap;cursor:pointer;display:inline-flex;align-items:center;gap:4px;min-height:40px;box-sizing:border-box;}
.chip.active{background:var(--primary-tint);border-color:var(--primary);color:var(--primary);font-weight:600;}
.badge{padding:3px 7px;border-radius:var(--radius-sm);font-size:10px;font-weight:800;letter-spacing:0.2px;}
.badge-new{background:var(--surface-2);color:var(--text-secondary);}
.badge-sale{background:var(--primary);color:#fff;}
.badge-hit{background:var(--text);color:#fff;}
.badge-oos{background:var(--surface-2);color:var(--text-tertiary);}

/* ===== cards / grid ===== */
.section{padding:0 var(--sp-4);display:flex;flex-direction:column;gap:var(--sp-3);}
.section-head{display:flex;align-items:center;justify-content:space-between;}
.section-link{font-size:13px;color:var(--primary);font-weight:600;cursor:pointer;background:none;border:none;font-family:inherit;}
.hscroll{display:flex;gap:12px;overflow-x:auto;padding:0 var(--sp-4);}
.hscroll::-webkit-scrollbar{display:none;}
.grid-2{display:grid;grid-template-columns:1fr 1fr;gap:12px;padding:0 var(--sp-4);}

.product-card{background:var(--bg);border:1px solid var(--border);border-radius:var(--radius-card);overflow:hidden;cursor:pointer;display:flex;flex-direction:column;flex-shrink:0;width:156px;transition:transform var(--t-micro) var(--ease);}
.product-card:active{transform:scale(0.98);}
.grid-2 .product-card{width:auto;}
.product-photo{height:150px;background:var(--surface);position:relative;flex-shrink:0;overflow:hidden;display:flex;align-items:center;justify-content:center;}
.product-photo img,.photo-cover{width:100%;height:100%;object-fit:contain;display:block;}
.thumb-photo{border-radius:var(--radius-card);overflow:hidden;flex-shrink:0;background:var(--surface);display:flex;align-items:center;justify-content:center;}
.thumb-photo img{width:100%;height:100%;object-fit:contain;display:block;}
.product-fav{position:absolute;top:8px;right:8px;background:rgba(255,255,255,0.9);border-radius:50%;width:28px;height:28px;display:flex;align-items:center;justify-content:center;border:none;padding:0;cursor:pointer;color:var(--text-tertiary);}
.product-fav.active{color:var(--primary);}
.product-quickadd{position:absolute;bottom:8px;right:8px;background:var(--primary);color:#fff;border-radius:50%;width:32px;height:32px;display:flex;align-items:center;justify-content:center;border:none;padding:0;cursor:pointer;box-shadow:0 2px 8px rgba(245,43,50,0.35);}
.product-body{padding:10px 12px 12px;display:flex;flex-direction:column;gap:3px;}
.product-brand{font-size:11px;color:var(--text-tertiary);font-weight:500;}
.product-name{font-size:13px;color:var(--text);font-weight:600;line-height:1.35;min-height:2.6em;}
.product-rating{display:flex;align-items:center;gap:3px;font-size:11px;color:var(--text-secondary);font-weight:500;}
.product-rating .icon{color:var(--warning);}
.product-price-row{display:flex;align-items:baseline;gap:6px;margin-top:2px;flex-wrap:wrap;}

.wheel-banner{
  margin:0 var(--sp-4);min-height:196px;border-radius:var(--radius-lg);
  background:
    radial-gradient(130% 150% at 90% 22%, rgba(245,43,50,0.55) 0%, rgba(245,43,50,0) 58%),
    linear-gradient(160deg,#221719 0%,#140F0E 100%);
  padding:24px;display:flex;align-items:center;justify-content:space-between;gap:14px;
  position:relative;overflow:hidden;color:#fff;
}
.wheel-banner .eyebrow{color:rgba(255,255,255,0.55);margin-bottom:2px;}
.wheel-banner .display{color:#fff;max-width:210px;line-height:1.18;}
.wheel-banner p{font-size:13px;color:rgba(255,255,255,0.72);margin:8px 0 0;max-width:200px;line-height:1.5;}
.wheel-banner .wb-cta{display:inline-flex;align-items:center;gap:8px;background:#fff;color:var(--primary);border-radius:var(--radius-pill);padding:12px 18px;font-weight:700;font-size:14px;box-shadow:0 8px 18px rgba(0,0,0,0.35);width:fit-content;margin-top:16px;}

.bonus-banner{margin:0 var(--sp-4);border-radius:var(--radius-lg);background:var(--primary);padding:16px 18px;display:flex;align-items:center;gap:14px;cursor:pointer;color:#fff;min-height:76px;}
.bonus-banner .icon-wrap{width:44px;height:44px;border-radius:12px;background:rgba(255,255,255,0.18);display:flex;align-items:center;justify-content:center;flex-shrink:0;}

.category-row{display:flex;gap:10px;padding:0 var(--sp-4);overflow-x:auto;}
.category-item{display:flex;flex-direction:column;align-items:center;gap:6px;min-width:64px;background:none;border:none;font-family:inherit;cursor:pointer;}
.category-icon{width:56px;height:56px;border-radius:50%;background:var(--surface);border:1px solid var(--border);display:flex;align-items:center;justify-content:center;color:var(--text-secondary);}
.category-icon.active{background:var(--primary-tint);border-color:var(--primary);color:var(--primary);}
.category-item span{font-size:11px;color:var(--text-secondary);font-weight:500;}
.category-item.active span{color:var(--text);font-weight:600;}

.list-row{display:flex;align-items:center;gap:14px;padding:14px var(--sp-4);border-bottom:1px solid var(--border);cursor:pointer;background:none;border-left:none;border-right:none;border-top:none;width:100%;text-align:left;font-family:inherit;color:inherit;}
.list-row:last-child{border-bottom:none;}
.list-row .thumb{width:52px;height:52px;border-radius:var(--radius-card);background:var(--surface);flex-shrink:0;}
.list-row .chev{color:var(--text-tertiary);flex-shrink:0;}
.list-row .row-icon{width:36px;height:36px;border-radius:10px;background:var(--surface);display:flex;align-items:center;justify-content:center;color:var(--text-secondary);flex-shrink:0;}

.qty-stepper{display:flex;align-items:center;gap:4px;background:var(--surface-2);border-radius:var(--radius-pill);padding:2px;height:40px;}
.qty-stepper button{background:none;border:none;color:var(--text-secondary);font-size:17px;cursor:pointer;width:36px;height:36px;display:flex;align-items:center;justify-content:center;border-radius:50%;}
.qty-stepper button:active{background:rgba(0,0,0,0.06);}
.qty-stepper button.plus{color:var(--primary);}
.qty-stepper span{font-size:14px;color:var(--text);font-weight:700;min-width:16px;text-align:center;}

.summary-row{display:flex;justify-content:space-between;font-size:14px;color:var(--text-secondary);}
.summary-row .val{color:var(--text);font-weight:500;}
.divider{height:1px;background:var(--border);margin:var(--sp-4) 0;}

.empty-state{flex:1;display:flex;flex-direction:column;align-items:center;justify-content:center;gap:16px;padding:36px;text-align:center;}
.empty-icon{width:76px;height:76px;border-radius:50%;background:var(--surface);border:1px solid var(--border);display:flex;align-items:center;justify-content:center;color:var(--text-tertiary);}
.empty-title{font-size:17px;font-weight:700;color:var(--text);}
.empty-text{font-size:13px;color:var(--text-secondary);line-height:1.6;max-width:260px;}

.toast{position:fixed;left:50%;bottom:calc(72px + var(--tg-safe-bottom));transform:translateX(-50%) translateY(8px);z-index:80;display:flex;align-items:center;gap:10px;padding:12px 16px;border-radius:var(--radius-card);background:var(--text);box-shadow:0 8px 24px rgba(21,23,26,0.25);font-size:13px;color:#fff;font-weight:500;opacity:0;pointer-events:none;transition:opacity var(--t-micro) var(--ease), transform var(--t-micro) var(--ease);max-width:90%;}
.toast.show{opacity:1;transform:translateX(-50%) translateY(0);}
.toast .dot{width:8px;height:8px;border-radius:50%;flex-shrink:0;}
.toast.ok .dot{background:var(--success);}
.toast.err .dot{background:var(--error);}

.tabs{display:flex;gap:22px;padding:0 var(--sp-4);border-bottom:1px solid var(--border);flex-shrink:0;height:36px;}
.tab{padding-bottom:10px;font-size:13px;font-weight:600;color:var(--text-tertiary);background:none;border:none;cursor:pointer;font-family:inherit;border-bottom:2px solid transparent;margin-bottom:-1px;}
.tab.active{color:var(--text);font-weight:700;border-color:var(--primary);}

.loyalty-card{margin:0 var(--sp-4);background:var(--text);border-radius:var(--radius-lg);padding:18px;display:flex;flex-direction:column;gap:12px;position:relative;overflow:hidden;color:#fff;}
.loyalty-tiers{display:flex;gap:8px;}
.loyalty-tier{flex:1;text-align:center;padding:8px 0;border-radius:10px;font-size:10px;font-weight:700;background:rgba(255,255,255,0.08);color:rgba(255,255,255,0.55);}
.loyalty-tier.active{background:var(--primary);color:#fff;}

.loyalty-qr-toggle{margin-top:14px;}
.loyalty-qr-toggle summary{
  list-style:none;cursor:pointer;display:flex;align-items:center;justify-content:space-between;
  font-size:12px;font-weight:700;color:#fff;
  padding-top:14px;border-top:1px solid rgba(255,255,255,0.14);
  -webkit-tap-highlight-color:transparent;
}
.loyalty-qr-toggle summary::-webkit-details-marker{display:none;}
.loyalty-qr-toggle summary::marker{content:"";}
.loyalty-qr-toggle summary .chev{transition:transform var(--t-micro) var(--ease);color:#fff;}
.loyalty-qr-toggle[open] summary .chev{transform:rotate(90deg);}

.pin{width:18px;height:18px;border-radius:50%;border:1.5px solid var(--border);display:flex;align-items:center;justify-content:center;flex-shrink:0;}
.pin.active{border-color:var(--primary);}
.pin.active::after{content:'';width:9px;height:9px;border-radius:50%;background:var(--primary);}

.segmented{display:flex;background:var(--surface);border:1px solid var(--border);border-radius:10px;padding:4px;}
.segmented .seg{flex:1;text-align:center;padding:9px 0;font-size:13px;font-weight:600;color:var(--text-secondary);border-radius:8px;background:none;border:none;cursor:pointer;font-family:inherit;}
.segmented .seg.active{background:var(--primary);color:#fff;}

.swatch{width:36px;height:36px;border-radius:50%;border:2px solid transparent;cursor:pointer;}
.swatch.active{border-color:var(--primary);box-shadow:0 0 0 2px #fff, 0 0 0 3px var(--primary);}

.avatar{width:56px;height:56px;border-radius:50%;background:var(--surface-2);border:1px solid var(--border);display:flex;align-items:center;justify-content:center;font-weight:700;font-size:20px;color:var(--text);flex-shrink:0;}

/* ===== filter / sort bottom sheet ===== */
.sheet-overlay{position:fixed;inset:0;background:rgba(21,23,26,0.4);z-index:60;display:flex;align-items:flex-end;justify-content:center;opacity:0;pointer-events:none;transition:opacity var(--t-sheet) var(--ease);}
.sheet-overlay.open{opacity:1;pointer-events:auto;}
.sheet{width:100%;max-width:560px;background:var(--bg);border-top-left-radius:20px;border-top-right-radius:20px;max-height:86%;display:flex;flex-direction:column;transform:translateY(100%);transition:transform var(--t-sheet) var(--ease);}
.sheet-overlay.open .sheet{transform:translateY(0);}
.sheet-handle{display:flex;justify-content:center;padding:10px 0 4px;flex-shrink:0;}
.sheet-handle span{width:36px;height:4px;border-radius:2px;background:var(--border);}
.sheet-head{display:flex;align-items:center;justify-content:space-between;padding:6px var(--sp-4) var(--sp-3);flex-shrink:0;}
.sheet-body{overflow-y:auto;padding:0 var(--sp-4) var(--sp-4);display:flex;flex-direction:column;gap:var(--sp-5);}
.sheet-footer{display:flex;gap:10px;padding:var(--sp-3) var(--sp-4);padding-bottom:calc(var(--sp-3) + var(--tg-safe-bottom));border-top:1px solid var(--border);flex-shrink:0;}
.filter-group{display:flex;flex-direction:column;gap:10px;}
.filter-group label.flabel{font-size:13px;font-weight:600;color:var(--text);}
.range-row{display:flex;align-items:center;justify-content:space-between;font-size:13px;color:var(--text-secondary);font-weight:500;}
.range-slider{width:100%;-webkit-appearance:none;appearance:none;height:4px;border-radius:2px;background:var(--border);outline:none;margin:6px 0;}
.range-slider::-webkit-slider-thumb{-webkit-appearance:none;width:20px;height:20px;border-radius:50%;background:var(--primary);border:3px solid #fff;box-shadow:0 1px 4px rgba(0,0,0,0.25);cursor:pointer;}
.range-slider::-moz-range-thumb{width:20px;height:20px;border-radius:50%;background:var(--primary);border:3px solid #fff;box-shadow:0 1px 4px rgba(0,0,0,0.25);cursor:pointer;}
.switch-row{display:flex;align-items:center;justify-content:space-between;}
.switch{position:relative;width:44px;height:26px;border-radius:999px;background:var(--border);flex-shrink:0;cursor:pointer;transition:background var(--t-micro) var(--ease);}
.switch.on{background:var(--primary);}
.switch::after{content:'';position:absolute;top:3px;left:3px;width:20px;height:20px;border-radius:50%;background:#fff;box-shadow:0 1px 3px rgba(0,0,0,0.25);transition:transform var(--t-micro) var(--ease);}
.switch.on::after{transform:translateX(18px);}
.sort-option{display:flex;align-items:center;justify-content:space-between;padding:14px 0;border-bottom:1px solid var(--border);font-size:14px;font-weight:500;color:var(--text);cursor:pointer;}
.sort-option:last-child{border-bottom:none;}
.sort-option.active{color:var(--primary);font-weight:700;}

/* ===== states: skeleton / offline / error ===== */
.skeleton{background:linear-gradient(100deg,var(--surface) 30%,var(--surface-2) 50%,var(--surface) 70%);background-size:220% 100%;animation:shimmer 1.3s ease-in-out infinite;border-radius:var(--radius-card);}
@keyframes shimmer{0%{background-position:120% 0;}100%{background-position:-20% 0;}}
.skeleton-card{border:1px solid var(--border);border-radius:var(--radius-card);overflow:hidden;}
.skeleton-card .skeleton{height:150px;border-radius:0;}
.skeleton-line{height:11px;margin:10px 12px;border-radius:4px;}

.state-banner{display:flex;align-items:center;gap:10px;padding:11px 14px;border-radius:var(--radius-card);font-size:12px;font-weight:600;margin:0 var(--sp-4);}
.state-banner.warn{background:#FEF3E2;color:var(--warning);}
.state-banner.err{background:#FCEBEC;color:var(--error);}

.confirm-sheet-actions{display:flex;gap:10px;}

@media (min-width:561px){
  #app{border-left:1px solid var(--border);border-right:1px solid var(--border);}
}
