/* ================================================================
   Univox Mini App — дизайн-система Univox
   ================================================================ */

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

/* ── Univox Design Tokens ── */
:root {
  --bg:         #ffffff;
  --surface:    #f7f8fa;
  --border:     #e8eaed;
  --text:       #111827;
  --muted:      #6b7280;
  --accent:     #22c55e;
  --accent-d:   #16a34a;
  --accent-bg:  #f0fdf4;
  --red:        #ef4444;

  --shadow-card: 0 1px 2px rgba(17,24,39,.04), 0 4px 12px rgba(17,24,39,.06);
  --shadow-btn:  0 1px 2px rgba(34,197,94,.12), 0 2px 6px rgba(34,197,94,.18);
  --shadow-modal: 0 8px 40px rgba(0,0,0,.14);

  --r-sm:   8px;
  --r-md:   10px;
  --r-lg:   16px;
  --r-xl:   20px;
  --r-pill: 99px;

  --pay-h: 76px;
}

html, body {
  font-family: 'Manrope', system-ui, sans-serif;
  background: var(--bg);
  color: var(--text);
  font-size: 15px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  min-height: 100%;
}

/* ── Страница ── */
.page {
  max-width: 480px;
  margin: 0 auto;
  padding: 20px 16px calc(var(--pay-h) + 24px);
}

.hidden { display: none !important; }

/* ── Шапка ── */
.header {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 24px;
}

/* Иконка лого */
.logo-wrap {
  flex-shrink: 0;
  width: 56px;
  height: 56px;
  border-radius: 14px;
  overflow: hidden;
  box-shadow: var(--shadow-card);
}

.logo-img {
  width: 100%;
  height: 100%;
  display: block;
}

.header-text { flex: 1; min-width: 0; }

.header-title {
  font-size: 1.15rem;
  font-weight: 800;
  letter-spacing: -.4px;
  color: var(--text);
}

.header-sub {
  font-size: 0.82rem;
  font-weight: 500;
  color: var(--muted);
  margin-top: 1px;
}

.header-balance {
  display: flex;
  align-items: center;
  gap: 5px;
  background: var(--accent-bg);
  border: 1.5px solid #b6f5cf;
  border-radius: var(--r-pill);
  padding: 5px 11px;
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--accent-d);
  white-space: nowrap;
}

.header-balance i { font-size: 14px; }

/* ── Панели ── */
.pane { margin-bottom: 16px; }

/* ── Калькулятор кредитов ── */
.calc-card {
  background: var(--surface);
  border: 1.5px solid var(--border);
  border-radius: var(--r-lg);
  padding: 18px 16px 20px;
  margin-bottom: 12px;
  box-shadow: var(--shadow-card);
}

.calc-heading {
  font-size: 1.35rem;
  font-weight: 800;
  color: var(--text);
  letter-spacing: -.5px;
  margin-bottom: 6px;
}

.calc-hint {
  display: flex;
  align-items: center;
  gap: 5px;
  font-size: 0.8rem;
  font-weight: 500;
  color: var(--muted);
  margin-bottom: 16px;
}

/* Пресеты */
.preset-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  margin-bottom: 14px;
}

.preset-btn {
  padding: 12px 0;
  background: var(--bg);
  border: 1.5px solid var(--border);
  border-radius: var(--r-pill);
  font-family: 'Manrope', system-ui, sans-serif;
  font-size: 1rem;
  font-weight: 700;
  color: var(--text);
  cursor: pointer;
  transition: border-color .15s, background .15s, box-shadow .15s;
  letter-spacing: -.2px;
}

.preset-btn:active { transform: scale(.96); }

.preset-btn.active {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
  box-shadow: var(--shadow-btn);
}

/* Ввод вручную */
.custom-input-wrap {
  background: var(--bg);
  border: 1.5px solid var(--border);
  border-radius: var(--r-md);
  padding: 10px 14px 12px;
  margin-bottom: 18px;
  transition: border-color .15s, box-shadow .15s;
}

.custom-input-wrap:focus-within {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(34,197,94,.15);
}

.custom-input-label {
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--muted);
  margin-bottom: 4px;
}

.custom-input {
  width: 100%;
  border: none;
  outline: none;
  background: transparent;
  font-family: 'Manrope', system-ui, sans-serif;
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--text);
  appearance: textfield;
  -moz-appearance: textfield;
}

.custom-input::-webkit-outer-spin-button,
.custom-input::-webkit-inner-spin-button { -webkit-appearance: none; }

.custom-input::placeholder { color: var(--border); font-weight: 500; }

/* Слайдер */
.slider-wrap {
  position: relative;
  padding: 0 2px;
}


