:root {
  --bg: #0a1222;
  --surface: #0f1a2e;
  --tile: #132038;
  --raise: #172743;
  --line: #1b2a45;
  --line-2: #263a5c;
  --ink: #e8eef8;
  --muted: #8d9cb8;
  --dim: #5e6f90;
  /* Акцент на тёмном фоне: цены, ссылки, выбранное. Кнопки — отдельным, более глубоким синим. */
  --accent: #9db8ff;
  --btn: #3f6fe0;
  --btn-ink: #ffffff;
  --accent-soft: rgba(90, 135, 245, .13);
  --accent-line: rgba(125, 160, 245, .34);
  --glow: 0 10px 24px -14px rgba(40, 90, 220, .9);
  --ok: #4fd39a;
  --warn: #f2c66d;
  --danger: #f2747f;
  --glass: rgba(225, 235, 255, .12);
  --glass-edge: rgba(225, 235, 255, .26);
  --label: #e3eaf7;
  --text: "Exo 2", -apple-system, "Segoe UI", Roboto, sans-serif;
  --mono: "JetBrains Mono", ui-monospace, "SF Mono", Menlo, monospace;
  --r-card: 20px;
  --r-tile: 14px;
  --r-ctl: 12px;
  --dock-h: 62px;
  --safe-b: max(env(safe-area-inset-bottom, 0px), var(--tg-safe-area-inset-bottom, 0px));
  color-scheme: dark;
}

