/* Digital Freedom — мини-аппка аренды.
   Образ: чек и посадочный талон. Бумага на столе в светлой теме, чернила в тёмной.
   Один акцент (ультрамарин) — только действия; зелёный — только суммы заработка. */

@font-face {
  font-family: "Geologica";
  src: url("../fonts/geologica.woff2") format("woff2");
  font-weight: 300 800;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "Martian Mono";
  src: url("../fonts/martian-mono.woff2") format("woff2");
  font-weight: 300 700;
  font-stretch: 75% 100%;
  font-style: normal;
  font-display: swap;
}

/* ───────── Токены ───────── */
:root {
  --font: "Geologica", system-ui, -apple-system, "Segoe UI", sans-serif;
  --mono: "Martian Mono", ui-monospace, "SF Mono", Menlo, Consolas, monospace;

  --bg: #EEE9DF;
  --paper: #FBF9F3;
  --paper-2: #F3EFE5;
  --ink: #1A1915;
  --ink-2: #48453D;
  --muted: #6A665B;
  --line: #DAD4C5;
  --line-2: #B8B09D;
  --accent: #2038C8;
  --accent-text: #2038C8;
  --on-accent: #FFFFFF;
  --accent-soft: #E1E5F8;
  --gain: #1D7A4B;
  --gain-soft: #DDEEDD;
  --warn: #8A5A00;
  --warn-soft: #F6EACB;
  --danger: #AE3B20;
  --danger-soft: #F7E2DA;
  --drop: drop-shadow(0 1px 0 rgba(26, 25, 21, .05)) drop-shadow(0 10px 14px rgba(26, 25, 21, .07));

  /* Telegram отдаёт отступы своими переменными; вне Telegram — нули и env(). */
  --safe-top: calc(var(--tg-safe-area-inset-top, 0px) + var(--tg-content-safe-area-inset-top, 0px));
  --safe-bottom: max(var(--tg-safe-area-inset-bottom, 0px), env(safe-area-inset-bottom, 0px));
  --safe-left: max(var(--tg-safe-area-inset-left, 0px), env(safe-area-inset-left, 0px));
  --safe-right: max(var(--tg-safe-area-inset-right, 0px), env(safe-area-inset-right, 0px));
  --gut: 16px;

  color-scheme: light;
}

/* Тёмные токены в двух местах: до ответа Telegram верим системе, после — data-theme. */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0C0F15;
    --paper: #151A24;
    --paper-2: #1C2230;
    --ink: #EDE9DF;
    --ink-2: #C5C2BA;
    --muted: #8F95A3;
    --line: #262D3B;
    --line-2: #3B4456;
    --accent: #3F58F2;
    --accent-text: #94A7FF;
    --on-accent: #FFFFFF;
    --accent-soft: #1B2347;
    --gain: #6FCB97;
    --gain-soft: #14281E;
    --warn: #E2B45C;
    --warn-soft: #2C2513;
    --danger: #F08D72;
    --danger-soft: #2F1B16;
    --drop: none;
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #0C0F15;
  --paper: #151A24;
  --paper-2: #1C2230;
  --ink: #EDE9DF;
  --ink-2: #C5C2BA;
  --muted: #8F95A3;
  --line: #262D3B;
  --line-2: #3B4456;
  --accent: #3F58F2;
  --accent-text: #94A7FF;
  --on-accent: #FFFFFF;
  --accent-soft: #1B2347;
  --gain: #6FCB97;
  --gain-soft: #14281E;
  --warn: #E2B45C;
  --warn-soft: #2C2513;
  --danger: #F08D72;
  --danger-soft: #2F1B16;
  --drop: none;
  color-scheme: dark;
}

