/* Store — Telegram Mini App. Две темы: тёмная (по умолчанию) и светлая. */

:root,
[data-theme="dark"] {
  --bg: #0C0C0D;
  --surface: #171718;
  --raised: #242426;
  --field: #0F0F10;
  --ink: #F4F4F3;
  --muted: #9B9BA0;
  --soft: #CFCFD3;
  --dot: #5E5E63;
  --accent: #F4F4F3;
  --on-accent: #0C0C0D;
  --ring: #3D3D41;
  --knob-off: #9B9BA0;
  --warn: #FFB35C;
  --danger: #FF7B72;
  --on-danger: #1C0806;
  --line: rgba(255, 255, 255, 0.07);
  --line2: rgba(255, 255, 255, 0.1);
  --outline: rgba(255, 255, 255, 0.18);
  --shine: inset 0 -2px 0 rgba(0, 0, 0, 0.18);
  --shadow: 0 12px 32px rgba(0, 0, 0, 0.45);
  --backdrop: rgba(0, 0, 0, 0.6);
  color-scheme: dark;
}

[data-theme="light"] {
  --bg: #F3F3F1;
  --surface: #FFFFFF;
  --raised: #ECECEA;
  --field: #F6F6F4;
  --ink: #121213;
  --muted: #64646A;
  --soft: #3B3B40;
  --dot: #AAAAAF;
  --accent: #121213;
  --on-accent: #FFFFFF;
  --ring: #C9C9CD;
  --knob-off: #FFFFFF;
  --warn: #A84F00;
  --danger: #C0362C;
  --on-danger: #FFFFFF;
  --line: rgba(0, 0, 0, 0.07);
  --line2: rgba(0, 0, 0, 0.1);
  --outline: rgba(0, 0, 0, 0.18);
  --shine: inset 0 1px 0 rgba(255, 255, 255, 0.18), inset 0 -2px 0 rgba(0, 0, 0, 0.35);
  --shadow: 0 12px 32px rgba(0, 0, 0, 0.12);
  --backdrop: rgba(0, 0, 0, 0.35);
  color-scheme: light;
}

*, *::before, *::after { box-sizing: border-box; }

html, body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: Onest, system-ui, -apple-system, "Segoe UI", sans-serif;
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
  -webkit-text-size-adjust: 100%;
}

button, input, textarea { font-family: inherit; }
button { cursor: pointer; }
a { color: inherit; }
h1, h2, h3, p { margin: 0; }
:focus-visible { outline: 2px solid var(--ink); outline-offset: 2px; }
button:active, .btn:active, .hist:active, .admin-link:active { transform: scale(0.985); }

.app {
  max-width: 480px;
  min-height: 100vh;
  margin: 0 auto;
  padding: 20px 20px calc(112px + env(safe-area-inset-bottom));
  display: flex;
  flex-direction: column;
}
.app.no-nav { padding-bottom: calc(32px + env(safe-area-inset-bottom)); }

.loading, .fatal {
  padding: 120px 20px;
  text-align: center;
  color: var(--muted);
  font-size: 16px;
  line-height: 1.4;
}
.fatal b { display: block; margin-bottom: 8px; color: var(--ink); font-size: 20px; }

/* ---------- шапка ---------- */

