/* Компоненты дизайн-системы — общие для веба и Telegram Mini App. Мобильная раскладка первична. */
*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font: 16px/1.45 var(--font);
  -webkit-font-smoothing: antialiased;
}
a { color: inherit; }
button { font: inherit; color: inherit; }

.app { max-width: var(--maxw); margin: 0 auto; min-height: 100vh; }
.screen { padding: 16px var(--pad) 40px; display: flex; flex-direction: column; gap: 16px; }

/* ── Типографика ── */
.brand { font-size: 22px; font-weight: var(--w-heavy); letter-spacing: -0.02em; }
.brand::after { content: "."; color: var(--lime-text); }
.title-xl { font-size: 40px; line-height: 1.04; font-weight: var(--w-heavy); letter-spacing: -0.03em; margin: 8px 0 0; }
.title-lg { font-size: 32px; line-height: 1.06; font-weight: var(--w-heavy); letter-spacing: -0.025em; margin: 4px 0 0; }
.title-md { font-size: 20px; font-weight: var(--w-heavy); margin: 8px 0 0; }
.label { font-size: 14px; font-weight: var(--w-semi); color: var(--ink-2); margin: 0; }
.muted { color: var(--muted); margin: 0; }
.small { font-size: 13px; }
.center { text-align: center; }
.error { color: var(--danger); font-size: 14px; margin: 0; }
.notice { background: var(--card); border-radius: var(--r-md); padding: 12px 16px; font-weight: var(--w-semi); margin: 0; }

/* ── Шапка ── */
.topbar { display: flex; align-items: center; justify-content: space-between; min-height: 56px; gap: 12px; }
.topbar-title { font-weight: var(--w-semi); font-size: 17px; }
.icon-btn {
  width: 52px; height: 52px; border-radius: 50%; background: var(--card); border: 0;
  display: inline-grid; place-items: center; font-size: 28px; line-height: 1; text-decoration: none; cursor: pointer;
}
.icon-btn--ghost { background: transparent; cursor: default; }

