:root{
  --bg: #0b0f14;
  --panel: rgba(255,255,255,0.06);
  --card: rgba(255,255,255,0.07);
  --stroke: rgba(255,255,255,0.10);
  --text: #e8eef6;
  --muted: rgba(232,238,246,0.70);
  --accent: #3b82f6;
  --danger: #ef4444;
  --shadow: 0 10px 30px rgba(0,0,0,0.35);
  --r: 16px;
}

*{ box-sizing:border-box; }
html,body{ height:100%; }
body{
  margin:0;
  font-family: system-ui, -apple-system, Segoe UI, Roboto, Arial;
  background: var(--bg);
  color: var(--text);
  touch-action: manipulation;
  -webkit-touch-callout: none;
}

.app{
  max-width: 760px;
  margin: 0 auto;
  padding: 14px 14px 24px;
}

.header{
  position: sticky;
  top: 0;
  z-index: 5;
  padding: 10px 2px 12px;
  backdrop-filter: blur(16px);
  background: linear-gradient(to bottom, rgba(11,15,20,0.95), rgba(11,15,20,0.65));
}

.header__title{
  font-size: 22px;
  font-weight: 900;
  letter-spacing: 0.2px;
}

.header__sub{
  margin-top: 4px;
  font-size: 13px;
  color: var(--muted);
}

.controls{
  display:flex;
  gap: 10px;
  margin-top: 12px;
  align-items: center;
  justify-content: flex-end;
  display: none;
}

.search{
  width: 100%;
  display:flex;
  gap: 8px;
  align-items:center;
  padding: 8px 12px;
  border-radius: 999px;
  background: var(--panel);
  border: 1px solid var(--stroke);
  margin-right: 10px;
  margin-top: 12px;
}

.search .icon{
  color: var(--muted);
  font-size: 14px;
}

.search input{
  width: 100%;
  border: 0;
  outline: 0;
  background: transparent;
  color: var(--text);
  font-size: 14px;
}

.searchSort{
  padding: 8px 12px;
  border: 1px solid rgba(255,255,255,0.3);
  background: rgba(255,255,255,0.08);
  color: white;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  font-size: 13px;
  user-select: none;
  transition: all 200ms ease;
  border-radius: 12px;
  font-weight: 800;
  pointer-events: auto;
  flex-shrink: 0;
  white-space: nowrap;
}

.searchSort:hover{
  background: rgba(255,255,255,0.12);
  border-color: rgba(255,255,255,0.5);
  color: white;
}

.searchSort:active{
  transform: scale(0.96);
}

.pill{
  display:flex;
  align-items:center;
  gap: 8px;
  padding: 12px 12px;
  border-radius: 999px;
  border: 1px solid var(--stroke);
  background: var(--panel);
  color: var(--text);
  font-weight: 800;
  cursor:pointer;
  user-select:none;
}

.pill:active{ transform: scale(0.99); }
.caret{ opacity: 0.7; }

.chips{
  display:flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-top: 10px;
}

.chip{
  padding: 8px 10px;
  border-radius: 999px;
  border: 1px solid var(--stroke);
  background: rgba(0,0,0,0.10);
  color: var(--text);
  font-weight: 800;
  font-size: 13px;
  cursor:pointer;
  user-select:none;
}

.chip.active{
  border-color: rgba(59,130,246,0.8);
  box-shadow: 0 0 0 3px rgba(59,130,246,0.16);
}

.content{
  padding-top: 6px;
  padding-bottom: 80px;
}

