:root {
  --bg: #f6f2ea;
  --bg-soft: #efe9dd;
  --card: #ffffff;
  --ink: #1c241f;
  --muted: #6f7a72;
  --line: #e8e0d2;
  --green: #1e7a4b;
  --green-dark: #145c38;
  --green-soft: #e4f2e9;
  --amber: #b8731f;
  --red: #b03a2e;
  --radius: 16px;
  --shadow: 0 4px 18px rgba(39, 45, 40, 0.06);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  background:
    radial-gradient(1200px 400px at 50% -180px, #fdfbf6 0%, rgba(253, 251, 246, 0) 70%),
    var(--bg);
  color: var(--ink);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  font-size: 16px;
  line-height: 1.45;
  -webkit-font-smoothing: antialiased;
  padding-bottom: calc(96px + var(--safe-bottom));
}

body.no-scroll { overflow: hidden; }

.hidden { display: none !important; }

/* ---------- header ---------- */

.top {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  max-width: 680px;
  margin: 0 auto;
  padding: 14px 16px 10px;
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
}

.brand { display: flex; align-items: center; gap: 10px; min-width: 0; }

.brand-mark {
  width: 42px; height: 42px;
  display: grid; place-items: center;
  background: var(--green-soft);
  border-radius: 13px;
  font-size: 22px;
  flex: none;
}

.brand-text { min-width: 0; }

.brand h1 {
  margin: 0;
  font-size: 18px;
  font-weight: 700;
  letter-spacing: -0.02em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.brand p {
  margin: 1px 0 0;
  font-size: 12.5px;
  color: var(--muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.ghost-btn {
  flex: none;
  border: 1px solid var(--line);
  background: var(--card);
  color: var(--ink);
  font: inherit;
  font-size: 13px;
  font-weight: 600;
  padding: 9px 13px;
  border-radius: 999px;
  cursor: pointer;
}

.ghost-btn:active { transform: scale(0.97); }

/* ---------- categories ---------- */

.category-nav {
  position: sticky;
  top: 66px;
  z-index: 19;
  display: flex;
  gap: 8px;
  overflow-x: auto;
  scrollbar-width: none;
  max-width: 680px;
  margin: 0 auto;
  padding: 6px 16px 12px;
  background: linear-gradient(to bottom, var(--bg) 70%, rgba(246, 242, 234, 0));
}

.category-nav::-webkit-scrollbar { display: none; }

.cat-chip {
  flex: none;
  border: 1px solid var(--line);
  background: var(--card);
  color: var(--ink);
  font: inherit;
  font-size: 13px;
  font-weight: 600;
  padding: 8px 13px;
  border-radius: 999px;
  cursor: pointer;
  white-space: nowrap;
  transition: background 0.15s, border-color 0.15s;
}

.cat-chip:active { background: var(--green-soft); border-color: #cfe4d8; }

/* ---------- catalog ---------- */

.catalog {
  max-width: 680px;
  margin: 0 auto;
  padding: 0 16px;
}

.section { margin-bottom: 26px; scroll-margin-top: 128px; }

.section h2 {
  margin: 0 0 10px;
  font-size: 15px;
  font-weight: 700;
  letter-spacing: 0.01em;
}

.products {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.product {
  display: flex;
  align-items: center;
  gap: 12px;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 11px 12px;
  box-shadow: var(--shadow);
}

.product-emoji {
  width: 56px; height: 56px;
  flex: none;
  display: grid; place-items: center;
  font-size: 30px;
  background: var(--bg-soft);
  border-radius: 13px;
}

.product-photo {
  width: 56px;
  height: 56px;
  flex: none;
  object-fit: cover;
  border-radius: 13px;
  background: var(--bg-soft);
}

.product-info { flex: 1; min-width: 0; }

.product-name {
  font-size: 15px;
  font-weight: 600;
  line-height: 1.25;
  overflow-wrap: anywhere;
}

.product-price {
  margin-top: 3px;
  font-size: 13.5px;
  color: var(--muted);
}

.product-price b { color: var(--ink); font-size: 15px; font-weight: 700; }

.stepper { flex: none; display: flex; align-items: center; gap: 2px; }

.step-add {
  width: 38px; height: 38px;
  border: none;
  border-radius: 12px;
  background: var(--green);
  color: #fff;
  font-size: 22px;
  line-height: 1;
  font-weight: 500;
  cursor: pointer;
  display: grid;
  place-items: center;
  padding: 0 0 2px;
}

.step-add:active { background: var(--green-dark); }

.step {
  display: flex;
  align-items: center;
  background: var(--green-soft);
  border-radius: 12px;
  height: 38px;
}

.step-btn {
  width: 34px; height: 38px;
  border: none;
  background: transparent;
  color: var(--green-dark);
  font-size: 20px;
  font-weight: 600;
  line-height: 1;
  cursor: pointer;
  display: grid;
  place-items: center;
}

.step span {
  min-width: 20px;
  text-align: center;
  font-size: 15px;
  font-weight: 700;
  color: var(--green-dark);
}

.step .qty-label {
  min-width: 48px;
  padding: 0 2px;
  font-size: 13px;
  white-space: nowrap;
}

.step-btn:disabled,
.step-add:disabled {
  opacity: 0.35;
  cursor: default;
}

/* ---------- loading / errors ---------- */

.loading {
  max-width: 680px;
  margin: 30px auto;
  padding: 0 16px;
  color: var(--muted);
  text-align: center;
}

.load-error {
  max-width: 640px;
  margin: 30px auto;
  padding: 16px;
  background: #fdecea;
  color: var(--red);
  border-radius: var(--radius);
  text-align: center;
}

.foot {
  max-width: 680px;
  margin: 10px auto 0;
  padding: 24px 16px 8px;
  text-align: center;
  color: var(--muted);
  font-size: 12.5px;
}

.foot p { margin: 3px 0; }
.foot-muted { opacity: 0.75; }

/* ---------- cart bar ---------- */

.cart-bar {
  position: fixed;
  left: 50%;
  bottom: calc(14px + var(--safe-bottom));
  transform: translateX(-50%);
  z-index: 30;
  width: calc(100% - 28px);
  max-width: 652px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  border: none;
  border-radius: 18px;
  padding: 13px 16px;
  background: linear-gradient(135deg, var(--green) 0%, var(--green-dark) 100%);
  color: #fff;
  font: inherit;
  font-weight: 600;
  box-shadow: 0 10px 26px rgba(20, 92, 56, 0.34);
  cursor: pointer;
  animation: rise 0.2s ease-out;
}

@keyframes rise {
  from { opacity: 0; transform: translate(-50%, 10px); }
  to { opacity: 1; transform: translate(-50%, 0); }
}

.cart-bar-left { display: flex; align-items: center; gap: 8px; }

.cart-bar-icon { font-size: 18px; }

.cart-bar-count {
  display: grid;
  place-items: center;
  min-width: 24px;
  height: 24px;
  padding: 0 6px;
  background: rgba(255, 255, 255, 0.2);
  border-radius: 8px;
  font-size: 13px;
}

.cart-bar-sum { font-size: 16px; }
.cart-bar-go { font-size: 14px; opacity: 0.95; }

/* ---------- overlay / sheet ---------- */

.overlay {
  position: fixed;
  inset: 0;
  z-index: 40;
  background: rgba(18, 24, 20, 0.45);
  backdrop-filter: blur(2px);
  animation: fade 0.18s ease-out;
}

@keyframes fade { from { opacity: 0; } to { opacity: 1; } }

.sheet {
  position: fixed;
  z-index: 50;
  left: 50%;
  bottom: 0;
  transform: translateX(-50%);
  width: min(100%, 640px);
  max-height: 92dvh;
  display: flex;
  flex-direction: column;
  background: var(--card);
  border-radius: 24px 24px 0 0;
  box-shadow: 0 -12px 40px rgba(20, 26, 22, 0.2);
  animation: sheet-up 0.24s cubic-bezier(0.2, 0.8, 0.2, 1);
  padding-bottom: var(--safe-bottom);
}

@keyframes sheet-up {
  from { transform: translate(-50%, 30px); opacity: 0.6; }
  to { transform: translate(-50%, 0); opacity: 1; }
}

.sheet-grip {
  width: 42px;
  height: 4px;
  background: #e2dccf;
  border-radius: 999px;
  margin: 8px auto 0;
  flex: none;
}

.sheet-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 18px 10px;
  flex: none;
}

.sheet-head h2 {
  margin: 0;
  font-size: 19px;
  font-weight: 700;
  letter-spacing: -0.02em;
}

.icon-btn {
  width: 34px; height: 34px;
  border: none;
  border-radius: 50%;
  background: var(--bg-soft);
  color: var(--muted);
  font-size: 15px;
  cursor: pointer;
  display: grid;
  place-items: center;
}

.sheet-body {
  overflow-y: auto;
  padding: 0 18px 20px;
  -webkit-overflow-scrolling: touch;
}

/* ---------- cart / checkout ---------- */

.cart-list { display: flex; flex-direction: column; }

.cart-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 11px 0;
  border-bottom: 1px solid var(--line);
}

.cart-row-main { display: flex; align-items: center; gap: 10px; min-width: 0; }

.cart-emoji {
  width: 40px; height: 40px;
  flex: none;
  display: grid;
  place-items: center;
  background: var(--bg-soft);
  border-radius: 10px;
  font-size: 21px;
}

.cart-photo {
  width: 40px;
  height: 40px;
  flex: none;
  object-fit: cover;
  border-radius: 10px;
  background: var(--bg-soft);
}

.cart-name { font-size: 14px; font-weight: 600; }
.cart-meta { font-size: 12.5px; color: var(--muted); margin-top: 1px; }

.cart-row-side { display: flex; align-items: center; gap: 10px; flex: none; }

.line-sum { font-size: 14px; font-weight: 700; white-space: nowrap; }

.summary { margin-top: 14px; padding: 12px 14px; background: var(--bg); border-radius: 14px; }

.sum-row {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  font-size: 14px;
  color: var(--muted);
  padding: 3px 0;
}

.sum-row.total {
  margin-top: 7px;
  padding-top: 9px;
  border-top: 1px dashed #d9d0bf;
  color: var(--ink);
  font-size: 17px;
  font-weight: 700;
}

.free-hint { margin: 8px 2px 0; font-size: 12.5px; color: var(--amber); }

.primary-btn {
  width: 100%;
  margin-top: 16px;
  border: none;
  border-radius: 14px;
  padding: 15px 16px;
  background: var(--green);
  color: #fff;
  font: inherit;
  font-size: 16px;
  font-weight: 700;
  cursor: pointer;
}

.primary-btn:active { background: var(--green-dark); }
.primary-btn:disabled { opacity: 0.55; cursor: default; }

.secondary-btn {
  width: 100%;
  margin-top: 10px;
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 13px 16px;
  background: var(--card);
  color: var(--ink);
  font: inherit;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
}

.empty-state { text-align: center; padding: 30px 10px; color: var(--muted); }
.empty-state .big { font-size: 40px; margin-bottom: 8px; }

.pay-note {
  margin: 0;
  font-size: 13px;
  line-height: 1.45;
  color: var(--muted);
  background: var(--bg);
  border-radius: 12px;
  padding: 10px 12px;
}

.pay-details {
  margin: 12px 0 4px;
  padding: 12px;
  background: var(--bg);
  border-radius: 12px;
  text-align: left;
  font-size: 13.5px;
  line-height: 1.45;
  white-space: pre-line;
}

.order-pay {
  width: 100%;
  margin-top: 10px;
  border: none;
  border-radius: 11px;
  padding: 11px 14px;
  background: var(--green);
  color: #fff;
  font: inherit;
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
}

.order-pay:active { background: var(--green-dark); }

.pay-claimed {
  margin-top: 9px;
  padding: 8px 10px;
  background: #fdf1dd;
  color: var(--amber);
  border-radius: 10px;
  font-size: 12.5px;
  font-weight: 600;
  text-align: center;
}

.pay-screen .success-mark { margin-bottom: 10px; }

/* ---------- forms ---------- */

.form { display: flex; flex-direction: column; gap: 14px; margin-top: 8px; }

.field { display: flex; flex-direction: column; gap: 6px; }

.field > label, .field-label {
  font-size: 13px;
  font-weight: 600;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.input, .textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--bg);
  color: var(--ink);
  font: inherit;
  font-size: 16px;
  padding: 12px 13px;
  outline: none;
  transition: border-color 0.15s, background 0.15s;
}

.input:focus, .textarea:focus {
  border-color: #7fbf9d;
  background: #fff;
}

.textarea { resize: vertical; min-height: 64px; }

.field-apartment { max-width: 110px; }

.check-row {
  display: flex;
  align-items: center;
  gap: 9px;
  font-size: 14px;
  font-weight: 600;
  color: var(--ink);
  padding: 2px 0;
  cursor: pointer;
}

.check-row input {
  width: 18px;
  height: 18px;
  accent-color: var(--green);
  margin: 0;
  flex: none;
}

.field-row { display: flex; gap: 10px; }
.field-row .field { flex: 1; }

.slot-group { margin-bottom: 8px; }

.slot-date {
  font-size: 13px;
  font-weight: 700;
  margin: 6px 0 6px;
}

.slot-grid { display: flex; flex-wrap: wrap; gap: 8px; }

.slot {
  border: 1px solid var(--line);
  background: var(--bg);
  border-radius: 12px;
  padding: 9px 11px;
  font: inherit;
  font-size: 14px;
  font-weight: 600;
  color: var(--ink);
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 1px;
}

.slot small { font-size: 11px; font-weight: 500; color: var(--muted); }

.slot.selected {
  border-color: var(--green);
  background: var(--green-soft);
  color: var(--green-dark);
}

.slot.selected small { color: var(--green); }

.pay-grid { display: flex; gap: 8px; }

.pay-option {
  flex: 1;
  border: 1px solid var(--line);
  background: var(--bg);
  border-radius: 12px;
  padding: 11px 12px;
  font: inherit;
  font-size: 14px;
  font-weight: 600;
  color: var(--ink);
  cursor: pointer;
  text-align: left;
}

.pay-option small { display: block; font-size: 11.5px; font-weight: 500; color: var(--muted); margin-top: 2px; }

.pay-option.selected {
  border-color: var(--green);
  background: var(--green-soft);
  color: var(--green-dark);
}

.pay-option.selected small { color: var(--green); }

.form-error {
  background: #fdecea;
  color: var(--red);
  border-radius: 12px;
  padding: 10px 12px;
  font-size: 13.5px;
}

/* ---------- orders ---------- */

.order-card {
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 13px 14px;
  margin-bottom: 10px;
  background: var(--card);
}

.order-top { display: flex; align-items: center; justify-content: space-between; gap: 10px; }

.order-number { font-weight: 700; font-size: 15px; }
.order-date { font-size: 12.5px; color: var(--muted); margin-top: 2px; }

.badge {
  font-size: 11.5px;
  font-weight: 700;
  padding: 4px 9px;
  border-radius: 999px;
  white-space: nowrap;
}

.badge.new { background: #fdf1dd; color: var(--amber); }
.badge.collecting { background: #fdf1dd; color: var(--amber); }
.badge.awaiting_payment { background: #fdf1dd; color: var(--amber); }
.badge.paid { background: var(--green-soft); color: var(--green-dark); }
.badge.ready { background: #e8eef7; color: #2f5c8f; }
.badge.delivered { background: #e8eef7; color: #2f5c8f; }
.badge.cancelled { background: #f2ecec; color: var(--red); }

.order-meta { margin-top: 8px; font-size: 13px; color: var(--muted); }
.order-items { margin-top: 8px; font-size: 13px; color: var(--muted); }
.order-total { margin-top: 8px; font-weight: 700; font-size: 15px; }
.order-progress { margin-top: 8px; font-size: 12.5px; color: var(--amber); line-height: 1.45; }
.order-progress span { color: var(--muted); }

/* ---------- success ---------- */

.success { text-align: center; padding: 8px 4px 4px; }

.success-mark {
  width: 70px; height: 70px;
  margin: 8px auto 14px;
  display: grid;
  place-items: center;
  background: var(--green-soft);
  border-radius: 50%;
  font-size: 34px;
}

.success h3 { margin: 0 0 4px; font-size: 21px; letter-spacing: -0.02em; }

.success p { margin: 5px 0; color: var(--muted); font-size: 14px; }

.success .order-summary {
  margin: 16px 0 4px;
  padding: 13px;
  background: var(--bg);
  border-radius: 14px;
  text-align: left;
}

.success .order-summary .sum-row { color: var(--ink); font-size: 13.5px; }

/* ---------- admin link ---------- */

.admin-link { color: var(--muted); text-decoration: none; }
.admin-link:hover { text-decoration: underline; }

/* ---------- telegram link ---------- */

.tg-card {
  border: 1px dashed var(--line);
  border-radius: 14px;
  padding: 12px 14px;
  margin-bottom: 12px;
  background: var(--card);
}
.tg-title { font-weight: 700; font-size: 14px; }
.tg-card p { margin: 6px 0 10px; font-size: 12.5px; color: var(--muted); line-height: 1.45; }
.tg-card .secondary-btn { margin: 0; }
.tg-ok {
  border-style: solid;
  border-color: var(--green-soft);
  background: var(--green-soft);
  color: var(--green-dark);
  font-size: 13px;
  font-weight: 600;
}
.tg-hint { margin-top: 8px; font-size: 12.5px; color: var(--muted); }
.tg-hint a { color: var(--green-dark); }

.v-order-contact { margin-top: 6px; font-size: 13px; color: var(--muted); }
.v-order-contact a { color: var(--green-dark); font-weight: 600; text-decoration: none; }
