/* Фирменная палитра (в цветах лендинга) — чёрный фон + зелёный акцент,
   зафиксирована сознательно и не подстраивается под тему Telegram
   у конкретного пользователя (раньше подстраивалась — теперь это единый
   бренд-вид витрины, как у обычного маркетплейса). */
:root {
  --bg: #0d0d0f;
  --text: #f3f1ea;
  --hint: #a7a49d;
  --link: #5fa845;
  --button: #5fa845;
  --button-text: #101a0c;
  --secondary-bg: #18181c;
  --border: #2a2a30;
  --danger: #e8837a;
}

* { box-sizing: border-box; }

html, body {
  height: 100%;
  overflow: hidden;
}

body {
  margin: 0;
  font-family: -apple-system, "Segoe UI", Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
}

.app {
  max-width: 480px;
  margin: 0 auto;
  height: 100vh;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.screen {
  flex: 1;
  display: flex;
  flex-direction: column;
  height: 100vh;
  min-height: 0;
}
.hidden { display: none !important; }

.topbar {
  padding: 14px 16px;
  font-weight: 600;
  font-size: 17px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 10px;
}

.back-btn {
  background: none;
  border: none;
  font-size: 18px;
  cursor: pointer;
  color: var(--text);
  padding: 0;
  /* На дашборде admin.html это <a href="index.html"> (выход из админки, не
     внутренняя навигация showScreen) — text-decoration нужен только для
     этого случая, для <button> он не действует, безопасно для всех
     остальных мест использования этого класса. */
  text-decoration: none;
}

.list {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  padding: 10px 12px;
}

.cart-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px;
  margin-bottom: 8px;
  background: var(--secondary-bg);
  border-radius: 12px;
  cursor: pointer;
}

.hero-banner {
  background: var(--secondary-bg);
  border: 1px solid var(--border);
  border-top: 3px solid var(--link);
  color: var(--text);
  padding: 22px 18px;
  border-radius: 18px;
  margin-bottom: 14px;
}
.hero-banner .hero-title { font-size: 19px; font-weight: 700; margin-bottom: 6px; }
.hero-banner .hero-sub { font-size: 13.5px; color: var(--hint); }

.quick-actions {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  margin-bottom: 16px;
}
.quick-tile {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  background: var(--secondary-bg);
  border: none;
  border-radius: 14px;
  padding: 14px 6px;
  cursor: pointer;
  color: var(--text);
  font-size: 12.5px;
  font-weight: 500;
}
.quick-tile svg {
  width: 24px;
  height: 24px;
  stroke: var(--link);
  fill: none;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.section-label { font-weight: 700; font-size: 15px; margin: 4px 0 10px; }

.search-bar {
  position: relative;
  margin-bottom: 12px;
}
.search-bar svg {
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  width: 16px;
  height: 16px;
  stroke: var(--hint);
  fill: none;
  stroke-width: 2;
  stroke-linecap: round;
  pointer-events: none;
}
.search-bar input {
  width: 100%;
  padding: 11px 36px 11px 38px;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: var(--secondary-bg);
  color: var(--text);
  font-size: 15px;
  font-family: inherit;
}
.search-clear {
  position: absolute;
  right: 8px;
  top: 50%;
  transform: translateY(-50%);
  width: 24px;
  height: 24px;
  border: none;
  background: none;
  color: var(--hint);
  font-size: 14px;
  cursor: pointer;
}

.grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
  align-content: start;
  align-items: start;
}

.category-tile {
  background: var(--secondary-bg);
  border-radius: 14px;
  padding: 10px;
  cursor: pointer;
  text-align: center;
}
.category-tile .tile-thumb {
  width: 100%;
  aspect-ratio: 1;
  border-radius: 10px;
  background: var(--bg);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 32px;
  overflow: hidden;
  margin-bottom: 8px;
}
.category-tile .tile-thumb img { width: 100%; height: 100%; object-fit: cover; }
.category-tile .tile-title { font-weight: 600; font-size: 13.5px; line-height: 1.25; }