.credits-slider {
  -webkit-appearance: none;
  display: block;
  width: 100%;
  height: 5px;
  border-radius: 3px;
  background: linear-gradient(
    to right,
    var(--accent) var(--fill, 0%),
    var(--border) var(--fill, 0%)
  );
  outline: none;
  cursor: pointer;
  margin: 0;
}

.credits-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: #fff;
  border: 2.5px solid var(--accent);
  box-shadow: 0 1px 6px rgba(34,197,94,.3);
  cursor: pointer;
  transition: transform .1s;
}

.credits-slider::-webkit-slider-thumb:active { transform: scale(1.2); }

.credits-slider::-moz-range-thumb {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: #fff;
  border: 2.5px solid var(--accent);
  box-shadow: 0 1px 6px rgba(34,197,94,.3);
  cursor: pointer;
}

/* Отметки-тики на треке слайдера */
.slider-ticks {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 5px;    /* ровно высота трека */
  pointer-events: none;
}

.slider-ticks span {
  position: absolute;
  top: 50%;
  width: 2px;
  height: 9px;
  background: rgba(255,255,255,.7);
  border-radius: 1px;
  transform: translate(-50%, -50%);
}

.slider-labels {
  display: flex;
  justify-content: space-between;
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--muted);
  margin-top: 6px;
  margin-bottom: 16px;
}

/* ── Тировый прогресс-бар ── */
.tier-bar {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 5px;
  margin-bottom: 8px;
}

.tier-seg {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 5px;
}

.tier-seg-fill {
  width: 100%;
  height: 6px;
  border-radius: 3px;
  background: var(--border);
  transition: background .2s, height .15s;
}

.tier-seg.passed .tier-seg-fill {
  background: var(--accent);
  opacity: .5;
}

.tier-seg.active .tier-seg-fill {
  background: var(--accent);
  height: 9px;
}

.tier-seg-label {
  font-size: 0.6rem;
  font-weight: 700;
  color: var(--border);
  transition: color .2s;
  white-space: nowrap;
}

.tier-seg.passed .tier-seg-label { color: var(--accent); opacity: .7; }
.tier-seg.active .tier-seg-label { color: var(--accent-d); }

.tier-hint {
  font-size: 0.78rem;
  font-weight: 500;
  color: var(--muted);
  text-align: center;
  min-height: 18px;
  padding-top: 2px;
}

/* ── Итоговая карточка ── */
.summary-card {
  background: var(--accent);
  border: none;
  border-radius: var(--r-lg);
  padding: 20px 18px;
  margin-bottom: 20px;
  box-shadow: 0 4px 20px rgba(34,197,94,.35);
}

.summary-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 10px;
}

.summary-heading {
  font-size: 1.15rem;
  font-weight: 800;
  color: #fff;
  letter-spacing: -.4px;
}

.summary-main {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  margin-bottom: 6px;
}

.summary-credits {
  font-size: 1.2rem;
  font-weight: 800;
  color: #fff;
  letter-spacing: -.4px;
}

.summary-price {
  font-size: 2.2rem;
  font-weight: 800;
  color: #fff;
  letter-spacing: -.6px;
}

.summary-per-cr {
  font-size: 0.85rem;
  font-weight: 600;
  color: rgba(255,255,255,.92);
}

.discount-badge {
  display: inline-flex;
  align-items: center;
  background: rgba(255,255,255,.25);
  color: #fff;
  font-size: 0.75rem;
  font-weight: 800;
  padding: 3px 10px;
  border-radius: var(--r-pill);
  letter-spacing: .02em;
}

/* ── Карточка покупки ── */
.purchase-card {
  background: var(--surface);
  border: 1.5px solid var(--border);
  border-radius: var(--r-lg);
  padding: 16px;
  margin-bottom: 16px;
  box-shadow: var(--shadow-card);
}

.purchase-row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 12px;
}

.purchase-type {
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: .05em;
  margin-bottom: 3px;
}

.purchase-desc {
  font-size: 1rem;
  font-weight: 700;
  color: var(--text);
  letter-spacing: -.3px;
}

.purchase-price {
  font-size: 1.6rem;
  font-weight: 800;
  color: var(--accent-d);
  letter-spacing: -.5px;
  white-space: nowrap;
  flex-shrink: 0;
}

.divider {
  height: 1px;
  background: var(--border);
  margin-bottom: 12px;
}


/* ── Заголовок секции ── */
.section-heading {
  font-size: 1.2rem;
  font-weight: 800;
  color: var(--text);
  letter-spacing: -.4px;
  margin-bottom: 10px;
}

/* ── Способы оплаты (2-колоночная сетка) ── */
.payment-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-bottom: 16px;
}

.pay-method {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  padding: 18px 10px 16px;
  border: 2px solid transparent;
  border-radius: var(--r-lg);
  cursor: pointer;
  font-family: 'Manrope', system-ui, sans-serif;
  text-align: center;
  transition: border-color .15s, background .15s, box-shadow .15s;
}

