/* ── ZayaPay ──
   Цвета — из общей палитры /webapp/theme.css, ни одного своего значения. */

:root {
  --card: var(--surface);
  --card-border: var(--surface-border);
  --tabbar-h: 68px;
}

[hidden] {
  display: none !important;
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

button,
select,
input {
  font-family: inherit;
  font-size: inherit;
  color: inherit;
}

button {
  -webkit-appearance: none;
  appearance: none;
}

body {
  font-family: "Inter Tight", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
  font-size: 15px;
  line-height: 1.45;
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
  min-height: 100vh;
}

body.has-tabbar #app {
  padding-bottom: calc(var(--tabbar-h) + 28px + env(safe-area-inset-bottom));
}

#app {
  max-width: 560px;
  margin: 0 auto;
  padding: calc(16px + env(safe-area-inset-top)) 16px calc(28px + env(safe-area-inset-bottom));
}

.screen {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.icon {
  display: inline-flex;
  flex: none;
  width: 22px;
  height: 22px;
}

.icon svg {
  width: 100%;
  height: 100%;
  display: block;
}

/* ── Шапка ── */
.top {
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 40px;
  margin-bottom: 16px;
}

.top-title {
  font-size: 22px;
  font-weight: 650;
  letter-spacing: -0.3px;
  color: var(--text-strong);
}

.icon-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  flex: none;
  width: 40px;
  height: 40px;
  border: 1px solid var(--card-border);
  border-radius: 14px;
  background: var(--card);
  cursor: pointer;
}

.icon-btn svg {
  width: 20px;
  height: 20px;
}

/* ── Нижнее меню ── */
.tabbar {
  position: fixed;
  left: 50%;
  bottom: calc(10px + env(safe-area-inset-bottom));
  transform: translateX(-50%);
  z-index: 8;
  display: flex;
  gap: 4px;
  width: min(calc(100% - 24px), 440px);
  padding: 6px;
  border-radius: 26px;
  border: 1px solid var(--card-border);
  background: var(--card);
  box-shadow: var(--shadow);
}

.tab {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  padding: 8px 4px 6px;
  border: none;
  border-radius: 20px;
  background: transparent;
  color: var(--text-soft);
  font-size: 11.5px;
  font-weight: 600;
  cursor: pointer;
}

.tab-icon {
  width: 22px;
  height: 22px;
}

.tab.active {
  background: var(--accent-soft);
  color: var(--accent-text);
}

/* ── Предупреждения ── */
.demo-strip {
  padding: 8px 12px;
  border-radius: 12px;
  background: var(--accent-soft);
  color: var(--accent-text);
  font-size: 13px;
  text-align: center;
}

.notice {
  padding: 14px 16px;
  border-radius: 16px;
  border: 1px solid var(--accent);
  background: var(--accent-soft);
}

.notice-title {
  font-weight: 650;
  color: var(--text-strong);
}

.notice-text {
  margin-top: 2px;
  font-size: 14px;
  color: var(--text);
}

/* ── Общий баланс и быстрые действия ── */
.total {
  padding: 8px 4px 2px;
  text-align: center;
}

.total-label {
  color: var(--text-soft);
}

.total-row {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  margin-top: 4px;
}

.eye {
  display: flex;
  flex: none;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  padding: 4px;
  border: none;
  background: transparent;
  color: var(--text-soft);
  cursor: pointer;
}

.total-amount {
  font-size: 36px;
  font-weight: 700;
  letter-spacing: -0.8px;
  font-variant-numeric: tabular-nums;
  color: var(--text-strong);
}

.total-note {
  margin-top: 2px;
  font-size: 12.5px;
  color: var(--text-soft);
}

.quick {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
}

.quick-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 7px;
  padding: 0;
  border: none;
  background: transparent;
  font-size: 12.5px;
  font-weight: 600;
  color: var(--text-strong);
  cursor: pointer;
}

.quick-icon {
  width: 54px;
  height: 54px;
  align-items: center;
  justify-content: center;
  padding: 15px;
  border-radius: 20px;
  background: var(--btn-bg);
  color: var(--btn-text);
}

.quick-item:active .quick-icon {
  transform: scale(0.96);
}

/* ── Карта и плитки ── */
.tile {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px;
  border-radius: 20px;
  border: 1px solid var(--card-border);
  background: var(--card);
  box-shadow: var(--shadow);
}

.tile-icon {
  width: 44px;
  height: 44px;
  padding: 11px;
  border-radius: 14px;
  background: var(--accent-soft);
  color: var(--accent-text);
}

.tile-body {
  flex: 1;
  min-width: 0;
}