.product-card {
  position: relative;
  display: flex;
  flex-direction: column;
  background: var(--secondary-bg);
  border-radius: 14px;
  padding: 8px;
  cursor: pointer;
}
.product-card .card-thumb {
  position: relative;
  width: 100%;
  aspect-ratio: 1;
  border-radius: 10px;
  background: var(--bg);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 38px;
  overflow: hidden;
  margin-bottom: 8px;
}
.product-card .card-thumb img { width: 100%; height: 100%; object-fit: cover; }
.product-card .card-title {
  font-size: 13.5px;
  font-weight: 500;
  line-height: 1.3;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  min-height: 2.6em;
  margin-bottom: 4px;
}
.product-card .card-stock { font-size: 11.5px; color: var(--hint); margin-bottom: 6px; }
.product-card .card-bottom {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: auto;
  gap: 6px;
}
.product-card .card-price { font-weight: 700; font-size: 14.5px; }
.quick-add {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  border: none;
  background: var(--button);
  color: var(--button-text);
  font-size: 18px;
  line-height: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  flex-shrink: 0;
}
.quick-add.added { background: var(--link); }

.thumb {
  width: 52px;
  height: 52px;
  border-radius: 10px;
  background: var(--bg);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 26px;
  flex-shrink: 0;
  overflow: hidden;
}
.thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.row-info { flex: 1; min-width: 0; }
.row-info .title { font-weight: 600; font-size: 15px; }
.row-info .desc {
  color: var(--hint);
  font-size: 13px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.row-info .meta { font-size: 13px; color: var(--hint); margin-top: 2px; }
.row-price { font-weight: 600; white-space: nowrap; }

.qty-inline {
  display: flex;
  align-items: center;
  gap: 6px;
}
.qty-inline button {
  width: 26px; height: 26px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--bg);
  color: var(--text);
  font-size: 15px;
  cursor: pointer;
}

.bottombar {
  display: flex;
  border-top: 1px solid var(--border);
}
.nav-btn {
  flex: 1;
  padding: 9px 4px 8px;
  background: none;
  border: none;
  font-size: 11.5px;
  color: var(--text);
  cursor: pointer;
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
}
.nav-btn svg {
  width: 22px;
  height: 22px;
  stroke: currentColor;
  fill: none;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.nav-btn.primary { color: var(--link); }
.nav-btn.primary svg { stroke-width: 2.2; }
.nav-btn + .nav-btn { border-left: 1px solid var(--border); }

.nav-icon-wrap { position: relative; display: inline-flex; }

.badge {
  display: inline-block;
  min-width: 16px;
  padding: 0 4px;
  border-radius: 8px;
  background: var(--link);
  color: #fff;
  font-size: 11px;
  line-height: 16px;
}
.nav-icon-wrap .badge {
  position: absolute;
  top: -4px;
  right: -9px;
}

.item-card { padding: 16px; flex: 1; min-height: 0; overflow-y: auto; }
.item-photo-big {
  width: 100%;
  height: 200px;
  border-radius: 14px;
  background: var(--secondary-bg);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 72px;
  margin-bottom: 14px;
  overflow: hidden;
}
.item-photo-big img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}
.item-card h2 { margin: 0 0 6px; font-size: 19px; }
.muted { color: var(--hint); font-size: 14px; }
.demo-note { font-size: 12px; padding: 16px 20px 8px; line-height: 1.4; text-align: center; }
.admin-image-actions { display: flex; gap: 18px; margin-bottom: 12px; }
.admin-image-delete { color: var(--danger); }
.error-text { color: var(--danger); font-size: 14px; }
.availability { font-size: 13px; margin: 6px 0 14px; color: var(--link); }

.price-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin: 16px 0;
}
.price { font-size: 20px; font-weight: 700; }
.qty-picker {
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--secondary-bg);
  border-radius: 10px;
  padding: 6px 10px;
}
.qty-picker button {
  width: 28px; height: 28px;
  border-radius: 8px;
  border: none;
  background: var(--bg);
  color: var(--text);
  font-size: 17px;
  cursor: pointer;
}

.item-section {
  margin-top: 20px;
  padding-top: 16px;
  border-top: 1px solid var(--border);
}
.item-section-title { font-weight: 700; font-size: 15px; margin-bottom: 8px; }
.item-section-text {
  font-size: 14px;
  line-height: 1.5;
  color: var(--hint);
  white-space: pre-line;
  margin: 0;
}
.specs-table { width: 100%; border-collapse: collapse; font-size: 14px; }
.specs-table td {
  padding: 7px 0;
  border-bottom: 1px solid var(--border);
}
.specs-table td:first-child { color: var(--hint); width: 55%; }
.specs-table td:last-child { font-weight: 500; text-align: right; }
.specs-table tr:last-child td { border-bottom: none; }

