:root {
  --font: 'Jost', system-ui, -apple-system, sans-serif;
  --display: 'Cormorant Garamond', Georgia, 'Times New Roman', serif;
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
}
/* Тёмная тема — логотип Classico: тёмный шоколад и золото */
[data-theme="dark"] {
  --accent: #C9A35E; --on-accent: #2A1912;
  --bg: #24150F; --surface: #2F1D16; --surface2: #3B261D; --dock: #2C1B14;
  --text: #F3E6D3; --muted: #C4AF9A; --line: #48322A; --danger: #FF8A80; --ok: #B9D68A; --key: #2F1D16;
  color-scheme: dark;
}
/* Светлая тема — логотип Moderno: сливочный фон и бронза */
[data-theme="light"] {
  --accent: #8A6A2E; --on-accent: #FFFFFF;
  --bg: #F4ECE1; --surface: #FBF7F1; --surface2: #EADFCF; --dock: #FBF7F1;
  --text: #2A1912; --muted: #6B5A4C; --line: #E0D3C1; --danger: #B3261E; --ok: #3F6B1F; --key: #FBF7F1;
  color-scheme: light;
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; background: var(--bg); color: var(--text); font-family: var(--font); -webkit-tap-highlight-color: transparent; }
button, input, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
img { display: block; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

.app { max-width: 480px; margin: 0 auto; min-height: 100%; position: relative; display: flex; flex-direction: column; }
.screen { flex: 1; display: flex; flex-direction: column; min-height: 100vh; min-height: 100dvh; }
.scroll { flex: 1; padding: calc(28px + var(--safe-top)) 20px calc(124px + var(--safe-bottom)); }
.h1 { margin: 0; font-family: var(--display); font-weight: 600; font-size: 34px; line-height: 1.1; }
.label { margin: 24px 0 10px; font-size: 13px; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); }
.muted { color: var(--muted); }
.card { border-radius: 24px; background: var(--surface); border: 1px solid var(--line); overflow: hidden; }
.badge { padding: 4px 9px; border-radius: 10px; border: 1px solid var(--line); font-size: 11px; font-weight: 700; letter-spacing: .06em; color: var(--muted); }
.logo { width: 38px; height: 38px; border-radius: 13px; background: var(--accent); color: var(--on-accent); display: grid; place-items: center; flex: none; }
.logo svg { display: block; }
.wordmark { font-family: var(--display); font-style: italic; font-weight: 600; font-size: 24px; letter-spacing: .01em; }

.btn { height: 54px; padding: 0 24px; border-radius: 27px; border: 0; font-weight: 700; font-size: 16px; display: inline-flex; align-items: center; justify-content: center; gap: 10px; }
.btn-accent { background: var(--accent); color: var(--on-accent); }
.btn-ghost { background: var(--surface); border: 1px solid var(--line); color: var(--text); font-weight: 600; }
.btn-sm { height: 40px; padding: 0 16px; border-radius: 20px; font-size: 14px; }
.btn:disabled { opacity: .55; cursor: default; }
.icon-btn { width: 44px; height: 44px; flex: none; border-radius: 22px; border: 1px solid var(--line); background: var(--surface); color: var(--text); display: grid; place-items: center; }

.topbar { display: flex; align-items: center; gap: 12px; padding: calc(24px + var(--safe-top)) 20px 8px; }
.topbar .title { flex: 1; font-family: var(--display); font-weight: 600; font-size: 24px; }
.bottombar { position: sticky; bottom: 0; padding: 14px 20px calc(20px + var(--safe-bottom)); border-top: 1px solid var(--line); background: var(--bg); display: flex; align-items: center; gap: 14px; }
.body { flex: 1; padding: 8px 20px 24px; }

