/* FRANK web — мобильная оболочка под iPhone */

:root {
  --canvas: #ffffff;
  --ink: #0d0d0d;
  --muted: #5a5a5a;
  --line: #e5e5e5;
  --summary: #f6f6f7;
  --control-border: #858585;
  --primary: #b83100;
  --primary-soft: #ffeee7;
  --accent: #ff4500;
  --action: #d63a00;
  --danger: #b84d42;
  --success: #246b4a;
  --night: #0d0d0d;
  --card-night: #232326;
  --on-night-muted: #b8b8b8;
  --paper: #f7f3ec;
  --paper-line: #e6dfd2;

  --r-control: 12px;
  --r-action: 14px;
  --r-card: 16px;
  --r-panel: 24px;

  --sat: env(safe-area-inset-top, 0px);
  --sab: env(safe-area-inset-bottom, 0px);
  --sal: env(safe-area-inset-left, 0px);
  --sar: env(safe-area-inset-right, 0px);

  --font: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Helvetica Neue", Inter, Roboto, system-ui, sans-serif;
  --font-display: -apple-system, BlinkMacSystemFont, "SF Pro Display", "Helvetica Neue", Inter, Roboto, system-ui, sans-serif;
}

* { box-sizing: border-box; }
html, body { height: 100%; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font-family: var(--font);
  font-size: 17px;
  line-height: 1.4;
  color: var(--ink);
  background: var(--night);
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
  overscroll-behavior: none;
  touch-action: manipulation;
}
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
input, textarea { font-size: 17px; } /* ≥16px: iOS не зумит поле при фокусе */
h1, h2, h3, p { margin: 0; }
.num { font-variant-numeric: tabular-nums; font-family: var(--font-display); }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }

/* ---------------------------------------------------------------- shell */

.app { position: fixed; inset: 0; overflow: hidden; }

/* Стек экранов: каждый экран — слой на весь экран со своей прокруткой тела,
 * шапка и действия неподвижны, переходы — как push/pop навигации iOS. */
.stack { position: absolute; inset: 0; }
.layer { position: absolute; inset: 0; will-change: transform, opacity; }
.layer--modal { z-index: 20; }
.layer--enter-forward { animation: slide-in-right 320ms cubic-bezier(.32,.72,0,1) both; }
.layer--leave-forward { animation: slide-out-left 320ms cubic-bezier(.32,.72,0,1) both; }
.layer--enter-back { animation: slide-in-left 320ms cubic-bezier(.32,.72,0,1) both; }
.layer--leave-back { animation: slide-out-right 320ms cubic-bezier(.32,.72,0,1) both; z-index: 2; }
@keyframes slide-in-right { from { transform: translate3d(100%,0,0); box-shadow: -12px 0 32px rgba(0,0,0,.25); } to { transform: none; } }
@keyframes slide-out-left { from { transform: none; } to { transform: translate3d(-28%,0,0); filter: brightness(.82); } }
@keyframes slide-in-left { from { transform: translate3d(-28%,0,0); filter: brightness(.82); } to { transform: none; } }
@keyframes slide-out-right { from { transform: none; } to { transform: translate3d(100%,0,0); } }

.screen {
  position: absolute; inset: 0;
  display: flex;
  flex-direction: column;
  background: var(--canvas);
}
.screen--dark { background: var(--night); color: #fff; }
.screen--paper { background: var(--paper); }

@keyframes fade-in { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: none; } }
@media (prefers-reduced-motion: reduce) {
  .layer, .screen, .toast { animation: none !important; }
  * { transition: none !important; }
}