.primary-btn {
  width: 100%;
  padding: 14px;
  border: none;
  border-radius: 12px;
  background: var(--button);
  color: var(--button-text);
  font-size: 16px;
  font-weight: 600;
  cursor: pointer;
}

.sum-row {
  display: flex;
  justify-content: space-between;
  padding: 14px 16px;
  font-size: 16px;
  font-weight: 700;
  border-top: 1px solid var(--border);
}

.center { text-align: center; padding: 40px 16px; }

.form {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}
.field { display: flex; flex-direction: column; gap: 6px; }
.field span { font-size: 13px; color: var(--hint); }
.field input, .field textarea, .field select {
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 10px 12px;
  font-size: 15px;
  font-family: inherit;
  background: var(--bg);
  color: var(--text);
}
.field-primary input {
  border: 2px solid var(--link);
  font-size: 17px;
  font-weight: 600;
  padding: 12px;
}
.field-primary span { color: var(--link); font-weight: 600; }
.field-secondary textarea {
  min-height: 50px;
  resize: vertical;
  font-size: 14px;
}
.field-secondary span { color: var(--hint); font-weight: 400; }

.success-box {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 24px;
  gap: 8px;
}
.success-icon {
  width: 64px; height: 64px;
  border-radius: 50%;
  background: var(--link);
  color: #fff;
  font-size: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 10px;
}
.success-box .primary-btn { margin-top: 16px; max-width: 240px; }

.rating-box { margin: 6px 0; }
.rating-stars { display: flex; gap: 6px; justify-content: center; }
.rating-stars button {
  border: none;
  background: none;
  font-size: 30px;
  line-height: 1;
  color: var(--hint);
  cursor: pointer;
  padding: 2px;
}
.rating-stars button.active { color: #f5a623; }
.rating-stars.done button { pointer-events: none; }

.order-row {
  padding: 12px;
  margin-bottom: 8px;
  background: var(--secondary-bg);
  border-radius: 12px;
}
.order-row .pay-btn {
  margin-top: 10px;
  padding: 10px;
  font-size: 14px;
}
.order-row .order-top {
  display: flex;
  justify-content: space-between;
  font-size: 14px;
  color: var(--hint);
  margin-bottom: 6px;
}
.order-row .order-items { font-size: 14px; margin-bottom: 6px; }
.order-row .order-bottom {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-weight: 600;
}
.status-badge {
  font-size: 12px;
  font-weight: 500;
  padding: 3px 8px;
  border-radius: 8px;
  background: var(--bg);
  color: var(--hint);
}
.status-badge.status-reserved { color: var(--link); }
.status-badge.status-finalized { color: var(--link); }

.admin-entry-btn {
  width: 100%;
  padding: 12px;
  margin-bottom: 16px;
  border-radius: 12px;
  border: 1px dashed var(--link);
  background: none;
  color: var(--link);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  /* Элемент — <a href="admin.html"> (переезд на отдельную страницу, см.
     progress.md, шаг 8b), display/text-align/text-decoration нужны, чтобы
     ссылка выглядела как кнопка (по умолчанию <a> — inline) */
  display: block;
  text-align: center;
  text-decoration: none;
  box-sizing: border-box;
}

.admin-section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin: 18px 0 10px;
}
.admin-section-head:first-child { margin-top: 4px; }
.admin-section-head .section-label { margin: 0; }
.admin-add-btn {
  border: none;
  background: none;
  color: var(--link);
  font-size: 13.5px;
  font-weight: 600;
  cursor: pointer;
  padding: 4px 0;
}

.admin-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 12px;
  margin-bottom: 8px;
  background: var(--secondary-bg);
  border-radius: 12px;
  cursor: pointer;
}
.admin-row .chevron { color: var(--hint); flex-shrink: 0; }

.danger-btn {
  width: 100%;
  padding: 13px;
  border: 1px solid var(--danger);
  border-radius: 12px;
  background: none;
  color: var(--danger);
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
}
