:root {
  --yellow: #ffdd2d;
  --yellow-press: #f5d000;
  --black: #1a1a1a;
  --ink: #0d0d0d;
  --gray-bg: #f1f2f4;
  --white: #ffffff;
  --muted: #9299a2;
  --muted-2: #b6bcc4;
  --green: #2fa84f;
  --red: #e02d3c;
  --line: #ececef;
  --radius: 20px;
  --tabbar-h: 64px;
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
}

* {
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
  /* Ведём себя как нативное приложение: без выделения текста и контекстных меню */
  -webkit-user-select: none;
  -moz-user-select: none;
  user-select: none;
  -webkit-touch-callout: none;
}

html, body {
  margin: 0;
  padding: 0;
  height: 100%;
  background: var(--gray-bg);
  color: var(--ink);
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
  overscroll-behavior: none;
  /* Запрет двойного тапа-зума и жестов масштабирования */
  touch-action: manipulation;
}

/* Картинки/SVG нельзя перетаскивать */
img, svg { -webkit-user-drag: none; user-drag: none; }

/* В полях ввода выделение/каретку оставляем — иначе их не отредактировать */
input, textarea {
  -webkit-user-select: text;
  -moz-user-select: text;
  user-select: text;
  -webkit-touch-callout: default;
}

#app {
  max-width: 480px;
  margin: 0 auto;
  min-height: 100%;
  position: relative;
  background: var(--gray-bg);
}

/* ===== Экран ===== */
.screen {
  padding: calc(var(--safe-top) + 8px) 16px calc(var(--tabbar-h) + var(--safe-bottom) + 24px);
  min-height: 100vh;
  animation: fade .22s ease;
}
@keyframes fade { from { opacity: 0; transform: translateY(4px);} to { opacity: 1; transform: none; } }

/* ===== Шапка ===== */
.topbar {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 8px 0 16px;
}
.avatar {
  width: 40px; height: 40px;
  border-radius: 50%;
  background: var(--yellow);
  color: var(--black);
  font-weight: 700;
  font-size: 16px;
  display: flex; align-items: center; justify-content: center;
  flex: 0 0 auto;
}
.topbar__greet { display: flex; flex-direction: column; line-height: 1.2; }
.topbar__greet b { font-size: 16px; }
.topbar__greet span { font-size: 12px; color: var(--muted); }
.topbar__spacer { flex: 1; }
.iconbtn {
  width: 40px; height: 40px;
  border: none; background: var(--white);
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  color: var(--black);
  cursor: pointer;
}
.iconbtn svg { width: 22px; height: 22px; }

/* ===== Заголовок экрана ===== */
.h1 { font-size: 26px; font-weight: 700; margin: 4px 0 18px; letter-spacing: -.5px; }
.section-title { font-size: 18px; font-weight: 700; margin: 22px 0 12px; }

/* ===== Баланс ===== */
.balance {
  margin: 4px 0 20px;
}
.balance__label { font-size: 14px; color: var(--muted); margin-bottom: 4px; }
.balance__value { font-size: 40px; font-weight: 700; letter-spacing: -1px; }
.balance__value .cur { font-weight: 600; }

/* ===== Быстрые действия ===== */
.actions {
  display: flex;
  gap: 10px;
  overflow-x: auto;
  padding-bottom: 4px;
  scrollbar-width: none;
}
.actions::-webkit-scrollbar { display: none; }
.action {
  flex: 0 0 auto;
  border: none;
  background: var(--white);
  border-radius: 16px;
  padding: 12px 16px;
  display: flex; flex-direction: column; align-items: center; gap: 8px;
  min-width: 84px;
  cursor: pointer;
  color: var(--ink);
}
.action__ic {
  width: 36px; height: 36px;
  border-radius: 50%;
  background: var(--yellow);
  display: flex; align-items: center; justify-content: center;
  color: var(--black);
}
.action__ic svg { width: 20px; height: 20px; }
.action span { font-size: 12px; font-weight: 500; }

/* ===== Карточки счетов ===== */
.cards { display: flex; flex-direction: column; gap: 12px; }
.acard {
  background: var(--white);
  border-radius: var(--radius);
  padding: 16px;
  display: flex; align-items: center; gap: 14px;
  cursor: pointer;
  border: 1px solid transparent;
  transition: transform .08s ease;
}
.acard:active { transform: scale(.985); }
.acard__chip {
  width: 48px; height: 32px;
  border-radius: 7px;
  flex: 0 0 auto;
  display: flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: 14px;
  position: relative;
  overflow: hidden;
}
.acard__chip--black { background: var(--black); color: var(--yellow); }
.acard__chip--save { background: var(--yellow); color: var(--black); }
.acard__chip svg { height: 26px; width: auto; display: block; }
.acard__info { flex: 1; min-width: 0; }
.acard__name { font-size: 15px; font-weight: 600; }
.acard__sub { font-size: 13px; color: var(--muted); margin-top: 2px; }
.acard__bal { font-size: 16px; font-weight: 700; white-space: nowrap; }

