:root {
  --tg-bg: #000000;
  --ink: #ffffff;
  --muted: #9aa0a6;
  --blue: #1a9fff;
  --card: #121212;
  --line: #2a2a2a;
}
* { box-sizing: border-box; margin: 0; padding: 0; }
html, body {
  min-height: 100%;
  background: var(--tg-bg);
  color: var(--ink);
  font-family: system-ui, -apple-system, 'Segoe UI', sans-serif;
}
.hidden { display: none !important; }
#app { max-width: 720px; margin: 0 auto; padding: 8px 14px 48px; }
.app-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 2px 14px;
}
.brand { min-width: 0; flex: 1; }
.logo { font-size: 24px; font-weight: 800; letter-spacing: -0.04em; line-height: 1.1; }
.tagline { color: var(--muted); font-size: 12px; margin-top: 5px; line-height: 1.35; }
.header-actions {
  display: flex;
  gap: 8px;
  flex: 0 0 auto;
}
.icon-btn {
  width: 44px;
  height: 44px;
  padding: 0;
  border-radius: 14px;
  border: 1px solid #2c2c2c;
  background: linear-gradient(180deg, #1b1b1b 0%, #121212 100%);
  color: #f3f5f7;
  display: grid;
  place-items: center;
  position: relative;
  cursor: pointer;
  box-shadow: inset 0 1px 0 rgba(255,255,255,.06);
}
.icon-btn svg {
  width: 20px;
  height: 20px;
  display: block;
}
.icon-btn:active { transform: scale(.96); }
.icon-dot {
  display: none;
  position: absolute;
  top: 8px;
  right: 8px;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--blue);
  box-shadow: 0 0 0 3px rgba(26,159,255,.18);
}
.icon-btn.is-on {
  border-color: rgba(26,159,255,.7);
  color: #7cc8ff;
  background: linear-gradient(180deg, #12324a 0%, #0d1c28 100%);
}
.icon-btn.is-on .icon-dot { display: block; }
.filter-badge {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin: 4px 0 8px;
  padding: 10px 12px;
  border-radius: 12px;
  background: #151515;
  border: 1px solid var(--line);
  font-size: 13px;
}
.filter-clear {
  border: 0;
  background: transparent;
  color: var(--blue);
  font: inherit;
  font-weight: 700;
  cursor: pointer;
  white-space: nowrap;
}
.badge {
  position: absolute;
  top: -5px;
  right: -5px;
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  border-radius: 999px;
  background: var(--blue);
  color: #fff;
  font-size: 10px;
  font-weight: 800;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 0 0 2px #000;
}
.catalog {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-top: 8px;
}
.product-card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 14px;
  overflow: hidden;
  cursor: pointer;
}
.product-image { aspect-ratio: 1; background: #0a0a0a center/cover no-repeat; position: relative; overflow: hidden; }
.product-image img { width: 100%; height: 100%; object-fit: cover; display: block; }
.search-input {
  width: 100%;
  margin: 8px 0;
  border: 1px solid var(--line);
  background: #151515;
  color: inherit;
  border-radius: 12px;
  padding: 12px 14px;
  font: inherit;
}
.listing-bar { display: flex; align-items: center; gap: 10px; padding: 8px 0 4px; }
.listing-title { font-weight: 800; font-size: 16px; }
.listing-meta { font-size: 12px; opacity: .65; }
.product-info { padding: 10px; }
.product-name { font-size: 13px; font-weight: 700; line-height: 1.3; min-height: 34px; }
.product-price { margin-top: 8px; font-weight: 800; font-size: 16px; }
.product-add-btn, .btn-primary {
  width: 100%;
  border: 0;
  background: var(--blue);
  color: #fff;
  padding: 10px;
  font-weight: 800;
  cursor: pointer;
  font: inherit;
  border-radius: 0 0 14px 14px;
}
.btn-primary { border-radius: 12px; padding: 14px; }
.card-counter { display: flex; justify-content: space-between; padding: 8px; }
.card-counter button {
  width: 32px; height: 32px;
  background: var(--blue); color: #fff; border: 0; border-radius: 8px; cursor: pointer;
}
.overlay {
  position: fixed; inset: 0;
  background: rgba(0,0,0,.72);
  z-index: 40;
  display: flex;
  align-items: flex-end;
}
.sheet {
  background: #111;
  width: 100%;
  max-width: 720px;
  margin: 0 auto;
  padding: 20px 16px 32px;
  max-height: 92vh;
  overflow: auto;
  border-top: 3px solid var(--blue);
  border-radius: 18px 18px 0 0;
}
.sheet h2 { font-size: 22px; margin-bottom: 12px; }
.cart-item {
  display: flex; gap: 8px; align-items: center;
  padding: 10px 0; border-bottom: 1px solid var(--line);
}
.cart-item-name { flex: 1; }
.cart-item-controls { display: flex; gap: 8px; align-items: center; }
.cart-item-controls button {
  width: 26px; height: 26px; background: var(--blue); color: #fff; border: 0; border-radius: 6px;
}
.cart-item-price { color: var(--blue); min-width: 70px; text-align: right; font-weight: 800; }
.total { margin: 14px 0; font-size: 22px; font-weight: 800; }
.form-group { margin-bottom: 12px; }
.form-group label { display: block; font-size: 12px; color: var(--muted); margin-bottom: 4px; }
.form-input, .form-textarea {
  width: 100%;
  background: #0a0a0a;
  border: 1px solid var(--line);
  color: var(--ink);
  padding: 10px;
  border-radius: 10px;
  font: inherit;
}
.form-textarea { min-height: 72px; }
#product-form-photo-preview { display: none; margin-top: 8px; }
#product-form-photo-img { width: 100%; }
.tabs { display: flex; flex-wrap: wrap; gap: 6px; margin: 12px 0; }
.tab-btn {
  flex: 1 1 calc(50% - 6px); background: #0a0a0a; color: var(--ink);
  border: 1px solid var(--line); padding: 8px; cursor: pointer; font: inherit; border-radius: 8px;
}
.tab-btn.active { background: var(--blue); border-color: var(--blue); }
.admin-tab { display: none; }
.admin-tab.active { display: block; }
.admin-stats-box {
  margin-top: 12px;
  padding: 14px;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: #0a0a0a;
  color: var(--ink);
  white-space: pre-wrap;
  font-family: ui-monospace, Consolas, monospace;
  font-size: 13px;
  line-height: 1.45;
  overflow: auto;
}
.admin-item, .order-item { background: #1a1a1a; padding: 10px; margin: 8px 0; border-radius: 10px; }
.admin-item { display: flex; justify-content: space-between; gap: 8px; }
.admin-actions { display: flex; gap: 6px; }
.btn-ghost, .btn-danger { border: 0; padding: 6px 8px; cursor: pointer; font: inherit; border-radius: 8px; }
.btn-ghost { background: #2a2a2a; color: #fff; }
.btn-danger { background: #e10600; color: #fff; }
.muted { color: var(--muted); }
.empty { text-align: center; padding: 20px; color: var(--muted); }
.order-items { font-size: 12px; white-space: pre-wrap; }
.legal-footer {
  display: flex;
  flex-wrap: wrap;
  gap: 10px 14px;
  align-items: center;
  justify-content: center;
  padding: 18px 12px 28px;
  font-size: 12px;
}
.legal-footer a {
  color: var(--muted);
  text-decoration: underline;
  text-underline-offset: 2px;
}
.legal-footer a:hover { color: var(--ink); }
.legal-code {
  color: var(--muted);
  opacity: .7;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}