.tile-title {
  font-weight: 650;
  color: var(--text-strong);
}

.tile-text {
  font-size: 12.5px;
  color: var(--text-soft);
}

.pill {
  flex: none;
  padding: 9px 14px;
  border: none;
  border-radius: 99px;
  background: var(--btn-bg);
  color: var(--btn-text);
  font-size: 13px;
  font-weight: 650;
  cursor: pointer;
}

/* ── Секции и списки ── */
.section-title {
  margin: 4px 2px 8px;
  font-size: 17px;
  font-weight: 650;
  color: var(--text-strong);
}

.list {
  display: flex;
  flex-direction: column;
  border-radius: 20px;
  border: 1px solid var(--card-border);
  background: var(--card);
  box-shadow: var(--shadow);
  overflow: hidden;
}

.list > * + * {
  border-top: 1px solid var(--line);
}

.asset,
.link-row,
.op {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  padding: 13px 14px;
  border: none;
  background: transparent;
  text-align: left;
  cursor: pointer;
}

.link-row:disabled {
  cursor: default;
  opacity: 0.6;
}

.badge {
  display: flex;
  flex: none;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: var(--accent-soft);
  color: var(--accent-text);
  font-size: 18px;
  font-weight: 700;
}

.asset-body,
.link-body,
.op-body {
  display: flex;
  flex: 1;
  flex-direction: column;
  min-width: 0;
}

.asset-name,
.link-title,
.op-title {
  font-weight: 650;
  color: var(--text-strong);
}

.asset-sub,
.link-text,
.op-sub {
  font-size: 12.5px;
  color: var(--text-soft);
}

.asset-amounts,
.op-amounts {
  display: flex;
  flex: none;
  flex-direction: column;
  align-items: flex-end;
  font-variant-numeric: tabular-nums;
}

.asset-amount,
.op-amount {
  font-weight: 650;
  color: var(--text-strong);
}

.link-icon {
  width: 40px;
  height: 40px;
  padding: 10px;
  border-radius: 14px;
  background: var(--accent-soft);
  color: var(--accent-text);
}

.link-chevron {
  width: 18px;
  height: 18px;
  color: var(--text-soft);
}

/* ── История ── */
.chips {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding-bottom: 2px;
  scrollbar-width: none;
}

.chips::-webkit-scrollbar {
  display: none;
}

.chip {
  flex: none;
  padding: 8px 14px;
  border: 1px solid var(--card-border);
  border-radius: 99px;
  background: var(--card);
  font-size: 13.5px;
  font-weight: 600;
  color: var(--text);
  cursor: pointer;
}

.chip.active {
  border-color: var(--accent);
  background: var(--accent-soft);
  color: var(--accent-text);
}

/* Свой вид выбора: родной на iPhone и Android рисуется по-разному и выбивается из страницы. */
.select {
  -webkit-appearance: none;
  appearance: none;
  width: 100%;
  padding: 12px 40px 12px 14px;
  border: 1px solid var(--card-border);
  border-radius: 14px;
  background-color: var(--card);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%238e8480' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  background-size: 20px;
  color: var(--text-strong);
  font-weight: 600;
}

/* ── Фильтр по валютам: кнопка и нижний лист ── */
.picker {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  padding: 12px 14px;
  border: 1px solid var(--card-border);
  border-radius: 14px;
  background: var(--card);
  text-align: left;
  cursor: pointer;
}

.picker-label {
  color: var(--text-soft);
  font-size: 13.5px;
}

.picker-value {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  text-align: right;
  font-weight: 600;
  color: var(--text-strong);
}

.picker-chevron {
  width: 18px;
  height: 18px;
  color: var(--text-soft);
  transform: rotate(90deg);
}

.sheet-backdrop {
  position: fixed;
  inset: 0;
  z-index: 20;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  background: rgba(0, 0, 0, 0.45);
}

.sheet {
  display: flex;
  flex-direction: column;
  gap: 12px;
  width: min(100%, 560px);
  padding: 18px 16px calc(16px + env(safe-area-inset-bottom));
  border-radius: 24px 24px 0 0;
  background: var(--bg);
}

.sheet-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.sheet-title {
  font-size: 18px;
  font-weight: 650;
  color: var(--text-strong);
}

.sheet-reset {
  padding: 6px 4px;
  border: none;
  background: transparent;
  color: var(--accent-text);
  font-weight: 600;
  cursor: pointer;
}

.sheet-list {
  display: flex;
  flex-direction: column;
  border-radius: 18px;
  border: 1px solid var(--card-border);
  background: var(--card);
  overflow: hidden;
}