/* ---------- PIN ---------- */
.pin { flex: 1; display: flex; flex-direction: column; align-items: center; padding: calc(72px + var(--safe-top)) 32px calc(40px + var(--safe-bottom)); text-align: center; }
.pin .logo { width: 72px; height: 72px; border-radius: 24px; }
.pin h1 { margin: 28px 0 0; font-family: var(--display); font-weight: 600; font-size: 30px; }
.pin p { margin: 10px 0 0; font-size: 15px; line-height: 1.45; color: var(--muted); max-width: 280px; }
.dots { display: flex; gap: 18px; margin-top: 36px; }
.dot { width: 16px; height: 16px; border-radius: 8px; border: 2px solid var(--muted); transition: all .15s; }
.dot.on { background: var(--accent); border-color: var(--accent); }
.dots.err .dot { border-color: var(--danger); }
.dots.err { animation: shake .35s; }
@keyframes shake { 25% { transform: translateX(-8px); } 75% { transform: translateX(8px); } }
.pin-err { height: 22px; margin-top: 16px; font-size: 14px; font-weight: 500; color: var(--danger); }
.keypad { margin-top: auto; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px 28px; width: 276px; }
.key { height: 72px; border-radius: 36px; border: 0; background: var(--key); font-size: 28px; font-weight: 500; display: grid; place-items: center; }
.key.ghost { background: transparent; }
.link-btn { margin-top: 18px; border: 0; background: none; color: var(--muted); font-size: 14px; text-decoration: underline; text-underline-offset: 3px; min-height: 44px; }

/* ---------- Лаунчер ---------- */
.home-head { display: flex; align-items: center; justify-content: space-between; }
.brand { display: flex; align-items: center; gap: 12px; }
.hero { margin-top: 20px; padding: 22px 22px 20px; border-radius: 28px; background: var(--accent); color: var(--on-accent); }
.hero b { display: block; font-family: var(--display); font-style: italic; font-weight: 600; font-size: 31px; line-height: 1.1; }
.hero span { display: block; margin-top: 10px; font-size: 14px; line-height: 1.4; font-weight: 500; }
.search { margin-top: 18px; height: 48px; border-radius: 24px; background: var(--surface); border: 1px solid var(--line); display: flex; align-items: center; gap: 10px; padding: 0 16px; color: var(--muted); }
.search input { flex: 1; min-width: 0; border: 0; outline: 0; background: transparent; color: var(--text); font-size: 15px; }
.chips { display: flex; gap: 8px; overflow-x: auto; margin: 16px -20px 0; padding: 0 20px 4px; scrollbar-width: none; }
.chips::-webkit-scrollbar { display: none; }
.chip { flex: none; height: 38px; padding: 0 16px; border-radius: 19px; font-size: 14px; font-weight: 600; border: 1px solid var(--line); background: var(--surface); }
.chip[aria-pressed="true"] { background: var(--accent); border-color: var(--accent); color: var(--on-accent); }
.grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 22px 8px; margin: 22px 0 0; }
.tile { border: 0; background: transparent; padding: 0; display: flex; flex-direction: column; align-items: center; gap: 8px; }
.tile .tile-name { font-family: var(--display); font-style: italic; font-size: 19px; line-height: 1.2; font-weight: 600; text-align: center; }
.empty-grid { grid-column: 1 / -1; text-align: center; color: var(--muted); padding: 24px 0; }