.grid{
  display:grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.grid.cart-view{
  grid-template-columns: 1fr;
}

.card{
  border-radius: var(--r);
  background: var(--card);
  border: 1px solid var(--stroke);
  box-shadow: var(--shadow);
  padding: 0;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  cursor: pointer;
  transition: all 200ms ease;
}

.card:hover{
  background: var(--panel);
  border-color: var(--accent);
  transform: translateY(-2px);
}

.card__image{
  width: 100%;
  height: 140px;
  background: linear-gradient(135deg, rgba(59,130,246,0.1), rgba(59,130,246,0.05));
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  cursor: pointer;
}

.card__image img{
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.card__image--empty{
  font-size: 48px;
  color: rgba(232,238,246,0.3);
}

.card__info{
  padding: 6px;
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.card__title{
  font-weight: 900;
  font-size: 14px;
  line-height: 1.2;
  text-align: center;
}

.card__category{
  font-size: 12px;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.3px;
  text-align: center;
}

.card__price{
  font-weight: 950;
  font-size: 15px;
  color: var(--text);
  margin-top: 2px;
  text-align: center;
}

.card__action{
  padding: 4px 6px 6px 6px;
  margin: 4px 0 0 0;
}

.card__action .addBtn{
  width: 100%;
  flex: auto;
  border-radius: 12px 12px 12px 12px;
  margin: 0;
}

.card__action .qtyCtl{
  width: 100%;
  flex: auto;
  border-radius: 12px 12px 12px 12px;
}


.price{
  font-weight: 950;
  font-size: 16px;
}

.meta{
  color: var(--muted);
  font-size: 12px;
  margin-top: 4px;
}

.fav{
  width: 40px;
  height: 40px;
  border-radius: 12px;
  border: 1px solid var(--stroke);
  background: rgba(0,0,0,0.12);
  color: var(--text);
  cursor:pointer;
  display:grid;
  place-items:center;
  user-select:none;
}

.fav.on{
  border-color: rgba(239,68,68,0.7);
  box-shadow: 0 0 0 3px rgba(239,68,68,0.14);
}

.fav:active{ transform: scale(0.98); }

.toast{
  position: fixed;
  left: 50%;
  bottom: 18px;
  transform: translateX(-50%);
  background: rgba(0,0,0,0.65);
  border: 1px solid rgba(255,255,255,0.12);
  color: var(--text);
  padding: 10px 12px;
  border-radius: 12px;
  font-size: 13px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 180ms ease;
  max-width: calc(100% - 24px);
}
.toast.show{ opacity: 1; }

.empty{
  border-radius: var(--r);
  border: 1px dashed rgba(255,255,255,0.16);
  padding: 18px;
  color: var(--muted);
  text-align:center;
}

.modal{
  position: fixed;
  inset: 0;
  background: var(--bg);
  display:none;
  align-items: flex-start;
  justify-content: center;
  padding: 0;
  z-index: 50;
  overflow: hidden;
}
.modal.show{ display:flex; }

.sheet{
  width: 100%;
  max-width: 760px;
  height: 100vh;
  border-radius: 0;
  background: var(--bg);
  border: none;
  box-shadow: none;
  padding: 14px;
  padding-top: 70px;
  padding-bottom: 100px;
  overflow-y: auto;
  position: relative;
}

.sheet__close{
  position: absolute;
  top: 14px;
  left: 14px;
  z-index: 10;
  width: 120px;
  height: 42px;
  border-radius: 14px;
  border: 1px solid var(--stroke);
  background: rgba(0,0,0,0.5);
  color: var(--text);
  font-size: 18px;
  font-weight: 950;
  cursor: pointer;
  display: grid;
  place-items: center;
}

.sheet__close:active{
  transform: scale(0.96);
}

.sheet__title{ font-size: 18px; font-weight: 950; }
.sheet__desc{ margin-top: 8px; color: var(--muted); line-height: 1.35; }

.sheet__image {
  margin: 0 -14px 12px -14px;
  width: calc(100% + 28px);
  height: 320px;
  background: rgba(59, 130, 246, 0.1);
  border-radius: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

.sheet__img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.sheet__row{
  display:flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 12px;
  gap: 10px;
}

.btnPrimary{
  width: 100%;
  padding: 12px;
  border-radius: 14px;
  border: none;
  background: rgba(59,130,246,0.95);
  color: white;
  font-weight: 950;
  cursor:pointer;
}
.btnPrimary:active{ transform: scale(0.99); }

.btnGhost{
  padding: 12px;
  border-radius: 14px;
  border: 1px solid rgba(255,255,255,0.10);
  background: rgba(255,255,255,0.06);
  color: var(--text);
  font-weight: 900;
  cursor:pointer;
}

#mFav{
  padding: 8px 10px;
  font-size: 18px;
  min-width: auto;
  width: auto;
}

#mClose{
  flex: 1;
  height: 40px;
  padding: 0 14px;
  border-radius: 14px;
  background: rgba(255,255,255,0.06);
  border: 1px solid rgba(255,255,255,0.10);
  color: var(--text);
  font-weight: 950;
  box-shadow: none;
}

#mClose:hover{
  background: rgba(255,255,255,0.10);
  border-color: rgba(255,255,255,0.2);
}

#mClose:active{
  transform: scale(0.98);
}


.headerRow{
  display:flex;
  align-items:center;
  gap:10px;
}

.back{
  width: 42px;
  height: 42px;
  border-radius: 14px;
  border: 1px solid var(--stroke);
  background: var(--panel);
  color: var(--text);
  font-weight: 950;
  cursor:pointer;
  display:grid;
  place-items:center;
}
.back:active{ transform: scale(0.98); }

