/*
 * Клиентская страница счёта (/i/:token) — в дизайне сайта Tekis Nasiya.
 *
 * Покупатель открывает её по QR-коду или ссылке из SMS, и дальше попадает
 * в анкету кредитной системы, оформленную как сайт. Синяя страница кабинета
 * между ними читалась бы как чужая система на шаге, где человек решает,
 * доверять ли ссылке. Токены — те же, что в tekis_credit/app/assets/
 * stylesheets/site.scss; меняются там — меняются и здесь.
 *
 * Всё ограничено классом .tk-client: кабинеты подключают все файлы стилей
 * разом (stylesheet_link_tag :app), и без области правила задели бы админку.
 */

.tk-client {
  --teal: #0f6e56;
  --teal-dark: #085041;
  --teal-light: #1d9e75;
  --mint: #9fe1cb;
  --amber: #ef9f27;
  --cocoa: #412402;
  --sand: #f4f1ea;
  --paper: #fff;
  --ink: #2c2c2a;
  --ink-soft: #5f5e5a;
  --ink-mute: #888780;
  --line: #d3d1c7;
  --danger: #a32d2d;
  --shadow-sm: 0 1px 2px rgba(65, 36, 2, .06), 0 2px 8px rgba(65, 36, 2, .04);
  --shadow-md: 0 2px 4px rgba(65, 36, 2, .06), 0 12px 32px rgba(65, 36, 2, .08);
  --radius: 14px;
  --radius-lg: 22px;
  --display: "Inter Tight", "Inter", system-ui, -apple-system, "Segoe UI", sans-serif;
  --text: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;

  margin: 0;
  min-height: 100vh;
  background: var(--sand);
  color: var(--ink);
  font-family: var(--text);
  font-size: 17px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

.tk-client *, .tk-client *::before, .tk-client *::after { box-sizing: border-box; }

.tk-client h1 {
  margin: 0 0 8px;
  font-family: var(--display);
  font-weight: 600;
  font-size: clamp(1.6rem, 1.3rem + 1.2vw, 2.1rem);
  letter-spacing: -.022em;
  line-height: 1.1;
  text-wrap: balance;
}

.tk-client p { margin: 0; }
.tk-client .num { font-variant-numeric: tabular-nums; }
.tk-client .muted { color: var(--ink-soft); }
.tk-client .center { text-align: center; }

/* ── Шапка ── */

.tk-client .header {
  position: sticky;
  top: 0;
  z-index: 10;
  border-bottom: 1px solid rgba(65, 36, 2, .06);
  background: rgba(244, 241, 234, .9);
  backdrop-filter: blur(8px);
}

.tk-client .wrap { width: min(100% - 40px, 568px); margin-inline: auto; }

.tk-client .header .wrap {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 64px;
}

.tk-client .brand {
  display: inline-flex;
  align-items: baseline;
  gap: 8px;
  font-family: var(--display);
  font-size: 1.24rem;
  font-weight: 600;
  letter-spacing: -.03em;
  color: var(--ink);
}

/* Знак как на сайте: зелёная точка и два затухающих следа. */
.tk-client .brand__mark {
  width: 11px;
  height: 11px;
  margin-left: 14px;
  border-radius: 50%;
  background: var(--teal);
  align-self: center;
  box-shadow: -7px 0 0 -2px var(--mint), -14px 0 0 -4px var(--line);
}

.tk-client .brand__sub { font-family: var(--text); font-size: .82rem; font-weight: 500; color: var(--ink-mute); letter-spacing: 0; }

.tk-client .lang {
  display: inline-flex;
  padding: 3px;
  border-radius: 999px;
  background: rgba(65, 36, 2, .06);
}

.tk-client .lang a {
  padding: 4px 11px;
  border-radius: 999px;
  font-size: .82rem;
  font-weight: 600;
  color: var(--ink-mute);
  text-decoration: none;
}

.tk-client .lang a[aria-current="true"] { background: var(--paper); color: var(--teal-dark); box-shadow: var(--shadow-sm); }

/* ── Карточка ── */

.tk-client main { padding-block: clamp(24px, 5vw, 48px) 40px; }

.tk-client .card {
  background: var(--paper);
  border-radius: var(--radius-lg);
  padding: clamp(24px, 4vw, 36px);
  box-shadow: var(--shadow-md);
}

.tk-client .badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 5px 12px;
  border-radius: 999px;
  background: rgba(159, 225, 203, .45);
  color: var(--teal-dark);
  font-size: .8rem;
  font-weight: 600;
}

.tk-client .badge::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: var(--teal-light); }

.tk-client .intro { text-align: center; margin-bottom: 22px; }
.tk-client .intro .badge { margin-bottom: 16px; }