/* Иконка товара: монограмма или фавикон, всегда сквиркл */
.ic { --size: 62px; width: var(--size); height: var(--size); border-radius: calc(var(--size) * .34); flex: none; display: grid; place-items: center; overflow: hidden;
  background: var(--c, #44464F); color: #fff; font-family: var(--display); font-weight: 600; letter-spacing: -.02em; font-size: calc(var(--size) * .29); }
.ic.img { background: #fff; border: 1px solid rgba(0,0,0,.08); }
.ic.img img { width: 68%; height: 68%; object-fit: contain; }
.ic.brand-ic { background: transparent; border-radius: calc(var(--size) * .23); box-shadow: 0 0 0 1px var(--line), 0 6px 18px rgba(42,25,18,.18); }
.ic.brand-ic img { width: 100%; height: 100%; }
.ic-lg { --size: 92px; }
.ic-xl { --size: 104px; }
.ic-md { --size: 64px; }
.ic-sm { --size: 44px; }

/* ---------- Товар ---------- */
.product-hero { display: flex; flex-direction: column; align-items: center; padding: 12px 0 8px; text-align: center; }
.box-hero { margin-top: 4px; padding: 26px 20px 22px; border-radius: 28px; background: var(--bx); color: var(--bf); box-shadow: 0 0 0 1px var(--line); }
.box-hero .eyebrow { color: var(--bf); font-weight: 600; }
.box-hero .tag { background: color-mix(in srgb, var(--bf) 16%, transparent); color: var(--bf); }
.box-hero .ic.brand-ic { box-shadow: 0 0 0 1px color-mix(in srgb, var(--bf) 35%, transparent), 0 8px 22px rgba(0,0,0,.25); }
.product-hero .eyebrow { margin-top: 18px; font-size: 12px; font-weight: 500; letter-spacing: .3em; text-transform: uppercase; color: var(--muted); }
.product-hero h1 { margin: 4px 0 0; font-family: var(--display); font-style: italic; font-weight: 600; font-size: 40px; line-height: 1.1; }
.tags { margin-top: 10px; display: flex; gap: 6px; flex-wrap: wrap; justify-content: center; }
.tag { padding: 6px 12px; border-radius: 14px; background: var(--surface2); font-size: 13px; font-weight: 500; }
.plans { display: flex; flex-direction: column; gap: 8px; }
.plan { width: 100%; min-height: 58px; display: flex; align-items: center; gap: 14px; padding: 0 16px; border-radius: 20px; background: var(--surface); border: 1px solid var(--line); text-align: left; }
.plan[aria-pressed="true"] { border: 2px solid var(--text); padding: 0 15px; }
.radio { width: 22px; height: 22px; border-radius: 11px; border: 2px solid var(--muted); display: grid; place-items: center; flex: none; }
.plan[aria-pressed="true"] .radio { border-color: var(--accent); background: var(--accent); }
.plan[aria-pressed="true"] .radio::after { content: ''; width: 8px; height: 8px; border-radius: 4px; background: var(--on-accent); }
.plan .pl { flex: 1; font-size: 16px; font-weight: 500; }
.plan .pr { font-size: 15px; font-weight: 600; color: var(--muted); }
.desc { margin: 0; font-size: 15px; line-height: 1.55; white-space: pre-line; }
.rows > div { display: flex; justify-content: space-between; gap: 12px; padding: 14px 16px; font-size: 14px; }
.rows > div + div { border-top: 1px solid var(--line); }
.price-now { flex: 1; }
.price-now small { display: block; font-size: 12px; color: var(--muted); }
.price-now b { font-size: 20px; }

/* ---------- Списки, настройки ---------- */
.row { width: 100%; min-height: 56px; display: flex; align-items: center; gap: 12px; padding: 10px 16px; border: 0; background: transparent; font-size: 16px; text-align: left; }
.row + .row { border-top: 1px solid var(--line); }
.row .grow { flex: 1; min-width: 0; }
.row small { display: block; margin-top: 2px; font-size: 13px; color: var(--muted); }
.seg { padding: 6px; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 6px; }
.seg button { height: 48px; border-radius: 18px; border: 0; background: transparent; font-size: 15px; font-weight: 600; display: flex; align-items: center; justify-content: center; gap: 8px; }
.seg button[aria-pressed="true"] { background: var(--accent); color: var(--on-accent); }
.switch { width: 48px; height: 28px; border-radius: 14px; padding: 3px; background: var(--line); display: flex; flex: none; }
.switch::after { content: ''; width: 22px; height: 22px; border-radius: 11px; background: var(--muted); }
[aria-pressed="true"] > .switch { background: var(--accent); justify-content: flex-end; }
[aria-pressed="true"] > .switch::after { background: var(--on-accent); }

.profile { margin-top: 22px; padding: 20px; display: flex; flex-direction: column; align-items: center; text-align: center; border-radius: 28px; }
.avatar { width: 76px; height: 76px; border-radius: 38px; background: var(--surface2); color: var(--muted); display: grid; place-items: center; font-family: var(--display); font-size: 26px; }
.role { margin-top: 8px; padding: 5px 12px; border-radius: 12px; background: var(--accent); color: var(--on-accent); font-size: 12px; font-weight: 700; }
.empty { padding: 28px 20px; border-radius: 24px; border: 1px dashed var(--line); display: flex; flex-direction: column; align-items: center; gap: 8px; text-align: center; }
.status { font-size: 12px; font-weight: 700; padding: 4px 10px; border-radius: 10px; background: var(--surface2); white-space: nowrap; }
.status.paid { background: var(--accent); color: var(--on-accent); }
.status.failed { color: var(--danger); }

/* ---------- Редактор ---------- */
.field { width: 100%; height: 50px; padding: 0 16px; border-radius: 18px; border: 1px solid var(--line); background: var(--surface); color: var(--text); font-size: 16px; outline: 0; }
.field:focus { border-color: var(--text); }
textarea.field.field-short { min-height: 84px; }
.field:disabled { opacity: .7; }
.stock-note { margin-top: 14px; padding: 14px 16px; border-radius: 20px; background: var(--surface2); display: flex; flex-direction: column; align-items: flex-start; gap: 4px; font-size: 14px; line-height: 1.45; }
.stock-note b { font-size: 15px; }
.stock-note.low b { color: var(--accent); }
.stock-note.pickup { background: color-mix(in srgb, var(--ok) 14%, var(--surface)); border: 1px solid color-mix(in srgb, var(--ok) 40%, transparent); }
.stock-note.pickup b { color: var(--ok); font-size: 17px; }
.stores { margin: 8px 0 0; padding-left: 18px; font-size: 14px; }
.stores li + li { margin-top: 4px; }
.tile-tag { margin-top: -4px; padding: 3px 9px; border-radius: 10px; font-size: 11px; font-weight: 600; letter-spacing: .02em; background: var(--surface2); color: var(--muted); }
.tile-tag.in { background: color-mix(in srgb, var(--ok) 16%, transparent); color: var(--ok); }
.pickup-code { margin-top: 10px; padding: 12px 14px; border-radius: 16px; background: var(--accent); color: var(--on-accent); display: flex; flex-direction: column; align-items: flex-start; gap: 2px; }
.row .pickup-code small { margin: 0; color: inherit; opacity: .85; font-size: 12px; }
.pickup-code b { font-size: 30px; letter-spacing: .12em; font-variant-numeric: tabular-nums; }
.stock-note.out { background: color-mix(in srgb, var(--danger) 14%, var(--surface)); border: 1px solid color-mix(in srgb, var(--danger) 45%, transparent); }
.stock-note.out b { color: var(--danger); font-size: 17px; }
.stock-note .btn { margin-top: 8px; }
.stepper { display: flex; align-items: center; justify-content: space-between; padding: 8px; }
.stepper b { font-size: 20px; }
.stepper .icon-btn { font-size: 22px; }
.stepper .icon-btn:disabled { opacity: .4; cursor: default; }
.row-side { display: flex; flex-direction: column; align-items: flex-end; gap: 8px; }
.row small.dlv { margin-top: 6px; line-height: 1.45; color: var(--text); }
textarea.field { height: auto; min-height: 140px; padding: 14px 16px; line-height: 1.5; resize: vertical; }
.url-row { display: flex; gap: 8px; }
.url-row .field { flex: 1; min-width: 0; }
.icon-msg { margin-top: 10px; display: flex; align-items: center; gap: 10px; min-height: 36px; font-size: 14px; line-height: 1.4; }
.icon-msg .grow { flex: 1; }
.icon-msg.ok .grow { color: var(--ok); }
.icon-msg.err .grow { color: var(--danger); }
.price-row { display: flex; align-items: center; gap: 10px; padding: 10px 12px 10px 16px; }
.price-row + .price-row { border-top: 1px solid var(--line); }
.price-row label { flex: 1; font-size: 15px; font-weight: 500; }
.price-row input { width: 100px; height: 40px; padding: 0 12px; border-radius: 14px; border: 1px solid var(--line); background: var(--bg); text-align: right; outline: 0; }
.price-row span { width: 40px; font-size: 13px; font-weight: 600; color: var(--muted); }
.preview { display: flex; align-items: center; gap: 14px; padding: 14px; }
.two { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; width: 100%; }

/* ---------- Док и уведомления ---------- */
.dock { position: fixed; left: 50%; bottom: calc(20px + var(--safe-bottom)); transform: translateX(-50%); padding: 8px; border-radius: 34px; background: var(--dock); border: 1px solid var(--line); display: flex; gap: 6px; box-shadow: 0 10px 30px rgba(0,0,0,.18); z-index: 5; }
.dock button { width: 64px; height: 52px; border-radius: 26px; border: 0; background: transparent; color: var(--muted); display: grid; place-items: center; }
.dock button[aria-current="page"] { background: var(--accent); color: var(--on-accent); }
.toast { position: fixed; left: 50%; transform: translateX(-50%); top: calc(16px + var(--safe-top)); width: calc(100% - 40px); max-width: 440px; padding: 14px 16px; border-radius: 18px; background: var(--text); color: var(--bg); font-size: 14px; font-weight: 500; line-height: 1.4; z-index: 10; box-shadow: 0 10px 30px rgba(0,0,0,.25); }
.spinner { width: 28px; height: 28px; border-radius: 50%; border: 3px solid var(--line); border-top-color: var(--accent); animation: spin .8s linear infinite; margin: auto; }
@keyframes spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { * { animation: none !important; transition: none !important; } }

/* ---------- Оплата: ожидание реквизитов, реквизиты, проверка ---------- */
.pay-screen .body.wait { display: flex; flex-direction: column; align-items: center; text-align: center; gap: 14px; padding-top: 24px; }
.moon-loader { position: relative; width: 168px; height: 168px; margin: 8px 0 6px; display: grid; place-items: center; }
.moon-loader::before { content: ''; position: absolute; inset: 10px; border-radius: 50%; border: 1px dashed color-mix(in srgb, var(--accent) 45%, transparent); }
.moon-loader::after { content: ''; position: absolute; inset: 34px; border-radius: 50%; background: radial-gradient(circle, color-mix(in srgb, var(--accent) 22%, transparent) 0%, transparent 70%); animation: glow 2.8s ease-in-out infinite; }
.moon-loader .moon { position: relative; z-index: 1; width: 84px; height: 84px; color: var(--accent); animation: breathe 2.8s ease-in-out infinite; }
.moon-loader .orbit { position: absolute; inset: 10px; animation: spin 6s linear infinite; }
.moon-loader .orbit i { position: absolute; width: 12px; height: 12px; border-radius: 50%; background: var(--accent); top: -6px; left: calc(50% - 6px); box-shadow: 0 0 0 3px var(--bg); }
.moon-loader .orbit i:nth-child(2) { transform: rotate(120deg); transform-origin: 6px 80px; opacity: .7; width: 9px; height: 9px; }
.moon-loader .orbit i:nth-child(3) { transform: rotate(240deg); transform-origin: 6px 80px; opacity: .45; width: 7px; height: 7px; }
@keyframes breathe { 50% { transform: scale(1.06) rotate(-4deg); } }
@keyframes glow { 50% { opacity: .35; transform: scale(1.15); } }
.wait-title { margin: 0; font-family: var(--display); font-style: italic; font-weight: 600; font-size: 32px; line-height: 1.15; text-wrap: balance; }
.dots-anim i { font-style: normal; animation: blink 1.4s infinite; }
.dots-anim i:nth-child(2) { animation-delay: .2s; }
.dots-anim i:nth-child(3) { animation-delay: .4s; }
@keyframes blink { 0%, 100% { opacity: .15; } 40% { opacity: 1; } }
.wait-text { margin: 0; max-width: 320px; font-size: 15px; line-height: 1.5; color: var(--muted); }
.pay-sum { width: 100%; display: flex; justify-content: space-between; align-items: baseline; gap: 12px; padding: 14px 16px; border-radius: 18px; background: var(--surface); border: 1px solid var(--line); font-size: 14px; text-align: left; }
.pay-sum b { font-size: 18px; white-space: nowrap; font-variant-numeric: tabular-nums; }
.steps { list-style: none; margin: 6px 0 0; padding: 0; width: 100%; display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 6px; font-size: 11px; font-weight: 500; color: var(--muted); text-align: center; }
.steps li { display: flex; flex-direction: column; align-items: center; gap: 6px; }
.steps li span { width: 100%; height: 4px; border-radius: 2px; background: var(--line); }
.steps li.done span { background: var(--accent); }
.steps li.now span { background: linear-gradient(90deg, var(--accent) 0 40%, var(--line) 40%); background-size: 250% 100%; animation: progress 1.6s ease-in-out infinite alternate; }
.steps li.done, .steps li.now { color: var(--text); }
@keyframes progress { to { background-position: -100% 0; } }
.pay-screen .steps + .pay-card { margin-top: 18px; }
.pay-card { padding: 18px; border-radius: 24px; background: var(--accent); color: var(--on-accent); display: flex; flex-direction: column; gap: 14px; }
.pay-card small { font-size: 12px; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; opacity: .8; }
.pay-amount { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.pay-amount b { font-size: 36px; font-variant-numeric: tabular-nums; line-height: 1; }
.pay-line { display: grid; grid-template-columns: 1fr auto; gap: 2px 12px; align-items: center; padding-top: 12px; border-top: 1px solid color-mix(in srgb, var(--on-accent) 22%, transparent); }
.pay-line small { grid-column: 1 / -1; }
.pay-line p { margin: 0; font-size: 16px; font-weight: 600; line-height: 1.4; white-space: pre-line; overflow-wrap: anywhere; }
.copy { min-height: 36px; padding: 0 12px; border-radius: 12px; border: 1px solid color-mix(in srgb, var(--on-accent) 40%, transparent); background: transparent; color: inherit; font-size: 13px; font-weight: 600; }
.pay-hint { margin: 14px 2px; font-size: 13px; line-height: 1.5; }
.done-mark { width: 88px; height: 88px; border-radius: 28px; background: var(--accent); color: var(--on-accent); padding: 10px; box-sizing: border-box; }
.pickup-code.big { width: 100%; align-items: center; padding: 18px; }
.pickup-code.big b { font-size: 40px; }
.status.wait { background: color-mix(in srgb, var(--accent) 22%, transparent); color: var(--text); }
.card.todo { border-color: color-mix(in srgb, var(--accent) 55%, transparent); }
.recent-row { margin: 0 -20px 10px; }
.chip.recent { font-weight: 500; font-size: 13px; }

/* ---------- Данные плательщика ---------- */
.payer-intro { display: flex; align-items: center; gap: 14px; padding: 14px 16px; border-radius: 20px; background: var(--surface2); }
.payer-intro p { margin: 0; font-size: 14px; line-height: 1.45; }
.payer-mark { width: 52px; height: 52px; flex: none; border-radius: 16px; background: var(--accent); color: var(--on-accent); padding: 6px; box-sizing: border-box; }
.card-no { font-variant-numeric: tabular-nums; letter-spacing: .04em; }
a.btn { text-decoration: none; }