.pay-method:active { transform: scale(.97); }

/* Галочка в углу активной карточки */
.pay-method.active::after {
  content: '✓';
  position: absolute;
  top: 8px;
  right: 8px;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  font-size: 12px;
  font-weight: 800;
  color: #fff;
  text-align: center;
  line-height: 20px;
}

/* Карта */
#method-card {
  background: #eff6ff;
}
#method-card.active {
  background: #dbeafe;
  border-color: #3b82f6;
  box-shadow: 0 0 0 3px rgba(59,130,246,.12);
}
#method-card.active::after {
  background: #3b82f6;
}

/* Stars */
#method-stars {
  background: #fffbeb;
}
#method-stars.active {
  background: #fef3c7;
  border-color: #d97706;
  box-shadow: 0 0 0 3px rgba(217,119,6,.12);
}
#method-stars.active::after {
  background: #d97706;
}

.method-icon-wrap {
  width: 54px;
  height: 54px;
  border-radius: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 26px;
  color: #fff;
  flex-shrink: 0;
}

.card-gradient  { background: linear-gradient(135deg, #1d4ed8, #3b82f6); }
.stars-gradient { background: linear-gradient(135deg, #d97706, #fbbf24); }

.method-svg-icon {
  width: 28px;
  height: 28px;
  display: block;
}

.pay-method-name {
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--text);
  line-height: 1.2;
}

.pay-method-sub {
  font-size: 0.75rem;
  font-weight: 500;
  color: var(--muted);
  margin-top: -4px;
}

/* ── Согласие ── */
.agree-row {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  cursor: pointer;
  user-select: none;
  padding: 2px 0;
}

.agree-box {
  width: 20px;
  height: 20px;
  border-radius: 6px;
  border: 1.5px solid var(--border);
  background: var(--surface);
  flex-shrink: 0;
  margin-top: 1px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: border-color .15s, background .15s;
}

.agree-box.checked {
  background: var(--accent);
  border-color: var(--accent);
}

.agree-check {
  color: #fff;
  font-size: 12px;
  font-weight: 800;
}

.agree-text {
  font-size: 0.82rem;
  font-weight: 500;
  color: var(--muted);
  line-height: 1.55;
}

.link {
  color: var(--accent-d);
  font-weight: 600;
}

/* ── Кнопка оплаты ── */
.pay-footer {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  padding: 12px 16px calc(12px + env(safe-area-inset-bottom));
  background: linear-gradient(to top, #fff 65%, transparent);
  z-index: 50;
}

.btn-pay {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  max-width: 480px;
  margin: 0 auto;
  padding: 14px;
  background: var(--accent);
  color: #fff;
  border: none;
  border-radius: var(--r-pill);
  font-family: 'Manrope', system-ui, sans-serif;
  font-size: 0.95rem;
  font-weight: 800;
  letter-spacing: .04em;
  cursor: pointer;
  box-shadow: var(--shadow-btn);
  transition: background .15s, transform .1s, opacity .15s;
}

.btn-pay:hover:not(:disabled) { background: var(--accent-d); }
.btn-pay:active:not(:disabled) { transform: scale(.98); }

.btn-pay:disabled {
  background: var(--border);
  color: var(--muted);
  box-shadow: none;
  cursor: not-allowed;
}

.btn-pay i { font-size: 17px; }

/* ── Модальное окно ── */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(17,24,39,.45);
  display: flex;
  align-items: flex-end;
  z-index: 200;
  animation: fade-in .2s ease;
}

@keyframes fade-in {
  from { opacity: 0; }
  to   { opacity: 1; }
}

.modal {
  position: relative;
  background: var(--bg);
  border-radius: var(--r-xl) var(--r-xl) 0 0;
  padding: 32px 20px calc(28px + env(safe-area-inset-bottom));
  width: 100%;
  text-align: center;
  box-shadow: var(--shadow-modal);
  animation: slide-up .25s ease;
}

@keyframes slide-up {
  from { transform: translateY(40px); opacity: 0; }
  to   { transform: translateY(0);    opacity: 1; }
}

.modal-close-btn {
  position: absolute;
  top: 14px;
  right: 14px;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  border: none;
  background: var(--surface);
  color: var(--muted);
  font-size: 15px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background .15s;
}

.modal-close-btn:hover { background: var(--border); }

.modal-icon  { font-size: 48px; margin-bottom: 14px; }
.modal-title {
  font-size: 1.2rem;
  font-weight: 800;
  letter-spacing: -.4px;
  margin-bottom: 8px;
}
.modal-body  {
  font-size: 0.92rem;
  color: var(--muted);
  font-weight: 500;
  line-height: 1.6;
  margin-bottom: 22px;
}
