/* ====== ДЫМ · tokens ====== */
:root {
  --night: #0C0B0A;
  --panel: #161311;
  --panel-2: #1E1A17;
  --line: #2C2620;
  --gold: #C9A063;
  --gold-soft: #E2C89A;
  --rose: #A65D4E;
  --smoke: #8A7E75;
  --cream: #F3EBE0;
  --ok: #7FA16B;

  --font-display: Georgia, "Times New Roman", serif;
  --font-body: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;

  --r: 10px;
  --pad: 18px;
  --tab-h: 64px;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html, body {
  background: var(--night);
  color: var(--cream);
  font-family: var(--font-body);
  font-size: 15px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}
body { min-height: 100vh; }
button { font: inherit; color: inherit; background: none; border: none; cursor: pointer; }
textarea { font: inherit; }

#app {
  max-width: 480px;
  margin: 0 auto;
  padding-bottom: calc(var(--tab-h) + 24px + env(safe-area-inset-bottom));
}

/* ====== HERO ====== */
.hero {
  position: relative;
  padding: 28px var(--pad) 22px;
  overflow: hidden;
  border-bottom: 1px solid var(--line);
}
.hero-smoke {
  position: absolute; inset: -40% -20% auto -20%; height: 220px;
  background:
    radial-gradient(60% 80% at 30% 20%, rgba(201,160,99,.18), transparent 70%),
    radial-gradient(50% 70% at 80% 10%, rgba(166,93,78,.12), transparent 70%);
  filter: blur(12px);
  pointer-events: none;
}
.hero-brand {
  display: flex; align-items: center; gap: 14px;
  position: relative;
}
.hero-icon { width: 48px; height: 48px; color: var(--gold); }
.eyebrow {
  font-size: 11px;
  letter-spacing: .18em;
  text-transform: uppercase;
  color: var(--smoke);
}
.hero h1 {
  font-family: var(--font-display);
  font-size: 34px;
  letter-spacing: .12em;
  font-weight: 500;
  line-height: 1.1;
  color: var(--gold-soft);
}
.hero-sub {
  margin-top: 12px;
  color: var(--smoke);
  font-size: 14px;
  position: relative;
}

/* ====== VIEWS ====== */
.view { display: none; padding: 20px var(--pad) 8px; }
.view.active { display: block; }

.section-head {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 16px;
}
.section-head h2 {
  font-family: var(--font-display);
  font-size: 22px;
  font-weight: 500;
  letter-spacing: .04em;
}
.pill {
  font-size: 11px;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--gold);
  border: 1px solid var(--line);
  padding: 5px 10px;
  border-radius: 999px;
}
.pill b { color: var(--gold-soft); }

/* ====== MENU ====== */
.menu-list { display: flex; flex-direction: column; gap: 10px; }

.menu-item {
  display: grid;
  grid-template-columns: 36px 1fr auto;
  gap: 12px;
  align-items: center;
  padding: 14px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--r);
  text-align: left;
  width: 100%;
  transition: border-color .15s, transform .12s;
}
.menu-item:hover, .menu-item:focus-visible {
  border-color: var(--gold);
  outline: none;
}
.menu-item:active { transform: scale(.985); }
.menu-item.selected { border-color: var(--gold); background: var(--panel-2); }

.menu-num {
  font-family: var(--font-display);
  color: var(--gold);
  font-size: 13px;
  letter-spacing: .06em;
  opacity: .85;
}
.menu-name {
  font-family: var(--font-display);
  font-size: 17px;
  letter-spacing: .02em;
}
.menu-desc {
  color: var(--smoke);
  font-size: 12.5px;
  margin-top: 2px;
  display: -webkit-box;
  -webkit-line-clamp: 1;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.menu-price {
  font-family: var(--font-display);
  color: var(--gold-soft);
  font-size: 17px;
  white-space: nowrap;
}

.cat-label {
  font-size: 11px;
  letter-spacing: .16em;
  text-transform: uppercase;
  color: var(--smoke);
  margin: 18px 0 8px;
}
.cat-label:first-child { margin-top: 0; }

.strength { display: flex; gap: 3px; margin-top: 6px; }
.strength i {
  width: 14px; height: 3px; border-radius: 2px;
  background: var(--line);
}
.strength i.on { background: var(--gold); }

/* ====== BLOCKS / FORM ====== */
.block { margin: 18px 0; }
.block-title {
  font-size: 11px;
  letter-spacing: .16em;
  text-transform: uppercase;
  color: var(--smoke);
  margin-bottom: 10px;
}

.chips { display: flex; gap: 8px; overflow-x: auto; padding-bottom: 4px; }
.chips::-webkit-scrollbar { display: none; }
.chip {
  flex: 0 0 auto;
  padding: 10px 14px;
  border: 1px solid var(--line);
  border-radius: var(--r);
  background: var(--panel);
  color: var(--smoke);
  font-size: 13px;
  min-height: 44px;
}
.chip.active {
  border-color: var(--gold);
  color: var(--night);
  background: var(--gold);
  font-weight: 600;
}

.slot-grid, .table-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(72px, 1fr));
  gap: 8px;
}
.slot, .table-chip {
  padding: 12px 6px;
  border: 1px solid var(--line);
  border-radius: var(--r);
  background: var(--panel);
  text-align: center;
  font-size: 14px;
  min-height: 44px;
  color: var(--cream);
}
.slot.active, .table-chip.active {
  border-color: var(--gold);
  background: var(--gold);
  color: var(--night);
  font-weight: 600;
}
.slot.off {
  opacity: .35;
  text-decoration: line-through;
  cursor: not-allowed;
}