* { box-sizing: border-box; }
html { background: var(--bg); }
body {
  margin: 0; color: var(--ink);
  font: 400 15px/1.45 var(--text);
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
  overscroll-behavior-y: none;
  background: radial-gradient(120% 55% at 50% -12%, rgba(64, 104, 200, .22), transparent 62%), var(--bg);
  background-attachment: fixed;
}
body.locked { overflow: hidden; }
button, input, textarea, select { font: inherit; color: inherit; }
a { color: var(--accent); text-decoration: none; }
img { max-width: 100%; display: block; }
[hidden] { display: none !important; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
::selection { background: var(--btn); color: var(--btn-ink); }

#app { max-width: 560px; margin: 0 auto; min-height: 100dvh; }
#view { padding: 4px 14px calc(var(--dock-h) + var(--safe-b) + 92px); outline: none; }

.mono { font-family: var(--mono); }
.caps { font-family: var(--mono); text-transform: uppercase; letter-spacing: .12em; font-size: 12px; font-weight: 600; }

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

.top { position: sticky; top: 0; z-index: 8; padding: calc(10px + var(--tg-content-safe-area-inset-top, 0px)) 10px 6px; }
.top > .bar, .top > .search { position: relative; }
.top::before {
  content: ""; position: absolute; inset: calc(6px + var(--tg-content-safe-area-inset-top, 0px)) 6px 0;
  border-radius: 24px; background: rgba(12, 21, 38, .9); backdrop-filter: blur(14px);
  border: 1px solid var(--line-2); box-shadow: 0 12px 30px -20px rgba(0, 0, 0, .8);
}
.bar { display: flex; align-items: center; gap: 8px; padding: 6px 6px 6px 8px; }
.brand { flex: 1; min-width: 0; display: flex; align-items: center; gap: 10px; color: var(--ink); }
.brand #logo { width: 38px; height: 38px; flex: none; border-radius: 12px; }
.brand .mark { display: grid; place-items: center; background: linear-gradient(145deg, #1d3566, #122242); border: 1px solid var(--accent-line); }
.brand .mark svg { width: 21px; height: 21px; fill: none; stroke: var(--accent); stroke-width: 1.9; stroke-linecap: round; stroke-linejoin: round; }
.brand #logo { object-fit: contain; background: var(--tile); }
.brand span { font: 800 20px/1.1 var(--text); letter-spacing: .01em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.icon-btn {
  position: relative; width: 40px; height: 40px; flex: none; border-radius: 50%;
  display: grid; place-items: center; color: var(--ink); cursor: pointer;
  background: var(--raise); border: 1px solid var(--line-2);
}
.icon-btn svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.icon-btn.back { background: transparent; border-color: transparent; margin-right: -4px; }
.icon-btn .dot { position: absolute; top: 2px; right: 2px; width: 9px; height: 9px; border-radius: 50%; background: var(--danger); border: 2px solid var(--bg); }
.badge {
  position: absolute; top: -5px; right: -5px; min-width: 20px; height: 20px; padding: 0 5px; border-radius: 999px;
  background: var(--btn); color: var(--btn-ink); font: 700 11px/20px var(--mono); text-align: center;
}
.bump .badge { animation: bump .32s ease-out; }
@keyframes bump { 40% { transform: scale(1.35); } }
.balance-pill {
  height: 40px; padding: 0 12px; border-radius: 12px; display: inline-flex; align-items: center;
  font: 700 13px/1 var(--mono); color: var(--accent); white-space: nowrap;
  background: var(--accent-soft); border: 1px solid var(--accent-line);
}
.search { display: block; margin: 2px 6px 6px; }
.search svg { position: absolute; left: 16px; top: 50%; width: 19px; height: 19px; transform: translateY(-50%); fill: none; stroke: var(--muted); stroke-width: 1.9; stroke-linecap: round; pointer-events: none; }
.search input {
  width: 100%; height: 46px; padding: 0 16px 0 44px; border-radius: 999px; outline: none;
  background: var(--tile); border: 1px solid var(--line-2); font-size: 16px;
}
.search input::placeholder { color: var(--dim); }
.search input:focus { border-color: var(--accent-line); }
.search input::-webkit-search-cancel-button { filter: invert(1) opacity(.5); }

/* ---------- нижняя панель ---------- */

.dock {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 7; max-width: 560px; margin: 0 auto;
  padding-bottom: var(--safe-b); background: rgba(10, 18, 34, .92); backdrop-filter: blur(14px);
  border-top: 1px solid var(--line);
}
.action { padding: 10px 14px 0; }
.tabs { display: grid; grid-template-columns: repeat(4, 1fr); height: var(--dock-h); }
.tabs a { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px; color: var(--dim); font-size: 11.5px; font-weight: 600; }
.tabs svg { width: 23px; height: 23px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linejoin: round; stroke-linecap: round; }
.tabs a[aria-current="page"] { color: var(--accent); }

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

.btn {
  display: flex; align-items: center; justify-content: center; gap: 10px;
  width: 100%; min-height: 52px; padding: 12px 18px; border: 0; border-radius: 14px; cursor: pointer;
  background: var(--btn); color: var(--btn-ink); box-shadow: var(--glow);
  font: 700 14px/1.2 var(--mono); text-transform: uppercase; letter-spacing: .06em;
  transition: transform .12s ease, opacity .12s ease;
}
.btn:active { transform: scale(.985); }
.btn[disabled] { opacity: .4; cursor: default; box-shadow: none; }
.btn .sum { font: 700 16px/1 var(--mono); letter-spacing: 0; }
.btn.split { justify-content: space-between; }
.btn.secondary { background: var(--raise); color: var(--ink); border: 1px solid var(--line-2); box-shadow: none; }
.btn.quiet { background: transparent; color: var(--muted); box-shadow: none; min-height: 44px; }
.btn.danger { background: transparent; color: var(--danger); box-shadow: none; min-height: 44px; }
.btn.small { min-height: 40px; width: auto; padding: 8px 14px; font-size: 12px; }
.row-btns { display: grid; gap: 8px; }

.field { display: block; margin: 0 0 12px; }
.field > span { display: block; margin: 0 0 6px; font-size: 13px; color: var(--muted); }
.fields-row { display: grid; grid-template-columns: 1fr 118px; gap: 10px; }
.input {
  width: 100%; padding: 13px 14px; border-radius: var(--r-ctl); outline: none; font-size: 16px;
  background: var(--tile); border: 1px solid var(--line-2);
}
.input::placeholder { color: var(--dim); }
.input:focus { border-color: var(--accent-line); box-shadow: 0 0 0 3px var(--accent-soft); }
textarea.input { resize: none; min-height: 84px; }
.hint { font-size: 13px; color: var(--muted); margin: -4px 0 12px; }

/* ---------- общие блоки ---------- */

h1 { font: 800 26px/1.12 var(--text); letter-spacing: .005em; margin: 12px 0 14px; }
h2 { font: 700 18px/1.2 var(--text); margin: 26px 0 10px; }
.muted { color: var(--muted); }
.panel { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-card); padding: 14px 16px; }
.panel + .panel { margin-top: 10px; }
.lines { display: grid; gap: 8px; }
.line { display: flex; justify-content: space-between; gap: 12px; }
.line b, .money { font: 600 15px/1.3 var(--mono); white-space: nowrap; }
.line.total { padding-top: 10px; border-top: 1px solid var(--line-2); }
.line.total b { color: var(--accent); font-size: 17px; }
.empty { padding: 48px 12px; text-align: center; color: var(--muted); }
.empty .btn { margin-top: 18px; }
.rich { white-space: pre-wrap; overflow-wrap: anywhere; color: #c5d0e3; }
.rich code, .code { font-family: var(--mono); font-size: 14px; color: var(--accent); background: var(--accent-soft); padding: 2px 6px; border-radius: 6px; cursor: copy; }
.rich blockquote { margin: 8px 0; padding-left: 12px; border-left: 2px solid var(--line-2); }
.rich a { text-decoration: underline; }
.note { font-size: 12.5px; color: var(--dim); text-align: center; margin: 14px 8px 0; }

/* ---------- баннер: только текст, одна строка-ссылка в чат ---------- */

.banner {
  display: flex; align-items: center; gap: 14px; margin: 6px 0 14px; padding: 14px 14px 14px 16px;
  border-radius: 18px; border: 1px solid var(--line-2); color: var(--ink);
  background: linear-gradient(120deg, #15264a, #0e1a31 70%);
}
.banner-text { flex: 1; min-width: 0; }
.banner-title { font: 700 16px/1.25 var(--text); }
.banner-sub { margin-top: 3px; font-size: 13px; line-height: 1.4; color: var(--muted); }
.banner-go { width: 40px; height: 40px; flex: none; border-radius: 12px; display: grid; place-items: center; background: var(--btn); color: var(--btn-ink); }
.banner-go svg { width: 19px; height: 19px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; }

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

.chips { display: flex; gap: 8px; overflow-x: auto; scrollbar-width: none; margin: 0 -14px 16px; padding: 2px 14px; }
.chips::-webkit-scrollbar { display: none; }
.chip {
  flex: none; display: inline-flex; align-items: center; gap: 8px; height: 42px; padding: 0 16px; border-radius: 12px; cursor: pointer;
  background: var(--surface); border: 1px solid var(--line-2); color: #c5d0e3;
  font: 600 12.5px/1 var(--mono); text-transform: uppercase; letter-spacing: .08em;
}
.chip[aria-pressed="true"] { color: var(--accent); border-color: var(--accent-line); background: var(--accent-soft); }
.section-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin: 2px 2px 12px; }
.section-head h1 { margin: 0; font-size: 22px; font-style: italic; text-transform: uppercase; letter-spacing: .01em; }
.fav-toggle {
  display: inline-flex; align-items: center; gap: 8px; height: 40px; padding: 0 14px; border-radius: 12px; cursor: pointer;
  background: var(--surface); border: 1px solid var(--line-2); color: #c5d0e3;
}
.fav-toggle svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linejoin: round; }
.fav-toggle[aria-pressed="true"] { color: var(--accent); border-color: var(--accent-line); background: var(--accent-soft); }
.fav-toggle[aria-pressed="true"] svg { fill: currentColor; }
.count { margin: 4px 0 0; color: var(--dim); font-size: 11px; }

.grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.card {
  position: relative; display: flex; flex-direction: column; padding: 8px; cursor: pointer;
  background: linear-gradient(180deg, var(--surface), #0c1628); border: 1px solid var(--line); border-radius: var(--r-card);
}
.card .tile { position: relative; aspect-ratio: 3 / 2; border-radius: var(--r-tile); overflow: hidden; display: grid; place-items: center; background: var(--tile); }
.card .tile img { width: 100%; height: 100%; object-fit: cover; }
.card .tile .vial { transform: scale(.82); }
.card.out .tile > :not(.heart) { opacity: .35; }
.heart {
  position: absolute; top: 8px; left: 8px; z-index: 1; width: 36px; height: 36px; border-radius: 50%; cursor: pointer;
  display: grid; place-items: center; background: rgba(10, 18, 34, .72); border: 1px solid var(--line-2); color: #dbe4f3;
}
.heart svg { width: 17px; height: 17px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linejoin: round; }
.heart[aria-pressed="true"] { color: var(--danger); border-color: rgba(255, 95, 109, .45); }
.heart[aria-pressed="true"] svg { fill: currentColor; }
.card .body { display: flex; flex-direction: column; flex: 1; padding: 10px 4px 2px; }
.brand-label { font: 600 11px/1 var(--mono); text-transform: uppercase; letter-spacing: .14em; color: var(--muted); margin-bottom: 7px; }
.pname { font: 700 15.5px/1.22 var(--text); }
.pname .sub { font-weight: 400; color: #c5d0e3; }
.pname .sep { color: var(--dim); margin: 0 4px; font-weight: 400; }
.meta { display: flex; align-items: center; gap: 7px; margin-top: 8px; font-size: 12.5px; color: var(--muted); }
.meta i { width: 8px; height: 8px; border-radius: 3px 3px 2px 2px; background: var(--cap); }
.meta.out { color: var(--danger); }
.buy { margin-top: auto; padding-top: 12px; display: flex; align-items: flex-end; justify-content: space-between; gap: 6px; }
.price { font: 700 18px/1 var(--mono); color: var(--ink); white-space: nowrap; }
.old { display: block; margin-top: 5px; font: 500 12.5px/1 var(--mono); color: var(--dim); text-decoration: line-through; white-space: nowrap; }
.to-cart {
  position: relative; width: 46px; height: 46px; flex: none; border-radius: 13px; cursor: pointer;
  display: grid; place-items: center; color: var(--accent); background: var(--raise); border: 1px solid var(--line-2);
}
.to-cart svg { width: 21px; height: 21px; fill: none; stroke: currentColor; stroke-width: 1.9; stroke-linecap: round; stroke-linejoin: round; }
.to-cart.in { background: var(--btn); color: var(--btn-ink); border-color: var(--btn); box-shadow: var(--glow); }
.to-cart .badge { top: -6px; right: -6px; background: var(--ink); color: var(--bg); }
.to-cart[disabled] { color: var(--dim); cursor: default; }

/* Флакон: рисуется, когда у товара нет фото. Цвет колпачка = цвет категории. */
.vial { position: relative; width: 58px; height: 104px; flex: none; }
.vial .cap { position: absolute; top: 0; left: 13px; width: 32px; height: 15px; border-radius: 6px 6px 2px 2px; background: var(--cap, var(--accent)); }
.vial .crimp { position: absolute; top: 14px; left: 11px; width: 36px; height: 9px; border-radius: 2px; background: linear-gradient(#d7dee1, #8e999d); }
.vial .glass { position: absolute; top: 22px; left: 3px; width: 52px; height: 82px; border-radius: 9px 9px 13px 13px; border: 1.5px solid var(--glass-edge); background: linear-gradient(90deg, var(--glass), transparent 45%, var(--glass)); }
.vial .tag-l { position: absolute; top: 46px; left: 3px; width: 52px; height: 34px; background: var(--label); border-block: 3px solid var(--cap, var(--accent)); }
.vial .tag-l::before, .vial .tag-l::after { content: ""; position: absolute; left: 9px; height: 3px; border-radius: 2px; background: color-mix(in srgb, var(--cap, var(--accent)) 60%, transparent); }
.vial .tag-l::before { top: 8px; width: 34px; }
.vial .tag-l::after { top: 16px; width: 22px; }

/* ---------- окно товара ---------- */

.backdrop { position: fixed; inset: 0; z-index: 20; background: rgba(0, 0, 0, .6); animation: fade .2s ease-out; }
.sheet {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 21; max-width: 560px; margin: 0 auto; max-height: 92dvh;
  display: flex; flex-direction: column; background: #0d1729; border: 1px solid var(--line-2); border-bottom: 0;
  border-radius: 26px 26px 0 0; box-shadow: 0 -20px 50px -20px rgba(0, 0, 0, .7);
  animation: rise .26s cubic-bezier(.2, .8, .2, 1);
}
.sheet.closing { animation: sink .2s ease-in forwards; }
.backdrop.closing { animation: fade .2s ease-in reverse forwards; }
.sheet .grip { width: 40px; height: 5px; border-radius: 3px; background: var(--line-2); margin: 9px auto 0; flex: none; }
.sheet .close { position: absolute; top: 14px; right: 14px; z-index: 2; }
.sheet .scroll { overflow-y: auto; padding: 10px 16px 16px; overscroll-behavior: contain; }
.sheet .tile { position: relative; aspect-ratio: 3 / 2; max-height: 46dvh; margin: 0 auto 16px; border-radius: 18px; overflow: hidden; display: grid; place-items: center; background: var(--tile); }
.sheet .tile img { width: 100%; height: 100%; object-fit: cover; }
.sheet .tile .vial { transform: scale(1.35); }
.sheet .heart { top: 12px; left: 12px; }
.sheet .pname { font-size: 22px; line-height: 1.2; }
.sheet .prices { display: flex; align-items: baseline; gap: 12px; margin: 14px 0 0; }
.sheet .price { font-size: 26px; }
.sheet .old { display: inline; margin: 0; font-size: 15px; }
.sheet .foot { display: flex; gap: 10px; padding: 12px 16px calc(12px + var(--safe-b)); border-top: 1px solid var(--line); }
@keyframes rise { from { transform: translateY(100%); } }
@keyframes sink { to { transform: translateY(100%); } }
@keyframes fade { from { opacity: 0; } }

.stepper { display: flex; align-items: center; justify-content: space-between; height: 52px; min-width: 132px; border-radius: 14px; background: var(--raise); border: 1px solid var(--line-2); }
.stepper button { width: 44px; height: 100%; border: 0; background: transparent; color: var(--accent); cursor: pointer; display: grid; place-items: center; }
.stepper svg { width: 17px; height: 17px; fill: none; stroke: currentColor; stroke-width: 2.4; stroke-linecap: round; }
.stepper output { min-width: 24px; text-align: center; font: 700 16px/1 var(--mono); }
.stepper.small { height: 36px; min-width: 104px; border-radius: 10px; }
.stepper.small button { width: 34px; }

/* ---------- корзина ---------- */

.cart-row { display: grid; grid-template-columns: 60px 1fr auto; gap: 12px; align-items: center; padding: 12px 0; border-bottom: 1px solid var(--line); }
.cart-row:last-child { border-bottom: 0; }
.thumb { position: relative; width: 60px; height: 60px; border-radius: 12px; overflow: hidden; background: var(--tile); }
.thumb img { width: 100%; height: 100%; object-fit: cover; }
.thumb .vial { position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%) scale(.46); }
.cart-row .pname { font-size: 14.5px; }
.cart-row .each { font: 500 12.5px/1.2 var(--mono); color: var(--muted); margin-top: 4px; }
.cart-row .right { display: grid; justify-items: end; gap: 8px; }
.cart-row .right .money { color: var(--accent); }

/* ---------- выбор вариантов ---------- */

.options { display: grid; gap: 8px; }
.option { display: grid; grid-template-columns: 22px 1fr auto; gap: 12px; align-items: start; padding: 14px; border-radius: 14px; cursor: pointer; background: var(--surface); border: 1px solid var(--line-2); }
.option input { appearance: none; width: 20px; height: 20px; margin: 1px 0 0; border-radius: 50%; border: 2px solid var(--line-2); display: grid; place-items: center; }
.option input:checked { border-color: var(--accent); }
.option input:checked::after { content: ""; width: 10px; height: 10px; border-radius: 50%; background: var(--accent); }
.option:has(input:checked) { border-color: var(--accent-line); background: linear-gradient(180deg, rgba(90, 135, 245, .08), var(--surface)); }
.option .t { font-weight: 700; }
.option .d { font-size: 13px; color: var(--muted); margin-top: 2px; }
.option .money { color: var(--accent); }
.notice { padding: 12px 14px; border-radius: 12px; background: rgba(255, 207, 90, .08); border: 1px solid rgba(255, 207, 90, .25); color: #ffe3a0; font-size: 14px; margin: 12px 0 0; }

/* ---------- статусы и заказы ---------- */

.status { display: inline-flex; align-items: center; gap: 7px; height: 26px; padding: 0 10px; border-radius: 999px; font: 600 11.5px/1 var(--mono); text-transform: uppercase; letter-spacing: .06em; color: var(--c); background: color-mix(in srgb, var(--c) 12%, transparent); border: 1px solid color-mix(in srgb, var(--c) 35%, transparent); white-space: nowrap; }
.status::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: var(--c); }
.s-pending, .s-requested, .s-created { --c: var(--warn); }
.s-confirmed { --c: var(--accent); }
.s-shipped { --c: #b3a1ff; }
.s-delivered, .s-paid { --c: var(--ok); }
.s-cancelled, .s-rejected, .s-expired { --c: var(--muted); }

.order-row { display: grid; gap: 10px; color: inherit; }
.order-row .head { display: flex; justify-content: space-between; align-items: center; gap: 10px; }
.order-row .num { font: 700 17px/1 var(--mono); }
.order-row .meta-row { display: flex; justify-content: space-between; color: var(--muted); font-size: 14px; }
.order-row .meta-row .money { color: var(--ink); }
.order-row .need { font-size: 13.5px; font-weight: 700; color: var(--danger); }

.steps { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; margin: 4px 0 18px; }
.steps div { font-size: 12px; color: var(--dim); }
.steps div::before { content: ""; display: block; height: 4px; border-radius: 2px; background: var(--line-2); margin-bottom: 7px; }
.steps .done { color: var(--ink); font-weight: 600; }
.steps .done::before { background: var(--accent); }

.offer { border-color: rgba(255, 95, 109, .4); background: linear-gradient(180deg, rgba(255, 95, 109, .06), var(--surface)); }
.offer p { margin: 0 0 12px; }
.item-row { display: flex; justify-content: space-between; gap: 12px; padding: 9px 0; }
.item-row + .item-row { border-top: 1px solid var(--line); }
.item-row .was { font-size: 13px; color: var(--muted); }
.item-row.removed .t { text-decoration: line-through; color: var(--muted); }
.track { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.track .code { font-size: 16px; }

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

.wallet { padding: 20px 18px; background: radial-gradient(90% 120% at 100% 0%, rgba(80, 125, 235, .2), transparent 60%), var(--surface); }
.wallet .amount { font: 700 38px/1 var(--mono); color: var(--ink); margin-top: 8px; }
.quick { display: flex; flex-wrap: wrap; gap: 8px; margin: -2px 0 14px; }
.quick button { height: 36px; padding: 0 12px; border-radius: 10px; border: 1px solid var(--line-2); background: var(--surface); cursor: pointer; font: 600 13px/1 var(--mono); color: #c5d0e3; }
.pay-now { font: 700 30px/1.1 var(--mono); color: var(--accent); margin: 6px 0 2px; cursor: copy; }
.file-pick { position: relative; display: flex; align-items: center; gap: 10px; padding: 14px; border-radius: 14px; border: 1.5px dashed var(--line-2); background: var(--surface); cursor: pointer; margin-bottom: 12px; color: #c5d0e3; }
.file-pick input { position: absolute; inset: 0; opacity: 0; cursor: pointer; }
.file-pick svg { width: 22px; height: 22px; fill: none; stroke: var(--accent); stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; flex: none; }
.history-row { display: flex; justify-content: space-between; align-items: center; gap: 10px; padding: 12px 0; color: inherit; }
.history-row + .history-row { border-top: 1px solid var(--line); }
.history-row .money { color: var(--ink); }

.howto { list-style: none; margin: 0; padding: 0; counter-reset: step; display: grid; gap: 10px; }
.howto > li { counter-increment: step; position: relative; padding: 15px 16px 15px 56px; background: var(--surface); border: 1px solid var(--line); border-radius: 18px; }
.howto > li::before {
  content: counter(step); position: absolute; left: 14px; top: 13px; width: 28px; height: 28px; border-radius: 50%;
  display: grid; place-items: center; font: 700 13px/1 var(--mono); color: var(--accent); background: var(--accent-soft); border: 1px solid var(--accent-line);
}
.howto .t { font-weight: 700; margin-bottom: 10px; }
.copy-box { display: flex; align-items: center; gap: 10px; padding: 10px 10px 10px 12px; border-radius: 12px; background: var(--tile); border: 1px solid var(--line-2); }
.copy-box .v { flex: 1; min-width: 0; font: 500 13.5px/1.35 var(--mono); overflow-wrap: anywhere; }
.copy-box .v.big { font: 700 24px/1.1 var(--mono); color: var(--accent); overflow-wrap: normal; }
.copy-box .btn { flex: none; }
.net { display: inline-flex; align-items: center; gap: 6px; margin-bottom: 10px; padding: 0 9px; height: 24px; border-radius: 999px; font: 600 11px/1 var(--mono); letter-spacing: .06em; color: #4fe0b0; background: rgba(38, 161, 123, .14); border: 1px solid rgba(79, 224, 176, .3); }
.timer { font: 600 14px/1 var(--mono); color: var(--warn); }
.live { display: inline-flex; align-items: center; gap: 9px; color: var(--muted); font-size: 14px; }
.live::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: var(--ok); animation: pulse 1.6s ease-in-out infinite; flex: none; }
@keyframes pulse { 50% { opacity: .25; } }
.qr { display: grid; place-items: center; padding: 16px; background: #fff; border-radius: 18px; }
.qr img { width: min(260px, 100%); }
.waiting { display: grid; justify-items: center; gap: 12px; text-align: center; padding: 30px 18px; }
.waiting .vial { animation: tilt 2.4s ease-in-out infinite; transform-origin: 50% 90%; }
@keyframes tilt { 25% { transform: rotate(-6deg); } 75% { transform: rotate(6deg); } }

/* ---------- чат ---------- */

.chat { display: flex; flex-direction: column; gap: 8px; padding-bottom: 8px; }
.msg { max-width: 82%; padding: 10px 13px; border-radius: 16px; white-space: pre-wrap; overflow-wrap: anywhere; }
.msg time { display: block; font: 500 10.5px/1 var(--mono); opacity: .6; margin-top: 5px; text-align: right; }
.msg.in { align-self: flex-end; background: var(--btn); color: var(--btn-ink); border-bottom-right-radius: 5px; }
.msg.out { align-self: flex-start; background: var(--surface); border: 1px solid var(--line-2); border-bottom-left-radius: 5px; }
.composer { display: flex; gap: 8px; align-items: flex-end; }
.composer textarea { min-height: 48px; max-height: 120px; padding: 13px 14px; }
.composer .send { width: 48px; height: 48px; flex: none; border-radius: 14px; border: 0; background: var(--btn); color: var(--btn-ink); display: grid; place-items: center; cursor: pointer; box-shadow: var(--glow); }
.composer .send svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 2.2; stroke-linecap: round; stroke-linejoin: round; }

/* ---------- уведомление и загрузка ---------- */

/* Подсказка сверху: снизу её закрывала бы кнопка действия. */
.toast {
  position: fixed; left: 50%; transform: translateX(-50%); top: calc(12px + var(--tg-content-safe-area-inset-top, 0px) + env(safe-area-inset-top, 0px)); z-index: 30;
  max-width: calc(100% - 32px); padding: 11px 16px; border-radius: 12px; font-size: 14px; font-weight: 600;
  background: var(--raise); color: var(--ink); border: 1px solid var(--accent-line); box-shadow: 0 12px 30px -16px rgba(0, 0, 0, .8);
  animation: toast-in .18s ease-out;
}
.toast.error { border-color: rgba(255, 95, 109, .5); color: #ffc2c8; box-shadow: none; }
@keyframes toast-in { from { opacity: 0; transform: translate(-50%, -6px); } }
.skeleton { height: 250px; border-radius: var(--r-card); background: linear-gradient(180deg, var(--surface), #0c1628); border: 1px solid var(--line); }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}
@media (min-width: 520px) { .grid { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
@media (max-width: 360px) {
  .balance-pill { display: none; }
}

/* ---------- вход через Telegram ---------- */

.login { display: grid; justify-items: center; gap: 14px; text-align: center; padding: 34px 18px 26px; }
.login .tg { width: 64px; height: 64px; border-radius: 20px; display: grid; place-items: center; background: linear-gradient(145deg, #2f8fe0, #1f6fc4); }
.login .tg svg { width: 32px; height: 32px; fill: #fff; }
.login h1 { margin: 6px 0 0; }
.login p { margin: 0; color: var(--muted); max-width: 34ch; }
.login .btn { max-width: 340px; }
.login .live { justify-content: center; }
.tg-btn svg { width: 18px; height: 18px; fill: currentColor; }
.logout { margin-top: 18px; }

/* ---------- навигация в шапке: на широком экране вместо нижних вкладок ---------- */

.topnav { display: none; }
.topnav a { padding: 10px 12px; border-radius: 10px; color: var(--muted); font-weight: 600; font-size: 15px; white-space: nowrap; }
.topnav a[aria-current="page"] { color: var(--ink); background: var(--raise); }

@media (min-width: 900px) {
  #app { max-width: 1160px; }
  #view { padding: 8px 24px 120px; }
  #view[data-narrow] { max-width: 760px; margin: 0 auto; }
  .top { padding: 14px 18px 8px; }
  .top::before { inset: 10px 14px 0; }
  .bar { gap: 10px; padding: 8px 10px 8px 12px; }
  .brand { flex: 0 0 auto; margin-right: 12px; }
  .topnav { display: flex; gap: 4px; flex: 1; }
  .search { margin: 2px 10px 10px; }
  .grid { grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; }
  .chips { margin: 0 0 18px; padding: 2px 0; flex-wrap: wrap; overflow: visible; }
  .banner { padding: 18px 20px; }
  .banner-title { font-size: 18px; }
  /* Нижние вкладки не нужны: та же навигация в шапке. Остаётся только кнопка действия. */
  .dock { background: transparent; border: 0; backdrop-filter: none; max-width: 560px; bottom: 18px; pointer-events: none; }
  .dock .tabs { display: none; }
  .action { pointer-events: auto; padding: 0 14px; }
  .action .btn { box-shadow: 0 16px 40px -14px rgba(0, 0, 0, .9); }
  .sheet { top: 50%; bottom: auto; transform: translateY(-50%); max-height: 88dvh; border-radius: 26px; border-bottom: 1px solid var(--line-2); animation: pop .2s ease-out; }
  .sheet.closing { animation: fade .16s ease-in reverse forwards; }
  .sheet .grip { display: none; }
  .sheet .foot { padding-bottom: 14px; border-radius: 0 0 26px 26px; }
}
@keyframes pop { from { opacity: 0; transform: translateY(-48%); } }
@media (min-width: 1200px) { .grid { grid-template-columns: repeat(5, minmax(0, 1fr)); } }

/* На телефоне «Мои заказы» есть во вкладках снизу: в шапке место под логотип. */
@media (max-width: 519px) { .orders-btn { display: none; } }

/* Похожие товары в окне товара. */
.similar { margin-top: 20px; }
.similar-row { display: flex; gap: 10px; overflow-x: auto; scrollbar-width: none; margin: 10px -16px 0; padding: 0 16px 4px; }
.similar-row::-webkit-scrollbar { display: none; }
.mini { flex: none; width: 132px; display: grid; gap: 6px; color: inherit; }
.mini .thumb { width: 132px; height: 88px; border-radius: 12px; }
.mini .thumb .vial { transform: translate(-50%, -50%) scale(.6); }
.mini .pname { font-size: 13.5px; }
.mini .price { font-size: 14px; }