/* ── Кнопки и пилюли ── */
.btn {
  display: flex; align-items: center; justify-content: center; width: 100%; min-height: 60px;
  border-radius: var(--r-lg); border: 0; font-size: 18px; font-weight: var(--w-bold);
  text-decoration: none; cursor: pointer; padding: 0 20px; text-align: center;
}
.btn:disabled { opacity: 0.5; cursor: default; }
.btn-primary { background: var(--ink); color: #fff; }
.btn-lime { background: var(--lime); color: var(--lime-ink); }
.btn-secondary { background: var(--card); color: var(--ink); }
.btn-outline { background: transparent; color: var(--ink); border: 1.5px solid var(--ink); }
.btn-ghost { background: transparent; color: var(--muted); min-height: 48px; font-weight: var(--w-semi); }
.pill {
  display: inline-flex; align-items: center; gap: 8px; border-radius: var(--r-pill); border: 0;
  padding: 11px 20px; font-size: 16px; font-weight: var(--w-semi); cursor: pointer; text-decoration: none;
}
.pill--dark { background: var(--ink); color: #fff; }
.pill--soft { background: var(--card); color: var(--ink); }
:focus-visible { outline: 3px solid var(--ink); outline-offset: 2px; }

/* ── Карточки и формы ── */
.card { background: var(--card); border-radius: var(--r-xl); padding: 20px; }
.stack { display: flex; flex-direction: column; gap: var(--gap); }
.input {
  width: 100%; height: 56px; border-radius: var(--r-md); border: 1px solid var(--line); background: var(--paper);
  padding: 0 16px; font-size: 18px; color: var(--ink);
}
.input:focus { outline: 2px solid var(--ink); outline-offset: 0; border-color: transparent; }
.input--code { letter-spacing: 0.4em; font-size: 24px; text-align: center; font-weight: var(--w-bold); }
.input[readonly] { color: var(--muted); }

/* ── Главная ── */
.balance { text-align: center; display: flex; flex-direction: column; align-items: center; gap: 10px; padding: 28px 0 12px; }
.balance-value { font-size: 44px; font-weight: var(--w-heavy); letter-spacing: -0.03em; }
.tiles { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.tile {
  background: var(--card); border-radius: var(--r-xl); padding: 18px; min-height: 96px; text-decoration: none;
  display: flex; align-items: center; justify-content: space-between; gap: 10px; position: relative;
}
.tile--big { min-height: 168px; flex-direction: column-reverse; align-items: flex-start; }
.tile--big .tile-ico { align-self: flex-end; }
.tile--lime { background: var(--lime); color: var(--lime-ink); }
.tile--off { opacity: 0.55; }
.tile-text { font-size: 18px; font-weight: var(--w-semi); line-height: 1.2; }
.tile--big .tile-text { font-size: 24px; font-weight: var(--w-heavy); }
.tile-ico { width: 48px; height: 48px; border-radius: 50%; background: var(--soft); display: grid; place-items: center; font-size: 22px; flex: none; }
.tile--lime .tile-ico { background: var(--card); }
.tile-soon { position: absolute; top: 14px; left: 18px; font-size: 12px; font-weight: var(--w-semi); color: var(--muted); }

/* ── Списки операций: бейдж слева, название и время по центру, сумма справа ── */
.list { display: flex; flex-direction: column; }
.day { font-size: 14px; color: var(--ink-2); margin: 18px 0 4px; }
.row { display: flex; align-items: center; gap: 14px; padding: 10px 0; text-decoration: none; }
.card-row { background: var(--card); border-radius: var(--r-lg); padding: 14px 16px; }
.row--off { opacity: 0.6; }
.badge { width: 48px; height: 48px; border-radius: 50%; background: var(--soft); display: grid; place-items: center; font-size: 20px; font-weight: var(--w-bold); flex: none; }
.badge--lime { background: var(--lime); color: var(--lime-ink); }
.row-main { display: flex; flex-direction: column; min-width: 0; }
.row-title { font-size: 16px; font-weight: var(--w-semi); }
.row-sub { font-size: 14px; color: var(--muted); }
.row-end { margin-left: auto; font-size: 16px; font-weight: var(--w-bold); white-space: nowrap; }
.row-end--muted { color: var(--muted); font-weight: var(--w-semi); }

/* ── Ввод суммы ── */
.amount { text-align: center; padding: 24px 0 4px; }
.amount-value { font-size: 64px; font-weight: var(--w-heavy); letter-spacing: -0.04em; line-height: 1; }
.amount-cur { color: var(--lime-text); font-size: 20px; font-weight: var(--w-semi); margin-top: 6px; }
.card--keypad { padding: 16px; }
.keypad { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.key { min-height: 64px; border-radius: 18px; background: var(--key); border: 0; font-size: 26px; font-weight: var(--w-bold); cursor: pointer; }
.key:active { background: var(--soft); }

/* ── Раскладка суммы ── */
.breakdown { display: flex; flex-direction: column; }
.line { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; padding: 13px 0; border-bottom: 1px solid var(--line); }
.line:last-child { border-bottom: 0; }
.line-label { color: var(--ink-2); }
.line-value { font-weight: var(--w-semi); text-align: right; }
.line--strong .line-value { font-size: 20px; font-weight: var(--w-heavy); }
.timer { font-weight: var(--w-semi); }

/* ── QR и адрес ── */
.qr-card { display: flex; flex-direction: column; align-items: center; gap: 10px; text-align: center; }
.qr-amount { font-size: 36px; font-weight: var(--w-heavy); letter-spacing: -0.02em; }
.qr { background: #fff; border: 1px solid var(--line); border-radius: 20px; padding: 10px; line-height: 0; }
.qr svg { width: 220px; height: 220px; }
.qr--small svg { width: 168px; height: 168px; }
.status-line { text-align: center; font-weight: var(--w-semi); margin: 0; }
.address { display: block; width: 100%; word-break: break-all; font: 15px/1.4 var(--font-mono); background: var(--paper); border-radius: 14px; padding: 12px; }
.warning { background: var(--warn-bg); color: var(--warn-ink); border-radius: var(--r-lg); padding: 16px 18px; display: flex; flex-direction: column; gap: 6px; }
.warning p { margin: 0; }
.warning-title { font-weight: var(--w-heavy); font-size: 17px; }

/* ── Успех: окно поверх экрана (см. «Окно результата» ниже). Лаймом только отметка. ── */
.success-mark { width: 56px; height: 56px; border-radius: 50%; background: var(--lime); color: var(--lime-ink); display: grid; place-items: center; font-size: 28px; font-weight: var(--w-heavy); align-self: center; }
.sheet--done .breakdown { width: 100%; text-align: left; }

/* ── Тарифы ── */
.tariff-head { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.tariff-head .title-md { margin: 0; }
.chip { background: var(--lime); color: var(--lime-ink); border-radius: var(--r-pill); padding: 5px 10px; font-size: 12px; font-weight: var(--w-bold); white-space: nowrap; }

/* Знак на тёмном фоне (лендинг, галерея) */
.brand--light { color: #fff; }
.brand--light::after { color: var(--lime); }

/* ── Реквизиты: скрыты до «Показать» ── */
.reveal-head { display: flex; justify-content: space-between; align-items: center; }
.reveal-row { display: flex; align-items: center; gap: 12px; padding: 10px 0; border-top: 1px solid var(--line); }
.reveal-row .row-sub { width: 56px; flex: none; }
/* Номер не рвём посреди группы цифр: переносится только целыми группами по четыре. */
.secret { font: var(--w-semi) 16px var(--font-mono); letter-spacing: 0.02em; flex: 1; min-width: 0; word-break: normal; overflow-wrap: normal; }
.pill--small { padding: 7px 12px; font-size: 13px; }

/* ── Код подтверждения ── */
.otp-code { font: var(--w-heavy) 44px/1 var(--font-mono); letter-spacing: 0.12em; padding: 10px 0; }

/* ── Нижняя шторка диалога ── */
.sheet-backdrop { position: fixed; inset: 0; background: var(--scrim); display: flex; align-items: flex-end; justify-content: center; z-index: 10; }
.sheet { background: var(--card); width: 100%; max-width: var(--maxw); border-radius: 28px 28px 0 0; padding: 24px 20px 28px; }
.sheet p { margin: 0; }

/* ── Окно результата: выпуск карты, зачисление, пополнение, закрытие ──
   Поверх текущего экрана, а не сменой всего экрана на лайм (замечание владельца 18.09.2026):
   фон приглушается и размывается, акцент — отметка или сама карта, которая «выезжает». */
.sheet-backdrop--done { align-items: center; padding: 16px; backdrop-filter: blur(6px); animation: issued-fade 0.25s ease-out; }
.sheet--done {
  border-radius: var(--r-xl); text-align: center; display: flex; flex-direction: column; gap: 12px;
  padding: 22px 20px 20px; animation: issued-up 0.45s cubic-bezier(0.2, 0.8, 0.2, 1);
}
.sheet--done .acard { margin: 0 auto 6px; animation: issued-card 0.9s cubic-bezier(0.2, 0.8, 0.2, 1) 0.08s both; }
.sheet--done .title-lg { margin: 0; }
.issued-badge {
  align-self: center; display: inline-flex; align-items: center; gap: 6px;
  background: var(--lime); color: var(--lime-ink); border-radius: var(--r-pill);
  padding: 6px 14px; font-size: 13px; font-weight: var(--w-bold);
}
.issued-badge--wait { background: var(--soft); color: var(--ink-2); }
/* Анимируем translate/rotate/scale, а не transform: transform занят наклоном карты. */
@keyframes issued-fade { from { opacity: 0; } }
@keyframes issued-up { from { translate: 0 28px; scale: 0.98; opacity: 0; } }
@keyframes issued-card { from { translate: 0 22px; rotate: -7deg; scale: 0.88; opacity: 0; } }
@media (prefers-reduced-motion: reduce) {
  .sheet-backdrop--done, .sheet--done, .sheet--done .acard { animation: none; }
}

/* ── «Платёж не прошёл»: три варианта причин, подходящий выделен ── */
.reason-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.reason { background: var(--card); border-radius: var(--r-lg); padding: 14px 16px; color: var(--muted); border: 1.5px solid transparent; }
.reason--hit { color: var(--ink); border-color: var(--ink); }
.reason-title { font-weight: var(--w-bold); display: block; }

/* ── Поддержка: быстрые темы, поле сообщения, лента переписки ── */
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip-btn {
  border: 1.5px solid var(--line); background: var(--bg); color: var(--ink);
  border-radius: var(--r-pill); padding: 8px 14px; font: inherit; font-size: 14px; cursor: pointer;
}
.chip-btn--on { background: var(--lime); border-color: var(--lime); color: var(--lime-ink); font-weight: var(--w-bold); }
.input--area { min-height: 96px; resize: vertical; line-height: 1.4; font: inherit; }
select.input { appearance: none; background: var(--bg); }

.thread { display: flex; flex-direction: column; gap: 10px; }
.bubble { max-width: 88%; border-radius: 20px; padding: 12px 14px; background: var(--card); }
.bubble--me { align-self: flex-end; background: var(--lime); color: var(--lime-ink); }
.bubble--them { align-self: flex-start; }
.bubble-who { display: block; font-size: 12px; font-weight: var(--w-bold); opacity: 0.7; }
.bubble-body { margin: 4px 0 0; white-space: pre-wrap; overflow-wrap: anywhere; }
.bubble-time { display: block; margin-top: 4px; font-size: 12px; opacity: 0.6; }

/* ── Профиль: переключатели уведомлений ── */
.switch-row { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 10px 0; border-top: 1px solid var(--line); }
.switch-row:first-child { border-top: none; }
.switch-row input { width: 44px; height: 26px; accent-color: var(--lime); flex: none; }

/* ── Статья справочника ── */
.article-text { margin: 0; white-space: pre-wrap; }
.steps { margin: 0; padding-left: 20px; display: flex; flex-direction: column; gap: 8px; }
.steps li { padding-left: 4px; }

/* Тариф, выбранный на лендинге */
.card--chosen { border: 1.5px solid var(--lime); }

/* ── Карта Атласа в экранах кабинета (сама карта — web/ui/acard.css) ── */
.card > .acard, .screen > .acard { margin: 0 auto; }
/* Мини-карта вместо значка в списке «Мои карты»: та же карта, только маленькая и без тени */
.row-card { width: 64px; flex: none; }
.row-card .acard { box-shadow: none; }
.wallet-btn { gap: 8px; }
.wallet-steps { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 10px; }
.wallet-step { display: flex; gap: 14px; align-items: flex-start; background: var(--card); border-radius: var(--r-lg); padding: 14px 16px; }
.wallet-step .row-title { margin: 0 0 2px; }
.step-num { display: grid; place-items: center; width: 36px; height: 36px; flex: none; border-radius: 50%; background: var(--lime); color: var(--lime-ink); font-weight: var(--w-heavy); }