.input {
  width: 100%;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--r);
  color: var(--cream);
  padding: 12px 14px;
  resize: vertical;
}
.input:focus { outline: none; border-color: var(--gold); }

.switch-row {
  display: flex; align-items: center; justify-content: space-between;
  gap: 12px;
  padding: 12px 14px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--r);
  cursor: pointer;
  min-height: 48px;
}
.switch-row input { display: none; }
.switch {
  width: 44px; height: 26px;
  background: var(--line);
  border-radius: 999px;
  position: relative;
  transition: background .15s;
}
.switch::after {
  content: "";
  position: absolute; top: 3px; left: 3px;
  width: 20px; height: 20px;
  background: var(--smoke);
  border-radius: 50%;
  transition: transform .15s, background .15s;
}
.switch-row input:checked + .switch { background: var(--gold); }
.switch-row input:checked + .switch::after {
  transform: translateX(18px);
  background: var(--night);
}

.hint { color: var(--smoke); font-size: 12.5px; margin-top: 8px; }
.hint b { color: var(--gold-soft); }

/* ====== ORDER SUMMARY ====== */
.order-summary {
  display: flex; align-items: flex-end; justify-content: space-between;
  gap: 14px;
  margin: 22px 0 14px;
  padding: 16px;
  background: linear-gradient(160deg, var(--panel-2), var(--panel));
  border: 1px solid var(--line);
  border-radius: var(--r);
}
.price-big {
  font-family: var(--font-display);
  font-size: 30px;
  color: var(--gold-soft);
  line-height: 1;
}
.price-big small { font-size: 16px; color: var(--smoke); }
.order-meta { text-align: right; font-size: 13px; color: var(--smoke); }
.order-meta p { margin: 2px 0; }

.btn-primary {
  width: 100%;
  padding: 16px;
  background: var(--gold);
  color: var(--night);
  font-weight: 700;
  font-size: 15px;
  letter-spacing: .04em;
  border-radius: var(--r);
  min-height: 52px;
  transition: filter .15s, transform .12s;
}
.btn-primary:hover:not(:disabled) { filter: brightness(1.08); }
.btn-primary:active:not(:disabled) { transform: scale(.985); }
.btn-primary:disabled {
  background: var(--panel-2);
  color: var(--smoke);
  cursor: not-allowed;
  border: 1px solid var(--line);
}

.msg {
  margin-top: 12px;
  padding: 12px 14px;
  border-radius: var(--r);
  font-size: 13.5px;
}
.msg.ok { background: rgba(127,161,107,.15); color: var(--ok); border: 1px solid rgba(127,161,107,.35); }
.msg.err { background: rgba(166,93,78,.15); color: var(--rose); border: 1px solid rgba(166,93,78,.35); }

/* ====== BONUS ====== */
.bonus-card {
  padding: 22px;
  background:
    radial-gradient(120% 140% at 10% 0%, rgba(201,160,99,.18), transparent 55%),
    linear-gradient(160deg, var(--panel-2), var(--panel));
  border: 1px solid var(--line);
  border-radius: 14px;
}
.bonus-num {
  font-family: var(--font-display);
  font-size: 48px;
  color: var(--gold-soft);
  line-height: 1.05;
  margin: 6px 0 14px;
}
.bonus-num small { font-size: 15px; color: var(--smoke); font-family: var(--font-body); }
.bonus-bar {
  height: 4px;
  background: var(--line);
  border-radius: 4px;
  overflow: hidden;
}
.bonus-bar i {
  display: block; height: 100%;
  width: 0%;
  background: linear-gradient(90deg, var(--gold), var(--gold-soft));
  transition: width .5s ease;
}

.rules { list-style: none; display: flex; flex-direction: column; gap: 10px; }
.rules li {
  padding-left: 16px;
  position: relative;
  color: var(--smoke);
  font-size: 13.5px;
}
.rules li::before {
  content: "";
  position: absolute; left: 0; top: 8px;
  width: 6px; height: 6px;
  background: var(--gold);
  border-radius: 50%;
}
.rules b { color: var(--cream); }