.top { display: flex; align-items: center; gap: 12px; }
.logo {
  width: 48px; height: 48px; flex-shrink: 0;
  border-radius: 14px; background: var(--accent); color: var(--on-accent);
  display: flex; align-items: center; justify-content: center;
}
.brand {
  flex: 1 1 auto; min-width: 0;
  font-size: 22px; font-weight: 700; letter-spacing: -0.01em;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.top-meta { font-size: 16px; font-weight: 600; color: var(--muted); white-space: nowrap; }
.sq {
  width: 48px; height: 48px; flex-shrink: 0; padding: 0; border: 0;
  border-radius: 14px; background: var(--surface); color: var(--ink);
  display: flex; align-items: center; justify-content: center; text-decoration: none;
}
.rnd {
  width: 44px; height: 44px; flex-shrink: 0; padding: 0; border: 0;
  border-radius: 50%; background: var(--surface); color: var(--ink);
  display: flex; align-items: center; justify-content: center;
}
.bal {
  height: 44px; flex-shrink: 0; padding: 0 16px 0 12px;
  border-radius: 999px; background: var(--surface); color: var(--ink);
  display: flex; align-items: center; gap: 8px;
  font-size: 16px; font-weight: 600; text-decoration: none; white-space: nowrap;
}
.bal svg { color: var(--muted); }

/* ---------- первый экран раздела ---------- */

.hero { margin-top: 32px; display: flex; flex-direction: column; }
.kicker { display: flex; align-items: center; gap: 12px; min-width: 0; }
.pill {
  height: 34px; flex-shrink: 0; padding: 0 14px;
  border-radius: 999px; background: var(--accent); color: var(--on-accent);
  font-size: 15px; font-weight: 800; letter-spacing: 0.05em;
  display: inline-flex; align-items: center; box-shadow: var(--shine);
  max-width: 70%; overflow: hidden; white-space: nowrap; text-overflow: ellipsis;
}
.pill.plain { font-size: 16px; letter-spacing: 0; }
.sep { width: 5px; height: 5px; flex-shrink: 0; border-radius: 50%; background: var(--dot); }
.kicker-txt { font-size: 18px; font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.h1 {
  margin-top: 18px;
  font-size: 38px; line-height: 1.05; font-weight: 800; letter-spacing: -0.03em;
  overflow-wrap: anywhere;
}
.lead { margin-top: 12px; font-size: 17px; line-height: 1.4; color: var(--muted); }
.lead + .lead { margin-top: 6px; }

/* ---------- секции ---------- */

.sec { margin-top: 36px; display: flex; flex-direction: column; gap: 16px; }
.h2 { font-size: 26px; line-height: 1.2; font-weight: 800; letter-spacing: -0.02em; }
.stack { display: flex; flex-direction: column; gap: 12px; }
.grid2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.mt { margin-top: 24px; }
.mt12 { margin-top: 12px; }
.mt16 { margin-top: 16px; }

/* ---------- кнопки ---------- */

.btn {
  height: 48px; padding: 0 18px 0 14px; border: 0;
  border-radius: 999px; background: var(--accent); color: var(--on-accent);
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  font-size: 16px; font-weight: 700; text-decoration: none; white-space: nowrap;
  box-shadow: var(--shine); flex-shrink: 0;
}
.btn.block { display: flex; width: 100%; height: 56px; padding: 0 20px; gap: 8px; font-size: 17px; font-weight: 800; }
.btn.xl { height: 60px; font-size: 18px; }
.btn.ghost { background: var(--surface); color: var(--ink); box-shadow: none; font-weight: 600; }
.btn.outline { background: transparent; color: var(--ink); border: 1.5px solid var(--outline); box-shadow: none; font-weight: 600; }
.btn.text { background: transparent; color: var(--soft); box-shadow: none; font-weight: 600; }
.btn.danger-text { background: transparent; color: var(--danger); box-shadow: none; font-weight: 600; }
.btn.danger { background: var(--danger); color: var(--on-danger); box-shadow: none; }
.btn.soldout, .btn[disabled] { background: var(--raised); color: var(--muted); box-shadow: none; cursor: default; }
.btn.small { height: 44px; padding: 0 16px; font-size: 15px; }

/* ---------- каталог ---------- */

.tabs {
  display: flex; gap: 8px; margin: 0 -20px; padding: 0 20px;
  overflow-x: auto; scrollbar-width: none;
}
.tabs::-webkit-scrollbar { display: none; }
.chip {
  flex-shrink: 0; height: 40px; padding: 0 16px; border: 0;
  border-radius: 999px; background: var(--surface); color: var(--soft);
  font-size: 15px; font-weight: 600;
}
.chip.on { background: var(--accent); color: var(--on-accent); font-weight: 700; box-shadow: var(--shine); }
.chip.alt { height: 44px; background: var(--raised); }
.chip.alt.on { background: var(--accent); }

.card {
  background: var(--surface); border-radius: 26px; padding: 20px;
  display: flex; flex-direction: column; gap: 18px;
}
.lot-head { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.row { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.lot-title { min-width: 0; font-size: 20px; line-height: 1.2; font-weight: 700; letter-spacing: -0.01em; overflow-wrap: anywhere; }
.tag {
  flex-shrink: 0; height: 28px; padding: 0 10px;
  border-radius: 999px; border: 1px solid var(--outline); color: var(--soft);
  font-size: 12px; font-weight: 800; letter-spacing: 0.08em;
  display: inline-flex; align-items: center;
}
.desc { font-size: 15px; line-height: 1.35; color: var(--muted); overflow-wrap: anywhere; }
.desc.one { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.lot-foot { display: flex; align-items: flex-end; justify-content: space-between; gap: 12px; }
.lot-price { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.price { font-size: 26px; line-height: 1; font-weight: 800; letter-spacing: -0.02em; white-space: nowrap; }
.price small { font-size: 15px; font-weight: 500; letter-spacing: 0; color: var(--muted); }
.stock { display: flex; align-items: center; gap: 6px; font-size: 14px; color: var(--muted); }
.stock i { width: 6px; height: 6px; flex-shrink: 0; border-radius: 50%; background: var(--accent); }
.stock.low { color: var(--warn); }
.stock.low i { background: var(--warn); }

.empty {
  background: var(--surface); border-radius: 26px; padding: 28px 20px;
  display: flex; flex-direction: column; align-items: center; gap: 8px; text-align: center;
}
.empty b { font-size: 18px; font-weight: 700; }
.empty span { font-size: 15px; line-height: 1.35; color: var(--muted); }
.empty .btn { margin-top: 8px; }

.feat { background: var(--surface); border-radius: 26px; padding: 18px; display: flex; flex-direction: column; gap: 22px; }
.ico {
  width: 46px; height: 46px; flex-shrink: 0; border-radius: 14px;
  background: var(--raised); color: var(--ink);
  display: flex; align-items: center; justify-content: center;
}
.feat-txt { display: flex; flex-direction: column; gap: 4px; }
.feat-t { font-size: 18px; line-height: 1.2; font-weight: 700; }
.feat-d { font-size: 15px; line-height: 1.35; color: var(--muted); }

/* ---------- нижняя навигация ---------- */

.nav {
  position: fixed; z-index: 20;
  left: 50%; transform: translateX(-50%);
  bottom: calc(16px + env(safe-area-inset-bottom));
  width: calc(min(480px, 100vw) - 40px); height: 68px; padding: 8px;
  border-radius: 999px; background: var(--surface); border: 1px solid var(--line);
  box-shadow: var(--shadow);
  display: flex; gap: 4px;
}
.nav a, .nav button {
  flex: 1 1 0; min-width: 0; border: 0; border-radius: 999px;
  background: transparent; color: var(--soft); text-decoration: none;
  display: flex; align-items: center; justify-content: center; gap: 8px;
  font-size: 15px; font-weight: 600;
}
.nav .on { background: var(--accent); color: var(--on-accent); font-weight: 700; box-shadow: var(--shine); }

/* ---------- оформление ---------- */

.qty-row { display: flex; align-items: center; justify-content: space-between; }
.step {
  width: 52px; height: 52px; padding: 0; border: 0; border-radius: 50%;
  background: var(--raised); color: var(--ink);
  display: flex; align-items: center; justify-content: center;
}
.step.plus { background: var(--accent); color: var(--on-accent); box-shadow: var(--shine); }
.step[disabled] { opacity: 0.4; cursor: default; }
.qty-val { display: flex; align-items: baseline; gap: 8px; }
.qty-num { font-family: Oswald, Onest, sans-serif; font-size: 60px; line-height: 1; font-weight: 700; }
.qty-unit { font-size: 18px; font-weight: 600; color: var(--muted); }
.presets { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; }
.preset { height: 44px; border: 0; border-radius: 999px; background: var(--raised); color: var(--soft); font-size: 16px; font-weight: 600; }
.preset.on { background: var(--accent); color: var(--on-accent); font-weight: 700; box-shadow: var(--shine); }
.disc { display: flex; align-items: center; gap: 10px; font-size: 15px; color: var(--muted); }
.disc b {
  height: 24px; padding: 0 8px; border-radius: 999px;
  background: var(--accent); color: var(--on-accent);
  font-size: 13px; font-weight: 800; display: inline-flex; align-items: center;
}

.pay {
  min-height: 128px; padding: 18px; border-radius: 26px;
  border: 2px solid transparent; background: var(--surface); color: var(--ink);
  text-align: left; display: flex; flex-direction: column; justify-content: space-between; gap: 14px;
}
.pay.on { border-color: var(--accent); }
.pay > svg, .pay-top svg { color: var(--soft); }
.pay-top { display: flex; align-items: center; justify-content: space-between; }
.radio {
  width: 22px; height: 22px; flex-shrink: 0; border-radius: 50%;
  border: 2px solid var(--ring); display: flex; align-items: center; justify-content: center;
}
.radio i { width: 10px; height: 10px; border-radius: 50%; }
.pay.on .radio { border-color: var(--accent); }
.pay.on .radio i { background: var(--accent); }
.pay-t { font-size: 17px; font-weight: 700; }
.pay-s { font-size: 14px; color: var(--muted); }
.pay-sub { display: flex; flex-direction: column; gap: 2px; }
.pay-big { font-family: Oswald, Onest, sans-serif; font-size: 42px; line-height: 1; font-weight: 700; white-space: nowrap; }

.warn { display: flex; align-items: flex-start; gap: 10px; font-size: 15px; line-height: 1.35; color: var(--warn); }
.warn svg { margin-top: 1px; flex-shrink: 0; }

.sum { background: var(--surface); border-radius: 26px; padding: 20px; display: flex; flex-direction: column; gap: 12px; }
.sum-row { display: flex; justify-content: space-between; gap: 12px; font-size: 16px; }
.sum-row span:first-child { color: var(--muted); }
.sum-row span:last-child { font-weight: 600; white-space: nowrap; }
.sum-line { height: 1px; background: var(--line2); }
.sum-total { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; }
.sum-total span { font-size: 19px; font-weight: 700; }
.sum-total b { font-size: 26px; font-weight: 800; letter-spacing: -0.02em; white-space: nowrap; }

/* ---------- заказ ---------- */

.list { background: var(--surface); border-radius: 26px; padding: 8px; display: flex; flex-direction: column; }
.list-head { padding: 12px 12px 10px; display: flex; align-items: baseline; justify-content: space-between; }
.list-head b { font-size: 19px; font-weight: 700; }
.list-head span { font-size: 15px; color: var(--muted); }
.irow { padding: 12px; border-top: 1px solid var(--line); display: flex; align-items: center; gap: 12px; }
.irow-txt { flex: 1 1 auto; min-width: 0; display: flex; flex-direction: column; gap: 4px; }
.mono { font-family: "JetBrains Mono", ui-monospace, monospace; font-size: 15px; font-weight: 500; word-break: break-all; }
.irow small { font-size: 13px; color: var(--muted); }
.icon-btn {
  width: 44px; height: 44px; flex-shrink: 0; padding: 0; border: 0;
  border-radius: 14px; background: var(--raised); color: var(--soft);
  display: flex; align-items: center; justify-content: center;
}
.more { height: 48px; border: 0; border-top: 1px solid var(--line); background: transparent; color: var(--ink); font-size: 16px; font-weight: 600; }
.actions2 { margin-top: 12px; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.actions2 .btn { height: 56px; padding: 0 12px; }

.details { background: var(--surface); border-radius: 26px; padding: 4px 20px; display: flex; flex-direction: column; }
.drow { min-height: 52px; display: flex; align-items: center; justify-content: space-between; gap: 12px; font-size: 16px; }
.drow + .drow { border-top: 1px solid var(--line); }
.drow span:first-child { color: var(--muted); }
.drow span:last-child { font-weight: 600; text-align: right; }
.drow.total { min-height: 56px; }
.drow.total span:first-child { color: var(--ink); font-size: 17px; font-weight: 700; }
.drow.total b { font-size: 22px; font-weight: 800; letter-spacing: -0.02em; }

.help-card { background: var(--surface); border-radius: 26px; padding: 18px; display: flex; flex-direction: column; gap: 16px; }
.help-row { display: flex; align-items: flex-start; gap: 14px; }
.support-card { padding: 16px; border-radius: 20px; background: var(--surface); align-items: center; }
.support-card .feat-t { font-size: 19px; overflow-wrap: anywhere; }
.sheet .hint { margin-top: -4px; }

/* ---------- профиль ---------- */

.tile {
  min-height: 128px; background: var(--surface); border-radius: 26px; padding: 20px;
  display: flex; flex-direction: column; justify-content: space-between; gap: 14px;
}
.tile-t { font-size: 17px; font-weight: 700; }
.big { font-family: Oswald, Onest, sans-serif; font-size: 44px; line-height: 1; font-weight: 700; white-space: nowrap; }
.hist {
  background: var(--surface); border-radius: 26px; padding: 20px 22px; color: var(--ink); text-decoration: none;
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
}
.hist-l { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.hist-t { font-size: 19px; font-weight: 800; letter-spacing: -0.01em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.hist-t i { font-style: normal; color: var(--dot); }
.hist-d { font-size: 15px; color: var(--muted); }
.hist-r { font-size: 20px; font-weight: 700; white-space: nowrap; }
.hist-r.st { font-size: 15px; font-weight: 600; color: var(--warn); }
.admin-link {
  margin-top: 24px; background: var(--surface); border: 1px dashed var(--outline); border-radius: 26px;
  padding: 18px; color: var(--ink); text-decoration: none;
  display: flex; align-items: center; gap: 14px;
}
.admin-link > span:nth-child(2) { flex: 1 1 auto; display: flex; flex-direction: column; gap: 4px; }
.admin-link > svg { color: var(--muted); flex-shrink: 0; }

/* ---------- пополнение ---------- */

.amount { display: flex; align-items: baseline; justify-content: center; gap: 8px; }
.amount input {
  width: 100%; min-width: 0; border: 0; padding: 0; background: transparent; color: var(--ink);
  font-family: Oswald, Onest, sans-serif; font-size: 60px; line-height: 1.1; font-weight: 700;
  text-align: right; outline: none;
}
.amount input::placeholder { color: var(--dot); }
.amount span { font-family: Oswald, Onest, sans-serif; font-size: 40px; font-weight: 700; color: var(--muted); flex-shrink: 0; width: 45%; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.hint { font-size: 14px; line-height: 1.35; color: var(--muted); }
.center { text-align: center; }

/* ---------- админка ---------- */

.stats3 { background: var(--surface); border-radius: 26px; padding: 16px 0; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); }
.stat { padding: 0 18px; display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.stat + .stat { border-left: 1px solid var(--line2); }
.stat span { font-size: 13px; font-weight: 600; color: var(--muted); white-space: nowrap; }
.stat b { font-family: Oswald, Onest, sans-serif; font-size: 30px; line-height: 1; font-weight: 700; white-space: nowrap; }
.stat b.low { color: var(--warn); }

.flash {
  margin-top: 24px; background: var(--surface); border-radius: 20px; padding: 12px 16px 12px 12px;
  display: flex; align-items: center; gap: 12px; font-size: 16px; line-height: 1.3; font-weight: 600;
}
.flash i {
  width: 32px; height: 32px; flex-shrink: 0; border-radius: 50%;
  background: var(--accent); color: var(--on-accent);
  display: flex; align-items: center; justify-content: center;
}

.lot-card { gap: 16px; }
.fade { opacity: 0.5; }
.metrics { padding-top: 14px; border-top: 1px solid var(--line); display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
.metric { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.metric span { font-size: 13px; font-weight: 600; color: var(--muted); }
.metric b { display: flex; align-items: center; gap: 6px; font-size: 17px; font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.metric b i { width: 6px; height: 6px; flex-shrink: 0; border-radius: 50%; background: currentColor; }
.metric b.low { color: var(--warn); }
.lot-actions { display: flex; align-items: center; gap: 12px; }
.lot-actions .btn { flex: 1 1 auto; height: 44px; font-size: 15px; gap: 8px; padding: 0 12px; }
.vis {
  flex-shrink: 0; height: 44px; padding: 0 2px 0 8px; border: 0; background: transparent; color: var(--soft);
  display: flex; align-items: center; gap: 10px; font-size: 14px; font-weight: 600;
}
.sw { width: 48px; height: 28px; flex-shrink: 0; padding: 3px; border-radius: 999px; background: var(--ring); display: flex; justify-content: flex-start; }
.sw i { width: 22px; height: 22px; border-radius: 50%; background: var(--knob-off); }
.sw.on { background: var(--accent); justify-content: flex-end; }
.sw.on i { background: var(--on-accent); }
.sw.lg { width: 52px; height: 32px; }
.sw.lg i { width: 26px; height: 26px; }

.field { display: flex; flex-direction: column; gap: 8px; min-width: 0; }
.lbl { font-size: 14px; font-weight: 600; color: var(--muted); }
.input {
  width: 100%; height: 52px; padding: 0 16px;
  border-radius: 16px; border: 1px solid var(--line2); background: var(--field); color: var(--ink);
  font-size: 16px; font-weight: 500; outline: none;
}
.input:focus { border-color: var(--outline); }
.input::placeholder { color: var(--muted); opacity: 0.75; }
textarea.input { height: auto; padding: 14px 16px; line-height: 1.45; resize: vertical; }
textarea.input.mono { font-size: 14px; line-height: 1.5; }
.input.tagin { font-weight: 700; letter-spacing: 0.06em; }
.input.pricein { font-weight: 700; padding-right: 40px; }
.input-wrap { position: relative; }
.suffix { position: absolute; top: 0; right: 16px; height: 52px; display: flex; align-items: center; font-size: 16px; font-weight: 600; color: var(--muted); pointer-events: none; }
.upload {
  position: relative; height: 48px; overflow: hidden; cursor: pointer;
  border: 1.5px solid var(--outline); border-radius: 999px; color: var(--ink);
  display: flex; align-items: center; justify-content: center; gap: 8px; font-size: 16px; font-weight: 600;
}
.upload input { position: absolute; inset: 0; width: 100%; height: 100%; margin: 0; opacity: 0; cursor: pointer; }
.upload:focus-within { outline: 2px solid var(--ink); outline-offset: 2px; }
.badge {
  height: 32px; padding: 0 12px; border-radius: 999px; background: var(--raised); color: var(--ink);
  font-size: 14px; font-weight: 700; display: inline-flex; align-items: center; white-space: nowrap;
}
.stock-now { display: flex; align-items: flex-end; justify-content: space-between; gap: 12px; }
.stock-now > div { display: flex; flex-direction: column; gap: 6px; }
.stock-now .qty-val .big { font-size: 44px; }
.stock-tools { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.stock-tools .btn { height: 44px; font-size: 15px; padding: 0 10px; }
.pub {
  margin-top: 36px; background: var(--surface); border-radius: 26px; padding: 16px 12px 16px 20px;
  display: flex; align-items: center; gap: 14px;
}
.pub > div { flex: 1 1 auto; display: flex; flex-direction: column; gap: 4px; }
.pub b { font-size: 18px; line-height: 1.2; font-weight: 700; }
.pub span { font-size: 15px; line-height: 1.35; color: var(--muted); }
.pub button { flex-shrink: 0; width: 60px; height: 44px; padding: 0; border: 0; background: transparent; display: flex; align-items: center; justify-content: center; }
.actions { margin-top: 24px; display: flex; flex-direction: column; gap: 12px; }
.confirm { background: var(--surface); border-radius: 26px; padding: 20px; display: flex; flex-direction: column; gap: 16px; }
.confirm b { font-size: 18px; line-height: 1.2; font-weight: 700; }
.confirm p { font-size: 15px; line-height: 1.35; color: var(--muted); margin-top: 4px; }
.confirm .grid2 .btn { height: 48px; }

/* ---------- всплывающие окна ---------- */

.backdrop {
  position: fixed; inset: 0; z-index: 50; background: var(--backdrop);
  display: flex; align-items: flex-end; justify-content: center;
  animation: fade 0.15s ease-out;
}
.sheet {
  width: min(480px, 100%); background: var(--bg); border-radius: 28px 28px 0 0;
  padding: 24px 20px calc(24px + env(safe-area-inset-bottom));
  display: flex; flex-direction: column; gap: 16px;
  animation: rise 0.2s ease-out;
}
.sheet-t { font-size: 24px; line-height: 1.2; font-weight: 800; letter-spacing: -0.02em; }
.sheet .lead { margin-top: 0; }
@keyframes fade { from { opacity: 0; } }
@keyframes rise { from { transform: translateY(40px); opacity: 0.4; } }

.toast {
  position: fixed; z-index: 60; left: 50%; bottom: calc(100px + env(safe-area-inset-bottom));
  width: max-content; max-width: calc(100vw - 40px); padding: 12px 18px; border-radius: 18px; line-height: 1.35;
  background: var(--ink); color: var(--bg); font-size: 15px; font-weight: 600; text-align: center;
  transform: translate(-50%, 16px); opacity: 0; pointer-events: none;
  transition: transform 0.25s ease, opacity 0.25s ease;
}
.toast.show { transform: translate(-50%, 0); opacity: 1; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}

/* ---------- описание лота ---------- */

.desc { font-size: 16px; line-height: 1.4; font-weight: 500; color: var(--soft); }
.hero-desc { margin-top: 14px; font-size: 18px; line-height: 1.45; font-weight: 500; color: var(--soft); overflow-wrap: anywhere; }
.hero-desc + .lead { margin-top: 10px; }

/* ---------- промокод при оформлении ---------- */

.promo-in { display: flex; align-items: center; gap: 8px; }
.promo-field {
  flex: 1 1 auto; min-width: 0; height: 48px; padding: 0 14px;
  border-radius: 14px; border: 1.5px dashed var(--outline); background: var(--field); color: var(--muted);
  display: flex; align-items: center; gap: 10px; cursor: text;
}
.promo-field:focus-within { border-style: solid; border-color: var(--ink); color: var(--ink); }
.promo-field input {
  flex: 1 1 auto; min-width: 0; height: 100%; padding: 0; border: 0; outline: none; background: transparent; color: var(--ink);
  font-family: "JetBrains Mono", ui-monospace, monospace; font-size: 16px; font-weight: 500; letter-spacing: 0.06em; text-transform: uppercase;
}
.promo-field input::placeholder { font-family: Onest, system-ui, sans-serif; letter-spacing: 0; text-transform: none; color: var(--muted); }
.promo-in .btn { height: 48px; }
.promo-err { display: flex; align-items: center; gap: 8px; font-size: 14px; line-height: 1.35; color: var(--warn); }
.promo-err svg { flex-shrink: 0; }
.promo-on { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.promo-row span:last-child { font-weight: 700; color: var(--ink); }

/* Купон: пунктирная рамка и «вырезы» по бокам */
.ticket {
  position: relative; display: inline-flex; align-items: center; gap: 10px; min-width: 0;
  height: 44px; padding: 0 16px; border-radius: 12px;
  background: var(--raised); border: 1.5px dashed var(--outline); color: var(--ink);
}
.ticket::before, .ticket::after {
  content: ""; position: absolute; top: 50%; width: 14px; height: 14px; margin-top: -7px;
  border-radius: 50%; background: var(--surface);
}
.ticket::before { left: -8px; }
.ticket::after { right: -8px; }
.ticket svg { flex-shrink: 0; color: var(--muted); }
.ticket b { font-size: 16px; font-weight: 500; letter-spacing: 0.06em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ticket i {
  font-style: normal; height: 24px; padding: 0 8px; border-radius: 999px;
  background: var(--accent); color: var(--on-accent); font-size: 13px; font-weight: 800;
  display: inline-flex; align-items: center; white-space: nowrap;
}
.off-pill {
  flex-shrink: 0; height: 32px; padding: 0 12px; border-radius: 999px;
  background: var(--accent); color: var(--on-accent); box-shadow: var(--shine);
  font-size: 15px; font-weight: 800; display: inline-flex; align-items: center; white-space: nowrap;
}

.total-v { display: flex; align-items: baseline; gap: 10px; }
.total-v s { font-size: 17px; font-weight: 600; color: var(--muted); text-decoration-thickness: 2px; white-space: nowrap; }
.saved {
  align-self: flex-start; display: inline-flex; align-items: center; gap: 8px;
  height: 32px; padding: 0 12px; border-radius: 999px; background: var(--raised); color: var(--ink);
  font-size: 14px; font-weight: 700;
}
.btn .btn-old { font-weight: 600; opacity: 0.55; text-decoration-thickness: 2px; }
.btn.block.xl { gap: 10px; }

/* ---------- сумма пополнения по центру ---------- */

.amount { justify-content: center; align-items: baseline; }
.amount input { width: 1.15ch; max-width: 100%; text-align: center; flex: 0 0 auto; }
.amount span { width: auto; }

/* ---------- админка: вкладки и промокоды ---------- */

.seg {
  margin-top: 24px; padding: 4px; border-radius: 999px; background: var(--surface);
  display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 4px;
}
.seg a {
  height: 44px; border-radius: 999px; color: var(--soft); text-decoration: none;
  display: flex; align-items: center; justify-content: center; gap: 8px; font-size: 15px; font-weight: 600;
}
.seg a.on { background: var(--accent); color: var(--on-accent); font-weight: 700; box-shadow: var(--shine); }
.row-field { display: flex; align-items: center; gap: 8px; }
.row-field .input { flex: 1 1 auto; min-width: 0; }
.row-field .btn { height: 52px; flex-shrink: 0; }
.btn.raised { background: var(--raised); }
.input.codein { letter-spacing: 0.08em; text-transform: uppercase; }
.switch-row { display: flex; align-items: center; gap: 14px; }
.switch-row > div { flex: 1 1 auto; display: flex; flex-direction: column; gap: 4px; }
.switch-row b { font-size: 16px; font-weight: 700; }
.switch-row span { font-size: 14px; line-height: 1.35; color: var(--muted); }
.switch-row button { flex-shrink: 0; width: 60px; height: 44px; padding: 0; border: 0; background: transparent; display: flex; align-items: center; justify-content: center; }
.lot-card .row .ticket { flex: 0 1 auto; }

/* ---------- оптовые пороги лота ---------- */

.tiers { display: flex; flex-direction: column; gap: 10px; padding-top: 16px; border-top: 1px solid var(--line); }
.tiers-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; }
.tiers-head > span:first-child { font-size: 15px; font-weight: 700; }
.tiers-next { font-size: 14px; font-weight: 600; color: var(--muted); text-align: right; }
.tiers-next.on { color: var(--ink); }
.tier-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(96px, 1fr)); gap: 8px; }
.tier {
  min-height: 72px; padding: 10px 12px; border: 0; border-radius: 16px;
  background: var(--raised); color: var(--ink); text-align: left;
  display: flex; flex-direction: column; justify-content: center; gap: 2px;
}
.tier span { font-size: 13px; font-weight: 600; color: var(--muted); }
.tier b { font-size: 18px; line-height: 1.15; font-weight: 800; }
.tier small { font-size: 12px; color: var(--muted); }
.tier.on { background: var(--accent); color: var(--on-accent); box-shadow: var(--shine); }
.tier.on span, .tier.on small { color: var(--on-accent); opacity: 0.75; }
.tier[disabled] { opacity: 0.45; cursor: default; }
.opt-note { display: flex; align-items: center; gap: 6px; font-size: 13px; font-weight: 600; color: var(--soft); }
.opt-note svg { flex-shrink: 0; color: var(--muted); }

.tier-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) 44px; gap: 8px 10px; align-items: center; }
.tier-grid .icon-btn { height: 52px; width: 44px; }
#tiersCard > .btn { align-self: flex-start; }

/* ---------- честная выдача: товары открываются по одному ---------- */

.check { background: var(--surface); border-radius: 26px; padding: 20px; display: flex; flex-direction: column; gap: 16px; }
.check-head { display: flex; align-items: center; gap: 14px; }
.check-ico {
  width: 48px; height: 48px; flex-shrink: 0; border-radius: 16px; background: var(--raised); color: var(--ink);
  display: flex; align-items: center; justify-content: center;
}
.check-t { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.check-t b { font-size: 18px; font-weight: 800; }
.check-t span { font-size: 15px; color: var(--muted); font-variant-numeric: tabular-nums; }
.check-t span.warn { color: var(--warn); font-weight: 600; }
.bar { height: 8px; border-radius: 999px; background: var(--raised); overflow: hidden; }
.bar i { display: block; height: 100%; min-width: 0; border-radius: inherit; background: var(--accent); transition: width .35s ease; }
.check-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; font-size: 15px; color: var(--muted); flex-wrap: wrap; }
.check-row b { color: var(--ink); font-weight: 700; }
.srv { display: inline-flex; align-items: center; gap: 6px; font-variant-numeric: tabular-nums; }
.srv b { font-family: "JetBrains Mono", ui-monospace, monospace; font-weight: 500; }
.last {
  border-radius: 18px; padding: 14px; background: var(--field); border: 1px solid var(--line2);
  display: flex; flex-direction: column; gap: 10px; animation: pop .35s ease;
}
.last-t { font-size: 13px; font-weight: 700; letter-spacing: 0.04em; text-transform: uppercase; color: var(--muted); }
.last-row { display: flex; align-items: center; gap: 12px; }
.last-row .mono { flex: 1 1 auto; min-width: 0; font-size: 16px; }
.last-time { display: flex; align-items: center; gap: 6px; font-size: 14px; font-weight: 600; color: var(--soft); font-variant-numeric: tabular-nums; }
.tip { display: flex; align-items: flex-start; gap: 10px; font-size: 14px; line-height: 1.4; color: var(--soft); }
.tip svg { flex-shrink: 0; margin-top: 1px; color: var(--muted); }
.irow.closed .lock {
  width: 44px; height: 44px; flex-shrink: 0; border-radius: 14px; background: var(--raised); color: var(--muted);
  display: flex; align-items: center; justify-content: center;
}
.masked { font-family: "JetBrains Mono", ui-monospace, monospace; font-size: 15px; letter-spacing: 0.1em; color: var(--dot); }
.irow .btn.small { height: 40px; padding: 0 14px; flex-shrink: 0; }
.irow small { font-variant-numeric: tabular-nums; }
.irow small.warn { color: var(--warn); font-weight: 600; }
.hist-open { font-weight: 600; color: var(--warn); white-space: nowrap; }
.hist-r2 { display: flex; flex-direction: column; align-items: flex-end; gap: 2px; flex-shrink: 0; }
.hist-r2 b { font-size: 20px; font-weight: 700; white-space: nowrap; font-variant-numeric: tabular-nums; }
.hist-r2 small { font-size: 13px; color: var(--muted); }
.hist-r2.part b { color: var(--warn); }
.row .h2 { min-width: 0; }
.btn.text.small { height: 36px; padding: 0 4px; }
.seg { grid-template-columns: repeat(3, minmax(0, 1fr)); }
@media (max-width: 370px) { .seg a svg { display: none; } }
@keyframes pop { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
@media (prefers-reduced-motion: reduce) { .last { animation: none; } .bar i { transition: none; } }
.nw { white-space: nowrap; }

/* ---------- документы: соглашение и политика ---------- */

.legal-foot {
  margin-top: 40px; padding-top: 20px; border-top: 1px solid var(--line);
  display: flex; flex-wrap: wrap; justify-content: center; gap: 6px 18px;
}
.legal-foot a { font-size: 14px; font-weight: 500; color: var(--muted); text-decoration: none; padding: 6px 0; }
.legal-foot a:active { color: var(--ink); }
.consent { margin-top: 12px; text-align: center; font-size: 13px; line-height: 1.4; color: var(--muted); }
.consent a { color: var(--soft); text-decoration: underline; text-underline-offset: 2px; }
.doc { margin-top: 12px; display: flex; flex-direction: column; gap: 14px; font-size: 16px; line-height: 1.55; color: var(--soft); overflow-wrap: anywhere; }
.doc .h1 { margin: 12px 0 6px; font-size: 32px; color: var(--ink); }
.doc h2 { margin-top: 18px; font-size: 21px; line-height: 1.25; font-weight: 800; letter-spacing: -0.01em; color: var(--ink); }
.doc ul { margin: 0; padding-left: 20px; display: flex; flex-direction: column; gap: 8px; }
.doc li::marker { color: var(--dot); }
.doc b { color: var(--ink); font-weight: 700; }
.doc a { color: var(--ink); text-decoration: underline; text-underline-offset: 2px; text-decoration-color: var(--outline); }
.doc > p:last-child { margin-top: 10px; font-size: 14px; color: var(--muted); }
.legal-next { margin-top: 28px; }
.legal-page .legal-links { margin-top: 32px; padding-top: 20px; border-top: 1px solid var(--line); font-size: 15px; color: var(--muted); }
.legal-page .legal-links a { color: var(--soft); }

/* ---------- окно открыто не из того места: старая кнопка, другой бот, вне Telegram ---------- */

.fatal.auth { min-height: 70vh; padding: 48px 8px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 10px; }
.fatal.auth b { margin: 0; font-size: 22px; line-height: 1.25; }
.fatal.auth > span:not(.fatal-ico) { max-width: 330px; font-size: 16px; line-height: 1.45; color: var(--soft); }
.fatal-ico {
  width: 64px; height: 64px; margin-bottom: 8px; border-radius: 20px; background: var(--surface); color: var(--ink);
  display: flex; align-items: center; justify-content: center;
}
.fatal.auth .btn { margin-top: 20px; max-width: 330px; }