/* Магазин: кто выставил счёт — первое, что проверяет осторожный человек. */
.tk-client .shop {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  margin-bottom: 14px;
}

.tk-client .shop__icon {
  flex: none;
  width: 40px;
  height: 40px;
  border-radius: 12px;
  display: grid;
  place-items: center;
  background: var(--mint);
  color: var(--teal-dark);
}

.tk-client .shop__icon svg { width: 20px; height: 20px; stroke: currentColor; fill: none; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }
.tk-client .shop__name { display: block; font-size: .98rem; color: var(--ink); }
.tk-client .shop__place { display: block; font-size: .85rem; color: var(--ink-mute); }

.tk-client .purchase {
  padding: 20px 22px;
  border-radius: var(--radius);
  background: var(--sand);
  margin-bottom: 22px;
}

.tk-client .purchase__item { font-family: var(--display); font-size: 1.12rem; font-weight: 600; }
.tk-client .purchase__qty { font-size: .88rem; color: var(--ink-mute); }

.tk-client .purchase__amount {
  margin-top: 14px;
  font-family: var(--display);
  font-size: clamp(2rem, 1.6rem + 1.4vw, 2.5rem);
  font-weight: 600;
  letter-spacing: -.02em;
  color: var(--teal-dark);
}

.tk-client .purchase__due { margin-top: 4px; font-size: .84rem; color: var(--ink-mute); }

/* ── Кнопки ── */

.tk-client .actions { display: grid; gap: 10px; }
.tk-client .actions form { margin: 0; }

.tk-client .btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  width: 100%;
  padding: 17px 28px;
  border: 0;
  border-radius: 999px;
  font: 600 1.04rem var(--text);
  text-decoration: none;
  cursor: pointer;
  transition: background .15s, box-shadow .15s, transform .15s;
}

.tk-client .btn--primary { background: var(--teal); color: #fff; box-shadow: 0 8px 20px -10px rgba(15, 110, 86, .7); }
.tk-client .btn--primary:hover { background: var(--teal-dark); }
.tk-client .btn--primary:active { transform: translateY(1px); }

.tk-client .btn--primary::after {
  content: "";
  width: 16px;
  height: 16px;
  background: currentColor;
  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M5 12h14m-6-6 6 6-6 6'/%3E%3C/svg%3E") center / contain no-repeat;
          mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M5 12h14m-6-6 6 6-6 6'/%3E%3C/svg%3E") center / contain no-repeat;
}

/* Оплата целиком ждёт эквайринга: видна, но честно неактивна. */
.tk-client .btn--disabled {
  background: transparent;
  border: 1px solid var(--line);
  color: var(--ink-mute);
  cursor: not-allowed;
}

.tk-client .btn-text {
  border: 0;
  background: none;
  padding: 8px;
  width: 100%;
  font: 500 .92rem var(--text);
  color: var(--ink-mute);
  cursor: pointer;
}

.tk-client .btn-text:hover { color: var(--ink-soft); text-decoration: underline; text-underline-offset: 3px; }

.tk-client .note { margin-top: 14px; font-size: .82rem; color: var(--ink-mute); text-align: center; }

/* ── Закрытый счёт ── */

.tk-client .status-icon {
  width: 64px;
  height: 64px;
  border-radius: 50%;
  display: inline-grid;
  place-items: center;
  margin-bottom: 16px;
  background: var(--sand);
  color: var(--ink-soft);
}

.tk-client .status-icon svg { width: 28px; height: 28px; stroke: currentColor; fill: none; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }

.tk-client .kv { margin: 22px 0 0; border: 1px solid var(--line); border-radius: var(--radius); text-align: left; }
.tk-client .kv > div { display: flex; justify-content: space-between; gap: 16px; padding: 12px 16px; font-size: .95rem; }
.tk-client .kv > div + div { border-top: 1px solid var(--line); }
.tk-client .kv dt { color: var(--ink-soft); }
.tk-client .kv dd { margin: 0; font-weight: 600; text-align: right; }

.tk-client .alert { padding: 14px 18px; border-radius: 12px; margin-bottom: 18px; font-size: .95rem; }
.tk-client .alert--error { background: rgba(163, 45, 45, .08); color: var(--danger); }
.tk-client .alert--ok { background: rgba(29, 158, 117, .12); color: var(--teal-dark); }

.tk-client .footer {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  margin-top: 26px;
  font-size: .85rem;
  color: var(--ink-mute);
}

.tk-client .footer svg { width: 15px; height: 15px; stroke: currentColor; fill: none; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }

.tk-client :focus-visible { outline: 2px solid var(--teal-light); outline-offset: 3px; border-radius: 4px; }