/* ===== Большая карта (экран карты) ===== */
.bigcard {
  border-radius: 24px;
  padding: 20px;
  color: #fff;
  background: linear-gradient(150deg, #2b2b2b 0%, #111 100%);
  position: relative;
  overflow: hidden;
  min-height: 200px;
  display: flex; flex-direction: column; justify-content: space-between;
  margin-bottom: 18px;
}
.bigcard::after {
  content: "";
  position: absolute;
  right: -40px; top: -40px;
  width: 180px; height: 180px;
  background: radial-gradient(circle, rgba(255,221,45,.22), transparent 70%);
}
.bigcard__top { display: flex; justify-content: space-between; align-items: flex-start; }
.bigcard__brand { display: flex; }
.bigcard__brand svg { height: 34px; width: auto; display: block; filter: drop-shadow(0 2px 4px rgba(0,0,0,.35)); }
.bigcard__sys { font-size: 13px; opacity: .85; font-style: italic; font-weight: 700; }
.bigcard__bal-label { font-size: 13px; opacity: .7; }
.bigcard__bal { font-size: 30px; font-weight: 700; margin-top: 2px; }
.bigcard__num { font-size: 16px; letter-spacing: 2px; opacity: .9; margin-top: 14px; }

.card-actions { display: flex; gap: 10px; margin-bottom: 8px; }
.card-actions .action { flex: 1; }

/* ===== История операций ===== */
.search {
  display: flex; align-items: center; gap: 8px;
  background: var(--white);
  border-radius: 14px;
  padding: 11px 14px;
  color: var(--muted);
  margin-bottom: 18px;
}
.search svg { width: 18px; height: 18px; }
.daygroup { margin-bottom: 18px; }
.daygroup__date { font-size: 13px; color: var(--muted); margin: 0 0 8px 4px; }
.oplist { background: var(--white); border-radius: var(--radius); overflow: hidden; }
.op {
  display: flex; align-items: center; gap: 14px;
  padding: 13px 16px;
  border-bottom: 1px solid var(--line);
}
.op:last-child { border-bottom: none; }
.op__ic {
  width: 42px; height: 42px; border-radius: 50%;
  flex: 0 0 auto;
  display: flex; align-items: center; justify-content: center;
  font-size: 20px;
}
.op__info { flex: 1; min-width: 0; }
.op__title { font-size: 15px; font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.op__cat { font-size: 13px; color: var(--muted); margin-top: 1px; }
.op__amt { font-size: 15px; font-weight: 600; white-space: nowrap; }
.op__amt--in { color: var(--green); }

/* ===== Меню «Ещё» ===== */
.menu { background: var(--white); border-radius: var(--radius); overflow: hidden; }
.menu__item {
  display: flex; align-items: center; gap: 14px;
  padding: 15px 16px;
  border-bottom: 1px solid var(--line);
  cursor: pointer;
}
.menu__item:last-child { border-bottom: none; }
.menu__ic {
  width: 32px; height: 32px; border-radius: 9px;
  background: var(--gray-bg);
  display: flex; align-items: center; justify-content: center;
}
.menu__ic svg { width: 18px; height: 18px; color: var(--black); }
.menu__label { flex: 1; font-size: 15px; }
.menu__chev { color: var(--muted-2); }

.profile-row {
  display: flex; align-items: center; gap: 14px;
  background: var(--white);
  border-radius: var(--radius);
  padding: 16px;
  margin-bottom: 16px;
}
.profile-row .avatar { width: 52px; height: 52px; font-size: 20px; }
.profile-row b { font-size: 17px; }
.profile-row span { font-size: 13px; color: var(--muted); display: block; margin-top: 2px; }

.version {
  text-align: center;
  color: var(--muted-2);
  font-size: 13px;
  margin: 28px 0 0;
  user-select: none;
  cursor: default;
}

/* ===== Заглушка пустого экрана ===== */
.placeholder {
  text-align: center;
  padding: 80px 24px;
  color: var(--muted);
}
.placeholder__ic {
  width: 72px; height: 72px;
  margin: 0 auto 18px;
  border-radius: 50%;
  background: var(--white);
  display: flex; align-items: center; justify-content: center;
}
.placeholder__ic svg { width: 34px; height: 34px; color: var(--black); }
.placeholder h3 { margin: 0 0 6px; color: var(--ink); font-size: 18px; }
.placeholder p { margin: 0; font-size: 14px; }

/* ===== Нижняя навигация ===== */
.tabbar {
  position: fixed;
  bottom: 0; left: 50%; transform: translateX(-50%);
  width: 100%; max-width: 480px;
  height: calc(var(--tabbar-h) + var(--safe-bottom));
  padding-bottom: var(--safe-bottom);
  background: rgba(255,255,255,.94);
  backdrop-filter: saturate(180%) blur(20px);
  -webkit-backdrop-filter: saturate(180%) blur(20px);
  border-top: 1px solid var(--line);
  display: flex;
  z-index: 50;
}
.tab {
  flex: 1;
  border: none; background: none;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 3px;
  color: var(--muted);
  cursor: pointer;
  padding: 0;
}
.tab__icon { width: 26px; height: 26px; display: block; }
.tab__icon svg { width: 26px; height: 26px; }
.tab__label { font-size: 10px; font-weight: 500; }
.tab.is-active { color: var(--ink); }

/* ===== Тост ===== */
.toast {
  position: fixed;
  left: 50%; bottom: calc(var(--tabbar-h) + var(--safe-bottom) + 18px);
  transform: translateX(-50%) translateY(12px);
  background: rgba(26,26,26,.95);
  color: #fff;
  padding: 12px 18px;
  border-radius: 14px;
  font-size: 14px;
  font-weight: 500;
  opacity: 0;
  pointer-events: none;
  transition: opacity .2s ease, transform .2s ease;
  z-index: 100;
  max-width: 80%;
  text-align: center;
}
.toast.is-show { opacity: 1; transform: translateX(-50%) translateY(0); }

/* ===== Модалка настроек ===== */
.modal {
  position: fixed; inset: 0;
  z-index: 200;
  display: none;
}
.modal.is-open { display: block; }
.modal__backdrop {
  position: absolute; inset: 0;
  background: rgba(0,0,0,.45);
  animation: fade .2s ease;
}
.modal__sheet {
  position: absolute;
  left: 50%; bottom: 0; transform: translateX(-50%);
  width: 100%; max-width: 480px;
  background: var(--white);
  border-radius: 24px 24px 0 0;
  padding: 8px 20px calc(24px + var(--safe-bottom));
  animation: slideup .28s cubic-bezier(.2,.8,.2,1);
  max-height: 90vh; overflow-y: auto;
}
@keyframes slideup { from { transform: translateX(-50%) translateY(100%);} to { transform: translateX(-50%) translateY(0);} }
.modal__grab {
  width: 40px; height: 4px; border-radius: 2px;
  background: var(--line);
  margin: 6px auto 12px;
}
.modal__head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 12px; }
.modal__title { font-size: 20px; font-weight: 700; margin: 0; }
.modal__close {
  border: none; background: var(--gray-bg);
  width: 32px; height: 32px; border-radius: 50%;
  font-size: 14px; color: var(--black); cursor: pointer;
}

/* ===== Форма ===== */
.form { display: flex; flex-direction: column; gap: 14px; }
.field { display: flex; flex-direction: column; gap: 6px; }
.field__label { font-size: 13px; color: var(--muted); padding-left: 2px; }
.field__input {
  border: 1.5px solid var(--line);
  border-radius: 12px;
  padding: 13px 14px;
  font-size: 16px;
  background: var(--gray-bg);
  color: var(--ink);
  outline: none;
}
.field__input:focus { border-color: var(--yellow); background: #fff; }
.form__actions { display: flex; gap: 10px; margin-top: 8px; }
.btn {
  flex: 1;
  border: none;
  border-radius: 14px;
  padding: 15px;
  font-size: 16px; font-weight: 600;
  cursor: pointer;
}
.btn--primary { background: var(--yellow); color: var(--black); }
.btn--primary:active { background: var(--yellow-press); }
.btn--ghost { background: var(--gray-bg); color: var(--ink); }
.btn--add {
  background: var(--gray-bg); color: var(--ink);
  border: 1.5px dashed var(--muted-2);
  flex: none; width: 100%; padding: 13px; font-size: 15px;
}

/* ===== Шапка главной ===== */
.avatar--btn { border: none; cursor: pointer; }
.home-title {
  display: inline-flex; align-items: center; gap: 4px;
  border: none; background: none; cursor: pointer;
  font-size: 20px; font-weight: 700; color: var(--ink); padding: 0;
}
.home-title__chev { display: inline-flex; }
.home-title__chev svg { width: 18px; height: 18px; }

/* ===== Сторис ===== */
.stories {
  display: flex; gap: 10px;
  overflow-x: auto; scrollbar-width: none;
  padding: 4px 0 16px;
}
.stories::-webkit-scrollbar { display: none; }
.story {
  flex: 0 0 auto;
  width: 96px; height: 128px;
  border: none; border-radius: 16px;
  cursor: pointer; position: relative;
  display: flex; align-items: flex-end;
  padding: 10px; text-align: left;
  box-shadow: 0 4px 12px rgba(0,0,0,.08);
}
.story__t { color: #fff; font-size: 13px; font-weight: 600; line-height: 1.2; text-shadow: 0 1px 3px rgba(0,0,0,.3); }

/* ===== Круглые быстрые действия ===== */
.qa-row {
  display: flex; gap: 6px;
  overflow-x: auto; scrollbar-width: none;
  padding-bottom: 6px; margin-bottom: 6px;
}
.qa-row::-webkit-scrollbar { display: none; }
.qa {
  flex: 0 0 auto;
  border: none; background: none; cursor: pointer;
  display: flex; flex-direction: column; align-items: center; gap: 7px;
  min-width: 74px; padding: 0;
}
.qa__ic {
  width: 56px; height: 56px; border-radius: 50%;
  background: var(--white);
  display: flex; align-items: center; justify-content: center;
  color: var(--black);
  box-shadow: 0 2px 8px rgba(0,0,0,.05);
}
.qa__ic svg { width: 24px; height: 24px; }
.qa__l { font-size: 12px; color: var(--ink); font-weight: 500; text-align: center; }

/* ===== Кнопка «Назад» ===== */
.backbar { display: flex; align-items: center; gap: 10px; padding: 6px 0 14px; }
.backbar__back { background: var(--white); }
.backbar__back svg { width: 20px; height: 20px; }
.backbar__title { font-size: 20px; font-weight: 700; }

/* ===== Чипы валют (Ещё) ===== */
.ccy { display: flex; gap: 8px; margin-bottom: 16px; flex-wrap: wrap; }
.ccy__chip {
  border: none; background: var(--white);
  border-radius: 12px; padding: 9px 14px;
  font-size: 14px; color: var(--ink); cursor: pointer;
}
.ccy__chip b { font-weight: 700; }

/* ===== Меню «Ещё»: подписи ===== */
.menu__txt { flex: 1; min-width: 0; }
.menu__sub { font-size: 12px; color: var(--muted); margin-top: 1px; }
.profile-row .menu__chev { margin-left: auto; }

/* ===== Группы формы ===== */
.form__group { font-size: 15px; font-weight: 700; margin: 6px 0 0; }
.form__hint { font-weight: 400; font-size: 12px; color: var(--muted); }

/* ===== Редактор операций ===== */
.tx-editor { display: flex; flex-direction: column; gap: 10px; }
.tx-row {
  background: var(--gray-bg);
  border-radius: 14px; padding: 10px;
  display: flex; flex-direction: column; gap: 8px;
}
.tx-line { display: flex; gap: 8px; align-items: center; }
.tx-i {
  border: 1px solid var(--line); border-radius: 10px;
  padding: 10px; font-size: 14px;
  background: #fff; color: var(--ink);
  width: 100%; outline: none;
}
.tx-i:focus { border-color: var(--yellow); }
.tx-emoji { flex: 0 0 46px; width: 46px; text-align: center; padding: 10px 2px; font-size: 18px; }
.tx-day { flex: 1; }
.tx-amt { flex: 1; }
.tx-del {
  flex: 0 0 34px; width: 34px; height: 38px;
  border: none; background: #fff; border-radius: 9px;
  color: var(--red); font-size: 14px; cursor: pointer;
}
.tx-sign {
  flex: 0 0 42px; width: 42px; height: 40px;
  border: 1px solid var(--line); border-radius: 10px;
  background: #fff; color: var(--red);
  font-size: 20px; font-weight: 700; cursor: pointer;
}
.tx-sign--in { color: var(--green); }

/* ===== Гайд установки ===== */
.guide { display: flex; flex-direction: column; gap: 16px; }
.guide__block {
  background: var(--gray-bg); border-radius: 16px; padding: 14px 16px;
  transition: opacity .2s ease;
}
.guide__block--dim { opacity: .4; }
.guide__os { font-size: 15px; font-weight: 700; margin-bottom: 8px; display: flex; align-items: center; gap: 8px; }
.guide__logo {
  width: 22px; height: 22px; border-radius: 6px;
  background: var(--yellow); flex: 0 0 22px;
  display: inline-block; position: relative;
}
.guide__logo::after {
  content: "Т"; position: absolute; inset: 0;
  display: flex; align-items: center; justify-content: center;
  font-size: 13px; font-weight: 800; color: var(--black);
}
.guide__steps { margin: 0; padding-left: 20px; display: flex; flex-direction: column; gap: 6px; }
.guide__steps li { font-size: 14px; line-height: 1.4; color: var(--ink); }
.guide__note { font-size: 13px; color: var(--muted); margin: 0; line-height: 1.4; }
.guide .btn { margin-top: 2px; }