.addBtn{
  flex: 2;
  height: 40px;
  padding: 0 14px;
  border-radius: 8px;
  border: 1px solid #00ff88;
  background: #00ff88;
  color: #0b0f14;
  font-weight: 950;
  font-size: 14px;
  cursor: pointer;
  user-select: none;
  box-shadow: 0 4px 15px rgba(0,255,136,0.3);
  transition: all 0.2s ease;
}

.addBtn:active{
  transform: scale(0.98);
}

.addBtn:hover{
  background: #00ff88;
  border-color: #00ff88;
  box-shadow: 0 6px 20px rgba(0,255,136,0.5);
  transform: translateY(-2px);
}

.addBtn:disabled{
  cursor: not-allowed;
  opacity: 0.55;
  border-color: rgba(255,255,255,0.10);
  background: rgba(255,255,255,0.06);
  color: var(--text);
  box-shadow: none;
}

.addBtn--inCart{
  background: #00cc6a;
  border-color: #00cc6a;
  box-shadow: 0 4px 15px rgba(0,204,106,0.3);
}

.addBtn--inCart:hover{
  background: #00b35c;
  border-color: #00b35c;
  box-shadow: 0 6px 20px rgba(0,179,92,0.5);
}

.qtyCtl{
  display:flex;
  align-items:center;
  justify-content: space-between;
  flex: 2;
  height: 40px;
  padding: 0 8px;
  border-radius: 14px;
  border: 1px solid rgba(0,255,136,0.5);
  background: rgba(0,255,136,0.25);
  box-shadow: 0 0 10px rgba(0,255,136,0.2);
}

.qtyBtn{
  flex: 1;
  height: 32px;
  border-radius: 10px;
  border: 1px solid rgba(0,255,136,0.4);
  background: rgba(0,255,136,0.15);
  color: #00ff88;
  font-weight: 950;
  cursor:pointer;
  display:grid;
  place-items:center;
  user-select:none;
}

.qtyBtn:hover{
  background: rgba(0,255,136,0.25);
  border-color: rgba(0,255,136,0.6);
}

.qtyBtn:active{ transform: scale(0.98); }

.qtyBtn:disabled{
  opacity: 0.5;
  cursor: not-allowed;
}

.qtyNum{
  flex: 1;
  text-align:center;
  font-weight: 950;
  color: #00ff88;
}
.adminTop{
  display:flex; gap:10px; flex-wrap:wrap; margin: 10px 0 14px;
}
.adminTabs .pill{ opacity:.9 }
.adminTabs .pill.on{ border-color: rgba(59,130,246,.7); box-shadow: 0 0 0 2px rgba(59,130,246,.15) inset; }

.adminCard{
  padding: 14px;
}

.card.adminCard{
  width: 100%;
}


.formRow{
  display:grid;
  grid-template-columns: 1fr 1fr;
  gap:10px;
  margin-top:10px;
}

@media (max-width: 520px){
  .formRow{
    grid-template-columns: 1fr;
  }
}


.input{
  width:100%;
  height:40px;
  border-radius: 14px;
  border:1px solid rgba(255,255,255,.10);
  background: rgba(255,255,255,.06);
  color: var(--text);
  padding: 0 12px;
  outline:none;
}

.select{ height:40px; }

.adminList{
  display:flex;
  flex-direction:column;
  gap:10px;
  margin-top:12px;
}

.adminRow{
  display:flex;
  justify-content:space-between;
  align-items:center;
  gap:10px;
  padding:12px;
  border-radius:16px;
  border:1px solid rgba(255,255,255,.08);
  background: rgba(255,255,255,.04);
}

.adminRow .meta{ opacity:.75; font-size:12px; }
.adminRowActions{ display:flex; gap:8px; align-items:center; }

.miniBtn{
  height:34px;
  padding:0 10px;
  border-radius:12px;
  border:1px solid rgba(255,255,255,.10);
  background: rgba(0,0,0,.12);
  color: var(--text);
  cursor:pointer;
}
.miniBtn:active{ transform: scale(.98); }

.badge{
  padding: 4px 8px;
  border-radius: 999px;
  border:1px solid rgba(255,255,255,.10);
  background: rgba(255,255,255,.06);
  font-size:12px;
  opacity:.9;
}

/* админка должна занимать всю ширину даже когда .grid = 2 колонки */
.card.adminCard{
  grid-column: 1 / -1;
}
.empty{
  grid-column: 1 / -1;
}

/* Нормальный dark select + выпадашка */
select.input, .input.select{
  background: rgba(255,255,255,0.06);
  color: var(--text);
}