.topbar {
  flex: none; z-index: 5;
  background: var(--night); color: #fff;
  padding: calc(var(--sat) + 10px) calc(16px + var(--sar)) 12px calc(16px + var(--sal));
  display: flex; align-items: center; gap: 12px; min-height: 52px;
}
.topbar__back {
  width: 40px; height: 40px; margin-left: -8px; border: 0; border-radius: 12px;
  background: transparent; color: #fff; display: grid; place-items: center;
}
.topbar__back:active { background: rgba(255,255,255,.12); }
.topbar__title { font-size: 18px; font-weight: 600; letter-spacing: -0.2px; flex: 1; }
.topbar__step { font-size: 13px; color: var(--on-night-muted); font-weight: 500; white-space: nowrap; }
.topbar__spacer { width: 32px; }

.body {
  flex: 1; min-height: 0;
  overflow-y: auto; -webkit-overflow-scrolling: touch; overscroll-behavior: contain;
  padding: 20px calc(16px + var(--sar)) 24px calc(16px + var(--sal));
  display: flex; flex-direction: column; gap: 16px;
}
/* Дети прокручиваемого тела не сжимаются под высоту экрана: карточка с
 * overflow:hidden иначе обрезает свой низ на коротких телефонах. */
.body > * { flex: none; }
.actions {
  flex: none;
  padding: 12px calc(16px + var(--sar)) calc(12px + var(--sab)) calc(16px + var(--sal));
  background: var(--canvas);
  border-top: 1px solid var(--line);
  display: flex; flex-direction: column; gap: 10px;
}
.screen--dark .actions { background: var(--night); border-top-color: #2a2a2d; }
.screen--paper .actions { background: var(--paper); border-top-color: var(--paper-line); }

/* ---------------------------------------------------------------- buttons */

.btn {
  display: flex; align-items: center; justify-content: center; gap: 8px;
  width: 100%; min-height: 54px; padding: 14px 18px;
  border: 0; border-radius: var(--r-action);
  font-size: 17px; font-weight: 600; line-height: 1.25;
  transition: transform 120ms ease, background-color 120ms ease, opacity 120ms ease;
}
.btn:active { transform: scale(.985); }
.btn:disabled { pointer-events: none; } /* клик уходит в обёртку data-action=*-blocked */
.btn--primary { background: var(--action); color: #fff; }
.btn--primary:disabled { background: var(--summary); color: var(--muted); }
.screen--dark .btn--primary:disabled { background: var(--card-night); color: var(--on-night-muted); }
.btn--outline { background: transparent; color: var(--ink); border: 1px solid var(--control-border); min-height: 52px; }
.screen--dark .btn--outline { color: #fff; border-color: #4a4a4e; }
.btn--ghost { background: transparent; color: var(--primary); min-height: 44px; }
.btn--danger { background: transparent; color: var(--danger); border: 1px solid var(--danger); }
.btn svg, .icon svg { width: 20px; height: 20px; flex: none; display: block; }
/* Иконка действия — кружок у правого края, подпись по центру кнопки. */
.btn { position: relative; }
.btn__label { flex: 1; text-align: center; }
.btn__icon {
  position: absolute; right: 9px; top: 50%; transform: translateY(-50%);
  width: 36px; height: 36px; border-radius: 50%;
  display: grid; place-items: center;
  background: rgba(255,255,255,.18); color: currentColor;
}
.btn__icon svg { width: 18px; height: 18px; }
.btn:has(.btn__icon) .btn__label { padding: 0 44px; }
.btn--primary:disabled .btn__icon { background: rgba(0,0,0,.06); }
.screen--dark .btn--primary:disabled .btn__icon { background: rgba(255,255,255,.08); }
.btn--outline .btn__icon, .btn--danger .btn__icon { background: transparent; border: 1px solid currentColor; opacity: .8; }
.btn--ghost .btn__icon { display: none; }
.icon { display: inline-flex; }
.btn-surface { display: contents; }
.btn--inline { display: inline; width: auto; min-height: 0; padding: 0; font-size: inherit; font-weight: 500; }
.doc-row--last { border-bottom: 0; }
.card-preview__brand { font-size: 12px; font-weight: 700; letter-spacing: 1.5px; color: var(--on-night-muted); }

/* ---------------------------------------------------------------- calculator */

.calc-hero {
  padding: 4px 0 8px;
  display: flex; align-items: baseline; justify-content: space-between;
}
.wordmark { font-family: var(--font-display); font-weight: 700; font-size: 22px; letter-spacing: 3px; }
.wordmark i { color: var(--accent); font-style: normal; }
.calc-card {
  border-radius: var(--r-panel);
  overflow: hidden;
  background: #fff;
  color: var(--ink);
  box-shadow: 0 18px 40px rgba(0,0,0,.35);
}
.calc-card__amount { background: var(--card-night); color: #fff; padding: 22px 20px 18px; }
.calc-card__term { padding: 20px 20px 4px; }
.calc-card__summary { padding: 8px 20px 20px; }
.calc-label { font-size: 13px; font-weight: 500; letter-spacing: .2px; color: var(--on-night-muted); text-transform: uppercase; }
.calc-card__term .calc-label, .calc-card__summary .calc-label { color: var(--muted); }
.calc-value { font-size: clamp(36px, 12.8vw, 54px); font-weight: 500; letter-spacing: -1.5px; line-height: 1.1; margin-top: 6px; }
.calc-value--term { font-size: clamp(22px, 6.6vw, 26px); font-weight: 600; letter-spacing: -.4px; color: var(--ink); }
.calc-range-labels { display: flex; justify-content: space-between; font-size: 13px; color: var(--on-night-muted); margin-top: -6px; }
.calc-card__term .calc-range-labels { color: var(--muted); }
.calc-row { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: baseline; gap: 2px 12px; padding: 12px 0; border-top: 1px solid var(--line); }
.calc-row__label { font-size: 15px; color: var(--muted); }
.calc-row__value { font-size: 17px; font-weight: 500; white-space: nowrap; margin-left: auto; }
.calc-row--total .calc-row__value { font-size: clamp(21px, 6.4vw, 26px); font-weight: 600; letter-spacing: -.4px; }
.calc-disclaimer { color: var(--on-night-muted); font-size: 13px; line-height: 1.45; }

/* Ползунок: непрерывный, 20px трек. Видимый бегунок 32px, но зона нажатия —
 * 56px: внешнее кольцо прозрачное (часть радиального градиента), сам input
 * высотой 64px, touch-action: none — жест не уходит в прокрутку. */
.range {
  -webkit-appearance: none; appearance: none;
  width: 100%; height: 64px; margin: 0; background: transparent;
  touch-action: none; cursor: pointer;
  --p: 50%;
  --thumb: radial-gradient(circle, #fff 0 5px, var(--accent) 5.5px 15.5px, var(--thumb-ring, var(--card-night)) 16px 17px, rgba(0,0,0,.16) 17.5px 18.5px, rgba(0,0,0,.05) 20px, rgba(0,0,0,0) 22px 100%);
}
.range:focus-visible { outline: 2px solid var(--accent); outline-offset: 4px; border-radius: 12px; }
.range::-webkit-slider-runnable-track {
  height: 20px; border-radius: 10px;
  background: linear-gradient(90deg, var(--accent) 0 var(--p), var(--track, #3a3a3e) var(--p) 100%);
}
.range::-webkit-slider-thumb {
  -webkit-appearance: none; appearance: none;
  width: 56px; height: 56px; margin-top: -18px; border-radius: 50%; border: 0;
  background: var(--thumb);
}
.range:active::-webkit-slider-thumb { transform: scale(1.06); }
.range::-moz-range-track { height: 20px; border-radius: 10px; background: var(--track, #3a3a3e); }
.range::-moz-range-progress { height: 20px; border-radius: 10px; background: var(--accent); }
.range::-moz-range-thumb {
  width: 56px; height: 56px; border-radius: 50%; border: 0;
  background: var(--thumb);
}
.range--light { --track: var(--primary-soft); --thumb-ring: #fff; }

/* ---------------------------------------------------------------- summary & panels */

.summary {
  background: var(--summary); border-radius: var(--r-card); padding: 4px 16px;
}
.summary__row { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; padding: 12px 0; border-bottom: 1px solid var(--line); }
.summary__row:last-child { border-bottom: 0; }
.summary__label { color: var(--muted); font-size: 15px; }
.summary__value { font-weight: 500; text-align: right; }
.summary__row--big .summary__value { font-size: clamp(21px, 6.4vw, 26px); font-weight: 600; letter-spacing: -.4px; }

.panel { border: 1px solid var(--line); border-radius: var(--r-card); padding: 16px; background: #fff; }
.panel__title { display: flex; align-items: center; gap: 10px; font-size: 17px; font-weight: 600; margin-bottom: 8px; }
.panel__title svg { width: 20px; height: 20px; color: var(--primary); }
.detail { display: flex; justify-content: space-between; gap: 12px; padding: 9px 0; border-bottom: 1px solid var(--line); font-size: 15px; }
.detail:last-of-type { border-bottom: 0; }
.detail__label { color: var(--muted); flex: 0 0 44%; }
.detail__value { text-align: right; word-break: break-word; }

.text-muted { color: var(--muted); }
.text-small { font-size: 15px; }
.text-error { color: var(--danger); font-size: 15px; }
h2.title { font-size: clamp(21px, 6.2vw, 24px); font-weight: 600; letter-spacing: -.3px; line-height: 1.25; }
h3.subtitle { font-size: 17px; font-weight: 600; }

.doc-row {
  display: flex; align-items: center; gap: 12px; width: 100%;
  padding: 14px 0; border: 0; border-bottom: 1px solid var(--line);
  background: transparent; text-align: left; font-size: 15px;
}
.doc-row svg { width: 20px; height: 20px; color: var(--muted); flex: none; }
.doc-row span { flex: 1; }

/* ---------------------------------------------------------------- forms */

.check {
  display: flex; gap: 12px; align-items: flex-start; padding: 10px 0; cursor: pointer;
}
.check input { position: absolute; opacity: 0; width: 0; height: 0; }
.check__box {
  flex: none; width: 24px; height: 24px; border-radius: 6px; margin-top: 2px;
  border: 1.5px solid var(--control-border); background: #fff;
  display: grid; place-items: center; transition: background 120ms ease, border-color 120ms ease;
}
.check__box svg { width: 16px; height: 16px; color: #fff; opacity: 0; }
.check input:checked + .check__box { background: var(--primary); border-color: var(--primary); }
.check input:checked + .check__box svg { opacity: 1; }
.check input:focus-visible + .check__box { outline: 2px solid var(--accent); outline-offset: 2px; }
.check--error .check__box { border-color: var(--danger); }
.check__label { font-size: 15px; line-height: 1.45; }

.field { display: flex; flex-direction: column; gap: 6px; }
/* банковская плашка: подпись внутри, без рамки, фокус — белый фон и тонкий контур */
.field__box {
  display: block; position: relative; cursor: text;
  background: #f2f3f5; border-radius: 16px; padding: 10px 16px 11px;
  border: 1.5px solid transparent;
  transition: background 140ms ease, border-color 140ms ease, box-shadow 140ms ease;
}
.field__box:focus-within { background: #fff; border-color: var(--ink); }
.field__box--locked { background: #f7f7f8; cursor: default; }
.field__box--locked .field__input { color: var(--muted); }
.field__box--locked::after {
  content: ""; position: absolute; right: 16px; top: 50%; width: 16px; height: 16px; transform: translateY(-50%);
  background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%235a5a5a' stroke-width='2' stroke-linecap='round'%3E%3Crect x='5' y='11' width='14' height='10' rx='2'/%3E%3Cpath d='M8 11V7a4 4 0 018 0v4'/%3E%3C/svg%3E") center/contain no-repeat;
}
.field__label { display: block; font-size: 13px; font-weight: 400; color: var(--muted); line-height: 1.3; margin-bottom: 2px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.field__box:focus-within .field__label { color: var(--ink); }
.field__input {
  display: block; width: 100%; min-height: 26px; padding: 0; margin: 0;
  border: 0; background: transparent; color: var(--ink); font-size: 17px; line-height: 1.5;
  -webkit-appearance: none; appearance: none; outline: 0;
}
.field__input::placeholder { color: #a8a8ad; }
.field__input:disabled { opacity: 1; -webkit-text-fill-color: var(--muted); }
.field--error .field__box { border-color: var(--danger); background: #fff6f4; }
.field--error .field__label { color: var(--danger); }
.field__help { font-size: 13px; color: var(--muted); padding: 0 16px; }
.field__error { font-size: 13px; color: var(--danger); line-height: 1.35; padding: 0 16px; }
.field__hint { font-size: 13px; color: var(--muted); padding: 0 16px; }

/* телефон: крупная белая плашка, пилюля +7, призрачная маска дозаполняется по мере ввода */
.phone-field {
  display: flex; align-items: center; gap: 10px; cursor: text;
  min-height: 68px; padding: 0 12px 0 14px;
  background: #fff; border: 1.5px solid var(--line); border-radius: 18px;
  box-shadow: 0 1px 2px rgba(0,0,0,.04);
  transition: border-color 140ms ease, box-shadow 140ms ease;
}
.phone-field:focus-within { border-color: var(--ink); box-shadow: 0 8px 24px rgba(0,0,0,.08); }
.field--error .phone-field { border-color: var(--danger); }
.phone-field__prefix { flex: none; font-size: clamp(22px, 7.2vw, 28px); font-weight: 500; color: var(--ink); letter-spacing: .5px; line-height: 36px; padding-left: 6px; }
.phone-field__wrap { position: relative; flex: 1; height: 36px; overflow: hidden; }
.phone-field__ghost, .phone-field__input {
  font-size: clamp(22px, 7.2vw, 28px); font-weight: 500; letter-spacing: .5px; line-height: 36px; white-space: pre;
}
.phone-field__ghost { position: absolute; inset: 0; color: #c4c5ca; pointer-events: none; }
.phone-field__ghost b { color: var(--ink); font-weight: 500; }
.phone-field__input {
  position: absolute; inset: 0; width: 100%; height: 100%;
  border: 0; padding: 0; margin: 0; background: transparent; outline: 0;
  color: transparent; caret-color: var(--ink); -webkit-text-fill-color: transparent;
}
.phone-field__input::selection { background: rgba(255,69,0,.25); }
.field__clear {
  flex: none; width: 26px; height: 26px; border-radius: 50%; border: 0;
  background: #c9cacf; color: #fff; display: grid; place-items: center; padding: 0;
}
.field__clear svg { width: 12px; height: 12px; }
.field__clear[hidden] { display: none; }
.field__clear--inset { position: absolute; right: 14px; top: 50%; transform: translateY(-50%); }
.field__box:has(.field__clear--inset) { padding-right: 48px; }

/* код: отдельные ячейки, ввод идёт в невидимый input поверх */
.otp { position: relative; }
.otp__cells { display: grid; grid-template-columns: repeat(var(--n, 4), 1fr); gap: 10px; }
.otp__cell {
  height: 68px; border-radius: 16px; background: #fff; border: 1.5px solid var(--line);
  box-shadow: 0 1px 2px rgba(0,0,0,.04);
  display: grid; place-items: center; font-size: clamp(24px, 7.6vw, 30px); font-weight: 500;
  transition: border-color 140ms ease, box-shadow 140ms ease;
}
.otp__cell--filled { border-color: var(--control-border); }
.otp__cell--active { border-color: var(--ink); box-shadow: 0 8px 24px rgba(0,0,0,.08); }
.otp__cell--active:empty::after { content: ""; width: 2px; height: 30px; background: var(--ink); animation: blink 1s step-end infinite; }
.otp--error .otp__cell { border-color: var(--danger); background: #fff6f4; }
.otp__input {
  position: absolute; inset: 0; width: 100%; height: 100%; opacity: 0; font-size: 30px;
  border: 0; padding: 0; margin: 0; caret-color: transparent; color: transparent; background: transparent;
}
@keyframes blink { 50% { opacity: 0; } }

/* Правило приёмки: поля в одной строке одинаковой высоты, подписи без переноса. */
.row-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; align-items: stretch; }
.row-2 .field { height: 100%; }
.row-2 .field__box { height: 100%; }

.phone-hero { padding: 8px 0; }
.phone-hero .wordmark { font-size: clamp(28px, 8.5vw, 34px); letter-spacing: 6px; }

/* ---------------------------------------------------------------- journal (анкета) */

.journal {
  background: #fff; border-radius: 6px 18px 18px 6px; position: relative;
  box-shadow: 0 10px 30px rgba(60,40,10,.12), inset 6px 0 0 #e8dcc9;
  padding: 20px 18px 18px 24px; border: 1px solid var(--paper-line);
}
.journal::before {
  content: ""; position: absolute; left: 12px; top: 12px; bottom: 12px; width: 1px;
  background: repeating-linear-gradient(180deg, #c9b99b 0 6px, transparent 6px 12px);
}
.journal__eyebrow { font-size: 11px; font-weight: 600; letter-spacing: 2px; color: var(--muted); }
.journal__title { font-size: 22px; font-weight: 600; letter-spacing: -.25px; margin-top: 2px; }
.journal__subtitle { font-size: 15px; color: var(--muted); margin-bottom: 14px; }
.journal__fields { display: flex; flex-direction: column; gap: 14px; }

.bookmarks { display: flex; gap: 6px; padding: 0 8px; }
.bookmark {
  flex: 1; border: 0; padding: 10px 6px 12px; border-radius: 0 0 10px 10px;
  background: #e8e0d1; color: var(--muted); font-size: 12px; font-weight: 600;
  position: relative; transition: transform 160ms ease, background 160ms ease;
}
.bookmark--done { background: #d7e5db; color: var(--success); }
.bookmark--active { background: var(--action); color: #fff; transform: translateY(4px); }
.bookmark--error { background: #f3d9d5; color: var(--danger); }

/* ---------------------------------------------------------------- card preview */

.card-preview {
  aspect-ratio: 1.586; border-radius: 18px; padding: 18px;
  background: linear-gradient(135deg, #1a1a1d 0%, #2c2c31 60%, #3a2a24 100%);
  color: #fff; display: flex; flex-direction: column; justify-content: space-between;
  box-shadow: 0 18px 36px rgba(0,0,0,.3);
}
.card-preview__eyebrow { font-size: 11px; letter-spacing: 1.5px; color: var(--on-night-muted); font-weight: 600; }
.card-preview__pan { font-size: clamp(18px, 5.6vw, 22px); letter-spacing: clamp(1.5px, .7vw, 3px); font-weight: 500; }
.card-preview__meta { display: flex; justify-content: space-between; gap: 12px; font-size: 13px; }
.card-preview__meta small { display: block; color: var(--on-night-muted); font-size: 10px; letter-spacing: 1px; }
.card-preview__chip { width: 36px; height: 26px; border-radius: 6px; background: linear-gradient(135deg, #e8c27a, #b98a3a); }

/* ---------------------------------------------------------------- dashboard */

.status-card {
  border-radius: var(--r-panel); padding: 20px; background: var(--card-night); color: #fff;
}
.status-card__badge { display: inline-block; font-size: 11px; font-weight: 600; letter-spacing: 1.5px; padding: 4px 10px; border-radius: 999px; background: rgba(255,255,255,.12); }
.status-card__title { font-size: clamp(21px, 6.2vw, 24px); font-weight: 600; letter-spacing: -.3px; margin: 10px 0 4px; }
.status-card__text { color: var(--on-night-muted); font-size: 15px; }
.status-card__grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-top: 16px; }
.status-card__grid small { display: block; color: var(--on-night-muted); font-size: 12px; margin-bottom: 2px; }
.status-card__grid b { font-size: 20px; font-weight: 600; }
.history { list-style: none; margin: 0; padding: 0; }
.history li { padding: 8px 0; border-bottom: 1px solid var(--line); font-size: 15px; color: var(--muted); }
.history li:last-child { border-bottom: 0; }

/* ---------------------------------------------------------------- boot / intro */

.intro { flex: 1; display: grid; place-items: center; background: var(--night); color: #fff; }
.intro__mark { font-family: var(--font-display); font-size: clamp(44px, 14vw, 56px); font-weight: 700; letter-spacing: 10px; }
.intro__mark span { display: inline-block; opacity: 0; animation: letter 320ms ease-out forwards; }
.intro__mark span:nth-child(2) { animation-delay: 140ms; }
.intro__mark span:nth-child(3) { animation-delay: 280ms; }
.intro__mark span:nth-child(4) { animation-delay: 420ms; }
.intro__mark span:nth-child(5) { animation-delay: 560ms; color: var(--accent); }
@keyframes letter { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }

/* ---------------------------------------------------------------- misc */

.toast {
  position: fixed; left: 16px; right: 16px; bottom: calc(16px + var(--sab)); z-index: 50;
  background: var(--card-night); color: #fff; padding: 12px 16px; border-radius: 12px;
  font-size: 15px; box-shadow: 0 10px 30px rgba(0,0,0,.35);
  animation: fade-in 180ms ease-out;
}
.toast--error { background: var(--danger); }
.offline-pill {
  display: inline-flex; align-items: center; gap: 6px; padding: 4px 10px; border-radius: 999px;
  background: #fff3cd; color: #6b4e00; font-size: 12px; font-weight: 600;
}
.offline-pill::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: #d9a400; }
.dialog-backdrop {
  position: fixed; inset: 0; z-index: 40; background: rgba(0,0,0,.45);
  display: grid; place-items: end center; padding: 16px; padding-bottom: calc(16px + var(--sab));
}
.dialog {
  width: 100%; max-width: 420px; background: #fff; border-radius: var(--r-panel); padding: 20px;
  display: flex; flex-direction: column; gap: 12px;
}
.dialog h3 { font-size: 20px; font-weight: 600; }
.dialog p { color: var(--muted); font-size: 15px; }
.doc-text { white-space: pre-wrap; font-size: 15px; line-height: 1.5; }
.doc-frame { flex: 1; width: 100%; height: 100%; min-height: 100%; border: 0; display: block; background: #fff; }
.body--flush { padding: 0; gap: 0; }

@media (min-width: 600px) {
  .app { background: #1a1a1d; }
  .stack, .layer--modal { left: 50%; width: 430px; margin-left: -215px; box-shadow: 0 0 0 1px #2a2a2d; }
}

/* Короткие экраны (iPhone SE / 8): плотнее отступы, чтобы расчёт помещался
 * без лишней прокрутки; размеры шрифтов уже масштабируются через clamp(). */
@media (max-height: 700px) {
  .body { padding-top: 12px; gap: 12px; }
  .calc-hero { padding-bottom: 4px; }
  .calc-card__amount { padding: 16px 18px 12px; }
  .calc-card__term { padding: 14px 18px 2px; }
  .calc-card__summary { padding: 6px 18px 14px; }
  .calc-row { padding: 9px 0; }
  .range { height: 56px; }
  .phone-hero { padding: 8px 0 4px; }
}
@media (max-width: 360px) {
  .body { padding-left: calc(14px + var(--sal)); padding-right: calc(14px + var(--sar)); }
  .topbar__title { font-size: 17px; }
  .btn { font-size: 16px; }
}