.history { display: flex; flex-direction: column; gap: 8px; }
.hist-row {
  display: flex; justify-content: space-between; align-items: center;
  padding: 12px 14px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--r);
  font-size: 13px;
}
.hist-row .amt { color: var(--ok); font-weight: 600; }
.hist-row .amt.neg { color: var(--rose); }
.hist-row .when { color: var(--smoke); font-size: 11.5px; }
.empty {
  color: var(--smoke);
  font-size: 13px;
  padding: 16px;
  text-align: center;
  border: 1px dashed var(--line);
  border-radius: var(--r);
}

/* ====== TABBAR ====== */
.tabbar {
  position: fixed;
  left: 50%;
  transform: translateX(-50%);
  bottom: 0;
  width: 100%;
  max-width: 480px;
  height: calc(var(--tab-h) + env(safe-area-inset-bottom));
  padding-bottom: env(safe-area-inset-bottom);
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  background: rgba(12, 11, 10, .92);
  backdrop-filter: blur(14px);
  border-top: 1px solid var(--line);
  z-index: 20;
}
.tab {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 3px;
  color: var(--smoke);
  font-size: 11px;
  letter-spacing: .06em;
  text-transform: uppercase;
}
.tab svg { width: 22px; height: 22px; }
.tab.active { color: var(--gold); }

/* ====== SHEET ====== */
.sheet { position: fixed; inset: 0; z-index: 40; }
.sheet-backdrop {
  position: absolute; inset: 0;
  background: rgba(0,0,0,.55);
}
.sheet-panel {
  position: absolute;
  left: 50%;
  bottom: 0;
  transform: translateX(-50%);
  width: 100%;
  max-width: 480px;
  background: var(--panel-2);
  border: 1px solid var(--line);
  border-bottom: none;
  border-radius: 18px 18px 0 0;
  padding: 12px var(--pad) calc(24px + env(safe-area-inset-bottom));
}
.sheet-grip {
  width: 40px; height: 4px;
  background: var(--line);
  border-radius: 4px;
  margin: 0 auto 16px;
}
.sheet-panel h2 {
  font-family: var(--font-display);
  font-size: 26px;
  font-weight: 500;
  margin: 4px 0 8px;
}
.sheet-desc { color: var(--smoke); margin: 12px 0 20px; }
.sheet-foot {
  display: flex; align-items: center; justify-content: space-between; gap: 14px;
}
.sheet-foot .btn-primary { width: auto; padding-left: 28px; padding-right: 28px; }

/* ====== a11y ====== */
:focus-visible {
  outline: 2px solid var(--gold);
  outline-offset: 2px;
}
@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; animation: none !important; }
}

/* ====== v2: discount tiers + QR ====== */
.menu-price { text-align: right; }
.old-price {
  display: block;
  color: var(--smoke);
  font-size: 12px;
  opacity: .75;
  margin-top: 2px;
}

.qr-wrap {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  padding: 18px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--r);
}
.qr-wrap img {
  background: #fff;
  border-radius: 8px;
  padding: 8px;
}
.qr-code {
  font-family: var(--font-display);
  letter-spacing: .18em;
  color: var(--gold-soft);
  font-size: 18px;
}

.tiers { display: flex; flex-direction: column; gap: 8px; }
.tier {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--r);
}
.tier.active {
  border-color: var(--gold);
  background: var(--panel-2);
}
.tier-disc {
  font-family: var(--font-display);
  font-size: 20px;
  color: var(--gold-soft);
  min-width: 52px;
}
.tier-label {
  flex: 1;
  color: var(--smoke);
  font-size: 13px;
}
.tier-now {
  font-size: 10px;
  letter-spacing: .12em;
  text-transform: uppercase;
  color: var(--night);
  background: var(--gold);
  padding: 3px 8px;
  border-radius: 999px;
  font-weight: 700;
}

.hist-row .amt { color: var(--gold-soft); }

/* ====== admin: receipt upload ====== */
.upload {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 88px;
  padding: 16px;
  border: 1px dashed var(--line);
  border-radius: var(--r);
  background: var(--panel);
  color: var(--smoke);
  cursor: pointer;
  text-align: center;
  font-size: 13.5px;
}
.upload:hover, .upload:focus-within { border-color: var(--gold); color: var(--cream); }

#preview-wrap {
  margin-top: 10px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  align-items: center;
}
#preview {
  max-width: 100%;
  max-height: 240px;
  border-radius: 8px;
  border: 1px solid var(--line);
}

.btn-secondary {
  padding: 10px 16px;
  border: 1px solid var(--line);
  border-radius: var(--r);
  color: var(--smoke);
  background: var(--panel);
  min-height: 44px;
}
.btn-secondary:hover { border-color: var(--gold); color: var(--cream); }