select.input option{
  background: #0b0f14;
  color: #e8eefc;
}
/* Нормальный dark select + выпадашка */
select.input, .input.select{
  background: rgba(255,255,255,0.06);
  color: var(--text);
}

select.input option{
  background: #0b0f14;
  color: #e8eefc;
}
.adminSection{
  margin-top: 12px;
  padding: 12px;
  border-radius: 16px;
  border: 1px solid rgba(255,255,255,0.08);
  background: rgba(255,255,255,0.03);
}
.adminSection__title{
  font-weight: 950;
  opacity: .9;
  margin-bottom: 10px;
}
.field{
  display:flex;
  flex-direction:column;
  gap:6px;
}

.label{
  font-size: 12px;
  opacity: .75;
  padding-left: 6px;
}
.rowBtns{
  display:flex;
  gap:10px;
  flex-wrap:wrap;
}
.rowBtns .btnPrimary, .rowBtns .btnGhost{ flex:1; min-width:140px; }
.stockRowRight{
  display:flex;
  align-items:center;
  gap:8px;
  flex-wrap:wrap;
  justify-content:flex-end;
}

.stockQtyInput{
  width: 90px;
  height: 34px;
  border-radius: 12px;
  border:1px solid rgba(255,255,255,.10);
  background: rgba(255,255,255,.06);
  color: var(--text);
  padding: 0 10px;
  outline: none;
}
.kpiGrid{
  display:grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap:10px;
  margin-top:12px;
}
@media (max-width: 700px){
  .kpiGrid{ grid-template-columns: 1fr; }
}
.kpi{
  padding: 12px;
  border-radius: 16px;
  border: 1px solid rgba(255,255,255,.08);
  background: rgba(255,255,255,.03);
}
.kpiLabel{ font-size:12px; opacity:.75; }
.kpiValue{ font-size:22px; font-weight:950; margin-top:6px; }

.chart{
  margin-top: 12px;
  padding: 12px;
  border-radius: 16px;
  border: 1px solid rgba(255,255,255,.08);
  background: rgba(255,255,255,.03);
}
.chartRow{
  display:flex;
  align-items:center;
  gap:10px;
  margin-top:10px;
}
.chartDate{ width: 92px; font-size:12px; opacity:.75; }
.chartBarWrap{
  flex:1;
  height: 10px;
  border-radius: 999px;
  background: rgba(255,255,255,.06);
  overflow:hidden;
}
.chartBar{
  height: 100%;
  width: 0%;
  border-radius: 999px;
  background: rgba(59,130,246,.9);
}
.chartVal{ width: 92px; text-align:right; font-size:12px; opacity:.85; }

.twoCols{
  display:grid;
  grid-template-columns: 1fr 1fr;
  gap:10px;
  margin-top:12px;
}
@media (max-width: 700px){
  .twoCols{ grid-template-columns: 1fr; }
}

/* Bottom Navigation */
.bottomNav{
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  height: 70px;
  background: linear-gradient(to top, rgba(11,15,20,0.98), rgba(11,15,20,0.92));
  border-top: 1px solid var(--stroke);
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 12px;
  padding: 10px 14px;
  z-index: 40;
}

.bottomNav__btn{
  display: flex;
  align-items: center;
  justify-content: center;
  width: 50px;
  height: 50px;
  border-radius: 14px;
  border: 1px solid var(--stroke);
  background: var(--panel);
  color: var(--text);
  font-size: 20px;
  font-weight: 800;
  cursor: pointer;
  user-select: none;
  transition: all 200ms ease;
}

.bottomNav__btn:active{
  transform: scale(0.96);
}

.bottomNav__btn:hover{
  background: rgba(255,255,255,0.10);
  border-color: rgba(255,255,255,0.15);
}

.bottomNav__btn--fullwidth{
  width: 100%;
  height: 50px;
  border-radius: 14px;
  background: #00ff88;
  color: #0b0f14;
  border: none;
  font-size: 16px;
  font-weight: 900;
  padding: 0;
  box-shadow: 0 4px 15px rgba(0,255,136,0.3);
}

.bottomNav__btn--fullwidth:hover{
  background: #00ff88;
  border-color: #00ff88;
  box-shadow: 0 6px 20px rgba(0,255,136,0.5);
  transform: translateY(-2px);
}

.bottomNav__btn--fullwidth:active{
  transform: scale(0.98);
}

/* =============== CART STYLES =============== */
.cart-card {
  padding: 12px;
  cursor: default;
}

.cart-card:hover {
  transform: none;
}

.cart-row {
  display: flex;
  gap: 12px;
  align-items: stretch;
}