.sheet-list > * + * {
  border-top: 1px solid var(--line);
}

.check-row {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  padding: 12px 14px;
  border: none;
  background: transparent;
  text-align: left;
  cursor: pointer;
}

.check-name {
  flex: 1;
  font-weight: 600;
  color: var(--text-strong);
}

.check-box {
  position: relative;
  flex: none;
  width: 24px;
  height: 24px;
  border-radius: 8px;
  border: 2px solid var(--line);
}

.check-row.on .check-box {
  border-color: var(--accent);
  background: var(--accent);
}

.check-row.on .check-box::after {
  content: "";
  position: absolute;
  left: 6px;
  top: 2px;
  width: 6px;
  height: 11px;
  border: solid var(--bg);
  border-width: 0 2.5px 2.5px 0;
  transform: rotate(45deg);
}

.day {
  margin: 6px 2px 0;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-soft);
}

.op-icon {
  width: 40px;
  height: 40px;
  padding: 10px;
  border-radius: 14px;
  background: var(--accent-soft);
  color: var(--accent-text);
}

.op-sub {
  display: flex;
  gap: 8px;
  align-items: center;
}

.op-amounts .op-sub {
  display: block;
}

.op-amount.in,
.op-big.in {
  color: var(--accent-text);
}

/* Не прошедшая операция: деньги не двигались, сумма приглушена и зачёркнута. */
.op-amount.failed {
  color: var(--text-soft);
  text-decoration: line-through;
}

.chip-status {
  font-weight: 600;
}

.chip-status.pending {
  color: var(--accent-text);
}

.chip-status.failed {
  color: var(--danger);
}

.op-big {
  font-size: 30px;
  font-weight: 700;
  letter-spacing: -0.5px;
  font-variant-numeric: tabular-nums;
  color: var(--text-strong);
}

/* ── Карточки и факты ── */
.card {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 18px 18px 16px;
  border-radius: 20px;
  background: var(--card);
  border: 1px solid var(--card-border);
  box-shadow: var(--shadow);
}

.card-title {
  font-size: 17px;
  font-weight: 650;
  color: var(--text-strong);
}

.card-text {
  font-size: 14px;
  color: var(--text-soft);
}

.card-text.center {
  text-align: center;
}

.eyebrow {
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--accent-text);
}

.facts {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 6px 14px;
  font-size: 14px;
}

.facts dt {
  color: var(--text-soft);
}

.facts dd {
  color: var(--text-strong);
  font-weight: 600;
  text-align: right;
  overflow-wrap: anywhere;
}

/* ── Виртуальная карта ── */
.vcard {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 28px;
  aspect-ratio: 1.586;
  padding: 20px;
  border-radius: 22px;
  background: linear-gradient(135deg, var(--btn-bg), var(--accent));
  color: var(--btn-text);
}

.vcard-brand {
  font-weight: 700;
  letter-spacing: 0.4px;
}

.vcard-number {
  font-size: 20px;
  letter-spacing: 2px;
  font-variant-numeric: tabular-nums;
}

/* ── Обмен ── */
.exchange-side {
  gap: 8px;
}

.amount-input,
.amount-out {
  width: 100%;
  padding: 0;
  border: none;
  background: transparent;
  font-size: 30px;
  font-weight: 700;
  letter-spacing: -0.5px;
  font-variant-numeric: tabular-nums;
  color: var(--text-strong);
  outline: none;
}

.amount-out {
  overflow-wrap: anywhere;
}

.swap {
  display: flex;
  align-self: center;
  width: 44px;
  height: 44px;
  padding: 11px;
  margin: -6px 0;
  border: 1px solid var(--card-border);
  border-radius: 50%;
  background: var(--card);
  color: var(--accent-text);
  cursor: pointer;
}

/* ── Скан QR ── */
.code {
  display: block;
  width: 100%;
  padding: 14px 16px;
  border-radius: 16px;
  border: 1px solid var(--card-border);
  background: var(--bg);
  color: var(--text-strong);
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 14px;
  line-height: 1.5;
  text-align: left;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  cursor: pointer;
}

/* ── Состояние целиком (гейт, пустая история, ошибка) ── */
.hero {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  padding: 36px 20px 30px;
  border-radius: 24px;
  background: var(--card);
  border: 1px solid var(--card-border);
  box-shadow: var(--shadow);
  text-align: center;
}

.hero-title {
  font-size: 22px;
  font-weight: 650;
  line-height: 1.2;
  color: var(--text-strong);
}

.hero-text {
  max-width: 34ch;
  font-size: 14px;
  color: var(--text-soft);
}