/* ───────── Основа ───────── */
*, *::before, *::after { box-sizing: border-box; }
html, body { height: 100%; margin: 0; }
html { background: var(--bg); -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
body {
  background: var(--bg);
  color: var(--ink);
  font: 400 16px/1.45 var(--font);
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
  overscroll-behavior: none;
  overflow: hidden;
}
button, input, textarea { font: inherit; color: inherit; }
button { -webkit-appearance: none; appearance: none; cursor: pointer; touch-action: manipulation; }
h1, h2, h3, p, ul, ol { margin: 0; padding: 0; }
ul, ol { list-style: none; }
a { color: var(--accent-text); }
[hidden] { display: none !important; }
:focus { outline: none; }
:focus-visible { outline: 2px solid var(--accent-text); outline-offset: 2px; }
.noscript { padding: 24px; }

.app {
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  left: 0;
  display: flex;
  flex-direction: column;
  max-width: 480px;
  margin: 0 auto;
  padding-left: var(--safe-left);
  padding-right: var(--safe-right);
}
.views { position: relative; flex: 1; min-height: 0; }
.view, .overlay {
  position: absolute;
  top: 0;
  right: 0;
  bottom: 0;
  left: 0;
  overflow-x: hidden;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
  padding: calc(18px + var(--safe-top)) var(--gut) 28px;
}
.view[hidden] { display: none; }
.overlay {
  z-index: 10;
  background: var(--bg);
  padding-bottom: calc(28px + var(--safe-bottom));
}
.stack > * + * { margin-top: var(--gap, 16px); }

/* ───────── Типографика ───────── */
.h1 {
  font-size: 28px;
  line-height: 1.12;
  font-weight: 700;
  letter-spacing: -.022em;
  text-wrap: balance;
  overflow-wrap: break-word;
}
.h2 { font-size: 19px; line-height: 1.25; font-weight: 650; letter-spacing: -.012em; text-wrap: balance; }
.lead { font-size: 16.5px; line-height: 1.42; color: var(--ink-2); text-wrap: pretty; }
.text { color: var(--ink-2); text-wrap: pretty; }
.small { font-size: 13.5px; line-height: 1.42; color: var(--muted); text-wrap: pretty; }
.cap {
  font: 500 10.5px/1.35 var(--mono);
  font-stretch: 85%;
  letter-spacing: .09em;
  text-transform: uppercase;
  color: var(--muted);
}
.mono { font-family: var(--mono); font-stretch: 87.5%; font-variant-numeric: tabular-nums; }
/* В моноширинном пробел шириной в знак: «299 ₽» и «12 000 ₽» разваливаются. Поджимаем его у всех сумм. */
.row__v, .total__v, .balance__sum, .pace b, .talon__sum, .kv3 b, .entry__sum, .ptable td, .markup__val { word-spacing: -.32em; }
.gain { color: var(--gain); }
.nowrap { white-space: nowrap; }
.center { text-align: center; }

.head { display: flex; align-items: flex-end; justify-content: space-between; gap: 12px; }
.head .cap { padding-bottom: 5px; white-space: nowrap; }
.section-cap { margin-top: 28px; margin-bottom: 10px; }

/* ───────── Бумага: лист, чек, талон ───────── */
.sheet {
  position: relative;
  background: var(--paper);
  border-radius: 4px;
  padding: 16px;
}
.drop { filter: var(--drop); }

/* Чек: нижний край вырезан зубцами маской, поэтому тень — на обёртке .drop */
.receipt {
  --z: 6px;
  position: relative;
  background: var(--paper);
  border-radius: 3px 3px 0 0;
  padding: 16px 16px calc(14px + var(--z));
  -webkit-mask:
    linear-gradient(#000, #000) top / 100% calc(100% - var(--z)) no-repeat,
    conic-gradient(from -45deg at 50% 100%, #000 90deg, transparent 0) bottom left / calc(var(--z) * 2) var(--z) repeat-x;
  mask:
    linear-gradient(#000, #000) top / 100% calc(100% - var(--z)) no-repeat,
    conic-gradient(from -45deg at 50% 100%, #000 90deg, transparent 0) bottom left / calc(var(--z) * 2) var(--z) repeat-x;
}
.receipt__brand {
  font: 600 12px/1 var(--mono);
  font-stretch: 100%;
  letter-spacing: .22em;
  text-transform: uppercase;
  text-align: center;
  padding: 2px 0 12px;
}
.receipt__title { display: flex; justify-content: space-between; gap: 8px; margin-bottom: 8px; }

.row { display: flex; align-items: baseline; gap: 8px; padding: 5px 0; }
.row__k { flex: 0 1 auto; color: var(--ink-2); font-size: 15px; }
.row__dots { flex: 1 1 12px; min-width: 12px; border-bottom: 1.5px dotted var(--line-2); transform: translateY(-4px); }
.row__v {
  flex: none;
  font: 500 15px/1.3 var(--mono);
  font-stretch: 87.5%;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}
.row--strong .row__k { color: var(--ink); font-weight: 600; }
.row--strong .row__v { font-weight: 700; }

/* Линия отрыва с выкусами по краям — как на талоне */
.tear {
  position: relative;
  height: 0;
  border-top: 1.5px dashed var(--line-2);
  margin: 12px -16px;
}
.tear::before, .tear::after {
  content: "";
  position: absolute;
  top: -8px;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: var(--bg);
}
.tear::before { left: -7px; }
.tear::after { right: -7px; }
.tear--plain::before, .tear--plain::after { display: none; }

.total { display: flex; align-items: flex-end; justify-content: space-between; gap: 12px; }
.total__k .cap { display: block; }
.total__sub { font-size: 13px; color: var(--muted); margin-top: 3px; }
.total__v {
  font: 700 30px/1 var(--mono);
  font-stretch: 85%;
  font-variant-numeric: tabular-nums;
  letter-spacing: -.02em;
  color: var(--gain);
  white-space: nowrap;
}
.total__v.is-zero { color: var(--muted); }

.barcode { display: flex; align-items: stretch; height: 26px; color: var(--ink); opacity: .82; overflow: hidden; }
.barcode i { display: block; flex: none; background: currentColor; }

.stamp {
  display: inline-block;
  padding: 7px 12px 6px;
  border: 2px solid currentColor;
  border-radius: 5px;
  box-shadow: inset 0 0 0 2px var(--paper), inset 0 0 0 3px currentColor;
  color: var(--accent-text);
  font: 700 11.5px/1.2 var(--mono);
  font-stretch: 90%;
  letter-spacing: .14em;
  text-transform: uppercase;
  transform: rotate(-4deg);
}

/* ───────── Кнопки ───────── */
.btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  width: 100%;
  min-height: 54px;
  padding: 10px 18px;
  border: 0;
  border-radius: 12px;
  background: var(--accent);
  color: var(--on-accent);
  font-weight: 600;
  font-size: 16.5px;
  line-height: 1.2;
  text-align: center;
  text-decoration: none;
  transition: transform .08s ease, opacity .15s ease, background-color .15s ease;
}
.btn:active { transform: scale(.985); }
.btn--ghost { background: transparent; color: var(--ink); box-shadow: inset 0 0 0 1.5px var(--ink); }
.btn--paper { background: var(--paper); color: var(--ink); box-shadow: inset 0 0 0 1px var(--line); }
.btn--dashed {
  background: transparent;
  color: var(--accent-text);
  border: 1.5px dashed var(--line-2);
  min-height: 56px;
}
.btn[disabled], .btn[aria-disabled="true"] { background: var(--line); color: var(--muted); box-shadow: none; cursor: default; }
.btn[disabled]:active { transform: none; }
.btn .ic { flex: none; }
.btn__note { font: 500 10.5px/1 var(--mono); font-stretch: 85%; letter-spacing: .09em; text-transform: uppercase; opacity: .9; }

.link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 44px;
  padding: 0;
  border: 0;
  background: none;
  color: var(--accent-text);
  font-weight: 500;
  text-decoration: underline dotted;
  text-underline-offset: 4px;
}
.link--danger { color: var(--danger); }
.link--muted { color: var(--muted); }

.iconbtn {
  display: grid;
  place-items: center;
  flex: none;
  width: 44px;
  height: 44px;
  border: 1.5px solid var(--line-2);
  border-radius: 50%;
  background: var(--paper);
  color: var(--ink);
  transition: transform .08s ease;
}
.iconbtn:active { transform: scale(.94); }
.iconbtn[disabled] { opacity: .35; }

/* ───────── Поля ───────── */
.field { display: block; }
.field__top { display: flex; justify-content: space-between; align-items: baseline; margin-bottom: 7px; }
.input {
  display: block;
  width: 100%;
  min-height: 54px;
  padding: 14px;
  border: 1.5px solid var(--line-2);
  border-radius: 10px;
  background: var(--paper);
  color: var(--ink);
  font-weight: 500;
  font-size: 17px;
  line-height: 1.3;
  transition: border-color .15s ease, box-shadow .15s ease;
  -webkit-appearance: none;
  appearance: none;
}
.input::placeholder { color: var(--muted); opacity: .75; font-weight: 400; }
.input:focus { border-color: var(--accent-text); box-shadow: 0 0 0 3px var(--accent-soft); outline: none; }
.input.is-error { border-color: var(--danger); }
.input--token {
  font: 500 14px/1.55 var(--mono);
  font-stretch: 80%;
  resize: none;
  word-break: break-all;
  min-height: 76px;
}
.field__hint { margin-top: 7px; }

.check { display: flex; gap: 12px; align-items: flex-start; min-height: 44px; padding: 10px 0; cursor: pointer; }
.check input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.check__box {
  flex: none;
  display: grid;
  place-items: center;
  width: 26px;
  height: 26px;
  border: 1.5px solid var(--line-2);
  border-radius: 7px;
  background: var(--paper);
  color: transparent;
  transition: background-color .12s ease, border-color .12s ease;
}
.check input:checked + .check__box { background: var(--accent); border-color: var(--accent); color: var(--on-accent); }
.check input:focus-visible + .check__box { outline: 2px solid var(--accent-text); outline-offset: 2px; }
.check__text { padding-top: 2px; font-weight: 500; }
.check.is-nudge .check__box { animation: nudge .45s ease; border-color: var(--accent-text); box-shadow: 0 0 0 4px var(--accent-soft); }

/* ───────── Ползунок наценки ───────── */
.markup__top { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.markup__val {
  flex: 1;
  text-align: center;
  font: 700 38px/1 var(--mono);
  font-stretch: 85%;
  font-variant-numeric: tabular-nums;
  letter-spacing: -.03em;
  white-space: nowrap;
}
.markup__val small { font-size: 20px; font-weight: 500; color: var(--muted); margin-left: 3px; }

.range {
  --f: 0;
  --thumb: 30px;
  display: block;
  width: 100%;
  height: 44px;
  margin: 4px 0 0;
  padding: 0;
  background: transparent;
  -webkit-appearance: none;
  appearance: none;
  touch-action: pan-y;
}
.range:focus-visible { outline: none; }
.range::-webkit-slider-runnable-track {
  height: 6px;
  border-radius: 3px;
  background: linear-gradient(to right,
    var(--accent) calc(var(--thumb) / 2 + (100% - var(--thumb)) * var(--f)),
    var(--line-2) calc(var(--thumb) / 2 + (100% - var(--thumb)) * var(--f)));
}
.range::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: var(--thumb);
  height: var(--thumb);
  margin-top: -12px;
  border: 2px solid var(--accent);
  border-radius: 50%;
  background: var(--paper);
  box-shadow: 0 2px 6px rgba(0, 0, 0, .18);
}
.range:focus-visible::-webkit-slider-thumb { box-shadow: 0 0 0 4px var(--accent-soft), 0 2px 6px rgba(0, 0, 0, .18); }
.range::-moz-range-track { height: 6px; border-radius: 3px; background: var(--line-2); }
.range::-moz-range-progress { height: 6px; border-radius: 3px; background: var(--accent); }
.range::-moz-range-thumb {
  width: 26px;
  height: 26px;
  border: 2px solid var(--accent);
  border-radius: 50%;
  background: var(--paper);
  box-shadow: 0 2px 6px rgba(0, 0, 0, .18);
}
.scale { position: relative; height: 16px; margin: -4px 15px 0; }
.scale span {
  position: absolute;
  top: 0;
  transform: translateX(-50%);
  font: 500 10px/1 var(--mono);
  font-stretch: 85%;
  color: var(--muted);
  white-space: nowrap;
}
.scale span::before {
  content: "";
  position: absolute;
  left: 50%;
  top: -7px;
  width: 1px;
  height: 4px;
  background: var(--line-2);
}

.chips {
  display: flex;
  gap: 6px;
  overflow-x: auto;
  scrollbar-width: none;
  margin: 0 calc(var(--gut) * -1);
  padding: 2px var(--gut);
}
.chips::-webkit-scrollbar { display: none; }
.chip {
  flex: none;
  min-height: 44px;
  /* 12 px и зазор 6: пять сроков настоящей сетки (1, 3, 6 мес, 1 год, 2 года) помещаются в 390 px целиком */
  padding: 0 12px;
  border: 1.5px solid var(--line-2);
  border-radius: 999px;
  background: transparent;
  color: var(--ink);
  font-weight: 500;
  font-size: 14.5px;
  white-space: nowrap;
  transition: background-color .12s ease, color .12s ease, border-color .12s ease;
}
.chip[aria-pressed="true"] { background: var(--ink); border-color: var(--ink); color: var(--bg); }
.picker { display: grid; gap: 6px; }
.picker .cap { margin-top: 6px; }
.picker .small { margin-bottom: -2px; }

.pace {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
  padding: 12px 14px;
  border: 1.5px dashed var(--line-2);
  border-radius: 10px;
  font-size: 14.5px;
  color: var(--ink-2);
}
.pace b { font: 700 16px/1.2 var(--mono); font-stretch: 85%; font-variant-numeric: tabular-nums; color: var(--gain); white-space: nowrap; }
.pace b.is-zero { color: var(--muted); }

/* ───────── Статусы ───────── */
.pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  flex: none;
  height: 24px;
  padding: 0 9px 0 8px;
  border-radius: 999px;
  background: var(--paper-2);
  color: var(--ink);
  font: 500 10px/1 var(--mono);
  font-stretch: 85%;
  letter-spacing: .06em;
  text-transform: uppercase;
  white-space: nowrap;
}
.pill::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.pill--draft { color: var(--muted); box-shadow: inset 0 0 0 1px var(--line); background: transparent; }
.pill--pending, .pill--paused { color: var(--warn); background: var(--warn-soft); }
.pill--provisioning { color: var(--accent-text); background: var(--accent-soft); }
/* «Работает» — чернилами, зелёная только точка: зелёный текст оставлен суммам заработка */
.pill--active { box-shadow: inset 0 0 0 1px var(--line); }
.pill--active::before { background: var(--gain); }
.pill--blocked { color: var(--danger); background: var(--danger-soft); }
.pill--soon { color: var(--muted); background: transparent; box-shadow: inset 0 0 0 1px var(--line-2); padding: 0 8px; }
.pill--soon::before { display: none; }

/* ───────── Главная ───────── */
.hero-receipt { transform: rotate(-1.2deg); margin: 6px 4px 0; }
.duo { display: grid; grid-template-columns: 1fr 1fr; gap: 0; }
.duo > div { padding: 2px 0; }
.duo > div + div { border-left: 1.5px dashed var(--line-2); padding-left: 16px; }
.duo > div:first-child { padding-right: 14px; }
.duo .cap { display: block; margin-bottom: 8px; }
.duo li { position: relative; padding: 3px 0 3px 15px; font-size: 14.5px; line-height: 1.35; color: var(--ink-2); }
.duo li::before { content: ""; position: absolute; left: 0; top: 12px; width: 7px; height: 2px; background: var(--line-2); }

.talon {
  display: block;
  width: 100%;
  padding: 14px 16px 13px;
  border: 0;
  border-radius: 10px;
  background: var(--paper);
  color: inherit;
  text-align: left;
  position: relative;
  transition: transform .08s ease;
}
button.talon:active { transform: scale(.99); }
.talon__top { display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; }
.talon__id { min-width: 0; flex: 1 1 auto; }
.talon__brand {
  font-weight: 650;
  font-size: 18px;
  line-height: 1.2;
  letter-spacing: -.01em;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.talon__user {
  margin-top: 3px;
  font: 400 12px/1.3 var(--mono);
  font-stretch: 85%;
  color: var(--muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.talon__bottom { display: flex; align-items: flex-end; justify-content: space-between; gap: 12px; }
.talon__note { font-size: 13.5px; line-height: 1.38; color: var(--ink-2); display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.talon__sum { font: 700 18px/1 var(--mono); font-stretch: 85%; font-variant-numeric: tabular-nums; white-space: nowrap; }
.talon__sum.is-zero { color: var(--muted); font-weight: 500; }
.talon__kv .cap { display: block; margin-bottom: 5px; }
.talon__kv--r { text-align: right; }
.talon__go { flex: none; align-self: center; color: var(--muted); margin-right: -4px; }
/* minmax(0, 1fr): иначе длинный @username без переносов распирает колонку шире экрана */
.talon-list { display: grid; grid-template-columns: minmax(0, 1fr); gap: 12px; }

/* ───────── Мастер ───────── */
.steps { display: flex; align-items: center; gap: 12px; margin-bottom: 18px; }
.steps__bar { display: flex; gap: 4px; flex: 1; }
.steps__seg { flex: 1; height: 4px; border-radius: 2px; background: var(--line-2); opacity: .55; transition: background-color .2s ease, opacity .2s ease; }
.steps__seg.is-done { background: var(--ink); opacity: 1; }
.steps__seg.is-current { background: var(--accent); opacity: 1; }
.steps .cap { white-space: nowrap; }

.numlist { counter-reset: n; display: grid; gap: 0; }
.numlist > li { counter-increment: n; position: relative; padding: 13px 0 13px 40px; min-height: 50px; color: var(--ink-2); }
.numlist > li + li { border-top: 1.5px dashed var(--line); }
.numlist > li::before {
  content: counter(n);
  position: absolute;
  left: 0;
  top: 12px;
  width: 26px;
  height: 26px;
  display: grid;
  place-items: center;
  border: 1.5px solid var(--ink);
  border-radius: 50%;
  font: 600 12px/1 var(--mono);
  color: var(--ink);
}
.numlist b { color: var(--ink); font-weight: 600; }
.numlist--tight > li { padding: 10px 0 10px 38px; min-height: 46px; font-size: 14.5px; line-height: 1.4; }
.numlist--tight > li::before { top: 10px; width: 24px; height: 24px; font-size: 11px; }
.code {
  font: 500 .88em/1.3 var(--mono);
  font-stretch: 85%;
  padding: 2px 6px;
  border-radius: 5px;
  background: var(--paper-2);
  color: var(--ink);
  white-space: nowrap;
}
.sheet .code { background: var(--bg); }

.bubble {
  padding: 12px 14px;
  border-radius: 4px 14px 14px 14px;
  background: var(--paper);
  font-size: 14px;
  line-height: 1.45;
  color: var(--ink-2);
}
.bubble .cap { display: block; margin-bottom: 6px; }
.bubble__token {
  display: block;
  margin-top: 4px;
  font: 500 13px/1.5 var(--mono);
  font-stretch: 80%;
  color: var(--accent-text);
  word-break: break-all;
}

.note { display: flex; gap: 11px; padding: 12px 14px; border-radius: 10px; background: var(--paper-2); font-size: 14.5px; line-height: 1.42; color: var(--ink-2); }
.note .ic { flex: none; margin-top: 1px; color: var(--muted); }
.note--warn { background: var(--warn-soft); color: var(--ink); }
.note--warn .ic { color: var(--warn); }
.note--error { background: var(--danger-soft); color: var(--ink); }
.note--error .ic { color: var(--danger); }
.note b { font-weight: 600; color: var(--ink); }

.found { display: flex; align-items: center; gap: 13px; }
.found__ava {
  flex: none;
  display: grid;
  place-items: center;
  width: 52px;
  height: 52px;
  border-radius: 50%;
  background: var(--accent-soft);
  color: var(--accent-text);
}
.found__name { font-weight: 650; font-size: 18px; line-height: 1.2; overflow-wrap: anywhere; }
.found__user { margin-top: 3px; font: 400 12.5px/1.3 var(--mono); font-stretch: 85%; color: var(--muted); overflow-wrap: anywhere; }
/* на узком экране ссылка «Другой токен» уходит на свою строку, а не сплющивает токен в многоточие */
.masked { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 0 12px; }
.masked__val { flex: none; font: 500 13px/1.3 var(--mono); font-stretch: 80%; color: var(--ink-2); white-space: nowrap; }

.spin {
  width: 18px;
  height: 18px;
  flex: none;
  border: 2px solid var(--line-2);
  border-top-color: var(--accent-text);
  border-radius: 50%;
  animation: spin .7s linear infinite;
}
.checking { display: flex; align-items: center; gap: 11px; padding: 12px 2px; color: var(--ink-2); }

.done-top { display: flex; flex-direction: column; align-items: flex-start; gap: 14px; }

/* ───────── Карточка бота ───────── */
.stages { display: grid; grid-template-columns: repeat(4, 1fr); margin: 4px 0 2px; }
.stage { position: relative; text-align: center; padding-top: 22px; }
.stage::before {
  content: "";
  position: absolute;
  top: 6px;
  left: -50%;
  right: 50%;
  height: 2px;
  background: var(--line-2);
}
.stage:first-child::before { display: none; }
.stage::after {
  content: "";
  position: absolute;
  top: 0;
  left: 50%;
  width: 14px;
  height: 14px;
  margin-left: -7px;
  border-radius: 50%;
  border: 2px solid var(--line-2);
  background: var(--paper);
}
.stage.is-done::before, .stage.is-current::before, .stage.is-warn::before, .stage.is-danger::before { background: var(--ink); }
.stage.is-done::after { background: var(--ink); border-color: var(--ink); }
.stage.is-current::after { border-color: var(--accent); background: var(--accent); box-shadow: 0 0 0 4px var(--accent-soft); }
.stage.is-warn::after { border-color: var(--warn); background: var(--warn); box-shadow: 0 0 0 4px var(--warn-soft); }
.stage.is-danger::after { border-color: var(--danger); background: var(--danger); box-shadow: 0 0 0 4px var(--danger-soft); }
.stage .cap { letter-spacing: .04em; font-size: 9.5px; }
.stage.is-current .cap, .stage.is-warn .cap, .stage.is-danger .cap { color: var(--ink); font-weight: 600; }

.kv3 { display: grid; grid-template-columns: repeat(3, auto); justify-content: space-between; gap: 10px; }
.kv3 .cap { display: block; margin-bottom: 5px; white-space: nowrap; }
.kv3 b { font: 600 17px/1 var(--mono); font-stretch: 85%; font-variant-numeric: tabular-nums; white-space: nowrap; }

.soon { display: flex; gap: 13px; padding: 14px 0; }
.soon + .soon { border-top: 1.5px dashed var(--line); }
.soon:first-child { padding-top: 2px; }
.soon:last-child { padding-bottom: 2px; }
.soon .ic { flex: none; margin-top: 1px; color: var(--ink-2); }
.soon__head { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.soon__title { font-weight: 600; }
.soon p { margin-top: 3px; font-size: 14px; line-height: 1.4; color: var(--muted); }
.soon__body { flex: 1; min-width: 0; }

/* ───────── Деньги ───────── */
.balance__sum {
  font: 700 44px/1 var(--mono);
  font-stretch: 80%;
  font-variant-numeric: tabular-nums;
  letter-spacing: -.035em;
  white-space: nowrap;
  margin: 8px 0 4px;
}
.balance__sum.is-neg { color: var(--danger); }
.balance__sum--sm { font-size: 34px; }

.ledger__day { margin: 18px 0 2px; }
.ledger__day:first-child { margin-top: 0; }
.entry { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; padding: 11px 0; }
.entry + .entry { border-top: 1.5px dashed var(--line); }
.entry__title { font-weight: 500; font-size: 15px; line-height: 1.3; overflow-wrap: anywhere; }
.entry__meta { margin-top: 4px; }
.entry__sum { flex: none; font: 600 15px/1.3 var(--mono); font-stretch: 85%; font-variant-numeric: tabular-nums; white-space: nowrap; }
.entry__sum.is-minus { font-weight: 500; color: var(--ink-2); }

/* ───────── Справка ───────── */
.faq details { border-top: 1.5px dashed var(--line-2); }
.faq details:last-child { border-bottom: 1.5px dashed var(--line-2); }
.faq summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  min-height: 56px;
  padding: 12px 0;
  font-weight: 600;
  line-height: 1.3;
  list-style: none;
  cursor: pointer;
}
.faq summary::-webkit-details-marker { display: none; }
.faq summary .ic { flex: none; color: var(--muted); transition: transform .2s ease; }
.faq details[open] summary .ic { transform: rotate(45deg); }
.faq details p { padding: 0 34px 16px 0; color: var(--ink-2); text-wrap: pretty; }
.faq details[open] p { animation: fade-up .22s ease both; }

/* ───────── Цены ───────── */
.ptable { width: 100%; border-collapse: collapse; }
.ptable th { text-align: right; padding: 0 0 8px 8px; font-weight: 500; }
.ptable th:first-child, .ptable td:first-child { text-align: left; padding-left: 0; }
.ptable td {
  text-align: right;
  padding: 11px 0 11px 8px;
  border-top: 1.5px dashed var(--line);
  font: 500 14px/1.2 var(--mono);
  font-stretch: 82%;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}
.ptable td:first-child { font: 500 15px/1.2 var(--font); word-spacing: normal; }
.ptable td.gain { font-weight: 700; }
.ptable td.dim { color: var(--muted); }

/* ───────── Пустые и служебные состояния ───────── */
.state { display: flex; flex-direction: column; align-items: flex-start; gap: 10px; padding: 18px 16px; }
.state .ic { color: var(--muted); }
.state__title { font-weight: 650; font-size: 17px; }
.state .btn { margin-top: 6px; }
.state--page { justify-content: center; min-height: 100%; padding: 0; gap: 14px; }
.state--page .btn { margin-top: 10px; }

.gate { display: flex; flex-direction: column; justify-content: center; min-height: 100%; gap: 18px; }
.gate__mark { color: var(--accent-text); }

.toast {
  position: fixed;
  left: 50%;
  bottom: calc(84px + var(--safe-bottom));
  z-index: 60;
  width: max-content;
  max-width: min(448px, calc(100% - 32px));
  transform: translateX(-50%);
  padding: 12px 16px;
  border-radius: 10px;
  background: var(--ink);
  color: var(--bg);
  font-size: 14.5px;
  line-height: 1.35;
  font-weight: 500;
  text-align: center;
  animation: toast-in .2s ease both;
}
.app.has-overlay .toast { bottom: calc(20px + var(--safe-bottom)); }
.toast.is-out { animation: toast-out .18s ease both; }

/* ───────── Нижняя панель ───────── */
.tabbar {
  flex: none;
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 2px;
  padding: 6px 8px calc(6px + var(--safe-bottom));
  background: var(--bg);
  border-top: 1.5px dashed var(--line-2);
}
/* display, а не visibility: скрытая панель иначе держит место, и экран поверх не достаёт до низа */
.app.has-overlay .tabbar { display: none; }
.tab {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  min-height: 50px;
  padding: 4px 0;
  border: 0;
  border-radius: 10px;
  background: none;
  color: var(--muted);
  font-weight: 500;
  font-size: 11px;
  line-height: 1;
  transition: color .12s ease;
}
.tab[aria-current="page"] { color: var(--ink); font-weight: 600; }
.tab[aria-current="page"] .ic { color: var(--accent-text); }

/* ───────── Скелетоны ───────── */
.sk {
  border-radius: 6px;
  background: linear-gradient(90deg, var(--line) 25%, var(--paper-2) 40%, var(--line) 60%) 0 0 / 300% 100%;
  animation: sk 1.5s ease-in-out infinite;
  opacity: .7;
}
.sk + .sk { margin-top: 12px; }
.sk--cap { width: 96px; height: 11px; }
.sk--h1 { width: 78%; height: 30px; margin-top: 10px; }
.sk--line { width: 92%; height: 16px; }
.sk--sheet { height: 170px; margin-top: 22px; border-radius: 4px; }
.sk--row { height: 86px; border-radius: 10px; }
.sk--btn { height: 54px; border-radius: 12px; margin-top: 18px; }
.sk--sum { width: 55%; height: 44px; }

/* ───────── Движение ───────── */
.ic { display: block; }
.overlay.is-in { animation: slide-in .24s cubic-bezier(.2, .8, .2, 1) both; }
.overlay.is-out { animation: slide-out .18s ease-in both; pointer-events: none; }
.view.is-in { animation: fade-in .16s ease both; }
.step.is-fwd { animation: step-fwd .24s cubic-bezier(.2, .8, .2, 1) both; }
.step.is-back { animation: step-back .24s cubic-bezier(.2, .8, .2, 1) both; }
.fade-up { animation: fade-up .24s ease both; }

@keyframes slide-in { from { opacity: 0; transform: translateX(28px); } }
@keyframes slide-out { to { opacity: 0; transform: translateX(28px); } }
@keyframes fade-in { from { opacity: 0; } }
@keyframes fade-up { from { opacity: 0; transform: translateY(6px); } }
@keyframes step-fwd { from { opacity: 0; transform: translateX(22px); } }
@keyframes step-back { from { opacity: 0; transform: translateX(-22px); } }
@keyframes toast-in { from { opacity: 0; transform: translate(-50%, 8px); } }
@keyframes toast-out { to { opacity: 0; transform: translate(-50%, 8px); } }
@keyframes nudge { 20% { transform: translateX(-4px); } 50% { transform: translateX(4px); } 80% { transform: translateX(-2px); } }
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes sk { from { background-position: 100% 0; } to { background-position: 0 0; } }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: .001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .001ms !important;
  }
  .hero-receipt { transform: none; }
}

/* Узкие экраны (320): ужимаем крупные цифры и поля, чтобы ничего не переносилось */
@media (max-width: 350px) {
  :root { --gut: 14px; }
  .h1 { font-size: 25px; }
  .balance__sum { font-size: 38px; }
  .markup__val { font-size: 34px; }
  .total__v { font-size: 26px; }
  .row__k, .row__v { font-size: 14px; }
  .duo li { font-size: 13.5px; }
  .ptable td { font-size: 12.5px; padding-left: 6px; }
  .kv3 .cap { letter-spacing: .03em; }
  .ptable td:first-child { font-size: 14px; }
  .tab { font-size: 10.5px; }
}

/* Отступы сверху — вместо inline-стилей */
.mt-6 { margin-top: 6px; }
.mt-8 { margin-top: 8px; }
.mt-10 { margin-top: 10px; }
.mt-14 { margin-top: 14px; }
.mt-18 { margin-top: 18px; }
.mt-22 { margin-top: 22px; }
.mt-26 { margin-top: 26px; }
