:root {
  --bg: var(--tg-theme-bg-color, #ffffff);
  --text: var(--tg-theme-text-color, #17212b);
  --hint: var(--tg-theme-hint-color, #708499);
  --link: var(--tg-theme-link-color, #2481cc);
  --button: var(--tg-theme-button-color, #2481cc);
  --button-text: var(--tg-theme-button-text-color, #ffffff);
  --section: var(--tg-theme-secondary-bg-color, #f1f4f7);
  --radius: 14px;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  padding: 0 0 96px;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
  font-size: 15px;
  line-height: 1.4;
}

.head { padding: 16px 16px 8px; }
.head-row { display: flex; align-items: center; gap: 8px; }
.head h1 { margin: 0; font-size: 20px; font-weight: 650; }
.note { margin: 6px 0 0; color: var(--hint); font-size: 13px; }

.badge {
  background: var(--button);
  color: var(--button-text);
  border-radius: 999px;
  padding: 2px 10px;
  font-size: 12px;
  font-weight: 600;
}

.chips { display: flex; gap: 8px; overflow-x: auto; padding: 12px 0 4px; }
.chips::-webkit-scrollbar { display: none; }
.chip {
  flex: 0 0 auto;
  border: none;
  border-radius: 999px;
  padding: 7px 14px;
  background: var(--section);
  color: var(--text);
  font-size: 13px;
  cursor: pointer;
}
.chip.active { background: var(--button); color: var(--button-text); }

.catalog { display: flex; flex-direction: column; gap: 10px; padding: 8px 16px; }

.card {
  display: flex;
  gap: 12px;
  background: var(--section);
  border-radius: var(--radius);
  padding: 12px;
}
.card img {
  width: 72px; height: 72px;
  object-fit: cover;
  border-radius: 10px;
  background: var(--bg);
  flex: 0 0 auto;
}
.card-body { flex: 1 1 auto; min-width: 0; }
.card h3 { margin: 0 0 2px; font-size: 15px; font-weight: 600; }
.card .meta { color: var(--hint); font-size: 12px; margin: 0 0 6px; }
.price { font-size: 16px; font-weight: 650; }
.price small { font-weight: 400; color: var(--hint); font-size: 12px; }
.price-wholesale { display: block; color: var(--link); font-size: 12px; margin-top: 2px; }

.qty { display: flex; align-items: center; gap: 10px; margin-top: 8px; }
.qty button {
  width: 30px; height: 30px;
  border: none; border-radius: 8px;
  background: var(--bg); color: var(--text);
  font-size: 18px; line-height: 1; cursor: pointer;
}
.qty input {
  width: 52px; text-align: center;
  border: none; border-radius: 8px; padding: 6px 4px;
  background: var(--bg); color: var(--text); font-size: 15px;
}
.qty .add {
  width: auto; padding: 0 14px; height: 32px;
  background: var(--button); color: var(--button-text);
  font-size: 14px; font-weight: 600;
}

.empty { color: var(--hint); text-align: center; padding: 32px 16px; }

.cta { margin: 16px; padding: 16px; background: var(--section); border-radius: var(--radius); }
.cta h2 { margin: 0 0 6px; font-size: 16px; }
.cta p { margin: 0 0 12px; color: var(--hint); font-size: 13px; }

.btn-primary, .btn-secondary {
  border: none; border-radius: 10px;
  padding: 11px 16px; font-size: 15px; font-weight: 600; cursor: pointer;
}
.btn-primary { background: var(--button); color: var(--button-text); }
.btn-secondary { background: var(--bg); color: var(--link); }

.sheet {
  position: fixed; inset: 0;
  background: rgba(0, 0, 0, 0.4);
  display: flex; align-items: flex-end;
  z-index: 10;
}
.sheet-card {
  width: 100%;
  background: var(--bg);
  border-radius: 16px 16px 0 0;
  padding: 20px 16px calc(20px + env(safe-area-inset-bottom));
  max-height: 90vh; overflow-y: auto;
}
.sheet-card h2 { margin: 0 0 12px; font-size: 17px; }
.sheet-actions { display: flex; gap: 10px; margin-top: 16px; }
.sheet-actions button { flex: 1; }

label { display: block; margin-bottom: 10px; font-size: 13px; color: var(--hint); }
label input, label textarea {
  display: block; width: 100%; margin-top: 4px;
  border: none; border-radius: 10px; padding: 11px 12px;
  background: var(--section); color: var(--text);
  font-size: 15px; font-family: inherit;
}
label textarea { resize: vertical; min-height: 64px; }

.summary { background: var(--section); border-radius: var(--radius); padding: 12px; margin-bottom: 14px; }
.summary-line { display: flex; justify-content: space-between; gap: 12px; font-size: 14px; margin-bottom: 6px; }
.summary-total { display: flex; justify-content: space-between; font-weight: 650; font-size: 16px; padding-top: 8px; border-top: 1px solid var(--bg); }

.error { color: #e53935; font-size: 13px; margin: 10px 0 0; }
.hidden { display: none !important; }

.checkout-bar {
  position: fixed;
  left: 16px; right: 16px;
  bottom: calc(16px + env(safe-area-inset-bottom));
  z-index: 5;
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.25);
}

/* ── Админка ─────────────────────────────────────────────────────────── */
.search {
  width: 100%;
  margin-top: 10px;
  border: none;
  border-radius: 10px;
  padding: 10px 12px;
  background: var(--section);
  color: var(--text);
  font-size: 15px;
}

.admin-row { align-items: center; cursor: pointer; }
.admin-check { width: 20px; height: 20px; flex: 0 0 auto; accent-color: var(--button); }

.flags { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 6px; }
.flag {
  font-size: 11px;
  padding: 2px 8px;
  border-radius: 999px;
  background: var(--bg);
  color: var(--hint);
}
.flag-off { color: #b26b00; }
.flag-wholesale { color: var(--link); }
.flag-warn { color: #e53935; }

.bulk-bar {
  position: sticky;
  top: 0;
  z-index: 4;
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 12px 16px;
  background: var(--section);
  border-bottom: 1px solid var(--bg);
}
.bulk-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.bulk-actions button { flex: 1 1 auto; padding: 8px 12px; font-size: 13px; }

.toggle {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 12px 0;
  color: var(--text);
  font-size: 14px;
}
.toggle input { width: 20px; height: 20px; accent-color: var(--button); }

.hint { display: block; margin-top: 4px; color: var(--hint); font-size: 12px; }