/* ── Строка с переключателем ── */
.row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  width: 100%;
  padding: 0;
  border: none;
  background: transparent;
  text-align: left;
  cursor: pointer;
}

.row:disabled {
  cursor: default;
  opacity: 0.6;
}

.row-label {
  color: var(--text-strong);
  font-weight: 600;
}

.switch {
  position: relative;
  flex: none;
  width: 46px;
  height: 28px;
  border-radius: 99px;
  background: var(--line);
  transition: background 0.15s ease;
}

.switch::after {
  content: "";
  position: absolute;
  top: 3px;
  left: 3px;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: var(--card);
  box-shadow: var(--shadow);
  transition: transform 0.15s ease;
}

.row.on .switch {
  background: var(--accent);
}

.row.on .switch::after {
  transform: translateX(18px);
}

/* ── Кнопки ── */
.actions {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.cta {
  width: 100%;
  padding: 16px 20px;
  border: none;
  border-radius: 18px;
  background: var(--btn-bg);
  color: var(--btn-text);
  font-size: 16px;
  font-weight: 600;
  cursor: pointer;
  transition: transform 0.15s ease, box-shadow 0.2s ease;
}

.cta:active {
  transform: scale(0.99);
  box-shadow: 0 0 0 4px var(--accent-soft), 0 0 24px var(--accent-soft);
}

.cta:disabled {
  opacity: 0.45;
  cursor: default;
}

.ghost {
  width: 100%;
  padding: 15px 20px;
  border-radius: 18px;
  border: 1px solid var(--card-border);
  background: transparent;
  color: var(--text-strong);
  font-size: 16px;
  font-weight: 600;
  cursor: pointer;
}

/* ── Короткое сообщение внизу ── */
.status {
  position: fixed;
  left: 50%;
  bottom: calc(var(--tabbar-h) + 28px + env(safe-area-inset-bottom));
  transform: translateX(-50%);
  max-width: 88vw;
  padding: 9px 16px;
  border-radius: 99px;
  background: var(--card);
  border: 1px solid var(--card-border);
  font-size: 14px;
  color: var(--text-soft);
  text-align: center;
  opacity: 0;
  transition: opacity 0.2s ease;
  pointer-events: none;
  z-index: 9;
}

.status.visible {
  opacity: 1;
}

/* ── PIN и клавиатура ── */
.pin {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
  padding: 28px 8px 8px;
}

.pin-title {
  font-size: 22px;
  font-weight: 650;
  line-height: 1.2;
  text-align: center;
  color: var(--text-strong);
}

.pin-text {
  max-width: 34ch;
  font-size: 14px;
  text-align: center;
  color: var(--text-soft);
}

.pin-dots {
  display: flex;
  gap: 14px;
  margin: 6px 0 2px;
}

.pin-dot {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  border: 2px solid var(--text-soft);
  transition: background 0.12s ease, border-color 0.12s ease;
}

.pin-dot.on {
  background: var(--accent);
  border-color: var(--accent);
}

.pin-message {
  min-height: 20px;
  font-size: 14px;
  text-align: center;
  color: var(--text-soft);
}

.pin-message.error {
  color: var(--danger);
}

.keypad {
  display: grid;
  grid-template-columns: repeat(3, 76px);
  gap: 14px 22px;
  margin: 4px 0 6px;
}

.key,
.key-gap {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 76px;
  height: 76px;
}

.key {
  border-radius: 50%;
  border: 1px solid var(--card-border);
  background: var(--card);
  font-size: 28px;
  font-weight: 500;
  color: var(--text-strong);
  cursor: pointer;
  transition: transform 0.1s ease, background 0.15s ease;
}

.key:active {
  transform: scale(0.94);
  background: var(--accent-soft);
}

.key:disabled {
  opacity: 0.5;
  cursor: default;
}

.key-erase,
.key-bio {
  border-color: transparent;
  background: transparent;
}

.key-erase .icon,
.key-bio .icon {
  width: 28px;
  height: 28px;
}

.link-btn {
  padding: 10px 14px;
  border: none;
  background: transparent;
  font-size: 15px;
  font-weight: 600;
  color: var(--link);
  cursor: pointer;
}

/* ── Устройства с биометрией ── */
.devices {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.device {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.device-body {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.device-title {
  font-size: 15px;
  font-weight: 600;
  color: var(--text-strong);
}

.device-sub {
  font-size: 13px;
  color: var(--text-soft);
}

@media (prefers-reduced-motion: reduce) {
  .cta,
  .key,
  .pin-dot,
  .switch,
  .switch::after {
    transition: none;
  }
}