.cart-info {
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  min-width: 0;
}

.cart-controls {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 12px;
  gap: 10px;
}

.cart-thumb-wrap {
  flex-shrink: 0;
  width: 80px;
  height: 80px;
  border-radius: 12px;
  overflow: hidden;
  background: rgba(59, 130, 246, 0.1);
  display: flex;
  align-items: center;
  justify-content: center;
}

.cart-thumb {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 12px;
}

.cart-thumb--empty {
  font-size: 24px;
  color: rgba(232, 238, 246, 0.3);
  display: flex;
  align-items: center;
  justify-content: center;
}

/* =============== IMAGE VIEWER (LIGHTBOX) =============== */
.image-viewer-modal {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.95);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 10000;
  animation: fadeIn 200ms ease;
}

@keyframes fadeIn {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

.image-viewer-container {
  display: flex;
  flex-direction: column;
  width: 90%;
  max-width: 900px;
  height: 85vh;
  background: rgba(255, 255, 255, 0.05);
  border-radius: 12px;
  overflow: hidden;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
}

.image-viewer-header {
  padding: 15px 20px;
  background: rgba(0, 0, 0, 0.4);
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
  display: flex;
  justify-content: space-between;
  align-items: center;
  color: white;
}

.image-viewer-header h3 {
  margin: 0;
  font-size: 16px;
  font-weight: 600;
}

.image-viewer-close {
  background: none;
  border: none;
  color: white;
  font-size: 24px;
  cursor: pointer;
  padding: 0;
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 6px;
  transition: background 200ms ease;
}

.image-viewer-close:hover {
  background: rgba(255, 255, 255, 0.1);
}

.image-viewer-content {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  background: rgba(0, 0, 0, 0.2);
}

.image-viewer-img {
  max-width: 100%;
  max-height: 100%;
  cursor: grab;
  user-select: none;
  transition: transform 100ms ease;
  transform-origin: center;
}

.image-viewer-img:active {
  cursor: grabbing;
}

.image-viewer-footer {
  padding: 15px 20px;
  background: rgba(0, 0, 0, 0.4);
  border-top: 1px solid rgba(255, 255, 255, 0.1);
  display: flex;
  gap: 10px;
  justify-content: center;
}

.image-viewer-btn {
  background: rgba(59, 130, 246, 0.8);
  color: white;
  border: 1px solid rgba(59, 130, 246, 1);
  padding: 10px 20px;
  border-radius: 6px;
  cursor: pointer;
  font-size: 14px;
  font-weight: 500;
  transition: all 200ms ease;
}

.image-viewer-btn:hover {
  background: rgba(59, 130, 246, 1);
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(59, 130, 246, 0.4);
}

.image-viewer-btn:active {
  transform: translateY(0);
}

/* =============== ADMIN EDIT MODAL =============== */
.adminModal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.72);
  z-index: 5000;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  animation: fadeIn 180ms ease;
}

.adminModal {
  width: 100%;
  max-width: 560px;
  background: #131820;
  border: 1px solid rgba(255,255,255,0.10);
  border-radius: 24px 24px 0 0;
  padding: 20px 18px 32px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  animation: slideUp 220ms ease;
}

@keyframes slideUp {
  from { transform: translateY(60px); opacity: 0; }
  to   { transform: translateY(0);    opacity: 1; }
}

.adminModal__title {
  font-size: 17px;
  font-weight: 950;
  text-align: center;
  margin-bottom: 4px;
}

.adminModal__field {
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.adminModal__label {
  font-size: 12px;
  opacity: .7;
  padding-left: 4px;
}

.adminModal__btns {
  display: flex;
  gap: 10px;
  margin-top: 4px;
}

.adminModal__btns .btnPrimary,
.adminModal__btns .btnGhost {
  flex: 1;
}

/* Кнопка загрузки фото — в стиле приложения */
.fileUploadBtn {
  width: 100%;
  padding: 10px 14px;
  border-radius: 14px;
  border: 1px dashed rgba(59,130,246,0.55);
  background: rgba(59,130,246,0.08);
  color: var(--text);
  font-weight: 900;
  font-size: 14px;
  cursor: pointer;
  text-align: center;
  transition: all 200ms ease;
  user-select: none;
}

.fileUploadBtn:hover {
  background: rgba(59,130,246,0.15);
  border-color: rgba(59,130,246,0.9);
}

.fileUploadBtn:active {
  transform: scale(0.98);
}

.fileUploadBtn--selected {
  border-style: solid;
  border-color: rgba(59,130,246,0.8);
  background: rgba(59,130,246,0.14);
  color: #7ab8ff;
}